@tearleads/client-sdk 0.1.248 → 0.1.250

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 (178) hide show
  1. package/client/organizations/index.js +5 -3
  2. package/client/organizations/index.js.map +1 -1
  3. package/client/organizations/organizationGroupPresentation.d.ts +1 -1
  4. package/client/organizations/organizationGroupPresentation.js.map +1 -1
  5. package/client/organizations/organizationLeaveRequestVerifier.js +21 -0
  6. package/client/organizations/organizationLeaveRequestVerifier.js.map +1 -0
  7. package/client/organizations/{organizationReadModels.d.ts → organizationReadModelCoordinator.d.ts} +18 -16
  8. package/client/organizations/organizationReadModelCoordinator.js +2 -0
  9. package/client/organizations/organizationReadModelCoordinator.js.map +1 -0
  10. package/client/organizations/organizationReadModelPresentation.js +51 -0
  11. package/client/organizations/organizationReadModelPresentation.js.map +1 -0
  12. package/client/organizations/organizationReadModelScopes.js +37 -0
  13. package/client/organizations/organizationReadModelScopes.js.map +1 -0
  14. package/client/organizations/organizationReadModels.js +131 -88
  15. package/client/organizations/organizationReadModels.js.map +1 -1
  16. package/client/organizations/organizationsTypes.d.ts +13 -5
  17. package/client/organizations/organizationsTypes.js.map +1 -1
  18. package/client/organizations/principalMutations.d.ts +18 -2
  19. package/client/organizations/principalMutations.js +29 -15
  20. package/client/organizations/principalMutations.js.map +1 -1
  21. package/client/runtime/principalMutationApi.d.ts +2 -0
  22. package/client/runtime/principalMutationApi.js +2 -0
  23. package/client/runtime/principalMutationApi.js.map +1 -1
  24. package/client/runtime/principalMutationDispatch.js +47 -10
  25. package/client/runtime/principalMutationDispatch.js.map +1 -1
  26. package/client/runtime/workflowRuntime.js +5 -4
  27. package/client/runtime/workflowRuntime.js.map +1 -1
  28. package/data/containers/shared/mutationRequestOptions.d.ts +2 -0
  29. package/data/containers/shared/mutationRequestOptions.js.map +1 -1
  30. package/data/containers/shared/types.d.ts +12 -2
  31. package/data/containers/shared/types.js.map +1 -1
  32. package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js +1 -4
  33. package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js.map +1 -1
  34. package/data/persistence/organizations/organizationReadModelRepository.js +20 -2
  35. package/data/persistence/organizations/organizationReadModelRepository.js.map +1 -1
  36. package/data/persistence/principalPolicy/heldOrganizationDirectories.js +6 -1
  37. package/data/persistence/principalPolicy/heldOrganizationDirectories.js.map +1 -1
  38. package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js +1 -1
  39. package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js.map +1 -1
  40. package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js +1 -5
  41. package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js.map +1 -1
  42. package/data/principals/organizationGroupDirectoryRequest.js +0 -2
  43. package/data/principals/organizationGroupDirectoryRequest.js.map +1 -1
  44. package/data/principals/organizationPolicyRequest.js +0 -2
  45. package/data/principals/organizationPolicyRequest.js.map +1 -1
  46. package/data/principals/principalPolicyRequest.js +0 -2
  47. package/data/principals/principalPolicyRequest.js.map +1 -1
  48. package/internal/api-client/ApiClient.d.ts +4 -59
  49. package/internal/api-client/client/apiClientContext.d.ts +0 -30
  50. package/internal/api-client/client/containerMutations.d.ts +2 -2
  51. package/internal/api-client/client/containerMutations.js +2 -1
  52. package/internal/api-client/client/containerMutations.js.map +1 -1
  53. package/internal/api-client/client/documents.d.ts +0 -12
  54. package/internal/api-client/client/principalPolicies.d.ts +3 -18
  55. package/internal/api-client/client/writerProjections.d.ts +0 -12
  56. package/internal/api-client/heldDirectoryCitations.d.ts +8 -4
  57. package/internal/api-client/heldDirectoryCitations.js +6 -10
  58. package/internal/api-client/heldDirectoryCitations.js.map +1 -1
  59. package/internal/api-client/organizationPolicyHistory.d.ts +0 -6
  60. package/internal/api-client/principalPolicyRequests.d.ts +2 -18
  61. package/internal/api-client/principalPolicyRequests.js +6 -4
  62. package/internal/api-client/principalPolicyRequests.js.map +1 -1
  63. package/internal/api-client/routes/containers/mutations.js +3 -3
  64. package/internal/api-client/routes/containers/mutations.js.map +1 -1
  65. package/internal/api-client/routes/organizations/createGroup.js +3 -5
  66. package/internal/api-client/routes/organizations/createGroup.js.map +1 -1
  67. package/internal/api-client/routes/principals/policy.js +2 -5
  68. package/internal/api-client/routes/principals/policy.js.map +1 -1
  69. package/internal/api-client/types.d.ts +6 -0
  70. package/internal/api-client/types.js.map +1 -1
  71. package/internal/api-client/verifiedManifestCitations.js +3 -3
  72. package/internal/api-client/verifiedManifestCitations.js.map +1 -1
  73. package/internal/crypto/index.d.ts +1 -1
  74. package/internal/crypto/index.js.map +1 -1
  75. package/internal/crypto/keying/principalPolicyPayload.js +2 -12
  76. package/internal/crypto/keying/principalPolicyPayload.js.map +1 -1
  77. package/internal/crypto/keying/principalPolicyTypes.d.ts +5 -6
  78. package/internal/crypto/keying/principalPolicyTypes.js.map +1 -1
  79. package/internal/crypto/principalState.d.ts +1 -1
  80. package/internal/crypto/principalState.js.map +1 -1
  81. package/internal/crypto/principalStateTypes.d.ts +0 -1
  82. package/internal/crypto/principalStateTypes.js.map +1 -1
  83. package/internal/validators/operation/auth.d.ts +0 -24
  84. package/internal/validators/operation/containerMutations.d.ts +20 -3
  85. package/internal/validators/operation/containerMutations.js +18 -20
  86. package/internal/validators/operation/containerMutations.js.map +1 -1
  87. package/internal/validators/operation/documentMutations.d.ts +0 -48
  88. package/internal/validators/operation/index.d.ts +1 -1
  89. package/internal/validators/operation/index.js +1 -1
  90. package/internal/validators/operation/index.js.map +1 -1
  91. package/internal/validators/operation/organizationPolicyHistory.d.ts +0 -24
  92. package/internal/validators/operation/organizations.d.ts +17 -49
  93. package/internal/validators/operation/organizations.js +4 -2
  94. package/internal/validators/operation/organizations.js.map +1 -1
  95. package/internal/validators/operation/principals.d.ts +17 -57
  96. package/internal/validators/operation/principals.js +5 -2
  97. package/internal/validators/operation/principals.js.map +1 -1
  98. package/internal/validators/operation/writerProjections.d.ts +0 -48
  99. package/internal/validators/request/index.d.ts +1 -1
  100. package/internal/validators/request/index.js +1 -1
  101. package/internal/validators/request/index.js.map +1 -1
  102. package/internal/validators/request/organization.d.ts +15 -32
  103. package/internal/validators/request/organization.js +8 -0
  104. package/internal/validators/request/organization.js.map +1 -1
  105. package/internal/validators/request/organizationProvisioning.d.ts +0 -72
  106. package/internal/validators/request/principal.d.ts +4 -48
  107. package/internal/validators/request/principal.js +4 -2
  108. package/internal/validators/request/principal.js.map +1 -1
  109. package/internal/validators/request/registration.d.ts +0 -24
  110. package/internal/validators/response/areas/organizations.d.ts +3 -2
  111. package/internal/validators/response/areas/organizations.js +3 -2
  112. package/internal/validators/response/areas/organizations.js.map +1 -1
  113. package/internal/validators/response/areas/principals.d.ts +1 -1
  114. package/internal/validators/response/areas/principals.js +1 -1
  115. package/internal/validators/response/areas/principals.js.map +1 -1
  116. package/internal/validators/response/committedReadModel.d.ts +697 -0
  117. package/internal/validators/response/committedReadModel.js +52 -0
  118. package/internal/validators/response/committedReadModel.js.map +1 -0
  119. package/internal/validators/response/container.d.ts +52 -48
  120. package/internal/validators/response/container.js +3 -3
  121. package/internal/validators/response/container.js.map +1 -1
  122. package/internal/validators/response/documentMutation.d.ts +0 -96
  123. package/internal/validators/response/organization.d.ts +0 -191
  124. package/internal/validators/response/organization.js +0 -7
  125. package/internal/validators/response/organization.js.map +1 -1
  126. package/internal/validators/response/organizationPolicyHistory.d.ts +0 -24
  127. package/internal/validators/response/organizationReadModel.d.ts +167 -0
  128. package/internal/validators/response/organizationReadModel.js +5 -0
  129. package/internal/validators/response/organizationReadModel.js.map +1 -1
  130. package/internal/validators/response/policyEvidenceWire.d.ts +5 -3
  131. package/internal/validators/response/policyEvidenceWire.js +6 -4
  132. package/internal/validators/response/policyEvidenceWire.js.map +1 -1
  133. package/internal/validators/response/principal.d.ts +0 -451
  134. package/internal/validators/response/principal.js +0 -8
  135. package/internal/validators/response/principal.js.map +1 -1
  136. package/internal/validators/response/principalPolicyPage.d.ts +0 -48
  137. package/internal/validators/response/principalSnapshot.d.ts +4 -24
  138. package/internal/validators/response/principalSnapshot.js +4 -6
  139. package/internal/validators/response/principalSnapshot.js.map +1 -1
  140. package/internal/validators/response/projectionPolicyEvidence.d.ts +0 -48
  141. package/package.json +1 -1
  142. package/workflows/container-contents/container-state/organizationHost.d.ts +9 -0
  143. package/workflows/container-contents/container-state/organizationHost.js.map +1 -1
  144. package/workflows/container-contents/container-state/remote.js +6 -0
  145. package/workflows/container-contents/container-state/remote.js.map +1 -1
  146. package/workflows/containers/child/share/index.d.ts +4 -2
  147. package/workflows/containers/child/share/index.js +37 -20
  148. package/workflows/containers/child/share/index.js.map +1 -1
  149. package/workflows/organizations/containerContentsHost.js +20 -1
  150. package/workflows/organizations/containerContentsHost.js.map +1 -1
  151. package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js +5 -1
  152. package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js.map +1 -1
  153. package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js +1 -6
  154. package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js.map +1 -1
  155. package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js +1 -6
  156. package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js.map +1 -1
  157. package/workflows/organizations/groups/createCurrentOrganizationGroup.js +8 -1
  158. package/workflows/organizations/groups/createCurrentOrganizationGroup.js.map +1 -1
  159. package/workflows/organizations/index.d.ts +1 -0
  160. package/workflows/organizations/index.js +1 -0
  161. package/workflows/organizations/index.js.map +1 -1
  162. package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js +4 -6
  163. package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js.map +1 -1
  164. package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js +1 -7
  165. package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js.map +1 -1
  166. package/workflows/organizations/readModel/committedReadModel.d.ts +66 -0
  167. package/workflows/organizations/readModel/committedReadModel.js +150 -0
  168. package/workflows/organizations/readModel/committedReadModel.js.map +1 -0
  169. package/workflows/organizations/readModel/readModelProjection.d.ts +15 -2
  170. package/workflows/organizations/readModel/readModelProjection.js +26 -4
  171. package/workflows/organizations/readModel/readModelProjection.js.map +1 -1
  172. package/workflows/principals/policyCache/principalPolicyCacheValidation.js +0 -13
  173. package/workflows/principals/policyCache/principalPolicyCacheValidation.js.map +1 -1
  174. package/workflows/principals/publicHistory/publicProjectionDirectory.js +4 -5
  175. package/workflows/principals/publicHistory/publicProjectionDirectory.js.map +1 -1
  176. package/workflows/registration/provisioningBootstrapBuilders.d.ts +0 -6
  177. package/workflows/registration/registrationPrincipalPolicyPersistence.js +1 -7
  178. package/workflows/registration/registrationPrincipalPolicyPersistence.js.map +1 -1
