@tearleads/client-sdk 0.1.14 → 0.1.15

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 (200) hide show
  1. package/client/containerContents.js +2 -1
  2. package/client/containerContents.js.map +1 -1
  3. package/data/documents/blob/shared/types.d.ts +4 -0
  4. package/data/documents/blob/shared/types.js.map +1 -1
  5. package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js +2 -0
  6. package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js.map +1 -1
  7. package/data/keyingProjectionVerification/checkpointContext.d.ts +2 -1
  8. package/data/keyingProjectionVerification/checkpointContext.js +22 -0
  9. package/data/keyingProjectionVerification/checkpointContext.js.map +1 -1
  10. package/data/keyingProjectionVerification/containerDestinationVerification.js +11 -1
  11. package/data/keyingProjectionVerification/containerDestinationVerification.js.map +1 -1
  12. package/data/keyingProjectionVerification/containerManifestVerification.js.map +1 -1
  13. package/data/keyingProjectionVerification/containerPathVerification.js.map +1 -1
  14. package/data/keyingProjectionVerification/containerProjectionVerification.d.ts +3 -2
  15. package/data/keyingProjectionVerification/containerProjectionVerification.js +10 -11
  16. package/data/keyingProjectionVerification/containerProjectionVerification.js.map +1 -1
  17. package/data/keyingProjectionVerification/documentManifestPolicies.js.map +1 -1
  18. package/data/keyingProjectionVerification/documentManifestVerification.js.map +1 -1
  19. package/data/keyingProjectionVerification/documentProjectionVerification.d.ts +2 -3
  20. package/data/keyingProjectionVerification/documentProjectionVerification.js +4 -0
  21. package/data/keyingProjectionVerification/documentProjectionVerification.js.map +1 -1
  22. package/data/keyingProjectionVerification/mergeProjectionPolicyEvidence.js +14 -12
  23. package/data/keyingProjectionVerification/mergeProjectionPolicyEvidence.js.map +1 -1
  24. package/data/keyingProjectionVerification/organizationFounderBinding.js.map +1 -1
  25. package/data/keyingProjectionVerification/projectionAuthorizationEvidence.js +33 -6
  26. package/data/keyingProjectionVerification/projectionAuthorizationEvidence.js.map +1 -1
  27. package/data/keyingProjectionVerification/projectionLifetimes.js +13 -0
  28. package/data/keyingProjectionVerification/projectionLifetimes.js.map +1 -0
  29. package/data/keyingProjectionVerification/projectionPolicyEvidence.js +19 -66
  30. package/data/keyingProjectionVerification/projectionPolicyEvidence.js.map +1 -1
  31. package/data/keyingProjectionVerification/types.d.ts +13 -2
  32. package/data/keyingProjectionVerification/types.js +15 -0
  33. package/data/keyingProjectionVerification/types.js.map +1 -1
  34. package/data/persistence/keyingCheckpointAdvancePersistence.js +4 -1
  35. package/data/persistence/keyingCheckpointAdvancePersistence.js.map +1 -1
  36. package/data/persistence/organizationFounderPersistence.js +2 -2
  37. package/data/persistence/organizationFounderPersistence.js.map +1 -1
  38. package/data/persistence/principalAuthorizationCheckpoints.js +29 -0
  39. package/data/persistence/principalAuthorizationCheckpoints.js.map +1 -0
  40. package/data/persistence/principalHistoryEvidencePersistence.d.ts +30 -0
  41. package/data/persistence/principalHistoryPrefixPersistence.d.ts +24 -0
  42. package/data/persistence/principalHistoryPrefixPersistence.js +6 -2
  43. package/data/persistence/principalHistoryPrefixPersistence.js.map +1 -1
  44. package/data/persistence/principalHistoryStagePersistence.d.ts +21 -0
  45. package/data/principals/principalHistoryRuntime.js +12 -0
  46. package/data/principals/principalHistoryRuntime.js.map +1 -0
  47. package/data/principals/principalHistoryStageProtection.js +2 -12
  48. package/data/principals/principalHistoryStageProtection.js.map +1 -1
  49. package/data/principals/principalPolicyEvidence.d.ts +2 -2
  50. package/data/principals/principalPolicyEvidence.js.map +1 -1
  51. package/data/sqlite/principalHistoryEvidenceSchema.d.ts +308 -0
  52. package/data/sqlite/principalHistoryStageSchema.d.ts +119 -0
  53. package/index.d.ts +2 -2
  54. package/index.js +1 -1
  55. package/index.js.map +1 -1
  56. package/internal/api-client/ApiCache.d.ts +54 -0
  57. package/internal/api-client/ApiClient.d.ts +255 -309
  58. package/internal/api-client/ApiClient.js +15 -6
  59. package/internal/api-client/ApiClient.js.map +1 -1
  60. package/internal/api-client/index.d.ts +1 -0
  61. package/internal/api-client/index.js.map +1 -1
  62. package/internal/api-client/principalHistoryDeadline.js +20 -0
  63. package/internal/api-client/principalHistoryDeadline.js.map +1 -0
  64. package/internal/api-client/principalHistoryRequest.js +59 -22
  65. package/internal/api-client/principalHistoryRequest.js.map +1 -1
  66. package/internal/api-client/principalHistoryRequestContext.js +18 -5
  67. package/internal/api-client/principalHistoryRequestContext.js.map +1 -1
  68. package/internal/api-client/principalPolicyRequests.d.ts +799 -0
  69. package/internal/api-client/principalPolicyRequests.js +9 -4
  70. package/internal/api-client/principalPolicyRequests.js.map +1 -1
  71. package/internal/api-client/projectionPolicyHistoryPages.d.ts +9 -0
  72. package/internal/api-client/projectionPolicyHistoryPages.js +88 -0
  73. package/internal/api-client/projectionPolicyHistoryPages.js.map +1 -0
  74. package/internal/api-client/writerProjectionRequests.js +26 -0
  75. package/internal/api-client/writerProjectionRequests.js.map +1 -0
  76. package/internal/crypto/keying/principalPolicyHistory.js +4 -0
  77. package/internal/crypto/keying/principalPolicyHistory.js.map +1 -1
  78. package/internal/crypto/keying/principalPolicyHistoryTypes.d.ts +2 -0
  79. package/internal/crypto/keying/principalPolicyHistoryTypes.js.map +1 -1
  80. package/internal/crypto/projectionHistorySlots.js +0 -4
  81. package/internal/crypto/projectionHistorySlots.js.map +1 -1
  82. package/internal/validators/operation/index.d.ts +1 -0
  83. package/internal/validators/operation/index.js +1 -0
  84. package/internal/validators/operation/index.js.map +1 -1
  85. package/internal/validators/operation/principals.d.ts +38 -16
  86. package/internal/validators/operation/principals.js +11 -5
  87. package/internal/validators/operation/principals.js.map +1 -1
  88. package/internal/validators/operation/projectionPolicyHistory.d.ts +512 -0
  89. package/internal/validators/operation/projectionPolicyHistory.js +37 -0
  90. package/internal/validators/operation/projectionPolicyHistory.js.map +1 -0
  91. package/internal/validators/operation/registry.d.ts +2 -0
  92. package/internal/validators/operation/registry.js +2 -0
  93. package/internal/validators/operation/registry.js.map +1 -1
  94. package/internal/validators/operation/writerProjections.d.ts +178 -1224
  95. package/internal/validators/operation/writerProjections.js +9 -2
  96. package/internal/validators/operation/writerProjections.js.map +1 -1
  97. package/internal/validators/response/container.d.ts +84 -612
  98. package/internal/validators/response/documentMutation.d.ts +84 -612
  99. package/internal/validators/response/index.d.ts +1 -0
  100. package/internal/validators/response/index.js +1 -0
  101. package/internal/validators/response/index.js.map +1 -1
  102. package/internal/validators/response/organizationBilling.d.ts +1 -0
  103. package/internal/validators/response/organizationBilling.js +1 -1
  104. package/internal/validators/response/organizationBilling.js.map +1 -1
  105. package/internal/validators/response/principalHistoryPreparation.js +28 -1
  106. package/internal/validators/response/principalHistoryPreparation.js.map +1 -1
  107. package/internal/validators/response/principalPolicySnapshotPage.d.ts +388 -0
  108. package/internal/validators/response/principalPolicySnapshotPage.js +24 -0
  109. package/internal/validators/response/principalPolicySnapshotPage.js.map +1 -0
  110. package/internal/validators/response/projectionPolicyEvidence.d.ts +85 -613
  111. package/internal/validators/response/projectionPolicyEvidence.js +10 -5
  112. package/internal/validators/response/projectionPolicyEvidence.js.map +1 -1
  113. package/package.json +1 -1
  114. package/stores/documents/documentStore/attachmentHydration.js +3 -0
  115. package/stores/documents/documentStore/attachmentHydration.js.map +1 -1
  116. package/stores/documents/documentStore/syncDetachedAttachments.js +3 -0
  117. package/stores/documents/documentStore/syncDetachedAttachments.js.map +1 -1
  118. package/workflows/blobs/decrypt.d.ts +1 -1
  119. package/workflows/blobs/decrypt.js +3 -1
  120. package/workflows/blobs/decrypt.js.map +1 -1
  121. package/workflows/blobs/detach.js +6 -1
  122. package/workflows/blobs/detach.js.map +1 -1
  123. package/workflows/blobs/hydrate.d.ts +3 -1
  124. package/workflows/blobs/hydrate.js +2 -0
  125. package/workflows/blobs/hydrate.js.map +1 -1
  126. package/workflows/blobs/retainedAttachmentVerification.js +2 -0
  127. package/workflows/blobs/retainedAttachmentVerification.js.map +1 -1
  128. package/workflows/container-contents/container-state/createAdoption.js +2 -0
  129. package/workflows/container-contents/container-state/createAdoption.js.map +1 -1
  130. package/workflows/container-contents/container-state/createWithMetadata.js +7 -39
  131. package/workflows/container-contents/container-state/createWithMetadata.js.map +1 -1
  132. package/workflows/container-contents/container-state/createWithMetadataPlan.js +68 -0
  133. package/workflows/container-contents/container-state/createWithMetadataPlan.js.map +1 -0
  134. package/workflows/container-contents/remoteContainerState.js +3 -1
  135. package/workflows/container-contents/remoteContainerState.js.map +1 -1
  136. package/workflows/container-contents/remoteHydration/verifiedDestination.js +3 -0
  137. package/workflows/container-contents/remoteHydration/verifiedDestination.js.map +1 -1
  138. package/workflows/container-contents/runtime.d.ts +3 -0
  139. package/workflows/container-contents/runtime.js +7 -6
  140. package/workflows/container-contents/runtime.js.map +1 -1
  141. package/workflows/documents/create.d.ts +2 -15
  142. package/workflows/documents/create.js +9 -64
  143. package/workflows/documents/create.js.map +1 -1
  144. package/workflows/documents/createProjection.d.ts +14 -0
  145. package/workflows/documents/createProjection.js +26 -0
  146. package/workflows/documents/createProjection.js.map +1 -0
  147. package/workflows/documents/createResponse.js +49 -0
  148. package/workflows/documents/createResponse.js.map +1 -0
  149. package/workflows/documents/linkSetBlobRewraps.js +2 -0
  150. package/workflows/documents/linkSetBlobRewraps.js.map +1 -1
  151. package/workflows/documents/runtime.d.ts +3 -0
  152. package/workflows/documents/runtime.js +3 -2
  153. package/workflows/documents/runtime.js.map +1 -1
  154. package/workflows/documents/syncFailureClassification.js +3 -1
  155. package/workflows/documents/syncFailureClassification.js.map +1 -1
  156. package/workflows/principals/index.d.ts +2 -0
  157. package/workflows/principals/index.js +1 -0
  158. package/workflows/principals/index.js.map +1 -1
  159. package/workflows/principals/policyVerification.js.map +1 -1
  160. package/workflows/principals/principalHistoryRecoveryAuthority.js +20 -0
  161. package/workflows/principals/principalHistoryRecoveryAuthority.js.map +1 -0
  162. package/workflows/principals/principalHistoryRecoveryStage.js +1 -1
  163. package/workflows/principals/principalHistoryRecoveryStage.js.map +1 -1
  164. package/workflows/principals/principalHistoryRecoveryTypes.d.ts +3 -3
  165. package/workflows/principals/principalHistoryRecoveryTypes.js.map +1 -1
  166. package/workflows/principals/principalHistoryRecoveryVerification.js +6 -1
  167. package/workflows/principals/principalHistoryRecoveryVerification.js.map +1 -1
  168. package/workflows/principals/principalRecoveryOutage.js +1 -1
  169. package/workflows/principals/principalRecoveryOutage.js.map +1 -1
  170. package/workflows/principals/publicPrincipalHistoryAuthority.js +60 -0
  171. package/workflows/principals/publicPrincipalHistoryAuthority.js.map +1 -0
  172. package/workflows/principals/publicPrincipalHistoryPage.js +87 -0
  173. package/workflows/principals/publicPrincipalHistoryPage.js.map +1 -0
  174. package/workflows/principals/publicPrincipalHistoryProgress.js +178 -0
  175. package/workflows/principals/publicPrincipalHistoryProgress.js.map +1 -0
  176. package/workflows/principals/publicPrincipalHistoryTypes.d.ts +39 -0
  177. package/workflows/principals/publicPrincipalHistoryTypes.js +2 -0
  178. package/workflows/principals/publicPrincipalHistoryTypes.js.map +1 -0
  179. package/workflows/principals/publicProjectionDirectory.js +40 -0
  180. package/workflows/principals/publicProjectionDirectory.js.map +1 -0
  181. package/workflows/principals/publicProjectionPrincipal.js +53 -0
  182. package/workflows/principals/publicProjectionPrincipal.js.map +1 -0
  183. package/workflows/principals/recoverPrincipalPolicyHistory.js +4 -1
  184. package/workflows/principals/recoverPrincipalPolicyHistory.js.map +1 -1
  185. package/workflows/principals/recoverProjectionPolicyHistory.d.ts +9 -0
  186. package/workflows/principals/recoverProjectionPolicyHistory.js +98 -0
  187. package/workflows/principals/recoverProjectionPolicyHistory.js.map +1 -0
  188. package/workflows/principals/recoverPublicPrincipalHistory.js +176 -0
  189. package/workflows/principals/recoverPublicPrincipalHistory.js.map +1 -0
  190. package/workflows/principals/recoverScopedPrincipalPolicyHistory.js +2 -5
  191. package/workflows/principals/recoverScopedPrincipalPolicyHistory.js.map +1 -1
  192. package/workflows/principals/runtimePolicyRecovery.js +2 -1
  193. package/workflows/principals/runtimePolicyRecovery.js.map +1 -1
  194. package/workflows/principals/runtimePolicyWarmer.js +2 -0
  195. package/workflows/principals/runtimePolicyWarmer.js.map +1 -1
  196. package/workflows/principals/runtimeProjectionPolicyRecovery.js +56 -0
  197. package/workflows/principals/runtimeProjectionPolicyRecovery.js.map +1 -0
  198. package/workflows/principals/selectPublicPrincipalHistory.js +90 -0
  199. package/workflows/principals/selectPublicPrincipalHistory.js.map +1 -0
  200. package/workflows/registration/provisioningBootstrapBuilders.d.ts +21 -153
