@tearleads/client-sdk 0.1.250 → 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.
Files changed (50) hide show
  1. package/data/documents/shared/events.js +2 -1
  2. package/data/documents/shared/events.js.map +1 -1
  3. package/internal/validators/documentCreateSeedRefinements.js +2 -2
  4. package/internal/validators/documentCreateSeedRefinements.js.map +1 -1
  5. package/internal/validators/operation/auth.d.ts +50 -1703
  6. package/internal/validators/operation/auth.js +2 -2
  7. package/internal/validators/operation/auth.js.map +1 -1
  8. package/internal/validators/operation/containerMutations.d.ts +1 -294
  9. package/internal/validators/operation/containerMutations.js +2 -2
  10. package/internal/validators/operation/containerMutations.js.map +1 -1
  11. package/internal/validators/operation/documentMutations.d.ts +1 -294
  12. package/internal/validators/operation/documentMutations.js +2 -2
  13. package/internal/validators/operation/documentMutations.js.map +1 -1
  14. package/internal/validators/operation/organizations.d.ts +50 -1703
  15. package/internal/validators/operation/organizations.js +2 -2
  16. package/internal/validators/operation/organizations.js.map +1 -1
  17. package/internal/validators/organizationProvisioningRefinements.js +2 -2
  18. package/internal/validators/organizationProvisioningRefinements.js.map +1 -1
  19. package/internal/validators/request/containerMetadata.d.ts +0 -276
  20. package/internal/validators/request/containerMetadata.js +5 -4
  21. package/internal/validators/request/containerMetadata.js.map +1 -1
  22. package/internal/validators/request/document.d.ts +0 -277
  23. package/internal/validators/request/document.js +8 -4
  24. package/internal/validators/request/document.js.map +1 -1
  25. package/internal/validators/request/documentCreateSeed.d.ts +99 -0
  26. package/internal/validators/request/documentCreateSeed.js +132 -9
  27. package/internal/validators/request/documentCreateSeed.js.map +1 -1
  28. package/internal/validators/request/documentSyncSchema.d.ts +41 -0
  29. package/internal/validators/request/documentSyncSchema.js +1 -1
  30. package/internal/validators/request/documentSyncSchema.js.map +1 -1
  31. package/internal/validators/request/index.d.ts +1 -0
  32. package/internal/validators/request/index.js +1 -0
  33. package/internal/validators/request/index.js.map +1 -1
  34. package/internal/validators/request/organizationProvisioning.d.ts +263 -5567
  35. package/internal/validators/request/organizationProvisioning.js +10 -4
  36. package/internal/validators/request/organizationProvisioning.js.map +1 -1
  37. package/internal/validators/request/registration.d.ts +71 -1703
  38. package/package.json +1 -1
  39. package/workflows/container-contents/container-state/create/createWithMetadata.js +6 -3
  40. package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -1
  41. package/workflows/documents/create/index.js +4 -4
  42. package/workflows/documents/create/index.js.map +1 -1
  43. package/workflows/documents/sync/initialSync.d.ts +26 -11
  44. package/workflows/documents/sync/initialSync.js +32 -12
  45. package/workflows/documents/sync/initialSync.js.map +1 -1
  46. package/workflows/registration/provisionedProfileDocument.js +2 -2
  47. package/workflows/registration/provisionedProfileDocument.js.map +1 -1
  48. package/workflows/registration/provisioningBootstrapBuilders.d.ts +0 -68
  49. package/workflows/registration/provisioningBootstrapBuilders.js +3 -3
  50. package/workflows/registration/provisioningBootstrapBuilders.js.map +1 -1
@@ -28,12 +28,7 @@ export declare const createDocumentOperation: Omit<{
28
28
  };
29
29
  event: Record<string, unknown>;
30
30
  expectedManifestHash: string;