@@ -0,0 +1,52 @@
1
+ import { z } from "zod";
2
+ import { registerJsonSchemaView } from "../jsonSchema.js";
3
+ import { loosePlainObject } from "../schema.js";
4
+ import { ContainerMutationResponseShape } from "./container.js";
5
+ import { OrganizationGroupSummaryResponseSchema } from "./organization.js";
6
+ import { OrganizationReadModelDeltaSchema, } from "./organizationReadModel.js";
7
+ import { PrincipalPolicyMutationResponseSchema } from "./principal.js";
8
+ /**
9
+ * The read-model delta a mutation response may carry for the cursor its
10
+ * caller held (`readModelCursor`). Present only when that cursor was the head
11
+ * the commit advanced from and the caller may read the feed; otherwise the
12
+ * caller reads the feed as before. The receipt does not depend on it: a
13
+ * response validates whatever this field holds, and a client applies it only
14
+ * after `committedReadModelDelta` accepts it, so a malformed delta costs a
15
+ * feed read, never the acknowledgement.
16
+ */
17
+ const committedReadModel = registerJsonSchemaView(z.unknown().optional(), OrganizationReadModelDeltaSchema.optional());
18
+ function isOrganizationReadModelDelta(value) {
19
+ return OrganizationReadModelDeltaSchema.safeParse(value).success;
20
+ }
21
+ /** The delta a mutation response carried, if well formed for `organizationId`. */
22
+ export function committedReadModelDelta(value, organizationId) {
23
+ return isOrganizationReadModelDelta(value) &&
24
+ value.organizationId === organizationId
25
+ ? value
26
+ : undefined;
27
+ }
28
+ export const CreateOrganizationGroupResponseSchema = loosePlainObject({
29
+ group: OrganizationGroupSummaryResponseSchema,
30
+ organizationPolicy: PrincipalPolicyMutationResponseSchema,
31
+ readModel: committedReadModel,
32
+ });
33
+ export function isCreateOrganizationGroupResponse(value) {
34
+ return CreateOrganizationGroupResponseSchema.safeParse(value).success;
35
+ }
36
+ export const CommitOrganizationGroupPolicyResponseSchema = loosePlainObject({
37
+ groupPolicy: PrincipalPolicyMutationResponseSchema,
38
+ memberPolicy: PrincipalPolicyMutationResponseSchema.optional(),
39
+ organizationPolicy: PrincipalPolicyMutationResponseSchema,
40
+ readModel: committedReadModel,
41
+ });
42
+ export function isCommitOrganizationGroupPolicyResponse(value) {
43
+ return CommitOrganizationGroupPolicyResponseSchema.safeParse(value).success;
44
+ }
45
+ export const ContainerShareResponseSchema = loosePlainObject({
46
+ ...ContainerMutationResponseShape,
47
+ readModel: committedReadModel,
48
+ });
49
+ export function isContainerShareResponse(value) {
50
+ return ContainerShareResponseSchema.safeParse(value).success;
51
+ }
52
+ //# sourceMappingURL=committedReadModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"committedReadModel.js","sourceRoot":"","sources":["committedReadModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAEL,gCAAgC,GACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qCAAqC,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,kBAAkB,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,CAAC,OAAO,CAAC;AAC/D,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { registerJsonSchemaView } from \"../jsonSchema\";\nimport { loosePlainObject } from \"../schema\";\nimport { ContainerMutationResponseShape } from \"./container\";\nimport { OrganizationGroupSummaryResponseSchema } from \"./organization\";\nimport {\n type OrganizationReadModelDeltaResponse,\n OrganizationReadModelDeltaSchema,\n} from \"./organizationReadModel\";\nimport { PrincipalPolicyMutationResponseSchema } from \"./principal\";\n\n/**\n * The read-model delta a mutation response may carry for the cursor its\n * caller held (`readModelCursor`). Present only when that cursor was the head\n * the commit advanced from and the caller may read the feed; otherwise the\n * caller reads the feed as before. The receipt does not depend on it: a\n * response validates whatever this field holds, and a client applies it only\n * after `committedReadModelDelta` accepts it, so a malformed delta costs a\n * feed read, never the acknowledgement.\n */\nconst committedReadModel = registerJsonSchemaView(\n z.unknown().optional(),\n OrganizationReadModelDeltaSchema.optional(),\n);\n\nfunction isOrganizationReadModelDelta(\n value: unknown,\n): value is OrganizationReadModelDeltaResponse {\n return OrganizationReadModelDeltaSchema.safeParse(value).success;\n}\n\n/** The delta a mutation response carried, if well formed for `organizationId`. */\nexport function committedReadModelDelta(\n value: unknown,\n organizationId: string,\n): OrganizationReadModelDeltaResponse | undefined {\n return isOrganizationReadModelDelta(value) &&\n value.organizationId === organizationId\n ? value\n : undefined;\n}\n\nexport const CreateOrganizationGroupResponseSchema = loosePlainObject({\n group: OrganizationGroupSummaryResponseSchema,\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n readModel: committedReadModel,\n});\n\nexport type CreateOrganizationGroupResponse = z.infer<\n typeof CreateOrganizationGroupResponseSchema\n>;\n\nexport function isCreateOrganizationGroupResponse(\n value: unknown,\n): value is CreateOrganizationGroupResponse {\n return CreateOrganizationGroupResponseSchema.safeParse(value).success;\n}\n\nexport const CommitOrganizationGroupPolicyResponseSchema = loosePlainObject({\n groupPolicy: PrincipalPolicyMutationResponseSchema,\n memberPolicy: PrincipalPolicyMutationResponseSchema.optional(),\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n readModel: committedReadModel,\n});\n\nexport type CommitOrganizationGroupPolicyResponse = z.infer<\n typeof CommitOrganizationGroupPolicyResponseSchema\n>;\n\nexport function isCommitOrganizationGroupPolicyResponse(\n value: unknown,\n): value is CommitOrganizationGroupPolicyResponse {\n return CommitOrganizationGroupPolicyResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerShareResponseSchema = loosePlainObject({\n ...ContainerMutationResponseShape,\n readModel: committedReadModel,\n});\n\nexport type ContainerShareResponse = z.infer<\n typeof ContainerShareResponseSchema\n>;\n\nexport function isContainerShareResponse(\n value: unknown,\n): value is ContainerShareResponse {\n return ContainerShareResponseSchema.safeParse(value).success;\n}\n"]}
@@ -395,6 +395,58 @@ export declare const ContainerKekLogResponseSchema: z.ZodType<{
395
395
  }>>;
