@cloudpdf/contract 3.0.0-next.14 → 3.0.0-next.15

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/dist/index.js CHANGED
@@ -1,22 +1,49 @@
1
1
  // src/index.ts
2
2
  import {
3
+ ChangeRequestSchema,
4
+ ChangeResponseSchema,
3
5
  PageScaleInputSchema,
4
6
  PageScaleResultSchema,
5
- PageMeasurementViewportSchema
7
+ PageMeasurementViewportListSchema
6
8
  } from "@embedpdf/engine-core/wire";
7
9
  import {
8
- AnnotationListPageSnapshotSchema,
9
- AnnotationListSnapshotAllPagesSchema,
10
+ AnnotationCreateResultSchema,
11
+ AnnotationDeleteResultSchema,
12
+ AnnotationFlattenResultSchema,
13
+ AnnotationListSchema,
14
+ AnnotationReorderBodySchema,
15
+ AnnotationReorderResultSchema,
16
+ AnnotationUpdateResultSchema,
10
17
  DocumentHeadSchema,
11
18
  DocumentManifestSchema,
19
+ CustomMetadataSchema,
12
20
  DocumentMetadataSchema,
13
21
  EngineErrorPayloadSchema,
22
+ FormResetBodySchema,
23
+ FormWidgetDeleteResultSchema,
24
+ FormWidgetUpdateBodySchema,
25
+ FormWidgetUpdateResultSchema,
26
+ FormWidgetsReorderBodySchema,
27
+ FormWidgetsReorderResultSchema,
28
+ FormCalculationsReorderBodySchema,
29
+ FormCalculationsReorderResultSchema,
30
+ FormResetResultSchema,
31
+ FormSetValueResultSchema,
14
32
  FormSnapshotSchema,
15
- MutationMetaSchema,
33
+ IdentitySchema,
34
+ PageDeleteResultSchema,
35
+ PageFlattenResultSchema,
36
+ PageInsertResultSchema,
37
+ PageReorderInputSchema,
38
+ PageReorderResultSchema,
39
+ PageNameResultSchema,
40
+ PageRotateResultSchema,
41
+ RedactionApplyResultSchema,
42
+ RedactionApplyScopeSchema,
16
43
  PageTextSnapshotSchema,
17
44
  ChangeAnalysisSchema,
18
45
  DocumentVersionsSchema,
19
- SignatureAbortResultSchema,
46
+ SignatureCancelResultSchema,
20
47
  SignatureCompleteBodySchema,
21
48
  SignatureCompleteResultSchema,
22
49
  SignaturePreparedWireSchema,
@@ -157,7 +184,7 @@ var AdminImportSourceSchema = z.discriminatedUnion("kind", [
157
184
  "The operator pre-registered the authority: the request names a connection and a key inside it. Which provider backs the connection (S3, GCS, Azure Blob, filesystem, ...) is deployment configuration, never wire surface."
158
185
  )
159
186
  ]).describe(
160
- "Where CloudPDF pulls the bytes from. The two shapes differ in WHO supplies the authority to read, not in which storage vendor holds the file."
187
+ "Where CloudPDF pulls the bytes from. The two shapes differ in who supplies the authority to read, not in which storage vendor holds the file."
161
188
  );
