@cloudpdf/contract 3.0.0-next.13 → 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,17 +1,49 @@
1
1
  // src/index.ts
2
2
  import {
3
- AnnotationListPageSnapshotSchema,
4
- AnnotationListSnapshotAllPagesSchema,
3
+ ChangeRequestSchema,
4
+ ChangeResponseSchema,
5
+ PageScaleInputSchema,
6
+ PageScaleResultSchema,
7
+ PageMeasurementViewportListSchema
8
+ } from "@embedpdf/engine-core/wire";
9
+ import {
10
+ AnnotationCreateResultSchema,
11
+ AnnotationDeleteResultSchema,
12
+ AnnotationFlattenResultSchema,
13
+ AnnotationListSchema,
14
+ AnnotationReorderBodySchema,
15
+ AnnotationReorderResultSchema,
16
+ AnnotationUpdateResultSchema,
5
17
  DocumentHeadSchema,
6
18
  DocumentManifestSchema,
19
+ CustomMetadataSchema,
7
20
  DocumentMetadataSchema,
8
21
  EngineErrorPayloadSchema,
22
+ FormResetBodySchema,
23
+ FormWidgetDeleteResultSchema,
24
+ FormWidgetUpdateBodySchema,
25
+ FormWidgetUpdateResultSchema,
26
+ FormWidgetsReorderBodySchema,
27
+ FormWidgetsReorderResultSchema,
28
+ FormCalculationsReorderBodySchema,
29
+ FormCalculationsReorderResultSchema,
30
+ FormResetResultSchema,
31
+ FormSetValueResultSchema,
9
32
  FormSnapshotSchema,
10
- MutationMetaSchema,
33
+ IdentitySchema,
34
+ PageDeleteResultSchema,
35
+ PageFlattenResultSchema,
36
+ PageInsertResultSchema,
37
+ PageReorderInputSchema,
38
+ PageReorderResultSchema,
39
+ PageNameResultSchema,
40
+ PageRotateResultSchema,
41
+ RedactionApplyResultSchema,
42
+ RedactionApplyScopeSchema,
11
43
  PageTextSnapshotSchema,
12
44
  ChangeAnalysisSchema,
13
45
  DocumentVersionsSchema,
14
- SignatureAbortResultSchema,
46
+ SignatureCancelResultSchema,
15
47
  SignatureCompleteBodySchema,
16
48
  SignatureCompleteResultSchema,
17
49
  SignaturePreparedWireSchema,
@@ -152,7 +184,7 @@ var AdminImportSourceSchema = z.discriminatedUnion("kind", [
152
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."
153
185
  )
154
186
  ]).describe(
155
- "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."
156
188
  );