396
396
  export type ContainerKekLogResponse = z.infer<typeof ContainerKekLogResponseSchema>;
397
397
  export declare function isContainerKekLogResponse(value: unknown): value is ContainerKekLogResponse;
398
+ export declare const ContainerMutationResponseShape: {
399
+ containerKek: z.ZodType<{
400
+ containerKeyEpoch: number;
401
+ containerKeyEpochId: string;
402
+ keyEpochHash: string;
403
+ keyringHash: string | null;
404
+ keyTargetHash: string;
405
+ parentContainerKeyEpochId: string | null;
406
+ }, {
407
+ containerKeyEpoch: number;
408
+ containerKeyEpochId: string;
409
+ keyEpochHash: string;
410
+ keyringHash: string | null;
411
+ keyTargetHash: string;
412
+ parentContainerKeyEpochId: string | null;
413
+ }, z.core.$ZodTypeInternals<{
414
+ containerKeyEpoch: number;
415
+ containerKeyEpochId: string;
416
+ keyEpochHash: string;
417
+ keyringHash: string | null;
418
+ keyTargetHash: string;
419
+ parentContainerKeyEpochId: string | null;
420
+ }, {
421
+ containerKeyEpoch: number;
422
+ containerKeyEpochId: string;
423
+ keyEpochHash: string;
424
+ keyringHash: string | null;
425
+ keyTargetHash: string;
426
+ parentContainerKeyEpochId: string | null;
427
+ }>>;
428
+ bundleDigest: z.ZodCustom<string, string>;
429
+ containerId: z.ZodString;
430
+ createdAt: z.ZodString;
431
+ eventHash: z.ZodString;
432
+ manifestHead: z.ZodType<{
433
+ epoch: number;
434
+ manifestHash: string;
435
+ }, {
436
+ epoch: number;
437
+ manifestHash: string;
438
+ }, z.core.$ZodTypeInternals<{
439
+ epoch: number;
440
+ manifestHash: string;
441
+ }, {
442
+ epoch: number;
443
+ manifestHash: string;
444
+ }>>;
445
+ organizationId: z.ZodString;
446
+ parentId: z.ZodNullable<z.ZodString>;
447
+ systemSlot: z.ZodOptional<z.ZodNullable<z.ZodCustom<string, string>>>;
448
+ updatedAt: z.ZodString;
449
+ };
398
450
  export declare const ContainerMutationResponseSchema: z.ZodType<{
399
451
  containerKek: {
400
452
  containerKeyEpoch: number;
@@ -941,13 +993,7 @@ export declare const ContainerWriterProjectionResponseSchema: z.ZodType<{
941
993
  version: number;
942
994
  };
943
995
  payload: {
944
- cipherSuite: "aes-256-gcm";
945
996
  ciphertext: string;
946
- ciphertextHash: string;
947
- createdAt: string;
948
- principalId: string;
949
- principalType: "group" | "organization";
950
- stateHash: string;
951
997
  };
952
998
  }[];
953
999
  groups: {
@@ -1027,13 +1073,7 @@ export declare const ContainerWriterProjectionResponseSchema: z.ZodType<{
1027
1073
  version: number;
1028
1074
  };
1029
1075
  payload: {
1030
- cipherSuite: "aes-256-gcm";
1031
1076
  ciphertext: string;
1032
- ciphertextHash: string;
1033
- createdAt: string;
1034
- principalId: string;
1035
- principalType: "group" | "organization";
1036
- stateHash: string;
1037
1077
  };
1038
1078
  }[];
1039
1079
  groups: {
@@ -1113,13 +1153,7 @@ export declare const ContainerWriterProjectionResponseSchema: z.ZodType<{
1113
1153
  version: number;
1114
1154
  };
1115
1155
  payload: {
1116
- cipherSuite: "aes-256-gcm";
1117
1156
  ciphertext: string;
1118
- ciphertextHash: string;
1119
- createdAt: string;
1120
- principalId: string;
1121
- principalType: "group" | "organization";
1122
- stateHash: string;
1123
1157
  };
1124
1158
  }[];
1125
1159
  groups: {
@@ -1199,13 +1233,7 @@ export declare const ContainerWriterProjectionResponseSchema: z.ZodType<{
1199
1233
  version: number;
1200
1234
  };
1201
1235
  payload: {
1202
- cipherSuite: "aes-256-gcm";
1203
1236
  ciphertext: string;
1204
- ciphertextHash: string;
1205
- createdAt: string;
1206
- principalId: string;
1207
- principalType: "group" | "organization";
1208
- stateHash: string;
1209
1237
  };
1210
1238
  }[];
1211
1239
  groups: {
@@ -1405,13 +1433,7 @@ export declare const ContainerWriterProjectionWireResponseSchema: z.ZodType<{
1405
1433
  version: number;
1406
1434
  };
1407
1435
  payload: {
1408
- cipherSuite: "aes-256-gcm";
1409
1436
  ciphertext: string;
1410
- ciphertextHash: string;
1411
- createdAt: string;
1412
- principalId: string;
1413
- principalType: "group" | "organization";
1414
- stateHash: string;
1415
1437
  } | null;
1416
1438
  }[];
1417
1439
  groups: {
@@ -1487,13 +1509,7 @@ export declare const ContainerWriterProjectionWireResponseSchema: z.ZodType<{
1487
1509
  version: number;
1488
1510
  };
1489
1511
  payload: {
1490
- cipherSuite: "aes-256-gcm";
1491
1512
  ciphertext: string;
1492
- ciphertextHash: string;
1493
- createdAt: string;
1494
- principalId: string;
1495
- principalType: "group" | "organization";
1496
- stateHash: string;
1497
1513
  } | null;
1498
1514
  }[];
1499
1515
  groups: {
@@ -1569,13 +1585,7 @@ export declare const ContainerWriterProjectionWireResponseSchema: z.ZodType<{
1569
1585
  version: number;
1570
1586
  };
1571
1587
  payload: {
1572
- cipherSuite: "aes-256-gcm";
1573
1588
  ciphertext: string;
1574
- ciphertextHash: string;
1575
- createdAt: string;
1576
- principalId: string;
1577
- principalType: "group" | "organization";
1578
- stateHash: string;
1579
1589
  } | null;
1580
1590
  }[];
1581
1591
  groups: {
@@ -1651,13 +1661,7 @@ export declare const ContainerWriterProjectionWireResponseSchema: z.ZodType<{
1651
1661
  version: number;
1652
1662
  };
1653
1663
  payload: {
1654
- cipherSuite: "aes-256-gcm";
1655
1664
  ciphertext: string;
1656
- ciphertextHash: string;
1657
- createdAt: string;
1658
- principalId: string;
1659
- principalType: "group" | "organization";
1660
- stateHash: string;
1661
1665
  } | null;
1662
1666
  }[];
1663
1667
  groups: {
@@ -141,14 +141,14 @@ const ContainerMutationKekAcknowledgementSchema = registerJsonSchemaRuntimeRefin
141
141
  });
