@tearleads/client-sdk 0.1.17 → 0.1.19

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 (36) hide show
  1. package/client/principalMutationApi.d.ts +1 -1
  2. package/client/principalMutationApi.js +5 -13
  3. package/client/principalMutationApi.js.map +1 -1
  4. package/client/principalMutationDispatch.js +54 -0
  5. package/client/principalMutationDispatch.js.map +1 -0
  6. package/data/persistence/container-contents/documentMoveIntentPersistence.js.map +1 -1
  7. package/data/principals/principalMutationJournal.d.ts +2 -5
  8. package/data/principals/principalMutationJournal.js +3 -20
  9. package/data/principals/principalMutationJournal.js.map +1 -1
  10. package/data/principals/principalMutationJournalShape.d.ts +26 -0
  11. package/data/principals/principalMutationJournalShape.js +46 -0
  12. package/data/principals/principalMutationJournalShape.js.map +1 -0
  13. package/index.d.ts +1 -1
  14. package/index.js.map +1 -1
  15. package/internal/api-client/ApiClient.d.ts +267 -3
  16. package/internal/api-client/ApiClient.js +11 -29
  17. package/internal/api-client/ApiClient.js.map +1 -1
  18. package/internal/api-client/principalPolicyRequests.d.ts +266 -1
  19. package/internal/api-client/principalPolicyRequests.js +43 -1
  20. package/internal/api-client/principalPolicyRequests.js.map +1 -1
  21. package/internal/loro/document.js +8 -11
  22. package/internal/loro/document.js.map +1 -1
  23. package/internal/validators/operation/organizations.d.ts +54 -0
  24. package/internal/validators/operation/organizations.js +19 -4
  25. package/internal/validators/operation/organizations.js.map +1 -1
  26. package/package.json +4 -4
  27. package/workflows/organizations/index.d.ts +1 -0
  28. package/workflows/organizations/index.js.map +1 -1
  29. package/workflows/organizations/principalMutationJournalSession.d.ts +3 -3
  30. package/workflows/organizations/principalMutationJournalSession.js +2 -2
  31. package/workflows/organizations/principalMutationJournalSession.js.map +1 -1
  32. package/workflows/organizations/principalMutationReceipt.js +13 -12
  33. package/workflows/organizations/principalMutationReceipt.js.map +1 -1
  34. package/workflows/organizations/principalOperationReceipt.d.ts +5 -0
  35. package/workflows/organizations/principalOperationReceipt.js +36 -0
  36. package/workflows/organizations/principalOperationReceipt.js.map +1 -0
@@ -9008,12 +9008,20 @@ export declare const createOrganizationGroupOperation: Omit<{
9008
9008
  }>>;
9009
9009
  readonly 503: z.ZodType<{
9010
9010
  error: string;
9011
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
9012
+ committed?: boolean | undefined;
9011
9013
  }, {
9012
9014
  error: string;
9015
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
9016
+ committed?: boolean | undefined;
9013
9017
  }, z.core.$ZodTypeInternals<{
9014
9018
  error: string;
9019
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
9020
+ committed?: boolean | undefined;
9015
9021
  }, {
9016
9022
  error: string;
9023
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
9024
+ committed?: boolean | undefined;
9017
9025
  }>>;
9018
9026
  };
9019
9027
  readonly failureStatuses: readonly [400, 401, 402, 403, 404, 409, 500, 503];
@@ -9023,7 +9031,15 @@ export declare const createOrganizationGroupOperation: Omit<{
9023
9031
  organizationId: z.ZodCustom<string, string>;
9024
9032
  }, z.core.$strict>;
9025
9033
  readonly path: "/organizations/{organizationId}/groups";
