@tearleads/client-sdk 0.1.248 → 0.1.249

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 (111) 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/persistence/organizations/organizationReadModelRepository.js +20 -2
  33. package/data/persistence/organizations/organizationReadModelRepository.js.map +1 -1
  34. package/internal/api-client/ApiClient.d.ts +4 -1
  35. package/internal/api-client/client/containerMutations.d.ts +2 -2
  36. package/internal/api-client/client/containerMutations.js +2 -1
  37. package/internal/api-client/client/containerMutations.js.map +1 -1
  38. package/internal/api-client/client/principalPolicies.d.ts +3 -0
  39. package/internal/api-client/principalPolicyRequests.d.ts +2 -0
  40. package/internal/api-client/principalPolicyRequests.js +6 -4
  41. package/internal/api-client/principalPolicyRequests.js.map +1 -1
  42. package/internal/api-client/routes/containers/mutations.js +3 -3
  43. package/internal/api-client/routes/containers/mutations.js.map +1 -1
  44. package/internal/api-client/routes/organizations/createGroup.js +3 -5
  45. package/internal/api-client/routes/organizations/createGroup.js.map +1 -1
  46. package/internal/api-client/routes/principals/policy.js +2 -5
  47. package/internal/api-client/routes/principals/policy.js.map +1 -1
  48. package/internal/api-client/types.d.ts +6 -0
  49. package/internal/api-client/types.js.map +1 -1
  50. package/internal/validators/operation/containerMutations.d.ts +20 -3
  51. package/internal/validators/operation/containerMutations.js +18 -20
  52. package/internal/validators/operation/containerMutations.js.map +1 -1
  53. package/internal/validators/operation/index.d.ts +1 -1
  54. package/internal/validators/operation/index.js +1 -1
  55. package/internal/validators/operation/index.js.map +1 -1
  56. package/internal/validators/operation/organizations.d.ts +17 -1
  57. package/internal/validators/operation/organizations.js +4 -2
  58. package/internal/validators/operation/organizations.js.map +1 -1
  59. package/internal/validators/operation/principals.d.ts +17 -1
  60. package/internal/validators/operation/principals.js +5 -2
  61. package/internal/validators/operation/principals.js.map +1 -1
  62. package/internal/validators/request/index.d.ts +1 -1
  63. package/internal/validators/request/index.js +1 -1
  64. package/internal/validators/request/index.js.map +1 -1
  65. package/internal/validators/request/organization.d.ts +15 -0
  66. package/internal/validators/request/organization.js +8 -0
  67. package/internal/validators/request/organization.js.map +1 -1
  68. package/internal/validators/response/areas/organizations.d.ts +3 -2
  69. package/internal/validators/response/areas/organizations.js +3 -2
  70. package/internal/validators/response/areas/organizations.js.map +1 -1
  71. package/internal/validators/response/areas/principals.d.ts +1 -1
  72. package/internal/validators/response/areas/principals.js +1 -1
  73. package/internal/validators/response/areas/principals.js.map +1 -1
  74. package/internal/validators/response/committedReadModel.d.ts +697 -0
  75. package/internal/validators/response/committedReadModel.js +52 -0
  76. package/internal/validators/response/committedReadModel.js.map +1 -0
  77. package/internal/validators/response/container.d.ts +52 -0
  78. package/internal/validators/response/container.js +3 -3
  79. package/internal/validators/response/container.js.map +1 -1
  80. package/internal/validators/response/organization.d.ts +0 -191
  81. package/internal/validators/response/organization.js +0 -7
  82. package/internal/validators/response/organization.js.map +1 -1
  83. package/internal/validators/response/organizationReadModel.d.ts +167 -0
  84. package/internal/validators/response/organizationReadModel.js +5 -0
  85. package/internal/validators/response/organizationReadModel.js.map +1 -1
  86. package/internal/validators/response/principal.d.ts +0 -403
  87. package/internal/validators/response/principal.js +0 -8
  88. package/internal/validators/response/principal.js.map +1 -1
  89. package/package.json +1 -1
  90. package/workflows/container-contents/container-state/organizationHost.d.ts +9 -0
  91. package/workflows/container-contents/container-state/organizationHost.js.map +1 -1
  92. package/workflows/container-contents/container-state/remote.js +6 -0
  93. package/workflows/container-contents/container-state/remote.js.map +1 -1
  94. package/workflows/containers/child/share/index.d.ts +4 -2
  95. package/workflows/containers/child/share/index.js +37 -20
  96. package/workflows/containers/child/share/index.js.map +1 -1
  97. package/workflows/organizations/containerContentsHost.js +20 -1
  98. package/workflows/organizations/containerContentsHost.js.map +1 -1
  99. package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js +5 -1
  100. package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js.map +1 -1
  101. package/workflows/organizations/groups/createCurrentOrganizationGroup.js +8 -1
  102. package/workflows/organizations/groups/createCurrentOrganizationGroup.js.map +1 -1
  103. package/workflows/organizations/index.d.ts +1 -0
  104. package/workflows/organizations/index.js +1 -0
  105. package/workflows/organizations/index.js.map +1 -1
  106. package/workflows/organizations/readModel/committedReadModel.d.ts +66 -0
  107. package/workflows/organizations/readModel/committedReadModel.js +150 -0
  108. package/workflows/organizations/readModel/committedReadModel.js.map +1 -0
  109. package/workflows/organizations/readModel/readModelProjection.d.ts +15 -2
  110. package/workflows/organizations/readModel/readModelProjection.js +26 -4
  111. package/workflows/organizations/readModel/readModelProjection.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,GAAG,sBAAsB,CAC/C,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EACtB,gCAAgC,CAAC,QAAQ,EAAE,CAC5C,CAAC;AAEF,SAAS,4BAA4B,CACnC,KAAc;IAEd,OAAO,gCAAgC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACnE,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,uBAAuB,CACrC,KAAc,EACd,cAAsB;IAEtB,OAAO,4BAA4B,CAAC,KAAK,CAAC;QACxC,KAAK,CAAC,cAAc,KAAK,cAAc;QACvC,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,qCAAqC,GAAG,gBAAgB,CAAC;IACpE,KAAK,EAAE,sCAAsC;IAC7C,kBAAkB,EAAE,qCAAqC;IACzD,SAAS,EAAE,kBAAkB;CAC9B,CAAC,CAAC;AAMH,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,MAAM,2CAA2C,GAAG,gBAAgB,CAAC;IAC1E,WAAW,EAAE,qCAAqC;IAClD,YAAY,EAAE,qCAAqC,CAAC,QAAQ,EAAE;IAC9D,kBAAkB,EAAE,qCAAqC;IACzD,SAAS,EAAE,kBAAkB;CAC9B,CAAC,CAAC;AAMH,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,2CAA2C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;IAC3D,GAAG,8BAA8B;IACjC,SAAS,EAAE,kBAAkB;CAC9B,CAAC,CAAC;AAMH,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,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;
