@tearleads/client-sdk 0.1.252 → 0.1.254
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/Tearleads.js +3 -3
- package/Tearleads.js.map +1 -1
- package/client/containerContents/documentDiscovery.js +0 -2
- package/client/containerContents/documentDiscovery.js.map +1 -1
- package/client/containerContents/index.d.ts +2 -0
- package/client/containerContents/index.js +4 -9
- package/client/containerContents/index.js.map +1 -1
- package/client/containerContents/storeRuntime.d.ts +17 -0
- package/client/containerContents/storeRuntime.js +31 -0
- package/client/containerContents/storeRuntime.js.map +1 -0
- package/client/deviceFirst/index.d.ts +2 -3
- package/client/deviceFirst/index.js +44 -22
- package/client/deviceFirst/index.js.map +1 -1
- package/client/runtime/workflowRuntime.d.ts +2 -0
- package/client/runtime/workflowRuntime.js +13 -6
- package/client/runtime/workflowRuntime.js.map +1 -1
- package/data/persistence/container-contents/containerContentsPersistenceTypes.d.ts +7 -10
- package/data/persistence/container-contents/containerContentsPersistenceTypes.js.map +1 -1
- package/data/persistence/container-contents/containerDeletionPersistence.js +5 -1
- package/data/persistence/container-contents/containerDeletionPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerHydrationPersistence.js +1 -1
- package/data/persistence/container-contents/containerHydrationPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerMetadataMutationPersistence.js +11 -4
- package/data/persistence/container-contents/containerMetadataMutationPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerRemovalMetadata.js +47 -0
- package/data/persistence/container-contents/containerRemovalMetadata.js.map +1 -0
- package/data/persistence/container-contents/containerRemovalPlacements.js +22 -0
- package/data/persistence/container-contents/containerRemovalPlacements.js.map +1 -0
- package/data/persistence/container-contents/containerSyncWatermarkPersistence.d.ts +2 -1
- package/data/persistence/container-contents/containerSyncWatermarkPersistence.js +10 -2
- package/data/persistence/container-contents/containerSyncWatermarkPersistence.js.map +1 -1
- package/data/persistence/documents/documentDiscoveryCandidate.d.ts +1 -0
- package/data/persistence/documents/documentDiscoveryCandidate.js +3 -1
- package/data/persistence/documents/documentDiscoveryCandidate.js.map +1 -1
- package/data/persistence/documents/documentDiscoveryEvidencePersistence.d.ts +1 -1
- package/data/persistence/documents/documentDiscoveryEvidencePersistence.js +16 -4
- package/data/persistence/documents/documentDiscoveryEvidencePersistence.js.map +1 -1
- package/data/sqlite/migrations/localSchemaMigrations.js +11 -0
- package/data/sqlite/migrations/localSchemaMigrations.js.map +1 -1
- package/data/sqlite/schema/containerSyncWatermarkSchema.js +6 -3
- package/data/sqlite/schema/containerSyncWatermarkSchema.js.map +1 -1
- package/data/sqlite/schema/index.d.ts +17 -0
- package/data/sync/syncCoordinator.js +17 -10
- package/data/sync/syncCoordinator.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +1 -0
- package/internal/api-client/client/apiClientContext.d.ts +1 -0
- package/internal/api-client/client/containerReads.d.ts +1 -0
- package/internal/api-client/requestInternals.js +14 -6
- package/internal/api-client/requestInternals.js.map +1 -1
- package/internal/validators/operation/containerReads.d.ts +29 -2
- package/internal/validators/operation/containerReads.js +2 -1
- package/internal/validators/operation/containerReads.js.map +1 -1
- package/internal/validators/request/containerDocumentLanes.d.ts +7 -0
- package/internal/validators/request/containerDocumentLanes.js +6 -0
- package/internal/validators/request/containerDocumentLanes.js.map +1 -1
- package/internal/validators/response/container.d.ts +8 -0
- package/internal/validators/response/container.js +1 -0
- package/internal/validators/response/container.js.map +1 -1
- package/internal/validators/response/containerParentLanes.d.ts +2 -0
- package/package.json +1 -1
- package/stores/container-contents/containerContentsStore.d.ts +3 -9
- package/stores/container-contents/containerContentsStore.js +24 -21
- package/stores/container-contents/containerContentsStore.js.map +1 -1
- package/stores/container-contents/containerState/storeScope.js +6 -0
- package/stores/container-contents/containerState/storeScope.js.map +1 -0
- package/stores/container-contents/hydration/backgroundHydration.js +2 -1
- package/stores/container-contents/hydration/backgroundHydration.js.map +1 -1
- package/stores/container-contents/hydration/reconnectRefresh.d.ts +10 -0
- package/stores/container-contents/hydration/reconnectRefresh.js +68 -0
- package/stores/container-contents/hydration/reconnectRefresh.js.map +1 -0
- package/stores/container-contents/hydration/reconnectRefreshMachine.js +49 -0
- package/stores/container-contents/hydration/reconnectRefreshMachine.js.map +1 -0
- package/stores/container-contents/hydration/remoteHydrationRefresh.js +4 -1
- package/stores/container-contents/hydration/remoteHydrationRefresh.js.map +1 -1
- package/stores/container-contents/hydration/remoteHydrationRequest.js +79 -10
- package/stores/container-contents/hydration/remoteHydrationRequest.js.map +1 -1
- package/stores/container-contents/hydration/startupHydration.js +2 -9
- package/stores/container-contents/hydration/startupHydration.js.map +1 -1
- package/stores/container-contents/hydration/treeResetMachine.js +61 -0
- package/stores/container-contents/hydration/treeResetMachine.js.map +1 -0
- package/stores/container-contents/localRefresh.js +28 -12
- package/stores/container-contents/localRefresh.js.map +1 -1
- package/stores/container-contents/remoteEvents/remoteContainerIngestion.js +4 -1
- package/stores/container-contents/remoteEvents/remoteContainerIngestion.js.map +1 -1
- package/stores/container-contents/remoteWrites/writeGeneration.js +5 -2
- package/stores/container-contents/remoteWrites/writeGeneration.js.map +1 -1
- package/stores/container-contents/state.d.ts +3 -7
- package/stores/container-contents/state.js +27 -16
- package/stores/container-contents/state.js.map +1 -1
- package/stores/container-contents/syncAgent/index.d.ts +7 -2
- package/stores/container-contents/syncAgent/index.js +77 -49
- package/stores/container-contents/syncAgent/index.js.map +1 -1
- package/stores/container-contents/syncAgent/syncAgentTypes.d.ts +5 -2
- package/stores/container-contents/syncAgent/syncAgentTypes.js.map +1 -1
- package/stores/container-contents/syncAgent/syncLaneIteration.js +6 -3
- package/stores/container-contents/syncAgent/syncLaneIteration.js.map +1 -1
- package/stores/local-projection/localProjectionStore.js +24 -15
- package/stores/local-projection/localProjectionStore.js.map +1 -1
- package/stores/local-projection/registry.js +2 -2
- package/stores/local-projection/registry.js.map +1 -1
- package/workflows/container-contents/container-state/create/createChild.js +3 -15
- package/workflows/container-contents/container-state/create/createChild.js.map +1 -1
- package/workflows/container-contents/containerPersistence.d.ts +4 -8
- package/workflows/container-contents/containerPersistence.js +22 -12
- package/workflows/container-contents/containerPersistence.js.map +1 -1
- package/workflows/container-contents/documentDiscovery/containerDocumentListing.js +52 -4
- package/workflows/container-contents/documentDiscovery/containerDocumentListing.js.map +1 -1
- package/workflows/container-contents/documentDiscovery/documentDiscoveryApply.js +4 -2
- package/workflows/container-contents/documentDiscovery/documentDiscoveryApply.js.map +1 -1
- package/workflows/container-contents/documentDiscovery/documentDiscoveryEvidence.js +17 -12
- package/workflows/container-contents/documentDiscovery/documentDiscoveryEvidence.js.map +1 -1
- package/workflows/container-contents/documentDiscovery/documentDiscoveryTypes.js.map +1 -1
- package/workflows/container-contents/documentDiscovery/publicationWatermark.js +15 -0
- package/workflows/container-contents/documentDiscovery/publicationWatermark.js.map +1 -0
- package/workflows/container-contents/localState.js +3 -0
- package/workflows/container-contents/localState.js.map +1 -1
- package/workflows/container-contents/remoteHydration/hydrateRemoteContainers.d.ts +12 -0
- package/workflows/container-contents/remoteHydration/hydrateRemoteContainers.js +93 -0
- package/workflows/container-contents/remoteHydration/hydrateRemoteContainers.js.map +1 -0
- package/workflows/container-contents/remoteHydration/index.d.ts +3 -11
- package/workflows/container-contents/remoteHydration/index.js +17 -66
- package/workflows/container-contents/remoteHydration/index.js.map +1 -1
- package/workflows/container-contents/remoteHydration/lanes/parentLaneFetch.js +3 -2
- package/workflows/container-contents/remoteHydration/lanes/parentLaneFetch.js.map +1 -1
- package/workflows/container-contents/remoteHydration/lanes/restorationReceipt.js +25 -0
- package/workflows/container-contents/remoteHydration/lanes/restorationReceipt.js.map +1 -0
- package/workflows/container-contents/remoteHydration/lanes/tombstoneAccess.js +107 -0
- package/workflows/container-contents/remoteHydration/lanes/tombstoneAccess.js.map +1 -0
- package/workflows/container-contents/remoteHydration/principalPolicyCache.js +57 -5
- package/workflows/container-contents/remoteHydration/principalPolicyCache.js.map +1 -1
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js +129 -84
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js.map +1 -1
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js +32 -10
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js.map +1 -1
- package/workflows/container-contents/remoteHydration/tombstoneApplication.js +67 -24
- package/workflows/container-contents/remoteHydration/tombstoneApplication.js.map +1 -1
- package/workflows/container-contents/remoteHydration/types.d.ts +16 -1
- package/workflows/container-contents/remoteHydration/types.js.map +1 -1
- package/workflows/container-contents/remoteReset/remoteResetCursorScope.js +3 -3
- package/workflows/container-contents/remoteReset/remoteResetCursorScope.js.map +1 -1
- package/workflows/container-contents/runtime.d.ts +3 -0
- package/workflows/container-contents/runtime.js.map +1 -1
- package/workflows/container-contents/storedContainerState.js +17 -7
- package/workflows/container-contents/storedContainerState.js.map +1 -1
- package/workflows/container-contents/syncLane.d.ts +1 -0
- package/workflows/container-contents/syncLane.js +9 -1
- package/workflows/container-contents/syncLane.js.map +1 -1
- package/workflows/container-contents/syncPause/discoveryGuard.js +6 -2
- package/workflows/container-contents/syncPause/discoveryGuard.js.map +1 -1
- package/workflows/container-contents/tombstones/documentTombstoneGate.js +6 -3
- package/workflows/container-contents/tombstones/documentTombstoneGate.js.map +1 -1
- package/workflows/shared/runtimeInput.d.ts +2 -0
- package/workflows/shared/runtimeInput.js.map +1 -1
- package/workflows/container-contents/remoteHydration/completeHydration.js +0 -25
- package/workflows/container-contents/remoteHydration/completeHydration.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestInternals.js","sourceRoot":"","sources":["requestInternals.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,8BAA8B,EAC9B,sCAAsC,EACtC,+BAA+B,EAC/B,qCAAqC,EACrC,8BAA8B,EAC9B,mCAAmC,EACnC,kCAAkC,EAClC,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,6BAA6B,EA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,EAAE,CAAC;QACX,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,+BAA+B,CAAC;QACzC,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,MAAM,aAAa,GAAG,6BAA6B,CACjD,MAAM,EACN,MAAM,EACN,qCAAqC,CACtC,CAAC;IACF,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,OAAO,+BAA+B,CAAC;IACzC,CAAC;IAED,MAAM,WAAW,GACf,8BAA8B,CAAC,MAAM,EAAE,MAAM,CAAC;QAC9C,0BAA0B,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3D,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,gCAAgC,CACrC,SAAS,EACT,6BAA6B,EAC7B,YAAY,CACb,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,MAAc,EACd,IAAmB;IAEnB,OAAO,MAAM,KAAK,GAAG,IAAI,IAAI,KAAK,mBAAmB,CAAC,eAAe,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,yEAAyE;IACzE,oEAAoE;IACpE,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EACjC,CAAC;QACD,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","sourcesContent":["import type { HttpOperation } from \"@tearleads/validators/operation\";\nimport type {\n DocumentSyncRequest,\n ListContainerDocumentLanesRequest,\n ListContainerParentLanesRequest,\n} from \"@tearleads/validators/request\";\nimport type {\n DocumentWriterProjectionResponse,\n ReferencedPrincipalStateResponse,\n SyncWatermark,\n} from \"@tearleads/validators/response\";\nimport {\n CONTAINER_MUTATION_ERROR_CODES,\n ContainerMutationFailureResponseSchema,\n DocumentSyncErrorResponseSchema,\n isDocumentSyncStateStaleErrorResponse,\n isPaymentRequiredErrorResponse,\n isPrincipalPolicyStaleErrorResponse,\n PaymentRequiredErrorResponseSchema,\n SESSION_ERROR_CODES,\n} from \"@tearleads/validators/response\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"@tearleads/validators/util\";\nimport type { RequestBody } from \"./types\";\n\n/**\n * True when a committed sync advances the document's write material past what\n * a cached/primed writer projection holds, so the projection must be re-fetched\n * before the next write. The server commits a sync only against the bundle the\n * request carries or, without one, the bundle its expectations name, and the\n * KEK targets that bundle wraps to; compare the projection with those.\n */\nfunction documentSyncInvalidatesWriterProjection(\n projection: DocumentWriterProjectionResponse,\n request: DocumentSyncRequest,\n): boolean {\n const committed = request.contentKeyBundle ?? {\n contentKeyEpoch: request.contentKeyEpoch,\n linkSetManifestHash: request.expectedLinkSetManifestHash,\n targetHash: request.expectedTargetHash,\n };\n return (\n projection.contentKeyBundle?.contentKeyEpoch !==\n committed.contentKeyEpoch ||\n projection.contentKeyBundle?.linkSetManifestHash !==\n committed.linkSetManifestHash ||\n projection.contentKeyBundle?.targetHash !== committed.targetHash ||\n projection.documentKekTargets?.linkSetManifestHash !==\n committed.linkSetManifestHash ||\n projection.documentKekTargets?.documentKeyTargetHash !==\n committed.targetHash\n );\n}\n\n/**\n * Evict a cached/primed document writer projection iff the just-committed sync\n * moved its write material. Re-checks the cache slot after awaiting so a\n * concurrent invalidation or refetch is not clobbered. `onEvicted` fires\n * whenever an invalidation is issued, so callers can invalidate parallel\n * bookkeeping (e.g. an in-flight result fetch that predates the sync).\n */\nexport async function evictWriterProjectionIfSyncChanged(\n cache: RequestCache<DocumentWriterProjectionResponse>,\n documentId: string,\n request: DocumentSyncRequest,\n onEvicted?: () => void,\n): Promise<void> {\n const cached = cache.get(documentId);\n if (!cached) {\n // No cached projection to compare against, so whether the sync moved the\n // write material is undecidable here — but a concurrent in-flight GET may\n // still predate it. Invalidate conservatively: deleting the (absent) slot\n // bumps the cache's eviction generation so such a fetch's success is not\n // cached, and onEvicted drops a shared in-flight result entry. The cost\n // when nothing is in flight is a skipped cache warm, never wrong data.\n cache.delete(documentId);\n onEvicted?.();\n return;\n }\n const projection = await cached.catch(() => null);\n if (cache.get(documentId) !== cached || !projection) {\n return;\n }\n if (documentSyncInvalidatesWriterProjection(projection, request)) {\n cache.delete(documentId);\n onEvicted?.();\n }\n}\n\nexport interface ErrorResponseDescription {\n readonly code: string | null;\n readonly detail: string;\n readonly error: string | null;\n readonly stalePrincipalHeads?: ReferencedPrincipalStateResponse[] | undefined;\n /** Descendant rekeys a refused rotation must carry, parent-first. */\n readonly requiredContainerIds?: readonly string[] | undefined;\n /** Set on a 402 body — the organization whose billing blocked the sync write. */\n readonly paymentRequiredOrganizationId?: string | undefined;\n}\n\nconst emptyErrorResponseDescription: ErrorResponseDescription = {\n code: null,\n detail: \"\",\n error: null,\n};\n\nconst invalidErrorResponseDescription: ErrorResponseDescription = {\n ...emptyErrorResponseDescription,\n detail: \": Invalid failure response body\",\n};\n\nfunction validatedFailureCode(\n value: object,\n schema: NonNullable<HttpOperation[\"failureResponses\"]>[number] | undefined,\n): string | null {\n if (\n !schema ||\n !(\"code\" in value) ||\n typeof value.code !== \"string\" ||\n value.code.length === 0\n ) {\n return null;\n }\n\n // Loose object schemas retain extension keys. A code is behavior-bearing\n // only when changing that field to an unregistered value breaks the selected\n // status schema, proving that the schema constrains rather than merely\n // preserves it.\n const unregisteredCode = `${value.code}\\u0000unregistered`;\n return schema.safeParse({ ...value, code: unregisteredCode }).success\n ? null\n : value.code;\n}\n\n// Container mutations and document sync with inline container rekeys can\n// carry advisory heads whose signed evidence can be recovered in pages.\nfunction stalePrincipalHeadsField(\n value: object,\n schema?: NonNullable<HttpOperation[\"failureResponses\"]>[number],\n) {\n return schema === ContainerMutationFailureResponseSchema &&\n isPrincipalPolicyStaleErrorResponse(value)\n ? { stalePrincipalHeads: value.principalHeads }\n : schema === DocumentSyncErrorResponseSchema &&\n isDocumentSyncStateStaleErrorResponse(value) &&\n value.principalHeads !== undefined\n ? { stalePrincipalHeads: value.principalHeads }\n : {};\n}\n\nfunction parsedErrorResponseDescription(\n value: unknown,\n schema?: NonNullable<HttpOperation[\"failureResponses\"]>[number],\n): ErrorResponseDescription | null {\n if (\n !value ||\n typeof value !== \"object\" ||\n !(\"error\" in value) ||\n typeof value.error !== \"string\"\n ) {\n return null;\n }\n\n const error = value.error.trim();\n const code = validatedFailureCode(value, schema);\n if (error.length === 0 && code === null) {\n return null;\n }\n return {\n code,\n detail: error.length === 0 ? \"\" : `: ${error}`,\n error: error.length === 0 ? null : error,\n ...stalePrincipalHeadsField(value, schema),\n ...((code === CONTAINER_MUTATION_ERROR_CODES.descendantRekeysRequired ||\n code === CONTAINER_MUTATION_ERROR_CODES.descendantRekeysInaccessible) &&\n \"requiredContainerIds\" in value &&\n Array.isArray(value.requiredContainerIds) &&\n value.requiredContainerIds.length <= MAX_ROTATION_CONTAINER_REKEYS &&\n value.requiredContainerIds.every(\n (containerId: unknown): containerId is string =>\n typeof containerId === \"string\" && containerId.length > 0,\n )\n ? { requiredContainerIds: value.requiredContainerIds }\n : {}),\n // Sync-write 402s carry the target org for the billing prompt.\n ...(schema === PaymentRequiredErrorResponseSchema &&\n isPaymentRequiredErrorResponse(value)\n ? { paymentRequiredOrganizationId: value.organizationId }\n : {}),\n };\n}\n\nexport function bindPrototypeMethods(\n instance: object,\n prototype: object,\n): void {\n for (const propertyName of Object.getOwnPropertyNames(prototype)) {\n if (propertyName === \"constructor\") {\n continue;\n }\n\n const property = Reflect.get(prototype, propertyName);\n if (typeof property === \"function\") {\n Reflect.set(instance, propertyName, property.bind(instance));\n }\n }\n}\n\nexport function normalizeApiBaseUrl(\n baseUrl: string | null | undefined,\n): string {\n const trimmed = (baseUrl ?? \"\").trim();\n if (trimmed === \"\" || trimmed === \"/\") {\n return \"\";\n }\n\n // Scan from the end to avoid regex backtracking over internal slash runs.\n let end = trimmed.length;\n while (end > 0 && trimmed[end - 1] === \"/\") {\n end -= 1;\n }\n return trimmed.slice(0, end);\n}\n\nexport function hasHeader(\n headers: Record<string, string> | undefined,\n name: string,\n): boolean {\n const normalizedName = name.toLowerCase();\n return Object.keys(headers ?? {}).some(\n (headerName) => headerName.toLowerCase() === normalizedName,\n );\n}\n\nexport function requestFailureKey(input: {\n method: string;\n path: string;\n}): string {\n return `${input.method}\\u0000${input.path}`;\n}\n\nfunction syncWatermarkRequestKey(\n watermark: SyncWatermark | null | undefined,\n): string {\n return watermark ? `${watermark.updatedAt}\\u0000${watermark.id}` : \"\";\n}\n\nexport function listContainerParentLanesRequestKey(\n input: ListContainerParentLanesRequest,\n): string {\n return JSON.stringify(\n input.lanes.map((lane) => ({\n laneId: lane.laneId,\n limit: lane.limit ?? null,\n parentId: lane.parentId,\n watermark: syncWatermarkRequestKey(lane.watermark),\n })),\n );\n}\n\nexport function listContainerDocumentLanesRequestKey(\n input: ListContainerDocumentLanesRequest,\n): string {\n return JSON.stringify(\n input.lanes.map((lane) => ({\n containerId: lane.containerId,\n laneId: lane.laneId,\n limit: lane.limit ?? null,\n watermark: syncWatermarkRequestKey(lane.watermark),\n })),\n );\n}\n\n/**\n * Minimal cache surface shared by `Map` and `ApiCache.BoundedCache`, so the\n * request helpers work with either backing store.\n */\ninterface RequestCache<T> {\n get(key: string): Promise<T | null> | undefined;\n has(key: string): boolean;\n set(key: string, value: Promise<T | null>): unknown;\n delete(key: string): unknown;\n}\n\nexport function cachedRequest<T>(\n cache: RequestCache<T>,\n cacheKey: string,\n request: () => Promise<T | null>,\n): Promise<T | null> {\n const cached = cache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n let pending: Promise<T | null>;\n pending = request()\n .then((response) => {\n if (!response && cache.get(cacheKey) === pending) {\n cache.delete(cacheKey);\n }\n return response;\n })\n .catch((error: unknown) => {\n if (cache.get(cacheKey) === pending) {\n cache.delete(cacheKey);\n }\n throw error;\n });\n cache.set(cacheKey, pending);\n return pending;\n}\n\nexport function dedupedRequest<T>(\n cache: RequestCache<T>,\n cacheKey: string,\n request: () => Promise<T | null>,\n): Promise<T | null> {\n const cached = cache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n let pending: Promise<T | null>;\n pending = request().finally(() => {\n if (cache.get(cacheKey) === pending) {\n cache.delete(cacheKey);\n }\n });\n cache.set(cacheKey, pending);\n return pending;\n}\n\nexport function isReplayableRequestBody(\n body: RequestBody | undefined,\n): boolean {\n return !(\n typeof ReadableStream === \"function\" && body instanceof ReadableStream\n );\n}\n\nexport function isSuccessfulResponse(\n response: Response,\n additionalSuccessStatuses: readonly number[],\n): boolean {\n return response.ok || additionalSuccessStatuses.includes(response.status);\n}\n\nfunction validatePaymentRequiredTarget(\n schema: NonNullable<HttpOperation[\"failureResponses\"]>[number] | undefined,\n parsed: unknown,\n expectedOrganizationId: string | undefined,\n): { readonly invalid: boolean; readonly organizationId?: string } {\n if (schema !== PaymentRequiredErrorResponseSchema) {\n return { invalid: false };\n }\n if (\n !isPaymentRequiredErrorResponse(parsed) ||\n (expectedOrganizationId !== undefined &&\n parsed.organizationId !== expectedOrganizationId)\n ) {\n return { invalid: true };\n }\n return { invalid: false, organizationId: parsed.organizationId };\n}\n\nfunction paymentRequiredDescription(\n organizationId: string | undefined,\n): ErrorResponseDescription | null {\n return organizationId === undefined\n ? null\n : {\n ...emptyErrorResponseDescription,\n paymentRequiredOrganizationId: organizationId,\n };\n}\n\n/** An unreadable or empty body: invalid for a typed operation. */\nfunction unreadableErrorResponseDescription(\n operation: HttpOperation | undefined,\n): ErrorResponseDescription {\n return operation\n ? invalidErrorResponseDescription\n : emptyErrorResponseDescription;\n}\n\n/** A body without a recognized error: untyped requests echo its text. */\nfunction unparsedErrorResponseDescription(\n operation: HttpOperation | undefined,\n typed: ErrorResponseDescription,\n responseText: string,\n): ErrorResponseDescription {\n return operation\n ? typed\n : { ...emptyErrorResponseDescription, detail: `: ${responseText}` };\n}\n\nexport async function describeErrorResponse(\n response: Response,\n operation?: HttpOperation,\n expectedPaymentRequiredOrganizationId?: string,\n): Promise<ErrorResponseDescription> {\n const schema = operation?.failureResponses?.[response.status];\n if (operation && !schema) {\n // A cloned response can wait for its other branch to finish cancelling.\n // Cleanup must not delay reporting an already-invalid status.\n void response.body?.cancel().catch(() => {});\n return invalidErrorResponseDescription;\n }\n let responseText = \"\";\n\n try {\n responseText = (await response.text()).trim();\n } catch {\n return unreadableErrorResponseDescription(operation);\n }\n\n if (responseText.length === 0) {\n return unreadableErrorResponseDescription(operation);\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(responseText);\n } catch {\n return unparsedErrorResponseDescription(\n operation,\n invalidErrorResponseDescription,\n responseText,\n );\n }\n\n if (schema) {\n const result = schema.safeParse(parsed);\n if (!result.success) {\n return invalidErrorResponseDescription;\n }\n parsed = result.data;\n }\n\n const paymentTarget = validatePaymentRequiredTarget(\n schema,\n parsed,\n expectedPaymentRequiredOrganizationId,\n );\n if (paymentTarget.invalid) {\n return invalidErrorResponseDescription;\n }\n\n const description =\n parsedErrorResponseDescription(parsed, schema) ??\n paymentRequiredDescription(paymentTarget.organizationId);\n if (description) {\n return description;\n }\n\n return unparsedErrorResponseDescription(\n operation,\n emptyErrorResponseDescription,\n responseText,\n );\n}\n\nexport function isRefreshableSessionError(\n status: number,\n code: string | null,\n): boolean {\n return status === 401 && code === SESSION_ERROR_CODES.refreshRequired;\n}\n\nexport function errorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n // `instanceof Error` fails for errors thrown across realms (web workers,\n // serialized payloads); fall back to a duck-typed string `message`.\n if (\n typeof error === \"object\" &&\n error !== null &&\n \"message\" in error &&\n typeof error.message === \"string\"\n ) {\n return error.message;\n }\n return String(error);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"requestInternals.js","sourceRoot":"","sources":["requestInternals.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,8BAA8B,EAC9B,sCAAsC,EACtC,+BAA+B,EAC/B,qCAAqC,EACrC,8BAA8B,EAC9B,mCAAmC,EACnC,kCAAkC,EAClC,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAG3E;;;;;;GAMG;AACH,SAAS,uCAAuC,CAC9C,UAA4C,EAC5C,OAA4B;IAE5B,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,IAAI;QAC5C,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,mBAAmB,EAAE,OAAO,CAAC,2BAA2B;QACxD,UAAU,EAAE,OAAO,CAAC,kBAAkB;KACvC,CAAC;IACF,OAAO,CACL,UAAU,CAAC,gBAAgB,EAAE,eAAe;QAC1C,SAAS,CAAC,eAAe;QAC3B,UAAU,CAAC,gBAAgB,EAAE,mBAAmB;YAC9C,SAAS,CAAC,mBAAmB;QAC/B,UAAU,CAAC,gBAAgB,EAAE,UAAU,KAAK,SAAS,CAAC,UAAU;QAChE,UAAU,CAAC,kBAAkB,EAAE,mBAAmB;YAChD,SAAS,CAAC,mBAAmB;QAC/B,UAAU,CAAC,kBAAkB,EAAE,qBAAqB;YAClD,SAAS,CAAC,UAAU,CACvB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,KAAqD,EACrD,UAAkB,EAClB,OAA4B,EAC5B,SAAsB;IAEtB,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,yEAAyE;QACzE,0EAA0E;QAC1E,0EAA0E;QAC1E,yEAAyE;QACzE,wEAA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IAAI,IAAI,KAAK,mBAAmB,CAAC,eAAe,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,yEAAyE;IACzE,oEAAoE;IACpE,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EACjC,CAAC;QACD,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","sourcesContent":["import type { HttpOperation } from \"@tearleads/validators/operation\";\nimport type {\n DocumentSyncRequest,\n ListContainerDocumentLanesRequest,\n ListContainerParentLanesRequest,\n} from \"@tearleads/validators/request\";\nimport type {\n DocumentWriterProjectionResponse,\n ReferencedPrincipalStateResponse,\n SyncWatermark,\n} from \"@tearleads/validators/response\";\nimport {\n CONTAINER_MUTATION_ERROR_CODES,\n ContainerMutationFailureResponseSchema,\n DocumentSyncErrorResponseSchema,\n isDocumentSyncStateStaleErrorResponse,\n isPaymentRequiredErrorResponse,\n isPrincipalPolicyStaleErrorResponse,\n PaymentRequiredErrorResponseSchema,\n SESSION_ERROR_CODES,\n} from \"@tearleads/validators/response\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"@tearleads/validators/util\";\nimport type { RequestBody } from \"./types\";\n\n/**\n * True when a committed sync advances the document's write material past what\n * a cached/primed writer projection holds, so the projection must be re-fetched\n * before the next write. The server commits a sync only against the bundle the\n * request carries or, without one, the bundle its expectations name, and the\n * KEK targets that bundle wraps to; compare the projection with those.\n */\nfunction documentSyncInvalidatesWriterProjection(\n projection: DocumentWriterProjectionResponse,\n request: DocumentSyncRequest,\n): boolean {\n const committed = request.contentKeyBundle ?? {\n contentKeyEpoch: request.contentKeyEpoch,\n linkSetManifestHash: request.expectedLinkSetManifestHash,\n targetHash: request.expectedTargetHash,\n };\n return (\n projection.contentKeyBundle?.contentKeyEpoch !==\n committed.contentKeyEpoch ||\n projection.contentKeyBundle?.linkSetManifestHash !==\n committed.linkSetManifestHash ||\n projection.contentKeyBundle?.targetHash !== committed.targetHash ||\n projection.documentKekTargets?.linkSetManifestHash !==\n committed.linkSetManifestHash ||\n projection.documentKekTargets?.documentKeyTargetHash !==\n committed.targetHash\n );\n}\n\n/**\n * Evict a cached/primed document writer projection iff the just-committed sync\n * moved its write material. Re-checks the cache slot after awaiting so a\n * concurrent invalidation or refetch is not clobbered. `onEvicted` fires\n * whenever an invalidation is issued, so callers can invalidate parallel\n * bookkeeping (e.g. an in-flight result fetch that predates the sync).\n */\nexport async function evictWriterProjectionIfSyncChanged(\n cache: RequestCache<DocumentWriterProjectionResponse>,\n documentId: string,\n request: DocumentSyncRequest,\n onEvicted?: () => void,\n): Promise<void> {\n const cached = cache.get(documentId);\n if (!cached) {\n // No cached projection to compare against, so whether the sync moved the\n // write material is undecidable here — but a concurrent in-flight GET may\n // still predate it. Invalidate conservatively: deleting the (absent) slot\n // bumps the cache's eviction generation so such a fetch's success is not\n // cached, and onEvicted drops a shared in-flight result entry. The cost\n // when nothing is in flight is a skipped cache warm, never wrong data.\n cache.delete(documentId);\n onEvicted?.();\n return;\n }\n const projection = await cached.catch(() => null);\n if (cache.get(documentId) !== cached || !projection) {\n return;\n }\n if (documentSyncInvalidatesWriterProjection(projection, request)) {\n cache.delete(documentId);\n onEvicted?.();\n }\n}\n\nexport interface ErrorResponseDescription {\n readonly code: string | null;\n readonly detail: string;\n readonly error: string | null;\n readonly stalePrincipalHeads?: ReferencedPrincipalStateResponse[] | undefined;\n /** Descendant rekeys a refused rotation must carry, parent-first. */\n readonly requiredContainerIds?: readonly string[] | undefined;\n /** Set on a 402 body — the organization whose billing blocked the sync write. */\n readonly paymentRequiredOrganizationId?: string | undefined;\n}\n\nconst emptyErrorResponseDescription: ErrorResponseDescription = {\n code: null,\n detail: \"\",\n error: null,\n};\n\nconst invalidErrorResponseDescription: ErrorResponseDescription = {\n ...emptyErrorResponseDescription,\n detail: \": Invalid failure response body\",\n};\n\nfunction validatedFailureCode(\n value: object,\n schema: NonNullable<HttpOperation[\"failureResponses\"]>[number] | undefined,\n): string | null {\n if (\n !schema ||\n !(\"code\" in value) ||\n typeof value.code !== \"string\" ||\n value.code.length === 0\n ) {\n return null;\n }\n\n // Loose object schemas retain extension keys. A code is behavior-bearing\n // only when changing that field to an unregistered value breaks the selected\n // status schema, proving that the schema constrains rather than merely\n // preserves it.\n const unregisteredCode = `${value.code}\\u0000unregistered`;\n return schema.safeParse({ ...value, code: unregisteredCode }).success\n ? null\n : value.code;\n}\n\n// Container mutations and document sync with inline container rekeys can\n// carry advisory heads whose signed evidence can be recovered in pages.\nfunction stalePrincipalHeadsField(\n value: object,\n schema?: NonNullable<HttpOperation[\"failureResponses\"]>[number],\n) {\n return schema === ContainerMutationFailureResponseSchema &&\n isPrincipalPolicyStaleErrorResponse(value)\n ? { stalePrincipalHeads: value.principalHeads }\n : schema === DocumentSyncErrorResponseSchema &&\n isDocumentSyncStateStaleErrorResponse(value) &&\n value.principalHeads !== undefined\n ? { stalePrincipalHeads: value.principalHeads }\n : {};\n}\n\nfunction parsedErrorResponseDescription(\n value: unknown,\n schema?: NonNullable<HttpOperation[\"failureResponses\"]>[number],\n): ErrorResponseDescription | null {\n if (\n !value ||\n typeof value !== \"object\" ||\n !(\"error\" in value) ||\n typeof value.error !== \"string\"\n ) {\n return null;\n }\n\n const error = value.error.trim();\n const code = validatedFailureCode(value, schema);\n if (error.length === 0 && code === null) {\n return null;\n }\n return {\n code,\n detail: error.length === 0 ? \"\" : `: ${error}`,\n error: error.length === 0 ? null : error,\n ...stalePrincipalHeadsField(value, schema),\n ...((code === CONTAINER_MUTATION_ERROR_CODES.descendantRekeysRequired ||\n code === CONTAINER_MUTATION_ERROR_CODES.descendantRekeysInaccessible) &&\n \"requiredContainerIds\" in value &&\n Array.isArray(value.requiredContainerIds) &&\n value.requiredContainerIds.length <= MAX_ROTATION_CONTAINER_REKEYS &&\n value.requiredContainerIds.every(\n (containerId: unknown): containerId is string =>\n typeof containerId === \"string\" && containerId.length > 0,\n )\n ? { requiredContainerIds: value.requiredContainerIds }\n : {}),\n // Sync-write 402s carry the target org for the billing prompt.\n ...(schema === PaymentRequiredErrorResponseSchema &&\n isPaymentRequiredErrorResponse(value)\n ? { paymentRequiredOrganizationId: value.organizationId }\n : {}),\n };\n}\n\nexport function bindPrototypeMethods(\n instance: object,\n prototype: object,\n): void {\n for (const propertyName of Object.getOwnPropertyNames(prototype)) {\n if (propertyName === \"constructor\") {\n continue;\n }\n\n const property = Reflect.get(prototype, propertyName);\n if (typeof property === \"function\") {\n Reflect.set(instance, propertyName, property.bind(instance));\n }\n }\n}\n\nexport function normalizeApiBaseUrl(\n baseUrl: string | null | undefined,\n): string {\n const trimmed = (baseUrl ?? \"\").trim();\n if (trimmed === \"\" || trimmed === \"/\") {\n return \"\";\n }\n\n // Scan from the end to avoid regex backtracking over internal slash runs.\n let end = trimmed.length;\n while (end > 0 && trimmed[end - 1] === \"/\") {\n end -= 1;\n }\n return trimmed.slice(0, end);\n}\n\nexport function hasHeader(\n headers: Record<string, string> | undefined,\n name: string,\n): boolean {\n const normalizedName = name.toLowerCase();\n return Object.keys(headers ?? {}).some(\n (headerName) => headerName.toLowerCase() === normalizedName,\n );\n}\n\nexport function requestFailureKey(input: {\n method: string;\n path: string;\n}): string {\n return `${input.method}\\u0000${input.path}`;\n}\n\nfunction syncWatermarkRequestKey(\n watermark: SyncWatermark | null | undefined,\n): string {\n return watermark ? `${watermark.updatedAt}\\u0000${watermark.id}` : \"\";\n}\n\nexport function listContainerParentLanesRequestKey(\n input: ListContainerParentLanesRequest,\n): string {\n return JSON.stringify(\n input.lanes.map((lane) => ({\n laneId: lane.laneId,\n limit: lane.limit ?? null,\n parentId: lane.parentId,\n watermark: syncWatermarkRequestKey(lane.watermark),\n })),\n );\n}\n\nexport function listContainerDocumentLanesRequestKey(\n input: ListContainerDocumentLanesRequest,\n): string {\n return JSON.stringify({\n afterParentPage: input.afterParentPage\n ? [\n input.afterParentPage.parentId,\n syncWatermarkRequestKey(input.afterParentPage.watermark),\n ]\n : null,\n lanes: input.lanes.map((lane) => ({\n containerId: lane.containerId,\n laneId: lane.laneId,\n limit: lane.limit ?? null,\n watermark: syncWatermarkRequestKey(lane.watermark),\n })),\n });\n}\n\n/**\n * Minimal cache surface shared by `Map` and `ApiCache.BoundedCache`, so the\n * request helpers work with either backing store.\n */\ninterface RequestCache<T> {\n get(key: string): Promise<T | null> | undefined;\n has(key: string): boolean;\n set(key: string, value: Promise<T | null>): unknown;\n delete(key: string): unknown;\n}\n\nexport function cachedRequest<T>(\n cache: RequestCache<T>,\n cacheKey: string,\n request: () => Promise<T | null>,\n): Promise<T | null> {\n const cached = cache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n let pending: Promise<T | null>;\n pending = request()\n .then((response) => {\n if (!response && cache.get(cacheKey) === pending) {\n cache.delete(cacheKey);\n }\n return response;\n })\n .catch((error: unknown) => {\n if (cache.get(cacheKey) === pending) {\n cache.delete(cacheKey);\n }\n throw error;\n });\n cache.set(cacheKey, pending);\n return pending;\n}\n\nexport function dedupedRequest<T>(\n cache: RequestCache<T>,\n cacheKey: string,\n request: () => Promise<T | null>,\n): Promise<T | null> {\n const cached = cache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n let pending: Promise<T | null>;\n pending = request().finally(() => {\n if (cache.get(cacheKey) === pending) {\n cache.delete(cacheKey);\n }\n });\n cache.set(cacheKey, pending);\n return pending;\n}\n\nexport function isReplayableRequestBody(\n body: RequestBody | undefined,\n): boolean {\n return !(\n typeof ReadableStream === \"function\" && body instanceof ReadableStream\n );\n}\n\nexport function isSuccessfulResponse(\n response: Response,\n additionalSuccessStatuses: readonly number[],\n): boolean {\n return response.ok || additionalSuccessStatuses.includes(response.status);\n}\n\nfunction validatePaymentRequiredTarget(\n schema: NonNullable<HttpOperation[\"failureResponses\"]>[number] | undefined,\n parsed: unknown,\n expectedOrganizationId: string | undefined,\n): { readonly invalid: boolean; readonly organizationId?: string } {\n if (schema !== PaymentRequiredErrorResponseSchema) {\n return { invalid: false };\n }\n if (\n !isPaymentRequiredErrorResponse(parsed) ||\n (expectedOrganizationId !== undefined &&\n parsed.organizationId !== expectedOrganizationId)\n ) {\n return { invalid: true };\n }\n return { invalid: false, organizationId: parsed.organizationId };\n}\n\nfunction paymentRequiredDescription(\n organizationId: string | undefined,\n): ErrorResponseDescription | null {\n return organizationId === undefined\n ? null\n : {\n ...emptyErrorResponseDescription,\n paymentRequiredOrganizationId: organizationId,\n };\n}\n\n/** An unreadable or empty body: invalid for a typed operation. */\nfunction unreadableErrorResponseDescription(\n operation: HttpOperation | undefined,\n): ErrorResponseDescription {\n return operation\n ? invalidErrorResponseDescription\n : emptyErrorResponseDescription;\n}\n\n/** A body without a recognized error: untyped requests echo its text. */\nfunction unparsedErrorResponseDescription(\n operation: HttpOperation | undefined,\n typed: ErrorResponseDescription,\n responseText: string,\n): ErrorResponseDescription {\n return operation\n ? typed\n : { ...emptyErrorResponseDescription, detail: `: ${responseText}` };\n}\n\nexport async function describeErrorResponse(\n response: Response,\n operation?: HttpOperation,\n expectedPaymentRequiredOrganizationId?: string,\n): Promise<ErrorResponseDescription> {\n const schema = operation?.failureResponses?.[response.status];\n if (operation && !schema) {\n // A cloned response can wait for its other branch to finish cancelling.\n // Cleanup must not delay reporting an already-invalid status.\n void response.body?.cancel().catch(() => {});\n return invalidErrorResponseDescription;\n }\n let responseText = \"\";\n\n try {\n responseText = (await response.text()).trim();\n } catch {\n return unreadableErrorResponseDescription(operation);\n }\n\n if (responseText.length === 0) {\n return unreadableErrorResponseDescription(operation);\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(responseText);\n } catch {\n return unparsedErrorResponseDescription(\n operation,\n invalidErrorResponseDescription,\n responseText,\n );\n }\n\n if (schema) {\n const result = schema.safeParse(parsed);\n if (!result.success) {\n return invalidErrorResponseDescription;\n }\n parsed = result.data;\n }\n\n const paymentTarget = validatePaymentRequiredTarget(\n schema,\n parsed,\n expectedPaymentRequiredOrganizationId,\n );\n if (paymentTarget.invalid) {\n return invalidErrorResponseDescription;\n }\n\n const description =\n parsedErrorResponseDescription(parsed, schema) ??\n paymentRequiredDescription(paymentTarget.organizationId);\n if (description) {\n return description;\n }\n\n return unparsedErrorResponseDescription(\n operation,\n emptyErrorResponseDescription,\n responseText,\n );\n}\n\nexport function isRefreshableSessionError(\n status: number,\n code: string | null,\n): boolean {\n return status === 401 && code === SESSION_ERROR_CODES.refreshRequired;\n}\n\nexport function errorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n // `instanceof Error` fails for errors thrown across realms (web workers,\n // serialized payloads); fall back to a duck-typed string `message`.\n if (\n typeof error === \"object\" &&\n error !== null &&\n \"message\" in error &&\n typeof error.message === \"string\"\n ) {\n return error.message;\n }\n return String(error);\n}\n"]}
|
|
@@ -255,6 +255,13 @@ export declare const getContainerKekLogOperation: Omit<{
|
|
|
255
255
|
export declare const listContainerDocumentLanesOperation: Omit<{
|
|
256
256
|
readonly auth: "session";
|
|
257
257
|
readonly body: z.ZodObject<{
|
|
258
|
+
afterParentPage: z.ZodOptional<z.ZodObject<{
|
|
259
|
+
parentId: z.ZodNullable<z.ZodCustom<string, string>>;
|
|
260
|
+
watermark: z.ZodObject<{
|
|
261
|
+
id: z.ZodString;
|
|
262
|
+
updatedAt: z.ZodString;
|
|
263
|
+
}, z.core.$strict>;
|
|
264
|
+
}, z.core.$strict>>;
|
|
258
265
|
lanes: z.ZodCustom<{
|
|
259
266
|
containerId: string;
|
|
260
267
|
laneId: string;
|
|
@@ -296,6 +303,15 @@ export declare const listContainerDocumentLanesOperation: Omit<{
|
|
|
296
303
|
error: string;
|
|
297
304
|
code?: "session_refresh_required" | undefined;
|
|
298
305
|
}>>;
|
|
306
|
+
readonly 409: z.ZodType<{
|
|
307
|
+
error: string;
|
|
308
|
+
}, {
|
|
309
|
+
error: string;
|
|
310
|
+
}, z.core.$ZodTypeInternals<{
|
|
311
|
+
error: string;
|
|
312
|
+
}, {
|
|
313
|
+
error: string;
|
|
314
|
+
}>>;
|
|
299
315
|
readonly 500: z.ZodType<{
|
|
300
316
|
error: string;
|
|
301
317
|
}, {
|
|
@@ -306,7 +322,7 @@ export declare const listContainerDocumentLanesOperation: Omit<{
|
|
|
306
322
|
error: string;
|
|
307
323
|
}>>;
|
|
308
324
|
};
|
|
309
|
-
readonly failureStatuses: readonly [400, 401, 500];
|
|
325
|
+
readonly failureStatuses: readonly [400, 401, 409, 500];
|
|
310
326
|
readonly id: "containers.documentLanes.query";
|
|
311
327
|
readonly summary: "List container documents by lane";
|
|
312
328
|
readonly description: "Lists the documents linked into up to 32 containers, each lane with its own watermark and page size (500 rows in total). Each lane needs read access to its container; a lane that fails reports its own failure while the others still list, and only the container's absence is reported as `container_not_found`.";
|
|
@@ -428,6 +444,15 @@ export declare const listContainerDocumentLanesOperation: Omit<{
|
|
|
428
444
|
error: string;
|
|
429
445
|
code?: "session_refresh_required" | undefined;
|
|
430
446
|
}>>;
|
|
447
|
+
readonly 409: z.ZodType<{
|
|
448
|
+
error: string;
|
|
449
|
+
}, {
|
|
450
|
+
error: string;
|
|
451
|
+
}, z.core.$ZodTypeInternals<{
|
|
452
|
+
error: string;
|
|
453
|
+
}, {
|
|
454
|
+
error: string;
|
|
455
|
+
}>>;
|
|
431
456
|
readonly 500: z.ZodType<{
|
|
432
457
|
error: string;
|
|
433
458
|
}, {
|
|
@@ -440,7 +465,7 @@ export declare const listContainerDocumentLanesOperation: Omit<{
|
|
|
440
465
|
} & {
|
|
441
466
|
readonly 503: typeof ErrorResponseSchema;
|
|
442
467
|
};
|
|
443
|
-
readonly failureStatuses: readonly [400, 401,
|
|
468
|
+
readonly failureStatuses: readonly [400, 401, 409, 500] | readonly [400, 401, 409, 500, 503];
|
|
444
469
|
};
|
|
445
470
|
export declare const listContainerParentLanesOperation: Omit<{
|
|
446
471
|
readonly auth: "session";
|
|
@@ -529,6 +554,7 @@ export declare const listContainerParentLanesOperation: Omit<{
|
|
|
529
554
|
organizationId: string;
|
|
530
555
|
parentId: string | null;
|
|
531
556
|
updatedAt: string;
|
|
557
|
+
restorationId?: string | undefined;
|
|
532
558
|
systemSlot?: string | null | undefined;
|
|
533
559
|
}[];
|
|
534
560
|
nextWatermark: {
|
|
@@ -567,6 +593,7 @@ export declare const listContainerParentLanesOperation: Omit<{
|
|
|
567
593
|
organizationId: string;
|
|
568
594
|
parentId: string | null;
|
|
569
595
|
updatedAt: string;
|
|
596
|
+
restorationId?: string | undefined;
|
|
570
597
|
systemSlot?: string | null | undefined;
|
|
571
598
|
}[];
|
|
572
599
|
nextWatermark: {
|
|
@@ -58,9 +58,10 @@ export const listContainerDocumentLanesOperation = defineJsonOperation({
|
|
|
58
58
|
failureResponses: {
|
|
59
59
|
400: ErrorResponseSchema,
|
|
60
60
|
401: SessionFailureResponseSchema,
|
|
61
|
+
409: ErrorResponseSchema,
|
|
61
62
|
500: ErrorResponseSchema,
|
|
62
63
|
},
|
|
63
|
-
failureStatuses: [400, 401, 500],
|
|
64
|
+
failureStatuses: [400, 401, 409, 500],
|
|
64
65
|
id: "containers.documentLanes.query",
|
|
65
66
|
summary: "List container documents by lane",
|
|
66
67
|
description: "Lists the documents linked into up to 32 containers, each lane with its own watermark and page size (500 rows in total). Each lane needs read access to its container; a lane that fails reports its own failure while the others still list, and only the container's absence is reported as `container_not_found`.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerReads.js","sourceRoot":"","sources":["containerReads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uCAAuC,EACvC,yCAAyC,EACzC,qCAAqC,GACtC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,0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GACtD,kCAAkC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n containerDocumentLaneRuntimeRefinements,\n containerKekLogResponseRuntimeRefinements,\n containerParentLaneRuntimeRefinements,\n} from \"../containerReadRefinements\";\nimport { registerJsonSchemaFragment } from \"../jsonSchema\";\nimport {\n isListContainerDocumentLanesRequest,\n isListContainerParentLanesRequest,\n ListContainerDocumentLanesRequestSchema,\n ListContainerParentLanesRequestSchema,\n} from \"../request\";\nimport {\n ContainerKekLogResponseSchema,\n ErrorResponseSchema,\n isContainerKekLogResponse,\n isListContainerParentLanesResponse,\n ListContainerParentLanesResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport {\n isListContainerDocumentLanesResponse,\n ListContainerDocumentLanesResponseSchema,\n} from \"../response/containerDocumentLanes\";\nimport { loosePlainObject } from \"../schema\";\nimport { MAX_CONTAINER_KEY_EPOCH } from \"../util\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst DIGITS_PATTERN = /^\\d+$/u;\n\nfunction containerKekLogEpochQuerySchema() {\n return registerJsonSchemaFragment(\n z.union([z.number(), z.string()]).refine((value) => {\n if (typeof value === \"string\" && !DIGITS_PATTERN.test(value))\n return false;\n const parsed = Number(value);\n return (\n Number.isSafeInteger(parsed) &&\n parsed > 0 &&\n parsed <= MAX_CONTAINER_KEY_EPOCH\n );\n }, \"Invalid key epoch\"),\n {\n maximum: MAX_CONTAINER_KEY_EPOCH,\n minimum: 1,\n type: \"integer\",\n },\n );\n}\n\nexport const ContainerReadPathParamsSchema = z.strictObject({\n containerId: z.string(),\n});\n\nexport const ContainerKekLogQuerySchema = loosePlainObject({\n keyringForEpoch: containerKekLogEpochQuerySchema().optional(),\n afterKeyEpoch: containerKekLogEpochQuerySchema().optional(),\n});\n\nexport type ContainerReadPathParams = z.infer<\n typeof ContainerReadPathParamsSchema\n>;\nexport type ContainerKekLogQuery = z.infer<typeof ContainerKekLogQuerySchema>;\n\nconst containerReadFailureResponses = {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n} as const;\n\nconst containerReadFailureStatuses = [400, 401, 403, 404, 409, 500] as const;\n\nexport const getContainerKekLogOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: containerReadFailureResponses,\n failureStatuses: containerReadFailureStatuses,\n id: \"containers.kekLog.get\",\n summary: \"Page a container's KEK rotation log\",\n description:\n \"Pages a container's append-only KEK rotation log: every epoch with its write-once predecessor bridge and retained wraps, plus the sealed keyring of one epoch the request names. Clients use it to rebuild or repair a damaged container KEK keyring. Any current reader of the container may page the whole log, because current read access includes retained history.\",\n method: \"GET\",\n params: ContainerReadPathParamsSchema,\n path: \"/containers/{containerId}/kek-log\",\n query: ContainerKekLogQuerySchema,\n responses: { 200: ContainerKekLogResponseSchema },\n runtimeRefinements: containerKekLogResponseRuntimeRefinements,\n});\n\nexport const listContainerDocumentLanesOperation = defineJsonOperation({\n auth: \"session\",\n body: ListContainerDocumentLanesRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 409, 500],\n id: \"containers.documentLanes.query\",\n summary: \"List container documents by lane\",\n description:\n \"Lists the documents linked into up to 32 containers, each lane with its own watermark and page size (500 rows in total). Each lane needs read access to its container; a lane that fails reports its own failure while the others still list, and only the container's absence is reported as `container_not_found`.\",\n method: \"POST\",\n params: z.strictObject({}),\n path: \"/containers/documents/query\",\n responses: { 200: ListContainerDocumentLanesResponseSchema },\n runtimeRefinements: containerDocumentLaneRuntimeRefinements,\n});\n\nexport const listContainerParentLanesOperation = defineJsonOperation({\n auth: \"session\",\n body: ListContainerParentLanesRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 500],\n id: \"containers.parentLanes.query\",\n summary: \"List containers by parent lane\",\n description:\n \"Lists the containers the caller can reach through direct grants or managed-principal membership, one bounded page for each of up to four requested parent lanes, each with its own watermark. Clients use it to discover and incrementally refresh the folder tree. Any signed-in user may call it; access is checked per container.\",\n method: \"POST\",\n params: z.strictObject({}),\n path: \"/containers/parent-lanes/query\",\n responses: { 200: ListContainerParentLanesResponseSchema },\n runtimeRefinements: containerParentLaneRuntimeRefinements,\n});\n\nexport const isGetContainerKekLogOperationResponse = isContainerKekLogResponse;\nexport const isListContainerDocumentLanesOperationRequest =\n isListContainerDocumentLanesRequest;\nexport const isListContainerDocumentLanesOperationResponse =\n isListContainerDocumentLanesResponse;\nexport const isListContainerParentLanesOperationRequest =\n isListContainerParentLanesRequest;\nexport const isListContainerParentLanesOperationResponse =\n isListContainerParentLanesResponse;\n"]}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export { DEFAULT_CONTAINER_READ_LANE_PAGE_LIMIT as DEFAULT_CONTAINER_DOCUMENT_LANE_PAGE_LIMIT, MAX_CONTAINER_DOCUMENT_LANES, MAX_CONTAINER_READ_LANE_BATCH_PAGE_TOTAL as MAX_CONTAINER_DOCUMENT_LANE_PAGE_TOTAL, } from "../containerReadSchemas.js";
|
|
3
3
|
export declare const ListContainerDocumentLanesRequestSchema: z.ZodObject<{
|
|
4
|
+
afterParentPage: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
parentId: z.ZodNullable<z.ZodCustom<string, string>>;
|
|
6
|
+
watermark: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
updatedAt: z.ZodString;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
}, z.core.$strict>>;
|
|
4
11
|
lanes: z.ZodCustom<{
|
|
5
12
|
containerId: string;
|
|
6
13
|
laneId: string;
|
|
@@ -11,6 +11,12 @@ const ContainerDocumentLaneRequestSchema = z.strictObject({
|
|
|
11
11
|
watermark: ContainerReadLaneWatermarkSchema.nullable(),
|
|
12
12
|
});
|
|
13
13
|
const ListContainerDocumentLanesRequestViewSchema = z.strictObject({
|
|
14
|
+
afterParentPage: z
|
|
15
|
+
.strictObject({
|
|
16
|
+
parentId: uuidV4StringSchema.nullable(),
|
|
17
|
+
watermark: ContainerReadLaneWatermarkSchema,
|
|
18
|
+
})
|
|
19
|
+
.optional(),
|
|
14
20
|
lanes: boundedNonEmptyArraySchema(ContainerDocumentLaneRequestSchema, MAX_CONTAINER_DOCUMENT_LANES),
|
|
15
21
|
});
|
|
16
22
|
export const ListContainerDocumentLanesRequestSchema = registerJsonSchemaRuntimeRefinements(registerJsonSchemaView(ListContainerDocumentLanesRequestViewSchema.superRefine(refineContainerReadLaneRequests("Container document lane")), ListContainerDocumentLanesRequestViewSchema), [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerDocumentLanes.js","sourceRoot":"","sources":["containerDocumentLanes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,+CAA+C,EAC/C,+CAA+C,GAChD,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,4BAA4B,EAC5B,wCAAwC,EACxC,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oCAAoC,EACpC,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,sCAAsC,IAAI,0CAA0C,EACpF,4BAA4B,EAC5B,wCAAwC,IAAI,sCAAsC,GACnF,MAAM,yBAAyB,CAAC;AAEjC,MAAM,kCAAkC,GAAG,CAAC,CAAC,YAAY,CAAC;IACxD,WAAW,EAAE,kBAAkB;IAC/B,MAAM,EAAE,yBAAyB;IACjC,KAAK,EAAE,4BAA4B,CACjC,wCAAwC,CACzC,CAAC,QAAQ,EAAE;IACZ,SAAS,EAAE,gCAAgC,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAC;AAEH,MAAM,2CAA2C,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,KAAK,EAAE,0BAA0B,CAC/B,kCAAkC,EAClC,4BAA4B,CAC7B;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uCAAuC,GAClD,oCAAoC,CAClC,sBAAsB,CACpB,2CAA2C,CAAC,WAAW,CACrD,+BAA+B,CAAC,yBAAyB,CAAC,CAC3D,EACD,2CAA2C,CAC5C,EACD;IACE,+CAA+C;IAC/C,+CAA+C;CAChD,CACF,CAAC;AAMJ,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n containerDocumentLaneRequestPageTotalRefinement,\n containerDocumentLaneRequestUniqueIdsRefinement,\n} from \"../containerReadRefinements\";\nimport {\n ContainerReadLaneIdSchema,\n ContainerReadLaneWatermarkSchema,\n MAX_CONTAINER_DOCUMENT_LANES,\n MAX_CONTAINER_READ_LANE_BATCH_PAGE_TOTAL,\n refineContainerReadLaneRequests,\n} from \"../containerReadSchemas\";\nimport {\n registerJsonSchemaRuntimeRefinements,\n registerJsonSchemaView,\n} from \"../jsonSchema\";\nimport {\n boundedNonEmptyArraySchema,\n boundedPositiveIntegerSchema,\n uuidV4StringSchema,\n} from \"../schema\";\n\nexport {\n DEFAULT_CONTAINER_READ_LANE_PAGE_LIMIT as DEFAULT_CONTAINER_DOCUMENT_LANE_PAGE_LIMIT,\n MAX_CONTAINER_DOCUMENT_LANES,\n MAX_CONTAINER_READ_LANE_BATCH_PAGE_TOTAL as MAX_CONTAINER_DOCUMENT_LANE_PAGE_TOTAL,\n} from \"../containerReadSchemas\";\n\nconst ContainerDocumentLaneRequestSchema = z.strictObject({\n containerId: uuidV4StringSchema,\n laneId: ContainerReadLaneIdSchema,\n limit: boundedPositiveIntegerSchema(\n MAX_CONTAINER_READ_LANE_BATCH_PAGE_TOTAL,\n ).optional(),\n watermark: ContainerReadLaneWatermarkSchema.nullable(),\n});\n\nconst ListContainerDocumentLanesRequestViewSchema = z.strictObject({\n lanes: boundedNonEmptyArraySchema(\n ContainerDocumentLaneRequestSchema,\n MAX_CONTAINER_DOCUMENT_LANES,\n ),\n});\n\nexport const ListContainerDocumentLanesRequestSchema =\n registerJsonSchemaRuntimeRefinements(\n registerJsonSchemaView(\n ListContainerDocumentLanesRequestViewSchema.superRefine(\n refineContainerReadLaneRequests(\"Container document lane\"),\n ),\n ListContainerDocumentLanesRequestViewSchema,\n ),\n [\n containerDocumentLaneRequestUniqueIdsRefinement,\n containerDocumentLaneRequestPageTotalRefinement,\n ],\n );\n\nexport type ListContainerDocumentLanesRequest = z.infer<\n typeof ListContainerDocumentLanesRequestSchema\n>;\n\nexport function isListContainerDocumentLanesRequest(\n value: unknown,\n): value is ListContainerDocumentLanesRequest {\n return ListContainerDocumentLanesRequestSchema.safeParse(value).success;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"containerDocumentLanes.js","sourceRoot":"","sources":["containerDocumentLanes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,+CAA+C,EAC/C,+CAA+C,GAChD,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,4BAA4B,EAC5B,wCAAwC,EACxC,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oCAAoC,EACpC,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,sCAAsC,IAAI,0CAA0C,EACpF,4BAA4B,EAC5B,wCAAwC,IAAI,sCAAsC,GACnF,MAAM,yBAAyB,CAAC;AAEjC,MAAM,kCAAkC,GAAG,CAAC,CAAC,YAAY,CAAC;IACxD,WAAW,EAAE,kBAAkB;IAC/B,MAAM,EAAE,yBAAyB;IACjC,KAAK,EAAE,4BAA4B,CACjC,wCAAwC,CACzC,CAAC,QAAQ,EAAE;IACZ,SAAS,EAAE,gCAAgC,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAC;AAEH,MAAM,2CAA2C,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,eAAe,EAAE,CAAC;SACf,YAAY,CAAC;QACZ,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE;QACvC,SAAS,EAAE,gCAAgC;KAC5C,CAAC;SACD,QAAQ,EAAE;IACb,KAAK,EAAE,0BAA0B,CAC/B,kCAAkC,EAClC,4BAA4B,CAC7B;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uCAAuC,GAClD,oCAAoC,CAClC,sBAAsB,CACpB,2CAA2C,CAAC,WAAW,CACrD,+BAA+B,CAAC,yBAAyB,CAAC,CAC3D,EACD,2CAA2C,CAC5C,EACD;IACE,+CAA+C;IAC/C,+CAA+C;CAChD,CACF,CAAC;AAMJ,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n containerDocumentLaneRequestPageTotalRefinement,\n containerDocumentLaneRequestUniqueIdsRefinement,\n} from \"../containerReadRefinements\";\nimport {\n ContainerReadLaneIdSchema,\n ContainerReadLaneWatermarkSchema,\n MAX_CONTAINER_DOCUMENT_LANES,\n MAX_CONTAINER_READ_LANE_BATCH_PAGE_TOTAL,\n refineContainerReadLaneRequests,\n} from \"../containerReadSchemas\";\nimport {\n registerJsonSchemaRuntimeRefinements,\n registerJsonSchemaView,\n} from \"../jsonSchema\";\nimport {\n boundedNonEmptyArraySchema,\n boundedPositiveIntegerSchema,\n uuidV4StringSchema,\n} from \"../schema\";\n\nexport {\n DEFAULT_CONTAINER_READ_LANE_PAGE_LIMIT as DEFAULT_CONTAINER_DOCUMENT_LANE_PAGE_LIMIT,\n MAX_CONTAINER_DOCUMENT_LANES,\n MAX_CONTAINER_READ_LANE_BATCH_PAGE_TOTAL as MAX_CONTAINER_DOCUMENT_LANE_PAGE_TOTAL,\n} from \"../containerReadSchemas\";\n\nconst ContainerDocumentLaneRequestSchema = z.strictObject({\n containerId: uuidV4StringSchema,\n laneId: ContainerReadLaneIdSchema,\n limit: boundedPositiveIntegerSchema(\n MAX_CONTAINER_READ_LANE_BATCH_PAGE_TOTAL,\n ).optional(),\n watermark: ContainerReadLaneWatermarkSchema.nullable(),\n});\n\nconst ListContainerDocumentLanesRequestViewSchema = z.strictObject({\n afterParentPage: z\n .strictObject({\n parentId: uuidV4StringSchema.nullable(),\n watermark: ContainerReadLaneWatermarkSchema,\n })\n .optional(),\n lanes: boundedNonEmptyArraySchema(\n ContainerDocumentLaneRequestSchema,\n MAX_CONTAINER_DOCUMENT_LANES,\n ),\n});\n\nexport const ListContainerDocumentLanesRequestSchema =\n registerJsonSchemaRuntimeRefinements(\n registerJsonSchemaView(\n ListContainerDocumentLanesRequestViewSchema.superRefine(\n refineContainerReadLaneRequests(\"Container document lane\"),\n ),\n ListContainerDocumentLanesRequestViewSchema,\n ),\n [\n containerDocumentLaneRequestUniqueIdsRefinement,\n containerDocumentLaneRequestPageTotalRefinement,\n ],\n );\n\nexport type ListContainerDocumentLanesRequest = z.infer<\n typeof ListContainerDocumentLanesRequestSchema\n>;\n\nexport function isListContainerDocumentLanesRequest(\n value: unknown,\n): value is ListContainerDocumentLanesRequest {\n return ListContainerDocumentLanesRequestSchema.safeParse(value).success;\n}\n"]}
|
|
@@ -1736,6 +1736,7 @@ export declare const ContainerSummaryResponseSchema: z.ZodType<{
|
|
|
1736
1736
|
organizationId: string;
|
|
1737
1737
|
parentId: string | null;
|
|
1738
1738
|
updatedAt: string;
|
|
1739
|
+
restorationId?: string | undefined;
|
|
1739
1740
|
systemSlot?: string | null | undefined;
|
|
1740
1741
|
}, {
|
|
1741
1742
|
createdAt: string;
|
|
@@ -1757,6 +1758,7 @@ export declare const ContainerSummaryResponseSchema: z.ZodType<{
|
|
|
1757
1758
|
organizationId: string;
|
|
1758
1759
|
parentId: string | null;
|
|
1759
1760
|
updatedAt: string;
|
|
1761
|
+
restorationId?: string | undefined;
|
|
1760
1762
|
systemSlot?: string | null | undefined;
|
|
1761
1763
|
}, z.core.$ZodTypeInternals<{
|
|
1762
1764
|
createdAt: string;
|
|
@@ -1778,6 +1780,7 @@ export declare const ContainerSummaryResponseSchema: z.ZodType<{
|
|
|
1778
1780
|
organizationId: string;
|
|
1779
1781
|
parentId: string | null;
|
|
1780
1782
|
updatedAt: string;
|
|
1783
|
+
restorationId?: string | undefined;
|
|
1781
1784
|
systemSlot?: string | null | undefined;
|
|
1782
1785
|
}, {
|
|
1783
1786
|
createdAt: string;
|
|
@@ -1799,6 +1802,7 @@ export declare const ContainerSummaryResponseSchema: z.ZodType<{
|
|
|
1799
1802
|
organizationId: string;
|
|
1800
1803
|
parentId: string | null;
|
|
1801
1804
|
updatedAt: string;
|
|
1805
|
+
restorationId?: string | undefined;
|
|
1802
1806
|
systemSlot?: string | null | undefined;
|
|
1803
1807
|
}>>;
|
|
1804
1808
|
export type ContainerSummary = z.infer<typeof ContainerSummaryResponseSchema>;
|
|
@@ -1850,6 +1854,7 @@ export declare const ListContainersResponseSchema: z.ZodType<{
|
|
|
1850
1854
|
organizationId: string;
|
|
1851
1855
|
parentId: string | null;
|
|
1852
1856
|
updatedAt: string;
|
|
1857
|
+
restorationId?: string | undefined;
|
|
1853
1858
|
systemSlot?: string | null | undefined;
|
|
1854
1859
|
}[];
|
|
1855
1860
|
nextWatermark: {
|
|
@@ -1885,6 +1890,7 @@ export declare const ListContainersResponseSchema: z.ZodType<{
|
|
|
1885
1890
|
organizationId: string;
|
|
1886
1891
|
parentId: string | null;
|
|
1887
1892
|
updatedAt: string;
|
|
1893
|
+
restorationId?: string | undefined;
|
|
1888
1894
|
systemSlot?: string | null | undefined;
|
|
1889
1895
|
}[];
|
|
1890
1896
|
nextWatermark: {
|
|
@@ -1920,6 +1926,7 @@ export declare const ListContainersResponseSchema: z.ZodType<{
|
|
|
1920
1926
|
organizationId: string;
|
|
1921
1927
|
parentId: string | null;
|
|
1922
1928
|
updatedAt: string;
|
|
1929
|
+
restorationId?: string | undefined;
|
|
1923
1930
|
systemSlot?: string | null | undefined;
|
|
1924
1931
|
}[];
|
|
1925
1932
|
nextWatermark: {
|
|
@@ -1955,6 +1962,7 @@ export declare const ListContainersResponseSchema: z.ZodType<{
|
|
|
1955
1962
|
organizationId: string;
|
|
1956
1963
|
parentId: string | null;
|
|
1957
1964
|
updatedAt: string;
|
|
1965
|
+
restorationId?: string | undefined;
|
|
1958
1966
|
systemSlot?: string | null | undefined;
|
|
1959
1967
|
}[];
|
|
1960
1968
|
nextWatermark: {
|
|
@@ -217,6 +217,7 @@ export const ContainerWriterProjectionWireResponseSchema = registerJsonSchemaRun
|
|
|
217
217
|
writerProjectionManifestBundlesRefinement,
|
|
218
218
|
]);
|
|
219
219
|
export const ContainerSummaryResponseSchema = loosePlainObject({
|
|
220
|
+
restorationId: sha256HexStringSchema.optional(),
|
|
220
221
|
createdAt: z.string(),
|
|
221
222
|
depth: nonNegativeIntegerSchema,
|
|
222
223
|
effectiveAccessLevel: EffectiveAccessLevelSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","sourceRoot":"","sources":["container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,oCAAoC,EAAE,MAAM,e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CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IAChD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,KAAK,EAAE,WAAW,CAAC,8BAA8B,CAAC;IAClD,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IAC7C,UAAU,EAAE,WAAW,CAAC,oCAAoC,CAAC;CAC9D,CAAC,CAAC;AAMH,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,+BAA+B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,6BAA6B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,2CAA2C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { containerKekLogSingleKeyringRefinement } from \"../containerReadRefinements\";\nimport { ContainerSystemSlotSchema } from \"../containerSystemSlot\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport { organizationProvisioningContainerKeyringRefinement } from \"../organizationProvisioningRefinements\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyArraySchema,\n nonEmptyStringSchema,\n nonNegativeIntegerSchema,\n plainObjectSchema,\n positiveIntegerSchema,\n sha256HexStringSchema,\n} from \"../schema\";\nimport {\n AccessManifestBundleWireResponseSchema,\n CONTAINER_KEK_LOG_PAGE_LIMIT,\n CONTAINER_KEK_WRAPS_PER_EPOCH_LIMIT,\n ContainerKekKeyringWireRecordSchema,\n} from \"../util\";\nimport {\n containerWriterProjectionPathKekCountRefinement,\n writerProjectionManifestBundlesRefinement,\n} from \"../writerProjectionRefinements\";\nimport { EffectiveAccessLevelSchema } from \"./accessLevel\";\nimport {\n containerKeyingPathReferences,\n ManifestBundlesSchema,\n ManifestHashReferenceSchema,\n OmittedManifestBundlesSchema,\n refineManifestBundleReferences,\n} from \"./manifestBundleReferences\";\nimport { ReferencedPrincipalStateResponseSchema } from \"./principalReference\";\nimport {\n ProjectionPolicyEvidenceResponseSchema,\n ProjectionPolicyEvidenceWireResponseSchema,\n} from \"./projectionPolicyEvidence\";\nimport { SyncWatermarkSchema } from \"./syncWatermark\";\n\n/**\n * The container's sealed predecessor key history. Opening it under the\n * current KEK yields every retained historical KEK in one decrypt; the\n * bridge log behind it is served only by the rebuild read path.\n */\nconst ContainerKekKeyringWireResponseSchema =\n ContainerKekKeyringWireRecordSchema;\n\nexport type ContainerKekKeyringWireResponse = z.infer<\n typeof ContainerKekKeyringWireResponseSchema\n>;\n\nconst containerKekResponseShape = {\n accessManifestHash: nonEmptyStringSchema,\n containerId: z.string(),\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n containerManifestHistory: arraySchema(AccessManifestBundleWireResponseSchema),\n keyEpoch: plainObjectSchema,\n keyEpochHash: nonEmptyStringSchema,\n keyring: ContainerKekKeyringWireResponseSchema.nullable(),\n keyTargetHash: nonEmptyStringSchema,\n parentContainerKeyEpochId: z.string().nullable(),\n recipientTargets: nonEmptyArraySchema(plainObjectSchema),\n wraps: nonEmptyArraySchema(plainObjectSchema),\n};\n\nfunction refineContainerKekKeyring(\n value: { readonly containerKeyEpoch: number; readonly keyring: unknown },\n context: z.RefinementCtx,\n) {\n if ((value.keyring === null) !== (value.containerKeyEpoch === 1)) {\n context.addIssue({\n code: \"custom\",\n message: \"container keyring must be null exactly at epoch 1\",\n path: [\"keyring\"],\n });\n }\n}\n\nconst ContainerKekResponseSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKekResponseShape).superRefine(\n refineContainerKekKeyring,\n ),\n [organizationProvisioningContainerKeyringRefinement],\n);\n\n/** On the writer-projection wire, KEK history cites manifests by hash. */\nconst ContainerKekWireResponseSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerKekResponseShape,\n containerManifestHistory: arraySchema(ManifestHashReferenceSchema),\n }).superRefine(refineContainerKekKeyring),\n [organizationProvisioningContainerKeyringRefinement],\n);\n\nexport type ContainerKekResponse = z.infer<typeof ContainerKekResponseSchema>;\n\n/** One KEK level as served in full, its manifest history cited by hash. */\nexport type ContainerKekWireLevel = z.infer<\n typeof ContainerKekWireResponseSchema\n>;\n\nexport function isContainerKekWireLevel(\n value: unknown,\n): value is ContainerKekWireLevel {\n return (\n ContainerKekWireResponseSchema.safeParse(value).success &&\n !Object.hasOwn(Object(value), \"levelDigest\")\n );\n}\n\n/**\n * A KEK level the request declared held (`k:` hint), replaced by the\n * domain-separated digest of its canonical wire bytes. It keeps the level's manifest citations, so\n * the response's bundle bookkeeping stays exact; the client refills the\n * level from those exact held bytes before anything reads it.\n */\nexport const CitedContainerKekLevelSchema = z.strictObject({\n levelDigest: sha256HexStringSchema,\n containerManifestHistory: arraySchema(ManifestHashReferenceSchema),\n});\n\nexport type CitedContainerKekLevel = z.infer<\n typeof CitedContainerKekLevelSchema\n>;\n\nexport function isCitedContainerKekLevel(\n value: unknown,\n): value is CitedContainerKekLevel {\n return CitedContainerKekLevelSchema.safeParse(value).success;\n}\n\nconst ServedContainerKekLevelSchema = z.union([\n CitedContainerKekLevelSchema,\n ContainerKekWireResponseSchema,\n]);\n\n/**\n * The append-only rotation log for one container: every epoch with its\n * write-once bridge and sealed keyring. This is the rebuild/repair read\n * path — hot reads use the projection keyring instead.\n */\nexport const ContainerKekLogEpochResponseSchema = loosePlainObject({\n accessManifestHash: nonEmptyStringSchema,\n bridge: plainObjectSchema.nullable(),\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n keyring: ContainerKekKeyringWireResponseSchema.nullable(),\n parentContainerKeyEpochId: z.string().nullable(),\n /**\n * Retained recipient envelopes are the recovery backstop when a bridge is\n * severed. The server and response guard apply this bound per epoch.\n */\n wraps: arraySchema(plainObjectSchema, CONTAINER_KEK_WRAPS_PER_EPOCH_LIMIT),\n});\n\nexport type ContainerKekLogEpochResponse = z.infer<\n typeof ContainerKekLogEpochResponseSchema\n>;\n\nexport const ContainerKekLogResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n containerId: nonEmptyStringSchema,\n epochs: arraySchema(\n ContainerKekLogEpochResponseSchema,\n CONTAINER_KEK_LOG_PAGE_LIMIT,\n ),\n /** True when epochs above this page's last remain unserved. */\n hasMore: z.boolean(),\n }).superRefine(({ epochs }, context) => {\n if (epochs.filter((epoch) => epoch.keyring !== null).length > 1) {\n context.addIssue({\n code: \"custom\",\n message: \"container KEK log pages contain at most one keyring\",\n path: [\"epochs\"],\n });\n }\n }),\n [containerKekLogSingleKeyringRefinement],\n );\n\nexport type ContainerKekLogResponse = z.infer<\n typeof ContainerKekLogResponseSchema\n>;\n\nexport function isContainerKekLogResponse(\n value: unknown,\n): value is ContainerKekLogResponse {\n return ContainerKekLogResponseSchema.safeParse(value).success;\n}\n\n/**\n * A container mutation's acknowledgement names what the server committed by\n * hash and adds only the fields it assigned (timestamps). The client compares\n * the hashes with its own signed plan and persists state built from the plan,\n * so the signed event, manifest, state, key epoch, and wraps are never echoed.\n * `bundleDigest` names the bundle a writer projection would serve for the new\n * head, so the author can hold exactly those bytes for later citation.\n */\nconst ContainerManifestMutationResponseShape = {\n bundleDigest: sha256HexStringSchema,\n containerId: z.string(),\n createdAt: z.string(),\n eventHash: nonEmptyStringSchema,\n manifestHead: loosePlainObject({\n epoch: z.number(),\n manifestHash: z.string(),\n }),\n organizationId: z.string(),\n parentId: z.string().nullable(),\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n updatedAt: z.string(),\n};\n\n/** The committed key epoch, by hash: no epoch, wrap, or keyring bytes. */\nconst ContainerMutationKekAcknowledgementSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n keyEpochHash: nonEmptyStringSchema,\n keyringHash: nonEmptyStringSchema.nullable(),\n keyTargetHash: nonEmptyStringSchema,\n parentContainerKeyEpochId: z.string().nullable(),\n }).superRefine((value, context) => {\n if ((value.keyringHash === null) !== (value.containerKeyEpoch === 1)) {\n context.addIssue({\n code: \"custom\",\n message: \"container keyring hash must be null exactly at epoch 1\",\n path: [\"keyringHash\"],\n });\n }\n }),\n [organizationProvisioningContainerKeyringRefinement],\n );\n\nexport const ContainerMutationResponseShape = {\n ...ContainerManifestMutationResponseShape,\n containerKek: ContainerMutationKekAcknowledgementSchema,\n};\n\nexport const ContainerMutationResponseSchema = loosePlainObject(\n ContainerMutationResponseShape,\n);\n\nexport type ContainerMutationResponse = z.infer<\n typeof ContainerMutationResponseSchema\n>;\n\n/** A rotation's acknowledgement, plus one per carried rekey in request order. */\nexport const ContainerRotationResponseSchema = loosePlainObject({\n ...ContainerMutationResponseShape,\n containerRekeys: arraySchema(ContainerMutationResponseSchema).optional(),\n});\n\nexport type ContainerRotationResponse = z.infer<\n typeof ContainerRotationResponseSchema\n>;\n\nexport function isContainerRotationResponse(\n value: unknown,\n): value is ContainerRotationResponse {\n return ContainerRotationResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerReciteResponseSchema = loosePlainObject(\n ContainerManifestMutationResponseShape,\n);\nexport type ContainerReciteResponse = z.infer<\n typeof ContainerReciteResponseSchema\n>;\n\nexport function isContainerReciteResponse(\n value: unknown,\n): value is ContainerReciteResponse {\n return ContainerReciteResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerDeleteResponseSchema = loosePlainObject({\n containerId: z.string(),\n deletedAt: z.string(),\n});\n\nexport type ContainerDeleteResponse = z.infer<\n typeof ContainerDeleteResponseSchema\n>;\n\nexport const CONTAINER_PROJECTION_STATE_INVALID_ERROR_CODE =\n \"container_projection_state_invalid\";\nexport const ContainerWriterProjectionErrorResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_PROJECTION_STATE_INVALID_ERROR_CODE),\n error: z.string(),\n});\n\nconst containerKeyingPathShape = {\n containerId: z.string(),\n containerKeks: arraySchema(ContainerKekResponseSchema),\n organizationId: z.string(),\n path: nonEmptyArraySchema(AccessManifestBundleWireResponseSchema),\n};\nfunction refineContainerKeyingPath(\n projection: { containerKeks: unknown[]; path: unknown[] },\n context: z.RefinementCtx,\n) {\n // loosePlainObject can continue refinements after reporting malformed fields.\n if (\n Array.isArray(projection.containerKeks) &&\n Array.isArray(projection.path) &&\n projection.containerKeks.length !== projection.path.length\n )\n context.addIssue({\n code: \"custom\",\n message: \"container KEK count must match the manifest path length\",\n path: [\"containerKeks\"],\n });\n}\nexport const ContainerKeyingPathResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKeyingPathShape).superRefine(\n refineContainerKeyingPath,\n ),\n [containerWriterProjectionPathKekCountRefinement],\n );\nexport type ContainerKeyingPathResponse = z.infer<\n typeof ContainerKeyingPathResponseSchema\n>;\n/**\n * The decoded projection a client verifies: every manifest position holds\n * its bundle. `decodeContainerWriterProjection` builds it from the wire.\n */\nexport const ContainerWriterProjectionResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerKeyingPathShape,\n policyEvidence: ProjectionPolicyEvidenceResponseSchema,\n }).superRefine(refineContainerKeyingPath),\n [containerWriterProjectionPathKekCountRefinement],\n );\n\nexport type ContainerWriterProjectionResponse = z.infer<\n typeof ContainerWriterProjectionResponseSchema\n>;\n\nconst containerKeyingPathWireShape = {\n containerId: z.string(),\n containerKeks: arraySchema(ServedContainerKekLevelSchema),\n organizationId: z.string(),\n path: nonEmptyArraySchema(ManifestHashReferenceSchema),\n};\nexport const ContainerKeyingPathWireResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKeyingPathWireShape).superRefine(\n refineContainerKeyingPath,\n ),\n [containerWriterProjectionPathKekCountRefinement],\n );\nexport type ContainerKeyingPathWireResponse = z.infer<\n typeof ContainerKeyingPathWireResponseSchema\n>;\n\n/**\n * The served shape: manifest positions cite `bundles` by hash, except hashes\n * the request declared already held, which `omittedBundles` lists instead.\n */\nexport const ContainerWriterProjectionWireResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n bundles: ManifestBundlesSchema,\n omittedBundles: OmittedManifestBundlesSchema,\n ...containerKeyingPathWireShape,\n policyEvidence: ProjectionPolicyEvidenceWireResponseSchema,\n }).superRefine((projection, context) => {\n refineContainerKeyingPath(projection, context);\n refineManifestBundleReferences(\n projection,\n containerKeyingPathReferences(projection),\n context,\n );\n }),\n [\n containerWriterProjectionPathKekCountRefinement,\n writerProjectionManifestBundlesRefinement,\n ],\n );\n\nexport type ContainerWriterProjectionWireResponse = z.infer<\n typeof ContainerWriterProjectionWireResponseSchema\n>;\n\nexport const ContainerSummaryResponseSchema = loosePlainObject({\n createdAt: z.string(),\n depth: nonNegativeIntegerSchema,\n effectiveAccessLevel: EffectiveAccessLevelSchema,\n id: z.string(),\n metadataAccessEpoch: z.number(),\n metadataAccessStateHash: nonEmptyStringSchema,\n metadataDocumentId: z.string(),\n metadataReferencedPrincipals: arraySchema(\n ReferencedPrincipalStateResponseSchema,\n ),\n metadataVersionVector: z.string(),\n organizationId: z.string(),\n parentId: z.string().nullable(),\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n updatedAt: z.string(),\n});\n\nexport type ContainerSummary = z.infer<typeof ContainerSummaryResponseSchema>;\n\nexport const ContainerSyncTombstoneResponseSchema = loosePlainObject({\n containerId: z.string(),\n depth: nonNegativeIntegerSchema,\n parentId: z.string().nullable(),\n reason: z.literal([\"access_revoked\", \"deleted\"]),\n updatedAt: z.string(),\n});\n\nexport type ContainerSyncTombstone = z.infer<\n typeof ContainerSyncTombstoneResponseSchema\n>;\n\nexport const ListContainersResponseSchema = loosePlainObject({\n hasMore: z.boolean(),\n items: arraySchema(ContainerSummaryResponseSchema),\n nextWatermark: SyncWatermarkSchema.nullable(),\n tombstones: arraySchema(ContainerSyncTombstoneResponseSchema),\n});\n\nexport type ListContainersResponse = z.infer<\n typeof ListContainersResponseSchema\n>;\n\nexport function isListContainersResponse(\n value: unknown,\n): value is ListContainersResponse {\n return ListContainersResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerMutationResponse(\n value: unknown,\n): value is ContainerMutationResponse {\n return ContainerMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerDeleteResponse(\n value: unknown,\n): value is ContainerDeleteResponse {\n return ContainerDeleteResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerWriterProjectionResponse(\n value: unknown,\n): value is ContainerWriterProjectionResponse {\n return ContainerWriterProjectionResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerWriterProjectionWireResponse(\n value: unknown,\n): value is ContainerWriterProjectionWireResponse {\n return ContainerWriterProjectionWireResponseSchema.safeParse(value).success;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,kDAAkD,EAAE,MAAM,wCAAwC,CAAC;AAC5G,OAAO,EACL,WAAW,EAC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,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,KAAK,EAAE,WAAW,CAAC,8BAA8B,CAAC;IAClD,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IAC7C,UAAU,EAAE,WAAW,CAAC,oCAAoC,CAAC;CAC9D,CAAC,CAAC;AAMH,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,+BAA+B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,6BAA6B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,2CAA2C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { containerKekLogSingleKeyringRefinement } from \"../containerReadRefinements\";\nimport { ContainerSystemSlotSchema } from \"../containerSystemSlot\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport { organizationProvisioningContainerKeyringRefinement } from \"../organizationProvisioningRefinements\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyArraySchema,\n nonEmptyStringSchema,\n nonNegativeIntegerSchema,\n plainObjectSchema,\n positiveIntegerSchema,\n sha256HexStringSchema,\n} from \"../schema\";\nimport {\n AccessManifestBundleWireResponseSchema,\n CONTAINER_KEK_LOG_PAGE_LIMIT,\n CONTAINER_KEK_WRAPS_PER_EPOCH_LIMIT,\n ContainerKekKeyringWireRecordSchema,\n} from \"../util\";\nimport {\n containerWriterProjectionPathKekCountRefinement,\n writerProjectionManifestBundlesRefinement,\n} from \"../writerProjectionRefinements\";\nimport { EffectiveAccessLevelSchema } from \"./accessLevel\";\nimport {\n containerKeyingPathReferences,\n ManifestBundlesSchema,\n ManifestHashReferenceSchema,\n OmittedManifestBundlesSchema,\n refineManifestBundleReferences,\n} from \"./manifestBundleReferences\";\nimport { ReferencedPrincipalStateResponseSchema } from \"./principalReference\";\nimport {\n ProjectionPolicyEvidenceResponseSchema,\n ProjectionPolicyEvidenceWireResponseSchema,\n} from \"./projectionPolicyEvidence\";\nimport { SyncWatermarkSchema } from \"./syncWatermark\";\n\n/**\n * The container's sealed predecessor key history. Opening it under the\n * current KEK yields every retained historical KEK in one decrypt; the\n * bridge log behind it is served only by the rebuild read path.\n */\nconst ContainerKekKeyringWireResponseSchema =\n ContainerKekKeyringWireRecordSchema;\n\nexport type ContainerKekKeyringWireResponse = z.infer<\n typeof ContainerKekKeyringWireResponseSchema\n>;\n\nconst containerKekResponseShape = {\n accessManifestHash: nonEmptyStringSchema,\n containerId: z.string(),\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n containerManifestHistory: arraySchema(AccessManifestBundleWireResponseSchema),\n keyEpoch: plainObjectSchema,\n keyEpochHash: nonEmptyStringSchema,\n keyring: ContainerKekKeyringWireResponseSchema.nullable(),\n keyTargetHash: nonEmptyStringSchema,\n parentContainerKeyEpochId: z.string().nullable(),\n recipientTargets: nonEmptyArraySchema(plainObjectSchema),\n wraps: nonEmptyArraySchema(plainObjectSchema),\n};\n\nfunction refineContainerKekKeyring(\n value: { readonly containerKeyEpoch: number; readonly keyring: unknown },\n context: z.RefinementCtx,\n) {\n if ((value.keyring === null) !== (value.containerKeyEpoch === 1)) {\n context.addIssue({\n code: \"custom\",\n message: \"container keyring must be null exactly at epoch 1\",\n path: [\"keyring\"],\n });\n }\n}\n\nconst ContainerKekResponseSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKekResponseShape).superRefine(\n refineContainerKekKeyring,\n ),\n [organizationProvisioningContainerKeyringRefinement],\n);\n\n/** On the writer-projection wire, KEK history cites manifests by hash. */\nconst ContainerKekWireResponseSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerKekResponseShape,\n containerManifestHistory: arraySchema(ManifestHashReferenceSchema),\n }).superRefine(refineContainerKekKeyring),\n [organizationProvisioningContainerKeyringRefinement],\n);\n\nexport type ContainerKekResponse = z.infer<typeof ContainerKekResponseSchema>;\n\n/** One KEK level as served in full, its manifest history cited by hash. */\nexport type ContainerKekWireLevel = z.infer<\n typeof ContainerKekWireResponseSchema\n>;\n\nexport function isContainerKekWireLevel(\n value: unknown,\n): value is ContainerKekWireLevel {\n return (\n ContainerKekWireResponseSchema.safeParse(value).success &&\n !Object.hasOwn(Object(value), \"levelDigest\")\n );\n}\n\n/**\n * A KEK level the request declared held (`k:` hint), replaced by the\n * domain-separated digest of its canonical wire bytes. It keeps the level's manifest citations, so\n * the response's bundle bookkeeping stays exact; the client refills the\n * level from those exact held bytes before anything reads it.\n */\nexport const CitedContainerKekLevelSchema = z.strictObject({\n levelDigest: sha256HexStringSchema,\n containerManifestHistory: arraySchema(ManifestHashReferenceSchema),\n});\n\nexport type CitedContainerKekLevel = z.infer<\n typeof CitedContainerKekLevelSchema\n>;\n\nexport function isCitedContainerKekLevel(\n value: unknown,\n): value is CitedContainerKekLevel {\n return CitedContainerKekLevelSchema.safeParse(value).success;\n}\n\nconst ServedContainerKekLevelSchema = z.union([\n CitedContainerKekLevelSchema,\n ContainerKekWireResponseSchema,\n]);\n\n/**\n * The append-only rotation log for one container: every epoch with its\n * write-once bridge and sealed keyring. This is the rebuild/repair read\n * path — hot reads use the projection keyring instead.\n */\nexport const ContainerKekLogEpochResponseSchema = loosePlainObject({\n accessManifestHash: nonEmptyStringSchema,\n bridge: plainObjectSchema.nullable(),\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n keyring: ContainerKekKeyringWireResponseSchema.nullable(),\n parentContainerKeyEpochId: z.string().nullable(),\n /**\n * Retained recipient envelopes are the recovery backstop when a bridge is\n * severed. The server and response guard apply this bound per epoch.\n */\n wraps: arraySchema(plainObjectSchema, CONTAINER_KEK_WRAPS_PER_EPOCH_LIMIT),\n});\n\nexport type ContainerKekLogEpochResponse = z.infer<\n typeof ContainerKekLogEpochResponseSchema\n>;\n\nexport const ContainerKekLogResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n containerId: nonEmptyStringSchema,\n epochs: arraySchema(\n ContainerKekLogEpochResponseSchema,\n CONTAINER_KEK_LOG_PAGE_LIMIT,\n ),\n /** True when epochs above this page's last remain unserved. */\n hasMore: z.boolean(),\n }).superRefine(({ epochs }, context) => {\n if (epochs.filter((epoch) => epoch.keyring !== null).length > 1) {\n context.addIssue({\n code: \"custom\",\n message: \"container KEK log pages contain at most one keyring\",\n path: [\"epochs\"],\n });\n }\n }),\n [containerKekLogSingleKeyringRefinement],\n );\n\nexport type ContainerKekLogResponse = z.infer<\n typeof ContainerKekLogResponseSchema\n>;\n\nexport function isContainerKekLogResponse(\n value: unknown,\n): value is ContainerKekLogResponse {\n return ContainerKekLogResponseSchema.safeParse(value).success;\n}\n\n/**\n * A container mutation's acknowledgement names what the server committed by\n * hash and adds only the fields it assigned (timestamps). The client compares\n * the hashes with its own signed plan and persists state built from the plan,\n * so the signed event, manifest, state, key epoch, and wraps are never echoed.\n * `bundleDigest` names the bundle a writer projection would serve for the new\n * head, so the author can hold exactly those bytes for later citation.\n */\nconst ContainerManifestMutationResponseShape = {\n bundleDigest: sha256HexStringSchema,\n containerId: z.string(),\n createdAt: z.string(),\n eventHash: nonEmptyStringSchema,\n manifestHead: loosePlainObject({\n epoch: z.number(),\n manifestHash: z.string(),\n }),\n organizationId: z.string(),\n parentId: z.string().nullable(),\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n updatedAt: z.string(),\n};\n\n/** The committed key epoch, by hash: no epoch, wrap, or keyring bytes. */\nconst ContainerMutationKekAcknowledgementSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n keyEpochHash: nonEmptyStringSchema,\n keyringHash: nonEmptyStringSchema.nullable(),\n keyTargetHash: nonEmptyStringSchema,\n parentContainerKeyEpochId: z.string().nullable(),\n }).superRefine((value, context) => {\n if ((value.keyringHash === null) !== (value.containerKeyEpoch === 1)) {\n context.addIssue({\n code: \"custom\",\n message: \"container keyring hash must be null exactly at epoch 1\",\n path: [\"keyringHash\"],\n });\n }\n }),\n [organizationProvisioningContainerKeyringRefinement],\n );\n\nexport const ContainerMutationResponseShape = {\n ...ContainerManifestMutationResponseShape,\n containerKek: ContainerMutationKekAcknowledgementSchema,\n};\n\nexport const ContainerMutationResponseSchema = loosePlainObject(\n ContainerMutationResponseShape,\n);\n\nexport type ContainerMutationResponse = z.infer<\n typeof ContainerMutationResponseSchema\n>;\n\n/** A rotation's acknowledgement, plus one per carried rekey in request order. */\nexport const ContainerRotationResponseSchema = loosePlainObject({\n ...ContainerMutationResponseShape,\n containerRekeys: arraySchema(ContainerMutationResponseSchema).optional(),\n});\n\nexport type ContainerRotationResponse = z.infer<\n typeof ContainerRotationResponseSchema\n>;\n\nexport function isContainerRotationResponse(\n value: unknown,\n): value is ContainerRotationResponse {\n return ContainerRotationResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerReciteResponseSchema = loosePlainObject(\n ContainerManifestMutationResponseShape,\n);\nexport type ContainerReciteResponse = z.infer<\n typeof ContainerReciteResponseSchema\n>;\n\nexport function isContainerReciteResponse(\n value: unknown,\n): value is ContainerReciteResponse {\n return ContainerReciteResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerDeleteResponseSchema = loosePlainObject({\n containerId: z.string(),\n deletedAt: z.string(),\n});\n\nexport type ContainerDeleteResponse = z.infer<\n typeof ContainerDeleteResponseSchema\n>;\n\nexport const CONTAINER_PROJECTION_STATE_INVALID_ERROR_CODE =\n \"container_projection_state_invalid\";\nexport const ContainerWriterProjectionErrorResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_PROJECTION_STATE_INVALID_ERROR_CODE),\n error: z.string(),\n});\n\nconst containerKeyingPathShape = {\n containerId: z.string(),\n containerKeks: arraySchema(ContainerKekResponseSchema),\n organizationId: z.string(),\n path: nonEmptyArraySchema(AccessManifestBundleWireResponseSchema),\n};\nfunction refineContainerKeyingPath(\n projection: { containerKeks: unknown[]; path: unknown[] },\n context: z.RefinementCtx,\n) {\n // loosePlainObject can continue refinements after reporting malformed fields.\n if (\n Array.isArray(projection.containerKeks) &&\n Array.isArray(projection.path) &&\n projection.containerKeks.length !== projection.path.length\n )\n context.addIssue({\n code: \"custom\",\n message: \"container KEK count must match the manifest path length\",\n path: [\"containerKeks\"],\n });\n}\nexport const ContainerKeyingPathResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKeyingPathShape).superRefine(\n refineContainerKeyingPath,\n ),\n [containerWriterProjectionPathKekCountRefinement],\n );\nexport type ContainerKeyingPathResponse = z.infer<\n typeof ContainerKeyingPathResponseSchema\n>;\n/**\n * The decoded projection a client verifies: every manifest position holds\n * its bundle. `decodeContainerWriterProjection` builds it from the wire.\n */\nexport const ContainerWriterProjectionResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerKeyingPathShape,\n policyEvidence: ProjectionPolicyEvidenceResponseSchema,\n }).superRefine(refineContainerKeyingPath),\n [containerWriterProjectionPathKekCountRefinement],\n );\n\nexport type ContainerWriterProjectionResponse = z.infer<\n typeof ContainerWriterProjectionResponseSchema\n>;\n\nconst containerKeyingPathWireShape = {\n containerId: z.string(),\n containerKeks: arraySchema(ServedContainerKekLevelSchema),\n organizationId: z.string(),\n path: nonEmptyArraySchema(ManifestHashReferenceSchema),\n};\nexport const ContainerKeyingPathWireResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKeyingPathWireShape).superRefine(\n refineContainerKeyingPath,\n ),\n [containerWriterProjectionPathKekCountRefinement],\n );\nexport type ContainerKeyingPathWireResponse = z.infer<\n typeof ContainerKeyingPathWireResponseSchema\n>;\n\n/**\n * The served shape: manifest positions cite `bundles` by hash, except hashes\n * the request declared already held, which `omittedBundles` lists instead.\n */\nexport const ContainerWriterProjectionWireResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n bundles: ManifestBundlesSchema,\n omittedBundles: OmittedManifestBundlesSchema,\n ...containerKeyingPathWireShape,\n policyEvidence: ProjectionPolicyEvidenceWireResponseSchema,\n }).superRefine((projection, context) => {\n refineContainerKeyingPath(projection, context);\n refineManifestBundleReferences(\n projection,\n containerKeyingPathReferences(projection),\n context,\n );\n }),\n [\n containerWriterProjectionPathKekCountRefinement,\n writerProjectionManifestBundlesRefinement,\n ],\n );\n\nexport type ContainerWriterProjectionWireResponse = z.infer<\n typeof ContainerWriterProjectionWireResponseSchema\n>;\n\nexport const ContainerSummaryResponseSchema = loosePlainObject({\n restorationId: sha256HexStringSchema.optional(),\n createdAt: z.string(),\n depth: nonNegativeIntegerSchema,\n effectiveAccessLevel: EffectiveAccessLevelSchema,\n id: z.string(),\n metadataAccessEpoch: z.number(),\n metadataAccessStateHash: nonEmptyStringSchema,\n metadataDocumentId: z.string(),\n metadataReferencedPrincipals: arraySchema(\n ReferencedPrincipalStateResponseSchema,\n ),\n metadataVersionVector: z.string(),\n organizationId: z.string(),\n parentId: z.string().nullable(),\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n updatedAt: z.string(),\n});\n\nexport type ContainerSummary = z.infer<typeof ContainerSummaryResponseSchema>;\n\nexport const ContainerSyncTombstoneResponseSchema = loosePlainObject({\n containerId: z.string(),\n depth: nonNegativeIntegerSchema,\n parentId: z.string().nullable(),\n reason: z.literal([\"access_revoked\", \"deleted\"]),\n updatedAt: z.string(),\n});\n\nexport type ContainerSyncTombstone = z.infer<\n typeof ContainerSyncTombstoneResponseSchema\n>;\n\nexport const ListContainersResponseSchema = loosePlainObject({\n hasMore: z.boolean(),\n items: arraySchema(ContainerSummaryResponseSchema),\n nextWatermark: SyncWatermarkSchema.nullable(),\n tombstones: arraySchema(ContainerSyncTombstoneResponseSchema),\n});\n\nexport type ListContainersResponse = z.infer<\n typeof ListContainersResponseSchema\n>;\n\nexport function isListContainersResponse(\n value: unknown,\n): value is ListContainersResponse {\n return ListContainersResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerMutationResponse(\n value: unknown,\n): value is ContainerMutationResponse {\n return ContainerMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerDeleteResponse(\n value: unknown,\n): value is ContainerDeleteResponse {\n return ContainerDeleteResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerWriterProjectionResponse(\n value: unknown,\n): value is ContainerWriterProjectionResponse {\n return ContainerWriterProjectionResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerWriterProjectionWireResponse(\n value: unknown,\n): value is ContainerWriterProjectionWireResponse {\n return ContainerWriterProjectionWireResponseSchema.safeParse(value).success;\n}\n"]}
|
|
@@ -24,6 +24,7 @@ export declare const ListContainerParentLanesResponseSchema: z.ZodObject<{
|
|
|
24
24
|
organizationId: string;
|
|
25
25
|
parentId: string | null;
|
|
26
26
|
updatedAt: string;
|
|
27
|
+
restorationId?: string | undefined;
|
|
27
28
|
systemSlot?: string | null | undefined;
|
|
28
29
|
}[];
|
|
29
30
|
nextWatermark: {
|
|
@@ -62,6 +63,7 @@ export declare const ListContainerParentLanesResponseSchema: z.ZodObject<{
|
|
|
62
63
|
organizationId: string;
|
|
63
64
|
parentId: string | null;
|
|
64
65
|
updatedAt: string;
|
|
66
|
+
restorationId?: string | undefined;
|
|
65
67
|
systemSlot?: string | null | undefined;
|
|
66
68
|
}[];
|
|
67
69
|
nextWatermark: {
|
package/package.json
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { DomainScope } from "../../data/shared/domainScope.js";
|
|
2
2
|
import { type ContainerContentsPersistence } from "../../workflows/container-contents/containerPersistence.js";
|
|
3
|
-
import { type ContainerContentsStoreRuntime, createContainerContentsStoreSyncAgent } from "./syncAgent/index.js";
|
|
3
|
+
import { type ContainerContentsStoreRuntime, type createContainerContentsStoreSyncAgent } from "./syncAgent/index.js";
|
|
4
4
|
import type { ContainerContentsStore, ContainerContentsStoreOptions, ContainerContentsStoreState } from "./types.js";
|
|
5
5
|
type ContainerWriteMethods = Pick<ContainerContentsStore, "createChild" | "deleteContainer" | "emptyTrash" | "ensureSystemContainer" | "moveContainer" | "prepareGroupRewrap" | "purgeContainer" | "renameContainer" | "setContainerIcon" | "setContainerPrimaryDocument" | "shareWithGroup" | "shareWithUser">;
|
|
6
6
|
export declare function createContainerWriteMethods(state: ContainerContentsStoreState, syncAgent: ReturnType<typeof createContainerContentsStoreSyncAgent>): ContainerWriteMethods;
|
|
7
7
|
export declare function createContainerContentsStore(initialRuntime: ContainerContentsStoreRuntime, persistence?: ContainerContentsPersistence, options?: ContainerContentsStoreOptions): ContainerContentsStore;
|
|
8
8
|
export declare function getOrCreateContainerContentsStore(domainScope: DomainScope, runtime: ContainerContentsStoreRuntime, options?: ContainerContentsStoreOptions): ContainerContentsStore;
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* Priming normally re-arms only on store creation and topology changes, so a
|
|
12
|
-
* caller that just tore down a document's local state uses this to have the
|
|
13
|
-
* still-listed server document re-created without waiting for an app
|
|
14
|
-
* restart. Returns false when the scope has no container-contents store yet;
|
|
15
|
-
* the startup priming pass covers that case.
|
|
16
|
-
*/
|
|
9
|
+
/** Re-arm priming after a local deletion so the next pass re-creates still-listed documents.
|
|
10
|
+
* A new store already primes its documents on startup. */
|
|
17
11
|
export declare function requestContainerContentsDocumentPriming(domainScope: DomainScope): boolean;
|
|
18
12
|
export {};
|