@tearleads/client-sdk 0.1.32 → 0.1.34
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/data/blobs/transferPool.js +53 -0
- package/data/blobs/transferPool.js.map +1 -0
- package/data/documents/blob/shared/types.d.ts +2 -2
- package/data/documents/blob/shared/types.js.map +1 -1
- package/data/sync/coordinatorLaneRun.js +154 -0
- package/data/sync/coordinatorLaneRun.js.map +1 -0
- package/data/sync/coordinatorPump.js +72 -169
- package/data/sync/coordinatorPump.js.map +1 -1
- package/data/sync/coordinatorState.d.ts +6 -0
- package/data/sync/coordinatorState.js +3 -1
- package/data/sync/coordinatorState.js.map +1 -1
- package/data/sync/syncCoordinator.js +4 -3
- package/data/sync/syncCoordinator.js.map +1 -1
- package/data/sync/syncLaneConfig.d.ts +2 -0
- package/data/sync/syncLaneConfig.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +2 -2
- package/internal/api-client/ApiClient.js +6 -30
- package/internal/api-client/ApiClient.js.map +1 -1
- package/internal/api-client/routes/blobs/get.d.ts +2 -2
- package/internal/api-client/routes/blobs/get.js +24 -21
- package/internal/api-client/routes/blobs/get.js.map +1 -1
- package/internal/api-client/routes/blobs/multipartUpload.js +146 -0
- package/internal/api-client/routes/blobs/multipartUpload.js.map +1 -0
- package/internal/api-client/routes/blobs/storageFetchOptions.js +11 -0
- package/internal/api-client/routes/blobs/storageFetchOptions.js.map +1 -0
- package/internal/api-client/types.d.ts +1 -1
- package/internal/api-client/types.js.map +1 -1
- package/internal/validators/operation/blobDownloads.js +3 -9
- package/internal/validators/operation/blobDownloads.js.map +1 -1
- package/internal/validators/operation/blobTransferSchemas.js +11 -0
- package/internal/validators/operation/blobTransferSchemas.js.map +1 -0
- package/internal/validators/operation/index.d.ts +1 -0
- package/internal/validators/operation/index.js +1 -0
- package/internal/validators/operation/index.js.map +1 -1
- package/internal/validators/operation/multipartPartUploads.d.ts +179 -0
- package/internal/validators/operation/multipartPartUploads.js +47 -0
- package/internal/validators/operation/multipartPartUploads.js.map +1 -0
- package/internal/validators/operation/registry.d.ts +2 -0
- package/internal/validators/operation/registry.js +2 -0
- package/internal/validators/operation/registry.js.map +1 -1
- package/internal/validators/util/blob.d.ts +2 -4
- package/internal/validators/util/blob.js +2 -4
- package/internal/validators/util/blob.js.map +1 -1
- package/package.json +1 -1
- package/stores/documents/documentStore/attachmentHydration.js +33 -0
- package/stores/documents/documentStore/attachmentHydration.js.map +1 -1
- package/stores/documents/documentStore/remoteWork.js +1 -1
- package/stores/documents/documentStore/remoteWork.js.map +1 -1
- package/stores/documents/documentStore/sync.js +3 -0
- package/stores/documents/documentStore/sync.js.map +1 -1
- package/sync/reconciliation/documentContentPull.js +7 -3
- package/sync/reconciliation/documentContentPull.js.map +1 -1
- package/sync/reconciliation/idleBackfill.js +14 -2
- package/sync/reconciliation/idleBackfill.js.map +1 -1
- package/sync/reconciliation/knownContainerSweep.js +5 -2
- package/sync/reconciliation/knownContainerSweep.js.map +1 -1
- package/sync/reconciliation/reconcileContainer.js +3 -3
- package/sync/reconciliation/reconcileContainer.js.map +1 -1
- package/sync/reconciliation/service.js +9 -4
- package/sync/reconciliation/service.js.map +1 -1
- package/sync/reconciliation/serviceTypes.d.ts +5 -3
- package/sync/reconciliation/serviceTypes.js.map +1 -1
- package/sync/reconciliation/triggers.d.ts +2 -1
- package/sync/reconciliation/triggers.js +5 -2
- package/sync/reconciliation/triggers.js.map +1 -1
- package/workflows/blobs/hydrate.d.ts +4 -2
- package/workflows/blobs/hydrate.js +21 -7
- package/workflows/blobs/hydrate.js.map +1 -1
- package/workflows/blobs/multipartStageFailures.js +1 -1
- package/workflows/blobs/multipartStageFailures.js.map +1 -1
- package/workflows/blobs/multipartUpload.js +69 -39
- package/workflows/blobs/multipartUpload.js.map +1 -1
- package/workflows/blobs/readAttachmentTransfer.js +42 -0
- package/workflows/blobs/readAttachmentTransfer.js.map +1 -0
- package/workflows/documents/syncLane.d.ts +1 -0
- package/workflows/documents/syncLane.js +1 -0
- package/workflows/documents/syncLane.js.map +1 -1
- package/workflows/registration/persistRegistrationBootstrap.js +3 -0
- package/workflows/registration/persistRegistrationBootstrap.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["get.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AAyBzC,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,SAAgC,EAChC,MAAc,EACd,gBAA+B,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC;IAE9D,wEAAwE;IACxE,4EAA4E;IAC5E,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,aAAa,CAC1C,wBAAwB,EACxB,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EACtB,EAAE,YAAY,EAAE,KAAK,EAAE,CACxB,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACpD,OAAO,aAAa,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAC1C,CAAC;YACD,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;QAC/B,IAAI,UAAU,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YACjC,SAAS,CAAC,aAAa,CAAC;gBACtB,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,UAAU,MAAM,WAAW;gB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E,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC;IAEtE,iEAAiE;IACjE,uEAAuE;IACvE,iFAAiF;IACjF,8EAA8E;IAC9E,4EAA4E;IAC5E,8EAA8E;IAC9E,6EAA6E;IAC7E,6EAA6E;IAC7E,6EAA6E;IAC7E,6EAA6E;IAC7E,qEAAqE;IACrE,MAAM,cAAc,GAClB,QAAQ,CAAC,IAAI,IAAI,0BAA0B,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAE5E,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC;QAC1C,UAAU;QACV,cAAc;QACd,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC;KAC/C,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,qEAAqE;AACrE,0DAA0D;AAC1D,yEAAyE;AACzE,yCAAyC;AACzC,SAAS,0BAA0B,CACjC,MAAmB;IAEnB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,IAAI,cAAc,CAAa;QACpC,KAAK,CAAC,UAAU;YACd,IAAI,KAAK,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;gBACzB,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;YACD,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n blobWireHeaderKeys,\n getBlobBytesOperation,\n getBlobDownloadOperation,\n} from \"@tearleads/validators/operation\";\nimport type { BinaryResponseOperationTransport } from \"../../binaryResponseOperationTransport\";\nimport type { JsonOperationTransport } from \"../../operationTransport\";\nimport type { OperationResponseRequestFn } from \"../../types\";\n\nexport interface BlobBytesResponse {\n readonly blobId: string;\n readonly byteLength: number;\n readonly encryptedBytes: ReadableStream<Uint8Array>;\n readonly sha256: string;\n}\n\nexport interface UploadMultipartBlobPartBytesRequest {\n readonly byteLength: number;\n readonly encryptedBytes: Blob | BufferSource;\n readonly sha256: string;\n readonly uploadId: string;\n}\n\ntype BlobDownloadTransport = Pick<JsonOperationTransport, \"requestResult\"> &\n Pick<BinaryResponseOperationTransport, \"requestBinaryResponse\"> &\n Pick<OperationResponseRequestFn, \"reportFailure\">;\n\ntype DownloadFetch = (url: string, init: RequestInit) => Promise<Response>;\n\nexport async function getBlobBytes(\n transport: BlobDownloadTransport,\n blobId: string,\n downloadFetch: DownloadFetch = (url, init) => fetch(url, init),\n): Promise<BlobBytesResponse | null> {\n // Refresh at most once. R2 expiration errors can appear as CORS/network\n // failures in browsers, so both rejected fetches and 403s need a fresh URL.\n for (let attempt = 0; attempt < 2; attempt += 1) {\n const result = await transport.requestResult(\n getBlobDownloadOperation,\n { params: { blobId } },\n { reportErrors: false },\n );\n if (!result.ok) {\n if (result.kind === \"http\" && result.status === 404) {\n return getBlobStream(transport, blobId);\n }\n result.report();\n return null;\n }\n const descriptor = result.data;\n if (descriptor.blobId !== blobId) {\n transport.reportFailure({\n kind: \"shape\",\n method: \"GET\",\n path: `/blobs/${blobId}/download`,\n status: 200,\n statusText: \"\",\n message: `Blob ${blobId} download descriptor has the wrong identity`,\n });\n return null;\n }\n if (descriptor.source.kind === \"api\") {\n return getBlobStream(transport, blobId);\n }\n try {\n // Never send the application's session or cookies to the object store.\n // Reject redirects and keep bearer URLs out of referrers and errors.\n const response = await downloadFetch(descriptor.source.url, {\n cache: \"no-store\",\n credentials: \"omit\",\n redirect: \"error\",\n referrerPolicy: \"no-referrer\",\n });\n if (response.status !== 200) {\n await response.body?.cancel().catch(() => {});\n if (response.status === 403) {\n continue;\n }\n break;\n }\n return {\n blobId: descriptor.blobId,\n byteLength: descriptor.byteLength,\n sha256: descriptor.sha256,\n encryptedBytes: response.body\n ? signedDownloadBodyStream(response.body)\n : bufferedResponseBodyStream(await response.arrayBuffer()),\n };\n } catch {\n // The downstream SDK still verifies length, hash and authenticated\n // encryption. An error after streaming begins propagates to that reader.\n }\n }\n // Preserve downloads when storage is unreachable or a native HTTP bridge\n // cannot use the signed URL. This endpoint checks current access again.\n // A storage failure alone must not signal that the API is offline.\n return getBlobStream(transport, blobId);\n}\n\nfunction signedDownloadBodyStream(\n stream: ReadableStream<Uint8Array>,\n): ReadableStream<Uint8Array> {\n const reader = stream.getReader();\n // Native network errors may contain the bearer URL. Keep failures generic\n // before downstream readers log them, without buffering or eager reads.\n return new ReadableStream<Uint8Array>(\n {\n async pull(controller) {\n try {\n const { done, value } = await reader.read();\n if (done) {\n controller.close();\n reader.releaseLock();\n } else {\n controller.enqueue(value);\n }\n } catch {\n controller.error(new Error(\"Blob download interrupted\"));\n reader.releaseLock();\n }\n },\n async cancel(reason) {\n try {\n await reader.cancel(reason);\n } catch {\n throw new Error(\"Blob download cancellation failed\");\n } finally {\n reader.releaseLock();\n }\n },\n },\n { highWaterMark: 0 },\n );\n}\n\nasync function getBlobStream(\n transport: Pick<BinaryResponseOperationTransport, \"requestBinaryResponse\">,\n blobId: string,\n): Promise<BlobBytesResponse | null> {\n const result = await transport.requestBinaryResponse(getBlobBytesOperation, {\n params: { blobId },\n });\n if (!result) {\n return null;\n }\n\n const { headers, response } = result;\n const byteLength = Number(headers[blobWireHeaderKeys.blobByteLength]);\n\n // On the browser / WKWebView-fetch path the body is streamed, so\n // `response.body` is a live ReadableStream. Under a native HTTP bridge\n // (CapacitorHttp — which the Capacitor iOS/Android builds enable so cross-origin\n // API requests reach the backend at all; the WKWebView's own fetch fails from\n // the app's https://localhost origin) the response is buffered natively and\n // `response.body` is null even for a valid 200. So take the bytes either way:\n // the stream when present, otherwise buffer the response and re-wrap it as a\n // one-shot ReadableStream so callers keep a single streaming interface. This\n // does not weaken validation — a truncated or corrupted body is still caught\n // downstream by the X-Tearleads-Blob-Sha256 integrity check; it only stops a\n // buffered-but-valid response from being rejected here as malformed.\n const encryptedBytes =\n response.body ?? bufferedResponseBodyStream(await response.arrayBuffer());\n\n return {\n blobId: headers[blobWireHeaderKeys.blobId],\n byteLength,\n encryptedBytes,\n sha256: headers[blobWireHeaderKeys.blobSha256],\n };\n}\n\n// Wraps a fully-buffered response body as a single-chunk ReadableStream, so a\n// native HTTP bridge that only exposes the buffered bytes (no WHATWG\n// `response.body` stream) can still satisfy the streaming\n// `BlobBytesResponse.encryptedBytes` contract. An empty buffer yields an\n// immediately-closed, zero-chunk stream.\nfunction bufferedResponseBodyStream(\n buffer: ArrayBuffer,\n): ReadableStream<Uint8Array> {\n const bytes = new Uint8Array(buffer);\n return new ReadableStream<Uint8Array>({\n start(controller) {\n if (bytes.byteLength > 0) {\n controller.enqueue(bytes);\n }\n controller.close();\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["get.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAsB5D,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,SAAgC,EAChC,MAAc,EACd,gBAA+B,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,EAC9D,UAAgC,EAAE;IAElC,wEAAwE;IACxE,4EAA4E;IAC5E,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO;YAAE,OAAO,IAAI,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,aAAa,CAC1C,wBAAwB,EACxB,EAAE,MAAM,EAAE,EA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AE,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC;QAC1C,UAAU;QACV,cAAc;QACd,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC;KAC/C,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,qEAAqE;AACrE,0DAA0D;AAC1D,yEAAyE;AACzE,yCAAyC;AACzC,SAAS,0BAA0B,CACjC,MAAmB;IAEnB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,IAAI,cAAc,CAAa;QACpC,KAAK,CAAC,UAAU;YACd,IAAI,KAAK,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;gBACzB,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;YACD,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n blobWireHeaderKeys,\n getBlobBytesOperation,\n getBlobDownloadOperation,\n} from \"@tearleads/validators/operation\";\nimport type { BinaryResponseOperationTransport } from \"../../binaryResponseOperationTransport\";\nimport type { JsonOperationTransport } from \"../../operationTransport\";\nimport type {\n OperationResponseRequestFn,\n RequestResultOptions,\n} from \"../../types\";\nimport { storageFetchOptions } from \"./storageFetchOptions\";\n\nexport interface BlobBytesResponse {\n readonly blobId: string;\n readonly byteLength: number;\n readonly encryptedBytes: ReadableStream<Uint8Array>;\n readonly sha256: string;\n}\n\nexport interface UploadMultipartBlobPartBytesRequest {\n readonly byteLength: number;\n readonly encryptedBytes: Blob | BufferSource;\n readonly sha256: string;\n readonly uploadId: string;\n}\n\ntype BlobDownloadTransport = Pick<JsonOperationTransport, \"requestResult\"> &\n Pick<BinaryResponseOperationTransport, \"requestBinaryResponse\"> &\n Pick<OperationResponseRequestFn, \"reportFailure\">;\n\ntype DownloadFetch = (url: string, init: RequestInit) => Promise<Response>;\n\nexport async function getBlobBytes(\n transport: BlobDownloadTransport,\n blobId: string,\n downloadFetch: DownloadFetch = (url, init) => fetch(url, init),\n options: RequestResultOptions = {},\n): Promise<BlobBytesResponse | null> {\n // Refresh at most once. R2 expiration errors can appear as CORS/network\n // failures in browsers, so both rejected fetches and 403s need a fresh URL.\n for (let attempt = 0; attempt < 2; attempt += 1) {\n if (options.signal?.aborted) return null;\n const result = await transport.requestResult(\n getBlobDownloadOperation,\n { params: { blobId } },\n { ...options, reportErrors: false },\n );\n if (!result.ok) {\n if (result.kind === \"http\" && result.status === 404) {\n return getBlobStream(transport, blobId, options);\n }\n result.report();\n return null;\n }\n const descriptor = result.data;\n if (descriptor.blobId !== blobId) {\n transport.reportFailure({\n kind: \"shape\",\n method: \"GET\",\n path: `/blobs/${blobId}/download`,\n status: 200,\n statusText: \"\",\n message: `Blob ${blobId} download descriptor has the wrong identity`,\n });\n return null;\n }\n if (descriptor.source.kind === \"api\") {\n return getBlobStream(transport, blobId, options);\n }\n try {\n // Never send the application's session or cookies to the object store.\n // Reject redirects and keep bearer URLs out of referrers and errors.\n const response = await downloadFetch(\n descriptor.source.url,\n storageFetchOptions(options),\n );\n if (response.status !== 200) {\n await response.body?.cancel().catch(() => {});\n if (response.status === 403) {\n continue;\n }\n break;\n }\n return await signedBlobResponse(descriptor, response);\n } catch {\n // The downstream SDK still verifies length, hash and authenticated\n // encryption. An error after streaming begins propagates to that reader.\n }\n }\n // Preserve downloads when storage is unreachable or a native HTTP bridge\n // cannot use the signed URL. This endpoint checks current access again.\n // A storage failure alone must not signal that the API is offline.\n return getBlobStream(transport, blobId, options);\n}\n\nasync function signedBlobResponse(\n descriptor: Pick<BlobBytesResponse, \"blobId\" | \"byteLength\" | \"sha256\">,\n response: Response,\n): Promise<BlobBytesResponse> {\n return {\n blobId: descriptor.blobId,\n byteLength: descriptor.byteLength,\n sha256: descriptor.sha256,\n encryptedBytes: response.body\n ? signedDownloadBodyStream(response.body)\n : bufferedResponseBodyStream(await response.arrayBuffer()),\n };\n}\n\nfunction signedDownloadBodyStream(\n stream: ReadableStream<Uint8Array>,\n): ReadableStream<Uint8Array> {\n const reader = stream.getReader();\n // Native network errors may contain the bearer URL. Keep failures generic\n // before downstream readers log them, without buffering or eager reads.\n return new ReadableStream<Uint8Array>(\n {\n async pull(controller) {\n try {\n const { done, value } = await reader.read();\n if (done) {\n controller.close();\n reader.releaseLock();\n } else {\n controller.enqueue(value);\n }\n } catch {\n controller.error(new Error(\"Blob download interrupted\"));\n reader.releaseLock();\n }\n },\n async cancel(reason) {\n try {\n await reader.cancel(reason);\n } catch {\n throw new Error(\"Blob download cancellation failed\");\n } finally {\n reader.releaseLock();\n }\n },\n },\n { highWaterMark: 0 },\n );\n}\n\nasync function getBlobStream(\n transport: Pick<BinaryResponseOperationTransport, \"requestBinaryResponse\">,\n blobId: string,\n options: RequestResultOptions,\n): Promise<BlobBytesResponse | null> {\n if (options.signal?.aborted) return null;\n const result = await transport.requestBinaryResponse(\n getBlobBytesOperation,\n {\n params: { blobId },\n },\n options,\n );\n if (!result) {\n return null;\n }\n\n const { headers, response } = result;\n const byteLength = Number(headers[blobWireHeaderKeys.blobByteLength]);\n\n // On the browser / WKWebView-fetch path the body is streamed, so\n // `response.body` is a live ReadableStream. Under a native HTTP bridge\n // (CapacitorHttp — which the Capacitor iOS/Android builds enable so cross-origin\n // API requests reach the backend at all; the WKWebView's own fetch fails from\n // the app's https://localhost origin) the response is buffered natively and\n // `response.body` is null even for a valid 200. So take the bytes either way:\n // the stream when present, otherwise buffer the response and re-wrap it as a\n // one-shot ReadableStream so callers keep a single streaming interface. This\n // does not weaken validation — a truncated or corrupted body is still caught\n // downstream by the X-Tearleads-Blob-Sha256 integrity check; it only stops a\n // buffered-but-valid response from being rejected here as malformed.\n const encryptedBytes =\n response.body ?? bufferedResponseBodyStream(await response.arrayBuffer());\n\n return {\n blobId: headers[blobWireHeaderKeys.blobId],\n byteLength,\n encryptedBytes,\n sha256: headers[blobWireHeaderKeys.blobSha256],\n };\n}\n\n// Wraps a fully-buffered response body as a single-chunk ReadableStream, so a\n// native HTTP bridge that only exposes the buffered bytes (no WHATWG\n// `response.body` stream) can still satisfy the streaming\n// `BlobBytesResponse.encryptedBytes` contract. An empty buffer yields an\n// immediately-closed, zero-chunk stream.\nfunction bufferedResponseBodyStream(\n buffer: ArrayBuffer,\n): ReadableStream<Uint8Array> {\n const bytes = new Uint8Array(buffer);\n return new ReadableStream<Uint8Array>({\n start(controller) {\n if (bytes.byteLength > 0) {\n controller.enqueue(bytes);\n }\n controller.close();\n },\n });\n}\n"]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { md5 } from "@noble/hashes/legacy.js";
|
|
2
|
+
import { bytesToHex } from "../../../crypto/index.js";
|
|
3
|
+
import { authorizeMultipartBlobPartUploadOperation, blobWireHeaderKeys, operationRequestPath, uploadMultipartBlobPartBytesOperation, } from "../../../validators/operation/index.js";
|
|
4
|
+
import { MAX_MULTIPART_BLOB_PART_BYTES } from "../../../validators/util/index.js";
|
|
5
|
+
import { storageFetchOptions } from "./storageFetchOptions.js";
|
|
6
|
+
function invalidPart(transport, path) {
|
|
7
|
+
transport.reportFailure({
|
|
8
|
+
kind: "shape",
|
|
9
|
+
method: authorizeMultipartBlobPartUploadOperation.method,
|
|
10
|
+
path,
|
|
11
|
+
status: null,
|
|
12
|
+
statusText: "",
|
|
13
|
+
message: "Multipart part bytes do not match the declared length or SHA-256",
|
|
14
|
+
});
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
async function retryStorageStatus(status, attempt) {
|
|
18
|
+
if (status === 403)
|
|
19
|
+
return true;
|
|
20
|
+
const transient = status === 429 || (status >= 500 && status <= 599);
|
|
21
|
+
if (transient && attempt === 0) {
|
|
22
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
23
|
+
}
|
|
24
|
+
return transient;
|
|
25
|
+
}
|
|
26
|
+
async function preparePart(input) {
|
|
27
|
+
// File snapshots mutable buffers and preserves ciphertext across Capacitor's
|
|
28
|
+
// native HTTP bridge. Uint8Array is UTF-8 decoded there; a plain Blob becomes
|
|
29
|
+
// JSON. File's base64 bridge path is byte-for-byte, including non-UTF-8 data.
|
|
30
|
+
const file = input.encryptedBytes instanceof File
|
|
31
|
+
? input.encryptedBytes
|
|
32
|
+
: new File([input.encryptedBytes], "encrypted-blob-part", {
|
|
33
|
+
type: "application/octet-stream",
|
|
34
|
+
});
|
|
35
|
+
if (file.size !== input.byteLength ||
|
|
36
|
+
file.size < 1 ||
|
|
37
|
+
file.size > MAX_MULTIPART_BLOB_PART_BYTES) {
|
|
38
|
+
throw new TypeError("Invalid multipart part byte length");
|
|
39
|
+
}
|
|
40
|
+
const bytes = await file.arrayBuffer();
|
|
41
|
+
if (bytesToHex(new Uint8Array(await crypto.subtle.digest("SHA-256", bytes))) !==
|
|
42
|
+
input.sha256) {
|
|
43
|
+
throw new TypeError("Multipart part SHA-256 does not match its bytes");
|
|
44
|
+
}
|
|
45
|
+
const contentMd5 = btoa(String.fromCharCode(...md5(new Uint8Array(bytes))));
|
|
46
|
+
return { file, contentMd5 };
|
|
47
|
+
}
|
|
48
|
+
export async function uploadMultipartBlobPartBytes(transport, stageId, partNumber, input, uploadFetch = (url, init) => fetch(url, init), options = {}) {
|
|
49
|
+
if (options.signal?.aborted)
|
|
50
|
+
return null;
|
|
51
|
+
const operation = authorizeMultipartBlobPartUploadOperation;
|
|
52
|
+
const params = { stageId, partNumber };
|
|
53
|
+
const path = operationRequestPath(operation, params);
|
|
54
|
+
const prepared = await preparePart(input).catch(() => invalidPart(transport, path));
|
|
55
|
+
if (!prepared)
|
|
56
|
+
return null;
|
|
57
|
+
const { file, contentMd5 } = prepared;
|
|
58
|
+
const body = {
|
|
59
|
+
byteLength: input.byteLength,
|
|
60
|
+
contentMd5,
|
|
61
|
+
uploadId: input.uploadId,
|
|
62
|
+
};
|
|
63
|
+
let status = null;
|
|
64
|
+
// Sign just in time for each part, not once for the entire file. A network
|
|
65
|
+
// failure may be an expired URL hidden by R2 CORS, or a lost success response;
|
|
66
|
+
// reauthorize once and send the same immutable bytes to the same part number.
|
|
67
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
68
|
+
if (options.signal?.aborted)
|
|
69
|
+
return null;
|
|
70
|
+
const result = await transport.requestResult(operation, { params, body }, options);
|
|
71
|
+
if (!result.ok)
|
|
72
|
+
return null;
|
|
73
|
+
const descriptor = result.data;
|
|
74
|
+
if (descriptor.stageId !== stageId ||
|
|
75
|
+
descriptor.uploadId !== input.uploadId ||
|
|
76
|
+
descriptor.partNumber !== partNumber ||
|
|
77
|
+
descriptor.byteLength !== input.byteLength ||
|
|
78
|
+
descriptor.contentMd5 !== contentMd5) {
|
|
79
|
+
transport.reportFailure({
|
|
80
|
+
kind: "shape",
|
|
81
|
+
method: operation.method,
|
|
82
|
+
path,
|
|
83
|
+
status: 200,
|
|
84
|
+
statusText: "",
|
|
85
|
+
message: "Multipart upload descriptor does not match its part",
|
|
86
|
+
});
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (descriptor.source.kind === "api") {
|
|
90
|
+
// A capability path for memory/custom stores; S3/R2 never proxy parts.
|
|
91
|
+
return transport.requestBinaryRequest(uploadMultipartBlobPartBytesOperation, {
|
|
92
|
+
params,
|
|
93
|
+
body: input.encryptedBytes,
|
|
94
|
+
headers: {
|
|
95
|
+
[blobWireHeaderKeys.partByteLength]: input.byteLength.toString(),
|
|
96
|
+
[blobWireHeaderKeys.partSha256]: input.sha256,
|
|
97
|
+
[blobWireHeaderKeys.partUploadId]: input.uploadId,
|
|
98
|
+
},
|
|
99
|
+
}, { ...options, encodeBody: () => file });
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const response = await uploadFetch(descriptor.source.url, {
|
|
103
|
+
method: "PUT",
|
|
104
|
+
body: file,
|
|
105
|
+
headers: {
|
|
106
|
+
"Content-Type": "application/octet-stream",
|
|
107
|
+
"Content-MD5": contentMd5,
|
|
108
|
+
},
|
|
109
|
+
...storageFetchOptions(options),
|
|
110
|
+
});
|
|
111
|
+
status = response.status;
|
|
112
|
+
const etag = response.headers.get("ETag")?.trim();
|
|
113
|
+
await response.body?.cancel().catch(() => { });
|
|
114
|
+
if (status === 200 && etag) {
|
|
115
|
+
return {
|
|
116
|
+
stageId,
|
|
117
|
+
uploadId: input.uploadId,
|
|
118
|
+
part: { byteLength: input.byteLength, partNumber, etag },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (!(await retryStorageStatus(status, attempt)))
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// Never expose a provider exception or body: it may contain the bearer URL.
|
|
126
|
+
status = null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (options.signal?.aborted)
|
|
130
|
+
return null;
|
|
131
|
+
reportStorageFailure(transport, path, partNumber, status);
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
function reportStorageFailure(transport, path, partNumber, status) {
|
|
135
|
+
transport.reportFailure({
|
|
136
|
+
kind: "storage",
|
|
137
|
+
method: authorizeMultipartBlobPartUploadOperation.method,
|
|
138
|
+
path,
|
|
139
|
+
status,
|
|
140
|
+
statusText: "",
|
|
141
|
+
message: status === 200
|
|
142
|
+
? `Multipart part ${partNumber} storage response is missing ETag; check storage CORS exposure`
|
|
143
|
+
: `Multipart part ${partNumber} storage upload failed${status === null ? "" : ` (HTTP ${status})`}`,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=multipartUpload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multipartUpload.js","sourceRoot":"","sources":["multipartUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,yCAAyC,EACzC,kBAAkB,EAClB,oBAAoB,EACpB,qCAAqC,GACtC,MAAM,iCAAiC,CAAC;AA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C5E,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO;QAAE,OAAO,IAAI,CAAC;IACzC,oBAAoB,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,oBAAoB,CAC3B,SAA6B,EAC7B,IAAY,EACZ,UAAkB,EAClB,MAAqB;IAErB,SAAS,CAAC,aAAa,CAAC;QACtB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,yCAAyC,CAAC,MAAM;QACxD,IAAI;QACJ,MAAM;QACN,UAAU,EAAE,EAAE;QACd,OAAO,EACL,MAAM,KAAK,GAAG;YACZ,CAAC,CAAC,kBAAkB,UAAU,gEAAgE;YAC9F,CAAC,CAAC,kBAAkB,UAAU,yBAAyB,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,MAAM,GAAG,EAAE;KACxG,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { md5 } from \"@noble/hashes/legacy.js\";\nimport { bytesToHex } from \"@tearleads/crypto\";\nimport {\n authorizeMultipartBlobPartUploadOperation,\n blobWireHeaderKeys,\n operationRequestPath,\n uploadMultipartBlobPartBytesOperation,\n} from \"@tearleads/validators/operation\";\nimport type { UploadMultipartBlobPartResponse } from \"@tearleads/validators/response\";\nimport { MAX_MULTIPART_BLOB_PART_BYTES } from \"@tearleads/validators/util\";\nimport type { OperationTransport } from \"../../operationTransportFactory\";\nimport type { RequestResultOptions } from \"../../types\";\nimport type { UploadMultipartBlobPartBytesRequest } from \"./get\";\nimport { storageFetchOptions } from \"./storageFetchOptions\";\n\ntype UploadFetch = (url: string, init: RequestInit) => Promise<Response>;\n\nfunction invalidPart(transport: OperationTransport, path: string) {\n transport.reportFailure({\n kind: \"shape\",\n method: authorizeMultipartBlobPartUploadOperation.method,\n path,\n status: null,\n statusText: \"\",\n message: \"Multipart part bytes do not match the declared length or SHA-256\",\n });\n return null;\n}\n\nasync function retryStorageStatus(status: number, attempt: number) {\n if (status === 403) return true;\n const transient = status === 429 || (status >= 500 && status <= 599);\n if (transient && attempt === 0) {\n await new Promise<void>((resolve) => setTimeout(resolve, 250));\n }\n return transient;\n}\n\nasync function preparePart(input: UploadMultipartBlobPartBytesRequest) {\n // File snapshots mutable buffers and preserves ciphertext across Capacitor's\n // native HTTP bridge. Uint8Array is UTF-8 decoded there; a plain Blob becomes\n // JSON. File's base64 bridge path is byte-for-byte, including non-UTF-8 data.\n const file =\n input.encryptedBytes instanceof File\n ? input.encryptedBytes\n : new File([input.encryptedBytes], \"encrypted-blob-part\", {\n type: \"application/octet-stream\",\n });\n if (\n file.size !== input.byteLength ||\n file.size < 1 ||\n file.size > MAX_MULTIPART_BLOB_PART_BYTES\n ) {\n throw new TypeError(\"Invalid multipart part byte length\");\n }\n const bytes = await file.arrayBuffer();\n if (\n bytesToHex(new Uint8Array(await crypto.subtle.digest(\"SHA-256\", bytes))) !==\n input.sha256\n ) {\n throw new TypeError(\"Multipart part SHA-256 does not match its bytes\");\n }\n const contentMd5 = btoa(String.fromCharCode(...md5(new Uint8Array(bytes))));\n return { file, contentMd5 };\n}\n\nexport async function uploadMultipartBlobPartBytes(\n transport: OperationTransport,\n stageId: string,\n partNumber: number,\n input: UploadMultipartBlobPartBytesRequest,\n uploadFetch: UploadFetch = (url, init) => fetch(url, init),\n options: RequestResultOptions = {},\n): Promise<UploadMultipartBlobPartResponse | null> {\n if (options.signal?.aborted) return null;\n const operation = authorizeMultipartBlobPartUploadOperation;\n const params = { stageId, partNumber };\n const path = operationRequestPath(operation, params);\n const prepared = await preparePart(input).catch(() =>\n invalidPart(transport, path),\n );\n if (!prepared) return null;\n const { file, contentMd5 } = prepared;\n const body = {\n byteLength: input.byteLength,\n contentMd5,\n uploadId: input.uploadId,\n };\n let status: number | null = null;\n // Sign just in time for each part, not once for the entire file. A network\n // failure may be an expired URL hidden by R2 CORS, or a lost success response;\n // reauthorize once and send the same immutable bytes to the same part number.\n for (let attempt = 0; attempt < 2; attempt += 1) {\n if (options.signal?.aborted) return null;\n const result = await transport.requestResult(\n operation,\n { params, body },\n options,\n );\n if (!result.ok) return null;\n const descriptor = result.data;\n if (\n descriptor.stageId !== stageId ||\n descriptor.uploadId !== input.uploadId ||\n descriptor.partNumber !== partNumber ||\n descriptor.byteLength !== input.byteLength ||\n descriptor.contentMd5 !== contentMd5\n ) {\n transport.reportFailure({\n kind: \"shape\",\n method: operation.method,\n path,\n status: 200,\n statusText: \"\",\n message: \"Multipart upload descriptor does not match its part\",\n });\n return null;\n }\n if (descriptor.source.kind === \"api\") {\n // A capability path for memory/custom stores; S3/R2 never proxy parts.\n return transport.requestBinaryRequest(\n uploadMultipartBlobPartBytesOperation,\n {\n params,\n body: input.encryptedBytes,\n headers: {\n [blobWireHeaderKeys.partByteLength]: input.byteLength.toString(),\n [blobWireHeaderKeys.partSha256]: input.sha256,\n [blobWireHeaderKeys.partUploadId]: input.uploadId,\n },\n },\n { ...options, encodeBody: () => file },\n );\n }\n try {\n const response = await uploadFetch(descriptor.source.url, {\n method: \"PUT\",\n body: file,\n headers: {\n \"Content-Type\": \"application/octet-stream\",\n \"Content-MD5\": contentMd5,\n },\n ...storageFetchOptions(options),\n });\n status = response.status;\n const etag = response.headers.get(\"ETag\")?.trim();\n await response.body?.cancel().catch(() => {});\n if (status === 200 && etag) {\n return {\n stageId,\n uploadId: input.uploadId,\n part: { byteLength: input.byteLength, partNumber, etag },\n };\n }\n if (!(await retryStorageStatus(status, attempt))) break;\n } catch {\n // Never expose a provider exception or body: it may contain the bearer URL.\n status = null;\n }\n }\n if (options.signal?.aborted) return null;\n reportStorageFailure(transport, path, partNumber, status);\n return null;\n}\n\nfunction reportStorageFailure(\n transport: OperationTransport,\n path: string,\n partNumber: number,\n status: number | null,\n) {\n transport.reportFailure({\n kind: \"storage\",\n method: authorizeMultipartBlobPartUploadOperation.method,\n path,\n status,\n statusText: \"\",\n message:\n status === 200\n ? `Multipart part ${partNumber} storage response is missing ETag; check storage CORS exposure`\n : `Multipart part ${partNumber} storage upload failed${status === null ? \"\" : ` (HTTP ${status})`}`,\n });\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Keep bearer URLs and application credentials out of object-store requests. */
|
|
2
|
+
export function storageFetchOptions(options) {
|
|
3
|
+
return {
|
|
4
|
+
cache: "no-store",
|
|
5
|
+
credentials: "omit",
|
|
6
|
+
redirect: "error",
|
|
7
|
+
referrerPolicy: "no-referrer",
|
|
8
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=storageFetchOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageFetchOptions.js","sourceRoot":"","sources":["storageFetchOptions.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,CACjC,OAA6B;IAE7B,OAAO;QACL,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,OAAO;QACjB,cAAc,EAAE,aAAa;QAC7B,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,CAAC;AACJ,CAAC","sourcesContent":["import type { RequestResultOptions } from \"../../types\";\n\n/** Keep bearer URLs and application credentials out of object-store requests. */\nexport function storageFetchOptions(\n options: RequestResultOptions,\n): RequestInit {\n return {\n cache: \"no-store\",\n credentials: \"omit\",\n redirect: \"error\",\n referrerPolicy: \"no-referrer\",\n ...(options.signal ? { signal: options.signal } : {}),\n };\n}\n"]}
|
|
@@ -21,7 +21,7 @@ export interface RequestResultOptions {
|
|
|
21
21
|
}
|
|
22
22
|
export type OperationRequestFn = <T>(path: string, validator: (value: unknown) => value is T, method: HttpMethod, body: RequestBody | undefined, options: RequestResultOptions | undefined, failureOperation: HttpOperation) => Promise<T | null>;
|
|
23
23
|
export type OperationRequestResultFn = <T>(path: string, validator: (value: unknown) => value is T, method: HttpMethod, body: RequestBody | undefined, options: RequestResultOptions | undefined, failureOperation: HttpOperation) => Promise<RequestResult<T>>;
|
|
24
|
-
export type RequestFailureKind = "http" | "network" | "json" | "shape" | "cancelled" | "outcome-unknown";
|
|
24
|
+
export type RequestFailureKind = "storage" | "http" | "network" | "json" | "shape" | "cancelled" | "outcome-unknown";
|
|
25
25
|
export interface RequestFailure {
|
|
26
26
|
readonly code?: string | undefined;
|
|
27
27
|
readonly kind: RequestFailureKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DocumentAttributionRangesQuery,\n HttpOperation,\n HttpOperationMethod,\n} from \"@tearleads/validators/operation\";\nimport type {\n ReferencedPrincipalStateResponse,\n SyncWatermark,\n} from \"@tearleads/validators/response\";\n\nexport type HttpMethod = HttpOperationMethod;\nexport type RequestBody = BodyInit;\n\nexport interface ListContainerDocumentsOptions {\n limit?: number;\n watermark?: SyncWatermark | null;\n}\n\nexport type ListDocumentEditAttributionRangesOptions = Omit<\n DocumentAttributionRangesQuery,\n \"cursor\"\n> & {\n cursor?: DocumentAttributionRangesQuery[\"cursor\"] | null;\n};\n\nexport interface RequestResultOptions {\n readonly signal?: AbortSignal | undefined;\n /** Expected target for a declared 402; mismatched response identities fail closed. */\n readonly expectedPaymentRequiredOrganizationId?: string | undefined;\n readonly headers?: Record<string, string> | undefined;\n readonly reportErrors?: boolean | undefined;\n /** Called after this request or a concurrent request renews the same session. */\n readonly onSessionRenewed?: (() => void) | undefined;\n readonly retryOnSessionExpired?: boolean | \"renew-only\" | undefined;\n}\n\nexport type OperationRequestFn = <T>(\n path: string,\n validator: (value: unknown) => value is T,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n failureOperation: HttpOperation,\n) => Promise<T | null>;\n\nexport type OperationRequestResultFn = <T>(\n path: string,\n validator: (value: unknown) => value is T,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n failureOperation: HttpOperation,\n) => Promise<RequestResult<T>>;\n\nexport type RequestFailureKind =\n | \"http\"\n | \"network\"\n | \"json\"\n | \"shape\"\n | \"cancelled\"\n | \"outcome-unknown\";\n\nexport interface RequestFailure {\n readonly code?: string | undefined;\n readonly kind: RequestFailureKind;\n readonly message: string;\n readonly method: HttpMethod;\n readonly ok: false;\n readonly path: string;\n readonly report: () => void;\n readonly status: number | null;\n readonly statusText: string;\n readonly stalePrincipalHeads?: ReferencedPrincipalStateResponse[] | undefined;\n /**\n * With `container_descendant_rekeys_required`, the full owed set, parent-first;\n * with `container_descendant_rekeys_inaccessible`, its unwritable subset.\n * A hint, never authority; verify each container before signing for it.\n */\n readonly requiredContainerIds?: readonly string[] | undefined;\n}\n\nexport interface RequestSuccess<T> {\n readonly data: T;\n readonly ok: true;\n}\n\nexport type RequestResult<T> = RequestFailure | RequestSuccess<T>;\n\nexport interface ResponseRequestValidationFailureInput {\n readonly code?: string | undefined;\n readonly kind: RequestFailureKind;\n readonly message: string;\n readonly method: HttpMethod;\n readonly options?: RequestResultOptions | undefined;\n readonly path: string;\n readonly status: number | null;\n readonly statusText: string;\n}\n\nexport interface OperationResponseRequestFn {\n (\n path: string,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n additionalSuccessStatuses: readonly number[],\n failureOperation: HttpOperation,\n ): Promise<RequestResult<Response>>;\n readonly reportFailure: (\n input: ResponseRequestValidationFailureInput,\n ) => RequestFailure;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DocumentAttributionRangesQuery,\n HttpOperation,\n HttpOperationMethod,\n} from \"@tearleads/validators/operation\";\nimport type {\n ReferencedPrincipalStateResponse,\n SyncWatermark,\n} from \"@tearleads/validators/response\";\n\nexport type HttpMethod = HttpOperationMethod;\nexport type RequestBody = BodyInit;\n\nexport interface ListContainerDocumentsOptions {\n limit?: number;\n watermark?: SyncWatermark | null;\n}\n\nexport type ListDocumentEditAttributionRangesOptions = Omit<\n DocumentAttributionRangesQuery,\n \"cursor\"\n> & {\n cursor?: DocumentAttributionRangesQuery[\"cursor\"] | null;\n};\n\nexport interface RequestResultOptions {\n readonly signal?: AbortSignal | undefined;\n /** Expected target for a declared 402; mismatched response identities fail closed. */\n readonly expectedPaymentRequiredOrganizationId?: string | undefined;\n readonly headers?: Record<string, string> | undefined;\n readonly reportErrors?: boolean | undefined;\n /** Called after this request or a concurrent request renews the same session. */\n readonly onSessionRenewed?: (() => void) | undefined;\n readonly retryOnSessionExpired?: boolean | \"renew-only\" | undefined;\n}\n\nexport type OperationRequestFn = <T>(\n path: string,\n validator: (value: unknown) => value is T,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n failureOperation: HttpOperation,\n) => Promise<T | null>;\n\nexport type OperationRequestResultFn = <T>(\n path: string,\n validator: (value: unknown) => value is T,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n failureOperation: HttpOperation,\n) => Promise<RequestResult<T>>;\n\nexport type RequestFailureKind =\n | \"storage\"\n | \"http\"\n | \"network\"\n | \"json\"\n | \"shape\"\n | \"cancelled\"\n | \"outcome-unknown\";\n\nexport interface RequestFailure {\n readonly code?: string | undefined;\n readonly kind: RequestFailureKind;\n readonly message: string;\n readonly method: HttpMethod;\n readonly ok: false;\n readonly path: string;\n readonly report: () => void;\n readonly status: number | null;\n readonly statusText: string;\n readonly stalePrincipalHeads?: ReferencedPrincipalStateResponse[] | undefined;\n /**\n * With `container_descendant_rekeys_required`, the full owed set, parent-first;\n * with `container_descendant_rekeys_inaccessible`, its unwritable subset.\n * A hint, never authority; verify each container before signing for it.\n */\n readonly requiredContainerIds?: readonly string[] | undefined;\n}\n\nexport interface RequestSuccess<T> {\n readonly data: T;\n readonly ok: true;\n}\n\nexport type RequestResult<T> = RequestFailure | RequestSuccess<T>;\n\nexport interface ResponseRequestValidationFailureInput {\n readonly code?: string | undefined;\n readonly kind: RequestFailureKind;\n readonly message: string;\n readonly method: HttpMethod;\n readonly options?: RequestResultOptions | undefined;\n readonly path: string;\n readonly status: number | null;\n readonly statusText: string;\n}\n\nexport interface OperationResponseRequestFn {\n (\n path: string,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n additionalSuccessStatuses: readonly number[],\n failureOperation: HttpOperation,\n ): Promise<RequestResult<Response>>;\n readonly reportFailure: (\n input: ResponseRequestValidationFailureInput,\n ) => RequestFailure;\n}\n"]}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { registerJsonSchemaFragment } from "../jsonSchema.js";
|
|
3
2
|
import { ErrorResponseSchema, SessionFailureResponseSchema } from "../response/index.js";
|
|
4
3
|
import { safeNonNegativeIntegerSchema, sha256HexStringSchema, uuidStringSchema, } from "../schema.js";
|
|
5
4
|
import { BlobBytesPathParamsSchema } from "./blobBytes.js";
|
|
5
|
+
import { signedBlobUrlExpirySchema, signedBlobUrlSchema, } from "./blobTransferSchemas.js";
|
|
6
6
|
import { defineJsonOperation } from "./definition.js";
|
|
7
|
-
const downloadUrlSchema = z.url().regex(/^https?:\/\//u);
|
|
8
|
-
const downloadExpirySchema = z.iso.datetime();
|
|
9
|
-
function stringSchemaFragment(schema) {
|
|
10
|
-
const { $schema: _dialect, ...fragment } = z.toJSONSchema(schema);
|
|
11
|
-
return registerJsonSchemaFragment(z.custom((value) => schema.safeParse(value).success), fragment);
|
|
12
|
-
}
|
|
13
7
|
export const BlobDownloadResponseSchema = z.strictObject({
|
|
14
8
|
blobId: uuidStringSchema,
|
|
15
9
|
byteLength: safeNonNegativeIntegerSchema,
|
|
@@ -18,8 +12,8 @@ export const BlobDownloadResponseSchema = z.strictObject({
|
|
|
18
12
|
z.strictObject({ kind: z.literal("api") }),
|
|
19
13
|
z.strictObject({
|
|
20
14
|
kind: z.literal("signed-url"),
|
|
21
|
-
url:
|
|
22
|
-
expiresAt:
|
|
15
|
+
url: signedBlobUrlSchema,
|
|
16
|
+
expiresAt: signedBlobUrlExpirySchema,
|
|
23
17
|
}),
|
|
24
18
|
]),
|
|
25
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobDownloads.js","sourceRoot":"","sources":["blobDownloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"blobDownloads.js","sourceRoot":"","sources":["blobDownloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IACvD,MAAM,EAAE,gBAAgB;IACxB,UAAU,EAAE,4BAA4B;IACxC,MAAM,EAAE,qBAAqB;IAC7B,MAAM,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;QACnC,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1C,CAAC,CAAC,YAAY,CAAC;YACb,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;YAC7B,GAAG,EAAE,mBAAmB;YACxB,SAAS,EAAE,yBAAyB;SACrC,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;IAC1D,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE;QAChB,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,4BAA4B;QACjC,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;KACzB;IACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC/C,EAAE,EAAE,oBAAoB;IACxB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,yBAAyB;IACjC,IAAI,EAAE,0BAA0B;IAChC,SAAS,EAAE,EAAE,GAAG,EAAE,0BAA0B,EAAE;CAC/C,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { ErrorResponseSchema, SessionFailureResponseSchema } from \"../response\";\nimport {\n safeNonNegativeIntegerSchema,\n sha256HexStringSchema,\n uuidStringSchema,\n} from \"../schema\";\nimport { BlobBytesPathParamsSchema } from \"./blobBytes\";\nimport {\n signedBlobUrlExpirySchema,\n signedBlobUrlSchema,\n} from \"./blobTransferSchemas\";\nimport { defineJsonOperation } from \"./definition\";\n\nexport const BlobDownloadResponseSchema = z.strictObject({\n blobId: uuidStringSchema,\n byteLength: safeNonNegativeIntegerSchema,\n sha256: sha256HexStringSchema,\n source: z.discriminatedUnion(\"kind\", [\n z.strictObject({ kind: z.literal(\"api\") }),\n z.strictObject({\n kind: z.literal(\"signed-url\"),\n url: signedBlobUrlSchema,\n expiresAt: signedBlobUrlExpirySchema,\n }),\n ]),\n});\n\nexport type BlobDownloadResponse = z.infer<typeof BlobDownloadResponseSchema>;\n\nexport const getBlobDownloadOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 409, 500],\n id: \"blobs.download.get\",\n method: \"GET\",\n params: BlobBytesPathParamsSchema,\n path: \"/blobs/{blobId}/download\",\n responses: { 200: BlobDownloadResponseSchema },\n});\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { registerJsonSchemaFragment } from "../jsonSchema.js";
|
|
3
|
+
function stringSchemaFragment(schema) {
|
|
4
|
+
const { $schema: _dialect, ...fragment } = z.toJSONSchema(schema);
|
|
5
|
+
return registerJsonSchemaFragment(z.custom((value) => schema.safeParse(value).success), fragment);
|
|
6
|
+
}
|
|
7
|
+
export const signedBlobUrlSchema = stringSchemaFragment(z.url().regex(/^https?:\/\//u));
|
|
8
|
+
export const signedBlobUrlExpirySchema = stringSchemaFragment(z.iso.datetime());
|
|
9
|
+
// R2 transport checksum; assembled SHA-256 remains the application authority.
|
|
10
|
+
export const blobPartContentMd5Schema = stringSchemaFragment(z.string().regex(/^[A-Za-z0-9+/]{21}[AQgw]==$/u));
|
|
11
|
+
//# sourceMappingURL=blobTransferSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blobTransferSchemas.js","sourceRoot":"","sources":["blobTransferSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3D,SAAS,oBAAoB,CAAC,MAAyB;IACrD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,GAAG,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClE,OAAO,0BAA0B,CAC/B,CAAC,CAAC,MAAM,CAAS,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAC5D,QAAQ,CACT,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CACrD,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAC/B,CAAC;AACF,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEhF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAC1D,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,CACjD,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { registerJsonSchemaFragment } from \"../jsonSchema\";\n\nfunction stringSchemaFragment(schema: z.ZodType<string>) {\n const { $schema: _dialect, ...fragment } = z.toJSONSchema(schema);\n return registerJsonSchemaFragment(\n z.custom<string>((value) => schema.safeParse(value).success),\n fragment,\n );\n}\n\nexport const signedBlobUrlSchema = stringSchemaFragment(\n z.url().regex(/^https?:\\/\\//u),\n);\nexport const signedBlobUrlExpirySchema = stringSchemaFragment(z.iso.datetime());\n\n// R2 transport checksum; assembled SHA-256 remains the application authority.\nexport const blobPartContentMd5Schema = stringSchemaFragment(\n z.string().regex(/^[A-Za-z0-9+/]{21}[AQgw]==$/u),\n);\n"]}
|
|
@@ -14,6 +14,7 @@ export { type DocumentSyncPathParams, DocumentSyncPathParamsSchema, documentSync
|
|
|
14
14
|
export { operationRequestHeaderNames, operationResponseHeaderNames, } from "./headerNames.js";
|
|
15
15
|
export { getHealthOperation, isGetHealthOperationResponse, } from "./health.js";
|
|
16
16
|
export { completeMultipartBlobStageOperation, getMultipartBlobStageOperation, initiateMultipartBlobStageOperation, isCompleteMultipartBlobStageOperationRequest, isCompleteMultipartBlobStageOperationResponse, isGetMultipartBlobStageOperationResponse, isInitiateMultipartBlobStageOperationRequest, isInitiateMultipartBlobStageOperationResponse, type MultipartBlobStagePathParams, MultipartBlobStagePathParamsSchema, } from "./multipartBlobs.js";
|
|
17
|
+
export { authorizeMultipartBlobPartUploadOperation, type MultipartBlobPartUploadRequest, MultipartBlobPartUploadRequestSchema, type MultipartBlobPartUploadResponse, MultipartBlobPartUploadResponseSchema, } from "./multipartPartUploads.js";
|
|
17
18
|
export { claimNativeOrganizationSubscriptionOperation, getOrganizationBillingHistoryOperation, getOrganizationBillingManagementUrlOperation, getOrganizationBillingOperation, getOrganizationNativePurchaseEligibilityOperation, isClaimNativeOrganizationSubscriptionOperationResponse, isGetOrganizationBillingHistoryOperationResponse, isGetOrganizationBillingManagementUrlOperationResponse, isGetOrganizationBillingOperationResponse, isGetOrganizationNativePurchaseEligibilityOperationResponse, isStartOrganizationTrialOperationResponse, type OrganizationBillingNativeClaimPathParams, OrganizationBillingNativeClaimPathParamsSchema, type OrganizationBillingNativeEligibilityQuery, OrganizationBillingNativeEligibilityQuerySchema, type OrganizationBillingPathParams, OrganizationBillingPathParamsSchema, startOrganizationTrialOperation, } from "./organizationBilling.js";
|
|
18
19
|
export { getOrganizationPolicyHistoryOperation } from "./organizationPolicyHistory.js";
|
|
19
20
|
export { createOrganizationGroupOperation, createOrganizationOperation, deleteOrganizationGroupOperation, getOrganizationDataUsageOperation, getOrganizationReadModelOperation, isCreateOrganizationGroupOperationRequest, isCreateOrganizationGroupOperationResponse, isCreateOrganizationOperationRequest, isCreateOrganizationOperationResponse, isDeleteOrganizationGroupOperationResponse, isGetOrganizationDataUsageOperationResponse, isGetOrganizationReadModelOperationResponse, isListOrganizationGroupMembersOperationResponse, isUpdateOrganizationProfileOperationRequest, isUpdateOrganizationProfileOperationResponse, isUpdateOrganizationRosterEntryOperationRequest, isUpdateOrganizationRosterEntryOperationResponse, listOrganizationGroupMembersOperation, type OrganizationGroupPathParams, OrganizationGroupPathParamsSchema, type OrganizationPathParams, OrganizationPathParamsSchema, type OrganizationRosterPathParams, OrganizationRosterPathParamsSchema, updateOrganizationProfileOperation, updateOrganizationRosterEntryOperation, } from "./organizations.js";
|
|
@@ -14,6 +14,7 @@ export { DocumentSyncPathParamsSchema, documentSyncOperation, isDocumentSyncOper
|
|
|
14
14
|
export { operationRequestHeaderNames, operationResponseHeaderNames, } from "./headerNames.js";
|
|
15
15
|
export { getHealthOperation, isGetHealthOperationResponse, } from "./health.js";
|
|
16
16
|
export { completeMultipartBlobStageOperation, getMultipartBlobStageOperation, initiateMultipartBlobStageOperation, isCompleteMultipartBlobStageOperationRequest, isCompleteMultipartBlobStageOperationResponse, isGetMultipartBlobStageOperationResponse, isInitiateMultipartBlobStageOperationRequest, isInitiateMultipartBlobStageOperationResponse, MultipartBlobStagePathParamsSchema, } from "./multipartBlobs.js";
|
|
17
|
+
export { authorizeMultipartBlobPartUploadOperation, MultipartBlobPartUploadRequestSchema, MultipartBlobPartUploadResponseSchema, } from "./multipartPartUploads.js";
|
|
17
18
|
export { claimNativeOrganizationSubscriptionOperation, getOrganizationBillingHistoryOperation, getOrganizationBillingManagementUrlOperation, getOrganizationBillingOperation, getOrganizationNativePurchaseEligibilityOperation, isClaimNativeOrganizationSubscriptionOperationResponse, isGetOrganizationBillingHistoryOperationResponse, isGetOrganizationBillingManagementUrlOperationResponse, isGetOrganizationBillingOperationResponse, isGetOrganizationNativePurchaseEligibilityOperationResponse, isStartOrganizationTrialOperationResponse, OrganizationBillingNativeClaimPathParamsSchema, OrganizationBillingNativeEligibilityQuerySchema, OrganizationBillingPathParamsSchema, startOrganizationTrialOperation, } from "./organizationBilling.js";
|
|
18
19
|
export { getOrganizationPolicyHistoryOperation } from "./organizationPolicyHistory.js";
|
|
19
20
|
export { createOrganizationGroupOperation, createOrganizationOperation, deleteOrganizationGroupOperation, getOrganizationDataUsageOperation, getOrganizationReadModelOperation, isCreateOrganizationGroupOperationRequest, isCreateOrganizationGroupOperationResponse, isCreateOrganizationOperationRequest, isCreateOrganizationOperationResponse, isDeleteOrganizationGroupOperationResponse, isGetOrganizationDataUsageOperationResponse, isGetOrganizationReadModelOperationResponse, isListOrganizationGroupMembersOperationResponse, isUpdateOrganizationProfileOperationRequest, isUpdateOrganizationProfileOperationResponse, isUpdateOrganizationRosterEntryOperationRequest, isUpdateOrganizationRosterEntryOperationResponse, listOrganizationGroupMembersOperation, OrganizationGroupPathParamsSchema, OrganizationPathParamsSchema, OrganizationRosterPathParamsSchema, updateOrganizationProfileOperation, updateOrganizationRosterEntryOperation, } from "./organizations.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAEL,qCAAqC,EAErC,8BAA8B,EAC9B,2BAA2B,EAE3B,mCAAmC,EACnC,6BAA6B,EAC7B,oCAAoC,EACpC,qCAAqC,EACrC,sCAAsC,EACtC,uCAAuC,EACvC,0CAA0C,EAC1C,gCAAgC,GACjC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,iCAAiC,EACjC,+BAA+B,EAC/B,yBAAyB,EACzB,8BAA8B,EAC9B,+BAA+B,EAC/B,+BAA+B,EAC/B,wBAAwB,EACxB,yBAAyB,EACzB,kCAAkC,EAClC,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,wBAAwB,GACzB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAC7B,0CAA0C,EAC1C,2CAA2C,EAC3C,sCAAsC,EACtC,uCAAuC,EAEvC,8BAA8B,EAC9B,iCAAiC,EACjC,6BAA6B,EAE7B,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AA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C/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sCAAsC,EACtC,2BAA2B,EAC3B,+CAA+C,EAC/C,gDAAgD,EAChD,qCAAqC,EACrC,oCAAoC,EACpC,qCAAqC,EAErC,uCAAuC,EAEvC,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mCAAmC,EAEnC,kCAAkC,GACnC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,qCAAqC,EACrC,gDAAgD,EAChD,2BAA2B,EAC3B,sCAAsC,EACtC,2BAA2B,EAE3B,yBAAyB,EAEzB,4BAA4B,GAC7B,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,qCAAqC,EACrC,4BAA4B,EAC5B,gCAAgC,EAChC,uCAAuC,EACvC,8BAA8B,GAG/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iCAAiC,EACjC,6BAA6B,EAC7B,oCAAoC,EACpC,2BAA2B,EAC3B,iCAAiC,EACjC,2CAA2C,EAC3C,uCAAuC,EACvC,6CAA6C,EAC7C,8CAA8C,EAC9C,oCAAoC,EACpC,qCAAqC,EACrC,2CAA2C,EAE3C,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,yCAAyC,EAEzC,wCAAwC,EACxC,qCAAqC,EACrC,oCAAoC,EACpC,+CAA+C,EAC/C,8CAA8C,GAC/C,MAAM,qBAAqB,CAAC","sourcesContent":["export { apiVersionHeaderName, parseApiVersion } from \"./apiVersion\";\nexport {\n type BlobAttachmentBindingPathParams,\n BlobAttachmentBindingPathParamsSchema,\n type BlobAttachmentPathParams,\n BlobAttachmentPathParamsSchema,\n bindBlobAttachmentOperation,\n type DocumentAttachmentsPathParams,\n DocumentAttachmentsPathParamsSchema,\n detachBlobAttachmentOperation,\n isBindBlobAttachmentOperationRequest,\n isBindBlobAttachmentOperationResponse,\n isDetachBlobAttachmentOperationRequest,\n isDetachBlobAttachmentOperationResponse,\n isListDocumentAttachmentsOperationResponse,\n listDocumentAttachmentsOperation,\n} from \"./attachments\";\nexport {\n challengeOperation,\n destroySessionOperation,\n isChallengeOperationRequest,\n isChallengeOperationResponse,\n isDestroySessionOperationResponse,\n isListSessionsOperationResponse,\n isLogoutOperationResponse,\n isRegistrationOperationRequest,\n isRegistrationOperationResponse,\n isUserIdentityOperationResponse,\n isVerifyOperationRequest,\n isVerifyOperationResponse,\n isWebSocketTicketOperationResponse,\n listSessionsOperation,\n logoutOperation,\n registerOperation,\n userIdentityOperation,\n verifyOperation,\n webSocketTicketOperation,\n} from \"./auth\";\nexport {\n billingWebhookWireHeaderKeys,\n billingWebhookWireHeaderNames,\n isReceiveRevenueCatWebhookOperationRequest,\n isReceiveRevenueCatWebhookOperationResponse,\n isReceiveStripeWebhookOperationRequest,\n isReceiveStripeWebhookOperationResponse,\n type RevenueCatWebhookHeaders,\n RevenueCatWebhookHeadersSchema,\n receiveRevenueCatWebhookOperation,\n receiveStripeWebhookOperation,\n type StripeWebhookHeaders,\n StripeWebhookHeadersSchema,\n} from \"./billingWebhooks\";\nexport {\n BinaryBodySchema,\n type BlobBytesPathParams,\n BlobBytesPathParamsSchema,\n type BlobBytesResponseHeaders,\n BlobBytesResponseHeadersSchema,\n blobWireHeaderKeys,\n blobWireHeaderNames,\n getBlobBytesOperation,\n isUploadMultipartBlobPartBytesOperationResponse,\n type MultipartBlobPartHeaders,\n MultipartBlobPartHeadersSchema,\n type MultipartBlobPartPathParams,\n MultipartBlobPartPathParamsSchema,\n uploadMultipartBlobPartBytesOperation,\n} from \"./blobBytes\";\nexport {\n type BlobDownloadResponse,\n BlobDownloadResponseSchema,\n getBlobDownloadOperation,\n} from \"./blobDownloads\";\nexport {\n type ContainerMutationPathParams,\n ContainerMutationPathParamsSchema,\n createContainerOperation,\n createContainerWithMetadataDocumentOperation,\n deleteContainerOperation,\n isContainerMutationOperationRequest,\n isContainerMutationOperationResponse,\n isContainerRotationOperationRequest,\n isContainerRotationOperationResponse,\n isCreateContainerWithMetadataDocumentOperationRequest,\n isCreateContainerWithMetadataDocumentOperationResponse,\n isDeleteContainerOperationResponse,\n moveContainerOperation,\n reciteContainerOperation,\n rekeyContainerOperation,\n revokeContainerOperation,\n shareContainerOperation,\n} from \"./containerMutations\";\nexport {\n type ContainerKekLogQuery,\n ContainerKekLogQuerySchema,\n type ContainerReadPathParams,\n ContainerReadPathParamsSchema,\n getContainerKekLogOperation,\n isGetContainerKekLogOperationResponse,\n isListContainerDocumentsOperationResponse,\n isListContainerParentLanesOperationRequest,\n isListContainerParentLanesOperationResponse,\n type ListContainerDocumentsQuery,\n ListContainerDocumentsQuerySchema,\n listContainerDocumentsOperation,\n listContainerParentLanesOperation,\n} from \"./containerReads\";\nexport {\n type ContainerReplacementAuthorizationsResponse,\n ContainerReplacementAuthorizationsResponseSchema,\n getContainerReplacementAuthorizationsOperation,\n} from \"./containerReplacement\";\nexport {\n defineHttpOperation,\n defineJsonOperation,\n type HttpOperation,\n type HttpOperationMediaType,\n type HttpOperationMethod,\n type JsonOperation,\n type JsonOperationMethod,\n type OperationSchemaInput,\n type OperationSchemaOutput,\n operationRequestPath,\n operationRequestPathForInput,\n operationRequestPathWithQuery,\n operationRoutePath,\n type RuntimeRefinement,\n} from \"./definition\";\nexport {\n type DocumentAttributionPathParams,\n DocumentAttributionPathParamsSchema,\n type DocumentAttributionRangesQuery,\n DocumentAttributionRangesQuerySchema,\n type DocumentAttributionRequestHeaders,\n DocumentAttributionRequestHeadersSchema,\n documentAttributionWireHeaderKeys,\n documentAttributionWireHeaderNames,\n getDocumentAttributionOperation,\n isGetDocumentAttributionOperationResponse,\n isListDocumentAttributionRangesOperationResponse,\n listDocumentAttributionRangesOperation,\n} from \"./documentAttribution\";\nexport {\n createDocumentOperation,\n type DocumentMutationPathParams,\n DocumentMutationPathParamsSchema,\n type DocumentPurgeProofQuery,\n DocumentPurgeProofQuerySchema,\n getDocumentPurgeProofOperation,\n isCreateDocumentOperationRequest,\n isCreateDocumentOperationResponse,\n isDocumentLinkSetMutationOperationRequest,\n isDocumentLinkSetMutationOperationResponse,\n isGetDocumentPurgeProofOperationResponse,\n isPurgeDocumentOperationRequest,\n isPurgeDocumentOperationResponse,\n linkDocumentOperation,\n purgeDocumentOperation,\n unlinkDocumentOperation,\n} from \"./documentMutations\";\nexport {\n type DocumentSyncPathParams,\n DocumentSyncPathParamsSchema,\n documentSyncOperation,\n isDocumentSyncOperationRequest,\n isDocumentSyncOperationResponse,\n} from \"./documentSync\";\nexport {\n operationRequestHeaderNames,\n operationResponseHeaderNames,\n} from \"./headerNames\";\nexport {\n getHealthOperation,\n isGetHealthOperationResponse,\n} from \"./health\";\nexport {\n completeMultipartBlobStageOperation,\n getMultipartBlobStageOperation,\n initiateMultipartBlobStageOperation,\n isCompleteMultipartBlobStageOperationRequest,\n isCompleteMultipartBlobStageOperationResponse,\n isGetMultipartBlobStageOperationResponse,\n isInitiateMultipartBlobStageOperationRequest,\n isInitiateMultipartBlobStageOperationResponse,\n type MultipartBlobStagePathParams,\n MultipartBlobStagePathParamsSchema,\n} from \"./multipartBlobs\";\nexport {\n claimNativeOrganizationSubscriptionOperation,\n getOrganizationBillingHistoryOperation,\n getOrganizationBillingManagementUrlOperation,\n getOrganizationBillingOperation,\n getOrganizationNativePurchaseEligibilityOperation,\n isClaimNativeOrganizationSubscriptionOperationResponse,\n isGetOrganizationBillingHistoryOperationResponse,\n isGetOrganizationBillingManagementUrlOperationResponse,\n isGetOrganizationBillingOperationResponse,\n isGetOrganizationNativePurchaseEligibilityOperationResponse,\n isStartOrganizationTrialOperationResponse,\n type OrganizationBillingNativeClaimPathParams,\n OrganizationBillingNativeClaimPathParamsSchema,\n type OrganizationBillingNativeEligibilityQuery,\n OrganizationBillingNativeEligibilityQuerySchema,\n type OrganizationBillingPathParams,\n OrganizationBillingPathParamsSchema,\n startOrganizationTrialOperation,\n} from \"./organizationBilling\";\nexport { getOrganizationPolicyHistoryOperation } from \"./organizationPolicyHistory\";\nexport {\n createOrganizationGroupOperation,\n createOrganizationOperation,\n deleteOrganizationGroupOperation,\n getOrganizationDataUsageOperation,\n getOrganizationReadModelOperation,\n isCreateOrganizationGroupOperationRequest,\n isCreateOrganizationGroupOperationResponse,\n isCreateOrganizationOperationRequest,\n isCreateOrganizationOperationResponse,\n isDeleteOrganizationGroupOperationResponse,\n isGetOrganizationDataUsageOperationResponse,\n isGetOrganizationReadModelOperationResponse,\n isListOrganizationGroupMembersOperationResponse,\n isUpdateOrganizationProfileOperationRequest,\n isUpdateOrganizationProfileOperationResponse,\n isUpdateOrganizationRosterEntryOperationRequest,\n isUpdateOrganizationRosterEntryOperationResponse,\n listOrganizationGroupMembersOperation,\n type OrganizationGroupPathParams,\n OrganizationGroupPathParamsSchema,\n type OrganizationPathParams,\n OrganizationPathParamsSchema,\n type OrganizationRosterPathParams,\n OrganizationRosterPathParamsSchema,\n updateOrganizationProfileOperation,\n updateOrganizationRosterEntryOperation,\n} from \"./organizations\";\nexport {\n type PrincipalPolicyPageQuery,\n PrincipalPolicyPageQuerySchema,\n} from \"./principalPolicyPageQuery\";\nexport {\n commitOrganizationGroupPolicyOperation,\n getPrincipalPolicyOperation,\n isCommitOrganizationGroupPolicyOperationRequest,\n isCommitOrganizationGroupPolicyOperationResponse,\n isGetPrincipalPolicyOperationResponse,\n isPutPrincipalPolicyOperationRequest,\n isPutPrincipalPolicyOperationResponse,\n type OrganizationGroupPolicyPathParams,\n OrganizationGroupPolicyPathParamsSchema,\n type PrincipalPolicyPathParams,\n PrincipalPolicyPathParamsSchema,\n putPrincipalPolicyOperation,\n} from \"./principals\";\nexport {\n getProjectionPolicyHistoryOperation,\n type ProjectionPolicyHistoryQuery,\n ProjectionPolicyHistoryQuerySchema,\n} from \"./projectionPolicyHistory\";\nexport { protocolOperations } from \"./registry\";\nexport {\n getRootIdentityOperation,\n isGetRootIdentityOperationResponse,\n isListRootIdentitiesOperationResponse,\n isListRootIdentityOrganizationsOperationResponse,\n listRootIdentitiesOperation,\n listRootIdentityOrganizationsOperation,\n MAX_ROOT_IDENTITY_PAGE_SIZE,\n type RootIdentitiesQuery,\n RootIdentitiesQuerySchema,\n type RootIdentityPathParams,\n RootIdentityPathParamsSchema,\n} from \"./root\";\nexport {\n getRootOrganizationDataUsageOperation,\n getRootOrganizationOperation,\n listRootDataUsageReportOperation,\n listRootOrganizationIdentitiesOperation,\n listRootOrganizationsOperation,\n type RootOrganizationPageQuery,\n type RootOrganizationsQuery,\n} from \"./rootOrganizations\";\nexport {\n cancelStripeSubscriptionOperation,\n createStripeCheckoutOperation,\n createStripeCheckoutSessionOperation,\n createStripePortalOperation,\n getStripeCheckoutOptionsOperation,\n isCancelStripeSubscriptionOperationResponse,\n isCreateStripeCheckoutOperationResponse,\n isCreateStripeCheckoutSessionOperationRequest,\n isCreateStripeCheckoutSessionOperationResponse,\n isCreateStripePortalOperationRequest,\n isCreateStripePortalOperationResponse,\n isGetStripeCheckoutOptionsOperationResponse,\n type StripeCheckoutPathParams,\n StripeCheckoutPathParamsSchema,\n} from \"./stripeCheckout\";\nexport {\n type ContainerWriterProjectionPathParams,\n ContainerWriterProjectionPathParamsSchema,\n type DocumentWriterProjectionPathParams,\n DocumentWriterProjectionPathParamsSchema,\n getContainerWriterProjectionOperation,\n getDocumentWriterProjectionOperation,\n isGetContainerWriterProjectionOperationResponse,\n isGetDocumentWriterProjectionOperationResponse,\n} from \"./writerProjections\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAEL,qCAAqC,EAErC,8BAA8B,EAC9B,2BAA2B,EAE3B,mCAAmC,EACnC,6BAA6B,EAC7B,oCAAoC,EACpC,qCAAqC,EACrC,sCAAsC,EACtC,uCAAuC,EACvC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,qBAAqB,CAAC;AAC7B,OAAO,EACL,iCAAiC,EACjC,6BAA6B,EAC7B,oCAAoC,EACpC,2BAA2B,EAC3B,iCAAiC,EACjC,2CAA2C,EAC3C,uCAAuC,EACvC,6CAA6C,EAC7C,8CAA8C,EAC9C,oCAAoC,EACpC,qCAAqC,EACrC,2CAA2C,EAE3C,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,yCAAyC,EAEzC,wCAAwC,EACxC,qCAAqC,EACrC,oCAAoC,EACpC,+CAA+C,EAC/C,8CAA8C,GAC/C,MAAM,qBAAqB,CAAC","sourcesContent":["export { apiVersionHeaderName, parseApiVersion } from \"./apiVersion\";\nexport {\n type BlobAttachmentBindingPathParams,\n BlobAttachmentBindingPathParamsSchema,\n type BlobAttachmentPathParams,\n BlobAttachmentPathParamsSchema,\n bindBlobAttachmentOperation,\n type DocumentAttachmentsPathParams,\n DocumentAttachmentsPathParamsSchema,\n detachBlobAttachmentOperation,\n isBindBlobAttachmentOperationRequest,\n isBindBlobAttachmentOperationResponse,\n isDetachBlobAttachmentOperationRequest,\n isDetachBlobAttachmentOperationResponse,\n isListDocumentAttachmentsOperationResponse,\n listDocumentAttachmentsOperation,\n} from \"./attachments\";\nexport {\n challengeOperation,\n destroySessionOperation,\n isChallengeOperationRequest,\n isChallengeOperationResponse,\n isDestroySessionOperationResponse,\n isListSessionsOperationResponse,\n isLogoutOperationResponse,\n isRegistrationOperationRequest,\n isRegistrationOperationResponse,\n isUserIdentityOperationResponse,\n isVerifyOperationRequest,\n isVerifyOperationResponse,\n isWebSocketTicketOperationResponse,\n listSessionsOperation,\n logoutOperation,\n registerOperation,\n userIdentityOperation,\n verifyOperation,\n webSocketTicketOperation,\n} from \"./auth\";\nexport {\n billingWebhookWireHeaderKeys,\n billingWebhookWireHeaderNames,\n isReceiveRevenueCatWebhookOperationRequest,\n isReceiveRevenueCatWebhookOperationResponse,\n isReceiveStripeWebhookOperationRequest,\n isReceiveStripeWebhookOperationResponse,\n type RevenueCatWebhookHeaders,\n RevenueCatWebhookHeadersSchema,\n receiveRevenueCatWebhookOperation,\n receiveStripeWebhookOperation,\n type StripeWebhookHeaders,\n StripeWebhookHeadersSchema,\n} from \"./billingWebhooks\";\nexport {\n BinaryBodySchema,\n type BlobBytesPathParams,\n BlobBytesPathParamsSchema,\n type BlobBytesResponseHeaders,\n BlobBytesResponseHeadersSchema,\n blobWireHeaderKeys,\n blobWireHeaderNames,\n getBlobBytesOperation,\n isUploadMultipartBlobPartBytesOperationResponse,\n type MultipartBlobPartHeaders,\n MultipartBlobPartHeadersSchema,\n type MultipartBlobPartPathParams,\n MultipartBlobPartPathParamsSchema,\n uploadMultipartBlobPartBytesOperation,\n} from \"./blobBytes\";\nexport {\n type BlobDownloadResponse,\n BlobDownloadResponseSchema,\n getBlobDownloadOperation,\n} from \"./blobDownloads\";\nexport {\n type ContainerMutationPathParams,\n ContainerMutationPathParamsSchema,\n createContainerOperation,\n createContainerWithMetadataDocumentOperation,\n deleteContainerOperation,\n isContainerMutationOperationRequest,\n isContainerMutationOperationResponse,\n isContainerRotationOperationRequest,\n isContainerRotationOperationResponse,\n isCreateContainerWithMetadataDocumentOperationRequest,\n isCreateContainerWithMetadataDocumentOperationResponse,\n isDeleteContainerOperationResponse,\n moveContainerOperation,\n reciteContainerOperation,\n rekeyContainerOperation,\n revokeContainerOperation,\n shareContainerOperation,\n} from \"./containerMutations\";\nexport {\n type ContainerKekLogQuery,\n ContainerKekLogQuerySchema,\n type ContainerReadPathParams,\n ContainerReadPathParamsSchema,\n getContainerKekLogOperation,\n isGetContainerKekLogOperationResponse,\n isListContainerDocumentsOperationResponse,\n isListContainerParentLanesOperationRequest,\n isListContainerParentLanesOperationResponse,\n type ListContainerDocumentsQuery,\n ListContainerDocumentsQuerySchema,\n listContainerDocumentsOperation,\n listContainerParentLanesOperation,\n} from \"./containerReads\";\nexport {\n type ContainerReplacementAuthorizationsResponse,\n ContainerReplacementAuthorizationsResponseSchema,\n getContainerReplacementAuthorizationsOperation,\n} from \"./containerReplacement\";\nexport {\n defineHttpOperation,\n defineJsonOperation,\n type HttpOperation,\n type HttpOperationMediaType,\n type HttpOperationMethod,\n type JsonOperation,\n type JsonOperationMethod,\n type OperationSchemaInput,\n type OperationSchemaOutput,\n operationRequestPath,\n operationRequestPathForInput,\n operationRequestPathWithQuery,\n operationRoutePath,\n type RuntimeRefinement,\n} from \"./definition\";\nexport {\n type DocumentAttributionPathParams,\n DocumentAttributionPathParamsSchema,\n type DocumentAttributionRangesQuery,\n DocumentAttributionRangesQuerySchema,\n type DocumentAttributionRequestHeaders,\n DocumentAttributionRequestHeadersSchema,\n documentAttributionWireHeaderKeys,\n documentAttributionWireHeaderNames,\n getDocumentAttributionOperation,\n isGetDocumentAttributionOperationResponse,\n isListDocumentAttributionRangesOperationResponse,\n listDocumentAttributionRangesOperation,\n} from \"./documentAttribution\";\nexport {\n createDocumentOperation,\n type DocumentMutationPathParams,\n DocumentMutationPathParamsSchema,\n type DocumentPurgeProofQuery,\n DocumentPurgeProofQuerySchema,\n getDocumentPurgeProofOperation,\n isCreateDocumentOperationRequest,\n isCreateDocumentOperationResponse,\n isDocumentLinkSetMutationOperationRequest,\n isDocumentLinkSetMutationOperationResponse,\n isGetDocumentPurgeProofOperationResponse,\n isPurgeDocumentOperationRequest,\n isPurgeDocumentOperationResponse,\n linkDocumentOperation,\n purgeDocumentOperation,\n unlinkDocumentOperation,\n} from \"./documentMutations\";\nexport {\n type DocumentSyncPathParams,\n DocumentSyncPathParamsSchema,\n documentSyncOperation,\n isDocumentSyncOperationRequest,\n isDocumentSyncOperationResponse,\n} from \"./documentSync\";\nexport {\n operationRequestHeaderNames,\n operationResponseHeaderNames,\n} from \"./headerNames\";\nexport {\n getHealthOperation,\n isGetHealthOperationResponse,\n} from \"./health\";\nexport {\n completeMultipartBlobStageOperation,\n getMultipartBlobStageOperation,\n initiateMultipartBlobStageOperation,\n isCompleteMultipartBlobStageOperationRequest,\n isCompleteMultipartBlobStageOperationResponse,\n isGetMultipartBlobStageOperationResponse,\n isInitiateMultipartBlobStageOperationRequest,\n isInitiateMultipartBlobStageOperationResponse,\n type MultipartBlobStagePathParams,\n MultipartBlobStagePathParamsSchema,\n} from \"./multipartBlobs\";\nexport {\n authorizeMultipartBlobPartUploadOperation,\n type MultipartBlobPartUploadRequest,\n MultipartBlobPartUploadRequestSchema,\n type MultipartBlobPartUploadResponse,\n MultipartBlobPartUploadResponseSchema,\n} from \"./multipartPartUploads\";\nexport {\n claimNativeOrganizationSubscriptionOperation,\n getOrganizationBillingHistoryOperation,\n getOrganizationBillingManagementUrlOperation,\n getOrganizationBillingOperation,\n getOrganizationNativePurchaseEligibilityOperation,\n isClaimNativeOrganizationSubscriptionOperationResponse,\n isGetOrganizationBillingHistoryOperationResponse,\n isGetOrganizationBillingManagementUrlOperationResponse,\n isGetOrganizationBillingOperationResponse,\n isGetOrganizationNativePurchaseEligibilityOperationResponse,\n isStartOrganizationTrialOperationResponse,\n type OrganizationBillingNativeClaimPathParams,\n OrganizationBillingNativeClaimPathParamsSchema,\n type OrganizationBillingNativeEligibilityQuery,\n OrganizationBillingNativeEligibilityQuerySchema,\n type OrganizationBillingPathParams,\n OrganizationBillingPathParamsSchema,\n startOrganizationTrialOperation,\n} from \"./organizationBilling\";\nexport { getOrganizationPolicyHistoryOperation } from \"./organizationPolicyHistory\";\nexport {\n createOrganizationGroupOperation,\n createOrganizationOperation,\n deleteOrganizationGroupOperation,\n getOrganizationDataUsageOperation,\n getOrganizationReadModelOperation,\n isCreateOrganizationGroupOperationRequest,\n isCreateOrganizationGroupOperationResponse,\n isCreateOrganizationOperationRequest,\n isCreateOrganizationOperationResponse,\n isDeleteOrganizationGroupOperationResponse,\n isGetOrganizationDataUsageOperationResponse,\n isGetOrganizationReadModelOperationResponse,\n isListOrganizationGroupMembersOperationResponse,\n isUpdateOrganizationProfileOperationRequest,\n isUpdateOrganizationProfileOperationResponse,\n isUpdateOrganizationRosterEntryOperationRequest,\n isUpdateOrganizationRosterEntryOperationResponse,\n listOrganizationGroupMembersOperation,\n type OrganizationGroupPathParams,\n OrganizationGroupPathParamsSchema,\n type OrganizationPathParams,\n OrganizationPathParamsSchema,\n type OrganizationRosterPathParams,\n OrganizationRosterPathParamsSchema,\n updateOrganizationProfileOperation,\n updateOrganizationRosterEntryOperation,\n} from \"./organizations\";\nexport {\n type PrincipalPolicyPageQuery,\n PrincipalPolicyPageQuerySchema,\n} from \"./principalPolicyPageQuery\";\nexport {\n commitOrganizationGroupPolicyOperation,\n getPrincipalPolicyOperation,\n isCommitOrganizationGroupPolicyOperationRequest,\n isCommitOrganizationGroupPolicyOperationResponse,\n isGetPrincipalPolicyOperationResponse,\n isPutPrincipalPolicyOperationRequest,\n isPutPrincipalPolicyOperationResponse,\n type OrganizationGroupPolicyPathParams,\n OrganizationGroupPolicyPathParamsSchema,\n type PrincipalPolicyPathParams,\n PrincipalPolicyPathParamsSchema,\n putPrincipalPolicyOperation,\n} from \"./principals\";\nexport {\n getProjectionPolicyHistoryOperation,\n type ProjectionPolicyHistoryQuery,\n ProjectionPolicyHistoryQuerySchema,\n} from \"./projectionPolicyHistory\";\nexport { protocolOperations } from \"./registry\";\nexport {\n getRootIdentityOperation,\n isGetRootIdentityOperationResponse,\n isListRootIdentitiesOperationResponse,\n isListRootIdentityOrganizationsOperationResponse,\n listRootIdentitiesOperation,\n listRootIdentityOrganizationsOperation,\n MAX_ROOT_IDENTITY_PAGE_SIZE,\n type RootIdentitiesQuery,\n RootIdentitiesQuerySchema,\n type RootIdentityPathParams,\n RootIdentityPathParamsSchema,\n} from \"./root\";\nexport {\n getRootOrganizationDataUsageOperation,\n getRootOrganizationOperation,\n listRootDataUsageReportOperation,\n listRootOrganizationIdentitiesOperation,\n listRootOrganizationsOperation,\n type RootOrganizationPageQuery,\n type RootOrganizationsQuery,\n} from \"./rootOrganizations\";\nexport {\n cancelStripeSubscriptionOperation,\n createStripeCheckoutOperation,\n createStripeCheckoutSessionOperation,\n createStripePortalOperation,\n getStripeCheckoutOptionsOperation,\n isCancelStripeSubscriptionOperationResponse,\n isCreateStripeCheckoutOperationResponse,\n isCreateStripeCheckoutSessionOperationRequest,\n isCreateStripeCheckoutSessionOperationResponse,\n isCreateStripePortalOperationRequest,\n isCreateStripePortalOperationResponse,\n isGetStripeCheckoutOptionsOperationResponse,\n type StripeCheckoutPathParams,\n StripeCheckoutPathParamsSchema,\n} from \"./stripeCheckout\";\nexport {\n type ContainerWriterProjectionPathParams,\n ContainerWriterProjectionPathParamsSchema,\n type DocumentWriterProjectionPathParams,\n DocumentWriterProjectionPathParamsSchema,\n getContainerWriterProjectionOperation,\n getDocumentWriterProjectionOperation,\n isGetContainerWriterProjectionOperationResponse,\n isGetDocumentWriterProjectionOperationResponse,\n} from \"./writerProjections\";\n"]}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ErrorResponseSchema } from "../response/index.js";
|
|
3
|
+
export declare const MultipartBlobPartUploadRequestSchema: z.ZodObject<{
|
|
4
|
+
byteLength: z.ZodCustom<number, number>;
|
|
5
|
+
contentMd5: z.ZodCustom<string, string>;
|
|
6
|
+
uploadId: z.ZodString;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export declare const MultipartBlobPartUploadResponseSchema: z.ZodObject<{
|
|
9
|
+
byteLength: z.ZodCustom<number, number>;
|
|
10
|
+
contentMd5: z.ZodCustom<string, string>;
|
|
11
|
+
partNumber: z.ZodCustom<number, number>;
|
|
12
|
+
stageId: z.ZodString;
|
|
13
|
+
uploadId: z.ZodString;
|
|
14
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
15
|
+
kind: z.ZodLiteral<"api">;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"signed-url">;
|
|
18
|
+
url: z.ZodCustom<string, string>;
|
|
19
|
+
expiresAt: z.ZodCustom<string, string>;
|
|
20
|
+
}, z.core.$strict>], "kind">;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
export type MultipartBlobPartUploadRequest = z.infer<typeof MultipartBlobPartUploadRequestSchema>;
|
|
23
|
+
export type MultipartBlobPartUploadResponse = z.infer<typeof MultipartBlobPartUploadResponseSchema>;
|
|
24
|
+
export declare const authorizeMultipartBlobPartUploadOperation: Omit<{
|
|
25
|
+
readonly auth: "session";
|
|
26
|
+
readonly body: z.ZodObject<{
|
|
27
|
+
byteLength: z.ZodCustom<number, number>;
|
|
28
|
+
contentMd5: z.ZodCustom<string, string>;
|
|
29
|
+
uploadId: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
readonly failureResponses: {
|
|
32
|
+
readonly 400: z.ZodType<{
|
|
33
|
+
error: string;
|
|
34
|
+
}, {
|
|
35
|
+
error: string;
|
|
36
|
+
}, z.core.$ZodTypeInternals<{
|
|
37
|
+
error: string;
|
|
38
|
+
}, {
|
|
39
|
+
error: string;
|
|
40
|
+
}>>;
|
|
41
|
+
readonly 401: z.ZodType<{
|
|
42
|
+
error: string;
|
|
43
|
+
code?: "session_refresh_required" | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
error: string;
|
|
46
|
+
code?: "session_refresh_required" | undefined;
|
|
47
|
+
}, z.core.$ZodTypeInternals<{
|
|
48
|
+
error: string;
|
|
49
|
+
code?: "session_refresh_required" | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
error: string;
|
|
52
|
+
code?: "session_refresh_required" | undefined;
|
|
53
|
+
}>>;
|
|
54
|
+
readonly 403: z.ZodType<{
|
|
55
|
+
error: string;
|
|
56
|
+
}, {
|
|
57
|
+
error: string;
|
|
58
|
+
}, z.core.$ZodTypeInternals<{
|
|
59
|
+
error: string;
|
|
60
|
+
}, {
|
|
61
|
+
error: string;
|
|
62
|
+
}>>;
|
|
63
|
+
readonly 404: z.ZodType<{
|
|
64
|
+
error: string;
|
|
65
|
+
}, {
|
|
66
|
+
error: string;
|
|
67
|
+
}, z.core.$ZodTypeInternals<{
|
|
68
|
+
error: string;
|
|
69
|
+
}, {
|
|
70
|
+
error: string;
|
|
71
|
+
}>>;
|
|
72
|
+
readonly 409: z.ZodType<{
|
|
73
|
+
error: string;
|
|
74
|
+
}, {
|
|
75
|
+
error: string;
|
|
76
|
+
}, z.core.$ZodTypeInternals<{
|
|
77
|
+
error: string;
|
|
78
|
+
}, {
|
|
79
|
+
error: string;
|
|
80
|
+
}>>;
|
|
81
|
+
readonly 500: z.ZodType<{
|
|
82
|
+
error: string;
|
|
83
|
+
}, {
|
|
84
|
+
error: string;
|
|
85
|
+
}, z.core.$ZodTypeInternals<{
|
|
86
|
+
error: string;
|
|
87
|
+
}, {
|
|
88
|
+
error: string;
|
|
89
|
+
}>>;
|
|
90
|
+
};
|
|
91
|
+
readonly failureStatuses: readonly [400, 401, 403, 404, 409, 500];
|
|
92
|
+
readonly id: "blobs.multipartStages.parts.authorize";
|
|
93
|
+
readonly method: "POST";
|
|
94
|
+
readonly params: z.ZodObject<{
|
|
95
|
+
partNumber: z.ZodCustom<string | number, string | number>;
|
|
96
|
+
stageId: z.ZodString;
|
|
97
|
+
}, z.core.$strict>;
|
|
98
|
+
readonly path: "/blobs/stages/multipart/{stageId}/parts/{partNumber}/upload";
|
|
99
|
+
readonly responses: {
|
|
100
|
+
readonly 200: z.ZodObject<{
|
|
101
|
+
byteLength: z.ZodCustom<number, number>;
|
|
102
|
+
contentMd5: z.ZodCustom<string, string>;
|
|
103
|
+
partNumber: z.ZodCustom<number, number>;
|
|
104
|
+
stageId: z.ZodString;
|
|
105
|
+
uploadId: z.ZodString;
|
|
106
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
107
|
+
kind: z.ZodLiteral<"api">;
|
|
108
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
109
|
+
kind: z.ZodLiteral<"signed-url">;
|
|
110
|
+
url: z.ZodCustom<string, string>;
|
|
111
|
+
expiresAt: z.ZodCustom<string, string>;
|
|
112
|
+
}, z.core.$strict>], "kind">;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
};
|
|
115
|
+
}, "failureResponses" | "failureStatuses"> & {
|
|
116
|
+
readonly failureResponses: {
|
|
117
|
+
readonly 400: z.ZodType<{
|
|
118
|
+
error: string;
|
|
119
|
+
}, {
|
|
120
|
+
error: string;
|
|
121
|
+
}, z.core.$ZodTypeInternals<{
|
|
122
|
+
error: string;
|
|
123
|
+
}, {
|
|
124
|
+
error: string;
|
|
125
|
+
}>>;
|
|
126
|
+
readonly 401: z.ZodType<{
|
|
127
|
+
error: string;
|
|
128
|
+
code?: "session_refresh_required" | undefined;
|
|
129
|
+
}, {
|
|
130
|
+
error: string;
|
|
131
|
+
code?: "session_refresh_required" | undefined;
|
|
132
|
+
}, z.core.$ZodTypeInternals<{
|
|
133
|
+
error: string;
|
|
134
|
+
code?: "session_refresh_required" | undefined;
|
|
135
|
+
}, {
|
|
136
|
+
error: string;
|
|
137
|
+
code?: "session_refresh_required" | undefined;
|
|
138
|
+
}>>;
|
|
139
|
+
readonly 403: z.ZodType<{
|
|
140
|
+
error: string;
|
|
141
|
+
}, {
|
|
142
|
+
error: string;
|
|
143
|
+
}, z.core.$ZodTypeInternals<{
|
|
144
|
+
error: string;
|
|
145
|
+
}, {
|
|
146
|
+
error: string;
|
|
147
|
+
}>>;
|
|
148
|
+
readonly 404: z.ZodType<{
|
|
149
|
+
error: string;
|
|
150
|
+
}, {
|
|
151
|
+
error: string;
|
|
152
|
+
}, z.core.$ZodTypeInternals<{
|
|
153
|
+
error: string;
|
|
154
|
+
}, {
|
|
155
|
+
error: string;
|
|
156
|
+
}>>;
|
|
157
|
+
readonly 409: z.ZodType<{
|
|
158
|
+
error: string;
|
|
159
|
+
}, {
|
|
160
|
+
error: string;
|
|
161
|
+
}, z.core.$ZodTypeInternals<{
|
|
162
|
+
error: string;
|
|
163
|
+
}, {
|
|
164
|
+
error: string;
|
|
165
|
+
}>>;
|
|
166
|
+
readonly 500: z.ZodType<{
|
|
167
|
+
error: string;
|
|
168
|
+
}, {
|
|
169
|
+
error: string;
|
|
170
|
+
}, z.core.$ZodTypeInternals<{
|
|
171
|
+
error: string;
|
|
172
|
+
}, {
|
|
173
|
+
error: string;
|
|
174
|
+
}>>;
|
|
175
|
+
} & {
|
|
176
|
+
readonly 503: typeof ErrorResponseSchema;
|
|
177
|
+
};
|
|
178
|
+
readonly failureStatuses: readonly [400, 401, 403, 404, 409, 500] | readonly [400, 401, 403, 404, 409, 500, 503];
|
|
179
|
+
};
|