@cloudpdf/contract 3.0.0-next.15 → 3.0.0-next.16
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.d.ts +2764 -1213
- package/dist/index.js +87 -102
- package/dist/index.js.map +1 -1
- package/dist/openapi.js +90 -102
- package/dist/openapi.js.map +1 -1
- package/openapi.json +3261 -3359
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
DocumentManifestSchema,
|
|
19
19
|
CustomMetadataSchema,
|
|
20
20
|
DocumentMetadataSchema,
|
|
21
|
+
DocumentOutlineSchema,
|
|
21
22
|
EngineErrorPayloadSchema,
|
|
22
23
|
FormResetBodySchema,
|
|
23
24
|
FormWidgetDeleteResultSchema,
|
|
@@ -31,13 +32,8 @@ import {
|
|
|
31
32
|
FormSetValueResultSchema,
|
|
32
33
|
FormSnapshotSchema,
|
|
33
34
|
IdentitySchema,
|
|
34
|
-
PageDeleteResultSchema,
|
|
35
35
|
PageFlattenResultSchema,
|
|
36
|
-
PageInsertResultSchema,
|
|
37
|
-
PageReorderInputSchema,
|
|
38
|
-
PageReorderResultSchema,
|
|
39
36
|
PageNameResultSchema,
|
|
40
|
-
PageRotateResultSchema,
|
|
41
37
|
RedactionApplyResultSchema,
|
|
42
38
|
RedactionApplyScopeSchema,
|
|
43
39
|
PageTextSnapshotSchema,
|
|
@@ -48,6 +44,7 @@ import {
|
|
|
48
44
|
SignatureCompleteResultSchema,
|
|
49
45
|
SignaturePreparedWireSchema,
|
|
50
46
|
SignatureSnapshotSchema,
|
|
47
|
+
AttachmentListSchema,
|
|
51
48
|
wireTemplates
|
|
52
49
|
} from "@embedpdf/engine-core/wire";
|
|
53
50
|
import { z } from "zod";
|
|
@@ -904,6 +901,11 @@ var DocAnnotationParamsSchema = DocPageParamsSchema.extend({
|
|
|
904
901
|
var DocFieldParamsSchema = DocLayerParamsSchema.extend({
|
|
905
902
|
fieldKey: z.string().min(1)
|
|
906
903
|
});
|
|
904
|
+
var DocAttachmentParamsSchema = DocLayerParamsSchema.extend({
|
|
905
|
+
fileKey: z.string().min(1).describe(
|
|
906
|
+
"The embedded file's name-tree key (its `ref.key`), token-text encoded, as `fieldKey` is."
|
|
907
|
+
)
|
|
908
|
+
});
|
|
907
909
|
var documentPasswordHeader = {
|
|
908
910
|
name: "X-Document-Password",
|
|
909
911
|
required: false,
|
|
@@ -1007,6 +1009,58 @@ var docOperations = {
|
|
|
1007
1009
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1008
1010
|
}
|
|
1009
1011
|
},
|
|
1012
|
+
"doc.outline.get": {
|
|
1013
|
+
operationId: "doc.outline.get",
|
|
1014
|
+
title: "Get outline",
|
|
1015
|
+
summary: "The document's outline (its bookmarks) for a layer: every item, depth first, with its parent, its target in page space, its look and whether it opens. Edit it with the outline ops of a change.",
|
|
1016
|
+
method: "GET",
|
|
1017
|
+
path: wireTemplates.layerOutline,
|
|
1018
|
+
credentials: docCredentials,
|
|
1019
|
+
scope: [],
|
|
1020
|
+
docCapabilities: ["doc.open"],
|
|
1021
|
+
requestHeaders: [documentPasswordHeader],
|
|
1022
|
+
params: DocLayerParamsSchema,
|
|
1023
|
+
responses: {
|
|
1024
|
+
200: { contentType: "application/json", schema: DocumentOutlineSchema },
|
|
1025
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
"doc.attachments.list": {
|
|
1029
|
+
operationId: "doc.attachments.list",
|
|
1030
|
+
title: "List attachments",
|
|
1031
|
+
summary: "The files embedded in the document (its /EmbeddedFiles) for a layer, in key order: each with its name, type, description, size, checksum and dates, never its bytes. Add and remove them with the attachment ops of a change.",
|
|
1032
|
+
method: "GET",
|
|
1033
|
+
path: wireTemplates.layerAttachments,
|
|
1034
|
+
credentials: docCredentials,
|
|
1035
|
+
scope: [],
|
|
1036
|
+
docCapabilities: ["doc.open"],
|
|
1037
|
+
requestHeaders: [documentPasswordHeader],
|
|
1038
|
+
params: DocLayerParamsSchema,
|
|
1039
|
+
responses: {
|
|
1040
|
+
200: { contentType: "application/json", schema: AttachmentListSchema },
|
|
1041
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1042
|
+
},
|
|
1043
|
+
notes: "A file-attachment annotation's file is listed with the annotation; read its bytes with `doc.annotations.readFile`."
|
|
1044
|
+
},
|
|
1045
|
+
"doc.attachments.download": {
|
|
1046
|
+
operationId: "doc.attachments.download",
|
|
1047
|
+
title: "Download an attachment",
|
|
1048
|
+
summary: "One embedded file's bytes, decoded. Its name and type are what the listing says; `Content-Type` is its type, or `application/octet-stream` when it has none.",
|
|
1049
|
+
method: "GET",
|
|
1050
|
+
path: wireTemplates.layerAttachmentFile,
|
|
1051
|
+
credentials: docCredentials,
|
|
1052
|
+
scope: [],
|
|
1053
|
+
docCapabilities: ["doc.download"],
|
|
1054
|
+
requestHeaders: [documentPasswordHeader],
|
|
1055
|
+
params: DocAttachmentParamsSchema,
|
|
1056
|
+
responses: {
|
|
1057
|
+
200: { contentType: "application/octet-stream" },
|
|
1058
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1059
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1060
|
+
413: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1061
|
+
},
|
|
1062
|
+
notes: "A file that decodes past the server's limit is refused (PayloadTooLarge)."
|
|
1063
|
+
},
|
|
1010
1064
|
"doc.signatures.list": {
|
|
1011
1065
|
operationId: "doc.signatures.list",
|
|
1012
1066
|
title: "List signatures",
|
|
@@ -1294,9 +1348,12 @@ var docOperations = {
|
|
|
1294
1348
|
scope: [],
|
|
1295
1349
|
docCapabilities: [
|
|
1296
1350
|
"doc.annotate.modify",
|
|
1351
|
+
"doc.attachments.modify",
|
|
1297
1352
|
"doc.forms.fill",
|
|
1298
1353
|
"doc.forms.modify",
|
|
1299
|
-
"doc.metadata.modify"
|
|
1354
|
+
"doc.metadata.modify",
|
|
1355
|
+
"doc.outline.modify",
|
|
1356
|
+
"doc.pages.assemble"
|
|
1300
1357
|
],
|
|
1301
1358
|
requestHeaders: [documentPasswordHeader],
|
|
1302
1359
|
params: DocLayerParamsSchema,
|
|
@@ -1304,7 +1361,7 @@ var docOperations = {
|
|
|
1304
1361
|
contentType: ["application/json", "multipart/form-data"],
|
|
1305
1362
|
schema: ChangeRequestSchema
|
|
1306
1363
|
},
|
|
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.",
|
|
1364
|
+
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`, outline `doc.outline.modify`, pages `doc.pages.assemble`, embedded files `doc.attachments.modify`. Bytes (a stamp's drawing, an attached file, a signature's artwork, a PDF whose pages come in) 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
1365
|
responses: {
|
|
1309
1366
|
200: { contentType: "application/json", schema: ChangeResponseSchema },
|
|
1310
1367
|
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
@@ -1437,6 +1494,25 @@ var docOperations = {
|
|
|
1437
1494
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1438
1495
|
}
|
|
1439
1496
|
},
|
|
1497
|
+
"doc.annotations.readFile": {
|
|
1498
|
+
operationId: "doc.annotations.readFile",
|
|
1499
|
+
title: "Read an attached file",
|
|
1500
|
+
summary: "A file-attachment annotation's file, decoded: its `file` resource. Its name and type are what the annotation's `file` says. A read; the source is untouched.",
|
|
1501
|
+
method: "GET",
|
|
1502
|
+
path: wireTemplates.layerAnnotationItemFileResource,
|
|
1503
|
+
credentials: docCredentials,
|
|
1504
|
+
scope: [],
|
|
1505
|
+
docCapabilities: ["doc.download"],
|
|
1506
|
+
requestHeaders: [documentPasswordHeader],
|
|
1507
|
+
params: DocAnnotationParamsSchema,
|
|
1508
|
+
responses: {
|
|
1509
|
+
200: { contentType: "application/octet-stream" },
|
|
1510
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1511
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1512
|
+
413: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1513
|
+
},
|
|
1514
|
+
notes: "A file that decodes past the server's limit is refused (PayloadTooLarge)."
|
|
1515
|
+
},
|
|
1440
1516
|
"doc.forms.list": {
|
|
1441
1517
|
operationId: "doc.forms.list",
|
|
1442
1518
|
title: "List form fields",
|
|
@@ -1594,60 +1670,6 @@ var docOperations = {
|
|
|
1594
1670
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1595
1671
|
}
|
|
1596
1672
|
},
|
|
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.",
|
|
1601
|
-
method: "POST",
|
|
1602
|
-
path: wireTemplates.layerPagesReorder,
|
|
1603
|
-
credentials: docCredentials,
|
|
1604
|
-
scope: [],
|
|
1605
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1606
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1607
|
-
params: DocLayerParamsSchema,
|
|
1608
|
-
body: { contentType: "application/json", schema: PageReorderInputSchema },
|
|
1609
|
-
responses: {
|
|
1610
|
-
200: { contentType: "application/json", schema: PageReorderResultSchema },
|
|
1611
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1612
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1613
|
-
}
|
|
1614
|
-
},
|
|
1615
|
-
"doc.pages.rotate": {
|
|
1616
|
-
operationId: "doc.pages.rotate",
|
|
1617
|
-
title: "Rotate pages",
|
|
1618
|
-
summary: "Set absolute rotation on pages.",
|
|
1619
|
-
method: "POST",
|
|
1620
|
-
path: wireTemplates.layerPagesRotate,
|
|
1621
|
-
credentials: docCredentials,
|
|
1622
|
-
scope: [],
|
|
1623
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1624
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1625
|
-
params: DocLayerParamsSchema,
|
|
1626
|
-
body: { contentType: "application/json", schema: looseJson },
|
|
1627
|
-
responses: {
|
|
1628
|
-
200: { contentType: "application/json", schema: PageRotateResultSchema },
|
|
1629
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1630
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1631
|
-
}
|
|
1632
|
-
},
|
|
1633
|
-
"doc.pages.delete": {
|
|
1634
|
-
operationId: "doc.pages.delete",
|
|
1635
|
-
title: "Delete pages",
|
|
1636
|
-
summary: "Delete pages.",
|
|
1637
|
-
method: "POST",
|
|
1638
|
-
path: wireTemplates.layerPagesDelete,
|
|
1639
|
-
credentials: docCredentials,
|
|
1640
|
-
scope: [],
|
|
1641
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1642
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1643
|
-
params: DocLayerParamsSchema,
|
|
1644
|
-
body: { contentType: "application/json", schema: looseJson },
|
|
1645
|
-
responses: {
|
|
1646
|
-
200: { contentType: "application/json", schema: PageDeleteResultSchema },
|
|
1647
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1648
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1649
|
-
}
|
|
1650
|
-
},
|
|
1651
1673
|
"doc.pages.setName": {
|
|
1652
1674
|
operationId: "doc.pages.setName",
|
|
1653
1675
|
title: "Set page name",
|
|
@@ -1702,46 +1724,6 @@ var docOperations = {
|
|
|
1702
1724
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1703
1725
|
}
|
|
1704
1726
|
},
|
|
1705
|
-
"doc.pages.insert": {
|
|
1706
|
-
operationId: "doc.pages.insert",
|
|
1707
|
-
title: "Insert pages from a PDF",
|
|
1708
|
-
summary: "Copy every page of an uploaded PDF into the document at an index.",
|
|
1709
|
-
method: "POST",
|
|
1710
|
-
path: wireTemplates.layerPagesInsert,
|
|
1711
|
-
credentials: docCredentials,
|
|
1712
|
-
scope: [],
|
|
1713
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1714
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1715
|
-
params: DocLayerParamsSchema,
|
|
1716
|
-
body: {
|
|
1717
|
-
contentType: "multipart/form-data"
|
|
1718
|
-
},
|
|
1719
|
-
responses: {
|
|
1720
|
-
200: { contentType: "application/json", schema: PageInsertResultSchema },
|
|
1721
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1722
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1723
|
-
},
|
|
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.'
|
|
1725
|
-
},
|
|
1726
|
-
"doc.pages.insertBlank": {
|
|
1727
|
-
operationId: "doc.pages.insertBlank",
|
|
1728
|
-
title: "Insert blank pages",
|
|
1729
|
-
summary: "Create blank pages of an explicit size at a position.",
|
|
1730
|
-
method: "POST",
|
|
1731
|
-
path: wireTemplates.layerPagesInsertBlank,
|
|
1732
|
-
credentials: docCredentials,
|
|
1733
|
-
scope: [],
|
|
1734
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1735
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1736
|
-
params: DocLayerParamsSchema,
|
|
1737
|
-
body: { contentType: "application/json", schema: looseJson },
|
|
1738
|
-
responses: {
|
|
1739
|
-
200: { contentType: "application/json", schema: PageInsertResultSchema },
|
|
1740
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1741
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1742
|
-
},
|
|
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).'
|
|
1744
|
-
},
|
|
1745
1727
|
"doc.pages.extract": {
|
|
1746
1728
|
operationId: "doc.pages.extract",
|
|
1747
1729
|
title: "Extract pages",
|
|
@@ -1759,7 +1741,7 @@ var docOperations = {
|
|
|
1759
1741
|
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1760
1742
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1761
1743
|
},
|
|
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.'
|
|
1744
|
+
notes: 'A read, not a mutation: the source document is untouched and no event is published. Body is `{"pages": PageRef[], "flatten"?: {"usage"?: "display" | "print"}, "includeAnnotations"?: boolean, "includeFormFields"?: boolean}`; the response body is the new PDF. With `flatten` the copy is the pages as they draw for `usage` (`"print"`: a print copy): the annotations and form fields painted in, nothing interactive left, layers in their state for the usage. A flattened copy takes `doc.download` or `doc.download.flattened`, and paints only what the caller may read; `includeAnnotations` and `includeFormFields` choose what it paints, and are refused without `flatten`.'
|
|
1763
1745
|
},
|
|
1764
1746
|
"doc.redactions.apply": {
|
|
1765
1747
|
operationId: "doc.redactions.apply",
|
|
@@ -1805,9 +1787,11 @@ var docsGroups = {
|
|
|
1805
1787
|
shares: { title: "Shares" },
|
|
1806
1788
|
doc: { title: "Document operations", slug: "document-operations" },
|
|
1807
1789
|
"doc.annotations": { title: "Annotations" },
|
|
1790
|
+
"doc.attachments": { title: "Attachments" },
|
|
1808
1791
|
"doc.forms": { title: "Forms" },
|
|
1809
1792
|
"doc.metadata": { title: "Metadata" },
|
|
1810
1793
|
"doc.metadata.custom": { title: "Custom keys" },
|
|
1794
|
+
"doc.outline": { title: "Outline" },
|
|
1811
1795
|
"doc.pages": { title: "Pages" },
|
|
1812
1796
|
"doc.redactions": { title: "Redactions" },
|
|
1813
1797
|
"doc.signatures": { title: "Digital signatures" },
|
|
@@ -1850,6 +1834,7 @@ export {
|
|
|
1850
1834
|
AdminUploadProxyResponseSchema,
|
|
1851
1835
|
DedupModeSchema,
|
|
1852
1836
|
DocAnnotationParamsSchema,
|
|
1837
|
+
DocAttachmentParamsSchema,
|
|
1853
1838
|
DocFieldParamsSchema,
|
|
1854
1839
|
DocIdParamsSchema,
|
|
1855
1840
|
DocLayerParamsSchema,
|