@tearleads/client-sdk 0.1.19 → 0.1.21

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 (238) hide show
  1. package/client/organizations/index.js +2 -2
  2. package/client/organizations/index.js.map +1 -1
  3. package/client/organizations/organizationHistory.js +66 -0
  4. package/client/organizations/organizationHistory.js.map +1 -0
  5. package/client/organizations/organizationReadModels.d.ts +1 -1
  6. package/client/organizations/organizationReadModels.js +7 -27
  7. package/client/organizations/organizationReadModels.js.map +1 -1
  8. package/client/organizations/organizationsTypes.d.ts +1 -1
  9. package/client/organizations/organizationsTypes.js.map +1 -1
  10. package/data/containers/shared/types.d.ts +2 -2
  11. package/data/containers/shared/types.js.map +1 -1
  12. package/data/documents/shared/syncSubmitFailure.d.ts +2 -2
  13. package/data/documents/shared/syncSubmitFailure.js.map +1 -1
  14. package/data/keyingProjectionVerification/documentPurgeCheckpointCurrency.js +34 -8
  15. package/data/keyingProjectionVerification/documentPurgeCheckpointCurrency.js.map +1 -1
  16. package/data/keyingProjectionVerification/documentPurgeDocumentChainVerification.js.map +1 -1
  17. package/data/keyingProjectionVerification/documentPurgePolicyCheckpoints.js +17 -0
  18. package/data/keyingProjectionVerification/documentPurgePolicyCheckpoints.js.map +1 -0
  19. package/data/keyingProjectionVerification/documentPurgePolicyCurrency.js +55 -0
  20. package/data/keyingProjectionVerification/documentPurgePolicyCurrency.js.map +1 -0
  21. package/data/keyingProjectionVerification/documentPurgePrincipalEvidence.js +25 -13
  22. package/data/keyingProjectionVerification/documentPurgePrincipalEvidence.js.map +1 -1
  23. package/data/keyingProjectionVerification/documentPurgeProofVerification.d.ts +5 -3
  24. package/data/keyingProjectionVerification/documentPurgeProofVerification.js +52 -8
  25. package/data/keyingProjectionVerification/documentPurgeProofVerification.js.map +1 -1
  26. package/data/keyingProjectionVerification/projectionPolicyEvidence.js.map +1 -1
  27. package/data/keyingProjectionVerification/types.d.ts +4 -0
  28. package/data/keyingProjectionVerification/types.js.map +1 -1
  29. package/data/persistence/organizations/organizationReadModelProjection.js +2 -2
  30. package/data/persistence/organizations/organizationReadModelProjection.js.map +1 -1
  31. package/data/persistence/principalAuthorizationCheckpoints.js +1 -1
  32. package/data/persistence/principalAuthorizationCheckpoints.js.map +1 -1
  33. package/data/persistence/principalCurrentAcknowledgementPersistence.d.ts +1 -0
  34. package/data/persistence/principalCurrentAcknowledgementPersistence.js +58 -12
  35. package/data/persistence/principalCurrentAcknowledgementPersistence.js.map +1 -1
  36. package/data/persistence/principalHistoryEvidencePersistence.d.ts +2 -0
  37. package/data/persistence/principalHistoryEvidencePersistence.js +2 -0
  38. package/data/persistence/principalHistoryEvidencePersistence.js.map +1 -1
  39. package/data/persistence/principalHistoryIncompleteRetention.js +32 -0
  40. package/data/persistence/principalHistoryIncompleteRetention.js.map +1 -0
  41. package/data/persistence/principalHistoryNodeRetention.js +76 -0
  42. package/data/persistence/principalHistoryNodeRetention.js.map +1 -0
  43. package/data/persistence/principalHistoryPrefixPersistence.d.ts +1 -0
  44. package/data/persistence/principalHistoryPrefixPersistence.js +30 -1
  45. package/data/persistence/principalHistoryPrefixPersistence.js.map +1 -1
  46. package/data/persistence/principalHistoryRootOwnership.js +71 -0
  47. package/data/persistence/principalHistoryRootOwnership.js.map +1 -0
  48. package/data/persistence/principalHistoryStagePersistence.js +45 -0
  49. package/data/persistence/principalHistoryStagePersistence.js.map +1 -1
  50. package/data/persistence/principalHistoryStageRetention.js +44 -0
  51. package/data/persistence/principalHistoryStageRetention.js.map +1 -0
  52. package/data/persistence/principalHistoryUnpublishedRetention.js +71 -0
  53. package/data/persistence/principalHistoryUnpublishedRetention.js.map +1 -0
  54. package/data/persistence/principalKeyEnvelopeArchivePersistence.js +63 -0
  55. package/data/persistence/principalKeyEnvelopeArchivePersistence.js.map +1 -0
  56. package/data/persistence/principalKeyEnvelopeCandidates.js +10 -1
  57. package/data/persistence/principalKeyEnvelopeCandidates.js.map +1 -1
  58. package/data/persistence/principalPolicyReferencePersistence.js +2 -2
  59. package/data/persistence/principalPolicyReferencePersistence.js.map +1 -1
  60. package/data/sqlite/principalHistoryEvidenceSchema.js +2 -0
  61. package/data/sqlite/principalHistoryEvidenceSchema.js.map +1 -1
  62. package/data/sqlite/principalHistoryNodeRetentionSchema.js +30 -0
  63. package/data/sqlite/principalHistoryNodeRetentionSchema.js.map +1 -0
  64. package/data/sqlite/principalHistoryRetentionSchema.js +40 -0
  65. package/data/sqlite/principalHistoryRetentionSchema.js.map +1 -0
  66. package/data/sqlite/principalHistoryStageSchema.js +2 -0
  67. package/data/sqlite/principalHistoryStageSchema.js.map +1 -1
  68. package/data/sqlite/schema.d.ts +453 -0
  69. package/data/sqlite/schema.js +6 -0
  70. package/data/sqlite/schema.js.map +1 -1
  71. package/data/sqlite/sqliteCommitGuards.js +49 -0
  72. package/data/sqlite/sqliteCommitGuards.js.map +1 -0
  73. package/data/sqlite/sqlitePersistenceRuntime.js +14 -2
  74. package/data/sqlite/sqlitePersistenceRuntime.js.map +1 -1
  75. package/index.d.ts +3 -1
  76. package/index.js.map +1 -1
  77. package/internal/api-client/ApiClient.d.ts +60 -137
  78. package/internal/api-client/ApiClient.js +7 -5
  79. package/internal/api-client/ApiClient.js.map +1 -1
  80. package/internal/api-client/apiRequestRuntime.js +7 -7
  81. package/internal/api-client/apiRequestRuntime.js.map +1 -1
  82. package/internal/api-client/documentPurge.js +25 -0
  83. package/internal/api-client/documentPurge.js.map +1 -0
  84. package/internal/api-client/organizationPolicyHistory.d.ts +53 -0
  85. package/internal/api-client/organizationPolicyHistory.js +15 -0
  86. package/internal/api-client/organizationPolicyHistory.js.map +1 -0
  87. package/internal/api-client/requestInternals.js +4 -4
  88. package/internal/api-client/requestInternals.js.map +1 -1
  89. package/internal/api-client/types.d.ts +2 -2
  90. package/internal/api-client/types.js.map +1 -1
  91. package/internal/crypto/keying/accessEvent.js +11 -9
  92. package/internal/crypto/keying/accessEvent.js.map +1 -1
  93. package/internal/crypto/keying/principalPolicyChainEntry.js +3 -0
  94. package/internal/crypto/keying/principalPolicyChainEntry.js.map +1 -1
  95. package/internal/crypto/keying/principalPolicyHistory.js +4 -0
  96. package/internal/crypto/keying/principalPolicyHistory.js.map +1 -1
  97. package/internal/crypto/keying/principalPolicyHistoryTypes.d.ts +2 -0
  98. package/internal/crypto/keying/principalPolicyHistoryTypes.js.map +1 -1
  99. package/internal/crypto/keying/principalPolicyTransition.d.ts +2 -1
  100. package/internal/crypto/keying/principalPolicyTransition.js +5 -0
  101. package/internal/crypto/keying/principalPolicyTransition.js.map +1 -1
  102. package/internal/crypto/principalState.js +2 -2
  103. package/internal/crypto/principalState.js.map +1 -1
  104. package/internal/validators/operation/containerMutations.d.ts +448 -6528
  105. package/internal/validators/operation/documentMutations.d.ts +323 -579
  106. package/internal/validators/operation/documentMutations.js +22 -4
  107. package/internal/validators/operation/documentMutations.js.map +1 -1
  108. package/internal/validators/operation/documentSync.d.ts +26 -406
  109. package/internal/validators/operation/organizationPolicyHistory.d.ts +188 -310
  110. package/internal/validators/operation/organizationPolicyHistory.js +17 -3
  111. package/internal/validators/operation/organizationPolicyHistory.js.map +1 -1
  112. package/internal/validators/operation/organizations.d.ts +2 -2
  113. package/internal/validators/request/principal.js +2 -2
  114. package/internal/validators/request/principal.js.map +1 -1
  115. package/internal/validators/response/containerMutationError.d.ts +28 -408
  116. package/internal/validators/response/documentMutation.d.ts +232 -544
  117. package/internal/validators/response/documentMutation.js +1 -2
  118. package/internal/validators/response/documentMutation.js.map +1 -1
  119. package/internal/validators/response/documentSyncError.d.ts +26 -406
  120. package/internal/validators/response/documentSyncError.js +4 -3
  121. package/internal/validators/response/documentSyncError.js.map +1 -1
  122. package/internal/validators/response/index.d.ts +1 -1
  123. package/internal/validators/response/index.js +1 -1
  124. package/internal/validators/response/index.js.map +1 -1
  125. package/internal/validators/response/organization.d.ts +1 -1
  126. package/internal/validators/response/organization.js +1 -1
  127. package/internal/validators/response/organization.js.map +1 -1
  128. package/internal/validators/response/organizationPolicyHistory.d.ts +127 -309
  129. package/internal/validators/response/organizationPolicyHistory.js +10 -4
  130. package/internal/validators/response/organizationPolicyHistory.js.map +1 -1
  131. package/internal/validators/response/organizationReadModel.d.ts +5 -5
  132. package/internal/validators/response/principal.d.ts +28 -408
  133. package/internal/validators/response/principal.js +3 -1
  134. package/internal/validators/response/principal.js.map +1 -1
  135. package/internal/validators/response/principalReference.d.ts +1 -1
  136. package/internal/validators/response/principalReference.js +1 -1
  137. package/internal/validators/response/principalReference.js.map +1 -1
  138. package/internal/validators/response/principalSnapshot.js +4 -4
  139. package/internal/validators/response/principalSnapshot.js.map +1 -1
  140. package/internal/validators/util/index.d.ts +1 -1
  141. package/internal/validators/util/index.js +1 -1
  142. package/internal/validators/util/index.js.map +1 -1
  143. package/internal/validators/util/principalHistoryWire.d.ts +2 -0
  144. package/internal/validators/util/principalHistoryWire.js +2 -0
  145. package/internal/validators/util/principalHistoryWire.js.map +1 -1
  146. package/package.json +1 -1
  147. package/workflows/container-contents/container-state/createWithMetadata.js +19 -49
  148. package/workflows/container-contents/container-state/createWithMetadata.js.map +1 -1
  149. package/workflows/container-contents/container-state/groupGrantVerification.js +29 -0
  150. package/workflows/container-contents/container-state/groupGrantVerification.js.map +1 -1
  151. package/workflows/container-contents/container-state/groupShareEpoch.js +33 -0
  152. package/workflows/container-contents/container-state/groupShareEpoch.js.map +1 -0
  153. package/workflows/container-contents/container-state/remote.js +4 -1
  154. package/workflows/container-contents/container-state/remote.js.map +1 -1
  155. package/workflows/container-contents/container-state/share.js +2 -24
  156. package/workflows/container-contents/container-state/share.js.map +1 -1
  157. package/workflows/container-contents/documentTombstoneEvidence.js +23 -12
  158. package/workflows/container-contents/documentTombstoneEvidence.js.map +1 -1
  159. package/workflows/containers/child/create.js +1 -3
  160. package/workflows/containers/child/create.js.map +1 -1
  161. package/workflows/containers/child/createSubmission.d.ts +1 -3
  162. package/workflows/containers/child/createSubmission.js +13 -15
  163. package/workflows/containers/child/createSubmission.js.map +1 -1
  164. package/workflows/containers/child/currentShareGrantMutation.js +82 -0
  165. package/workflows/containers/child/currentShareGrantMutation.js.map +1 -0
  166. package/workflows/containers/child/currentSharePrincipalPolicy.js +83 -0
  167. package/workflows/containers/child/currentSharePrincipalPolicy.js.map +1 -0
  168. package/workflows/containers/child/mutationSubmit.js +1 -1
  169. package/workflows/containers/child/mutationSubmit.js.map +1 -1
  170. package/workflows/containers/child/runtimeCurrentGroupShare.js +82 -0
  171. package/workflows/containers/child/runtimeCurrentGroupShare.js.map +1 -0
  172. package/workflows/containers/child/share.js +1 -14
  173. package/workflows/containers/child/share.js.map +1 -1
  174. package/workflows/containers/child/shareProjection.js +15 -0
  175. package/workflows/containers/child/shareProjection.js.map +1 -0
  176. package/workflows/containers/mutationResponse.js +1 -1
  177. package/workflows/containers/mutationResponse.js.map +1 -1
  178. package/workflows/documents/purge.d.ts +3 -0
  179. package/workflows/documents/purge.js +13 -0
  180. package/workflows/documents/purge.js.map +1 -1
  181. package/workflows/documents/sync.js +2 -0
  182. package/workflows/documents/sync.js.map +1 -1
  183. package/workflows/documents/syncFailures.js +2 -2
  184. package/workflows/documents/syncFailures.js.map +1 -1
  185. package/workflows/documents/syncPolicyRepair.js +15 -13
  186. package/workflows/documents/syncPolicyRepair.js.map +1 -1
  187. package/workflows/organizations/initialPrincipalCurrentPublication.js +2 -0
  188. package/workflows/organizations/initialPrincipalCurrentPublication.js.map +1 -1
  189. package/workflows/organizations/loadPolicyHistoryDetails.js +31 -32
  190. package/workflows/organizations/loadPolicyHistoryDetails.js.map +1 -1
  191. package/workflows/organizations/organizationPolicyHistoryDetails.js +37 -15
  192. package/workflows/organizations/organizationPolicyHistoryDetails.js.map +1 -1
  193. package/workflows/organizations/organizationPolicyHistoryVerification.js +56 -69
  194. package/workflows/organizations/organizationPolicyHistoryVerification.js.map +1 -1
  195. package/workflows/organizations/policyHistoryCache.js +5 -2
  196. package/workflows/organizations/policyHistoryCache.js.map +1 -1
  197. package/workflows/organizations/policyHistoryTypes.d.ts +1 -0
  198. package/workflows/organizations/policyHistoryTypes.js.map +1 -1
  199. package/workflows/organizations/retainAcknowledgedPrincipalCurrents.js +4 -1
  200. package/workflows/organizations/retainAcknowledgedPrincipalCurrents.js.map +1 -1
  201. package/workflows/principals/loadRecoveredPrincipalHistoryPage.d.ts +0 -1
  202. package/workflows/principals/loadRecoveredPrincipalHistoryPage.js +1 -2
  203. package/workflows/principals/loadRecoveredPrincipalHistoryPage.js.map +1 -1
  204. package/workflows/principals/policyRepair.js +38 -0
  205. package/workflows/principals/policyRepair.js.map +1 -0
  206. package/workflows/principals/policyRepairBudget.d.ts +2 -2
  207. package/workflows/principals/policyRepairBudget.js +3 -3
  208. package/workflows/principals/policyRepairBudget.js.map +1 -1
  209. package/workflows/principals/principalHistoryRecoveryPrefix.js +4 -0
  210. package/workflows/principals/principalHistoryRecoveryPrefix.js.map +1 -1
  211. package/workflows/principals/principalRecoveryLocalPreference.js +3 -2
  212. package/workflows/principals/principalRecoveryLocalPreference.js.map +1 -1
  213. package/workflows/principals/publicPrincipalHistoryPage.js +1 -0
  214. package/workflows/principals/publicPrincipalHistoryPage.js.map +1 -1
  215. package/workflows/principals/publicPrincipalHistoryProgress.js +1 -0
  216. package/workflows/principals/publicPrincipalHistoryProgress.js.map +1 -1
  217. package/workflows/principals/publicPrincipalHistoryTypes.d.ts +2 -0
  218. package/workflows/principals/publicPrincipalHistoryTypes.js.map +1 -1
  219. package/workflows/principals/publicProjectionPrincipal.js +1 -0
  220. package/workflows/principals/publicProjectionPrincipal.js.map +1 -1
  221. package/workflows/principals/recoverPrincipalHistoryPage.js +2 -1
  222. package/workflows/principals/recoverPrincipalHistoryPage.js.map +1 -1
  223. package/workflows/principals/recoverPrincipalPolicyHistory.js +1 -0
  224. package/workflows/principals/recoverPrincipalPolicyHistory.js.map +1 -1
  225. package/workflows/principals/recoverPublicPrincipalHistory.js +2 -0
  226. package/workflows/principals/recoverPublicPrincipalHistory.js.map +1 -1
  227. package/workflows/principals/runtimePolicyRecovery.js +2 -1
  228. package/workflows/principals/runtimePolicyRecovery.js.map +1 -1
  229. package/workflows/principals/selectPublicPrincipalHistory.js +21 -15
  230. package/workflows/principals/selectPublicPrincipalHistory.js.map +1 -1
  231. package/workflows/sync/remoteResetPrincipalScope.js +6 -0
  232. package/workflows/sync/remoteResetPrincipalScope.js.map +1 -1
  233. package/data/keyingProjectionVerification/principalPolicySnapshotVerification.js +0 -208
  234. package/data/keyingProjectionVerification/principalPolicySnapshotVerification.js.map +0 -1
  235. package/data/keyingProjectionVerification/snapshotVerificationCache.js +0 -39
  236. package/data/keyingProjectionVerification/snapshotVerificationCache.js.map +0 -1
  237. package/workflows/containers/child/policyRepair.js +0 -23
  238. package/workflows/containers/child/policyRepair.js.map +0 -1