31
- manifest: Record<string, unknown>;
32
31
  initialSync?: {
33
- contentKeyEpoch: number;
34
- expectedLinkSetManifestHash: string;
35
- expectedTargetHash: string;
36
- localVersionVector: string | null;
37
32
  outgoingUpdates: {
38
33
  encryptedData: string;
39
34
  id: string;
@@ -45,69 +40,6 @@ export declare const createDocumentOperation: Omit<{
45
40
  checkpointPayloadKind?: "full_history_snapshot" | undefined;
46
41
  sourceVersionVector?: string | undefined;
47
42
  }[];
48
- supportsPullPagination: true;
49
- authorizingContainerPathRefs?: {
50
- containerId: string;
51
- manifestHash: string;
52
- }[][] | undefined;
53
- containerRekeys?: {
54
- body: unknown;
55
- event: Record<string, unknown>;
56
- expectedManifestHash: string;
57
- keyEpoch: Record<string, unknown>;
58
- keyring: Record<string, unknown> | null;
59
- predecessorBridge: Record<string, unknown> | null;
60
- principalPolicyRefs: {
61
- principalType: "group" | "organization";
62
- principalId: string;
63
- version: number;
64
- stateHash: string;
65
- }[];
66
- wraps: Record<string, unknown>[];
67
- containerManifestHistoryRefs?: {
68
- containerId: string;
69
- manifestHash: string;
70
- }[] | undefined;
71
- destinationParentContainerPathRefs?: {
72
- containerId: string;
73
- manifestHash: string;
74
- }[] | undefined;
75
- parentContainerPathRefs?: {
76
- containerId: string;
77
- manifestHash: string;
78
- }[] | undefined;
79
- parentKekRef?: {
80
- containerId: string;
81
- containerKeyEpochId: string;
82
- keyEpochHash: string;
83
- } | null | undefined;
84
- previousContainerPathRefs?: {
85
- containerId: string;
86
- manifestHash: string;
87
- }[] | undefined;
88
- previousManifestRef?: {
89
- containerId: string;
90
- manifestHash: string;
91
- } | null | undefined;
92
- userRecipientKeys?: Record<string, unknown>[] | undefined;
93
- }[] | undefined;
94
- contentKeyBundle?: {
95
- contentKeyEpoch: number;
96
- linkSetManifestHash: string;
97
- targetHash: string;
98
- targets: {
99
- containerId: string;
100
- containerKeyEpoch: number;
101
- containerKeyEpochId: string;
102
- containerManifestHash: string;
103
- wrappedKey: string;
104
- wrappingMetadata: Record<string, unknown>;
105
- }[];
106
- } | undefined;
107
- historyMode?: "raw" | undefined;
108
- inlineRekeyCommitId?: string | undefined;
109
- minLsn?: string | undefined;
110
- pullCursor?: string | undefined;
111
43
  } | undefined;
112
44
  authorizingContainerPathRefs?: {
113
45
  containerId: string;
@@ -175,12 +107,7 @@ export declare const createDocumentOperation: Omit<{
175
107
  };
176
108
  event: Record<string, unknown>;
177
109
  expectedManifestHash: string;
178
- manifest: Record<string, unknown>;
179
110
  initialSync?: {
180
- contentKeyEpoch: number;
181
- expectedLinkSetManifestHash: string;
182
- expectedTargetHash: string;
183
- localVersionVector: string | null;
184
111
  outgoingUpdates: {
185
112
  encryptedData: string;
186
113
  id: string;
@@ -192,69 +119,6 @@ export declare const createDocumentOperation: Omit<{
192
119
  checkpointPayloadKind?: "full_history_snapshot" | undefined;
193
120
  sourceVersionVector?: string | undefined;
194
121
  }[];
195
- supportsPullPagination: true;
196
- authorizingContainerPathRefs?: {
197
- containerId: string;
198
- manifestHash: string;
199
- }[][] | undefined;
200
- containerRekeys?: {
201
- body: unknown;
202
- event: Record<string, unknown>;
203
- expectedManifestHash: string;
204
- keyEpoch: Record<string, unknown>;
205
- keyring: Record<string, unknown> | null;
206
- predecessorBridge: Record<string, unknown> | null;
207
- principalPolicyRefs: {
208
- principalType: "group" | "organization";
209
- principalId: string;
210
- version: number;
211
- stateHash: string;
212
- }[];
213
- wraps: Record<string, unknown>[];
214
- containerManifestHistoryRefs?: {
215
- containerId: string;
216
- manifestHash: string;
217
- }[] | undefined;
218
- destinationParentContainerPathRefs?: {
219
- containerId: string;
220
- manifestHash: string;
221
- }[] | undefined;
222
- parentContainerPathRefs?: {
223
- containerId: string;
224
- manifestHash: string;
225
- }[] | undefined;
226
- parentKekRef?: {
227
- containerId: string;
228
- containerKeyEpochId: string;
229
- keyEpochHash: string;
230
- } | null | undefined;
231
- previousContainerPathRefs?: {
232
- containerId: string;
233
- manifestHash: string;
234
- }[] | undefined;
235
- previousManifestRef?: {
236
- containerId: string;
237
- manifestHash: string;
238
- } | null | undefined;
239
- userRecipientKeys?: Record<string, unknown>[] | undefined;
240
- }[] | undefined;
241
- contentKeyBundle?: {
242
- contentKeyEpoch: number;
243
- linkSetManifestHash: string;
244
- targetHash: string;
245
- targets: {
246
- containerId: string;
247
- containerKeyEpoch: number;
248
- containerKeyEpochId: string;
249
- containerManifestHash: string;
250
- wrappedKey: string;
251
- wrappingMetadata: Record<string, unknown>;
252
- }[];
253
- } | undefined;
254
- historyMode?: "raw" | undefined;
255
- inlineRekeyCommitId?: string | undefined;
256
- minLsn?: string | undefined;
257
- pullCursor?: string | undefined;
258
122
  } | undefined;
259
123
  authorizingContainerPathRefs?: {
260
124
  containerId: string;
@@ -322,12 +186,7 @@ export declare const createDocumentOperation: Omit<{
322
186
  };
323
187
  event: Record<string, unknown>;
324
188
  expectedManifestHash: string;
325
- manifest: Record<string, unknown>;
326
189
  initialSync?: {
327
- contentKeyEpoch: number;
328
- expectedLinkSetManifestHash: string;
329
- expectedTargetHash: string;
330
- localVersionVector: string | null;
331
190
  outgoingUpdates: {
332
191
  encryptedData: string;
333
192
  id: string;
@@ -339,69 +198,6 @@ export declare const createDocumentOperation: Omit<{
339
198
  checkpointPayloadKind?: "full_history_snapshot" | undefined;
340
199
  sourceVersionVector?: string | undefined;
341
200
  }[];
342
- supportsPullPagination: true;
343
- authorizingContainerPathRefs?: {
344
- containerId: string;
345
- manifestHash: string;
346
- }[][] | undefined;
347
- containerRekeys?: {
348
- body: unknown;
349
- event: Record<string, unknown>;
350
- expectedManifestHash: string;
351
- keyEpoch: Record<string, unknown>;
352
- keyring: Record<string, unknown> | null;
353
- predecessorBridge: Record<string, unknown> | null;
354
- principalPolicyRefs: {
355
- principalType: "group" | "organization";
356
- principalId: string;
357
- version: number;
358
- stateHash: string;
359
- }[];
360
- wraps: Record<string, unknown>[];
361
- containerManifestHistoryRefs?: {
362
- containerId: string;
363
- manifestHash: string;
364
- }[] | undefined;
365
- destinationParentContainerPathRefs?: {
366
- containerId: string;
367
- manifestHash: string;
368
- }[] | undefined;
369
- parentContainerPathRefs?: {
370
- containerId: string;
371
- manifestHash: string;
372
- }[] | undefined;
373
- parentKekRef?: {
374
- containerId: string;
375
- containerKeyEpochId: string;
376
- keyEpochHash: string;
377
- } | null | undefined;
378
- previousContainerPathRefs?: {
379
- containerId: string;
380
- manifestHash: string;
381
- }[] | undefined;
382
- previousManifestRef?: {
383
- containerId: string;
384
- manifestHash: string;
385
- } | null | undefined;
386
- userRecipientKeys?: Record<string, unknown>[] | undefined;
387
- }[] | undefined;
388
- contentKeyBundle?: {
389
- contentKeyEpoch: number;
390
- linkSetManifestHash: string;
391
- targetHash: string;
392
- targets: {
393
- containerId: string;
394
- containerKeyEpoch: number;
395
- containerKeyEpochId: string;
396
- containerManifestHash: string;
397
- wrappedKey: string;
398
- wrappingMetadata: Record<string, unknown>;
399
- }[];
400
- } | undefined;
401
- historyMode?: "raw" | undefined;
402
- inlineRekeyCommitId?: string | undefined;
403
- minLsn?: string | undefined;
404
- pullCursor?: string | undefined;
405
201
  } | undefined;
406
202
  authorizingContainerPathRefs?: {
407
203
  containerId: string;
@@ -469,12 +265,7 @@ export declare const createDocumentOperation: Omit<{
469
265
  };
470
266
  event: Record<string, unknown>;
471
267
  expectedManifestHash: string;
472
- manifest: Record<string, unknown>;
473
268
  initialSync?: {
474
- contentKeyEpoch: number;
475
- expectedLinkSetManifestHash: string;
476
- expectedTargetHash: string;
477
- localVersionVector: string | null;
478
269
  outgoingUpdates: {
479
270
  encryptedData: string;
480
271
  id: string;
@@ -486,69 +277,6 @@ export declare const createDocumentOperation: Omit<{
486
277
  checkpointPayloadKind?: "full_history_snapshot" | undefined;
487
278
  sourceVersionVector?: string | undefined;
488
279
  }[];
489
- supportsPullPagination: true;
490
- authorizingContainerPathRefs?: {
491
- containerId: string;
492
- manifestHash: string;
493
- }[][] | undefined;
494
- containerRekeys?: {
495
- body: unknown;
496
- event: Record<string, unknown>;
497
- expectedManifestHash: string;
498
- keyEpoch: Record<string, unknown>;
499
- keyring: Record<string, unknown> | null;
500
- predecessorBridge: Record<string, unknown> | null;
501
- principalPolicyRefs: {
502
- principalType: "group" | "organization";
503
- principalId: string;
504
- version: number;
505
- stateHash: string;
506
- }[];
507
- wraps: Record<string, unknown>[];
508
- containerManifestHistoryRefs?: {
509
- containerId: string;
510
- manifestHash: string;
511
- }[] | undefined;
512
- destinationParentContainerPathRefs?: {
513
- containerId: string;
514
- manifestHash: string;
515
- }[] | undefined;
516
- parentContainerPathRefs?: {
517
- containerId: string;
518
- manifestHash: string;
519
- }[] | undefined;
520
- parentKekRef?: {
521
- containerId: string;
522
- containerKeyEpochId: string;
523
- keyEpochHash: string;
524
- } | null | undefined;
525
- previousContainerPathRefs?: {
526
- containerId: string;
527
- manifestHash: string;
528
- }[] | undefined;
529
- previousManifestRef?: {
530
- containerId: string;
531
- manifestHash: string;
532
- } | null | undefined;
533
- userRecipientKeys?: Record<string, unknown>[] | undefined;
534
- }[] | undefined;
535
- contentKeyBundle?: {
536
- contentKeyEpoch: number;
537
- linkSetManifestHash: string;
538
- targetHash: string;
539
- targets: {
540
- containerId: string;
541
- containerKeyEpoch: number;
542
- containerKeyEpochId: string;
543
- containerManifestHash: string;
544
- wrappedKey: string;
545
- wrappingMetadata: Record<string, unknown>;
546
- }[];
547
- } | undefined;
548
- historyMode?: "raw" | undefined;
549
- inlineRekeyCommitId?: string | undefined;
550
- minLsn?: string | undefined;
551
- pullCursor?: string | undefined;
552
280
  } | undefined;
553
281
  authorizingContainerPathRefs?: {
554
282
  containerId: string;
@@ -739,29 +467,8 @@ export declare const createDocumentOperation: Omit<{
739
467
  }>>;
740
468
  };
741
469
  readonly runtimeRefinements: readonly [{
742
- readonly description: "a document create seed must contain exactly one outgoing update and no container rekeys, and serialize within the document sync request limit";
470
+ readonly description: "a document create seed must contain exactly one outgoing update and no container rekeys, and with the create's content-key bundle and target path form a valid document sync that serializes within the document sync request limit";
743
471
  readonly id: "request.document-create-seed";
744
- }, {
745
- readonly description: "inlineRekeyCommitId must be present exactly when containerRekeys is non-empty";
746
- readonly id: "request.inline-rekey-commit-marker";
747
- }, {
748
- readonly description: "authorizingContainerPathRefs is required when outgoingUpdates is non-empty";
749
- readonly id: "request.authorizing-paths-for-writes";
750
- }, {
751
- readonly description: "containerRekeys may be non-empty only when outgoingUpdates is non-empty";
752
- readonly id: "request.container-rekeys-require-write";
753
- }, {
754
- readonly description: "outgoing update ids must be unique within the request";
755
- readonly id: "request.unique-outgoing-update-ids";
756
- }, {
757
- readonly description: "a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths";
758
- readonly id: "request.pull-continuation-read-only";
759
- }, {
760
- readonly description: "historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths";
761
- readonly id: "request.raw-history-read-only";
762
- }, {
763
- readonly description: "historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested";
764
- readonly id: "request.raw-history-null-frontier";
765
472
  }, {
766
473
  readonly description: "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline";
767
474
  readonly id: "request.rotation-checkpoint-fields";
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { documentCreateSeedRefinement } from "../documentCreateSeedRefinements.js";
3
- import { documentLinkSetPathRefinement, documentSyncRequestRotationRefinement, documentSyncRequestRuntimeRefinements, } from "../documentSyncRefinements.js";
3
+ import { documentLinkSetPathRefinement, documentSyncRequestRotationRefinement, } from "../documentSyncRefinements.js";
4
4
  import { registerJsonSchemaFragment } from "../jsonSchema.js";
5
5
  import { DocumentCreateRequestSchema, DocumentLinkSetMutationRequestSchema, DocumentPurgeRequestSchema, isDocumentCreateRequest, isDocumentLinkSetMutationRequest, isDocumentPurgeRequest, } from "../request/index.js";
6
6
  import { DocumentCreateResponseSchema, DocumentLinkSetMutationResponseSchema, DocumentMutationFailureResponseSchema, DocumentPurgeProofResponseSchema, DocumentPurgeResponseSchema, ErrorResponseSchema, isDocumentCreateResponse, isDocumentLinkSetMutationResponse, isDocumentPurgeProofResponse, isDocumentPurgeResponse, PaymentRequiredErrorResponseSchema, SessionFailureResponseSchema, } from "../response/index.js";
@@ -40,7 +40,7 @@ export const createDocumentOperation = defineJsonOperation({
40
40
  responses: { 200: DocumentCreateResponseSchema },
41
41
  runtimeRefinements: [
42
42
  documentCreateSeedRefinement,
43
- ...documentSyncRequestRuntimeRefinements,
43
+ documentSyncRequestRotationRefinement,
44
44
  ],
45
45
  });
46
46
  function defineDocumentLinkSetMutationOperation(input) {
@@ -1 +1 @@
1
- {"version":3,"file":"documentMutations.js","sourceRoot":"","sources":["documentMutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAA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,EAAE,gCAAgC;IACxC,IAAI,EAAE,+BAA+B;IACrC,KAAK,EAAE,6BAA6B;IACpC,oBAAoB,EAAE,+BAA+B;IACrD,SAAS,EAAE;QACT,GAAG,EAAE,gCAAgC;QACrC,GAAG,EAAE,yCAAyC;KAC/C;IACD,kBAAkB,EAAE,CAAC,kCAAkC,CAAC;CACzD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG,uBAAuB,CAAC;AACxE,MAAM,CAAC,MAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAC1E,MAAM,CAAC,MAAM,yCAAyC,GACpD,gCAAgC,CAAC;AACnC,MAAM,CAAC,MAAM,0CAA0C,GACrD,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,gCAAgC,GAAG,uBAAuB,CAAC;AACxE,MAAM,CAAC,MAAM,wCAAwC,GACnD,4BAA4B,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { documentCreateSeedRefinement } from \"../documentCreateSeedRefinements\";\nimport {\n documentLinkSetPathRefinement,\n documentSyncRequestRotationRefinement,\n documentSyncRequestRuntimeRefinements,\n} from \"../documentSyncRefinements\";\nimport { registerJsonSchemaFragment } from \"../jsonSchema\";\nimport {\n DocumentCreateRequestSchema,\n DocumentLinkSetMutationRequestSchema,\n DocumentPurgeRequestSchema,\n isDocumentCreateRequest,\n isDocumentLinkSetMutationRequest,\n isDocumentPurgeRequest,\n} from \"../request\";\nimport {\n DocumentCreateResponseSchema,\n DocumentLinkSetMutationResponseSchema,\n DocumentMutationFailureResponseSchema,\n DocumentPurgeProofResponseSchema,\n DocumentPurgeResponseSchema,\n ErrorResponseSchema,\n isDocumentCreateResponse,\n isDocumentLinkSetMutationResponse,\n isDocumentPurgeProofResponse,\n isDocumentPurgeResponse,\n PaymentRequiredErrorResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport {\n PrincipalHistoryPreparationFailureResponseSchema,\n PrincipalHistoryPreparationResponseSchema,\n principalHistoryRollbackRefinement,\n} from \"../response/principalHistoryPreparation\";\nimport { defineJsonOperation } from \"./definition\";\nimport { DocumentSyncPathParamsSchema } from \"./documentSync\";\n\nconst EmptyDocumentMutationPathParamsSchema = z.strictObject({});\n\nexport const DocumentMutationPathParamsSchema = DocumentSyncPathParamsSchema;\n\nexport type DocumentMutationPathParams = z.infer<\n typeof DocumentMutationPathParamsSchema\n>;\n\nconst checkpointManifestHashQuerySchema = registerJsonSchemaFragment(\n z.string().min(1).max(6_500),\n { maxLength: 6_500, minLength: 1, type: \"string\" },\n);\n\nexport const DocumentPurgeProofQuerySchema = z.strictObject({\n documentCheckpointManifestHash: checkpointManifestHashQuerySchema.optional(),\n});\n\nexport type DocumentPurgeProofQuery = z.infer<\n typeof DocumentPurgeProofQuerySchema\n>;\n\nconst documentMutationFailureResponses = {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: DocumentMutationFailureResponseSchema,\n 409: DocumentMutationFailureResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n} as const;\n\nconst documentMutationFailureStatuses = [\n 400, 401, 402, 403, 404, 409, 500, 503,\n] as const;\n\nexport const createDocumentOperation = defineJsonOperation({\n auth: \"session\",\n body: DocumentCreateRequestSchema,\n failureResponses: documentMutationFailureResponses,\n failureStatuses: documentMutationFailureStatuses,\n id: \"documents.create\",\n summary: \"Create a document\",\n description:\n \"Creates a document from a signed document access event, its document link-set manifest, and its content-key bundle, optionally committing the document's first encrypted update in the same transaction. Requires write access to the target container through an authorizing container path. A retry of a create that already committed returns 409 `document_manifest_already_exists`, which lets the client adopt it.\",\n method: \"POST\",\n params: EmptyDocumentMutationPathParamsSchema,\n path: \"/documents\",\n responses: { 200: DocumentCreateResponseSchema },\n runtimeRefinements: [\n documentCreateSeedRefinement,\n ...documentSyncRequestRuntimeRefinements,\n ],\n});\n\nfunction defineDocumentLinkSetMutationOperation<\n const Id extends string,\n const Path extends `/${string}`,\n>(input: {\n readonly id: Id;\n readonly path: Path;\n readonly summary: string;\n readonly description: string;\n}) {\n return defineJsonOperation({\n auth: \"session\",\n body: DocumentLinkSetMutationRequestSchema,\n failureResponses: documentMutationFailureResponses,\n failureStatuses: documentMutationFailureStatuses,\n id: input.id,\n summary: input.summary,\n description: input.description,\n method: \"POST\",\n params: DocumentMutationPathParamsSchema,\n path: input.path,\n responses: { 200: DocumentLinkSetMutationResponseSchema },\n runtimeRefinements: [\n documentLinkSetPathRefinement,\n documentSyncRequestRotationRefinement,\n ],\n });\n}\n\nexport const linkDocumentOperation = defineDocumentLinkSetMutationOperation({\n id: \"documents.link\",\n summary: \"Link a document to a container\",\n description:\n \"Links a document into another container through a signed `document.link` event, advancing its document link-set manifest and rewrapping the content keys of its attached blobs for the new container. Requires write access through the target and authorizing container paths. Stale heads or incomplete rewraps return 409 without changing the document.\",\n path: \"/documents/{documentId}/link\",\n});\n\nexport const unlinkDocumentOperation = defineDocumentLinkSetMutationOperation({\n id: \"documents.unlink\",\n summary: \"Unlink a document from a container\",\n description:\n \"Removes a container from a document's link set through a signed `document.unlink` event and rotates the document content key. The request must carry a rotation baseline covering every committed update, unless the document has none. Requires write access; stale heads, a missing baseline, or incomplete rewraps return 409.\",\n path: \"/documents/{documentId}/unlink\",\n});\n\nconst documentPurgeFailureResponses = {\n ...documentMutationFailureResponses,\n 503: PrincipalHistoryPreparationFailureResponseSchema,\n} as const;\n\nconst preparationResponseDescriptions = {\n 202: \"The attempted operation rolled back. Retry the identical request to continue verification preparation.\",\n} as const;\n\nexport const purgeDocumentOperation = defineJsonOperation({\n auth: \"session\",\n body: DocumentPurgeRequestSchema,\n failureResponses: documentPurgeFailureResponses,\n failureStatuses: documentMutationFailureStatuses,\n id: \"documents.purge\",\n summary: \"Purge a document\",\n description:\n \"Permanently removes a document through a signed `document.purge` event that cites its exact current authorizing container path. Requires write access, a document linked to exactly one container, and a document that is not a container's metadata document. The server keeps the signed proof, and blobs only this document referenced enter the attachment-retention grace period; a 202 asks the client to retry the identical request after policy history is prepared.\",\n method: \"POST\",\n params: DocumentMutationPathParamsSchema,\n path: \"/documents/{documentId}/purge\",\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: DocumentPurgeResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [principalHistoryRollbackRefinement],\n});\n\nexport const getDocumentPurgeProofOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: documentPurgeFailureResponses,\n failureStatuses: documentMutationFailureStatuses,\n id: \"documents.purgeProof\",\n summary: \"Get a document purge proof\",\n description:\n \"Returns the retained signed proof that a document was purged, so a device can verify the deletion before removing its local copy. Only callers who were authorized through the purge-time container path are served it; a 202 asks the client to retry the identical request after policy history is prepared.\",\n method: \"GET\",\n params: DocumentMutationPathParamsSchema,\n path: \"/documents/{documentId}/purge\",\n query: DocumentPurgeProofQuerySchema,\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: DocumentPurgeProofResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [principalHistoryRollbackRefinement],\n});\n\nexport const isCreateDocumentOperationRequest = isDocumentCreateRequest;\nexport const isCreateDocumentOperationResponse = isDocumentCreateResponse;\nexport const isDocumentLinkSetMutationOperationRequest =\n isDocumentLinkSetMutationRequest;\nexport const isDocumentLinkSetMutationOperationResponse =\n isDocumentLinkSetMutationResponse;\nexport const isPurgeDocumentOperationRequest = isDocumentPurgeRequest;\nexport const isPurgeDocumentOperationResponse = isDocumentPurgeResponse;\nexport const isGetDocumentPurgeProofOperationResponse =\n isDocumentPurgeProofResponse;\n"]}
1
+ {"version":3,"file":"documentMutations.js","sourceRoot":"","sources":["documentMutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,MAAM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gCAAgC;IACxC,IAAI,EAAE,+BAA+B;IACrC,KAAK,EAAE,6BAA6B;IACpC,oBAAoB,EAAE,+BAA+B;IACrD,SAAS,EAAE;QACT,GAAG,EAAE,gCAAgC;QACrC,GAAG,EAAE,yCAAyC;KAC/C;IACD,kBAAkB,EAAE,CAAC,kCAAkC,CAAC;CACzD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG,uBAAuB,CAAC;AACxE,MAAM,CAAC,MAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAC1E,MAAM,CAAC,MAAM,yCAAyC,GACpD,gCAAgC,CAAC;AACnC,MAAM,CAAC,MAAM,0CAA0C,GACrD,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,gCAAgC,GAAG,uBAAuB,CAAC;AACxE,MAAM,CAAC,MAAM,wCAAwC,GACnD,4BAA4B,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { documentCreateSeedRefinement } from \"../documentCreateSeedRefinements\";\nimport {\n documentLinkSetPathRefinement,\n documentSyncRequestRotationRefinement,\n} from \"../documentSyncRefinements\";\nimport { registerJsonSchemaFragment } from \"../jsonSchema\";\nimport {\n DocumentCreateRequestSchema,\n DocumentLinkSetMutationRequestSchema,\n DocumentPurgeRequestSchema,\n isDocumentCreateRequest,\n isDocumentLinkSetMutationRequest,\n isDocumentPurgeRequest,\n} from \"../request\";\nimport {\n DocumentCreateResponseSchema,\n DocumentLinkSetMutationResponseSchema,\n DocumentMutationFailureResponseSchema,\n DocumentPurgeProofResponseSchema,\n DocumentPurgeResponseSchema,\n ErrorResponseSchema,\n isDocumentCreateResponse,\n isDocumentLinkSetMutationResponse,\n isDocumentPurgeProofResponse,\n isDocumentPurgeResponse,\n PaymentRequiredErrorResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport {\n PrincipalHistoryPreparationFailureResponseSchema,\n PrincipalHistoryPreparationResponseSchema,\n principalHistoryRollbackRefinement,\n} from \"../response/principalHistoryPreparation\";\nimport { defineJsonOperation } from \"./definition\";\nimport { DocumentSyncPathParamsSchema } from \"./documentSync\";\n\nconst EmptyDocumentMutationPathParamsSchema = z.strictObject({});\n\nexport const DocumentMutationPathParamsSchema = DocumentSyncPathParamsSchema;\n\nexport type DocumentMutationPathParams = z.infer<\n typeof DocumentMutationPathParamsSchema\n>;\n\nconst checkpointManifestHashQuerySchema = registerJsonSchemaFragment(\n z.string().min(1).max(6_500),\n { maxLength: 6_500, minLength: 1, type: \"string\" },\n);\n\nexport const DocumentPurgeProofQuerySchema = z.strictObject({\n documentCheckpointManifestHash: checkpointManifestHashQuerySchema.optional(),\n});\n\nexport type DocumentPurgeProofQuery = z.infer<\n typeof DocumentPurgeProofQuerySchema\n>;\n\nconst documentMutationFailureResponses = {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: DocumentMutationFailureResponseSchema,\n 409: DocumentMutationFailureResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n} as const;\n\nconst documentMutationFailureStatuses = [\n 400, 401, 402, 403, 404, 409, 500, 503,\n] as const;\n\nexport const createDocumentOperation = defineJsonOperation({\n auth: \"session\",\n body: DocumentCreateRequestSchema,\n failureResponses: documentMutationFailureResponses,\n failureStatuses: documentMutationFailureStatuses,\n id: \"documents.create\",\n summary: \"Create a document\",\n description:\n \"Creates a document from a signed document access event, its document link-set manifest, and its content-key bundle, optionally committing the document's first encrypted update in the same transaction. Requires write access to the target container through an authorizing container path. A retry of a create that already committed returns 409 `document_manifest_already_exists`, which lets the client adopt it.\",\n method: \"POST\",\n params: EmptyDocumentMutationPathParamsSchema,\n path: \"/documents\",\n responses: { 200: DocumentCreateResponseSchema },\n runtimeRefinements: [\n documentCreateSeedRefinement,\n documentSyncRequestRotationRefinement,\n ],\n});\n\nfunction defineDocumentLinkSetMutationOperation<\n const Id extends string,\n const Path extends `/${string}`,\n>(input: {\n readonly id: Id;\n readonly path: Path;\n readonly summary: string;\n readonly description: string;\n}) {\n return defineJsonOperation({\n auth: \"session\",\n body: DocumentLinkSetMutationRequestSchema,\n failureResponses: documentMutationFailureResponses,\n failureStatuses: documentMutationFailureStatuses,\n id: input.id,\n summary: input.summary,\n description: input.description,\n method: \"POST\",\n params: DocumentMutationPathParamsSchema,\n path: input.path,\n responses: { 200: DocumentLinkSetMutationResponseSchema },\n runtimeRefinements: [\n documentLinkSetPathRefinement,\n documentSyncRequestRotationRefinement,\n ],\n });\n}\n\nexport const linkDocumentOperation = defineDocumentLinkSetMutationOperation({\n id: \"documents.link\",\n summary: \"Link a document to a container\",\n description:\n \"Links a document into another container through a signed `document.link` event, advancing its document link-set manifest and rewrapping the content keys of its attached blobs for the new container. Requires write access through the target and authorizing container paths. Stale heads or incomplete rewraps return 409 without changing the document.\",\n path: \"/documents/{documentId}/link\",\n});\n\nexport const unlinkDocumentOperation = defineDocumentLinkSetMutationOperation({\n id: \"documents.unlink\",\n summary: \"Unlink a document from a container\",\n description:\n \"Removes a container from a document's link set through a signed `document.unlink` event and rotates the document content key. The request must carry a rotation baseline covering every committed update, unless the document has none. Requires write access; stale heads, a missing baseline, or incomplete rewraps return 409.\",\n path: \"/documents/{documentId}/unlink\",\n});\n\nconst documentPurgeFailureResponses = {\n ...documentMutationFailureResponses,\n 503: PrincipalHistoryPreparationFailureResponseSchema,\n} as const;\n\nconst preparationResponseDescriptions = {\n 202: \"The attempted operation rolled back. Retry the identical request to continue verification preparation.\",\n} as const;\n\nexport const purgeDocumentOperation = defineJsonOperation({\n auth: \"session\",\n body: DocumentPurgeRequestSchema,\n failureResponses: documentPurgeFailureResponses,\n failureStatuses: documentMutationFailureStatuses,\n id: \"documents.purge\",\n summary: \"Purge a document\",\n description:\n \"Permanently removes a document through a signed `document.purge` event that cites its exact current authorizing container path. Requires write access, a document linked to exactly one container, and a document that is not a container's metadata document. The server keeps the signed proof, and blobs only this document referenced enter the attachment-retention grace period; a 202 asks the client to retry the identical request after policy history is prepared.\",\n method: \"POST\",\n params: DocumentMutationPathParamsSchema,\n path: \"/documents/{documentId}/purge\",\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: DocumentPurgeResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [principalHistoryRollbackRefinement],\n});\n\nexport const getDocumentPurgeProofOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: documentPurgeFailureResponses,\n failureStatuses: documentMutationFailureStatuses,\n id: \"documents.purgeProof\",\n summary: \"Get a document purge proof\",\n description:\n \"Returns the retained signed proof that a document was purged, so a device can verify the deletion before removing its local copy. Only callers who were authorized through the purge-time container path are served it; a 202 asks the client to retry the identical request after policy history is prepared.\",\n method: \"GET\",\n params: DocumentMutationPathParamsSchema,\n path: \"/documents/{documentId}/purge\",\n query: DocumentPurgeProofQuerySchema,\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: DocumentPurgeProofResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [principalHistoryRollbackRefinement],\n});\n\nexport const isCreateDocumentOperationRequest = isDocumentCreateRequest;\nexport const isCreateDocumentOperationResponse = isDocumentCreateResponse;\nexport const isDocumentLinkSetMutationOperationRequest =\n isDocumentLinkSetMutationRequest;\nexport const isDocumentLinkSetMutationOperationResponse =\n isDocumentLinkSetMutationResponse;\nexport const isPurgeDocumentOperationRequest = isDocumentPurgeRequest;\nexport const isPurgeDocumentOperationResponse = isDocumentPurgeResponse;\nexport const isGetDocumentPurgeProofOperationResponse =\n isDocumentPurgeProofResponse;\n"]}