@tearleads/client-sdk 0.1.16 → 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.
- package/client/index.d.ts +1 -1
- package/client/index.js.map +1 -1
- package/client/organizations/currentPrincipalMutations.js +96 -0
- package/client/organizations/currentPrincipalMutations.js.map +1 -0
- package/client/organizations/index.d.ts +1 -1
- package/client/organizations/index.js +4 -3
- package/client/organizations/index.js.map +1 -1
- package/client/organizations/organizationGroupHistory.js +44 -0
- package/client/organizations/organizationGroupHistory.js.map +1 -0
- package/client/organizations/organizationGroupNameHydration.js +7 -1
- package/client/organizations/organizationGroupNameHydration.js.map +1 -1
- package/client/organizations/organizationGroupPresentation.d.ts +1 -0
- package/client/organizations/organizationGroupPresentation.js +16 -2
- package/client/organizations/organizationGroupPresentation.js.map +1 -1
- package/client/organizations/organizationReadModels.d.ts +1 -1
- package/client/organizations/organizationReadModels.js +11 -1
- package/client/organizations/organizationReadModels.js.map +1 -1
- package/client/organizations/organizationsTypes.d.ts +8 -5
- package/client/organizations/organizationsTypes.js.map +1 -1
- package/client/organizations/principalContainerMutations.js +2 -0
- package/client/organizations/principalContainerMutations.js.map +1 -1
- package/client/organizations/principalMutations.d.ts +4 -308
- package/client/organizations/principalMutations.js +165 -87
- package/client/organizations/principalMutations.js.map +1 -1
- package/client/principalMutationApi.d.ts +1 -1
- package/client/principalMutationApi.js +5 -13
- package/client/principalMutationApi.js.map +1 -1
- package/client/principalMutationDispatch.js +54 -0
- package/client/principalMutationDispatch.js.map +1 -0
- package/data/persistence/principalCurrentAcknowledgementPersistence.d.ts +2 -2
- package/data/persistence/principalCurrentAcknowledgementPersistence.js +21 -14
- package/data/persistence/principalCurrentAcknowledgementPersistence.js.map +1 -1
- package/data/principals/currentPolicyReferenceResolver.js +2 -0
- package/data/principals/currentPolicyReferenceResolver.js.map +1 -0
- package/data/principals/principalHistoryScopeProtection.js +23 -0
- package/data/principals/principalHistoryScopeProtection.js.map +1 -0
- package/data/principals/principalMutationJournal.d.ts +2 -5
- package/data/principals/principalMutationJournal.js +3 -20
- package/data/principals/principalMutationJournal.js.map +1 -1
- package/data/principals/principalMutationJournalShape.d.ts +26 -0
- package/data/principals/principalMutationJournalShape.js +46 -0
- package/data/principals/principalMutationJournalShape.js.map +1 -0
- package/data/principals/principalPolicyAdminSigners.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +267 -3
- package/internal/api-client/ApiClient.js +11 -29
- package/internal/api-client/ApiClient.js.map +1 -1
- package/internal/api-client/principalPolicyRequests.d.ts +266 -1
- package/internal/api-client/principalPolicyRequests.js +43 -1
- package/internal/api-client/principalPolicyRequests.js.map +1 -1
- package/internal/crypto/index.d.ts +1 -1
- package/internal/crypto/index.js +1 -1
- package/internal/crypto/index.js.map +1 -1
- package/internal/crypto/keying/index.d.ts +1 -0
- package/internal/crypto/keying/index.js +1 -0
- package/internal/crypto/keying/index.js.map +1 -1
- package/internal/crypto/keying/principalPolicyCurrentPredecessorReferences.d.ts +8 -0
- package/internal/crypto/keying/principalPolicyCurrentPredecessorReferences.js +46 -0
- package/internal/crypto/keying/principalPolicyCurrentPredecessorReferences.js.map +1 -0
- package/internal/validators/operation/organizations.d.ts +54 -0
- package/internal/validators/operation/organizations.js +19 -4
- package/internal/validators/operation/organizations.js.map +1 -1
- package/package.json +1 -1
- package/workflows/containers/child/carriedDescendantRekeys.js +9 -1
- package/workflows/containers/child/carriedDescendantRekeys.js.map +1 -1
- package/workflows/containers/child/replacementPrincipalPolicyReferences.js +19 -0
- package/workflows/containers/child/replacementPrincipalPolicyReferences.js.map +1 -0
- package/workflows/organizations/commitCurrentGroupPolicyMutation.js +72 -0
- package/workflows/organizations/commitCurrentGroupPolicyMutation.js.map +1 -0
- package/workflows/organizations/createCurrentOrganizationGroup.js +85 -0
- package/workflows/organizations/createCurrentOrganizationGroup.js.map +1 -0
- package/workflows/organizations/currentGroupMetadataAuthority.js +24 -3
- package/workflows/organizations/currentGroupMetadataAuthority.js.map +1 -1
- package/workflows/organizations/currentGroupMutationReferences.js +35 -0
- package/workflows/organizations/currentGroupMutationReferences.js.map +1 -0
- package/workflows/organizations/currentGroupPolicyMutationContext.js +79 -0
- package/workflows/organizations/currentGroupPolicyMutationContext.js.map +1 -0
- package/workflows/organizations/currentOrganizationGroupNames.js +5 -1
- package/workflows/organizations/currentOrganizationGroupNames.js.map +1 -1
- package/workflows/organizations/currentOrganizationMutationAuthority.js +16 -0
- package/workflows/organizations/currentOrganizationMutationAuthority.js.map +1 -0
- package/workflows/organizations/currentOrganizationMutationRetention.js +53 -0
- package/workflows/organizations/currentOrganizationMutationRetention.js.map +1 -0
- package/workflows/organizations/currentPrincipalMutationLease.js +38 -0
- package/workflows/organizations/currentPrincipalMutationLease.js.map +1 -0
- package/workflows/organizations/deleteCurrentOrganizationGroup.js +35 -0
- package/workflows/organizations/deleteCurrentOrganizationGroup.js.map +1 -0
- package/workflows/organizations/deleteOrganizationGroup.d.ts +1 -0
- package/workflows/organizations/deleteOrganizationGroup.js +10 -0
- package/workflows/organizations/deleteOrganizationGroup.js.map +1 -1
- package/workflows/organizations/groupCreation.d.ts +1 -0
- package/workflows/organizations/groupCreation.js +8 -0
- package/workflows/organizations/groupCreation.js.map +1 -1
- package/workflows/organizations/groupMembershipName.d.ts +1 -1
- package/workflows/organizations/groupMembershipName.js.map +1 -1
- package/workflows/organizations/groupMetadataRuntime.js +14 -9
- package/workflows/organizations/groupMetadataRuntime.js.map +1 -1
- package/workflows/organizations/groupNameUniqueness.js +1 -1
- package/workflows/organizations/groupNameUniqueness.js.map +1 -1
- package/workflows/organizations/groupPolicyHistoryPage.js +31 -0
- package/workflows/organizations/groupPolicyHistoryPage.js.map +1 -0
- package/workflows/organizations/groupPolicyMutationAcknowledgement.js +1 -0
- package/workflows/organizations/groupPolicyMutationAcknowledgement.js.map +1 -1
- package/workflows/organizations/groupPolicyMutationContext.d.ts +18 -0
- package/workflows/organizations/groupPolicyMutationContext.js +1 -1
- package/workflows/organizations/groupPolicyMutationContext.js.map +1 -1
- package/workflows/organizations/index.d.ts +1 -0
- package/workflows/organizations/index.js.map +1 -1
- package/workflows/organizations/initialPrincipalCurrentPublication.js +83 -0
- package/workflows/organizations/initialPrincipalCurrentPublication.js.map +1 -0
- package/workflows/organizations/organizationGroupDirectory.js +6 -0
- package/workflows/organizations/organizationGroupDirectory.js.map +1 -1
- package/workflows/organizations/organizationGroupNames.js.map +1 -1
- package/workflows/organizations/policyHistoryTypes.d.ts +2 -0
- package/workflows/organizations/policyHistoryTypes.js.map +1 -1
- package/workflows/organizations/principalContainerRematerialization.js +12 -2
- package/workflows/organizations/principalContainerRematerialization.js.map +1 -1
- package/workflows/organizations/principalContainerRematerializationPlanning.js +1 -0
- package/workflows/organizations/principalContainerRematerializationPlanning.js.map +1 -1
- package/workflows/organizations/principalContainerRematerializationTargets.js.map +1 -1
- package/workflows/organizations/principalMutationJournalSession.d.ts +3 -3
- package/workflows/organizations/principalMutationJournalSession.js +2 -2
- package/workflows/organizations/principalMutationJournalSession.js.map +1 -1
- package/workflows/organizations/principalMutationReceipt.js +13 -12
- package/workflows/organizations/principalMutationReceipt.js.map +1 -1
- package/workflows/organizations/principalOperationReceipt.d.ts +5 -0
- package/workflows/organizations/principalOperationReceipt.js +36 -0
- package/workflows/organizations/principalOperationReceipt.js.map +1 -0
- package/workflows/organizations/retainAcknowledgedPrincipalCurrents.d.ts +2 -0
- package/workflows/organizations/retainAcknowledgedPrincipalCurrents.js +5 -1
- package/workflows/organizations/retainAcknowledgedPrincipalCurrents.js.map +1 -1
- package/workflows/organizations/runtimeCurrentGroupMutation.js +85 -0
- package/workflows/organizations/runtimeCurrentGroupMutation.js.map +1 -0
- package/workflows/organizations/runtimeCurrentOrganizationMutation.js +48 -0
- package/workflows/organizations/runtimeCurrentOrganizationMutation.js.map +1 -0
- package/workflows/principals/loadRecoveredPrincipalHistoryPage.d.ts +11 -0
- package/workflows/principals/loadRecoveredPrincipalHistoryPage.js +120 -0
- package/workflows/principals/loadRecoveredPrincipalHistoryPage.js.map +1 -0
- package/workflows/principals/principalHistoryRecoveryReferences.js +8 -0
- package/workflows/principals/principalHistoryRecoveryReferences.js.map +1 -1
- package/workflows/principals/principalRecoveryDirectory.js +3 -8
- package/workflows/principals/principalRecoveryDirectory.js.map +1 -1
- package/workflows/principals/principalRecoveryLocalPreference.js +3 -2
- package/workflows/principals/principalRecoveryLocalPreference.js.map +1 -1
- package/workflows/principals/recoverCurrentOrganizationPolicy.js.map +1 -1
- package/workflows/principals/recoverPrincipalHistoryPage.js +30 -0
- package/workflows/principals/recoverPrincipalHistoryPage.js.map +1 -0
- package/workflows/principals/recoverPrincipalPolicyHistory.d.ts +2 -0
- package/workflows/principals/recoverPrincipalPolicyHistory.js +14 -2
- package/workflows/principals/recoverPrincipalPolicyHistory.js.map +1 -1
- package/workflows/principals/recoverScopedPrincipalPolicyHistory.d.ts +6 -0
- package/workflows/principals/recoverScopedPrincipalPolicyHistory.js +31 -19
- package/workflows/principals/recoverScopedPrincipalPolicyHistory.js.map +1 -1
- package/workflows/principals/runtimePolicyRecovery.js +25 -4
- package/workflows/principals/runtimePolicyRecovery.js.map +1 -1
- package/workflows/principals/runtimePolicyWarmer.js +2 -2
- package/workflows/principals/runtimePolicyWarmer.js.map +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { issueVerifiedPrincipalPolicyCurrent, ownVerifiedPrincipalPolicyCurrent, } from "./principalPolicyCurrentEvidence.js";
|
|
2
|
+
import { normalizePrincipalHistoryInput } from "./principalPolicyHistoryChecks.js";
|
|
3
|
+
import { principalPolicyStateMatchesReference } from "./principalPolicyReference.js";
|
|
4
|
+
import { ok, throwVerification, toVerificationResult } from "./shared.js";
|
|
5
|
+
/** Carry selected authenticated citations across one privately verified successor. */
|
|
6
|
+
export function selectPrincipalPolicyCurrentPredecessorReferences(input) {
|
|
7
|
+
try {
|
|
8
|
+
const current = ownVerifiedPrincipalPolicyCurrent(input.current);
|
|
9
|
+
const predecessor = ownVerifiedPrincipalPolicyCurrent(input.predecessor);
|
|
10
|
+
const { references } = normalizePrincipalHistoryInput({
|
|
11
|
+
principalId: current.policy.principalId,
|
|
12
|
+
principalType: current.policy.principalType,
|
|
13
|
+
retainedReferences: input.references,
|
|
14
|
+
});
|
|
15
|
+
if (predecessor.policy.principalType !== current.policy.principalType ||
|
|
16
|
+
predecessor.policy.principalId !== current.policy.principalId ||
|
|
17
|
+
predecessor.policy.version + 1 !== current.policy.version ||
|
|
18
|
+
predecessor.policy.stateHash !== current.policy.state.prevStateHash)
|
|
19
|
+
throwVerification("stale_predecessor", "Selected history must belong to the exact verified predecessor");
|
|
20
|
+
const retained = new Map();
|
|
21
|
+
for (const policy of [predecessor.policy, current.policy])
|
|
22
|
+
retained.set(policy.version, {
|
|
23
|
+
state: policy.state,
|
|
24
|
+
projection: policy.projection,
|
|
25
|
+
grants: policy.grants,
|
|
26
|
+
});
|
|
27
|
+
for (const reference of references) {
|
|
28
|
+
const entry = [
|
|
29
|
+
...current.policy.retainedHistory,
|
|
30
|
+
...predecessor.policy.retainedHistory,
|
|
31
|
+
].find(({ state }) => principalPolicyStateMatchesReference(state, reference));
|
|
32
|
+
if (!entry)
|
|
33
|
+
throwVerification("missing_dependency", "Requested predecessor citation was not privately verified");
|
|
34
|
+
retained.set(entry.state.version, entry);
|
|
35
|
+
}
|
|
36
|
+
// At most the history reference budget plus the predecessor/successor pair.
|
|
37
|
+
return ok(issueVerifiedPrincipalPolicyCurrent({
|
|
38
|
+
...current.policy,
|
|
39
|
+
retainedHistory: [...retained.values()].sort((left, right) => left.state.version - right.state.version),
|
|
40
|
+
}, current.latestAuthority));
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return toVerificationResult(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=principalPolicyCurrentPredecessorReferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principalPolicyCurrentPredecessorReferences.js","sourceRoot":"","sources":["principalPolicyCurrentPredecessorReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,oCAAoC,EAAE,MAAM,4BAA4B,CAAC;AAElF,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAOvE,sFAAsF;AACtF,MAAM,UAAU,iDAAiD,CAAC,KAIjE;IACC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,iCAAiC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACjE,MAAM,WAAW,GAAG,iCAAiC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACzE,MAAM,EAAE,UAAU,EAAE,GAAG,8BAA8B,CAAC;YACpD,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW;YACvC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa;YAC3C,kBAAkB,EAAE,KAAK,CAAC,UAAU;SACrC,CAAC,CAAC;QACH,IACE,WAAW,CAAC,MAAM,CAAC,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,aAAa;YACjE,WAAW,CAAC,MAAM,CAAC,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,WAAW;YAC7D,WAAW,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,OAAO;YACzD,WAAW,CAAC,MAAM,CAAC,SAAS,KAAK,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa;YAEnE,iBAAiB,CACf,mBAAmB,EACnB,gEAAgE,CACjE,CAAC;QACJ,MAAM,QAAQ,GAAG,IAAI,GAAG,EAGrB,CAAC;QACJ,KAAK,MAAM,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;YACvD,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE;gBAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB,CAAC,CAAC;QACL,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,KAAK,GAAG;gBACZ,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe;gBACjC,GAAG,WAAW,CAAC,MAAM,CAAC,eAAe;aACtC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACnB,oCAAoC,CAAC,KAAK,EAAE,SAAS,CAAC,CACvD,CAAC;YACF,IAAI,CAAC,KAAK;gBACR,iBAAiB,CACf,oBAAoB,EACpB,2DAA2D,CAC5D,CAAC;YACJ,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;QACD,4EAA4E;QAC5E,OAAO,EAAE,CACP,mCAAmC,CACjC;YACE,GAAG,OAAO,CAAC,MAAM;YACjB,eAAe,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAC1C,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAC1D;SACF,EACD,OAAO,CAAC,eAAe,CACxB,CACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;AACH,CAAC","sourcesContent":["import {\n issueVerifiedPrincipalPolicyCurrent,\n ownVerifiedPrincipalPolicyCurrent,\n} from \"./principalPolicyCurrentEvidence\";\nimport { normalizePrincipalHistoryInput } from \"./principalPolicyHistoryChecks\";\nimport { principalPolicyStateMatchesReference } from \"./principalPolicyReference\";\nimport type { VerifiedPrincipalPolicyCurrent } from \"./principalPolicyTypes\";\nimport { ok, throwVerification, toVerificationResult } from \"./shared\";\nimport type {\n KeyingVerificationResult,\n NormalizedPrincipalPolicyStateChainEntry,\n ReferencedPrincipalHead,\n} from \"./types\";\n\n/** Carry selected authenticated citations across one privately verified successor. */\nexport function selectPrincipalPolicyCurrentPredecessorReferences(input: {\n readonly current: VerifiedPrincipalPolicyCurrent;\n readonly predecessor: VerifiedPrincipalPolicyCurrent;\n readonly references: readonly ReferencedPrincipalHead[];\n}): KeyingVerificationResult<VerifiedPrincipalPolicyCurrent> {\n try {\n const current = ownVerifiedPrincipalPolicyCurrent(input.current);\n const predecessor = ownVerifiedPrincipalPolicyCurrent(input.predecessor);\n const { references } = normalizePrincipalHistoryInput({\n principalId: current.policy.principalId,\n principalType: current.policy.principalType,\n retainedReferences: input.references,\n });\n if (\n predecessor.policy.principalType !== current.policy.principalType ||\n predecessor.policy.principalId !== current.policy.principalId ||\n predecessor.policy.version + 1 !== current.policy.version ||\n predecessor.policy.stateHash !== current.policy.state.prevStateHash\n )\n throwVerification(\n \"stale_predecessor\",\n \"Selected history must belong to the exact verified predecessor\",\n );\n const retained = new Map<\n number,\n NormalizedPrincipalPolicyStateChainEntry\n >();\n for (const policy of [predecessor.policy, current.policy])\n retained.set(policy.version, {\n state: policy.state,\n projection: policy.projection,\n grants: policy.grants,\n });\n for (const reference of references) {\n const entry = [\n ...current.policy.retainedHistory,\n ...predecessor.policy.retainedHistory,\n ].find(({ state }) =>\n principalPolicyStateMatchesReference(state, reference),\n );\n if (!entry)\n throwVerification(\n \"missing_dependency\",\n \"Requested predecessor citation was not privately verified\",\n );\n retained.set(entry.state.version, entry);\n }\n // At most the history reference budget plus the predecessor/successor pair.\n return ok(\n issueVerifiedPrincipalPolicyCurrent(\n {\n ...current.policy,\n retainedHistory: [...retained.values()].sort(\n (left, right) => left.state.version - right.state.version,\n ),\n },\n current.latestAuthority,\n ),\n );\n } catch (error) {\n return toVerificationResult(error);\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:
|
|
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: [
|
|
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:
|
|
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: [
|
|
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,EA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,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 { 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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AgB,EAAE;QAChB,GAAG,EAAE,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
|
@@ -2,6 +2,7 @@ import { MAX_ROTATION_CONTAINER_REKEYS } from "../../../internal/validators/util
|
|
|
2
2
|
import { verifyContainerWriterProjection, } from "../../../data/keyingProjectionVerification.js";
|
|
3
3
|
import { buildMaterializedContainerRekeyPlan } from "./rekey.js";
|
|
4
4
|
import { rebaseContainerWriterProjection } from "./rekeyProjection.js";
|
|
5
|
+
import { selectReplacementPrincipalPolicyReferences } from "./replacementPrincipalPolicyReferences.js";
|
|
5
6
|
/**
|
|
6
7
|
* Re-root a served projection on the deepest not-yet-accepted proper ancestor
|
|
7
8
|
* among `speculativePaths`. Each carried plan's own path was built the same
|
|
@@ -67,7 +68,14 @@ export async function planCarriedDescendantRekey(input) {
|
|
|
67
68
|
persistVerificationCheckpoints: false,
|
|
68
69
|
previousProjection: rebased.projection,
|
|
69
70
|
principalPolicyCache: input.principalPolicyCache,
|
|
70
|
-
replacementPrincipalPolicy: input.replacementPrincipalPolicy
|
|
71
|
+
replacementPrincipalPolicy: input.replacementPrincipalPolicy
|
|
72
|
+
? await selectReplacementPrincipalPolicyReferences({
|
|
73
|
+
policy: input.replacementPrincipalPolicy,
|
|
74
|
+
projection: rebased.projection,
|
|
75
|
+
principalPolicyCache: input.principalPolicyCache,
|
|
76
|
+
resolveAuthoredPolicyReferences: input.resolveAuthoredPolicyReferences,
|
|
77
|
+
})
|
|
78
|
+
: undefined,
|
|
71
79
|
resolveProjectionUserKey: input.resolveProjectionUserKey,
|
|
72
80
|
stillCurrent: input.stillCurrent,
|
|
73
81
|
targetSecretKey: input.targetSecretKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carriedDescendantRekeys.js","sourceRoot":"","sources":["carriedDescendantRekeys.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAM3E,OAAO,EAIL,+BAA+B,GAChC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAkCpE;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAyC,EACzC,gBAA4C;IAK5C,IAAI,OAAO,GAA2B,IAAI,CAAC;IAC3C,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC;IACtB,KAAK,MAAM,WAAW,IAAI,gBAAgB,EAAE,CAAC;QAC3C,MAAM,WAAW,GAAG,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC;QAClE,IAAI,WAAW,KAAK,MAAM,CAAC,WAAW;YAAE,SAAS;QACjD,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,SAAS,CAC1C,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,KAA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D,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,0BAA0B,CAAC;YAC5C,GAAG,KAAK;YACR,kBAAkB;YAClB,OAAO,EAAE,gBAAgB;YACzB,MAAM;SACP,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7C,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { VerifiedPrincipalPolicy } from \"@tearleads/crypto\";\nimport type { ContainerWriterProjectionResponse } from \"@tearleads/validators/response\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"@tearleads/validators/util\";\nimport type {\n ContainerMutationAuthor,\n ContainerRekeyApi,\n MaterializedContainerRekeyPlan,\n} from \"../../../data/containers/shared/types\";\nimport {\n type PrincipalPolicyCache,\n type ProjectionUserKeyResolver,\n type ReferencedPrincipalPolicyWarmer,\n verifyContainerWriterProjection,\n} from \"../../../data/keyingProjectionVerification\";\nimport type { ExecSql } from \"../../../data/sqlite/sqlSchema\";\nimport { buildMaterializedContainerRekeyPlan } from \"./rekey\";\nimport { rebaseContainerWriterProjection } from \"./rekeyProjection\";\n\n/** What a rotation needs in hand to sign the descendant rekeys it must carry. */\nexport interface CarriedRekeyPlanningInput {\n readonly apiClient: Pick<ContainerRekeyApi, \"getContainerWriterProjection\">;\n readonly author: ContainerMutationAuthor;\n readonly execSql: ExecSql;\n /**\n * Keys the batch minted and has yet to commit, by epoch id. A rotation's\n * successor is wrapped to recipients at heads the batch itself commits, so\n * no wrap on a re-rooted path opens it for the signer before then; the key\n * the signer just minted does, and its keyring then opens what sits below.\n */\n readonly knownContainerKeks?: ReadonlyMap<string, Uint8Array> | undefined;\n /**\n * Verified policies the batch itself commits, which the rebased paths cite\n * before any store holds them; and the one each carried rekey cites anew.\n */\n readonly principalPolicyCache?: PrincipalPolicyCache | undefined;\n readonly replacementPrincipalPolicy?: VerifiedPrincipalPolicy | undefined;\n readonly resolveProjectionUserKey: ProjectionUserKeyResolver;\n readonly stillCurrent?: (() => boolean) | undefined;\n readonly targetSecretKey: Uint8Array;\n readonly warmReferencedPrincipalPolicies?:\n | ReferencedPrincipalPolicyWarmer\n | undefined;\n}\n\n/** A rotated container's own path once its batch is accepted. */\nexport type SpeculativePath = Pick<\n ContainerWriterProjectionResponse,\n \"containerKeks\" | \"organizationId\" | \"path\" | \"policyEvidence\"\n>;\n\n/**\n * Re-root a served projection on the deepest not-yet-accepted proper ancestor\n * among `speculativePaths`. Each carried plan's own path was built the same\n * way, so the deepest one already holds every speculative level above it. The\n * container's own path, when the batch rotates it too, is not an ancestor: the\n * caller is re-planning that rotation, and it extends what sits above.\n */\nexport function rebaseOnDeepestAncestor(\n served: ContainerWriterProjectionResponse,\n speculativePaths: readonly SpeculativePath[],\n): {\n ancestor: SpeculativePath;\n projection: ContainerWriterProjectionResponse;\n} | null {\n let deepest: SpeculativePath | null = null;\n let deepestIndex = -1;\n for (const speculative of speculativePaths) {\n const containerId = speculative.containerKeks.at(-1)?.containerId;\n if (containerId === served.containerId) continue;\n const index = served.containerKeks.findIndex(\n (kek) => kek.containerId === containerId,\n );\n if (index > deepestIndex) {\n deepest = speculative;\n deepestIndex = index;\n }\n }\n if (!deepest) return null;\n const projection = rebaseContainerWriterProjection(served, deepest);\n return projection ? { ancestor: deepest, projection } : null;\n}\n\n/**\n * Sign one carried rekey against the path its batch will leave behind. The\n * served projection is fetched by the caller; here it is verified, must sit\n * below one of the rotated containers and in that container's organization,\n * and is signed only if this signer holds its key and write access — which a\n * member able to rotate the ancestor always does, since both inherit downward.\n */\nexport async function planCarriedDescendantRekey(\n input: CarriedRekeyPlanningInput & {\n readonly rotated: readonly SpeculativePath[];\n readonly served: ContainerWriterProjectionResponse;\n },\n): Promise<MaterializedContainerRekeyPlan> {\n // Pin the served head before signing beyond it. The batch is acknowledged\n // against the latest durable pin, and a carried rekey is always past epoch\n // 1, so a device that never pinned this container would otherwise reject\n // its own batch after the server had committed it.\n await verifyContainerWriterProjection({\n execSql: input.execSql,\n principalPolicyCache: input.principalPolicyCache,\n projection: input.served,\n resolveUserKey: input.resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n });\n const rebased = rebaseOnDeepestAncestor(input.served, input.rotated);\n if (!rebased) {\n throw new Error(\n \"Carried descendant rekey is not below the rotated container\",\n );\n }\n // A batch locks whatever organizations it names, so the server holds each\n // to the rule on its own; a carried rekey belongs to the rotation it rides.\n if (input.served.organizationId !== rebased.ancestor.organizationId) {\n throw new Error(\n \"Carried descendant rekey is outside the rotated container's organization\",\n );\n }\n return buildMaterializedContainerRekeyPlan({\n author: {\n ...input.author,\n organizationId: rebased.ancestor.organizationId,\n },\n execSql: input.execSql,\n knownContainerKeks: input.knownContainerKeks,\n // Nothing here is acknowledged yet: pins move only with the batch.\n persistVerificationCheckpoints: false,\n previousProjection: rebased.projection,\n principalPolicyCache: input.principalPolicyCache,\n replacementPrincipalPolicy: input.replacementPrincipalPolicy,\n resolveProjectionUserKey: input.resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n targetSecretKey: input.targetSecretKey,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n });\n}\n\n/**\n * Sign the descendant rekeys a rotation must commit with (#2340). The server\n * refuses a rotation that would leave a level above a directly granted\n * container pinned to a retired epoch, because the grantee could never re-key\n * that level itself and its writes would wait on another device. It names the\n * levels; this signs them, parent-first, each against the path the batch will\n * leave behind rather than the one currently served.\n *\n * `requiredContainerIds` is a hint, never an authority: each container is\n * fetched and verified here, and refused unless it sits below a rotation.\n */\nexport async function planCarriedDescendantRekeys(\n input: CarriedRekeyPlanningInput & {\n readonly requiredContainerIds: readonly string[];\n /** Each rotated container's own path once the batch is accepted. */\n readonly rotated: readonly SpeculativePath[];\n },\n): Promise<MaterializedContainerRekeyPlan[]> {\n const plans: MaterializedContainerRekeyPlan[] = [];\n const speculativePaths: SpeculativePath[] = [...input.rotated];\n const knownContainerKeks = new Map(input.knownContainerKeks);\n const planned = new Set<string>();\n for (const containerId of input.requiredContainerIds) {\n if (plans.length >= MAX_ROTATION_CONTAINER_REKEYS) break;\n if (planned.has(containerId)) continue;\n const served =\n await input.apiClient.getContainerWriterProjection(containerId);\n if (!served) {\n throw new Error(\"Carried descendant rekey projection is unavailable\");\n }\n if (served.containerId !== containerId) {\n throw new Error(\"Carried descendant rekey targets another container\");\n }\n const plan = await planCarriedDescendantRekey({\n ...input,\n knownContainerKeks,\n rotated: speculativePaths,\n served,\n });\n planned.add(containerId);\n plans.push(plan);\n speculativePaths.push(plan.writerProjection);\n knownContainerKeks.set(plan.plan.containerKeyEpochId, plan.containerKey);\n }\n return plans;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"carriedDescendantRekeys.js","sourceRoot":"","sources":["carriedDescendantRekeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAM3E,OAAO,EAIL,+BAA+B,GAChC,MAAM,4CAA4C,CAAC;AAIpD,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,0CAA0C,EAAE,MAAM,wCAAwC,CAAC;AAuCpG;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAyC,EACzC,gBAA4C;IAK5C,IAAI,OAAO,GAA2B,IAAI,CAAC;IAC3C,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC;IACtB,KAAK,MAAM,WAAW,IAAI,gBAAgB,EAAE,CAAC;QAC3C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D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,WAAW,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;QACrD,IAAI,KAAK,CAAC,MAAM,IAAI,6BAA6B;YAAE,MAAM;QACzD,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;YAAE,SAAS;QACvC,MAAM,MAAM,GACV,MAAM,KAAK,CAAC,SAAS,CAAC,4BAA4B,CAAC,WAAW,CAAC,CAAC;QAClE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,0BAA0B,CAAC;YAC5C,GAAG,KAAK;YACR,kBAAkB;YAClB,OAAO,EAAE,gBAAgB;YACzB,MAAM;SACP,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7C,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { ContainerWriterProjectionResponse } from \"@tearleads/validators/response\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"@tearleads/validators/util\";\nimport type {\n ContainerMutationAuthor,\n ContainerRekeyApi,\n MaterializedContainerRekeyPlan,\n} from \"../../../data/containers/shared/types\";\nimport {\n type PrincipalPolicyCache,\n type ProjectionUserKeyResolver,\n type ReferencedPrincipalPolicyWarmer,\n verifyContainerWriterProjection,\n} from \"../../../data/keyingProjectionVerification\";\nimport type { CurrentPolicyReferenceResolver } from \"../../../data/principals/currentPolicyReferenceResolver\";\nimport type { PrincipalPolicyCurrentEvidence } from \"../../../data/principals/principalPolicyEvidence\";\nimport type { ExecSql } from \"../../../data/sqlite/sqlSchema\";\nimport { buildMaterializedContainerRekeyPlan } from \"./rekey\";\nimport { rebaseContainerWriterProjection } from \"./rekeyProjection\";\nimport { selectReplacementPrincipalPolicyReferences } from \"./replacementPrincipalPolicyReferences\";\n\n/** What a rotation needs in hand to sign the descendant rekeys it must carry. */\nexport interface CarriedRekeyPlanningInput {\n readonly apiClient: Pick<ContainerRekeyApi, \"getContainerWriterProjection\">;\n readonly author: ContainerMutationAuthor;\n readonly execSql: ExecSql;\n /**\n * Keys the batch minted and has yet to commit, by epoch id. A rotation's\n * successor is wrapped to recipients at heads the batch itself commits, so\n * no wrap on a re-rooted path opens it for the signer before then; the key\n * the signer just minted does, and its keyring then opens what sits below.\n */\n readonly knownContainerKeks?: ReadonlyMap<string, Uint8Array> | undefined;\n /**\n * Verified policies the batch itself commits, which the rebased paths cite\n * before any store holds them; and the one each carried rekey cites anew.\n */\n readonly principalPolicyCache?: PrincipalPolicyCache | undefined;\n readonly replacementPrincipalPolicy?:\n | PrincipalPolicyCurrentEvidence\n | undefined;\n readonly resolveAuthoredPolicyReferences?:\n | CurrentPolicyReferenceResolver\n | undefined;\n readonly resolveProjectionUserKey: ProjectionUserKeyResolver;\n readonly stillCurrent?: (() => boolean) | undefined;\n readonly targetSecretKey: Uint8Array;\n readonly warmReferencedPrincipalPolicies?:\n | ReferencedPrincipalPolicyWarmer\n | undefined;\n}\n\n/** A rotated container's own path once its batch is accepted. */\nexport type SpeculativePath = Pick<\n ContainerWriterProjectionResponse,\n \"containerKeks\" | \"organizationId\" | \"path\" | \"policyEvidence\"\n>;\n\n/**\n * Re-root a served projection on the deepest not-yet-accepted proper ancestor\n * among `speculativePaths`. Each carried plan's own path was built the same\n * way, so the deepest one already holds every speculative level above it. The\n * container's own path, when the batch rotates it too, is not an ancestor: the\n * caller is re-planning that rotation, and it extends what sits above.\n */\nexport function rebaseOnDeepestAncestor(\n served: ContainerWriterProjectionResponse,\n speculativePaths: readonly SpeculativePath[],\n): {\n ancestor: SpeculativePath;\n projection: ContainerWriterProjectionResponse;\n} | null {\n let deepest: SpeculativePath | null = null;\n let deepestIndex = -1;\n for (const speculative of speculativePaths) {\n const containerId = speculative.containerKeks.at(-1)?.containerId;\n if (containerId === served.containerId) continue;\n const index = served.containerKeks.findIndex(\n (kek) => kek.containerId === containerId,\n );\n if (index > deepestIndex) {\n deepest = speculative;\n deepestIndex = index;\n }\n }\n if (!deepest) return null;\n const projection = rebaseContainerWriterProjection(served, deepest);\n return projection ? { ancestor: deepest, projection } : null;\n}\n\n/**\n * Sign one carried rekey against the path its batch will leave behind. The\n * served projection is fetched by the caller; here it is verified, must sit\n * below one of the rotated containers and in that container's organization,\n * and is signed only if this signer holds its key and write access — which a\n * member able to rotate the ancestor always does, since both inherit downward.\n */\nexport async function planCarriedDescendantRekey(\n input: CarriedRekeyPlanningInput & {\n readonly rotated: readonly SpeculativePath[];\n readonly served: ContainerWriterProjectionResponse;\n },\n): Promise<MaterializedContainerRekeyPlan> {\n // Pin the served head before signing beyond it. The batch is acknowledged\n // against the latest durable pin, and a carried rekey is always past epoch\n // 1, so a device that never pinned this container would otherwise reject\n // its own batch after the server had committed it.\n await verifyContainerWriterProjection({\n execSql: input.execSql,\n principalPolicyCache: input.principalPolicyCache,\n projection: input.served,\n resolveUserKey: input.resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n });\n const rebased = rebaseOnDeepestAncestor(input.served, input.rotated);\n if (!rebased) {\n throw new Error(\n \"Carried descendant rekey is not below the rotated container\",\n );\n }\n // A batch locks whatever organizations it names, so the server holds each\n // to the rule on its own; a carried rekey belongs to the rotation it rides.\n if (input.served.organizationId !== rebased.ancestor.organizationId) {\n throw new Error(\n \"Carried descendant rekey is outside the rotated container's organization\",\n );\n }\n return buildMaterializedContainerRekeyPlan({\n author: {\n ...input.author,\n organizationId: rebased.ancestor.organizationId,\n },\n execSql: input.execSql,\n knownContainerKeks: input.knownContainerKeks,\n // Nothing here is acknowledged yet: pins move only with the batch.\n persistVerificationCheckpoints: false,\n previousProjection: rebased.projection,\n principalPolicyCache: input.principalPolicyCache,\n replacementPrincipalPolicy: input.replacementPrincipalPolicy\n ? await selectReplacementPrincipalPolicyReferences({\n policy: input.replacementPrincipalPolicy,\n projection: rebased.projection,\n principalPolicyCache: input.principalPolicyCache,\n resolveAuthoredPolicyReferences:\n input.resolveAuthoredPolicyReferences,\n })\n : undefined,\n resolveProjectionUserKey: input.resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n targetSecretKey: input.targetSecretKey,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n });\n}\n\n/**\n * Sign the descendant rekeys a rotation must commit with (#2340). The server\n * refuses a rotation that would leave a level above a directly granted\n * container pinned to a retired epoch, because the grantee could never re-key\n * that level itself and its writes would wait on another device. It names the\n * levels; this signs them, parent-first, each against the path the batch will\n * leave behind rather than the one currently served.\n *\n * `requiredContainerIds` is a hint, never an authority: each container is\n * fetched and verified here, and refused unless it sits below a rotation.\n */\nexport async function planCarriedDescendantRekeys(\n input: CarriedRekeyPlanningInput & {\n readonly requiredContainerIds: readonly string[];\n /** Each rotated container's own path once the batch is accepted. */\n readonly rotated: readonly SpeculativePath[];\n },\n): Promise<MaterializedContainerRekeyPlan[]> {\n const plans: MaterializedContainerRekeyPlan[] = [];\n const speculativePaths: SpeculativePath[] = [...input.rotated];\n const knownContainerKeks = new Map(input.knownContainerKeks);\n const planned = new Set<string>();\n for (const containerId of input.requiredContainerIds) {\n if (plans.length >= MAX_ROTATION_CONTAINER_REKEYS) break;\n if (planned.has(containerId)) continue;\n const served =\n await input.apiClient.getContainerWriterProjection(containerId);\n if (!served) {\n throw new Error(\"Carried descendant rekey projection is unavailable\");\n }\n if (served.containerId !== containerId) {\n throw new Error(\"Carried descendant rekey targets another container\");\n }\n const plan = await planCarriedDescendantRekey({\n ...input,\n knownContainerKeks,\n rotated: speculativePaths,\n served,\n });\n planned.add(containerId);\n plans.push(plan);\n speculativePaths.push(plan.writerProjection);\n knownContainerKeks.set(plan.plan.containerKeyEpochId, plan.containerKey);\n }\n return plans;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { readContainerState } from "../../../data/containers/shared/projection.js";
|
|
2
|
+
import { dedupeReferencedPrincipalStates, referencedPrincipalPolicyKey, } from "../../../data/keyingProjectionVerification/principalPolicyCache.js";
|
|
3
|
+
/** Current membership with only the historical group citations this path uses. */
|
|
4
|
+
export async function selectReplacementPrincipalPolicyReferences(input) {
|
|
5
|
+
if (!("retainedHistory" in input.policy) ||
|
|
6
|
+
!input.resolveAuthoredPolicyReferences)
|
|
7
|
+
return input.policy;
|
|
8
|
+
const references = dedupeReferencedPrincipalStates(input.projection.path
|
|
9
|
+
.flatMap((manifest) => readContainerState(manifest).referencedPrincipalHeads)
|
|
10
|
+
.filter((reference) => reference.principalType === input.policy.principalType &&
|
|
11
|
+
reference.principalId === input.policy.principalId));
|
|
12
|
+
const selected = await input.resolveAuthoredPolicyReferences(input.policy, references);
|
|
13
|
+
// Planning is sequential: each path selects its own citations before use.
|
|
14
|
+
// Only speculative successor citations use this cache entry. Served historical
|
|
15
|
+
// references still resolve to acknowledged policies and cannot pin our new head.
|
|
16
|
+
input.principalPolicyCache?.set(referencedPrincipalPolicyKey(selected.state), selected);
|
|
17
|
+
return selected;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=replacementPrincipalPolicyReferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replacementPrincipalPolicyReferences.js","sourceRoot":"","sources":["replacementPrincipalPolicyReferences.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAEhF,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,iEAAiE,CAAC;AAIzE,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,0CAA0C,CAAC,KAOhE;IACC,IACE,CAAC,CAAC,iBAAiB,IAAI,KAAK,CAAC,MAAM,CAAC;QACpC,CAAC,KAAK,CAAC,+BAA+B;QAEtC,OAAO,KAAK,CAAC,MAAM,CAAC;IACtB,MAAM,UAAU,GAAG,+BAA+B,CAChD,KAAK,CAAC,UAAU,CAAC,IAAI;SAClB,OAAO,CACN,CAAC,QAAQ,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,wBAAwB,CACpE;SACA,MAAM,CACL,CAAC,SAAS,EAAE,EAAE,CACZ,SAAS,CAAC,aAAa,KAAK,KAAK,CAAC,MAAM,CAAC,aAAa;QACtD,SAAS,CAAC,WAAW,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,CACrD,CACJ,CAAC;IACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,+BAA+B,CAC1D,KAAK,CAAC,MAAM,EACZ,UAAU,CACX,CAAC;IACF,0EAA0E;IAC1E,+EAA+E;IAC/E,iFAAiF;IACjF,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAC7B,4BAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC5C,QAAQ,CACT,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { ContainerWriterProjectionResponse } from \"@tearleads/validators/response\";\nimport { readContainerState } from \"../../../data/containers/shared/projection\";\nimport type { PrincipalPolicyCache } from \"../../../data/keyingProjectionVerification\";\nimport {\n dedupeReferencedPrincipalStates,\n referencedPrincipalPolicyKey,\n} from \"../../../data/keyingProjectionVerification/principalPolicyCache\";\nimport type { CurrentPolicyReferenceResolver } from \"../../../data/principals/currentPolicyReferenceResolver\";\nimport type { PrincipalPolicyCurrentEvidence } from \"../../../data/principals/principalPolicyEvidence\";\n\n/** Current membership with only the historical group citations this path uses. */\nexport async function selectReplacementPrincipalPolicyReferences(input: {\n readonly policy: PrincipalPolicyCurrentEvidence;\n readonly projection: ContainerWriterProjectionResponse;\n readonly principalPolicyCache?: PrincipalPolicyCache | undefined;\n readonly resolveAuthoredPolicyReferences?:\n | CurrentPolicyReferenceResolver\n | undefined;\n}): Promise<PrincipalPolicyCurrentEvidence> {\n if (\n !(\"retainedHistory\" in input.policy) ||\n !input.resolveAuthoredPolicyReferences\n )\n return input.policy;\n const references = dedupeReferencedPrincipalStates(\n input.projection.path\n .flatMap(\n (manifest) => readContainerState(manifest).referencedPrincipalHeads,\n )\n .filter(\n (reference) =>\n reference.principalType === input.policy.principalType &&\n reference.principalId === input.policy.principalId,\n ),\n );\n const selected = await input.resolveAuthoredPolicyReferences(\n input.policy,\n references,\n );\n // Planning is sequential: each path selects its own citations before use.\n // Only speculative successor citations use this cache entry. Served historical\n // references still resolve to acknowledged policies and cannot pin our new head.\n input.principalPolicyCache?.set(\n referencedPrincipalPolicyKey(selected.state),\n selected,\n );\n return selected;\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { assertProjectionVerificationCurrent } from "../../data/keyingProjectionVerification/types.js";
|
|
2
|
+
import { prepareAuthoredGroupPolicy } from "./groupPolicyMutationAcknowledgement.js";
|
|
3
|
+
import { submitGroupPolicyCommit, } from "./groupPolicyMutationContext.js";
|
|
4
|
+
import { groupPolicyMutationHead } from "./groupPolicyMutationHead.js";
|
|
5
|
+
import { buildOrganizationGroupDirectoryPolicyRequest, replaceOrganizationGroupHead, } from "./organizationGroupDirectory.js";
|
|
6
|
+
import { projectionUserIds, resolveRequiredUserIdentities, } from "./trustedOrganizationUsers.js";
|
|
7
|
+
/** Commit and retain one exact compound successor without rebuilding full history. */
|
|
8
|
+
export async function commitCurrentGroupPolicyMutation(input) {
|
|
9
|
+
const { context } = input;
|
|
10
|
+
assertProjectionVerificationCurrent(context.stillCurrent);
|
|
11
|
+
const [signer] = await resolveRequiredUserIdentities({
|
|
12
|
+
resolveTrustedUserIdentity: input.resolveTrustedUserIdentity,
|
|
13
|
+
userIds: [input.signerUserId],
|
|
14
|
+
});
|
|
15
|
+
if (!signer)
|
|
16
|
+
throw new Error("Group policy signer is unavailable");
|
|
17
|
+
const expectedHead = await groupPolicyMutationHead(input.request);
|
|
18
|
+
const nextPolicy = await prepareAuthoredGroupPolicy({
|
|
19
|
+
verifiedCurrentPolicy: context.verifiedCurrentPolicy,
|
|
20
|
+
expectedHead,
|
|
21
|
+
request: input.request,
|
|
22
|
+
signerPublicKeys: [signer],
|
|
23
|
+
externalAuthority: context.externalAuthority,
|
|
24
|
+
localPolicyCheckpoint: context.localPolicyCheckpoint,
|
|
25
|
+
stillCurrent: context.stillCurrent,
|
|
26
|
+
});
|
|
27
|
+
const prepared = await input.prepareContainerMutations(nextPolicy);
|
|
28
|
+
input.request.containerMutations = [...prepared.requests];
|
|
29
|
+
const adminProjection = context.isOrganizationAdminsGroup
|
|
30
|
+
? input.request.projection
|
|
31
|
+
: context.adminCurrent.current.currentProjection;
|
|
32
|
+
const adminUsers = await resolveRequiredUserIdentities({
|
|
33
|
+
resolveTrustedUserIdentity: input.resolveTrustedUserIdentity,
|
|
34
|
+
userIds: projectionUserIds(adminProjection),
|
|
35
|
+
});
|
|
36
|
+
const organizationRequest = await buildOrganizationGroupDirectoryPolicyRequest({
|
|
37
|
+
adminProjection,
|
|
38
|
+
adminUsers,
|
|
39
|
+
currentPolicy: context.organizationCurrent.current,
|
|
40
|
+
descriptor: context.organizationDescriptor,
|
|
41
|
+
groupHeads: replaceOrganizationGroupHead({
|
|
42
|
+
descriptor: context.organizationDescriptor,
|
|
43
|
+
nextHead: expectedHead,
|
|
44
|
+
}),
|
|
45
|
+
signerUserId: input.signerUserId,
|
|
46
|
+
signingFingerprint: input.signingFingerprint,
|
|
47
|
+
signingKeyPair: input.signingKeyPair,
|
|
48
|
+
});
|
|
49
|
+
assertProjectionVerificationCurrent(context.stillCurrent);
|
|
50
|
+
const response = await submitGroupPolicyCommit({
|
|
51
|
+
apiClient: input.apiClient,
|
|
52
|
+
groupId: input.groupId,
|
|
53
|
+
organizationId: input.organizationId,
|
|
54
|
+
request: input.request,
|
|
55
|
+
organizationRequest,
|
|
56
|
+
carryDescendantRekeys: prepared.carry,
|
|
57
|
+
stillCurrent: context.stillCurrent,
|
|
58
|
+
});
|
|
59
|
+
if (!response)
|
|
60
|
+
throw new Error("Group policy update failed");
|
|
61
|
+
assertProjectionVerificationCurrent(context.stillCurrent);
|
|
62
|
+
await context.retainAcknowledged({
|
|
63
|
+
request: input.request,
|
|
64
|
+
organizationRequest,
|
|
65
|
+
response,
|
|
66
|
+
retiredContainerIds: prepared.retiredContainerIds,
|
|
67
|
+
});
|
|
68
|
+
await prepared.acknowledge(response.groupPolicy.containerMutations, context.stillCurrent);
|
|
69
|
+
assertProjectionVerificationCurrent(context.stillCurrent);
|
|
70
|
+
return response.groupPolicy;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=commitCurrentGroupPolicyMutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commitCurrentGroupPolicyMutation.js","sourceRoot":"","sources":["commitCurrentGroupPolicyMutation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AAEpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAEL,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,4CAA4C,EAC5C,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AAEpC,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,K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type {\n SigningKeyPair,\n VerifiedPrincipalPolicyCurrent,\n} from \"@tearleads/crypto\";\nimport type { PutPrincipalPolicyRequest } from \"@tearleads/validators/request\";\nimport type { PrincipalPolicyMutationResponse } from \"@tearleads/validators/response\";\nimport { assertProjectionVerificationCurrent } from \"../../data/keyingProjectionVerification/types\";\nimport type { TrustedUserIdentityResolver } from \"../../data/trustedUserIdentity\";\nimport { prepareAuthoredGroupPolicy } from \"./groupPolicyMutationAcknowledgement\";\nimport {\n type PrincipalPolicyReadWriteApi,\n submitGroupPolicyCommit,\n} from \"./groupPolicyMutationContext\";\nimport { groupPolicyMutationHead } from \"./groupPolicyMutationHead\";\nimport {\n buildOrganizationGroupDirectoryPolicyRequest,\n replaceOrganizationGroupHead,\n} from \"./organizationGroupDirectory\";\nimport type { PreparedPrincipalContainerRematerializationBatch } from \"./principalContainerRematerialization\";\nimport type { RuntimeCurrentGroupMutationContext } from \"./runtimeCurrentGroupMutation\";\nimport {\n projectionUserIds,\n resolveRequiredUserIdentities,\n} from \"./trustedOrganizationUsers\";\n\n/** Commit and retain one exact compound successor without rebuilding full history. */\nexport async function commitCurrentGroupPolicyMutation(input: {\n readonly apiClient: PrincipalPolicyReadWriteApi;\n readonly context: RuntimeCurrentGroupMutationContext;\n readonly groupId: string;\n readonly organizationId: string;\n readonly request: PutPrincipalPolicyRequest;\n readonly signerUserId: string;\n readonly signingFingerprint: string;\n readonly signingKeyPair: SigningKeyPair;\n readonly resolveTrustedUserIdentity: TrustedUserIdentityResolver;\n readonly prepareContainerMutations: (\n nextPolicy: VerifiedPrincipalPolicyCurrent,\n ) => Promise<PreparedPrincipalContainerRematerializationBatch>;\n}): Promise<PrincipalPolicyMutationResponse> {\n const { context } = input;\n assertProjectionVerificationCurrent(context.stillCurrent);\n const [signer] = await resolveRequiredUserIdentities({\n resolveTrustedUserIdentity: input.resolveTrustedUserIdentity,\n userIds: [input.signerUserId],\n });\n if (!signer) throw new Error(\"Group policy signer is unavailable\");\n const expectedHead = await groupPolicyMutationHead(input.request);\n const nextPolicy = await prepareAuthoredGroupPolicy({\n verifiedCurrentPolicy: context.verifiedCurrentPolicy,\n expectedHead,\n request: input.request,\n signerPublicKeys: [signer],\n externalAuthority: context.externalAuthority,\n localPolicyCheckpoint: context.localPolicyCheckpoint,\n stillCurrent: context.stillCurrent,\n });\n const prepared = await input.prepareContainerMutations(nextPolicy);\n input.request.containerMutations = [...prepared.requests];\n const adminProjection = context.isOrganizationAdminsGroup\n ? input.request.projection\n : context.adminCurrent.current.currentProjection;\n const adminUsers = await resolveRequiredUserIdentities({\n resolveTrustedUserIdentity: input.resolveTrustedUserIdentity,\n userIds: projectionUserIds(adminProjection),\n });\n const organizationRequest =\n await buildOrganizationGroupDirectoryPolicyRequest({\n adminProjection,\n adminUsers,\n currentPolicy: context.organizationCurrent.current,\n descriptor: context.organizationDescriptor,\n groupHeads: replaceOrganizationGroupHead({\n descriptor: context.organizationDescriptor,\n nextHead: expectedHead,\n }),\n signerUserId: input.signerUserId,\n signingFingerprint: input.signingFingerprint,\n signingKeyPair: input.signingKeyPair,\n });\n assertProjectionVerificationCurrent(context.stillCurrent);\n const response = await submitGroupPolicyCommit({\n apiClient: input.apiClient,\n groupId: input.groupId,\n organizationId: input.organizationId,\n request: input.request,\n organizationRequest,\n carryDescendantRekeys: prepared.carry,\n stillCurrent: context.stillCurrent,\n });\n if (!response) throw new Error(\"Group policy update failed\");\n assertProjectionVerificationCurrent(context.stillCurrent);\n await context.retainAcknowledged({\n request: input.request,\n organizationRequest,\n response,\n retiredContainerIds: prepared.retiredContainerIds,\n });\n await prepared.acknowledge(\n response.groupPolicy.containerMutations,\n context.stillCurrent,\n );\n assertProjectionVerificationCurrent(context.stillCurrent);\n return response.groupPolicy;\n}\n"]}
|