142
142
  }
143
143
  }), [organizationProvisioningContainerKeyringRefinement]);
144
- const containerMutationResponseShape = {
144
+ export const ContainerMutationResponseShape = {
145
145
  ...ContainerManifestMutationResponseShape,
146
146
  containerKek: ContainerMutationKekAcknowledgementSchema,
147
147
  };
148
- export const ContainerMutationResponseSchema = loosePlainObject(containerMutationResponseShape);
148
+ export const ContainerMutationResponseSchema = loosePlainObject(ContainerMutationResponseShape);
149
149
  /** A rotation's acknowledgement, plus one per carried rekey in request order. */
150
150
  export const ContainerRotationResponseSchema = loosePlainObject({
151
- ...containerMutationResponseShape,
151
+ ...ContainerMutationResponseShape,
152
152
  containerRekeys: arraySchema(ContainerMutationResponseSchema).optional(),
153
153
  });
154
154
  export function isContainerRotationResponse(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"container.js","sourceRoot":"","sources":["container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,kDAAkD,EAAE,MAAM,wCAAwC,CAAC;AAC5G,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,sCAAsC,EACtC,4BAA4B,EAC5B,mCAAmC,EACnC,mCAAmC,GACpC,MAAM,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AW,CAAC,oCAAoC,CAAC;CAC9D,CAAC,CAAC;AAMH,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,+BAA+B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,6BAA6B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,2CAA2C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { containerKekLogSingleKeyringRefinement } from \"../containerReadRefinements\";\nimport { ContainerSystemSlotSchema } from \"../containerSystemSlot\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport { organizationProvisioningContainerKeyringRefinement } from \"../organizationProvisioningRefinements\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyArraySchema,\n nonEmptyStringSchema,\n nonNegativeIntegerSchema,\n plainObjectSchema,\n positiveIntegerSchema,\n sha256HexStringSchema,\n} from \"../schema\";\nimport {\n AccessManifestBundleWireResponseSchema,\n CONTAINER_KEK_LOG_PAGE_LIMIT,\n CONTAINER_KEK_WRAPS_PER_EPOCH_LIMIT,\n ContainerKekKeyringWireRecordSchema,\n} from \"../util\";\nimport {\n containerWriterProjectionPathKekCountRefinement,\n writerProjectionManifestBundlesRefinement,\n} from \"../writerProjectionRefinements\";\nimport { EffectiveAccessLevelSchema } from \"./accessLevel\";\nimport {\n containerKeyingPathReferences,\n ManifestBundlesSchema,\n ManifestHashReferenceSchema,\n OmittedManifestBundlesSchema,\n refineManifestBundleReferences,\n} from \"./manifestBundleReferences\";\nimport { ReferencedPrincipalStateResponseSchema } from \"./principalReference\";\nimport {\n ProjectionPolicyEvidenceResponseSchema,\n ProjectionPolicyEvidenceWireResponseSchema,\n} from \"./projectionPolicyEvidence\";\nimport { SyncWatermarkSchema } from \"./syncWatermark\";\n\n/**\n * The container's sealed predecessor key history. Opening it under the\n * current KEK yields every retained historical KEK in one decrypt; the\n * bridge log behind it is served only by the rebuild read path.\n */\nconst ContainerKekKeyringWireResponseSchema =\n ContainerKekKeyringWireRecordSchema;\n\nexport type ContainerKekKeyringWireResponse = z.infer<\n typeof ContainerKekKeyringWireResponseSchema\n>;\n\nconst containerKekResponseShape = {\n accessManifestHash: nonEmptyStringSchema,\n containerId: z.string(),\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n containerManifestHistory: arraySchema(AccessManifestBundleWireResponseSchema),\n keyEpoch: plainObjectSchema,\n keyEpochHash: nonEmptyStringSchema,\n keyring: ContainerKekKeyringWireResponseSchema.nullable(),\n keyTargetHash: nonEmptyStringSchema,\n parentContainerKeyEpochId: z.string().nullable(),\n recipientTargets: nonEmptyArraySchema(plainObjectSchema),\n wraps: nonEmptyArraySchema(plainObjectSchema),\n};\n\nfunction refineContainerKekKeyring(\n value: { readonly containerKeyEpoch: number; readonly keyring: unknown },\n context: z.RefinementCtx,\n) {\n if ((value.keyring === null) !== (value.containerKeyEpoch === 1)) {\n context.addIssue({\n code: \"custom\",\n message: \"container keyring must be null exactly at epoch 1\",\n path: [\"keyring\"],\n });\n }\n}\n\nconst ContainerKekResponseSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKekResponseShape).superRefine(\n refineContainerKekKeyring,\n ),\n [organizationProvisioningContainerKeyringRefinement],\n);\n\n/** On the writer-projection wire, KEK history cites manifests by hash. */\nconst ContainerKekWireResponseSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerKekResponseShape,\n containerManifestHistory: arraySchema(ManifestHashReferenceSchema),\n }).superRefine(refineContainerKekKeyring),\n [organizationProvisioningContainerKeyringRefinement],\n);\n\nexport type ContainerKekResponse = z.infer<typeof ContainerKekResponseSchema>;\n\n/** One KEK level as served in full, its manifest history cited by hash. */\nexport type ContainerKekWireLevel = z.infer<\n typeof ContainerKekWireResponseSchema\n>;\n\nexport function isContainerKekWireLevel(\n value: unknown,\n): value is ContainerKekWireLevel {\n return (\n ContainerKekWireResponseSchema.safeParse(value).success &&\n !Object.hasOwn(Object(value), \"levelDigest\")\n );\n}\n\n/**\n * A KEK level the request declared held (`k:` hint), replaced by the\n * domain-separated digest of its canonical wire bytes. It keeps the level's manifest citations, so\n * the response's bundle bookkeeping stays exact; the client refills the\n * level from those exact held bytes before anything reads it.\n */\nexport const CitedContainerKekLevelSchema = z.strictObject({\n levelDigest: sha256HexStringSchema,\n containerManifestHistory: arraySchema(ManifestHashReferenceSchema),\n});\n\nexport type CitedContainerKekLevel = z.infer<\n typeof CitedContainerKekLevelSchema\n>;\n\nexport function isCitedContainerKekLevel(\n value: unknown,\n): value is CitedContainerKekLevel {\n return CitedContainerKekLevelSchema.safeParse(value).success;\n}\n\nconst ServedContainerKekLevelSchema = z.union([\n CitedContainerKekLevelSchema,\n ContainerKekWireResponseSchema,\n]);\n\n/**\n * The append-only rotation log for one container: every epoch with its\n * write-once bridge and sealed keyring. This is the rebuild/repair read\n * path — hot reads use the projection keyring instead.\n */\nexport const ContainerKekLogEpochResponseSchema = loosePlainObject({\n accessManifestHash: nonEmptyStringSchema,\n bridge: plainObjectSchema.nullable(),\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n keyring: ContainerKekKeyringWireResponseSchema.nullable(),\n parentContainerKeyEpochId: z.string().nullable(),\n /**\n * Retained recipient envelopes are the recovery backstop when a bridge is\n * severed. The server and response guard apply this bound per epoch.\n */\n wraps: arraySchema(plainObjectSchema, CONTAINER_KEK_WRAPS_PER_EPOCH_LIMIT),\n});\n\nexport type ContainerKekLogEpochResponse = z.infer<\n typeof ContainerKekLogEpochResponseSchema\n>;\n\nexport const ContainerKekLogResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n containerId: nonEmptyStringSchema,\n epochs: arraySchema(\n ContainerKekLogEpochResponseSchema,\n CONTAINER_KEK_LOG_PAGE_LIMIT,\n ),\n /** True when epochs above this page's last remain unserved. */\n hasMore: z.boolean(),\n }).superRefine(({ epochs }, context) => {\n if (epochs.filter((epoch) => epoch.keyring !== null).length > 1) {\n context.addIssue({\n code: \"custom\",\n message: \"container KEK log pages contain at most one keyring\",\n path: [\"epochs\"],\n });\n }\n }),\n [containerKekLogSingleKeyringRefinement],\n );\n\nexport type ContainerKekLogResponse = z.infer<\n typeof ContainerKekLogResponseSchema\n>;\n\nexport function isContainerKekLogResponse(\n value: unknown,\n): value is ContainerKekLogResponse {\n return ContainerKekLogResponseSchema.safeParse(value).success;\n}\n\n/**\n * A container mutation's acknowledgement names what the server committed by\n * hash and adds only the fields it assigned (timestamps). The client compares\n * the hashes with its own signed plan and persists state built from the plan,\n * so the signed event, manifest, state, key epoch, and wraps are never echoed.\n * `bundleDigest` names the bundle a writer projection would serve for the new\n * head, so the author can hold exactly those bytes for later citation.\n */\nconst ContainerManifestMutationResponseShape = {\n bundleDigest: sha256HexStringSchema,\n containerId: z.string(),\n createdAt: z.string(),\n eventHash: nonEmptyStringSchema,\n manifestHead: loosePlainObject({\n epoch: z.number(),\n manifestHash: z.string(),\n }),\n organizationId: z.string(),\n parentId: z.string().nullable(),\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n updatedAt: z.string(),\n};\n\n/** The committed key epoch, by hash: no epoch, wrap, or keyring bytes. */\nconst ContainerMutationKekAcknowledgementSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n keyEpochHash: nonEmptyStringSchema,\n keyringHash: nonEmptyStringSchema.nullable(),\n keyTargetHash: nonEmptyStringSchema,\n parentContainerKeyEpochId: z.string().nullable(),\n }).superRefine((value, context) => {\n if ((value.keyringHash === null) !== (value.containerKeyEpoch === 1)) {\n context.addIssue({\n code: \"custom\",\n message: \"container keyring hash must be null exactly at epoch 1\",\n path: [\"keyringHash\"],\n });\n }\n }),\n [organizationProvisioningContainerKeyringRefinement],\n );\n\nconst containerMutationResponseShape = {\n ...ContainerManifestMutationResponseShape,\n containerKek: ContainerMutationKekAcknowledgementSchema,\n};\n\nexport const ContainerMutationResponseSchema = loosePlainObject(\n containerMutationResponseShape,\n);\n\nexport type ContainerMutationResponse = z.infer<\n typeof ContainerMutationResponseSchema\n>;\n\n/** A rotation's acknowledgement, plus one per carried rekey in request order. */\nexport const ContainerRotationResponseSchema = loosePlainObject({\n ...containerMutationResponseShape,\n containerRekeys: arraySchema(ContainerMutationResponseSchema).optional(),\n});\n\nexport type ContainerRotationResponse = z.infer<\n typeof ContainerRotationResponseSchema\n>;\n\nexport function isContainerRotationResponse(\n value: unknown,\n): value is ContainerRotationResponse {\n return ContainerRotationResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerReciteResponseSchema = loosePlainObject(\n ContainerManifestMutationResponseShape,\n);\nexport type ContainerReciteResponse = z.infer<\n typeof ContainerReciteResponseSchema\n>;\n\nexport function isContainerReciteResponse(\n value: unknown,\n): value is ContainerReciteResponse {\n return ContainerReciteResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerDeleteResponseSchema = loosePlainObject({\n containerId: z.string(),\n deletedAt: z.string(),\n});\n\nexport type ContainerDeleteResponse = z.infer<\n typeof ContainerDeleteResponseSchema\n>;\n\nexport const CONTAINER_PROJECTION_STATE_INVALID_ERROR_CODE =\n \"container_projection_state_invalid\";\nexport const ContainerWriterProjectionErrorResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_PROJECTION_STATE_INVALID_ERROR_CODE),\n error: z.string(),\n});\n\nconst containerKeyingPathShape = {\n containerId: z.string(),\n containerKeks: arraySchema(ContainerKekResponseSchema),\n organizationId: z.string(),\n path: nonEmptyArraySchema(AccessManifestBundleWireResponseSchema),\n};\nfunction refineContainerKeyingPath(\n projection: { containerKeks: unknown[]; path: unknown[] },\n context: z.RefinementCtx,\n) {\n // loosePlainObject can continue refinements after reporting malformed fields.\n if (\n Array.isArray(projection.containerKeks) &&\n Array.isArray(projection.path) &&\n projection.containerKeks.length !== projection.path.length\n )\n context.addIssue({\n code: \"custom\",\n message: \"container KEK count must match the manifest path length\",\n path: [\"containerKeks\"],\n });\n}\nexport const ContainerKeyingPathResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKeyingPathShape).superRefine(\n refineContainerKeyingPath,\n ),\n [containerWriterProjectionPathKekCountRefinement],\n );\nexport type ContainerKeyingPathResponse = z.infer<\n typeof ContainerKeyingPathResponseSchema\n>;\n/**\n * The decoded projection a client verifies: every manifest position holds\n * its bundle. `decodeContainerWriterProjection` builds it from the wire.\n */\nexport const ContainerWriterProjectionResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerKeyingPathShape,\n policyEvidence: ProjectionPolicyEvidenceResponseSchema,\n }).superRefine(refineContainerKeyingPath),\n [containerWriterProjectionPathKekCountRefinement],\n );\n\nexport type ContainerWriterProjectionResponse = z.infer<\n typeof ContainerWriterProjectionResponseSchema\n>;\n\nconst containerKeyingPathWireShape = {\n containerId: z.string(),\n containerKeks: arraySchema(ServedContainerKekLevelSchema),\n organizationId: z.string(),\n path: nonEmptyArraySchema(ManifestHashReferenceSchema),\n};\nexport const ContainerKeyingPathWireResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKeyingPathWireShape).superRefine(\n refineContainerKeyingPath,\n ),\n [containerWriterProjectionPathKekCountRefinement],\n );\nexport type ContainerKeyingPathWireResponse = z.infer<\n typeof ContainerKeyingPathWireResponseSchema\n>;\n\n/**\n * The served shape: manifest positions cite `bundles` by hash, except hashes\n * the request declared already held, which `omittedBundles` lists instead.\n */\nexport const ContainerWriterProjectionWireResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n bundles: ManifestBundlesSchema,\n omittedBundles: OmittedManifestBundlesSchema,\n ...containerKeyingPathWireShape,\n policyEvidence: ProjectionPolicyEvidenceWireResponseSchema,\n }).superRefine((projection, context) => {\n refineContainerKeyingPath(projection, context);\n refineManifestBundleReferences(\n projection,\n containerKeyingPathReferences(projection),\n context,\n );\n }),\n [\n containerWriterProjectionPathKekCountRefinement,\n writerProjectionManifestBundlesRefinement,\n ],\n );\n\nexport type ContainerWriterProjectionWireResponse = z.infer<\n typeof ContainerWriterProjectionWireResponseSchema\n>;\n\nexport const ContainerSummaryResponseSchema = loosePlainObject({\n createdAt: z.string(),\n depth: nonNegativeIntegerSchema,\n effectiveAccessLevel: EffectiveAccessLevelSchema,\n id: z.string(),\n metadataAccessEpoch: z.number(),\n metadataAccessStateHash: nonEmptyStringSchema,\n metadataDocumentId: z.string(),\n metadataReferencedPrincipals: arraySchema(\n ReferencedPrincipalStateResponseSchema,\n ),\n metadataVersionVector: z.string(),\n organizationId: z.string(),\n parentId: z.string().nullable(),\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n updatedAt: z.string(),\n});\n\nexport type ContainerSummary = z.infer<typeof ContainerSummaryResponseSchema>;\n\nexport const ContainerSyncTombstoneResponseSchema = loosePlainObject({\n containerId: z.string(),\n depth: nonNegativeIntegerSchema,\n parentId: z.string().nullable(),\n reason: z.literal([\"access_revoked\", \"deleted\"]),\n updatedAt: z.string(),\n});\n\nexport type ContainerSyncTombstone = z.infer<\n typeof ContainerSyncTombstoneResponseSchema\n>;\n\nexport const ListContainersResponseSchema = loosePlainObject({\n hasMore: z.boolean(),\n items: arraySchema(ContainerSummaryResponseSchema),\n nextWatermark: SyncWatermarkSchema.nullable(),\n tombstones: arraySchema(ContainerSyncTombstoneResponseSchema),\n});\n\nexport type ListContainersResponse = z.infer<\n typeof ListContainersResponseSchema\n>;\n\nexport function isListContainersResponse(\n value: unknown,\n): value is ListContainersResponse {\n return ListContainersResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerMutationResponse(\n value: unknown,\n): value is ContainerMutationResponse {\n return ContainerMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerDeleteResponse(\n value: unknown,\n): value is ContainerDeleteResponse {\n return ContainerDeleteResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerWriterProjectionResponse(\n value: unknown,\n): value is ContainerWriterProjectionResponse {\n return ContainerWriterProjectionResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerWriterProjectionWireResponse(\n value: unknown,\n): value is ContainerWriterProjectionWireResponse {\n return ContainerWriterProjectionWireResponseSchema.safeParse(value).success;\n}\n"]}
1
+ {"version":3,"file":"container.js","sourceRoot":"","sources":["container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,kDAAkD,EAAE,MAAM,wCAAwC,CAAC;AAC5G,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,sCAAsC,EACtC,4BAA4B,EAC5B,mCAAmC,EACnC,mCAAmC,GACpC,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,+CAA+C,EAC/C,yCAAyC,GAC1C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,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C,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,+BAA+B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,6BAA6B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,2CAA2C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { containerKekLogSingleKeyringRefinement } from \"../containerReadRefinements\";\nimport { ContainerSystemSlotSchema } from \"../containerSystemSlot\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport { organizationProvisioningContainerKeyringRefinement } from \"../organizationProvisioningRefinements\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyArraySchema,\n nonEmptyStringSchema,\n nonNegativeIntegerSchema,\n plainObjectSchema,\n positiveIntegerSchema,\n sha256HexStringSchema,\n} from \"../schema\";\nimport {\n AccessManifestBundleWireResponseSchema,\n CONTAINER_KEK_LOG_PAGE_LIMIT,\n CONTAINER_KEK_WRAPS_PER_EPOCH_LIMIT,\n ContainerKekKeyringWireRecordSchema,\n} from \"../util\";\nimport {\n containerWriterProjectionPathKekCountRefinement,\n writerProjectionManifestBundlesRefinement,\n} from \"../writerProjectionRefinements\";\nimport { EffectiveAccessLevelSchema } from \"./accessLevel\";\nimport {\n containerKeyingPathReferences,\n ManifestBundlesSchema,\n ManifestHashReferenceSchema,\n OmittedManifestBundlesSchema,\n refineManifestBundleReferences,\n} from \"./manifestBundleReferences\";\nimport { ReferencedPrincipalStateResponseSchema } from \"./principalReference\";\nimport {\n ProjectionPolicyEvidenceResponseSchema,\n ProjectionPolicyEvidenceWireResponseSchema,\n} from \"./projectionPolicyEvidence\";\nimport { SyncWatermarkSchema } from \"./syncWatermark\";\n\n/**\n * The container's sealed predecessor key history. Opening it under the\n * current KEK yields every retained historical KEK in one decrypt; the\n * bridge log behind it is served only by the rebuild read path.\n */\nconst ContainerKekKeyringWireResponseSchema =\n ContainerKekKeyringWireRecordSchema;\n\nexport type ContainerKekKeyringWireResponse = z.infer<\n typeof ContainerKekKeyringWireResponseSchema\n>;\n\nconst containerKekResponseShape = {\n accessManifestHash: nonEmptyStringSchema,\n containerId: z.string(),\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n containerManifestHistory: arraySchema(AccessManifestBundleWireResponseSchema),\n keyEpoch: plainObjectSchema,\n keyEpochHash: nonEmptyStringSchema,\n keyring: ContainerKekKeyringWireResponseSchema.nullable(),\n keyTargetHash: nonEmptyStringSchema,\n parentContainerKeyEpochId: z.string().nullable(),\n recipientTargets: nonEmptyArraySchema(plainObjectSchema),\n wraps: nonEmptyArraySchema(plainObjectSchema),\n};\n\nfunction refineContainerKekKeyring(\n value: { readonly containerKeyEpoch: number; readonly keyring: unknown },\n context: z.RefinementCtx,\n) {\n if ((value.keyring === null) !== (value.containerKeyEpoch === 1)) {\n context.addIssue({\n code: \"custom\",\n message: \"container keyring must be null exactly at epoch 1\",\n path: [\"keyring\"],\n });\n }\n}\n\nconst ContainerKekResponseSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKekResponseShape).superRefine(\n refineContainerKekKeyring,\n ),\n [organizationProvisioningContainerKeyringRefinement],\n);\n\n/** On the writer-projection wire, KEK history cites manifests by hash. */\nconst ContainerKekWireResponseSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerKekResponseShape,\n containerManifestHistory: arraySchema(ManifestHashReferenceSchema),\n }).superRefine(refineContainerKekKeyring),\n [organizationProvisioningContainerKeyringRefinement],\n);\n\nexport type ContainerKekResponse = z.infer<typeof ContainerKekResponseSchema>;\n\n/** One KEK level as served in full, its manifest history cited by hash. */\nexport type ContainerKekWireLevel = z.infer<\n typeof ContainerKekWireResponseSchema\n>;\n\nexport function isContainerKekWireLevel(\n value: unknown,\n): value is ContainerKekWireLevel {\n return (\n ContainerKekWireResponseSchema.safeParse(value).success &&\n !Object.hasOwn(Object(value), \"levelDigest\")\n );\n}\n\n/**\n * A KEK level the request declared held (`k:` hint), replaced by the\n * domain-separated digest of its canonical wire bytes. It keeps the level's manifest citations, so\n * the response's bundle bookkeeping stays exact; the client refills the\n * level from those exact held bytes before anything reads it.\n */\nexport const CitedContainerKekLevelSchema = z.strictObject({\n levelDigest: sha256HexStringSchema,\n containerManifestHistory: arraySchema(ManifestHashReferenceSchema),\n});\n\nexport type CitedContainerKekLevel = z.infer<\n typeof CitedContainerKekLevelSchema\n>;\n\nexport function isCitedContainerKekLevel(\n value: unknown,\n): value is CitedContainerKekLevel {\n return CitedContainerKekLevelSchema.safeParse(value).success;\n}\n\nconst ServedContainerKekLevelSchema = z.union([\n CitedContainerKekLevelSchema,\n ContainerKekWireResponseSchema,\n]);\n\n/**\n * The append-only rotation log for one container: every epoch with its\n * write-once bridge and sealed keyring. This is the rebuild/repair read\n * path — hot reads use the projection keyring instead.\n */\nexport const ContainerKekLogEpochResponseSchema = loosePlainObject({\n accessManifestHash: nonEmptyStringSchema,\n bridge: plainObjectSchema.nullable(),\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n keyring: ContainerKekKeyringWireResponseSchema.nullable(),\n parentContainerKeyEpochId: z.string().nullable(),\n /**\n * Retained recipient envelopes are the recovery backstop when a bridge is\n * severed. The server and response guard apply this bound per epoch.\n */\n wraps: arraySchema(plainObjectSchema, CONTAINER_KEK_WRAPS_PER_EPOCH_LIMIT),\n});\n\nexport type ContainerKekLogEpochResponse = z.infer<\n typeof ContainerKekLogEpochResponseSchema\n>;\n\nexport const ContainerKekLogResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n containerId: nonEmptyStringSchema,\n epochs: arraySchema(\n ContainerKekLogEpochResponseSchema,\n CONTAINER_KEK_LOG_PAGE_LIMIT,\n ),\n /** True when epochs above this page's last remain unserved. */\n hasMore: z.boolean(),\n }).superRefine(({ epochs }, context) => {\n if (epochs.filter((epoch) => epoch.keyring !== null).length > 1) {\n context.addIssue({\n code: \"custom\",\n message: \"container KEK log pages contain at most one keyring\",\n path: [\"epochs\"],\n });\n }\n }),\n [containerKekLogSingleKeyringRefinement],\n );\n\nexport type ContainerKekLogResponse = z.infer<\n typeof ContainerKekLogResponseSchema\n>;\n\nexport function isContainerKekLogResponse(\n value: unknown,\n): value is ContainerKekLogResponse {\n return ContainerKekLogResponseSchema.safeParse(value).success;\n}\n\n/**\n * A container mutation's acknowledgement names what the server committed by\n * hash and adds only the fields it assigned (timestamps). The client compares\n * the hashes with its own signed plan and persists state built from the plan,\n * so the signed event, manifest, state, key epoch, and wraps are never echoed.\n * `bundleDigest` names the bundle a writer projection would serve for the new\n * head, so the author can hold exactly those bytes for later citation.\n */\nconst ContainerManifestMutationResponseShape = {\n bundleDigest: sha256HexStringSchema,\n containerId: z.string(),\n createdAt: z.string(),\n eventHash: nonEmptyStringSchema,\n manifestHead: loosePlainObject({\n epoch: z.number(),\n manifestHash: z.string(),\n }),\n organizationId: z.string(),\n parentId: z.string().nullable(),\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n updatedAt: z.string(),\n};\n\n/** The committed key epoch, by hash: no epoch, wrap, or keyring bytes. */\nconst ContainerMutationKekAcknowledgementSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n keyEpochHash: nonEmptyStringSchema,\n keyringHash: nonEmptyStringSchema.nullable(),\n keyTargetHash: nonEmptyStringSchema,\n parentContainerKeyEpochId: z.string().nullable(),\n }).superRefine((value, context) => {\n if ((value.keyringHash === null) !== (value.containerKeyEpoch === 1)) {\n context.addIssue({\n code: \"custom\",\n message: \"container keyring hash must be null exactly at epoch 1\",\n path: [\"keyringHash\"],\n });\n }\n }),\n [organizationProvisioningContainerKeyringRefinement],\n );\n\nexport const ContainerMutationResponseShape = {\n ...ContainerManifestMutationResponseShape,\n containerKek: ContainerMutationKekAcknowledgementSchema,\n};\n\nexport const ContainerMutationResponseSchema = loosePlainObject(\n ContainerMutationResponseShape,\n);\n\nexport type ContainerMutationResponse = z.infer<\n typeof ContainerMutationResponseSchema\n>;\n\n/** A rotation's acknowledgement, plus one per carried rekey in request order. */\nexport const ContainerRotationResponseSchema = loosePlainObject({\n ...ContainerMutationResponseShape,\n containerRekeys: arraySchema(ContainerMutationResponseSchema).optional(),\n});\n\nexport type ContainerRotationResponse = z.infer<\n typeof ContainerRotationResponseSchema\n>;\n\nexport function isContainerRotationResponse(\n value: unknown,\n): value is ContainerRotationResponse {\n return ContainerRotationResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerReciteResponseSchema = loosePlainObject(\n ContainerManifestMutationResponseShape,\n);\nexport type ContainerReciteResponse = z.infer<\n typeof ContainerReciteResponseSchema\n>;\n\nexport function isContainerReciteResponse(\n value: unknown,\n): value is ContainerReciteResponse {\n return ContainerReciteResponseSchema.safeParse(value).success;\n}\n\nexport const ContainerDeleteResponseSchema = loosePlainObject({\n containerId: z.string(),\n deletedAt: z.string(),\n});\n\nexport type ContainerDeleteResponse = z.infer<\n typeof ContainerDeleteResponseSchema\n>;\n\nexport const CONTAINER_PROJECTION_STATE_INVALID_ERROR_CODE =\n \"container_projection_state_invalid\";\nexport const ContainerWriterProjectionErrorResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_PROJECTION_STATE_INVALID_ERROR_CODE),\n error: z.string(),\n});\n\nconst containerKeyingPathShape = {\n containerId: z.string(),\n containerKeks: arraySchema(ContainerKekResponseSchema),\n organizationId: z.string(),\n path: nonEmptyArraySchema(AccessManifestBundleWireResponseSchema),\n};\nfunction refineContainerKeyingPath(\n projection: { containerKeks: unknown[]; path: unknown[] },\n context: z.RefinementCtx,\n) {\n // loosePlainObject can continue refinements after reporting malformed fields.\n if (\n Array.isArray(projection.containerKeks) &&\n Array.isArray(projection.path) &&\n projection.containerKeks.length !== projection.path.length\n )\n context.addIssue({\n code: \"custom\",\n message: \"container KEK count must match the manifest path length\",\n path: [\"containerKeks\"],\n });\n}\nexport const ContainerKeyingPathResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKeyingPathShape).superRefine(\n refineContainerKeyingPath,\n ),\n [containerWriterProjectionPathKekCountRefinement],\n );\nexport type ContainerKeyingPathResponse = z.infer<\n typeof ContainerKeyingPathResponseSchema\n>;\n/**\n * The decoded projection a client verifies: every manifest position holds\n * its bundle. `decodeContainerWriterProjection` builds it from the wire.\n */\nexport const ContainerWriterProjectionResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerKeyingPathShape,\n policyEvidence: ProjectionPolicyEvidenceResponseSchema,\n }).superRefine(refineContainerKeyingPath),\n [containerWriterProjectionPathKekCountRefinement],\n );\n\nexport type ContainerWriterProjectionResponse = z.infer<\n typeof ContainerWriterProjectionResponseSchema\n>;\n\nconst containerKeyingPathWireShape = {\n containerId: z.string(),\n containerKeks: arraySchema(ServedContainerKekLevelSchema),\n organizationId: z.string(),\n path: nonEmptyArraySchema(ManifestHashReferenceSchema),\n};\nexport const ContainerKeyingPathWireResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(containerKeyingPathWireShape).superRefine(\n refineContainerKeyingPath,\n ),\n [containerWriterProjectionPathKekCountRefinement],\n );\nexport type ContainerKeyingPathWireResponse = z.infer<\n typeof ContainerKeyingPathWireResponseSchema\n>;\n\n/**\n * The served shape: manifest positions cite `bundles` by hash, except hashes\n * the request declared already held, which `omittedBundles` lists instead.\n */\nexport const ContainerWriterProjectionWireResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n bundles: ManifestBundlesSchema,\n omittedBundles: OmittedManifestBundlesSchema,\n ...containerKeyingPathWireShape,\n policyEvidence: ProjectionPolicyEvidenceWireResponseSchema,\n }).superRefine((projection, context) => {\n refineContainerKeyingPath(projection, context);\n refineManifestBundleReferences(\n projection,\n containerKeyingPathReferences(projection),\n context,\n );\n }),\n [\n containerWriterProjectionPathKekCountRefinement,\n writerProjectionManifestBundlesRefinement,\n ],\n );\n\nexport type ContainerWriterProjectionWireResponse = z.infer<\n typeof ContainerWriterProjectionWireResponseSchema\n>;\n\nexport const ContainerSummaryResponseSchema = loosePlainObject({\n createdAt: z.string(),\n depth: nonNegativeIntegerSchema,\n effectiveAccessLevel: EffectiveAccessLevelSchema,\n id: z.string(),\n metadataAccessEpoch: z.number(),\n metadataAccessStateHash: nonEmptyStringSchema,\n metadataDocumentId: z.string(),\n metadataReferencedPrincipals: arraySchema(\n ReferencedPrincipalStateResponseSchema,\n ),\n metadataVersionVector: z.string(),\n organizationId: z.string(),\n parentId: z.string().nullable(),\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n updatedAt: z.string(),\n});\n\nexport type ContainerSummary = z.infer<typeof ContainerSummaryResponseSchema>;\n\nexport const ContainerSyncTombstoneResponseSchema = loosePlainObject({\n containerId: z.string(),\n depth: nonNegativeIntegerSchema,\n parentId: z.string().nullable(),\n reason: z.literal([\"access_revoked\", \"deleted\"]),\n updatedAt: z.string(),\n});\n\nexport type ContainerSyncTombstone = z.infer<\n typeof ContainerSyncTombstoneResponseSchema\n>;\n\nexport const ListContainersResponseSchema = loosePlainObject({\n hasMore: z.boolean(),\n items: arraySchema(ContainerSummaryResponseSchema),\n nextWatermark: SyncWatermarkSchema.nullable(),\n tombstones: arraySchema(ContainerSyncTombstoneResponseSchema),\n});\n\nexport type ListContainersResponse = z.infer<\n typeof ListContainersResponseSchema\n>;\n\nexport function isListContainersResponse(\n value: unknown,\n): value is ListContainersResponse {\n return ListContainersResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerMutationResponse(\n value: unknown,\n): value is ContainerMutationResponse {\n return ContainerMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerDeleteResponse(\n value: unknown,\n): value is ContainerDeleteResponse {\n return ContainerDeleteResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerWriterProjectionResponse(\n value: unknown,\n): value is ContainerWriterProjectionResponse {\n return ContainerWriterProjectionResponseSchema.safeParse(value).success;\n}\n\nexport function isContainerWriterProjectionWireResponse(\n value: unknown,\n): value is ContainerWriterProjectionWireResponse {\n return ContainerWriterProjectionWireResponseSchema.safeParse(value).success;\n}\n"]}
@@ -188,13 +188,7 @@ export declare const DocumentPurgeProofResponseSchema: z.ZodType<{
188
188
  version: number;
189
189
  };
190
190
  payload: {
191
- cipherSuite: "aes-256-gcm";
192
191
  ciphertext: string;
193
- ciphertextHash: string;
194
- createdAt: string;
195
- principalId: string;
196
- principalType: "group" | "organization";
197
- stateHash: string;
198
192
  };
199
193
  }[];
