@tearleads/client-sdk 0.1.58 → 0.1.60

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 (477) hide show
  1. package/Tearleads.d.ts +17 -17
  2. package/Tearleads.js +15 -15
  3. package/Tearleads.js.map +1 -1
  4. package/client/{blobs.d.ts → blobs/index.d.ts} +1 -1
  5. package/client/{blobs.js → blobs/index.js} +3 -3
  6. package/client/blobs/index.js.map +1 -0
  7. package/client/{containerDocumentDiscovery.js → containerContents/documentDiscovery.js} +11 -11
  8. package/client/containerContents/documentDiscovery.js.map +1 -0
  9. package/client/{containerContents.d.ts → containerContents/index.d.ts} +13 -13
  10. package/client/{containerContents.js → containerContents/index.js} +18 -18
  11. package/client/containerContents/index.js.map +1 -0
  12. package/client/{containerContentsTypes.d.ts → containerContents/types.d.ts} +14 -14
  13. package/client/containerContents/types.js +2 -0
  14. package/client/containerContents/types.js.map +1 -0
  15. package/client/{deviceFirst.d.ts → deviceFirst/index.d.ts} +7 -7
  16. package/client/{deviceFirst.js → deviceFirst/index.js} +11 -11
  17. package/client/deviceFirst/index.js.map +1 -0
  18. package/client/{reconciledDocumentContentPull.js → deviceFirst/reconciledDocumentContentPull.js} +1 -1
  19. package/client/deviceFirst/reconciledDocumentContentPull.js.map +1 -0
  20. package/client/{documents.d.ts → documents/index.d.ts} +5 -5
  21. package/client/{documents.js → documents/index.js} +5 -5
  22. package/client/documents/index.js.map +1 -0
  23. package/client/{identity.d.ts → identity/index.d.ts} +2 -2
  24. package/client/{identity.js → identity/index.js} +5 -5
  25. package/client/identity/index.js.map +1 -0
  26. package/client/{identityKeyPackage.d.ts → identity/keyPackage.d.ts} +1 -1
  27. package/client/{identityKeyPackage.js → identity/keyPackage.js} +4 -4
  28. package/client/identity/keyPackage.js.map +1 -0
  29. package/client/{userIdentities.d.ts → identity/userIdentities.d.ts} +2 -2
  30. package/client/{userIdentities.js → identity/userIdentities.js} +4 -4
  31. package/client/identity/userIdentities.js.map +1 -0
  32. package/client/index.d.ts +18 -18
  33. package/client/index.js +9 -9
  34. package/client/index.js.map +1 -1
  35. package/client/organizations/currentPrincipalMutations.js.map +1 -1
  36. package/client/organizations/index.d.ts +2 -2
  37. package/client/organizations/index.js.map +1 -1
  38. package/client/organizations/organizationAccessRestoration.js.map +1 -1
  39. package/client/organizations/organizationDataUsage.d.ts +1 -1
  40. package/client/organizations/organizationDataUsage.js.map +1 -1
  41. package/client/organizations/organizationGroupNameHydration.js.map +1 -1
  42. package/client/organizations/organizationGroupPresentation.d.ts +1 -1
  43. package/client/organizations/organizationGroupPresentation.js.map +1 -1
  44. package/client/organizations/organizationMetadataProfileSync.js +1 -1
  45. package/client/organizations/organizationMetadataProfileSync.js.map +1 -1
  46. package/client/organizations/organizationReadModels.d.ts +1 -1
  47. package/client/organizations/organizationReadModels.js.map +1 -1
  48. package/client/organizations/organizationWorkflowRuntime.js.map +1 -1
  49. package/client/organizations/organizationsTypes.d.ts +1 -1
  50. package/client/organizations/organizationsTypes.js.map +1 -1
  51. package/client/organizations/principalContainerMutations.js.map +1 -1
  52. package/client/organizations/principalMutationRecovery.d.ts +1 -1
  53. package/client/organizations/principalMutationRecovery.js.map +1 -1
  54. package/client/organizations/principalMutationScope.js.map +1 -1
  55. package/client/organizations/principalMutations.d.ts +2 -2
  56. package/client/organizations/principalMutations.js.map +1 -1
  57. package/client/root/index.d.ts +1 -1
  58. package/client/root/index.js.map +1 -1
  59. package/client/{database.d.ts → runtime/database.d.ts} +1 -1
  60. package/client/{database.js → runtime/database.js} +1 -1
  61. package/client/runtime/database.js.map +1 -0
  62. package/client/{principalHistoryProtection.d.ts → runtime/principalHistoryProtection.d.ts} +1 -1
  63. package/client/{principalHistoryProtection.js → runtime/principalHistoryProtection.js} +2 -2
  64. package/client/runtime/principalHistoryProtection.js.map +1 -0
  65. package/client/{principalMutationApi.d.ts → runtime/principalMutationApi.d.ts} +4 -4
  66. package/client/{principalMutationApi.js → runtime/principalMutationApi.js} +2 -2
  67. package/client/runtime/principalMutationApi.js.map +1 -0
  68. package/client/{principalMutationDispatch.js → runtime/principalMutationDispatch.js} +2 -2
  69. package/client/runtime/principalMutationDispatch.js.map +1 -0
  70. package/client/runtime/rootContainerAdoption.js.map +1 -0
  71. package/client/{workflowRuntime.d.ts → runtime/workflowRuntime.d.ts} +12 -12
  72. package/client/{workflowRuntime.js → runtime/workflowRuntime.js} +5 -5
  73. package/client/runtime/workflowRuntime.js.map +1 -0
  74. package/client/{securityIncidents.d.ts → securityIncidents/index.d.ts} +3 -3
  75. package/client/{securityIncidents.js → securityIncidents/index.js} +5 -5
  76. package/client/securityIncidents/index.js.map +1 -0
  77. package/client/session/index.js +1 -1
  78. package/client/session/index.js.map +1 -1
  79. package/client/session/sessionIdentityTrust.d.ts +1 -1
  80. package/client/session/sessionLoginRefusal.js.map +1 -1
  81. package/client/session/sessionOrganizationCreation.js.map +1 -1
  82. package/client/session/sessionPurgeRecovery.js.map +1 -1
  83. package/client/session/sessionRootAuthority.js.map +1 -1
  84. package/client/session/sessionTypes.d.ts +3 -3
  85. package/client/session/sessionTypes.js.map +1 -1
  86. package/data/blobs/createBlobStore.d.ts +1 -1
  87. package/data/blobs/createBlobStore.js.map +1 -1
  88. package/data/blobs/encryptedBlobByteSource.js +1 -1
  89. package/data/blobs/encryptedBlobByteSource.js.map +1 -1
  90. package/data/blobs/encryptedBlobEnvelope.d.ts +1 -1
  91. package/data/blobs/encryptedBlobEnvelope.js +2 -2
  92. package/data/blobs/encryptedBlobEnvelope.js.map +1 -1
  93. package/data/blobs/encryptedBlobStore.d.ts +1 -1
  94. package/data/blobs/encryptedBlobStore.js +1 -1
  95. package/data/blobs/encryptedBlobStore.js.map +1 -1
  96. package/data/blobs/memoryBlobStore.d.ts +1 -1
  97. package/data/blobs/memoryBlobStore.js +1 -1
  98. package/data/blobs/memoryBlobStore.js.map +1 -1
  99. package/data/blobs/opfsBlobStore.d.ts +1 -1
  100. package/data/blobs/opfsBlobStore.js +1 -1
  101. package/data/blobs/opfsBlobStore.js.map +1 -1
  102. package/data/containers/containerMetadataDocument.js +1 -1
  103. package/data/containers/containerMetadataDocument.js.map +1 -1
  104. package/data/containers/shared/events.js +1 -1
  105. package/data/containers/shared/events.js.map +1 -1
  106. package/data/containers/shared/heldContainerHeads.js +1 -1
  107. package/data/containers/shared/heldContainerHeads.js.map +1 -1
  108. package/data/containers/shared/mutationAcknowledgement.js +1 -1
  109. package/data/containers/shared/mutationAcknowledgement.js.map +1 -1
  110. package/data/containers/shared/principalPolicies.js +1 -1
  111. package/data/containers/shared/principalPolicies.js.map +1 -1
  112. package/data/containers/shared/readers.js +2 -2
  113. package/data/containers/shared/readers.js.map +1 -1
  114. package/data/documents/attachmentContentIdentity.js +1 -1
  115. package/data/documents/attachmentContentIdentity.js.map +1 -1
  116. package/data/documents/blob/shared/blobEnvelopeStream.js.map +1 -1
  117. package/data/documents/blob/shared/blobSourceSnapshot.d.ts +1 -1
  118. package/data/documents/blob/shared/blobSourceSnapshot.js.map +1 -1
  119. package/data/documents/blob/shared/chunkedBlobCrypto.js.map +1 -1
  120. package/data/documents/blob/shared/encryptedUploadParts.js.map +1 -1
  121. package/data/documents/blob/shared/events.js +1 -1
  122. package/data/documents/blob/shared/events.js.map +1 -1
  123. package/data/documents/blob/shared/types.d.ts +2 -2
  124. package/data/documents/blob/shared/types.js.map +1 -1
  125. package/data/documents/shared/containerKekPathHistory.js +1 -1
  126. package/data/documents/shared/containerKekPathHistory.js.map +1 -1
  127. package/data/documents/shared/containerKekPathVerification.d.ts +1 -1
  128. package/data/documents/shared/containerKekPathVerification.js +1 -1
  129. package/data/documents/shared/events.js +1 -1
  130. package/data/documents/shared/events.js.map +1 -1
  131. package/data/documents/shared/manifestBundleReaders.js +2 -2
  132. package/data/documents/shared/manifestBundleReaders.js.map +1 -1
  133. package/data/documents/shared/projection.d.ts +1 -1
  134. package/data/documents/shared/projection.js +2 -2
  135. package/data/documents/shared/projection.js.map +1 -1
  136. package/data/documents/shared/projectionContentKeys.d.ts +1 -1
  137. package/data/documents/shared/readers.js +3 -3
  138. package/data/documents/shared/readers.js.map +1 -1
  139. package/data/documents/shared/stableDocumentId.js +1 -1
  140. package/data/documents/shared/stableDocumentId.js.map +1 -1
  141. package/data/documents/shared/types.d.ts +1 -1
  142. package/data/documents/shared/types.js +1 -1
  143. package/data/{keyingCanonicalJson.js → keying/canonicalJson.js} +3 -3
  144. package/data/keying/canonicalJson.js.map +1 -0
  145. package/data/keyingProjectionVerification/bundleVerification.js +1 -1
  146. package/data/keyingProjectionVerification/bundleVerification.js.map +1 -1
  147. package/data/keyingProjectionVerification/containerAncestorCitations.js +1 -1
  148. package/data/keyingProjectionVerification/containerAncestorCitations.js.map +1 -1
  149. package/data/keyingProjectionVerification/containerManifestVerification.js +1 -1
  150. package/data/keyingProjectionVerification/containerManifestVerification.js.map +1 -1
  151. package/data/keyingProjectionVerification/documentManifestVerification.js +1 -1
  152. package/data/keyingProjectionVerification/documentManifestVerification.js.map +1 -1
  153. package/data/keyingProjectionVerification/documentPurgeDocumentChainVerification.js +1 -1
  154. package/data/keyingProjectionVerification/documentPurgeDocumentChainVerification.js.map +1 -1
  155. package/data/keyingProjectionVerification/error.js +1 -1
  156. package/data/keyingProjectionVerification/error.js.map +1 -1
  157. package/data/keyingProjectionVerification/index.d.ts +9 -0
  158. package/data/{keyingProjectionVerification.js → keyingProjectionVerification/index.js} +8 -8
  159. package/data/keyingProjectionVerification/index.js.map +1 -0
  160. package/data/keyingProjectionVerification/principalPolicyCache.js +1 -1
  161. package/data/keyingProjectionVerification/principalPolicyCache.js.map +1 -1
  162. package/data/keyingProjectionVerification/principalPolicyVerification.js +1 -1
  163. package/data/keyingProjectionVerification/principalPolicyVerification.js.map +1 -1
  164. package/data/keyingProjectionVerification/readers.d.ts +1 -1
  165. package/data/keyingProjectionVerification/readers.js +3 -3
  166. package/data/keyingProjectionVerification/readers.js.map +1 -1
  167. package/data/keyingProjectionVerification/userKeyResolver.d.ts +1 -1
  168. package/data/keyingProjectionVerification/userKeyResolver.js.map +1 -1
  169. package/data/persistence/containers/containerPersistence.js +1 -1
  170. package/data/persistence/containers/containerPersistence.js.map +1 -1
  171. package/data/persistence/documents/documentDiscoveryCandidate.js +1 -1
  172. package/data/persistence/documents/documentDiscoveryCandidate.js.map +1 -1
  173. package/data/persistence/documents/documentDiscoveryEvidencePersistence.js +1 -1
  174. package/data/persistence/documents/documentDiscoveryEvidencePersistence.js.map +1 -1
  175. package/data/persistence/documents/internal/documentProjectionRows.js +1 -1
  176. package/data/persistence/documents/internal/documentProjectionRows.js.map +1 -1
  177. package/data/persistence/documents/internal/documentRows.js +1 -1
  178. package/data/persistence/documents/internal/documentRows.js.map +1 -1
  179. package/data/persistence/principalPolicyBundleIntegrity.js +1 -1
  180. package/data/persistence/principalPolicyBundleIntegrity.js.map +1 -1
  181. package/data/persistence/principalPolicyReferenceCheckpoint.js +1 -1
  182. package/data/persistence/principalPolicyReferenceCheckpoint.js.map +1 -1
  183. package/data/persistence/principalPolicyReferenceIndexPersistence.js +1 -1
  184. package/data/persistence/principalPolicyReferenceIndexPersistence.js.map +1 -1
  185. package/data/persistence/principalPolicyReferencePersistence.js +1 -1
  186. package/data/persistence/principalPolicyReferencePersistence.js.map +1 -1
  187. package/data/persistence/securityIncidentPersistence.js.map +1 -1
  188. package/data/persistence/verifiedPrincipalPolicyBundle.js +1 -1
  189. package/data/persistence/verifiedPrincipalPolicyBundle.js.map +1 -1
  190. package/data/persistence/verifiedPrincipalPolicyCurrent.js +1 -1
  191. package/data/persistence/verifiedPrincipalPolicyCurrent.js.map +1 -1
  192. package/data/principals/principalMutationJournal.js +1 -1
  193. package/data/principals/principalMutationJournal.js.map +1 -1
  194. package/data/{securityIncidents.d.ts → shared/securityIncidents.d.ts} +1 -1
  195. package/data/sqlite/documentRecordPersistence.js +1 -1
  196. package/data/sqlite/documentRecordPersistence.js.map +1 -1
  197. package/data/sync/crdtPeerSeed.d.ts +18 -0
  198. package/data/sync/originatedDocuments.d.ts +1 -1
  199. package/data/sync/originatedDocuments.js.map +1 -1
  200. package/data/sync/syncCoordinator.d.ts +1 -1
  201. package/data/sync/syncCoordinator.js.map +1 -1
  202. package/package.json +1 -1
  203. package/stores/container-contents/backgroundHydration.js +1 -1
  204. package/stores/container-contents/backgroundHydration.js.map +1 -1
  205. package/stores/container-contents/containerContentsStore.d.ts +1 -1
  206. package/stores/container-contents/containerContentsStore.js.map +1 -1
  207. package/stores/container-contents/localRefresh.js +1 -1
  208. package/stores/container-contents/localRefresh.js.map +1 -1
  209. package/stores/container-contents/remoteContainerIngestion.js +1 -1
  210. package/stores/container-contents/remoteContainerIngestion.js.map +1 -1
  211. package/stores/container-contents/remoteWriteQueue.js +1 -1
  212. package/stores/container-contents/remoteWriteQueue.js.map +1 -1
  213. package/stores/container-contents/systemContainerHydration.js +1 -1
  214. package/stores/container-contents/systemContainerHydration.js.map +1 -1
  215. package/stores/container-contents/utils.js +1 -1
  216. package/stores/container-contents/utils.js.map +1 -1
  217. package/stores/documents/documentStore/attachmentIntents.js +1 -1
  218. package/stores/documents/documentStore/attachmentIntents.js.map +1 -1
  219. package/stores/documents/documentStore/attachmentSourceUpload.js.map +1 -1
  220. package/stores/documents/documentStore/attachmentStaging.js +1 -1
  221. package/stores/documents/documentStore/attachmentStaging.js.map +1 -1
  222. package/stores/documents/documentStore/attachmentUploadLane.js.map +1 -1
  223. package/stores/documents/documentStore/persistence.js +2 -2
  224. package/stores/documents/documentStore/persistence.js.map +1 -1
  225. package/stores/documents/documentStore/state.js +1 -1
  226. package/stores/documents/documentStore/state.js.map +1 -1
  227. package/stores/documents/documentStore/storedDocument.js +1 -1
  228. package/stores/documents/documentStore/storedDocument.js.map +1 -1
  229. package/stores/documents/documentStore/syncAttachments.js.map +1 -1
  230. package/stores/documents/documentStore.d.ts +1 -1
  231. package/stores/documents/documentStore.js.map +1 -1
  232. package/stores/documents/registry.d.ts +1 -1
  233. package/stores/documents/registry.js.map +1 -1
  234. package/stores/documents/types.d.ts +1 -1
  235. package/stores/documents/types.js.map +1 -1
  236. package/stores/local-projection/registry.d.ts +1 -1
  237. package/stores/local-projection/registry.js.map +1 -1
  238. package/sync/reconciliation/serviceTypes.d.ts +1 -1
  239. package/sync/reconciliation/serviceTypes.js.map +1 -1
  240. package/sync/reconciliation/triggers.d.ts +1 -1
  241. package/sync/reconciliation/triggers.js.map +1 -1
  242. package/workflows/blobs/attachmentBindingVerification.js +2 -2
  243. package/workflows/blobs/attachmentBindingVerification.js.map +1 -1
  244. package/workflows/blobs/blobChunkDecryption.js.map +1 -1
  245. package/workflows/blobs/decrypt.d.ts +1 -1
  246. package/workflows/blobs/decrypt.js +2 -2
  247. package/workflows/blobs/decrypt.js.map +1 -1
  248. package/workflows/blobs/detach.js +2 -2
  249. package/workflows/blobs/detach.js.map +1 -1
  250. package/workflows/blobs/hydrate.d.ts +3 -3
  251. package/workflows/blobs/hydrate.js +1 -1
  252. package/workflows/blobs/hydrate.js.map +1 -1
  253. package/workflows/blobs/hydrationResults.js.map +1 -1
  254. package/workflows/blobs/index.d.ts +2 -2
  255. package/workflows/blobs/index.js +1 -1
  256. package/workflows/blobs/index.js.map +1 -1
  257. package/workflows/blobs/multipartFirstParts.js.map +1 -1
  258. package/workflows/blobs/retainedAttachmentVerification.js +1 -1
  259. package/workflows/blobs/upload.js +3 -3
  260. package/workflows/blobs/upload.js.map +1 -1
  261. package/workflows/container-contents/container-state/createAdoption.js +1 -1
  262. package/workflows/container-contents/container-state/createAdoption.js.map +1 -1
  263. package/workflows/container-contents/container-state/createChild.js +1 -1
  264. package/workflows/container-contents/container-state/createChild.js.map +1 -1
  265. package/workflows/container-contents/container-state/createIntentSync.js +1 -1
  266. package/workflows/container-contents/container-state/createIntentSync.js.map +1 -1
  267. package/workflows/container-contents/container-state/groupGrantVerification.js +1 -1
  268. package/workflows/container-contents/container-state/moveIntentSync.js +1 -1
  269. package/workflows/container-contents/container-state/moveIntentSync.js.map +1 -1
  270. package/workflows/container-contents/container-state/purgeTreeScope.js +1 -1
  271. package/workflows/container-contents/container-state/purgeTreeScope.js.map +1 -1
  272. package/workflows/container-contents/container-state/share.js +1 -1
  273. package/workflows/container-contents/documentDiscoveryInputs.js +1 -1
  274. package/workflows/container-contents/documentDiscoveryInputs.js.map +1 -1
  275. package/workflows/container-contents/documentInfo.d.ts +1 -1
  276. package/workflows/container-contents/documentInfo.js.map +1 -1
  277. package/workflows/container-contents/documentLinks.d.ts +1 -1
  278. package/workflows/container-contents/documentLinks.js +1 -1
  279. package/workflows/container-contents/documentLinks.js.map +1 -1
  280. package/workflows/container-contents/documentMoveIntentSync.js +1 -1
  281. package/workflows/container-contents/documentMoveIntentSync.js.map +1 -1
  282. package/workflows/container-contents/documentPurge.d.ts +1 -1
  283. package/workflows/container-contents/documentPurge.js +1 -1
  284. package/workflows/container-contents/documentPurge.js.map +1 -1
  285. package/workflows/container-contents/documentQueries/rows.js +1 -1
  286. package/workflows/container-contents/documentQueries/rows.js.map +1 -1
  287. package/workflows/container-contents/metadata.d.ts +1 -1
  288. package/workflows/container-contents/metadataMutationPreparation.js +1 -1
  289. package/workflows/container-contents/metadataMutationPreparation.js.map +1 -1
  290. package/workflows/container-contents/metadataRemoteSync.d.ts +1 -1
  291. package/workflows/container-contents/metadataSyncErrors.js.map +1 -1
  292. package/workflows/container-contents/projectionKeys.d.ts +1 -1
  293. package/workflows/container-contents/syncLane.d.ts +1 -1
  294. package/workflows/container-contents/syncLane.js.map +1 -1
  295. package/workflows/containers/child/carriedDescendantRekeys.js +1 -1
  296. package/workflows/containers/child/create.d.ts +1 -1
  297. package/workflows/containers/child/create.js +2 -2
  298. package/workflows/containers/child/create.js.map +1 -1
  299. package/workflows/containers/child/createProjection.js +1 -1
  300. package/workflows/containers/child/createProjection.js.map +1 -1
  301. package/workflows/containers/child/createSubmission.d.ts +2 -2
  302. package/workflows/containers/child/createSubmission.js.map +1 -1
  303. package/workflows/containers/child/move.d.ts +2 -2
  304. package/workflows/containers/child/move.js +2 -2
  305. package/workflows/containers/child/move.js.map +1 -1
  306. package/workflows/containers/child/moveWraps.js +1 -1
  307. package/workflows/containers/child/mutationRequestCore.js +1 -1
  308. package/workflows/containers/child/mutationRequestCore.js.map +1 -1
  309. package/workflows/containers/child/mutationSubmit.js.map +1 -1
  310. package/workflows/containers/child/recite.js.map +1 -1
  311. package/workflows/containers/child/recitePlan.js +1 -1
  312. package/workflows/containers/child/recitePlan.js.map +1 -1
  313. package/workflows/containers/child/rekey.d.ts +1 -1
  314. package/workflows/containers/child/rekey.js +2 -2
  315. package/workflows/containers/child/rekey.js.map +1 -1
  316. package/workflows/containers/child/rekeyProjection.js +1 -1
  317. package/workflows/containers/child/rekeyProjection.js.map +1 -1
  318. package/workflows/containers/child/rekeyRemote.d.ts +2 -2
  319. package/workflows/containers/child/rekeyRemote.js.map +1 -1
  320. package/workflows/containers/child/revoke.d.ts +2 -2
  321. package/workflows/containers/child/revoke.js +2 -2
  322. package/workflows/containers/child/revoke.js.map +1 -1
  323. package/workflows/containers/child/rotationPrincipalPolicies.js +1 -1
  324. package/workflows/containers/child/runtimeCurrentGroupShare.js +1 -1
  325. package/workflows/containers/child/share.d.ts +2 -2
  326. package/workflows/containers/child/share.js +1 -1
  327. package/workflows/containers/child/share.js.map +1 -1
  328. package/workflows/containers/child/shareAncestorRepair.js.map +1 -1
  329. package/workflows/containers/child/shareMaterialization.d.ts +1 -1
  330. package/workflows/containers/child/sharePlanCore.d.ts +1 -1
  331. package/workflows/containers/child/sharePlanCore.js +1 -1
  332. package/workflows/containers/root/create.js +1 -1
  333. package/workflows/containers/root/create.js.map +1 -1
  334. package/workflows/containers/root/initialGroupPolicy.js +1 -1
  335. package/workflows/containers/root/initialGroupPolicy.js.map +1 -1
  336. package/workflows/documents/create.d.ts +1 -1
  337. package/workflows/documents/create.js +1 -1
  338. package/workflows/documents/documentMutationPreparation.js +1 -1
  339. package/workflows/documents/documentMutationPreparation.js.map +1 -1
  340. package/workflows/documents/historyContent.js +1 -1
  341. package/workflows/documents/historyContent.js.map +1 -1
  342. package/workflows/documents/linkSet.js +1 -1
  343. package/workflows/documents/linkSet.js.map +1 -1
  344. package/workflows/documents/linkSetAuthority.js +1 -1
  345. package/workflows/documents/linkSetBlobRewraps.js +2 -2
  346. package/workflows/documents/linkSetBlobRewraps.js.map +1 -1
  347. package/workflows/documents/linkSetRemote.d.ts +1 -1
  348. package/workflows/documents/linkSetRemote.js +1 -1
  349. package/workflows/documents/orphanBlobReclaims.js +1 -1
  350. package/workflows/documents/orphanBlobReclaims.js.map +1 -1
  351. package/workflows/documents/projectionKeys.d.ts +1 -1
  352. package/workflows/documents/purge.d.ts +1 -1
  353. package/workflows/documents/purge.js +2 -2
  354. package/workflows/documents/purge.js.map +1 -1
  355. package/workflows/documents/readOnlySync.d.ts +1 -1
  356. package/workflows/documents/readOnlySync.js +1 -1
  357. package/workflows/documents/readOnlySync.js.map +1 -1
  358. package/workflows/documents/sync.js +1 -1
  359. package/workflows/documents/syncContainerRekeyPreparation.js +1 -1
  360. package/workflows/documents/syncLane.d.ts +1 -1
  361. package/workflows/documents/syncLane.js.map +1 -1
  362. package/workflows/documents/syncPlanIdentity.js +1 -1
  363. package/workflows/documents/syncPlanIdentity.js.map +1 -1
  364. package/workflows/documents/syncRepairAccess.js +1 -1
  365. package/workflows/documents/syncSubmittedResult.js +1 -1
  366. package/workflows/organizations/authoredPrincipalPolicyWarmer.js +1 -1
  367. package/workflows/organizations/authoredPrincipalPolicyWarmer.js.map +1 -1
  368. package/workflows/organizations/containerGrantRevocation.d.ts +2 -2
  369. package/workflows/organizations/containerGrantRevocation.js.map +1 -1
  370. package/workflows/organizations/createCurrentOrganizationGroup.js.map +1 -1
  371. package/workflows/organizations/currentOrganizationGroupNames.js.map +1 -1
  372. package/workflows/organizations/currentPolicyMutationAcknowledgement.js +1 -1
  373. package/workflows/organizations/currentPolicyMutationAcknowledgement.js.map +1 -1
  374. package/workflows/organizations/groupCreation.d.ts +1 -1
  375. package/workflows/organizations/groupCreation.js.map +1 -1
  376. package/workflows/organizations/groupMetadataAccess.d.ts +1 -1
  377. package/workflows/organizations/groupMetadataContainerAuthority.js.map +1 -1
  378. package/workflows/organizations/groupMetadataRuntime.js.map +1 -1
  379. package/workflows/organizations/groupNameUniqueness.js.map +1 -1
  380. package/workflows/organizations/groupPolicyMutationAcknowledgement.js +1 -1
  381. package/workflows/organizations/groupPolicyMutationAcknowledgement.js.map +1 -1
  382. package/workflows/organizations/groupPolicyRequests.js.map +1 -1
  383. package/workflows/organizations/loadPolicyHistoryDetails.js.map +1 -1
  384. package/workflows/organizations/organizationGroupDirectory.js.map +1 -1
  385. package/workflows/organizations/organizationProfile.js +1 -1
  386. package/workflows/organizations/organizationProfile.js.map +1 -1
  387. package/workflows/organizations/policyHistoryCache.js.map +1 -1
  388. package/workflows/organizations/principalContainerRematerialization.js +1 -1
  389. package/workflows/organizations/principalContainerRematerializationPlanning.js.map +1 -1
  390. package/workflows/organizations/principalMutationJournalManagement.js +1 -1
  391. package/workflows/organizations/principalMutationJournalManagement.js.map +1 -1
  392. package/workflows/organizations/principalMutationReceipt.js +1 -1
  393. package/workflows/organizations/principalMutationReceipt.js.map +1 -1
  394. package/workflows/organizations/principalPolicy.d.ts +1 -1
  395. package/workflows/organizations/principalPolicy.js.map +1 -1
  396. package/workflows/organizations/principalPolicyReceiptArtifacts.js +1 -1
  397. package/workflows/organizations/principalPolicyReceiptArtifacts.js.map +1 -1
  398. package/workflows/organizations/rosterProfileContainer.js +1 -1
  399. package/workflows/organizations/rosterProfileContainer.js.map +1 -1
  400. package/workflows/principals/policyCache.d.ts +1 -1
  401. package/workflows/principals/policyCache.js +2 -2
  402. package/workflows/principals/policyCache.js.map +1 -1
  403. package/workflows/principals/runtimePolicyRecovery.js.map +1 -1
  404. package/workflows/principals/runtimePolicyWarmer.js +1 -1
  405. package/workflows/principals/runtimePolicyWarmer.js.map +1 -1
  406. package/workflows/registration/persistRegistrationBootstrap.js +1 -1
  407. package/workflows/registration/persistRegistrationBootstrap.js.map +1 -1
  408. package/workflows/runtimeInput.d.ts +3 -3
  409. package/workflows/runtimeInput.js.map +1 -1
  410. package/workflows/sync/index.d.ts +2 -1
  411. package/workflows/sync/index.js +2 -1
  412. package/workflows/sync/index.js.map +1 -1
  413. package/client/blobs.js.map +0 -1
  414. package/client/containerContents.js.map +0 -1
  415. package/client/containerContentsTypes.js +0 -2
  416. package/client/containerContentsTypes.js.map +0 -1
  417. package/client/containerDocumentDiscovery.js.map +0 -1
  418. package/client/database.js.map +0 -1
  419. package/client/deviceFirst.js.map +0 -1
  420. package/client/documents.js.map +0 -1
  421. package/client/identity.js.map +0 -1
  422. package/client/identityKeyPackage.js.map +0 -1
  423. package/client/principalHistoryProtection.js.map +0 -1
  424. package/client/principalMutationApi.js.map +0 -1
  425. package/client/principalMutationDispatch.js.map +0 -1
  426. package/client/reconciledDocumentContentPull.js.map +0 -1
  427. package/client/rootContainerAdoption.js.map +0 -1
  428. package/client/securityIncidents.js.map +0 -1
  429. package/client/userIdentities.js.map +0 -1
  430. package/client/workflowRuntime.js.map +0 -1
  431. package/data/keyingCanonicalJson.js.map +0 -1
  432. package/data/keyingProjectionVerification.d.ts +0 -9
  433. package/data/keyingProjectionVerification.js.map +0 -1
  434. /package/client/{fileSaver.d.ts → host/fileSaver.d.ts} +0 -0
  435. /package/client/{fileSaver.js → host/fileSaver.js} +0 -0
  436. /package/client/{fileSaver.js.map → host/fileSaver.js.map} +0 -0
  437. /package/client/{logger.d.ts → host/logger.d.ts} +0 -0
  438. /package/client/{logger.js → host/logger.js} +0 -0
  439. /package/client/{logger.js.map → host/logger.js.map} +0 -0
  440. /package/client/{apiVersion.d.ts → runtime/apiVersion.d.ts} +0 -0
  441. /package/client/{apiVersion.js → runtime/apiVersion.js} +0 -0
  442. /package/client/{apiVersion.js.map → runtime/apiVersion.js.map} +0 -0
  443. /package/client/{events.d.ts → runtime/events.d.ts} +0 -0
  444. /package/client/{events.js → runtime/events.js} +0 -0
  445. /package/client/{events.js.map → runtime/events.js.map} +0 -0
  446. /package/client/{listenerSet.js → runtime/listenerSet.js} +0 -0
  447. /package/client/{listenerSet.js.map → runtime/listenerSet.js.map} +0 -0
  448. /package/client/{network.d.ts → runtime/network.d.ts} +0 -0
  449. /package/client/{network.js → runtime/network.js} +0 -0
  450. /package/client/{network.js.map → runtime/network.js.map} +0 -0
  451. /package/client/{principalMutationDeadline.js → runtime/principalMutationDeadline.js} +0 -0
  452. /package/client/{principalMutationDeadline.js.map → runtime/principalMutationDeadline.js.map} +0 -0
  453. /package/client/{rootContainerAdoption.js → runtime/rootContainerAdoption.js} +0 -0
  454. /package/client/{syncBillingGate.d.ts → runtime/syncBillingGate.d.ts} +0 -0
  455. /package/client/{syncBillingGate.js → runtime/syncBillingGate.js} +0 -0
  456. /package/client/{syncBillingGate.js.map → runtime/syncBillingGate.js.map} +0 -0
  457. /package/data/{blobContracts.d.ts → blobs/blobContracts.d.ts} +0 -0
  458. /package/data/{blobContracts.js → blobs/blobContracts.js} +0 -0
  459. /package/data/{blobContracts.js.map → blobs/blobContracts.js.map} +0 -0
  460. /package/data/{accessLevel.js → keying/accessLevel.js} +0 -0
  461. /package/data/{accessLevel.js.map → keying/accessLevel.js.map} +0 -0
  462. /package/data/{stableUuid.js → keying/stableUuid.js} +0 -0
  463. /package/data/{stableUuid.js.map → keying/stableUuid.js.map} +0 -0
  464. /package/data/{principalPolicyStates.js → principals/principalPolicyStates.js} +0 -0
  465. /package/data/{principalPolicyStates.js.map → principals/principalPolicyStates.js.map} +0 -0
  466. /package/data/{domainScope.d.ts → shared/domainScope.d.ts} +0 -0
  467. /package/data/{domainScope.js → shared/domainScope.js} +0 -0
  468. /package/data/{domainScope.js.map → shared/domainScope.js.map} +0 -0
  469. /package/data/{errorMessage.js → shared/errorMessage.js} +0 -0
  470. /package/data/{errorMessage.js.map → shared/errorMessage.js.map} +0 -0
  471. /package/data/{recordReaders.d.ts → shared/recordReaders.d.ts} +0 -0
  472. /package/data/{recordReaders.js → shared/recordReaders.js} +0 -0
  473. /package/data/{recordReaders.js.map → shared/recordReaders.js.map} +0 -0
  474. /package/data/{securityIncidents.js → shared/securityIncidents.js} +0 -0
  475. /package/data/{securityIncidents.js.map → shared/securityIncidents.js.map} +0 -0
  476. /package/data/{crdtPeerSeed.js → sync/crdtPeerSeed.js} +0 -0
  477. /package/data/{crdtPeerSeed.js.map → sync/crdtPeerSeed.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAGL,mCAAmC,EACnC,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,+BAA+B,GAGhC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAG3B,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kCAAkC,EAAE,MAAM,6DAA6D,CAAC;AACjH,OAAO,EAAE,oCAAoC,EAAE,MAAM,2DAA2D,CAAC;AACjH,OAAO,EAEL,uCAAuC,EACvC,2CAA2C,GAC5C,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,wCAAwC,EAAE,MAAM,wCAAwC,CAAC;AAElG,OAAO,EAAE,qCAAqC,EAAE,MAAM,iCAAiC,CAAC;AAgCxF,MAAM,UAAU,iBAAiB,CAC/B,cAA+B,EAC/B,iBAAoC;IAEpC,OAAO,IAAI,kBAAkB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AACnE,CAAC;AASD,SAAS,8BAA8B,CACr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E;gBAC1B,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC,eAAe,EAAE,CAAC;YACpD,CAAC;YACD,gBAAgB,EAAE,0BAA0B;YAC5C,qEAAqE;YACrE,wEAAwE;YACxE,QAAQ,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAC3B,wBAAwB,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC;SACnE,CAAC;IACJ,CAAC;CACF;AAED,8EAA8E;AAC9E,sEAAsE;AACtE,SAAS,wBAAwB,CAC/B,OAA8C,EAC9C,OAAe,EACf,KAAc;IAEd,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IACvC,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,cAA+B;IAE/B,OAAO,2CAA2C,CAChD,cAAc,CAAC,aAAa,EAAE,EAC9B,cAAc,CAAC,kBAAkB,CAClC,CAAC;AACJ,CAAC","sourcesContent":["import type { DomainScope } from \"../../data/shared/domainScope\";\nimport {\n disposeDomainSyncCoordinator,\n getOrCreateDomainSyncCoordinator,\n isDatabaseUnavailableError,\n} from \"../../data/sync/syncCoordinator\";\nimport {\n type ContainerContentsStore,\n type ContainerContentsStoreOptions,\n isAutomaticRootCatchupContainerNode,\n isReconcilableContainerNode,\n isRemoteBackedContainerNode,\n} from \"../../stores/container-contents\";\nimport { openDocumentStore } from \"../../stores/documents\";\nimport {\n requestRegisteredDocumentRemoteSync,\n subscribeToPersistedDocumentDeletions,\n subscribeToPersistedDocuments,\n} from \"../../stores/documents/registry\";\nimport {\n getOrCreateLocalProjectionStore,\n type LocalProjectionStore,\n type LocalProjectionView,\n} from \"../../stores/local-projection\";\nimport {\n connectReconciliationTriggers,\n createReconciliationService,\n type ReconciliationHost,\n type ReconciliationService,\n systemReconciliationClock,\n} from \"../../sync/reconciliation\";\nimport { listAllContainerDocumentIdsFromApi } from \"../../workflows/container-contents/containerDocumentListing\";\nimport { probeUndiscoveredRemoteDocumentBatch } from \"../../workflows/container-contents/documentHydrationProbe\";\nimport {\n type ContainerContentsStoreWorkflowRuntime,\n createContainerContentsDocumentsRuntime,\n createContainerContentsStoreWorkflowRuntime,\n} from \"../../workflows/container-contents/runtime\";\nimport type { ContainerContents } from \"../containerContents\";\nimport { discoverContainerDocumentLanesForRuntime } from \"../containerContents/documentDiscovery\";\nimport type { InternalRuntime } from \"../runtime/workflowRuntime\";\nimport { createReconciledDocumentContentPuller } from \"./reconciledDocumentContentPull\";\n\nexport type { LocalProjectionView } from \"../../stores/local-projection\";\n\n/** One domain scope's local read, local-write, and reconciliation handles. */\nexport interface DeviceFirstContainerContents {\n /**\n * Locally durable container tree and mutation store. Ordinary tree writes\n * update this store after local persistence and queue remote convergence in\n * the background; security-sensitive remote operations keep their explicit\n * online requirements.\n */\n readonly containerStore: ContainerContentsStore;\n /** Background remote reconciliation; never awaited for first paint. */\n readonly reconciler: ReconciliationService;\n /** Synchronously readable container/document projection. */\n readonly view: LocalProjectionView;\n}\n\n/**\n * Device-first facade. Opens a shared scope that pairs immediate local reads\n * and locally durable writes with background remote convergence.\n */\nexport interface DeviceFirst {\n /** Open all device-first handles for the current domain scope. */\n open(\n options?: ContainerContentsStoreOptions | undefined,\n ): DeviceFirstContainerContents;\n /** Stop the current scope's reconciler (if one was created) on teardown. */\n dispose(): void;\n}\n\nexport function createDeviceFirst(\n runtimeService: InternalRuntime,\n containerContents: ContainerContents,\n): DeviceFirst {\n return new DeviceFirstService(runtimeService, containerContents);\n}\n\ninterface DeviceFirstScopeEntry {\n contents: DeviceFirstContainerContents;\n disconnectReconciliationTriggers: () => void;\n unsubscribePersistedDocumentDeletions: () => void;\n unsubscribePersistedDocuments: () => void;\n}\n\nfunction createInitialDocumentProbeHost(\n runtimeService: InternalRuntime,\n domainScope: ReconciliationHost[\"domainScope\"],\n): Pick<\n ReconciliationHost,\n | \"listContainerDocumentIds\"\n | \"probeUndiscoveredDocumentsBatch\"\n | \"reportInitialDocumentProbeComplete\"\n> {\n return {\n listContainerDocumentIds: (containerId) => {\n const runtime = createDeviceFirstWorkflowRuntime(runtimeService);\n return listAllContainerDocumentIdsFromApi({\n apiClient: runtime.apiClient,\n containerId,\n reportErrors: false,\n });\n },\n probeUndiscoveredDocumentsBatch: async (input) => {\n const runtime = createDeviceFirstWorkflowRuntime(runtimeService);\n return probeUndiscoveredRemoteDocumentBatch({\n ...input,\n host: {\n documentWorkflowRuntime: (containerId) =>\n createContainerContentsDocumentsRuntime(runtime, containerId),\n openDocumentStore: (target) =>\n openDocumentStore(\n domainScope,\n target.localId,\n target.runtime,\n target.documentId,\n ),\n },\n runtime,\n });\n },\n reportInitialDocumentProbeComplete: (requestedCount) => {\n runtimeService\n .workflowInput()\n .util.log(\n `Initial document hydration probe requested ${requestedCount} syncs`,\n );\n },\n };\n}\n\nclass DeviceFirstService implements DeviceFirst {\n // A real Map (not WeakMap) so dispose() can iterate every scope seen this\n // session. A running reconciler holds event subscriptions that keep an idle,\n // stale-scope service (and its scope) reachable anyway, so WeakMap bought no\n // GC here; the entries are released explicitly on dispose().\n private readonly entriesByScope = new Map<\n DomainScope,\n DeviceFirstScopeEntry\n >();\n\n constructor(\n private readonly runtimeService: InternalRuntime,\n private readonly containerContents: ContainerContents,\n ) {}\n\n open(\n options?: ContainerContentsStoreOptions | undefined,\n ): DeviceFirstContainerContents {\n return this.getOrCreateEntry(options).contents;\n }\n\n dispose(): void {\n // Stop every reconciler created this session — not just the current\n // scope's. A scope change (e.g. anonymous -> authenticated) leaves the old\n // scope's reconciler subscribed and its coordinator pump live; tear them\n // all down. Force-stop each scope's coordinator (which runs the reconciler\n // lane) alongside stopping the service.\n for (const [domainScope, entry] of this.entriesByScope) {\n entry.contents.reconciler.stop();\n entry.disconnectReconciliationTriggers();\n entry.unsubscribePersistedDocumentDeletions();\n entry.unsubscribePersistedDocuments();\n disposeDomainSyncCoordinator(domainScope);\n }\n this.entriesByScope.clear();\n }\n\n private workflowRuntime(): ContainerContentsStoreWorkflowRuntime {\n return createDeviceFirstWorkflowRuntime(this.runtimeService);\n }\n\n private getOrCreateEntry(\n options?: ContainerContentsStoreOptions | undefined,\n ): DeviceFirstScopeEntry {\n const runtime = this.workflowRuntime();\n const domainScope = runtime.state.domainScope;\n const existing = this.entriesByScope.get(domainScope);\n if (existing) {\n // Do not call updateRuntime here: facade selectors run during React\n // render, and updateRuntime emits synchronously. Hosts drive runtime\n // updates through view.updateRuntime() from an effect instead.\n return existing;\n }\n\n const store = getOrCreateLocalProjectionStore({\n domainScope,\n runtime,\n options,\n });\n const service = createReconciliationService(\n this.createReconciliationHost(store, domainScope),\n );\n const disconnectReconciliationTriggers = connectReconciliationTriggers({\n service,\n store,\n });\n const unsubscribePersistedDocumentDeletions =\n subscribeToPersistedDocumentDeletions(domainScope, (localId) => {\n store.removePersistedDocument(localId);\n });\n const unsubscribePersistedDocuments = subscribeToPersistedDocuments(\n domainScope,\n (document, change) =>\n store.refreshPersistedDocument(document, change.placementChanged),\n );\n service.start();\n\n const view: LocalProjectionView = {\n getSnapshot: () => store.getSnapshot(),\n subscribe: (listener) => store.subscribe(listener),\n setActiveContainer: (containerId) =>\n store.setActiveContainer(containerId),\n updateRuntime: (nextRuntime) => store.updateRuntime(nextRuntime),\n };\n\n const entry: DeviceFirstScopeEntry = {\n contents: {\n containerStore: store.getContainerStore(),\n reconciler: service,\n view,\n },\n disconnectReconciliationTriggers,\n unsubscribePersistedDocumentDeletions,\n unsubscribePersistedDocuments,\n };\n this.entriesByScope.set(domainScope, entry);\n return entry;\n }\n\n private createReconciliationHost(\n store: LocalProjectionStore,\n domainScope: ReconciliationHost[\"domainScope\"],\n ): ReconciliationHost {\n const runtimeService = this.runtimeService;\n const containerContents = this.containerContents;\n const requestDocumentContentPull = createReconciledDocumentContentPuller({\n getContainer: (containerId) =>\n store\n .getSnapshot()\n .containers.find((container) => container.id === containerId) ?? null,\n pullDocumentContent: (input) =>\n containerContents.pullDocumentContent(input),\n requestRegisteredDocumentRemoteSync: (localId, documentId) =>\n requestRegisteredDocumentRemoteSync(domainScope, localId, documentId),\n });\n const canDiscoverContainerDocuments = (containerId: string) => {\n const container = store\n .getSnapshot()\n .containers.find((node) => node.id === containerId);\n return container ? isRemoteBackedContainerNode(container) : false;\n };\n const listKnownContainerIds = () => {\n // A local-first id is not listable yet and may still be racing its create\n // request. Once remote-backed, it participates normally; system contents\n // are especially important during rematerialization because this device\n // may not have authored them.\n const homeOrganizationId =\n runtimeService.workflowInput().auth.organizationId;\n return store\n .getSnapshot()\n .containers.flatMap((node) =>\n isReconcilableContainerNode(node, homeOrganizationId)\n ? [node.id]\n : [],\n );\n };\n const listAutomaticRootCatchupContainerIds = () => {\n const homeOrganizationId =\n runtimeService.workflowInput().auth.organizationId;\n return store\n .getSnapshot()\n .containers.flatMap((node) =>\n isAutomaticRootCatchupContainerNode(node, homeOrganizationId)\n ? [node.id]\n : [],\n );\n };\n return {\n clock: systemReconciliationClock,\n domainScope,\n registerLane: (key, config) =>\n getOrCreateDomainSyncCoordinator(domainScope).registerLane(key, config),\n canDiscoverContainerDocuments,\n getRuntimeStatus: () => {\n const input = runtimeService.workflowInput();\n return {\n dbStatus: input.infra.dbStatus,\n isAuthenticated: input.auth.isAuthenticated,\n online: input.state.online,\n };\n },\n listKnownContainerIds,\n // Root discovery can surface directly granted non-root containers, so\n // retain every regular container. Exclude only this identity's own system\n // children; cold/auth backfill and explicit full Refresh cover those.\n listAutomaticRootCatchupContainerIds,\n discoverContainerDocuments: (requests, onOutcome) =>\n discoverContainerDocumentLanesForRuntime({\n onOutcome,\n requests,\n runtimeService,\n }),\n loadContainerDelta: (containerId) =>\n store.loadContainerDelta(containerId),\n applyReconciled: (delta) => store.applyReconciled(delta),\n requestDocumentContentPull,\n ...createInitialDocumentProbeHost(runtimeService, domainScope),\n refreshTree: async () => {\n await store.getContainerStore().refresh();\n },\n refreshRootTree: async () => {\n await store.getContainerStore().refreshRootLane();\n },\n isIgnorableError: isDatabaseUnavailableError,\n // Resolve the runtime per call: it is rebuilt as the active identity\n // changes, and a reference captured here would report into a dead host.\n logError: (message, error) =>\n logReconciliationFailure(this.workflowRuntime(), message, error),\n };\n }\n}\n\n// Returns the host's result: both callbacks are declared `=> void` but may be\n// async, and the lane reporter only catches a rejection it is handed.\nfunction logReconciliationFailure(\n runtime: ContainerContentsStoreWorkflowRuntime,\n message: string,\n error: unknown,\n): unknown {\n const { log, logError } = runtime.util;\n return logError ? logError(message, error) : log(message);\n}\n\nexport function createDeviceFirstWorkflowRuntime(\n runtimeService: InternalRuntime,\n): ContainerContentsStoreWorkflowRuntime {\n return createContainerContentsStoreWorkflowRuntime(\n runtimeService.workflowInput(),\n runtimeService.adoptRootContainer,\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { isSystemContainerNode } from "../stores/container-contents/index.js";
1
+ import { isSystemContainerNode } from "../../stores/container-contents/index.js";
2
2
  function shouldForceDocument(force, documentIds, documentId) {
3
3
  return force && (!documentIds || documentIds.has(documentId));
4
4
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconciledDocumentContentPull.js","sourceRoot":"","sources":["reconciledDocumentContentPull.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAgBxE,SAAS,mBAAmB,CAC1B,KAAc,EACd,WAA4C,EAC5C,UAAkB;IAElB,OAAO,KAAK,IAAI,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qCAAqC,CACnD,IAAuC;IAEvC,4EAA4E;IAC5E,4EAA4E;IAC5E,kDAAkD;IAClD,MAAM,4BAA4B,GAAG,IAAI,GAAG,EAAkB,C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AC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { ContainerNode } from \"../../stores/container-contents\";\nimport { isSystemContainerNode } from \"../../stores/container-contents\";\nimport type { ReconciliationHost } from \"../../sync/reconciliation\";\n\ninterface ReconciledDocumentContentPullHost {\n readonly getContainer: (containerId: string) => ContainerNode | null;\n readonly pullDocumentContent: (input: {\n readonly containerId: string;\n readonly documentId: string;\n readonly localId: string;\n }) => void;\n readonly requestRegisteredDocumentRemoteSync: (\n localId: string,\n documentId: string,\n ) => void;\n}\n\nfunction shouldForceDocument(\n force: boolean,\n documentIds: ReadonlySet<string> | undefined,\n documentId: string,\n): boolean {\n return force && (!documentIds || documentIds.has(documentId));\n}\n\n/**\n * Routes reconciled summaries into the appropriate content-sync policy.\n *\n * System-container contents cannot rely on a mini-app opening them on this\n * device, especially during identity recovery. Pull each remote version once.\n * Ordinary documents stay lazy unless an explicit refresh asks an already-open\n * store to revalidate.\n */\nexport function createReconciledDocumentContentPuller(\n host: ReconciledDocumentContentPullHost,\n): ReconciliationHost[\"requestDocumentContentPull\"] {\n // Retain only the last observed version for each system-container document.\n // Keeping the version in the key would grow this cache for every historical\n // updatedAt value over the reconciler's lifetime.\n const pulledSystemDocumentVersions = new Map<string, string>();\n\n return (containerId, documents, force, documentIds) => {\n const systemContainer = isSystemContainerNode(\n host.getContainer(containerId) ?? { systemSlot: null },\n );\n\n for (const document of documents) {\n if (!document.documentId) {\n continue;\n }\n\n const forceDocument = shouldForceDocument(\n force,\n documentIds,\n document.documentId,\n );\n\n if (systemContainer) {\n // Container scope is significant: the same document can be linked into\n // multiple system containers whose keys establish different decryption\n // contexts for the transient store.\n const documentKey = `${containerId}:${document.documentId}`;\n if (\n pulledSystemDocumentVersions.get(documentKey) !== document.updatedAt\n ) {\n host.pullDocumentContent({\n containerId,\n documentId: document.documentId,\n localId: document.id,\n });\n pulledSystemDocumentVersions.set(documentKey, document.updatedAt);\n } else if (forceDocument) {\n // The first eager pull registers a document store before scheduling\n // its async sync. If that sync failed, a later explicit Refresh must\n // be able to retry the same server version without defeating normal\n // background dedupe.\n host.requestRegisteredDocumentRemoteSync(\n document.id,\n document.documentId,\n );\n }\n continue;\n }\n\n if (forceDocument) {\n host.requestRegisteredDocumentRemoteSync(\n document.id,\n document.documentId,\n );\n }\n }\n };\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { StoredDocumentKind } from "../data/documents/documentKinds.js";
2
- import type { DocumentSummaryList, DocumentSummarySort, DocumentSummarySortDirection, DocumentSummarySortKey, ListDocumentSummariesInput } from "../data/persistence/documents/types.js";
3
- import { DEFAULT_DOCUMENT_ID as DEFAULT_LOCAL_DOCUMENT_ID, type DocumentStore, type DocumentsRuntime, type PersistedDocumentListener } from "../stores/documents/index.js";
4
- import type { InternalRuntime } from "./workflowRuntime.js";
5
- export type { DocumentAttachmentStatus, DocumentAttachmentUpload, DocumentContextValue, DocumentStore, DocumentsRuntime, PersistedDocumentListener, } from "../stores/documents/index.js";
1
+ import type { StoredDocumentKind } from "../../data/documents/documentKinds.js";
2
+ import type { DocumentSummaryList, DocumentSummarySort, DocumentSummarySortDirection, DocumentSummarySortKey, ListDocumentSummariesInput } from "../../data/persistence/documents/types.js";
3
+ import { DEFAULT_DOCUMENT_ID as DEFAULT_LOCAL_DOCUMENT_ID, type DocumentStore, type DocumentsRuntime, type PersistedDocumentListener } from "../../stores/documents/index.js";
4
+ import type { InternalRuntime } from "../runtime/workflowRuntime.js";
5
+ export type { DocumentAttachmentStatus, DocumentAttachmentUpload, DocumentContextValue, DocumentStore, DocumentsRuntime, PersistedDocumentListener, } from "../../stores/documents/index.js";
6
6
  export type DocumentSortDirection = DocumentSummarySortDirection;
7
7
  export type DocumentSortKey = DocumentSummarySortKey;
8
8
  export type DocumentSort = DocumentSummarySort;
@@ -1,7 +1,7 @@
1
- import { DEFAULT_DOCUMENT_KIND } from "../data/documents/documentConstants.js";
2
- import { DEFAULT_DOCUMENT_ID as DEFAULT_LOCAL_DOCUMENT_ID, openDocumentStore, subscribeToPersistedDocuments, } from "../stores/documents/index.js";
3
- import { emitPersistedDocumentDeletion } from "../stores/documents/registry.js";
4
- import { createDocumentsWorkflowRuntime, defaultDocumentsPersistence, deletePersistedDocument, reclaimDocumentOrphanBlobs, } from "../workflows/documents/index.js";
1
+ import { DEFAULT_DOCUMENT_KIND } from "../../data/documents/documentConstants.js";
2
+ import { DEFAULT_DOCUMENT_ID as DEFAULT_LOCAL_DOCUMENT_ID, openDocumentStore, subscribeToPersistedDocuments, } from "../../stores/documents/index.js";
3
+ import { emitPersistedDocumentDeletion } from "../../stores/documents/registry.js";
4
+ import { createDocumentsWorkflowRuntime, defaultDocumentsPersistence, deletePersistedDocument, reclaimDocumentOrphanBlobs, } from "../../workflows/documents/index.js";
5
5
  export { DEFAULT_LOCAL_DOCUMENT_ID as DEFAULT_DOCUMENT_ID };
6
6
  export function createDocuments(dependencies) {
7
7
  return new DocumentsService(dependencies);
@@ -73,4 +73,4 @@ class DocumentsService {
73
73
  return ensure;
74
74
  }
75
75
  }
76
- //# sourceMappingURL=documents.js.map
76
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAU/E,OAAO,EACL,mBAAmB,IAAI,yBAAyB,EAGhD,iBAAiB,EAEjB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AAqBnC,OAAO,EAAE,yBAAyB,IAAI,mBAAmB,EAAE,CAAC;AAuC5D,MAAM,UAAU,eAAe,CAC7B,YAAmC;IAEnC,OAAO,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC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YAAY,CAAC,OAAgB;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,MAAM,GAAG,2BAA2B;aACvC,YAAY,CAAC,OAAO,CAAC;aACrB,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACxB,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5C,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QACL,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { DEFAULT_DOCUMENT_KIND } from \"../../data/documents/documentConstants\";\nimport type { StoredDocumentKind } from \"../../data/documents/documentKinds\";\nimport type {\n DocumentSummaryList,\n DocumentSummarySort,\n DocumentSummarySortDirection,\n DocumentSummarySortKey,\n ListDocumentSummariesInput,\n} from \"../../data/persistence/documents/types\";\nimport type { ExecSql } from \"../../data/sqlite/sqlSchema\";\nimport {\n DEFAULT_DOCUMENT_ID as DEFAULT_LOCAL_DOCUMENT_ID,\n type DocumentStore,\n type DocumentsRuntime,\n openDocumentStore,\n type PersistedDocumentListener,\n subscribeToPersistedDocuments,\n} from \"../../stores/documents\";\nimport { emitPersistedDocumentDeletion } from \"../../stores/documents/registry\";\nimport {\n createDocumentsWorkflowRuntime,\n defaultDocumentsPersistence,\n deletePersistedDocument,\n reclaimDocumentOrphanBlobs,\n} from \"../../workflows/documents\";\nimport type { InternalRuntime } from \"../runtime/workflowRuntime\";\n\nexport type {\n DocumentAttachmentStatus,\n DocumentAttachmentUpload,\n DocumentContextValue,\n DocumentStore,\n DocumentsRuntime,\n PersistedDocumentListener,\n} from \"../../stores/documents\";\n\nexport type DocumentSortDirection = DocumentSummarySortDirection;\nexport type DocumentSortKey = DocumentSummarySortKey;\n\nexport type DocumentSort = DocumentSummarySort;\n\nexport interface ListDocumentsInput extends ListDocumentSummariesInput {}\n\nexport type DocumentList = DocumentSummaryList;\n\nexport { DEFAULT_LOCAL_DOCUMENT_ID as DEFAULT_DOCUMENT_ID };\n\nexport interface OpenDocumentInput {\n readonly containerId?: string | null | undefined;\n readonly documentId?: string | null | undefined;\n readonly initialDocumentKind?: StoredDocumentKind | undefined;\n readonly initialText?: string | undefined;\n readonly localId?: string | undefined;\n}\n\nexport interface OpenDocumentOptions {\n readonly remoteSyncMode?: \"on-demand\" | \"startup\" | undefined;\n readonly workflowRuntime?: DocumentsRuntime | undefined;\n}\n\nexport interface DocumentSubscriptionOptions {\n readonly containerId?: string | null | undefined;\n}\n\nexport interface Documents {\n delete(localId: string): Promise<boolean>;\n findLocalIdByDocumentId(documentId: string): Promise<string | null>;\n list(input?: ListDocumentsInput | undefined): Promise<DocumentList | null>;\n open(\n input?: OpenDocumentInput | undefined,\n options?: OpenDocumentOptions | undefined,\n ): DocumentStore;\n subscribe(\n listener: PersistedDocumentListener,\n options?: DocumentSubscriptionOptions | undefined,\n ): () => void;\n workflowRuntime(containerId?: string | null | undefined): DocumentsRuntime;\n}\n\ninterface DocumentsDependencies {\n getDefaultContainerId: () => string | null;\n runtime: InternalRuntime;\n}\n\nexport function createDocuments(\n dependencies: DocumentsDependencies,\n): Documents {\n return new DocumentsService(dependencies);\n}\n\nclass DocumentsService implements Documents {\n private readonly schemaEnsuresByExecSql = new WeakMap<\n ExecSql,\n Promise<void>\n >();\n\n constructor(private readonly dependencies: DocumentsDependencies) {}\n\n async delete(localId: string): Promise<boolean> {\n const runtime = this.workflowRuntime();\n if (runtime.infra.dbStatus !== \"ready\") {\n return false;\n }\n\n const deleted = await deletePersistedDocument({\n documentProjectors: runtime.infra.documentProjectors,\n execSql: runtime.infra.execSql,\n localId,\n persistence: defaultDocumentsPersistence,\n });\n if (!deleted) return false;\n void reclaimDocumentOrphanBlobs(runtime);\n emitPersistedDocumentDeletion(runtime.state.domainScope, localId);\n return true;\n }\n\n async findLocalIdByDocumentId(documentId: string): Promise<string | null> {\n const runtime = this.dependencies.runtime.workflowInput();\n if (runtime.infra.dbStatus !== \"ready\") {\n return null;\n }\n\n await this.ensureSchema(runtime.infra.execSql);\n return defaultDocumentsPersistence.findLocalIdByDocumentId(\n runtime.infra.execSql,\n documentId,\n );\n }\n\n async list(input: ListDocumentsInput = {}): Promise<DocumentList | null> {\n const runtime = this.dependencies.runtime.workflowInput();\n if (runtime.infra.dbStatus !== \"ready\") {\n return null;\n }\n\n await this.ensureSchema(runtime.infra.execSql);\n return defaultDocumentsPersistence.listDocumentSummaries(\n runtime.infra.execSql,\n input,\n );\n }\n\n workflowRuntime(\n containerId = this.dependencies.getDefaultContainerId(),\n ): DocumentsRuntime {\n const input = this.dependencies.runtime.workflowInput(containerId);\n return createDocumentsWorkflowRuntime(input);\n }\n\n open(\n input: OpenDocumentInput = {},\n options: OpenDocumentOptions = {},\n ): DocumentStore {\n const {\n containerId,\n documentId = null,\n initialDocumentKind = DEFAULT_DOCUMENT_KIND,\n initialText = \"\",\n localId = DEFAULT_LOCAL_DOCUMENT_ID,\n } = input;\n const runtime =\n options.workflowRuntime ?? this.workflowRuntime(containerId);\n return openDocumentStore(\n runtime.state.domainScope,\n localId,\n runtime,\n documentId,\n initialText,\n initialDocumentKind,\n { remoteSyncMode: options.remoteSyncMode },\n );\n }\n\n subscribe(\n listener: PersistedDocumentListener,\n options: DocumentSubscriptionOptions = {},\n ): () => void {\n return subscribeToPersistedDocuments(\n this.dependencies.runtime.workflowInput(options.containerId).state\n .domainScope,\n listener,\n );\n }\n\n private ensureSchema(execSql: ExecSql): Promise<void> {\n const existing = this.schemaEnsuresByExecSql.get(execSql);\n if (existing) {\n return existing;\n }\n\n const ensure = defaultDocumentsPersistence\n .ensureSchema(execSql)\n .catch((error: unknown) => {\n this.schemaEnsuresByExecSql.delete(execSql);\n throw error;\n });\n this.schemaEnsuresByExecSql.set(execSql, ensure);\n return ensure;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { type EncapsulationKeyPair, type SigningKeyPair } from "../internal/crypto/index.js";
2
- import { type IdentityKeyPackage } from "./identityKeyPackage.js";
1
+ import { type EncapsulationKeyPair, type SigningKeyPair } from "../../internal/crypto/index.js";
2
+ import { type IdentityKeyPackage } from "./keyPackage.js";
3
3
  export interface IdentityOptions {
4
4
  encapsulationKeyPair?: EncapsulationKeyPair | null | undefined;
5
5
  seedPhrase?: string | null | undefined;
@@ -1,7 +1,7 @@
1
- import { createIdentitySeedPhrase, generateIdentityKeyPairsFromSeedPhrase, toFingerprint, } from "../internal/crypto/index.js";
2
- import { errorMessage } from "../data/errorMessage.js";
3
- import { createIdentityKeyPackage, parseIdentityKeyPackage, } from "./identityKeyPackage.js";
4
- import { createListenerSet } from "./listenerSet.js";
1
+ import { createIdentitySeedPhrase, generateIdentityKeyPairsFromSeedPhrase, toFingerprint, } from "../../internal/crypto/index.js";
2
+ import { errorMessage } from "../../data/shared/errorMessage.js";
3
+ import { createListenerSet } from "../runtime/listenerSet.js";
4
+ import { createIdentityKeyPackage, parseIdentityKeyPackage, } from "./keyPackage.js";
5
5
  export function createIdentity(options = {}, onIdentityChanged, log, runtimeHooks = {}) {
6
6
  return new IdentityService(options, onIdentityChanged, log, runtimeHooks);
7
7
  }
@@ -160,4 +160,4 @@ class IdentityService {
160
160
  this.listeners.notify();
161
161
  }
162
162
  }
163
- //# sourceMappingURL=identity.js.map
163
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAExB,sCAAsC,EAEtC,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;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,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAC;YACJ,CAAC;YAED,MAAM,aAAa,GAAG,MAAM,2BAA2B,EAAE,CAAC;YAE1D,OAAO;gBACL,oBAAoB,EAAE,aAAa,CAAC,OAAO;gBAC3C,eAAe,EAAE,aAAa,CAAC,WAAW;gBAC1C,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,IAAI,IAAI;aAChD,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,CAAC,GAAG,CAAC,oCAAoC,OAAO,EAAE,CAAC,CAAC;YACxD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAEO,eAAe;QACrB,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC3C,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC;QAC5C,IACE,gBAAgB,CAAC,oBAAoB;YACnC,YAAY,CAAC,oBAAoB;YACnC,gBAAgB,CAAC,UAAU,KAAK,YAAY,CAAC,UAAU;YACvD,gBAAgB,CAAC,kBAAkB,KAAK,YAAY,CAAC,kBAAkB;YACvE,gBAAgB,CAAC,cAAc,KAAK,YAAY,CAAC,cAAc,EAC/D,CAAC;YACD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;QACxD,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;CACF","sourcesContent":["import {\n createIdentitySeedPhrase,\n type EncapsulationKeyPair,\n generateIdentityKeyPairsFromSeedPhrase,\n type SigningKeyPair,\n toFingerprint,\n} from \"@tearleads/crypto\";\nimport { errorMessage } from \"../../data/shared/errorMessage\";\nimport { createListenerSet } from \"../runtime/listenerSet\";\nimport {\n createIdentityKeyPackage,\n type IdentityKeyPackage,\n parseIdentityKeyPackage,\n} from \"./keyPackage\";\n\nexport interface IdentityOptions {\n encapsulationKeyPair?: EncapsulationKeyPair | null | undefined;\n seedPhrase?: string | null | undefined;\n signingFingerprint?: string | null | undefined;\n signingKeyPair?: SigningKeyPair | null | undefined;\n}\n\nexport interface IdentitySnapshot {\n encapsulationKeyPair: EncapsulationKeyPair | null;\n seedPhrase: string | null;\n signingFingerprint: string | null;\n signingKeyPair: SigningKeyPair | null;\n}\n\nexport interface IdentityGenerationResult extends IdentitySnapshot {\n rootContainerCreated: boolean;\n rootContainerId: string;\n userId: string | null;\n}\n\nexport type IdentityListener = () => void;\n\nexport interface Identity {\n readonly encapsulationKeyPair: EncapsulationKeyPair | null;\n readonly seedPhrase: string | null;\n readonly signingFingerprint: string | null;\n readonly signingKeyPair: SigningKeyPair | null;\n readonly snapshot: IdentitySnapshot;\n destroy(): void;\n exportKeyPackage(): Promise<IdentityKeyPackage>;\n generate(): Promise<IdentityGenerationResult>;\n importKeyPackage(keyPackage: unknown): Promise<IdentitySnapshot>;\n importSeedPhrase(seedPhrase: string): Promise<IdentitySnapshot>;\n requireSigningKeyPair(operation?: string): SigningKeyPair;\n refreshSigningFingerprint(): Promise<string | null>;\n setKeyPairs(options: {\n encapsulationKeyPair: EncapsulationKeyPair | null;\n seedPhrase?: string | null | undefined;\n signingFingerprint?: string | null | undefined;\n signingKeyPair: SigningKeyPair | null;\n }): Promise<IdentitySnapshot>;\n subscribe(listener: IdentityListener): () => void;\n}\n\ninterface IdentityGenerationContext {\n rootContainerCreated: boolean;\n rootContainerId: string;\n userId: string | null;\n}\n\ninterface IdentityRuntimeHooks {\n bootstrapLocalRootContainer?:\n | (() => Promise<{ containerId: string; created: boolean }>)\n | undefined;\n getUserId?: (() => string | null) | undefined;\n}\n\nexport function createIdentity(\n options: IdentityOptions = {},\n onIdentityChanged: (signingFingerprint: string | null) => void,\n log: (message: string) => void,\n runtimeHooks: IdentityRuntimeHooks = {},\n): Identity {\n return new IdentityService(options, onIdentityChanged, log, runtimeHooks);\n}\n\nclass IdentityService implements Identity {\n private encapsulationKeyPairValue: EncapsulationKeyPair | null;\n private readonly listeners = createListenerSet();\n private seedPhraseValue: string | null;\n private signingFingerprintValue: string | null;\n private signingKeyPairValue: SigningKeyPair | null;\n private snapshotValue: IdentitySnapshot;\n\n constructor(\n options: IdentityOptions = {},\n private readonly onIdentityChanged: (\n signingFingerprint: string | null,\n ) => void,\n private readonly log: (message: string) => void,\n private readonly runtimeHooks: IdentityRuntimeHooks,\n ) {\n this.encapsulationKeyPairValue = options.encapsulationKeyPair ?? null;\n this.seedPhraseValue = options.seedPhrase ?? null;\n this.signingFingerprintValue = options.signingFingerprint ?? null;\n this.signingKeyPairValue = options.signingKeyPair ?? null;\n this.snapshotValue = this.createSnapshot();\n this.onIdentityChanged(this.signingFingerprintValue);\n }\n\n get encapsulationKeyPair(): EncapsulationKeyPair | null {\n return this.encapsulationKeyPairValue;\n }\n\n get seedPhrase(): string | null {\n return this.seedPhraseValue;\n }\n\n get signingFingerprint(): string | null {\n return this.signingFingerprintValue;\n }\n\n get signingKeyPair(): SigningKeyPair | null {\n return this.signingKeyPairValue;\n }\n\n get snapshot(): IdentitySnapshot {\n return this.snapshotValue;\n }\n\n destroy(): void {\n this.encapsulationKeyPairValue = null;\n this.seedPhraseValue = null;\n this.signingFingerprintValue = null;\n this.signingKeyPairValue = null;\n this.publishSnapshot();\n this.log(\"Key pair destroyed\");\n }\n\n exportKeyPackage(): Promise<IdentityKeyPackage> {\n return createIdentityKeyPackage(this.snapshot);\n }\n\n async generate(): Promise<IdentityGenerationResult> {\n const seedPhrase = createIdentitySeedPhrase();\n const { encapsulationKeyPair, signingKeyPair } =\n generateIdentityKeyPairsFromSeedPhrase(seedPhrase);\n const signingFingerprint = await toFingerprint(\n signingKeyPair.signingPublicKey,\n );\n const generationContext = await this.createGenerationContext();\n\n this.signingKeyPairValue = signingKeyPair;\n this.encapsulationKeyPairValue = encapsulationKeyPair;\n this.seedPhraseValue = seedPhrase;\n this.signingFingerprintValue = signingFingerprint;\n this.publishSnapshot();\n this.log(\"Key pair generated\");\n return {\n ...this.snapshot,\n ...generationContext,\n };\n }\n\n async importKeyPackage(keyPackage: unknown): Promise<IdentitySnapshot> {\n const parsed = await parseIdentityKeyPackage(keyPackage);\n this.encapsulationKeyPairValue = parsed.encapsulationKeyPair;\n this.seedPhraseValue = parsed.package.seedPhrase ?? null;\n this.signingKeyPairValue = parsed.signingKeyPair;\n this.signingFingerprintValue = parsed.package.signingFingerprint;\n this.publishSnapshot();\n this.log(\"Key package imported\");\n return this.snapshot;\n }\n\n async importSeedPhrase(seedPhrase: string): Promise<IdentitySnapshot> {\n const derived = generateIdentityKeyPairsFromSeedPhrase(seedPhrase);\n this.encapsulationKeyPairValue = derived.encapsulationKeyPair;\n this.seedPhraseValue = derived.seedPhrase;\n this.signingKeyPairValue = derived.signingKeyPair;\n this.signingFingerprintValue = await toFingerprint(\n derived.signingKeyPair.signingPublicKey,\n );\n this.publishSnapshot();\n this.log(\"Seed phrase imported\");\n return this.snapshot;\n }\n\n requireSigningKeyPair(operation = \"This operation\"): SigningKeyPair {\n if (!this.signingKeyPairValue) {\n throw new Error(`${operation} requires a signing key pair.`);\n }\n\n return this.signingKeyPairValue;\n }\n\n async refreshSigningFingerprint(): Promise<string | null> {\n if (!this.signingKeyPairValue) {\n this.signingFingerprintValue = null;\n this.publishSnapshot();\n return null;\n }\n\n this.signingFingerprintValue = await toFingerprint(\n this.signingKeyPairValue.signingPublicKey,\n );\n this.publishSnapshot();\n return this.signingFingerprintValue;\n }\n\n async setKeyPairs(options: {\n encapsulationKeyPair: EncapsulationKeyPair | null;\n seedPhrase?: string | null | undefined;\n signingFingerprint?: string | null | undefined;\n signingKeyPair: SigningKeyPair | null;\n }): Promise<IdentitySnapshot> {\n this.encapsulationKeyPairValue = options.encapsulationKeyPair;\n this.seedPhraseValue = options.seedPhrase ?? null;\n this.signingKeyPairValue = options.signingKeyPair;\n this.signingFingerprintValue = options.signingFingerprint ?? null;\n\n if (!this.signingFingerprintValue) {\n await this.refreshSigningFingerprint();\n } else {\n this.publishSnapshot();\n }\n\n return this.snapshot;\n }\n\n subscribe = (listener: IdentityListener): (() => void) =>\n this.listeners.subscribe(listener);\n\n private createSnapshot(): IdentitySnapshot {\n return {\n encapsulationKeyPair: this.encapsulationKeyPairValue,\n seedPhrase: this.seedPhraseValue,\n signingFingerprint: this.signingFingerprintValue,\n signingKeyPair: this.signingKeyPairValue,\n };\n }\n\n private async createGenerationContext(): Promise<IdentityGenerationContext> {\n try {\n const bootstrapLocalRootContainer =\n this.runtimeHooks.bootstrapLocalRootContainer;\n if (!bootstrapLocalRootContainer) {\n throw new Error(\n \"identity.generate requires local root container bootstrap.\",\n );\n }\n\n const rootContainer = await bootstrapLocalRootContainer();\n\n return {\n rootContainerCreated: rootContainer.created,\n rootContainerId: rootContainer.containerId,\n userId: this.runtimeHooks.getUserId?.() ?? null,\n };\n } catch (error: unknown) {\n const message = errorMessage(error);\n this.log(`Root container bootstrap failed: ${message}`);\n throw error;\n }\n }\n\n private publishSnapshot(): void {\n const nextSnapshot = this.createSnapshot();\n const previousSnapshot = this.snapshotValue;\n if (\n previousSnapshot.encapsulationKeyPair ===\n nextSnapshot.encapsulationKeyPair &&\n previousSnapshot.seedPhrase === nextSnapshot.seedPhrase &&\n previousSnapshot.signingFingerprint === nextSnapshot.signingFingerprint &&\n previousSnapshot.signingKeyPair === nextSnapshot.signingKeyPair\n ) {\n return;\n }\n\n this.snapshotValue = nextSnapshot;\n this.onIdentityChanged(nextSnapshot.signingFingerprint);\n this.listeners.notify();\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { type EncapsulationKeyPair, type SigningKeyPair } from "../internal/crypto/index.js";
1
+ import { type EncapsulationKeyPair, type SigningKeyPair } from "../../internal/crypto/index.js";
2
2
  export declare const IDENTITY_KEY_PACKAGE_FORMAT = "tearleads.identity-key-package";
3
3
  export interface IdentityKeyPackage {
4
4
  readonly createdAt: string;
@@ -1,6 +1,6 @@
1
- import { decryptAsRecipient, encryptForRecipients, generateIdentityKeyPairsFromSeedPhrase, ML_DSA87_PUBLIC_KEY_BYTES, ML_DSA87_SECRET_KEY_BYTES, ML_KEM1024_PUBLIC_KEY_BYTES, ML_KEM1024_SECRET_KEY_BYTES, sign, toFingerprint, verify, } from "../internal/crypto/index.js";
2
- import { base64ToBytes, bytesToBase64 } from "../internal/encoding/index.js";
3
- import { isPlainObject } from "../internal/validators/isPlainObject.js";
1
+ import { decryptAsRecipient, encryptForRecipients, generateIdentityKeyPairsFromSeedPhrase, ML_DSA87_PUBLIC_KEY_BYTES, ML_DSA87_SECRET_KEY_BYTES, ML_KEM1024_PUBLIC_KEY_BYTES, ML_KEM1024_SECRET_KEY_BYTES, sign, toFingerprint, verify, } from "../../internal/crypto/index.js";
2
+ import { base64ToBytes, bytesToBase64 } from "../../internal/encoding/index.js";
3
+ import { isPlainObject } from "../../internal/validators/isPlainObject.js";
4
4
  export const IDENTITY_KEY_PACKAGE_FORMAT = "tearleads.identity-key-package";
5
5
  const KEY_PACKAGE_PROBE_MESSAGE = new TextEncoder().encode("tearleads.identity-key-package.probe");
6
6
  function readStringProperty(value, property, label) {
@@ -198,4 +198,4 @@ export async function parseIdentityKeyPackage(value) {
198
198
  signingKeyPair,
199
199
  };
200
200
  }
201
- //# sourceMappingURL=identityKeyPackage.js.map
201
+ //# sourceMappingURL=keyPackage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyPackage.js","sourceRoot":"","sources":["keyPackage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,oBAAoB,EACpB,sCAAsC,EACtC,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAE3B,IAAI,EACJ,aAAa,EACb,MAAM,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,aAAa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P,SAAS,EAAE,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,CAAC;YAC/D,oBAAoB,EAAE;gBACpB,SAAS,EAAE,aAAa,CAAC,oBAAoB,CAAC,SAAS,CAAC;gBACxD,SAAS,EAAE,aAAa,CAAC,oBAAoB,CAAC,SAAS,CAAC;aACzD;YACD,MAAM;YACN,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrC,kBAAkB;YAClB,cAAc,EAAE;gBACd,iBAAiB,EAAE,aAAa,CAAC,cAAc,CAAC,iBAAiB,CAAC;gBAClE,gBAAgB,EAAE,aAAa,CAAC,cAAc,CAAC,gBAAgB,CAAC;aACjE;YACD,OAAO;SACR;QACD,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import {\n decryptAsRecipient,\n type EncapsulationKeyPair,\n encryptForRecipients,\n generateIdentityKeyPairsFromSeedPhrase,\n ML_DSA87_PUBLIC_KEY_BYTES,\n ML_DSA87_SECRET_KEY_BYTES,\n ML_KEM1024_PUBLIC_KEY_BYTES,\n ML_KEM1024_SECRET_KEY_BYTES,\n type SigningKeyPair,\n sign,\n toFingerprint,\n verify,\n} from \"@tearleads/crypto\";\nimport { base64ToBytes, bytesToBase64 } from \"@tearleads/encoding\";\nimport { isPlainObject } from \"@tearleads/validators/isPlainObject\";\n\nexport const IDENTITY_KEY_PACKAGE_FORMAT = \"tearleads.identity-key-package\";\n\nconst KEY_PACKAGE_PROBE_MESSAGE = new TextEncoder().encode(\n \"tearleads.identity-key-package.probe\",\n);\n\nexport interface IdentityKeyPackage {\n readonly createdAt: string;\n readonly encapsulationKeyPair: {\n readonly publicKey: string;\n readonly secretKey: string;\n };\n readonly format: typeof IDENTITY_KEY_PACKAGE_FORMAT;\n readonly seedPhrase?: string | undefined;\n readonly signingFingerprint: string;\n readonly signingKeyPair: {\n readonly signingPrivateKey: string;\n readonly signingPublicKey: string;\n };\n readonly version: 1;\n}\n\ninterface ParsedIdentityKeyPackage {\n readonly encapsulationKeyPair: EncapsulationKeyPair;\n readonly package: IdentityKeyPackage;\n readonly signingKeyPair: SigningKeyPair;\n}\n\nfunction readStringProperty(\n value: object,\n property: string,\n label: string,\n): string {\n const rawValue = Reflect.get(value, property);\n if (typeof rawValue !== \"string\" || rawValue.length === 0) {\n throw new Error(`Invalid identity key package: ${label} is required.`);\n }\n\n return rawValue;\n}\n\nfunction readOptionalStringProperty(\n value: object,\n property: string,\n label: string,\n): string | null {\n const rawValue = Reflect.get(value, property);\n if (rawValue === undefined || rawValue === null) {\n return null;\n }\n if (typeof rawValue !== \"string\" || rawValue.length === 0) {\n throw new Error(`Invalid identity key package: ${label} must be a string.`);\n }\n\n return rawValue;\n}\n\nfunction readBase64Bytes(input: {\n expectedLength: number;\n label: string;\n value: string;\n}): Uint8Array {\n let bytes: Uint8Array;\n try {\n bytes = base64ToBytes(input.value);\n } catch (error) {\n throw new Error(\n `Invalid identity key package: ${input.label} must be base64.`,\n { cause: error },\n );\n }\n\n if (bytes.length !== input.expectedLength) {\n throw new Error(\n `Invalid identity key package: ${input.label} has ${bytes.length} bytes, expected ${input.expectedLength}.`,\n );\n }\n\n return bytes;\n}\n\nfunction bytesEqual(left: Uint8Array, right: Uint8Array): boolean {\n if (left.length !== right.length) {\n return false;\n }\n\n let result = 0;\n for (let index = 0; index < left.length; index += 1) {\n result |= (left[index] ?? 0) ^ (right[index] ?? 0);\n }\n return result === 0;\n}\n\nfunction readMatchingSeedPhrase(input: {\n encapsulationKeyPair: EncapsulationKeyPair;\n seedPhrase: string | null;\n signingKeyPair: SigningKeyPair;\n}): string | undefined {\n if (!input.seedPhrase) {\n return undefined;\n }\n\n let derived: ReturnType<typeof generateIdentityKeyPairsFromSeedPhrase>;\n try {\n derived = generateIdentityKeyPairsFromSeedPhrase(input.seedPhrase);\n } catch (error) {\n throw new Error(\"Invalid identity key package: seed phrase is invalid.\", {\n cause: error,\n });\n }\n\n if (\n !bytesEqual(\n derived.signingKeyPair.signingPrivateKey,\n input.signingKeyPair.signingPrivateKey,\n ) ||\n !bytesEqual(\n derived.signingKeyPair.signingPublicKey,\n input.signingKeyPair.signingPublicKey,\n ) ||\n !bytesEqual(\n derived.encapsulationKeyPair.secretKey,\n input.encapsulationKeyPair.secretKey,\n ) ||\n !bytesEqual(\n derived.encapsulationKeyPair.publicKey,\n input.encapsulationKeyPair.publicKey,\n )\n ) {\n throw new Error(\n \"Invalid identity key package: seed phrase does not match the key pairs.\",\n );\n }\n\n return derived.seedPhrase;\n}\n\nfunction readSigningKeyPair(value: unknown): SigningKeyPair {\n if (!isPlainObject(value)) {\n throw new Error(\n \"Invalid identity key package: signingKeyPair is required.\",\n );\n }\n\n return {\n signingPrivateKey: readBase64Bytes({\n expectedLength: ML_DSA87_SECRET_KEY_BYTES,\n label: \"signing private key\",\n value: readStringProperty(\n value,\n \"signingPrivateKey\",\n \"signing private key\",\n ),\n }),\n signingPublicKey: readBase64Bytes({\n expectedLength: ML_DSA87_PUBLIC_KEY_BYTES,\n label: \"signing public key\",\n value: readStringProperty(\n value,\n \"signingPublicKey\",\n \"signing public key\",\n ),\n }),\n };\n}\n\nfunction readEncapsulationKeyPair(value: unknown): EncapsulationKeyPair {\n if (!isPlainObject(value)) {\n throw new Error(\n \"Invalid identity key package: encapsulationKeyPair is required.\",\n );\n }\n\n return {\n publicKey: readBase64Bytes({\n expectedLength: ML_KEM1024_PUBLIC_KEY_BYTES,\n label: \"encapsulation public key\",\n value: readStringProperty(value, \"publicKey\", \"encapsulation public key\"),\n }),\n secretKey: readBase64Bytes({\n expectedLength: ML_KEM1024_SECRET_KEY_BYTES,\n label: \"encapsulation secret key\",\n value: readStringProperty(value, \"secretKey\", \"encapsulation secret key\"),\n }),\n };\n}\n\nfunction assertSigningKeyPairMatches(signingKeyPair: SigningKeyPair): void {\n let signature: Uint8Array;\n try {\n signature = sign(\n KEY_PACKAGE_PROBE_MESSAGE,\n signingKeyPair.signingPrivateKey,\n );\n } catch (error) {\n throw new Error(\n \"Invalid identity key package: signing private key could not sign.\",\n { cause: error },\n );\n }\n\n if (\n !verify(\n signature,\n KEY_PACKAGE_PROBE_MESSAGE,\n signingKeyPair.signingPublicKey,\n )\n ) {\n throw new Error(\n \"Invalid identity key package: signing private key does not match the public key.\",\n );\n }\n}\n\nasync function assertEncapsulationKeyPairMatches(\n encapsulationKeyPair: EncapsulationKeyPair,\n): Promise<void> {\n try {\n const envelope = await encryptForRecipients(KEY_PACKAGE_PROBE_MESSAGE, [\n encapsulationKeyPair.publicKey,\n ]);\n const decrypted = await decryptAsRecipient(\n envelope,\n encapsulationKeyPair.secretKey,\n );\n\n if (\n decrypted.length !== KEY_PACKAGE_PROBE_MESSAGE.length ||\n decrypted.some((byte, index) => byte !== KEY_PACKAGE_PROBE_MESSAGE[index])\n ) {\n throw new Error(\"probe plaintext mismatch\");\n }\n } catch (error) {\n throw new Error(\n \"Invalid identity key package: encapsulation secret key does not match the public key.\",\n { cause: error },\n );\n }\n}\n\nexport async function createIdentityKeyPackage(input: {\n encapsulationKeyPair: EncapsulationKeyPair | null;\n seedPhrase?: string | null | undefined;\n signingFingerprint: string | null;\n signingKeyPair: SigningKeyPair | null;\n}): Promise<IdentityKeyPackage> {\n if (!input.signingKeyPair || !input.encapsulationKeyPair) {\n throw new Error(\"Cannot export an identity key package without key pairs.\");\n }\n\n const signingFingerprint =\n input.signingFingerprint ??\n (await toFingerprint(input.signingKeyPair.signingPublicKey));\n const seedPhrase = readMatchingSeedPhrase({\n encapsulationKeyPair: input.encapsulationKeyPair,\n seedPhrase: input.seedPhrase ?? null,\n signingKeyPair: input.signingKeyPair,\n });\n\n return {\n createdAt: new Date().toISOString(),\n encapsulationKeyPair: {\n publicKey: bytesToBase64(input.encapsulationKeyPair.publicKey),\n secretKey: bytesToBase64(input.encapsulationKeyPair.secretKey),\n },\n format: IDENTITY_KEY_PACKAGE_FORMAT,\n ...(seedPhrase ? { seedPhrase } : {}),\n signingFingerprint,\n signingKeyPair: {\n signingPrivateKey: bytesToBase64(input.signingKeyPair.signingPrivateKey),\n signingPublicKey: bytesToBase64(input.signingKeyPair.signingPublicKey),\n },\n version: 1,\n };\n}\n\nexport async function parseIdentityKeyPackage(\n value: unknown,\n): Promise<ParsedIdentityKeyPackage> {\n if (!isPlainObject(value)) {\n throw new Error(\"Invalid identity key package: expected an object.\");\n }\n\n const format = readStringProperty(value, \"format\", \"format\");\n if (format !== IDENTITY_KEY_PACKAGE_FORMAT) {\n throw new Error(\"Invalid identity key package: unsupported format.\");\n }\n\n const version = Reflect.get(value, \"version\");\n if (version !== 1) {\n throw new Error(\"Invalid identity key package: unsupported version.\");\n }\n\n const signingFingerprint = readStringProperty(\n value,\n \"signingFingerprint\",\n \"signing fingerprint\",\n );\n const signingKeyPair = readSigningKeyPair(\n Reflect.get(value, \"signingKeyPair\"),\n );\n const computedSigningFingerprint = await toFingerprint(\n signingKeyPair.signingPublicKey,\n );\n if (computedSigningFingerprint !== signingFingerprint) {\n throw new Error(\n \"Invalid identity key package: signing fingerprint does not match the public key.\",\n );\n }\n assertSigningKeyPairMatches(signingKeyPair);\n\n const encapsulationKeyPair = readEncapsulationKeyPair(\n Reflect.get(value, \"encapsulationKeyPair\"),\n );\n await assertEncapsulationKeyPairMatches(encapsulationKeyPair);\n const seedPhrase = readMatchingSeedPhrase({\n encapsulationKeyPair,\n seedPhrase: readOptionalStringProperty(value, \"seedPhrase\", \"seed phrase\"),\n signingKeyPair,\n });\n\n return {\n encapsulationKeyPair,\n package: {\n createdAt: readStringProperty(value, \"createdAt\", \"created at\"),\n encapsulationKeyPair: {\n publicKey: bytesToBase64(encapsulationKeyPair.publicKey),\n secretKey: bytesToBase64(encapsulationKeyPair.secretKey),\n },\n format,\n ...(seedPhrase ? { seedPhrase } : {}),\n signingFingerprint,\n signingKeyPair: {\n signingPrivateKey: bytesToBase64(signingKeyPair.signingPrivateKey),\n signingPublicKey: bytesToBase64(signingKeyPair.signingPublicKey),\n },\n version,\n },\n signingKeyPair,\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { SecurityIncidentReporter } from "../data/securityIncidents.js";
2
- import { type TrustedUserIdentityResolver, type TrustedUserIdentityService } from "../data/trustedUserIdentity/index.js";
1
+ import type { SecurityIncidentReporter } from "../../data/shared/securityIncidents.js";
2
+ import { type TrustedUserIdentityResolver, type TrustedUserIdentityService } from "../../data/trustedUserIdentity/index.js";
3
3
  export interface ResolvedUserIdentity {
4
4
  encapsulationKeyFingerprint: string;
5
5
  encapsulationPublicKey: string;
@@ -1,7 +1,7 @@
1
- import { bytesToBase64 } from "../internal/encoding/index.js";
2
- import { ProjectionDependencyUnavailableError } from "../data/keyingProjectionVerification/dependencyUnavailable.js";
3
- import { runWithSecurityIncidentReporting } from "../data/keyingProjectionVerification/error.js";
4
- import { parseIdentityLink, requireTrustedUserIdentityResolver, } from "../data/trustedUserIdentity/index.js";
1
+ import { bytesToBase64 } from "../../internal/encoding/index.js";
2
+ import { ProjectionDependencyUnavailableError } from "../../data/keyingProjectionVerification/dependencyUnavailable.js";
3
+ import { runWithSecurityIncidentReporting } from "../../data/keyingProjectionVerification/error.js";
4
+ import { parseIdentityLink, requireTrustedUserIdentityResolver, } from "../../data/trustedUserIdentity/index.js";
5
5
  function toResolvedIdentity(identity) {
6
6
  return {
7
7
  encapsulationKeyFingerprint: identity.encapsulationKeyFingerprint,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userIdentities.js","sourceRoot":"","sources":["userIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AACrH,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AAEjG,OAAO,EACL,iBAAiB,EACjB,kCAAkC,GAInC,MAAM,gCAAgC,CAAC;AAqBxC,SAAS,kBAAkB,CACzB,QAA6B;IAE7B,OAAO;QACL,2BAA2B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CAAC;YAC/D,IAAI,CAAC;gBACH,QAAQ,GAAG,MAAM,0BAA0B,CAAC,MAAM,CAAC,CAAC;YACtD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,CAAC,KAAK,YAAY,oCAAoC,CAAC;oBAC1D,MAAM,KAAK,CAAC;gBACd,KAAK,CAAC,GAAG,CACP,qBAAqB,MAAM,oBAAoB,KAAK,CAAC,OAAO,EAAE,CAC/D,CAAC;gBACF,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { bytesToBase64 } from \"@tearleads/encoding\";\nimport { ProjectionDependencyUnavailableError } from \"../../data/keyingProjectionVerification/dependencyUnavailable\";\nimport { runWithSecurityIncidentReporting } from \"../../data/keyingProjectionVerification/error\";\nimport type { SecurityIncidentReporter } from \"../../data/shared/securityIncidents\";\nimport {\n parseIdentityLink,\n requireTrustedUserIdentityResolver,\n type TrustedUserIdentity,\n type TrustedUserIdentityResolver,\n type TrustedUserIdentityService,\n} from \"../../data/trustedUserIdentity\";\n\nexport interface ResolvedUserIdentity {\n encapsulationKeyFingerprint: string;\n encapsulationPublicKey: string;\n signingKeyFingerprint: string;\n signingPublicKey: string;\n userId: string;\n}\n\nexport interface UserIdentities {\n /** Share a stable link derived exclusively from this user's local keys. */\n createLink(appUrl: string): Promise<string>;\n /** Compare an independently received link before durably pinning either key. */\n verifyLink(link: string): Promise<ResolvedUserIdentity>;\n /** Read an existing durable pin without fetching or trusting a new identity. */\n resolvePinned(userId: string): Promise<ResolvedUserIdentity | null>;\n /** `null` when the user is unknown or currently unresolvable; integrity failures throw. */\n resolve(userId: string): Promise<ResolvedUserIdentity | null>;\n}\n\nfunction toResolvedIdentity(\n identity: TrustedUserIdentity,\n): ResolvedUserIdentity {\n return {\n encapsulationKeyFingerprint: identity.encapsulationKeyFingerprint,\n encapsulationPublicKey: bytesToBase64(identity.encapsulationPublicKey),\n signingKeyFingerprint: identity.signingKeyFingerprint,\n signingPublicKey: bytesToBase64(identity.signingPublicKey),\n userId: identity.userId,\n };\n}\n\nexport function createUserIdentities(input: {\n getOrganizationId: () => string | null;\n reportSecurityIncident: SecurityIncidentReporter;\n identityLinks: Pick<\n TrustedUserIdentityService,\n \"createLink\" | \"verifyLink\" | \"resolvePinned\"\n >;\n log: (message: string) => void;\n resolveTrustedUserIdentity: TrustedUserIdentityResolver;\n}): UserIdentities {\n const resolveTrustedUserIdentity = requireTrustedUserIdentityResolver(\n input.resolveTrustedUserIdentity,\n );\n return {\n createLink: (appUrl) => input.identityLinks.createLink(appUrl),\n async verifyLink(link) {\n const { userId } = parseIdentityLink(link);\n return runWithSecurityIncidentReporting(\n input.reportSecurityIncident,\n {\n objectId: userId,\n objectKind: \"user\",\n operation: \"user.identity.verify_link\",\n organizationId: input.getOrganizationId(),\n },\n async () =>\n toResolvedIdentity(await input.identityLinks.verifyLink(link)),\n );\n },\n async resolvePinned(userId) {\n const identity = await input.identityLinks.resolvePinned(userId);\n return identity ? toResolvedIdentity(identity) : null;\n },\n async resolve(userId) {\n input.log(`Loading user identity for userId: ${userId}`);\n let identity: Awaited<ReturnType<TrustedUserIdentityResolver>>;\n try {\n identity = await resolveTrustedUserIdentity(userId);\n } catch (error) {\n if (!(error instanceof ProjectionDependencyUnavailableError))\n throw error;\n input.log(\n `User identity for ${userId} is unavailable: ${error.message}`,\n );\n return null;\n }\n if (!identity) {\n return null;\n }\n\n return toResolvedIdentity(identity);\n },\n };\n}\n"]}
package/client/index.d.ts CHANGED
@@ -1,29 +1,29 @@
1
- export { createDomainScope, type DomainScope } from "../data/domainScope.js";
1
+ export { createDomainScope, type DomainScope, } from "../data/shared/domainScope.js";
2
2
  export type { LocalProjectionReconciledDelta, LocalProjectionSnapshot, } from "../stores/local-projection/index.js";
3
3
  export { enqueueReconciliationForEvents, type ReconciliationService, } from "../sync/reconciliation/index.js";
4
4
  export { createUnavailableDirectCheckout, type DirectCheckoutAppearance, type DirectCheckoutCapability, type DirectCheckoutConfirmation, type DirectCheckoutSession, DirectCheckoutUnavailableError, } from "./billing/directCheckout.js";
5
5
  export { createRevenueCatPurchases, createUnavailablePurchases, PurchaseAbortedError, PurchaseAlreadyOwnedError, PurchaseCancelledError, PurchaseIdentityPendingError, PurchaseProviderStalledError, type PurchasesCapability, PurchasesUnavailableError, type RevenueCatBackend, type RevenueCatCustomerInfo, type RevenueCatPackage, type RevenueCatPurchasesConfig, type SyncPurchaseResult, type SyncSubscriptionOption, } from "./billing/purchases.js";
6
- export { type BlobStoreFactory, Blobs } from "./blobs.js";
7
- export type { BlobInfo, BlobInfoAttachmentKind, BlobInfoDocumentReference, BlobInfoInput, BlobInfoList, BlobInfoSort, BlobInfoSortDirection, BlobInfoSortKey, ContainerContents, ContainerContentsContextValue, ContainerContentsStore, ContainerContentsStoreOptions, ContainerDocumentLinkInput, ContainerDocumentLinks, ContainerDocumentObjectSyncState, ContainerDocumentObjectSyncStatus, ContainerDocumentQueries, ContainerDocumentSidebarRow, ContainerInfo, ContainerInfoInput, ContainerItemRow, ContainerItemSort, ContainerItemSortDirection, ContainerItemSortKey, ContainerNode, ContainerShareAccessLevel, DocumentAttributionRangesInput, DocumentAttributionRangesPage, DocumentInfo, DocumentInfoInput, LinkDocumentToContainerInput, MergeDocumentSummary, MoveDocumentToContainerInput, OpenContainerDocumentInput, PendingWriteQueueItem, PendingWriteQueueItemStatus, PendingWriteQueueObjectKind, PendingWriteQueueOperation, PendingWriteQueueOperationKind, PendingWriteQueueOperationStatus, PurgeDocumentInput, PurgeDocumentResult, SetActiveDocumentContainerInput, SetLinkedContainerIdsForDocument, UnlinkDocumentFromContainerInput, } from "./containerContents.js";
8
- export { createContainerDocumentObjectSyncState } from "./containerContents.js";
9
- export { Database, type DatabaseListener, type DatabaseOptions, type DatabaseSnapshot, type DatabaseStatus, } from "./database.js";
10
- export type { DeviceFirst, DeviceFirstContainerContents, LocalProjectionView, } from "./deviceFirst.js";
11
- export type { DocumentAttachmentStatus, DocumentAttachmentUpload, DocumentContextValue, DocumentList, DocumentSort, DocumentSortDirection, DocumentSortKey, DocumentStore, DocumentSubscriptionOptions, Documents, DocumentsRuntime, ListDocumentsInput, OpenDocumentInput, OpenDocumentOptions, PersistedDocumentListener, } from "./documents.js";
12
- export { DEFAULT_DOCUMENT_ID } from "./documents.js";
13
- export { Events, type EventsListener, type EventsSnapshot, } from "./events.js";
14
- export type { FileSaver, SaveFileRequest } from "./fileSaver.js";
15
- export type { Identity, IdentityGenerationResult, IdentityListener, IdentityOptions, IdentitySnapshot, } from "./identity.js";
16
- export { IDENTITY_KEY_PACKAGE_FORMAT, type IdentityKeyPackage, } from "./identityKeyPackage.js";
6
+ export { type BlobStoreFactory, Blobs } from "./blobs/index.js";
7
+ export type { BlobInfo, BlobInfoAttachmentKind, BlobInfoDocumentReference, BlobInfoInput, BlobInfoList, BlobInfoSort, BlobInfoSortDirection, BlobInfoSortKey, ContainerContents, ContainerContentsContextValue, ContainerContentsStore, ContainerContentsStoreOptions, ContainerDocumentLinkInput, ContainerDocumentLinks, ContainerDocumentObjectSyncState, ContainerDocumentObjectSyncStatus, ContainerDocumentQueries, ContainerDocumentSidebarRow, ContainerInfo, ContainerInfoInput, ContainerItemRow, ContainerItemSort, ContainerItemSortDirection, ContainerItemSortKey, ContainerNode, ContainerShareAccessLevel, DocumentAttributionRangesInput, DocumentAttributionRangesPage, DocumentInfo, DocumentInfoInput, LinkDocumentToContainerInput, MergeDocumentSummary, MoveDocumentToContainerInput, OpenContainerDocumentInput, PendingWriteQueueItem, PendingWriteQueueItemStatus, PendingWriteQueueObjectKind, PendingWriteQueueOperation, PendingWriteQueueOperationKind, PendingWriteQueueOperationStatus, PurgeDocumentInput, PurgeDocumentResult, SetActiveDocumentContainerInput, SetLinkedContainerIdsForDocument, UnlinkDocumentFromContainerInput, } from "./containerContents/index.js";
8
+ export { createContainerDocumentObjectSyncState } from "./containerContents/index.js";
9
+ export type { DeviceFirst, DeviceFirstContainerContents, LocalProjectionView, } from "./deviceFirst/index.js";
10
+ export type { DocumentAttachmentStatus, DocumentAttachmentUpload, DocumentContextValue, DocumentList, DocumentSort, DocumentSortDirection, DocumentSortKey, DocumentStore, DocumentSubscriptionOptions, Documents, DocumentsRuntime, ListDocumentsInput, OpenDocumentInput, OpenDocumentOptions, PersistedDocumentListener, } from "./documents/index.js";
11
+ export { DEFAULT_DOCUMENT_ID } from "./documents/index.js";
12
+ export type { FileSaver, SaveFileRequest } from "./host/fileSaver.js";
13
+ export type { Logger } from "./host/logger.js";
14
+ export type { Identity, IdentityGenerationResult, IdentityListener, IdentityOptions, IdentitySnapshot, } from "./identity/index.js";
15
+ export { IDENTITY_KEY_PACKAGE_FORMAT, type IdentityKeyPackage, } from "./identity/keyPackage.js";
16
+ export type { ResolvedUserIdentity, UserIdentities, } from "./identity/userIdentities.js";
17
17
  export type { BrowserLocalKeyringOptions, IndexedDbLocalKeyringManifestStoreOptions, IndexedDbWrappingKeyKeystoreOptions, LocalKeyPurpose, LocalKeyring, LocalKeyringManifest, LocalKeyringManifestFormat, LocalKeyringManifestStorage, LocalKeyringManifestStore, LocalKeyringOptions, LocalKeyringScope, LocalKeyringSession, LocalSecretContext, LocalStorageLocalKeyringManifestStoreOptions, NormalizedLocalKeyringScope, UnwrapLocalSecretInput, WrapLocalSecretInput, WrappedLocalSecretEnvelope, WrappedLocalSecretFormat, WrappingKeyHandle, WrappingKeyKeystore, WrappingKeyMaterialStorage, } from "./localKeyring/index.js";
18
18
  export { createBrowserLocalKeyring, createBrowserLocalKeyringManifestStore, createIndexedDbLocalKeyringManifestStore, createIndexedDbWrappingKeyKeystore, createLocalKeyring, createLocalStorageLocalKeyringManifestStore, createMemoryLocalKeyringManifestStore, createMemoryWrappingKeyKeystore, createWebViewLocalKeyring, decodeLocalKeyringSqliteKey, encodeLocalKeyringSqliteKey, LOCAL_KEYRING_MANIFEST_FORMAT, localKeyringScopeKey, normalizeLocalKeyringScope, parseLocalKeyringManifest, serializeLocalKeyringManifest, WRAPPED_LOCAL_SECRET_FORMAT, } from "./localKeyring/index.js";
19
19
  export type { LocalKeyringPinCode, PinCodeBrowserLocalKeyringOptions, PinCodeWrappingKeyKeystoreOptions, } from "./localKeyring/localKeyringPinCode.js";
20
20
  export { createPinCodeBrowserLocalKeyring, createPinCodeWrappingKeyKeystore, isPinCodeWrappedLocalSecretEnvelope, } from "./localKeyring/localKeyringPinCode.js";
21
- export type { Logger } from "./logger.js";
22
- export { createBrowserNetworkStatusSource, Network, type NetworkListener, type NetworkMode, type NetworkStatusSource, } from "./network.js";
23
21
  export type { AbandonOrganizationPolicyMutationInput, AddOrganizationGroupUserInput, DiscardUnreadableOrganizationPolicyMutationInput, ImportedOrganizationUser, LocalOrganizationSummary, OrganizationBilling, OrganizationBillingHistory, OrganizationBillingHistoryEntry, OrganizationBillingManagementUrl, OrganizationBillingView, OrganizationContainerGrant, OrganizationContainerGrants, OrganizationDataUsage, OrganizationDirectory, OrganizationDirectoryAndGroups, OrganizationDirectoryUser, OrganizationGrantRef, OrganizationGroupContainer, OrganizationGroupContainers, OrganizationGroupDetails, OrganizationGroupMember, OrganizationGroupMembers, OrganizationGroupMutationReceipt, OrganizationGroupPolicyHistory, OrganizationGroupSummary, OrganizationPolicyGrantChange, OrganizationPolicyGroupChange, OrganizationPolicyHistory, OrganizationPolicyHistoryEntry, OrganizationProfile, Organizations, OrganizationUserDetail, RemoveOrganizationGroupUserInput, } from "./organizations/index.js";
24
- export type { PrincipalHistoryKeyProvider, PrincipalHistoryKeyScope, } from "./principalHistoryProtection.js";
25
- export type { SecurityIncident, SecurityIncidentListener, SecurityIncidentObjectKind, SecurityIncidents, } from "./securityIncidents.js";
22
+ export { Database, type DatabaseListener, type DatabaseOptions, type DatabaseSnapshot, type DatabaseStatus, } from "./runtime/database.js";
23
+ export { Events, type EventsListener, type EventsSnapshot, } from "./runtime/events.js";
24
+ export { createBrowserNetworkStatusSource, Network, type NetworkListener, type NetworkMode, type NetworkStatusSource, } from "./runtime/network.js";
25
+ export type { PrincipalHistoryKeyProvider, PrincipalHistoryKeyScope, } from "./runtime/principalHistoryProtection.js";
26
+ export { SyncBillingGate, type SyncBillingGateListener, } from "./runtime/syncBillingGate.js";
27
+ export type { SecurityIncident, SecurityIncidentListener, SecurityIncidentObjectKind, SecurityIncidents, } from "./securityIncidents/index.js";
26
28
  export { PurgedOrganizationRecoveryBillingRequiredError } from "./session/sessionRecoveryErrors.js";
27
29
  export type { CreateOrganizationOptions, Session, SessionContext, SessionCreateOrganizationResult, SessionListener, SessionRecoverOrganizationResult, SessionRegistrationRefusal, SessionRegistrationResult, SessionSnapshot, UserSession, } from "./session/sessionTypes.js";
28
- export { SyncBillingGate, type SyncBillingGateListener, } from "./syncBillingGate.js";
29
- export type { ResolvedUserIdentity, UserIdentities, } from "./userIdentities.js";
package/client/index.js CHANGED
@@ -1,16 +1,16 @@
1
- export { createDomainScope } from "../data/domainScope.js";
1
+ export { createDomainScope, } from "../data/shared/domainScope.js";
2
2
  export { enqueueReconciliationForEvents, } from "../sync/reconciliation/index.js";
3
3
  export { createUnavailableDirectCheckout, DirectCheckoutUnavailableError, } from "./billing/directCheckout.js";
4
4
  export { createRevenueCatPurchases, createUnavailablePurchases, PurchaseAbortedError, PurchaseAlreadyOwnedError, PurchaseCancelledError, PurchaseIdentityPendingError, PurchaseProviderStalledError, PurchasesUnavailableError, } from "./billing/purchases.js";
5
- export { Blobs } from "./blobs.js";
6
- export { createContainerDocumentObjectSyncState } from "./containerContents.js";
7
- export { Database, } from "./database.js";
8
- export { DEFAULT_DOCUMENT_ID } from "./documents.js";
9
- export { Events, } from "./events.js";
10
- export { IDENTITY_KEY_PACKAGE_FORMAT, } from "./identityKeyPackage.js";
5
+ export { Blobs } from "./blobs/index.js";
6
+ export { createContainerDocumentObjectSyncState } from "./containerContents/index.js";
7
+ export { DEFAULT_DOCUMENT_ID } from "./documents/index.js";
8
+ export { IDENTITY_KEY_PACKAGE_FORMAT, } from "./identity/keyPackage.js";
11
9
  export { createBrowserLocalKeyring, createBrowserLocalKeyringManifestStore, createIndexedDbLocalKeyringManifestStore, createIndexedDbWrappingKeyKeystore, createLocalKeyring, createLocalStorageLocalKeyringManifestStore, createMemoryLocalKeyringManifestStore, createMemoryWrappingKeyKeystore, createWebViewLocalKeyring, decodeLocalKeyringSqliteKey, encodeLocalKeyringSqliteKey, LOCAL_KEYRING_MANIFEST_FORMAT, localKeyringScopeKey, normalizeLocalKeyringScope, parseLocalKeyringManifest, serializeLocalKeyringManifest, WRAPPED_LOCAL_SECRET_FORMAT, } from "./localKeyring/index.js";
12
10
  export { createPinCodeBrowserLocalKeyring, createPinCodeWrappingKeyKeystore, isPinCodeWrappedLocalSecretEnvelope, } from "./localKeyring/localKeyringPinCode.js";
13
- export { createBrowserNetworkStatusSource, Network, } from "./network.js";
11
+ export { Database, } from "./runtime/database.js";
12
+ export { Events, } from "./runtime/events.js";
13
+ export { createBrowserNetworkStatusSource, Network, } from "./runtime/network.js";
14
+ export { SyncBillingGate, } from "./runtime/syncBillingGate.js";
14
15
  export { PurgedOrganizationRecoveryBillingRequiredError } from "./session/sessionRecoveryErrors.js";
15
- export { SyncBillingGate, } from "./syncBillingGate.js";
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,qBAAqB,CAAC;AAK1E,OAAO,EACL,8BAA8B,GAE/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,+BAA+B,EAK/B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAE5B,yBAAyB,GAO1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAyB,KAAK,EAAE,MAAM,SAAS,CAAC;AAgDvD,OAAO,EAAE,sCAAsC,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,QAAQ,GAKT,MAAM,YAAY,CAAC;AAuBpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,MAAM,GAGP,MAAM,UAAU,CAAC;AASlB,OAAO,EACL,2BAA2B,GAE5B,MAAM,sBAAsB,CAAC;AAyB9B,OAAO,EACL,yBAAyB,EACzB,sCAAsC,EACtC,wCAAwC,EACxC,kCAAkC,EAClC,kBAAkB,EAClB,2CAA2C,EAC3C,qCAAqC,EACrC,+BAA+B,EAC/B,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,mCAAmC,GACpC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,gCAAgC,EAChC,OAAO,GAIR,MAAM,WAAW,CAAC;AA8CnB,OAAO,EAAE,8CAA8C,EAAE,MAAM,iCAAiC,CAAC;AAajG,OAAO,EACL,eAAe,GAEhB,MAAM,mBAAmB,CAAC","sourcesContent":["export { createDomainScope, type DomainScope } from \"../data/domainScope\";\nexport type {\n LocalProjectionReconciledDelta,\n LocalProjectionSnapshot,\n} from \"../stores/local-projection\";\nexport {\n enqueueReconciliationForEvents,\n type ReconciliationService,\n} from \"../sync/reconciliation\";\nexport {\n createUnavailableDirectCheckout,\n type DirectCheckoutAppearance,\n type DirectCheckoutCapability,\n type DirectCheckoutConfirmation,\n type DirectCheckoutSession,\n DirectCheckoutUnavailableError,\n} from \"./billing/directCheckout\";\nexport {\n createRevenueCatPurchases,\n createUnavailablePurchases,\n PurchaseAbortedError,\n PurchaseAlreadyOwnedError,\n PurchaseCancelledError,\n PurchaseIdentityPendingError,\n PurchaseProviderStalledError,\n type PurchasesCapability,\n PurchasesUnavailableError,\n type RevenueCatBackend,\n type RevenueCatCustomerInfo,\n type RevenueCatPackage,\n type RevenueCatPurchasesConfig,\n type SyncPurchaseResult,\n type SyncSubscriptionOption,\n} from \"./billing/purchases\";\nexport { type BlobStoreFactory, Blobs } from \"./blobs\";\nexport type {\n BlobInfo,\n BlobInfoAttachmentKind,\n BlobInfoDocumentReference,\n BlobInfoInput,\n BlobInfoList,\n BlobInfoSort,\n BlobInfoSortDirection,\n BlobInfoSortKey,\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 DocumentAttributionRangesInput,\n DocumentAttributionRangesPage,\n DocumentInfo,\n DocumentInfoInput,\n LinkDocumentToContainerInput,\n MergeDocumentSummary,\n MoveDocumentToContainerInput,\n OpenContainerDocumentInput,\n PendingWriteQueueItem,\n PendingWriteQueueItemStatus,\n PendingWriteQueueObjectKind,\n PendingWriteQueueOperation,\n PendingWriteQueueOperationKind,\n PendingWriteQueueOperationStatus,\n PurgeDocumentInput,\n PurgeDocumentResult,\n SetActiveDocumentContainerInput,\n SetLinkedContainerIdsForDocument,\n UnlinkDocumentFromContainerInput,\n} from \"./containerContents\";\nexport { createContainerDocumentObjectSyncState } from \"./containerContents\";\nexport {\n Database,\n type DatabaseListener,\n type DatabaseOptions,\n type DatabaseSnapshot,\n type DatabaseStatus,\n} from \"./database\";\nexport type {\n DeviceFirst,\n DeviceFirstContainerContents,\n LocalProjectionView,\n} from \"./deviceFirst\";\nexport type {\n DocumentAttachmentStatus,\n DocumentAttachmentUpload,\n DocumentContextValue,\n DocumentList,\n DocumentSort,\n DocumentSortDirection,\n DocumentSortKey,\n DocumentStore,\n DocumentSubscriptionOptions,\n Documents,\n DocumentsRuntime,\n ListDocumentsInput,\n OpenDocumentInput,\n OpenDocumentOptions,\n PersistedDocumentListener,\n} from \"./documents\";\nexport { DEFAULT_DOCUMENT_ID } from \"./documents\";\nexport {\n Events,\n type EventsListener,\n type EventsSnapshot,\n} from \"./events\";\nexport type { FileSaver, SaveFileRequest } from \"./fileSaver\";\nexport type {\n Identity,\n IdentityGenerationResult,\n IdentityListener,\n IdentityOptions,\n IdentitySnapshot,\n} from \"./identity\";\nexport {\n IDENTITY_KEY_PACKAGE_FORMAT,\n type IdentityKeyPackage,\n} from \"./identityKeyPackage\";\nexport type {\n BrowserLocalKeyringOptions,\n IndexedDbLocalKeyringManifestStoreOptions,\n IndexedDbWrappingKeyKeystoreOptions,\n LocalKeyPurpose,\n LocalKeyring,\n LocalKeyringManifest,\n LocalKeyringManifestFormat,\n LocalKeyringManifestStorage,\n LocalKeyringManifestStore,\n LocalKeyringOptions,\n LocalKeyringScope,\n LocalKeyringSession,\n LocalSecretContext,\n LocalStorageLocalKeyringManifestStoreOptions,\n NormalizedLocalKeyringScope,\n UnwrapLocalSecretInput,\n WrapLocalSecretInput,\n WrappedLocalSecretEnvelope,\n WrappedLocalSecretFormat,\n WrappingKeyHandle,\n WrappingKeyKeystore,\n WrappingKeyMaterialStorage,\n} from \"./localKeyring\";\nexport {\n createBrowserLocalKeyring,\n createBrowserLocalKeyringManifestStore,\n createIndexedDbLocalKeyringManifestStore,\n createIndexedDbWrappingKeyKeystore,\n createLocalKeyring,\n createLocalStorageLocalKeyringManifestStore,\n createMemoryLocalKeyringManifestStore,\n createMemoryWrappingKeyKeystore,\n createWebViewLocalKeyring,\n decodeLocalKeyringSqliteKey,\n encodeLocalKeyringSqliteKey,\n LOCAL_KEYRING_MANIFEST_FORMAT,\n localKeyringScopeKey,\n normalizeLocalKeyringScope,\n parseLocalKeyringManifest,\n serializeLocalKeyringManifest,\n WRAPPED_LOCAL_SECRET_FORMAT,\n} from \"./localKeyring\";\nexport type {\n LocalKeyringPinCode,\n PinCodeBrowserLocalKeyringOptions,\n PinCodeWrappingKeyKeystoreOptions,\n} from \"./localKeyring/localKeyringPinCode\";\nexport {\n createPinCodeBrowserLocalKeyring,\n createPinCodeWrappingKeyKeystore,\n isPinCodeWrappedLocalSecretEnvelope,\n} from \"./localKeyring/localKeyringPinCode\";\nexport type { Logger } from \"./logger\";\nexport {\n createBrowserNetworkStatusSource,\n Network,\n type NetworkListener,\n type NetworkMode,\n type NetworkStatusSource,\n} from \"./network\";\nexport type {\n AbandonOrganizationPolicyMutationInput,\n AddOrganizationGroupUserInput,\n DiscardUnreadableOrganizationPolicyMutationInput,\n ImportedOrganizationUser,\n LocalOrganizationSummary,\n OrganizationBilling,\n OrganizationBillingHistory,\n OrganizationBillingHistoryEntry,\n OrganizationBillingManagementUrl,\n OrganizationBillingView,\n OrganizationContainerGrant,\n OrganizationContainerGrants,\n OrganizationDataUsage,\n OrganizationDirectory,\n OrganizationDirectoryAndGroups,\n OrganizationDirectoryUser,\n OrganizationGrantRef,\n OrganizationGroupContainer,\n OrganizationGroupContainers,\n OrganizationGroupDetails,\n OrganizationGroupMember,\n OrganizationGroupMembers,\n OrganizationGroupMutationReceipt,\n OrganizationGroupPolicyHistory,\n OrganizationGroupSummary,\n OrganizationPolicyGrantChange,\n OrganizationPolicyGroupChange,\n OrganizationPolicyHistory,\n OrganizationPolicyHistoryEntry,\n OrganizationProfile,\n Organizations,\n OrganizationUserDetail,\n RemoveOrganizationGroupUserInput,\n} from \"./organizations\";\nexport type {\n PrincipalHistoryKeyProvider,\n PrincipalHistoryKeyScope,\n} from \"./principalHistoryProtection\";\nexport type {\n SecurityIncident,\n SecurityIncidentListener,\n SecurityIncidentObjectKind,\n SecurityIncidents,\n} from \"./securityIncidents\";\nexport { PurgedOrganizationRecoveryBillingRequiredError } from \"./session/sessionRecoveryErrors\";\nexport type {\n CreateOrganizationOptions,\n Session,\n SessionContext,\n SessionCreateOrganizationResult,\n SessionListener,\n SessionRecoverOrganizationResult,\n SessionRegistrationRefusal,\n SessionRegistrationResult,\n SessionSnapshot,\n UserSession,\n} from \"./session/sessionTypes\";\nexport {\n SyncBillingGate,\n type SyncBillingGateListener,\n} from \"./syncBillingGate\";\nexport type {\n ResolvedUserIdentity,\n UserIdentities,\n} from \"./userIdentities\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAElB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EACL,8BAA8B,GAE/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,+BAA+B,EAK/B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAE5B,yBAAyB,GAO1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAyB,KAAK,EAAE,MAAM,SAAS,CAAC;AAgDvD,OAAO,EAAE,sCAAsC,EAAE,MAAM,qBAAqB,CAAC;AAuB7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAUlD,OAAO,EACL,2BAA2B,GAE5B,MAAM,uBAAuB,CAAC;AA6B/B,OAAO,EACL,yBAAyB,EACzB,sCAAsC,EACtC,wCAAwC,EACxC,kCAAkC,EAClC,kBAAkB,EAClB,2CAA2C,EAC3C,qCAAqC,EACrC,+BAA+B,EAC/B,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,mCAAmC,GACpC,MAAM,oCAAoC,CAAC;AAoC5C,OAAO,EACL,QAAQ,GAKT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,MAAM,GAGP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gCAAgC,EAChC,OAAO,GAIR,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EACL,eAAe,GAEhB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,8CAA8C,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["export {\n createDomainScope,\n type DomainScope,\n} from \"../data/shared/domainScope\";\nexport type {\n LocalProjectionReconciledDelta,\n LocalProjectionSnapshot,\n} from \"../stores/local-projection\";\nexport {\n enqueueReconciliationForEvents,\n type ReconciliationService,\n} from \"../sync/reconciliation\";\nexport {\n createUnavailableDirectCheckout,\n type DirectCheckoutAppearance,\n type DirectCheckoutCapability,\n type DirectCheckoutConfirmation,\n type DirectCheckoutSession,\n DirectCheckoutUnavailableError,\n} from \"./billing/directCheckout\";\nexport {\n createRevenueCatPurchases,\n createUnavailablePurchases,\n PurchaseAbortedError,\n PurchaseAlreadyOwnedError,\n PurchaseCancelledError,\n PurchaseIdentityPendingError,\n PurchaseProviderStalledError,\n type PurchasesCapability,\n PurchasesUnavailableError,\n type RevenueCatBackend,\n type RevenueCatCustomerInfo,\n type RevenueCatPackage,\n type RevenueCatPurchasesConfig,\n type SyncPurchaseResult,\n type SyncSubscriptionOption,\n} from \"./billing/purchases\";\nexport { type BlobStoreFactory, Blobs } from \"./blobs\";\nexport type {\n BlobInfo,\n BlobInfoAttachmentKind,\n BlobInfoDocumentReference,\n BlobInfoInput,\n BlobInfoList,\n BlobInfoSort,\n BlobInfoSortDirection,\n BlobInfoSortKey,\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 DocumentAttributionRangesInput,\n DocumentAttributionRangesPage,\n DocumentInfo,\n DocumentInfoInput,\n LinkDocumentToContainerInput,\n MergeDocumentSummary,\n MoveDocumentToContainerInput,\n OpenContainerDocumentInput,\n PendingWriteQueueItem,\n PendingWriteQueueItemStatus,\n PendingWriteQueueObjectKind,\n PendingWriteQueueOperation,\n PendingWriteQueueOperationKind,\n PendingWriteQueueOperationStatus,\n PurgeDocumentInput,\n PurgeDocumentResult,\n SetActiveDocumentContainerInput,\n SetLinkedContainerIdsForDocument,\n UnlinkDocumentFromContainerInput,\n} from \"./containerContents\";\nexport { createContainerDocumentObjectSyncState } from \"./containerContents\";\nexport type {\n DeviceFirst,\n DeviceFirstContainerContents,\n LocalProjectionView,\n} from \"./deviceFirst\";\nexport type {\n DocumentAttachmentStatus,\n DocumentAttachmentUpload,\n DocumentContextValue,\n DocumentList,\n DocumentSort,\n DocumentSortDirection,\n DocumentSortKey,\n DocumentStore,\n DocumentSubscriptionOptions,\n Documents,\n DocumentsRuntime,\n ListDocumentsInput,\n OpenDocumentInput,\n OpenDocumentOptions,\n PersistedDocumentListener,\n} from \"./documents\";\nexport { DEFAULT_DOCUMENT_ID } from \"./documents\";\nexport type { FileSaver, SaveFileRequest } from \"./host/fileSaver\";\nexport type { Logger } from \"./host/logger\";\nexport type {\n Identity,\n IdentityGenerationResult,\n IdentityListener,\n IdentityOptions,\n IdentitySnapshot,\n} from \"./identity\";\nexport {\n IDENTITY_KEY_PACKAGE_FORMAT,\n type IdentityKeyPackage,\n} from \"./identity/keyPackage\";\nexport type {\n ResolvedUserIdentity,\n UserIdentities,\n} from \"./identity/userIdentities\";\nexport type {\n BrowserLocalKeyringOptions,\n IndexedDbLocalKeyringManifestStoreOptions,\n IndexedDbWrappingKeyKeystoreOptions,\n LocalKeyPurpose,\n LocalKeyring,\n LocalKeyringManifest,\n LocalKeyringManifestFormat,\n LocalKeyringManifestStorage,\n LocalKeyringManifestStore,\n LocalKeyringOptions,\n LocalKeyringScope,\n LocalKeyringSession,\n LocalSecretContext,\n LocalStorageLocalKeyringManifestStoreOptions,\n NormalizedLocalKeyringScope,\n UnwrapLocalSecretInput,\n WrapLocalSecretInput,\n WrappedLocalSecretEnvelope,\n WrappedLocalSecretFormat,\n WrappingKeyHandle,\n WrappingKeyKeystore,\n WrappingKeyMaterialStorage,\n} from \"./localKeyring\";\nexport {\n createBrowserLocalKeyring,\n createBrowserLocalKeyringManifestStore,\n createIndexedDbLocalKeyringManifestStore,\n createIndexedDbWrappingKeyKeystore,\n createLocalKeyring,\n createLocalStorageLocalKeyringManifestStore,\n createMemoryLocalKeyringManifestStore,\n createMemoryWrappingKeyKeystore,\n createWebViewLocalKeyring,\n decodeLocalKeyringSqliteKey,\n encodeLocalKeyringSqliteKey,\n LOCAL_KEYRING_MANIFEST_FORMAT,\n localKeyringScopeKey,\n normalizeLocalKeyringScope,\n parseLocalKeyringManifest,\n serializeLocalKeyringManifest,\n WRAPPED_LOCAL_SECRET_FORMAT,\n} from \"./localKeyring\";\nexport type {\n LocalKeyringPinCode,\n PinCodeBrowserLocalKeyringOptions,\n PinCodeWrappingKeyKeystoreOptions,\n} from \"./localKeyring/localKeyringPinCode\";\nexport {\n createPinCodeBrowserLocalKeyring,\n createPinCodeWrappingKeyKeystore,\n isPinCodeWrappedLocalSecretEnvelope,\n} from \"./localKeyring/localKeyringPinCode\";\nexport type {\n AbandonOrganizationPolicyMutationInput,\n AddOrganizationGroupUserInput,\n DiscardUnreadableOrganizationPolicyMutationInput,\n ImportedOrganizationUser,\n LocalOrganizationSummary,\n OrganizationBilling,\n OrganizationBillingHistory,\n OrganizationBillingHistoryEntry,\n OrganizationBillingManagementUrl,\n OrganizationBillingView,\n OrganizationContainerGrant,\n OrganizationContainerGrants,\n OrganizationDataUsage,\n OrganizationDirectory,\n OrganizationDirectoryAndGroups,\n OrganizationDirectoryUser,\n OrganizationGrantRef,\n OrganizationGroupContainer,\n OrganizationGroupContainers,\n OrganizationGroupDetails,\n OrganizationGroupMember,\n OrganizationGroupMembers,\n OrganizationGroupMutationReceipt,\n OrganizationGroupPolicyHistory,\n OrganizationGroupSummary,\n OrganizationPolicyGrantChange,\n OrganizationPolicyGroupChange,\n OrganizationPolicyHistory,\n OrganizationPolicyHistoryEntry,\n OrganizationProfile,\n Organizations,\n OrganizationUserDetail,\n RemoveOrganizationGroupUserInput,\n} from \"./organizations\";\nexport {\n Database,\n type DatabaseListener,\n type DatabaseOptions,\n type DatabaseSnapshot,\n type DatabaseStatus,\n} from \"./runtime/database\";\nexport {\n Events,\n type EventsListener,\n type EventsSnapshot,\n} from \"./runtime/events\";\nexport {\n createBrowserNetworkStatusSource,\n Network,\n type NetworkListener,\n type NetworkMode,\n type NetworkStatusSource,\n} from \"./runtime/network\";\nexport type {\n PrincipalHistoryKeyProvider,\n PrincipalHistoryKeyScope,\n} from \"./runtime/principalHistoryProtection\";\nexport {\n SyncBillingGate,\n type SyncBillingGateListener,\n} from \"./runtime/syncBillingGate\";\nexport type {\n SecurityIncident,\n SecurityIncidentListener,\n SecurityIncidentObjectKind,\n SecurityIncidents,\n} from \"./securityIncidents\";\nexport { PurgedOrganizationRecoveryBillingRequiredError } from \"./session/sessionRecoveryErrors\";\nexport type {\n CreateOrganizationOptions,\n Session,\n SessionContext,\n SessionCreateOrganizationResult,\n SessionListener,\n SessionRecoverOrganizationResult,\n SessionRegistrationRefusal,\n SessionRegistrationResult,\n SessionSnapshot,\n UserSession,\n} from \"./session/sessionTypes\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"currentPrincipalMutations.js","sourceRoot":"","sources":["currentPrincipalMutations.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C,CAAC;QACH,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAChC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,YAAY,CACxD,CAAC;QACF,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACzE,OAAO,GAAG,MAAM,8BAA8B,CAAC;YAC7C,GAAG,MAAM;YACT,oBAAoB;YACpB,UAAU;YACV,YAAY,EAAE,UAAU,CAAC,MAAM,CAC7B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,YAAY,CACxD;YACD,sBAAsB,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB;SAClE,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,GAAG,MAAM,iCAAiC,CAAC;YAChD,GAAG,MAAM;YACT,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,cAAc,EAAE,MAAM,YAAY,CAChC,iBAAiB,CACf,UAAU,CAAC,MAAM,CACf,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,aAAa,CACrD,CACF,CACF;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,MAAM,sCAAsC,CAAC;YACrD,GAAG,MAAM;YACT,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;YAC/C,YAAY,EAAE,MAAM,YAAY,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;SAChE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { SigningKeyPair } from \"@tearleads/crypto\";\nimport type { PutPrincipalPolicyRequest } from \"@tearleads/validators/request\";\nimport { assertProjectionVerificationCurrent } from \"../../data/keyingProjectionVerification/types\";\nimport { commitCurrentGroupPolicyMutation } from \"../../workflows/organizations/commitCurrentGroupPolicyMutation\";\nimport { assertGroupMembershipName } from \"../../workflows/organizations/groupMembershipName\";\nimport { createRuntimeGroupMetadataAccess } from \"../../workflows/organizations/groupMetadataRuntime\";\nimport {\n buildAddGroupUserPolicyRequest,\n buildGroupAccessSetShrinkPolicyRequest,\n buildRemoveGroupUserPolicyRequest,\n} from \"../../workflows/organizations/groupPolicyRequests\";\nimport {\n createRuntimeCurrentGroupMutation,\n type RuntimeCurrentGroupMutationContext,\n} from \"../../workflows/organizations/runtimeCurrentGroupMutation\";\nimport {\n projectionUserIds,\n resolveRequiredUserIdentities,\n} from \"../../workflows/organizations/trustedOrganizationUsers\";\nimport type { InternalWorkflowRuntimeInput } from \"../workflowRuntime\";\nimport { preparePrincipalContainerMutations } from \"./principalContainerMutations\";\n\ntype CurrentGroupMutation =\n | {\n readonly kind: \"add\";\n readonly expectedGroupName: string;\n readonly targetUserId: string;\n }\n | {\n readonly kind: \"remove\";\n readonly expectedGroupName: string;\n readonly removedUserId: string;\n }\n | { readonly kind: \"revoke\"; readonly revokedContainerId: string };\n\n/** Built-in hosts with private custody use bounded current-policy mutation work. */\ninterface CurrentPrincipalMutationInput {\n readonly runtime: InternalWorkflowRuntimeInput;\n readonly organizationId: string;\n readonly signerUserId: string;\n readonly signingFingerprint: string;\n readonly signingKeyPair: SigningKeyPair;\n readonly stillCurrent: () => boolean;\n}\n\nexport function createCurrentPrincipalMutation(\n input: CurrentPrincipalMutationInput,\n) {\n const mutate = createRuntimeCurrentGroupMutation(input.runtime);\n if (!mutate) return undefined;\n return (groupId: string, mutation: CurrentGroupMutation) =>\n mutate(\n {\n groupId,\n organizationId: input.organizationId,\n signerUserId: input.signerUserId,\n stillCurrent: input.stillCurrent,\n },\n async (context) => {\n const prepareChange = async (\n selected: RuntimeCurrentGroupMutationContext,\n change: CurrentGroupMutation,\n ) => ({\n context: selected,\n request: await buildCurrentMutationRequest(input, selected, change),\n prepareContainerMutations: (\n nextPolicy: Parameters<\n typeof preparePrincipalContainerMutations\n >[0][\"nextPolicy\"],\n preceding?: Parameters<\n typeof preparePrincipalContainerMutations\n >[0][\"preceding\"],\n ) =>\n preparePrincipalContainerMutations({\n preceding,\n currentPolicy: selected.currentPolicy,\n nextPolicy,\n groupId: selected.currentPolicy.currentState.principalId,\n organizationId: input.organizationId,\n runtime: input.runtime,\n stillCurrent: selected.stillCurrent,\n recitationStillCurrent: input.stillCurrent,\n resolveAuthoredPolicyReferences:\n selected.resolveAuthoredPolicyReferences,\n revokedContainerId:\n change.kind === \"revoke\"\n ? change.revokedContainerId\n : undefined,\n }),\n });\n const primary = await prepareChange(context, mutation);\n let member: Awaited<ReturnType<typeof prepareChange>> | undefined;\n if (mutation.kind === \"add\" && groupId !== context.memberGroupId) {\n const members = await context.loadGroup(context.memberGroupId);\n if (\n !members.currentPolicy.currentProjection.some(\n (entry) => entry.userId === mutation.targetUserId,\n )\n ) {\n member = await prepareChange(members, {\n ...mutation,\n expectedGroupName: \"Members\",\n });\n }\n }\n assertProjectionVerificationCurrent(context.stillCurrent);\n const response = await commitCurrentGroupPolicyMutation({\n ...input,\n apiClient: input.runtime.apiClient,\n groupId,\n ...primary,\n member,\n resolveTrustedUserIdentity: input.runtime.resolveTrustedUserIdentity,\n });\n return {\n response,\n memberGroupId: context.memberGroupId,\n enrolled: Boolean(member),\n };\n },\n );\n}\n\nasync function buildCurrentMutationRequest(\n input: CurrentPrincipalMutationInput,\n context: RuntimeCurrentGroupMutationContext,\n mutation: CurrentGroupMutation,\n): Promise<PutPrincipalPolicyRequest> {\n const shared = {\n ...context,\n signerUserId: input.signerUserId,\n signingFingerprint: input.signingFingerprint,\n signingKeyPair: input.signingKeyPair,\n };\n if (mutation.kind !== \"revoke\") {\n await assertGroupMembershipName(\n context.currentPolicy,\n mutation.expectedGroupName,\n createRuntimeGroupMetadataAccess(\n input.runtime,\n input.organizationId,\n context.stillCurrent,\n context.verifyMetadataContainer,\n ).readName,\n );\n }\n const resolveUsers = (userIds: readonly string[]) =>\n resolveRequiredUserIdentities({\n resolveTrustedUserIdentity: input.runtime.resolveTrustedUserIdentity,\n userIds,\n });\n const projection = context.currentPolicy.currentProjection;\n let request: PutPrincipalPolicyRequest;\n if (mutation.kind === \"add\") {\n const currentUserSecretKey =\n input.runtime.crypto.encapsulationKeyPair?.secretKey;\n if (!currentUserSecretKey)\n throw new Error(\"Organization encryption context is unavailable\");\n const identities = await resolveUsers([\n ...projectionUserIds(projection),\n mutation.targetUserId,\n ]);\n const targetUser = identities.find(\n (identity) => identity.userId === mutation.targetUserId,\n );\n if (!targetUser) throw new Error(\"Group target identity is unavailable\");\n request = await buildAddGroupUserPolicyRequest({\n ...shared,\n currentUserSecretKey,\n targetUser,\n currentUsers: identities.filter(\n (identity) => identity.userId !== mutation.targetUserId,\n ),\n reportSecurityIncident: input.runtime.util.reportSecurityIncident,\n });\n } else if (mutation.kind === \"remove\") {\n request = await buildRemoveGroupUserPolicyRequest({\n ...shared,\n removedUserId: mutation.removedUserId,\n remainingUsers: await resolveUsers(\n projectionUserIds(\n projection.filter(\n (member) => member.userId !== mutation.removedUserId,\n ),\n ),\n ),\n });\n } else {\n request = await buildGroupAccessSetShrinkPolicyRequest({\n ...shared,\n revokedContainerId: mutation.revokedContainerId,\n currentUsers: await resolveUsers(projectionUserIds(projection)),\n });\n }\n\n return request;\n}\n"]}
1
+ {"version":3,"file":"currentPrincipalMutations.js","sourceRoot":"","sources":["currentPrincipalMutations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,EAAE,gCAAgC,EAAE,MAAM,gEAAgE,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AACtG,OAAO,EACL,8BAA8B,EAC9B,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,mDAA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V,YAAY,EAAE,UAAU,CAAC,MAAM,CAC7B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,YAAY,CACxD;YACD,sBAAsB,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB;SAClE,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,GAAG,MAAM,iCAAiC,CAAC;YAChD,GAAG,MAAM;YACT,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,cAAc,EAAE,MAAM,YAAY,CAChC,iBAAiB,CACf,UAAU,CAAC,MAAM,CACf,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,aAAa,CACrD,CACF,CACF;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,MAAM,sCAAsC,CAAC;YACrD,GAAG,MAAM;YACT,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;YAC/C,YAAY,EAAE,MAAM,YAAY,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;SAChE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { SigningKeyPair } from \"@tearleads/crypto\";\nimport type { PutPrincipalPolicyRequest } from \"@tearleads/validators/request\";\nimport { assertProjectionVerificationCurrent } from \"../../data/keyingProjectionVerification/types\";\nimport { commitCurrentGroupPolicyMutation } from \"../../workflows/organizations/commitCurrentGroupPolicyMutation\";\nimport { assertGroupMembershipName } from \"../../workflows/organizations/groupMembershipName\";\nimport { createRuntimeGroupMetadataAccess } from \"../../workflows/organizations/groupMetadataRuntime\";\nimport {\n buildAddGroupUserPolicyRequest,\n buildGroupAccessSetShrinkPolicyRequest,\n buildRemoveGroupUserPolicyRequest,\n} from \"../../workflows/organizations/groupPolicyRequests\";\nimport {\n createRuntimeCurrentGroupMutation,\n type RuntimeCurrentGroupMutationContext,\n} from \"../../workflows/organizations/runtimeCurrentGroupMutation\";\nimport {\n projectionUserIds,\n resolveRequiredUserIdentities,\n} from \"../../workflows/organizations/trustedOrganizationUsers\";\nimport type { InternalWorkflowRuntimeInput } from \"../runtime/workflowRuntime\";\nimport { preparePrincipalContainerMutations } from \"./principalContainerMutations\";\n\ntype CurrentGroupMutation =\n | {\n readonly kind: \"add\";\n readonly expectedGroupName: string;\n readonly targetUserId: string;\n }\n | {\n readonly kind: \"remove\";\n readonly expectedGroupName: string;\n readonly removedUserId: string;\n }\n | { readonly kind: \"revoke\"; readonly revokedContainerId: string };\n\n/** Built-in hosts with private custody use bounded current-policy mutation work. */\ninterface CurrentPrincipalMutationInput {\n readonly runtime: InternalWorkflowRuntimeInput;\n readonly organizationId: string;\n readonly signerUserId: string;\n readonly signingFingerprint: string;\n readonly signingKeyPair: SigningKeyPair;\n readonly stillCurrent: () => boolean;\n}\n\nexport function createCurrentPrincipalMutation(\n input: CurrentPrincipalMutationInput,\n) {\n const mutate = createRuntimeCurrentGroupMutation(input.runtime);\n if (!mutate) return undefined;\n return (groupId: string, mutation: CurrentGroupMutation) =>\n mutate(\n {\n groupId,\n organizationId: input.organizationId,\n signerUserId: input.signerUserId,\n stillCurrent: input.stillCurrent,\n },\n async (context) => {\n const prepareChange = async (\n selected: RuntimeCurrentGroupMutationContext,\n change: CurrentGroupMutation,\n ) => ({\n context: selected,\n request: await buildCurrentMutationRequest(input, selected, change),\n prepareContainerMutations: (\n nextPolicy: Parameters<\n typeof preparePrincipalContainerMutations\n >[0][\"nextPolicy\"],\n preceding?: Parameters<\n typeof preparePrincipalContainerMutations\n >[0][\"preceding\"],\n ) =>\n preparePrincipalContainerMutations({\n preceding,\n currentPolicy: selected.currentPolicy,\n nextPolicy,\n groupId: selected.currentPolicy.currentState.principalId,\n organizationId: input.organizationId,\n runtime: input.runtime,\n stillCurrent: selected.stillCurrent,\n recitationStillCurrent: input.stillCurrent,\n resolveAuthoredPolicyReferences:\n selected.resolveAuthoredPolicyReferences,\n revokedContainerId:\n change.kind === \"revoke\"\n ? change.revokedContainerId\n : undefined,\n }),\n });\n const primary = await prepareChange(context, mutation);\n let member: Awaited<ReturnType<typeof prepareChange>> | undefined;\n if (mutation.kind === \"add\" && groupId !== context.memberGroupId) {\n const members = await context.loadGroup(context.memberGroupId);\n if (\n !members.currentPolicy.currentProjection.some(\n (entry) => entry.userId === mutation.targetUserId,\n )\n ) {\n member = await prepareChange(members, {\n ...mutation,\n expectedGroupName: \"Members\",\n });\n }\n }\n assertProjectionVerificationCurrent(context.stillCurrent);\n const response = await commitCurrentGroupPolicyMutation({\n ...input,\n apiClient: input.runtime.apiClient,\n groupId,\n ...primary,\n member,\n resolveTrustedUserIdentity: input.runtime.resolveTrustedUserIdentity,\n });\n return {\n response,\n memberGroupId: context.memberGroupId,\n enrolled: Boolean(member),\n };\n },\n );\n}\n\nasync function buildCurrentMutationRequest(\n input: CurrentPrincipalMutationInput,\n context: RuntimeCurrentGroupMutationContext,\n mutation: CurrentGroupMutation,\n): Promise<PutPrincipalPolicyRequest> {\n const shared = {\n ...context,\n signerUserId: input.signerUserId,\n signingFingerprint: input.signingFingerprint,\n signingKeyPair: input.signingKeyPair,\n };\n if (mutation.kind !== \"revoke\") {\n await assertGroupMembershipName(\n context.currentPolicy,\n mutation.expectedGroupName,\n createRuntimeGroupMetadataAccess(\n input.runtime,\n input.organizationId,\n context.stillCurrent,\n context.verifyMetadataContainer,\n ).readName,\n );\n }\n const resolveUsers = (userIds: readonly string[]) =>\n resolveRequiredUserIdentities({\n resolveTrustedUserIdentity: input.runtime.resolveTrustedUserIdentity,\n userIds,\n });\n const projection = context.currentPolicy.currentProjection;\n let request: PutPrincipalPolicyRequest;\n if (mutation.kind === \"add\") {\n const currentUserSecretKey =\n input.runtime.crypto.encapsulationKeyPair?.secretKey;\n if (!currentUserSecretKey)\n throw new Error(\"Organization encryption context is unavailable\");\n const identities = await resolveUsers([\n ...projectionUserIds(projection),\n mutation.targetUserId,\n ]);\n const targetUser = identities.find(\n (identity) => identity.userId === mutation.targetUserId,\n );\n if (!targetUser) throw new Error(\"Group target identity is unavailable\");\n request = await buildAddGroupUserPolicyRequest({\n ...shared,\n currentUserSecretKey,\n targetUser,\n currentUsers: identities.filter(\n (identity) => identity.userId !== mutation.targetUserId,\n ),\n reportSecurityIncident: input.runtime.util.reportSecurityIncident,\n });\n } else if (mutation.kind === \"remove\") {\n request = await buildRemoveGroupUserPolicyRequest({\n ...shared,\n removedUserId: mutation.removedUserId,\n remainingUsers: await resolveUsers(\n projectionUserIds(\n projection.filter(\n (member) => member.userId !== mutation.removedUserId,\n ),\n ),\n ),\n });\n } else {\n request = await buildGroupAccessSetShrinkPolicyRequest({\n ...shared,\n revokedContainerId: mutation.revokedContainerId,\n currentUsers: await resolveUsers(projectionUserIds(projection)),\n });\n }\n\n return request;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { ContainerContents } from "../containerContents.js";
2
- import type { InternalRuntime } from "../workflowRuntime.js";
1
+ import type { ContainerContents } from "../containerContents/index.js";
2
+ import type { InternalRuntime } from "../runtime/workflowRuntime.js";
3
3
  import type { Organizations } from "./organizationsTypes.js";
4
4
  export type { ImportedOrganizationUser, LocalOrganizationSummary, OrganizationBilling, OrganizationBillingHistory, OrganizationBillingHistoryEntry, OrganizationBillingManagementUrl, OrganizationBillingView, OrganizationContainerGrant, OrganizationContainerGrants, OrganizationDataUsage, OrganizationDirectory, OrganizationDirectoryAndGroups, OrganizationDirectoryUser, OrganizationGroupContainer, OrganizationGroupContainers, OrganizationGroupDetails, OrganizationGroupMember, OrganizationGroupMembers, OrganizationGroupPolicyHistory, OrganizationGroupSummary, OrganizationPolicyGrantChange, OrganizationPolicyGroupChange, OrganizationPolicyHistory, OrganizationPolicyHistoryEntry, OrganizationProfile, OrganizationUserDetail, } from "../../workflows/organizations/index.js";
5
5
  export type { OrganizationGroupMutationReceipt, Organizations, } from "./organizationsTypes.js";