@tearleads/client-sdk 0.1.68 → 0.1.71
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/principalPolicies.js +8 -12
- package/data/containers/shared/principalPolicies.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +73 -3
- package/internal/api-client/apiRequestMetrics.d.ts +18 -4
- package/internal/api-client/apiRequestMetrics.js +55 -5
- package/internal/api-client/apiRequestMetrics.js.map +1 -1
- package/internal/api-client/durationSampleWindow.d.ts +26 -0
- package/internal/api-client/durationSampleWindow.js +42 -0
- package/internal/api-client/durationSampleWindow.js.map +1 -0
- package/internal/api-client/measureApiRequest.js +9 -4
- package/internal/api-client/measureApiRequest.js.map +1 -1
- package/internal/api-client/serverTiming.d.ts +12 -0
- package/internal/api-client/serverTiming.js +49 -0
- package/internal/api-client/serverTiming.js.map +1 -0
- package/internal/validators/documentCreateSeedRefinements.js +9 -0
- package/internal/validators/documentCreateSeedRefinements.js.map +1 -0
- package/internal/validators/operation/attachments.d.ts +48 -8
- package/internal/validators/operation/auth.d.ts +576 -76
- package/internal/validators/operation/containerMutations.d.ts +619 -44
- package/internal/validators/operation/containerMutations.js +7 -1
- package/internal/validators/operation/containerMutations.js.map +1 -1
- package/internal/validators/operation/documentMutations.d.ts +428 -12
- package/internal/validators/operation/documentMutations.js +6 -1
- package/internal/validators/operation/documentMutations.js.map +1 -1
- package/internal/validators/operation/documentSync.d.ts +33 -13
- package/internal/validators/operation/organizations.d.ts +648 -88
- package/internal/validators/operation/principals.d.ts +96 -16
- package/internal/validators/request/blob.d.ts +48 -8
- package/internal/validators/request/container.d.ts +96 -16
- package/internal/validators/request/container.js +5 -2
- package/internal/validators/request/container.js.map +1 -1
- package/internal/validators/request/containerMetadata.d.ts +409 -16
- package/internal/validators/request/containerMetadata.js +20 -3
- package/internal/validators/request/containerMetadata.js.map +1 -1
- package/internal/validators/request/document.d.ts +631 -10
- package/internal/validators/request/document.js +19 -1
- package/internal/validators/request/document.js.map +1 -1
- package/internal/validators/request/documentCreateSeed.js +35 -0
- package/internal/validators/request/documentCreateSeed.js.map +1 -0
- package/internal/validators/request/documentSyncSchema.d.ts +24 -4
- package/internal/validators/request/documentSyncSchema.js +2 -1
- package/internal/validators/request/documentSyncSchema.js.map +1 -1
- package/internal/validators/request/index.d.ts +1 -0
- package/internal/validators/request/index.js +1 -0
- package/internal/validators/request/index.js.map +1 -1
- package/internal/validators/request/organization.d.ts +96 -16
- package/internal/validators/request/organizationProvisioning.d.ts +1456 -246
- package/internal/validators/request/organizationProvisioning.js +9 -22
- package/internal/validators/request/organizationProvisioning.js.map +1 -1
- package/internal/validators/request/principal.d.ts +120 -20
- package/internal/validators/request/principalPolicyRef.d.ts +42 -0
- package/internal/validators/request/principalPolicyRef.js +19 -0
- package/internal/validators/request/principalPolicyRef.js.map +1 -0
- package/internal/validators/request/registration.d.ts +456 -76
- package/internal/validators/response/containerMetadata.d.ts +20 -0
- package/internal/validators/response/documentMutation.d.ts +43 -0
- package/internal/validators/response/documentMutation.js +12 -1
- package/internal/validators/response/documentMutation.js.map +1 -1
- package/internal/validators/response/documentSyncSchema.d.ts +13 -9
- package/internal/validators/response/documentSyncSchema.js +23 -18
- package/internal/validators/response/documentSyncSchema.js.map +1 -1
- package/internal/validators/response/index.d.ts +1 -1
- package/internal/validators/response/index.js.map +1 -1
- package/internal/validators/response/organizationProvisioning.d.ts +350 -0
- package/internal/validators/response/registration.d.ts +120 -0
- package/internal/validators/util/containerLimits.d.ts +8 -0
- package/internal/validators/util/containerLimits.js +8 -0
- package/internal/validators/util/containerLimits.js.map +1 -1
- package/package.json +1 -1
- package/stores/container-contents/containerState/containerStatePersistence.js +2 -0
- package/stores/container-contents/containerState/containerStatePersistence.js.map +1 -1
- package/stores/container-contents/remoteEvents/remoteEventSync.js +1 -1
- package/stores/container-contents/remoteEvents/remoteEventSync.js.map +1 -1
- package/stores/container-contents/state.js +2 -0
- package/stores/container-contents/state.js.map +1 -1
- package/stores/container-contents/syncAgent/syncAgentTypes.d.ts +5 -0
- package/stores/container-contents/syncAgent/syncAgentTypes.js.map +1 -1
- package/stores/documents/documentStore/sync/createdDocumentPersistence.js +71 -0
- package/stores/documents/documentStore/sync/createdDocumentPersistence.js.map +1 -0
- package/stores/documents/documentStore/sync/index.js +13 -2
- package/stores/documents/documentStore/sync/index.js.map +1 -1
- package/stores/documents/documentStore/sync/syncRemoteSignals.js +21 -3
- package/stores/documents/documentStore/sync/syncRemoteSignals.js.map +1 -1
- package/stores/documents/documentStore/sync/syncSeededCreate.js +50 -0
- package/stores/documents/documentStore/sync/syncSeededCreate.js.map +1 -0
- package/stores/documents/documentStore/sync/syncShared.js +16 -8
- package/stores/documents/documentStore/sync/syncShared.js.map +1 -1
- package/workflows/container-contents/container-state/create/createIntentSeed.js +60 -0
- package/workflows/container-contents/container-state/create/createIntentSeed.js.map +1 -0
- package/workflows/container-contents/container-state/create/createIntentSync.js +18 -19
- package/workflows/container-contents/container-state/create/createIntentSync.js.map +1 -1
- package/workflows/container-contents/container-state/create/createWithMetadata.js +43 -6
- package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -1
- package/workflows/container-contents/container-state/create/createWithMetadataPlan.js +5 -1
- package/workflows/container-contents/container-state/create/createWithMetadataPlan.js.map +1 -1
- package/workflows/container-contents/container-state/remote.js +15 -0
- package/workflows/container-contents/container-state/remote.js.map +1 -1
- package/workflows/container-contents/container-state/types.js.map +1 -1
- package/workflows/container-contents/metadata/metadataEvents.d.ts +7 -1
- package/workflows/container-contents/metadata/metadataEvents.js +8 -2
- package/workflows/container-contents/metadata/metadataEvents.js.map +1 -1
- package/workflows/container-contents/remoteHydration/types.d.ts +3 -0
- package/workflows/container-contents/remoteHydration/types.js.map +1 -1
- package/workflows/containers/child/mutationRequestCore.js +2 -2
- package/workflows/containers/child/mutationRequestCore.js.map +1 -1
- package/workflows/containers/child/recitePlan.js +2 -2
- package/workflows/containers/child/recitePlan.js.map +1 -1
- package/workflows/containers/root/create.js +17 -28
- package/workflows/containers/root/create.js.map +1 -1
- package/workflows/containers/root/initialGroupPolicy.js +0 -23
- package/workflows/containers/root/initialGroupPolicy.js.map +1 -1
- package/workflows/documents/create/index.d.ts +7 -0
- package/workflows/documents/create/index.js +40 -2
- package/workflows/documents/create/index.js.map +1 -1
- package/workflows/documents/index.d.ts +1 -0
- package/workflows/documents/index.js +1 -0
- package/workflows/documents/index.js.map +1 -1
- package/workflows/documents/sync/initialSync.d.ts +39 -0
- package/workflows/documents/sync/initialSync.js +39 -6
- package/workflows/documents/sync/initialSync.js.map +1 -1
- package/workflows/documents/syncFailures/syncPolicyRepair.js +2 -8
- package/workflows/documents/syncFailures/syncPolicyRepair.js.map +1 -1
- package/workflows/registration/provisioningBootstrapBuilders.d.ts +12 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { documentCreateSeedRefinement } from "../documentCreateSeedRefinements.js";
|
|
1
2
|
import { documentLinkSetPathRefinement } from "../documentSyncRefinements.js";
|
|
2
3
|
import { registerJsonSchemaRuntimeRefinements } from "../jsonSchema.js";
|
|
3
4
|
import { arraySchema, loosePlainObject, nonEmptyStringSchema, plainObjectSchema, requiredUnknownSchema, } from "../schema.js";
|
|
4
5
|
import { MAX_CONTAINER_PATH_LENGTH, MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS, MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS, MAX_INLINE_CONTAINER_REKEYS, } from "../util/index.js";
|
|
5
6
|
import { ContainerMutationRequestSchema } from "./container.js";
|
|
7
|
+
import { refineSeedWithinSyncRequestLimit, refineSingleUpdateSeed, } from "./documentCreateSeed.js";
|
|
6
8
|
import { ContainerManifestPathSchema, ContainerManifestRefArrayArraySchema, DocumentContentKeyBundleRequestSchema, DocumentOutgoingUpdateSchema, DocumentSyncRequestSchema, } from "./documentSyncSchema.js";
|
|
7
9
|
export { ContainerManifestRefArrayArraySchema, ContainerManifestRefSchema, DocumentContentKeyBundleRequestSchema, DocumentContentKeyTargetEnvelopeSchema, DocumentOutgoingUpdateSchema, DocumentSyncRequestSchema, } from "./documentSyncSchema.js";
|
|
8
10
|
export const documentCreateRequestShape = {
|
|
@@ -15,7 +17,23 @@ export const documentCreateRequestShape = {
|
|
|
15
17
|
manifest: plainObjectSchema,
|
|
16
18
|
targetContainerPathRefs: ContainerManifestPathSchema.optional(),
|
|
17
19
|
};
|
|
18
|
-
|
|
20
|
+
/** A document create with no seed: a container's metadata document. */
|
|
21
|
+
export const DocumentCreateBaseRequestSchema = loosePlainObject(documentCreateRequestShape);
|
|
22
|
+
/**
|
|
23
|
+
* `POST /documents`. The optional seed is the create's first queued update,
|
|
24
|
+
* committed in the create transaction under the same checks as a standalone
|
|
25
|
+
* sync, so a new document needs no follow-up sync round trip.
|
|
26
|
+
*/
|
|
27
|
+
export const DocumentCreateRequestSchema = registerJsonSchemaRuntimeRefinements(loosePlainObject({
|
|
28
|
+
...documentCreateRequestShape,
|
|
29
|
+
initialSync: DocumentSyncRequestSchema.optional(),
|
|
30
|
+
}).superRefine((value, context) => {
|
|
31
|
+
refineSingleUpdateSeed(value.initialSync, context, {
|
|
32
|
+
message: "document create seed requires one update and no container rekeys",
|
|
33
|
+
path: "initialSync",
|
|
34
|
+
});
|
|
35
|
+
refineSeedWithinSyncRequestLimit(value.initialSync, context, "initialSync");
|
|
36
|
+
}), [documentCreateSeedRefinement]);
|
|
19
37
|
// The prior link-set manifest is the document's current head. The server
|
|
20
38
|
// resolves it from its own store, while the signed event's previous manifest
|
|
21
39
|
// hash pins freshness, so the writer does not echo the bundle back.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,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;IACzD,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,iBAAiB;CACzB,CAAC,CAAC;AAIH,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,oCAAoC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,2BAA2B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,oCAAoC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,0BAA0B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,yBAAyB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport { documentLinkSetPathRefinement } from \"../documentSyncRefinements\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n plainObjectSchema,\n requiredUnknownSchema,\n} from \"../schema\";\nimport {\n MAX_CONTAINER_PATH_LENGTH,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS,\n MAX_INLINE_CONTAINER_REKEYS,\n} from \"../util\";\nimport { ContainerMutationRequestSchema } from \"./container\";\nimport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n DocumentOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nexport {\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n ContainerManifestRefSchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n type DocumentContentKeyTargetEnvelope,\n DocumentContentKeyTargetEnvelopeSchema,\n type DocumentOutgoingUpdate,\n DocumentOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nexport const documentCreateRequestShape = {\n authorizingContainerPathRefs: ContainerManifestRefArrayArraySchema.optional(),\n body: requiredUnknownSchema,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n manifest: plainObjectSchema,\n targetContainerPathRefs: ContainerManifestPathSchema.optional(),\n} satisfies z.ZodRawShape;\n\nexport const DocumentCreateRequestSchema = loosePlainObject(\n documentCreateRequestShape,\n);\n\nexport type DocumentCreateRequest = z.infer<typeof DocumentCreateRequestSchema>;\n\n// The prior link-set manifest is the document's current head. The server\n// resolves it from its own store, while the signed event's previous manifest\n// hash pins freshness, so the writer does not echo the bundle back.\nexport const DocumentLinkSetMutationRequestSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n authorizingContainerPathRefs: ContainerManifestRefArrayArraySchema,\n body: requiredUnknownSchema,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n manifest: plainObjectSchema,\n rotationBaseline: DocumentOutgoingUpdateSchema.optional(),\n // A container path (root→leaf chain) must carry at least one manifest\n // reference; an empty path authorizes nothing and is never legitimately built.\n targetContainerPathRefs: ContainerManifestPathSchema,\n }).superRefine((request, context) => {\n if (\n !Array.isArray(request.authorizingContainerPathRefs) ||\n !Array.isArray(request.targetContainerPathRefs)\n ) {\n return;\n }\n // The nested schemas have already reported their shape/cardinality\n // errors. Keep this aggregate refinement bounded and never dereference a\n // malformed path after those continuable issues have been replayed.\n if (\n request.authorizingContainerPathRefs.length >\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS ||\n request.targetContainerPathRefs.length > MAX_CONTAINER_PATH_LENGTH ||\n request.authorizingContainerPathRefs.some(\n (path) =>\n !Array.isArray(path) || path.length > MAX_CONTAINER_PATH_LENGTH,\n )\n ) {\n return;\n }\n const totalReferences = request.authorizingContainerPathRefs.reduce(\n (total, path) => total + path.length,\n request.targetContainerPathRefs.length,\n );\n if (totalReferences > MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS) {\n context.addIssue({\n code: \"custom\",\n message: documentLinkSetPathRefinement.description,\n path: [\"authorizingContainerPathRefs\"],\n });\n }\n }),\n [documentLinkSetPathRefinement],\n );\n\nexport type DocumentLinkSetMutationRequest = z.infer<\n typeof DocumentLinkSetMutationRequestSchema\n>;\n\nexport const DocumentPurgeRequestSchema = loosePlainObject({\n authorizingContainerPathRefs: ContainerManifestPathSchema,\n body: requiredUnknownSchema,\n event: plainObjectSchema,\n});\n\nexport type DocumentPurgeRequest = z.infer<typeof DocumentPurgeRequestSchema>;\n\nexport function isContainerManifestRefArrayArray(\n value: unknown,\n): value is ContainerManifestRef[][] {\n return ContainerManifestRefArrayArraySchema.safeParse(value).success;\n}\n\nexport function isDocumentContentKeyBundleRequest(\n value: unknown,\n): value is DocumentContentKeyBundleRequest {\n return DocumentContentKeyBundleRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentCreateRequest(\n value: unknown,\n): value is DocumentCreateRequest {\n return DocumentCreateRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentLinkSetMutationRequest(\n value: unknown,\n): value is DocumentLinkSetMutationRequest {\n return DocumentLinkSetMutationRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentPurgeRequest(\n value: unknown,\n): value is DocumentPurgeRequest {\n return DocumentPurgeRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentSyncRequest(\n value: unknown,\n): value is DocumentSyncRequest {\n return DocumentSyncRequestSchema.safeParse(value).success;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EACzB,yCAAyC,EACzC,qCAAqC,EACrC,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,2BAA2B,EAE3B,oCAAoC,EAEpC,qCAAqC,EACrC,4BAA4B,EAE5B,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,oCAAoC,EACpC,0BAA0B,EAE1B,qCAAqC,EAErC,sCAAsC,EAEtC,4BAA4B,EAE5B,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,4BAA4B,EAAE,oCAAoC,CAAC,QAAQ,EAAE;IAC7E,IAAI,EAAE,qBAAqB;IAC3B,eAAe,EAAE,WAAW,CAC1B,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,KAAc;IAEd,OAAO,oCAAoC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,2BAA2B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,oCAAoC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,0BAA0B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,yBAAyB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport { documentCreateSeedRefinement } from \"../documentCreateSeedRefinements\";\nimport { documentLinkSetPathRefinement } from \"../documentSyncRefinements\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n plainObjectSchema,\n requiredUnknownSchema,\n} from \"../schema\";\nimport {\n MAX_CONTAINER_PATH_LENGTH,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS,\n MAX_INLINE_CONTAINER_REKEYS,\n} from \"../util\";\nimport { ContainerMutationRequestSchema } from \"./container\";\nimport {\n refineSeedWithinSyncRequestLimit,\n refineSingleUpdateSeed,\n} from \"./documentCreateSeed\";\nimport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n DocumentOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nexport {\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n ContainerManifestRefSchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n type DocumentContentKeyTargetEnvelope,\n DocumentContentKeyTargetEnvelopeSchema,\n type DocumentOutgoingUpdate,\n DocumentOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nexport const documentCreateRequestShape = {\n authorizingContainerPathRefs: ContainerManifestRefArrayArraySchema.optional(),\n body: requiredUnknownSchema,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n manifest: plainObjectSchema,\n targetContainerPathRefs: ContainerManifestPathSchema.optional(),\n} satisfies z.ZodRawShape;\n\n/** A document create with no seed: a container's metadata document. */\nexport const DocumentCreateBaseRequestSchema = loosePlainObject(\n documentCreateRequestShape,\n);\n\n/**\n * `POST /documents`. The optional seed is the create's first queued update,\n * committed in the create transaction under the same checks as a standalone\n * sync, so a new document needs no follow-up sync round trip.\n */\nexport const DocumentCreateRequestSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...documentCreateRequestShape,\n initialSync: DocumentSyncRequestSchema.optional(),\n }).superRefine((value, context) => {\n refineSingleUpdateSeed(value.initialSync, context, {\n message:\n \"document create seed requires one update and no container rekeys\",\n path: \"initialSync\",\n });\n refineSeedWithinSyncRequestLimit(value.initialSync, context, \"initialSync\");\n }),\n [documentCreateSeedRefinement],\n);\n\nexport type DocumentCreateRequest = z.infer<typeof DocumentCreateRequestSchema>;\n\n// The prior link-set manifest is the document's current head. The server\n// resolves it from its own store, while the signed event's previous manifest\n// hash pins freshness, so the writer does not echo the bundle back.\nexport const DocumentLinkSetMutationRequestSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n authorizingContainerPathRefs: ContainerManifestRefArrayArraySchema,\n body: requiredUnknownSchema,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n manifest: plainObjectSchema,\n rotationBaseline: DocumentOutgoingUpdateSchema.optional(),\n // A container path (root→leaf chain) must carry at least one manifest\n // reference; an empty path authorizes nothing and is never legitimately built.\n targetContainerPathRefs: ContainerManifestPathSchema,\n }).superRefine((request, context) => {\n if (\n !Array.isArray(request.authorizingContainerPathRefs) ||\n !Array.isArray(request.targetContainerPathRefs)\n ) {\n return;\n }\n // The nested schemas have already reported their shape/cardinality\n // errors. Keep this aggregate refinement bounded and never dereference a\n // malformed path after those continuable issues have been replayed.\n if (\n request.authorizingContainerPathRefs.length >\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS ||\n request.targetContainerPathRefs.length > MAX_CONTAINER_PATH_LENGTH ||\n request.authorizingContainerPathRefs.some(\n (path) =>\n !Array.isArray(path) || path.length > MAX_CONTAINER_PATH_LENGTH,\n )\n ) {\n return;\n }\n const totalReferences = request.authorizingContainerPathRefs.reduce(\n (total, path) => total + path.length,\n request.targetContainerPathRefs.length,\n );\n if (totalReferences > MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS) {\n context.addIssue({\n code: \"custom\",\n message: documentLinkSetPathRefinement.description,\n path: [\"authorizingContainerPathRefs\"],\n });\n }\n }),\n [documentLinkSetPathRefinement],\n );\n\nexport type DocumentLinkSetMutationRequest = z.infer<\n typeof DocumentLinkSetMutationRequestSchema\n>;\n\nexport const DocumentPurgeRequestSchema = loosePlainObject({\n authorizingContainerPathRefs: ContainerManifestPathSchema,\n body: requiredUnknownSchema,\n event: plainObjectSchema,\n});\n\nexport type DocumentPurgeRequest = z.infer<typeof DocumentPurgeRequestSchema>;\n\nexport function isContainerManifestRefArrayArray(\n value: unknown,\n): value is ContainerManifestRef[][] {\n return ContainerManifestRefArrayArraySchema.safeParse(value).success;\n}\n\nexport function isDocumentContentKeyBundleRequest(\n value: unknown,\n): value is DocumentContentKeyBundleRequest {\n return DocumentContentKeyBundleRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentCreateRequest(\n value: unknown,\n): value is DocumentCreateRequest {\n return DocumentCreateRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentLinkSetMutationRequest(\n value: unknown,\n): value is DocumentLinkSetMutationRequest {\n return DocumentLinkSetMutationRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentPurgeRequest(\n value: unknown,\n): value is DocumentPurgeRequest {\n return DocumentPurgeRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentSyncRequest(\n value: unknown,\n): value is DocumentSyncRequest {\n return DocumentSyncRequestSchema.safeParse(value).success;\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MAX_DOCUMENT_SYNC_REQUEST_BYTES } from "../util/documentSyncLimits.js";
|
|
2
|
+
const TEXT_ENCODER = new TextEncoder();
|
|
3
|
+
/**
|
|
4
|
+
* A seed is the one update a document is born with, committed in its create
|
|
5
|
+
* transaction: exactly one outgoing update and no container rekeys.
|
|
6
|
+
*/
|
|
7
|
+
export function refineSingleUpdateSeed(seed, context, issue) {
|
|
8
|
+
if (!Array.isArray(seed?.outgoingUpdates)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (seed.outgoingUpdates.length !== 1 ||
|
|
12
|
+
(seed.containerRekeys?.length ?? 0) !== 0) {
|
|
13
|
+
context.addIssue({
|
|
14
|
+
code: "custom",
|
|
15
|
+
message: issue.message,
|
|
16
|
+
path: [issue.path],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A create seed stands in for the document's first sync, so it is held to the
|
|
22
|
+
* sync request limit the create route's larger ingress ceiling would not apply.
|
|
23
|
+
*/
|
|
24
|
+
export function refineSeedWithinSyncRequestLimit(seed, context, path) {
|
|
25
|
+
if (seed !== undefined &&
|
|
26
|
+
TEXT_ENCODER.encode(JSON.stringify(seed)).byteLength >
|
|
27
|
+
MAX_DOCUMENT_SYNC_REQUEST_BYTES) {
|
|
28
|
+
context.addIssue({
|
|
29
|
+
code: "custom",
|
|
30
|
+
message: `create seed exceeds ${MAX_DOCUMENT_SYNC_REQUEST_BYTES} serialized bytes`,
|
|
31
|
+
path: [path],
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=documentCreateSeed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentCreateSeed.js","sourceRoot":"","sources":["documentCreateSeed.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAG7E,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAqC,EACrC,OAAwB,EACxB,KAA0D;IAE1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,EAAE,CAAC;QAC1C,OAAO;IACT,CAAC;IACD,IACE,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC;QACjC,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,EACzC,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SACnB,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,IAAqC,EACrC,OAAwB,EACxB,IAAY;IAEZ,IACE,IAAI,KAAK,SAAS;QAClB,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU;YAClD,+BAA+B,EACjC,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,uBAAuB,+BAA+B,mBAAmB;YAClF,IAAI,EAAE,CAAC,IAAI,CAAC;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport { MAX_DOCUMENT_SYNC_REQUEST_BYTES } from \"../util/documentSyncLimits\";\nimport type { DocumentSyncRequest } from \"./documentSyncSchema\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * A seed is the one update a document is born with, committed in its create\n * transaction: exactly one outgoing update and no container rekeys.\n */\nexport function refineSingleUpdateSeed(\n seed: DocumentSyncRequest | undefined,\n context: z.RefinementCtx,\n issue: { readonly message: string; readonly path: string },\n): void {\n if (!Array.isArray(seed?.outgoingUpdates)) {\n return;\n }\n if (\n seed.outgoingUpdates.length !== 1 ||\n (seed.containerRekeys?.length ?? 0) !== 0\n ) {\n context.addIssue({\n code: \"custom\",\n message: issue.message,\n path: [issue.path],\n });\n }\n}\n\n/**\n * A create seed stands in for the document's first sync, so it is held to the\n * sync request limit the create route's larger ingress ceiling would not apply.\n */\nexport function refineSeedWithinSyncRequestLimit(\n seed: DocumentSyncRequest | undefined,\n context: z.RefinementCtx,\n path: string,\n): void {\n if (\n seed !== undefined &&\n TEXT_ENCODER.encode(JSON.stringify(seed)).byteLength >\n MAX_DOCUMENT_SYNC_REQUEST_BYTES\n ) {\n context.addIssue({\n code: \"custom\",\n message: `create seed exceeds ${MAX_DOCUMENT_SYNC_REQUEST_BYTES} serialized bytes`,\n path: [path],\n });\n }\n}\n"]}
|
|
@@ -159,7 +159,12 @@ export declare const DocumentSyncRequestSchema: z.ZodType<{
|
|
|
159
159
|
keyring: Record<string, unknown> | null;
|
|
160
160
|
manifest: Record<string, unknown>;
|
|
161
161
|
predecessorBridge: Record<string, unknown> | null;
|
|
162
|
-
|
|
162
|
+
principalPolicyRefs: {
|
|
163
|
+
principalType: "group" | "organization";
|
|
164
|
+
principalId: string;
|
|
165
|
+
version: number;
|
|
166
|
+
stateHash: string;
|
|
167
|
+
}[];
|
|
163
168
|
wraps: Record<string, unknown>[];
|
|
164
169
|
containerManifestHistoryRefs?: {
|
|
165
170
|
containerId: string;
|
|
@@ -230,7 +235,12 @@ export declare const DocumentSyncRequestSchema: z.ZodType<{
|
|
|
230
235
|
keyring: Record<string, unknown> | null;
|
|
231
236
|
manifest: Record<string, unknown>;
|
|
232
237
|
predecessorBridge: Record<string, unknown> | null;
|
|
233
|
-
|
|
238
|
+
principalPolicyRefs: {
|
|
239
|
+
principalType: "group" | "organization";
|
|
240
|
+
principalId: string;
|
|
241
|
+
version: number;
|
|
242
|
+
stateHash: string;
|
|
243
|
+
}[];
|
|
234
244
|
wraps: Record<string, unknown>[];
|
|
235
245
|
containerManifestHistoryRefs?: {
|
|
236
246
|
containerId: string;
|
|
@@ -301,7 +311,12 @@ export declare const DocumentSyncRequestSchema: z.ZodType<{
|
|
|
301
311
|
keyring: Record<string, unknown> | null;
|
|
302
312
|
manifest: Record<string, unknown>;
|
|
303
313
|
predecessorBridge: Record<string, unknown> | null;
|
|
304
|
-
|
|
314
|
+
principalPolicyRefs: {
|
|
315
|
+
principalType: "group" | "organization";
|
|
316
|
+
principalId: string;
|
|
317
|
+
version: number;
|
|
318
|
+
stateHash: string;
|
|
319
|
+
}[];
|
|
305
320
|
wraps: Record<string, unknown>[];
|
|
306
321
|
containerManifestHistoryRefs?: {
|
|
307
322
|
containerId: string;
|
|
@@ -372,7 +387,12 @@ export declare const DocumentSyncRequestSchema: z.ZodType<{
|
|
|
372
387
|
keyring: Record<string, unknown> | null;
|
|
373
388
|
manifest: Record<string, unknown>;
|
|
374
389
|
predecessorBridge: Record<string, unknown> | null;
|
|
375
|
-
|
|
390
|
+
principalPolicyRefs: {
|
|
391
|
+
principalType: "group" | "organization";
|
|
392
|
+
principalId: string;
|
|
393
|
+
version: number;
|
|
394
|
+
stateHash: string;
|
|
395
|
+
}[];
|
|
376
396
|
wraps: Record<string, unknown>[];
|
|
377
397
|
containerManifestHistoryRefs?: {
|
|
378
398
|
containerId: string;
|
|
@@ -12,6 +12,7 @@ import { isWalLsnString, WAL_LSN_PATTERN } from "../util/walLsn.js";
|
|
|
12
12
|
import { ContainerMutationRequestSchema, } from "./container.js";
|
|
13
13
|
import { ContainerManifestPathSchema, ContainerManifestRefListSchema, ContainerManifestRefSchema, OptionalContainerManifestPathSchema, } from "./containerManifestRef.js";
|
|
14
14
|
import { ContentKeyWrappedKeySchema, contentKeyWrappingMetadataSchema, } from "./contentKeyEnvelopeSchema.js";
|
|
15
|
+
import { PrincipalPolicyRefListSchema } from "./principalPolicyRef.js";
|
|
15
16
|
export { ContainerManifestPathSchema, ContainerManifestRefSchema, };
|
|
16
17
|
export const ContainerManifestRefArrayArraySchema = arraySchema(ContainerManifestPathSchema, MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS);
|
|
17
18
|
export const DocumentContentKeyTargetEnvelopeSchema = loosePlainObject({
|
|
@@ -79,7 +80,7 @@ const DocumentSyncContainerMutationRequestSchema = registerJsonSchemaView(z.cust
|
|
|
79
80
|
predecessorBridge: plainObjectSchema.nullable(),
|
|
80
81
|
previousContainerPathRefs: OptionalContainerManifestPathSchema.optional(),
|
|
81
82
|
previousManifestRef: ContainerManifestRefSchema.nullable().optional(),
|
|
82
|
-
|
|
83
|
+
principalPolicyRefs: PrincipalPolicyRefListSchema,
|
|
83
84
|
userRecipientKeys: z.array(plainObjectSchema).optional(),
|
|
84
85
|
wraps: z.array(plainObjectSchema),
|
|
85
86
|
}));
|
|
@@ -1 +1 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eAAe;SACpB,MAAM,CAAC,aAAa,CAAC;SACrB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAC9C,CAAC,IAAI,KAAK,OAAO,CAAC,eAAe,CAAC,MAAM,EACzC,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,oCAAoC;YAC7C,IAAI,EAAE,CAAC,iBAAiB,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,EACF;IACE,GAAG,sCAAsC;IACzC,GAAG,kCAAkC;CACtC,CACF,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n classifyDocumentSyncCheckpointFields,\n DOCUMENT_SYNC_CHECKPOINT_FIELD_SET_ISSUE_MESSAGE,\n DOCUMENT_SYNC_ROTATION_CHECKPOINT_KIND,\n DOCUMENT_SYNC_ROTATION_CHECKPOINT_PAYLOAD_KIND,\n} from \"../documentSyncCheckpoint\";\nimport {\n documentSyncRequestEnvelopeRefinements,\n documentSyncRequestPullRefinements,\n documentSyncRequestRotationRefinement,\n} from \"../documentSyncRefinements\";\nimport { classifyDocumentSyncRequestMode } from \"../documentSyncRequestMode\";\nimport { isPlainObject } from \"../isPlainObject\";\nimport {\n registerJsonSchemaFragment,\n registerJsonSchemaRuntimeRefinements,\n registerJsonSchemaView,\n} from \"../jsonSchema\";\nimport {\n arraySchema,\n boundedNonEmptyStringSchema,\n boundedStringSchema,\n loosePlainObject,\n nonEmptyStringSchema,\n plainObjectSchema,\n positiveIntegerSchema,\n requiredUnknownSchema,\n sha256HexStringSchema,\n} from \"../schema\";\nimport { MAX_INLINE_CONTAINER_REKEYS } from \"../util/containerKekKeyringWire\";\nimport {\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS,\n MAX_DOCUMENT_SYNC_CONTENT_KEY_TARGETS,\n MAX_DOCUMENT_SYNC_OUTGOING_UPDATES,\n MAX_DOCUMENT_SYNC_PULL_CURSOR_LENGTH,\n MAX_DOCUMENT_SYNC_REQUEST_BYTES,\n} from \"../util/documentSyncLimits\";\nimport { isUuidV4String, UUID_V4_PATTERN } from \"../util/uuid\";\nimport { isWalLsnString, WAL_LSN_PATTERN } from \"../util/walLsn\";\nimport {\n type ContainerMutationRequest,\n ContainerMutationRequestSchema,\n} from \"./container\";\nimport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n ContainerManifestRefListSchema,\n ContainerManifestRefSchema,\n OptionalContainerManifestPathSchema,\n} from \"./containerManifestRef\";\nimport {\n ContentKeyWrappedKeySchema,\n contentKeyWrappingMetadataSchema,\n} from \"./contentKeyEnvelopeSchema\";\n\nexport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n ContainerManifestRefSchema,\n};\n\nexport const ContainerManifestRefArrayArraySchema = arraySchema(\n ContainerManifestPathSchema,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS,\n);\n\nexport const DocumentContentKeyTargetEnvelopeSchema = loosePlainObject({\n containerId: nonEmptyStringSchema,\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n containerManifestHash: nonEmptyStringSchema,\n wrappedKey: ContentKeyWrappedKeySchema,\n wrappingMetadata: contentKeyWrappingMetadataSchema(\"document\"),\n});\n\nexport type DocumentContentKeyTargetEnvelope = z.infer<\n typeof DocumentContentKeyTargetEnvelopeSchema\n>;\n\nexport const DocumentContentKeyBundleRequestSchema = loosePlainObject({\n contentKeyEpoch: positiveIntegerSchema,\n linkSetManifestHash: nonEmptyStringSchema,\n targetHash: nonEmptyStringSchema,\n targets: arraySchema(\n DocumentContentKeyTargetEnvelopeSchema,\n MAX_DOCUMENT_SYNC_CONTENT_KEY_TARGETS,\n ),\n});\n\nexport type DocumentContentKeyBundleRequest = z.infer<\n typeof DocumentContentKeyBundleRequestSchema\n>;\n\nfunction createDocumentOutgoingUpdateSchema(\n encryptedDataSchema: z.ZodType<string>,\n versionVectorSchema: z.ZodType<string>,\n) {\n return registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n checkpointKind: z\n .literal(DOCUMENT_SYNC_ROTATION_CHECKPOINT_KIND)\n .optional(),\n checkpointPayloadKind: z\n .literal(DOCUMENT_SYNC_ROTATION_CHECKPOINT_PAYLOAD_KIND)\n .optional(),\n encryptedData: encryptedDataSchema,\n id: registerJsonSchemaFragment(z.string().refine(isUuidV4String), {\n pattern: UUID_V4_PATTERN.source,\n type: \"string\",\n }),\n partialEndVersionVector: versionVectorSchema,\n partialStartVersionVector: versionVectorSchema,\n plaintextHash: nonEmptyStringSchema,\n sourceVersionVector: versionVectorSchema.optional(),\n writeHeader: plainObjectSchema,\n }).superRefine((update, context) => {\n if (classifyDocumentSyncCheckpointFields(update) === \"invalid\") {\n context.addIssue({\n code: \"custom\",\n message: DOCUMENT_SYNC_CHECKPOINT_FIELD_SET_ISSUE_MESSAGE,\n });\n }\n }),\n [documentSyncRequestRotationRefinement],\n );\n}\n\n// Link-set rotations may carry a full-history baseline that is larger than a\n// single sync request. Their route has its own ingress policy, so keep the\n// shared update contract unbounded and apply the sync-specific ceiling only\n// where an update is embedded in DocumentSyncRequest.\nexport const DocumentOutgoingUpdateSchema = createDocumentOutgoingUpdateSchema(\n nonEmptyStringSchema,\n nonEmptyStringSchema,\n);\n\nconst DocumentSyncOutgoingUpdateSchema = createDocumentOutgoingUpdateSchema(\n boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_REQUEST_BYTES),\n boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_REQUEST_BYTES),\n);\n\nexport type DocumentOutgoingUpdate = z.infer<\n typeof DocumentOutgoingUpdateSchema\n>;\n\n// Document sync published container keyrings as opaque records before the\n// canonical container-mutation schema described their fields. Keep that one\n// existing OpenAPI view stable while runtime validation delegates to the shared\n// schema used by newer operations.\nconst DocumentSyncContainerMutationRequestSchema = registerJsonSchemaView(\n z.custom<ContainerMutationRequest>(\n (value) => ContainerMutationRequestSchema.safeParse(value).success,\n ),\n z.looseObject({\n body: requiredUnknownSchema,\n containerManifestHistoryRefs: ContainerManifestRefListSchema.optional(),\n destinationParentContainerPathRefs:\n OptionalContainerManifestPathSchema.optional(),\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n keyEpoch: plainObjectSchema,\n keyring: plainObjectSchema.nullable(),\n manifest: plainObjectSchema,\n parentContainerPathRefs: OptionalContainerManifestPathSchema.optional(),\n parentKekState: plainObjectSchema.nullable().optional(),\n predecessorBridge: plainObjectSchema.nullable(),\n previousContainerPathRefs: OptionalContainerManifestPathSchema.optional(),\n previousManifestRef: ContainerManifestRefSchema.nullable().optional(),\n principalPolicies: z.array(plainObjectSchema),\n userRecipientKeys: z.array(plainObjectSchema).optional(),\n wraps: z.array(plainObjectSchema),\n }),\n);\n\nconst WalLsnSchema = registerJsonSchemaFragment(\n z.string().refine(isWalLsnString),\n { pattern: WAL_LSN_PATTERN.source, type: \"string\" },\n);\n\nexport const DocumentSyncRequestSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n authorizingContainerPathRefs:\n ContainerManifestRefArrayArraySchema.optional(),\n // Each rotation carries a keyring sized by its epoch, so the batch is\n // bounded here as well as in the runtime guard.\n containerRekeys: arraySchema(\n DocumentSyncContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema.optional(),\n contentKeyEpoch: positiveIntegerSchema,\n expectedLinkSetManifestHash: nonEmptyStringSchema,\n expectedTargetHash: nonEmptyStringSchema,\n historyMode: z\n .literal(\"raw\")\n .describe(\n \"Explicit read-only recovery mode that bypasses rotation-baseline redirection and returns retained missing history\",\n )\n .optional(),\n inlineRekeyCommitId: sha256HexStringSchema.optional(),\n localVersionVector: boundedStringSchema(\n MAX_DOCUMENT_SYNC_REQUEST_BYTES,\n ).nullable(),\n minLsn: WalLsnSchema.optional(),\n outgoingUpdates: arraySchema(\n DocumentSyncOutgoingUpdateSchema,\n MAX_DOCUMENT_SYNC_OUTGOING_UPDATES,\n ),\n pullCursor: boundedNonEmptyStringSchema(\n MAX_DOCUMENT_SYNC_PULL_CURSOR_LENGTH,\n ).optional(),\n supportsPullPagination: z.literal(true),\n }).superRefine((request, context) => {\n if (!Array.isArray(request.outgoingUpdates)) {\n return;\n }\n // The field schemas have already recorded their cardinality errors. Do\n // not let the cross-field checks below rescan attacker-sized arrays after\n // those bounded schemas deliberately stopped before item validation.\n if (request.outgoingUpdates.length > MAX_DOCUMENT_SYNC_OUTGOING_UPDATES) {\n return;\n }\n if (\n Array.isArray(request.authorizingContainerPathRefs) &&\n request.authorizingContainerPathRefs.length >\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS\n ) {\n return;\n }\n\n const hasOutgoingUpdates = request.outgoingUpdates.length > 0;\n if (\n (request.containerRekeys?.length ?? 0) > 0 !==\n (request.inlineRekeyCommitId !== undefined)\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"inline rekey commit id must accompany container rekeys\",\n path: [\"inlineRekeyCommitId\"],\n });\n }\n if (\n request.pullCursor !== undefined &&\n (hasOutgoingUpdates ||\n (request.containerRekeys?.length ?? 0) > 0 ||\n request.contentKeyBundle !== undefined ||\n request.authorizingContainerPathRefs !== undefined)\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"continued pulls must be read-only\",\n path: [\"pullCursor\"],\n });\n }\n if (\n request.historyMode === \"raw\" &&\n (hasOutgoingUpdates ||\n (request.containerRekeys?.length ?? 0) > 0 ||\n request.contentKeyBundle !== undefined ||\n request.authorizingContainerPathRefs !== undefined)\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"raw-history pulls must be read-only\",\n path: [\"historyMode\"],\n });\n }\n if (request.historyMode === \"raw\" && request.localVersionVector !== null) {\n context.addIssue({\n code: \"custom\",\n message: \"raw-history pulls must start from a null version vector\",\n path: [\"localVersionVector\"],\n });\n }\n const requestMode = classifyDocumentSyncRequestMode({\n authorizingContainerPathRefsPresent:\n request.authorizingContainerPathRefs !== undefined,\n hasContainerRekeys: (request.containerRekeys?.length ?? 0) > 0,\n hasOutgoingUpdates,\n });\n\n if (requestMode === \"invalid-authorizing-path-refs-absent\") {\n context.addIssue({\n code: \"custom\",\n message:\n \"authorizing container paths are required for outgoing updates\",\n path: [\"authorizingContainerPathRefs\"],\n });\n }\n\n if (requestMode === \"invalid-rekeys-without-write\") {\n context.addIssue({\n code: \"custom\",\n message: \"container rekeys require an outgoing update\",\n path: [\"containerRekeys\"],\n });\n }\n\n if (\n new Set(\n request.outgoingUpdates\n .filter(isPlainObject)\n .map((update) => Reflect.get(update, \"id\")),\n ).size !== request.outgoingUpdates.length\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"outgoing update ids must be unique\",\n path: [\"outgoingUpdates\"],\n });\n }\n }),\n [\n ...documentSyncRequestEnvelopeRefinements,\n ...documentSyncRequestPullRefinements,\n ],\n);\n\nexport type DocumentSyncRequest = z.infer<typeof DocumentSyncRequestSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"documentSyncSchema.js","sourceRoot":"","sources":["documentSyncSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oCAAoC,EACpC,gDAAgD,EAChD,sCAAsC,EACtC,8CAA8C,GAC/C,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,sCAAsC,EACtC,kCAAkC,EAClC,qCAAqC,GACtC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,0BAA0B,EAC1B,oCAAoC,EACpC,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,iBAA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HECKPOINT_KIND,\n DOCUMENT_SYNC_ROTATION_CHECKPOINT_PAYLOAD_KIND,\n} from \"../documentSyncCheckpoint\";\nimport {\n documentSyncRequestEnvelopeRefinements,\n documentSyncRequestPullRefinements,\n documentSyncRequestRotationRefinement,\n} from \"../documentSyncRefinements\";\nimport { classifyDocumentSyncRequestMode } from \"../documentSyncRequestMode\";\nimport { isPlainObject } from \"../isPlainObject\";\nimport {\n registerJsonSchemaFragment,\n registerJsonSchemaRuntimeRefinements,\n registerJsonSchemaView,\n} from \"../jsonSchema\";\nimport {\n arraySchema,\n boundedNonEmptyStringSchema,\n boundedStringSchema,\n loosePlainObject,\n nonEmptyStringSchema,\n plainObjectSchema,\n positiveIntegerSchema,\n requiredUnknownSchema,\n sha256HexStringSchema,\n} from \"../schema\";\nimport { MAX_INLINE_CONTAINER_REKEYS } from \"../util/containerKekKeyringWire\";\nimport {\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS,\n MAX_DOCUMENT_SYNC_CONTENT_KEY_TARGETS,\n MAX_DOCUMENT_SYNC_OUTGOING_UPDATES,\n MAX_DOCUMENT_SYNC_PULL_CURSOR_LENGTH,\n MAX_DOCUMENT_SYNC_REQUEST_BYTES,\n} from \"../util/documentSyncLimits\";\nimport { isUuidV4String, UUID_V4_PATTERN } from \"../util/uuid\";\nimport { isWalLsnString, WAL_LSN_PATTERN } from \"../util/walLsn\";\nimport {\n type ContainerMutationRequest,\n ContainerMutationRequestSchema,\n} from \"./container\";\nimport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n ContainerManifestRefListSchema,\n ContainerManifestRefSchema,\n OptionalContainerManifestPathSchema,\n} from \"./containerManifestRef\";\nimport {\n ContentKeyWrappedKeySchema,\n contentKeyWrappingMetadataSchema,\n} from \"./contentKeyEnvelopeSchema\";\nimport { PrincipalPolicyRefListSchema } from \"./principalPolicyRef\";\n\nexport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n ContainerManifestRefSchema,\n};\n\nexport const ContainerManifestRefArrayArraySchema = arraySchema(\n ContainerManifestPathSchema,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS,\n);\n\nexport const DocumentContentKeyTargetEnvelopeSchema = loosePlainObject({\n containerId: nonEmptyStringSchema,\n containerKeyEpoch: positiveIntegerSchema,\n containerKeyEpochId: nonEmptyStringSchema,\n containerManifestHash: nonEmptyStringSchema,\n wrappedKey: ContentKeyWrappedKeySchema,\n wrappingMetadata: contentKeyWrappingMetadataSchema(\"document\"),\n});\n\nexport type DocumentContentKeyTargetEnvelope = z.infer<\n typeof DocumentContentKeyTargetEnvelopeSchema\n>;\n\nexport const DocumentContentKeyBundleRequestSchema = loosePlainObject({\n contentKeyEpoch: positiveIntegerSchema,\n linkSetManifestHash: nonEmptyStringSchema,\n targetHash: nonEmptyStringSchema,\n targets: arraySchema(\n DocumentContentKeyTargetEnvelopeSchema,\n MAX_DOCUMENT_SYNC_CONTENT_KEY_TARGETS,\n ),\n});\n\nexport type DocumentContentKeyBundleRequest = z.infer<\n typeof DocumentContentKeyBundleRequestSchema\n>;\n\nfunction createDocumentOutgoingUpdateSchema(\n encryptedDataSchema: z.ZodType<string>,\n versionVectorSchema: z.ZodType<string>,\n) {\n return registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n checkpointKind: z\n .literal(DOCUMENT_SYNC_ROTATION_CHECKPOINT_KIND)\n .optional(),\n checkpointPayloadKind: z\n .literal(DOCUMENT_SYNC_ROTATION_CHECKPOINT_PAYLOAD_KIND)\n .optional(),\n encryptedData: encryptedDataSchema,\n id: registerJsonSchemaFragment(z.string().refine(isUuidV4String), {\n pattern: UUID_V4_PATTERN.source,\n type: \"string\",\n }),\n partialEndVersionVector: versionVectorSchema,\n partialStartVersionVector: versionVectorSchema,\n plaintextHash: nonEmptyStringSchema,\n sourceVersionVector: versionVectorSchema.optional(),\n writeHeader: plainObjectSchema,\n }).superRefine((update, context) => {\n if (classifyDocumentSyncCheckpointFields(update) === \"invalid\") {\n context.addIssue({\n code: \"custom\",\n message: DOCUMENT_SYNC_CHECKPOINT_FIELD_SET_ISSUE_MESSAGE,\n });\n }\n }),\n [documentSyncRequestRotationRefinement],\n );\n}\n\n// Link-set rotations may carry a full-history baseline that is larger than a\n// single sync request. Their route has its own ingress policy, so keep the\n// shared update contract unbounded and apply the sync-specific ceiling only\n// where an update is embedded in DocumentSyncRequest.\nexport const DocumentOutgoingUpdateSchema = createDocumentOutgoingUpdateSchema(\n nonEmptyStringSchema,\n nonEmptyStringSchema,\n);\n\nconst DocumentSyncOutgoingUpdateSchema = createDocumentOutgoingUpdateSchema(\n boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_REQUEST_BYTES),\n boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_REQUEST_BYTES),\n);\n\nexport type DocumentOutgoingUpdate = z.infer<\n typeof DocumentOutgoingUpdateSchema\n>;\n\n// Document sync published container keyrings as opaque records before the\n// canonical container-mutation schema described their fields. Keep that one\n// existing OpenAPI view stable while runtime validation delegates to the shared\n// schema used by newer operations.\nconst DocumentSyncContainerMutationRequestSchema = registerJsonSchemaView(\n z.custom<ContainerMutationRequest>(\n (value) => ContainerMutationRequestSchema.safeParse(value).success,\n ),\n z.looseObject({\n body: requiredUnknownSchema,\n containerManifestHistoryRefs: ContainerManifestRefListSchema.optional(),\n destinationParentContainerPathRefs:\n OptionalContainerManifestPathSchema.optional(),\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n keyEpoch: plainObjectSchema,\n keyring: plainObjectSchema.nullable(),\n manifest: plainObjectSchema,\n parentContainerPathRefs: OptionalContainerManifestPathSchema.optional(),\n parentKekState: plainObjectSchema.nullable().optional(),\n predecessorBridge: plainObjectSchema.nullable(),\n previousContainerPathRefs: OptionalContainerManifestPathSchema.optional(),\n previousManifestRef: ContainerManifestRefSchema.nullable().optional(),\n principalPolicyRefs: PrincipalPolicyRefListSchema,\n userRecipientKeys: z.array(plainObjectSchema).optional(),\n wraps: z.array(plainObjectSchema),\n }),\n);\n\nconst WalLsnSchema = registerJsonSchemaFragment(\n z.string().refine(isWalLsnString),\n { pattern: WAL_LSN_PATTERN.source, type: \"string\" },\n);\n\nexport const DocumentSyncRequestSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n authorizingContainerPathRefs:\n ContainerManifestRefArrayArraySchema.optional(),\n // Each rotation carries a keyring sized by its epoch, so the batch is\n // bounded here as well as in the runtime guard.\n containerRekeys: arraySchema(\n DocumentSyncContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema.optional(),\n contentKeyEpoch: positiveIntegerSchema,\n expectedLinkSetManifestHash: nonEmptyStringSchema,\n expectedTargetHash: nonEmptyStringSchema,\n historyMode: z\n .literal(\"raw\")\n .describe(\n \"Explicit read-only recovery mode that bypasses rotation-baseline redirection and returns retained missing history\",\n )\n .optional(),\n inlineRekeyCommitId: sha256HexStringSchema.optional(),\n localVersionVector: boundedStringSchema(\n MAX_DOCUMENT_SYNC_REQUEST_BYTES,\n ).nullable(),\n minLsn: WalLsnSchema.optional(),\n outgoingUpdates: arraySchema(\n DocumentSyncOutgoingUpdateSchema,\n MAX_DOCUMENT_SYNC_OUTGOING_UPDATES,\n ),\n pullCursor: boundedNonEmptyStringSchema(\n MAX_DOCUMENT_SYNC_PULL_CURSOR_LENGTH,\n ).optional(),\n supportsPullPagination: z.literal(true),\n }).superRefine((request, context) => {\n if (!Array.isArray(request.outgoingUpdates)) {\n return;\n }\n // The field schemas have already recorded their cardinality errors. Do\n // not let the cross-field checks below rescan attacker-sized arrays after\n // those bounded schemas deliberately stopped before item validation.\n if (request.outgoingUpdates.length > MAX_DOCUMENT_SYNC_OUTGOING_UPDATES) {\n return;\n }\n if (\n Array.isArray(request.authorizingContainerPathRefs) &&\n request.authorizingContainerPathRefs.length >\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS\n ) {\n return;\n }\n\n const hasOutgoingUpdates = request.outgoingUpdates.length > 0;\n if (\n (request.containerRekeys?.length ?? 0) > 0 !==\n (request.inlineRekeyCommitId !== undefined)\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"inline rekey commit id must accompany container rekeys\",\n path: [\"inlineRekeyCommitId\"],\n });\n }\n if (\n request.pullCursor !== undefined &&\n (hasOutgoingUpdates ||\n (request.containerRekeys?.length ?? 0) > 0 ||\n request.contentKeyBundle !== undefined ||\n request.authorizingContainerPathRefs !== undefined)\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"continued pulls must be read-only\",\n path: [\"pullCursor\"],\n });\n }\n if (\n request.historyMode === \"raw\" &&\n (hasOutgoingUpdates ||\n (request.containerRekeys?.length ?? 0) > 0 ||\n request.contentKeyBundle !== undefined ||\n request.authorizingContainerPathRefs !== undefined)\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"raw-history pulls must be read-only\",\n path: [\"historyMode\"],\n });\n }\n if (request.historyMode === \"raw\" && request.localVersionVector !== null) {\n context.addIssue({\n code: \"custom\",\n message: \"raw-history pulls must start from a null version vector\",\n path: [\"localVersionVector\"],\n });\n }\n const requestMode = classifyDocumentSyncRequestMode({\n authorizingContainerPathRefsPresent:\n request.authorizingContainerPathRefs !== undefined,\n hasContainerRekeys: (request.containerRekeys?.length ?? 0) > 0,\n hasOutgoingUpdates,\n });\n\n if (requestMode === \"invalid-authorizing-path-refs-absent\") {\n context.addIssue({\n code: \"custom\",\n message:\n \"authorizing container paths are required for outgoing updates\",\n path: [\"authorizingContainerPathRefs\"],\n });\n }\n\n if (requestMode === \"invalid-rekeys-without-write\") {\n context.addIssue({\n code: \"custom\",\n message: \"container rekeys require an outgoing update\",\n path: [\"containerRekeys\"],\n });\n }\n\n if (\n new Set(\n request.outgoingUpdates\n .filter(isPlainObject)\n .map((update) => Reflect.get(update, \"id\")),\n ).size !== request.outgoingUpdates.length\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"outgoing update ids must be unique\",\n path: [\"outgoingUpdates\"],\n });\n }\n }),\n [\n ...documentSyncRequestEnvelopeRefinements,\n ...documentSyncRequestPullRefinements,\n ],\n);\n\nexport type DocumentSyncRequest = z.infer<typeof DocumentSyncRequestSchema>;\n"]}
|
|
@@ -9,6 +9,7 @@ export { type ContainerManifestRef, ContainerManifestRefArrayArraySchema, Contai
|
|
|
9
9
|
export { type CreateOrganizationGroupRequest, CreateOrganizationGroupRequestSchema, type CreateOrganizationGroupWithPolicyRequest, CreateOrganizationGroupWithPolicyRequestSchema, type DeleteOrganizationGroupRequest, DeleteOrganizationGroupRequestSchema, isCreateOrganizationGroupRequest, isCreateOrganizationGroupWithPolicyRequest, isDeleteOrganizationGroupRequest, isUpdateOrganizationProfileRequest, isUpdateOrganizationRosterEntryRequest, type OrganizationReadModelQuery, OrganizationReadModelQuerySchema, type UpdateOrganizationProfileRequest, UpdateOrganizationProfileRequestSchema, type UpdateOrganizationRosterEntryRequest, UpdateOrganizationRosterEntryRequestSchema, } from "./organization.js";
|
|
10
10
|
export { type CreateOrganizationRequest, CreateOrganizationRequestSchema, isCreateOrganizationRequest, isOrganizationProvisioningRequest, isProvisionedDocumentRequest, isProvisionedSystemContainerRequest, type OrganizationProvisioningRequest, OrganizationProvisioningRequestSchema, type ProvisionedDocumentRequest, ProvisionedDocumentRequestSchema, type ProvisionedSystemContainerRequest, ProvisionedSystemContainerRequestSchema, } from "./organizationProvisioning.js";
|
|
11
11
|
export { type CommitOrganizationGroupPolicyRequest, CommitOrganizationGroupPolicyRequestSchema, isCommitOrganizationGroupPolicyRequest, isOrganizationPrincipalPolicyRequest, isPutPrincipalPolicyRequest, type OrganizationPrincipalPolicyRequest, OrganizationPrincipalPolicyRequestSchema, type PrincipalContainerGrantRequest, PrincipalContainerGrantRequestSchema, type PrincipalMemberEnvelopeRequest, type PrincipalProjectionMemberRequest, type PrincipalStateEncryptedPayloadRequest, type PrincipalStateRequest, type PutPrincipalPolicyRequest, PutPrincipalPolicyRequestSchema, } from "./principal.js";
|
|
12
|
+
export { type PrincipalPolicyRef, PrincipalPolicyRefListSchema, PrincipalPolicyRefSchema, } from "./principalPolicyRef.js";
|
|
12
13
|
export { isRegistrationRequest, type RegistrationRequest, RegistrationRequestSchema, } from "./registration.js";
|
|
13
14
|
export { isRevenueCatTransferWebhookEvent, isRevenueCatWebhookRequest, type RevenueCatIncomingWebhookEvent, RevenueCatIncomingWebhookEventSchema, type RevenueCatSubscriberAttribute, RevenueCatSubscriberAttributeSchema, type RevenueCatTransferWebhookEvent, RevenueCatTransferWebhookEventSchema, type RevenueCatWebhookEvent, RevenueCatWebhookEventSchema, type RevenueCatWebhookRequest, RevenueCatWebhookRequestSchema, } from "./revenuecatWebhook.js";
|
|
14
15
|
export { isStripeReturnUrlRequest, type StripeReturnUrlRequest, StripeReturnUrlRequestSchema, } from "./stripeCheckout.js";
|
|
@@ -8,6 +8,7 @@ export { ContainerManifestRefArrayArraySchema, ContainerManifestRefSchema, Docum
|
|
|
8
8
|
export { CreateOrganizationGroupRequestSchema, CreateOrganizationGroupWithPolicyRequestSchema, DeleteOrganizationGroupRequestSchema, isCreateOrganizationGroupRequest, isCreateOrganizationGroupWithPolicyRequest, isDeleteOrganizationGroupRequest, isUpdateOrganizationProfileRequest, isUpdateOrganizationRosterEntryRequest, OrganizationReadModelQuerySchema, UpdateOrganizationProfileRequestSchema, UpdateOrganizationRosterEntryRequestSchema, } from "./organization.js";
|
|
9
9
|
export { CreateOrganizationRequestSchema, isCreateOrganizationRequest, isOrganizationProvisioningRequest, isProvisionedDocumentRequest, isProvisionedSystemContainerRequest, OrganizationProvisioningRequestSchema, ProvisionedDocumentRequestSchema, ProvisionedSystemContainerRequestSchema, } from "./organizationProvisioning.js";
|
|
10
10
|
export { CommitOrganizationGroupPolicyRequestSchema, isCommitOrganizationGroupPolicyRequest, isOrganizationPrincipalPolicyRequest, isPutPrincipalPolicyRequest, OrganizationPrincipalPolicyRequestSchema, PrincipalContainerGrantRequestSchema, PutPrincipalPolicyRequestSchema, } from "./principal.js";
|
|
11
|
+
export { PrincipalPolicyRefListSchema, PrincipalPolicyRefSchema, } from "./principalPolicyRef.js";
|
|
11
12
|
export { isRegistrationRequest, RegistrationRequestSchema, } from "./registration.js";
|
|
12
13
|
export { isRevenueCatTransferWebhookEvent, isRevenueCatWebhookRequest, RevenueCatIncomingWebhookEventSchema, RevenueCatSubscriberAttributeSchema, RevenueCatTransferWebhookEventSchema, RevenueCatWebhookEventSchema, RevenueCatWebhookRequestSchema, } from "./revenuecatWebhook.js";
|
|
13
14
|
export { isStripeReturnUrlRequest, StripeReturnUrlRequestSchema, } from "./stripeCheckout.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EAEf,mBAAmB,GACpB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAEL,+BAA+B,EAE/B,iCAAiC,EAEjC,iCAAiC,EAEjC,yCAAyC,EAEzC,2BAA2B,EAE3B,uCAAuC,EACvC,2BAA2B,EAC3B,6BAA6B,EAC7B,mCAAmC,GACpC,MAAM,QAAQ,CAAC;AAChB,OAAO,EAEL,8BAA8B,EAE9B,4BAA4B,EAE5B,8BAA8B,EAC9B,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0CAA0C,EAC1C,mCAAmC,EAEnC,uCAAuC,EACvC,sCAAsC,EACtC,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,gDAAgD,EAChD,4CAA4C,GAC7C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iCAAiC,EAEjC,qCAAqC,GACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,oCAAoC,EACpC,0BAA0B,EAE1B,qCAAqC,EAErC,sCAAsC,EAEtC,2BAA2B,EAE3B,oCAAoC,EAEpC,4BAA4B,EAE5B,0BAA0B,EAE1B,yBAAyB,EACzB,gCAAgC,EAChC,iCAAiC,EACjC,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,oCAAoC,EAEpC,8CAA8C,EAE9C,oCAAoC,EACpC,gCAAgC,EAChC,0CAA0C,EAC1C,gCAAgC,EAChC,kCAAkC,EAClC,sCAAsC,EAEtC,gCAAgC,EAEhC,sCAAsC,EAEtC,0CAA0C,GAC3C,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,+BAA+B,EAC/B,2BAA2B,EAC3B,iCAAiC,EACjC,4BAA4B,EAC5B,mCAAmC,EAEnC,qCAAqC,EAErC,gCAAgC,EAEhC,uCAAuC,GACxC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,0CAA0C,EAC1C,sCAAsC,EACtC,oCAAoC,EACpC,2BAA2B,EAE3B,wCAAwC,EAExC,oCAAoC,EAMpC,+BAA+B,GAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EAErB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gCAAgC,EAChC,0BAA0B,EAE1B,oCAAoC,EAEpC,mCAAmC,EAEnC,oCAAoC,EAEpC,4BAA4B,EAE5B,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EAExB,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC","sourcesContent":["export type { AccessManifestBundleWire } from \"../util/accessManifestBundle\";\nexport {\n type ChallengeRequest,\n ChallengeRequestSchema,\n isChallengeRequest,\n isVerifyRequest,\n type VerifyRequest,\n VerifyRequestSchema,\n} from \"./auth\";\nexport {\n type BlobAttachmentBindRequest,\n BlobAttachmentBindRequestSchema,\n type BlobAttachmentDetachRequest,\n BlobAttachmentDetachRequestSchema,\n type BlobContentKeyBundleRequest,\n BlobContentKeyBundleRequestSchema,\n type BlobContentKeyTargetEnvelopeRequest,\n BlobContentKeyTargetEnvelopeRequestSchema,\n type BlobStagedBlobRequest,\n BlobStagedBlobRequestSchema,\n type InitiateMultipartBlobStageRequest,\n InitiateMultipartBlobStageRequestSchema,\n isBlobAttachmentBindRequest,\n isBlobAttachmentDetachRequest,\n isInitiateMultipartBlobStageRequest,\n} from \"./blob\";\nexport {\n type ContainerMutationRequest,\n ContainerMutationRequestSchema,\n type ContainerReciteRequest,\n ContainerReciteRequestSchema,\n type ContainerRotationRequest,\n ContainerRotationRequestSchema,\n isContainerMutationRequest,\n isContainerReciteRequest,\n isContainerRotationRequest,\n} from \"./container\";\nexport {\n DEFAULT_CONTAINER_DOCUMENT_LANE_PAGE_LIMIT,\n isListContainerDocumentLanesRequest,\n type ListContainerDocumentLanesRequest,\n ListContainerDocumentLanesRequestSchema,\n MAX_CONTAINER_DOCUMENT_LANE_PAGE_TOTAL,\n MAX_CONTAINER_DOCUMENT_LANES,\n} from \"./containerDocumentLanes\";\nexport {\n type ContainerCreateWithMetadataDocumentRequest,\n ContainerCreateWithMetadataDocumentRequestSchema,\n isContainerCreateWithMetadataDocumentRequest,\n} from \"./containerMetadata\";\nexport {\n isListContainerParentLanesRequest,\n type ListContainerParentLanesRequest,\n ListContainerParentLanesRequestSchema,\n} from \"./containerParentLanes\";\nexport {\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n ContainerManifestRefSchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n type DocumentContentKeyTargetEnvelope,\n DocumentContentKeyTargetEnvelopeSchema,\n type DocumentCreateRequest,\n DocumentCreateRequestSchema,\n type DocumentLinkSetMutationRequest,\n DocumentLinkSetMutationRequestSchema,\n type DocumentOutgoingUpdate,\n DocumentOutgoingUpdateSchema,\n type DocumentPurgeRequest,\n DocumentPurgeRequestSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n isContainerManifestRefArrayArray,\n isDocumentContentKeyBundleRequest,\n isDocumentCreateRequest,\n isDocumentLinkSetMutationRequest,\n isDocumentPurgeRequest,\n isDocumentSyncRequest,\n} from \"./document\";\nexport {\n type CreateOrganizationGroupRequest,\n CreateOrganizationGroupRequestSchema,\n type CreateOrganizationGroupWithPolicyRequest,\n CreateOrganizationGroupWithPolicyRequestSchema,\n type DeleteOrganizationGroupRequest,\n DeleteOrganizationGroupRequestSchema,\n isCreateOrganizationGroupRequest,\n isCreateOrganizationGroupWithPolicyRequest,\n isDeleteOrganizationGroupRequest,\n isUpdateOrganizationProfileRequest,\n isUpdateOrganizationRosterEntryRequest,\n type OrganizationReadModelQuery,\n OrganizationReadModelQuerySchema,\n type UpdateOrganizationProfileRequest,\n UpdateOrganizationProfileRequestSchema,\n type UpdateOrganizationRosterEntryRequest,\n UpdateOrganizationRosterEntryRequestSchema,\n} from \"./organization\";\nexport {\n type CreateOrganizationRequest,\n CreateOrganizationRequestSchema,\n isCreateOrganizationRequest,\n isOrganizationProvisioningRequest,\n isProvisionedDocumentRequest,\n isProvisionedSystemContainerRequest,\n type OrganizationProvisioningRequest,\n OrganizationProvisioningRequestSchema,\n type ProvisionedDocumentRequest,\n ProvisionedDocumentRequestSchema,\n type ProvisionedSystemContainerRequest,\n ProvisionedSystemContainerRequestSchema,\n} from \"./organizationProvisioning\";\nexport {\n type CommitOrganizationGroupPolicyRequest,\n CommitOrganizationGroupPolicyRequestSchema,\n isCommitOrganizationGroupPolicyRequest,\n isOrganizationPrincipalPolicyRequest,\n isPutPrincipalPolicyRequest,\n type OrganizationPrincipalPolicyRequest,\n OrganizationPrincipalPolicyRequestSchema,\n type PrincipalContainerGrantRequest,\n PrincipalContainerGrantRequestSchema,\n type PrincipalMemberEnvelopeRequest,\n type PrincipalProjectionMemberRequest,\n type PrincipalStateEncryptedPayloadRequest,\n type PrincipalStateRequest,\n type PutPrincipalPolicyRequest,\n PutPrincipalPolicyRequestSchema,\n} from \"./principal\";\nexport {\n isRegistrationRequest,\n type RegistrationRequest,\n RegistrationRequestSchema,\n} from \"./registration\";\nexport {\n isRevenueCatTransferWebhookEvent,\n isRevenueCatWebhookRequest,\n type RevenueCatIncomingWebhookEvent,\n RevenueCatIncomingWebhookEventSchema,\n type RevenueCatSubscriberAttribute,\n RevenueCatSubscriberAttributeSchema,\n type RevenueCatTransferWebhookEvent,\n RevenueCatTransferWebhookEventSchema,\n type RevenueCatWebhookEvent,\n RevenueCatWebhookEventSchema,\n type RevenueCatWebhookRequest,\n RevenueCatWebhookRequestSchema,\n} from \"./revenuecatWebhook\";\nexport {\n isStripeReturnUrlRequest,\n type StripeReturnUrlRequest,\n StripeReturnUrlRequestSchema,\n} from \"./stripeCheckout\";\nexport {\n isStripeWebhookRequest,\n type StripeWebhookRequest,\n StripeWebhookRequestSchema,\n} from \"./stripeWebhook\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EAEf,mBAAmB,GACpB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAEL,+BAA+B,EAE/B,iCAAiC,EAEjC,iCAAiC,EAEjC,yCAAyC,EAEzC,2BAA2B,EAE3B,uCAAuC,EACvC,2BAA2B,EAC3B,6BAA6B,EAC7B,mCAAmC,GACpC,MAAM,QAAQ,CAAC;AAChB,OAAO,EAEL,8BAA8B,EAE9B,4BAA4B,EAE5B,8BAA8B,EAC9B,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0CAA0C,EAC1C,mCAAmC,EAEnC,uCAAuC,EACvC,sCAAsC,EACtC,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,gDAAgD,EAChD,4CAA4C,GAC7C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iCAAiC,E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esContent":["export type { AccessManifestBundleWire } from \"../util/accessManifestBundle\";\nexport {\n type ChallengeRequest,\n ChallengeRequestSchema,\n isChallengeRequest,\n isVerifyRequest,\n type VerifyRequest,\n VerifyRequestSchema,\n} from \"./auth\";\nexport {\n type BlobAttachmentBindRequest,\n BlobAttachmentBindRequestSchema,\n type BlobAttachmentDetachRequest,\n BlobAttachmentDetachRequestSchema,\n type BlobContentKeyBundleRequest,\n BlobContentKeyBundleRequestSchema,\n type BlobContentKeyTargetEnvelopeRequest,\n BlobContentKeyTargetEnvelopeRequestSchema,\n type BlobStagedBlobRequest,\n BlobStagedBlobRequestSchema,\n type InitiateMultipartBlobStageRequest,\n InitiateMultipartBlobStageRequestSchema,\n isBlobAttachmentBindRequest,\n isBlobAttachmentDetachRequest,\n isInitiateMultipartBlobStageRequest,\n} from \"./blob\";\nexport {\n type ContainerMutationRequest,\n ContainerMutationRequestSchema,\n type ContainerReciteRequest,\n ContainerReciteRequestSchema,\n type ContainerRotationRequest,\n ContainerRotationRequestSchema,\n isContainerMutationRequest,\n isContainerReciteRequest,\n isContainerRotationRequest,\n} from \"./container\";\nexport {\n DEFAULT_CONTAINER_DOCUMENT_LANE_PAGE_LIMIT,\n isListContainerDocumentLanesRequest,\n type ListContainerDocumentLanesRequest,\n ListContainerDocumentLanesRequestSchema,\n MAX_CONTAINER_DOCUMENT_LANE_PAGE_TOTAL,\n MAX_CONTAINER_DOCUMENT_LANES,\n} from \"./containerDocumentLanes\";\nexport {\n type ContainerCreateWithMetadataDocumentRequest,\n ContainerCreateWithMetadataDocumentRequestSchema,\n isContainerCreateWithMetadataDocumentRequest,\n} from \"./containerMetadata\";\nexport {\n isListContainerParentLanesRequest,\n type ListContainerParentLanesRequest,\n ListContainerParentLanesRequestSchema,\n} from \"./containerParentLanes\";\nexport {\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n ContainerManifestRefSchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n type DocumentContentKeyTargetEnvelope,\n DocumentContentKeyTargetEnvelopeSchema,\n type DocumentCreateRequest,\n DocumentCreateRequestSchema,\n type DocumentLinkSetMutationRequest,\n DocumentLinkSetMutationRequestSchema,\n type DocumentOutgoingUpdate,\n DocumentOutgoingUpdateSchema,\n type DocumentPurgeRequest,\n DocumentPurgeRequestSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n isContainerManifestRefArrayArray,\n isDocumentContentKeyBundleRequest,\n isDocumentCreateRequest,\n isDocumentLinkSetMutationRequest,\n isDocumentPurgeRequest,\n isDocumentSyncRequest,\n} from \"./document\";\nexport {\n type CreateOrganizationGroupRequest,\n CreateOrganizationGroupRequestSchema,\n type CreateOrganizationGroupWithPolicyRequest,\n CreateOrganizationGroupWithPolicyRequestSchema,\n type DeleteOrganizationGroupRequest,\n DeleteOrganizationGroupRequestSchema,\n isCreateOrganizationGroupRequest,\n isCreateOrganizationGroupWithPolicyRequest,\n isDeleteOrganizationGroupRequest,\n isUpdateOrganizationProfileRequest,\n isUpdateOrganizationRosterEntryRequest,\n type OrganizationReadModelQuery,\n OrganizationReadModelQuerySchema,\n type UpdateOrganizationProfileRequest,\n UpdateOrganizationProfileRequestSchema,\n type UpdateOrganizationRosterEntryRequest,\n UpdateOrganizationRosterEntryRequestSchema,\n} from \"./organization\";\nexport {\n type CreateOrganizationRequest,\n CreateOrganizationRequestSchema,\n isCreateOrganizationRequest,\n isOrganizationProvisioningRequest,\n isProvisionedDocumentRequest,\n isProvisionedSystemContainerRequest,\n type OrganizationProvisioningRequest,\n OrganizationProvisioningRequestSchema,\n type ProvisionedDocumentRequest,\n ProvisionedDocumentRequestSchema,\n type ProvisionedSystemContainerRequest,\n ProvisionedSystemContainerRequestSchema,\n} from \"./organizationProvisioning\";\nexport {\n type CommitOrganizationGroupPolicyRequest,\n CommitOrganizationGroupPolicyRequestSchema,\n isCommitOrganizationGroupPolicyRequest,\n isOrganizationPrincipalPolicyRequest,\n isPutPrincipalPolicyRequest,\n type OrganizationPrincipalPolicyRequest,\n OrganizationPrincipalPolicyRequestSchema,\n type PrincipalContainerGrantRequest,\n PrincipalContainerGrantRequestSchema,\n type PrincipalMemberEnvelopeRequest,\n type PrincipalProjectionMemberRequest,\n type PrincipalStateEncryptedPayloadRequest,\n type PrincipalStateRequest,\n type PutPrincipalPolicyRequest,\n PutPrincipalPolicyRequestSchema,\n} from \"./principal\";\nexport {\n type PrincipalPolicyRef,\n PrincipalPolicyRefListSchema,\n PrincipalPolicyRefSchema,\n} from \"./principalPolicyRef\";\nexport {\n isRegistrationRequest,\n type RegistrationRequest,\n RegistrationRequestSchema,\n} from \"./registration\";\nexport {\n isRevenueCatTransferWebhookEvent,\n isRevenueCatWebhookRequest,\n type RevenueCatIncomingWebhookEvent,\n RevenueCatIncomingWebhookEventSchema,\n type RevenueCatSubscriberAttribute,\n RevenueCatSubscriberAttributeSchema,\n type RevenueCatTransferWebhookEvent,\n RevenueCatTransferWebhookEventSchema,\n type RevenueCatWebhookEvent,\n RevenueCatWebhookEventSchema,\n type RevenueCatWebhookRequest,\n RevenueCatWebhookRequestSchema,\n} from \"./revenuecatWebhook\";\nexport {\n isStripeReturnUrlRequest,\n type StripeReturnUrlRequest,\n StripeReturnUrlRequestSchema,\n} from \"./stripeCheckout\";\nexport {\n isStripeWebhookRequest,\n type StripeWebhookRequest,\n StripeWebhookRequestSchema,\n} from \"./stripeWebhook\";\n"]}
|
|
@@ -58,7 +58,12 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
58
58
|
keyring: Record<string, unknown> | null;
|
|
59
59
|
manifest: Record<string, unknown>;
|
|
60
60
|
predecessorBridge: Record<string, unknown> | null;
|
|
61
|
-
|
|
61
|
+
principalPolicyRefs: {
|
|
62
|
+
principalType: "group" | "organization";
|
|
63
|
+
principalId: string;
|
|
64
|
+
version: number;
|
|
65
|
+
stateHash: string;
|
|
66
|
+
}[];
|
|
62
67
|
wraps: Record<string, unknown>[];
|
|
63
68
|
containerManifestHistoryRefs?: {
|
|
64
69
|
containerId: string;
|
|
@@ -140,7 +145,12 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
140
145
|
keyring: Record<string, unknown> | null;
|
|
141
146
|
manifest: Record<string, unknown>;
|
|
142
147
|
predecessorBridge: Record<string, unknown> | null;
|
|
143
|
-
|
|
148
|
+
principalPolicyRefs: {
|
|
149
|
+
principalType: "group" | "organization";
|
|
150
|
+
principalId: string;
|
|
151
|
+
version: number;
|
|
152
|
+
stateHash: string;
|
|
153
|
+
}[];
|
|
144
154
|
wraps: Record<string, unknown>[];
|
|
145
155
|
containerManifestHistoryRefs?: {
|
|
146
156
|
containerId: string;
|
|
@@ -222,7 +232,12 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
222
232
|
keyring: Record<string, unknown> | null;
|
|
223
233
|
manifest: Record<string, unknown>;
|
|
224
234
|
predecessorBridge: Record<string, unknown> | null;
|
|
225
|
-
|
|
235
|
+
principalPolicyRefs: {
|
|
236
|
+
principalType: "group" | "organization";
|
|
237
|
+
principalId: string;
|
|
238
|
+
version: number;
|
|
239
|
+
stateHash: string;
|
|
240
|
+
}[];
|
|
226
241
|
wraps: Record<string, unknown>[];
|
|
227
242
|
containerManifestHistoryRefs?: {
|
|
228
243
|
containerId: string;
|
|
@@ -304,7 +319,12 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
304
319
|
keyring: Record<string, unknown> | null;
|
|
305
320
|
manifest: Record<string, unknown>;
|
|
306
321
|
predecessorBridge: Record<string, unknown> | null;
|
|
307
|
-
|
|
322
|
+
principalPolicyRefs: {
|
|
323
|
+
principalType: "group" | "organization";
|
|
324
|
+
principalId: string;
|
|
325
|
+
version: number;
|
|
326
|
+
stateHash: string;
|
|
327
|
+
}[];
|
|
308
328
|
wraps: Record<string, unknown>[];
|
|
309
329
|
containerManifestHistoryRefs?: {
|
|
310
330
|
containerId: string;
|
|
@@ -389,7 +409,12 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
389
409
|
keyring: Record<string, unknown> | null;
|
|
390
410
|
manifest: Record<string, unknown>;
|
|
391
411
|
predecessorBridge: Record<string, unknown> | null;
|
|
392
|
-
|
|
412
|
+
principalPolicyRefs: {
|
|
413
|
+
principalType: "group" | "organization";
|
|
414
|
+
principalId: string;
|
|
415
|
+
version: number;
|
|
416
|
+
stateHash: string;
|
|
417
|
+
}[];
|
|
393
418
|
wraps: Record<string, unknown>[];
|
|
394
419
|
containerManifestHistoryRefs?: {
|
|
395
420
|
containerId: string;
|
|
@@ -471,7 +496,12 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
471
496
|
keyring: Record<string, unknown> | null;
|
|
472
497
|
manifest: Record<string, unknown>;
|
|
473
498
|
predecessorBridge: Record<string, unknown> | null;
|
|
474
|
-
|
|
499
|
+
principalPolicyRefs: {
|
|
500
|
+
principalType: "group" | "organization";
|
|
501
|
+
principalId: string;
|
|
502
|
+
version: number;
|
|
503
|
+
stateHash: string;
|
|
504
|
+
}[];
|
|
475
505
|
wraps: Record<string, unknown>[];
|
|
476
506
|
containerManifestHistoryRefs?: {
|
|
477
507
|
containerId: string;
|
|
@@ -553,7 +583,12 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
553
583
|
keyring: Record<string, unknown> | null;
|
|
554
584
|
manifest: Record<string, unknown>;
|
|
555
585
|
predecessorBridge: Record<string, unknown> | null;
|
|
556
|
-
|
|
586
|
+
principalPolicyRefs: {
|
|
587
|
+
principalType: "group" | "organization";
|
|
588
|
+
principalId: string;
|
|
589
|
+
version: number;
|
|
590
|
+
stateHash: string;
|
|
591
|
+
}[];
|
|
557
592
|
wraps: Record<string, unknown>[];
|
|
558
593
|
containerManifestHistoryRefs?: {
|
|
559
594
|
containerId: string;
|
|
@@ -635,7 +670,12 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
635
670
|
keyring: Record<string, unknown> | null;
|
|
636
671
|
manifest: Record<string, unknown>;
|
|
637
672
|
predecessorBridge: Record<string, unknown> | null;
|
|
638
|
-
|
|
673
|
+
principalPolicyRefs: {
|
|
674
|
+
principalType: "group" | "organization";
|
|
675
|
+
principalId: string;
|
|
676
|
+
version: number;
|
|
677
|
+
stateHash: string;
|
|
678
|
+
}[];
|
|
639
679
|
wraps: Record<string, unknown>[];
|
|
640
680
|
containerManifestHistoryRefs?: {
|
|
641
681
|
containerId: string;
|
|
@@ -719,7 +759,12 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
719
759
|
keyring: Record<string, unknown> | null;
|
|
720
760
|
manifest: Record<string, unknown>;
|
|
721
761
|
predecessorBridge: Record<string, unknown> | null;
|
|
722
|
-
|
|
762
|
+
principalPolicyRefs: {
|
|
763
|
+
principalType: "group" | "organization";
|
|
764
|
+
principalId: string;
|
|
765
|
+
version: number;
|
|
766
|
+
stateHash: string;
|
|
767
|
+
}[];
|
|
723
768
|
wraps: Record<string, unknown>[];
|
|
724
769
|
containerManifestHistoryRefs?: {
|
|
725
770
|
containerId: string;
|
|
@@ -801,7 +846,12 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
801
846
|
keyring: Record<string, unknown> | null;
|
|
802
847
|
manifest: Record<string, unknown>;
|
|
803
848
|
predecessorBridge: Record<string, unknown> | null;
|
|
804
|
-
|
|
849
|
+
principalPolicyRefs: {
|
|
850
|
+
principalType: "group" | "organization";
|
|
851
|
+
principalId: string;
|
|
852
|
+
version: number;
|
|
853
|
+
stateHash: string;
|
|
854
|
+
}[];
|
|
805
855
|
wraps: Record<string, unknown>[];
|
|
806
856
|
containerManifestHistoryRefs?: {
|
|
807
857
|
containerId: string;
|
|
@@ -883,7 +933,12 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
883
933
|
keyring: Record<string, unknown> | null;
|
|
884
934
|
manifest: Record<string, unknown>;
|
|
885
935
|
predecessorBridge: Record<string, unknown> | null;
|
|
886
|
-
|
|
936
|
+
principalPolicyRefs: {
|
|
937
|
+
principalType: "group" | "organization";
|
|
938
|
+
principalId: string;
|
|
939
|
+
version: number;
|
|
940
|
+
stateHash: string;
|
|
941
|
+
}[];
|
|
887
942
|
wraps: Record<string, unknown>[];
|
|
888
943
|
containerManifestHistoryRefs?: {
|
|
889
944
|
containerId: string;
|
|
@@ -965,7 +1020,12 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
965
1020
|
keyring: Record<string, unknown> | null;
|
|
966
1021
|
manifest: Record<string, unknown>;
|
|
967
1022
|
predecessorBridge: Record<string, unknown> | null;
|
|
968
|
-
|
|
1023
|
+
principalPolicyRefs: {
|
|
1024
|
+
principalType: "group" | "organization";
|
|
1025
|
+
principalId: string;
|
|
1026
|
+
version: number;
|
|
1027
|
+
stateHash: string;
|
|
1028
|
+
}[];
|
|
969
1029
|
wraps: Record<string, unknown>[];
|
|
970
1030
|
containerManifestHistoryRefs?: {
|
|
971
1031
|
containerId: string;
|
|
@@ -1052,7 +1112,12 @@ export declare const DeleteOrganizationGroupRequestSchema: z.ZodType<{
|
|
|
1052
1112
|
keyring: Record<string, unknown> | null;
|
|
1053
1113
|
manifest: Record<string, unknown>;
|
|
1054
1114
|
predecessorBridge: Record<string, unknown> | null;
|
|
1055
|
-
|
|
1115
|
+
principalPolicyRefs: {
|
|
1116
|
+
principalType: "group" | "organization";
|
|
1117
|
+
principalId: string;
|
|
1118
|
+
version: number;
|
|
1119
|
+
stateHash: string;
|
|
1120
|
+
}[];
|
|
1056
1121
|
wraps: Record<string, unknown>[];
|
|
1057
1122
|
containerManifestHistoryRefs?: {
|
|
1058
1123
|
containerId: string;
|
|
@@ -1136,7 +1201,12 @@ export declare const DeleteOrganizationGroupRequestSchema: z.ZodType<{
|
|
|
1136
1201
|
keyring: Record<string, unknown> | null;
|
|
1137
1202
|
manifest: Record<string, unknown>;
|
|
1138
1203
|
predecessorBridge: Record<string, unknown> | null;
|
|
1139
|
-
|
|
1204
|
+
principalPolicyRefs: {
|
|
1205
|
+
principalType: "group" | "organization";
|
|
1206
|
+
principalId: string;
|
|
1207
|
+
version: number;
|
|
1208
|
+
stateHash: string;
|
|
1209
|
+
}[];
|
|
1140
1210
|
wraps: Record<string, unknown>[];
|
|
1141
1211
|
containerManifestHistoryRefs?: {
|
|
1142
1212
|
containerId: string;
|
|
@@ -1220,7 +1290,12 @@ export declare const DeleteOrganizationGroupRequestSchema: z.ZodType<{
|
|
|
1220
1290
|
keyring: Record<string, unknown> | null;
|
|
1221
1291
|
manifest: Record<string, unknown>;
|
|
1222
1292
|
predecessorBridge: Record<string, unknown> | null;
|
|
1223
|
-
|
|
1293
|
+
principalPolicyRefs: {
|
|
1294
|
+
principalType: "group" | "organization";
|
|
1295
|
+
principalId: string;
|
|
1296
|
+
version: number;
|
|
1297
|
+
stateHash: string;
|
|
1298
|
+
}[];
|
|
1224
1299
|
wraps: Record<string, unknown>[];
|
|
1225
1300
|
containerManifestHistoryRefs?: {
|
|
1226
1301
|
containerId: string;
|
|
@@ -1304,7 +1379,12 @@ export declare const DeleteOrganizationGroupRequestSchema: z.ZodType<{
|
|
|
1304
1379
|
keyring: Record<string, unknown> | null;
|
|
1305
1380
|
manifest: Record<string, unknown>;
|
|
1306
1381
|
predecessorBridge: Record<string, unknown> | null;
|
|
1307
|
-
|
|
1382
|
+
principalPolicyRefs: {
|
|
1383
|
+
principalType: "group" | "organization";
|
|
1384
|
+
principalId: string;
|
|
1385
|
+
version: number;
|
|
1386
|
+
stateHash: string;
|
|
1387
|
+
}[];
|
|
1308
1388
|
wraps: Record<string, unknown>[];
|
|
1309
1389
|
containerManifestHistoryRefs?: {
|
|
1310
1390
|
containerId: string;
|