@tearleads/client-sdk 0.1.17 → 0.1.18

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 (33) 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/principals/principalMutationJournal.d.ts +2 -5
  7. package/data/principals/principalMutationJournal.js +3 -20
  8. package/data/principals/principalMutationJournal.js.map +1 -1
  9. package/data/principals/principalMutationJournalShape.d.ts +26 -0
  10. package/data/principals/principalMutationJournalShape.js +46 -0
  11. package/data/principals/principalMutationJournalShape.js.map +1 -0
  12. package/index.d.ts +1 -1
  13. package/index.js.map +1 -1
  14. package/internal/api-client/ApiClient.d.ts +267 -3
  15. package/internal/api-client/ApiClient.js +11 -29
  16. package/internal/api-client/ApiClient.js.map +1 -1
  17. package/internal/api-client/principalPolicyRequests.d.ts +266 -1
  18. package/internal/api-client/principalPolicyRequests.js +43 -1
  19. package/internal/api-client/principalPolicyRequests.js.map +1 -1
  20. package/internal/validators/operation/organizations.d.ts +54 -0
  21. package/internal/validators/operation/organizations.js +19 -4
  22. package/internal/validators/operation/organizations.js.map +1 -1
  23. package/package.json +1 -1
  24. package/workflows/organizations/index.d.ts +1 -0
  25. package/workflows/organizations/index.js.map +1 -1
  26. package/workflows/organizations/principalMutationJournalSession.d.ts +3 -3
  27. package/workflows/organizations/principalMutationJournalSession.js +2 -2
  28. package/workflows/organizations/principalMutationJournalSession.js.map +1 -1
  29. package/workflows/organizations/principalMutationReceipt.js +13 -12
  30. package/workflows/organizations/principalMutationReceipt.js.map +1 -1
  31. package/workflows/organizations/principalOperationReceipt.d.ts +5 -0
  32. package/workflows/organizations/principalOperationReceipt.js +36 -0
  33. package/workflows/organizations/principalOperationReceipt.js.map +1 -0
@@ -1,4 +1,4 @@
1
- import type { CommitOrganizationGroupPolicyRequest, OrganizationPrincipalPolicyRequest } from "../validators/request/index.js";
1
+ import type { CommitOrganizationGroupPolicyRequest, CreateOrganizationGroupWithPolicyRequest, DeleteOrganizationGroupRequest, OrganizationPrincipalPolicyRequest } from "../validators/request/index.js";
2
2
  import type { PrincipalPolicyBundleResponse } from "../validators/response/index.js";
3
3
  import type { BoundedCache } from "./ApiCache.js";
4
4
  import type { ApiRequestRuntime } from "./apiRequestRuntime.js";
@@ -550,6 +550,271 @@ export declare class PrincipalPolicyRequests {
550
550
  version: number;
551
551
  };
552
552
  }>>;
