@tearleads/client-sdk 0.1.102 → 0.1.104
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/data/containers/shared/types.d.ts +2 -0
- package/data/containers/shared/types.js.map +1 -1
- package/internal/validators/operation/containerMutations.d.ts +16 -16
- package/internal/validators/operation/principals.d.ts +24 -0
- package/internal/validators/response/containerMutationError.d.ts +3 -3
- package/internal/validators/response/containerMutationError.js +2 -1
- package/internal/validators/response/containerMutationError.js.map +1 -1
- package/internal/validators/response/containerMutationStateStaleError.js +3 -0
- package/internal/validators/response/containerMutationStateStaleError.js.map +1 -0
- package/internal/validators/response/principal.d.ts +12 -0
- package/internal/validators/response/principal.js +5 -0
- package/internal/validators/response/principal.js.map +1 -1
- package/package.json +1 -1
- package/stores/container-contents/remoteEvents/remoteEventProjectionInvalidation.js +3 -33
- package/stores/container-contents/remoteEvents/remoteEventProjectionInvalidation.js.map +1 -1
- package/workflows/container-contents/container-state/projectionCache.js +34 -0
- package/workflows/container-contents/container-state/projectionCache.js.map +1 -1
- package/workflows/container-contents/container-state/types.js.map +1 -1
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js +17 -0
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js.map +1 -1
- package/workflows/container-contents/remoteHydration/types.d.ts +2 -1
- package/workflows/container-contents/remoteHydration/types.js.map +1 -1
- package/workflows/containers/child/revoke.d.ts +7 -3
- package/workflows/containers/child/revoke.js +73 -17
- package/workflows/containers/child/revoke.js.map +1 -1
- package/workflows/containers/rematerialization/acknowledgePrincipalContainerRematerialization.js +45 -0
- package/workflows/containers/rematerialization/acknowledgePrincipalContainerRematerialization.js.map +1 -0
- package/workflows/containers/rematerialization/principalContainerRematerialization.js +17 -47
- package/workflows/containers/rematerialization/principalContainerRematerialization.js.map +1 -1
- package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js +3 -0
- package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js.map +1 -1
- package/workflows/organizations/groupPolicy/submitGroupPolicyCommit.d.ts +6 -11
- package/workflows/organizations/groupPolicy/submitGroupPolicyCommit.js +58 -45
- package/workflows/organizations/groupPolicy/submitGroupPolicyCommit.js.map +1 -1
|
@@ -118,6 +118,8 @@ export interface ContainerMoveApi extends ContainerReciteApi {
|
|
|
118
118
|
moveContainerResult?(containerId: string, input: ContainerRotationRequest, options?: ContainerMutationRequestOptions): Promise<ContainerRotationResult>;
|
|
119
119
|
}
|
|
120
120
|
export interface ContainerRevokeApi extends ContainerReciteApi {
|
|
121
|
+
evictContainerWriterProjection?(containerId: string): void;
|
|
122
|
+
evictWriterProjectionsCiting?(containerIds: readonly string[]): void;
|
|
121
123
|
getContainerWriterProjection(containerId: string): Promise<ContainerWriterProjectionResponse | null>;
|
|
122
124
|
revokeContainer(containerId: string, input: ContainerRotationRequest, options?: ContainerMutationRequestOptions): Promise<ContainerRotationResponse | null>;
|
|
123
125
|
/** Optional status-bearing variant; without it nothing can be carried. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccessEvent,\n AccessManifest,\n ContainerAccessManifestState,\n ContainerCreateAccessEventBody,\n ContainerDirectGrant,\n ContainerGrantAccessEventBody,\n ContainerGrantPrincipalHead,\n ContainerKekKeyring,\n ContainerKekRecipientTarget,\n ContainerKeyEpoch,\n ContainerKeyWrap,\n ContainerMoveAccessEventBody,\n ContainerRekeyAccessEventBody,\n ContainerRevokeAccessEventBody,\n ContainerUserRecipientKey,\n} from \"@tearleads/crypto\";\nimport type {\n AccessManifestBundleWire,\n ContainerCreateWithMetadataDocumentRequest,\n ContainerMutationRequest,\n ContainerRotationRequest,\n} from \"@tearleads/validators/request\";\nimport type {\n ContainerCreateWithMetadataDocumentResponse,\n ContainerKekResponse,\n ContainerMutationResponse,\n ContainerRotationResponse,\n ContainerWriterProjectionResponse,\n ReferencedPrincipalStateResponse,\n} from \"@tearleads/validators/response\";\nimport type { PrincipalPolicyCurrentEvidence } from \"../../principals/principalPolicyEvidence\";\nimport type { ExecSql } from \"../../sqlite/sqlSchema\";\nimport type { ContainerMutationRequestOptions } from \"./mutationRequestOptions\";\nimport type { ContainerReciteApi } from \"./reciteApi\";\n\nexport interface ContainerMutationAuthor {\n organizationId: string;\n signerDeviceId: string;\n signerKeyFingerprint: string;\n signerPrivateKey: Uint8Array;\n signerUserId: string;\n}\n\nexport interface BuildContainerCreatePlanInput {\n author: ContainerMutationAuthor;\n containerId?: string | undefined;\n containerKey: Uint8Array;\n containerKeyEpochId?: string | undefined;\n eventId?: string | undefined;\n /**\n * Optional group grant to bake into the\n * create manifest, wrapping the new container key to that principal in\n * addition to the normal parent-inheritance wrap. Used to birth a child\n * container that is directly readable by a group — e.g. the org public\n * metadata container granted to the reserved Members group. The principal's\n * verified policy must also be supplied via `principalPolicies` so the server\n * can derive the recipient target.\n */\n managedPrincipalGrant?:\n | {\n accessLevel: ContainerDirectGrant[\"accessLevel\"];\n principalEncapsulationPublicKey: string;\n principalHead: ContainerGrantPrincipalHead;\n }\n | undefined;\n metadataDocumentId?: string | undefined;\n systemSlot?: string | null | undefined;\n parentProjection: ContainerWriterProjectionResponse;\n principalPolicies?: readonly PrincipalPolicyCurrentEvidence[] | undefined;\n signedAt?: string | undefined;\n}\n\nexport interface ContainerCreatePlan {\n body: ContainerCreateAccessEventBody;\n containerId: string;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyEpochHash: string;\n keyTargetHash: string;\n manifest: AccessManifest;\n manifestHash: string;\n metadataDocumentId: string;\n parentContainerId: string | null;\n parentManifestHash: string | null;\n recipientTargets: ContainerKekRecipientTarget[];\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerCreatePlan {\n containerKey: Uint8Array;\n plan: ContainerCreatePlan;\n}\n\nexport interface ContainerCreatePlanContext\n extends BuildContainerCreatePlanInput {\n containerKeyPublicKey: string;\n containerId: string;\n containerKeyEpochId: string;\n eventId: string;\n metadataDocumentId: string;\n parent: ParentContainerCreateContext;\n signedAt: string;\n}\n\nexport interface ContainerMutationSubmitFailure {\n readonly code?: string | undefined;\n readonly message: string;\n readonly ok: false;\n readonly report: () => void;\n readonly stalePrincipalHeads?:\n | readonly ReferencedPrincipalStateResponse[]\n | undefined;\n readonly status: number | null;\n}\n\nexport type ContainerMutationSubmitResult<T> =\n | {\n readonly data: T;\n readonly ok: true;\n }\n | ContainerMutationSubmitFailure;\n\nexport interface ContainerCreateApi {\n createContainerResult(\n input: ContainerMutationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerMutationSubmitResult<ContainerMutationResponse>>;\n createContainerWithMetadataDocumentResult(\n input: ContainerCreateWithMetadataDocumentRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<\n ContainerMutationSubmitResult<ContainerCreateWithMetadataDocumentResponse>\n >;\n evictContainerWriterProjection(containerId: string): void;\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n}\n\nexport interface ContainerShareApi extends ContainerReciteApi {\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n shareContainer(\n containerId: string,\n input: ContainerMutationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerMutationResponse | null>;\n /** Tells a stale path, which a fresh projection clears, from a refusal. */\n shareContainerResult?(\n containerId: string,\n input: ContainerMutationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerMutationSubmitResult<ContainerMutationResponse>>;\n evictContainerWriterProjection?(containerId: string): void;\n}\n\n/**\n * A status-bearing rotation outcome. A refusal that names\n * `requiredContainerIds` is answerable: sign those descendant rekeys and\n * resubmit with them carried.\n */\nexport type ContainerRotationResult =\n | { readonly ok: true; readonly data: ContainerRotationResponse }\n | {\n readonly ok: false;\n readonly code?: string | undefined;\n /** Surface a failure that was submitted with `reportErrors: false`. */\n readonly report?: (() => void) | undefined;\n readonly requiredContainerIds?: readonly string[] | undefined;\n readonly status: number | null;\n };\n\nexport interface ContainerMoveApi extends ContainerReciteApi {\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n moveContainer(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResponse | null>;\n /** Optional status-bearing variant; without it nothing can be carried. */\n moveContainerResult?(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResult>;\n}\n\nexport interface ContainerRevokeApi extends ContainerReciteApi {\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n revokeContainer(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResponse | null>;\n /** Optional status-bearing variant; without it nothing can be carried. */\n revokeContainerResult?(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResult>;\n}\n\nexport interface CreateRemoteContainerResult {\n containerKey: Uint8Array;\n containerId: string;\n metadataDocumentId: string;\n plan: ContainerCreatePlan;\n response: ContainerMutationResponse;\n}\n\nexport interface ContainerSharePlan {\n body: ContainerGrantAccessEventBody;\n /** The unchanged epoch's stored keyring, echoed back by the server. */\n previousKeyring?: Record<string, unknown> | null | undefined;\n containerId: string;\n event: AccessEvent;\n eventHash: string;\n grant: ContainerDirectGrant;\n keyEpoch: ContainerKeyEpoch;\n manifest: AccessManifest;\n manifestHash: string;\n previousManifest: AccessManifestBundleWire;\n recipientTarget: ContainerKekRecipientTarget;\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n userRecipientKeys: ContainerUserRecipientKey[];\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerSharePlan {\n containerKey: Uint8Array;\n plan: ContainerSharePlan;\n}\n\nexport interface ContainerRevokePlan {\n body: ContainerRevokeAccessEventBody;\n containerId: string;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n previousManifest: AccessManifestBundleWire;\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n userRecipientKeys: ContainerUserRecipientKey[];\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerRevokePlan {\n containerKey: Uint8Array;\n plan: ContainerRevokePlan;\n}\n\nexport interface ContainerRekeyPlan {\n body: ContainerRekeyAccessEventBody;\n containerId: string;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n previousManifest: AccessManifestBundleWire;\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n userRecipientKeys: ContainerUserRecipientKey[];\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerRekeyPlan {\n containerKey: Uint8Array;\n plan: ContainerRekeyPlan;\n writerProjection: ContainerWriterProjectionResponse;\n}\n\nexport interface ContainerRekeyApi extends ContainerReciteApi {\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n rekeyContainer(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResponse | null>;\n /** Optional status-bearing variant; see DocumentSyncApi. */\n rekeyContainerResult?(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResult>;\n}\n\nexport interface ContainerMovePlan {\n body: ContainerMoveAccessEventBody;\n containerId: string;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n previousManifest: AccessManifestBundleWire;\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerMovePlan {\n containerKey: Uint8Array;\n plan: ContainerMovePlan;\n}\n\nexport interface BuildMaterializedContainerMovePlanInput {\n author: ContainerMutationAuthor;\n containerKeyEpochId?: string | undefined;\n destinationParentProjection: ContainerWriterProjectionResponse;\n eventId?: string | undefined;\n execSql: ExecSql;\n previousProjection: ContainerWriterProjectionResponse;\n signedAt?: string | undefined;\n targetSecretKey: Uint8Array;\n}\n\nexport interface ParentContainerCreateContext {\n manifest: ContainerWriterProjectionResponse[\"path\"][number];\n kek: ContainerKekResponse;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccessEvent,\n AccessManifest,\n ContainerAccessManifestState,\n ContainerCreateAccessEventBody,\n ContainerDirectGrant,\n ContainerGrantAccessEventBody,\n ContainerGrantPrincipalHead,\n ContainerKekKeyring,\n ContainerKekRecipientTarget,\n ContainerKeyEpoch,\n ContainerKeyWrap,\n ContainerMoveAccessEventBody,\n ContainerRekeyAccessEventBody,\n ContainerRevokeAccessEventBody,\n ContainerUserRecipientKey,\n} from \"@tearleads/crypto\";\nimport type {\n AccessManifestBundleWire,\n ContainerCreateWithMetadataDocumentRequest,\n ContainerMutationRequest,\n ContainerRotationRequest,\n} from \"@tearleads/validators/request\";\nimport type {\n ContainerCreateWithMetadataDocumentResponse,\n ContainerKekResponse,\n ContainerMutationResponse,\n ContainerRotationResponse,\n ContainerWriterProjectionResponse,\n ReferencedPrincipalStateResponse,\n} from \"@tearleads/validators/response\";\nimport type { PrincipalPolicyCurrentEvidence } from \"../../principals/principalPolicyEvidence\";\nimport type { ExecSql } from \"../../sqlite/sqlSchema\";\nimport type { ContainerMutationRequestOptions } from \"./mutationRequestOptions\";\nimport type { ContainerReciteApi } from \"./reciteApi\";\n\nexport interface ContainerMutationAuthor {\n organizationId: string;\n signerDeviceId: string;\n signerKeyFingerprint: string;\n signerPrivateKey: Uint8Array;\n signerUserId: string;\n}\n\nexport interface BuildContainerCreatePlanInput {\n author: ContainerMutationAuthor;\n containerId?: string | undefined;\n containerKey: Uint8Array;\n containerKeyEpochId?: string | undefined;\n eventId?: string | undefined;\n /**\n * Optional group grant to bake into the\n * create manifest, wrapping the new container key to that principal in\n * addition to the normal parent-inheritance wrap. Used to birth a child\n * container that is directly readable by a group — e.g. the org public\n * metadata container granted to the reserved Members group. The principal's\n * verified policy must also be supplied via `principalPolicies` so the server\n * can derive the recipient target.\n */\n managedPrincipalGrant?:\n | {\n accessLevel: ContainerDirectGrant[\"accessLevel\"];\n principalEncapsulationPublicKey: string;\n principalHead: ContainerGrantPrincipalHead;\n }\n | undefined;\n metadataDocumentId?: string | undefined;\n systemSlot?: string | null | undefined;\n parentProjection: ContainerWriterProjectionResponse;\n principalPolicies?: readonly PrincipalPolicyCurrentEvidence[] | undefined;\n signedAt?: string | undefined;\n}\n\nexport interface ContainerCreatePlan {\n body: ContainerCreateAccessEventBody;\n containerId: string;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyEpochHash: string;\n keyTargetHash: string;\n manifest: AccessManifest;\n manifestHash: string;\n metadataDocumentId: string;\n parentContainerId: string | null;\n parentManifestHash: string | null;\n recipientTargets: ContainerKekRecipientTarget[];\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerCreatePlan {\n containerKey: Uint8Array;\n plan: ContainerCreatePlan;\n}\n\nexport interface ContainerCreatePlanContext\n extends BuildContainerCreatePlanInput {\n containerKeyPublicKey: string;\n containerId: string;\n containerKeyEpochId: string;\n eventId: string;\n metadataDocumentId: string;\n parent: ParentContainerCreateContext;\n signedAt: string;\n}\n\nexport interface ContainerMutationSubmitFailure {\n readonly code?: string | undefined;\n readonly message: string;\n readonly ok: false;\n readonly report: () => void;\n readonly stalePrincipalHeads?:\n | readonly ReferencedPrincipalStateResponse[]\n | undefined;\n readonly status: number | null;\n}\n\nexport type ContainerMutationSubmitResult<T> =\n | {\n readonly data: T;\n readonly ok: true;\n }\n | ContainerMutationSubmitFailure;\n\nexport interface ContainerCreateApi {\n createContainerResult(\n input: ContainerMutationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerMutationSubmitResult<ContainerMutationResponse>>;\n createContainerWithMetadataDocumentResult(\n input: ContainerCreateWithMetadataDocumentRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<\n ContainerMutationSubmitResult<ContainerCreateWithMetadataDocumentResponse>\n >;\n evictContainerWriterProjection(containerId: string): void;\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n}\n\nexport interface ContainerShareApi extends ContainerReciteApi {\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n shareContainer(\n containerId: string,\n input: ContainerMutationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerMutationResponse | null>;\n /** Tells a stale path, which a fresh projection clears, from a refusal. */\n shareContainerResult?(\n containerId: string,\n input: ContainerMutationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerMutationSubmitResult<ContainerMutationResponse>>;\n evictContainerWriterProjection?(containerId: string): void;\n}\n\n/**\n * A status-bearing rotation outcome. A refusal that names\n * `requiredContainerIds` is answerable: sign those descendant rekeys and\n * resubmit with them carried.\n */\nexport type ContainerRotationResult =\n | { readonly ok: true; readonly data: ContainerRotationResponse }\n | {\n readonly ok: false;\n readonly code?: string | undefined;\n /** Surface a failure that was submitted with `reportErrors: false`. */\n readonly report?: (() => void) | undefined;\n readonly requiredContainerIds?: readonly string[] | undefined;\n readonly status: number | null;\n };\n\nexport interface ContainerMoveApi extends ContainerReciteApi {\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n moveContainer(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResponse | null>;\n /** Optional status-bearing variant; without it nothing can be carried. */\n moveContainerResult?(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResult>;\n}\n\nexport interface ContainerRevokeApi extends ContainerReciteApi {\n evictContainerWriterProjection?(containerId: string): void;\n evictWriterProjectionsCiting?(containerIds: readonly string[]): void;\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n revokeContainer(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResponse | null>;\n /** Optional status-bearing variant; without it nothing can be carried. */\n revokeContainerResult?(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResult>;\n}\n\nexport interface CreateRemoteContainerResult {\n containerKey: Uint8Array;\n containerId: string;\n metadataDocumentId: string;\n plan: ContainerCreatePlan;\n response: ContainerMutationResponse;\n}\n\nexport interface ContainerSharePlan {\n body: ContainerGrantAccessEventBody;\n /** The unchanged epoch's stored keyring, echoed back by the server. */\n previousKeyring?: Record<string, unknown> | null | undefined;\n containerId: string;\n event: AccessEvent;\n eventHash: string;\n grant: ContainerDirectGrant;\n keyEpoch: ContainerKeyEpoch;\n manifest: AccessManifest;\n manifestHash: string;\n previousManifest: AccessManifestBundleWire;\n recipientTarget: ContainerKekRecipientTarget;\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n userRecipientKeys: ContainerUserRecipientKey[];\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerSharePlan {\n containerKey: Uint8Array;\n plan: ContainerSharePlan;\n}\n\nexport interface ContainerRevokePlan {\n body: ContainerRevokeAccessEventBody;\n containerId: string;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n previousManifest: AccessManifestBundleWire;\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n userRecipientKeys: ContainerUserRecipientKey[];\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerRevokePlan {\n containerKey: Uint8Array;\n plan: ContainerRevokePlan;\n}\n\nexport interface ContainerRekeyPlan {\n body: ContainerRekeyAccessEventBody;\n containerId: string;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n previousManifest: AccessManifestBundleWire;\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n userRecipientKeys: ContainerUserRecipientKey[];\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerRekeyPlan {\n containerKey: Uint8Array;\n plan: ContainerRekeyPlan;\n writerProjection: ContainerWriterProjectionResponse;\n}\n\nexport interface ContainerRekeyApi extends ContainerReciteApi {\n getContainerWriterProjection(\n containerId: string,\n ): Promise<ContainerWriterProjectionResponse | null>;\n rekeyContainer(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResponse | null>;\n /** Optional status-bearing variant; see DocumentSyncApi. */\n rekeyContainerResult?(\n containerId: string,\n input: ContainerRotationRequest,\n options?: ContainerMutationRequestOptions,\n ): Promise<ContainerRotationResult>;\n}\n\nexport interface ContainerMovePlan {\n body: ContainerMoveAccessEventBody;\n containerId: string;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n previousManifest: AccessManifestBundleWire;\n request: ContainerMutationRequest;\n state: ContainerAccessManifestState;\n wraps: ContainerKeyWrap[];\n}\n\nexport interface MaterializedContainerMovePlan {\n containerKey: Uint8Array;\n plan: ContainerMovePlan;\n}\n\nexport interface BuildMaterializedContainerMovePlanInput {\n author: ContainerMutationAuthor;\n containerKeyEpochId?: string | undefined;\n destinationParentProjection: ContainerWriterProjectionResponse;\n eventId?: string | undefined;\n execSql: ExecSql;\n previousProjection: ContainerWriterProjectionResponse;\n signedAt?: string | undefined;\n targetSecretKey: Uint8Array;\n}\n\nexport interface ParentContainerCreateContext {\n manifest: ContainerWriterProjectionResponse[\"path\"][number];\n kek: ContainerKekResponse;\n}\n"]}
|
|
@@ -215,7 +215,7 @@ export declare const createContainerOperation: Omit<{
|
|
|
215
215
|
error: string;
|
|
216
216
|
}>>;
|
|
217
217
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
218
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
218
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
219
219
|
error: z.ZodString;
|
|
220
220
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
221
221
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -581,7 +581,7 @@ export declare const createContainerOperation: Omit<{
|
|
|
581
581
|
error: string;
|
|
582
582
|
}>>;
|
|
583
583
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
584
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
584
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
585
585
|
error: z.ZodString;
|
|
586
586
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
587
587
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -1442,7 +1442,7 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
1442
1442
|
error: string;
|
|
1443
1443
|
}>>;
|
|
1444
1444
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
1445
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
1445
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
1446
1446
|
error: z.ZodString;
|
|
1447
1447
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
1448
1448
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -2016,7 +2016,7 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
2016
2016
|
error: string;
|
|
2017
2017
|
}>>;
|
|
2018
2018
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
2019
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
2019
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
2020
2020
|
error: z.ZodString;
|
|
2021
2021
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
2022
2022
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -2288,7 +2288,7 @@ export declare const shareContainerOperation: Omit<{
|
|
|
2288
2288
|
error: string;
|
|
2289
2289
|
}>>;
|
|
2290
2290
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
2291
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
2291
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
2292
2292
|
error: z.ZodString;
|
|
2293
2293
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
2294
2294
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -2656,7 +2656,7 @@ export declare const shareContainerOperation: Omit<{
|
|
|
2656
2656
|
error: string;
|
|
2657
2657
|
}>>;
|
|
2658
2658
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
2659
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
2659
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
2660
2660
|
error: z.ZodString;
|
|
2661
2661
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
2662
2662
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -2856,7 +2856,7 @@ export declare const reciteContainerOperation: Omit<{
|
|
|
2856
2856
|
error: string;
|
|
2857
2857
|
}>>;
|
|
2858
2858
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
2859
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
2859
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
2860
2860
|
error: z.ZodString;
|
|
2861
2861
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
2862
2862
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -3100,7 +3100,7 @@ export declare const reciteContainerOperation: Omit<{
|
|
|
3100
3100
|
error: string;
|
|
3101
3101
|
}>>;
|
|
3102
3102
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
3103
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
3103
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
3104
3104
|
error: z.ZodString;
|
|
3105
3105
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
3106
3106
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -3524,7 +3524,7 @@ export declare const revokeContainerOperation: Omit<{
|
|
|
3524
3524
|
error: string;
|
|
3525
3525
|
}>>;
|
|
3526
3526
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
3527
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
3527
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
3528
3528
|
error: z.ZodString;
|
|
3529
3529
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
3530
3530
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -4132,7 +4132,7 @@ export declare const revokeContainerOperation: Omit<{
|
|
|
4132
4132
|
error: string;
|
|
4133
4133
|
}>>;
|
|
4134
4134
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
4135
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
4135
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
4136
4136
|
error: z.ZodString;
|
|
4137
4137
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
4138
4138
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -4556,7 +4556,7 @@ export declare const rekeyContainerOperation: Omit<{
|
|
|
4556
4556
|
error: string;
|
|
4557
4557
|
}>>;
|
|
4558
4558
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
4559
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
4559
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
4560
4560
|
error: z.ZodString;
|
|
4561
4561
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
4562
4562
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -5164,7 +5164,7 @@ export declare const rekeyContainerOperation: Omit<{
|
|
|
5164
5164
|
error: string;
|
|
5165
5165
|
}>>;
|
|
5166
5166
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
5167
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
5167
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
5168
5168
|
error: z.ZodString;
|
|
5169
5169
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
5170
5170
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -5588,7 +5588,7 @@ export declare const moveContainerOperation: Omit<{
|
|
|
5588
5588
|
error: string;
|
|
5589
5589
|
}>>;
|
|
5590
5590
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
5591
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
5591
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
5592
5592
|
error: z.ZodString;
|
|
5593
5593
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
5594
5594
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -6196,7 +6196,7 @@ export declare const moveContainerOperation: Omit<{
|
|
|
6196
6196
|
error: string;
|
|
6197
6197
|
}>>;
|
|
6198
6198
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
6199
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
6199
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
6200
6200
|
error: z.ZodString;
|
|
6201
6201
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
6202
6202
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -6314,7 +6314,7 @@ export declare const deleteContainerOperation: Omit<{
|
|
|
6314
6314
|
error: string;
|
|
6315
6315
|
}>>;
|
|
6316
6316
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
6317
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
6317
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
6318
6318
|
error: z.ZodString;
|
|
6319
6319
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
6320
6320
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -6452,7 +6452,7 @@ export declare const deleteContainerOperation: Omit<{
|
|
|
6452
6452
|
error: string;
|
|
6453
6453
|
}>>;
|
|
6454
6454
|
readonly 409: z.ZodUnion<readonly [z.ZodObject<{
|
|
6455
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
6455
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
6456
6456
|
error: z.ZodString;
|
|
6457
6457
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
6458
6458
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -2814,6 +2814,18 @@ export declare const commitOrganizationGroupPolicyOperation: Omit<{
|
|
|
2814
2814
|
code: "container_descendant_rekeys_required";
|
|
2815
2815
|
error: string;
|
|
2816
2816
|
requiredContainerIds: string[];
|
|
2817
|
+
}>>, z.ZodType<{
|
|
2818
|
+
code: "container_mutation_state_stale";
|
|
2819
|
+
error: string;
|
|
2820
|
+
}, {
|
|
2821
|
+
code: "container_mutation_state_stale";
|
|
2822
|
+
error: string;
|
|
2823
|
+
}, z.core.$ZodTypeInternals<{
|
|
2824
|
+
code: "container_mutation_state_stale";
|
|
2825
|
+
error: string;
|
|
2826
|
+
}, {
|
|
2827
|
+
code: "container_mutation_state_stale";
|
|
2828
|
+
error: string;
|
|
2817
2829
|
}>>]>;
|
|
2818
2830
|
readonly 500: z.ZodType<{
|
|
2819
2831
|
error: string;
|
|
@@ -4435,6 +4447,18 @@ export declare const commitOrganizationGroupPolicyOperation: Omit<{
|
|
|
4435
4447
|
code: "container_descendant_rekeys_required";
|
|
4436
4448
|
error: string;
|
|
4437
4449
|
requiredContainerIds: string[];
|
|
4450
|
+
}>>, z.ZodType<{
|
|
4451
|
+
code: "container_mutation_state_stale";
|
|
4452
|
+
error: string;
|
|
4453
|
+
}, {
|
|
4454
|
+
code: "container_mutation_state_stale";
|
|
4455
|
+
error: string;
|
|
4456
|
+
}, z.core.$ZodTypeInternals<{
|
|
4457
|
+
code: "container_mutation_state_stale";
|
|
4458
|
+
error: string;
|
|
4459
|
+
}, {
|
|
4460
|
+
code: "container_mutation_state_stale";
|
|
4461
|
+
error: string;
|
|
4438
4462
|
}>>]>;
|
|
4439
4463
|
readonly 500: z.ZodType<{
|
|
4440
4464
|
error: string;
|
|
@@ -8,11 +8,11 @@ export declare const CONTAINER_MUTATION_ERROR_CODES: {
|
|
|
8
8
|
readonly pathTooDeep: "container_path_too_deep";
|
|
9
9
|
readonly stateStale: "container_mutation_state_stale";
|
|
10
10
|
};
|
|
11
|
-
export declare const ContainerMutationBehaviorErrorCodeSchema: z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
12
|
-
export declare const ContainerMutationErrorCodeSchema: z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
11
|
+
export declare const ContainerMutationBehaviorErrorCodeSchema: z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">;
|
|
12
|
+
export declare const ContainerMutationErrorCodeSchema: z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>;
|
|
13
13
|
export type ContainerMutationErrorCode = z.infer<typeof ContainerMutationErrorCodeSchema>;
|
|
14
14
|
export declare const ContainerMutationFailureResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
15
|
-
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep"
|
|
15
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"container_mutation_state_stale" | "container_descendant_rekeys_required" | "container_ancestor_rekeys_required" | "container_descendant_rekeys_inaccessible" | "container_manifest_already_exists" | "container_path_too_deep">, z.ZodUnion<readonly [z.ZodLiteral<"document_manifest_already_exists">, z.ZodLiteral<"document_sync_checkpoint_coverage_conflict" | "document_sync_conflict" | "document_sync_descendant_rekeys_required" | "document_sync_state_stale" | "document_sync_update_id_conflict">, z.ZodLiteral<"document_not_found">, z.ZodLiteral<"container_unavailable">]>]>>;
|
|
16
16
|
error: z.ZodString;
|
|
17
17
|
requiredContainerIds: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
18
18
|
}, z.core.$loose>, z.ZodType<{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { arraySchema, nonEmptyStringSchema } from "../schema.js";
|
|
3
3
|
import { MAX_ROTATION_CONTAINER_REKEYS } from "../util/index.js";
|
|
4
|
+
import { CONTAINER_MUTATION_STATE_STALE_ERROR_CODE } from "./containerMutationStateStaleError.js";
|
|
4
5
|
import { CONTAINER_UNAVAILABLE_ERROR_CODE } from "./containerUnavailableError.js";
|
|
5
6
|
import { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from "./descendantRekeysRequiredError.js";
|
|
6
7
|
import { DocumentMutationErrorCodeSchema } from "./documentMutationError.js";
|
|
@@ -25,7 +26,7 @@ export const CONTAINER_MUTATION_ERROR_CODES = {
|
|
|
25
26
|
// request never succeeds: a queued move is abandoned, while a queued create
|
|
26
27
|
// keeps its intent (a later local move can re-arm it).
|
|
27
28
|
pathTooDeep: "container_path_too_deep",
|
|
28
|
-
stateStale:
|
|
29
|
+
stateStale: CONTAINER_MUTATION_STATE_STALE_ERROR_CODE,
|
|
29
30
|
};
|
|
30
31
|
export const ContainerMutationBehaviorErrorCodeSchema = z.literal([
|
|
31
32
|
CONTAINER_MUTATION_ERROR_CODES.ancestorRekeysRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerMutationError.js","sourceRoot":"","sources":["containerMutationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,+CAA+C,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,uCAAuC,EAAE,MAAM,aAAa,CAAC;AAEtE,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,0EAA0E;IAC1E,sEAAsE;IACtE,2EAA2E;IAC3E,8EAA8E;IAC9E,2CAA2C;IAC3C,sBAAsB,EAAE,oCAAoC;IAC5D,oBAAoB,EAAE,gCAAgC;IACtD,6EAA6E;IAC7E,8EAA8E;IAC9E,kDAAkD;IAClD,wBAAwB,EAAE,+CAA+C;IACzE,4EAA4E;IAC5E,+EAA+E;IAC/E,4BAA4B,EAAE,0CAA0C;IACxE,qBAAqB,EAAE,mCAAmC;IAC1D,2EAA2E;IAC3E,4EAA4E;IAC5E,uDAAuD;IACvD,WAAW,EAAE,yBAAyB;IACtC,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"containerMutationError.js","sourceRoot":"","sources":["containerMutationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAA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C5D,CAAC,CAAC,WAAW,CAAC;QACZ,IAAI,EAAE,gCAAgC,CAAC,QAAQ,EAAE;QACjD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB,iFAAiF;QACjF,oBAAoB,EAAE,WAAW,CAC/B,oBAAoB,EACpB,6BAA6B,CAC9B,CAAC,QAAQ,EAAE;KACb,CAAC;IACF,uCAAuC;CACxC,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { arraySchema, nonEmptyStringSchema } from \"../schema\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"../util\";\nimport { CONTAINER_MUTATION_STATE_STALE_ERROR_CODE } from \"./containerMutationStateStaleError\";\nimport { CONTAINER_UNAVAILABLE_ERROR_CODE } from \"./containerUnavailableError\";\nimport { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from \"./descendantRekeysRequiredError\";\nimport { DocumentMutationErrorCodeSchema } from \"./documentMutationError\";\nimport { PrincipalPolicyStaleErrorResponseSchema } from \"./principal\";\n\nexport const CONTAINER_MUTATION_ERROR_CODES = {\n // Same literal as DOCUMENT_MUTATION_ERROR_CODES.containerUnavailable; the\n // envelope schema below already admits it through the document union.\n // A first direct grant sits below a chain pinned to a retired epoch, which\n // its grantee could never re-key. Not `stateStale`: refetching will not help,\n // the sharer must re-key that chain first.\n ancestorRekeysRequired: \"container_ancestor_rekeys_required\",\n containerUnavailable: CONTAINER_UNAVAILABLE_ERROR_CODE,\n // A rotation left a descendant above a granted container pinned to a retired\n // epoch. Not `stateStale`: refetching will not help, the client must sign and\n // carry the re-keys `requiredContainerIds` names.\n descendantRekeysRequired: CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE,\n // The revoke removes the caller's write access on owed descendants. Another\n // authorized member must perform it; retrying with carried rekeys cannot help.\n descendantRekeysInaccessible: \"container_descendant_rekeys_inaccessible\",\n manifestAlreadyExists: \"container_manifest_already_exists\",\n // A create or move would leave a path longer than readers accept. The same\n // request never succeeds: a queued move is abandoned, while a queued create\n // keeps its intent (a later local move can re-arm it).\n pathTooDeep: \"container_path_too_deep\",\n stateStale: CONTAINER_MUTATION_STATE_STALE_ERROR_CODE,\n} as const;\n\nexport const ContainerMutationBehaviorErrorCodeSchema = z.literal([\n CONTAINER_MUTATION_ERROR_CODES.ancestorRekeysRequired,\n CONTAINER_MUTATION_ERROR_CODES.descendantRekeysRequired,\n CONTAINER_MUTATION_ERROR_CODES.descendantRekeysInaccessible,\n CONTAINER_MUTATION_ERROR_CODES.manifestAlreadyExists,\n CONTAINER_MUTATION_ERROR_CODES.pathTooDeep,\n CONTAINER_MUTATION_ERROR_CODES.stateStale,\n]);\n\nexport const ContainerMutationErrorCodeSchema = z.union([\n ContainerMutationBehaviorErrorCodeSchema,\n // The compound container-plus-metadata-document create can fail in either\n // half of its transaction, so its envelope preserves document-domain tags.\n DocumentMutationErrorCodeSchema,\n]);\n\nexport type ContainerMutationErrorCode = z.infer<\n typeof ContainerMutationErrorCodeSchema\n>;\n\nexport const ContainerMutationFailureResponseSchema = z.union([\n z.looseObject({\n code: ContainerMutationErrorCodeSchema.optional(),\n error: z.string().min(1),\n /** Parent-first; owed levels, or the inaccessible subset on a refused revoke. */\n requiredContainerIds: arraySchema(\n nonEmptyStringSchema,\n MAX_ROTATION_CONTAINER_REKEYS,\n ).optional(),\n }),\n PrincipalPolicyStaleErrorResponseSchema,\n]);\n\nexport type ContainerMutationFailureResponse = z.infer<\n typeof ContainerMutationFailureResponseSchema\n>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerMutationStateStaleError.js","sourceRoot":"","sources":["containerMutationStateStaleError.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,CAAC,MAAM,yCAAyC,GACpD,gCAAgC,CAAC","sourcesContent":["/** A refused container mutation can be replanned against fresh served heads. */\nexport const CONTAINER_MUTATION_STATE_STALE_ERROR_CODE =\n \"container_mutation_state_stale\";\n"]}
|
|
@@ -2628,6 +2628,18 @@ export declare const CommitOrganizationGroupPolicyConflictResponseSchema: z.ZodU
|
|
|
2628
2628
|
code: "container_descendant_rekeys_required";
|
|
2629
2629
|
error: string;
|
|
2630
2630
|
requiredContainerIds: string[];
|
|
2631
|
+
}>>, z.ZodType<{
|
|
2632
|
+
code: "container_mutation_state_stale";
|
|
2633
|
+
error: string;
|
|
2634
|
+
}, {
|
|
2635
|
+
code: "container_mutation_state_stale";
|
|
2636
|
+
error: string;
|
|
2637
|
+
}, z.core.$ZodTypeInternals<{
|
|
2638
|
+
code: "container_mutation_state_stale";
|
|
2639
|
+
error: string;
|
|
2640
|
+
}, {
|
|
2641
|
+
code: "container_mutation_state_stale";
|
|
2642
|
+
error: string;
|
|
2631
2643
|
}>>]>;
|
|
2632
2644
|
export declare const PrincipalPolicyStaleErrorResponseSchema: z.ZodType<{
|
|
2633
2645
|
code: "principal_policy_stale";
|
|
@@ -3,6 +3,7 @@ import { arraySchema, loosePlainObject, nonEmptyStringSchema } from "../schema.j
|
|
|
3
3
|
import { MAX_ROTATION_CONTAINER_REKEYS } from "../util/index.js";
|
|
4
4
|
import { PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT } from "../util/principalHistoryWire.js";
|
|
5
5
|
import { ContainerMutationResponseSchema } from "./container.js";
|
|
6
|
+
import { CONTAINER_MUTATION_STATE_STALE_ERROR_CODE } from "./containerMutationStateStaleError.js";
|
|
6
7
|
import { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from "./descendantRekeysRequiredError.js";
|
|
7
8
|
import { BillingErrorResponseSchema } from "./organizationBilling.js";
|
|
8
9
|
import { ReferencedPrincipalStateResponseSchema } from "./principalReference.js";
|
|
@@ -48,6 +49,10 @@ const PrincipalPolicyDescendantRekeysRequiredResponseSchema = loosePlainObject({
|
|
|
48
49
|
export const CommitOrganizationGroupPolicyConflictResponseSchema = z.union([
|
|
49
50
|
PrincipalPolicyErrorResponseSchema,
|
|
50
51
|
PrincipalPolicyDescendantRekeysRequiredResponseSchema,
|
|
52
|
+
loosePlainObject({
|
|
53
|
+
code: z.literal(CONTAINER_MUTATION_STATE_STALE_ERROR_CODE),
|
|
54
|
+
error: z.string().min(1),
|
|
55
|
+
}),
|
|
51
56
|
]);
|
|
52
57
|
export const PrincipalPolicyStaleErrorResponseSchema = loosePlainObject({
|
|
53
58
|
code: z.literal("principal_policy_stale"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principal.js","sourceRoot":"","sources":["principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,kCAAkC,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,+CAA+C,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,sCAAsC,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EACL,6CAA6C,EAC7C,qCAAqC,EACrC,4CAA4C,EAC5C,uCAAuC,EACvC,mCAAmC,EACnC,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,6CAA6C,EAC7C,yCAAyC,EACzC,wCAAwC,EACxC,+BAA+B,EAC/B,wBAAwB,EAExB,qCAAqC,EAErC,qCAAqC,EAErC,qCAAqC,EAErC,4CAA4C,EAE5C,uCAAuC,EAEvC,6CAA6C,EAE7C,mCAAmC,EAEnC,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,aAAa,EAAE,WAAW,CAAC,qC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KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,2CAA2C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { arraySchema, loosePlainObject, nonEmptyStringSchema } from \"../schema\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"../util\";\nimport { PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT } from \"../util/principalHistoryWire\";\nimport { ContainerMutationResponseSchema } from \"./container\";\nimport { CONTAINER_MUTATION_STATE_STALE_ERROR_CODE } from \"./containerMutationStateStaleError\";\nimport { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from \"./descendantRekeysRequiredError\";\nimport { BillingErrorResponseSchema } from \"./organizationBilling\";\nimport { ReferencedPrincipalStateResponseSchema } from \"./principalReference\";\n\nimport {\n CurrentPrincipalMemberEnvelopesResponseSchema,\n PrincipalContainerGrantResponseSchema,\n PrincipalPolicyStateChainEntryResponseSchema,\n PrincipalProjectionMemberResponseSchema,\n PrincipalStatePayloadResponseSchema,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport {\n type CurrentPrincipalMemberEnvelopesResponse,\n CurrentPrincipalMemberEnvelopesResponseSchema,\n isCurrentPrincipalMemberEnvelopesResponse,\n isPrincipalPolicyStateChainEntryResponse,\n isPrincipalStatePayloadResponse,\n isPrincipalStateResponse,\n type PrincipalContainerGrantResponse,\n PrincipalContainerGrantResponseSchema,\n type PrincipalMemberEnvelopeResponse,\n PrincipalMemberEnvelopeResponseSchema,\n type PrincipalPolicySnapshotResponse,\n PrincipalPolicySnapshotResponseSchema,\n type PrincipalPolicyStateChainEntryResponse,\n PrincipalPolicyStateChainEntryResponseSchema,\n type PrincipalProjectionMemberResponse,\n PrincipalProjectionMemberResponseSchema,\n type PrincipalStateExternalAuthorityResponse,\n PrincipalStateExternalAuthorityResponseSchema,\n type PrincipalStatePayloadResponse,\n PrincipalStatePayloadResponseSchema,\n type PrincipalStateResponse,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport const principalPolicyCurrentResponseShape = {\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentMemberEnvelopes: CurrentPrincipalMemberEnvelopesResponseSchema,\n currentPayload: PrincipalStatePayloadResponseSchema,\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n};\n\nexport const PrincipalPolicyBundleResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicyBundleResponse = z.infer<\n typeof PrincipalPolicyBundleResponseSchema\n>;\n\nexport const PrincipalPolicyMutationResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n containerMutations: arraySchema(ContainerMutationResponseSchema),\n});\n\nexport type PrincipalPolicyMutationResponse = z.infer<\n typeof PrincipalPolicyMutationResponseSchema\n>;\n\nexport const CommitOrganizationGroupPolicyResponseSchema = loosePlainObject({\n groupPolicy: PrincipalPolicyMutationResponseSchema,\n memberPolicy: PrincipalPolicyMutationResponseSchema.optional(),\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n});\n\nexport type CommitOrganizationGroupPolicyResponse = z.infer<\n typeof CommitOrganizationGroupPolicyResponseSchema\n>;\n\nexport const PrincipalPolicyErrorResponseSchema = BillingErrorResponseSchema;\n\nexport type PrincipalPolicyErrorResponse = z.infer<\n typeof PrincipalPolicyErrorResponseSchema\n>;\n\n/**\n * A group policy change rematerializes its granted containers, and a rekey or\n * revoke among them is a rotation like any other: one that would leave a level\n * above a directly granted container pinned to a retired epoch is refused, and\n * this names the descendant rekeys the batch must carry, parent-first.\n */\nconst PrincipalPolicyDescendantRekeysRequiredResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE),\n error: z.string().min(1),\n requiredContainerIds: arraySchema(\n nonEmptyStringSchema,\n MAX_ROTATION_CONTAINER_REKEYS,\n ),\n});\n\n/**\n * The commit's conflict envelope alone: only a group commit carries container\n * mutations, so only it can be refused for what they strand. The principal\n * policy read and the organization policy write keep the plain envelope.\n */\nexport const CommitOrganizationGroupPolicyConflictResponseSchema = z.union([\n PrincipalPolicyErrorResponseSchema,\n PrincipalPolicyDescendantRekeysRequiredResponseSchema,\n loosePlainObject({\n code: z.literal(CONTAINER_MUTATION_STATE_STALE_ERROR_CODE),\n error: z.string().min(1),\n }),\n]);\n\nexport const PrincipalPolicyStaleErrorResponseSchema = loosePlainObject({\n code: z.literal(\"principal_policy_stale\"),\n error: z.string().min(1),\n principalHeads: arraySchema(\n ReferencedPrincipalStateResponseSchema,\n PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT,\n ),\n});\n\nexport type PrincipalPolicyStaleErrorResponse = z.infer<\n typeof PrincipalPolicyStaleErrorResponseSchema\n>;\n\nexport function isPrincipalPolicyBundleResponse(\n value: unknown,\n): value is PrincipalPolicyBundleResponse {\n return PrincipalPolicyBundleResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyMutationResponse(\n value: unknown,\n): value is PrincipalPolicyMutationResponse {\n return PrincipalPolicyMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isCommitOrganizationGroupPolicyResponse(\n value: unknown,\n): value is CommitOrganizationGroupPolicyResponse {\n return CommitOrganizationGroupPolicyResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStaleErrorResponse(\n value: unknown,\n): value is PrincipalPolicyStaleErrorResponse {\n return PrincipalPolicyStaleErrorResponseSchema.safeParse(value).success;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,36 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* Drop every cached writer projection a hint invalidates, before hydration
|
|
4
|
-
* lands, so the next share or move fetches a fresh one instead of submitting
|
|
5
|
-
* against a stale manifest and conflicting. Descendants cite the same ancestor
|
|
6
|
-
* manifests in their paths, so the locally known subtree under each invalidated
|
|
7
|
-
* container is dropped too (an unhydrated subtree has nothing cached). Both
|
|
8
|
-
* layers go: the in-memory copies on each container state, and the api-client's
|
|
9
|
-
* cached writer projections that cite an invalidated container. Document
|
|
10
|
-
* projections cite their paths too, so they are found by citation rather than
|
|
11
|
-
* through the links, which live in SQLite; projections citing none of them stay
|
|
12
|
-
* cached (#2395). Each open document store drops its own in-memory copy on the
|
|
13
|
-
* same hint.
|
|
14
|
-
*/
|
|
1
|
+
import { invalidateContainerProjectionCaches } from "../../../workflows/container-contents/container-state/projectionCache.js";
|
|
2
|
+
/** Store-facing adapter shared by realtime event handlers. */
|
|
15
3
|
export function invalidateCachedProjections(state, invalidated) {
|
|
16
|
-
|
|
17
|
-
return;
|
|
18
|
-
const roots = new Set(invalidated);
|
|
19
|
-
const stale = new Set(invalidated);
|
|
20
|
-
for (const [id, containerState] of state.containersById) {
|
|
21
|
-
let parentId = containerState.container.parentId;
|
|
22
|
-
for (let depth = 0; parentId !== null &&
|
|
23
|
-
!roots.has(parentId) &&
|
|
24
|
-
depth < state.containersById.size; depth++)
|
|
25
|
-
parentId = state.containersById.get(parentId)?.container.parentId ?? null;
|
|
26
|
-
if (parentId !== null)
|
|
27
|
-
stale.add(id);
|
|
28
|
-
}
|
|
29
|
-
for (const id of stale) {
|
|
30
|
-
const containerState = state.containersById.get(id);
|
|
31
|
-
if (containerState)
|
|
32
|
-
invalidateContainerProjections(containerState);
|
|
33
|
-
}
|
|
34
|
-
state.runtime.apiClient.evictWriterProjectionsCiting(invalidated);
|
|
4
|
+
invalidateContainerProjectionCaches(state, invalidated);
|
|
35
5
|
}
|
|
36
6
|
//# sourceMappingURL=remoteEventProjectionInvalidation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteEventProjectionInvalidation.js","sourceRoot":"","sources":["remoteEventProjectionInvalidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"remoteEventProjectionInvalidation.js","sourceRoot":"","sources":["remoteEventProjectionInvalidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,uEAAuE,CAAC;AAG5H,8DAA8D;AAC9D,MAAM,UAAU,2BAA2B,CACzC,KAA0E,EAC1E,WAA8B;IAE9B,mCAAmC,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import { invalidateContainerProjectionCaches } from \"../../../workflows/container-contents/container-state/projectionCache\";\nimport type { ContainerContentsStoreSyncState } from \"../syncAgent/syncAgentTypes\";\n\n/** Store-facing adapter shared by realtime event handlers. */\nexport function invalidateCachedProjections(\n state: Pick<ContainerContentsStoreSyncState, \"containersById\" | \"runtime\">,\n invalidated: readonly string[],\n): void {\n invalidateContainerProjectionCaches(state, invalidated);\n}\n"]}
|
|
@@ -68,4 +68,38 @@ export async function loadContainerWriterProjectionForState(input) {
|
|
|
68
68
|
}
|
|
69
69
|
return projection;
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Drop every cached writer projection a hint or listing invalidates before hydration
|
|
73
|
+
* lands, so the next share or move fetches a fresh one instead of submitting
|
|
74
|
+
* against a stale manifest and conflicting. Descendants cite the same ancestor
|
|
75
|
+
* manifests in their paths, so the locally known subtree under each invalidated
|
|
76
|
+
* container is dropped too (an unhydrated subtree has nothing cached). Both
|
|
77
|
+
* layers go: the in-memory copies on each container state, and the api-client's
|
|
78
|
+
* cached writer projections that cite an invalidated container. Document
|
|
79
|
+
* projections cite their paths too, so they are found by citation rather than
|
|
80
|
+
* through the links, which live in SQLite; projections citing none of them stay
|
|
81
|
+
* cached (#2395). Each open document store drops its own in-memory copy on the
|
|
82
|
+
* same realtime hint; explicit document pulls obtain fresh projections.
|
|
83
|
+
*/
|
|
84
|
+
export function invalidateContainerProjectionCaches(state, invalidated) {
|
|
85
|
+
if (invalidated.length === 0)
|
|
86
|
+
return;
|
|
87
|
+
const roots = new Set(invalidated);
|
|
88
|
+
const stale = new Set(invalidated);
|
|
89
|
+
for (const [id, containerState] of state.containersById) {
|
|
90
|
+
let parentId = containerState.container.parentId;
|
|
91
|
+
for (let depth = 0; parentId !== null &&
|
|
92
|
+
!roots.has(parentId) &&
|
|
93
|
+
depth < state.containersById.size; depth++)
|
|
94
|
+
parentId = state.containersById.get(parentId)?.container.parentId ?? null;
|
|
95
|
+
if (parentId !== null)
|
|
96
|
+
stale.add(id);
|
|
97
|
+
}
|
|
98
|
+
for (const id of stale) {
|
|
99
|
+
const containerState = state.containersById.get(id);
|
|
100
|
+
if (containerState)
|
|
101
|
+
invalidateContainerProjections(containerState);
|
|
102
|
+
}
|
|
103
|
+
state.runtime.apiClient.evictWriterProjectionsCiting(invalidated);
|
|
104
|
+
}
|
|
71
105
|
//# sourceMappingURL=projectionCache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectionCache.js","sourceRoot":"","sources":["projectionCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"projectionCache.js","sourceRoot":"","sources":["projectionCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAO/D,SAAS,qCAAqC,CAAC,KAG9C;IACC,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC7C,IAAI,UAAU,CAAC,WAAW,KAAK,cAAc,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE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AG,CAAC,EACb,QAAQ,KAAK,IAAI;YACjB,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;YACpB,KAAK,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,EACjC,KAAK,EAAE;YAEP,QAAQ,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC;QAC5E,IAAI,QAAQ,KAAK,IAAI;YAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpD,IAAI,cAAc;YAAE,8BAA8B,CAAC,cAAc,CAAC,CAAC;IACrE,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,4BAA4B,CAAC,WAAW,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import type { ContainerWriterProjectionResponse } from \"@tearleads/validators/response\";\nimport { projectionGeneration } from \"../projectionGeneration\";\nimport type {\n ContainerState,\n RemoteContainerHydrationState,\n} from \"../remoteHydration/types\";\nimport type { ContainerWorkflowRuntime } from \"./types\";\n\nfunction cachedProjectionMatchesContainerState(input: {\n containerState: ContainerState;\n projection: ContainerWriterProjectionResponse;\n}): boolean {\n const { containerState, projection } = input;\n if (projection.containerId !== containerState.container.id) {\n return false;\n }\n\n const targetManifest = projection.path.at(-1);\n const targetKek = projection.containerKeks.at(-1);\n if (\n !targetManifest ||\n !targetKek ||\n targetKek.containerId !== projection.containerId ||\n targetKek.accessManifestHash !== targetManifest.manifestHash\n ) {\n return false;\n }\n\n const expectedAccessStateHash = containerState.record.accessStateHash;\n return (\n typeof expectedAccessStateHash !== \"string\" ||\n expectedAccessStateHash.length === 0 ||\n targetManifest.manifestHash === expectedAccessStateHash\n );\n}\n\nexport function getCachedContainerWriterProjection(\n containerState: ContainerState,\n): ContainerWriterProjectionResponse | null {\n const projection = containerState.containerWriterProjection ?? null;\n return projection &&\n cachedProjectionMatchesContainerState({ containerState, projection })\n ? projection\n : null;\n}\n\n// A hint can invalidate a container while its load is in flight; each retry\n// re-reads the generation, so this only bounds a pathological hint storm.\nconst MAX_PROJECTION_LOAD_ATTEMPTS = 3;\n\n/**\n * Drop both cached writer projections (the container's and its metadata\n * document's) and advance their shared generation, so an operation that\n * started before this invalidation (and may carry a pre-hint manifest) cannot\n * install its result.\n */\nexport function invalidateContainerProjections(\n containerState: ContainerState,\n): void {\n containerState.containerWriterProjection = null;\n containerState.metadataWriterProjection = null;\n containerState.writerProjectionGeneration =\n projectionGeneration(containerState) + 1;\n}\n\n/**\n * Install a container projection an operation fetched or was handed back,\n * unless a hint invalidated the container while that operation ran: its\n * answer may predate the hint, so the slot is left as the hint left it and the\n * next operation fetches fresh.\n */\nexport function installContainerWriterProjection(\n containerState: ContainerState,\n projection: ContainerWriterProjectionResponse | null,\n capturedGeneration: number,\n): void {\n if (projectionGeneration(containerState) !== capturedGeneration) return;\n containerState.containerWriterProjection = projection;\n}\n\nexport async function loadContainerWriterProjectionForState(input: {\n containerState: ContainerState;\n runtime: ContainerWorkflowRuntime;\n}): Promise<ContainerWriterProjectionResponse | null> {\n const cachedProjection = getCachedContainerWriterProjection(\n input.containerState,\n );\n if (cachedProjection) {\n return cachedProjection;\n }\n\n let projection: ContainerWriterProjectionResponse | null = null;\n for (let attempt = 0; attempt < MAX_PROJECTION_LOAD_ATTEMPTS; attempt++) {\n const generation = projectionGeneration(input.containerState);\n projection = await input.runtime.apiClient.getContainerWriterProjection(\n input.containerState.container.id,\n );\n if (projectionGeneration(input.containerState) === generation) {\n installContainerWriterProjection(\n input.containerState,\n projection,\n generation,\n );\n return projection;\n }\n // Invalidated while in flight (the api-client entry went with it): this\n // answer may predate the hint, so fetch again instead of caching it.\n }\n return projection;\n}\n\n/**\n * Drop every cached writer projection a hint or listing invalidates before hydration\n * lands, so the next share or move fetches a fresh one instead of submitting\n * against a stale manifest and conflicting. Descendants cite the same ancestor\n * manifests in their paths, so the locally known subtree under each invalidated\n * container is dropped too (an unhydrated subtree has nothing cached). Both\n * layers go: the in-memory copies on each container state, and the api-client's\n * cached writer projections that cite an invalidated container. Document\n * projections cite their paths too, so they are found by citation rather than\n * through the links, which live in SQLite; projections citing none of them stay\n * cached (#2395). Each open document store drops its own in-memory copy on the\n * same realtime hint; explicit document pulls obtain fresh projections.\n */\nexport function invalidateContainerProjectionCaches(\n state: Pick<RemoteContainerHydrationState, \"containersById\" | \"runtime\">,\n invalidated: readonly string[],\n): void {\n if (invalidated.length === 0) return;\n const roots = new Set(invalidated);\n const stale = new Set(invalidated);\n for (const [id, containerState] of state.containersById) {\n let parentId = containerState.container.parentId;\n for (\n let depth = 0;\n parentId !== null &&\n !roots.has(parentId) &&\n depth < state.containersById.size;\n depth++\n )\n parentId = state.containersById.get(parentId)?.container.parentId ?? null;\n if (parentId !== null) stale.add(id);\n }\n for (const id of stale) {\n const containerState = state.containersById.get(id);\n if (containerState) invalidateContainerProjections(containerState);\n }\n state.runtime.apiClient.evictWriterProjectionsCiting(invalidated);\n}\n"]}
|