200
194
  groups: {
@@ -289,13 +283,7 @@ export declare const DocumentPurgeProofResponseSchema: z.ZodType<{
289
283
  version: number;
290
284
  };
291
285
  payload: {
292
- cipherSuite: "aes-256-gcm";
293
286
  ciphertext: string;
294
- ciphertextHash: string;
295
- createdAt: string;
296
- principalId: string;
297
- principalType: "group" | "organization";
298
- stateHash: string;
299
287
  };
300
288
  }[];
301
289
  groups: {
@@ -390,13 +378,7 @@ export declare const DocumentPurgeProofResponseSchema: z.ZodType<{
390
378
  version: number;
391
379
  };
392
380
  payload: {
393
- cipherSuite: "aes-256-gcm";
394
381
  ciphertext: string;
395
- ciphertextHash: string;
396
- createdAt: string;
397
- principalId: string;
398
- principalType: "group" | "organization";
399
- stateHash: string;
400
382
  };
401
383
  }[];
402
384
  groups: {
@@ -491,13 +473,7 @@ export declare const DocumentPurgeProofResponseSchema: z.ZodType<{
491
473
  version: number;
492
474
  };
493
475
  payload: {
494
- cipherSuite: "aes-256-gcm";
495
476
  ciphertext: string;
496
- ciphertextHash: string;
497
- createdAt: string;
498
- principalId: string;
499
- principalType: "group" | "organization";
500
- stateHash: string;
501
477
  };
502
478
  }[];
