@tearleads/client-sdk 0.1.242 → 0.1.244
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/organizations/currentPrincipalMutations.js +1 -0
- package/client/organizations/currentPrincipalMutations.js.map +1 -1
- package/client/organizations/principalMutations.d.ts +5 -0
- package/client/organizations/principalMutations.js +1 -0
- package/client/organizations/principalMutations.js.map +1 -1
- package/data/containers/shared/mutationAcknowledgement.d.ts +1 -1
- package/data/containers/shared/mutationAcknowledgement.js +3 -8
- package/data/containers/shared/mutationAcknowledgement.js.map +1 -1
- package/data/documents/shared/sync/mutationAcknowledgement.js +11 -2
- package/data/documents/shared/sync/mutationAcknowledgement.js.map +1 -1
- package/data/keyingProjectionVerification/checkpoints/heldBundleRecovery.d.ts +26 -0
- package/data/keyingProjectionVerification/checkpoints/heldBundleRecovery.js +46 -0
- package/data/keyingProjectionVerification/checkpoints/heldBundleRecovery.js.map +1 -0
- package/data/keyingProjectionVerification/container/containerDestinationVerification.d.ts +7 -4
- package/data/keyingProjectionVerification/container/containerDestinationVerification.js +5 -1
- package/data/keyingProjectionVerification/container/containerDestinationVerification.js.map +1 -1
- package/data/keyingProjectionVerification/container/containerProjectionVerification.js +9 -2
- package/data/keyingProjectionVerification/container/containerProjectionVerification.js.map +1 -1
- package/data/keyingProjectionVerification/document/documentContainerProjections.js +2 -1
- package/data/keyingProjectionVerification/document/documentContainerProjections.js.map +1 -1
- package/data/keyingProjectionVerification/document/documentProjectionVerification.js +9 -2
- package/data/keyingProjectionVerification/document/documentProjectionVerification.js.map +1 -1
- package/data/keyingProjectionVerification/index.d.ts +1 -0
- package/data/keyingProjectionVerification/index.js +1 -0
- package/data/keyingProjectionVerification/index.js.map +1 -1
- package/data/persistence/keyingCheckpoints/keyingCheckpointRepository.js +16 -4
- package/data/persistence/keyingCheckpoints/keyingCheckpointRepository.js.map +1 -1
- package/data/persistence/keyingCheckpoints/locallyAcknowledgedCheckpointPersistence.d.ts +13 -0
- package/data/persistence/keyingCheckpoints/locallyAcknowledgedCheckpointPersistence.js +11 -0
- package/data/persistence/keyingCheckpoints/locallyAcknowledgedCheckpointPersistence.js.map +1 -1
- package/data/persistence/verifiedCitations/authoredBundleCitation.d.ts +20 -0
- package/data/persistence/verifiedCitations/authoredBundleCitation.js +32 -0
- package/data/persistence/verifiedCitations/authoredBundleCitation.js.map +1 -0
- package/data/persistence/verifiedManifestBundlePersistence.d.ts +10 -0
- package/data/persistence/verifiedManifestBundlePersistence.js +95 -9
- package/data/persistence/verifiedManifestBundlePersistence.js.map +1 -1
- package/data/principals/organizationDirectoryKeying.js +136 -0
- package/data/principals/organizationDirectoryKeying.js.map +1 -0
- package/data/principals/organizationGroupDirectoryRequest.js +17 -11
- package/data/principals/organizationGroupDirectoryRequest.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +55 -0
- package/internal/api-client/client/containerMutations.d.ts +11 -0
- package/internal/api-client/client/documents.d.ts +5 -0
- package/internal/api-client/client/organizations.d.ts +20 -0
- package/internal/api-client/client/principalPolicies.d.ts +9 -0
- package/internal/api-client/client/session.d.ts +10 -0
- package/internal/api-client/principalPolicyRequests.d.ts +7 -0
- package/internal/api-client/writerProjectionCitations.d.ts +3 -0
- package/internal/api-client/writerProjectionCitations.js +12 -0
- package/internal/api-client/writerProjectionCitations.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/canonicalJsonGuard.d.ts +13 -0
- package/internal/crypto/keying/canonicalJsonGuard.js +23 -0
- package/internal/crypto/keying/canonicalJsonGuard.js.map +1 -1
- package/internal/crypto/keying/index.d.ts +1 -1
- package/internal/crypto/keying/index.js +1 -1
- package/internal/crypto/keying/index.js.map +1 -1
- package/internal/crypto/keying/keyingHashDomains.d.ts +1 -1
- package/internal/crypto/keying/keyingHashDomains.js.map +1 -1
- package/internal/validators/operation/auth.d.ts +40 -0
- package/internal/validators/operation/containerMutations.d.ts +44 -0
- package/internal/validators/operation/documentMutations.d.ts +12 -0
- package/internal/validators/operation/organizations.d.ts +48 -0
- package/internal/validators/operation/principals.d.ts +16 -0
- package/internal/validators/response/areas/containers.d.ts +1 -1
- package/internal/validators/response/areas/containers.js +1 -1
- package/internal/validators/response/areas/containers.js.map +1 -1
- package/internal/validators/response/container.d.ts +16 -0
- package/internal/validators/response/container.js +3 -0
- package/internal/validators/response/container.js.map +1 -1
- package/internal/validators/response/containerMetadata.d.ts +8 -0
- package/internal/validators/response/documentMutation.d.ts +8 -0
- package/internal/validators/response/documentMutation.js +2 -1
- package/internal/validators/response/documentMutation.js.map +1 -1
- package/internal/validators/response/organization.d.ts +8 -0
- package/internal/validators/response/organizationProvisioning.d.ts +113 -0
- package/internal/validators/response/organizationProvisioning.js +2 -1
- package/internal/validators/response/organizationProvisioning.js.map +1 -1
- package/internal/validators/response/principal.d.ts +16 -0
- package/internal/validators/response/registration.d.ts +40 -0
- package/internal/validators/response/writerProjectionWire.d.ts +25 -0
- package/internal/validators/response/writerProjectionWire.js +109 -3
- package/internal/validators/response/writerProjectionWire.js.map +1 -1
- package/package.json +1 -1
- package/stores/documents/documentStore/rotation/index.js +3 -1
- package/stores/documents/documentStore/rotation/index.js.map +1 -1
- package/stores/documents/documentStore/sync/syncAttachments.js +4 -1
- package/stores/documents/documentStore/sync/syncAttachments.js.map +1 -1
- package/stores/documents/documentStore/sync/syncDetachedAttachments.js +3 -1
- package/stores/documents/documentStore/sync/syncDetachedAttachments.js.map +1 -1
- package/stores/documents/documentStore/sync/syncRequest.js +3 -1
- package/stores/documents/documentStore/sync/syncRequest.js.map +1 -1
- package/workflows/container-contents/container-state/create/createAdoption.js +11 -3
- package/workflows/container-contents/container-state/create/createAdoption.js.map +1 -1
- package/workflows/container-contents/container-state/create/createWithMetadata.js +2 -2
- package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -1
- package/workflows/container-contents/container-state/projectionCache.js +3 -0
- package/workflows/container-contents/container-state/projectionCache.js.map +1 -1
- package/workflows/container-contents/metadata/index.js +5 -2
- package/workflows/container-contents/metadata/index.js.map +1 -1
- package/workflows/containers/child/recite.js +4 -2
- package/workflows/containers/child/recite.js.map +1 -1
- package/workflows/documents/create/createAdoption.js +11 -2
- package/workflows/documents/create/createAdoption.js.map +1 -1
- package/workflows/documents/create/createResponse.js +1 -0
- package/workflows/documents/create/createResponse.js.map +1 -1
- package/workflows/documents/linkSet/linkSetRemote.js +1 -0
- package/workflows/documents/linkSet/linkSetRemote.js.map +1 -1
- package/workflows/documents/sync/syncAttemptPlanning.js +8 -2
- package/workflows/documents/sync/syncAttemptPlanning.js.map +1 -1
- package/workflows/documents/syncRekeys/syncAutomaticContainerRekeys.js +3 -2
- package/workflows/documents/syncRekeys/syncAutomaticContainerRekeys.js.map +1 -1
- package/workflows/documents/syncRekeys/syncContainerRekeyProjection.js +3 -2
- package/workflows/documents/syncRekeys/syncContainerRekeyProjection.js.map +1 -1
- package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js +1 -0
- package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js.map +1 -1
- package/workflows/organizations/groupShare/currentShareGrantMutation.js +3 -0
- package/workflows/organizations/groupShare/currentShareGrantMutation.js.map +1 -1
- package/workflows/organizations/groupShare/shareWithGroup.js +2 -0
- package/workflows/organizations/groupShare/shareWithGroup.js.map +1 -1
- package/workflows/organizations/groups/createCurrentOrganizationGroup.js +3 -0
- package/workflows/organizations/groups/createCurrentOrganizationGroup.js.map +1 -1
- package/workflows/organizations/groups/deleteCurrentOrganizationGroup.js +1 -0
- package/workflows/organizations/groups/deleteCurrentOrganizationGroup.js.map +1 -1
- package/workflows/organizations/groups/deleteOrganizationGroup.d.ts +2 -0
- package/workflows/organizations/groups/deleteOrganizationGroup.js +1 -0
- package/workflows/organizations/groups/deleteOrganizationGroup.js.map +1 -1
- package/workflows/organizations/groups/organizationGroupDirectory.js +1 -0
- package/workflows/organizations/groups/organizationGroupDirectory.js.map +1 -1
- package/workflows/organizations/principalPolicy/index.d.ts +12 -0
- package/workflows/organizations/principalPolicy/index.js +11 -0
- package/workflows/organizations/principalPolicy/index.js.map +1 -1
- package/workflows/registration/organizationCreation/organizationCreationIntent.d.ts +10 -0
- package/workflows/registration/provisioningAcknowledgement.js +16 -11
- package/workflows/registration/provisioningAcknowledgement.js.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { registerJsonSchemaRuntimeRefinements } from "../jsonSchema.js";
|
|
3
3
|
import { organizationProvisioningCommittedUpdateIdsRefinement } from "../organizationProvisioningRefinements.js";
|
|
4
|
-
import { arraySchema, loosePlainObject, nonEmptyStringSchema, uuidV4StringSchema, } from "../schema.js";
|
|
4
|
+
import { arraySchema, loosePlainObject, nonEmptyStringSchema, sha256HexStringSchema, uuidV4StringSchema, } from "../schema.js";
|
|
5
5
|
import { OrganizationReplacementAuthorizationSchema } from "../util/organizationReplacement.js";
|
|
6
6
|
import { ContainerCreateWithMetadataDocumentResponseSchema } from "./containerMetadata.js";
|
|
7
7
|
import { DocumentCreateResponseSchema } from "./documentMutation.js";
|
|
@@ -23,6 +23,7 @@ export const organizationProvisioningResponseShape = {
|
|
|
23
23
|
organizationMetadataContainerId: z.string(),
|
|
24
24
|
organizationProfileDocument: DocumentCreateResponseSchema.optional(),
|
|
25
25
|
organizationProfileDocumentId: z.string().optional(),
|
|
26
|
+
rootBundleDigest: sha256HexStringSchema,
|
|
26
27
|
rootContainerId: z.string(),
|
|
27
28
|
rootMetadataAccessEpoch: z.number(),
|
|
28
29
|
rootMetadataAccessStateHash: nonEmptyStringSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizationProvisioning.js","sourceRoot":"","sources":["organizationProvisioning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oCAAoC,EAAE,MAAM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sonSchema\";\nimport { organizationProvisioningCommittedUpdateIdsRefinement } from \"../organizationProvisioningRefinements\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n uuidV4StringSchema,\n} from \"../schema\";\nimport { OrganizationReplacementAuthorizationSchema } from \"../util/organizationReplacement\";\nimport { ContainerCreateWithMetadataDocumentResponseSchema } from \"./containerMetadata\";\nimport { DocumentCreateResponseSchema } from \"./documentMutation\";\n\n/**\n * The bootstrapped state of a freshly provisioned organization: the ids and\n * signed personal and organization metadata roots the client needs to open the\n * organization locally, plus the optional roster/organization profile artifacts.\n *\n * Shared by user registration (which additionally issues an auth challenge, see\n * {@link RegistrationResponse}) and creating an additional organization for an\n * already-authenticated user ({@link CreateOrganizationResponse}).\n */\nconst committedUpdateIdsSchema = arraySchema(uuidV4StringSchema);\n\nexport const organizationProvisioningResponseShape = {\n committedCoreMetadataUpdateIds: committedUpdateIdsSchema,\n committedProfileUpdateIds: committedUpdateIdsSchema,\n organizationId: z.string(),\n organizationMetadataContainer:\n ContainerCreateWithMetadataDocumentResponseSchema,\n organizationMetadataContainerId: z.string(),\n organizationProfileDocument: DocumentCreateResponseSchema.optional(),\n organizationProfileDocumentId: z.string().optional(),\n rootContainerId: z.string(),\n rootMetadataAccessEpoch: z.number(),\n rootMetadataAccessStateHash: nonEmptyStringSchema,\n rootMetadataDocument: DocumentCreateResponseSchema,\n rootMetadataDocumentId: z.string(),\n rosterProfileContainer:\n ContainerCreateWithMetadataDocumentResponseSchema.optional(),\n rosterProfileContainerId: z.string().optional(),\n rosterProfileDocument: DocumentCreateResponseSchema.optional(),\n rosterProfileDocumentId: z.string().optional(),\n systemContainers: arraySchema(\n ContainerCreateWithMetadataDocumentResponseSchema,\n ),\n userId: z.string(),\n} satisfies z.ZodRawShape;\n\nexport function addCommittedUpdateIdIssues(\n value: z.output<z.ZodObject<typeof organizationProvisioningResponseShape>>,\n context: z.core.$RefinementCtx<unknown>,\n): void {\n for (const key of [\n \"committedCoreMetadataUpdateIds\",\n \"committedProfileUpdateIds\",\n ] as const) {\n if (!Array.isArray(value[key])) {\n continue;\n }\n if (new Set(value[key]).size !== value[key].length) {\n context.addIssue({\n code: \"custom\",\n message: \"committed update ids must be unique\",\n path: [key],\n });\n }\n }\n}\n\nexport const OrganizationProvisioningResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(organizationProvisioningResponseShape).superRefine(\n addCommittedUpdateIdIssues,\n ),\n [organizationProvisioningCommittedUpdateIdsRefinement],\n );\n\nexport type OrganizationProvisioningResponse = z.infer<\n typeof OrganizationProvisioningResponseSchema\n>;\n\nexport function isOrganizationProvisioningResponse(\n value: unknown,\n): value is OrganizationProvisioningResponse {\n return OrganizationProvisioningResponseSchema.safeParse(value).success;\n}\n\n/**\n * Response to creating an additional organization for the authenticated user.\n * The user is already registered, so unlike registration this carries no auth\n * challenge. Replacements additionally carry identity-signed recovery intent.\n */\nexport const CreateOrganizationResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...organizationProvisioningResponseShape,\n replacementAuthorization:\n OrganizationReplacementAuthorizationSchema.nullable(),\n }).superRefine(addCommittedUpdateIdIssues),\n [organizationProvisioningCommittedUpdateIdsRefinement],\n );\n\nexport type CreateOrganizationResponse = z.infer<\n typeof CreateOrganizationResponseSchema\n>;\n\nexport function isCreateOrganizationResponse(\n value: unknown,\n): value is CreateOrganizationResponse {\n return CreateOrganizationResponseSchema.safeParse(value).success;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"organizationProvisioning.js","sourceRoot":"","sources":["organizationProvisioning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,oDAAoD,EAAE,MAAM,wCAAwC,CAAC;AAC9G,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GAC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AgC;QAChC,2BAA2B;KACnB,EAAE,CAAC;QACX,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC/B,SAAS;QACX,CAAC;QACD,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;YACnD,OAAO,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,qCAAqC;gBAC9C,IAAI,EAAE,CAAC,GAAG,CAAC;aACZ,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,sCAAsC,GACjD,oCAAoC,CAClC,gBAAgB,CAAC,qCAAqC,CAAC,CAAC,WAAW,CACjE,0BAA0B,CAC3B,EACD,CAAC,oDAAoD,CAAC,CACvD,CAAC;AAMJ,MAAM,UAAU,kCAAkC,CAChD,KAAc;IAEd,OAAO,sCAAsC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACzE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAC3C,oCAAoC,CAClC,gBAAgB,CAAC;IACf,GAAG,qCAAqC;IACxC,wBAAwB,EACtB,0CAA0C,CAAC,QAAQ,EAAE;CACxD,CAAC,CAAC,WAAW,CAAC,0BAA0B,CAAC,EAC1C,CAAC,oDAAoD,CAAC,CACvD,CAAC;AAMJ,MAAM,UAAU,4BAA4B,CAC1C,KAAc;IAEd,OAAO,gCAAgC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACnE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport { organizationProvisioningCommittedUpdateIdsRefinement } from \"../organizationProvisioningRefinements\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n sha256HexStringSchema,\n uuidV4StringSchema,\n} from \"../schema\";\nimport { OrganizationReplacementAuthorizationSchema } from \"../util/organizationReplacement\";\nimport { ContainerCreateWithMetadataDocumentResponseSchema } from \"./containerMetadata\";\nimport { DocumentCreateResponseSchema } from \"./documentMutation\";\n\n/**\n * The bootstrapped state of a freshly provisioned organization: the ids and\n * signed personal and organization metadata roots the client needs to open the\n * organization locally, plus the optional roster/organization profile artifacts.\n *\n * Shared by user registration (which additionally issues an auth challenge, see\n * {@link RegistrationResponse}) and creating an additional organization for an\n * already-authenticated user ({@link CreateOrganizationResponse}).\n */\nconst committedUpdateIdsSchema = arraySchema(uuidV4StringSchema);\n\nexport const organizationProvisioningResponseShape = {\n committedCoreMetadataUpdateIds: committedUpdateIdsSchema,\n committedProfileUpdateIds: committedUpdateIdsSchema,\n organizationId: z.string(),\n organizationMetadataContainer:\n ContainerCreateWithMetadataDocumentResponseSchema,\n organizationMetadataContainerId: z.string(),\n organizationProfileDocument: DocumentCreateResponseSchema.optional(),\n organizationProfileDocumentId: z.string().optional(),\n rootBundleDigest: sha256HexStringSchema,\n rootContainerId: z.string(),\n rootMetadataAccessEpoch: z.number(),\n rootMetadataAccessStateHash: nonEmptyStringSchema,\n rootMetadataDocument: DocumentCreateResponseSchema,\n rootMetadataDocumentId: z.string(),\n rosterProfileContainer:\n ContainerCreateWithMetadataDocumentResponseSchema.optional(),\n rosterProfileContainerId: z.string().optional(),\n rosterProfileDocument: DocumentCreateResponseSchema.optional(),\n rosterProfileDocumentId: z.string().optional(),\n systemContainers: arraySchema(\n ContainerCreateWithMetadataDocumentResponseSchema,\n ),\n userId: z.string(),\n} satisfies z.ZodRawShape;\n\nexport function addCommittedUpdateIdIssues(\n value: z.output<z.ZodObject<typeof organizationProvisioningResponseShape>>,\n context: z.core.$RefinementCtx<unknown>,\n): void {\n for (const key of [\n \"committedCoreMetadataUpdateIds\",\n \"committedProfileUpdateIds\",\n ] as const) {\n if (!Array.isArray(value[key])) {\n continue;\n }\n if (new Set(value[key]).size !== value[key].length) {\n context.addIssue({\n code: \"custom\",\n message: \"committed update ids must be unique\",\n path: [key],\n });\n }\n }\n}\n\nexport const OrganizationProvisioningResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject(organizationProvisioningResponseShape).superRefine(\n addCommittedUpdateIdIssues,\n ),\n [organizationProvisioningCommittedUpdateIdsRefinement],\n );\n\nexport type OrganizationProvisioningResponse = z.infer<\n typeof OrganizationProvisioningResponseSchema\n>;\n\nexport function isOrganizationProvisioningResponse(\n value: unknown,\n): value is OrganizationProvisioningResponse {\n return OrganizationProvisioningResponseSchema.safeParse(value).success;\n}\n\n/**\n * Response to creating an additional organization for the authenticated user.\n * The user is already registered, so unlike registration this carries no auth\n * challenge. Replacements additionally carry identity-signed recovery intent.\n */\nexport const CreateOrganizationResponseSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...organizationProvisioningResponseShape,\n replacementAuthorization:\n OrganizationReplacementAuthorizationSchema.nullable(),\n }).superRefine(addCommittedUpdateIdIssues),\n [organizationProvisioningCommittedUpdateIdsRefinement],\n );\n\nexport type CreateOrganizationResponse = z.infer<\n typeof CreateOrganizationResponseSchema\n>;\n\nexport function isCreateOrganizationResponse(\n value: unknown,\n): value is CreateOrganizationResponse {\n return CreateOrganizationResponseSchema.safeParse(value).success;\n}\n"]}
|
|
@@ -652,6 +652,7 @@ export declare const PrincipalPolicyMutationResponseSchema: z.ZodType<{
|
|
|
652
652
|
keyTargetHash: string;
|
|
653
653
|
parentContainerKeyEpochId: string | null;
|
|
654
654
|
};
|
|
655
|
+
bundleDigest: string;
|
|
655
656
|
containerId: string;
|
|
656
657
|
createdAt: string;
|
|
657
658
|
eventHash: string;
|
|
@@ -683,6 +684,7 @@ export declare const PrincipalPolicyMutationResponseSchema: z.ZodType<{
|
|
|
683
684
|
keyTargetHash: string;
|
|
684
685
|
parentContainerKeyEpochId: string | null;
|
|
685
686
|
};
|
|
687
|
+
bundleDigest: string;
|
|
686
688
|
containerId: string;
|
|
687
689
|
createdAt: string;
|
|
688
690
|
eventHash: string;
|
|
@@ -714,6 +716,7 @@ export declare const PrincipalPolicyMutationResponseSchema: z.ZodType<{
|
|
|
714
716
|
keyTargetHash: string;
|
|
715
717
|
parentContainerKeyEpochId: string | null;
|
|
716
718
|
};
|
|
719
|
+
bundleDigest: string;
|
|
717
720
|
containerId: string;
|
|
718
721
|
createdAt: string;
|
|
719
722
|
eventHash: string;
|
|
@@ -745,6 +748,7 @@ export declare const PrincipalPolicyMutationResponseSchema: z.ZodType<{
|
|
|
745
748
|
keyTargetHash: string;
|
|
746
749
|
parentContainerKeyEpochId: string | null;
|
|
747
750
|
};
|
|
751
|
+
bundleDigest: string;
|
|
748
752
|
containerId: string;
|
|
749
753
|
createdAt: string;
|
|
750
754
|
eventHash: string;
|
|
@@ -779,6 +783,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
779
783
|
keyTargetHash: string;
|
|
780
784
|
parentContainerKeyEpochId: string | null;
|
|
781
785
|
};
|
|
786
|
+
bundleDigest: string;
|
|
782
787
|
containerId: string;
|
|
783
788
|
createdAt: string;
|
|
784
789
|
eventHash: string;
|
|
@@ -811,6 +816,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
811
816
|
keyTargetHash: string;
|
|
812
817
|
parentContainerKeyEpochId: string | null;
|
|
813
818
|
};
|
|
819
|
+
bundleDigest: string;
|
|
814
820
|
containerId: string;
|
|
815
821
|
createdAt: string;
|
|
816
822
|
eventHash: string;
|
|
@@ -843,6 +849,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
843
849
|
keyTargetHash: string;
|
|
844
850
|
parentContainerKeyEpochId: string | null;
|
|
845
851
|
};
|
|
852
|
+
bundleDigest: string;
|
|
846
853
|
containerId: string;
|
|
847
854
|
createdAt: string;
|
|
848
855
|
eventHash: string;
|
|
@@ -876,6 +883,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
876
883
|
keyTargetHash: string;
|
|
877
884
|
parentContainerKeyEpochId: string | null;
|
|
878
885
|
};
|
|
886
|
+
bundleDigest: string;
|
|
879
887
|
containerId: string;
|
|
880
888
|
createdAt: string;
|
|
881
889
|
eventHash: string;
|
|
@@ -908,6 +916,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
908
916
|
keyTargetHash: string;
|
|
909
917
|
parentContainerKeyEpochId: string | null;
|
|
910
918
|
};
|
|
919
|
+
bundleDigest: string;
|
|
911
920
|
containerId: string;
|
|
912
921
|
createdAt: string;
|
|
913
922
|
eventHash: string;
|
|
@@ -940,6 +949,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
940
949
|
keyTargetHash: string;
|
|
941
950
|
parentContainerKeyEpochId: string | null;
|
|
942
951
|
};
|
|
952
|
+
bundleDigest: string;
|
|
943
953
|
containerId: string;
|
|
944
954
|
createdAt: string;
|
|
945
955
|
eventHash: string;
|
|
@@ -973,6 +983,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
973
983
|
keyTargetHash: string;
|
|
974
984
|
parentContainerKeyEpochId: string | null;
|
|
975
985
|
};
|
|
986
|
+
bundleDigest: string;
|
|
976
987
|
containerId: string;
|
|
977
988
|
createdAt: string;
|
|
978
989
|
eventHash: string;
|
|
@@ -1005,6 +1016,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
1005
1016
|
keyTargetHash: string;
|
|
1006
1017
|
parentContainerKeyEpochId: string | null;
|
|
1007
1018
|
};
|
|
1019
|
+
bundleDigest: string;
|
|
1008
1020
|
containerId: string;
|
|
1009
1021
|
createdAt: string;
|
|
1010
1022
|
eventHash: string;
|
|
@@ -1037,6 +1049,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
1037
1049
|
keyTargetHash: string;
|
|
1038
1050
|
parentContainerKeyEpochId: string | null;
|
|
1039
1051
|
};
|
|
1052
|
+
bundleDigest: string;
|
|
1040
1053
|
containerId: string;
|
|
1041
1054
|
createdAt: string;
|
|
1042
1055
|
eventHash: string;
|
|
@@ -1070,6 +1083,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
1070
1083
|
keyTargetHash: string;
|
|
1071
1084
|
parentContainerKeyEpochId: string | null;
|
|
1072
1085
|
};
|
|
1086
|
+
bundleDigest: string;
|
|
1073
1087
|
containerId: string;
|
|
1074
1088
|
createdAt: string;
|
|
1075
1089
|
eventHash: string;
|
|
@@ -1102,6 +1116,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
1102
1116
|
keyTargetHash: string;
|
|
1103
1117
|
parentContainerKeyEpochId: string | null;
|
|
1104
1118
|
};
|
|
1119
|
+
bundleDigest: string;
|
|
1105
1120
|
containerId: string;
|
|
1106
1121
|
createdAt: string;
|
|
1107
1122
|
eventHash: string;
|
|
@@ -1134,6 +1149,7 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
1134
1149
|
keyTargetHash: string;
|
|
1135
1150
|
parentContainerKeyEpochId: string | null;
|
|
1136
1151
|
};
|
|
1152
|
+
bundleDigest: string;
|
|
1137
1153
|
containerId: string;
|
|
1138
1154
|
createdAt: string;
|
|
1139
1155
|
eventHash: string;
|
|
@@ -14,6 +14,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
14
14
|
keyTargetHash: string;
|
|
15
15
|
parentContainerKeyEpochId: string | null;
|
|
16
16
|
};
|
|
17
|
+
bundleDigest: string;
|
|
17
18
|
containerId: string;
|
|
18
19
|
createdAt: string;
|
|
19
20
|
eventHash: string;
|
|
@@ -28,6 +29,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
28
29
|
};
|
|
29
30
|
metadataDocument: {
|
|
30
31
|
createdAt: string;
|
|
32
|
+
bundleDigest: string;
|
|
31
33
|
contentKeyEpoch: number;
|
|
32
34
|
eventHash: string;
|
|
33
35
|
id: string;
|
|
@@ -41,11 +43,13 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
41
43
|
};
|
|
42
44
|
};
|
|
43
45
|
organizationMetadataContainerId: string;
|
|
46
|
+
rootBundleDigest: string;
|
|
44
47
|
rootContainerId: string;
|
|
45
48
|
rootMetadataAccessEpoch: number;
|
|
46
49
|
rootMetadataAccessStateHash: string;
|
|
47
50
|
rootMetadataDocument: {
|
|
48
51
|
createdAt: string;
|
|
52
|
+
bundleDigest: string;
|
|
49
53
|
contentKeyEpoch: number;
|
|
50
54
|
eventHash: string;
|
|
51
55
|
id: string;
|
|
@@ -68,6 +72,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
68
72
|
keyTargetHash: string;
|
|
69
73
|
parentContainerKeyEpochId: string | null;
|
|
70
74
|
};
|
|
75
|
+
bundleDigest: string;
|
|
71
76
|
containerId: string;
|
|
72
77
|
createdAt: string;
|
|
73
78
|
eventHash: string;
|
|
@@ -82,6 +87,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
82
87
|
};
|
|
83
88
|
metadataDocument: {
|
|
84
89
|
createdAt: string;
|
|
90
|
+
bundleDigest: string;
|
|
85
91
|
contentKeyEpoch: number;
|
|
86
92
|
eventHash: string;
|
|
87
93
|
id: string;
|
|
@@ -97,6 +103,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
97
103
|
userId: string;
|
|
98
104
|
organizationProfileDocument?: {
|
|
99
105
|
createdAt: string;
|
|
106
|
+
bundleDigest: string;
|
|
100
107
|
contentKeyEpoch: number;
|
|
101
108
|
eventHash: string;
|
|
102
109
|
id: string;
|
|
@@ -119,6 +126,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
119
126
|
keyTargetHash: string;
|
|
120
127
|
parentContainerKeyEpochId: string | null;
|
|
121
128
|
};
|
|
129
|
+
bundleDigest: string;
|
|
122
130
|
containerId: string;
|
|
123
131
|
createdAt: string;
|
|
124
132
|
eventHash: string;
|
|
@@ -133,6 +141,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
133
141
|
};
|
|
134
142
|
metadataDocument: {
|
|
135
143
|
createdAt: string;
|
|
144
|
+
bundleDigest: string;
|
|
136
145
|
contentKeyEpoch: number;
|
|
137
146
|
eventHash: string;
|
|
138
147
|
id: string;
|
|
@@ -148,6 +157,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
148
157
|
rosterProfileContainerId?: string | undefined;
|
|
149
158
|
rosterProfileDocument?: {
|
|
150
159
|
createdAt: string;
|
|
160
|
+
bundleDigest: string;
|
|
151
161
|
contentKeyEpoch: number;
|
|
152
162
|
eventHash: string;
|
|
153
163
|
id: string;
|
|
@@ -175,6 +185,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
175
185
|
keyTargetHash: string;
|
|
176
186
|
parentContainerKeyEpochId: string | null;
|
|
177
187
|
};
|
|
188
|
+
bundleDigest: string;
|
|
178
189
|
containerId: string;
|
|
179
190
|
createdAt: string;
|
|
180
191
|
eventHash: string;
|
|
@@ -189,6 +200,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
189
200
|
};
|
|
190
201
|
metadataDocument: {
|
|
191
202
|
createdAt: string;
|
|
203
|
+
bundleDigest: string;
|
|
192
204
|
contentKeyEpoch: number;
|
|
193
205
|
eventHash: string;
|
|
194
206
|
id: string;
|
|
@@ -202,11 +214,13 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
202
214
|
};
|
|
203
215
|
};
|
|
204
216
|
organizationMetadataContainerId: string;
|
|
217
|
+
rootBundleDigest: string;
|
|
205
218
|
rootContainerId: string;
|
|
206
219
|
rootMetadataAccessEpoch: number;
|
|
207
220
|
rootMetadataAccessStateHash: string;
|
|
208
221
|
rootMetadataDocument: {
|
|
209
222
|
createdAt: string;
|
|
223
|
+
bundleDigest: string;
|
|
210
224
|
contentKeyEpoch: number;
|
|
211
225
|
eventHash: string;
|
|
212
226
|
id: string;
|
|
@@ -229,6 +243,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
229
243
|
keyTargetHash: string;
|
|
230
244
|
parentContainerKeyEpochId: string | null;
|
|
231
245
|
};
|
|
246
|
+
bundleDigest: string;
|
|
232
247
|
containerId: string;
|
|
233
248
|
createdAt: string;
|
|
234
249
|
eventHash: string;
|
|
@@ -243,6 +258,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
243
258
|
};
|
|
244
259
|
metadataDocument: {
|
|
245
260
|
createdAt: string;
|
|
261
|
+
bundleDigest: string;
|
|
246
262
|
contentKeyEpoch: number;
|
|
247
263
|
eventHash: string;
|
|
248
264
|
id: string;
|
|
@@ -258,6 +274,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
258
274
|
userId: string;
|
|
259
275
|
organizationProfileDocument?: {
|
|
260
276
|
createdAt: string;
|
|
277
|
+
bundleDigest: string;
|
|
261
278
|
contentKeyEpoch: number;
|
|
262
279
|
eventHash: string;
|
|
263
280
|
id: string;
|
|
@@ -280,6 +297,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
280
297
|
keyTargetHash: string;
|
|
281
298
|
parentContainerKeyEpochId: string | null;
|
|
282
299
|
};
|
|
300
|
+
bundleDigest: string;
|
|
283
301
|
containerId: string;
|
|
284
302
|
createdAt: string;
|
|
285
303
|
eventHash: string;
|
|
@@ -294,6 +312,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
294
312
|
};
|
|
295
313
|
metadataDocument: {
|
|
296
314
|
createdAt: string;
|
|
315
|
+
bundleDigest: string;
|
|
297
316
|
contentKeyEpoch: number;
|
|
298
317
|
eventHash: string;
|
|
299
318
|
id: string;
|
|
@@ -309,6 +328,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
309
328
|
rosterProfileContainerId?: string | undefined;
|
|
310
329
|
rosterProfileDocument?: {
|
|
311
330
|
createdAt: string;
|
|
331
|
+
bundleDigest: string;
|
|
312
332
|
contentKeyEpoch: number;
|
|
313
333
|
eventHash: string;
|
|
314
334
|
id: string;
|
|
@@ -336,6 +356,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
336
356
|
keyTargetHash: string;
|
|
337
357
|
parentContainerKeyEpochId: string | null;
|
|
338
358
|
};
|
|
359
|
+
bundleDigest: string;
|
|
339
360
|
containerId: string;
|
|
340
361
|
createdAt: string;
|
|
341
362
|
eventHash: string;
|
|
@@ -350,6 +371,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
350
371
|
};
|
|
351
372
|
metadataDocument: {
|
|
352
373
|
createdAt: string;
|
|
374
|
+
bundleDigest: string;
|
|
353
375
|
contentKeyEpoch: number;
|
|
354
376
|
eventHash: string;
|
|
355
377
|
id: string;
|
|
@@ -363,11 +385,13 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
363
385
|
};
|
|
364
386
|
};
|
|
365
387
|
organizationMetadataContainerId: string;
|
|
388
|
+
rootBundleDigest: string;
|
|
366
389
|
rootContainerId: string;
|
|
367
390
|
rootMetadataAccessEpoch: number;
|
|
368
391
|
rootMetadataAccessStateHash: string;
|
|
369
392
|
rootMetadataDocument: {
|
|
370
393
|
createdAt: string;
|
|
394
|
+
bundleDigest: string;
|
|
371
395
|
contentKeyEpoch: number;
|
|
372
396
|
eventHash: string;
|
|
373
397
|
id: string;
|
|
@@ -390,6 +414,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
390
414
|
keyTargetHash: string;
|
|
391
415
|
parentContainerKeyEpochId: string | null;
|
|
392
416
|
};
|
|
417
|
+
bundleDigest: string;
|
|
393
418
|
containerId: string;
|
|
394
419
|
createdAt: string;
|
|
395
420
|
eventHash: string;
|
|
@@ -404,6 +429,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
404
429
|
};
|
|
405
430
|
metadataDocument: {
|
|
406
431
|
createdAt: string;
|
|
432
|
+
bundleDigest: string;
|
|
407
433
|
contentKeyEpoch: number;
|
|
408
434
|
eventHash: string;
|
|
409
435
|
id: string;
|
|
@@ -419,6 +445,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
419
445
|
userId: string;
|
|
420
446
|
organizationProfileDocument?: {
|
|
421
447
|
createdAt: string;
|
|
448
|
+
bundleDigest: string;
|
|
422
449
|
contentKeyEpoch: number;
|
|
423
450
|
eventHash: string;
|
|
424
451
|
id: string;
|
|
@@ -441,6 +468,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
441
468
|
keyTargetHash: string;
|
|
442
469
|
parentContainerKeyEpochId: string | null;
|
|
443
470
|
};
|
|
471
|
+
bundleDigest: string;
|
|
444
472
|
containerId: string;
|
|
445
473
|
createdAt: string;
|
|
446
474
|
eventHash: string;
|
|
@@ -455,6 +483,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
455
483
|
};
|
|
456
484
|
metadataDocument: {
|
|
457
485
|
createdAt: string;
|
|
486
|
+
bundleDigest: string;
|
|
458
487
|
contentKeyEpoch: number;
|
|
459
488
|
eventHash: string;
|
|
460
489
|
id: string;
|
|
@@ -470,6 +499,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
470
499
|
rosterProfileContainerId?: string | undefined;
|
|
471
500
|
rosterProfileDocument?: {
|
|
472
501
|
createdAt: string;
|
|
502
|
+
bundleDigest: string;
|
|
473
503
|
contentKeyEpoch: number;
|
|
474
504
|
eventHash: string;
|
|
475
505
|
id: string;
|
|
@@ -497,6 +527,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
497
527
|
keyTargetHash: string;
|
|
498
528
|
parentContainerKeyEpochId: string | null;
|
|
499
529
|
};
|
|
530
|
+
bundleDigest: string;
|
|
500
531
|
containerId: string;
|
|
501
532
|
createdAt: string;
|
|
502
533
|
eventHash: string;
|
|
@@ -511,6 +542,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
511
542
|
};
|
|
512
543
|
metadataDocument: {
|
|
513
544
|
createdAt: string;
|
|
545
|
+
bundleDigest: string;
|
|
514
546
|
contentKeyEpoch: number;
|
|
515
547
|
eventHash: string;
|
|
516
548
|
id: string;
|
|
@@ -524,11 +556,13 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
524
556
|
};
|
|
525
557
|
};
|
|
526
558
|
organizationMetadataContainerId: string;
|
|
559
|
+
rootBundleDigest: string;
|
|
527
560
|
rootContainerId: string;
|
|
528
561
|
rootMetadataAccessEpoch: number;
|
|
529
562
|
rootMetadataAccessStateHash: string;
|
|
530
563
|
rootMetadataDocument: {
|
|
531
564
|
createdAt: string;
|
|
565
|
+
bundleDigest: string;
|
|
532
566
|
contentKeyEpoch: number;
|
|
533
567
|
eventHash: string;
|
|
534
568
|
id: string;
|
|
@@ -551,6 +585,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
551
585
|
keyTargetHash: string;
|
|
552
586
|
parentContainerKeyEpochId: string | null;
|
|
553
587
|
};
|
|
588
|
+
bundleDigest: string;
|
|
554
589
|
containerId: string;
|
|
555
590
|
createdAt: string;
|
|
556
591
|
eventHash: string;
|
|
@@ -565,6 +600,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
565
600
|
};
|
|
566
601
|
metadataDocument: {
|
|
567
602
|
createdAt: string;
|
|
603
|
+
bundleDigest: string;
|
|
568
604
|
contentKeyEpoch: number;
|
|
569
605
|
eventHash: string;
|
|
570
606
|
id: string;
|
|
@@ -580,6 +616,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
580
616
|
userId: string;
|
|
581
617
|
organizationProfileDocument?: {
|
|
582
618
|
createdAt: string;
|
|
619
|
+
bundleDigest: string;
|
|
583
620
|
contentKeyEpoch: number;
|
|
584
621
|
eventHash: string;
|
|
585
622
|
id: string;
|
|
@@ -602,6 +639,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
602
639
|
keyTargetHash: string;
|
|
603
640
|
parentContainerKeyEpochId: string | null;
|
|
604
641
|
};
|
|
642
|
+
bundleDigest: string;
|
|
605
643
|
containerId: string;
|
|
606
644
|
createdAt: string;
|
|
607
645
|
eventHash: string;
|
|
@@ -616,6 +654,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
616
654
|
};
|
|
617
655
|
metadataDocument: {
|
|
618
656
|
createdAt: string;
|
|
657
|
+
bundleDigest: string;
|
|
619
658
|
contentKeyEpoch: number;
|
|
620
659
|
eventHash: string;
|
|
621
660
|
id: string;
|
|
@@ -631,6 +670,7 @@ export declare const RegistrationResponseSchema: z.ZodType<{
|
|
|
631
670
|
rosterProfileContainerId?: string | undefined;
|
|
632
671
|
rosterProfileDocument?: {
|
|
633
672
|
createdAt: string;
|
|
673
|
+
bundleDigest: string;
|
|
634
674
|
contentKeyEpoch: number;
|
|
635
675
|
eventHash: string;
|
|
636
676
|
id: string;
|
|
@@ -19,6 +19,31 @@ export type HeldKekLevelDigest = (kek: ContainerKekResponse) => string | null;
|
|
|
19
19
|
export declare function encodeContainerWriterProjection(projection: ContainerWriterProjectionResponse, known?: ReadonlySet<string>, heldLevel?: HeldKekLevelDigest): ContainerWriterProjectionWireResponse;
|
|
20
20
|
/** See {@link encodeContainerWriterProjection}. */
|
|
21
21
|
export declare function encodeDocumentWriterProjection(projection: DocumentWriterProjectionResponse, known?: ReadonlySet<string>, heldLevel?: HeldKekLevelDigest): DocumentWriterProjectionWireResponse;
|
|
22
|
+
/**
|
|
23
|
+
* The held bundles a decoded projection filled omissions from. A verifier
|
|
24
|
+
* that refuses such a projection drops exactly those held rows, so the next
|
|
25
|
+
* read fetches them from the server instead of failing the same way.
|
|
26
|
+
*/
|
|
27
|
+
export declare function heldBundlesUsedBy(projection: object): readonly ServedBundle[];
|
|
28
|
+
/**
|
|
29
|
+
* Carries a decoded projection's held bundles to a projection built from it,
|
|
30
|
+
* so a refusal of the derived one drops those bundles and refuses the decoded
|
|
31
|
+
* projection a cache holds.
|
|
32
|
+
*/
|
|
33
|
+
export declare function deriveDecodedProjection<T extends object>(from: object, to: T): T;
|
|
34
|
+
/** Marks a decoded projection refused, so no cache serves it again. */
|
|
35
|
+
export declare function rejectDecodedProjection(projection: object): void;
|
|
36
|
+
/**
|
|
37
|
+
* Whether a projection, or the decoded projection it was derived from, was
|
|
38
|
+
* refused: refusing any projection built from a decoded one refuses every
|
|
39
|
+
* other projection built from it too.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* A projection whose held bundles just verified: those bytes are good again
|
|
43
|
+
* for every other projection rebuilt from them.
|
|
44
|
+
*/
|
|
45
|
+
export declare function acceptDecodedProjection(projection: object): void;
|
|
46
|
+
export declare function isRejectedDecodedProjection(projection: unknown): boolean;
|
|
22
47
|
/**
|
|
23
48
|
* Null for any wire inconsistency or an omission `held` (bundles) or
|
|
24
49
|
* `heldLevels` (KEK levels by digest) cannot fill; the caller treats either
|
|
@@ -143,6 +143,110 @@ function decodeKeyingPath(path, resolve, heldLevels) {
|
|
|
143
143
|
})),
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
+
// The held bundles each decoded projection took from the caller's citations
|
|
147
|
+
// rather than from the response, exactly as the caller held them.
|
|
148
|
+
const heldBundlesByProjection = new WeakMap();
|
|
149
|
+
/**
|
|
150
|
+
* The held bundles a decoded projection filled omissions from. A verifier
|
|
151
|
+
* that refuses such a projection drops exactly those held rows, so the next
|
|
152
|
+
* read fetches them from the server instead of failing the same way.
|
|
153
|
+
*/
|
|
154
|
+
export function heldBundlesUsedBy(projection) {
|
|
155
|
+
return heldBundlesByProjection.get(projection) ?? [];
|
|
156
|
+
}
|
|
157
|
+
// Decoded projections a verifier refused after they took held bundles: a
|
|
158
|
+
// cache must not hand one out again.
|
|
159
|
+
const rejectedProjections = new WeakSet();
|
|
160
|
+
// A projection derived from a decoded one (a path of a document projection,
|
|
161
|
+
// a sliced path) answers for the decoded projection it came from.
|
|
162
|
+
const decodedOrigins = new WeakMap();
|
|
163
|
+
/**
|
|
164
|
+
* Carries a decoded projection's held bundles to a projection built from it,
|
|
165
|
+
* so a refusal of the derived one drops those bundles and refuses the decoded
|
|
166
|
+
* projection a cache holds.
|
|
167
|
+
*/
|
|
168
|
+
export function deriveDecodedProjection(from, to) {
|
|
169
|
+
const held = heldBundlesByProjection.get(from);
|
|
170
|
+
if (held) {
|
|
171
|
+
// Only the held bundles this projection still carries: verifying it
|
|
172
|
+
// vouches for those and no others.
|
|
173
|
+
const carried = manifestHashesIn(to);
|
|
174
|
+
const kept = held.filter((bundle) => carried.has(bundle.manifestHash));
|
|
175
|
+
if (kept.length > 0)
|
|
176
|
+
heldBundlesByProjection.set(to, kept);
|
|
177
|
+
}
|
|
178
|
+
decodedOrigins.set(to, decodedOrigins.get(from) ?? from);
|
|
179
|
+
return to;
|
|
180
|
+
}
|
|
181
|
+
function manifestHashesIn(value, found = new Set()) {
|
|
182
|
+
if (Array.isArray(value)) {
|
|
183
|
+
for (const item of value)
|
|
184
|
+
manifestHashesIn(item, found);
|
|
185
|
+
}
|
|
186
|
+
else if (typeof value === "object" && value !== null) {
|
|
187
|
+
for (const [key, child] of Object.entries(value)) {
|
|
188
|
+
if (key === "manifestHash" && typeof child === "string")
|
|
189
|
+
found.add(child);
|
|
190
|
+
else
|
|
191
|
+
manifestHashesIn(child, found);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return found;
|
|
195
|
+
}
|
|
196
|
+
// The exact held bytes refused projections took: any other projection
|
|
197
|
+
// rebuilt from the same bytes is refused with them.
|
|
198
|
+
const rejectedHeldBytes = new Set();
|
|
199
|
+
const MAX_REJECTED_HELD_BUNDLES = 64;
|
|
200
|
+
/** Marks a decoded projection refused, so no cache serves it again. */
|
|
201
|
+
export function rejectDecodedProjection(projection) {
|
|
202
|
+
rejectedProjections.add(projection);
|
|
203
|
+
const origin = decodedOrigins.get(projection);
|
|
204
|
+
if (origin)
|
|
205
|
+
rejectedProjections.add(origin);
|
|
206
|
+
for (const bundle of heldBundlesUsedBy(projection)) {
|
|
207
|
+
rejectedHeldBytes.add(JSON.stringify(bundle));
|
|
208
|
+
// Bounded: the oldest refusals go first. Their projections stay refused
|
|
209
|
+
// by identity; only rebuilds from the same bytes are no longer caught.
|
|
210
|
+
if (rejectedHeldBytes.size > MAX_REJECTED_HELD_BUNDLES) {
|
|
211
|
+
const [oldest] = rejectedHeldBytes;
|
|
212
|
+
if (oldest !== undefined)
|
|
213
|
+
rejectedHeldBytes.delete(oldest);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Whether a projection, or the decoded projection it was derived from, was
|
|
219
|
+
* refused: refusing any projection built from a decoded one refuses every
|
|
220
|
+
* other projection built from it too.
|
|
221
|
+
*/
|
|
222
|
+
/**
|
|
223
|
+
* A projection whose held bundles just verified: those bytes are good again
|
|
224
|
+
* for every other projection rebuilt from them.
|
|
225
|
+
*/
|
|
226
|
+
export function acceptDecodedProjection(projection) {
|
|
227
|
+
if (rejectedHeldBytes.size === 0)
|
|
228
|
+
return;
|
|
229
|
+
for (const bundle of heldBundlesUsedBy(projection))
|
|
230
|
+
rejectedHeldBytes.delete(JSON.stringify(bundle));
|
|
231
|
+
}
|
|
232
|
+
export function isRejectedDecodedProjection(projection) {
|
|
233
|
+
if (typeof projection !== "object" || projection === null)
|
|
234
|
+
return false;
|
|
235
|
+
const origin = decodedOrigins.get(projection);
|
|
236
|
+
return (rejectedProjections.has(projection) ||
|
|
237
|
+
(origin !== undefined && rejectedProjections.has(origin)) ||
|
|
238
|
+
(rejectedHeldBytes.size > 0 &&
|
|
239
|
+
heldBundlesUsedBy(projection).some((bundle) => rejectedHeldBytes.has(JSON.stringify(bundle)))));
|
|
240
|
+
}
|
|
241
|
+
function withHeldBundles(projection, omittedBundles, held) {
|
|
242
|
+
const used = omittedBundles.flatMap((hash) => {
|
|
243
|
+
const bundle = held.get(hash);
|
|
244
|
+
return bundle ? [bundle] : [];
|
|
245
|
+
});
|
|
246
|
+
if (used.length > 0)
|
|
247
|
+
heldBundlesByProjection.set(projection, used);
|
|
248
|
+
return projection;
|
|
249
|
+
}
|
|
146
250
|
/**
|
|
147
251
|
* Null for any wire inconsistency or an omission `held` (bundles) or
|
|
148
252
|
* `heldLevels` (KEK levels by digest) cannot fill; the caller treats either
|
|
@@ -158,7 +262,9 @@ export function decodeContainerWriterProjection(value, held = new Map(), heldLev
|
|
|
158
262
|
const path = resolve
|
|
159
263
|
? decodeKeyingPath(projection, resolve, heldLevels)
|
|
160
264
|
: null;
|
|
161
|
-
return path
|
|
265
|
+
return path
|
|
266
|
+
? withHeldBundles({ ...projection, ...path }, omittedBundles, held)
|
|
267
|
+
: null;
|
|
162
268
|
}
|
|
163
269
|
/** See {@link decodeContainerWriterProjection}. */
|
|
164
270
|
export function decodeDocumentWriterProjection(value, held = new Map(), heldLevels = new Map()) {
|
|
@@ -181,13 +287,13 @@ export function decodeDocumentWriterProjection(value, held = new Map(), heldLeve
|
|
|
181
287
|
const [firstPath, ...otherPaths] = authorizingContainerPaths;
|
|
182
288
|
if (!firstPath)
|
|
183
289
|
return null;
|
|
184
|
-
return {
|
|
290
|
+
return withHeldBundles({
|
|
185
291
|
...projection,
|
|
186
292
|
authorizingContainerPaths: [firstPath, ...otherPaths],
|
|
187
293
|
documentContainerManifestHistory: projection.documentContainerManifestHistory.map(resolve),
|
|
188
294
|
documentManifest: resolve(projection.documentManifest),
|
|
189
295
|
documentManifestContainerPaths: projection.documentManifestContainerPaths.map((path) => path.map(resolve)),
|
|
190
296
|
documentManifestHistory: projection.documentManifestHistory.map(resolve),
|
|
191
|
-
};
|
|
297
|
+
}, omittedBundles, held);
|
|
192
298
|
}
|
|
193
299
|
//# sourceMappingURL=writerProjectionWire.js.map
|