tabulark 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -2
- package/README.md +125 -42
- package/dist/client.d.ts +71 -2
- package/dist/errors.d.ts +7 -1
- package/dist/experimental.js +1 -1
- package/dist/experimental.js.map +2 -2
- package/dist/http.d.ts +65 -0
- package/dist/http.js +2 -0
- package/dist/http.js.map +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +4 -4
- package/dist/model.d.ts +6 -3
- package/dist/protocol.d.ts +3 -3
- package/dist/range-cache.d.ts +24 -5
- package/dist/range-source.d.ts +64 -0
- package/dist/rpc-client.d.ts +15 -2
- package/dist/source.d.ts +13 -0
- package/dist/view/canvas-table-view-public.d.ts +6 -0
- package/dist/view/canvas-table-view.d.ts +8 -0
- package/dist/wasm/arrow/tabulark_arrow.d.ts +33 -6
- package/dist/wasm/arrow/tabulark_arrow.js +129 -17
- package/dist/wasm/arrow/tabulark_arrow_bg.wasm +0 -0
- package/dist/wasm/arrow/tabulark_arrow_bg.wasm.d.ts +6 -1
- package/dist/wasm/delimited/tabulark_delimited.d.ts +31 -5
- package/dist/wasm/delimited/tabulark_delimited.js +115 -8
- package/dist/wasm/delimited/tabulark_delimited_bg.wasm +0 -0
- package/dist/wasm/delimited/tabulark_delimited_bg.wasm.d.ts +6 -1
- package/dist/wasm/excel/tabulark_excel.d.ts +33 -8
- package/dist/wasm/excel/tabulark_excel.js +129 -19
- package/dist/wasm/excel/tabulark_excel_bg.wasm +0 -0
- package/dist/wasm/excel/tabulark_excel_bg.wasm.d.ts +6 -1
- package/dist/wasm/parquet/tabulark_parquet.d.ts +31 -6
- package/dist/wasm/parquet/tabulark_parquet.js +135 -17
- package/dist/wasm/parquet/tabulark_parquet_bg.wasm +0 -0
- package/dist/wasm/parquet/tabulark_parquet_bg.wasm.d.ts +6 -1
- package/dist/worker/blob-source-accessor.d.ts +10 -0
- package/dist/worker/source-accessor.d.ts +76 -0
- package/dist/worker/wasm-adapter.d.ts +39 -38
- package/dist/worker-range-source.d.ts +1 -0
- package/dist/worker-range-source.js +2 -0
- package/dist/worker-range-source.js.map +7 -0
- package/dist/worker.js +1 -1
- package/dist/worker.js.map +4 -4
- package/package.json +8 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../js/errors.ts", "../js/worker/worker-errors.ts", "../js/worker/source-accessor.ts"],
|
|
4
|
+
"sourcesContent": ["import type { SerializedError } from \"./protocol.js\";\n\nexport type TabularkErrorCode =\n | \"INVALID_ARGUMENT\"\n | \"INVALID_RANGE\"\n | \"RANGE_NOT_INDEXED\"\n | \"RESOURCE_LIMIT\"\n | \"CANCELLED\"\n | \"HANDLE_CLOSED\"\n | \"PROTOCOL_INCOMPATIBLE\"\n | \"PARSE_FAILED\"\n | \"UNSUPPORTED_FEATURE\"\n | \"UNSUPPORTED_RUNTIME\"\n | \"RUNTIME_FAILURE\"\n /** A remote/source provider could not be reached or did not return bytes. */\n | \"SOURCE_UNAVAILABLE\"\n /** The provider validator or total length changed while a reader was open. */\n | \"SOURCE_CHANGED\"\n /** The provider did not honor the required single-range protocol. */\n | \"RANGE_UNSUPPORTED\"\n | (string & {});\n\n/** A stable, serializable error returned by Tabulark. */\nexport class TabularkError extends Error {\n readonly code: TabularkErrorCode;\n readonly retryable: boolean;\n readonly details?: unknown;\n\n constructor(\n code: TabularkErrorCode,\n message: string,\n options: { retryable?: boolean; details?: unknown; cause?: unknown } = {},\n ) {\n super(message, { cause: options.cause });\n this.name = \"TabularkError\";\n this.code = code;\n this.retryable = options.retryable ?? false;\n this.details = code === \"RESOURCE_LIMIT\"\n ? normalizeResourceLimitDetails(options.details)\n : options.details;\n }\n\n static fromSerialized(error: SerializedError): TabularkError {\n return new TabularkError(error.code, error.message, {\n retryable: error.retryable,\n details: error.details,\n });\n }\n}\n\n/** @internal Ensures every resource-limit error has a stable capacity shape. */\nexport function normalizeResourceLimitDetails(details: unknown): Readonly<Record<string, unknown>> {\n const raw = isRecord(details) ? details : {};\n const resource = typeof raw.resource === \"string\" && raw.resource.length > 0\n ? raw.resource\n : typeof raw.resourceCategory === \"string\" && raw.resourceCategory.length > 0\n ? raw.resourceCategory\n : inferResource(raw);\n if (isQuantity(raw.requiredBytes) && isQuantity(raw.availableBytes)) {\n return Object.freeze({ ...raw, resource });\n }\n if (isQuantity(raw.required) && isQuantity(raw.available)) {\n return Object.freeze({ ...raw, resource });\n }\n\n const byteLimit = firstQuantity(raw, [\n \"maxDecodedBytes\",\n \"maxOutputBytes\",\n \"maxMetadataBytes\",\n \"maxBlockBytes\",\n \"maxDisplayCellBytes\",\n \"maxDisplayBytes\",\n \"maxSourceBytes\",\n \"maxFieldBytes\",\n \"maxBatchBytes\",\n \"maxOperationBytes\",\n \"maxZipEntryBytes\",\n \"maxZipUncompressedBytes\",\n \"maxCfbStreamBytes\",\n ]);\n if (byteLimit !== undefined) {\n const requiredBytes = firstQuantity(raw, [\n \"decodedBytes\",\n \"outputBytes\",\n \"metadataBytes\",\n \"blockBytes\",\n \"displayCellBytes\",\n \"displayBytes\",\n \"sourceBytes\",\n \"fieldBytes\",\n \"batchBytes\",\n \"operationBytes\",\n ]) ?? byteLimit + 1;\n return Object.freeze({\n ...raw,\n resource,\n requiredBytes,\n availableBytes: byteLimit,\n });\n }\n\n const available = firstQuantity(raw, [\n \"limit\",\n \"maxCells\",\n \"maxRangeCells\",\n \"maxSources\",\n \"maxActiveRanges\",\n \"maxRangeWaiters\",\n \"maxColumns\",\n \"maxFields\",\n \"maxNestingDepth\",\n \"maxWorksheetRows\",\n \"maxWorksheetColumns\",\n \"maxStyles\",\n \"maxMergedRegions\",\n ]) ?? 0;\n const required = firstQuantity(raw, [\n \"cells\",\n \"cellCount\",\n \"visibleCellCount\",\n \"sources\",\n \"activeRanges\",\n \"rangeWaiters\",\n \"columns\",\n \"fields\",\n \"nestingDepth\",\n \"worksheetRows\",\n \"worksheetColumns\",\n \"styles\",\n \"mergedRegions\",\n ]) ?? available + 1;\n return Object.freeze({ ...raw, resource, required, available });\n}\n\nfunction inferResource(details: Record<string, unknown>): string {\n const keys = Object.keys(details).join(\" \").toLowerCase();\n if (keys.includes(\"source\")) return keys.includes(\"byte\") ? \"source-staging\" : \"source-slots\";\n if (keys.includes(\"metadata\")) return \"metadata\";\n if (keys.includes(\"decoded\") || keys.includes(\"decompress\")) return \"decompression\";\n if (keys.includes(\"display\")) return \"display-values\";\n if (keys.includes(\"field\")) return \"field\";\n if (keys.includes(\"batch\")) return \"batch\";\n if (keys.includes(\"range\") || keys.includes(\"cell\")) return \"range-cells\";\n if (keys.includes(\"column\")) return \"columns\";\n if (keys.includes(\"nest\")) return \"descriptor-nesting\";\n if (keys.includes(\"worksheet\")) return \"worksheet-dimensions\";\n return \"adapter-resource\";\n}\n\nfunction firstQuantity(\n details: Record<string, unknown>,\n names: readonly string[],\n): number | undefined {\n for (const name of names) {\n if (isQuantity(details[name])) return details[name] as number;\n }\n return undefined;\n}\n\nfunction isQuantity(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nexport function cancelledError(): TabularkError {\n return new TabularkError(\"CANCELLED\", \"The operation was cancelled\");\n}\n\nexport function closedError(resource: string): TabularkError {\n return new TabularkError(\"HANDLE_CLOSED\", `${resource} is closed`);\n}\n\nexport function invalidArgument(message: string, details?: unknown): TabularkError {\n return new TabularkError(\"INVALID_ARGUMENT\", message, { details });\n}\n", "import type { SerializedError } from \"../protocol.js\";\nimport { isRecord } from \"../protocol.js\";\nimport { normalizeResourceLimitDetails } from \"../errors.js\";\n\nexport class ProtocolFault extends Error {\n readonly code: string;\n readonly retryable: boolean;\n readonly details?: unknown;\n\n constructor(\n code: string,\n message: string,\n retryable = false,\n details?: unknown,\n cause?: unknown,\n ) {\n super(message, { cause });\n this.name = \"ProtocolFault\";\n this.code = code;\n this.retryable = retryable;\n this.details = code === \"RESOURCE_LIMIT\"\n ? normalizeResourceLimitDetails(details)\n : details;\n }\n}\n\nexport function faultFromUnknown(error: unknown, fallback: string): ProtocolFault {\n if (error instanceof ProtocolFault) {\n return error;\n }\n if (isRecord(error)) {\n return new ProtocolFault(\n typeof error.code === \"string\" ? error.code : \"RUNTIME_FAILURE\",\n typeof error.message === \"string\" ? error.message : fallback,\n error.retryable === true,\n error.details,\n error,\n );\n }\n if (error instanceof Error) {\n return new ProtocolFault(\"RUNTIME_FAILURE\", error.message || fallback, false, undefined, error);\n }\n return new ProtocolFault(\"RUNTIME_FAILURE\", fallback, false, { value: String(error) });\n}\n\nexport function serializeFault(error: unknown, fallback: string): SerializedError {\n const fault = faultFromUnknown(error, fallback);\n const details = fault.code === \"RESOURCE_LIMIT\"\n ? normalizeResourceLimitDetails(fault.details)\n : fault.details;\n return {\n code: fault.code,\n message: fault.message,\n retryable: fault.retryable,\n ...(details === undefined\n ? {}\n : { details: normalizeFaultDetails(fault.code, details) }),\n };\n}\n\n/**\n * Keep legacy Rust adapter diagnostics legible while the v2 adapters converge\n * on the public resource vocabulary. Counts intentionally remain `required` /\n * `available`; byte reservations use the explicit `*Bytes` names.\n */\nfunction normalizeFaultDetails(code: string, details: unknown): unknown {\n if (code !== \"RESOURCE_LIMIT\" || !isRecord(details)) {\n return details;\n }\n const resource = typeof details.resource === \"string\"\n ? details.resource\n : typeof details.resourceCategory === \"string\"\n ? details.resourceCategory\n : undefined;\n if (resource === undefined || details.resource === resource) {\n return details;\n }\n const { resourceCategory: _legacyResourceCategory, ...rest } = details;\n return { ...rest, resource };\n}\n", "import { ProtocolFault } from \"./worker-errors.js\";\nimport { MAX_RANGE_SOURCE_BYTES } from \"../range-source.js\";\n\n/** The largest source address representable by the wasm32 adapter boundary. */\nexport { MAX_RANGE_SOURCE_BYTES };\n\n/** A cancellation hook understood by the worker source broker. */\nexport interface SourceReadOptions {\n /** Resolves when the owning operation is cancelled. */\n readonly cancellation?: Promise<void>;\n /** Records one actual provider/Blob read after exact-length validation. */\n readonly onProviderRead?: (bytes: number) => void;\n /** Records bytes served without another provider read. */\n readonly onCacheHit?: (bytes: number) => void;\n /** Internal lifetime hook fired when the underlying read settles. */\n readonly onSettled?: () => void;\n}\n\nexport interface SourceAccessor {\n readonly kind: \"blob\" | \"range\";\n readonly size: number;\n read(offset: number, length: number, options?: SourceReadOptions): Promise<ArrayBuffer>;\n readMany?(\n requests: readonly Readonly<{ readonly offset: number; readonly end: number }>[],\n options?: SourceReadOptions,\n ): Promise<readonly ArrayBuffer[]>;\n /** Releases provider state and all retained range bytes. Idempotent. */\n close(): void;\n}\n\ninterface BrokerSourceDescriptor {\n readonly kind: \"range\";\n readonly handle: string;\n readonly size: number;\n readonly maxConcurrency?: number;\n}\n\ninterface SourceReadRequest {\n readonly type: \"source-read\";\n readonly requestId: string;\n readonly sourceHandle: string;\n readonly offset: number;\n readonly length: number;\n}\n\ninterface PendingBrokerRead {\n readonly requestId: string;\n readonly sourceHandle: string;\n readonly offset: number;\n readonly length: number;\n readonly resolve: (value: ArrayBuffer) => void;\n readonly reject: (reason: unknown) => void;\n}\n\ninterface CachedRange {\n readonly offset: number;\n readonly end: number;\n readonly bytes: ArrayBuffer;\n lastUsed: number;\n}\n\ninterface PendingRange {\n readonly offset: number;\n readonly end: number;\n promise: Promise<RangeCoverage>;\n readonly cancellation: RequestCancellation;\n waiters: number;\n settled: boolean;\n coverage?: RangeCoverage;\n}\n\ninterface RangeCoverage {\n readonly offset: number;\n readonly end: number;\n readonly bytes: ArrayBuffer;\n}\n\ninterface RequestCancellation {\n readonly promise: Promise<void>;\n readonly resolve: () => void;\n}\n\ninterface ProviderPermitWaiter {\n readonly resolve: (release: () => void) => void;\n readonly reject: (error: unknown) => void;\n readonly cancellation: Promise<void>;\n cancelled: boolean;\n granted: boolean;\n}\n\ninterface ReadInterval {\n readonly offset: number;\n readonly end: number;\n}\n\n/**\n * The host-side half of the private Worker source broker.\n *\n * The host never gives callbacks to the Worker. It receives a small request\n * DTO and sends back one transferable buffer, which keeps network/fetch state\n * and credentials entirely on the main thread.\n */\nexport class WorkerSourceBroker {\n readonly #scope: DedicatedWorkerGlobalScope;\n readonly #pending = new Map<string, PendingBrokerRead>();\n #nextRequestId = 1;\n #closed = false;\n\n constructor(scope: DedicatedWorkerGlobalScope) {\n this.#scope = scope;\n }\n\n request(\n sourceHandle: string,\n offset: number,\n length: number,\n options: SourceReadOptions = {},\n ): Promise<ArrayBuffer> {\n if (typeof sourceHandle !== \"string\" || sourceHandle.length === 0\n || !Number.isSafeInteger(offset) || offset < 0\n || !Number.isSafeInteger(length) || length < 0\n || offset > MAX_RANGE_SOURCE_BYTES\n || length > MAX_RANGE_SOURCE_BYTES\n || offset + length > MAX_RANGE_SOURCE_BYTES) {\n return Promise.reject(new ProtocolFault(\"RANGE_UNSUPPORTED\", \"The source range is invalid\"));\n }\n if (this.#closed) {\n return Promise.reject(new ProtocolFault(\"HANDLE_CLOSED\", \"The source broker is closed\"));\n }\n const requestId = `s${this.#nextRequestId++}`;\n return new Promise<ArrayBuffer>((resolve, reject) => {\n const pending: PendingBrokerRead = {\n requestId,\n sourceHandle,\n offset,\n length,\n resolve,\n reject,\n };\n this.#pending.set(requestId, pending);\n let cancelled = false;\n const cancel = (): void => {\n if (cancelled || this.#pending.get(requestId) !== pending) return;\n cancelled = true;\n this.#pending.delete(requestId);\n this.#postCancel(requestId, sourceHandle);\n reject(new ProtocolFault(\"CANCELLED\", \"The source read was cancelled\"));\n };\n if (options.cancellation) {\n options.cancellation.then(cancel, cancel);\n }\n try {\n const message: SourceReadRequest = {\n type: \"source-read\",\n requestId,\n sourceHandle,\n offset,\n length,\n };\n this.#scope.postMessage(message);\n } catch (error) {\n this.#pending.delete(requestId);\n reject(new ProtocolFault(\n \"SOURCE_UNAVAILABLE\",\n \"The source provider could not receive a range request\",\n true,\n undefined,\n error,\n ));\n }\n });\n }\n\n /** Handles a message delivered from the main-thread broker. */\n handle(value: unknown): boolean {\n if (!isRecord(value) || (\n value.type !== \"source-read-result\"\n && value.type !== \"source-read-failure\"\n && value.type !== \"source-read-error\"\n )) {\n return false;\n }\n if (typeof value.requestId !== \"string\") return true;\n const pending = this.#pending.get(value.requestId);\n if (!pending) return true;\n this.#pending.delete(value.requestId);\n if (\n value.sourceHandle !== pending.sourceHandle\n || value.offset !== pending.offset\n || value.length !== pending.length\n ) {\n this.#postCancel(pending.requestId, pending.sourceHandle);\n pending.reject(new ProtocolFault(\n \"PROTOCOL_INCOMPATIBLE\",\n \"The source provider returned a range for another request\",\n ));\n return true;\n }\n if (value.type !== \"source-read-result\" || value.error !== undefined || value.ok === false) {\n pending.reject(sourceFailure(value.error));\n return true;\n }\n try {\n pending.resolve(normalizeExactBytes(value.buffer, pending.length));\n } catch (error) {\n pending.reject(error instanceof ProtocolFault\n ? error\n : new ProtocolFault(\"RUNTIME_FAILURE\", \"The source provider returned invalid bytes\", false, undefined, error));\n }\n return true;\n }\n\n close(sourceHandle: string): void {\n for (const [requestId, pending] of this.#pending) {\n if (pending.sourceHandle !== sourceHandle) continue;\n this.#pending.delete(requestId);\n this.#postCancel(requestId, sourceHandle);\n pending.reject(new ProtocolFault(\"HANDLE_CLOSED\", \"The source was closed\"));\n }\n if (this.#closed) return;\n try {\n this.#scope.postMessage({ type: \"source-close\", sourceHandle });\n } catch {\n // Closing a failed Worker is best effort.\n }\n }\n\n shutdown(): void {\n if (this.#closed) return;\n this.#closed = true;\n for (const pending of this.#pending.values()) {\n this.#postCancel(pending.requestId, pending.sourceHandle);\n pending.reject(new ProtocolFault(\"HANDLE_CLOSED\", \"The source broker was shut down\"));\n }\n this.#pending.clear();\n }\n\n #postCancel(requestId: string, sourceHandle: string): void {\n try {\n this.#scope.postMessage({\n type: \"source-read-cancel\",\n requestId,\n sourceHandle,\n });\n } catch {\n // The Worker may already be terminating; the local rejection remains\n // authoritative and prevents a late provider response from being used.\n }\n }\n}\n\n/** A local Blob/File accessor. Blob.slice remains the only source operation. */\nexport class BlobSourceAccessor implements SourceAccessor {\n readonly kind = \"blob\" as const;\n readonly size: number;\n readonly #blob: Blob;\n #closed = false;\n\n constructor(blob: Blob) {\n this.#blob = blob;\n this.size = blob.size;\n }\n\n async read(offset: number, length: number, options: SourceReadOptions = {}): Promise<ArrayBuffer> {\n if (this.#closed) {\n options.onSettled?.();\n throw new ProtocolFault(\"HANDLE_CLOSED\", \"The source is closed\");\n }\n const end = checkedEnd(offset, length, this.size);\n if (end === undefined) {\n options.onSettled?.();\n throw new ProtocolFault(\"RANGE_UNSUPPORTED\", \"The requested source range is outside the source\");\n }\n let bounded: Blob;\n try {\n bounded = this.#blob.slice(offset, end);\n if (!bounded || (bounded.size !== undefined && bounded.size !== length)) {\n throw new ProtocolFault(\"RUNTIME_FAILURE\", \"Blob slice returned an invalid bounded length\");\n }\n } catch (error) {\n options.onSettled?.();\n throw error instanceof ProtocolFault\n ? error\n : new ProtocolFault(\"SOURCE_UNAVAILABLE\", \"The local source could not be sliced\", true, undefined, error);\n }\n const operation = readBlob(bounded, length).finally(() => options.onSettled?.());\n const result = options.cancellation === undefined\n ? await operation\n : await raceCancellation(operation, options.cancellation);\n options.onProviderRead?.(result.byteLength);\n return result;\n }\n\n close(): void {\n this.#closed = true;\n }\n}\n\n/**\n * A remote range accessor. The interval cache is deliberately scoped to this\n * accessor, which is one reader/dataset, so closing the dataset drops all\n * retained bytes and pending singleflight state.\n */\nexport class RangeSourceAccessor implements SourceAccessor {\n readonly kind = \"range\" as const;\n readonly size: number;\n readonly #broker: WorkerSourceBroker;\n readonly #sourceHandle: string;\n readonly #maxCacheBytes: number;\n readonly #maxReadBytes: number;\n readonly #maxConcurrency: number;\n readonly #cache: CachedRange[] = [];\n readonly #inflight: PendingRange[] = [];\n readonly #providerQueue: ProviderPermitWaiter[] = [];\n #providerReads = 0;\n #cacheBytes = 0;\n #clock = 0;\n #closed = false;\n\n constructor(\n descriptor: BrokerSourceDescriptor,\n broker: WorkerSourceBroker,\n maxCacheBytes: number,\n maxReadBytes: number,\n ) {\n validateRangeDescriptor(descriptor);\n this.size = descriptor.size;\n this.#sourceHandle = descriptor.handle;\n this.#broker = broker;\n this.#maxConcurrency = descriptor.maxConcurrency === undefined\n ? 1\n : descriptor.maxConcurrency;\n this.#maxCacheBytes = Number.isSafeInteger(maxCacheBytes) && maxCacheBytes > 0\n ? maxCacheBytes\n : 0;\n this.#maxReadBytes = Number.isSafeInteger(maxReadBytes) && maxReadBytes > 0\n ? maxReadBytes\n : 1;\n }\n\n async read(offset: number, length: number, options: SourceReadOptions = {}): Promise<ArrayBuffer> {\n try {\n return await this.#readInternal(offset, length, options);\n } finally {\n options.onSettled?.();\n }\n }\n\n async #readInternal(offset: number, length: number, options: SourceReadOptions = {}): Promise<ArrayBuffer> {\n const end = checkedEnd(offset, length, this.size);\n if (end === undefined) {\n throw new ProtocolFault(\"RANGE_UNSUPPORTED\", \"The requested source range is outside the source\");\n }\n if (this.#closed) throw new ProtocolFault(\"HANDLE_CLOSED\", \"The source is closed\");\n if (length === 0) return new ArrayBuffer(0);\n\n // Snapshot LRU coverage before attaching to concurrent provider work.\n // Bytes inserted when an in-flight singleflight settles are deduplicated\n // work, not cache hits for this caller, even though they enter the LRU\n // before the shared promise resumes.\n let unreportedCacheHitBytes = this.#coveredLength(offset, end);\n const reportInitialCacheHit = (): void => {\n if (unreportedCacheHitBytes > 0) options.onCacheHit?.(unreportedCacheHitBytes);\n unreportedCacheHitBytes = 0;\n };\n\n // A merged step may span several adapter actions. Keep every host-side\n // broker response within the staging slice supplied at open time while\n // still returning one exact contiguous result to the adapter.\n if (length > this.#maxReadBytes) {\n const chunks: ArrayBuffer[] = [];\n let cursor = offset;\n while (cursor < end) {\n const chunkEnd = Math.min(end, cursor + this.#maxReadBytes);\n chunks.push(await this.#readInternal(cursor, chunkEnd - cursor, options));\n cursor = chunkEnd;\n }\n const output = new Uint8Array(length);\n let target = 0;\n for (const chunk of chunks) {\n output.set(new Uint8Array(chunk), target);\n target += chunk.byteLength;\n }\n return output.buffer;\n }\n\n // Keep successful overlapping singleflight coverage as an ephemeral\n // segment even when the byte LRU cannot retain the whole request. This\n // prevents a large concurrent request from issuing a second provider read\n // merely because its first result was larger than the cache budget.\n const inherited: RangeCoverage[] = [];\n\n // Wait for overlapping in-flight work before computing the missing part.\n // This is the dataset-level singleflight path: identical and overlapping\n // concurrent requests share one provider read whenever possible.\n for (;;) {\n if (this.#closed) throw new ProtocolFault(\"HANDLE_CLOSED\", \"The source is closed\");\n const cached = this.#assemble(offset, end, inherited);\n if (cached) {\n reportInitialCacheHit();\n return cached;\n }\n const overlap = this.#inflight.filter((entry) => (\n entry.waiters > 0 && entry.offset < end && entry.end > offset\n ));\n if (overlap.length > 0) {\n for (const entry of overlap) entry.waiters += 1;\n let sharedCoverage: readonly RangeCoverage[] = [];\n try {\n sharedCoverage = await raceCancellation(\n Promise.all(overlap.map((entry) => entry.promise)),\n options.cancellation,\n );\n } finally {\n for (const entry of overlap) this.#releasePendingWaiter(entry);\n }\n inherited.push(...sharedCoverage);\n const shared = this.#assemble(offset, end, inherited);\n if (shared !== undefined) {\n reportInitialCacheHit();\n return shared;\n }\n continue;\n }\n\n // Do not attach one caller's cancellation to the shared provider work:\n // another table operation may still be waiting on this interval. Each\n // caller races the shared promise independently below.\n reportInitialCacheHit();\n const pending: PendingRange = {\n offset,\n end,\n promise: Promise.resolve({ offset, end, bytes: new ArrayBuffer(0) }),\n cancellation: createRequestCancellation(),\n waiters: 1,\n settled: false,\n };\n const promise = this.#fetchMissing(\n offset,\n end,\n pending.cancellation.promise,\n options.onProviderRead,\n inherited,\n );\n pending.promise = promise;\n this.#inflight.push(pending);\n void promise.then(\n (coverage) => {\n pending.coverage = coverage;\n this.#settlePending(pending);\n },\n () => this.#settlePending(pending),\n );\n let coverage: RangeCoverage;\n try {\n coverage = await raceCancellation(promise, options.cancellation);\n } finally {\n this.#releasePendingWaiter(pending);\n }\n // A response may be larger than the byte LRU. Use the pending coverage\n // as the exact result even when it was intentionally not retained.\n // Provider/cache coverage is immutable inside the official adapter\n // runtime. Sharing the owned buffer keeps singleflight from allocating\n // one extra full-range copy per waiter.\n return coverage.bytes;\n }\n }\n\n /** Reads a step's actions after merging overlaps and direct adjacency. */\n async readMany(\n requests: readonly ReadInterval[],\n options: SourceReadOptions = {},\n ): Promise<readonly ArrayBuffer[]> {\n if (requests.length === 0) return Object.freeze([]);\n const normalized = requests.map((request) => {\n const end = checkedEnd(request.offset, request.end - request.offset, this.size);\n if (end === undefined) {\n throw new ProtocolFault(\"RANGE_UNSUPPORTED\", \"The requested source range is outside the source\");\n }\n return { offset: request.offset, end };\n });\n const merged = mergeIntervals(normalized).flatMap((interval) => splitInterval(interval, this.#maxReadBytes));\n // Resolve merged intervals in at most four concurrent provider reads. Keep\n // the exact returned coverage separately because the LRU may evict a large\n // merged span immediately after it is fetched.\n const fetched: RangeCoverage[] = [];\n await runBounded(merged, this.#maxConcurrency, async (interval) => {\n const bytes = await this.read(interval.offset, interval.end - interval.offset, options);\n fetched.push({ offset: interval.offset, end: interval.end, bytes });\n });\n return Object.freeze(normalized.map((interval) => {\n if (interval.offset === interval.end) return new ArrayBuffer(0);\n const bytes = this.#assemble(interval.offset, interval.end, fetched);\n if (!bytes) {\n throw new ProtocolFault(\"SOURCE_UNAVAILABLE\", \"The source provider returned no bytes\", true);\n }\n return bytes;\n }));\n }\n\n close(): void {\n if (this.#closed) return;\n this.#closed = true;\n this.#cache.length = 0;\n this.#cacheBytes = 0;\n for (const pending of this.#inflight) {\n pending.waiters = 0;\n pending.cancellation.resolve();\n }\n // Drop the accessor's references immediately. The provider promises may\n // still settle later (after honoring cancellation), but their callbacks\n // no longer keep source coverage or waiter state alive after close.\n this.#inflight.length = 0;\n for (const waiter of this.#providerQueue.splice(0)) {\n waiter.cancelled = true;\n waiter.reject(new ProtocolFault(\"HANDLE_CLOSED\", \"The source is closed\"));\n }\n this.#broker.close(this.#sourceHandle);\n }\n\n async #acquireProviderPermit(cancellation: Promise<void>): Promise<() => void> {\n if (this.#closed) throw new ProtocolFault(\"HANDLE_CLOSED\", \"The source is closed\");\n if (this.#providerReads < this.#maxConcurrency) {\n this.#providerReads += 1;\n return () => this.#releaseProviderPermit();\n }\n return new Promise<() => void>((resolve, reject) => {\n const waiter: ProviderPermitWaiter = {\n resolve,\n reject,\n cancellation,\n cancelled: false,\n granted: false,\n };\n const onCancel = (): void => {\n if (waiter.cancelled || waiter.granted) return;\n waiter.cancelled = true;\n const index = this.#providerQueue.indexOf(waiter);\n if (index >= 0) this.#providerQueue.splice(index, 1);\n reject(new ProtocolFault(\"CANCELLED\", \"The source read was cancelled\"));\n };\n cancellation.then(onCancel, onCancel);\n this.#providerQueue.push(waiter);\n });\n }\n\n #releaseProviderPermit(): void {\n this.#providerReads = Math.max(0, this.#providerReads - 1);\n while (this.#providerQueue.length > 0) {\n const waiter = this.#providerQueue.shift()!;\n if (waiter.cancelled) continue;\n if (this.#closed) {\n waiter.cancelled = true;\n waiter.reject(new ProtocolFault(\"HANDLE_CLOSED\", \"The source is closed\"));\n continue;\n }\n this.#providerReads += 1;\n waiter.granted = true;\n waiter.resolve(() => this.#releaseProviderPermit());\n return;\n }\n }\n\n async #fetchMissing(\n offset: number,\n end: number,\n cancellation: Promise<void>,\n onProviderRead?: (bytes: number) => void,\n inherited: readonly RangeCoverage[] = [],\n ): Promise<RangeCoverage> {\n // Another interval can have completed between the first check and the\n // insertion into #inflight. Recompute holes and fetch only uncovered ones.\n const holes = this.#missing(offset, end, inherited);\n const fetched: RangeCoverage[] = [];\n await runBounded(holes, this.#maxConcurrency, async (hole) => {\n const release = await this.#acquireProviderPermit(cancellation);\n let buffer: ArrayBuffer;\n try {\n buffer = await this.#broker.request(\n this.#sourceHandle,\n hole.offset,\n hole.end - hole.offset,\n { cancellation },\n );\n } finally {\n release();\n }\n onProviderRead?.(buffer.byteLength);\n if (this.#closed) throw new ProtocolFault(\"HANDLE_CLOSED\", \"The source is closed\");\n fetched.push({ offset: hole.offset, end: hole.end, bytes: buffer });\n this.#insert(hole.offset, buffer);\n });\n const exactFetched = inherited.length === 0\n && fetched.length === 1\n && fetched[0]!.offset === offset\n && fetched[0]!.end === end\n ? fetched[0]!.bytes\n : undefined;\n const bytes = exactFetched ?? this.#assemble(offset, end, [...inherited, ...fetched]);\n if (bytes === undefined) {\n throw new ProtocolFault(\"SOURCE_UNAVAILABLE\", \"The source provider returned no bytes\", true);\n }\n return { offset, end, bytes };\n }\n\n #missing(\n offset: number,\n end: number,\n extra: readonly RangeCoverage[] = [],\n ): ReadInterval[] {\n const covered = this.#cache\n .filter((entry) => entry.end > offset && entry.offset < end)\n .map((entry) => ({ offset: Math.max(offset, entry.offset), end: Math.min(end, entry.end) }))\n .concat(extra\n .filter((entry) => entry.end > offset && entry.offset < end)\n .map((entry) => ({ offset: Math.max(offset, entry.offset), end: Math.min(end, entry.end) })))\n .sort((a, b) => a.offset - b.offset || a.end - b.end);\n const holes: ReadInterval[] = [];\n let cursor = offset;\n for (const entry of covered) {\n if (entry.end <= cursor) continue;\n if (entry.offset > cursor) holes.push({ offset: cursor, end: entry.offset });\n cursor = Math.max(cursor, entry.end);\n if (cursor >= end) break;\n }\n if (cursor < end) holes.push({ offset: cursor, end });\n return holes;\n }\n\n #covered(offset: number, end: number): ArrayBuffer | undefined {\n return this.#assemble(offset, end, []);\n }\n\n #assemble(\n offset: number,\n end: number,\n extra: readonly RangeCoverage[],\n ): ArrayBuffer | undefined {\n if (end === offset) return new ArrayBuffer(0);\n const segments: RangeCoverage[] = [];\n for (const entry of this.#cache) {\n if (entry.end <= offset || entry.offset >= end) continue;\n entry.lastUsed = ++this.#clock;\n segments.push({ offset: entry.offset, end: entry.end, bytes: entry.bytes });\n }\n for (const entry of extra) {\n if (entry.end > offset && entry.offset < end) segments.push(entry);\n }\n segments.sort((left, right) => left.offset - right.offset || left.end - right.end);\n const output = new Uint8Array(end - offset);\n let cursor = offset;\n for (const segment of segments) {\n if (segment.end <= cursor) continue;\n if (segment.offset > cursor) return undefined;\n const start = Math.max(cursor, segment.offset);\n const segmentEnd = Math.min(end, segment.end);\n const sourceStart = start - segment.offset;\n const length = segmentEnd - start;\n output.set(new Uint8Array(segment.bytes, sourceStart, length), start - offset);\n cursor = segmentEnd;\n if (cursor >= end) break;\n }\n return cursor >= end ? output.buffer : undefined;\n }\n\n #coveredLength(\n offset: number,\n end: number,\n extra: readonly RangeCoverage[] = [],\n ): number {\n const covered = this.#cache\n .filter((entry) => entry.end > offset && entry.offset < end)\n .map((entry) => ({ offset: Math.max(offset, entry.offset), end: Math.min(end, entry.end) }))\n .concat(extra\n .filter((entry) => entry.end > offset && entry.offset < end)\n .map((entry) => ({ offset: Math.max(offset, entry.offset), end: Math.min(end, entry.end) })))\n .sort((a, b) => a.offset - b.offset || a.end - b.end);\n let bytes = 0;\n let cursor = offset;\n for (const entry of covered) {\n const start = Math.max(cursor, entry.offset);\n if (entry.end <= start) continue;\n bytes += entry.end - start;\n cursor = entry.end;\n if (cursor >= end) break;\n }\n return bytes;\n }\n\n #insert(offset: number, bytes: ArrayBuffer): void {\n const length = bytes.byteLength;\n if (length === 0 || this.#maxCacheBytes <= 0 || length > this.#maxCacheBytes) return;\n const end = offset + length;\n // Keep disjoint bounded entries instead of constructing an oversized\n // merged allocation when adjacent cached windows touch. Coverage assembly\n // below handles overlap/adjacency and the byte LRU remains a hard cap.\n const entry: CachedRange = {\n offset,\n end,\n // Broker buffers are transferred into this Worker and treated as\n // immutable by official adapters, so the LRU can retain the owned\n // allocation directly instead of momentarily doubling cache usage.\n bytes,\n lastUsed: ++this.#clock,\n };\n this.#cache.push(entry);\n this.#cacheBytes += entry.bytes.byteLength;\n while (this.#cacheBytes > this.#maxCacheBytes && this.#cache.length > 0) {\n let oldest = this.#cache[0]!;\n for (const candidate of this.#cache) {\n if (candidate.lastUsed < oldest.lastUsed) oldest = candidate;\n }\n this.#remove(oldest);\n }\n }\n\n #remove(entry: CachedRange): void {\n const index = this.#cache.indexOf(entry);\n if (index < 0) return;\n this.#cache.splice(index, 1);\n this.#cacheBytes -= entry.bytes.byteLength;\n }\n\n #settlePending(entry: PendingRange): void {\n entry.settled = true;\n if (entry.waiters === 0) this.#removePending(entry);\n }\n\n #releasePendingWaiter(entry: PendingRange): void {\n if (entry.waiters > 0) entry.waiters -= 1;\n if (entry.waiters === 0 && !entry.settled) {\n entry.cancellation.resolve();\n } else if (entry.waiters === 0) {\n this.#removePending(entry);\n }\n }\n\n #removePending(entry: PendingRange): void {\n const index = this.#inflight.indexOf(entry);\n if (index >= 0) this.#inflight.splice(index, 1);\n }\n}\n\nexport function validateRangeDescriptor(value: unknown): asserts value is BrokerSourceDescriptor {\n if (!isRecord(value) || value.kind !== \"range\") {\n throw new ProtocolFault(\"INVALID_ARGUMENT\", \"source must be a range descriptor\");\n }\n if (Object.keys(value).some((key) => (\n key !== \"kind\" && key !== \"handle\" && key !== \"size\" && key !== \"maxConcurrency\"\n ))) {\n throw new ProtocolFault(\"INVALID_ARGUMENT\", \"range source descriptor contains private fields\");\n }\n const handle = value.handle;\n const size = value.size;\n if (typeof handle !== \"string\" || handle.length === 0 || handle.length > 256) {\n throw new ProtocolFault(\"INVALID_ARGUMENT\", \"range source handle must be a non-empty string\");\n }\n if (!Number.isSafeInteger(size) || size < 0 || size > MAX_RANGE_SOURCE_BYTES) {\n throw new ProtocolFault(\n \"RESOURCE_LIMIT\",\n `Range sources support at most ${MAX_RANGE_SOURCE_BYTES} bytes`,\n false,\n { resource: \"source-staging\", requiredBytes: numberForDetails(size), availableBytes: MAX_RANGE_SOURCE_BYTES },\n );\n }\n if (value.maxConcurrency !== undefined\n && (!Number.isSafeInteger(value.maxConcurrency)\n || value.maxConcurrency < 1\n || value.maxConcurrency > 4)) {\n throw new ProtocolFault(\"INVALID_ARGUMENT\", \"range source maxConcurrency must be between 1 and 4\");\n }\n}\n\nfunction sourceFailure(value: unknown): ProtocolFault {\n if (isRecord(value) && typeof value.code === \"string\") {\n const code = value.code === \"SOURCE_CHANGED\"\n || value.code === \"SOURCE_UNAVAILABLE\"\n || value.code === \"RANGE_UNSUPPORTED\"\n || value.code === \"RUNTIME_FAILURE\"\n || value.code === \"RESOURCE_LIMIT\"\n || value.code === \"CANCELLED\"\n || value.code === \"HANDLE_CLOSED\"\n ? value.code\n : \"SOURCE_UNAVAILABLE\";\n // Provider text can contain a URL, query, validator, or header. Keep the\n // Worker error deliberately generic; diagnostics must remain path-free.\n const message = sourceFailureMessage(code);\n return new ProtocolFault(\n code,\n message,\n value.retryable === true,\n code === \"RESOURCE_LIMIT\" ? safeLimitDetails(value.details) : undefined,\n );\n }\n return new ProtocolFault(\"SOURCE_UNAVAILABLE\", \"The source provider failed to read bytes\", true);\n}\n\nfunction sourceFailureMessage(code: string): string {\n switch (code) {\n case \"SOURCE_CHANGED\": return \"The source changed while it was open\";\n case \"RANGE_UNSUPPORTED\": return \"The source does not support the requested byte range\";\n case \"RUNTIME_FAILURE\": return \"The source provider returned invalid bytes\";\n case \"RESOURCE_LIMIT\": return \"The source exceeds its configured limit\";\n case \"HANDLE_CLOSED\": return \"The source is closed\";\n case \"CANCELLED\": return \"The source read was cancelled\";\n default: return \"The source provider is unavailable\";\n }\n}\n\nfunction safeLimitDetails(value: unknown): Readonly<Record<string, unknown>> {\n if (!isRecord(value)) return { resource: \"source-staging\", requiredBytes: 0, availableBytes: 0 };\n return {\n resource: typeof value.resource === \"string\" && /^[A-Za-z0-9_.:-]{1,64}$/u.test(value.resource)\n ? value.resource\n : \"source-staging\",\n requiredBytes: numberForDetails(value.requiredBytes),\n availableBytes: numberForDetails(value.availableBytes),\n };\n}\n\nfunction normalizeExactBytes(value: unknown, expectedLength: number): ArrayBuffer {\n if (value instanceof ArrayBuffer) {\n if (value.byteLength !== expectedLength) {\n throw new ProtocolFault(\"RUNTIME_FAILURE\", \"The source provider returned an invalid byte length\");\n }\n return value;\n }\n if (ArrayBuffer.isView(value)) {\n if (value.byteLength !== expectedLength) {\n throw new ProtocolFault(\"RUNTIME_FAILURE\", \"The source provider returned an invalid byte length\");\n }\n const bytes = new Uint8Array(expectedLength);\n bytes.set(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));\n return bytes.buffer;\n }\n throw new ProtocolFault(\"RUNTIME_FAILURE\", \"The source provider returned no byte buffer\");\n}\n\nasync function readBlob(blob: Blob, expectedLength: number): Promise<ArrayBuffer> {\n try {\n const method = (blob as unknown as { arrayBuffer?: () => Promise<ArrayBuffer> }).arrayBuffer;\n const result = typeof method === \"function\"\n ? await method.call(blob)\n : await readBlobStream(blob, expectedLength);\n return normalizeExactBytes(result, expectedLength);\n } catch (error) {\n if (error instanceof ProtocolFault) throw error;\n throw new ProtocolFault(\"SOURCE_UNAVAILABLE\", \"The local source could not be read\", true, undefined, error);\n }\n}\n\nasync function readBlobStream(blob: Blob, expectedLength: number): Promise<ArrayBuffer> {\n if (typeof blob.stream !== \"function\") {\n throw new TypeError(\"Blob slices must provide stream() or arrayBuffer()\");\n }\n const output = new Uint8Array(expectedLength);\n const reader = blob.stream().getReader();\n let written = 0;\n try {\n for (;;) {\n const next = await reader.read();\n if (next.done) break;\n const chunk = next.value instanceof Uint8Array\n ? next.value\n : new Uint8Array(next.value as ArrayBufferLike);\n if (chunk.byteLength > expectedLength - written) {\n throw new ProtocolFault(\"RUNTIME_FAILURE\", \"The source provider returned too many bytes\");\n }\n output.set(chunk, written);\n written += chunk.byteLength;\n }\n } finally {\n reader.releaseLock();\n }\n if (written !== expectedLength) {\n throw new ProtocolFault(\"RUNTIME_FAILURE\", \"The source provider returned too few bytes\");\n }\n return output.buffer;\n}\n\nfunction checkedEnd(offset: number, length: number, size: number): number | undefined {\n if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length)\n || offset < 0 || length < 0 || !Number.isSafeInteger(size) || size < 0\n || offset > size || length > size - offset) return undefined;\n return offset + length;\n}\n\nfunction mergeIntervals(intervals: readonly ReadInterval[]): ReadInterval[] {\n const sorted = [...intervals].sort((a, b) => a.offset - b.offset || a.end - b.end);\n const merged: ReadInterval[] = [];\n for (const current of sorted) {\n const previous = merged[merged.length - 1];\n if (previous && current.offset <= previous.end) {\n if (current.end > previous.end) {\n merged[merged.length - 1] = { offset: previous.offset, end: current.end };\n }\n } else {\n merged.push({ ...current });\n }\n }\n return merged;\n}\n\nfunction splitInterval(interval: ReadInterval, maxBytes: number): ReadInterval[] {\n if (interval.end <= interval.offset) return [{ ...interval }];\n const result: ReadInterval[] = [];\n let cursor = interval.offset;\n while (cursor < interval.end) {\n const end = Math.min(interval.end, cursor + maxBytes);\n result.push({ offset: cursor, end });\n cursor = end;\n }\n return result;\n}\n\nasync function runBounded<T>(\n values: readonly T[],\n concurrency: number,\n task: (value: T) => Promise<void>,\n): Promise<void> {\n let next = 0;\n let firstError: unknown;\n let failed = false;\n const worker = async (): Promise<void> => {\n for (;;) {\n if (failed) return;\n const index = next++;\n if (index >= values.length) return;\n try {\n await task(values[index]!);\n } catch (error) {\n if (!failed) {\n firstError = error;\n failed = true;\n }\n // Drain the remaining work items so every provider promise settles\n // before the caller releases its operation reservation.\n }\n }\n };\n await Promise.all(Array.from({ length: Math.min(concurrency, values.length) }, worker));\n if (failed) throw firstError;\n}\n\nfunction raceCancellation<T>(operation: Promise<T>, cancellation?: Promise<void>): Promise<T> {\n if (!cancellation) return operation;\n return Promise.race([\n operation,\n cancellation.then<T>(() => {\n throw new ProtocolFault(\"CANCELLED\", \"The source read was cancelled\");\n }),\n ]);\n}\n\nfunction createRequestCancellation(): RequestCancellation {\n let resolve!: () => void;\n const promise = new Promise<void>((done) => {\n resolve = done;\n });\n return { promise, resolve };\n}\n\nfunction numberForDetails(value: unknown): number {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0\n ? Math.min(Math.floor(value), Number.MAX_SAFE_INTEGER)\n : Number.MAX_SAFE_INTEGER;\n}\n\nfunction isRecord(value: unknown): value is Record<string, any> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"],
|
|
5
|
+
"mappings": "AAmDO,SAASA,EAA8BC,EAAqD,CACjG,IAAMC,EAAMC,EAASF,CAAO,EAAIA,EAAU,CAAC,EACrCG,EAAW,OAAOF,EAAI,UAAa,UAAYA,EAAI,SAAS,OAAS,EACvEA,EAAI,SACJ,OAAOA,EAAI,kBAAqB,UAAYA,EAAI,iBAAiB,OAAS,EACxEA,EAAI,iBACJG,EAAcH,CAAG,EACvB,GAAII,EAAWJ,EAAI,aAAa,GAAKI,EAAWJ,EAAI,cAAc,EAChE,OAAO,OAAO,OAAO,CAAE,GAAGA,EAAK,SAAAE,CAAS,CAAC,EAE3C,GAAIE,EAAWJ,EAAI,QAAQ,GAAKI,EAAWJ,EAAI,SAAS,EACtD,OAAO,OAAO,OAAO,CAAE,GAAGA,EAAK,SAAAE,CAAS,CAAC,EAG3C,IAAMG,EAAYC,EAAcN,EAAK,CACnC,kBACA,iBACA,mBACA,gBACA,sBACA,kBACA,iBACA,gBACA,gBACA,oBACA,mBACA,0BACA,mBACF,CAAC,EACD,GAAIK,IAAc,OAAW,CAC3B,IAAME,EAAgBD,EAAcN,EAAK,CACvC,eACA,cACA,gBACA,aACA,mBACA,eACA,cACA,aACA,aACA,gBACF,CAAC,GAAKK,EAAY,EAClB,OAAO,OAAO,OAAO,CACnB,GAAGL,EACH,SAAAE,EACA,cAAAK,EACA,eAAgBF,CAClB,CAAC,CACH,CAEA,IAAMG,EAAYF,EAAcN,EAAK,CACnC,QACA,WACA,gBACA,aACA,kBACA,kBACA,aACA,YACA,kBACA,mBACA,sBACA,YACA,kBACF,CAAC,GAAK,EACAS,EAAWH,EAAcN,EAAK,CAClC,QACA,YACA,mBACA,UACA,eACA,eACA,UACA,SACA,eACA,gBACA,mBACA,SACA,eACF,CAAC,GAAKQ,EAAY,EAClB,OAAO,OAAO,OAAO,CAAE,GAAGR,EAAK,SAAAE,EAAU,SAAAO,EAAU,UAAAD,CAAU,CAAC,CA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C,EAAO,KAAK,CAAE,OAAQC,EAAQ,IAAAC,CAAI,CAAC,EACnCD,EAASC,CACX,CACA,OAAOF,CACT,CAEA,eAAeG,EACbC,EACAC,EACAC,EACe,CACf,IAAIC,EAAO,EACPC,EACAC,EAAS,GACPC,EAAS,SAA2B,CACxC,OAAS,CACP,GAAID,EAAQ,OACZ,IAAME,EAAQJ,IACd,GAAII,GAASP,EAAO,OAAQ,OAC5B,GAAI,CACF,MAAME,EAAKF,EAAOO,CAAK,CAAE,CAC3B,OAASC,EAAO,CACTH,IACHD,EAAaI,EACbH,EAAS,GAIb,CACF,CACF,EAEA,GADA,MAAM,QAAQ,IAAI,MAAM,KAAK,CAAE,OAAQ,KAAK,IAAIJ,EAAaD,EAAO,MAAM,CAAE,EAAGM,CAAM,CAAC,EAClFD,EAAQ,MAAMD,CACpB,CAEA,SAASK,EAAoBC,EAAuBC,EAA0C,CAC5F,OAAKA,EACE,QAAQ,KAAK,CAClBD,EACAC,EAAa,KAAQ,IAAM,CACzB,MAAM,IAAIC,EAAc,YAAa,+BAA+B,CACtE,CAAC,CACH,CAAC,EANyBF,CAO5B,CAEA,SAASG,GAAiD,CACxD,IAAIC,EAIJ,MAAO,CAAE,QAHO,IAAI,QAAeC,GAAS,CAC1CD,EAAUC,CACZ,CAAC,EACiB,QAAAD,CAAQ,CAC5B,CAEA,SAASE,EAAiBC,EAAwB,CAChD,OAAO,OAAOA,GAAU,UAAY,OAAO,SAASA,CAAK,GAAKA,GAAS,EACnE,KAAK,IAAI,KAAK,MAAMA,CAAK,EAAG,OAAO,gBAAgB,EACnD,OAAO,gBACb,CAEA,SAASC,EAASD,EAA8C,CAC9D,OAAO,OAAOA,GAAU,UAAYA,IAAU,MAAQ,CAAC,MAAM,QAAQA,CAAK,CAC5E",
|
|
6
|
+
"names": ["normalizeResourceLimitDetails", "details", "raw", "isRecord", "resource", "inferResource", "isQuantity", "byteLimit", "firstQuantity", "requiredBytes", "available", "required", "keys", "names", "name", "value", "ProtocolFault", "code", "message", "retryable", "details", "cause", "normalizeResourceLimitDetails", "WorkerSourceBroker", "#scope", "#pending", "#nextRequestId", "#closed", "scope", "sourceHandle", "offset", "length", "options", "ProtocolFault", "requestId", "resolve", "reject", "pending", "cancelled", "cancel", "#postCancel", "message", "error", "value", "isRecord", "sourceFailure", "normalizeExactBytes", "RangeSourceAccessor", "#broker", "#sourceHandle", "#maxCacheBytes", "#maxReadBytes", "#maxConcurrency", "#cache", "#inflight", "#providerQueue", "#providerReads", "#cacheBytes", "#clock", "#closed", "descriptor", "broker", "maxCacheBytes", "maxReadBytes", "validateRangeDescriptor", "offset", "length", "options", "#readInternal", "end", "checkedEnd", "ProtocolFault", "unreportedCacheHitBytes", "#coveredLength", "reportInitialCacheHit", "chunks", "cursor", "chunkEnd", "output", "target", "chunk", "inherited", "cached", "#assemble", "overlap", "entry", "sharedCoverage", "raceCancellation", "#releasePendingWaiter", "shared", "pending", "createRequestCancellation", "promise", "#fetchMissing", "coverage", "#settlePending", "requests", "normalized", "request", "merged", "mergeIntervals", "interval", "splitInterval", "fetched", "runBounded", "bytes", "waiter", "#acquireProviderPermit", "cancellation", "#releaseProviderPermit", "resolve", "reject", "onCancel", "index", "onProviderRead", "holes", "#missing", "hole", "release", "buffer", "#insert", "extra", "covered", "a", "b", "#covered", "segments", "left", "right", "segment", "start", "segmentEnd", "sourceStart", "oldest", "candidate", "#remove", "#removePending", "value", "isRecord", "key", "handle", "size", "numberForDetails", "sourceFailure", "code", "message", "sourceFailureMessage", "safeLimitDetails", "normalizeExactBytes", "expectedLength", "checkedEnd", "offset", "length", "size", "mergeIntervals", "intervals", "sorted", "a", "b", "merged", "current", "previous", "splitInterval", "interval", "maxBytes", "result", "cursor", "end", "runBounded", "values", "concurrency", "task", "next", "firstError", "failed", "worker", "index", "error", "raceCancellation", "operation", "cancellation", "ProtocolFault", "createRequestCancellation", "resolve", "done", "numberForDetails", "value", "isRecord"]
|
|
7
|
+
}
|