@@ -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,C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AAC,8BAA8B,CAAC;IAClD,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IAC7C,UAAU,EAAE,WAAW,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,+CA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AAC;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\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"]}
@@ -413,196 +413,6 @@ export declare const OrganizationGroupSummaryResponseSchema: z.ZodType<{
413
413
  organizationId: string;
414
414
  }>>;
415
415
  export type OrganizationGroupSummaryResponse = z.infer<typeof OrganizationGroupSummaryResponseSchema>;
416
- export declare const CreateOrganizationGroupResponseSchema: z.ZodType<{
417
- group: {
418
- createdAt: string;
419
- currentState: {
420
- keyEpoch: number;
421
- keyFingerprint: string;
422
- memberCount: number;
423
- stateHash: string;
424
- version: number;
425
- } | null;
426
- groupId: string;
427
- isBuiltin: boolean;
428
- organizationId: string;
429
- };
430
- organizationPolicy: {
431
- containerMutations: {
432
- containerKek: {
433
- containerKeyEpoch: number;
434
- containerKeyEpochId: string;
435
- keyEpochHash: string;
436
- keyringHash: string | null;
437
- keyTargetHash: string;
438
- parentContainerKeyEpochId: string | null;
439
- };
440
- bundleDigest: string;
441
- containerId: string;
442
- createdAt: string;
443
- eventHash: string;
444
- manifestHead: {
445
- epoch: number;
446
- manifestHash: string;
447
- };
448
- organizationId: string;
449
- parentId: string | null;
450
- updatedAt: string;
451
- systemSlot?: string | null | undefined;
452
- }[];
453
- createdAt: string;
454
- head: {
455
- keyEpoch: number;
456
- keyFingerprint: string;
457
- principalId: string;
458
- principalType: "group" | "organization";
459
- stateHash: string;
460
- version: number;
461
- };
462
- };
463
- }, {
464
- group: {
465
- createdAt: string;
466
- currentState: {
467
- keyEpoch: number;
468
- keyFingerprint: string;
469
- memberCount: number;
470
- stateHash: string;
471
- version: number;
472
- } | null;
473
- groupId: string;
474
- isBuiltin: boolean;
475
- organizationId: string;
476
- };
477
- organizationPolicy: {
478
- containerMutations: {
479
- containerKek: {
480
- containerKeyEpoch: number;
481
- containerKeyEpochId: string;
482
- keyEpochHash: string;
483
- keyringHash: string | null;
484
- keyTargetHash: string;
485
- parentContainerKeyEpochId: string | null;
486
- };
487
- bundleDigest: string;
488
- containerId: string;
489
- createdAt: string;
490
- eventHash: string;
491
- manifestHead: {
492
- epoch: number;
493
- manifestHash: string;
494
- };
495
- organizationId: string;
496
- parentId: string | null;
497
- updatedAt: string;
498
- systemSlot?: string | null | undefined;
499
- }[];
500
- createdAt: string;
501
- head: {
502
- keyEpoch: number;
503
- keyFingerprint: string;
504
- principalId: string;
505
- principalType: "group" | "organization";
506
- stateHash: string;
507
- version: number;
508
- };
509
- };
510
- }, z.core.$ZodTypeInternals<{
511
- group: {
512
- createdAt: string;
513
- currentState: {
514
- keyEpoch: number;
515
- keyFingerprint: string;
516
- memberCount: number;
517
- stateHash: string;
518
- version: number;
519
- } | null;
520
- groupId: string;
521
- isBuiltin: boolean;
522
- organizationId: string;
523
- };
524
- organizationPolicy: {
525
- containerMutations: {
526
- containerKek: {
527
- containerKeyEpoch: number;
528
- containerKeyEpochId: string;
529
- keyEpochHash: string;
530
- keyringHash: string | null;
531
- keyTargetHash: string;
532
- parentContainerKeyEpochId: string | null;
533
- };
534
- bundleDigest: string;
535
- containerId: string;
536
- createdAt: string;
537
- eventHash: string;
538
- manifestHead: {
539
- epoch: number;
540
- manifestHash: string;
541
- };
542
- organizationId: string;
543
- parentId: string | null;
544
- updatedAt: string;
545
- systemSlot?: string | null | undefined;
546
- }[];
547
- createdAt: string;
548
- head: {
549
- keyEpoch: number;
550
- keyFingerprint: string;
551
- principalId: string;
552
- principalType: "group" | "organization";
553
- stateHash: string;
554
- version: number;
555
- };
556
- };
557
- }, {
558
- group: {
559
- createdAt: string;
560
- currentState: {
561
- keyEpoch: number;
562
- keyFingerprint: string;
563
- memberCount: number;
564
- stateHash: string;
565
- version: number;
566
- } | null;
567
- groupId: string;
568
- isBuiltin: boolean;
569
- organizationId: string;
570
- };
571
- organizationPolicy: {
572
- containerMutations: {
573
- containerKek: {
574
- containerKeyEpoch: number;
575
- containerKeyEpochId: string;
576
- keyEpochHash: string;
577
- keyringHash: string | null;
578
- keyTargetHash: string;
579
- parentContainerKeyEpochId: string | null;
580
- };
581
- bundleDigest: string;
582
- containerId: string;
583
- createdAt: string;
584
- eventHash: string;
585
- manifestHead: {
586
- epoch: number;
587
- manifestHash: string;
588
- };
589
- organizationId: string;
590
- parentId: string | null;
591
- updatedAt: string;
592
- systemSlot?: string | null | undefined;
593
- }[];
594
- createdAt: string;
595
- head: {
596
- keyEpoch: number;
597
- keyFingerprint: string;
598
- principalId: string;
599
- principalType: "group" | "organization";
600
- stateHash: string;
601
- version: number;
602
- };
603
- };
604
- }>>;
605
- export type CreateOrganizationGroupResponse = z.infer<typeof CreateOrganizationGroupResponseSchema>;
606
416
  export declare const DeleteOrganizationGroupResponseSchema: z.ZodType<{
607
417
  deleted: true;
608
418
  groupId: string;
@@ -1608,6 +1418,5 @@ export declare function isOrganizationContainerGrantResponse(value: unknown): va
1608
1418
  export declare function isOrganizationContainerGrantsResponse(value: unknown): value is OrganizationContainerGrantsResponse;
1609
1419
  export declare function isOrganizationUserDetailGrantsResponse(value: unknown): value is OrganizationUserDetailGrantsResponse;
1610
1420
  export declare function isOrganizationUserDetailResponse(value: unknown): value is OrganizationUserDetailResponse;
1611
- export declare function isCreateOrganizationGroupResponse(value: unknown): value is CreateOrganizationGroupResponse;
1612
1421
  export declare function isDeleteOrganizationGroupResponse(value: unknown): value is DeleteOrganizationGroupResponse;
1613
1422
  export {};
@@ -67,10 +67,6 @@ export const OrganizationGroupSummaryResponseShape = {
67
67
  organizationId: z.string(),
68
68
  };
69
69
  export const OrganizationGroupSummaryResponseSchema = loosePlainObject(OrganizationGroupSummaryResponseShape);
70
- export const CreateOrganizationGroupResponseSchema = loosePlainObject({
71
- group: OrganizationGroupSummaryResponseSchema,
72
- organizationPolicy: PrincipalPolicyMutationResponseSchema,
73
- });
74
70
  export const DeleteOrganizationGroupResponseSchema = loosePlainObject({
75
71
  deleted: z.literal(true),
76
72
  groupId: z.string(),
@@ -181,9 +177,6 @@ export function isOrganizationUserDetailGrantsResponse(value) {
181
177
  export function isOrganizationUserDetailResponse(value) {
182
178
  return OrganizationUserDetailResponseSchema.safeParse(value).success;
183
179
  }
184
- export function isCreateOrganizationGroupResponse(value) {
185
- return CreateOrganizationGroupResponseSchema.safeParse(value).success;
186
- }
187
180
  export function isDeleteOrganizationGroupResponse(value) {
188
181
  return DeleteOrganizationGroupResponseSchema.safeParse(value).success;
189
182
  }
@@ -1 +1 @@
1
- {"version":3,"file":"organization.js","sourceRoot":"","sources":["organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,4BAA4B,EAC5B,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,qCAAqC,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,sBAAsB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9D,MAAM,8BAA8B,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AACzE,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AAU,qCAAqC,CACnD,KAAc;IAEd,OAAO,yCAAyC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,KAAc;IAEd,OAAO,wCAAwC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,KAAc;IAEd,OAAO,yCAAyC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,sCAAsC,CACpD,KAAc;IAEd,OAAO,0CAA0C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,oCAAoC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n arraySchema,\n boundedPositiveIntegerSchema,\n loosePlainObject,\n nonEmptyStringSchema,\n nonNegativeIntegerSchema,\n positiveIntegerSchema,\n} from \"../schema\";\nimport { OrganizationLeaveRequestSchema } from \"../util/organizationLeaveRequest\";\nimport { PrincipalPolicyMutationResponseSchema } from \"./principal\";\n\nconst OrganizationRoleSchema = z.literal([\"member\", \"admin\"]);\nconst OrganizationRosterStatusSchema = z.literal([\"active\", \"disabled\"]);\nconst OrganizationGroupContainerAccessLevelSchema = z.literal([\n \"admin\",\n \"read\",\n \"write\",\n]);\nconst OrganizationContainerGrantSubjectTypeSchema = z.literal([\n \"group\",\n \"user\",\n]);\n\nexport type OrganizationRole = z.infer<typeof OrganizationRoleSchema>;\nexport type OrganizationRosterStatus = z.infer<\n typeof OrganizationRosterStatusSchema\n>;\nexport type OrganizationGroupContainerAccessLevel = z.infer<\n typeof OrganizationGroupContainerAccessLevelSchema\n>;\nexport type OrganizationContainerGrantSubjectType = z.infer<\n typeof OrganizationContainerGrantSubjectTypeSchema\n>;\n\n/**\n * A roster row carries each key's fingerprint, not the key: a client takes\n * public keys only from its trusted identity store, never from the directory.\n */\nexport const OrganizationDirectoryUserResponseShape = {\n createdAt: z.string(),\n disabledAt: z.string().nullable(),\n disabledByUserId: z.string().nullable(),\n encapsulationKeyFingerprint: z.string(),\n isPersonalOrganizationOwner: z.boolean(),\n isSelf: z.boolean(),\n joinedAt: z.string(),\n /**\n * The member's pending signed request to leave, which an administrator\n * verifies against the member's trusted signing key before acting on it.\n */\n leaveRequest: OrganizationLeaveRequestSchema.nullable(),\n profileDocumentId: z.string().nullable(),\n signingKeyFingerprint: z.string(),\n status: OrganizationRosterStatusSchema,\n updatedAt: z.string(),\n userId: z.string(),\n};\n\nexport const OrganizationDirectoryUserResponseSchema = loosePlainObject(\n OrganizationDirectoryUserResponseShape,\n);\n\nexport type OrganizationDirectoryUserResponse = z.infer<\n typeof OrganizationDirectoryUserResponseSchema\n>;\n\nexport const OrganizationDirectoryCurrentUserResponseShape = {\n isOrgAdmin: z.boolean(),\n};\n\nconst OrganizationDirectoryCurrentUserResponseSchema = loosePlainObject(\n OrganizationDirectoryCurrentUserResponseShape,\n);\n\nexport const OrganizationDirectoryResponseSchema = loosePlainObject({\n currentUser: OrganizationDirectoryCurrentUserResponseSchema,\n organizationId: z.string(),\n profileDocumentId: z.string().nullable(),\n users: arraySchema(OrganizationDirectoryUserResponseSchema),\n});\n\nexport type OrganizationDirectoryResponse = z.infer<\n typeof OrganizationDirectoryResponseSchema\n>;\n\nexport const OrganizationProfileResponseSchema = loosePlainObject({\n organizationId: z.string(),\n profileDocumentId: z.string().nullable(),\n});\n\nexport type OrganizationProfileResponse = z.infer<\n typeof OrganizationProfileResponseSchema\n>;\n\nexport const OrganizationGroupCurrentStateResponseShape = {\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: nonEmptyStringSchema,\n memberCount: nonNegativeIntegerSchema,\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n};\n\nexport const OrganizationGroupCurrentStateResponseSchema = loosePlainObject(\n OrganizationGroupCurrentStateResponseShape,\n);\n\nexport type OrganizationGroupCurrentStateResponse = z.infer<\n typeof OrganizationGroupCurrentStateResponseSchema\n>;\n\nexport const OrganizationGroupSummaryResponseShape = {\n createdAt: z.string(),\n currentState: OrganizationGroupCurrentStateResponseSchema.nullable(),\n groupId: z.string(),\n isBuiltin: z.boolean(),\n organizationId: z.string(),\n};\n\nexport const OrganizationGroupSummaryResponseSchema = loosePlainObject(\n OrganizationGroupSummaryResponseShape,\n);\n\nexport type OrganizationGroupSummaryResponse = z.infer<\n typeof OrganizationGroupSummaryResponseSchema\n>;\n\nexport const CreateOrganizationGroupResponseSchema = loosePlainObject({\n group: OrganizationGroupSummaryResponseSchema,\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n});\n\nexport type CreateOrganizationGroupResponse = z.infer<\n typeof CreateOrganizationGroupResponseSchema\n>;\n\nexport const DeleteOrganizationGroupResponseSchema = loosePlainObject({\n deleted: z.literal(true),\n groupId: z.string(),\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n organizationId: z.string(),\n});\n\nexport type DeleteOrganizationGroupResponse = z.infer<\n typeof DeleteOrganizationGroupResponseSchema\n>;\n\nexport const ListOrganizationGroupsResponseSchema = loosePlainObject({\n groups: arraySchema(OrganizationGroupSummaryResponseSchema),\n memberGroupId: z.string(),\n organizationId: z.string(),\n});\n\nexport type ListOrganizationGroupsResponse = z.infer<\n typeof ListOrganizationGroupsResponseSchema\n>;\n\nexport const OrganizationGroupMemberResponseShape = {\n role: OrganizationRoleSchema,\n userId: z.string(),\n};\n\nexport const OrganizationGroupMemberResponseSchema = loosePlainObject(\n OrganizationGroupMemberResponseShape,\n);\n\nexport type OrganizationGroupMemberResponse = z.infer<\n typeof OrganizationGroupMemberResponseSchema\n>;\n\nexport const OrganizationGroupMembersResponseSchema = loosePlainObject({\n groupId: z.string(),\n members: arraySchema(OrganizationGroupMemberResponseSchema),\n organizationId: z.string(),\n});\n\nexport type OrganizationGroupMembersResponse = z.infer<\n typeof OrganizationGroupMembersResponseSchema\n>;\n\nconst OrganizationGroupContainerResponseShape = {\n accessLevel: OrganizationGroupContainerAccessLevelSchema,\n containerId: z.string(),\n createdAt: z.string(),\n depth: nonNegativeIntegerSchema,\n isBuiltin: z.boolean(),\n metadataAccessEpoch: positiveIntegerSchema,\n metadataAccessStateHash: nonEmptyStringSchema,\n metadataDocumentId: z.string().nullable(),\n parentId: z.string().nullable(),\n updatedAt: z.string(),\n};\n\nexport const OrganizationGroupContainerResponseSchema = loosePlainObject(\n OrganizationGroupContainerResponseShape,\n);\n\nexport type OrganizationGroupContainerResponse = z.infer<\n typeof OrganizationGroupContainerResponseSchema\n>;\n\nexport const OrganizationGroupContainersResponseSchema = loosePlainObject({\n containers: arraySchema(OrganizationGroupContainerResponseSchema),\n groupId: z.string(),\n organizationId: z.string(),\n});\n\nexport type OrganizationGroupContainersResponse = z.infer<\n typeof OrganizationGroupContainersResponseSchema\n>;\n\nexport const OrganizationContainerGrantResponseShape = {\n ...OrganizationGroupContainerResponseShape,\n groupId: z.string().nullable(),\n signingKeyFingerprint: z.string().nullable(),\n subjectId: z.string(),\n subjectType: OrganizationContainerGrantSubjectTypeSchema,\n userId: z.string().nullable(),\n};\n\nexport const OrganizationContainerGrantResponseSchema = loosePlainObject(\n OrganizationContainerGrantResponseShape,\n);\n\nexport type OrganizationContainerGrantResponse = z.infer<\n typeof OrganizationContainerGrantResponseSchema\n>;\n\nexport const OrganizationContainerGrantsResponseSchema = loosePlainObject({\n grants: arraySchema(OrganizationContainerGrantResponseSchema),\n organizationId: z.string(),\n});\n\nexport type OrganizationContainerGrantsResponse = z.infer<\n typeof OrganizationContainerGrantsResponseSchema\n>;\n\nexport const OrganizationUserDetailGrantsResponseSchema = loosePlainObject({\n directGrants: arraySchema(OrganizationContainerGrantResponseSchema),\n groupGrants: arraySchema(OrganizationContainerGrantResponseSchema),\n});\n\nexport type OrganizationUserDetailGrantsResponse = z.infer<\n typeof OrganizationUserDetailGrantsResponseSchema\n>;\n\nexport const OrganizationUserDetailResponseSchema = loosePlainObject({\n grants: OrganizationUserDetailGrantsResponseSchema,\n groups: arraySchema(OrganizationGroupSummaryResponseSchema),\n organizationId: z.string(),\n user: OrganizationDirectoryUserResponseSchema,\n});\n\nexport type OrganizationUserDetailResponse = z.infer<\n typeof OrganizationUserDetailResponseSchema\n>;\n\nexport function isOrganizationGroupContainerAccessLevel(\n value: string,\n): value is OrganizationGroupContainerAccessLevel {\n return OrganizationGroupContainerAccessLevelSchema.safeParse(value).success;\n}\n\nexport function isOrganizationContainerGrantSubjectType(\n value: string,\n): value is OrganizationContainerGrantSubjectType {\n return OrganizationContainerGrantSubjectTypeSchema.safeParse(value).success;\n}\n\nexport function isOrganizationDirectoryUserResponse(\n value: unknown,\n): value is OrganizationDirectoryUserResponse {\n return OrganizationDirectoryUserResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationDirectoryResponse(\n value: unknown,\n): value is OrganizationDirectoryResponse {\n return OrganizationDirectoryResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationProfileResponse(\n value: unknown,\n): value is OrganizationProfileResponse {\n return OrganizationProfileResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupCurrentStateResponse(\n value: unknown,\n): value is OrganizationGroupCurrentStateResponse {\n return OrganizationGroupCurrentStateResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupSummaryResponse(\n value: unknown,\n): value is OrganizationGroupSummaryResponse {\n return OrganizationGroupSummaryResponseSchema.safeParse(value).success;\n}\n\nexport function isListOrganizationGroupsResponse(\n value: unknown,\n): value is ListOrganizationGroupsResponse {\n return ListOrganizationGroupsResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupMemberResponse(\n value: unknown,\n): value is OrganizationGroupMemberResponse {\n return OrganizationGroupMemberResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupMembersResponse(\n value: unknown,\n): value is OrganizationGroupMembersResponse {\n return OrganizationGroupMembersResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupContainerResponse(\n value: unknown,\n): value is OrganizationGroupContainerResponse {\n return OrganizationGroupContainerResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupContainersResponse(\n value: unknown,\n): value is OrganizationGroupContainersResponse {\n return OrganizationGroupContainersResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationContainerGrantResponse(\n value: unknown,\n): value is OrganizationContainerGrantResponse {\n return OrganizationContainerGrantResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationContainerGrantsResponse(\n value: unknown,\n): value is OrganizationContainerGrantsResponse {\n return OrganizationContainerGrantsResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationUserDetailGrantsResponse(\n value: unknown,\n): value is OrganizationUserDetailGrantsResponse {\n return OrganizationUserDetailGrantsResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationUserDetailResponse(\n value: unknown,\n): value is OrganizationUserDetailResponse {\n return OrganizationUserDetailResponseSchema.safeParse(value).success;\n}\n\nexport function isCreateOrganizationGroupResponse(\n value: unknown,\n): value is CreateOrganizationGroupResponse {\n return CreateOrganizationGroupResponseSchema.safeParse(value).success;\n}\n\nexport function isDeleteOrganizationGroupResponse(\n value: unknown,\n): value is DeleteOrganizationGroupResponse {\n return DeleteOrganizationGroupResponseSchema.safeParse(value).success;\n}\n"]}
1
+ {"version":3,"file":"organization.js","sourceRoot":"","sources":["organization.ts"],"names":[],"mappings":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/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,KAAc;IAEd,OAAO,sCAAsC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,KAAc;IAEd,OAAO,wCAAwC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,KAAc;IAEd,OAAO,yCAAyC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,KAAc;IAEd,OAAO,wCAAwC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,KAAc;IAEd,OAAO,yCAAyC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,sCAAsC,CACpD,KAAc;IAEd,OAAO,0CAA0C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,oCAAoC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n arraySchema,\n boundedPositiveIntegerSchema,\n loosePlainObject,\n nonEmptyStringSchema,\n nonNegativeIntegerSchema,\n positiveIntegerSchema,\n} from \"../schema\";\nimport { OrganizationLeaveRequestSchema } from \"../util/organizationLeaveRequest\";\nimport { PrincipalPolicyMutationResponseSchema } from \"./principal\";\n\nconst OrganizationRoleSchema = z.literal([\"member\", \"admin\"]);\nconst OrganizationRosterStatusSchema = z.literal([\"active\", \"disabled\"]);\nconst OrganizationGroupContainerAccessLevelSchema = z.literal([\n \"admin\",\n \"read\",\n \"write\",\n]);\nconst OrganizationContainerGrantSubjectTypeSchema = z.literal([\n \"group\",\n \"user\",\n]);\n\nexport type OrganizationRole = z.infer<typeof OrganizationRoleSchema>;\nexport type OrganizationRosterStatus = z.infer<\n typeof OrganizationRosterStatusSchema\n>;\nexport type OrganizationGroupContainerAccessLevel = z.infer<\n typeof OrganizationGroupContainerAccessLevelSchema\n>;\nexport type OrganizationContainerGrantSubjectType = z.infer<\n typeof OrganizationContainerGrantSubjectTypeSchema\n>;\n\n/**\n * A roster row carries each key's fingerprint, not the key: a client takes\n * public keys only from its trusted identity store, never from the directory.\n */\nexport const OrganizationDirectoryUserResponseShape = {\n createdAt: z.string(),\n disabledAt: z.string().nullable(),\n disabledByUserId: z.string().nullable(),\n encapsulationKeyFingerprint: z.string(),\n isPersonalOrganizationOwner: z.boolean(),\n isSelf: z.boolean(),\n joinedAt: z.string(),\n /**\n * The member's pending signed request to leave, which an administrator\n * verifies against the member's trusted signing key before acting on it.\n */\n leaveRequest: OrganizationLeaveRequestSchema.nullable(),\n profileDocumentId: z.string().nullable(),\n signingKeyFingerprint: z.string(),\n status: OrganizationRosterStatusSchema,\n updatedAt: z.string(),\n userId: z.string(),\n};\n\nexport const OrganizationDirectoryUserResponseSchema = loosePlainObject(\n OrganizationDirectoryUserResponseShape,\n);\n\nexport type OrganizationDirectoryUserResponse = z.infer<\n typeof OrganizationDirectoryUserResponseSchema\n>;\n\nexport const OrganizationDirectoryCurrentUserResponseShape = {\n isOrgAdmin: z.boolean(),\n};\n\nconst OrganizationDirectoryCurrentUserResponseSchema = loosePlainObject(\n OrganizationDirectoryCurrentUserResponseShape,\n);\n\nexport const OrganizationDirectoryResponseSchema = loosePlainObject({\n currentUser: OrganizationDirectoryCurrentUserResponseSchema,\n organizationId: z.string(),\n profileDocumentId: z.string().nullable(),\n users: arraySchema(OrganizationDirectoryUserResponseSchema),\n});\n\nexport type OrganizationDirectoryResponse = z.infer<\n typeof OrganizationDirectoryResponseSchema\n>;\n\nexport const OrganizationProfileResponseSchema = loosePlainObject({\n organizationId: z.string(),\n profileDocumentId: z.string().nullable(),\n});\n\nexport type OrganizationProfileResponse = z.infer<\n typeof OrganizationProfileResponseSchema\n>;\n\nexport const OrganizationGroupCurrentStateResponseShape = {\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: nonEmptyStringSchema,\n memberCount: nonNegativeIntegerSchema,\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n};\n\nexport const OrganizationGroupCurrentStateResponseSchema = loosePlainObject(\n OrganizationGroupCurrentStateResponseShape,\n);\n\nexport type OrganizationGroupCurrentStateResponse = z.infer<\n typeof OrganizationGroupCurrentStateResponseSchema\n>;\n\nexport const OrganizationGroupSummaryResponseShape = {\n createdAt: z.string(),\n currentState: OrganizationGroupCurrentStateResponseSchema.nullable(),\n groupId: z.string(),\n isBuiltin: z.boolean(),\n organizationId: z.string(),\n};\n\nexport const OrganizationGroupSummaryResponseSchema = loosePlainObject(\n OrganizationGroupSummaryResponseShape,\n);\n\nexport type OrganizationGroupSummaryResponse = z.infer<\n typeof OrganizationGroupSummaryResponseSchema\n>;\n\nexport const DeleteOrganizationGroupResponseSchema = loosePlainObject({\n deleted: z.literal(true),\n groupId: z.string(),\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n organizationId: z.string(),\n});\n\nexport type DeleteOrganizationGroupResponse = z.infer<\n typeof DeleteOrganizationGroupResponseSchema\n>;\n\nexport const ListOrganizationGroupsResponseSchema = loosePlainObject({\n groups: arraySchema(OrganizationGroupSummaryResponseSchema),\n memberGroupId: z.string(),\n organizationId: z.string(),\n});\n\nexport type ListOrganizationGroupsResponse = z.infer<\n typeof ListOrganizationGroupsResponseSchema\n>;\n\nexport const OrganizationGroupMemberResponseShape = {\n role: OrganizationRoleSchema,\n userId: z.string(),\n};\n\nexport const OrganizationGroupMemberResponseSchema = loosePlainObject(\n OrganizationGroupMemberResponseShape,\n);\n\nexport type OrganizationGroupMemberResponse = z.infer<\n typeof OrganizationGroupMemberResponseSchema\n>;\n\nexport const OrganizationGroupMembersResponseSchema = loosePlainObject({\n groupId: z.string(),\n members: arraySchema(OrganizationGroupMemberResponseSchema),\n organizationId: z.string(),\n});\n\nexport type OrganizationGroupMembersResponse = z.infer<\n typeof OrganizationGroupMembersResponseSchema\n>;\n\nconst OrganizationGroupContainerResponseShape = {\n accessLevel: OrganizationGroupContainerAccessLevelSchema,\n containerId: z.string(),\n createdAt: z.string(),\n depth: nonNegativeIntegerSchema,\n isBuiltin: z.boolean(),\n metadataAccessEpoch: positiveIntegerSchema,\n metadataAccessStateHash: nonEmptyStringSchema,\n metadataDocumentId: z.string().nullable(),\n parentId: z.string().nullable(),\n updatedAt: z.string(),\n};\n\nexport const OrganizationGroupContainerResponseSchema = loosePlainObject(\n OrganizationGroupContainerResponseShape,\n);\n\nexport type OrganizationGroupContainerResponse = z.infer<\n typeof OrganizationGroupContainerResponseSchema\n>;\n\nexport const OrganizationGroupContainersResponseSchema = loosePlainObject({\n containers: arraySchema(OrganizationGroupContainerResponseSchema),\n groupId: z.string(),\n organizationId: z.string(),\n});\n\nexport type OrganizationGroupContainersResponse = z.infer<\n typeof OrganizationGroupContainersResponseSchema\n>;\n\nexport const OrganizationContainerGrantResponseShape = {\n ...OrganizationGroupContainerResponseShape,\n groupId: z.string().nullable(),\n signingKeyFingerprint: z.string().nullable(),\n subjectId: z.string(),\n subjectType: OrganizationContainerGrantSubjectTypeSchema,\n userId: z.string().nullable(),\n};\n\nexport const OrganizationContainerGrantResponseSchema = loosePlainObject(\n OrganizationContainerGrantResponseShape,\n);\n\nexport type OrganizationContainerGrantResponse = z.infer<\n typeof OrganizationContainerGrantResponseSchema\n>;\n\nexport const OrganizationContainerGrantsResponseSchema = loosePlainObject({\n grants: arraySchema(OrganizationContainerGrantResponseSchema),\n organizationId: z.string(),\n});\n\nexport type OrganizationContainerGrantsResponse = z.infer<\n typeof OrganizationContainerGrantsResponseSchema\n>;\n\nexport const OrganizationUserDetailGrantsResponseSchema = loosePlainObject({\n directGrants: arraySchema(OrganizationContainerGrantResponseSchema),\n groupGrants: arraySchema(OrganizationContainerGrantResponseSchema),\n});\n\nexport type OrganizationUserDetailGrantsResponse = z.infer<\n typeof OrganizationUserDetailGrantsResponseSchema\n>;\n\nexport const OrganizationUserDetailResponseSchema = loosePlainObject({\n grants: OrganizationUserDetailGrantsResponseSchema,\n groups: arraySchema(OrganizationGroupSummaryResponseSchema),\n organizationId: z.string(),\n user: OrganizationDirectoryUserResponseSchema,\n});\n\nexport type OrganizationUserDetailResponse = z.infer<\n typeof OrganizationUserDetailResponseSchema\n>;\n\nexport function isOrganizationGroupContainerAccessLevel(\n value: string,\n): value is OrganizationGroupContainerAccessLevel {\n return OrganizationGroupContainerAccessLevelSchema.safeParse(value).success;\n}\n\nexport function isOrganizationContainerGrantSubjectType(\n value: string,\n): value is OrganizationContainerGrantSubjectType {\n return OrganizationContainerGrantSubjectTypeSchema.safeParse(value).success;\n}\n\nexport function isOrganizationDirectoryUserResponse(\n value: unknown,\n): value is OrganizationDirectoryUserResponse {\n return OrganizationDirectoryUserResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationDirectoryResponse(\n value: unknown,\n): value is OrganizationDirectoryResponse {\n return OrganizationDirectoryResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationProfileResponse(\n value: unknown,\n): value is OrganizationProfileResponse {\n return OrganizationProfileResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupCurrentStateResponse(\n value: unknown,\n): value is OrganizationGroupCurrentStateResponse {\n return OrganizationGroupCurrentStateResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupSummaryResponse(\n value: unknown,\n): value is OrganizationGroupSummaryResponse {\n return OrganizationGroupSummaryResponseSchema.safeParse(value).success;\n}\n\nexport function isListOrganizationGroupsResponse(\n value: unknown,\n): value is ListOrganizationGroupsResponse {\n return ListOrganizationGroupsResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupMemberResponse(\n value: unknown,\n): value is OrganizationGroupMemberResponse {\n return OrganizationGroupMemberResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupMembersResponse(\n value: unknown,\n): value is OrganizationGroupMembersResponse {\n return OrganizationGroupMembersResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupContainerResponse(\n value: unknown,\n): value is OrganizationGroupContainerResponse {\n return OrganizationGroupContainerResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationGroupContainersResponse(\n value: unknown,\n): value is OrganizationGroupContainersResponse {\n return OrganizationGroupContainersResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationContainerGrantResponse(\n value: unknown,\n): value is OrganizationContainerGrantResponse {\n return OrganizationContainerGrantResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationContainerGrantsResponse(\n value: unknown,\n): value is OrganizationContainerGrantsResponse {\n return OrganizationContainerGrantsResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationUserDetailGrantsResponse(\n value: unknown,\n): value is OrganizationUserDetailGrantsResponse {\n return OrganizationUserDetailGrantsResponseSchema.safeParse(value).success;\n}\n\nexport function isOrganizationUserDetailResponse(\n value: unknown,\n): value is OrganizationUserDetailResponse {\n return OrganizationUserDetailResponseSchema.safeParse(value).success;\n}\n\nexport function isDeleteOrganizationGroupResponse(\n value: unknown,\n): value is DeleteOrganizationGroupResponse {\n return DeleteOrganizationGroupResponseSchema.safeParse(value).success;\n}\n"]}