162
189
  var AdminDocumentImportRequestSchema = z.object({
163
190
  source: AdminImportSourceSchema,
@@ -166,7 +193,7 @@ var AdminDocumentImportRequestSchema = z.object({
166
193
  * against the source's declared Content-Length before the transfer,
167
194
  * `sha256` against the server-observed digest after it. When absent
168
195
  * the server-observed values become authoritative.
169
- * `dedupMode=reuse-existing` REQUIRES `sha256` — without a declared
196
+ * `dedupMode=reuse-existing` requires `sha256` — without a declared
170
197
  * hash the server cannot know what content to reuse.
171
198
  */
172
199
  expected: z.object({
@@ -257,7 +284,7 @@ var AdminTokenRevokeRequestSchema = z.object({
257
284
  /** Optional human reason, written to the audit row. */
258
285
  reason: z.string().max(1024).optional(),
259
286
  /**
260
- * The token's `exp` (unix seconds), used to GC the revocation row
287
+ * The token's `exp` (unix seconds); the revocation row is garbage-collected
261
288
  * once the token would have expired anyway. Defaults server-side to
262
289
  * now + 30 days.
263
290
  */
@@ -324,10 +351,12 @@ var AdminTokenIssueDocRequestSchema = z.object({
324
351
  * vocabulary — an unknown string rejects the whole request.
325
352
  */
326
353
  scope: z.array(z.string().min(1).max(128)).min(1).max(64),
327
- userId: z.string().max(256).optional(),
328
- displayName: z.string().max(256).optional(),
329
- groupId: z.string().max(256).optional(),
330
- groups: z.array(z.string().max(256)).max(64).optional(),
354
+ /**
355
+ * Who the token acts for: the same `Identity` the local engine takes at
356
+ * open time. `displayName` becomes the author of the annotations the token
357
+ * creates, `userId` and `groupId` their owner and group.
358
+ */
359
+ identity: IdentitySchema.optional(),
331
360
  /**
332
361
  * Origin lock: web origins (scheme + host, optional port; one leading
333
362
  * `*.` wildcard label allowed) the minted token may be presented
@@ -775,7 +804,7 @@ var adminOperations = {
775
804
  403: { contentType: "application/json", schema: AdminErrorPayloadSchema },
776
805
  404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
777
806
  },
778
- notes: "The returned share id IS the public share token. Mounted only when the deployment can sign (HS256 mode) \u2014 exchange mints session JWTs, so grants exist only where minting does."
807
+ notes: "The returned share id is the public share token. Mounted only when the deployment can sign (HS256 mode) \u2014 exchange mints session JWTs, so grants exist only where minting does."
779
808
  },
780
809
  "shares.list": {
781
810
  operationId: "shares.list",
@@ -863,10 +892,14 @@ var DocLayerParamsSchema = DocIdParamsSchema.extend({
863
892
  layerName: z.string().min(1)
864
893
  });
865
894
  var DocPageParamsSchema = DocLayerParamsSchema.extend({
866
- pon: z.coerce.number().int().min(0)
895
+ pageKey: z.string().min(1).regex(/^obj:[1-9][0-9]*$/).describe(
896
+ "The page's address, `obj:N`: the page's indirect object number, the durable identity every `PageLayout.ref` carries. Mirrors `annotKey` and `fieldKey`."
897
+ )
867
898
  });
868
899
  var DocAnnotationParamsSchema = DocPageParamsSchema.extend({
869
- annotKey: z.string().min(1)
900
+ annotKey: z.string().min(1).regex(/^(obj:[1-9][0-9]*|base:(0|[1-9][0-9]*))$/).describe(
901
+ "The annotation's address on the page: `obj:N`, its indirect object number, or `base:N` for an annotation the uploaded file stored inline (without an object number of its own), the position it was born at in the page's /Annots. The name the annotation's `ref` carries for life."
902
+ )
870
903
  });
871
904
  var DocFieldParamsSchema = DocLayerParamsSchema.extend({
872
905
  fieldKey: z.string().min(1)
@@ -876,9 +909,13 @@ var documentPasswordHeader = {
876
909
  required: false,
877
910
  description: "Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead."
878
911
  };
912
+ var idempotencyKeyHeader = {
913
+ name: "Idempotency-Key",
914
+ required: false,
915
+ description: "Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing."
916
+ };
879
917
  var looseJson = z.record(z.string(), z.unknown());
880
918
  var docCredentials = ["api-token", "doc-jwt"];
881
- var MutationResponseSchema = z.object({ meta: MutationMetaSchema }).passthrough();
882
919
  var DocSigningParamsSchema = DocLayerParamsSchema.extend({
883
920
  signingId: z.string().min(1)
884
921
  });
@@ -954,6 +991,22 @@ var docOperations = {
954
991
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
955
992
  }
956
993
  },
994
+ "doc.metadata.custom.get": {
995
+ operationId: "doc.metadata.custom.get",
996
+ title: "Get custom keys",
997
+ summary: "The Info dictionary's own keys for a layer: every key but the standard fields, as { key: value }.",
998
+ method: "GET",
999
+ path: wireTemplates.layerCustomMetadata,
1000
+ credentials: docCredentials,
1001
+ scope: [],
1002
+ docCapabilities: ["doc.open"],
1003
+ requestHeaders: [documentPasswordHeader],
1004
+ params: DocLayerParamsSchema,
1005
+ responses: {
1006
+ 200: { contentType: "application/json", schema: CustomMetadataSchema },
1007
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1008
+ }
1009
+ },
957
1010
  "doc.signatures.list": {
958
1011
  operationId: "doc.signatures.list",
959
1012
  title: "List signatures",
@@ -1008,7 +1061,7 @@ var docOperations = {
1008
1061
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1009
1062
  409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1010
1063
  },
1011
- notes: "The multipart envelope: a JSON `body` part (field, subFilter, digest, contentsSize, signer, certify, lock, appearance) and an optional `resource:<key>` PDF part the body's `appearance.resource` names. A certification (`certify.permission`) additionally requires `doc.sign.certify`. The layer is read-only until the signing completes, is aborted, or expires (15 minutes). A layer behind the document head cannot sign (StaleBase)."
1064
+ notes: "Multipart: a JSON `body` part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as `resources: { appearance: '<key>' }`, and that PDF as the part `resource:<key>`. A certification (`certify.permission`) additionally requires `doc.sign.certify`. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A layer behind the document head cannot sign (StaleBase)."
1012
1065
  },
1013
1066
  "doc.signatures.complete": {
1014
1067
  operationId: "doc.signatures.complete",
@@ -1030,19 +1083,19 @@ var docOperations = {
1030
1083
  },
1031
1084
  notes: "`cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. Every layer of the document then sits over the new version; refetch the manifest after a completion."
1032
1085
  },
1033
- "doc.signatures.abort": {
1034
- operationId: "doc.signatures.abort",
1035
- title: "Abort a signature",
1086
+ "doc.signatures.cancel": {
1087
+ operationId: "doc.signatures.cancel",
1088
+ title: "Cancel a signature",
1036
1089
  summary: "Discard a pending signing candidate.",
1037
1090
  method: "DELETE",
1038
- path: wireTemplates.layerSignatureAbort,
1091
+ path: wireTemplates.layerSignatureCancel,
1039
1092
  credentials: docCredentials,
1040
1093
  scope: [],
1041
1094
  docCapabilities: ["doc.sign"],
1042
1095
  requestHeaders: [documentPasswordHeader],
1043
1096
  params: DocSigningParamsSchema,
1044
1097
  responses: {
1045
- 200: { contentType: "application/json", schema: SignatureAbortResultSchema },
1098
+ 200: { contentType: "application/json", schema: SignatureCancelResultSchema },
1046
1099
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1047
1100
  }
1048
1101
  },
@@ -1209,7 +1262,7 @@ var docOperations = {
1209
1262
  requestHeaders: [documentPasswordHeader],
1210
1263
  params: DocPageParamsSchema,
1211
1264
  responses: {
1212
- 200: { contentType: "application/json", schema: AnnotationListPageSnapshotSchema },
1265
+ 200: { contentType: "application/json", schema: AnnotationListSchema },
1213
1266
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1214
1267
  }
1215
1268
  },
@@ -1224,13 +1277,42 @@ var docOperations = {
1224
1277
  docCapabilities: ["doc.annotate.read"],
1225
1278
  requestHeaders: [documentPasswordHeader],
1226
1279
  params: DocLayerParamsSchema,
1227
- notes: "Returns one entry per page plus the audit-log cursor for reconciling subsequent document events. Page order is unspecified; join by `pageState.pageObjectNumber` when display order matters.",
1280
+ notes: "Returns one entry per page plus the audit-log cursor for reconciling subsequent document events. Page order is unspecified; join by `page` (a `PageRef`) when display order matters.",
1228
1281
  responses: {
1229
- 200: { contentType: "application/json", schema: AnnotationListSnapshotAllPagesSchema },
1282
+ 200: { contentType: "application/json", schema: AnnotationListSchema },
1230
1283
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1231
1284
  409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1232
1285
  }
1233
1286
  },
1287
+ "doc.changes": {
1288
+ operationId: "doc.changes",
1289
+ title: "Apply changes",
1290
+ summary: "Apply user actions to a layer, each a change whose ops apply in order, all or none, or the undo of an earlier change.",
1291
+ method: "POST",
1292
+ path: wireTemplates.layerChanges,
1293
+ credentials: docCredentials,
1294
+ scope: [],
1295
+ docCapabilities: [
1296
+ "doc.annotate.modify",
1297
+ "doc.forms.fill",
1298
+ "doc.forms.modify",
1299
+ "doc.metadata.modify"
1300
+ ],
1301
+ requestHeaders: [documentPasswordHeader],
1302
+ params: DocLayerParamsSchema,
1303
+ body: {
1304
+ contentType: ["application/json", "multipart/form-data"],
1305
+ schema: ChangeRequestSchema
1306
+ },
1307
+ notes: "Each change stands on its own and names itself by `opId`: a refused change rolls back alone, and the answer lists every change in order, applied with its result or refused with its error. Asked again under its `opId`, a change gets the same answer, refusals included; a different change under an answered `opId` is refused (IdempotencyKeyReused). `{ opId, undoOf }` undoes an earlier change of the caller, here or in an earlier request; an undo leaves alone what was changed since, and the undo of an undo redoes. A redaction, a flatten, a form repair or a completed signature ends undo for the changes before it (UndoUnavailable). Each op is checked against its own capability: annotation ops need `doc.annotate.modify`, form values `doc.forms.fill`, form structure `doc.forms.modify`, metadata `doc.metadata.modify`. Bytes (a stamp's drawing, an attached file, a signature's artwork) travel as multipart: a JSON `body` part, each op naming its files by role as `resources: { <role>: '<key>' }`, and each file as the part `resource:<key>`. At most 64 changes per request and 512 ops per change.",
1308
+ responses: {
1309
+ 200: { contentType: "application/json", schema: ChangeResponseSchema },
1310
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1311
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1312
+ 409: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1313
+ 413: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1314
+ }
1315
+ },
1234
1316
  "doc.annotations.create": {
1235
1317
  operationId: "doc.annotations.create",
1236
1318
  title: "Create annotation",
@@ -1240,12 +1322,12 @@ var docOperations = {
1240
1322
  credentials: docCredentials,
1241
1323
  scope: [],
1242
1324
  docCapabilities: ["doc.annotate.modify"],
1243
- requestHeaders: [documentPasswordHeader],
1325
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1244
1326
  params: DocPageParamsSchema,
1245
1327
  body: { contentType: "application/json", schema: looseJson },
1246
1328
  notes: "Doc JWTs may instead carry collab scopes (annotations:create:self, \u2026) that refine per-annotation authorship rules; the API token is exempt from both.",
1247
1329
  responses: {
1248
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1330
+ 200: { contentType: "application/json", schema: AnnotationCreateResultSchema },
1249
1331
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1250
1332
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1251
1333
  }
@@ -1259,11 +1341,11 @@ var docOperations = {
1259
1341
  credentials: docCredentials,
1260
1342
  scope: [],
1261
1343
  docCapabilities: ["doc.annotate.modify"],
1262
- requestHeaders: [documentPasswordHeader],
1344
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1263
1345
  params: DocAnnotationParamsSchema,
1264
1346
  body: { contentType: "application/json", schema: looseJson },
1265
1347
  responses: {
1266
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1348
+ 200: { contentType: "application/json", schema: AnnotationUpdateResultSchema },
1267
1349
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1268
1350
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1269
1351
  }
@@ -1277,27 +1359,45 @@ var docOperations = {
1277
1359
  credentials: docCredentials,
1278
1360
  scope: [],
1279
1361
  docCapabilities: ["doc.annotate.modify"],
1280
- requestHeaders: [documentPasswordHeader],
1362
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1281
1363
  params: DocAnnotationParamsSchema,
1282
1364
  responses: {
1283
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1365
+ 200: { contentType: "application/json", schema: AnnotationDeleteResultSchema },
1366
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1367
+ }
1368
+ },
1369
+ "doc.annotations.reorder": {
1370
+ operationId: "doc.annotations.reorder",
1371
+ title: "Reorder annotations",
1372
+ summary: "Change the stacking order of one page's annotations: they go together, in the order given, next to a neighbour annotation (`{ before }`, `{ after }`) or to the bottom (`'start'`) or top (`'end'`). Widgets paint above every annotation and have their own order (`doc.forms.reorderWidgets`): a widget is refused. Returns the page's new order.",
1373
+ method: "POST",
1374
+ path: wireTemplates.layerAnnotationItemsReorder,
1375
+ credentials: docCredentials,
1376
+ scope: [],
1377
+ docCapabilities: ["doc.annotate.modify"],
1378
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1379
+ params: DocPageParamsSchema,
1380
+ body: { contentType: "application/json", schema: AnnotationReorderBodySchema },
1381
+ responses: {
1382
+ 200: { contentType: "application/json", schema: AnnotationReorderResultSchema },
1383
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1284
1384
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1285
1385
  }
1286
1386
  },
1287
1387
  "doc.annotations.flatten": {
1288
1388
  operationId: "doc.annotations.flatten",
1289
1389
  title: "Flatten annotations",
1290
- summary: "Flatten a chosen set of one page's annotations into its content \u2014 pages.flatten for a selection. Painted annotations are removed; ineligible ones report skipped.",
1390
+ summary: "Flatten a chosen set of one page's annotations into its content \u2014 pages.flatten for a selection. Painted annotations are removed; ineligible ones report unchanged.",
1291
1391
  method: "POST",
1292
1392
  path: wireTemplates.layerAnnotationItemsFlatten,
1293
1393
  credentials: docCredentials,
1294
1394
  scope: [],
1295
1395
  docCapabilities: ["doc.pages.modify", "doc.annotate.modify"],
1296
- requestHeaders: [documentPasswordHeader],
1396
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1297
1397
  params: DocPageParamsSchema,
1298
1398
  body: { contentType: "application/json", schema: looseJson },
1299
1399
  responses: {
1300
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1400
+ 200: { contentType: "application/json", schema: AnnotationFlattenResultSchema },
1301
1401
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1302
1402
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1303
1403
  }
@@ -1320,10 +1420,27 @@ var docOperations = {
1320
1420
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1321
1421
  }
1322
1422
  },
1323
- "doc.forms.get": {
1324
- operationId: "doc.forms.get",
1325
- title: "Get form snapshot",
1326
- summary: "Reconciled form snapshot: fields, widgets, values.",
1423
+ "doc.annotations.readAppearance": {
1424
+ operationId: "doc.annotations.readAppearance",
1425
+ title: "Read an annotation appearance",
1426
+ summary: "A stamp's drawing as a one-page PDF, before the fit, rotation and opacity its data describes: with the data, the bytes to create the same stamp again. A read; the source is untouched.",
1427
+ method: "GET",
1428
+ path: wireTemplates.layerAnnotationItemAppearanceResource,
1429
+ credentials: docCredentials,
1430
+ scope: [],
1431
+ docCapabilities: ["doc.download"],
1432
+ requestHeaders: [documentPasswordHeader],
1433
+ params: DocAnnotationParamsSchema,
1434
+ responses: {
1435
+ 200: { contentType: "application/pdf" },
1436
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1437
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1438
+ }
1439
+ },
1440
+ "doc.forms.list": {
1441
+ operationId: "doc.forms.list",
1442
+ title: "List form fields",
1443
+ summary: "The form: every field with its value, every widget's row (its place, look and state), and the calculation order. A form field's widgets come with the form, never with the annotations.",
1327
1444
  method: "GET",
1328
1445
  path: wireTemplates.layerForm,
1329
1446
  credentials: docCredentials,
@@ -1345,62 +1462,100 @@ var docOperations = {
1345
1462
  credentials: docCredentials,
1346
1463
  scope: [],
1347
1464
  docCapabilities: ["doc.forms.fill"],
1348
- requestHeaders: [documentPasswordHeader],
1465
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1349
1466
  params: DocFieldParamsSchema,
1350
1467
  body: { contentType: "application/json", schema: looseJson },
1351
1468
  responses: {
1352
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1469
+ 200: { contentType: "application/json", schema: FormSetValueResultSchema },
1353
1470
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1354
1471
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1355
1472
  }
1356
1473
  },
1357
- "doc.forms.reset": {
1358
- operationId: "doc.forms.reset",
1359
- title: "Reset form field",
1360
- summary: "Reset one form field to its default value.",
1474
+ "doc.forms.updateWidget": {
1475
+ operationId: "doc.forms.updateWidget",
1476
+ title: "Update form widget",
1477
+ summary: "Change a widget's place and look: what an annotation update takes, for a form field's widget. A widget is the form's, so the annotation routes refuse one.",
1478
+ method: "PATCH",
1479
+ path: wireTemplates.layerFormWidget,
1480
+ credentials: docCredentials,
1481
+ scope: [],
1482
+ docCapabilities: ["doc.forms.modify"],
1483
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1484
+ params: DocAnnotationParamsSchema,
1485
+ body: { contentType: "application/json", schema: FormWidgetUpdateBodySchema },
1486
+ responses: {
1487
+ 200: { contentType: "application/json", schema: FormWidgetUpdateResultSchema },
1488
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1489
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1490
+ }
1491
+ },
1492
+ "doc.forms.deleteWidget": {
1493
+ operationId: "doc.forms.deleteWidget",
1494
+ title: "Delete form widget",
1495
+ summary: "Delete a widget: it leaves its page, and its field when it has one. The field survives, unplaced when this was its last widget. A widget that is its field's own dictionary is refused: delete the field. A widget is the form's, so the annotation routes refuse one.",
1496
+ method: "DELETE",
1497
+ path: wireTemplates.layerFormWidget,
1498
+ credentials: docCredentials,
1499
+ scope: [],
1500
+ docCapabilities: ["doc.forms.modify"],
1501
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1502
+ params: DocAnnotationParamsSchema,
1503
+ responses: {
1504
+ 200: { contentType: "application/json", schema: FormWidgetDeleteResultSchema },
1505
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1506
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1507
+ }
1508
+ },
1509
+ "doc.forms.reorderWidgets": {
1510
+ operationId: "doc.forms.reorderWidgets",
1511
+ title: "Reorder form widgets",
1512
+ summary: "Change the stacking order of one page's widgets: they go together, in the order given, next to a neighbour widget or to the bottom (`'start'`) or top (`'end'`) of the page's widgets, which paint above every annotation. Where the page's `/Tabs` follows it, this is also the tab order. Returns the page's new widget order.",
1361
1513
  method: "POST",
1362
- path: wireTemplates.layerFormFieldReset,
1514
+ path: wireTemplates.layerFormWidgetsReorder,
1363
1515
  credentials: docCredentials,
1364
1516
  scope: [],
1365
- docCapabilities: ["doc.forms.fill"],
1366
- requestHeaders: [documentPasswordHeader],
1367
- params: DocFieldParamsSchema,
1517
+ docCapabilities: ["doc.forms.modify"],
1518
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1519
+ params: DocPageParamsSchema,
1520
+ body: { contentType: "application/json", schema: FormWidgetsReorderBodySchema },
1368
1521
  responses: {
1369
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1522
+ 200: { contentType: "application/json", schema: FormWidgetsReorderResultSchema },
1523
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1370
1524
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1371
1525
  }
1372
1526
  },
1373
- "doc.forms.exportData": {
1374
- operationId: "doc.forms.exportData",
1375
- title: "Export form data",
1376
- summary: "Export form data as FDF or XFDF.",
1377
- method: "GET",
1378
- path: wireTemplates.layerFormData,
1527
+ "doc.forms.reorderCalculations": {
1528
+ operationId: "doc.forms.reorderCalculations",
1529
+ title: "Reorder form calculations",
1530
+ summary: "Change the form's calculation order, the order its fields' calculate scripts run in: the fields go together, in the order given, next to a neighbour field or to the start (`'start'`) or end (`'end'`). Every field named must have a calculate script, which puts it in the order. Returns the whole new order.",
1531
+ method: "POST",
1532
+ path: wireTemplates.layerFormCalculationsReorder,
1379
1533
  credentials: docCredentials,
1380
1534
  scope: [],
1381
- docCapabilities: ["doc.forms.read"],
1382
- requestHeaders: [documentPasswordHeader],
1535
+ docCapabilities: ["doc.forms.modify"],
1536
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1383
1537
  params: DocLayerParamsSchema,
1384
- query: z.object({ format: z.enum(["fdf", "xfdf"]).optional() }),
1538
+ body: { contentType: "application/json", schema: FormCalculationsReorderBodySchema },
1385
1539
  responses: {
1386
- 200: { contentType: ["application/vnd.adobe.xfdf", "application/vnd.fdf"] },
1540
+ 200: { contentType: "application/json", schema: FormCalculationsReorderResultSchema },
1541
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1387
1542
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1388
1543
  }
1389
1544
  },
1390
- "doc.forms.importData": {
1391
- operationId: "doc.forms.importData",
1392
- title: "Import form data",
1393
- summary: "Import form data (FDF/XFDF), filling matching fields.",
1545
+ "doc.forms.reset": {
1546
+ operationId: "doc.forms.reset",
1547
+ title: "Reset form",
1548
+ summary: "Reset the fields named in `refs` to their default values, or the whole form without it. Returns the fields that changed.",
1394
1549
  method: "POST",
1395
- path: wireTemplates.layerFormData,
1550
+ path: wireTemplates.layerFormReset,
1396
1551
  credentials: docCredentials,
1397
1552
  scope: [],
1398
1553
  docCapabilities: ["doc.forms.fill"],
1399
- requestHeaders: [documentPasswordHeader],
1554
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1400
1555
  params: DocLayerParamsSchema,
1401
- body: { contentType: "application/json", schema: looseJson },
1556
+ body: { contentType: "application/json", schema: FormResetBodySchema },
1402
1557
  responses: {
1403
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1558
+ 200: { contentType: "application/json", schema: FormResetResultSchema },
1404
1559
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1405
1560
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1406
1561
  }
@@ -1417,7 +1572,7 @@ var docOperations = {
1417
1572
  requestHeaders: [documentPasswordHeader],
1418
1573
  params: DocPageParamsSchema,
1419
1574
  responses: {
1420
- 200: { contentType: "application/json", schema: z.array(PageMeasurementViewportSchema) },
1575
+ 200: { contentType: "application/json", schema: PageMeasurementViewportListSchema },
1421
1576
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1422
1577
  }
1423
1578
  },
@@ -1430,7 +1585,7 @@ var docOperations = {
1430
1585
  credentials: docCredentials,
1431
1586
  scope: [],
1432
1587
  docCapabilities: ["doc.annotate.modify"],
1433
- requestHeaders: [documentPasswordHeader],
1588
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1434
1589
  params: DocPageParamsSchema,
1435
1590
  body: { contentType: "application/json", schema: PageScaleInputSchema },
1436
1591
  responses: {
@@ -1439,20 +1594,20 @@ var docOperations = {
1439
1594
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1440
1595
  }
1441
1596
  },
1442
- "doc.pages.move": {
1443
- operationId: "doc.pages.move",
1444
- title: "Move pages",
1445
- summary: "Reorder pages.",
1597
+ "doc.pages.reorder": {
1598
+ operationId: "doc.pages.reorder",
1599
+ title: "Reorder pages",
1600
+ summary: "Move pages together, in the order given, next to a neighbour page (`{ before }`, `{ after }`) or to the start or end. Returns the new layout.",
1446
1601
  method: "POST",
1447
- path: wireTemplates.layerPagesMove,
1602
+ path: wireTemplates.layerPagesReorder,
1448
1603
  credentials: docCredentials,
1449
1604
  scope: [],
1450
1605
  docCapabilities: ["doc.pages.assemble"],
1451
- requestHeaders: [documentPasswordHeader],
1606
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1452
1607
  params: DocLayerParamsSchema,
1453
- body: { contentType: "application/json", schema: looseJson },
1608
+ body: { contentType: "application/json", schema: PageReorderInputSchema },
1454
1609
  responses: {
1455
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1610
+ 200: { contentType: "application/json", schema: PageReorderResultSchema },
1456
1611
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1457
1612
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1458
1613
  }
@@ -1466,11 +1621,11 @@ var docOperations = {
1466
1621
  credentials: docCredentials,
1467
1622
  scope: [],
1468
1623
  docCapabilities: ["doc.pages.assemble"],
1469
- requestHeaders: [documentPasswordHeader],
1624
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1470
1625
  params: DocLayerParamsSchema,
1471
1626
  body: { contentType: "application/json", schema: looseJson },
1472
1627
  responses: {
1473
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1628
+ 200: { contentType: "application/json", schema: PageRotateResultSchema },
1474
1629
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1475
1630
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1476
1631
  }
@@ -1484,11 +1639,11 @@ var docOperations = {
1484
1639
  credentials: docCredentials,
1485
1640
  scope: [],
1486
1641
  docCapabilities: ["doc.pages.assemble"],
1487
- requestHeaders: [documentPasswordHeader],
1642
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1488
1643
  params: DocLayerParamsSchema,
1489
1644
  body: { contentType: "application/json", schema: looseJson },
1490
1645
  responses: {
1491
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1646
+ 200: { contentType: "application/json", schema: PageDeleteResultSchema },
1492
1647
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1493
1648
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1494
1649
  }
@@ -1502,11 +1657,11 @@ var docOperations = {
1502
1657
  credentials: docCredentials,
1503
1658
  scope: [],
1504
1659
  docCapabilities: ["doc.pages.assemble"],
1505
- requestHeaders: [documentPasswordHeader],
1660
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1506
1661
  params: DocLayerParamsSchema,
1507
1662
  body: { contentType: "application/json", schema: looseJson },
1508
1663
  responses: {
1509
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1664
+ 200: { contentType: "application/json", schema: PageNameResultSchema },
1510
1665
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1511
1666
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1512
1667
  }
@@ -1520,11 +1675,11 @@ var docOperations = {
1520
1675
  credentials: docCredentials,
1521
1676
  scope: [],
1522
1677
  docCapabilities: ["doc.pages.assemble"],
1523
- requestHeaders: [documentPasswordHeader],
1678
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1524
1679
  params: DocLayerParamsSchema,
1525
1680
  body: { contentType: "application/json", schema: looseJson },
1526
1681
  responses: {
1527
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1682
+ 200: { contentType: "application/json", schema: PageNameResultSchema },
1528
1683
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1529
1684
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1530
1685
  }
@@ -1538,11 +1693,11 @@ var docOperations = {
1538
1693
  credentials: docCredentials,
1539
1694
  scope: [],
1540
1695
  docCapabilities: ["doc.pages.modify", "doc.annotate.modify"],
1541
- requestHeaders: [documentPasswordHeader],
1696
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1542
1697
  params: DocLayerParamsSchema,
1543
1698
  body: { contentType: "application/json", schema: looseJson, required: false },
1544
1699
  responses: {
1545
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1700
+ 200: { contentType: "application/json", schema: PageFlattenResultSchema },
1546
1701
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1547
1702
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1548
1703
  }
@@ -1556,36 +1711,36 @@ var docOperations = {
1556
1711
  credentials: docCredentials,
1557
1712
  scope: [],
1558
1713
  docCapabilities: ["doc.pages.assemble"],
1559
- requestHeaders: [documentPasswordHeader],
1714
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1560
1715
  params: DocLayerParamsSchema,
1561
1716
  body: {
1562
1717
  contentType: "multipart/form-data"
1563
1718
  },
1564
1719
  responses: {
1565
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1720
+ 200: { contentType: "application/json", schema: PageInsertResultSchema },
1566
1721
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1567
1722
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1568
1723
  },
1569
- notes: 'Multipart mutation envelope: a `body` field holding `{"destIndex"?: number}` (omitted \u2192 append) plus a `resource:source` file part carrying the standalone PDF whose pages are copied in. The inserted copies get fresh page object numbers, returned in insertion order.'
1724
+ notes: 'Multipart: a JSON `body` part `{"position"?: PagePosition, "resources": {"source": "<key>"}}` (position omitted \u2192 the end), and the standalone PDF whose pages are copied in as the part `resource:<key>`. The inserted copies get fresh page object numbers, returned in insertion order.'
1570
1725
  },
1571
1726
  "doc.pages.insertBlank": {
1572
1727
  operationId: "doc.pages.insertBlank",
1573
1728
  title: "Insert blank pages",
1574
- summary: "Create blank pages of an explicit size at an index.",
1729
+ summary: "Create blank pages of an explicit size at a position.",
1575
1730
  method: "POST",
1576
1731
  path: wireTemplates.layerPagesInsertBlank,
1577
1732
  credentials: docCredentials,
1578
1733
  scope: [],
1579
1734
  docCapabilities: ["doc.pages.assemble"],
1580
- requestHeaders: [documentPasswordHeader],
1735
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1581
1736
  params: DocLayerParamsSchema,
1582
1737
  body: { contentType: "application/json", schema: looseJson },
1583
1738
  responses: {
1584
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1739
+ 200: { contentType: "application/json", schema: PageInsertResultSchema },
1585
1740
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1586
1741
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1587
1742
  },
1588
- notes: 'Body is `{"size": {"width", "height"}, "count"?, "destIndex"?}` \u2014 size in PDF points, count in [1, 100], destIndex omitted \u2192 append.'
1743
+ notes: 'Body is `{"size": {"width", "height"}, "count"?, "position"?}` \u2014 size in PDF points, count in [1, 100], `position` a `PagePosition` (omitted \u2192 the end).'
1589
1744
  },
1590
1745
  "doc.pages.extract": {
1591
1746
  operationId: "doc.pages.extract",
@@ -1604,7 +1759,7 @@ var docOperations = {
1604
1759
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1605
1760
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1606
1761
  },
1607
- notes: 'A read, not a mutation: the source document is untouched and no event is published. Body is `{"pageObjectNumbers": number[]}`; the response body is the new PDF.'
1762
+ notes: 'A read, not a mutation: the source document is untouched and no event is published. Body is `{"pages": PageRef[]}`; the response body is the new PDF.'
1608
1763
  },
1609
1764
  "doc.redactions.apply": {
1610
1765
  operationId: "doc.redactions.apply",
@@ -1615,11 +1770,11 @@ var docOperations = {
1615
1770
  credentials: docCredentials,
1616
1771
  scope: [],
1617
1772
  docCapabilities: ["doc.pages.modify", "doc.annotate.modify", "doc.redact"],
1618
- requestHeaders: [documentPasswordHeader],
1773
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1619
1774
  params: DocLayerParamsSchema,
1620
- body: { contentType: "application/json", schema: looseJson, required: false },
1775
+ body: { contentType: "application/json", schema: RedactionApplyScopeSchema },
1621
1776
  responses: {
1622
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1777
+ 200: { contentType: "application/json", schema: RedactionApplyResultSchema },
1623
1778
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1624
1779
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1625
1780
  }
@@ -1652,6 +1807,7 @@ var docsGroups = {
1652
1807
  "doc.annotations": { title: "Annotations" },
1653
1808
  "doc.forms": { title: "Forms" },
1654
1809
  "doc.metadata": { title: "Metadata" },
1810
+ "doc.metadata.custom": { title: "Custom keys" },
1655
1811
  "doc.pages": { title: "Pages" },
1656
1812
  "doc.redactions": { title: "Redactions" },
1657
1813
  "doc.signatures": { title: "Digital signatures" },
@@ -1726,6 +1882,7 @@ export {
1726
1882
  docOperations,
1727
1883
  docsGroups,
1728
1884
  documentPasswordHeader,
1885
+ idempotencyKeyHeader,
1729
1886
  tenantIdPattern
1730
1887
  };
1731
1888
  //# sourceMappingURL=index.js.map