503
479
  groups: {
@@ -595,13 +571,7 @@ export declare const DocumentPurgeResponseSchema: z.ZodType<{
595
571
  version: number;
596
572
  };
597
573
  payload: {
598
- cipherSuite: "aes-256-gcm";
599
574
  ciphertext: string;
600
- ciphertextHash: string;
601
- createdAt: string;
602
- principalId: string;
603
- principalType: "group" | "organization";
604
- stateHash: string;
605
575
  };
606
576
  }[];
607
577
  groups: {
@@ -697,13 +667,7 @@ export declare const DocumentPurgeResponseSchema: z.ZodType<{
697
667
  version: number;
698
668
  };
699
669
  payload: {
700
- cipherSuite: "aes-256-gcm";
701
670
  ciphertext: string;
702
- ciphertextHash: string;
703
- createdAt: string;
704
- principalId: string;
705
- principalType: "group" | "organization";
706
- stateHash: string;
707
671
  };
708
672
  }[];
709
673
  groups: {
@@ -799,13 +763,7 @@ export declare const DocumentPurgeResponseSchema: z.ZodType<{
799
763
  version: number;
800
764
  };
801
765
  payload: {
802
- cipherSuite: "aes-256-gcm";
803
766
  ciphertext: string;
804
- ciphertextHash: string;
805
- createdAt: string;
806
- principalId: string;
807
- principalType: "group" | "organization";
808
- stateHash: string;
809
767
  };
810
768
  }[];
