@tearleads/client-sdk 0.1.249 → 0.1.251
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/documents/shared/events.js +2 -1
- package/data/documents/shared/events.js.map +1 -1
- package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js +1 -4
- package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js.map +1 -1
- package/data/persistence/principalPolicy/heldOrganizationDirectories.js +6 -1
- package/data/persistence/principalPolicy/heldOrganizationDirectories.js.map +1 -1
- package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js +1 -1
- package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js.map +1 -1
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js +1 -5
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js.map +1 -1
- package/data/principals/organizationGroupDirectoryRequest.js +0 -2
- package/data/principals/organizationGroupDirectoryRequest.js.map +1 -1
- package/data/principals/organizationPolicyRequest.js +0 -2
- package/data/principals/organizationPolicyRequest.js.map +1 -1
- package/data/principals/principalPolicyRequest.js +0 -2
- package/data/principals/principalPolicyRequest.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +0 -58
- package/internal/api-client/client/apiClientContext.d.ts +0 -30
- package/internal/api-client/client/documents.d.ts +0 -12
- package/internal/api-client/client/principalPolicies.d.ts +0 -18
- package/internal/api-client/client/writerProjections.d.ts +0 -12
- package/internal/api-client/heldDirectoryCitations.d.ts +8 -4
- package/internal/api-client/heldDirectoryCitations.js +6 -10
- package/internal/api-client/heldDirectoryCitations.js.map +1 -1
- package/internal/api-client/organizationPolicyHistory.d.ts +0 -6
- package/internal/api-client/principalPolicyRequests.d.ts +0 -18
- package/internal/api-client/verifiedManifestCitations.js +3 -3
- package/internal/api-client/verifiedManifestCitations.js.map +1 -1
- package/internal/crypto/index.d.ts +1 -1
- package/internal/crypto/index.js.map +1 -1
- package/internal/crypto/keying/principalPolicyPayload.js +2 -12
- package/internal/crypto/keying/principalPolicyPayload.js.map +1 -1
- package/internal/crypto/keying/principalPolicyTypes.d.ts +5 -6
- package/internal/crypto/keying/principalPolicyTypes.js.map +1 -1
- package/internal/crypto/principalState.d.ts +1 -1
- package/internal/crypto/principalState.js.map +1 -1
- package/internal/crypto/principalStateTypes.d.ts +0 -1
- package/internal/crypto/principalStateTypes.js.map +1 -1
- package/internal/validators/documentCreateSeedRefinements.js +2 -2
- package/internal/validators/documentCreateSeedRefinements.js.map +1 -1
- package/internal/validators/operation/auth.d.ts +50 -1727
- package/internal/validators/operation/auth.js +2 -2
- package/internal/validators/operation/auth.js.map +1 -1
- package/internal/validators/operation/containerMutations.d.ts +1 -294
- package/internal/validators/operation/containerMutations.js +2 -2
- package/internal/validators/operation/containerMutations.js.map +1 -1
- package/internal/validators/operation/documentMutations.d.ts +1 -342
- package/internal/validators/operation/documentMutations.js +2 -2
- package/internal/validators/operation/documentMutations.js.map +1 -1
- package/internal/validators/operation/organizationPolicyHistory.d.ts +0 -24
- package/internal/validators/operation/organizations.d.ts +50 -1751
- package/internal/validators/operation/organizations.js +2 -2
- package/internal/validators/operation/organizations.js.map +1 -1
- package/internal/validators/operation/principals.d.ts +0 -56
- package/internal/validators/operation/writerProjections.d.ts +0 -48
- package/internal/validators/organizationProvisioningRefinements.js +2 -2
- package/internal/validators/organizationProvisioningRefinements.js.map +1 -1
- package/internal/validators/request/containerMetadata.d.ts +0 -276
- package/internal/validators/request/containerMetadata.js +5 -4
- package/internal/validators/request/containerMetadata.js.map +1 -1
- package/internal/validators/request/document.d.ts +0 -277
- package/internal/validators/request/document.js +8 -4
- package/internal/validators/request/document.js.map +1 -1
- package/internal/validators/request/documentCreateSeed.d.ts +99 -0
- package/internal/validators/request/documentCreateSeed.js +132 -9
- package/internal/validators/request/documentCreateSeed.js.map +1 -1
- package/internal/validators/request/documentSyncSchema.d.ts +41 -0
- package/internal/validators/request/documentSyncSchema.js +1 -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 +0 -32
- package/internal/validators/request/organizationProvisioning.d.ts +263 -5639
- package/internal/validators/request/organizationProvisioning.js +10 -4
- package/internal/validators/request/organizationProvisioning.js.map +1 -1
- package/internal/validators/request/principal.d.ts +4 -48
- package/internal/validators/request/principal.js +4 -2
- package/internal/validators/request/principal.js.map +1 -1
- package/internal/validators/request/registration.d.ts +71 -1727
- package/internal/validators/response/container.d.ts +0 -48
- package/internal/validators/response/documentMutation.d.ts +0 -96
- package/internal/validators/response/organizationPolicyHistory.d.ts +0 -24
- package/internal/validators/response/policyEvidenceWire.d.ts +5 -3
- package/internal/validators/response/policyEvidenceWire.js +6 -4
- package/internal/validators/response/policyEvidenceWire.js.map +1 -1
- package/internal/validators/response/principal.d.ts +0 -48
- package/internal/validators/response/principalPolicyPage.d.ts +0 -48
- package/internal/validators/response/principalSnapshot.d.ts +4 -24
- package/internal/validators/response/principalSnapshot.js +4 -6
- package/internal/validators/response/principalSnapshot.js.map +1 -1
- package/internal/validators/response/projectionPolicyEvidence.d.ts +0 -48
- package/package.json +1 -1
- package/workflows/container-contents/container-state/create/createWithMetadata.js +6 -3
- package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -1
- package/workflows/documents/create/index.js +4 -4
- package/workflows/documents/create/index.js.map +1 -1
- package/workflows/documents/sync/initialSync.d.ts +26 -11
- package/workflows/documents/sync/initialSync.js +32 -12
- package/workflows/documents/sync/initialSync.js.map +1 -1
- package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js +1 -6
- package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js.map +1 -1
- package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js +1 -6
- package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js.map +1 -1
- package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js +4 -6
- package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js.map +1 -1
- package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js +1 -7
- package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js.map +1 -1
- package/workflows/principals/policyCache/principalPolicyCacheValidation.js +0 -13
- package/workflows/principals/policyCache/principalPolicyCacheValidation.js.map +1 -1
- package/workflows/principals/publicHistory/publicProjectionDirectory.js +4 -5
- package/workflows/principals/publicHistory/publicProjectionDirectory.js.map +1 -1
- package/workflows/registration/provisionedProfileDocument.js +2 -2
- package/workflows/registration/provisionedProfileDocument.js.map +1 -1
- package/workflows/registration/provisioningBootstrapBuilders.d.ts +0 -74
- package/workflows/registration/provisioningBootstrapBuilders.js +3 -3
- package/workflows/registration/provisioningBootstrapBuilders.js.map +1 -1
- package/workflows/registration/registrationPrincipalPolicyPersistence.js +1 -7
- package/workflows/registration/registrationPrincipalPolicyPersistence.js.map +1 -1
|
@@ -1,15 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { arraySchema, loosePlainObject } from "../schema.js";
|
|
2
|
+
import { MAX_CONTAINER_PATH_LENGTH } from "../util/containerLimits.js";
|
|
3
|
+
import { MAX_DOCUMENT_SYNC_OUTGOING_UPDATES, MAX_DOCUMENT_SYNC_REQUEST_BYTES, } from "../util/documentSyncLimits.js";
|
|
4
|
+
import { ContainerManifestPathSchema, DocumentContentKeyBundleRequestSchema, DocumentSyncOutgoingUpdateSchema, DocumentSyncRequestSchema, } from "./documentSyncSchema.js";
|
|
2
5
|
const TEXT_ENCODER = new TextEncoder();
|
|
3
6
|
/**
|
|
4
|
-
* A seed
|
|
5
|
-
* transaction
|
|
7
|
+
* A create's seed: the one update a document is born with, committed in its
|
|
8
|
+
* create transaction. It carries the update alone; the server takes the rest
|
|
9
|
+
* of the sync it stands for from the create itself (see
|
|
10
|
+
* {@link documentCreateSeedSyncRequest}).
|
|
11
|
+
*/
|
|
12
|
+
export const DocumentCreateSeedRequestSchema = loosePlainObject({
|
|
13
|
+
// A seed holds exactly one update; the create's seed refinement enforces it.
|
|
14
|
+
outgoingUpdates: arraySchema(DocumentSyncOutgoingUpdateSchema, MAX_DOCUMENT_SYNC_OUTGOING_UPDATES),
|
|
15
|
+
});
|
|
16
|
+
const DocumentCreateSeedSourceSchema = loosePlainObject({
|
|
17
|
+
contentKeyBundle: DocumentContentKeyBundleRequestSchema,
|
|
18
|
+
targetContainerPathRefs: ContainerManifestPathSchema.optional(),
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* The document sync a create's seed stands for: the seed's update under the
|
|
22
|
+
* create's content-key epoch, expected link-set and target hashes, and target
|
|
23
|
+
* path, with the update's end as the local version. The update's signed write
|
|
24
|
+
* header names the same values, so the sync checks hold it to them exactly as
|
|
25
|
+
* for a standalone first sync. It carries no content-key bundle: the create
|
|
26
|
+
* stores that bundle in the same transaction, and the sync checks the stored
|
|
27
|
+
* one against these hashes.
|
|
28
|
+
*/
|
|
29
|
+
export function documentCreateSeedSyncRequest(create, seed) {
|
|
30
|
+
const [update] = seed.outgoingUpdates;
|
|
31
|
+
return {
|
|
32
|
+
...(create.targetContainerPathRefs === undefined
|
|
33
|
+
? {}
|
|
34
|
+
: {
|
|
35
|
+
authorizingContainerPathRefs: [[...create.targetContainerPathRefs]],
|
|
36
|
+
}),
|
|
37
|
+
contentKeyEpoch: create.contentKeyBundle.contentKeyEpoch,
|
|
38
|
+
expectedLinkSetManifestHash: create.contentKeyBundle.linkSetManifestHash,
|
|
39
|
+
expectedTargetHash: create.contentKeyBundle.targetHash,
|
|
40
|
+
localVersionVector: update?.partialEndVersionVector ?? null,
|
|
41
|
+
outgoingUpdates: [...seed.outgoingUpdates],
|
|
42
|
+
supportsPullPagination: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A seed is exactly one outgoing update. An attachment bind's document sync,
|
|
47
|
+
* a full sync request, also holds no container rekeys.
|
|
6
48
|
*/
|
|
7
49
|
export function refineSingleUpdateSeed(seed, context, issue) {
|
|
8
50
|
if (!Array.isArray(seed?.outgoingUpdates)) {
|
|
9
51
|
return;
|
|
10
52
|
}
|
|
53
|
+
const rekeys = Reflect.get(seed, "containerRekeys");
|
|
11
54
|
if (seed.outgoingUpdates.length !== 1 ||
|
|
12
|
-
(
|
|
55
|
+
(Array.isArray(rekeys) && rekeys.length !== 0)) {
|
|
13
56
|
context.addIssue({
|
|
14
57
|
code: "custom",
|
|
15
58
|
message: issue.message,
|
|
@@ -18,13 +61,23 @@ export function refineSingleUpdateSeed(seed, context, issue) {
|
|
|
18
61
|
}
|
|
19
62
|
}
|
|
20
63
|
/**
|
|
21
|
-
* A create seed stands in for the document's first sync, so
|
|
22
|
-
* sync request limit the create route's larger
|
|
64
|
+
* A create seed stands in for the document's first sync, so the sync it
|
|
65
|
+
* stands for is held to the sync request limit the create route's larger
|
|
66
|
+
* ingress ceiling would not apply.
|
|
23
67
|
*/
|
|
24
68
|
export function refineSeedWithinSyncRequestLimit(seed, context, path) {
|
|
25
|
-
if (seed
|
|
26
|
-
|
|
27
|
-
|
|
69
|
+
if (seed === undefined)
|
|
70
|
+
return;
|
|
71
|
+
let bytes;
|
|
72
|
+
try {
|
|
73
|
+
bytes = TEXT_ENCODER.encode(JSON.stringify(seed)).byteLength;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Opaque fields (such as a write header) can nest too deeply to
|
|
77
|
+
// serialize; such a seed is refused, never thrown on.
|
|
78
|
+
bytes = Number.POSITIVE_INFINITY;
|
|
79
|
+
}
|
|
80
|
+
if (bytes > MAX_DOCUMENT_SYNC_REQUEST_BYTES) {
|
|
28
81
|
context.addIssue({
|
|
29
82
|
code: "custom",
|
|
30
83
|
message: `create seed exceeds ${MAX_DOCUMENT_SYNC_REQUEST_BYTES} serialized bytes`,
|
|
@@ -32,4 +85,74 @@ export function refineSeedWithinSyncRequestLimit(seed, context, path) {
|
|
|
32
85
|
});
|
|
33
86
|
}
|
|
34
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Fields of a document sync that a create's seed never carries: the API takes
|
|
90
|
+
* them from the create, so a seed naming one (such as a `minLsn` precondition)
|
|
91
|
+
* is refused rather than silently dropped.
|
|
92
|
+
*/
|
|
93
|
+
const SEED_SYNC_ONLY_FIELDS = [
|
|
94
|
+
"authorizingContainerPathRefs",
|
|
95
|
+
"containerRekeys",
|
|
96
|
+
"contentKeyBundle",
|
|
97
|
+
"contentKeyEpoch",
|
|
98
|
+
"expectedLinkSetManifestHash",
|
|
99
|
+
"expectedTargetHash",
|
|
100
|
+
"historyMode",
|
|
101
|
+
"inlineRekeyCommitId",
|
|
102
|
+
"localVersionVector",
|
|
103
|
+
"minLsn",
|
|
104
|
+
"pullCursor",
|
|
105
|
+
"supportsPullPagination",
|
|
106
|
+
];
|
|
107
|
+
function isRecord(value) {
|
|
108
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Holds a create's seed to its update alone and the sync it stands for to the
|
|
112
|
+
* checks a standalone sync request gets: it must parse as a document sync
|
|
113
|
+
* (unique update ids, an authorizing path for the write, rotation fields)
|
|
114
|
+
* and, `withinSyncLimit`, serialize within the sync request limit. The
|
|
115
|
+
* refinement also runs over values whose fields already failed, so it builds
|
|
116
|
+
* that sync only from a well-formed, bounded seed and create.
|
|
117
|
+
*/
|
|
118
|
+
export function refineCreateSeedSync(create, seed, context, issue) {
|
|
119
|
+
if (!isRecord(seed))
|
|
120
|
+
return;
|
|
121
|
+
if (SEED_SYNC_ONLY_FIELDS.some((field) => Object.hasOwn(seed, field))) {
|
|
122
|
+
context.addIssue({
|
|
123
|
+
code: "custom",
|
|
124
|
+
message: "a create seed carries its update alone",
|
|
125
|
+
path: [issue.path],
|
|
126
|
+
});
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (!isRecord(create))
|
|
130
|
+
return;
|
|
131
|
+
const { contentKeyBundle, targetContainerPathRefs } = create;
|
|
132
|
+
const { outgoingUpdates } = seed;
|
|
133
|
+
// The field schemas report malformed or oversized values; build nothing
|
|
134
|
+
// from them.
|
|
135
|
+
if (!Array.isArray(outgoingUpdates) ||
|
|
136
|
+
outgoingUpdates.length !== 1 ||
|
|
137
|
+
!isRecord(contentKeyBundle) ||
|
|
138
|
+
(targetContainerPathRefs !== undefined &&
|
|
139
|
+
(!Array.isArray(targetContainerPathRefs) ||
|
|
140
|
+
targetContainerPathRefs.length > MAX_CONTAINER_PATH_LENGTH)))
|
|
141
|
+
return;
|
|
142
|
+
const parsedSeed = DocumentCreateSeedRequestSchema.safeParse(seed);
|
|
143
|
+
const parsedSource = DocumentCreateSeedSourceSchema.safeParse(create);
|
|
144
|
+
if (!parsedSeed.success || !parsedSource.success)
|
|
145
|
+
return;
|
|
146
|
+
const sync = documentCreateSeedSyncRequest(parsedSource.data, parsedSeed.data);
|
|
147
|
+
if (!DocumentSyncRequestSchema.safeParse(sync).success) {
|
|
148
|
+
context.addIssue({
|
|
149
|
+
code: "custom",
|
|
150
|
+
message: "create seed does not form a valid document sync with the create's content-key bundle and target path",
|
|
151
|
+
path: [issue.path],
|
|
152
|
+
});
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (issue.withinSyncLimit)
|
|
156
|
+
refineSeedWithinSyncRequestLimit(sync, context, issue.path);
|
|
157
|
+
}
|
|
35
158
|
//# sourceMappingURL=documentCreateSeed.js.map
|
|
@@ -1 +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"]}
|
|
1
|
+
{"version":3,"file":"documentCreateSeed.js","sourceRoot":"","sources":["documentCreateSeed.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EACL,kCAAkC,EAClC,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,2BAA2B,EAG3B,qCAAqC,EACrC,gCAAgC,EAEhC,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,gBAAgB,CAAC;IAC9D,6EAA6E;IAC7E,eAAe,EAAE,WAAW,CAC1B,gCAAgC,EAChC,kCAAkC,CACnC;CACF,CAAC,CAAC;AAcH,MAAM,8BAA8B,GAAG,gBAAgB,CAAC;IACtD,gBAAgB,EAAE,qCAAqC;IACvD,uBAAuB,EAAE,2BAA2B,CAAC,QAAQ,EAAE;CAChE,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAgC,EAChC,IAA+B;IAE/B,MAAM,CAAC,MAAM,CAAC,GAAG,IAA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ChE,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport { arraySchema, loosePlainObject } from \"../schema\";\nimport { MAX_CONTAINER_PATH_LENGTH } from \"../util/containerLimits\";\nimport {\n MAX_DOCUMENT_SYNC_OUTGOING_UPDATES,\n MAX_DOCUMENT_SYNC_REQUEST_BYTES,\n} from \"../util/documentSyncLimits\";\nimport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n DocumentSyncOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * A create's seed: the one update a document is born with, committed in its\n * create transaction. It carries the update alone; the server takes the rest\n * of the sync it stands for from the create itself (see\n * {@link documentCreateSeedSyncRequest}).\n */\nexport const DocumentCreateSeedRequestSchema = loosePlainObject({\n // A seed holds exactly one update; the create's seed refinement enforces it.\n outgoingUpdates: arraySchema(\n DocumentSyncOutgoingUpdateSchema,\n MAX_DOCUMENT_SYNC_OUTGOING_UPDATES,\n ),\n});\n\nexport type DocumentCreateSeedRequest = z.infer<\n typeof DocumentCreateSeedRequestSchema\n>;\n\n/** The parts of a document create its seed's sync is made of. */\nexport interface DocumentCreateSeedSource {\n readonly contentKeyBundle: DocumentContentKeyBundleRequest;\n readonly targetContainerPathRefs?:\n | readonly ContainerManifestRef[]\n | undefined;\n}\n\nconst DocumentCreateSeedSourceSchema = loosePlainObject({\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n targetContainerPathRefs: ContainerManifestPathSchema.optional(),\n});\n\n/**\n * The document sync a create's seed stands for: the seed's update under the\n * create's content-key epoch, expected link-set and target hashes, and target\n * path, with the update's end as the local version. The update's signed write\n * header names the same values, so the sync checks hold it to them exactly as\n * for a standalone first sync. It carries no content-key bundle: the create\n * stores that bundle in the same transaction, and the sync checks the stored\n * one against these hashes.\n */\nexport function documentCreateSeedSyncRequest(\n create: DocumentCreateSeedSource,\n seed: DocumentCreateSeedRequest,\n): DocumentSyncRequest {\n const [update] = seed.outgoingUpdates;\n return {\n ...(create.targetContainerPathRefs === undefined\n ? {}\n : {\n authorizingContainerPathRefs: [[...create.targetContainerPathRefs]],\n }),\n contentKeyEpoch: create.contentKeyBundle.contentKeyEpoch,\n expectedLinkSetManifestHash: create.contentKeyBundle.linkSetManifestHash,\n expectedTargetHash: create.contentKeyBundle.targetHash,\n localVersionVector: update?.partialEndVersionVector ?? null,\n outgoingUpdates: [...seed.outgoingUpdates],\n supportsPullPagination: true,\n };\n}\n\n/**\n * A seed is exactly one outgoing update. An attachment bind's document sync,\n * a full sync request, also holds no container rekeys.\n */\nexport function refineSingleUpdateSeed(\n seed:\n | Pick<DocumentSyncRequest, \"outgoingUpdates\" | \"containerRekeys\">\n | DocumentCreateSeedRequest\n | 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 const rekeys: unknown = Reflect.get(seed, \"containerRekeys\");\n if (\n seed.outgoingUpdates.length !== 1 ||\n (Array.isArray(rekeys) && rekeys.length !== 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 the sync it\n * stands for is held to the sync request limit the create route's larger\n * ingress ceiling would not apply.\n */\nexport function refineSeedWithinSyncRequestLimit(\n seed: DocumentSyncRequest | undefined,\n context: z.RefinementCtx,\n path: string,\n): void {\n if (seed === undefined) return;\n let bytes: number;\n try {\n bytes = TEXT_ENCODER.encode(JSON.stringify(seed)).byteLength;\n } catch {\n // Opaque fields (such as a write header) can nest too deeply to\n // serialize; such a seed is refused, never thrown on.\n bytes = Number.POSITIVE_INFINITY;\n }\n if (bytes > MAX_DOCUMENT_SYNC_REQUEST_BYTES) {\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\n/**\n * Fields of a document sync that a create's seed never carries: the API takes\n * them from the create, so a seed naming one (such as a `minLsn` precondition)\n * is refused rather than silently dropped.\n */\nconst SEED_SYNC_ONLY_FIELDS = [\n \"authorizingContainerPathRefs\",\n \"containerRekeys\",\n \"contentKeyBundle\",\n \"contentKeyEpoch\",\n \"expectedLinkSetManifestHash\",\n \"expectedTargetHash\",\n \"historyMode\",\n \"inlineRekeyCommitId\",\n \"localVersionVector\",\n \"minLsn\",\n \"pullCursor\",\n \"supportsPullPagination\",\n] as const;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Holds a create's seed to its update alone and the sync it stands for to the\n * checks a standalone sync request gets: it must parse as a document sync\n * (unique update ids, an authorizing path for the write, rotation fields)\n * and, `withinSyncLimit`, serialize within the sync request limit. The\n * refinement also runs over values whose fields already failed, so it builds\n * that sync only from a well-formed, bounded seed and create.\n */\nexport function refineCreateSeedSync(\n create: unknown,\n seed: unknown,\n context: z.RefinementCtx,\n issue: { readonly path: string; readonly withinSyncLimit: boolean },\n): void {\n if (!isRecord(seed)) return;\n if (SEED_SYNC_ONLY_FIELDS.some((field) => Object.hasOwn(seed, field))) {\n context.addIssue({\n code: \"custom\",\n message: \"a create seed carries its update alone\",\n path: [issue.path],\n });\n return;\n }\n if (!isRecord(create)) return;\n const { contentKeyBundle, targetContainerPathRefs } = create;\n const { outgoingUpdates } = seed;\n // The field schemas report malformed or oversized values; build nothing\n // from them.\n if (\n !Array.isArray(outgoingUpdates) ||\n outgoingUpdates.length !== 1 ||\n !isRecord(contentKeyBundle) ||\n (targetContainerPathRefs !== undefined &&\n (!Array.isArray(targetContainerPathRefs) ||\n targetContainerPathRefs.length > MAX_CONTAINER_PATH_LENGTH))\n )\n return;\n const parsedSeed = DocumentCreateSeedRequestSchema.safeParse(seed);\n const parsedSource = DocumentCreateSeedSourceSchema.safeParse(create);\n if (!parsedSeed.success || !parsedSource.success) return;\n const sync = documentCreateSeedSyncRequest(\n parsedSource.data,\n parsedSeed.data,\n );\n if (!DocumentSyncRequestSchema.safeParse(sync).success) {\n context.addIssue({\n code: \"custom\",\n message:\n \"create seed does not form a valid document sync with the create's content-key bundle and target path\",\n path: [issue.path],\n });\n return;\n }\n if (issue.withinSyncLimit)\n refineSeedWithinSyncRequestLimit(sync, context, issue.path);\n}\n"]}
|
|
@@ -129,6 +129,47 @@ export declare const DocumentOutgoingUpdateSchema: z.ZodType<{
|
|
|
129
129
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
130
130
|
sourceVersionVector?: unknown;
|
|
131
131
|
}>>;
|
|
132
|
+
export declare const DocumentSyncOutgoingUpdateSchema: z.ZodType<{
|
|
133
|
+
encryptedData: string;
|
|
134
|
+
id: string;
|
|
135
|
+
partialEndVersionVector: string;
|
|
136
|
+
partialStartVersionVector: string;
|
|
137
|
+
plaintextHash: string;
|
|
138
|
+
writeHeader: Record<string, unknown>;
|
|
139
|
+
checkpointKind?: "rotate_baseline" | undefined;
|
|
140
|
+
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
141
|
+
sourceVersionVector?: string | undefined;
|
|
142
|
+
}, {
|
|
143
|
+
encryptedData: unknown;
|
|
144
|
+
id: string;
|
|
145
|
+
partialEndVersionVector: unknown;
|
|
146
|
+
partialStartVersionVector: unknown;
|
|
147
|
+
plaintextHash: string;
|
|
148
|
+
writeHeader: Record<string, unknown>;
|
|
149
|
+
checkpointKind?: "rotate_baseline" | undefined;
|
|
150
|
+
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
151
|
+
sourceVersionVector?: unknown;
|
|
152
|
+
}, z.core.$ZodTypeInternals<{
|
|
153
|
+
encryptedData: string;
|
|
154
|
+
id: string;
|
|
155
|
+
partialEndVersionVector: string;
|
|
156
|
+
partialStartVersionVector: string;
|
|
157
|
+
plaintextHash: string;
|
|
158
|
+
writeHeader: Record<string, unknown>;
|
|
159
|
+
checkpointKind?: "rotate_baseline" | undefined;
|
|
160
|
+
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
161
|
+
sourceVersionVector?: string | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
encryptedData: unknown;
|
|
164
|
+
id: string;
|
|
165
|
+
partialEndVersionVector: unknown;
|
|
166
|
+
partialStartVersionVector: unknown;
|
|
167
|
+
plaintextHash: string;
|
|
168
|
+
writeHeader: Record<string, unknown>;
|
|
169
|
+
checkpointKind?: "rotate_baseline" | undefined;
|
|
170
|
+
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
171
|
+
sourceVersionVector?: unknown;
|
|
172
|
+
}>>;
|
|
132
173
|
export type DocumentOutgoingUpdate = z.infer<typeof DocumentOutgoingUpdateSchema>;
|
|
133
174
|
export declare const DocumentSyncRequestSchema: z.ZodType<{
|
|
134
175
|
contentKeyEpoch: number;
|
|
@@ -61,7 +61,7 @@ function createDocumentOutgoingUpdateSchema(encryptedDataSchema, versionVectorSc
|
|
|
61
61
|
// shared update contract unbounded and apply the sync-specific ceiling only
|
|
62
62
|
// where an update is embedded in DocumentSyncRequest.
|
|
63
63
|
export const DocumentOutgoingUpdateSchema = createDocumentOutgoingUpdateSchema(nonEmptyStringSchema, nonEmptyStringSchema);
|
|
64
|
-
const DocumentSyncOutgoingUpdateSchema = createDocumentOutgoingUpdateSchema(boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_REQUEST_BYTES), boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_REQUEST_BYTES));
|
|
64
|
+
export const DocumentSyncOutgoingUpdateSchema = createDocumentOutgoingUpdateSchema(boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_REQUEST_BYTES), boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_REQUEST_BYTES));
|
|
65
65
|
// Document sync published container keyrings as opaque records before the
|
|
66
66
|
// canonical container-mutation schema described their fields. Keep that one
|
|
67
67
|
// existing OpenAPI view stable while runtime validation delegates to the shared
|
|
@@ -1 +1 @@
|
|
|
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,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EACL,qCAAqC,EACrC,qCAAqC,EACrC,kCAAkC,EAClC,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAEL,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAE3B,8BAA8B,EAC9B,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EA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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 ContainerKekParentRefSchema,\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 parentContainerPathRefs: OptionalContainerManifestPathSchema.optional(),\n parentKekRef: ContainerKekParentRefSchema.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\nfunction exceedsCrossFieldScanBounds(\n outgoingUpdateCount: number,\n authorizingContainerPathRefs: unknown,\n): boolean {\n if (outgoingUpdateCount > MAX_DOCUMENT_SYNC_OUTGOING_UPDATES) return true;\n return (\n Array.isArray(authorizingContainerPathRefs) &&\n authorizingContainerPathRefs.length > MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS\n );\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 (\n exceedsCrossFieldScanBounds(\n request.outgoingUpdates.length,\n request.authorizingContainerPathRefs,\n )\n ) {\n return;\n }\n\n const hasOutgoingUpdates = request.outgoingUpdates.length > 0;\n const hasContainerRekeys = (request.containerRekeys?.length ?? 0) > 0;\n const carriesWrite =\n hasOutgoingUpdates ||\n hasContainerRekeys ||\n request.contentKeyBundle !== undefined ||\n request.authorizingContainerPathRefs !== undefined;\n if (hasContainerRekeys !== (request.inlineRekeyCommitId !== undefined)) {\n context.addIssue({\n code: \"custom\",\n message: \"inline rekey commit id must accompany container rekeys\",\n path: [\"inlineRekeyCommitId\"],\n });\n }\n if (request.pullCursor !== undefined && carriesWrite) {\n context.addIssue({\n code: \"custom\",\n message: \"continued pulls must be read-only\",\n path: [\"pullCursor\"],\n });\n }\n if (request.historyMode === \"raw\" && carriesWrite) {\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,\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,oBA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ACL,CAAC;IACD,MAAM,WAAW,GAAG,+BAA+B,CAAC;QAClD,mCAAmC,EACjC,OAAO,CAAC,4BAA4B,KAAK,SAAS;QACpD,kBAAkB;QAClB,kBAAkB;KACnB,CAAC,CAAC;IAEH,IAAI,WAAW,KAAK,sCAAsC,EAAE,CAAC;QAC3D,OAAO,CAAC,QAAQ,CAAC;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EACL,+DAA+D;YACjE,IAAI,EAAE,CAAC,8BAA8B,CAAC;SACvC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,WAAW,KAAK,8BAA8B,EAAE,CAAC;QACnD,OAAO,CAAC,QAAQ,CAAC;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,6CAA6C;YACtD,IAAI,EAAE,CAAC,iBAAiB,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,IACE,IAAI,GAAG,CACL,OAAO,CAAC,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 ContainerKekParentRefSchema,\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\nexport const DocumentSyncOutgoingUpdateSchema =\n 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 parentContainerPathRefs: OptionalContainerManifestPathSchema.optional(),\n parentKekRef: ContainerKekParentRefSchema.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\nfunction exceedsCrossFieldScanBounds(\n outgoingUpdateCount: number,\n authorizingContainerPathRefs: unknown,\n): boolean {\n if (outgoingUpdateCount > MAX_DOCUMENT_SYNC_OUTGOING_UPDATES) return true;\n return (\n Array.isArray(authorizingContainerPathRefs) &&\n authorizingContainerPathRefs.length > MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS\n );\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 (\n exceedsCrossFieldScanBounds(\n request.outgoingUpdates.length,\n request.authorizingContainerPathRefs,\n )\n ) {\n return;\n }\n\n const hasOutgoingUpdates = request.outgoingUpdates.length > 0;\n const hasContainerRekeys = (request.containerRekeys?.length ?? 0) > 0;\n const carriesWrite =\n hasOutgoingUpdates ||\n hasContainerRekeys ||\n request.contentKeyBundle !== undefined ||\n request.authorizingContainerPathRefs !== undefined;\n if (hasContainerRekeys !== (request.inlineRekeyCommitId !== undefined)) {\n context.addIssue({\n code: \"custom\",\n message: \"inline rekey commit id must accompany container rekeys\",\n path: [\"inlineRekeyCommitId\"],\n });\n }\n if (request.pullCursor !== undefined && carriesWrite) {\n context.addIssue({\n code: \"custom\",\n message: \"continued pulls must be read-only\",\n path: [\"pullCursor\"],\n });\n }\n if (request.historyMode === \"raw\" && carriesWrite) {\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,\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"]}
|
|
@@ -7,6 +7,7 @@ export type { ContainerKekParentRef } from "./containerManifestRef.js";
|
|
|
7
7
|
export { type ContainerCreateWithMetadataDocumentRequest, ContainerCreateWithMetadataDocumentRequestSchema, isContainerCreateWithMetadataDocumentRequest, } from "./containerMetadata.js";
|
|
8
8
|
export { isListContainerParentLanesRequest, type ListContainerParentLanesRequest, ListContainerParentLanesRequestSchema, } from "./containerParentLanes.js";
|
|
9
9
|
export { type ContainerManifestRef, ContainerManifestRefArrayArraySchema, ContainerManifestRefSchema, type DocumentContentKeyBundleRequest, DocumentContentKeyBundleRequestSchema, type DocumentContentKeyTargetEnvelope, DocumentContentKeyTargetEnvelopeSchema, type DocumentCreateRequest, DocumentCreateRequestSchema, type DocumentLinkSetMutationRequest, DocumentLinkSetMutationRequestSchema, type DocumentOutgoingUpdate, DocumentOutgoingUpdateSchema, type DocumentPurgeRequest, DocumentPurgeRequestSchema, type DocumentSyncRequest, DocumentSyncRequestSchema, isContainerManifestRefArrayArray, isDocumentContentKeyBundleRequest, isDocumentCreateRequest, isDocumentLinkSetMutationRequest, isDocumentPurgeRequest, isDocumentSyncRequest, } from "./document.js";
|
|
10
|
+
export { type DocumentCreateSeedRequest, DocumentCreateSeedRequestSchema, documentCreateSeedSyncRequest, } from "./documentCreateSeed.js";
|
|
10
11
|
export { type CreateOrganizationGroupRequest, CreateOrganizationGroupRequestSchema, type CreateOrganizationGroupWithPolicyRequest, CreateOrganizationGroupWithPolicyRequestSchema, type DeleteOrganizationGroupRequest, DeleteOrganizationGroupRequestSchema, isCreateOrganizationGroupRequest, isCreateOrganizationGroupWithPolicyRequest, isDeleteOrganizationGroupRequest, isUpdateOrganizationMembershipRequest, isUpdateOrganizationProfileRequest, isUpdateOrganizationRosterEntryRequest, type OrganizationReadModelHeldCursorQuery, OrganizationReadModelHeldCursorQuerySchema, type OrganizationReadModelQuery, OrganizationReadModelQuerySchema, type UpdateOrganizationMembershipRequest, UpdateOrganizationMembershipRequestSchema, type UpdateOrganizationProfileRequest, UpdateOrganizationProfileRequestSchema, type UpdateOrganizationRosterEntryRequest, UpdateOrganizationRosterEntryRequestSchema, } from "./organization.js";
|
|
11
12
|
export { type CreateOrganizationRequest, CreateOrganizationRequestSchema, isCreateOrganizationRequest, isOrganizationProvisioningRequest, isProvisionedDocumentRequest, isProvisionedSystemContainerRequest, type OrganizationProvisioningRequest, OrganizationProvisioningRequestSchema, type ProvisionedDocumentRequest, ProvisionedDocumentRequestSchema, type ProvisionedSystemContainerRequest, ProvisionedSystemContainerRequestSchema, } from "./organizationProvisioning.js";
|
|
12
13
|
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";
|
|
@@ -5,6 +5,7 @@ export { DEFAULT_CONTAINER_DOCUMENT_LANE_PAGE_LIMIT, isListContainerDocumentLane
|
|
|
5
5
|
export { ContainerCreateWithMetadataDocumentRequestSchema, isContainerCreateWithMetadataDocumentRequest, } from "./containerMetadata.js";
|
|
6
6
|
export { isListContainerParentLanesRequest, ListContainerParentLanesRequestSchema, } from "./containerParentLanes.js";
|
|
7
7
|
export { ContainerManifestRefArrayArraySchema, ContainerManifestRefSchema, DocumentContentKeyBundleRequestSchema, DocumentContentKeyTargetEnvelopeSchema, DocumentCreateRequestSchema, DocumentLinkSetMutationRequestSchema, DocumentOutgoingUpdateSchema, DocumentPurgeRequestSchema, DocumentSyncRequestSchema, isContainerManifestRefArrayArray, isDocumentContentKeyBundleRequest, isDocumentCreateRequest, isDocumentLinkSetMutationRequest, isDocumentPurgeRequest, isDocumentSyncRequest, } from "./document.js";
|
|
8
|
+
export { DocumentCreateSeedRequestSchema, documentCreateSeedSyncRequest, } from "./documentCreateSeed.js";
|
|
8
9
|
export { CreateOrganizationGroupRequestSchema, CreateOrganizationGroupWithPolicyRequestSchema, DeleteOrganizationGroupRequestSchema, isCreateOrganizationGroupRequest, isCreateOrganizationGroupWithPolicyRequest, isDeleteOrganizationGroupRequest, isUpdateOrganizationMembershipRequest, isUpdateOrganizationProfileRequest, isUpdateOrganizationRosterEntryRequest, OrganizationReadModelHeldCursorQuerySchema, OrganizationReadModelQuerySchema, UpdateOrganizationMembershipRequestSchema, UpdateOrganizationProfileRequestSchema, UpdateOrganizationRosterEntryRequestSchema, } from "./organization.js";
|
|
9
10
|
export { CreateOrganizationRequestSchema, isCreateOrganizationRequest, isOrganizationProvisioningRequest, isProvisionedDocumentRequest, isProvisionedSystemContainerRequest, OrganizationProvisioningRequestSchema, ProvisionedDocumentRequestSchema, ProvisionedSystemContainerRequestSchema, } from "./organizationProvisioning.js";
|
|
10
11
|
export { CommitOrganizationGroupPolicyRequestSchema, isCommitOrganizationGroupPolicyRequest, isOrganizationPrincipalPolicyRequest, isPutPrincipalPolicyRequest, OrganizationPrincipalPolicyRequestSchema, PrincipalContainerGrantRequestSchema, PutPrincipalPolicyRequestSchema, } from "./principal.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,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A4B,EAC5B,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,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,uBAAuB,EACvB,8BAA8B,EAC9B,yBAAyB,EACzB,wBAAwB,EAExB,2BAA2B,EAE3B,kCAAkC,EAElC,6BAA6B,EAE7B,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 type { ContainerKekParentRef } from \"./containerManifestRef\";\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 isUpdateOrganizationMembershipRequest,\n isUpdateOrganizationProfileRequest,\n isUpdateOrganizationRosterEntryRequest,\n type OrganizationReadModelHeldCursorQuery,\n OrganizationReadModelHeldCursorQuerySchema,\n type OrganizationReadModelQuery,\n OrganizationReadModelQuerySchema,\n type UpdateOrganizationMembershipRequest,\n UpdateOrganizationMembershipRequestSchema,\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 isStripeCheckoutRequest,\n isStripeCheckoutSessionRequest,\n isStripePlanChangeRequest,\n isStripeReturnUrlRequest,\n type StripeCheckoutRequest,\n StripeCheckoutRequestSchema,\n type StripeCheckoutSessionRequest,\n StripeCheckoutSessionRequestSchema,\n type StripePlanChangeRequest,\n StripePlanChangeRequestSchema,\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;AAElC,OAAO,EAEL,gDAAgD,EAChD,4CAA4C,GAC7C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iCAAiC,EAEjC,qCAAqC,GACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,oCAAoC,EACpC,0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,EAElC,6BAA6B,EAE7B,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 type { ContainerKekParentRef } from \"./containerManifestRef\";\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 DocumentCreateSeedRequest,\n DocumentCreateSeedRequestSchema,\n documentCreateSeedSyncRequest,\n} from \"./documentCreateSeed\";\nexport {\n type CreateOrganizationGroupRequest,\n CreateOrganizationGroupRequestSchema,\n type CreateOrganizationGroupWithPolicyRequest,\n CreateOrganizationGroupWithPolicyRequestSchema,\n type DeleteOrganizationGroupRequest,\n DeleteOrganizationGroupRequestSchema,\n isCreateOrganizationGroupRequest,\n isCreateOrganizationGroupWithPolicyRequest,\n isDeleteOrganizationGroupRequest,\n isUpdateOrganizationMembershipRequest,\n isUpdateOrganizationProfileRequest,\n isUpdateOrganizationRosterEntryRequest,\n type OrganizationReadModelHeldCursorQuery,\n OrganizationReadModelHeldCursorQuerySchema,\n type OrganizationReadModelQuery,\n OrganizationReadModelQuerySchema,\n type UpdateOrganizationMembershipRequest,\n UpdateOrganizationMembershipRequestSchema,\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 isStripeCheckoutRequest,\n isStripeCheckoutSessionRequest,\n isStripePlanChangeRequest,\n isStripeReturnUrlRequest,\n type StripeCheckoutRequest,\n StripeCheckoutRequestSchema,\n type StripeCheckoutSessionRequest,\n StripeCheckoutSessionRequestSchema,\n type StripePlanChangeRequest,\n StripePlanChangeRequestSchema,\n type StripeReturnUrlRequest,\n StripeReturnUrlRequestSchema,\n} from \"./stripeCheckout\";\nexport {\n isStripeWebhookRequest,\n type StripeWebhookRequest,\n StripeWebhookRequestSchema,\n} from \"./stripeWebhook\";\n"]}
|
|
@@ -3,9 +3,7 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
3
3
|
groupId: z.ZodCustom<string, string>;
|
|
4
4
|
initialGroupPolicy: z.ZodType<{
|
|
5
5
|
encryptedPayload: {
|
|
6
|
-
cipherSuite: "aes-256-gcm";
|
|
7
6
|
ciphertext: string;
|
|
8
|
-
ciphertextHash: string;
|
|
9
7
|
};
|
|
10
8
|
grants: {
|
|
11
9
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -94,9 +92,7 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
94
92
|
}[] | undefined;
|
|
95
93
|
}, {
|
|
96
94
|
encryptedPayload: {
|
|
97
|
-
cipherSuite: "aes-256-gcm";
|
|
98
95
|
ciphertext: string;
|
|
99
|
-
ciphertextHash: string;
|
|
100
96
|
};
|
|
101
97
|
grants: {
|
|
102
98
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -185,9 +181,7 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
185
181
|
}[] | undefined;
|
|
186
182
|
}, z.core.$ZodTypeInternals<{
|
|
187
183
|
encryptedPayload: {
|
|
188
|
-
cipherSuite: "aes-256-gcm";
|
|
189
184
|
ciphertext: string;
|
|
190
|
-
ciphertextHash: string;
|
|
191
185
|
};
|
|
192
186
|
grants: {
|
|
193
187
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -276,9 +270,7 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
276
270
|
}[] | undefined;
|
|
277
271
|
}, {
|
|
278
272
|
encryptedPayload: {
|
|
279
|
-
cipherSuite: "aes-256-gcm";
|
|
280
273
|
ciphertext: string;
|
|
281
|
-
ciphertextHash: string;
|
|
282
274
|
};
|
|
283
275
|
grants: {
|
|
284
276
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -370,9 +362,7 @@ export declare const CreateOrganizationGroupRequestSchema: z.ZodObject<{
|
|
|
370
362
|
export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject<{
|
|
371
363
|
organizationPolicy: z.ZodType<{
|
|
372
364
|
encryptedPayload: {
|
|
373
|
-
cipherSuite: "aes-256-gcm";
|
|
374
365
|
ciphertext: string;
|
|
375
|
-
ciphertextHash: string;
|
|
376
366
|
};
|
|
377
367
|
grants: {
|
|
378
368
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -461,9 +451,7 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
461
451
|
}[] | undefined;
|
|
462
452
|
}, {
|
|
463
453
|
encryptedPayload: {
|
|
464
|
-
cipherSuite: "aes-256-gcm";
|
|
465
454
|
ciphertext: string;
|
|
466
|
-
ciphertextHash: string;
|
|
467
455
|
};
|
|
468
456
|
grants: {
|
|
469
457
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -552,9 +540,7 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
552
540
|
}[] | undefined;
|
|
553
541
|
}, z.core.$ZodTypeInternals<{
|
|
554
542
|
encryptedPayload: {
|
|
555
|
-
cipherSuite: "aes-256-gcm";
|
|
556
543
|
ciphertext: string;
|
|
557
|
-
ciphertextHash: string;
|
|
558
544
|
};
|
|
559
545
|
grants: {
|
|
560
546
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -643,9 +629,7 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
643
629
|
}[] | undefined;
|
|
644
630
|
}, {
|
|
645
631
|
encryptedPayload: {
|
|
646
|
-
cipherSuite: "aes-256-gcm";
|
|
647
632
|
ciphertext: string;
|
|
648
|
-
ciphertextHash: string;
|
|
649
633
|
};
|
|
650
634
|
grants: {
|
|
651
635
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -736,9 +720,7 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
736
720
|
groupId: z.ZodCustom<string, string>;
|
|
737
721
|
initialGroupPolicy: z.ZodType<{
|
|
738
722
|
encryptedPayload: {
|
|
739
|
-
cipherSuite: "aes-256-gcm";
|
|
740
723
|
ciphertext: string;
|
|
741
|
-
ciphertextHash: string;
|
|
742
724
|
};
|
|
743
725
|
grants: {
|
|
744
726
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -827,9 +809,7 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
827
809
|
}[] | undefined;
|
|
828
810
|
}, {
|
|
829
811
|
encryptedPayload: {
|
|
830
|
-
cipherSuite: "aes-256-gcm";
|
|
831
812
|
ciphertext: string;
|
|
832
|
-
ciphertextHash: string;
|
|
833
813
|
};
|
|
834
814
|
grants: {
|
|
835
815
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -918,9 +898,7 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
918
898
|
}[] | undefined;
|
|
919
899
|
}, z.core.$ZodTypeInternals<{
|
|
920
900
|
encryptedPayload: {
|
|
921
|
-
cipherSuite: "aes-256-gcm";
|
|
922
901
|
ciphertext: string;
|
|
923
|
-
ciphertextHash: string;
|
|
924
902
|
};
|
|
925
903
|
grants: {
|
|
926
904
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -1009,9 +987,7 @@ export declare const CreateOrganizationGroupWithPolicyRequestSchema: z.ZodObject
|
|
|
1009
987
|
}[] | undefined;
|
|
1010
988
|
}, {
|
|
1011
989
|
encryptedPayload: {
|
|
1012
|
-
cipherSuite: "aes-256-gcm";
|
|
1013
990
|
ciphertext: string;
|
|
1014
|
-
ciphertextHash: string;
|
|
1015
991
|
};
|
|
1016
992
|
grants: {
|
|
1017
993
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -1105,9 +1081,7 @@ export type CreateOrganizationGroupWithPolicyRequest = z.infer<typeof CreateOrga
|
|
|
1105
1081
|
export declare const DeleteOrganizationGroupRequestSchema: z.ZodType<{
|
|
1106
1082
|
organizationPolicy: {
|
|
1107
1083
|
encryptedPayload: {
|
|
1108
|
-
cipherSuite: "aes-256-gcm";
|
|
1109
1084
|
ciphertext: string;
|
|
1110
|
-
ciphertextHash: string;
|
|
1111
1085
|
};
|
|
1112
1086
|
grants: {
|
|
1113
1087
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -1198,9 +1172,7 @@ export declare const DeleteOrganizationGroupRequestSchema: z.ZodType<{
|
|
|
1198
1172
|
}, {
|
|
1199
1173
|
organizationPolicy: {
|
|
1200
1174
|
encryptedPayload: {
|
|
1201
|
-
cipherSuite: "aes-256-gcm";
|
|
1202
1175
|
ciphertext: string;
|
|
1203
|
-
ciphertextHash: string;
|
|
1204
1176
|
};
|
|
1205
1177
|
grants: {
|
|
1206
1178
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -1291,9 +1263,7 @@ export declare const DeleteOrganizationGroupRequestSchema: z.ZodType<{
|
|
|
1291
1263
|
}, z.core.$ZodTypeInternals<{
|
|
1292
1264
|
organizationPolicy: {
|
|
1293
1265
|
encryptedPayload: {
|
|
1294
|
-
cipherSuite: "aes-256-gcm";
|
|
1295
1266
|
ciphertext: string;
|
|
1296
|
-
ciphertextHash: string;
|
|
1297
1267
|
};
|
|
1298
1268
|
grants: {
|
|
1299
1269
|
accessLevel: "write" | "admin" | "read";
|
|
@@ -1384,9 +1354,7 @@ export declare const DeleteOrganizationGroupRequestSchema: z.ZodType<{
|
|
|
1384
1354
|
}, {
|
|
1385
1355
|
organizationPolicy: {
|
|
1386
1356
|
encryptedPayload: {
|
|
1387
|
-
cipherSuite: "aes-256-gcm";
|
|
1388
1357
|
ciphertext: string;
|
|
1389
|
-
ciphertextHash: string;
|
|
1390
1358
|
};
|
|
1391
1359
|
grants: {
|
|
1392
1360
|
accessLevel: "write" | "admin" | "read";
|