@@ -2144,426 +2144,46 @@ export declare const CommitOrganizationGroupPolicyConflictResponseSchema: z.ZodU
2144
2144
  export declare const PrincipalPolicyStaleErrorResponseSchema: z.ZodType<{
2145
2145
  code: "principal_policy_stale";
2146
2146
  error: string;
2147
- principalPolicies: {
2148
- previousStates: {
2149
- grants: {
2150
- accessLevel: "admin" | "read" | "write";
2151
- containerId: string;
2152
- }[];
2153
- projection: {
2154
- role: "member" | "admin";
2155
- userId: string;
2156
- }[];
2157
- state: {
2158
- createdAt: string;
2159
- encapsulationPublicKey: string;
2160
- externalAuthority: {
2161
- keyEpoch: number;
2162
- keyFingerprint: string;
2163
- principalId: string;
2164
- principalType: "group";
2165
- stateHash: string;
2166
- version: number;
2167
- } | null;
2168
- grantCount: number;
2169
- grantRoot: string;
2170
- keyEpoch: number;
2171
- keyFingerprint: string;
2172
- memberCount: number;
2173
- memberEnvelopesRoot: string;
2174
- membershipMode: "projection";
2175
- membershipRoot: string;
2176
- payloadCiphertextHash: string;
2177
- prevStateHash: string | null;
2178
- principalId: string;
2179
- principalType: "group" | "organization";
2180
- projectionRoot: string;
2181
- signature: string;
2182
- signedAt: string;
2183
- signerUserId: string;
2184
- signerUserKeyFingerprint: string;
2185
- stateHash: string;
2186
- version: number;
2187
- };
2188
- }[];
2189
- currentGrants: {
2190
- accessLevel: "admin" | "read" | "write";
2191
- containerId: string;
2192
- }[];
2193
- currentMemberEnvelopes: {
2194
- envelopes: {
2195
- kemCipherText: string;
2196
- memberKeyFingerprint: string;
2197
- userId: string;
2198
- wrappedKey: string;
2199
- }[];
2200
- epoch: number;
2201
- principalId: string;
2202
- principalType: "group" | "organization";
2203
- stateHash: string;
2204
- };
2205
- currentPayload: {
2206
- cipherSuite: "aes-256-gcm";
2207
- ciphertext: string;
2208
- ciphertextHash: string;
2209
- createdAt: string;
2210
- principalId: string;
2211
- principalType: "group" | "organization";
2212
- stateHash: string;
2213
- };
2214
- currentProjection: {
2215
- role: "member" | "admin";
2216
- userId: string;
2217
- }[];
2218
- currentState: {
2219
- createdAt: string;
2220
- encapsulationPublicKey: string;
2221
- externalAuthority: {
2222
- keyEpoch: number;
2223
- keyFingerprint: string;
2224
- principalId: string;
2225
- principalType: "group";
2226
- stateHash: string;
2227
- version: number;
2228
- } | null;
2229
- grantCount: number;
2230
- grantRoot: string;
2231
- keyEpoch: number;
2232
- keyFingerprint: string;
2233
- memberCount: number;
2234
- memberEnvelopesRoot: string;
2235
- membershipMode: "projection";
2236
- membershipRoot: string;
2237
- payloadCiphertextHash: string;
2238
- prevStateHash: string | null;
2239
- principalId: string;
2240
- principalType: "group" | "organization";
2241
- projectionRoot: string;
2242
- signature: string;
2243
- signedAt: string;
2244
- signerUserId: string;
2245
- signerUserKeyFingerprint: string;
2246
- stateHash: string;
2247
- version: number;
2248
- };
2147
+ principalHeads: {
2148
+ keyEpoch: number;
2149
+ keyFingerprint: string;
2150
+ principalId: string;
2151
+ principalType: "group" | "organization";
2152
+ stateHash: string;
2153
+ version: number;
2249
2154
  }[];
2250
2155
  }, {
2251
2156
  code: "principal_policy_stale";
2252
2157
  error: string;
2253
- principalPolicies: {
2254
- previousStates: {
2255
- grants: {
2256
- accessLevel: "admin" | "read" | "write";
2257
- containerId: string;
2258
- }[];
2259
- projection: {
2260
- role: "member" | "admin";
2261
- userId: string;
2262
- }[];
2263
- state: {
2264
- createdAt: string;
2265
- encapsulationPublicKey: string;
2266
- externalAuthority: {
2267
- keyEpoch: number;
2268
- keyFingerprint: string;
2269
- principalId: string;
2270
- principalType: "group";
2271
- stateHash: string;
2272
- version: number;
2273
- } | null;
2274
- grantCount: number;
2275
- grantRoot: string;
2276
- keyEpoch: number;
2277
- keyFingerprint: string;
2278
- memberCount: number;
2279
- memberEnvelopesRoot: string;
2280
- membershipMode: "projection";
2281
- membershipRoot: string;
2282
- payloadCiphertextHash: string;
2283
- prevStateHash: string | null;
2284
- principalId: string;
2285
- principalType: "group" | "organization";
2286
- projectionRoot: string;
2287
- signature: string;
2288
- signedAt: string;
2289
- signerUserId: string;
2290
- signerUserKeyFingerprint: string;
2291
- stateHash: string;
2292
- version: number;
2293
- };
2294
- }[];
2295
- currentGrants: {
2296
- accessLevel: "admin" | "read" | "write";
2297
- containerId: string;
2298
- }[];
2299
- currentMemberEnvelopes: {
2300
- envelopes: {
2301
- kemCipherText: string;
2302
- memberKeyFingerprint: string;
2303
- userId: string;
2304
- wrappedKey: string;
2305
- }[];
2306
- epoch: number;
2307
- principalId: string;
2308
- principalType: "group" | "organization";
2309
- stateHash: string;
2310
- };
2311
- currentPayload: {
2312
- cipherSuite: "aes-256-gcm";
2313
- ciphertext: string;
2314
- ciphertextHash: string;
2315
- createdAt: string;
2316
- principalId: string;
2317
- principalType: "group" | "organization";
2318
- stateHash: string;
2319
- };
2320
- currentProjection: {
2321
- role: "member" | "admin";
2322
- userId: string;
2323
- }[];
2324
- currentState: {
2325
- createdAt: string;
2326
- encapsulationPublicKey: string;
2327
- externalAuthority: {
2328
- keyEpoch: number;
2329
- keyFingerprint: string;
2330
- principalId: string;
2331
- principalType: "group";
2332
- stateHash: string;
2333
- version: number;
2334
- } | null;
2335
- grantCount: number;
2336
- grantRoot: string;
2337
- keyEpoch: number;
2338
- keyFingerprint: string;
2339
- memberCount: number;
2340
- memberEnvelopesRoot: string;
2341
- membershipMode: "projection";
2342
- membershipRoot: string;
2343
- payloadCiphertextHash: string;
2344
- prevStateHash: string | null;
2345
- principalId: string;
2346
- principalType: "group" | "organization";
2347
- projectionRoot: string;
2348
- signature: string;
2349
- signedAt: string;
2350
- signerUserId: string;
2351
- signerUserKeyFingerprint: string;
2352
- stateHash: string;
2353
- version: number;
2354
- };
2158
+ principalHeads: {
2159
+ keyEpoch: number;
2160
+ keyFingerprint: string;
2161
+ principalId: string;
2162
+ principalType: "group" | "organization";
2163
+ stateHash: string;
2164
+ version: number;
2355
2165
  }[];
2356
2166
  }, z.core.$ZodTypeInternals<{
2357
2167
  code: "principal_policy_stale";
2358
2168
  error: string;
2359
- principalPolicies: {
2360
- previousStates: {
2361
- grants: {
2362
- accessLevel: "admin" | "read" | "write";
2363
- containerId: string;
2364
- }[];
2365
- projection: {
2366
- role: "member" | "admin";
2367
- userId: string;
2368
- }[];
2369
- state: {
2370
- createdAt: string;
2371
- encapsulationPublicKey: string;
2372
- externalAuthority: {
2373
- keyEpoch: number;
2374
- keyFingerprint: string;
2375
- principalId: string;
2376
- principalType: "group";
2377
- stateHash: string;
2378
- version: number;
2379
- } | null;
2380
- grantCount: number;
2381
- grantRoot: string;
2382
- keyEpoch: number;
2383
- keyFingerprint: string;
2384
- memberCount: number;
2385
- memberEnvelopesRoot: string;
2386
- membershipMode: "projection";
2387
- membershipRoot: string;
2388
- payloadCiphertextHash: string;
2389
- prevStateHash: string | null;
2390
- principalId: string;
2391
- principalType: "group" | "organization";
2392
- projectionRoot: string;
2393
- signature: string;
2394
- signedAt: string;
2395
- signerUserId: string;
2396
- signerUserKeyFingerprint: string;
2397
- stateHash: string;
2398
- version: number;
2399
- };
2400
- }[];
2401
- currentGrants: {
2402
- accessLevel: "admin" | "read" | "write";
2403
- containerId: string;
2404
- }[];
2405
- currentMemberEnvelopes: {
2406
- envelopes: {
2407
- kemCipherText: string;
2408
- memberKeyFingerprint: string;
2409
- userId: string;
2410
- wrappedKey: string;
2411
- }[];
2412
- epoch: number;
2413
- principalId: string;
2414
- principalType: "group" | "organization";
2415
- stateHash: string;
2416
- };
2417
- currentPayload: {
2418
- cipherSuite: "aes-256-gcm";
2419
- ciphertext: string;
2420
- ciphertextHash: string;
2421
- createdAt: string;
2422
- principalId: string;
2423
- principalType: "group" | "organization";
2424
- stateHash: string;
2425
- };
2426
- currentProjection: {
2427
- role: "member" | "admin";
2428
- userId: string;
2429
- }[];
2430
- currentState: {
2431
- createdAt: string;
2432
- encapsulationPublicKey: string;
2433
- externalAuthority: {
2434
- keyEpoch: number;
2435
- keyFingerprint: string;
2436
- principalId: string;
2437
- principalType: "group";
2438
- stateHash: string;
2439
- version: number;
2440
- } | null;
2441
- grantCount: number;
2442
- grantRoot: string;
2443
- keyEpoch: number;
2444
- keyFingerprint: string;
2445
- memberCount: number;
2446
- memberEnvelopesRoot: string;
2447
- membershipMode: "projection";
2448
- membershipRoot: string;
2449
- payloadCiphertextHash: string;
2450
- prevStateHash: string | null;
2451
- principalId: string;
2452
- principalType: "group" | "organization";
2453
- projectionRoot: string;
2454
- signature: string;
2455
- signedAt: string;
2456
- signerUserId: string;
2457
- signerUserKeyFingerprint: string;
2458
- stateHash: string;
2459
- version: number;
2460
- };
2169
+ principalHeads: {
2170
+ keyEpoch: number;
2171
+ keyFingerprint: string;
2172
+ principalId: string;
2173
+ principalType: "group" | "organization";
2174
+ stateHash: string;
2175
+ version: number;
2461
2176
  }[];
2462
2177
  }, {
2463
2178
  code: "principal_policy_stale";
2464
2179
  error: string;
2465
- principalPolicies: {
2466
- previousStates: {
2467
- grants: {
2468
- accessLevel: "admin" | "read" | "write";
2469
- containerId: string;
2470
- }[];
2471
- projection: {
2472
- role: "member" | "admin";
2473
- userId: string;
2474
- }[];
2475
- state: {
2476
- createdAt: string;
2477
- encapsulationPublicKey: string;
2478
- externalAuthority: {
2479
- keyEpoch: number;
2480
- keyFingerprint: string;
2481
- principalId: string;
2482
- principalType: "group";
2483
- stateHash: string;
2484
- version: number;
2485
- } | null;
2486
- grantCount: number;
2487
- grantRoot: string;
2488
- keyEpoch: number;
2489
- keyFingerprint: string;
2490
- memberCount: number;
2491
- memberEnvelopesRoot: string;
2492
- membershipMode: "projection";
2493
- membershipRoot: string;
2494
- payloadCiphertextHash: string;
2495
- prevStateHash: string | null;
2496
- principalId: string;
2497
- principalType: "group" | "organization";
2498
- projectionRoot: string;
2499
- signature: string;
2500
- signedAt: string;
2501
- signerUserId: string;
2502
- signerUserKeyFingerprint: string;
2503
- stateHash: string;
2504
- version: number;
2505
- };
2506
- }[];
2507
- currentGrants: {
2508
- accessLevel: "admin" | "read" | "write";
2509
- containerId: string;
2510
- }[];
2511
- currentMemberEnvelopes: {
2512
- envelopes: {
2513
- kemCipherText: string;
2514
- memberKeyFingerprint: string;
2515
- userId: string;
2516
- wrappedKey: string;
2517
- }[];
2518
- epoch: number;
2519
- principalId: string;
2520
- principalType: "group" | "organization";
2521
- stateHash: string;
2522
- };
2523
- currentPayload: {
2524
- cipherSuite: "aes-256-gcm";
2525
- ciphertext: string;
2526
- ciphertextHash: string;
2527
- createdAt: string;
2528
- principalId: string;
2529
- principalType: "group" | "organization";
2530
- stateHash: string;
2531
- };
2532
- currentProjection: {
2533
- role: "member" | "admin";
2534
- userId: string;
2535
- }[];
2536
- currentState: {
2537
- createdAt: string;
2538
- encapsulationPublicKey: string;
2539
- externalAuthority: {
2540
- keyEpoch: number;
2541
- keyFingerprint: string;
2542
- principalId: string;
2543
- principalType: "group";
2544
- stateHash: string;
2545
- version: number;
2546
- } | null;
2547
- grantCount: number;
2548
- grantRoot: string;
2549
- keyEpoch: number;
2550
- keyFingerprint: string;
2551
- memberCount: number;
2552
- memberEnvelopesRoot: string;
2553
- membershipMode: "projection";
2554
- membershipRoot: string;
2555
- payloadCiphertextHash: string;
2556
- prevStateHash: string | null;
2557
- principalId: string;
2558
- principalType: "group" | "organization";
2559
- projectionRoot: string;
2560
- signature: string;
2561
- signedAt: string;
2562
- signerUserId: string;
2563
- signerUserKeyFingerprint: string;
2564
- stateHash: string;
2565
- version: number;
2566
- };
2180
+ principalHeads: {
2181
+ keyEpoch: number;
2182
+ keyFingerprint: string;
2183
+ principalId: string;
2184
+ principalType: "group" | "organization";
2185
+ stateHash: string;
2186
+ version: number;
2567
2187
  }[];
2568
2188
  }>>;
2569
2189
  export type PrincipalPolicyStaleErrorResponse = z.infer<typeof PrincipalPolicyStaleErrorResponseSchema>;
@@ -1,9 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { arraySchema, loosePlainObject, nonEmptyStringSchema } from "../schema.js";
3
3
  import { MAX_ROTATION_CONTAINER_REKEYS } from "../util/index.js";
4
+ import { PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT } from "../util/principalHistoryWire.js";
4
5
  import { ContainerMutationResponseSchema } from "./container.js";
5
6
  import { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from "./descendantRekeysRequiredError.js";
6
7
  import { BillingErrorResponseSchema } from "./organizationBilling.js";
8
+ import { ReferencedPrincipalStateResponseSchema } from "./principalReference.js";
7
9
  import { CurrentPrincipalMemberEnvelopesResponseSchema, PrincipalContainerGrantResponseSchema, PrincipalPolicyStateChainEntryResponseSchema, PrincipalProjectionMemberResponseSchema, PrincipalStatePayloadResponseSchema, PrincipalStateResponseSchema, } from "./principalSnapshot.js";
8
10
  export { CurrentPrincipalMemberEnvelopesResponseSchema, isCurrentPrincipalMemberEnvelopesResponse, isPrincipalPolicyStateChainEntryResponse, isPrincipalStatePayloadResponse, isPrincipalStateResponse, PrincipalContainerGrantResponseSchema, PrincipalMemberEnvelopeResponseSchema, PrincipalPolicySnapshotResponseSchema, PrincipalPolicyStateChainEntryResponseSchema, PrincipalProjectionMemberResponseSchema, PrincipalStateExternalAuthorityResponseSchema, PrincipalStatePayloadResponseSchema, PrincipalStateResponseSchema, } from "./principalSnapshot.js";
9
11
  export const principalPolicyCurrentResponseShape = {
@@ -49,7 +51,7 @@ export const CommitOrganizationGroupPolicyConflictResponseSchema = z.union([
49
51
  export const PrincipalPolicyStaleErrorResponseSchema = loosePlainObject({
50
52
  code: z.literal("principal_policy_stale"),
51
53
  error: z.string().min(1),
52
- principalPolicies: arraySchema(PrincipalPolicyBundleResponseSchema),
54
+ principalHeads: arraySchema(ReferencedPrincipalStateResponseSchema, PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT),
53
55
  });
54
56
  export function isPrincipalPolicyBundleResponse(value) {
55
57
  return PrincipalPolicyBundleResponseSchema.safeParse(value).success;
@@ -1 +1 @@
1
- {"version":3,"file":"principal.js","sourceRoot":"","sources":["principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,+CAA+C,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EACL,6CAA6C,EAC7C,qCAAqC,EACrC,4CAA4C,EAC5C,uCAAuC,EACvC,mCAAmC,EACnC,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,6CAA6C,EAC7C,yCAAyC,EACzC,wCAAwC,EACxC,+BAA+B,EAC/B,wBAAwB,EAExB,qCAAqC,EAErC,qCAAqC,EAErC,qCAAqC,EAErC,4CAA4C,EAE5C,uCAAuC,EAEvC,6CAA6C,EAE7C,mCAAmC,EAEnC,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,aAAa,EAAE,WAAW,CAAC,qCAAqC,CAAC;IACjE,sBAAsB,EAA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UAAU,+BAA+B,CAC7C,KAAc;IAEd,OAAO,mCAAmC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,2CAA2C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { arraySchema, loosePlainObject, nonEmptyStringSchema } from \"../schema\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"../util\";\nimport { ContainerMutationResponseSchema } from \"./container\";\nimport { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from \"./descendantRekeysRequiredError\";\nimport { BillingErrorResponseSchema } from \"./organizationBilling\";\n\nimport {\n CurrentPrincipalMemberEnvelopesResponseSchema,\n PrincipalContainerGrantResponseSchema,\n PrincipalPolicyStateChainEntryResponseSchema,\n PrincipalProjectionMemberResponseSchema,\n PrincipalStatePayloadResponseSchema,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport {\n type CurrentPrincipalMemberEnvelopesResponse,\n CurrentPrincipalMemberEnvelopesResponseSchema,\n isCurrentPrincipalMemberEnvelopesResponse,\n isPrincipalPolicyStateChainEntryResponse,\n isPrincipalStatePayloadResponse,\n isPrincipalStateResponse,\n type PrincipalContainerGrantResponse,\n PrincipalContainerGrantResponseSchema,\n type PrincipalMemberEnvelopeResponse,\n PrincipalMemberEnvelopeResponseSchema,\n type PrincipalPolicySnapshotResponse,\n PrincipalPolicySnapshotResponseSchema,\n type PrincipalPolicyStateChainEntryResponse,\n PrincipalPolicyStateChainEntryResponseSchema,\n type PrincipalProjectionMemberResponse,\n PrincipalProjectionMemberResponseSchema,\n type PrincipalStateExternalAuthorityResponse,\n PrincipalStateExternalAuthorityResponseSchema,\n type PrincipalStatePayloadResponse,\n PrincipalStatePayloadResponseSchema,\n type PrincipalStateResponse,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport const principalPolicyCurrentResponseShape = {\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentMemberEnvelopes: CurrentPrincipalMemberEnvelopesResponseSchema,\n currentPayload: PrincipalStatePayloadResponseSchema,\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n};\n\nexport const PrincipalPolicyBundleResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicyBundleResponse = z.infer<\n typeof PrincipalPolicyBundleResponseSchema\n>;\n\nexport const PrincipalPolicyMutationResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n containerMutations: arraySchema(ContainerMutationResponseSchema),\n});\n\nexport type PrincipalPolicyMutationResponse = z.infer<\n typeof PrincipalPolicyMutationResponseSchema\n>;\n\nexport const CommitOrganizationGroupPolicyResponseSchema = loosePlainObject({\n groupPolicy: PrincipalPolicyMutationResponseSchema,\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n});\n\nexport type CommitOrganizationGroupPolicyResponse = z.infer<\n typeof CommitOrganizationGroupPolicyResponseSchema\n>;\n\nexport const PrincipalPolicyErrorResponseSchema = BillingErrorResponseSchema;\n\nexport type PrincipalPolicyErrorResponse = z.infer<\n typeof PrincipalPolicyErrorResponseSchema\n>;\n\n/**\n * A group policy change rematerializes its granted containers, and a rekey or\n * revoke among them is a rotation like any other: one that would leave a level\n * above a directly granted container pinned to a retired epoch is refused, and\n * this names the descendant rekeys the batch must carry, parent-first.\n */\nconst PrincipalPolicyDescendantRekeysRequiredResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE),\n error: z.string().min(1),\n requiredContainerIds: arraySchema(\n nonEmptyStringSchema,\n MAX_ROTATION_CONTAINER_REKEYS,\n ),\n});\n\n/**\n * The commit's conflict envelope alone: only a group commit carries container\n * mutations, so only it can be refused for what they strand. The principal\n * policy read and the organization policy write keep the plain envelope.\n */\nexport const CommitOrganizationGroupPolicyConflictResponseSchema = z.union([\n PrincipalPolicyErrorResponseSchema,\n PrincipalPolicyDescendantRekeysRequiredResponseSchema,\n]);\n\nexport const PrincipalPolicyStaleErrorResponseSchema = loosePlainObject({\n code: z.literal(\"principal_policy_stale\"),\n error: z.string().min(1),\n principalPolicies: arraySchema(PrincipalPolicyBundleResponseSchema),\n});\n\nexport type PrincipalPolicyStaleErrorResponse = z.infer<\n typeof PrincipalPolicyStaleErrorResponseSchema\n>;\n\nexport function isPrincipalPolicyBundleResponse(\n value: unknown,\n): value is PrincipalPolicyBundleResponse {\n return PrincipalPolicyBundleResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyMutationResponse(\n value: unknown,\n): value is PrincipalPolicyMutationResponse {\n return PrincipalPolicyMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isCommitOrganizationGroupPolicyResponse(\n value: unknown,\n): value is CommitOrganizationGroupPolicyResponse {\n return CommitOrganizationGroupPolicyResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStaleErrorResponse(\n value: unknown,\n): value is PrincipalPolicyStaleErrorResponse {\n return PrincipalPolicyStaleErrorResponseSchema.safeParse(value).success;\n}\n"]}
1
+ {"version":3,"file":"principal.js","sourceRoot":"","sources":["principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,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CAAC,OAAO,CAAC;AAC1E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { arraySchema, loosePlainObject, nonEmptyStringSchema } from \"../schema\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"../util\";\nimport { PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT } from \"../util/principalHistoryWire\";\nimport { ContainerMutationResponseSchema } from \"./container\";\nimport { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from \"./descendantRekeysRequiredError\";\nimport { BillingErrorResponseSchema } from \"./organizationBilling\";\nimport { ReferencedPrincipalStateResponseSchema } from \"./principalReference\";\n\nimport {\n CurrentPrincipalMemberEnvelopesResponseSchema,\n PrincipalContainerGrantResponseSchema,\n PrincipalPolicyStateChainEntryResponseSchema,\n PrincipalProjectionMemberResponseSchema,\n PrincipalStatePayloadResponseSchema,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport {\n type CurrentPrincipalMemberEnvelopesResponse,\n CurrentPrincipalMemberEnvelopesResponseSchema,\n isCurrentPrincipalMemberEnvelopesResponse,\n isPrincipalPolicyStateChainEntryResponse,\n isPrincipalStatePayloadResponse,\n isPrincipalStateResponse,\n type PrincipalContainerGrantResponse,\n PrincipalContainerGrantResponseSchema,\n type PrincipalMemberEnvelopeResponse,\n PrincipalMemberEnvelopeResponseSchema,\n type PrincipalPolicySnapshotResponse,\n PrincipalPolicySnapshotResponseSchema,\n type PrincipalPolicyStateChainEntryResponse,\n PrincipalPolicyStateChainEntryResponseSchema,\n type PrincipalProjectionMemberResponse,\n PrincipalProjectionMemberResponseSchema,\n type PrincipalStateExternalAuthorityResponse,\n PrincipalStateExternalAuthorityResponseSchema,\n type PrincipalStatePayloadResponse,\n PrincipalStatePayloadResponseSchema,\n type PrincipalStateResponse,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport const principalPolicyCurrentResponseShape = {\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentMemberEnvelopes: CurrentPrincipalMemberEnvelopesResponseSchema,\n currentPayload: PrincipalStatePayloadResponseSchema,\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n};\n\nexport const PrincipalPolicyBundleResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicyBundleResponse = z.infer<\n typeof PrincipalPolicyBundleResponseSchema\n>;\n\nexport const PrincipalPolicyMutationResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n containerMutations: arraySchema(ContainerMutationResponseSchema),\n});\n\nexport type PrincipalPolicyMutationResponse = z.infer<\n typeof PrincipalPolicyMutationResponseSchema\n>;\n\nexport const CommitOrganizationGroupPolicyResponseSchema = loosePlainObject({\n groupPolicy: PrincipalPolicyMutationResponseSchema,\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n});\n\nexport type CommitOrganizationGroupPolicyResponse = z.infer<\n typeof CommitOrganizationGroupPolicyResponseSchema\n>;\n\nexport const PrincipalPolicyErrorResponseSchema = BillingErrorResponseSchema;\n\nexport type PrincipalPolicyErrorResponse = z.infer<\n typeof PrincipalPolicyErrorResponseSchema\n>;\n\n/**\n * A group policy change rematerializes its granted containers, and a rekey or\n * revoke among them is a rotation like any other: one that would leave a level\n * above a directly granted container pinned to a retired epoch is refused, and\n * this names the descendant rekeys the batch must carry, parent-first.\n */\nconst PrincipalPolicyDescendantRekeysRequiredResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE),\n error: z.string().min(1),\n requiredContainerIds: arraySchema(\n nonEmptyStringSchema,\n MAX_ROTATION_CONTAINER_REKEYS,\n ),\n});\n\n/**\n * The commit's conflict envelope alone: only a group commit carries container\n * mutations, so only it can be refused for what they strand. The principal\n * policy read and the organization policy write keep the plain envelope.\n */\nexport const CommitOrganizationGroupPolicyConflictResponseSchema = z.union([\n PrincipalPolicyErrorResponseSchema,\n PrincipalPolicyDescendantRekeysRequiredResponseSchema,\n]);\n\nexport const PrincipalPolicyStaleErrorResponseSchema = loosePlainObject({\n code: z.literal(\"principal_policy_stale\"),\n error: z.string().min(1),\n principalHeads: arraySchema(\n ReferencedPrincipalStateResponseSchema,\n PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT,\n ),\n});\n\nexport type PrincipalPolicyStaleErrorResponse = z.infer<\n typeof PrincipalPolicyStaleErrorResponseSchema\n>;\n\nexport function isPrincipalPolicyBundleResponse(\n value: unknown,\n): value is PrincipalPolicyBundleResponse {\n return PrincipalPolicyBundleResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyMutationResponse(\n value: unknown,\n): value is PrincipalPolicyMutationResponse {\n return PrincipalPolicyMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isCommitOrganizationGroupPolicyResponse(\n value: unknown,\n): value is CommitOrganizationGroupPolicyResponse {\n return CommitOrganizationGroupPolicyResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStaleErrorResponse(\n value: unknown,\n): value is PrincipalPolicyStaleErrorResponse {\n return PrincipalPolicyStaleErrorResponseSchema.safeParse(value).success;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export declare const ReferencedPrincipalStateResponseShape: {
3
- keyEpoch: z.ZodNumber;
3
+ keyEpoch: z.ZodCustom<number, number>;
4
4
  keyFingerprint: z.ZodString;
5
5
  principalId: z.ZodString;
6
6
  principalType: z.ZodLiteral<"group" | "organization">;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { boundedPositiveIntegerSchema, loosePlainObject } from "../schema.js";
3
3
  export const ReferencedPrincipalStateResponseShape = {
4
- keyEpoch: z.number(),
4
+ keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),
5
5
  keyFingerprint: z.string(),
6
6
  principalId: z.string(),
7
7
  principalType: z.literal(["group", "organization"]),
@@ -1 +1 @@
1
- {"version":3,"file":"principalReference.js","sourceRoot":"","sources":["principalReference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE3E,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;CAC/D,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,gBAAgB,CACpE,qCAAqC,CACtC,CAAC;AAMF,MAAM,UAAU,kCAAkC,CAChD,KAAc;IAEd,OAAO,sCAAsC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACzE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { boundedPositiveIntegerSchema, loosePlainObject } from \"../schema\";\n\nexport const ReferencedPrincipalStateResponseShape = {\n keyEpoch: z.number(),\n keyFingerprint: z.string(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n};\n\nexport const ReferencedPrincipalStateResponseSchema = loosePlainObject(\n ReferencedPrincipalStateResponseShape,\n);\n\nexport type ReferencedPrincipalStateResponse = z.infer<\n typeof ReferencedPrincipalStateResponseSchema\n>;\n\nexport function isReferencedPrincipalStateResponse(\n value: unknown,\n): value is ReferencedPrincipalStateResponse {\n return ReferencedPrincipalStateResponseSchema.safeParse(value).success;\n}\n"]}
1
+ {"version":3,"file":"principalReference.js","sourceRoot":"","sources":["principalReference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE3E,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,QAAQ,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAC/D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;CAC/D,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,gBAAgB,CACpE,qCAAqC,CACtC,CAAC;AAMF,MAAM,UAAU,kCAAkC,CAChD,KAAc;IAEd,OAAO,sCAAsC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACzE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { boundedPositiveIntegerSchema, loosePlainObject } from \"../schema\";\n\nexport const ReferencedPrincipalStateResponseShape = {\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: z.string(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n};\n\nexport const ReferencedPrincipalStateResponseSchema = loosePlainObject(\n ReferencedPrincipalStateResponseShape,\n);\n\nexport type ReferencedPrincipalStateResponse = z.infer<\n typeof ReferencedPrincipalStateResponseSchema\n>;\n\nexport function isReferencedPrincipalStateResponse(\n value: unknown,\n): value is ReferencedPrincipalStateResponse {\n return ReferencedPrincipalStateResponseSchema.safeParse(value).success;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
- import { arraySchema, boundedPositiveIntegerSchema, loosePlainObject, nonNegativeIntegerSchema, positiveIntegerSchema, } from "../schema.js";
2
+ import { arraySchema, boundedPositiveIntegerSchema, loosePlainObject, nonNegativeIntegerSchema, } from "../schema.js";
3
3
  export const PrincipalStateExternalAuthorityResponseSchema = loosePlainObject({
4
- keyEpoch: positiveIntegerSchema,
4
+ keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),
5
5
  keyFingerprint: z.string(),
6
6
  principalId: z.string(),
7
7
  principalType: z.literal("group"),
@@ -14,7 +14,7 @@ export const PrincipalStateResponseSchema = loosePlainObject({
14
14
  externalAuthority: PrincipalStateExternalAuthorityResponseSchema.nullable(),
15
15
  grantCount: nonNegativeIntegerSchema,
16
16
  grantRoot: z.string(),
17
- keyEpoch: z.number(),
17
+ keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),
18
18
  keyFingerprint: z.string(),
19
19
  memberCount: nonNegativeIntegerSchema,
20
20
  memberEnvelopesRoot: z.string(),
@@ -57,7 +57,7 @@ export const PrincipalMemberEnvelopeResponseSchema = loosePlainObject({
57
57
  });
58
58
  export const CurrentPrincipalMemberEnvelopesResponseSchema = loosePlainObject({
59
59
  envelopes: arraySchema(PrincipalMemberEnvelopeResponseSchema),
60
- epoch: z.number(),
60
+ epoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),
61
61
  principalId: z.string(),
62
62
  principalType: z.literal(["group", "organization"]),
63
63
  stateHash: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"principalSnapshot.js","sourceRoot":"","sources":["principalSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,4BAA4B,EAC5B,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,GACtB,MAA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C;AAC/E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n arraySchema,\n boundedPositiveIntegerSchema,\n loosePlainObject,\n nonNegativeIntegerSchema,\n positiveIntegerSchema,\n} from \"../schema\";\n\nexport const PrincipalStateExternalAuthorityResponseSchema = loosePlainObject({\n keyEpoch: positiveIntegerSchema,\n keyFingerprint: z.string(),\n principalId: z.string(),\n principalType: z.literal(\"group\"),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n});\n\nexport type PrincipalStateExternalAuthorityResponse = z.infer<\n typeof PrincipalStateExternalAuthorityResponseSchema\n>;\n\nexport const PrincipalStateResponseSchema = loosePlainObject({\n createdAt: z.string(),\n encapsulationPublicKey: z.string(),\n externalAuthority: PrincipalStateExternalAuthorityResponseSchema.nullable(),\n grantCount: nonNegativeIntegerSchema,\n grantRoot: z.string(),\n keyEpoch: z.number(),\n keyFingerprint: z.string(),\n memberCount: nonNegativeIntegerSchema,\n memberEnvelopesRoot: z.string(),\n membershipMode: z.literal(\"projection\"),\n membershipRoot: z.string(),\n payloadCiphertextHash: z.string(),\n prevStateHash: z.string().nullable(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n projectionRoot: z.string(),\n signature: z.string(),\n signedAt: z.string(),\n signerUserId: z.string(),\n signerUserKeyFingerprint: z.string(),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n});\n\nexport type PrincipalStateResponse = z.infer<\n typeof PrincipalStateResponseSchema\n>;\n\nexport const PrincipalProjectionMemberResponseSchema = loosePlainObject({\n role: z.literal([\"member\", \"admin\"]),\n userId: z.string(),\n});\n\nexport type PrincipalProjectionMemberResponse = z.infer<\n typeof PrincipalProjectionMemberResponseSchema\n>;\n\nexport const PrincipalContainerGrantResponseSchema = loosePlainObject({\n accessLevel: z.literal([\"admin\", \"read\", \"write\"]),\n containerId: z.string(),\n});\n\nexport type PrincipalContainerGrantResponse = z.infer<\n typeof PrincipalContainerGrantResponseSchema\n>;\n\nexport const PrincipalStatePayloadResponseSchema = loosePlainObject({\n cipherSuite: z.literal(\"aes-256-gcm\"),\n ciphertext: z.string(),\n ciphertextHash: z.string(),\n createdAt: z.string(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n});\n\nexport type PrincipalStatePayloadResponse = z.infer<\n typeof PrincipalStatePayloadResponseSchema\n>;\n\nexport const PrincipalMemberEnvelopeResponseSchema = loosePlainObject({\n kemCipherText: z.string(),\n memberKeyFingerprint: z.string(),\n userId: z.string(),\n wrappedKey: z.string(),\n});\n\nexport type PrincipalMemberEnvelopeResponse = z.infer<\n typeof PrincipalMemberEnvelopeResponseSchema\n>;\n\nexport const CurrentPrincipalMemberEnvelopesResponseSchema = loosePlainObject({\n envelopes: arraySchema(PrincipalMemberEnvelopeResponseSchema),\n epoch: z.number(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n});\n\nexport type CurrentPrincipalMemberEnvelopesResponse = z.infer<\n typeof CurrentPrincipalMemberEnvelopesResponseSchema\n>;\n\nexport const PrincipalPolicyStateChainEntryResponseSchema = loosePlainObject({\n grants: arraySchema(PrincipalContainerGrantResponseSchema),\n projection: arraySchema(PrincipalProjectionMemberResponseSchema),\n state: PrincipalStateResponseSchema,\n});\n\nexport type PrincipalPolicyStateChainEntryResponse = z.infer<\n typeof PrincipalPolicyStateChainEntryResponseSchema\n>;\n\nexport const PrincipalPolicySnapshotResponseSchema = loosePlainObject({\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicySnapshotResponse = z.infer<\n typeof PrincipalPolicySnapshotResponseSchema\n>;\n\nexport function isPrincipalStateResponse(\n value: unknown,\n): value is PrincipalStateResponse {\n return PrincipalStateResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalStatePayloadResponse(\n value: unknown,\n): value is PrincipalStatePayloadResponse {\n return PrincipalStatePayloadResponseSchema.safeParse(value).success;\n}\n\nexport function isCurrentPrincipalMemberEnvelopesResponse(\n value: unknown,\n): value is CurrentPrincipalMemberEnvelopesResponse {\n return CurrentPrincipalMemberEnvelopesResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStateChainEntryResponse(\n value: unknown,\n): value is PrincipalPolicyStateChainEntryResponse {\n return PrincipalPolicyStateChainEntryResponseSchema.safeParse(value).success;\n}\n"]}
1
+ {"version":3,"file":"principalSnapshot.js","sourceRoot":"","sources":["principalSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,4BAA4B,EAC5B,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,6CAA6C,GAAG,gBAAgB,CAAC;IAC5E,QAAQ,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAC/D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;CAC/D,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE;IAClC,iBAAiB,EAAE,6CAA6C,CAAC,QAAQ,EAAE;IAC3E,UAAU,EAAE,wBAAwB;IACpC,SAAS,EAAE,CAAC,CAAC,MAAM,EAA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gB,CAAC;IACpE,aAAa,EAAE,WAAW,CAAC,qCAAqC,CAAC;IACjE,iBAAiB,EAAE,WAAW,CAAC,uCAAuC,CAAC;IACvE,YAAY,EAAE,4BAA4B;IAC1C,cAAc,EAAE,WAAW,CAAC,4CAA4C,CAAC;CAC1E,CAAC,CAAC;AAMH,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,KAAc;IAEd,OAAO,mCAAmC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,yCAAyC,CACvD,KAAc;IAEd,OAAO,6CAA6C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,wCAAwC,CACtD,KAAc;IAEd,OAAO,4CAA4C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n arraySchema,\n boundedPositiveIntegerSchema,\n loosePlainObject,\n nonNegativeIntegerSchema,\n} from \"../schema\";\n\nexport const PrincipalStateExternalAuthorityResponseSchema = loosePlainObject({\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: z.string(),\n principalId: z.string(),\n principalType: z.literal(\"group\"),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n});\n\nexport type PrincipalStateExternalAuthorityResponse = z.infer<\n typeof PrincipalStateExternalAuthorityResponseSchema\n>;\n\nexport const PrincipalStateResponseSchema = loosePlainObject({\n createdAt: z.string(),\n encapsulationPublicKey: z.string(),\n externalAuthority: PrincipalStateExternalAuthorityResponseSchema.nullable(),\n grantCount: nonNegativeIntegerSchema,\n grantRoot: z.string(),\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: z.string(),\n memberCount: nonNegativeIntegerSchema,\n memberEnvelopesRoot: z.string(),\n membershipMode: z.literal(\"projection\"),\n membershipRoot: z.string(),\n payloadCiphertextHash: z.string(),\n prevStateHash: z.string().nullable(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n projectionRoot: z.string(),\n signature: z.string(),\n signedAt: z.string(),\n signerUserId: z.string(),\n signerUserKeyFingerprint: z.string(),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n});\n\nexport type PrincipalStateResponse = z.infer<\n typeof PrincipalStateResponseSchema\n>;\n\nexport const PrincipalProjectionMemberResponseSchema = loosePlainObject({\n role: z.literal([\"member\", \"admin\"]),\n userId: z.string(),\n});\n\nexport type PrincipalProjectionMemberResponse = z.infer<\n typeof PrincipalProjectionMemberResponseSchema\n>;\n\nexport const PrincipalContainerGrantResponseSchema = loosePlainObject({\n accessLevel: z.literal([\"admin\", \"read\", \"write\"]),\n containerId: z.string(),\n});\n\nexport type PrincipalContainerGrantResponse = z.infer<\n typeof PrincipalContainerGrantResponseSchema\n>;\n\nexport const PrincipalStatePayloadResponseSchema = loosePlainObject({\n cipherSuite: z.literal(\"aes-256-gcm\"),\n ciphertext: z.string(),\n ciphertextHash: z.string(),\n createdAt: z.string(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n});\n\nexport type PrincipalStatePayloadResponse = z.infer<\n typeof PrincipalStatePayloadResponseSchema\n>;\n\nexport const PrincipalMemberEnvelopeResponseSchema = loosePlainObject({\n kemCipherText: z.string(),\n memberKeyFingerprint: z.string(),\n userId: z.string(),\n wrappedKey: z.string(),\n});\n\nexport type PrincipalMemberEnvelopeResponse = z.infer<\n typeof PrincipalMemberEnvelopeResponseSchema\n>;\n\nexport const CurrentPrincipalMemberEnvelopesResponseSchema = loosePlainObject({\n envelopes: arraySchema(PrincipalMemberEnvelopeResponseSchema),\n epoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n});\n\nexport type CurrentPrincipalMemberEnvelopesResponse = z.infer<\n typeof CurrentPrincipalMemberEnvelopesResponseSchema\n>;\n\nexport const PrincipalPolicyStateChainEntryResponseSchema = loosePlainObject({\n grants: arraySchema(PrincipalContainerGrantResponseSchema),\n projection: arraySchema(PrincipalProjectionMemberResponseSchema),\n state: PrincipalStateResponseSchema,\n});\n\nexport type PrincipalPolicyStateChainEntryResponse = z.infer<\n typeof PrincipalPolicyStateChainEntryResponseSchema\n>;\n\nexport const PrincipalPolicySnapshotResponseSchema = loosePlainObject({\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicySnapshotResponse = z.infer<\n typeof PrincipalPolicySnapshotResponseSchema\n>;\n\nexport function isPrincipalStateResponse(\n value: unknown,\n): value is PrincipalStateResponse {\n return PrincipalStateResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalStatePayloadResponse(\n value: unknown,\n): value is PrincipalStatePayloadResponse {\n return PrincipalStatePayloadResponseSchema.safeParse(value).success;\n}\n\nexport function isCurrentPrincipalMemberEnvelopesResponse(\n value: unknown,\n): value is CurrentPrincipalMemberEnvelopesResponse {\n return CurrentPrincipalMemberEnvelopesResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStateChainEntryResponse(\n value: unknown,\n): value is PrincipalPolicyStateChainEntryResponse {\n return PrincipalPolicyStateChainEntryResponseSchema.safeParse(value).success;\n}\n"]}
@@ -5,7 +5,7 @@ export { MAX_CONTAINER_PATH_LENGTH } from "./containerLimits.js";
5
5
  export { MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS, MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS, MAX_DOCUMENT_SYNC_CONTENT_KEY_TARGETS, MAX_DOCUMENT_SYNC_OUTGOING_UPDATES, MAX_DOCUMENT_SYNC_PULL_CURSOR_LENGTH, MAX_DOCUMENT_SYNC_REQUEST_BYTES, MAX_DOCUMENT_SYNC_RESPONSE_ENVELOPE_BYTES, MAX_DOCUMENT_SYNC_RESPONSE_PAGE_BYTES, MAX_DOCUMENT_SYNC_RESPONSE_PAGE_UPDATES, MAX_DOCUMENT_SYNC_RESPONSE_UPDATE_PAGE_BYTES, } from "./documentSyncLimits.js";
6
6
  export { isSerializedKeyEnvelope, isSerializedKeyEnvelopeArray, type SerializedKeyEnvelope, } from "./keyEnvelope.js";
7
7
  export { isOrganizationReplacementAuthorization, type OrganizationReplacementAuthorization, OrganizationReplacementAuthorizationSchema, } from "./organizationReplacement.js";
8
- export { PRINCIPAL_POLICY_HISTORY_PAGE_LIMIT } from "./principalHistoryWire.js";
8
+ export { PRINCIPAL_POLICY_HISTORY_PAGE_LIMIT, PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT, } from "./principalHistoryWire.js";
9
9
  export { PROJECTION_HISTORY_HINT_CHARACTERS, ProjectionHistoryHeadersSchema, type ProjectionHistoryPrefix, ProjectionHistoryPrefixesSchema, parseProjectionHistoryHints, } from "./projectionHistoryWire.js";
10
10
  export { hasArrayProperty, hasBooleanProperty, hasNonEmptyStringProperty, hasNullableNumberProperty, hasNullableStringProperty, hasNumberProperty, hasObjectProperty, hasOptionalStringProperty, hasPositiveIntegerProperty, hasPropertyValue, hasStringProperty, isNonEmptyStringArray, isOptionalRecordArray, isOptionalRecordArrayArray, isRecordArray, isRecordArrayArray, isStringArray, } from "./properties.js";
11
11
  export { AUTH_CHALLENGE_HEX_LENGTH, isAuthChallengeHexString, isByteArray, isByteArrayOfLength, isSha256HexString, ML_DSA87_PUBLIC_KEY_BYTES, ML_DSA87_SIGNATURE_BYTES, ML_KEM1024_PUBLIC_KEY_BYTES, SHA256_HEX_LENGTH, } from "./protocol.js";
@@ -5,7 +5,7 @@ export { MAX_CONTAINER_PATH_LENGTH } from "./containerLimits.js";
5
5
  export { MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS, MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS, MAX_DOCUMENT_SYNC_CONTENT_KEY_TARGETS, MAX_DOCUMENT_SYNC_OUTGOING_UPDATES, MAX_DOCUMENT_SYNC_PULL_CURSOR_LENGTH, MAX_DOCUMENT_SYNC_REQUEST_BYTES, MAX_DOCUMENT_SYNC_RESPONSE_ENVELOPE_BYTES, MAX_DOCUMENT_SYNC_RESPONSE_PAGE_BYTES, MAX_DOCUMENT_SYNC_RESPONSE_PAGE_UPDATES, MAX_DOCUMENT_SYNC_RESPONSE_UPDATE_PAGE_BYTES, } from "./documentSyncLimits.js";
6
6
  export { isSerializedKeyEnvelope, isSerializedKeyEnvelopeArray, } from "./keyEnvelope.js";
7
7
  export { isOrganizationReplacementAuthorization, OrganizationReplacementAuthorizationSchema, } from "./organizationReplacement.js";
8
- export { PRINCIPAL_POLICY_HISTORY_PAGE_LIMIT } from "./principalHistoryWire.js";
8
+ export { PRINCIPAL_POLICY_HISTORY_PAGE_LIMIT, PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT, } from "./principalHistoryWire.js";
9
9
  export { PROJECTION_HISTORY_HINT_CHARACTERS, ProjectionHistoryHeadersSchema, ProjectionHistoryPrefixesSchema, parseProjectionHistoryHints, } from "./projectionHistoryWire.js";
10
10
  export { hasArrayProperty, hasBooleanProperty, hasNonEmptyStringProperty, hasNullableNumberProperty, hasNullableStringProperty, hasNumberProperty, hasObjectProperty, hasOptionalStringProperty, hasPositiveIntegerProperty, hasPropertyValue, hasStringProperty, isNonEmptyStringArray, isOptionalRecordArray, isOptionalRecordArrayArray, isRecordArray, isRecordArrayArray, isStringArray, } from "./properties.js";
11
11
  export { AUTH_CHALLENGE_HEX_LENGTH, isAuthChallengeHexString, isByteArray, isByteArrayOfLength, isSha256HexString, ML_DSA87_PUBLIC_KEY_BYTES, ML_DSA87_SIGNATURE_BYTES, ML_KEM1024_PUBLIC_KEY_BYTES, SHA256_HEX_LENGTH, } from "./protocol.js";