@@ -1 +1 @@
1
- {"version":3,"file":"principalHistoryPrefixPersistence.js","sourceRoot":"","sources":["principalHistoryPrefixPersistence.ts"],"names":[],"mappings":"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","sourcesContent":["import { and, eq } from \"drizzle-orm\";\nimport { assertProjectionVerificationCurrent } from \"../keyingProjectionVerification/types\";\nimport {\n principalHistoryEvidenceTables,\n principalHistoryPrefixes,\n} from \"../sqlite/principalHistoryEvidenceSchema\";\nimport { getClientSQLitePersistenceRuntime } from \"../sqlite/sqlitePersistenceRuntime\";\nimport { type ExecSql, ensureSqlTables } from \"../sqlite/sqlSchema\";\n\nexport type PrincipalHistoryPrefix =\n typeof principalHistoryPrefixes.$inferSelect;\n\nexport async function loadPrincipalHistoryPrefix(\n execSql: ExecSql,\n scopeId: string,\n) {\n await ensureSqlTables(execSql, principalHistoryEvidenceTables);\n const { db } = getClientSQLitePersistenceRuntime(execSql);\n const [prefix] = await db\n .select()\n .from(principalHistoryPrefixes)\n .where(eq(principalHistoryPrefixes.scopeId, scopeId))\n .limit(1);\n return prefix ?? null;\n}\n\n/** Keep one completed prefix per principal/trust scope; older readers cannot replace it. */\nexport async function savePrincipalHistoryPrefix(input: {\n readonly execSql: ExecSql;\n readonly prefix: PrincipalHistoryPrefix;\n readonly stillCurrent: () => boolean;\n}): Promise<void> {\n const prefix = { ...input.prefix };\n await ensureSqlTables(input.execSql, principalHistoryEvidenceTables);\n const runtime = getClientSQLitePersistenceRuntime(input.execSql);\n const result = await runtime.guardedTransaction(\n async (tx) => {\n const [previous] = await tx\n .select()\n .from(principalHistoryPrefixes)\n .where(eq(principalHistoryPrefixes.scopeId, prefix.scopeId))\n .limit(1);\n if (previous && previous.version > prefix.version) return;\n await tx\n .insert(principalHistoryPrefixes)\n .values(prefix)\n .onConflictDoUpdate({\n target: principalHistoryPrefixes.scopeId,\n set: prefix,\n })\n .run();\n },\n input.stillCurrent,\n { behavior: \"immediate\" },\n );\n assertProjectionVerificationCurrent(() => result.committed);\n}\n\n/** Invalid hints are disposable, but a losing reader must preserve a newer hint. */\nexport async function discardPrincipalHistoryPrefix(input: {\n readonly execSql: ExecSql;\n readonly prefix: PrincipalHistoryPrefix;\n readonly stillCurrent: () => boolean;\n}): Promise<void> {\n const prefix = { ...input.prefix };\n const runtime = getClientSQLitePersistenceRuntime(input.execSql);\n const result = await runtime.guardedTransaction(\n async (tx) => {\n await tx\n .delete(principalHistoryPrefixes)\n .where(\n and(\n eq(principalHistoryPrefixes.scopeId, prefix.scopeId),\n eq(principalHistoryPrefixes.progress, prefix.progress),\n ),\n )\n .run();\n },\n input.stillCurrent,\n { behavior: \"immediate\" },\n );\n assertProjectionVerificationCurrent(() => result.committed);\n}\n"]}
1
+ {"version":3,"file":"principalHistoryPrefixPersistence.js","sourceRoot":"","sources":["principalHistoryPrefixPersistence.ts"],"names":[],"mappings":"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","sourcesContent":["import { and, eq } from \"drizzle-orm\";\nimport { assertProjectionVerificationCurrent } from \"../keyingProjectionVerification/types\";\nimport {\n principalHistoryEvidenceTables,\n principalHistoryPrefixes,\n} from \"../sqlite/principalHistoryEvidenceSchema\";\nimport { getClientSQLitePersistenceRuntime } from \"../sqlite/sqlitePersistenceRuntime\";\nimport { type ExecSql, ensureSqlTables } from \"../sqlite/sqlSchema\";\n\nexport type PrincipalHistoryPrefix =\n typeof principalHistoryPrefixes.$inferSelect;\n\nexport async function loadPrincipalHistoryPrefix(\n execSql: ExecSql,\n scopeId: string,\n) {\n await ensureSqlTables(execSql, principalHistoryEvidenceTables);\n const { db } = getClientSQLitePersistenceRuntime(execSql);\n const [prefix] = await db\n .select()\n .from(principalHistoryPrefixes)\n .where(eq(principalHistoryPrefixes.scopeId, scopeId))\n .limit(1);\n return prefix ?? null;\n}\n\n/** Keep the newest prefix unless replay replaces the exact rejected candidate. */\nexport async function savePrincipalHistoryPrefix(input: {\n readonly execSql: ExecSql;\n readonly prefix: PrincipalHistoryPrefix;\n readonly stillCurrent: () => boolean;\n readonly rejectedPrefix?: PrincipalHistoryPrefix | null;\n}): Promise<void> {\n const prefix = { ...input.prefix };\n const rejected = input.rejectedPrefix ? { ...input.rejectedPrefix } : null;\n await ensureSqlTables(input.execSql, principalHistoryEvidenceTables);\n const runtime = getClientSQLitePersistenceRuntime(input.execSql);\n const result = await runtime.guardedTransaction(\n async (tx) => {\n const [previous] = await tx\n .select()\n .from(principalHistoryPrefixes)\n .where(eq(principalHistoryPrefixes.scopeId, prefix.scopeId))\n .limit(1);\n if (\n previous &&\n previous.version > prefix.version &&\n !(\n rejected?.scopeId === previous.scopeId &&\n rejected.progress === previous.progress\n )\n )\n return;\n await tx\n .insert(principalHistoryPrefixes)\n .values(prefix)\n .onConflictDoUpdate({\n target: principalHistoryPrefixes.scopeId,\n set: prefix,\n })\n .run();\n },\n input.stillCurrent,\n { behavior: \"immediate\" },\n );\n assertProjectionVerificationCurrent(() => result.committed);\n}\n\n/** Invalid hints are disposable, but a losing reader must preserve a newer hint. */\nexport async function discardPrincipalHistoryPrefix(input: {\n readonly execSql: ExecSql;\n readonly prefix: PrincipalHistoryPrefix;\n readonly stillCurrent: () => boolean;\n}): Promise<void> {\n const prefix = { ...input.prefix };\n const runtime = getClientSQLitePersistenceRuntime(input.execSql);\n const result = await runtime.guardedTransaction(\n async (tx) => {\n await tx\n .delete(principalHistoryPrefixes)\n .where(\n and(\n eq(principalHistoryPrefixes.scopeId, prefix.scopeId),\n eq(principalHistoryPrefixes.progress, prefix.progress),\n ),\n )\n .run();\n },\n input.stillCurrent,\n { behavior: \"immediate\" },\n );\n assertProjectionVerificationCurrent(() => result.committed);\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { principalHistoryStages } from "../sqlite/principalHistoryStageSchema.js";
2
+ import { type ExecSql } from "../sqlite/sqlSchema.js";
3
+ import { type PrincipalHistoryEvidencePage } from "./principalHistoryEvidencePersistence.js";
4
+ export type PrincipalHistoryStage = typeof principalHistoryStages.$inferSelect;
5
+ export declare function loadPrincipalHistoryStage(execSql: ExecSql, id: string): Promise<{
6
+ id: string;
7
+ organizationId: string;
8
+ currentJson: string;
9
+ afterVersion: number;
10
+ complete: boolean;
11
+ progress: string;
12
+ } | null>;
13
+ /** Publish accepted entries and index nodes atomically with authenticated progress. */
14
+ export declare function savePrincipalHistoryStage(input: {
15
+ readonly execSql: ExecSql;
16
+ readonly stage: PrincipalHistoryStage;
17
+ readonly evidence: PrincipalHistoryEvidencePage;
18
+ readonly previousProgress: string | null;
19
+ readonly stillCurrent: () => boolean;
20
+ }): Promise<void>;
21
+ export declare function discardPrincipalHistoryStage(execSql: ExecSql, stage: PrincipalHistoryStage, stillCurrent: () => boolean): Promise<void>;
@@ -0,0 +1,12 @@
1
+ const leases = new WeakMap();
2
+ /** Internal workflow adapters carry custody without exposing it on public views. */
3
+ export function readPrincipalHistoryProtection(runtime) {
4
+ return leases.get(runtime) ?? runtime.withPrincipalHistoryProtection;
5
+ }
6
+ export function inheritPrincipalHistoryProtection(source, target) {
7
+ const lease = readPrincipalHistoryProtection(source);
8
+ if (lease)
9
+ leases.set(target, lease);
10
+ return target;
11
+ }
12
+ //# sourceMappingURL=principalHistoryRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"principalHistoryRuntime.js","sourceRoot":"","sources":["principalHistoryRuntime.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,IAAI,OAAO,EAA2C,CAAC;AAEtE,oFAAoF;AACpF,MAAM,UAAU,8BAA8B,CAC5C,OAIC;IAED,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,8BAA8B,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,MAAc,EACd,MAAS;IAET,MAAM,KAAK,GAAG,8BAA8B,CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,KAAK;QAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PrincipalHistoryProtectionLease } from \"./principalHistoryProtection\";\n\nconst leases = new WeakMap<object, PrincipalHistoryProtectionLease>();\n\n/** Internal workflow adapters carry custody without exposing it on public views. */\nexport function readPrincipalHistoryProtection(\n runtime: object & {\n readonly withPrincipalHistoryProtection?:\n | PrincipalHistoryProtectionLease\n | undefined;\n },\n) {\n return leases.get(runtime) ?? runtime.withPrincipalHistoryProtection;\n}\n\nexport function inheritPrincipalHistoryProtection<T extends object>(\n source: object,\n target: T,\n): T {\n const lease = readPrincipalHistoryProtection(source);\n if (lease) leases.set(target, lease);\n return target;\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { serializeKeyingCanonicalJson, toFingerprint, } from "../../internal/crypto/index.js";
2
2
  import { isPrincipalPolicyPageResponse } from "../../internal/validators/response/index.js";
3
- export function principalHistoryStageId(organizationId, head, context, retainedReferences) {
3
+ export function principalHistoryStageId(organizationId, head, context) {
4
4
  return toFingerprint(new TextEncoder().encode(serializeKeyingCanonicalJson([
5
- "tearleads.sdk.principal-history-stage.v1",
5
+ "tearleads.sdk.principal-history-stage.v2",
6
6
  organizationId,
7
7
  head.principalType,
8
8
  head.principalId,
@@ -11,16 +11,6 @@ export function principalHistoryStageId(organizationId, head, context, retainedR
11
11
  head.stateHash,
12
12
  head.keyFingerprint,
13
13
  context,
14
- [...retainedReferences]
15
- .sort((a, b) => a.version - b.version)
16
- .map((reference) => [
17
- reference.principalType,
18
- reference.principalId,
19
- reference.version,
20
- reference.keyEpoch,
21
- reference.stateHash,
22
- reference.keyFingerprint,
23
- ]),
24
14
  ])));
25
15
  }
26
16
  export async function principalHistoryStageProtection(protection, expectedHead, stage) {
@@ -1 +1 @@
1
- {"version":3,"file":"principalHistoryStageProtection.js","sourceRoot":"","sources":["principalHistoryStageProtection.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,4BAA4B,EAC5B,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAG/E,MAAM,UAAU,uBAAuB,CACrC,cAAsB,EACtB,IAA6B,EAC7B,OAAe,EACf,kBAAsD;IAEtD,OAAO,aAAa,CAClB,IAAI,WAAW,EAAE,CAAC,MAAM,CACtB,4BAA4B,CAAC;QAC3B,0CAA0C;QAC1C,cAAc;QACd,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,cAAc;QACnB,OAAO;QACP,CAAC,GAAG,kBAAkB,CAAC;aACpB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;aACrC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC;YAClB,SAAS,CAAC,aAAa;YACvB,SAAS,CAAC,WAAW;YACrB,SAAS,CAAC,OAAO;YACjB,SAAS,CAAC,QAAQ;YAClB,SAAS,CAAC,SAAS;YACnB,SAAS,CAAC,cAAc;SACzB,CAAC;KACL,CAAC,CACH,CACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,UAAiD,EACjD,YAAqC,EACrC,KAA8C;IAE9C,OAAO;QACL,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,OAAO,EAAE,4BAA4B,CAAC;YACpC,MAAM,EAAE,0CAA0C;YAClD,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,YAAY,EAAE,EAAE,GAAG,YAAY,EAAE;YACjC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,aAAa,EAAE,MAAM,aAAa,CAChC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAC5C;SACF,CAAC;KACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAkE;IAElE,IAAI,OAAgB,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,MAAM,IAAI,GAAG;QACX,GAAG,OAAO;QACV,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE;KAC1E,CAAC;IACF,IACE,CAAC,6BAA6B,CAAC,IAAI,CAAC;QACpC,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO;QAE/C,OAAO,IAAI,CAAC;IACd,OAAO;QACL,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;KACpD,CAAC;AACJ,CAAC","sourcesContent":["import type { PrincipalPolicyPageCurrent } from \"@tearleads/api-client\";\nimport {\n type PrincipalPolicyHistoryProgressOptions,\n type ReferencedPrincipalHead,\n serializeKeyingCanonicalJson,\n toFingerprint,\n} from \"@tearleads/crypto\";\nimport { isPrincipalPolicyPageResponse } from \"@tearleads/validators/response\";\nimport type { PrincipalHistoryStage } from \"../persistence/principalHistoryStagePersistence\";\n\nexport function principalHistoryStageId(\n organizationId: string,\n head: ReferencedPrincipalHead,\n context: string,\n retainedReferences: readonly ReferencedPrincipalHead[],\n) {\n return toFingerprint(\n new TextEncoder().encode(\n serializeKeyingCanonicalJson([\n \"tearleads.sdk.principal-history-stage.v1\",\n organizationId,\n head.principalType,\n head.principalId,\n head.version,\n head.keyEpoch,\n head.stateHash,\n head.keyFingerprint,\n context,\n [...retainedReferences]\n .sort((a, b) => a.version - b.version)\n .map((reference) => [\n reference.principalType,\n reference.principalId,\n reference.version,\n reference.keyEpoch,\n reference.stateHash,\n reference.keyFingerprint,\n ]),\n ]),\n ),\n );\n}\n\nexport async function principalHistoryStageProtection(\n protection: PrincipalPolicyHistoryProgressOptions,\n expectedHead: ReferencedPrincipalHead,\n stage: Omit<PrincipalHistoryStage, \"progress\">,\n): Promise<PrincipalPolicyHistoryProgressOptions> {\n return {\n localKey: protection.localKey,\n context: serializeKeyingCanonicalJson({\n domain: \"tearleads.sdk.principal-history-stage.v1\",\n context: protection.context,\n id: stage.id,\n organizationId: stage.organizationId,\n expectedHead: { ...expectedHead },\n afterVersion: stage.afterVersion,\n complete: stage.complete,\n currentDigest: await toFingerprint(\n new TextEncoder().encode(stage.currentJson),\n ),\n }),\n };\n}\n\nexport function parsePrincipalHistoryStageCurrent(\n stage: Pick<PrincipalHistoryStage, \"currentJson\" | \"afterVersion\">,\n): PrincipalPolicyPageCurrent | null {\n let current: unknown;\n try {\n current = JSON.parse(stage.currentJson);\n } catch {\n return null;\n }\n if (!current || typeof current !== \"object\" || Array.isArray(current))\n return null;\n const page = {\n ...current,\n previousStates: [],\n historyPage: { afterVersion: stage.afterVersion, nextAfterVersion: null },\n };\n if (\n !isPrincipalPolicyPageResponse(page) ||\n stage.afterVersion >= page.currentState.version\n )\n return null;\n return {\n currentState: page.currentState,\n currentPayload: page.currentPayload,\n currentProjection: page.currentProjection,\n currentGrants: page.currentGrants,\n currentMemberEnvelopes: page.currentMemberEnvelopes,\n };\n}\n"]}
1
+ {"version":3,"file":"principalHistoryStageProtection.js","sourceRoot":"","sources":["principalHistoryStageProtection.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,4BAA4B,EAC5B,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAG/E,MAAM,UAAU,uBAAuB,CACrC,cAAsB,EACtB,IAA6B,EAC7B,OAAe;IAEf,OAAO,aAAa,CAClB,IAAI,WAAW,EAAE,CAAC,MAAM,CACtB,4BAA4B,CAAC;QAC3B,0CAA0C;QAC1C,cAAc;QACd,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,cAAc;QACnB,OAAO;KACR,CAAC,CACH,CACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,UAAiD,EACjD,YAAqC,EACrC,KAA8C;IAE9C,OAAO;QACL,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,OAAO,EAAE,4BAA4B,CAAC;YACpC,MAAM,EAAE,0CAA0C;YAClD,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,YAAY,EAAE,EAAE,GAAG,YAAY,EAAE;YACjC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,aAAa,EAAE,MAAM,aAAa,CAChC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAC5C;SACF,CAAC;KACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAkE;IAElE,IAAI,OAAgB,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,MAAM,IAAI,GAAG;QACX,GAAG,OAAO;QACV,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE;KAC1E,CAAC;IACF,IACE,CAAC,6BAA6B,CAAC,IAAI,CAAC;QACpC,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO;QAE/C,OAAO,IAAI,CAAC;IACd,OAAO;QACL,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;KACpD,CAAC;AACJ,CAAC","sourcesContent":["import type { PrincipalPolicyPageCurrent } from \"@tearleads/api-client\";\nimport {\n type PrincipalPolicyHistoryProgressOptions,\n type ReferencedPrincipalHead,\n serializeKeyingCanonicalJson,\n toFingerprint,\n} from \"@tearleads/crypto\";\nimport { isPrincipalPolicyPageResponse } from \"@tearleads/validators/response\";\nimport type { PrincipalHistoryStage } from \"../persistence/principalHistoryStagePersistence\";\n\nexport function principalHistoryStageId(\n organizationId: string,\n head: ReferencedPrincipalHead,\n context: string,\n) {\n return toFingerprint(\n new TextEncoder().encode(\n serializeKeyingCanonicalJson([\n \"tearleads.sdk.principal-history-stage.v2\",\n organizationId,\n head.principalType,\n head.principalId,\n head.version,\n head.keyEpoch,\n head.stateHash,\n head.keyFingerprint,\n context,\n ]),\n ),\n );\n}\n\nexport async function principalHistoryStageProtection(\n protection: PrincipalPolicyHistoryProgressOptions,\n expectedHead: ReferencedPrincipalHead,\n stage: Omit<PrincipalHistoryStage, \"progress\">,\n): Promise<PrincipalPolicyHistoryProgressOptions> {\n return {\n localKey: protection.localKey,\n context: serializeKeyingCanonicalJson({\n domain: \"tearleads.sdk.principal-history-stage.v1\",\n context: protection.context,\n id: stage.id,\n organizationId: stage.organizationId,\n expectedHead: { ...expectedHead },\n afterVersion: stage.afterVersion,\n complete: stage.complete,\n currentDigest: await toFingerprint(\n new TextEncoder().encode(stage.currentJson),\n ),\n }),\n };\n}\n\nexport function parsePrincipalHistoryStageCurrent(\n stage: Pick<PrincipalHistoryStage, \"currentJson\" | \"afterVersion\">,\n): PrincipalPolicyPageCurrent | null {\n let current: unknown;\n try {\n current = JSON.parse(stage.currentJson);\n } catch {\n return null;\n }\n if (!current || typeof current !== \"object\" || Array.isArray(current))\n return null;\n const page = {\n ...current,\n previousStates: [],\n historyPage: { afterVersion: stage.afterVersion, nextAfterVersion: null },\n };\n if (\n !isPrincipalPolicyPageResponse(page) ||\n stage.afterVersion >= page.currentState.version\n )\n return null;\n return {\n currentState: page.currentState,\n currentPayload: page.currentPayload,\n currentProjection: page.currentProjection,\n currentGrants: page.currentGrants,\n currentMemberEnvelopes: page.currentMemberEnvelopes,\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AnyVerifiedPrincipalPolicy, VerifiedPrincipalPolicy, VerifiedPrincipalPolicyCurrent } from "../../internal/crypto/index.js";
1
+ import type { AnyVerifiedPrincipalPolicy, PrincipalPolicyAuthorization, VerifiedPrincipalPolicy, VerifiedPrincipalPolicyCurrent } from "../../internal/crypto/index.js";
2
2
  export type PrincipalPolicyCurrentEvidence = VerifiedPrincipalPolicy | VerifiedPrincipalPolicyCurrent;
3
3
  export type PrincipalPolicyCheckpointEvidence = AnyVerifiedPrincipalPolicy | VerifiedPrincipalPolicyCurrent;
4
- export declare function principalPolicyEvidenceEntries(policy: PrincipalPolicyCheckpointEvidence): NonNullable<VerifiedPrincipalPolicy["history"]>;
4
+ export declare function principalPolicyEvidenceEntries(policy: PrincipalPolicyAuthorization): NonNullable<VerifiedPrincipalPolicy["history"]>;
@@ -1 +1 @@
1
- {"version":3,"file":"principalPolicyEvidence.js","sourceRoot":"","sources":["principalPolicyEvidence.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,8BAA8B,CAC5C,MAAyC;IAEzC,OAAO,iBAAiB,IAAI,MAAM;QAChC,CAAC,CAAC,MAAM,CAAC,eAAe;QACxB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI;YACjB;gBACE,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB;SACF,CAAC,CAAC;AACT,CAAC","sourcesContent":["import type {\n AnyVerifiedPrincipalPolicy,\n VerifiedPrincipalPolicy,\n VerifiedPrincipalPolicyCurrent,\n} from \"@tearleads/crypto\";\n\nexport type PrincipalPolicyCurrentEvidence =\n | VerifiedPrincipalPolicy\n | VerifiedPrincipalPolicyCurrent;\nexport type PrincipalPolicyCheckpointEvidence =\n | AnyVerifiedPrincipalPolicy\n | VerifiedPrincipalPolicyCurrent;\n\nexport function principalPolicyEvidenceEntries(\n policy: PrincipalPolicyCheckpointEvidence,\n): NonNullable<VerifiedPrincipalPolicy[\"history\"]> {\n return \"retainedHistory\" in policy\n ? policy.retainedHistory\n : (policy.history ?? [\n {\n state: policy.state,\n projection: policy.projection,\n grants: policy.grants,\n },\n ]);\n}\n"]}
1
+ {"version":3,"file":"principalPolicyEvidence.js","sourceRoot":"","sources":["principalPolicyEvidence.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,8BAA8B,CAC5C,MAAoC;IAEpC,OAAO,iBAAiB,IAAI,MAAM;QAChC,CAAC,CAAC,MAAM,CAAC,eAAe;QACxB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI;YACjB;gBACE,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB;SACF,CAAC,CAAC;AACT,CAAC","sourcesContent":["import type {\n AnyVerifiedPrincipalPolicy,\n PrincipalPolicyAuthorization,\n VerifiedPrincipalPolicy,\n VerifiedPrincipalPolicyCurrent,\n} from \"@tearleads/crypto\";\n\nexport type PrincipalPolicyCurrentEvidence =\n | VerifiedPrincipalPolicy\n | VerifiedPrincipalPolicyCurrent;\nexport type PrincipalPolicyCheckpointEvidence =\n | AnyVerifiedPrincipalPolicy\n | VerifiedPrincipalPolicyCurrent;\n\nexport function principalPolicyEvidenceEntries(\n policy: PrincipalPolicyAuthorization,\n): NonNullable<VerifiedPrincipalPolicy[\"history\"]> {\n return \"retainedHistory\" in policy\n ? policy.retainedHistory\n : (policy.history ?? [\n {\n state: policy.state,\n projection: policy.projection,\n grants: policy.grants,\n },\n ]);\n}\n"]}
@@ -0,0 +1,308 @@
1
+ /** A completed, locally authenticated prefix; never an application trust pin. */
2
+ export declare const principalHistoryPrefixes: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
+ name: "principal_history_prefixes";
4
+ schema: undefined;
5
+ columns: {
6
+ scopeId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
7
+ name: "scope_id";
8
+ tableName: "principal_history_prefixes";
9
+ dataType: "string";
10
+ columnType: "SQLiteText";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: false;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: [string, ...string[]];
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {
23
+ length: number | undefined;
24
+ }>;
25
+ organizationId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
26
+ name: "organization_id";
27
+ tableName: "principal_history_prefixes";
28
+ dataType: "string";
29
+ columnType: "SQLiteText";
30
+ data: string;
31
+ driverParam: string;
32
+ notNull: true;
33
+ hasDefault: false;
34
+ isPrimaryKey: false;
35
+ isAutoincrement: false;
36
+ hasRuntimeDefault: false;
37
+ enumValues: [string, ...string[]];
38
+ baseColumn: never;
39
+ identity: undefined;
40
+ generated: undefined;
41
+ }, {}, {
42
+ length: number | undefined;
43
+ }>;
44
+ version: import("drizzle-orm/sqlite-core").SQLiteColumn<{
45
+ name: "version";
46
+ tableName: "principal_history_prefixes";
47
+ dataType: "number";
48
+ columnType: "SQLiteInteger";
49
+ data: number;
50
+ driverParam: number;
51
+ notNull: true;
52
+ hasDefault: false;
53
+ isPrimaryKey: false;
54
+ isAutoincrement: false;
55
+ hasRuntimeDefault: false;
56
+ enumValues: undefined;
57
+ baseColumn: never;
58
+ identity: undefined;
59
+ generated: undefined;
60
+ }, {}, {}>;
61
+ headJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
62
+ name: "head_json";
63
+ tableName: "principal_history_prefixes";
64
+ dataType: "string";
65
+ columnType: "SQLiteText";
66
+ data: string;
67
+ driverParam: string;
68
+ notNull: true;
69
+ hasDefault: false;
70
+ isPrimaryKey: false;
71
+ isAutoincrement: false;
72
+ hasRuntimeDefault: false;
73
+ enumValues: [string, ...string[]];
74
+ baseColumn: never;
75
+ identity: undefined;
76
+ generated: undefined;
77
+ }, {}, {
78
+ length: number | undefined;
79
+ }>;
80
+ currentJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
81
+ name: "current_json";
82
+ tableName: "principal_history_prefixes";
83
+ dataType: "string";
84
+ columnType: "SQLiteText";
85
+ data: string;
86
+ driverParam: string;
87
+ notNull: true;
88
+ hasDefault: false;
89
+ isPrimaryKey: false;
90
+ isAutoincrement: false;
91
+ hasRuntimeDefault: false;
92
+ enumValues: [string, ...string[]];
93
+ baseColumn: never;
94
+ identity: undefined;
95
+ generated: undefined;
96
+ }, {}, {
97
+ length: number | undefined;
98
+ }>;
99
+ progress: import("drizzle-orm/sqlite-core").SQLiteColumn<{
100
+ name: "progress";
101
+ tableName: "principal_history_prefixes";
102
+ dataType: "string";
103
+ columnType: "SQLiteText";
104
+ data: string;
105
+ driverParam: string;
106
+ notNull: true;
107
+ hasDefault: false;
108
+ isPrimaryKey: false;
109
+ isAutoincrement: false;
110
+ hasRuntimeDefault: false;
111
+ enumValues: [string, ...string[]];
112
+ baseColumn: never;
113
+ identity: undefined;
114
+ generated: undefined;
115
+ }, {}, {
116
+ length: number | undefined;
117
+ }>;
118
+ };
119
+ dialect: "sqlite";
120
+ }>;
121
+ /** Entries are selected by their exact signed leaf, including signature bytes. */
122
+ export declare const principalHistoryEntries: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
123
+ name: "principal_history_entries";
124
+ schema: undefined;
125
+ columns: {
126
+ scopeId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
127
+ name: "scope_id";
128
+ tableName: "principal_history_entries";
129
+ dataType: "string";
130
+ columnType: "SQLiteText";
131
+ data: string;
132
+ driverParam: string;
133
+ notNull: true;
134
+ hasDefault: false;
135
+ isPrimaryKey: false;
136
+ isAutoincrement: false;
137
+ hasRuntimeDefault: false;
138
+ enumValues: [string, ...string[]];
139
+ baseColumn: never;
140
+ identity: undefined;
141
+ generated: undefined;
142
+ }, {}, {
143
+ length: number | undefined;
144
+ }>;
145
+ organizationId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
146
+ name: "organization_id";
147
+ tableName: "principal_history_entries";
148
+ dataType: "string";
149
+ columnType: "SQLiteText";
150
+ data: string;
151
+ driverParam: string;
152
+ notNull: true;
153
+ hasDefault: false;
154
+ isPrimaryKey: false;
155
+ isAutoincrement: false;
156
+ hasRuntimeDefault: false;
157
+ enumValues: [string, ...string[]];
158
+ baseColumn: never;
159
+ identity: undefined;
160
+ generated: undefined;
161
+ }, {}, {
162
+ length: number | undefined;
163
+ }>;
164
+ leafHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
165
+ name: "leaf_hash";
166
+ tableName: "principal_history_entries";
167
+ dataType: "string";
168
+ columnType: "SQLiteText";
169
+ data: string;
170
+ driverParam: string;
171
+ notNull: true;
172
+ hasDefault: false;
173
+ isPrimaryKey: false;
174
+ isAutoincrement: false;
175
+ hasRuntimeDefault: false;
176
+ enumValues: [string, ...string[]];
177
+ baseColumn: never;
178
+ identity: undefined;
179
+ generated: undefined;
180
+ }, {}, {
181
+ length: number | undefined;
182
+ }>;
183
+ entryJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
184
+ name: "entry_json";
185
+ tableName: "principal_history_entries";
186
+ dataType: "string";
187
+ columnType: "SQLiteText";
188
+ data: string;
189
+ driverParam: string;
190
+ notNull: true;
191
+ hasDefault: false;
192
+ isPrimaryKey: false;
193
+ isAutoincrement: false;
194
+ hasRuntimeDefault: false;
195
+ enumValues: [string, ...string[]];
196
+ baseColumn: never;
197
+ identity: undefined;
198
+ generated: undefined;
199
+ }, {}, {
200
+ length: number | undefined;
201
+ }>;
202
+ };
203
+ dialect: "sqlite";
204
+ }>;
205
+ /** Untrusted proof material, checked against a locally restored private root. */
206
+ export declare const principalHistoryNodes: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
207
+ name: "principal_history_nodes";
208
+ schema: undefined;
209
+ columns: {
210
+ scopeId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
211
+ name: "scope_id";
212
+ tableName: "principal_history_nodes";
213
+ dataType: "string";
214
+ columnType: "SQLiteText";
215
+ data: string;
216
+ driverParam: string;
217
+ notNull: true;
218
+ hasDefault: false;
219
+ isPrimaryKey: false;
220
+ isAutoincrement: false;
221
+ hasRuntimeDefault: false;
222
+ enumValues: [string, ...string[]];
223
+ baseColumn: never;
224
+ identity: undefined;
225
+ generated: undefined;
226
+ }, {}, {
227
+ length: number | undefined;
228
+ }>;
229
+ organizationId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
230
+ name: "organization_id";
231
+ tableName: "principal_history_nodes";
232
+ dataType: "string";
233
+ columnType: "SQLiteText";
234
+ data: string;
235
+ driverParam: string;
236
+ notNull: true;
237
+ hasDefault: false;
238
+ isPrimaryKey: false;
239
+ isAutoincrement: false;
240
+ hasRuntimeDefault: false;
241
+ enumValues: [string, ...string[]];
242
+ baseColumn: never;
243
+ identity: undefined;
244
+ generated: undefined;
245
+ }, {}, {
246
+ length: number | undefined;
247
+ }>;
248
+ hash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
249
+ name: "hash";
250
+ tableName: "principal_history_nodes";
251
+ dataType: "string";
252
+ columnType: "SQLiteText";
253
+ data: string;
254
+ driverParam: string;
255
+ notNull: true;
256
+ hasDefault: false;
257
+ isPrimaryKey: false;
258
+ isAutoincrement: false;
259
+ hasRuntimeDefault: false;
260
+ enumValues: [string, ...string[]];
261
+ baseColumn: never;
262
+ identity: undefined;
263
+ generated: undefined;
264
+ }, {}, {
265
+ length: number | undefined;
266
+ }>;
267
+ leftHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
268
+ name: "left_hash";
269
+ tableName: "principal_history_nodes";
270
+ dataType: "string";
271
+ columnType: "SQLiteText";
272
+ data: string;
273
+ driverParam: string;
274
+ notNull: true;
275
+ hasDefault: false;
276
+ isPrimaryKey: false;
277
+ isAutoincrement: false;
278
+ hasRuntimeDefault: false;
279
+ enumValues: [string, ...string[]];
280
+ baseColumn: never;
281
+ identity: undefined;
282
+ generated: undefined;
283
+ }, {}, {
284
+ length: number | undefined;
285
+ }>;
286
+ rightHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
287
+ name: "right_hash";
288
+ tableName: "principal_history_nodes";
289
+ dataType: "string";
290
+ columnType: "SQLiteText";
291
+ data: string;
292
+ driverParam: string;
293
+ notNull: true;
294
+ hasDefault: false;
295
+ isPrimaryKey: false;
296
+ isAutoincrement: false;
297
+ hasRuntimeDefault: false;
298
+ enumValues: [string, ...string[]];
299
+ baseColumn: never;
300
+ identity: undefined;
301
+ generated: undefined;
302
+ }, {}, {
303
+ length: number | undefined;
304
+ }>;
305
+ };
306
+ dialect: "sqlite";
307
+ }>;
308
+ export declare const principalHistoryEvidenceTables: import("./sqlTableSchema.js").SqlTableSchema[];
@@ -0,0 +1,119 @@
1
+ /** Provisional, locally authenticated verification work; never an app checkpoint. */
2
+ export declare const principalHistoryStages: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
+ name: "principal_history_stages";
4
+ schema: undefined;
5
+ columns: {
6
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
7
+ name: "id";
8
+ tableName: "principal_history_stages";
9
+ dataType: "string";
10
+ columnType: "SQLiteText";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: false;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: [string, ...string[]];
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {
23
+ length: number | undefined;
24
+ }>;
25
+ organizationId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
26
+ name: "organization_id";
27
+ tableName: "principal_history_stages";
28
+ dataType: "string";
29
+ columnType: "SQLiteText";
30
+ data: string;
31
+ driverParam: string;
32
+ notNull: true;
33
+ hasDefault: false;
34
+ isPrimaryKey: false;
35
+ isAutoincrement: false;
36
+ hasRuntimeDefault: false;
37
+ enumValues: [string, ...string[]];
38
+ baseColumn: never;
39
+ identity: undefined;
40
+ generated: undefined;
41
+ }, {}, {
42
+ length: number | undefined;
43
+ }>;
44
+ currentJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
45
+ name: "current_json";
46
+ tableName: "principal_history_stages";
47
+ dataType: "string";
48
+ columnType: "SQLiteText";
49
+ data: string;
50
+ driverParam: string;
51
+ notNull: true;
52
+ hasDefault: false;
53
+ isPrimaryKey: false;
54
+ isAutoincrement: false;
55
+ hasRuntimeDefault: false;
56
+ enumValues: [string, ...string[]];
57
+ baseColumn: never;
58
+ identity: undefined;
59
+ generated: undefined;
60
+ }, {}, {
61
+ length: number | undefined;
62
+ }>;
63
+ afterVersion: import("drizzle-orm/sqlite-core").SQLiteColumn<{
64
+ name: "after_version";
65
+ tableName: "principal_history_stages";
66
+ dataType: "number";
67
+ columnType: "SQLiteInteger";
68
+ data: number;
69
+ driverParam: number;
70
+ notNull: true;
71
+ hasDefault: false;
72
+ isPrimaryKey: false;
73
+ isAutoincrement: false;
74
+ hasRuntimeDefault: false;
75
+ enumValues: undefined;
76
+ baseColumn: never;
77
+ identity: undefined;
78
+ generated: undefined;
79
+ }, {}, {}>;
80
+ complete: import("drizzle-orm/sqlite-core").SQLiteColumn<{
81
+ name: "complete";
82
+ tableName: "principal_history_stages";
83
+ dataType: "boolean";
84
+ columnType: "SQLiteBoolean";
85
+ data: boolean;
86
+ driverParam: number;
87
+ notNull: true;
88
+ hasDefault: false;
89
+ isPrimaryKey: false;
90
+ isAutoincrement: false;
91
+ hasRuntimeDefault: false;
92
+ enumValues: undefined;
93
+ baseColumn: never;
94
+ identity: undefined;
95
+ generated: undefined;
96
+ }, {}, {}>;
97
+ progress: import("drizzle-orm/sqlite-core").SQLiteColumn<{
98
+ name: "progress";
99
+ tableName: "principal_history_stages";
100
+ dataType: "string";
101
+ columnType: "SQLiteText";
102
+ data: string;
103
+ driverParam: string;
104
+ notNull: true;
105
+ hasDefault: false;
106
+ isPrimaryKey: false;
107
+ isAutoincrement: false;
108
+ hasRuntimeDefault: false;
109
+ enumValues: [string, ...string[]];
110
+ baseColumn: never;
111
+ identity: undefined;
112
+ generated: undefined;
113
+ }, {}, {
114
+ length: number | undefined;
115
+ }>;
116
+ };
117
+ dialect: "sqlite";
118
+ }>;
119
+ export declare const principalHistoryStageTables: import("./sqlTableSchema.js").SqlTableSchema[];
package/index.d.ts CHANGED
@@ -16,8 +16,8 @@ export type { DocumentRecord, DocumentSyncContainerRekeyBuilder, DocumentSyncPul
16
16
  export { buildMaterializedDocumentCreatePlan, createDocumentProjectionUserKeyResolver, createDocumentsWorkflowRuntime, createRemoteDocument, DOCUMENT_SYNC_TRACE_FRAGMENT, DOCUMENT_SYNC_TRACE_PATTERN, DOCUMENTS_APP_KIND, DocumentRawHistoryUnavailableError, defaultDocumentsPersistence, deletePersistedDocument, isDatabaseUnavailableError, isDocumentSyncUpdateIsolationError, persistedDocumentCreateStateFromResponse, readPullContinuation, syncRemoteDocument, unwrapContainerKekPath, unwrapDocumentContentKeyTarget, validateDocumentSyncUpdateImports, } from "./workflows/documents/index.js";
17
17
  export type { OrganizationGroupPolicyHistoryEntry, OrganizationNativePurchaseEligibility, OrganizationPrincipalMemberChange, OrganizationPrincipalMemberChangeType, OrganizationPrincipalPolicyHistory, OrganizationPrincipalPolicyHistoryEntry, ReconcileOrganizationDataUsageInput, } from "./workflows/organizations/index.js";
18
18
  export { addOrganizationGroupUser, buildInitialGroupPolicyRequest, buildInitialMemberGroupPolicyRequest, buildOrganizationGroupPolicyHistory, buildOrganizationProfileDocumentPatch, buildRosterProfileDocumentPatch, checkNativePurchaseEligibility, createInitializedRosterProfileDocument, createOrganizationGroup, DEFAULT_PERSONAL_ORGANIZATION_PROFILE_NAME, deriveOrganizationMetadataContainerSystemSlot, deriveOrganizationRosterProfileContainerSystemSlot, GroupMembershipNameMismatchError, getOrganizationProfileDocumentLocalId, getRosterProfileDocumentLocalId, importOrganizationUser, loadLocalOrganizationDataUsage, loadLocalOrganizationDirectoryAndGroups, loadOrganizationBilling, loadOrganizationBillingHistory, loadOrganizationBillingManagementUrl, ORGANIZATION_METADATA_CONTAINER_NAME, ORGANIZATION_PROFILE_DOCUMENT_KIND, ORGANIZATION_ROSTER_PROFILE_CONTAINER_NAME, ROSTER_PROFILE_DOCUMENT_KIND, readOrganizationProfileName, reconcileOrganizationDataUsage, reconcileOrganizationDirectoryAndGroups, removeOrganizationGroupUser, resolveOrganizationBillingView, revokeOrganizationContainerGrant, startOrganizationTrial, subscribeOrganizationReadModelInvalidation, updateOrganizationProfile, updateOrganizationRosterEntry, } from "./workflows/organizations/index.js";
19
- export type { CacheReferencedPrincipalPoliciesOptions, RecoveredPrincipalPolicyHistory, RecoveredScopedPrincipalPolicyHistory, RecoverPrincipalPolicyHistoryOptions, RecoverScopedPrincipalPolicyHistoryOptions, } from "./workflows/principals/index.js";
20
- export { cacheReferencedPrincipalPolicies, PrincipalPolicyHistoryReadError, recoverPrincipalPolicyHistory, recoverScopedPrincipalPolicyHistory, } from "./workflows/principals/index.js";
19
+ export type { CacheReferencedPrincipalPoliciesOptions, PrincipalHistoryProtectionLease, ProjectionPolicyHistoryRecoveryOptions, RecoveredPrincipalPolicyHistory, RecoveredScopedPrincipalPolicyHistory, RecoverPrincipalPolicyHistoryOptions, RecoverScopedPrincipalPolicyHistoryOptions, } from "./workflows/principals/index.js";
20
+ export { cacheReferencedPrincipalPolicies, PrincipalPolicyHistoryReadError, recoverPrincipalPolicyHistory, recoverProjectionPolicyHistory, recoverScopedPrincipalPolicyHistory, } from "./workflows/principals/index.js";
21
21
  export type { InitialRootMetadataBootstrap, ProvisionedSystemContainerSpec, RegisterIdentityInput, RegistrationApi, } from "./workflows/registration/index.js";
22
22
  export { bootstrapRootContainer, buildInitialOrganizationPolicyRequest, createInitialRootMetadataBootstrap, persistRegistrationBootstrap, registerIdentity, } from "./workflows/registration/index.js";
23
23
  export type { RootIdentitiesApi, RootIdentitiesPage, RootIdentitiesQueryInput, RootIdentity, RootIdentityDetail, RootIdentityOrganization, RootIdentitySession, RootRequestOutcome, } from "./workflows/root/index.js";
package/index.js CHANGED
@@ -7,7 +7,7 @@ export { createContainerContentsDocumentsRuntime, createContainerContentsProject
7
7
  export { buildMaterializedContainerRekeyPlan, buildRootContainerCreatePlan, ContainerAuthorAccessError, ContainerKekRepairInaccessibleError, ContainerKekRepairRequiredError, ContainerKeyringOverrideStaleError, ContainerPathTooDeepError, classifyContainerWriteRefusal, containerWriterProjectionFromRekeyPlan, createRemoteContainer, fetchContainerKekLog, GroupShareNameMismatchError, HistoricalWrapUnavailableError, isProjectionVerificationCancelledError, moveRemoteContainer, rebuildKeyringEntriesFromLog, recoverKeyringEntryFromWraps, rekeyRemoteContainer, revokeRemoteContainer, rootContainerWriterProjectionFromCreatePlan, shareRemoteContainer, shareRemoteContainerWithGroup, } from "./workflows/containers/index.js";
8
8
  export { buildMaterializedDocumentCreatePlan, createDocumentProjectionUserKeyResolver, createDocumentsWorkflowRuntime, createRemoteDocument, DOCUMENT_SYNC_TRACE_FRAGMENT, DOCUMENT_SYNC_TRACE_PATTERN, DOCUMENTS_APP_KIND, DocumentRawHistoryUnavailableError, defaultDocumentsPersistence, deletePersistedDocument, isDatabaseUnavailableError, isDocumentSyncUpdateIsolationError, persistedDocumentCreateStateFromResponse, readPullContinuation, syncRemoteDocument, unwrapContainerKekPath, unwrapDocumentContentKeyTarget, validateDocumentSyncUpdateImports, } from "./workflows/documents/index.js";
9
9
  export { addOrganizationGroupUser, buildInitialGroupPolicyRequest, buildInitialMemberGroupPolicyRequest, buildOrganizationGroupPolicyHistory, buildOrganizationProfileDocumentPatch, buildRosterProfileDocumentPatch, checkNativePurchaseEligibility, createInitializedRosterProfileDocument, createOrganizationGroup, DEFAULT_PERSONAL_ORGANIZATION_PROFILE_NAME, deriveOrganizationMetadataContainerSystemSlot, deriveOrganizationRosterProfileContainerSystemSlot, GroupMembershipNameMismatchError, getOrganizationProfileDocumentLocalId, getRosterProfileDocumentLocalId, importOrganizationUser, loadLocalOrganizationDataUsage, loadLocalOrganizationDirectoryAndGroups, loadOrganizationBilling, loadOrganizationBillingHistory, loadOrganizationBillingManagementUrl, ORGANIZATION_METADATA_CONTAINER_NAME, ORGANIZATION_PROFILE_DOCUMENT_KIND, ORGANIZATION_ROSTER_PROFILE_CONTAINER_NAME, ROSTER_PROFILE_DOCUMENT_KIND, readOrganizationProfileName, reconcileOrganizationDataUsage, reconcileOrganizationDirectoryAndGroups, removeOrganizationGroupUser, resolveOrganizationBillingView, revokeOrganizationContainerGrant, startOrganizationTrial, subscribeOrganizationReadModelInvalidation, updateOrganizationProfile, updateOrganizationRosterEntry, } from "./workflows/organizations/index.js";
10
- export { cacheReferencedPrincipalPolicies, PrincipalPolicyHistoryReadError, recoverPrincipalPolicyHistory, recoverScopedPrincipalPolicyHistory, } from "./workflows/principals/index.js";
10
+ export { cacheReferencedPrincipalPolicies, PrincipalPolicyHistoryReadError, recoverPrincipalPolicyHistory, recoverProjectionPolicyHistory, recoverScopedPrincipalPolicyHistory, } from "./workflows/principals/index.js";
11
11
  export { bootstrapRootContainer, buildInitialOrganizationPolicyRequest, createInitialRootMetadataBootstrap, persistRegistrationBootstrap, registerIdentity, } from "./workflows/registration/index.js";
12
12
  export { listRootDataUsageReport, listRootIdentities, listRootIdentityOrganizations, listRootOrganizationIdentities, listRootOrganizations, loadRootIdentity, loadRootOrganization, loadRootOrganizationDataUsage, } from "./workflows/root/index.js";
13
13
  export { clearRemoteSyncState, getDomainSyncCoordinatorSnapshot, getOrCreateDomainSyncCoordinator, hasDomainSyncCoordinatorPendingWork, requestAllDomainSyncLanes, subscribeToDomainSyncCoordinator, waitForDomainSyncCoordinatorToSettle, } from "./workflows/sync/index.js";