811
769
  groups: {
@@ -901,13 +859,7 @@ export declare const DocumentPurgeResponseSchema: z.ZodType<{
901
859
  version: number;
902
860
  };
903
861
  payload: {
904
- cipherSuite: "aes-256-gcm";
905
862
  ciphertext: string;
906
- ciphertextHash: string;
907
- createdAt: string;
908
- principalId: string;
909
- principalType: "group" | "organization";
910
- stateHash: string;
911
863
  };
912
864
  }[];
913
865
  groups: {
@@ -947,13 +899,7 @@ export declare const DocumentWriterProjectionResponseSchema: z.ZodType<{
947
899
  version: number;
948
900
  };
949
901
  payload: {
950
- cipherSuite: "aes-256-gcm";
951
902
  ciphertext: string;
952
- ciphertextHash: string;
953
- createdAt: string;
954
- principalId: string;
955
- principalType: "group" | "organization";
956
- stateHash: string;
957
903
  };
958
904
  }[];
959
905
  groups: {
@@ -1099,13 +1045,7 @@ export declare const DocumentWriterProjectionResponseSchema: z.ZodType<{
1099
1045
  version: number;
1100
1046
  };
1101
1047
  payload: {
1102
- cipherSuite: "aes-256-gcm";
1103
1048
  ciphertext: string;
1104
- ciphertextHash: string;
1105
- createdAt: string;
1106
- principalId: string;
1107
- principalType: "group" | "organization";
1108
- stateHash: string;
1109
1049
  };
1110
1050
  }[];
