(root: string)
| 84 | } |
| 85 | |
| 86 | async function readStateRootComposition(root: string): Promise<StateRootCompositionRecord> { |
| 87 | return withCompositionIoFailure(async () => { |
| 88 | const contents = await readBoundedMarkerFile({ |
| 89 | path: join(root, STATE_ROOT_COMPOSITION_FILE), |
| 90 | maxBytes: MAX_STATE_ROOT_COMPOSITION_BYTES, |
| 91 | invalidFile, |
| 92 | }); |
| 93 | let value: unknown; |
| 94 | try { |
| 95 | value = JSON.parse(contents) as unknown; |
| 96 | } catch (error) { |
| 97 | throw invalidFile(error); |
| 98 | } |
| 99 | if (!isExactCompositionRecord(value)) throw invalidFile(); |
| 100 | requireCompositionId(value.compositionId); |
| 101 | return value; |
| 102 | }); |
| 103 | } |
| 104 | |
| 105 | function assertMatchingComposition( |
| 106 | record: StateRootCompositionRecord, |
no test coverage detected