9034
+ readonly responseDescriptions: {
9035
+ readonly 202: "The attempted operation rolled back. Retry the identical request to continue verification preparation.";
9036
+ };
9026
9037
  readonly responses: {
9038
+ readonly 202: z.ZodObject<{
9039
+ code: z.ZodLiteral<"principal_history_preparation_pending">;
9040
+ committed: z.ZodLiteral<false>;
9041
+ progressToken: z.ZodCustom<string, string>;
9042
+ }, z.core.$strict>;
9027
9043
  readonly 200: z.ZodType<{
9028
9044
  group: {
9029
9045
  createdAt: string;
@@ -9573,6 +9589,9 @@ export declare const createOrganizationGroupOperation: Omit<{
9573
9589
  readonly runtimeRefinements: readonly [{
9574
9590
  readonly description: "a container response keyring is null exactly for container key epoch 1";
9575
9591
  readonly id: "response.organization-provisioning-container-keyring";
9592
+ }, {
9593
+ readonly id: "response.principal-history-preparation-rollback";
9594
+ readonly description: "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback.";
9576
9595
  }];
9577
9596
  }, "failureResponses" | "failureStatuses"> & {
9578
9597
  readonly failureResponses: {
@@ -9653,12 +9672,20 @@ export declare const createOrganizationGroupOperation: Omit<{
9653
9672
  }>>;
9654
9673
  readonly 503: z.ZodType<{
9655
9674
  error: string;
9675
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
9676
+ committed?: boolean | undefined;
9656
9677
  }, {
9657
9678
  error: string;
9679
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
9680
+ committed?: boolean | undefined;
9658
9681
  }, z.core.$ZodTypeInternals<{
9659
9682
  error: string;
9683
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
9684
+ committed?: boolean | undefined;
9660
9685
  }, {
9661
9686
  error: string;
9687
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
9688
+ committed?: boolean | undefined;
9662
9689
  }>>;
9663
9690
  } & {
9664
9691
  readonly 503: typeof ErrorResponseSchema;
@@ -10122,12 +10149,20 @@ export declare const deleteOrganizationGroupOperation: Omit<{
10122
10149
  }>>;
10123
10150
  readonly 503: z.ZodType<{
10124
10151
  error: string;
10152
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
10153
+ committed?: boolean | undefined;
10125
10154
  }, {
10126
10155
  error: string;
10156
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
10157
+ committed?: boolean | undefined;
10127
10158
  }, z.core.$ZodTypeInternals<{
10128
10159
  error: string;
10160
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
10161
+ committed?: boolean | undefined;
10129
10162
  }, {
10130
10163
  error: string;
10164
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
10165
+ committed?: boolean | undefined;
10131
10166
  }>>;
10132
10167
  };
10133
10168
  readonly failureStatuses: readonly [400, 401, 402, 403, 404, 409, 500, 503];
@@ -10138,7 +10173,15 @@ export declare const deleteOrganizationGroupOperation: Omit<{
10138
10173
  groupId: z.ZodCustom<string, string>;
10139
10174
  }, z.core.$strict>;
10140
10175
  readonly path: "/organizations/{organizationId}/groups/{groupId}";
10176
+ readonly responseDescriptions: {
10177
+ readonly 202: "The attempted operation rolled back. Retry the identical request to continue verification preparation.";
10178
+ };
10141
10179
  readonly responses: {
10180
+ readonly 202: z.ZodObject<{
10181
+ code: z.ZodLiteral<"principal_history_preparation_pending">;
10182
+ committed: z.ZodLiteral<false>;
10183
+ progressToken: z.ZodCustom<string, string>;
10184
+ }, z.core.$strict>;
10142
10185
  readonly 200: z.ZodType<{
10143
10186
  deleted: true;
10144
10187
  groupId: string;
@@ -10648,6 +10691,9 @@ export declare const deleteOrganizationGroupOperation: Omit<{
10648
10691
  readonly runtimeRefinements: readonly [{
10649
10692
  readonly description: "a container response keyring is null exactly for container key epoch 1";
10650
10693
  readonly id: "response.organization-provisioning-container-keyring";
10694
+ }, {
10695
+ readonly id: "response.principal-history-preparation-rollback";
10696
+ readonly description: "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback.";
10651
10697
  }];
10652
10698
  }, "failureResponses" | "failureStatuses"> & {
10653
10699
  readonly failureResponses: {
@@ -10728,12 +10774,20 @@ export declare const deleteOrganizationGroupOperation: Omit<{
10728
10774
  }>>;
10729
10775
  readonly 503: z.ZodType<{
10730
10776
  error: string;
10777
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
10778
+ committed?: boolean | undefined;
10731
10779
  }, {
10732
10780
  error: string;
10781
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
10782
+ committed?: boolean | undefined;
10733
10783
  }, z.core.$ZodTypeInternals<{
10734
10784
  error: string;
10785
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
10786
+ committed?: boolean | undefined;
10735
10787
  }, {
10736
10788
  error: string;
10789
+ code?: "billing_checkout_no_active_members" | "billing_roster_over_capacity" | "principal_history_preparation_unavailable" | undefined;
10790
+ committed?: boolean | undefined;
10737
10791
  }>>;
10738
10792
  } & {
10739
10793
  readonly 503: typeof ErrorResponseSchema;
@@ -5,6 +5,7 @@ import { organizationProvisioningContainerKeyringRefinement, organizationProvisi
5
5
  import { organizationReadModelResponseRuntimeRefinements } from "../organizationReadModelRefinements.js";
6
6
  import { CreateOrganizationGroupWithPolicyRequestSchema, CreateOrganizationRequestSchema, DeleteOrganizationGroupRequestSchema, isCreateOrganizationGroupWithPolicyRequest, isCreateOrganizationRequest, isUpdateOrganizationProfileRequest, isUpdateOrganizationRosterEntryRequest, OrganizationReadModelQuerySchema, UpdateOrganizationProfileRequestSchema, UpdateOrganizationRosterEntryRequestSchema, } from "../request/index.js";
7
7
  import { CreateOrganizationGroupResponseSchema, CreateOrganizationResponseSchema, DeleteOrganizationGroupResponseSchema, ErrorResponseSchema, isCreateOrganizationGroupResponse, isCreateOrganizationResponse, isDeleteOrganizationGroupResponse, isOrganizationDataUsageResponse, isOrganizationDirectoryUserResponse, isOrganizationGroupMembersResponse, isOrganizationProfileResponse, isOrganizationReadModelResponse, OrganizationDataUsageResponseSchema, OrganizationDirectoryUserResponseSchema, OrganizationGroupMembersResponseSchema, OrganizationPresentationFailureResponseSchema, OrganizationProfileResponseSchema, OrganizationReadModelFailureResponseSchema, OrganizationReadModelResponseSchema, PaymentRequiredErrorResponseSchema, SessionFailureResponseSchema, } from "../response/index.js";
8
+ import { PrincipalHistoryPreparationFailureResponseSchema, PrincipalHistoryPreparationResponseSchema, principalHistoryRollbackRefinement, } from "../response/principalHistoryPreparation.js";
8
9
  import { uuidV4StringSchema } from "../schema.js";
9
10
  import { defineJsonOperation } from "./definition.js";
10
11
  const CreateOrganizationPathParamsSchema = z.strictObject({});
@@ -95,17 +96,24 @@ export const createOrganizationGroupOperation = defineJsonOperation({
95
96
  404: ErrorResponseSchema,
96
97
  409: ErrorResponseSchema,
97
98
  500: ErrorResponseSchema,
98
- 503: ErrorResponseSchema,
99
+ 503: PrincipalHistoryPreparationFailureResponseSchema,
99
100
  },
100
101
  failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],
101
102
  id: "organizations.groups.create",
102
103
  method: "POST",
103
104
  params: OrganizationPathParamsSchema,
104
105
  path: "/organizations/{organizationId}/groups",
106
+ responseDescriptions: {
107
+ 202: "The attempted operation rolled back. Retry the identical request to continue verification preparation.",
108
+ },
105
109
  responses: {
110
+ 202: PrincipalHistoryPreparationResponseSchema,
106
111
  200: CreateOrganizationGroupResponseSchema,
107
112
  },
108
- runtimeRefinements: [organizationProvisioningContainerKeyringRefinement],
113
+ runtimeRefinements: [
114
+ organizationProvisioningContainerKeyringRefinement,
115
+ principalHistoryRollbackRefinement,
116
+ ],
109
117
  });
110
118
  export const deleteOrganizationGroupOperation = defineJsonOperation({
111
119
  auth: "session",
@@ -118,17 +126,24 @@ export const deleteOrganizationGroupOperation = defineJsonOperation({
118
126
  404: ErrorResponseSchema,
119
127
  409: ErrorResponseSchema,
120
128
  500: ErrorResponseSchema,
121
- 503: ErrorResponseSchema,
129
+ 503: PrincipalHistoryPreparationFailureResponseSchema,
122
130
  },
123
131
  failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],
124
132
  id: "organizations.groups.delete",
125
133
  method: "DELETE",
126
134
  params: OrganizationGroupPathParamsSchema,
127
135
  path: "/organizations/{organizationId}/groups/{groupId}",
136
+ responseDescriptions: {
137
+ 202: "The attempted operation rolled back. Retry the identical request to continue verification preparation.",
138
+ },
128
139
  responses: {
140
+ 202: PrincipalHistoryPreparationResponseSchema,
129
141
  200: DeleteOrganizationGroupResponseSchema,
130
142
  },
131
- runtimeRefinements: [organizationProvisioningContainerKeyringRefinement],
143
+ runtimeRefinements: [
144
+ organizationProvisioningContainerKeyringRefinement,
145
+ principalHistoryRollbackRefinement,
146
+ ],
132
147
  });
133
148
  export const listOrganizationGroupMembersOperation = defineJsonOperation({
134
149
  auth: "session",
@@ -1 +1 @@
1
- {"version":3,"file":"organizations.js","sourceRoot":"","sources":["organizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,+CAA+C,EAAE,MAAM,qCAAqC,CAAC;AACtG,OAAO,EACL,kDAAkD,EAClD,iDAAiD,EACjD,kDAAkD,GACnD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,+CAA+C,EAAE,MAAM,qCAAqC,CAAC;AACtG,OAAO,EACL,8CAA8C,EAC9C,+BAA+B,EAC/B,oCAAoC,EACpC,0CAA0C,EAC1C,2BAA2B,EAC3B,kCAAkC,EAClC,sCAAsC,EACtC,gCAAgC,EAChC,sCAAsC,EACtC,0CAA0C,GAC3C,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,qCAAqC,EACrC,gCAAgC,EAChC,qCAAqC,EACrC,mBAAmB,EACnB,iCAAiC,EACjC,4BAA4B,EAC5B,iCAAiC,EACjC,+BAA+B,EAC/B,mCAAmC,EACnC,kCAAkC,EAClC,6BAA6B,EAC7B,+BAA+B,EAC/B,mCAAmC,EACnC,uCAAuC,EACvC,sCAAsC,EACtC,6CAA6C,EAC7C,iCAAiC,EACjC,0CAA0C,EAC1C,mCAAmC,EACnC,kCAAkC,EAClC,4BAA4B,GAC7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ACxB,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;KACzB;IACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC/C,EAAE,EAAE,6BAA6B;IACjC,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,kCAAkC;IAC1C,IAAI,EAAE,iDAAiD;IACvD,SAAS,EAAE;QACT,GAAG,EAAE,uCAAuC;KAC7C;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yCAAyC,GACpD,0CAA0C,CAAC;AAC7C,MAAM,CAAC,MAAM,0CAA0C,GACrD,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,oCAAoC,GAAG,2BAA2B,CAAC;AAChF,MAAM,CAAC,MAAM,qCAAqC,GAChD,4BAA4B,CAAC;AAC/B,MAAM,CAAC,MAAM,0CAA0C,GACrD,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,2CAA2C,GACtD,+BAA+B,CAAC;AAClC,MAAM,CAAC,MAAM,2CAA2C,GACtD,+BAA+B,CAAC;AAClC,MAAM,CAAC,MAAM,+CAA+C,GAC1D,kCAAkC,CAAC;AACrC,MAAM,CAAC,MAAM,2CAA2C,GACtD,kCAAkC,CAAC;AACrC,MAAM,CAAC,MAAM,4CAA4C,GACvD,6BAA6B,CAAC;AAChC,MAAM,CAAC,MAAM,+CAA+C,GAC1D,sCAAsC,CAAC;AACzC,MAAM,CAAC,MAAM,gDAAgD,GAC3D,mCAAmC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { documentSyncRequestRuntimeRefinements } from \"../documentSyncRefinements\";\nimport { organizationDataUsageResponseRuntimeRefinements } from \"../organizationDataUsageRefinements\";\nimport {\n organizationProvisioningContainerKeyringRefinement,\n organizationProvisioningRequestRuntimeRefinements,\n organizationProvisioningResponseRuntimeRefinements,\n} from \"../organizationProvisioningRefinements\";\nimport { organizationReadModelResponseRuntimeRefinements } from \"../organizationReadModelRefinements\";\nimport {\n CreateOrganizationGroupWithPolicyRequestSchema,\n CreateOrganizationRequestSchema,\n DeleteOrganizationGroupRequestSchema,\n isCreateOrganizationGroupWithPolicyRequest,\n isCreateOrganizationRequest,\n isUpdateOrganizationProfileRequest,\n isUpdateOrganizationRosterEntryRequest,\n OrganizationReadModelQuerySchema,\n UpdateOrganizationProfileRequestSchema,\n UpdateOrganizationRosterEntryRequestSchema,\n} from \"../request\";\nimport {\n CreateOrganizationGroupResponseSchema,\n CreateOrganizationResponseSchema,\n DeleteOrganizationGroupResponseSchema,\n ErrorResponseSchema,\n isCreateOrganizationGroupResponse,\n isCreateOrganizationResponse,\n isDeleteOrganizationGroupResponse,\n isOrganizationDataUsageResponse,\n isOrganizationDirectoryUserResponse,\n isOrganizationGroupMembersResponse,\n isOrganizationProfileResponse,\n isOrganizationReadModelResponse,\n OrganizationDataUsageResponseSchema,\n OrganizationDirectoryUserResponseSchema,\n OrganizationGroupMembersResponseSchema,\n OrganizationPresentationFailureResponseSchema,\n OrganizationProfileResponseSchema,\n OrganizationReadModelFailureResponseSchema,\n OrganizationReadModelResponseSchema,\n PaymentRequiredErrorResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport { uuidV4StringSchema } from \"../schema\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst CreateOrganizationPathParamsSchema = z.strictObject({});\nexport const OrganizationPathParamsSchema = z.strictObject({\n organizationId: uuidV4StringSchema,\n});\nexport const OrganizationGroupPathParamsSchema = z.strictObject({\n organizationId: uuidV4StringSchema,\n groupId: uuidV4StringSchema,\n});\nexport const OrganizationRosterPathParamsSchema = z.strictObject({\n organizationId: uuidV4StringSchema,\n userId: uuidV4StringSchema,\n});\n\nexport type OrganizationPathParams = z.infer<\n typeof OrganizationPathParamsSchema\n>;\nexport type OrganizationGroupPathParams = z.infer<\n typeof OrganizationGroupPathParamsSchema\n>;\nexport type OrganizationRosterPathParams = z.infer<\n typeof OrganizationRosterPathParamsSchema\n>;\n\nexport const createOrganizationOperation = defineJsonOperation({\n auth: \"session\",\n body: CreateOrganizationRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 409, 500, 503],\n id: \"organizations.create\",\n method: \"POST\",\n params: CreateOrganizationPathParamsSchema,\n path: \"/organizations\",\n responses: {\n 200: CreateOrganizationResponseSchema,\n },\n runtimeRefinements: [\n ...documentSyncRequestRuntimeRefinements,\n ...organizationProvisioningRequestRuntimeRefinements,\n ...organizationProvisioningResponseRuntimeRefinements,\n ],\n});\n\nexport const getOrganizationDataUsageOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: OrganizationPresentationFailureResponseSchema,\n 404: OrganizationPresentationFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"organizations.dataUsage.get\",\n method: \"GET\",\n params: OrganizationPathParamsSchema,\n path: \"/organizations/{organizationId}/data-usage\",\n responses: {\n 200: OrganizationDataUsageResponseSchema,\n },\n runtimeRefinements: organizationDataUsageResponseRuntimeRefinements,\n});\n\nexport const getOrganizationReadModelOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: OrganizationReadModelFailureResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: OrganizationPresentationFailureResponseSchema,\n 404: OrganizationPresentationFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"organizations.readModel.get\",\n method: \"GET\",\n params: OrganizationPathParamsSchema,\n path: \"/organizations/{organizationId}/read-model\",\n query: OrganizationReadModelQuerySchema,\n responses: {\n 200: OrganizationReadModelResponseSchema,\n },\n runtimeRefinements: organizationReadModelResponseRuntimeRefinements,\n});\n\nexport const createOrganizationGroupOperation = defineJsonOperation({\n auth: \"session\",\n body: CreateOrganizationGroupWithPolicyRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],\n id: \"organizations.groups.create\",\n method: \"POST\",\n params: OrganizationPathParamsSchema,\n path: \"/organizations/{organizationId}/groups\",\n responses: {\n 200: CreateOrganizationGroupResponseSchema,\n },\n runtimeRefinements: [organizationProvisioningContainerKeyringRefinement],\n});\n\nexport const deleteOrganizationGroupOperation = defineJsonOperation({\n auth: \"session\",\n body: DeleteOrganizationGroupRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],\n id: \"organizations.groups.delete\",\n method: \"DELETE\",\n params: OrganizationGroupPathParamsSchema,\n path: \"/organizations/{organizationId}/groups/{groupId}\",\n responses: {\n 200: DeleteOrganizationGroupResponseSchema,\n },\n runtimeRefinements: [organizationProvisioningContainerKeyringRefinement],\n});\n\nexport const listOrganizationGroupMembersOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"organizations.groups.members.list\",\n method: \"GET\",\n params: OrganizationGroupPathParamsSchema,\n path: \"/organizations/{organizationId}/groups/{groupId}/members\",\n responses: {\n 200: OrganizationGroupMembersResponseSchema,\n },\n});\n\nexport const updateOrganizationProfileOperation = defineJsonOperation({\n auth: \"session\",\n body: UpdateOrganizationProfileRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 500],\n id: \"organizations.profile.update\",\n method: \"PUT\",\n params: OrganizationPathParamsSchema,\n path: \"/organizations/{organizationId}/profile\",\n responses: {\n 200: OrganizationProfileResponseSchema,\n },\n});\n\nexport const updateOrganizationRosterEntryOperation = defineJsonOperation({\n auth: \"session\",\n body: UpdateOrganizationRosterEntryRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 500],\n id: \"organizations.roster.update\",\n method: \"PUT\",\n params: OrganizationRosterPathParamsSchema,\n path: \"/organizations/{organizationId}/roster/{userId}\",\n responses: {\n 200: OrganizationDirectoryUserResponseSchema,\n },\n});\n\nexport const isCreateOrganizationGroupOperationRequest =\n isCreateOrganizationGroupWithPolicyRequest;\nexport const isCreateOrganizationGroupOperationResponse =\n isCreateOrganizationGroupResponse;\nexport const isCreateOrganizationOperationRequest = isCreateOrganizationRequest;\nexport const isCreateOrganizationOperationResponse =\n isCreateOrganizationResponse;\nexport const isDeleteOrganizationGroupOperationResponse =\n isDeleteOrganizationGroupResponse;\nexport const isGetOrganizationDataUsageOperationResponse =\n isOrganizationDataUsageResponse;\nexport const isGetOrganizationReadModelOperationResponse =\n isOrganizationReadModelResponse;\nexport const isListOrganizationGroupMembersOperationResponse =\n isOrganizationGroupMembersResponse;\nexport const isUpdateOrganizationProfileOperationRequest =\n isUpdateOrganizationProfileRequest;\nexport const isUpdateOrganizationProfileOperationResponse =\n isOrganizationProfileResponse;\nexport const isUpdateOrganizationRosterEntryOperationRequest =\n isUpdateOrganizationRosterEntryRequest;\nexport const isUpdateOrganizationRosterEntryOperationResponse =\n isOrganizationDirectoryUserResponse;\n"]}
1
+ {"version":3,"file":"organizations.js","sourceRoot":"","sources":["organizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,+CAA+C,EAAE,MAAM,qCAAqC,CAAC;AACtG,OAAO,EACL,kDAAkD,EAClD,iDAAiD,EACjD,kDAAkD,GACnD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,+CAA+C,EAAE,MAAM,qCAAqC,CAAC;AACtG,OAAO,EACL,8CAA8C,EAC9C,+BAA+B,EAC/B,oCAAoC,EACpC,0CAA0C,EAC1C,2BAA2B,EAC3B,kCAAkC,EAClC,sCAAsC,EACtC,gCAAgC,EAChC,sCAAsC,EACtC,0CAA0C,GAC3C,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,qCAAqC,EACrC,gCAAgC,EAChC,qCAAqC,EACrC,mBAAmB,EACnB,iCAAiC,EACjC,4BAA4B,EAC5B,iCAAiC,EACjC,+BAA+B,EAC/B,mCAAmC,EACnC,kCAAkC,EAClC,6BAA6B,EAC7B,+BAA+B,EAC/B,mCAAmC,EACnC,uCAAuC,EACvC,sCAAsC,EACtC,6CAA6C,EAC7C,iCAAiC,EACjC,0CAA0C,EAC1C,mCAAmC,EACnC,kCAAkC,EAClC,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gDAAgD,EAChD,yCAAyC,EACzC,kCAAkC,GACnC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBA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AAE,mBAAmB;QACxB,GAAG,EAAE,4BAA4B;QACjC,GAAG,EAAE,kCAAkC;QACvC,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;KACzB;IACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC/C,EAAE,EAAE,6BAA6B;IACjC,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,kCAAkC;IAC1C,IAAI,EAAE,iDAAiD;IACvD,SAAS,EAAE;QACT,GAAG,EAAE,uCAAuC;KAC7C;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yCAAyC,GACpD,0CAA0C,CAAC;AAC7C,MAAM,CAAC,MAAM,0CAA0C,GACrD,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,oCAAoC,GAAG,2BAA2B,CAAC;AAChF,MAAM,CAAC,MAAM,qCAAqC,GAChD,4BAA4B,CAAC;AAC/B,MAAM,CAAC,MAAM,0CAA0C,GACrD,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,2CAA2C,GACtD,+BAA+B,CAAC;AAClC,MAAM,CAAC,MAAM,2CAA2C,GACtD,+BAA+B,CAAC;AAClC,MAAM,CAAC,MAAM,+CAA+C,GAC1D,kCAAkC,CAAC;AACrC,MAAM,CAAC,MAAM,2CAA2C,GACtD,kCAAkC,CAAC;AACrC,MAAM,CAAC,MAAM,4CAA4C,GACvD,6BAA6B,CAAC;AAChC,MAAM,CAAC,MAAM,+CAA+C,GAC1D,sCAAsC,CAAC;AACzC,MAAM,CAAC,MAAM,gDAAgD,GAC3D,mCAAmC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { documentSyncRequestRuntimeRefinements } from \"../documentSyncRefinements\";\nimport { organizationDataUsageResponseRuntimeRefinements } from \"../organizationDataUsageRefinements\";\nimport {\n organizationProvisioningContainerKeyringRefinement,\n organizationProvisioningRequestRuntimeRefinements,\n organizationProvisioningResponseRuntimeRefinements,\n} from \"../organizationProvisioningRefinements\";\nimport { organizationReadModelResponseRuntimeRefinements } from \"../organizationReadModelRefinements\";\nimport {\n CreateOrganizationGroupWithPolicyRequestSchema,\n CreateOrganizationRequestSchema,\n DeleteOrganizationGroupRequestSchema,\n isCreateOrganizationGroupWithPolicyRequest,\n isCreateOrganizationRequest,\n isUpdateOrganizationProfileRequest,\n isUpdateOrganizationRosterEntryRequest,\n OrganizationReadModelQuerySchema,\n UpdateOrganizationProfileRequestSchema,\n UpdateOrganizationRosterEntryRequestSchema,\n} from \"../request\";\nimport {\n CreateOrganizationGroupResponseSchema,\n CreateOrganizationResponseSchema,\n DeleteOrganizationGroupResponseSchema,\n ErrorResponseSchema,\n isCreateOrganizationGroupResponse,\n isCreateOrganizationResponse,\n isDeleteOrganizationGroupResponse,\n isOrganizationDataUsageResponse,\n isOrganizationDirectoryUserResponse,\n isOrganizationGroupMembersResponse,\n isOrganizationProfileResponse,\n isOrganizationReadModelResponse,\n OrganizationDataUsageResponseSchema,\n OrganizationDirectoryUserResponseSchema,\n OrganizationGroupMembersResponseSchema,\n OrganizationPresentationFailureResponseSchema,\n OrganizationProfileResponseSchema,\n OrganizationReadModelFailureResponseSchema,\n OrganizationReadModelResponseSchema,\n PaymentRequiredErrorResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport {\n PrincipalHistoryPreparationFailureResponseSchema,\n PrincipalHistoryPreparationResponseSchema,\n principalHistoryRollbackRefinement,\n} from \"../response/principalHistoryPreparation\";\nimport { uuidV4StringSchema } from \"../schema\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst CreateOrganizationPathParamsSchema = z.strictObject({});\nexport const OrganizationPathParamsSchema = z.strictObject({\n organizationId: uuidV4StringSchema,\n});\nexport const OrganizationGroupPathParamsSchema = z.strictObject({\n organizationId: uuidV4StringSchema,\n groupId: uuidV4StringSchema,\n});\nexport const OrganizationRosterPathParamsSchema = z.strictObject({\n organizationId: uuidV4StringSchema,\n userId: uuidV4StringSchema,\n});\n\nexport type OrganizationPathParams = z.infer<\n typeof OrganizationPathParamsSchema\n>;\nexport type OrganizationGroupPathParams = z.infer<\n typeof OrganizationGroupPathParamsSchema\n>;\nexport type OrganizationRosterPathParams = z.infer<\n typeof OrganizationRosterPathParamsSchema\n>;\n\nexport const createOrganizationOperation = defineJsonOperation({\n auth: \"session\",\n body: CreateOrganizationRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 409, 500, 503],\n id: \"organizations.create\",\n method: \"POST\",\n params: CreateOrganizationPathParamsSchema,\n path: \"/organizations\",\n responses: {\n 200: CreateOrganizationResponseSchema,\n },\n runtimeRefinements: [\n ...documentSyncRequestRuntimeRefinements,\n ...organizationProvisioningRequestRuntimeRefinements,\n ...organizationProvisioningResponseRuntimeRefinements,\n ],\n});\n\nexport const getOrganizationDataUsageOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: OrganizationPresentationFailureResponseSchema,\n 404: OrganizationPresentationFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"organizations.dataUsage.get\",\n method: \"GET\",\n params: OrganizationPathParamsSchema,\n path: \"/organizations/{organizationId}/data-usage\",\n responses: {\n 200: OrganizationDataUsageResponseSchema,\n },\n runtimeRefinements: organizationDataUsageResponseRuntimeRefinements,\n});\n\nexport const getOrganizationReadModelOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: OrganizationReadModelFailureResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: OrganizationPresentationFailureResponseSchema,\n 404: OrganizationPresentationFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"organizations.readModel.get\",\n method: \"GET\",\n params: OrganizationPathParamsSchema,\n path: \"/organizations/{organizationId}/read-model\",\n query: OrganizationReadModelQuerySchema,\n responses: {\n 200: OrganizationReadModelResponseSchema,\n },\n runtimeRefinements: organizationReadModelResponseRuntimeRefinements,\n});\n\nexport const createOrganizationGroupOperation = defineJsonOperation({\n auth: \"session\",\n body: CreateOrganizationGroupWithPolicyRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: PrincipalHistoryPreparationFailureResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],\n id: \"organizations.groups.create\",\n method: \"POST\",\n params: OrganizationPathParamsSchema,\n path: \"/organizations/{organizationId}/groups\",\n responseDescriptions: {\n 202: \"The attempted operation rolled back. Retry the identical request to continue verification preparation.\",\n },\n responses: {\n 202: PrincipalHistoryPreparationResponseSchema,\n 200: CreateOrganizationGroupResponseSchema,\n },\n runtimeRefinements: [\n organizationProvisioningContainerKeyringRefinement,\n principalHistoryRollbackRefinement,\n ],\n});\n\nexport const deleteOrganizationGroupOperation = defineJsonOperation({\n auth: \"session\",\n body: DeleteOrganizationGroupRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: PrincipalHistoryPreparationFailureResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],\n id: \"organizations.groups.delete\",\n method: \"DELETE\",\n params: OrganizationGroupPathParamsSchema,\n path: \"/organizations/{organizationId}/groups/{groupId}\",\n responseDescriptions: {\n 202: \"The attempted operation rolled back. Retry the identical request to continue verification preparation.\",\n },\n responses: {\n 202: PrincipalHistoryPreparationResponseSchema,\n 200: DeleteOrganizationGroupResponseSchema,\n },\n runtimeRefinements: [\n organizationProvisioningContainerKeyringRefinement,\n principalHistoryRollbackRefinement,\n ],\n});\n\nexport const listOrganizationGroupMembersOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"organizations.groups.members.list\",\n method: \"GET\",\n params: OrganizationGroupPathParamsSchema,\n path: \"/organizations/{organizationId}/groups/{groupId}/members\",\n responses: {\n 200: OrganizationGroupMembersResponseSchema,\n },\n});\n\nexport const updateOrganizationProfileOperation = defineJsonOperation({\n auth: \"session\",\n body: UpdateOrganizationProfileRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 500],\n id: \"organizations.profile.update\",\n method: \"PUT\",\n params: OrganizationPathParamsSchema,\n path: \"/organizations/{organizationId}/profile\",\n responses: {\n 200: OrganizationProfileResponseSchema,\n },\n});\n\nexport const updateOrganizationRosterEntryOperation = defineJsonOperation({\n auth: \"session\",\n body: UpdateOrganizationRosterEntryRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 500],\n id: \"organizations.roster.update\",\n method: \"PUT\",\n params: OrganizationRosterPathParamsSchema,\n path: \"/organizations/{organizationId}/roster/{userId}\",\n responses: {\n 200: OrganizationDirectoryUserResponseSchema,\n },\n});\n\nexport const isCreateOrganizationGroupOperationRequest =\n isCreateOrganizationGroupWithPolicyRequest;\nexport const isCreateOrganizationGroupOperationResponse =\n isCreateOrganizationGroupResponse;\nexport const isCreateOrganizationOperationRequest = isCreateOrganizationRequest;\nexport const isCreateOrganizationOperationResponse =\n isCreateOrganizationResponse;\nexport const isDeleteOrganizationGroupOperationResponse =\n isDeleteOrganizationGroupResponse;\nexport const isGetOrganizationDataUsageOperationResponse =\n isOrganizationDataUsageResponse;\nexport const isGetOrganizationReadModelOperationResponse =\n isOrganizationReadModelResponse;\nexport const isListOrganizationGroupMembersOperationResponse =\n isOrganizationGroupMembersResponse;\nexport const isUpdateOrganizationProfileOperationRequest =\n isUpdateOrganizationProfileRequest;\nexport const isUpdateOrganizationProfileOperationResponse =\n isOrganizationProfileResponse;\nexport const isUpdateOrganizationRosterEntryOperationRequest =\n isUpdateOrganizationRosterEntryRequest;\nexport const isUpdateOrganizationRosterEntryOperationResponse =\n isOrganizationDirectoryUserResponse;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tearleads/client-sdk",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "React-free Tearleads client runtime: local SQLite persistence, keys, sync, encrypted blobs, and domain workflows.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -33,8 +33,8 @@
33
33
  "@noble/hashes": "^2.4.0",
34
34
  "@noble/post-quantum": "^0.7.1",
35
35
  "@scure/bip39": "^2.4.0",
36
- "drizzle-orm": "^0.45.2",
37
- "loro-crdt": "^1.16.0",
38
- "zod": "^4.5.4"
36
+ "drizzle-orm": "^0.45.3",
37
+ "loro-crdt": "^1.16.4",
38
+ "zod": "^4.6.5"
39
39
  }
40
40
  }
@@ -14,6 +14,7 @@ export { buildOrganizationProfileDocumentPatch, createInitializedOrganizationPro
14
14
  export { type ImportedOrganizationUser, importOrganizationUser, } from "./organizationUserImport.js";
15
15
  export { abandonJournaledPrincipalMutation, discardUnreadableJournaledPrincipalMutation, readJournaledPrincipalMutation, } from "./principalMutationJournalManagement.js";
16
16
  export { type PrincipalMutationJournalContext, PrincipalMutationOutcomeUnknownError, recoverJournaledPrincipalMutation, submitJournaledPrincipalMutation, } from "./principalMutationJournalSession.js";
17
+ export type { PrincipalMutationResponse } from "./principalOperationReceipt.js";
17
18
  export { addOrganizationGroupUser, buildInitialGroupPolicyRequest, buildInitialMemberGroupPolicyRequest, createOrganizationGroup, removeOrganizationGroupUser, rotateOrganizationGroupForAccessSetShrink, } from "./principalPolicy.js";
18
19
  export { buildOrganizationGroupPolicyHistory, type OrganizationContainerGrant, type OrganizationContainerGrants, type OrganizationDirectory, type OrganizationDirectoryAndGroups, type OrganizationDirectoryUser, type OrganizationGroupContainer, type OrganizationGroupContainers, type OrganizationGroupDetails, type OrganizationGroupMember, type OrganizationGroupMembers, type OrganizationGroupPolicyHistory, type OrganizationGroupPolicyHistoryEntry, type OrganizationGroupSummary, type OrganizationPolicyGrantChange, type OrganizationPolicyGroupChange, type OrganizationPolicyHistory, type OrganizationPolicyHistoryEntry, type OrganizationPrincipalMemberChange, type OrganizationPrincipalMemberChangeType, type OrganizationPrincipalPolicyHistory, type OrganizationPrincipalPolicyHistoryEntry, type OrganizationProfile, type OrganizationUserDetail, updateOrganizationProfile, updateOrganizationRosterEntry, } from "./readModel.js";
19
20
  export { loadLocalOrganizationDirectoryAndGroups, loadLocalOrganizationGroupMembers, type ReconcileOrganizationDirectoryAndGroupsInput, reconcileOrganizationDirectoryAndGroups, } from "./readModelProjection.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0CAA0C,GAC3C,MAAM,wEAAwE,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAC;AAK3G,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;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EACL,uCAAuC,EACvC,iCAAiC,EAEjC,uCAAuC,GACxC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,mCAAmC,GACpC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,+BAA+B,EAC/B,sCAAsC,EACtC,6CAA6C,EAC7C,kDAAkD,EAClD,+BAA+B,EAC/B,oCAAoC,EACpC,0CAA0C,EAC1C,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n type OrganizationReadModelInvalidationListener,\n subscribeOrganizationReadModelInvalidation,\n} from \"../../data/persistence/organizations/organizationReadModelInvalidation\";\nexport { PendingPrincipalMutationError } from \"../../data/persistence/principalMutationJournalPersistence\";\nexport type {\n AuthoredPrincipalMutation,\n PrincipalMutationJournalScope,\n} from \"../../data/principals/principalMutationJournal\";\nexport { UnreadablePrincipalMutationError } from \"../../data/principals/principalMutationJournalRecord\";\nexport {\n cancelStripeSubscription,\n checkNativePurchaseEligibility,\n claimNativeOrganizationSubscription,\n createStripeCheckout,\n createStripeCheckoutSession,\n loadOrganizationBilling,\n loadOrganizationBillingHistory,\n loadOrganizationBillingManagementUrl,\n loadStripeCheckoutOptions,\n type OrganizationBilling,\n type OrganizationBillingHistory,\n type OrganizationBillingHistoryEntry,\n type OrganizationBillingManagementUrl,\n type OrganizationBillingView,\n type OrganizationNativePurchaseEligibility,\n resolveOrganizationBillingView,\n type StripeCheckoutIntent,\n type StripeCheckoutOptions,\n startOrganizationTrial,\n} from \"./billing\";\nexport { revokeOrganizationContainerGrant } from \"./containerGrantRevocation\";\nexport {\n type CreateOrganizationApi,\n type CreateOrganizationInput,\n createOrganization,\n} from \"./createOrganization\";\nexport {\n loadLocalOrganizationDataUsage,\n type OrganizationDataUsage,\n type ReconcileOrganizationDataUsageInput,\n reconcileOrganizationDataUsage,\n} from \"./dataUsageReadModel\";\nexport { deleteOrganizationGroup } from \"./deleteOrganizationGroup\";\nexport { GroupMembershipNameMismatchError } from \"./groupMembershipName\";\nexport {\n type LocalOrganizationSummary,\n listLocalOrganizations,\n} from \"./listLocalOrganizations\";\nexport {\n loadLocalOrganizationContainerGrants,\n loadLocalOrganizationGroupContainers,\n loadLocalOrganizationGroupPolicyHistory,\n loadLocalOrganizationPolicyHistory,\n loadLocalOrganizationPolicyReference,\n loadLocalOrganizationUserDetail,\n} from \"./localReadModelDetails\";\nexport {\n buildOrganizationProfileDocumentPatch,\n createInitializedOrganizationProfileDocument,\n DEFAULT_PERSONAL_ORGANIZATION_PROFILE_NAME,\n getOrganizationProfileDocumentLocalId,\n ORGANIZATION_PROFILE_DOCUMENT_KIND,\n readOrganizationProfileName,\n} from \"./organizationProfile\";\nexport {\n type ImportedOrganizationUser,\n importOrganizationUser,\n} from \"./organizationUserImport\";\nexport {\n abandonJournaledPrincipalMutation,\n discardUnreadableJournaledPrincipalMutation,\n readJournaledPrincipalMutation,\n} from \"./principalMutationJournalManagement\";\nexport {\n type PrincipalMutationJournalContext,\n PrincipalMutationOutcomeUnknownError,\n recoverJournaledPrincipalMutation,\n submitJournaledPrincipalMutation,\n} from \"./principalMutationJournalSession\";\nexport {\n addOrganizationGroupUser,\n buildInitialGroupPolicyRequest,\n buildInitialMemberGroupPolicyRequest,\n createOrganizationGroup,\n removeOrganizationGroupUser,\n rotateOrganizationGroupForAccessSetShrink,\n} from \"./principalPolicy\";\nexport {\n buildOrganizationGroupPolicyHistory,\n type OrganizationContainerGrant,\n type OrganizationContainerGrants,\n type OrganizationDirectory,\n type OrganizationDirectoryAndGroups,\n type OrganizationDirectoryUser,\n type OrganizationGroupContainer,\n type OrganizationGroupContainers,\n type OrganizationGroupDetails,\n type OrganizationGroupMember,\n type OrganizationGroupMembers,\n type OrganizationGroupPolicyHistory,\n type OrganizationGroupPolicyHistoryEntry,\n type OrganizationGroupSummary,\n type OrganizationPolicyGrantChange,\n type OrganizationPolicyGroupChange,\n type OrganizationPolicyHistory,\n type OrganizationPolicyHistoryEntry,\n type OrganizationPrincipalMemberChange,\n type OrganizationPrincipalMemberChangeType,\n type OrganizationPrincipalPolicyHistory,\n type OrganizationPrincipalPolicyHistoryEntry,\n type OrganizationProfile,\n type OrganizationUserDetail,\n updateOrganizationProfile,\n updateOrganizationRosterEntry,\n} from \"./readModel\";\nexport {\n loadLocalOrganizationDirectoryAndGroups,\n loadLocalOrganizationGroupMembers,\n type ReconcileOrganizationDirectoryAndGroupsInput,\n reconcileOrganizationDirectoryAndGroups,\n} from \"./readModelProjection\";\nexport {\n type AcknowledgedPrincipalCurrentInput,\n type AcknowledgedPrincipalCurrentRetirement,\n retainAcknowledgedPrincipalCurrents,\n} from \"./retainAcknowledgedPrincipalCurrents\";\nexport {\n buildRosterProfileDocumentPatch,\n createInitializedRosterProfileDocument,\n deriveOrganizationMetadataContainerSystemSlot,\n deriveOrganizationRosterProfileContainerSystemSlot,\n getRosterProfileDocumentLocalId,\n ORGANIZATION_METADATA_CONTAINER_NAME,\n ORGANIZATION_ROSTER_PROFILE_CONTAINER_NAME,\n ROSTER_PROFILE_DOCUMENT_KIND,\n} from \"./rosterProfileContainer\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0CAA0C,GAC3C,MAAM,wEAAwE,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAC;AAK3G,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AACxG,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,mCAAmC,EACnC,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACvB,8BAA8B,EAC9B,oCAAoC,EACpC,yBAAyB,EAOzB,8BAA8B,EAG9B,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAGL,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,8BAA8B,EAG9B,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAEL,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oCAAoC,EACpC,oCAAoC,EACpC,uCAAuC,EACvC,kCAAkC,EAClC,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qCAAqC,EACrC,4CAA4C,EAC5C,0CAA0C,EAC1C,qCAAqC,EACrC,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iCAAiC,EACjC,2CAA2C,EAC3C,8BAA8B,GAC/B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEL,oCAAoC,EACpC,iCAAiC,EACjC,gCAAgC,GACjC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,oCAAoC,EACpC,uBAAuB,EACvB,2BAA2B,EAC3B,yCAAyC,GAC1C,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,mCAAmC,EAwBnC,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uCAAuC,EACvC,iCAAiC,EAEjC,uCAAuC,GACxC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,mCAAmC,GACpC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,+BAA+B,EAC/B,sCAAsC,EACtC,6CAA6C,EAC7C,kDAAkD,EAClD,+BAA+B,EAC/B,oCAAoC,EACpC,0CAA0C,EAC1C,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n type OrganizationReadModelInvalidationListener,\n subscribeOrganizationReadModelInvalidation,\n} from \"../../data/persistence/organizations/organizationReadModelInvalidation\";\nexport { PendingPrincipalMutationError } from \"../../data/persistence/principalMutationJournalPersistence\";\nexport type {\n AuthoredPrincipalMutation,\n PrincipalMutationJournalScope,\n} from \"../../data/principals/principalMutationJournal\";\nexport { UnreadablePrincipalMutationError } from \"../../data/principals/principalMutationJournalRecord\";\nexport {\n cancelStripeSubscription,\n checkNativePurchaseEligibility,\n claimNativeOrganizationSubscription,\n createStripeCheckout,\n createStripeCheckoutSession,\n loadOrganizationBilling,\n loadOrganizationBillingHistory,\n loadOrganizationBillingManagementUrl,\n loadStripeCheckoutOptions,\n type OrganizationBilling,\n type OrganizationBillingHistory,\n type OrganizationBillingHistoryEntry,\n type OrganizationBillingManagementUrl,\n type OrganizationBillingView,\n type OrganizationNativePurchaseEligibility,\n resolveOrganizationBillingView,\n type StripeCheckoutIntent,\n type StripeCheckoutOptions,\n startOrganizationTrial,\n} from \"./billing\";\nexport { revokeOrganizationContainerGrant } from \"./containerGrantRevocation\";\nexport {\n type CreateOrganizationApi,\n type CreateOrganizationInput,\n createOrganization,\n} from \"./createOrganization\";\nexport {\n loadLocalOrganizationDataUsage,\n type OrganizationDataUsage,\n type ReconcileOrganizationDataUsageInput,\n reconcileOrganizationDataUsage,\n} from \"./dataUsageReadModel\";\nexport { deleteOrganizationGroup } from \"./deleteOrganizationGroup\";\nexport { GroupMembershipNameMismatchError } from \"./groupMembershipName\";\nexport {\n type LocalOrganizationSummary,\n listLocalOrganizations,\n} from \"./listLocalOrganizations\";\nexport {\n loadLocalOrganizationContainerGrants,\n loadLocalOrganizationGroupContainers,\n loadLocalOrganizationGroupPolicyHistory,\n loadLocalOrganizationPolicyHistory,\n loadLocalOrganizationPolicyReference,\n loadLocalOrganizationUserDetail,\n} from \"./localReadModelDetails\";\nexport {\n buildOrganizationProfileDocumentPatch,\n createInitializedOrganizationProfileDocument,\n DEFAULT_PERSONAL_ORGANIZATION_PROFILE_NAME,\n getOrganizationProfileDocumentLocalId,\n ORGANIZATION_PROFILE_DOCUMENT_KIND,\n readOrganizationProfileName,\n} from \"./organizationProfile\";\nexport {\n type ImportedOrganizationUser,\n importOrganizationUser,\n} from \"./organizationUserImport\";\nexport {\n abandonJournaledPrincipalMutation,\n discardUnreadableJournaledPrincipalMutation,\n readJournaledPrincipalMutation,\n} from \"./principalMutationJournalManagement\";\nexport {\n type PrincipalMutationJournalContext,\n PrincipalMutationOutcomeUnknownError,\n recoverJournaledPrincipalMutation,\n submitJournaledPrincipalMutation,\n} from \"./principalMutationJournalSession\";\nexport type { PrincipalMutationResponse } from \"./principalOperationReceipt\";\nexport {\n addOrganizationGroupUser,\n buildInitialGroupPolicyRequest,\n buildInitialMemberGroupPolicyRequest,\n createOrganizationGroup,\n removeOrganizationGroupUser,\n rotateOrganizationGroupForAccessSetShrink,\n} from \"./principalPolicy\";\nexport {\n buildOrganizationGroupPolicyHistory,\n type OrganizationContainerGrant,\n type OrganizationContainerGrants,\n type OrganizationDirectory,\n type OrganizationDirectoryAndGroups,\n type OrganizationDirectoryUser,\n type OrganizationGroupContainer,\n type OrganizationGroupContainers,\n type OrganizationGroupDetails,\n type OrganizationGroupMember,\n type OrganizationGroupMembers,\n type OrganizationGroupPolicyHistory,\n type OrganizationGroupPolicyHistoryEntry,\n type OrganizationGroupSummary,\n type OrganizationPolicyGrantChange,\n type OrganizationPolicyGroupChange,\n type OrganizationPolicyHistory,\n type OrganizationPolicyHistoryEntry,\n type OrganizationPrincipalMemberChange,\n type OrganizationPrincipalMemberChangeType,\n type OrganizationPrincipalPolicyHistory,\n type OrganizationPrincipalPolicyHistoryEntry,\n type OrganizationProfile,\n type OrganizationUserDetail,\n updateOrganizationProfile,\n updateOrganizationRosterEntry,\n} from \"./readModel\";\nexport {\n loadLocalOrganizationDirectoryAndGroups,\n loadLocalOrganizationGroupMembers,\n type ReconcileOrganizationDirectoryAndGroupsInput,\n reconcileOrganizationDirectoryAndGroups,\n} from \"./readModelProjection\";\nexport {\n type AcknowledgedPrincipalCurrentInput,\n type AcknowledgedPrincipalCurrentRetirement,\n retainAcknowledgedPrincipalCurrents,\n} from \"./retainAcknowledgedPrincipalCurrents\";\nexport {\n buildRosterProfileDocumentPatch,\n createInitializedRosterProfileDocument,\n deriveOrganizationMetadataContainerSystemSlot,\n deriveOrganizationRosterProfileContainerSystemSlot,\n getRosterProfileDocumentLocalId,\n ORGANIZATION_METADATA_CONTAINER_NAME,\n ORGANIZATION_ROSTER_PROFILE_CONTAINER_NAME,\n ROSTER_PROFILE_DOCUMENT_KIND,\n} from \"./rosterProfileContainer\";\n"]}
@@ -1,9 +1,9 @@
1
1
  import type { RequestResult } from "../../internal/api-client/index.js";
2
2
  import type { SigningKeyPair } from "../../internal/crypto/index.js";
3
- import type { CommitOrganizationGroupPolicyResponse } from "../../internal/validators/response/index.js";
4
3
  import { type AuthoredPrincipalMutation, type PrincipalMutationJournalScope } from "../../data/principals/principalMutationJournal.js";
5
4
  import type { ExecSql } from "../../data/sqlite/sqlSchema.js";
6
- type MutationResult = RequestResult<CommitOrganizationGroupPolicyResponse>;
5
+ import { type PrincipalMutationResponse } from "./principalOperationReceipt.js";
6
+ type MutationResult = RequestResult<PrincipalMutationResponse>;
7
7
  export interface PrincipalMutationJournalContext {
8
8
  readonly execSql: ExecSql;
9
9
  readonly scope: PrincipalMutationJournalScope;
@@ -21,6 +21,6 @@ export declare function submitJournaledPrincipalMutation(input: PrincipalMutatio
21
21
  /** Retry only authenticated saved bytes, never an application mutation callback. */
22
22
  export declare function recoverJournaledPrincipalMutation(input: PrincipalMutationJournalContext): Promise<{
23
23
  readonly mutation: AuthoredPrincipalMutation;
24
- readonly response: CommitOrganizationGroupPolicyResponse;
24
+ readonly response: PrincipalMutationResponse;
25
25
  } | null>;
26
26
  export {};
@@ -2,7 +2,7 @@ import { assertProjectionVerificationCurrent } from "../../data/keyingProjection
2
2
  import { claimPrincipalMutationJournal, clearPrincipalMutationJournal, loadPrincipalMutationJournal, } from "../../data/persistence/principalMutationJournalPersistence.js";
3
3
  import { openPrincipalMutation, principalMutationJournalScopeId, sealPrincipalMutation, } from "../../data/principals/principalMutationJournal.js";
4
4
  import { runPrincipalMutationJournalOperation } from "./principalMutationJournalLane.js";
5
- import { assertAuthoredPrincipalMutationReceipt } from "./principalMutationReceipt.js";
5
+ import { assertAuthoredPrincipalOperationReceipt, } from "./principalOperationReceipt.js";
6
6
  export class PrincipalMutationOutcomeUnknownError extends Error {
7
7
  constructor(options) {
8
8
  super("A saved policy request may have committed; resolve its outcome or explicitly abandon its retry before another mutation", options);
@@ -40,7 +40,7 @@ async function submitSavedMutation(input, row, recovering) {
40
40
  }
41
41
  assertProjectionVerificationCurrent(input.stillCurrent);
42
42
  if (result.ok) {
43
- await assertAuthoredPrincipalMutationReceipt(mutation.request, result.data);
43
+ await assertAuthoredPrincipalOperationReceipt(mutation, result.data);
44
44
  }
45
45
  else if (recovering || !knownInitialRefusal(result)) {
46
46
  // A refusal today (including loss of admin access) cannot establish whether
@@ -1 +1 @@
1
- {"version":3,"file":"principalMutationJournalSession.js","sourceRoot":"","sources":["principalMutationJournalSession.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,GAE7B,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAEL,qBAAqB,EAErB,+BAA+B,EAC/B,qBAAqB,GACtB,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,sCAAsC,EAAE,MAAM,4BAA4B,CAAC;AAcpF,MAAM,OAAO,oCAAqC,SAAQ,KAAK;IAC7D,YAAY,OAAsB;QAChC,KAAK,CACH,wHAAwH,EACxH,OAAO,CACR,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sCAAsC,CAAC;IACrD,CAAC;CACF;AAED,SAAS,mBAAmB,CAAC,MAAsB;IACjD,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KAAK,CAAC,CACnD,CAAC;QACF,mCAAmC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,EAAE;YAAE,MAAM,IAAI,oCAAoC,EAAE,CAAC;QACjE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RequestResult } from \"@tearleads/api-client\";\nimport type { SigningKeyPair } from \"@tearleads/crypto\";\nimport type { CommitOrganizationGroupPolicyResponse } from \"@tearleads/validators/response\";\nimport { assertProjectionVerificationCurrent } from \"../../data/keyingProjectionVerification/types\";\nimport {\n claimPrincipalMutationJournal,\n clearPrincipalMutationJournal,\n loadPrincipalMutationJournal,\n type PrincipalMutationJournalRow,\n} from \"../../data/persistence/principalMutationJournalPersistence\";\nimport {\n type AuthoredPrincipalMutation,\n openPrincipalMutation,\n type PrincipalMutationJournalScope,\n principalMutationJournalScopeId,\n sealPrincipalMutation,\n} from \"../../data/principals/principalMutationJournal\";\nimport type { ExecSql } from \"../../data/sqlite/sqlSchema\";\nimport { runPrincipalMutationJournalOperation } from \"./principalMutationJournalLane\";\nimport { assertAuthoredPrincipalMutationReceipt } from \"./principalMutationReceipt\";\n\ntype MutationResult = RequestResult<CommitOrganizationGroupPolicyResponse>;\n\nexport interface PrincipalMutationJournalContext {\n readonly execSql: ExecSql;\n readonly scope: PrincipalMutationJournalScope;\n readonly signingKeyPair: SigningKeyPair;\n readonly stillCurrent: () => boolean;\n readonly submit: (\n mutation: AuthoredPrincipalMutation,\n ) => Promise<MutationResult>;\n}\n\nexport class PrincipalMutationOutcomeUnknownError extends Error {\n constructor(options?: ErrorOptions) {\n super(\n \"A saved policy request may have committed; resolve its outcome or explicitly abandon its retry before another mutation\",\n options,\n );\n this.name = \"PrincipalMutationOutcomeUnknownError\";\n }\n}\n\nfunction knownInitialRefusal(result: MutationResult): boolean {\n if (result.ok) return false;\n // ApiClient separates pre-dispatch cancellation from an uncertain sent write.\n if (result.kind === \"cancelled\") return true;\n if (result.kind !== \"http\") return false;\n return (\n [400, 401, 402, 403, 409].includes(result.status ?? 0) ||\n (result.status === 503 &&\n result.code === \"principal_history_preparation_unavailable\")\n );\n}\n\nasync function submitSavedMutation(\n input: PrincipalMutationJournalContext,\n row: PrincipalMutationJournalRow,\n recovering: boolean,\n): Promise<{ mutation: AuthoredPrincipalMutation; result: MutationResult }> {\n const mutation = await openPrincipalMutation({\n scope: input.scope,\n row,\n signingPublicKey: input.signingKeyPair.signingPublicKey,\n });\n assertProjectionVerificationCurrent(input.stillCurrent);\n // Keep the authenticated copy for acknowledgement checks even if a transport\n // mutates its argument while preparing or retrying the HTTP request.\n let result: MutationResult;\n try {\n result = await input.submit(structuredClone(mutation));\n } catch (cause) {\n assertProjectionVerificationCurrent(input.stillCurrent);\n throw new PrincipalMutationOutcomeUnknownError({ cause });\n }\n assertProjectionVerificationCurrent(input.stillCurrent);\n if (result.ok) {\n await assertAuthoredPrincipalMutationReceipt(mutation.request, result.data);\n } else if (recovering || !knownInitialRefusal(result)) {\n // A refusal today (including loss of admin access) cannot establish whether\n // an earlier disconnected attempt committed. Preserve the original intent.\n throw new PrincipalMutationOutcomeUnknownError();\n }\n await clearPrincipalMutationJournal({\n execSql: input.execSql,\n row,\n stillCurrent: input.stillCurrent,\n });\n assertProjectionVerificationCurrent(input.stillCurrent);\n return { mutation, result };\n}\n\n/** No HTTP begins until the exact authored request is durably claimed. */\nexport async function submitJournaledPrincipalMutation(\n input: PrincipalMutationJournalContext & {\n readonly mutation: AuthoredPrincipalMutation;\n },\n): Promise<MutationResult> {\n return runPrincipalMutationJournalOperation(\n input.execSql,\n input.scope,\n async () => {\n assertProjectionVerificationCurrent(input.stillCurrent);\n const row = await sealPrincipalMutation(input);\n await claimPrincipalMutationJournal({\n execSql: input.execSql,\n row,\n stillCurrent: input.stillCurrent,\n });\n return (await submitSavedMutation(input, row, false)).result;\n },\n );\n}\n\n/** Retry only authenticated saved bytes, never an application mutation callback. */\nexport async function recoverJournaledPrincipalMutation(\n input: PrincipalMutationJournalContext,\n): Promise<{\n readonly mutation: AuthoredPrincipalMutation;\n readonly response: CommitOrganizationGroupPolicyResponse;\n} | null> {\n return runPrincipalMutationJournalOperation(\n input.execSql,\n input.scope,\n async () => {\n assertProjectionVerificationCurrent(input.stillCurrent);\n const row = await loadPrincipalMutationJournal(\n input.execSql,\n await principalMutationJournalScopeId(input.scope),\n );\n assertProjectionVerificationCurrent(input.stillCurrent);\n if (!row) return null;\n const { mutation, result } = await submitSavedMutation(input, row, true);\n if (!result.ok) throw new PrincipalMutationOutcomeUnknownError();\n return { mutation, response: result.data };\n },\n );\n}\n"]}
1
+ {"version":3,"file":"principalMutationJournalSession.js","sourceRoot":"","sources":["principalMutationJournalSession.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,GAE7B,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAEL,qBAAqB,EAErB,+BAA+B,EAC/B,qBAAqB,GACtB,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EACL,uCAAuC,GAExC,MAAM,6BAA6B,CAAC;AAcrC,MAAM,OAAO,oCAAqC,SAAQ,KAAK;IAC7D,YAAY,OAAsB;QAChC,KAAK,CACH,wHAAwH,EACxH,OAAO,CACR,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sCAAsC,CAAC;IACrD,CAAC;CACF;AAED,SAAS,mBAAmB,CAAC,MAAsB;IACjD,I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nD,CAAC;QACF,mCAAmC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,EAAE;YAAE,MAAM,IAAI,oCAAoC,EAAE,CAAC;QACjE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RequestResult } from \"@tearleads/api-client\";\nimport type { SigningKeyPair } from \"@tearleads/crypto\";\nimport { assertProjectionVerificationCurrent } from \"../../data/keyingProjectionVerification/types\";\nimport {\n claimPrincipalMutationJournal,\n clearPrincipalMutationJournal,\n loadPrincipalMutationJournal,\n type PrincipalMutationJournalRow,\n} from \"../../data/persistence/principalMutationJournalPersistence\";\nimport {\n type AuthoredPrincipalMutation,\n openPrincipalMutation,\n type PrincipalMutationJournalScope,\n principalMutationJournalScopeId,\n sealPrincipalMutation,\n} from \"../../data/principals/principalMutationJournal\";\nimport type { ExecSql } from \"../../data/sqlite/sqlSchema\";\nimport { runPrincipalMutationJournalOperation } from \"./principalMutationJournalLane\";\nimport {\n assertAuthoredPrincipalOperationReceipt,\n type PrincipalMutationResponse,\n} from \"./principalOperationReceipt\";\n\ntype MutationResult = RequestResult<PrincipalMutationResponse>;\n\nexport interface PrincipalMutationJournalContext {\n readonly execSql: ExecSql;\n readonly scope: PrincipalMutationJournalScope;\n readonly signingKeyPair: SigningKeyPair;\n readonly stillCurrent: () => boolean;\n readonly submit: (\n mutation: AuthoredPrincipalMutation,\n ) => Promise<MutationResult>;\n}\n\nexport class PrincipalMutationOutcomeUnknownError extends Error {\n constructor(options?: ErrorOptions) {\n super(\n \"A saved policy request may have committed; resolve its outcome or explicitly abandon its retry before another mutation\",\n options,\n );\n this.name = \"PrincipalMutationOutcomeUnknownError\";\n }\n}\n\nfunction knownInitialRefusal(result: MutationResult): boolean {\n if (result.ok) return false;\n // ApiClient separates pre-dispatch cancellation from an uncertain sent write.\n if (result.kind === \"cancelled\") return true;\n if (result.kind !== \"http\") return false;\n return (\n [400, 401, 402, 403, 409].includes(result.status ?? 0) ||\n (result.status === 503 &&\n result.code === \"principal_history_preparation_unavailable\")\n );\n}\n\nasync function submitSavedMutation(\n input: PrincipalMutationJournalContext,\n row: PrincipalMutationJournalRow,\n recovering: boolean,\n): Promise<{ mutation: AuthoredPrincipalMutation; result: MutationResult }> {\n const mutation = await openPrincipalMutation({\n scope: input.scope,\n row,\n signingPublicKey: input.signingKeyPair.signingPublicKey,\n });\n assertProjectionVerificationCurrent(input.stillCurrent);\n // Keep the authenticated copy for acknowledgement checks even if a transport\n // mutates its argument while preparing or retrying the HTTP request.\n let result: MutationResult;\n try {\n result = await input.submit(structuredClone(mutation));\n } catch (cause) {\n assertProjectionVerificationCurrent(input.stillCurrent);\n throw new PrincipalMutationOutcomeUnknownError({ cause });\n }\n assertProjectionVerificationCurrent(input.stillCurrent);\n if (result.ok) {\n await assertAuthoredPrincipalOperationReceipt(mutation, result.data);\n } else if (recovering || !knownInitialRefusal(result)) {\n // A refusal today (including loss of admin access) cannot establish whether\n // an earlier disconnected attempt committed. Preserve the original intent.\n throw new PrincipalMutationOutcomeUnknownError();\n }\n await clearPrincipalMutationJournal({\n execSql: input.execSql,\n row,\n stillCurrent: input.stillCurrent,\n });\n assertProjectionVerificationCurrent(input.stillCurrent);\n return { mutation, result };\n}\n\n/** No HTTP begins until the exact authored request is durably claimed. */\nexport async function submitJournaledPrincipalMutation(\n input: PrincipalMutationJournalContext & {\n readonly mutation: AuthoredPrincipalMutation;\n },\n): Promise<MutationResult> {\n return runPrincipalMutationJournalOperation(\n input.execSql,\n input.scope,\n async () => {\n assertProjectionVerificationCurrent(input.stillCurrent);\n const row = await sealPrincipalMutation(input);\n await claimPrincipalMutationJournal({\n execSql: input.execSql,\n row,\n stillCurrent: input.stillCurrent,\n });\n return (await submitSavedMutation(input, row, false)).result;\n },\n );\n}\n\n/** Retry only authenticated saved bytes, never an application mutation callback. */\nexport async function recoverJournaledPrincipalMutation(\n input: PrincipalMutationJournalContext,\n): Promise<{\n readonly mutation: AuthoredPrincipalMutation;\n readonly response: PrincipalMutationResponse;\n} | null> {\n return runPrincipalMutationJournalOperation(\n input.execSql,\n input.scope,\n async () => {\n assertProjectionVerificationCurrent(input.stillCurrent);\n const row = await loadPrincipalMutationJournal(\n input.execSql,\n await principalMutationJournalScopeId(input.scope),\n );\n assertProjectionVerificationCurrent(input.stillCurrent);\n if (!row) return null;\n const { mutation, result } = await submitSavedMutation(input, row, true);\n if (!result.ok) throw new PrincipalMutationOutcomeUnknownError();\n return { mutation, response: result.data };\n },\n );\n}\n"]}
@@ -4,18 +4,19 @@ import { assertPrincipalPolicyReceiptArtifacts } from "./principalPolicyReceiptA
4
4
  /** A past commit acknowledgement is not evidence for advancing current pins. */
5
5
  export async function assertAuthoredPrincipalMutationReceipt(request, response) {
6
6
  for (const part of ["groupPolicy", "organizationPolicy"]) {
7
- const expected = request[part];
8
- const observed = response[part];
9
- const { stateHash, createdAt: _createdAt, ...state } = observed.currentState;
10
- if (stateHash !== (await computePrincipalStateHash(expected.state)) ||
11
- canonicalKeyingJsonString(state, "principal mutation receipt state") !==
12
- canonicalKeyingJsonString(expected.state, "authored principal state"))
13
- throw new Error("Principal mutation receipt state differs from the authored request");
14
- assertPrincipalPolicyReceiptArtifacts({
15
- request: expected,
16
- response: observed,
17
- expectedHead: { ...observed.currentState, stateHash },
18
- });
7
+ await assertAuthoredPrincipalPolicyReceipt(request[part], response[part]);
19
8
  }
20
9
  }
10
+ export async function assertAuthoredPrincipalPolicyReceipt(expected, observed) {
11
+ const { stateHash, createdAt: _createdAt, ...state } = observed.currentState;
12
+ if (stateHash !== (await computePrincipalStateHash(expected.state)) ||
13
+ canonicalKeyingJsonString(state, "principal mutation receipt state") !==
14
+ canonicalKeyingJsonString(expected.state, "authored principal state"))
15
+ throw new Error("Principal mutation receipt state differs from the authored request");
16
+ assertPrincipalPolicyReceiptArtifacts({
17
+ request: expected,
18
+ response: observed,
19
+ expectedHead: { ...observed.currentState, stateHash },
20
+ });
21
+ }
21
22
  //# sourceMappingURL=principalMutationReceipt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"principalMutationReceipt.js","sourceRoot":"","sources":["principalMutationReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,qCAAqC,EAAE,MAAM,mCAAmC,CAAC;AAE1F,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC1D,OAA6C,EAC7C,QAA+C;IAE/C,KAAK,MAAM,IAAI,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAU,EAAE,CAAC;QAClE,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,EACJ,SAAS,EACT,SAAS,EAAE,UAAU,EACrB,GAAG,KAAK,EACT,GAAG,QAAQ,CAAC,YAAY,CAAC;QAC1B,IACE,SAAS,KAAK,CAAC,MAAM,yBAAyB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC/D,yBAAyB,CAAC,KAAK,EAAE,kCAAkC,CAAC;gBAClE,yBAAyB,CAAC,QAAQ,CAAC,KAAK,EAAE,0BAA0B,CAAC;YAEvE,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;QACJ,qCAAqC,CAAC;YACpC,OAAO,EAAE,QAAQ;YACjB,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,SAAS,EAAE;SACtD,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import { computePrincipalStateHash } from \"@tearleads/crypto\";\nimport type { CommitOrganizationGroupPolicyRequest } from \"@tearleads/validators/request\";\nimport type { CommitOrganizationGroupPolicyResponse } from \"@tearleads/validators/response\";\nimport { canonicalKeyingJsonString } from \"../../data/keyingCanonicalJson\";\nimport { assertPrincipalPolicyReceiptArtifacts } from \"./principalPolicyReceiptArtifacts\";\n\n/** A past commit acknowledgement is not evidence for advancing current pins. */\nexport async function assertAuthoredPrincipalMutationReceipt(\n request: CommitOrganizationGroupPolicyRequest,\n response: CommitOrganizationGroupPolicyResponse,\n): Promise<void> {\n for (const part of [\"groupPolicy\", \"organizationPolicy\"] as const) {\n const expected = request[part];\n const observed = response[part];\n const {\n stateHash,\n createdAt: _createdAt,\n ...state\n } = observed.currentState;\n if (\n stateHash !== (await computePrincipalStateHash(expected.state)) ||\n canonicalKeyingJsonString(state, \"principal mutation receipt state\") !==\n canonicalKeyingJsonString(expected.state, \"authored principal state\")\n )\n throw new Error(\n \"Principal mutation receipt state differs from the authored request\",\n );\n assertPrincipalPolicyReceiptArtifacts({\n request: expected,\n response: observed,\n expectedHead: { ...observed.currentState, stateHash },\n });\n }\n}\n"]}
1
+ {"version":3,"file":"principalMutationReceipt.js","sourceRoot":"","sources":["principalMutationReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,qCAAqC,EAAE,MAAM,mCAAmC,CAAC;AAE1F,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC1D,OAA6C,EAC7C,QAA+C;IAE/C,KAAK,MAAM,IAAI,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAU,EAAE,CAAC;QAClE,MAAM,oCAAoC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oCAAoC,CACxD,QAA6D,EAC7D,QAA8D;IAE9D,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC7E,IACE,SAAS,KAAK,CAAC,MAAM,yBAAyB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,yBAAyB,CAAC,KAAK,EAAE,kCAAkC,CAAC;YAClE,yBAAyB,CAAC,QAAQ,CAAC,KAAK,EAAE,0BAA0B,CAAC;QAEvE,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;IACJ,qCAAqC,CAAC;QACpC,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,SAAS,EAAE;KACtD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { computePrincipalStateHash } from \"@tearleads/crypto\";\nimport type { CommitOrganizationGroupPolicyRequest } from \"@tearleads/validators/request\";\nimport type { CommitOrganizationGroupPolicyResponse } from \"@tearleads/validators/response\";\nimport { canonicalKeyingJsonString } from \"../../data/keyingCanonicalJson\";\nimport { assertPrincipalPolicyReceiptArtifacts } from \"./principalPolicyReceiptArtifacts\";\n\n/** A past commit acknowledgement is not evidence for advancing current pins. */\nexport async function assertAuthoredPrincipalMutationReceipt(\n request: CommitOrganizationGroupPolicyRequest,\n response: CommitOrganizationGroupPolicyResponse,\n): Promise<void> {\n for (const part of [\"groupPolicy\", \"organizationPolicy\"] as const) {\n await assertAuthoredPrincipalPolicyReceipt(request[part], response[part]);\n }\n}\n\nexport async function assertAuthoredPrincipalPolicyReceipt(\n expected: CommitOrganizationGroupPolicyRequest[\"groupPolicy\"],\n observed: CommitOrganizationGroupPolicyResponse[\"groupPolicy\"],\n): Promise<void> {\n const { stateHash, createdAt: _createdAt, ...state } = observed.currentState;\n if (\n stateHash !== (await computePrincipalStateHash(expected.state)) ||\n canonicalKeyingJsonString(state, \"principal mutation receipt state\") !==\n canonicalKeyingJsonString(expected.state, \"authored principal state\")\n )\n throw new Error(\n \"Principal mutation receipt state differs from the authored request\",\n );\n assertPrincipalPolicyReceiptArtifacts({\n request: expected,\n response: observed,\n expectedHead: { ...observed.currentState, stateHash },\n });\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { type CommitOrganizationGroupPolicyResponse, type CreateOrganizationGroupResponse, type DeleteOrganizationGroupResponse, type PrincipalPolicyMutationResponse } from "../../internal/validators/response/index.js";
2
+ import type { AuthoredPrincipalMutation } from "../../data/principals/principalMutationJournal.js";
3
+ export type PrincipalMutationResponse = CommitOrganizationGroupPolicyResponse | CreateOrganizationGroupResponse | DeleteOrganizationGroupResponse | PrincipalPolicyMutationResponse;
4
+ /** Match both the operation's route and its exact authored policy artifacts. */
5
+ export declare function assertAuthoredPrincipalOperationReceipt(mutation: AuthoredPrincipalMutation, response: PrincipalMutationResponse): Promise<void>;
@@ -0,0 +1,36 @@
1
+ import { computePrincipalStateHash } from "../../internal/crypto/index.js";
2
+ import { isCommitOrganizationGroupPolicyResponse, isCreateOrganizationGroupResponse, isDeleteOrganizationGroupResponse, isPrincipalPolicyMutationResponse, } from "../../internal/validators/response/index.js";
3
+ import { acknowledgeInitialGroupPolicy } from "./groupPolicyMutationAcknowledgement.js";
4
+ import { assertAuthoredPrincipalMutationReceipt, assertAuthoredPrincipalPolicyReceipt, } from "./principalMutationReceipt.js";
5
+ /** Match both the operation's route and its exact authored policy artifacts. */
6
+ export async function assertAuthoredPrincipalOperationReceipt(mutation, response) {
7
+ switch (mutation.kind) {
8
+ case undefined:
9
+ if (!isCommitOrganizationGroupPolicyResponse(response))
10
+ break;
11
+ return assertAuthoredPrincipalMutationReceipt(mutation.request, response);
12
+ case "organization":
13
+ if (!isPrincipalPolicyMutationResponse(response))
14
+ break;
15
+ return assertAuthoredPrincipalPolicyReceipt(mutation.request, response);
16
+ case "group-create":
17
+ if (!isCreateOrganizationGroupResponse(response))
18
+ break;
19
+ await acknowledgeInitialGroupPolicy({
20
+ organizationId: mutation.request.organizationPolicy.state.principalId,
21
+ request: mutation.request,
22
+ response: response.group,
23
+ stateHash: await computePrincipalStateHash(mutation.request.initialGroupPolicy.state),
24
+ });
25
+ return assertAuthoredPrincipalPolicyReceipt(mutation.request.organizationPolicy, response.organizationPolicy);
26
+ case "group-delete":
27
+ if (!isDeleteOrganizationGroupResponse(response) ||
28
+ response.groupId !== mutation.groupId ||
29
+ response.organizationId !==
30
+ mutation.request.organizationPolicy.state.principalId)
31
+ break;
32
+ return assertAuthoredPrincipalPolicyReceipt(mutation.request.organizationPolicy, response.organizationPolicy);
33
+ }
34
+ throw new Error("Principal mutation receipt operation or target differs");
35
+ }
36
+ //# sourceMappingURL=principalOperationReceipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"principalOperationReceipt.js","sourceRoot":"","sources":["principalOperationReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAIL,uCAAuC,EACvC,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,GAElC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EACL,sCAAsC,EACtC,oCAAoC,GACrC,MAAM,4BAA4B,CAAC;AAQpC,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,uCAAuC,CAC3D,QAAmC,EACnC,QAAmC;IAEnC,QAAQ,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtB,KAAK,SAAS;YACZ,IAAI,CAAC,uCAAuC,CAAC,QAAQ,CAAC;gBAAE,MAAM;YAC9D,OAAO,sCAAsC,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC5E,KAAK,cAAc;YACjB,IAAI,CAAC,iCAAiC,CAAC,QAAQ,CAAC;gBAAE,MAAM;YACxD,OAAO,oCAAoC,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC1E,KAAK,cAAc;YACjB,IAAI,CAAC,iCAAiC,CAAC,QAAQ,CAAC;gBAAE,MAAM;YACxD,MAAM,6BAA6B,CAAC;gBAClC,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW;gBACrE,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,QAAQ,EAAE,QAAQ,CAAC,KAAK;gBACxB,SAAS,EAAE,MAAM,yBAAyB,CACxC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAC1C;aACF,CAAC,CAAC;YACH,OAAO,oCAAoC,CACzC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EACnC,QAAQ,CAAC,kBAAkB,CAC5B,CAAC;QACJ,KAAK,cAAc;YACjB,IACE,CAAC,iCAAiC,CAAC,QAAQ,CAAC;gBAC5C,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO;gBACrC,QAAQ,CAAC,cAAc;oBACrB,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW;gBAEvD,MAAM;YACR,OAAO,oCAAoC,CACzC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EACnC,QAAQ,CAAC,kBAAkB,CAC5B,CAAC;IACN,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import { computePrincipalStateHash } from \"@tearleads/crypto\";\nimport {\n type CommitOrganizationGroupPolicyResponse,\n type CreateOrganizationGroupResponse,\n type DeleteOrganizationGroupResponse,\n isCommitOrganizationGroupPolicyResponse,\n isCreateOrganizationGroupResponse,\n isDeleteOrganizationGroupResponse,\n isPrincipalPolicyMutationResponse,\n type PrincipalPolicyMutationResponse,\n} from \"@tearleads/validators/response\";\nimport type { AuthoredPrincipalMutation } from \"../../data/principals/principalMutationJournal\";\nimport { acknowledgeInitialGroupPolicy } from \"./groupPolicyMutationAcknowledgement\";\nimport {\n assertAuthoredPrincipalMutationReceipt,\n assertAuthoredPrincipalPolicyReceipt,\n} from \"./principalMutationReceipt\";\n\nexport type PrincipalMutationResponse =\n | CommitOrganizationGroupPolicyResponse\n | CreateOrganizationGroupResponse\n | DeleteOrganizationGroupResponse\n | PrincipalPolicyMutationResponse;\n\n/** Match both the operation's route and its exact authored policy artifacts. */\nexport async function assertAuthoredPrincipalOperationReceipt(\n mutation: AuthoredPrincipalMutation,\n response: PrincipalMutationResponse,\n): Promise<void> {\n switch (mutation.kind) {\n case undefined:\n if (!isCommitOrganizationGroupPolicyResponse(response)) break;\n return assertAuthoredPrincipalMutationReceipt(mutation.request, response);\n case \"organization\":\n if (!isPrincipalPolicyMutationResponse(response)) break;\n return assertAuthoredPrincipalPolicyReceipt(mutation.request, response);\n case \"group-create\":\n if (!isCreateOrganizationGroupResponse(response)) break;\n await acknowledgeInitialGroupPolicy({\n organizationId: mutation.request.organizationPolicy.state.principalId,\n request: mutation.request,\n response: response.group,\n stateHash: await computePrincipalStateHash(\n mutation.request.initialGroupPolicy.state,\n ),\n });\n return assertAuthoredPrincipalPolicyReceipt(\n mutation.request.organizationPolicy,\n response.organizationPolicy,\n );\n case \"group-delete\":\n if (\n !isDeleteOrganizationGroupResponse(response) ||\n response.groupId !== mutation.groupId ||\n response.organizationId !==\n mutation.request.organizationPolicy.state.principalId\n )\n break;\n return assertAuthoredPrincipalPolicyReceipt(\n mutation.request.organizationPolicy,\n response.organizationPolicy,\n );\n }\n throw new Error(\"Principal mutation receipt operation or target differs\");\n}\n"]}