@tearleads/client-sdk 0.1.253 → 0.1.255

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.
Files changed (108) hide show
  1. package/client/containerContents/documentDiscovery.js +0 -2
  2. package/client/containerContents/documentDiscovery.js.map +1 -1
  3. package/data/persistence/container-contents/containerContentsPersistenceTypes.d.ts +7 -10
  4. package/data/persistence/container-contents/containerContentsPersistenceTypes.js.map +1 -1
  5. package/data/persistence/container-contents/containerDeletionPersistence.js +5 -1
  6. package/data/persistence/container-contents/containerDeletionPersistence.js.map +1 -1
  7. package/data/persistence/container-contents/containerHydrationPersistence.js +1 -1
  8. package/data/persistence/container-contents/containerHydrationPersistence.js.map +1 -1
  9. package/data/persistence/container-contents/containerMetadataMutationPersistence.js +11 -4
  10. package/data/persistence/container-contents/containerMetadataMutationPersistence.js.map +1 -1
  11. package/data/persistence/container-contents/containerRemovalMetadata.js +47 -0
  12. package/data/persistence/container-contents/containerRemovalMetadata.js.map +1 -0
  13. package/data/persistence/container-contents/containerRemovalPlacements.js +22 -0
  14. package/data/persistence/container-contents/containerRemovalPlacements.js.map +1 -0
  15. package/data/persistence/container-contents/containerSyncWatermarkPersistence.d.ts +2 -1
  16. package/data/persistence/container-contents/containerSyncWatermarkPersistence.js +10 -2
  17. package/data/persistence/container-contents/containerSyncWatermarkPersistence.js.map +1 -1
  18. package/data/persistence/documents/documentDiscoveryCandidate.d.ts +1 -0
  19. package/data/persistence/documents/documentDiscoveryCandidate.js +3 -1
  20. package/data/persistence/documents/documentDiscoveryCandidate.js.map +1 -1
  21. package/data/persistence/documents/documentDiscoveryEvidencePersistence.d.ts +1 -1
  22. package/data/persistence/documents/documentDiscoveryEvidencePersistence.js +16 -4
  23. package/data/persistence/documents/documentDiscoveryEvidencePersistence.js.map +1 -1
  24. package/data/sqlite/migrations/localSchemaMigrations.js +11 -0
  25. package/data/sqlite/migrations/localSchemaMigrations.js.map +1 -1
  26. package/data/sqlite/schema/containerSyncWatermarkSchema.js +6 -3
  27. package/data/sqlite/schema/containerSyncWatermarkSchema.js.map +1 -1
  28. package/data/sqlite/schema/index.d.ts +17 -0
  29. package/index.d.ts +1 -1
  30. package/index.js +1 -1
  31. package/index.js.map +1 -1
  32. package/internal/api-client/ApiClient.d.ts +1 -0
  33. package/internal/api-client/client/apiClientContext.d.ts +1 -0
  34. package/internal/api-client/client/containerReads.d.ts +1 -0
  35. package/internal/api-client/requestInternals.js +14 -6
  36. package/internal/api-client/requestInternals.js.map +1 -1
  37. package/internal/validators/containerSystemSlot.d.ts +6 -0
  38. package/internal/validators/containerSystemSlot.js +14 -6
  39. package/internal/validators/containerSystemSlot.js.map +1 -1
  40. package/internal/validators/operation/containerReads.d.ts +29 -2
  41. package/internal/validators/operation/containerReads.js +2 -1
  42. package/internal/validators/operation/containerReads.js.map +1 -1
  43. package/internal/validators/request/containerDocumentLanes.d.ts +7 -0
  44. package/internal/validators/request/containerDocumentLanes.js +6 -0
  45. package/internal/validators/request/containerDocumentLanes.js.map +1 -1
  46. package/internal/validators/response/container.d.ts +8 -0
  47. package/internal/validators/response/container.js +1 -0
  48. package/internal/validators/response/container.js.map +1 -1
  49. package/internal/validators/response/containerParentLanes.d.ts +2 -0
  50. package/package.json +1 -1
  51. package/stores/container-contents/operations/index.js +4 -0
  52. package/stores/container-contents/operations/index.js.map +1 -1
  53. package/workflows/container-contents/container-state/create/createChild.d.ts +30 -0
  54. package/workflows/container-contents/container-state/move/moveIntentSync.js +1 -0
  55. package/workflows/container-contents/container-state/move/moveIntentSync.js.map +1 -1
  56. package/workflows/container-contents/container-state/remote.js +1 -1
  57. package/workflows/container-contents/container-state/remote.js.map +1 -1
  58. package/workflows/container-contents/container-state/types.d.ts +141 -0
  59. package/workflows/container-contents/documentDiscovery/containerDocumentListing.js +52 -4
  60. package/workflows/container-contents/documentDiscovery/containerDocumentListing.js.map +1 -1
  61. package/workflows/container-contents/documentDiscovery/documentDiscoveryApply.js +4 -2
  62. package/workflows/container-contents/documentDiscovery/documentDiscoveryApply.js.map +1 -1
  63. package/workflows/container-contents/documentDiscovery/documentDiscoveryEvidence.js +17 -12
  64. package/workflows/container-contents/documentDiscovery/documentDiscoveryEvidence.js.map +1 -1
  65. package/workflows/container-contents/documentDiscovery/documentDiscoveryTypes.js.map +1 -1
  66. package/workflows/container-contents/documentDiscovery/publicationWatermark.js +15 -0
  67. package/workflows/container-contents/documentDiscovery/publicationWatermark.js.map +1 -0
  68. package/workflows/container-contents/index.d.ts +1 -0
  69. package/workflows/container-contents/index.js +1 -0
  70. package/workflows/container-contents/index.js.map +1 -1
  71. package/workflows/container-contents/remoteHydration/destination/destinationSystemTopology.js +16 -0
  72. package/workflows/container-contents/remoteHydration/destination/destinationSystemTopology.js.map +1 -0
  73. package/workflows/container-contents/remoteHydration/destination/verifiedDestination.js +8 -9
  74. package/workflows/container-contents/remoteHydration/destination/verifiedDestination.js.map +1 -1
  75. package/workflows/container-contents/remoteHydration/hydrateRemoteContainers.js +4 -4
  76. package/workflows/container-contents/remoteHydration/hydrateRemoteContainers.js.map +1 -1
  77. package/workflows/container-contents/remoteHydration/lanes/restorationReceipt.js +25 -0
  78. package/workflows/container-contents/remoteHydration/lanes/restorationReceipt.js.map +1 -0
  79. package/workflows/container-contents/remoteHydration/lanes/tombstoneAccess.js +107 -0
  80. package/workflows/container-contents/remoteHydration/lanes/tombstoneAccess.js.map +1 -0
  81. package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js +29 -27
  82. package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js.map +1 -1
  83. package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js +17 -5
  84. package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js.map +1 -1
  85. package/workflows/container-contents/remoteHydration/tombstoneApplication.js +67 -24
  86. package/workflows/container-contents/remoteHydration/tombstoneApplication.js.map +1 -1
  87. package/workflows/container-contents/remoteHydration/types.d.ts +3 -1
  88. package/workflows/container-contents/remoteHydration/types.js.map +1 -1
  89. package/workflows/container-contents/remoteReset/remoteResetCursorScope.js +3 -3
  90. package/workflows/container-contents/remoteReset/remoteResetCursorScope.js.map +1 -1
  91. package/workflows/container-contents/syncPause/discoveryGuard.js +6 -2
  92. package/workflows/container-contents/syncPause/discoveryGuard.js.map +1 -1
  93. package/workflows/container-contents/tombstones/documentTombstoneGate.js +6 -3
  94. package/workflows/container-contents/tombstones/documentTombstoneGate.js.map +1 -1
  95. package/workflows/registration/bootstrapRootContainer.d.ts +1 -0
  96. package/workflows/registration/bootstrapRootContainer.js +9 -0
  97. package/workflows/registration/bootstrapRootContainer.js.map +1 -1
  98. package/workflows/registration/index.d.ts +1 -1
  99. package/workflows/registration/index.js +1 -1
  100. package/workflows/registration/index.js.map +1 -1
  101. package/workflows/registration/organizationProvisioning.d.ts +3 -2
  102. package/workflows/registration/organizationProvisioning.js +1 -2
  103. package/workflows/registration/organizationProvisioning.js.map +1 -1
  104. package/workflows/registration/provisioningBootstrapBuilders.d.ts +3 -5
  105. package/workflows/registration/provisioningBootstrapBuilders.js +11 -5
  106. package/workflows/registration/provisioningBootstrapBuilders.js.map +1 -1
  107. package/workflows/registration/registerIdentity.js +2 -0
  108. package/workflows/registration/registerIdentity.js.map +1 -1
@@ -2870,6 +2870,23 @@ export declare const clientSQLiteSchema: {
2870
2870
  }, {}, {
2871
2871
  length: number | undefined;
2872
2872
  }>;
2873
+ cursorFormat: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2874
+ name: "cursor_format";
2875
+ tableName: "container_sync_watermarks";
2876
+ dataType: "number";
2877
+ columnType: "SQLiteInteger";
2878
+ data: number;
2879
+ driverParam: number;
2880
+ notNull: true;
2881
+ hasDefault: true;
2882
+ isPrimaryKey: false;
2883
+ isAutoincrement: false;
2884
+ hasRuntimeDefault: false;
2885
+ enumValues: undefined;
2886
+ baseColumn: never;
2887
+ identity: undefined;
2888
+ generated: undefined;
2889
+ }, {}, {}>;
2873
2890
  updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2874
2891
  name: "updated_at";
2875
2892
  tableName: "container_sync_watermarks";