553
+ createResult(organizationId: string, input: CreateOrganizationGroupWithPolicyRequest, options?: RequestResultOptions): Promise<import("./types.js").RequestResult<{
554
+ group: {
555
+ createdAt: string;
556
+ currentState: {
557
+ keyEpoch: number;
558
+ keyFingerprint: string;
559
+ memberCount: number;
560
+ stateHash: string;
561
+ version: number;
562
+ } | null;
563
+ groupId: string;
564
+ isBuiltin: boolean;
565
+ organizationId: string;
566
+ };
567
+ organizationPolicy: {
568
+ containerMutations: {
569
+ createdAt: string;
570
+ manifestHead: {
571
+ epoch: number;
572
+ manifestHash: string;
573
+ };
574
+ organizationId: string;
575
+ parentId: string | null;
576
+ referencedPrincipalHeads: {
577
+ principalType: "group";
578
+ keyEpoch: number;
579
+ keyFingerprint: string;
580
+ principalId: string;
581
+ stateHash: string;
582
+ version: number;
583
+ }[];
584
+ updatedAt: string;
585
+ accessManifest: {
586
+ event: {
587
+ body: unknown;
588
+ event: Record<string, unknown>;
589
+ eventHash: string;
590
+ };
591
+ manifest: Record<string, unknown>;
592
+ manifestHash: string;
593
+ state: Record<string, unknown>;
594
+ };
595
+ containerId: string;
596
+ containerKek: {
597
+ accessManifestHash: string;
598
+ containerId: string;
599
+ containerKeyEpoch: number;
600
+ containerKeyEpochId: string;
601
+ containerManifestHistory: {
602
+ event: {
603
+ body: unknown;
604
+ event: Record<string, unknown>;
605
+ eventHash: string;
606
+ };
607
+ manifest: Record<string, unknown>;
608
+ manifestHash: string;
609
+ state: Record<string, unknown>;
610
+ }[];
611
+ keyEpoch: Record<string, unknown>;
612
+ keyEpochHash: string;
613
+ keyring: {
614
+ containerId: string;
615
+ containerKeyEpochId: string;
616
+ iv: string;
617
+ sealed: string;
618
+ sealingSuite: string;
619
+ version: number;
620
+ } | null;
621
+ keyTargetHash: string;
622
+ parentContainerKeyEpochId: string | null;
623
+ recipientTargets: Record<string, unknown>[];
624
+ wraps: Record<string, unknown>[];
625
+ };
626
+ systemSlot?: string | null | undefined;
627
+ }[];
628
+ currentGrants: {
629
+ accessLevel: "admin" | "read" | "write";
630
+ containerId: string;
631
+ }[];
632
+ currentMemberEnvelopes: {
633
+ envelopes: {
634
+ kemCipherText: string;
635
+ memberKeyFingerprint: string;
636
+ userId: string;
637
+ wrappedKey: string;
638
+ }[];
639
+ epoch: number;
640
+ principalId: string;
641
+ principalType: "group" | "organization";
642
+ stateHash: string;
643
+ };
644
+ currentPayload: {
645
+ cipherSuite: "aes-256-gcm";
646
+ ciphertext: string;
647
+ ciphertextHash: string;
648
+ createdAt: string;
649
+ principalId: string;
650
+ principalType: "group" | "organization";
651
+ stateHash: string;
652
+ };
653
+ currentProjection: {
654
+ role: "member" | "admin";
655
+ userId: string;
656
+ }[];
657
+ currentState: {
658
+ createdAt: string;
659
+ encapsulationPublicKey: string;
660
+ externalAuthority: {
661
+ keyEpoch: number;
662
+ keyFingerprint: string;
663
+ principalId: string;
664
+ principalType: "group";
665
+ stateHash: string;
666
+ version: number;
667
+ } | null;
668
+ grantCount: number;
669
+ grantRoot: string;
670
+ keyEpoch: number;
671
+ keyFingerprint: string;
672
+ memberCount: number;
673
+ memberEnvelopesRoot: string;
674
+ membershipMode: "projection";
675
+ membershipRoot: string;
676
+ payloadCiphertextHash: string;
677
+ prevStateHash: string | null;
678
+ principalId: string;
679
+ principalType: "group" | "organization";
680
+ projectionRoot: string;
681
+ signature: string;
682
+ signedAt: string;
683
+ signerUserId: string;
684
+ signerUserKeyFingerprint: string;
685
+ stateHash: string;
686
+ version: number;
687
+ };
688
+ };
689
+ }>>;
690
+ deleteResult(organizationId: string, groupId: string, input: DeleteOrganizationGroupRequest, options?: RequestResultOptions): Promise<import("./types.js").RequestResult<{
691
+ deleted: true;
692
+ groupId: string;
693
+ organizationPolicy: {
694
+ containerMutations: {
695
+ createdAt: string;
696
+ manifestHead: {
697
+ epoch: number;
698
+ manifestHash: string;
699
+ };
700
+ organizationId: string;
701
+ parentId: string | null;
702
+ referencedPrincipalHeads: {
703
+ principalType: "group";
704
+ keyEpoch: number;
705
+ keyFingerprint: string;
706
+ principalId: string;
707
+ stateHash: string;
708
+ version: number;
709
+ }[];
710
+ updatedAt: string;
711
+ accessManifest: {
712
+ event: {
713
+ body: unknown;
714
+ event: Record<string, unknown>;
715
+ eventHash: string;
716
+ };
717
+ manifest: Record<string, unknown>;
718
+ manifestHash: string;
719
+ state: Record<string, unknown>;
720
+ };
721
+ containerId: string;
722
+ containerKek: {
723
+ accessManifestHash: string;
724
+ containerId: string;
725
+ containerKeyEpoch: number;
726
+ containerKeyEpochId: string;
727
+ containerManifestHistory: {
728
+ event: {
729
+ body: unknown;
730
+ event: Record<string, unknown>;
731
+ eventHash: string;
732
+ };
733
+ manifest: Record<string, unknown>;
734
+ manifestHash: string;
735
+ state: Record<string, unknown>;
736
+ }[];
737
+ keyEpoch: Record<string, unknown>;
738
+ keyEpochHash: string;
739
+ keyring: {
740
+ containerId: string;
741
+ containerKeyEpochId: string;
742
+ iv: string;
743
+ sealed: string;
744
+ sealingSuite: string;
745
+ version: number;
746
+ } | null;
747
+ keyTargetHash: string;
748
+ parentContainerKeyEpochId: string | null;
749
+ recipientTargets: Record<string, unknown>[];
750
+ wraps: Record<string, unknown>[];
751
+ };
752
+ systemSlot?: string | null | undefined;
753
+ }[];
754
+ currentGrants: {
755
+ accessLevel: "admin" | "read" | "write";
756
+ containerId: string;
757
+ }[];
758
+ currentMemberEnvelopes: {
759
+ envelopes: {
760
+ kemCipherText: string;
761
+ memberKeyFingerprint: string;
762
+ userId: string;
763
+ wrappedKey: string;
764
+ }[];
765
+ epoch: number;
766
+ principalId: string;
767
+ principalType: "group" | "organization";
768
+ stateHash: string;
769
+ };
770
+ currentPayload: {
771
+ cipherSuite: "aes-256-gcm";
772
+ ciphertext: string;
773
+ ciphertextHash: string;
774
+ createdAt: string;
775
+ principalId: string;
776
+ principalType: "group" | "organization";
777
+ stateHash: string;
778
+ };
779
+ currentProjection: {
780
+ role: "member" | "admin";
781
+ userId: string;
782
+ }[];
783
+ currentState: {
784
+ createdAt: string;
785
+ encapsulationPublicKey: string;
786
+ externalAuthority: {
787
+ keyEpoch: number;
788
+ keyFingerprint: string;
789
+ principalId: string;
790
+ principalType: "group";
791
+ stateHash: string;
792
+ version: number;
793
+ } | null;
794
+ grantCount: number;
795
+ grantRoot: string;
796
+ keyEpoch: number;
797
+ keyFingerprint: string;
798
+ memberCount: number;
799
+ memberEnvelopesRoot: string;
800
+ membershipMode: "projection";
801
+ membershipRoot: string;
802
+ payloadCiphertextHash: string;
803
+ prevStateHash: string | null;
804
+ principalId: string;
805
+ principalType: "group" | "organization";
806
+ projectionRoot: string;
807
+ signature: string;
808
+ signedAt: string;
809
+ signerUserId: string;
810
+ signerUserKeyFingerprint: string;
811
+ stateHash: string;
812
+ version: number;
813
+ };
814
+ };
815
+ organizationId: string;
816
+ }>>;
817
+ private groupMutation;
553
818
  commitResult(organizationId: string, groupId: string, input: CommitOrganizationGroupPolicyRequest, options?: RequestResultOptions): Promise<import("./types.js").RequestResult<{
554
819
  groupPolicy: {
555
820
  containerMutations: {
@@ -1,8 +1,10 @@
1
- import { commitOrganizationGroupPolicyOperation, putPrincipalPolicyOperation, } from "../validators/operation/index.js";
1
+ import { commitOrganizationGroupPolicyOperation, createOrganizationGroupOperation, deleteOrganizationGroupOperation, putPrincipalPolicyOperation, } from "../validators/operation/index.js";
2
2
  import { principalHistoryRequest } from "./principalHistoryRequest.js";
3
3
  import { collectPrincipalPolicyPages, readPrincipalPolicyPages, } from "./principalPolicyPages.js";
4
4
  import { readProjectionPolicyHistoryPages } from "./projectionPolicyHistoryPages.js";
5
5
  import { dedupedRequest } from "./requestInternals.js";
6
+ import { createOrganizationGroup } from "./routes/organizations/createGroup.js";
7
+ import { deleteOrganizationGroup } from "./routes/organizations/deleteGroup.js";
6
8
  import { commitOrganizationGroupPolicy, putPrincipalPolicy, } from "./routes/principals/policy.js";
7
9
  export class PrincipalPolicyRequests {
8
10
  runtime;
@@ -45,6 +47,46 @@ export class PrincipalPolicyRequests {
45
47
  operation: putPrincipalPolicyOperation,
46
48
  }).finally(() => this.cache.delete(key));
47
49
  }
50
+ createResult(organizationId, input, options = {}) {
51
+ return this.groupMutation(organizationId, input.groupId, () => principalHistoryRequest(this.runtime, {
52
+ path: createOrganizationGroup.path(organizationId),
53
+ validator: createOrganizationGroup.isResponse,
54
+ method: createOrganizationGroup.method,
55
+ body: JSON.stringify(input),
56
+ options: {
57
+ expectedPaymentRequiredOrganizationId: organizationId,
58
+ ...options,
59
+ },
60
+ operation: createOrganizationGroupOperation,
61
+ }));
62
+ }
63
+ deleteResult(organizationId, groupId, input, options = {}) {
64
+ return this.groupMutation(organizationId, groupId, () => principalHistoryRequest(this.runtime, {
65
+ path: deleteOrganizationGroup.path(organizationId, groupId),
66
+ validator: deleteOrganizationGroup.isResponse,
67
+ method: deleteOrganizationGroup.method,
68
+ body: JSON.stringify(input),
69
+ options: {
70
+ expectedPaymentRequiredOrganizationId: organizationId,
71
+ ...options,
72
+ },
73
+ operation: deleteOrganizationGroupOperation,
74
+ }));
75
+ }
76
+ async groupMutation(organizationId, groupId, request) {
77
+ const groupKey = JSON.stringify(["group", groupId]);
78
+ const organizationKey = JSON.stringify(["organization", organizationId]);
79
+ this.cache.delete(groupKey);
80
+ this.cache.delete(organizationKey);
81
+ try {
82
+ return await request();
83
+ }
84
+ finally {
85
+ this.cache.delete(groupKey);
86
+ this.cache.delete(organizationKey);
87
+ this.clearWriterProjectionCaches();
88
+ }
89
+ }
48
90
  async commitResult(organizationId, groupId, input, options = {}) {
49
91
  const groupKey = JSON.stringify(["group", groupId]);
50
92
  const organizationKey = JSON.stringify(["organization", organizationId]);
@@ -1 +1 @@
1
- {"version":3,"file":"principalPolicyRequests.js","sourceRoot":"","sources":["principalPolicyRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,2BAA2B,EAE3B,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,6BAA6B,EAC7B,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAGpC,MAAM,OAAO,uBAAuB;IAEf;IACA;IAGA;IALnB,YACmB,OAA0B,EAC1B,KAEhB,EACgB,2BAAuC;QAJvC,YAAO,GAAP,OAAO,CAAmB;QAC1B,UAAK,GAAL,KAAK,CAErB;QACgB,gCAA2B,GAA3B,2BAA2B,CAAY;IACvD,CAAC;IAEJ,WAAW,CACT,MAA8D,EAC9D,UAAkE,EAAE;QAEpE,OAAO,gCAAgC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CACH,aAAuC,EACvC,WAAmB,EACnB,UAA0C,EAAE;QAE5C,OAAO,wBAAwB,CAC7B,IAAI,CAAC,OAAO,EACZ,aAAa,EACb,WAAW,EACX,OAAO,CACR,CAAC;IACJ,CAAC;IAED,GAAG,CACD,aAAuC,EACvC,WAAmB,EACnB,UAAgC,EAAE;QAElC,MAAM,OAAO,GAAG,GAAG,EAAE,CACnB,2BAA2B,CACzB,IAAI,CAAC,OAAO,EACZ,aAAa,EACb,WAAW,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,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,cAAsB,EACtB,OAAe,EACf,KAA2C,EAC3C,UAAgC,EAAE;QAElC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACnC,IAAI,CAAC;YACH,OAAO,MAAM,uBAAuB,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjD,IAAI,EAAE,6BAA6B,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;gBACjE,SAAS,EAAE,6BAA6B,CAAC,UAAU;gBACnD,MAAM,EAAE,6BAA6B,CAAC,MAAM;gBAC5C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC3B,OAAO,EAAE;oBACP,qCAAqC,EAAE,cAAc;oBACrD,GAAG,OAAO;iBACX;gBACD,SAAS,EAAE,sCAAsC;aAClD,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;YACnC,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACrC,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n commitOrganizationGroupPolicyOperation,\n putPrincipalPolicyOperation,\n} from \"@tearleads/validators/operation\";\nimport type {\n CommitOrganizationGroupPolicyRequest,\n OrganizationPrincipalPolicyRequest,\n} from \"@tearleads/validators/request\";\nimport type { PrincipalPolicyBundleResponse } from \"@tearleads/validators/response\";\nimport type { BoundedCache } from \"./ApiCache\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport {\n collectPrincipalPolicyPages,\n type PrincipalPolicyPageReadOptions,\n readPrincipalPolicyPages,\n} from \"./principalPolicyPages\";\nimport { readProjectionPolicyHistoryPages } from \"./projectionPolicyHistoryPages\";\nimport { dedupedRequest } from \"./requestInternals\";\nimport {\n commitOrganizationGroupPolicy,\n putPrincipalPolicy,\n} from \"./routes/principals/policy\";\nimport type { RequestResultOptions } from \"./types\";\n\nexport class PrincipalPolicyRequests {\n constructor(\n private readonly runtime: ApiRequestRuntime,\n private readonly cache: BoundedCache<\n Promise<PrincipalPolicyBundleResponse | null>\n >,\n private readonly clearWriterProjectionCaches: () => void,\n ) {}\n\n publicPages(\n source: Parameters<typeof readProjectionPolicyHistoryPages>[1],\n options: Parameters<typeof readProjectionPolicyHistoryPages>[2] = {},\n ) {\n return readProjectionPolicyHistoryPages(this.runtime, source, options);\n }\n\n pages(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions = {},\n ) {\n return readPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n get(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: RequestResultOptions = {},\n ) {\n const request = () =>\n collectPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n const key = JSON.stringify([principalType, principalId]);\n // Cancellation, reporting and renewal preferences belong to their caller.\n return Object.keys(options).length > 0\n ? request()\n : dedupedRequest(this.cache, key, request);\n }\n\n put(...args: Parameters<PrincipalPolicyRequests[\"putResult\"]>) {\n return this.putResult(...args).then((result) =>\n result.ok ? result.data : null,\n );\n }\n\n putResult(\n principalType: \"organization\",\n principalId: string,\n input: OrganizationPrincipalPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const key = JSON.stringify([principalType, principalId]);\n this.cache.delete(key);\n return principalHistoryRequest(this.runtime, {\n path: putPrincipalPolicy.path(principalType, principalId),\n validator: putPrincipalPolicy.isResponse,\n method: putPrincipalPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: principalId,\n ...options,\n },\n operation: putPrincipalPolicyOperation,\n }).finally(() => this.cache.delete(key));\n }\n\n async commitResult(\n organizationId: string,\n groupId: string,\n input: CommitOrganizationGroupPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await principalHistoryRequest(this.runtime, {\n path: commitOrganizationGroupPolicy.path(organizationId, groupId),\n validator: commitOrganizationGroupPolicy.isResponse,\n method: commitOrganizationGroupPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: commitOrganizationGroupPolicyOperation,\n });\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"principalPolicyRequests.js","sourceRoot":"","sources":["principalPolicyRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,gCAAgC,EAChC,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AAUzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,2BAA2B,EAE3B,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACL,6BAA6B,EAC7B,kBAAkB,GACnB,MAAM,4BAA4B,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AAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACnC,IAAI,CAAC;YACH,OAAO,MAAM,uBAAuB,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjD,IAAI,EAAE,6BAA6B,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;gBACjE,SAAS,EAAE,6BAA6B,CAAC,UAAU;gBACnD,MAAM,EAAE,6BAA6B,CAAC,MAAM;gBAC5C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC3B,OAAO,EAAE;oBACP,qCAAqC,EAAE,cAAc;oBACrD,GAAG,OAAO;iBACX;gBACD,SAAS,EAAE,sCAAsC;aAClD,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;YACnC,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACrC,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n commitOrganizationGroupPolicyOperation,\n createOrganizationGroupOperation,\n deleteOrganizationGroupOperation,\n putPrincipalPolicyOperation,\n} from \"@tearleads/validators/operation\";\nimport type {\n CommitOrganizationGroupPolicyRequest,\n CreateOrganizationGroupWithPolicyRequest,\n DeleteOrganizationGroupRequest,\n OrganizationPrincipalPolicyRequest,\n} from \"@tearleads/validators/request\";\nimport type { PrincipalPolicyBundleResponse } from \"@tearleads/validators/response\";\nimport type { BoundedCache } from \"./ApiCache\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport {\n collectPrincipalPolicyPages,\n type PrincipalPolicyPageReadOptions,\n readPrincipalPolicyPages,\n} from \"./principalPolicyPages\";\nimport { readProjectionPolicyHistoryPages } from \"./projectionPolicyHistoryPages\";\nimport { dedupedRequest } from \"./requestInternals\";\nimport { createOrganizationGroup } from \"./routes/organizations/createGroup\";\nimport { deleteOrganizationGroup } from \"./routes/organizations/deleteGroup\";\nimport {\n commitOrganizationGroupPolicy,\n putPrincipalPolicy,\n} from \"./routes/principals/policy\";\nimport type { RequestResultOptions } from \"./types\";\n\nexport class PrincipalPolicyRequests {\n constructor(\n private readonly runtime: ApiRequestRuntime,\n private readonly cache: BoundedCache<\n Promise<PrincipalPolicyBundleResponse | null>\n >,\n private readonly clearWriterProjectionCaches: () => void,\n ) {}\n\n publicPages(\n source: Parameters<typeof readProjectionPolicyHistoryPages>[1],\n options: Parameters<typeof readProjectionPolicyHistoryPages>[2] = {},\n ) {\n return readProjectionPolicyHistoryPages(this.runtime, source, options);\n }\n\n pages(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions = {},\n ) {\n return readPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n get(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: RequestResultOptions = {},\n ) {\n const request = () =>\n collectPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n const key = JSON.stringify([principalType, principalId]);\n // Cancellation, reporting and renewal preferences belong to their caller.\n return Object.keys(options).length > 0\n ? request()\n : dedupedRequest(this.cache, key, request);\n }\n\n put(...args: Parameters<PrincipalPolicyRequests[\"putResult\"]>) {\n return this.putResult(...args).then((result) =>\n result.ok ? result.data : null,\n );\n }\n\n putResult(\n principalType: \"organization\",\n principalId: string,\n input: OrganizationPrincipalPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const key = JSON.stringify([principalType, principalId]);\n this.cache.delete(key);\n return principalHistoryRequest(this.runtime, {\n path: putPrincipalPolicy.path(principalType, principalId),\n validator: putPrincipalPolicy.isResponse,\n method: putPrincipalPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: principalId,\n ...options,\n },\n operation: putPrincipalPolicyOperation,\n }).finally(() => this.cache.delete(key));\n }\n\n createResult(\n organizationId: string,\n input: CreateOrganizationGroupWithPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, input.groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: createOrganizationGroup.path(organizationId),\n validator: createOrganizationGroup.isResponse,\n method: createOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: createOrganizationGroupOperation,\n }),\n );\n }\n\n deleteResult(\n organizationId: string,\n groupId: string,\n input: DeleteOrganizationGroupRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: deleteOrganizationGroup.path(organizationId, groupId),\n validator: deleteOrganizationGroup.isResponse,\n method: deleteOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: deleteOrganizationGroupOperation,\n }),\n );\n }\n\n private async groupMutation<T>(\n organizationId: string,\n groupId: string,\n request: () => Promise<T>,\n ): Promise<T> {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await request();\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n\n async commitResult(\n organizationId: string,\n groupId: string,\n input: CommitOrganizationGroupPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await principalHistoryRequest(this.runtime, {\n path: commitOrganizationGroupPolicy.path(organizationId, groupId),\n validator: commitOrganizationGroupPolicy.isResponse,\n method: commitOrganizationGroupPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: commitOrganizationGroupPolicyOperation,\n });\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n}\n"]}
@@ -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",