1111
1051
  groups: {
@@ -1251,13 +1191,7 @@ export declare const DocumentWriterProjectionResponseSchema: z.ZodType<{
1251
1191
  version: number;
1252
1192
  };
1253
1193
  payload: {
1254
- cipherSuite: "aes-256-gcm";
1255
1194
  ciphertext: string;
1256
- ciphertextHash: string;
1257
- createdAt: string;
1258
- principalId: string;
1259
- principalType: "group" | "organization";
1260
- stateHash: string;
1261
1195
  };
1262
1196
  }[];
1263
1197
  groups: {
@@ -1403,13 +1337,7 @@ export declare const DocumentWriterProjectionResponseSchema: z.ZodType<{
1403
1337
  version: number;
1404
1338
  };
1405
1339
  payload: {
1406
- cipherSuite: "aes-256-gcm";
1407
1340
  ciphertext: string;
1408
- ciphertextHash: string;
1409
- createdAt: string;
1410
- principalId: string;
1411
- principalType: "group" | "organization";
1412
- stateHash: string;
1413
1341
  };
1414
1342
  }[];
1415
1343
  groups: {
@@ -1569,13 +1497,7 @@ export declare const DocumentWriterProjectionWireResponseSchema: z.ZodType<{
1569
1497
  version: number;
1570
1498
  };
1571
1499
  payload: {
1572
- cipherSuite: "aes-256-gcm";
1573
1500
  ciphertext: string;
1574
- ciphertextHash: string;
1575
- createdAt: string;
1576
- principalId: string;
1577
- principalType: "group" | "organization";
1578
- stateHash: string;
1579
1501
  } | null;
1580
1502
  }[];
1581
1503
  groups: {
@@ -1681,13 +1603,7 @@ export declare const DocumentWriterProjectionWireResponseSchema: z.ZodType<{
1681
1603
  version: number;
1682
1604
  };
1683
1605
  payload: {
1684
- cipherSuite: "aes-256-gcm";
1685
1606
  ciphertext: string;
1686
- ciphertextHash: string;
1687
- createdAt: string;
1688
- principalId: string;
1689
- principalType: "group" | "organization";
1690
- stateHash: string;
1691
1607
  } | null;
1692
1608
  }[];
1693
1609
  groups: {
@@ -1793,13 +1709,7 @@ export declare const DocumentWriterProjectionWireResponseSchema: z.ZodType<{
1793
1709
  version: number;
1794
1710
  };
1795
1711
  payload: {
1796
- cipherSuite: "aes-256-gcm";
1797
1712
  ciphertext: string;
1798
- ciphertextHash: string;
1799
- createdAt: string;
1800
- principalId: string;
1801
- principalType: "group" | "organization";
1802
- stateHash: string;
1803
1713
  } | null;
1804
1714
  }[];
1805
1715
  groups: {
@@ -1905,13 +1815,7 @@ export declare const DocumentWriterProjectionWireResponseSchema: z.ZodType<{
1905
1815
  version: number;
1906
1816
  };
1907
1817
  payload: {
1908
- cipherSuite: "aes-256-gcm";
1909
1818
  ciphertext: string;
1910
- ciphertextHash: string;
1911
- createdAt: string;
1912
- principalId: string;
1913
- principalType: "group" | "organization";
1914
- stateHash: string;
1915
1819
  } | null;
1916
1820
  }[];
1917
1821
  groups: {