package/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export { abandonJournaledPrincipalMutation, addOrganizationGroupUser, buildIniti
24
24
  export type { AcknowledgedPrincipalPredecessor, CacheReferencedPrincipalPoliciesOptions, PrincipalHistoryProtectionLease, PrincipalPolicyService, ProjectionPolicyHistoryRecoveryOptions, RecoveredPrincipalPolicyHistory, RecoveredScopedPrincipalPolicyHistory, RecoverPrincipalPolicyHistoryOptions, RecoverScopedPrincipalPolicyHistoryOptions, } from "./workflows/principals/index.js";
25
25
  export { cacheReferencedPrincipalPolicies, captureAcknowledgedPrincipalPredecessor, PrincipalPolicyHistoryReadError, recoverPrincipalPolicyHistory, recoverProjectionPolicyHistory, recoverScopedPrincipalPolicyHistory, } from "./workflows/principals/index.js";
26
26
  export type { InitialRootMetadataBootstrap, ProvisionedSystemContainerSpec, RegisterIdentityInput, RegistrationApi, } from "./workflows/registration/index.js";
27
- export { bootstrapRootContainer, buildInitialOrganizationPolicyRequest, createInitialRootMetadataBootstrap, persistRegistrationBootstrap, registerIdentity, } from "./workflows/registration/index.js";
27
+ export { bootstrapRootContainer, buildInitialOrganizationPolicyRequest, createInitialRootMetadataBootstrap, deriveRegistrationOrganizationId, persistRegistrationBootstrap, registerIdentity, } from "./workflows/registration/index.js";
28
28
  export type { PendingBlobDeletion, PendingBlobDeletionsPage, PendingBlobDeletionsQueryInput, RootIdentitiesApi, RootIdentitiesPage, RootIdentitiesQueryInput, RootIdentity, RootIdentityDetail, RootIdentityOrganization, RootIdentitySession, RootPendingBlobDeletionsQueryInput, RootRequestOutcome, } from "./workflows/root/index.js";
29
29
  export { liftRootIdentitySuspension, listRootAuditEvents, listRootDataUsageReport, listRootIdentities, listRootIdentityOrganizations, listRootOrganizationIdentities, listRootOrganizationRevenuecatEvents, listRootOrganizations, listRootRevenuecatEventsReport, loadRootIdentity, loadRootOpsHealthReport, loadRootOrganization, loadRootOrganizationDataUsage, type RootAuditApi, type RootAuditEvent, type RootAuditEventsPage, type RootAuditEventsQueryInput, type RootDataUsageApi, type RootDataUsageReportPage, type RootOpsHealthApi, type RootOpsHealthReport, type RootOrganization, type RootOrganizationDetail, type RootOrganizationIdentitiesPage, type RootOrganizationIdentity, type RootOrganizationPageQueryInput, type RootOrganizationRevenuecatEvent, type RootOrganizationRevenuecatEventsPage, type RootOrganizationsApi, type RootOrganizationsPage, type RootOrganizationsQueryInput, type RootRevenuecatApi, type RootRevenuecatEvent, type RootRevenuecatEventsQueryInput, type RootRevenuecatEventsReportPage, type RootRevenuecatEventsReportQueryInput, type RootSuspensionApi, suspendRootIdentity, } from "./workflows/root/index.js";
30
30
  export type { ClearRemoteSyncStateResult, DomainSyncCoordinator, DomainSyncSnapshot, RemoteResetInput, RemoteResetReplacement, SyncIdleOptions, SyncLane, SyncLaneConfig, SyncLaneLastAction, SyncLanePhase, SyncLaneSnapshot, SyncLaneStatus, } from "./workflows/sync/index.js";
package/index.js CHANGED
@@ -13,7 +13,7 @@ export { buildMaterializedContainerRekeyPlan, buildRootContainerCreatePlan, Cont
13
13
  export { buildMaterializedDocumentCreatePlan, createDocumentProjectionUserKeyResolver, DOCUMENT_SYNC_TRACE_FRAGMENT, DOCUMENT_SYNC_TRACE_PATTERN, DOCUMENTS_APP_KIND, DocumentRawHistoryUnavailableError, defaultDocumentsPersistence, deletePersistedDocument, deriveStableDocumentId, isDatabaseUnavailableError, isDocumentSyncUpdateIsolationError, isEmptyDocumentHistoryChange, persistedDocumentCreateStateFromResponse, RemoteDocumentService, readPullContinuation, unwrapContainerKekPath, unwrapDocumentContentKeyTarget, validateDocumentSyncUpdateImports, } from "./workflows/documents/index.js";
14
14
  export { abandonJournaledPrincipalMutation, addOrganizationGroupUser, buildInitialGroupPolicyRequest, buildInitialMemberGroupPolicyRequest, buildOrganizationGroupPolicyHistory, buildOrganizationProfileDocumentPatch, buildRosterProfileDocumentPatch, checkNativePurchaseEligibility, createInitializedRosterProfileDocument, createOrganizationGroup, DEFAULT_PERSONAL_ORGANIZATION_PROFILE_NAME, deriveOrganizationMetadataContainerSystemSlot, deriveOrganizationRosterProfileContainerSystemSlot, discardUnreadableJournaledPrincipalMutation, GroupMembershipNameMismatchError, GroupShareNameMismatchError, getOrganizationProfileDocumentLocalId, getRosterProfileDocumentLocalId, loadLocalOrganizationDataUsage, loadLocalOrganizationDirectoryAndGroups, loadOrganizationBilling, loadOrganizationBillingHistory, loadOrganizationBillingManagementUrl, ORGANIZATION_DOCUMENT_USAGE_CATEGORIES, ORGANIZATION_METADATA_CONTAINER_NAME, ORGANIZATION_PROFILE_DOCUMENT_KIND, ORGANIZATION_ROSTER_PROFILE_CONTAINER_NAME, PendingPrincipalMutationError, PrincipalMutationOutcomeUnknownError, ROSTER_PROFILE_DOCUMENT_KIND, readJournaledPrincipalMutation, readOrganizationProfileName, reconcileOrganizationDataUsage, reconcileOrganizationDirectoryAndGroups, recoverJournaledPrincipalMutation, removeOrganizationGroupUser, resolveOrganizationBillingView, retainAcknowledgedPrincipalCurrents, revokeOrganizationContainerGrant, shareRemoteContainerWithGroup, startOrganizationTrial, submitJournaledPrincipalMutation, subscribeOrganizationReadModelInvalidation, UnreadablePrincipalMutationError, updateOrganizationProfile, updateOrganizationRosterEntry, } from "./workflows/organizations/index.js";
15
15
  export { cacheReferencedPrincipalPolicies, captureAcknowledgedPrincipalPredecessor, PrincipalPolicyHistoryReadError, recoverPrincipalPolicyHistory, recoverProjectionPolicyHistory, recoverScopedPrincipalPolicyHistory, } from "./workflows/principals/index.js";
16
- export { bootstrapRootContainer, buildInitialOrganizationPolicyRequest, createInitialRootMetadataBootstrap, persistRegistrationBootstrap, registerIdentity, } from "./workflows/registration/index.js";
16
+ export { bootstrapRootContainer, buildInitialOrganizationPolicyRequest, createInitialRootMetadataBootstrap, deriveRegistrationOrganizationId, persistRegistrationBootstrap, registerIdentity, } from "./workflows/registration/index.js";
17
17
  export { liftRootIdentitySuspension, listRootAuditEvents, listRootDataUsageReport, listRootIdentities, listRootIdentityOrganizations, listRootOrganizationIdentities, listRootOrganizationRevenuecatEvents, listRootOrganizations, listRootRevenuecatEventsReport, loadRootIdentity, loadRootOpsHealthReport, loadRootOrganization, loadRootOrganizationDataUsage, suspendRootIdentity, } from "./workflows/root/index.js";
18
18
  export { clearRemoteSyncState, getDomainSyncCoordinatorSnapshot, getOrCreateDomainSyncCoordinator, hasDomainSyncCoordinatorPendingWork, requestAllDomainSyncLanes, subscribeToDomainSyncCoordinator, waitForDomainSyncCoordinatorToSettle, } from "./workflows/sync/index.js";
19
19
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,yEAAyE;AACzE,gEAAgE;AAChE,OAAO,EAGL,iBAAiB,GAElB,MAAM,uBAAuB,CAAC;AAiL/B,OAAO,EAEL,KAAK,EACL,yBAAyB,EACzB,sCAAsC,EACtC,gCAAgC,EAChC,2CAA2C,EAC3C,sCAAsC,EACtC,sCAAsC,EACtC,8BAA8B,EAC9B,iBAAiB,EACjB,wCAAwC,EACxC,kCAAkC,EAClC,kBAAkB,EAClB,2CAA2C,EAC3C,qCAAqC,EACrC,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EAChC,yBAAyB,EACzB,+BAA+B,EAC/B,0BAA0B,EAC1B,yBAAyB,EACzB,QAAQ,EACR,mBAAmB,EAKnB,8BAA8B,EAC9B,2BAA2B,EAC3B,MAAM,EAGN,2BAA2B,EAC3B,8BAA8B,EAC9B,2BAA2B,EAC3B,mCAAmC,EACnC,6BAA6B,EAC7B,oBAAoB,EACpB,OAAO,EACP,0BAA0B,EAG1B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAE5B,yBAAyB,EACzB,8CAA8C,EAC9C,yBAAyB,EAKzB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,8BAA8B,EAC9B,mCAAmC,EACnC,gCAAgC,EAChC,6BAA6B,EAC7B,sBAAsB,EACtB,gCAAgC,EAChC,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AAYnC,OAAO,EACL,gCAAgC,EAChC,uCAAuC,EACvC,+BAA+B,EAC/B,6BAA6B,EAC7B,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EACL,sBAAsB,EACtB,qCAAqC,EACrC,kCAAkC,EAClC,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAelC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,8BAA8B,EAC9B,oCAAoC,EACpC,qBAAqB,EACrB,8BAA8B,EAC9B,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,6BAA6B,EAyB7B,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAe1B,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,gCAAgC,EAChC,mCAAmC,EACnC,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,GACrC,MAAM,kBAAkB,CAAC","sourcesContent":["// SDK: full-bundle identity trust and bounded Members admission.\n// Exact-head authority; canonical writer domains; restart-safe journals.\n// No pin promotion or legacy adapters. See workflows/README.md.\nexport {\n type ApiRequestCounts,\n type ApiRequestEndpointCounts,\n ApiRequestMetrics,\n type ApiRequestMetricsSnapshot,\n} from \"@tearleads/api-client\";\nexport type {\n AbandonOrganizationPolicyMutationInput,\n AddOrganizationGroupUserInput,\n BlobInfo,\n BlobInfoAttachmentKind,\n BlobInfoDocumentReference,\n BlobInfoInput,\n BlobInfoList,\n BlobInfoSort,\n BlobInfoSortDirection,\n BlobInfoSortKey,\n BrowserLocalKeyringOptions,\n ContainerContents,\n ContainerContentsContextValue,\n ContainerContentsStore,\n ContainerContentsStoreOptions,\n ContainerDocumentLinkInput,\n ContainerDocumentLinks,\n ContainerDocumentObjectSyncState,\n ContainerDocumentObjectSyncStatus,\n ContainerDocumentQueries,\n ContainerDocumentSidebarRow,\n ContainerInfo,\n ContainerInfoInput,\n ContainerItemRow,\n ContainerItemSort,\n ContainerItemSortDirection,\n ContainerItemSortKey,\n ContainerNode,\n ContainerShareAccessLevel,\n CreateOrganizationOptions,\n DatabaseListener,\n DatabaseOptions,\n DatabaseSnapshot,\n DatabaseStatus,\n DeviceFirst,\n DeviceFirstContainerContents,\n DiscardUnreadableOrganizationPolicyMutationInput,\n DocumentAttachmentStatus,\n DocumentAttachmentUpload,\n DocumentAttributionRangesInput,\n DocumentAttributionRangesPage,\n DocumentContextValue,\n DocumentHistory,\n DocumentHistoryChange,\n DocumentHistoryRowChange,\n DocumentHistoryStop,\n DocumentHistoryTextChange,\n DocumentHistoryVersion,\n DocumentHistoryVersionEntry,\n DocumentHistoryView,\n DocumentInfo,\n DocumentInfoInput,\n DocumentList,\n DocumentSort,\n DocumentSortDirection,\n DocumentSortKey,\n DocumentStore,\n DocumentSubscriptionOptions,\n Documents,\n DocumentsRuntime,\n DocumentsWorkflowRuntimeInput,\n DomainScope,\n FileSaver,\n Identity,\n IdentityGenerationResult,\n IdentityKeyPackage,\n IdentityListener,\n IdentityOptions,\n IdentitySnapshot,\n IndexedDbLocalKeyringManifestStoreOptions,\n IndexedDbWrappingKeyKeystoreOptions,\n LinkDocumentToContainerInput,\n ListDocumentsInput,\n LocalKeyPurpose,\n LocalKeyring,\n LocalKeyringManifest,\n LocalKeyringManifestFormat,\n LocalKeyringManifestStorage,\n LocalKeyringManifestStore,\n LocalKeyringOptions,\n LocalKeyringPinCode,\n LocalKeyringScope,\n LocalKeyringSession,\n LocalOrganizationSummary,\n LocalProjectionReconciledDelta,\n LocalProjectionSnapshot,\n LocalProjectionView,\n LocalSecretContext,\n LocalStorageLocalKeyringManifestStoreOptions,\n Logger,\n MergeDocumentSummary,\n MoveDocumentToContainerInput,\n NetworkListener,\n NetworkMode,\n NetworkStatusSource,\n NormalizedLocalKeyringScope,\n OpenContainerDocumentInput,\n OpenDocumentInput,\n OpenDocumentOptions,\n OrganizationBilling,\n OrganizationBillingHistory,\n OrganizationBillingHistoryEntry,\n OrganizationBillingManagementUrl,\n OrganizationBillingView,\n OrganizationContainerGrant,\n OrganizationContainerGrants,\n OrganizationDataUsage,\n OrganizationDeviceDataUsage,\n OrganizationDeviceDocumentUsageCategoryBreakdown,\n OrganizationDirectory,\n OrganizationDirectoryAndGroups,\n OrganizationDirectoryUser,\n OrganizationGrantRef,\n OrganizationGroupContainer,\n OrganizationGroupContainers,\n OrganizationGroupDetails,\n OrganizationGroupMember,\n OrganizationGroupMembers,\n OrganizationGroupMutationReceipt,\n OrganizationGroupMutationResult,\n OrganizationGroupPolicyHistory,\n OrganizationGroupSummary,\n OrganizationLeaveRequestResult,\n OrganizationMembership,\n OrganizationMemberships,\n OrganizationPolicyGrantChange,\n OrganizationPolicyGroupChange,\n /** Verified organization display page with an optional older-page cursor. */\n OrganizationPolicyHistory,\n OrganizationPolicyHistoryEntry,\n OrganizationProfile,\n OrganizationSyncPauseResult,\n Organizations,\n OrganizationUserDetail,\n PendingWriteQueueItem,\n PendingWriteQueueItemStatus,\n PendingWriteQueueObjectKind,\n PendingWriteQueueOperation,\n PendingWriteQueueOperationKind,\n PendingWriteQueueOperationStatus,\n // Persistence notifications distinguish placement changes from content saves.\n PersistedDocumentListener,\n PinCodeBrowserLocalKeyringOptions,\n PinCodeWrappingKeyKeystoreOptions,\n PurgeDocumentInput,\n PurgeDocumentResult,\n ReconciliationService,\n RemoveOrganizationGroupUserInput,\n ResolvedUserIdentity,\n SaveFileRequest,\n SecurityIncident,\n SecurityIncidentListener,\n SecurityIncidentObjectKind,\n SecurityIncidents,\n Session,\n SessionContext,\n SessionCreateOrganizationResult,\n SessionListener,\n SessionRecoverOrganizationResult,\n SessionRegistrationRefusal,\n SessionRegistrationResult,\n SessionSnapshot,\n SetActiveDocumentContainerInput,\n SetLinkedContainerIdsForDocument,\n UnlinkDocumentFromContainerInput,\n UnwrapLocalSecretInput,\n UserIdentities,\n UserSession,\n WrapLocalSecretInput,\n WrappedLocalSecretEnvelope,\n WrappedLocalSecretFormat,\n WrappingKeyHandle,\n WrappingKeyKeystore,\n WrappingKeyMaterialStorage,\n} from \"./client\";\nexport {\n type BlobStoreFactory,\n Blobs,\n createBrowserLocalKeyring,\n createBrowserLocalKeyringManifestStore,\n createBrowserNetworkStatusSource,\n createContainerContentsStoreWorkflowRuntime,\n createContainerContentsWorkflowRuntime,\n createContainerDocumentObjectSyncState,\n createDocumentsWorkflowRuntime,\n createDomainScope,\n createIndexedDbLocalKeyringManifestStore,\n createIndexedDbWrappingKeyKeystore,\n createLocalKeyring,\n createLocalStorageLocalKeyringManifestStore,\n createMemoryLocalKeyringManifestStore,\n createMemoryWrappingKeyKeystore,\n createPinCodeBrowserLocalKeyring,\n createPinCodeWrappingKeyKeystore,\n createRevenueCatPurchases,\n createUnavailableDirectCheckout,\n createUnavailablePurchases,\n createWebViewLocalKeyring,\n Database,\n DEFAULT_DOCUMENT_ID,\n type DirectCheckoutAppearance,\n type DirectCheckoutCapability,\n type DirectCheckoutConfirmation,\n type DirectCheckoutSession,\n DirectCheckoutUnavailableError,\n decodeLocalKeyringSqliteKey,\n Events,\n type EventsListener,\n type EventsSnapshot,\n encodeLocalKeyringSqliteKey,\n enqueueReconciliationForEvents,\n IDENTITY_KEY_PACKAGE_FORMAT,\n isPinCodeWrappedLocalSecretEnvelope,\n LOCAL_KEYRING_MANIFEST_FORMAT,\n localKeyringScopeKey,\n Network,\n normalizeLocalKeyringScope,\n type PrincipalHistoryKeyProvider,\n type PrincipalHistoryKeyScope,\n PurchaseAbortedError,\n PurchaseAlreadyOwnedError,\n PurchaseCancelledError,\n PurchaseIdentityPendingError,\n PurchaseProviderStalledError,\n type PurchasesCapability,\n PurchasesUnavailableError,\n PurgedOrganizationRecoveryBillingRequiredError,\n parseLocalKeyringManifest,\n type RevenueCatBackend,\n type RevenueCatCustomerInfo,\n type RevenueCatPackage,\n type RevenueCatPurchasesConfig,\n SyncBillingGate,\n type SyncBillingGateListener,\n type SyncPurchaseResult,\n type SyncSubscriptionOption,\n serializeLocalKeyringManifest,\n UnverifiedUserIdentityError,\n WRAPPED_LOCAL_SECRET_FORMAT,\n} from \"./client\";\nexport type {\n DiscoveredDocumentInput,\n DocumentAttachment,\n DocumentClientProjectionDefinition,\n DocumentClientProjectionDeleteInput,\n DocumentClientProjectionSaveInput,\n DocumentFieldValidationIssue,\n DocumentProjection,\n DocumentProjectorDefinition,\n DocumentProjectorInput,\n DocumentProjectorRegistry,\n DocumentProjectorRegistryInput,\n DocumentRestoreContent,\n DocumentRow,\n DocumentRowSummary,\n DocumentSummary,\n EnvFileVariable,\n StoredDocumentKind,\n StoredDocumentState,\n StructuredDocumentMap,\n StructuredDocumentShape,\n StructuredDocumentText,\n ValidatedDocumentFields,\n} from \"./data/documents\";\nexport {\n addDocumentAttachments,\n createDocumentProjectorRegistry,\n createDocumentSignerDeviceId,\n DEFAULT_DOCUMENT_ACCESS_EPOCH,\n DEFAULT_DOCUMENT_KIND,\n defaultDocumentProjectorRegistry,\n deriveStoredDocumentTitle,\n ENV_FILE_DOCUMENT_KIND,\n ENV_FILE_NAME_FIELD,\n ENV_FILE_VARIABLE_KEY_FIELD,\n ENV_FILE_VARIABLE_NAME_PATTERN,\n ENV_FILE_VARIABLE_VALUE_FIELD,\n ensureDocumentAttachmentStructure,\n getDocumentAttachments,\n getDocumentClientProjectionTables,\n getStoredDocumentTypeLabel,\n getUntitledDocumentTitle,\n initializeStoredDocumentKind,\n isValidEnvFileVariableName,\n parseEnvFileText,\n projectStoredDocumentState,\n readStoredDocumentState,\n readStringDocumentField,\n resolveOpIdAttribution,\n sameDocumentAttachments,\n summarizeDocumentContributors,\n writerByPeerId,\n writeStoredDocumentFields,\n} from \"./data/documents\";\nexport type {\n ContainerContentsSnapshot,\n ContainerContentsStoreRuntime,\n ContainerContentsStoreState,\n ContainerContentsStoreSyncAgent,\n ContainerContentsStoreSyncState,\n ContainerState,\n PurgeMoveSettlement,\n PurgeOptions,\n PurgeProgress,\n} from \"./stores/container-contents\";\nexport {\n createContainerContentsStore,\n createContainerContentsStoreState,\n createContainerContentsStoreSyncAgent,\n getOrCreateContainerContentsStore,\n isSystemContainerNode,\n requestContainerContentsDocumentPriming,\n subscribeToContainerContentsStore,\n updateContainerContentsSnapshot,\n updateContainerContentsStoreRuntime,\n} from \"./stores/container-contents\";\nexport type {\n DocumentMutationGuard,\n DocumentMutationOptions,\n DocumentSnapshot,\n DocumentStoreFacade,\n DocumentStoreOpenOptions,\n DocumentStoreRelinkInput,\n DocumentStructuredFieldPatch,\n} from \"./stores/documents\";\nexport {\n createDocumentStore,\n discardRegisteredDocumentLocalState,\n getOrCreateDocumentStore,\n hasPendingLocalDocumentWrites,\n openDocumentStore,\n requestDomainDocumentSync,\n subscribeToPersistedDocuments,\n} from \"./stores/documents\";\nexport { Tearleads } from \"./Tearleads\";\nexport type {\n TearleadsDatabaseOptions,\n TearleadsOptions,\n} from \"./TearleadsOptions\";\nexport type {\n BlobAttachmentCollaborators,\n BlobAttachmentServiceApi,\n BlobByteSource,\n BlobByteSourceInput,\n BlobBytes,\n BlobStore,\n DecryptDocumentAttachmentBlobRequest,\n DetachDocumentAttachmentRequest,\n DetachDocumentAttachmentResult,\n EncryptedBlobStoreCipher,\n EncryptedBlobStoreKey,\n EncryptedBlobStoreOptions,\n HydrateDocumentAttachmentBlobsRequest,\n HydratedDocumentAttachmentBlob,\n UploadDocumentAttachmentRequest,\n UploadDocumentAttachmentResult,\n WrapEncryptedBlobStoreOptions,\n} from \"./workflows/blobs\";\nexport {\n BlobAttachmentService,\n blobByteSourceInputLength,\n createBlobByteSource,\n createBlobStore,\n createEncryptedBlobStore,\n createLazyEncryptedBlobStore,\n createMemoryBlobStore,\n purgeOpfsBlobStore,\n readBlobByteSource,\n wrapEncryptedBlobStore,\n} from \"./workflows/blobs\";\nexport type {\n ContainerContentsRootAdopter,\n ContainerContentsRootAdoptionInput,\n ContainerContentsStoreWorkflowRuntime,\n ContainerContentsWorkflowRuntime,\n // Distinct from the canonical `ContainerDocumentLinkInput` (./client); the\n // documentQueries variant has a different shape, so it keeps a disambiguating\n // alias on the public surface.\n ContainerDocumentLinkInput as ContainerDocumentQueriesLinkInput,\n ContainerSystemSlotDefinition,\n PendingDownloadQueueItem,\n RecoveryFolder,\n} from \"./workflows/container-contents\";\nexport {\n ContainerSyncWatermarkRepository,\n createContainerContentsDocumentsRuntime,\n createContainerContentsProjectionUserKeyResolver,\n createContainerContentsSyncLane,\n createContainerParentSyncLane,\n createInitializedContainerMetadataDocument,\n DocumentContainerProjectionRepository,\n defaultContainerContentsPersistence,\n deriveContainerSystemSlot,\n listBlobInfo,\n loadContainerInfo,\n loadDocumentAttributionRanges,\n loadDocumentInfo,\n syncedContainerDocumentObjectSyncState,\n} from \"./workflows/container-contents\";\nexport type {\n AggregatedContainerKekLog,\n ContainerMutationAuthor,\n ContainerMutationCollaborators,\n ContainerReciteApi,\n ContainerWriteRefusal,\n KeyringRebuildResult,\n MaterializedContainerRekeyPlan,\n} from \"./workflows/containers\";\nexport {\n buildMaterializedContainerRekeyPlan,\n buildRootContainerCreatePlan,\n ContainerAuthorAccessError,\n ContainerKekRepairInaccessibleError,\n ContainerKekRepairRequiredError,\n ContainerKeyringOverrideStaleError,\n ContainerMutationService,\n ContainerPathTooDeepError,\n classifyContainerWriteRefusal,\n containerWriterProjectionFromRekeyPlan,\n fetchContainerKekLog,\n HistoricalWrapUnavailableError,\n type HistoricalWrapUnavailableReason,\n isProjectionVerificationCancelledError,\n rebuildKeyringEntriesFromLog,\n recoverKeyringEntryFromWraps,\n rootContainerWriterProjectionFromCreatePlan,\n} from \"./workflows/containers\";\nexport type {\n CreateRemoteDocumentRequest,\n CreateRemoteDocumentResult,\n DocumentBirthResult,\n DocumentRecord,\n DocumentSyncContainerRekeyBuilder,\n DocumentSyncPullContinuation,\n DocumentSyncUpdateIsolationError,\n DocumentsPersistence,\n DocumentsWorkflowRuntime,\n IncomingDocumentSyncUpdateValidator,\n LocalAttachmentRecord,\n PendingAttachmentRecord,\n PendingUpdateInsert,\n PendingUpdateRecord,\n QueuedPendingUpdateRecord,\n RemoteDocumentServiceApi,\n SyncRemoteDocumentRequest,\n SyncRemoteDocumentResult,\n} from \"./workflows/documents\";\nexport {\n buildMaterializedDocumentCreatePlan,\n createDocumentProjectionUserKeyResolver,\n DOCUMENT_SYNC_TRACE_FRAGMENT,\n DOCUMENT_SYNC_TRACE_PATTERN,\n DOCUMENTS_APP_KIND,\n DocumentRawHistoryUnavailableError,\n defaultDocumentsPersistence,\n deletePersistedDocument,\n deriveStableDocumentId,\n isDatabaseUnavailableError,\n isDocumentSyncUpdateIsolationError,\n isEmptyDocumentHistoryChange,\n persistedDocumentCreateStateFromResponse,\n RemoteDocumentService,\n readPullContinuation,\n unwrapContainerKekPath,\n unwrapDocumentContentKeyTarget,\n validateDocumentSyncUpdateImports,\n} from \"./workflows/documents\";\n// Nominal identity constructors are available only through the testing subpath\n// for low-level runtime tests.\nexport type {\n AcknowledgedPrincipalCurrentInput,\n AcknowledgedPrincipalCurrentRetirement,\n AuthoredPrincipalMutation,\n OrganizationDocumentUsageCategory,\n OrganizationGroupPolicyHistoryEntry,\n OrganizationNativePurchaseEligibility,\n OrganizationPrincipalMemberChange,\n OrganizationPrincipalMemberChangeType,\n OrganizationPrincipalPolicyHistory,\n OrganizationPrincipalPolicyHistoryEntry,\n PrincipalMutationJournalContext,\n PrincipalMutationJournalScope,\n PrincipalMutationResponse,\n ReconcileOrganizationDataUsageInput,\n} from \"./workflows/organizations\";\nexport {\n abandonJournaledPrincipalMutation,\n addOrganizationGroupUser,\n buildInitialGroupPolicyRequest,\n buildInitialMemberGroupPolicyRequest,\n buildOrganizationGroupPolicyHistory,\n buildOrganizationProfileDocumentPatch,\n buildRosterProfileDocumentPatch,\n checkNativePurchaseEligibility,\n createInitializedRosterProfileDocument,\n createOrganizationGroup,\n DEFAULT_PERSONAL_ORGANIZATION_PROFILE_NAME,\n deriveOrganizationMetadataContainerSystemSlot,\n deriveOrganizationRosterProfileContainerSystemSlot,\n discardUnreadableJournaledPrincipalMutation,\n GroupMembershipNameMismatchError,\n GroupShareNameMismatchError,\n getOrganizationProfileDocumentLocalId,\n getRosterProfileDocumentLocalId,\n loadLocalOrganizationDataUsage,\n loadLocalOrganizationDirectoryAndGroups,\n loadOrganizationBilling,\n loadOrganizationBillingHistory,\n loadOrganizationBillingManagementUrl,\n ORGANIZATION_DOCUMENT_USAGE_CATEGORIES,\n ORGANIZATION_METADATA_CONTAINER_NAME,\n ORGANIZATION_PROFILE_DOCUMENT_KIND,\n ORGANIZATION_ROSTER_PROFILE_CONTAINER_NAME,\n PendingPrincipalMutationError,\n PrincipalMutationOutcomeUnknownError,\n ROSTER_PROFILE_DOCUMENT_KIND,\n readJournaledPrincipalMutation,\n readOrganizationProfileName,\n reconcileOrganizationDataUsage,\n reconcileOrganizationDirectoryAndGroups,\n recoverJournaledPrincipalMutation,\n removeOrganizationGroupUser,\n resolveOrganizationBillingView,\n retainAcknowledgedPrincipalCurrents,\n revokeOrganizationContainerGrant,\n shareRemoteContainerWithGroup,\n startOrganizationTrial,\n submitJournaledPrincipalMutation,\n subscribeOrganizationReadModelInvalidation,\n UnreadablePrincipalMutationError,\n updateOrganizationProfile,\n updateOrganizationRosterEntry,\n} from \"./workflows/organizations\";\nexport type {\n AcknowledgedPrincipalPredecessor,\n CacheReferencedPrincipalPoliciesOptions,\n PrincipalHistoryProtectionLease,\n PrincipalPolicyService,\n ProjectionPolicyHistoryRecoveryOptions,\n RecoveredPrincipalPolicyHistory,\n RecoveredScopedPrincipalPolicyHistory,\n RecoverPrincipalPolicyHistoryOptions,\n RecoverScopedPrincipalPolicyHistoryOptions,\n} from \"./workflows/principals\";\nexport {\n cacheReferencedPrincipalPolicies,\n captureAcknowledgedPrincipalPredecessor,\n PrincipalPolicyHistoryReadError,\n recoverPrincipalPolicyHistory,\n recoverProjectionPolicyHistory,\n recoverScopedPrincipalPolicyHistory,\n} from \"./workflows/principals\";\nexport type {\n InitialRootMetadataBootstrap,\n ProvisionedSystemContainerSpec,\n RegisterIdentityInput,\n RegistrationApi,\n} from \"./workflows/registration\";\nexport {\n bootstrapRootContainer,\n buildInitialOrganizationPolicyRequest,\n createInitialRootMetadataBootstrap,\n persistRegistrationBootstrap,\n registerIdentity,\n} from \"./workflows/registration\";\nexport type {\n PendingBlobDeletion,\n PendingBlobDeletionsPage,\n PendingBlobDeletionsQueryInput,\n RootIdentitiesApi,\n RootIdentitiesPage,\n RootIdentitiesQueryInput,\n RootIdentity,\n RootIdentityDetail,\n RootIdentityOrganization,\n RootIdentitySession,\n RootPendingBlobDeletionsQueryInput,\n RootRequestOutcome,\n} from \"./workflows/root\";\nexport {\n liftRootIdentitySuspension,\n listRootAuditEvents,\n listRootDataUsageReport,\n listRootIdentities,\n listRootIdentityOrganizations,\n listRootOrganizationIdentities,\n listRootOrganizationRevenuecatEvents,\n listRootOrganizations,\n listRootRevenuecatEventsReport,\n loadRootIdentity,\n loadRootOpsHealthReport,\n loadRootOrganization,\n loadRootOrganizationDataUsage,\n type RootAuditApi,\n type RootAuditEvent,\n type RootAuditEventsPage,\n type RootAuditEventsQueryInput,\n type RootDataUsageApi,\n type RootDataUsageReportPage,\n type RootOpsHealthApi,\n type RootOpsHealthReport,\n type RootOrganization,\n type RootOrganizationDetail,\n type RootOrganizationIdentitiesPage,\n type RootOrganizationIdentity,\n type RootOrganizationPageQueryInput,\n type RootOrganizationRevenuecatEvent,\n type RootOrganizationRevenuecatEventsPage,\n type RootOrganizationsApi,\n type RootOrganizationsPage,\n type RootOrganizationsQueryInput,\n type RootRevenuecatApi,\n type RootRevenuecatEvent,\n type RootRevenuecatEventsQueryInput,\n type RootRevenuecatEventsReportPage,\n type RootRevenuecatEventsReportQueryInput,\n type RootSuspensionApi,\n suspendRootIdentity,\n} from \"./workflows/root\";\nexport type {\n ClearRemoteSyncStateResult,\n DomainSyncCoordinator,\n DomainSyncSnapshot,\n RemoteResetInput,\n RemoteResetReplacement,\n SyncIdleOptions,\n SyncLane,\n SyncLaneConfig,\n SyncLaneLastAction,\n SyncLanePhase,\n SyncLaneSnapshot,\n SyncLaneStatus,\n} from \"./workflows/sync\";\nexport {\n clearRemoteSyncState,\n getDomainSyncCoordinatorSnapshot,\n getOrCreateDomainSyncCoordinator,\n hasDomainSyncCoordinatorPendingWork,\n requestAllDomainSyncLanes,\n subscribeToDomainSyncCoordinator,\n waitForDomainSyncCoordinatorToSettle,\n} from \"./workflows/sync\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,yEAAyE;AACzE,gEAAgE;AAChE,OAAO,EAGL,iBAAiB,GAElB,MAAM,uBAAuB,CAAC;AAiL/B,OAAO,EAEL,KAAK,EACL,yBAAyB,EACzB,sCAAsC,EACtC,gCAAgC,EAChC,2CAA2C,EAC3C,sCAAsC,EACtC,sCAAsC,EACtC,8BAA8B,EAC9B,iBAAiB,EACjB,wCAAwC,EACxC,kCAAkC,EAClC,kBAAkB,EAClB,2CAA2C,EAC3C,qCAAqC,EACrC,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EAChC,yBAAyB,EACzB,+BAA+B,EAC/B,0BAA0B,EAC1B,yBAAyB,EACzB,QAAQ,EACR,mBAAmB,EAKnB,8BAA8B,EAC9B,2BAA2B,EAC3B,MAAM,EAGN,2BAA2B,EAC3B,8BAA8B,EAC9B,2BAA2B,EAC3B,mCAAmC,EACnC,6BAA6B,EAC7B,oBAAoB,EACpB,OAAO,EACP,0BAA0B,EAG1B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAE5B,yBAAyB,EACzB,8CAA8C,EAC9C,yBAA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2B,EAC3B,8BAA8B,EAC9B,mCAAmC,EACnC,gCAAgC,EAChC,6BAA6B,EAC7B,sBAAsB,EACtB,gCAAgC,EAChC,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AAYnC,OAAO,EACL,gCAAgC,EAChC,uCAAuC,EACvC,+BAA+B,EAC/B,6BAA6B,EAC7B,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EACL,sBAAsB,EACtB,qCAAqC,EACrC,kCAAkC,EAClC,gCAAgC,EAChC,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAelC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,8BAA8B,EAC9B,oCAAoC,EACpC,qBAAqB,EACrB,8BAA8B,EAC9B,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,6BAA6B,EAyB7B,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAe1B,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,gCAAgC,EAChC,mCAAmC,EACnC,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,GACrC,MAAM,kBAAkB,CAAC","sourcesContent":["// SDK: full-bundle identity trust and bounded Members admission.\n// Exact-head authority; canonical writer domains; restart-safe journals.\n// No pin promotion or legacy adapters. See workflows/README.md.\nexport {\n type ApiRequestCounts,\n type ApiRequestEndpointCounts,\n ApiRequestMetrics,\n type ApiRequestMetricsSnapshot,\n} from \"@tearleads/api-client\";\nexport type {\n AbandonOrganizationPolicyMutationInput,\n AddOrganizationGroupUserInput,\n BlobInfo,\n BlobInfoAttachmentKind,\n BlobInfoDocumentReference,\n BlobInfoInput,\n BlobInfoList,\n BlobInfoSort,\n BlobInfoSortDirection,\n BlobInfoSortKey,\n BrowserLocalKeyringOptions,\n ContainerContents,\n ContainerContentsContextValue,\n ContainerContentsStore,\n ContainerContentsStoreOptions,\n ContainerDocumentLinkInput,\n ContainerDocumentLinks,\n ContainerDocumentObjectSyncState,\n ContainerDocumentObjectSyncStatus,\n ContainerDocumentQueries,\n ContainerDocumentSidebarRow,\n ContainerInfo,\n ContainerInfoInput,\n ContainerItemRow,\n ContainerItemSort,\n ContainerItemSortDirection,\n ContainerItemSortKey,\n ContainerNode,\n ContainerShareAccessLevel,\n CreateOrganizationOptions,\n DatabaseListener,\n DatabaseOptions,\n DatabaseSnapshot,\n DatabaseStatus,\n DeviceFirst,\n DeviceFirstContainerContents,\n DiscardUnreadableOrganizationPolicyMutationInput,\n DocumentAttachmentStatus,\n DocumentAttachmentUpload,\n DocumentAttributionRangesInput,\n DocumentAttributionRangesPage,\n DocumentContextValue,\n DocumentHistory,\n DocumentHistoryChange,\n DocumentHistoryRowChange,\n DocumentHistoryStop,\n DocumentHistoryTextChange,\n DocumentHistoryVersion,\n DocumentHistoryVersionEntry,\n DocumentHistoryView,\n DocumentInfo,\n DocumentInfoInput,\n DocumentList,\n DocumentSort,\n DocumentSortDirection,\n DocumentSortKey,\n DocumentStore,\n DocumentSubscriptionOptions,\n Documents,\n DocumentsRuntime,\n DocumentsWorkflowRuntimeInput,\n DomainScope,\n FileSaver,\n Identity,\n IdentityGenerationResult,\n IdentityKeyPackage,\n IdentityListener,\n IdentityOptions,\n IdentitySnapshot,\n IndexedDbLocalKeyringManifestStoreOptions,\n IndexedDbWrappingKeyKeystoreOptions,\n LinkDocumentToContainerInput,\n ListDocumentsInput,\n LocalKeyPurpose,\n LocalKeyring,\n LocalKeyringManifest,\n LocalKeyringManifestFormat,\n LocalKeyringManifestStorage,\n LocalKeyringManifestStore,\n LocalKeyringOptions,\n LocalKeyringPinCode,\n LocalKeyringScope,\n LocalKeyringSession,\n LocalOrganizationSummary,\n LocalProjectionReconciledDelta,\n LocalProjectionSnapshot,\n LocalProjectionView,\n LocalSecretContext,\n LocalStorageLocalKeyringManifestStoreOptions,\n Logger,\n MergeDocumentSummary,\n MoveDocumentToContainerInput,\n NetworkListener,\n NetworkMode,\n NetworkStatusSource,\n NormalizedLocalKeyringScope,\n OpenContainerDocumentInput,\n OpenDocumentInput,\n OpenDocumentOptions,\n OrganizationBilling,\n OrganizationBillingHistory,\n OrganizationBillingHistoryEntry,\n OrganizationBillingManagementUrl,\n OrganizationBillingView,\n OrganizationContainerGrant,\n OrganizationContainerGrants,\n OrganizationDataUsage,\n OrganizationDeviceDataUsage,\n OrganizationDeviceDocumentUsageCategoryBreakdown,\n OrganizationDirectory,\n OrganizationDirectoryAndGroups,\n OrganizationDirectoryUser,\n OrganizationGrantRef,\n OrganizationGroupContainer,\n OrganizationGroupContainers,\n OrganizationGroupDetails,\n OrganizationGroupMember,\n OrganizationGroupMembers,\n OrganizationGroupMutationReceipt,\n OrganizationGroupMutationResult,\n OrganizationGroupPolicyHistory,\n OrganizationGroupSummary,\n OrganizationLeaveRequestResult,\n OrganizationMembership,\n OrganizationMemberships,\n OrganizationPolicyGrantChange,\n OrganizationPolicyGroupChange,\n /** Verified organization display page with an optional older-page cursor. */\n OrganizationPolicyHistory,\n OrganizationPolicyHistoryEntry,\n OrganizationProfile,\n OrganizationSyncPauseResult,\n Organizations,\n OrganizationUserDetail,\n PendingWriteQueueItem,\n PendingWriteQueueItemStatus,\n PendingWriteQueueObjectKind,\n PendingWriteQueueOperation,\n PendingWriteQueueOperationKind,\n PendingWriteQueueOperationStatus,\n // Persistence notifications distinguish placement changes from content saves.\n PersistedDocumentListener,\n PinCodeBrowserLocalKeyringOptions,\n PinCodeWrappingKeyKeystoreOptions,\n PurgeDocumentInput,\n PurgeDocumentResult,\n ReconciliationService,\n RemoveOrganizationGroupUserInput,\n ResolvedUserIdentity,\n SaveFileRequest,\n SecurityIncident,\n SecurityIncidentListener,\n SecurityIncidentObjectKind,\n SecurityIncidents,\n Session,\n SessionContext,\n SessionCreateOrganizationResult,\n SessionListener,\n SessionRecoverOrganizationResult,\n SessionRegistrationRefusal,\n SessionRegistrationResult,\n SessionSnapshot,\n SetActiveDocumentContainerInput,\n SetLinkedContainerIdsForDocument,\n UnlinkDocumentFromContainerInput,\n UnwrapLocalSecretInput,\n UserIdentities,\n UserSession,\n WrapLocalSecretInput,\n WrappedLocalSecretEnvelope,\n WrappedLocalSecretFormat,\n WrappingKeyHandle,\n WrappingKeyKeystore,\n WrappingKeyMaterialStorage,\n} from \"./client\";\nexport {\n type BlobStoreFactory,\n Blobs,\n createBrowserLocalKeyring,\n createBrowserLocalKeyringManifestStore,\n createBrowserNetworkStatusSource,\n createContainerContentsStoreWorkflowRuntime,\n createContainerContentsWorkflowRuntime,\n createContainerDocumentObjectSyncState,\n createDocumentsWorkflowRuntime,\n createDomainScope,\n createIndexedDbLocalKeyringManifestStore,\n createIndexedDbWrappingKeyKeystore,\n createLocalKeyring,\n createLocalStorageLocalKeyringManifestStore,\n createMemoryLocalKeyringManifestStore,\n createMemoryWrappingKeyKeystore,\n createPinCodeBrowserLocalKeyring,\n createPinCodeWrappingKeyKeystore,\n createRevenueCatPurchases,\n createUnavailableDirectCheckout,\n createUnavailablePurchases,\n createWebViewLocalKeyring,\n Database,\n DEFAULT_DOCUMENT_ID,\n type DirectCheckoutAppearance,\n type DirectCheckoutCapability,\n type DirectCheckoutConfirmation,\n type DirectCheckoutSession,\n DirectCheckoutUnavailableError,\n decodeLocalKeyringSqliteKey,\n Events,\n type EventsListener,\n type EventsSnapshot,\n encodeLocalKeyringSqliteKey,\n enqueueReconciliationForEvents,\n IDENTITY_KEY_PACKAGE_FORMAT,\n isPinCodeWrappedLocalSecretEnvelope,\n LOCAL_KEYRING_MANIFEST_FORMAT,\n localKeyringScopeKey,\n Network,\n normalizeLocalKeyringScope,\n type PrincipalHistoryKeyProvider,\n type PrincipalHistoryKeyScope,\n PurchaseAbortedError,\n PurchaseAlreadyOwnedError,\n PurchaseCancelledError,\n PurchaseIdentityPendingError,\n PurchaseProviderStalledError,\n type PurchasesCapability,\n PurchasesUnavailableError,\n PurgedOrganizationRecoveryBillingRequiredError,\n parseLocalKeyringManifest,\n type RevenueCatBackend,\n type RevenueCatCustomerInfo,\n type RevenueCatPackage,\n type RevenueCatPurchasesConfig,\n SyncBillingGate,\n type SyncBillingGateListener,\n type SyncPurchaseResult,\n type SyncSubscriptionOption,\n serializeLocalKeyringManifest,\n UnverifiedUserIdentityError,\n WRAPPED_LOCAL_SECRET_FORMAT,\n} from \"./client\";\nexport type {\n DiscoveredDocumentInput,\n DocumentAttachment,\n DocumentClientProjectionDefinition,\n DocumentClientProjectionDeleteInput,\n DocumentClientProjectionSaveInput,\n DocumentFieldValidationIssue,\n DocumentProjection,\n DocumentProjectorDefinition,\n DocumentProjectorInput,\n DocumentProjectorRegistry,\n DocumentProjectorRegistryInput,\n DocumentRestoreContent,\n DocumentRow,\n DocumentRowSummary,\n DocumentSummary,\n EnvFileVariable,\n StoredDocumentKind,\n StoredDocumentState,\n StructuredDocumentMap,\n StructuredDocumentShape,\n StructuredDocumentText,\n ValidatedDocumentFields,\n} from \"./data/documents\";\nexport {\n addDocumentAttachments,\n createDocumentProjectorRegistry,\n createDocumentSignerDeviceId,\n DEFAULT_DOCUMENT_ACCESS_EPOCH,\n DEFAULT_DOCUMENT_KIND,\n defaultDocumentProjectorRegistry,\n deriveStoredDocumentTitle,\n ENV_FILE_DOCUMENT_KIND,\n ENV_FILE_NAME_FIELD,\n ENV_FILE_VARIABLE_KEY_FIELD,\n ENV_FILE_VARIABLE_NAME_PATTERN,\n ENV_FILE_VARIABLE_VALUE_FIELD,\n ensureDocumentAttachmentStructure,\n getDocumentAttachments,\n getDocumentClientProjectionTables,\n getStoredDocumentTypeLabel,\n getUntitledDocumentTitle,\n initializeStoredDocumentKind,\n isValidEnvFileVariableName,\n parseEnvFileText,\n projectStoredDocumentState,\n readStoredDocumentState,\n readStringDocumentField,\n resolveOpIdAttribution,\n sameDocumentAttachments,\n summarizeDocumentContributors,\n writerByPeerId,\n writeStoredDocumentFields,\n} from \"./data/documents\";\nexport type {\n ContainerContentsSnapshot,\n ContainerContentsStoreRuntime,\n ContainerContentsStoreState,\n ContainerContentsStoreSyncAgent,\n ContainerContentsStoreSyncState,\n ContainerState,\n PurgeMoveSettlement,\n PurgeOptions,\n PurgeProgress,\n} from \"./stores/container-contents\";\nexport {\n createContainerContentsStore,\n createContainerContentsStoreState,\n createContainerContentsStoreSyncAgent,\n getOrCreateContainerContentsStore,\n isSystemContainerNode,\n requestContainerContentsDocumentPriming,\n subscribeToContainerContentsStore,\n updateContainerContentsSnapshot,\n updateContainerContentsStoreRuntime,\n} from \"./stores/container-contents\";\nexport type {\n DocumentMutationGuard,\n DocumentMutationOptions,\n DocumentSnapshot,\n DocumentStoreFacade,\n DocumentStoreOpenOptions,\n DocumentStoreRelinkInput,\n DocumentStructuredFieldPatch,\n} from \"./stores/documents\";\nexport {\n createDocumentStore,\n discardRegisteredDocumentLocalState,\n getOrCreateDocumentStore,\n hasPendingLocalDocumentWrites,\n openDocumentStore,\n requestDomainDocumentSync,\n subscribeToPersistedDocuments,\n} from \"./stores/documents\";\nexport { Tearleads } from \"./Tearleads\";\nexport type {\n TearleadsDatabaseOptions,\n TearleadsOptions,\n} from \"./TearleadsOptions\";\nexport type {\n BlobAttachmentCollaborators,\n BlobAttachmentServiceApi,\n BlobByteSource,\n BlobByteSourceInput,\n BlobBytes,\n BlobStore,\n DecryptDocumentAttachmentBlobRequest,\n DetachDocumentAttachmentRequest,\n DetachDocumentAttachmentResult,\n EncryptedBlobStoreCipher,\n EncryptedBlobStoreKey,\n EncryptedBlobStoreOptions,\n HydrateDocumentAttachmentBlobsRequest,\n HydratedDocumentAttachmentBlob,\n UploadDocumentAttachmentRequest,\n UploadDocumentAttachmentResult,\n WrapEncryptedBlobStoreOptions,\n} from \"./workflows/blobs\";\nexport {\n BlobAttachmentService,\n blobByteSourceInputLength,\n createBlobByteSource,\n createBlobStore,\n createEncryptedBlobStore,\n createLazyEncryptedBlobStore,\n createMemoryBlobStore,\n purgeOpfsBlobStore,\n readBlobByteSource,\n wrapEncryptedBlobStore,\n} from \"./workflows/blobs\";\nexport type {\n ContainerContentsRootAdopter,\n ContainerContentsRootAdoptionInput,\n ContainerContentsStoreWorkflowRuntime,\n ContainerContentsWorkflowRuntime,\n // Distinct from the canonical `ContainerDocumentLinkInput` (./client); the\n // documentQueries variant has a different shape, so it keeps a disambiguating\n // alias on the public surface.\n ContainerDocumentLinkInput as ContainerDocumentQueriesLinkInput,\n ContainerSystemSlotDefinition,\n PendingDownloadQueueItem,\n RecoveryFolder,\n} from \"./workflows/container-contents\";\nexport {\n ContainerSyncWatermarkRepository,\n createContainerContentsDocumentsRuntime,\n createContainerContentsProjectionUserKeyResolver,\n createContainerContentsSyncLane,\n createContainerParentSyncLane,\n createInitializedContainerMetadataDocument,\n DocumentContainerProjectionRepository,\n defaultContainerContentsPersistence,\n deriveContainerSystemSlot,\n listBlobInfo,\n loadContainerInfo,\n loadDocumentAttributionRanges,\n loadDocumentInfo,\n syncedContainerDocumentObjectSyncState,\n} from \"./workflows/container-contents\";\nexport type {\n AggregatedContainerKekLog,\n ContainerMutationAuthor,\n ContainerMutationCollaborators,\n ContainerReciteApi,\n ContainerWriteRefusal,\n KeyringRebuildResult,\n MaterializedContainerRekeyPlan,\n} from \"./workflows/containers\";\nexport {\n buildMaterializedContainerRekeyPlan,\n buildRootContainerCreatePlan,\n ContainerAuthorAccessError,\n ContainerKekRepairInaccessibleError,\n ContainerKekRepairRequiredError,\n ContainerKeyringOverrideStaleError,\n ContainerMutationService,\n ContainerPathTooDeepError,\n classifyContainerWriteRefusal,\n containerWriterProjectionFromRekeyPlan,\n fetchContainerKekLog,\n HistoricalWrapUnavailableError,\n type HistoricalWrapUnavailableReason,\n isProjectionVerificationCancelledError,\n rebuildKeyringEntriesFromLog,\n recoverKeyringEntryFromWraps,\n rootContainerWriterProjectionFromCreatePlan,\n} from \"./workflows/containers\";\nexport type {\n CreateRemoteDocumentRequest,\n CreateRemoteDocumentResult,\n DocumentBirthResult,\n DocumentRecord,\n DocumentSyncContainerRekeyBuilder,\n DocumentSyncPullContinuation,\n DocumentSyncUpdateIsolationError,\n DocumentsPersistence,\n DocumentsWorkflowRuntime,\n IncomingDocumentSyncUpdateValidator,\n LocalAttachmentRecord,\n PendingAttachmentRecord,\n PendingUpdateInsert,\n PendingUpdateRecord,\n QueuedPendingUpdateRecord,\n RemoteDocumentServiceApi,\n SyncRemoteDocumentRequest,\n SyncRemoteDocumentResult,\n} from \"./workflows/documents\";\nexport {\n buildMaterializedDocumentCreatePlan,\n createDocumentProjectionUserKeyResolver,\n DOCUMENT_SYNC_TRACE_FRAGMENT,\n DOCUMENT_SYNC_TRACE_PATTERN,\n DOCUMENTS_APP_KIND,\n DocumentRawHistoryUnavailableError,\n defaultDocumentsPersistence,\n deletePersistedDocument,\n deriveStableDocumentId,\n isDatabaseUnavailableError,\n isDocumentSyncUpdateIsolationError,\n isEmptyDocumentHistoryChange,\n persistedDocumentCreateStateFromResponse,\n RemoteDocumentService,\n readPullContinuation,\n unwrapContainerKekPath,\n unwrapDocumentContentKeyTarget,\n validateDocumentSyncUpdateImports,\n} from \"./workflows/documents\";\n// Nominal identity constructors are available only through the testing subpath\n// for low-level runtime tests.\nexport type {\n AcknowledgedPrincipalCurrentInput,\n AcknowledgedPrincipalCurrentRetirement,\n AuthoredPrincipalMutation,\n OrganizationDocumentUsageCategory,\n OrganizationGroupPolicyHistoryEntry,\n OrganizationNativePurchaseEligibility,\n OrganizationPrincipalMemberChange,\n OrganizationPrincipalMemberChangeType,\n OrganizationPrincipalPolicyHistory,\n OrganizationPrincipalPolicyHistoryEntry,\n PrincipalMutationJournalContext,\n PrincipalMutationJournalScope,\n PrincipalMutationResponse,\n ReconcileOrganizationDataUsageInput,\n} from \"./workflows/organizations\";\nexport {\n abandonJournaledPrincipalMutation,\n addOrganizationGroupUser,\n buildInitialGroupPolicyRequest,\n buildInitialMemberGroupPolicyRequest,\n buildOrganizationGroupPolicyHistory,\n buildOrganizationProfileDocumentPatch,\n buildRosterProfileDocumentPatch,\n checkNativePurchaseEligibility,\n createInitializedRosterProfileDocument,\n createOrganizationGroup,\n DEFAULT_PERSONAL_ORGANIZATION_PROFILE_NAME,\n deriveOrganizationMetadataContainerSystemSlot,\n deriveOrganizationRosterProfileContainerSystemSlot,\n discardUnreadableJournaledPrincipalMutation,\n GroupMembershipNameMismatchError,\n GroupShareNameMismatchError,\n getOrganizationProfileDocumentLocalId,\n getRosterProfileDocumentLocalId,\n loadLocalOrganizationDataUsage,\n loadLocalOrganizationDirectoryAndGroups,\n loadOrganizationBilling,\n loadOrganizationBillingHistory,\n loadOrganizationBillingManagementUrl,\n ORGANIZATION_DOCUMENT_USAGE_CATEGORIES,\n ORGANIZATION_METADATA_CONTAINER_NAME,\n ORGANIZATION_PROFILE_DOCUMENT_KIND,\n ORGANIZATION_ROSTER_PROFILE_CONTAINER_NAME,\n PendingPrincipalMutationError,\n PrincipalMutationOutcomeUnknownError,\n ROSTER_PROFILE_DOCUMENT_KIND,\n readJournaledPrincipalMutation,\n readOrganizationProfileName,\n reconcileOrganizationDataUsage,\n reconcileOrganizationDirectoryAndGroups,\n recoverJournaledPrincipalMutation,\n removeOrganizationGroupUser,\n resolveOrganizationBillingView,\n retainAcknowledgedPrincipalCurrents,\n revokeOrganizationContainerGrant,\n shareRemoteContainerWithGroup,\n startOrganizationTrial,\n submitJournaledPrincipalMutation,\n subscribeOrganizationReadModelInvalidation,\n UnreadablePrincipalMutationError,\n updateOrganizationProfile,\n updateOrganizationRosterEntry,\n} from \"./workflows/organizations\";\nexport type {\n AcknowledgedPrincipalPredecessor,\n CacheReferencedPrincipalPoliciesOptions,\n PrincipalHistoryProtectionLease,\n PrincipalPolicyService,\n ProjectionPolicyHistoryRecoveryOptions,\n RecoveredPrincipalPolicyHistory,\n RecoveredScopedPrincipalPolicyHistory,\n RecoverPrincipalPolicyHistoryOptions,\n RecoverScopedPrincipalPolicyHistoryOptions,\n} from \"./workflows/principals\";\nexport {\n cacheReferencedPrincipalPolicies,\n captureAcknowledgedPrincipalPredecessor,\n PrincipalPolicyHistoryReadError,\n recoverPrincipalPolicyHistory,\n recoverProjectionPolicyHistory,\n recoverScopedPrincipalPolicyHistory,\n} from \"./workflows/principals\";\nexport type {\n InitialRootMetadataBootstrap,\n ProvisionedSystemContainerSpec,\n RegisterIdentityInput,\n RegistrationApi,\n} from \"./workflows/registration\";\nexport {\n bootstrapRootContainer,\n buildInitialOrganizationPolicyRequest,\n createInitialRootMetadataBootstrap,\n deriveRegistrationOrganizationId,\n persistRegistrationBootstrap,\n registerIdentity,\n} from \"./workflows/registration\";\nexport type {\n PendingBlobDeletion,\n PendingBlobDeletionsPage,\n PendingBlobDeletionsQueryInput,\n RootIdentitiesApi,\n RootIdentitiesPage,\n RootIdentitiesQueryInput,\n RootIdentity,\n RootIdentityDetail,\n RootIdentityOrganization,\n RootIdentitySession,\n RootPendingBlobDeletionsQueryInput,\n RootRequestOutcome,\n} from \"./workflows/root\";\nexport {\n liftRootIdentitySuspension,\n listRootAuditEvents,\n listRootDataUsageReport,\n listRootIdentities,\n listRootIdentityOrganizations,\n listRootOrganizationIdentities,\n listRootOrganizationRevenuecatEvents,\n listRootOrganizations,\n listRootRevenuecatEventsReport,\n loadRootIdentity,\n loadRootOpsHealthReport,\n loadRootOrganization,\n loadRootOrganizationDataUsage,\n type RootAuditApi,\n type RootAuditEvent,\n type RootAuditEventsPage,\n type RootAuditEventsQueryInput,\n type RootDataUsageApi,\n type RootDataUsageReportPage,\n type RootOpsHealthApi,\n type RootOpsHealthReport,\n type RootOrganization,\n type RootOrganizationDetail,\n type RootOrganizationIdentitiesPage,\n type RootOrganizationIdentity,\n type RootOrganizationPageQueryInput,\n type RootOrganizationRevenuecatEvent,\n type RootOrganizationRevenuecatEventsPage,\n type RootOrganizationsApi,\n type RootOrganizationsPage,\n type RootOrganizationsQueryInput,\n type RootRevenuecatApi,\n type RootRevenuecatEvent,\n type RootRevenuecatEventsQueryInput,\n type RootRevenuecatEventsReportPage,\n type RootRevenuecatEventsReportQueryInput,\n type RootSuspensionApi,\n suspendRootIdentity,\n} from \"./workflows/root\";\nexport type {\n ClearRemoteSyncStateResult,\n DomainSyncCoordinator,\n DomainSyncSnapshot,\n RemoteResetInput,\n RemoteResetReplacement,\n SyncIdleOptions,\n SyncLane,\n SyncLaneConfig,\n SyncLaneLastAction,\n SyncLanePhase,\n SyncLaneSnapshot,\n SyncLaneStatus,\n} from \"./workflows/sync\";\nexport {\n clearRemoteSyncState,\n getDomainSyncCoordinatorSnapshot,\n getOrCreateDomainSyncCoordinator,\n hasDomainSyncCoordinatorPendingWork,\n requestAllDomainSyncLanes,\n subscribeToDomainSyncCoordinator,\n waitForDomainSyncCoordinatorToSettle,\n} from \"./workflows/sync\";\n"]}
@@ -2492,6 +2492,7 @@ export declare class ApiClient extends ApiClientAreas {
2492
2492
  organizationId: string;
2493
2493
  parentId: string | null;
2494
2494
  updatedAt: string;
2495
+ restorationId?: string | undefined;
2495
2496
  systemSlot?: string | null | undefined;
2496
2497
  }[];
2497
2498
  nextWatermark: {
@@ -96,6 +96,7 @@ export declare class ApiClientContext {
96
96
  organizationId: string;
97
97
  parentId: string | null;
98
98
  updatedAt: string;
99
+ restorationId?: string | undefined;
99
100
  systemSlot?: string | null | undefined;
100
101
  }[];
101
102
  nextWatermark: {
@@ -75,6 +75,7 @@ export declare class ContainerReadArea {
75
75
  organizationId: string;
76
76
  parentId: string | null;
77
77
  updatedAt: string;
78
+ restorationId?: string | undefined;
78
79
  systemSlot?: string | null | undefined;
79
80
  }[];
80
81
  nextWatermark: {
@@ -163,12 +163,20 @@ export function listContainerParentLanesRequestKey(input) {
163
163
  })));
164
164
  }
165
165
  export function listContainerDocumentLanesRequestKey(input) {
166
- return JSON.stringify(input.lanes.map((lane) => ({
167
- containerId: lane.containerId,
168
- laneId: lane.laneId,
169
- limit: lane.limit ?? null,
170
- watermark: syncWatermarkRequestKey(lane.watermark),
171
- })));
166
+ return JSON.stringify({
167
+ afterParentPage: input.afterParentPage
168
+ ? [
169
+ input.afterParentPage.parentId,
170
+ syncWatermarkRequestKey(input.afterParentPage.watermark),
171
+ ]
172
+ : null,
173
+ lanes: input.lanes.map((lane) => ({
174
+ containerId: lane.containerId,
175
+ laneId: lane.laneId,
176
+ limit: lane.limit ?? null,
177
+ watermark: syncWatermarkRequestKey(lane.watermark),
178
+ })),
179
+ });
172
180
  }
173
181
  export function cachedRequest(cache, cacheKey, request) {
174
182
  const cached = cache.get(cacheKey);
@@ -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,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;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,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,CA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AO,+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 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"]}
@@ -1,5 +1,11 @@
1
1
  import { z } from "zod";
2
2
  export declare function formatContainerSystemSlot(digest: Uint8Array): ContainerSystemSlot;
3
+ export declare const ORGANIZATION_TRASH_SLOT_NAMESPACE = "tearleads.organization-trash";
4
+ export declare function deriveOrganizationSystemSlot(input: {
5
+ readonly namespace: string;
6
+ readonly organizationId: string;
7
+ }): ContainerSystemSlot;
8
+ export declare function deriveOrganizationTrashSystemSlot(organizationId: string): ContainerSystemSlot;
3
9
  export declare const ContainerSystemSlotSchema: z.ZodCustom<string, string>;
4
10
  export type ContainerSystemSlot = z.infer<typeof ContainerSystemSlotSchema>;
5
11
  export declare function isContainerSystemSlot(value: unknown): value is ContainerSystemSlot;
@@ -1,3 +1,4 @@
1
+ import { sha256 } from "@noble/hashes/sha2.js";
1
2
  import { z } from "zod";
2
3
  import { registerJsonSchemaFragment } from "./jsonSchema.js";
3
4
  const CONTAINER_SYSTEM_SLOT_PATTERN = /^sys_v1_[A-Za-z0-9_-]{43}$/;
@@ -11,13 +12,20 @@ export function formatContainerSystemSlot(digest) {
11
12
  .replace(/=+$/g, "");
12
13
  return `sys_v1_${encoded}`;
13
14
  }
14
- async function deriveOrganizationSystemSlot(input) {
15
- const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify({
15
+ export const ORGANIZATION_TRASH_SLOT_NAMESPACE = "tearleads.organization-trash";
16
+ export function deriveOrganizationSystemSlot(input) {
17
+ const label = JSON.stringify({
16
18
  namespace: input.namespace,
17
19
  organizationId: input.organizationId,
18
20
  version: 1,
19
- })));
20
- return formatContainerSystemSlot(new Uint8Array(digest));
21
+ });
22
+ return formatContainerSystemSlot(sha256(new TextEncoder().encode(label)));
23
+ }
24
+ export function deriveOrganizationTrashSystemSlot(organizationId) {
25
+ return deriveOrganizationSystemSlot({
26
+ namespace: ORGANIZATION_TRASH_SLOT_NAMESPACE,
27
+ organizationId,
28
+ });
21
29
  }
22
30
  export const ContainerSystemSlotSchema = registerJsonSchemaFragment(z.custom((value) => typeof value === "string" && CONTAINER_SYSTEM_SLOT_PATTERN.test(value)), {
23
31
  pattern: CONTAINER_SYSTEM_SLOT_PATTERN.source,
@@ -29,13 +37,13 @@ export function isContainerSystemSlot(value) {
29
37
  export function isNullableContainerSystemSlot(value) {
30
38
  return value === null || isContainerSystemSlot(value);
31
39
  }
32
- export function deriveOrganizationRosterProfileContainerSystemSlot(input) {
40
+ export async function deriveOrganizationRosterProfileContainerSystemSlot(input) {
33
41
  return deriveOrganizationSystemSlot({
34
42
  namespace: "tearleads.organization-roster-profiles",
35
43
  organizationId: input.organizationId,
36
44
  });
37
45
  }
38
- export function deriveOrganizationMetadataContainerSystemSlot(input) {
46
+ export async function deriveOrganizationMetadataContainerSystemSlot(input) {
39
47
  return deriveOrganizationSystemSlot({
40
48
  namespace: "tearleads.organization-metadata",
41
49
  organizationId: input.organizationId,
@@ -1 +1 @@
1
- {"version":3,"file":"containerSystemSlot.js","sourceRoot":"","sources":["containerSystemSlot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAEnE,MAAM,UAAU,yBAAyB,CACvC,MAAkB;IAElB,IAAI,MAAM,CAAC,UAAU,KAAK,EAAE,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,CAAC;SACjD,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvB,OAAO,UAAU,OAAO,EAAE,CAAC;AAC7B,CAAC;AAED,KAAK,UAAU,4BAA4B,CA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TAINER_SYSTEM_SLOT_PATTERN = /^sys_v1_[A-Za-z0-9_-]{43}$/;\n\nexport function formatContainerSystemSlot(\n digest: Uint8Array,\n): ContainerSystemSlot {\n if (digest.byteLength !== 32) {\n throw new Error(\"Container system slot digests must be exactly 32 bytes\");\n }\n const encoded = btoa(String.fromCharCode(...digest))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=+$/g, \"\");\n return `sys_v1_${encoded}`;\n}\n\nasync function deriveOrganizationSystemSlot(input: {\n readonly namespace: string;\n readonly organizationId: string;\n}): Promise<ContainerSystemSlot> {\n const digest = await crypto.subtle.digest(\n \"SHA-256\",\n new TextEncoder().encode(\n JSON.stringify({\n namespace: input.namespace,\n organizationId: input.organizationId,\n version: 1,\n }),\n ),\n );\n return formatContainerSystemSlot(new Uint8Array(digest));\n}\n\nexport const ContainerSystemSlotSchema = registerJsonSchemaFragment(\n z.custom<string>(\n (value) =>\n typeof value === \"string\" && CONTAINER_SYSTEM_SLOT_PATTERN.test(value),\n ),\n {\n pattern: CONTAINER_SYSTEM_SLOT_PATTERN.source,\n type: \"string\",\n },\n);\n\nexport type ContainerSystemSlot = z.infer<typeof ContainerSystemSlotSchema>;\n\nexport function isContainerSystemSlot(\n value: unknown,\n): value is ContainerSystemSlot {\n return ContainerSystemSlotSchema.safeParse(value).success;\n}\n\nexport function isNullableContainerSystemSlot(\n value: unknown,\n): value is ContainerSystemSlot | null {\n return value === null || isContainerSystemSlot(value);\n}\n\nexport function deriveOrganizationRosterProfileContainerSystemSlot(input: {\n readonly organizationId: string;\n}): Promise<ContainerSystemSlot> {\n return deriveOrganizationSystemSlot({\n namespace: \"tearleads.organization-roster-profiles\",\n organizationId: input.organizationId,\n });\n}\n\nexport function deriveOrganizationMetadataContainerSystemSlot(input: {\n readonly organizationId: string;\n}): Promise<ContainerSystemSlot> {\n return deriveOrganizationSystemSlot({\n namespace: \"tearleads.organization-metadata\",\n organizationId: input.organizationId,\n });\n}\n"]}
1
+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0BAA0B,CACjE,CAAC,CAAC,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,OAAO,KAAK,KAAK,QAAQ,IAAI,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CACzE,EACD;IACE,OAAO,EAAE,6BAA6B,CAAC,MAAM;IAC7C,IAAI,EAAE,QAAQ;CACf,CACF,CAAC;AAIF,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,yBAAyB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAc;IAEd,OAAO,KAAK,KAAK,IAAI,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kDAAkD,CAAC,KAExE;IACC,OAAO,4BAA4B,CAAC;QAClC,SAAS,EAAE,wCAAwC;QACnD,cAAc,EAAE,KAAK,CAAC,cAAc;KACrC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,6CAA6C,CAAC,KAEnE;IACC,OAAO,4BAA4B,CAAC;QAClC,SAAS,EAAE,iCAAiC;QAC5C,cAAc,EAAE,KAAK,CAAC,cAAc;KACrC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { z } from \"zod\";\nimport { registerJsonSchemaFragment } from \"./jsonSchema\";\n\nconst CONTAINER_SYSTEM_SLOT_PATTERN = /^sys_v1_[A-Za-z0-9_-]{43}$/;\n\nexport function formatContainerSystemSlot(\n digest: Uint8Array,\n): ContainerSystemSlot {\n if (digest.byteLength !== 32) {\n throw new Error(\"Container system slot digests must be exactly 32 bytes\");\n }\n const encoded = btoa(String.fromCharCode(...digest))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=+$/g, \"\");\n return `sys_v1_${encoded}`;\n}\n\nexport const ORGANIZATION_TRASH_SLOT_NAMESPACE = \"tearleads.organization-trash\";\n\nexport function deriveOrganizationSystemSlot(input: {\n readonly namespace: string;\n readonly organizationId: string;\n}): ContainerSystemSlot {\n const label = JSON.stringify({\n namespace: input.namespace,\n organizationId: input.organizationId,\n version: 1,\n });\n return formatContainerSystemSlot(sha256(new TextEncoder().encode(label)));\n}\n\nexport function deriveOrganizationTrashSystemSlot(\n organizationId: string,\n): ContainerSystemSlot {\n return deriveOrganizationSystemSlot({\n namespace: ORGANIZATION_TRASH_SLOT_NAMESPACE,\n organizationId,\n });\n}\n\nexport const ContainerSystemSlotSchema = registerJsonSchemaFragment(\n z.custom<string>(\n (value) =>\n typeof value === \"string\" && CONTAINER_SYSTEM_SLOT_PATTERN.test(value),\n ),\n {\n pattern: CONTAINER_SYSTEM_SLOT_PATTERN.source,\n type: \"string\",\n },\n);\n\nexport type ContainerSystemSlot = z.infer<typeof ContainerSystemSlotSchema>;\n\nexport function isContainerSystemSlot(\n value: unknown,\n): value is ContainerSystemSlot {\n return ContainerSystemSlotSchema.safeParse(value).success;\n}\n\nexport function isNullableContainerSystemSlot(\n value: unknown,\n): value is ContainerSystemSlot | null {\n return value === null || isContainerSystemSlot(value);\n}\n\nexport async function deriveOrganizationRosterProfileContainerSystemSlot(input: {\n readonly organizationId: string;\n}): Promise<ContainerSystemSlot> {\n return deriveOrganizationSystemSlot({\n namespace: \"tearleads.organization-roster-profiles\",\n organizationId: input.organizationId,\n });\n}\n\nexport async function deriveOrganizationMetadataContainerSystemSlot(input: {\n readonly organizationId: string;\n}): Promise<ContainerSystemSlot> {\n return deriveOrganizationSystemSlot({\n namespace: \"tearleads.organization-metadata\",\n organizationId: input.organizationId,\n });\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, 500, 503] | readonly [400, 401, 500];
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,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,qCAAqC,GACtC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,kCAAkC,EAClC,sCAAsC,EACtC,4BAA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AC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,mBAAmB,CAAC;IACnE,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,qCAAqC;IAC3C,gBAAgB,EAAE;QAChB,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,4BAA4B;QACjC,GAAG,EAAE,mBAAmB;KACzB;IACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAChC,EAAE,EAAE,8BAA8B;IAClC,OAAO,EAAE,gCAAgC;IACzC,WAAW,EACT,sUAAsU;IACxU,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC;IAC1B,IAAI,EAAE,gCAAgC;IACtC,SAAS,EAAE,EAAE,GAAG,EAAE,sCAAsC,EAAE;IAC1D,kBAAkB,EAAE,qCAAqC;CAC1D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qCAAqC,GAAG,yBAAyB,CAAC;AAC/E,MAAM,CAAC,MAAM,4CAA4C,GACvD,mCAAmC,CAAC;AACtC,MAAM,CAAC,MAAM,6CAA6C,GACxD,oCAAoC,CAAC;AACvC,MAAM,CAAC,MAAM,0CAA0C,GACrD,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,2CAA2C,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 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 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
+ {"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,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,qCAAqC,GACtC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,kCAAkC,EAClC,sCAAsC,EACtC,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oCAAoC,EACpC,wCAAwC,GACzC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEhC,SAAS,+BAA+B;IACtC,OAAO,0BAA0B,CAC/B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,CACL,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;YAC5B,MAAM,GAAG,CAAC;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CAAC,MAAM,6CAA6C,GACxD,oCAAoC,CAAC;AACvC,MAAM,CAAC,MAAM,0CAA0C,GACrD,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,2CAA2C,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), [