157
189
  var AdminDocumentImportRequestSchema = z.object({
158
190
  source: AdminImportSourceSchema,
@@ -161,7 +193,7 @@ var AdminDocumentImportRequestSchema = z.object({
161
193
  * against the source's declared Content-Length before the transfer,
162
194
  * `sha256` against the server-observed digest after it. When absent
163
195
  * the server-observed values become authoritative.
164
- * `dedupMode=reuse-existing` REQUIRES `sha256` — without a declared
196
+ * `dedupMode=reuse-existing` requires `sha256` — without a declared
165
197
  * hash the server cannot know what content to reuse.
166
198
  */
167
199
  expected: z.object({
@@ -252,7 +284,7 @@ var AdminTokenRevokeRequestSchema = z.object({
252
284
  /** Optional human reason, written to the audit row. */
253
285
  reason: z.string().max(1024).optional(),
254
286
  /**
255
- * 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
256
288
  * once the token would have expired anyway. Defaults server-side to
257
289
  * now + 30 days.
258
290
  */
@@ -319,10 +351,12 @@ var AdminTokenIssueDocRequestSchema = z.object({
319
351
  * vocabulary — an unknown string rejects the whole request.
320
352
  */
321
353
  scope: z.array(z.string().min(1).max(128)).min(1).max(64),
322
- userId: z.string().max(256).optional(),
323
- displayName: z.string().max(256).optional(),
324
- groupId: z.string().max(256).optional(),
325
- 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(),
326
360
  /**
327
361
  * Origin lock: web origins (scheme + host, optional port; one leading
328
362
  * `*.` wildcard label allowed) the minted token may be presented
@@ -770,7 +804,7 @@ var adminOperations = {
770
804
  403: { contentType: "application/json", schema: AdminErrorPayloadSchema },
771
805
  404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
772
806
  },
773
- 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."
774
808
  },
775
809
  "shares.list": {
776
810
  operationId: "shares.list",
@@ -858,10 +892,14 @@ var DocLayerParamsSchema = DocIdParamsSchema.extend({
858
892
  layerName: z.string().min(1)
859
893
  });
860
894
  var DocPageParamsSchema = DocLayerParamsSchema.extend({
861
- 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
+ )
862
898
  });
863
899
  var DocAnnotationParamsSchema = DocPageParamsSchema.extend({
864
- 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
+ )
865
903
  });
866
904
  var DocFieldParamsSchema = DocLayerParamsSchema.extend({
867
905
  fieldKey: z.string().min(1)
@@ -871,9 +909,13 @@ var documentPasswordHeader = {
871
909
  required: false,
872
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."
873
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
+ };
874
917
  var looseJson = z.record(z.string(), z.unknown());
875
918
  var docCredentials = ["api-token", "doc-jwt"];
876
- var MutationResponseSchema = z.object({ meta: MutationMetaSchema }).passthrough();
877
919
  var DocSigningParamsSchema = DocLayerParamsSchema.extend({
878
920
  signingId: z.string().min(1)
879
921
  });
@@ -949,6 +991,22 @@ var docOperations = {
949
991
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
950
992
  }
951
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
+ },
952
1010
  "doc.signatures.list": {
953
1011
  operationId: "doc.signatures.list",
954
1012
  title: "List signatures",
@@ -1003,7 +1061,7 @@ var docOperations = {
1003
1061
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1004
1062
  409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1005
1063
  },
1006
- 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)."
1007
1065
  },
1008
1066
  "doc.signatures.complete": {
1009
1067
  operationId: "doc.signatures.complete",
@@ -1025,19 +1083,19 @@ var docOperations = {
1025
1083
  },
1026
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."
1027
1085
  },
1028
- "doc.signatures.abort": {
1029
- operationId: "doc.signatures.abort",
1030
- title: "Abort a signature",
1086
+ "doc.signatures.cancel": {
1087
+ operationId: "doc.signatures.cancel",
1088
+ title: "Cancel a signature",
1031
1089
  summary: "Discard a pending signing candidate.",
1032
1090
  method: "DELETE",
1033
- path: wireTemplates.layerSignatureAbort,
1091
+ path: wireTemplates.layerSignatureCancel,
1034
1092
  credentials: docCredentials,
1035
1093
  scope: [],
1036
1094
  docCapabilities: ["doc.sign"],
1037
1095
  requestHeaders: [documentPasswordHeader],
1038
1096
  params: DocSigningParamsSchema,
1039
1097
  responses: {
1040
- 200: { contentType: "application/json", schema: SignatureAbortResultSchema },
1098
+ 200: { contentType: "application/json", schema: SignatureCancelResultSchema },
1041
1099
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1042
1100
  }
1043
1101
  },
@@ -1204,7 +1262,7 @@ var docOperations = {
1204
1262
  requestHeaders: [documentPasswordHeader],
1205
1263
  params: DocPageParamsSchema,
1206
1264
  responses: {
1207
- 200: { contentType: "application/json", schema: AnnotationListPageSnapshotSchema },
1265
+ 200: { contentType: "application/json", schema: AnnotationListSchema },
1208
1266
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1209
1267
  }
1210
1268
  },
@@ -1219,13 +1277,42 @@ var docOperations = {
1219
1277
  docCapabilities: ["doc.annotate.read"],
1220
1278
  requestHeaders: [documentPasswordHeader],
1221
1279
  params: DocLayerParamsSchema,
1222
- 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.",
1223
1281
  responses: {
1224
- 200: { contentType: "application/json", schema: AnnotationListSnapshotAllPagesSchema },
1282
+ 200: { contentType: "application/json", schema: AnnotationListSchema },
1225
1283
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1226
1284
  409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1227
1285
  }
1228
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
+ },
1229
1316
  "doc.annotations.create": {
1230
1317
  operationId: "doc.annotations.create",
1231
1318
  title: "Create annotation",
@@ -1235,12 +1322,12 @@ var docOperations = {
1235
1322
  credentials: docCredentials,
1236
1323
  scope: [],
1237
1324
  docCapabilities: ["doc.annotate.modify"],
1238
- requestHeaders: [documentPasswordHeader],
1325
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1239
1326
  params: DocPageParamsSchema,
1240
1327
  body: { contentType: "application/json", schema: looseJson },
1241
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.",
1242
1329
  responses: {
1243
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1330
+ 200: { contentType: "application/json", schema: AnnotationCreateResultSchema },
1244
1331
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1245
1332
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1246
1333
  }
@@ -1254,11 +1341,11 @@ var docOperations = {
1254
1341
  credentials: docCredentials,
1255
1342
  scope: [],
1256
1343
  docCapabilities: ["doc.annotate.modify"],
1257
- requestHeaders: [documentPasswordHeader],
1344
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1258
1345
  params: DocAnnotationParamsSchema,
1259
1346
  body: { contentType: "application/json", schema: looseJson },
1260
1347
  responses: {
1261
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1348
+ 200: { contentType: "application/json", schema: AnnotationUpdateResultSchema },
1262
1349
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1263
1350
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1264
1351
  }
@@ -1272,27 +1359,45 @@ var docOperations = {
1272
1359
  credentials: docCredentials,
1273
1360
  scope: [],
1274
1361
  docCapabilities: ["doc.annotate.modify"],
1275
- requestHeaders: [documentPasswordHeader],
1362
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1276
1363
  params: DocAnnotationParamsSchema,
1277
1364
  responses: {
1278
- 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 },
1279
1384
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1280
1385
  }
1281
1386
  },
1282
1387
  "doc.annotations.flatten": {
1283
1388
  operationId: "doc.annotations.flatten",
1284
1389
  title: "Flatten annotations",
1285
- 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.",
1286
1391
  method: "POST",
1287
1392
  path: wireTemplates.layerAnnotationItemsFlatten,
1288
1393
  credentials: docCredentials,
1289
1394
  scope: [],
1290
1395
  docCapabilities: ["doc.pages.modify", "doc.annotate.modify"],
1291
- requestHeaders: [documentPasswordHeader],
1396
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1292
1397
  params: DocPageParamsSchema,
1293
1398
  body: { contentType: "application/json", schema: looseJson },
1294
1399
  responses: {
1295
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1400
+ 200: { contentType: "application/json", schema: AnnotationFlattenResultSchema },
1296
1401
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1297
1402
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1298
1403
  }
@@ -1315,10 +1420,27 @@ var docOperations = {
1315
1420
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1316
1421
  }
1317
1422
  },
1318
- "doc.forms.get": {
1319
- operationId: "doc.forms.get",
1320
- title: "Get form snapshot",
1321
- 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.",
1322
1444
  method: "GET",
1323
1445
  path: wireTemplates.layerForm,
1324
1446
  credentials: docCredentials,
@@ -1340,80 +1462,152 @@ var docOperations = {
1340
1462
  credentials: docCredentials,
1341
1463
  scope: [],
1342
1464
  docCapabilities: ["doc.forms.fill"],
1343
- requestHeaders: [documentPasswordHeader],
1465
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1344
1466
  params: DocFieldParamsSchema,
1345
1467
  body: { contentType: "application/json", schema: looseJson },
1346
1468
  responses: {
1347
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1469
+ 200: { contentType: "application/json", schema: FormSetValueResultSchema },
1470
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1471
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1472
+ }
1473
+ },
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.",
1513
+ method: "POST",
1514
+ path: wireTemplates.layerFormWidgetsReorder,
1515
+ credentials: docCredentials,
1516
+ scope: [],
1517
+ docCapabilities: ["doc.forms.modify"],
1518
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1519
+ params: DocPageParamsSchema,
1520
+ body: { contentType: "application/json", schema: FormWidgetsReorderBodySchema },
1521
+ responses: {
1522
+ 200: { contentType: "application/json", schema: FormWidgetsReorderResultSchema },
1523
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1524
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1525
+ }
1526
+ },
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,
1533
+ credentials: docCredentials,
1534
+ scope: [],
1535
+ docCapabilities: ["doc.forms.modify"],
1536
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1537
+ params: DocLayerParamsSchema,
1538
+ body: { contentType: "application/json", schema: FormCalculationsReorderBodySchema },
1539
+ responses: {
1540
+ 200: { contentType: "application/json", schema: FormCalculationsReorderResultSchema },
1348
1541
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1349
1542
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1350
1543
  }
1351
1544
  },
1352
1545
  "doc.forms.reset": {
1353
1546
  operationId: "doc.forms.reset",
1354
- title: "Reset form field",
1355
- summary: "Reset one form field to its default value.",
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.",
1356
1549
  method: "POST",
1357
- path: wireTemplates.layerFormFieldReset,
1550
+ path: wireTemplates.layerFormReset,
1358
1551
  credentials: docCredentials,
1359
1552
  scope: [],
1360
1553
  docCapabilities: ["doc.forms.fill"],
1361
- requestHeaders: [documentPasswordHeader],
1362
- params: DocFieldParamsSchema,
1554
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1555
+ params: DocLayerParamsSchema,
1556
+ body: { contentType: "application/json", schema: FormResetBodySchema },
1363
1557
  responses: {
1364
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1558
+ 200: { contentType: "application/json", schema: FormResetResultSchema },
1559
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1365
1560
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1366
1561
  }
1367
1562
  },
1368
- "doc.forms.exportData": {
1369
- operationId: "doc.forms.exportData",
1370
- title: "Export form data",
1371
- summary: "Export form data as FDF or XFDF.",
1563
+ "doc.pages.viewports": {
1564
+ operationId: "doc.pages.viewports",
1565
+ title: "Read measurement viewports",
1566
+ summary: "Read page measurement viewports in drawing order from the current layer.",
1372
1567
  method: "GET",
1373
- path: wireTemplates.layerFormData,
1568
+ path: wireTemplates.layerPageViewports,
1374
1569
  credentials: docCredentials,
1375
1570
  scope: [],
1376
- docCapabilities: ["doc.forms.read"],
1571
+ docCapabilities: ["doc.open"],
1377
1572
  requestHeaders: [documentPasswordHeader],
1378
- params: DocLayerParamsSchema,
1379
- query: z.object({ format: z.enum(["fdf", "xfdf"]).optional() }),
1573
+ params: DocPageParamsSchema,
1380
1574
  responses: {
1381
- 200: { contentType: ["application/vnd.adobe.xfdf", "application/vnd.fdf"] },
1575
+ 200: { contentType: "application/json", schema: PageMeasurementViewportListSchema },
1382
1576
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1383
1577
  }
1384
1578
  },
1385
- "doc.forms.importData": {
1386
- operationId: "doc.forms.importData",
1387
- title: "Import form data",
1388
- summary: "Import form data (FDF/XFDF), filling matching fields.",
1389
- method: "POST",
1390
- path: wireTemplates.layerFormData,
1579
+ "doc.pages.setScale": {
1580
+ operationId: "doc.pages.setScale",
1581
+ title: "Set page measurement scale",
1582
+ summary: "Upsert or remove EmbedPDF calibration while preserving foreign viewports. Existing annotation scales are unchanged.",
1583
+ method: "PUT",
1584
+ path: wireTemplates.layerPageScale,
1391
1585
  credentials: docCredentials,
1392
1586
  scope: [],
1393
- docCapabilities: ["doc.forms.fill"],
1394
- requestHeaders: [documentPasswordHeader],
1395
- params: DocLayerParamsSchema,
1396
- body: { contentType: "application/json", schema: looseJson },
1587
+ docCapabilities: ["doc.annotate.modify"],
1588
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1589
+ params: DocPageParamsSchema,
1590
+ body: { contentType: "application/json", schema: PageScaleInputSchema },
1397
1591
  responses: {
1398
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1592
+ 200: { contentType: "application/json", schema: PageScaleResultSchema },
1399
1593
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1400
1594
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1401
1595
  }
1402
1596
  },
1403
- "doc.pages.move": {
1404
- operationId: "doc.pages.move",
1405
- title: "Move pages",
1406
- 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.",
1407
1601
  method: "POST",
1408
- path: wireTemplates.layerPagesMove,
1602
+ path: wireTemplates.layerPagesReorder,
1409
1603
  credentials: docCredentials,
1410
1604
  scope: [],
1411
1605
  docCapabilities: ["doc.pages.assemble"],
1412
- requestHeaders: [documentPasswordHeader],
1606
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1413
1607
  params: DocLayerParamsSchema,
1414
- body: { contentType: "application/json", schema: looseJson },
1608
+ body: { contentType: "application/json", schema: PageReorderInputSchema },
1415
1609
  responses: {
1416
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1610
+ 200: { contentType: "application/json", schema: PageReorderResultSchema },
1417
1611
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1418
1612
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1419
1613
  }
@@ -1427,11 +1621,11 @@ var docOperations = {
1427
1621
  credentials: docCredentials,
1428
1622
  scope: [],
1429
1623
  docCapabilities: ["doc.pages.assemble"],
1430
- requestHeaders: [documentPasswordHeader],
1624
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1431
1625
  params: DocLayerParamsSchema,
1432
1626
  body: { contentType: "application/json", schema: looseJson },
1433
1627
  responses: {
1434
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1628
+ 200: { contentType: "application/json", schema: PageRotateResultSchema },
1435
1629
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1436
1630
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1437
1631
  }
@@ -1445,11 +1639,11 @@ var docOperations = {
1445
1639
  credentials: docCredentials,
1446
1640
  scope: [],
1447
1641
  docCapabilities: ["doc.pages.assemble"],
1448
- requestHeaders: [documentPasswordHeader],
1642
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1449
1643
  params: DocLayerParamsSchema,
1450
1644
  body: { contentType: "application/json", schema: looseJson },
1451
1645
  responses: {
1452
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1646
+ 200: { contentType: "application/json", schema: PageDeleteResultSchema },
1453
1647
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1454
1648
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1455
1649
  }
@@ -1463,11 +1657,11 @@ var docOperations = {
1463
1657
  credentials: docCredentials,
1464
1658
  scope: [],
1465
1659
  docCapabilities: ["doc.pages.assemble"],
1466
- requestHeaders: [documentPasswordHeader],
1660
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1467
1661
  params: DocLayerParamsSchema,
1468
1662
  body: { contentType: "application/json", schema: looseJson },
1469
1663
  responses: {
1470
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1664
+ 200: { contentType: "application/json", schema: PageNameResultSchema },
1471
1665
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1472
1666
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1473
1667
  }
@@ -1481,11 +1675,11 @@ var docOperations = {
1481
1675
  credentials: docCredentials,
1482
1676
  scope: [],
1483
1677
  docCapabilities: ["doc.pages.assemble"],
1484
- requestHeaders: [documentPasswordHeader],
1678
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1485
1679
  params: DocLayerParamsSchema,
1486
1680
  body: { contentType: "application/json", schema: looseJson },
1487
1681
  responses: {
1488
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1682
+ 200: { contentType: "application/json", schema: PageNameResultSchema },
1489
1683
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1490
1684
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1491
1685
  }
@@ -1499,11 +1693,11 @@ var docOperations = {
1499
1693
  credentials: docCredentials,
1500
1694
  scope: [],
1501
1695
  docCapabilities: ["doc.pages.modify", "doc.annotate.modify"],
1502
- requestHeaders: [documentPasswordHeader],
1696
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1503
1697
  params: DocLayerParamsSchema,
1504
1698
  body: { contentType: "application/json", schema: looseJson, required: false },
1505
1699
  responses: {
1506
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1700
+ 200: { contentType: "application/json", schema: PageFlattenResultSchema },
1507
1701
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1508
1702
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1509
1703
  }
@@ -1517,36 +1711,36 @@ var docOperations = {
1517
1711
  credentials: docCredentials,
1518
1712
  scope: [],
1519
1713
  docCapabilities: ["doc.pages.assemble"],
1520
- requestHeaders: [documentPasswordHeader],
1714
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1521
1715
  params: DocLayerParamsSchema,
1522
1716
  body: {
1523
1717
  contentType: "multipart/form-data"
1524
1718
  },
1525
1719
  responses: {
1526
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1720
+ 200: { contentType: "application/json", schema: PageInsertResultSchema },
1527
1721
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1528
1722
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1529
1723
  },
1530
- 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.'
1531
1725
  },
1532
1726
  "doc.pages.insertBlank": {
1533
1727
  operationId: "doc.pages.insertBlank",
1534
1728
  title: "Insert blank pages",
1535
- summary: "Create blank pages of an explicit size at an index.",
1729
+ summary: "Create blank pages of an explicit size at a position.",
1536
1730
  method: "POST",
1537
1731
  path: wireTemplates.layerPagesInsertBlank,
1538
1732
  credentials: docCredentials,
1539
1733
  scope: [],
1540
1734
  docCapabilities: ["doc.pages.assemble"],
1541
- requestHeaders: [documentPasswordHeader],
1735
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1542
1736
  params: DocLayerParamsSchema,
1543
1737
  body: { contentType: "application/json", schema: looseJson },
1544
1738
  responses: {
1545
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1739
+ 200: { contentType: "application/json", schema: PageInsertResultSchema },
1546
1740
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1547
1741
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1548
1742
  },
1549
- 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).'
1550
1744
  },
1551
1745
  "doc.pages.extract": {
1552
1746
  operationId: "doc.pages.extract",
@@ -1565,7 +1759,7 @@ var docOperations = {
1565
1759
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1566
1760
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1567
1761
  },
1568
- 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.'
1569
1763
  },
1570
1764
  "doc.redactions.apply": {
1571
1765
  operationId: "doc.redactions.apply",
@@ -1576,11 +1770,11 @@ var docOperations = {
1576
1770
  credentials: docCredentials,
1577
1771
  scope: [],
1578
1772
  docCapabilities: ["doc.pages.modify", "doc.annotate.modify", "doc.redact"],
1579
- requestHeaders: [documentPasswordHeader],
1773
+ requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
1580
1774
  params: DocLayerParamsSchema,
1581
- body: { contentType: "application/json", schema: looseJson, required: false },
1775
+ body: { contentType: "application/json", schema: RedactionApplyScopeSchema },
1582
1776
  responses: {
1583
- 200: { contentType: "application/json", schema: MutationResponseSchema },
1777
+ 200: { contentType: "application/json", schema: RedactionApplyResultSchema },
1584
1778
  400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1585
1779
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1586
1780
  }
@@ -1613,6 +1807,7 @@ var docsGroups = {
1613
1807
  "doc.annotations": { title: "Annotations" },
1614
1808
  "doc.forms": { title: "Forms" },
1615
1809
  "doc.metadata": { title: "Metadata" },
1810
+ "doc.metadata.custom": { title: "Custom keys" },
1616
1811
  "doc.pages": { title: "Pages" },
1617
1812
  "doc.redactions": { title: "Redactions" },
1618
1813
  "doc.signatures": { title: "Digital signatures" },
@@ -1687,6 +1882,7 @@ export {
1687
1882
  docOperations,
1688
1883
  docsGroups,
1689
1884
  documentPasswordHeader,
1885
+ idempotencyKeyHeader,
1690
1886
  tenantIdPattern
1691
1887
  };
1692
1888
  //# sourceMappingURL=index.js.map