@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/openapi.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// src/openapi.ts
|
|
2
2
|
import {
|
|
3
3
|
AnnotationWireComponents,
|
|
4
|
+
AttachmentWireComponents,
|
|
4
5
|
ChangeWireComponents,
|
|
5
6
|
DocumentWireComponents,
|
|
6
7
|
EngineErrorPayloadSchema as EngineErrorPayloadSchema2,
|
|
7
8
|
FormWireComponents,
|
|
9
|
+
OutlineWireComponents,
|
|
8
10
|
PdfActionWireComponents
|
|
9
11
|
} from "@embedpdf/engine-core/wire";
|
|
10
12
|
import { z as z2 } from "zod";
|
|
@@ -30,6 +32,7 @@ import {
|
|
|
30
32
|
DocumentManifestSchema,
|
|
31
33
|
CustomMetadataSchema,
|
|
32
34
|
DocumentMetadataSchema,
|
|
35
|
+
DocumentOutlineSchema,
|
|
33
36
|
EngineErrorPayloadSchema,
|
|
34
37
|
FormResetBodySchema,
|
|
35
38
|
FormWidgetDeleteResultSchema,
|
|
@@ -43,13 +46,8 @@ import {
|
|
|
43
46
|
FormSetValueResultSchema,
|
|
44
47
|
FormSnapshotSchema,
|
|
45
48
|
IdentitySchema,
|
|
46
|
-
PageDeleteResultSchema,
|
|
47
49
|
PageFlattenResultSchema,
|
|
48
|
-
PageInsertResultSchema,
|
|
49
|
-
PageReorderInputSchema,
|
|
50
|
-
PageReorderResultSchema,
|
|
51
50
|
PageNameResultSchema,
|
|
52
|
-
PageRotateResultSchema,
|
|
53
51
|
RedactionApplyResultSchema,
|
|
54
52
|
RedactionApplyScopeSchema,
|
|
55
53
|
PageTextSnapshotSchema,
|
|
@@ -60,6 +58,7 @@ import {
|
|
|
60
58
|
SignatureCompleteResultSchema,
|
|
61
59
|
SignaturePreparedWireSchema,
|
|
62
60
|
SignatureSnapshotSchema,
|
|
61
|
+
AttachmentListSchema,
|
|
63
62
|
wireTemplates
|
|
64
63
|
} from "@embedpdf/engine-core/wire";
|
|
65
64
|
import { z } from "zod";
|
|
@@ -915,6 +914,11 @@ var DocAnnotationParamsSchema = DocPageParamsSchema.extend({
|
|
|
915
914
|
var DocFieldParamsSchema = DocLayerParamsSchema.extend({
|
|
916
915
|
fieldKey: z.string().min(1)
|
|
917
916
|
});
|
|
917
|
+
var DocAttachmentParamsSchema = DocLayerParamsSchema.extend({
|
|
918
|
+
fileKey: z.string().min(1).describe(
|
|
919
|
+
"The embedded file's name-tree key (its `ref.key`), token-text encoded, as `fieldKey` is."
|
|
920
|
+
)
|
|
921
|
+
});
|
|
918
922
|
var documentPasswordHeader = {
|
|
919
923
|
name: "X-Document-Password",
|
|
920
924
|
required: false,
|
|
@@ -1018,6 +1022,58 @@ var docOperations = {
|
|
|
1018
1022
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1019
1023
|
}
|
|
1020
1024
|
},
|
|
1025
|
+
"doc.outline.get": {
|
|
1026
|
+
operationId: "doc.outline.get",
|
|
1027
|
+
title: "Get outline",
|
|
1028
|
+
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.",
|
|
1029
|
+
method: "GET",
|
|
1030
|
+
path: wireTemplates.layerOutline,
|
|
1031
|
+
credentials: docCredentials,
|
|
1032
|
+
scope: [],
|
|
1033
|
+
docCapabilities: ["doc.open"],
|
|
1034
|
+
requestHeaders: [documentPasswordHeader],
|
|
1035
|
+
params: DocLayerParamsSchema,
|
|
1036
|
+
responses: {
|
|
1037
|
+
200: { contentType: "application/json", schema: DocumentOutlineSchema },
|
|
1038
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
"doc.attachments.list": {
|
|
1042
|
+
operationId: "doc.attachments.list",
|
|
1043
|
+
title: "List attachments",
|
|
1044
|
+
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.",
|
|
1045
|
+
method: "GET",
|
|
1046
|
+
path: wireTemplates.layerAttachments,
|
|
1047
|
+
credentials: docCredentials,
|
|
1048
|
+
scope: [],
|
|
1049
|
+
docCapabilities: ["doc.open"],
|
|
1050
|
+
requestHeaders: [documentPasswordHeader],
|
|
1051
|
+
params: DocLayerParamsSchema,
|
|
1052
|
+
responses: {
|
|
1053
|
+
200: { contentType: "application/json", schema: AttachmentListSchema },
|
|
1054
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1055
|
+
},
|
|
1056
|
+
notes: "A file-attachment annotation's file is listed with the annotation; read its bytes with `doc.annotations.readFile`."
|
|
1057
|
+
},
|
|
1058
|
+
"doc.attachments.download": {
|
|
1059
|
+
operationId: "doc.attachments.download",
|
|
1060
|
+
title: "Download an attachment",
|
|
1061
|
+
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.",
|
|
1062
|
+
method: "GET",
|
|
1063
|
+
path: wireTemplates.layerAttachmentFile,
|
|
1064
|
+
credentials: docCredentials,
|
|
1065
|
+
scope: [],
|
|
1066
|
+
docCapabilities: ["doc.download"],
|
|
1067
|
+
requestHeaders: [documentPasswordHeader],
|
|
1068
|
+
params: DocAttachmentParamsSchema,
|
|
1069
|
+
responses: {
|
|
1070
|
+
200: { contentType: "application/octet-stream" },
|
|
1071
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1072
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1073
|
+
413: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1074
|
+
},
|
|
1075
|
+
notes: "A file that decodes past the server's limit is refused (PayloadTooLarge)."
|
|
1076
|
+
},
|
|
1021
1077
|
"doc.signatures.list": {
|
|
1022
1078
|
operationId: "doc.signatures.list",
|
|
1023
1079
|
title: "List signatures",
|
|
@@ -1305,9 +1361,12 @@ var docOperations = {
|
|
|
1305
1361
|
scope: [],
|
|
1306
1362
|
docCapabilities: [
|
|
1307
1363
|
"doc.annotate.modify",
|
|
1364
|
+
"doc.attachments.modify",
|
|
1308
1365
|
"doc.forms.fill",
|
|
1309
1366
|
"doc.forms.modify",
|
|
1310
|
-
"doc.metadata.modify"
|
|
1367
|
+
"doc.metadata.modify",
|
|
1368
|
+
"doc.outline.modify",
|
|
1369
|
+
"doc.pages.assemble"
|
|
1311
1370
|
],
|
|
1312
1371
|
requestHeaders: [documentPasswordHeader],
|
|
1313
1372
|
params: DocLayerParamsSchema,
|
|
@@ -1315,7 +1374,7 @@ var docOperations = {
|
|
|
1315
1374
|
contentType: ["application/json", "multipart/form-data"],
|
|
1316
1375
|
schema: ChangeRequestSchema
|
|
1317
1376
|
},
|
|
1318
|
-
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.",
|
|
1377
|
+
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.",
|
|
1319
1378
|
responses: {
|
|
1320
1379
|
200: { contentType: "application/json", schema: ChangeResponseSchema },
|
|
1321
1380
|
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
@@ -1448,6 +1507,25 @@ var docOperations = {
|
|
|
1448
1507
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1449
1508
|
}
|
|
1450
1509
|
},
|
|
1510
|
+
"doc.annotations.readFile": {
|
|
1511
|
+
operationId: "doc.annotations.readFile",
|
|
1512
|
+
title: "Read an attached file",
|
|
1513
|
+
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.",
|
|
1514
|
+
method: "GET",
|
|
1515
|
+
path: wireTemplates.layerAnnotationItemFileResource,
|
|
1516
|
+
credentials: docCredentials,
|
|
1517
|
+
scope: [],
|
|
1518
|
+
docCapabilities: ["doc.download"],
|
|
1519
|
+
requestHeaders: [documentPasswordHeader],
|
|
1520
|
+
params: DocAnnotationParamsSchema,
|
|
1521
|
+
responses: {
|
|
1522
|
+
200: { contentType: "application/octet-stream" },
|
|
1523
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1524
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1525
|
+
413: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1526
|
+
},
|
|
1527
|
+
notes: "A file that decodes past the server's limit is refused (PayloadTooLarge)."
|
|
1528
|
+
},
|
|
1451
1529
|
"doc.forms.list": {
|
|
1452
1530
|
operationId: "doc.forms.list",
|
|
1453
1531
|
title: "List form fields",
|
|
@@ -1605,60 +1683,6 @@ var docOperations = {
|
|
|
1605
1683
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1606
1684
|
}
|
|
1607
1685
|
},
|
|
1608
|
-
"doc.pages.reorder": {
|
|
1609
|
-
operationId: "doc.pages.reorder",
|
|
1610
|
-
title: "Reorder pages",
|
|
1611
|
-
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.",
|
|
1612
|
-
method: "POST",
|
|
1613
|
-
path: wireTemplates.layerPagesReorder,
|
|
1614
|
-
credentials: docCredentials,
|
|
1615
|
-
scope: [],
|
|
1616
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1617
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1618
|
-
params: DocLayerParamsSchema,
|
|
1619
|
-
body: { contentType: "application/json", schema: PageReorderInputSchema },
|
|
1620
|
-
responses: {
|
|
1621
|
-
200: { contentType: "application/json", schema: PageReorderResultSchema },
|
|
1622
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1623
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1624
|
-
}
|
|
1625
|
-
},
|
|
1626
|
-
"doc.pages.rotate": {
|
|
1627
|
-
operationId: "doc.pages.rotate",
|
|
1628
|
-
title: "Rotate pages",
|
|
1629
|
-
summary: "Set absolute rotation on pages.",
|
|
1630
|
-
method: "POST",
|
|
1631
|
-
path: wireTemplates.layerPagesRotate,
|
|
1632
|
-
credentials: docCredentials,
|
|
1633
|
-
scope: [],
|
|
1634
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1635
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1636
|
-
params: DocLayerParamsSchema,
|
|
1637
|
-
body: { contentType: "application/json", schema: looseJson },
|
|
1638
|
-
responses: {
|
|
1639
|
-
200: { contentType: "application/json", schema: PageRotateResultSchema },
|
|
1640
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1641
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1642
|
-
}
|
|
1643
|
-
},
|
|
1644
|
-
"doc.pages.delete": {
|
|
1645
|
-
operationId: "doc.pages.delete",
|
|
1646
|
-
title: "Delete pages",
|
|
1647
|
-
summary: "Delete pages.",
|
|
1648
|
-
method: "POST",
|
|
1649
|
-
path: wireTemplates.layerPagesDelete,
|
|
1650
|
-
credentials: docCredentials,
|
|
1651
|
-
scope: [],
|
|
1652
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1653
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1654
|
-
params: DocLayerParamsSchema,
|
|
1655
|
-
body: { contentType: "application/json", schema: looseJson },
|
|
1656
|
-
responses: {
|
|
1657
|
-
200: { contentType: "application/json", schema: PageDeleteResultSchema },
|
|
1658
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1659
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1660
|
-
}
|
|
1661
|
-
},
|
|
1662
1686
|
"doc.pages.setName": {
|
|
1663
1687
|
operationId: "doc.pages.setName",
|
|
1664
1688
|
title: "Set page name",
|
|
@@ -1713,46 +1737,6 @@ var docOperations = {
|
|
|
1713
1737
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1714
1738
|
}
|
|
1715
1739
|
},
|
|
1716
|
-
"doc.pages.insert": {
|
|
1717
|
-
operationId: "doc.pages.insert",
|
|
1718
|
-
title: "Insert pages from a PDF",
|
|
1719
|
-
summary: "Copy every page of an uploaded PDF into the document at an index.",
|
|
1720
|
-
method: "POST",
|
|
1721
|
-
path: wireTemplates.layerPagesInsert,
|
|
1722
|
-
credentials: docCredentials,
|
|
1723
|
-
scope: [],
|
|
1724
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1725
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1726
|
-
params: DocLayerParamsSchema,
|
|
1727
|
-
body: {
|
|
1728
|
-
contentType: "multipart/form-data"
|
|
1729
|
-
},
|
|
1730
|
-
responses: {
|
|
1731
|
-
200: { contentType: "application/json", schema: PageInsertResultSchema },
|
|
1732
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1733
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1734
|
-
},
|
|
1735
|
-
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.'
|
|
1736
|
-
},
|
|
1737
|
-
"doc.pages.insertBlank": {
|
|
1738
|
-
operationId: "doc.pages.insertBlank",
|
|
1739
|
-
title: "Insert blank pages",
|
|
1740
|
-
summary: "Create blank pages of an explicit size at a position.",
|
|
1741
|
-
method: "POST",
|
|
1742
|
-
path: wireTemplates.layerPagesInsertBlank,
|
|
1743
|
-
credentials: docCredentials,
|
|
1744
|
-
scope: [],
|
|
1745
|
-
docCapabilities: ["doc.pages.assemble"],
|
|
1746
|
-
requestHeaders: [documentPasswordHeader, idempotencyKeyHeader],
|
|
1747
|
-
params: DocLayerParamsSchema,
|
|
1748
|
-
body: { contentType: "application/json", schema: looseJson },
|
|
1749
|
-
responses: {
|
|
1750
|
-
200: { contentType: "application/json", schema: PageInsertResultSchema },
|
|
1751
|
-
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1752
|
-
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1753
|
-
},
|
|
1754
|
-
notes: 'Body is `{"size": {"width", "height"}, "count"?, "position"?}` \u2014 size in PDF points, count in [1, 100], `position` a `PagePosition` (omitted \u2192 the end).'
|
|
1755
|
-
},
|
|
1756
1740
|
"doc.pages.extract": {
|
|
1757
1741
|
operationId: "doc.pages.extract",
|
|
1758
1742
|
title: "Extract pages",
|
|
@@ -1770,7 +1754,7 @@ var docOperations = {
|
|
|
1770
1754
|
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1771
1755
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1772
1756
|
},
|
|
1773
|
-
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.'
|
|
1757
|
+
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`.'
|
|
1774
1758
|
},
|
|
1775
1759
|
"doc.redactions.apply": {
|
|
1776
1760
|
operationId: "doc.redactions.apply",
|
|
@@ -1816,9 +1800,11 @@ var docsGroups = {
|
|
|
1816
1800
|
shares: { title: "Shares" },
|
|
1817
1801
|
doc: { title: "Document operations", slug: "document-operations" },
|
|
1818
1802
|
"doc.annotations": { title: "Annotations" },
|
|
1803
|
+
"doc.attachments": { title: "Attachments" },
|
|
1819
1804
|
"doc.forms": { title: "Forms" },
|
|
1820
1805
|
"doc.metadata": { title: "Metadata" },
|
|
1821
1806
|
"doc.metadata.custom": { title: "Custom keys" },
|
|
1807
|
+
"doc.outline": { title: "Outline" },
|
|
1822
1808
|
"doc.pages": { title: "Pages" },
|
|
1823
1809
|
"doc.redactions": { title: "Redactions" },
|
|
1824
1810
|
"doc.signatures": { title: "Digital signatures" },
|
|
@@ -1850,6 +1836,8 @@ var SHARED_COMPONENT_SCHEMAS = sharedComponents([
|
|
|
1850
1836
|
PdfActionWireComponents,
|
|
1851
1837
|
AnnotationWireComponents,
|
|
1852
1838
|
FormWireComponents,
|
|
1839
|
+
OutlineWireComponents,
|
|
1840
|
+
AttachmentWireComponents,
|
|
1853
1841
|
ChangeWireComponents
|
|
1854
1842
|
]);
|
|
1855
1843
|
var SHARED_COMPONENT_BY_DEFINITION = new Map(
|