( items: unknown[], context: LargeArrayManifestWriteOptions )
| 119 | } |
| 120 | |
| 121 | async function storeArrayChunks( |
| 122 | items: unknown[], |
| 123 | context: LargeArrayManifestWriteOptions |
| 124 | ): Promise<LargeArrayManifestChunk[]> { |
| 125 | const targetBytes = Math.max( |
| 126 | 2, |
| 127 | Math.min( |
| 128 | context.chunkTargetBytes ?? LARGE_ARRAY_MANIFEST_CHUNK_TARGET_BYTES, |
| 129 | MAX_INLINE_MATERIALIZATION_BYTES |
| 130 | ) |
| 131 | ) |
| 132 | const chunks = chunkArrayItems(items, targetBytes) |
| 133 | const storedChunks: LargeArrayManifestChunk[] = [] |
| 134 | for (const chunk of chunks) { |
| 135 | storedChunks.push(await storeArrayChunk(chunk, context)) |
| 136 | } |
| 137 | return storedChunks |
| 138 | } |
| 139 | |
| 140 | function assertLargeArrayManifest(value: LargeArrayManifest): void { |
| 141 | if (!isLargeArrayManifest(value)) { |
no test coverage detected