@cloudpdf/contract 3.0.0-next.12 → 3.0.0-next.14
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 +4557 -634
- package/dist/index.js +292 -1
- package/dist/index.js.map +1 -1
- package/dist/openapi.js +285 -1
- package/dist/openapi.js.map +1 -1
- package/openapi.json +9159 -3317
- package/package.json +2 -2
package/dist/openapi.js
CHANGED
|
@@ -4,6 +4,11 @@ import { z as z2 } from "zod";
|
|
|
4
4
|
import { ignoreOverride, zodToJsonSchema } from "zod-to-json-schema";
|
|
5
5
|
|
|
6
6
|
// src/index.ts
|
|
7
|
+
import {
|
|
8
|
+
PageScaleInputSchema,
|
|
9
|
+
PageScaleResultSchema,
|
|
10
|
+
PageMeasurementViewportSchema
|
|
11
|
+
} from "@embedpdf/engine-core/wire";
|
|
7
12
|
import {
|
|
8
13
|
AnnotationListPageSnapshotSchema,
|
|
9
14
|
AnnotationListSnapshotAllPagesSchema,
|
|
@@ -14,6 +19,13 @@ import {
|
|
|
14
19
|
FormSnapshotSchema,
|
|
15
20
|
MutationMetaSchema,
|
|
16
21
|
PageTextSnapshotSchema,
|
|
22
|
+
ChangeAnalysisSchema,
|
|
23
|
+
DocumentVersionsSchema,
|
|
24
|
+
SignatureAbortResultSchema,
|
|
25
|
+
SignatureCompleteBodySchema,
|
|
26
|
+
SignatureCompleteResultSchema,
|
|
27
|
+
SignaturePreparedWireSchema,
|
|
28
|
+
SignatureSnapshotSchema,
|
|
17
29
|
wireTemplates
|
|
18
30
|
} from "@embedpdf/engine-core/wire";
|
|
19
31
|
import { z } from "zod";
|
|
@@ -871,6 +883,32 @@ var documentPasswordHeader = {
|
|
|
871
883
|
var looseJson = z.record(z.string(), z.unknown());
|
|
872
884
|
var docCredentials = ["api-token", "doc-jwt"];
|
|
873
885
|
var MutationResponseSchema = z.object({ meta: MutationMetaSchema }).passthrough();
|
|
886
|
+
var DocSigningParamsSchema = DocLayerParamsSchema.extend({
|
|
887
|
+
signingId: z.string().min(1)
|
|
888
|
+
});
|
|
889
|
+
var sha256Pattern = /^[0-9a-f]{64}$/;
|
|
890
|
+
var DocVersionParamsSchema = DocIdParamsSchema.extend({
|
|
891
|
+
sha: z.string().regex(sha256Pattern)
|
|
892
|
+
});
|
|
893
|
+
var DocVersionFieldParamsSchema = DocVersionParamsSchema.extend({
|
|
894
|
+
fieldKey: z.string().min(1)
|
|
895
|
+
});
|
|
896
|
+
var DocVersionDigestParamsSchema = DocVersionFieldParamsSchema.extend({
|
|
897
|
+
algorithm: z.enum(["sha1", "sha256", "sha384", "sha512"])
|
|
898
|
+
});
|
|
899
|
+
var DocVersionRevisionParamsSchema = DocVersionParamsSchema.extend({
|
|
900
|
+
index: z.coerce.number().int().min(0)
|
|
901
|
+
});
|
|
902
|
+
var LayerSignaturesAnalysisQuerySchema = z.object({
|
|
903
|
+
"since.signature": z.coerce.number().int().min(0).optional(),
|
|
904
|
+
"since.revision": z.coerce.number().int().min(0).optional(),
|
|
905
|
+
level: z.enum(["none", "lta", "fill", "annotate"]).optional()
|
|
906
|
+
});
|
|
907
|
+
var VersionAnalysisQuerySchema = LayerSignaturesAnalysisQuerySchema.extend({
|
|
908
|
+
until: z.coerce.number().int().min(0).optional(),
|
|
909
|
+
/** The judging policy version the caller expects — a cache key on this immutable URL, not an input. */
|
|
910
|
+
policy: z.coerce.number().int().min(1).optional()
|
|
911
|
+
});
|
|
874
912
|
var docOperations = {
|
|
875
913
|
"doc.head": {
|
|
876
914
|
operationId: "doc.head",
|
|
@@ -920,6 +958,216 @@ var docOperations = {
|
|
|
920
958
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
921
959
|
}
|
|
922
960
|
},
|
|
961
|
+
"doc.signatures.list": {
|
|
962
|
+
operationId: "doc.signatures.list",
|
|
963
|
+
title: "List signatures",
|
|
964
|
+
summary: "The layer view of digital signatures: revisions, every signature field with its signed state, and the protection in force.",
|
|
965
|
+
method: "GET",
|
|
966
|
+
path: wireTemplates.layerSignatures,
|
|
967
|
+
credentials: docCredentials,
|
|
968
|
+
scope: [],
|
|
969
|
+
docCapabilities: ["doc.forms.read"],
|
|
970
|
+
requestHeaders: [documentPasswordHeader],
|
|
971
|
+
params: DocLayerParamsSchema,
|
|
972
|
+
responses: {
|
|
973
|
+
200: { contentType: "application/json", schema: SignatureSnapshotSchema },
|
|
974
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
975
|
+
},
|
|
976
|
+
notes: "Describes the bytes the layer is over: the base version's signatures plus the layer's own edits as the last revision. Signed bytes (contents, digests, revision prefixes) are served per base version under /versions."
|
|
977
|
+
},
|
|
978
|
+
"doc.signatures.analysis": {
|
|
979
|
+
operationId: "doc.signatures.analysis",
|
|
980
|
+
title: "Analyze layer changes",
|
|
981
|
+
summary: "What the layer changed after a signature (or after any revision), judged against the restrictions in force.",
|
|
982
|
+
method: "GET",
|
|
983
|
+
path: wireTemplates.layerSignaturesAnalysis,
|
|
984
|
+
credentials: docCredentials,
|
|
985
|
+
scope: [],
|
|
986
|
+
docCapabilities: ["doc.forms.read"],
|
|
987
|
+
requestHeaders: [documentPasswordHeader],
|
|
988
|
+
params: DocLayerParamsSchema,
|
|
989
|
+
query: LayerSignaturesAnalysisQuerySchema,
|
|
990
|
+
responses: {
|
|
991
|
+
200: { contentType: "application/json", schema: ChangeAnalysisSchema },
|
|
992
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
993
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
994
|
+
},
|
|
995
|
+
notes: "Exactly one of `since.signature=<index>` or `since.revision=<index>`; the layer's pending edits are the end. `level=fill|annotate|lta|none` evaluates exploratorily and never becomes a verdict. For history between two base revisions use the version analysis."
|
|
996
|
+
},
|
|
997
|
+
"doc.signatures.prepare": {
|
|
998
|
+
operationId: "doc.signatures.prepare",
|
|
999
|
+
title: "Prepare a signature",
|
|
1000
|
+
summary: "Author and seal a signing candidate; returns the digest to sign and the version fences.",
|
|
1001
|
+
method: "POST",
|
|
1002
|
+
path: wireTemplates.layerSignaturesPrepare,
|
|
1003
|
+
credentials: docCredentials,
|
|
1004
|
+
scope: [],
|
|
1005
|
+
docCapabilities: ["doc.sign"],
|
|
1006
|
+
requestHeaders: [documentPasswordHeader],
|
|
1007
|
+
params: DocLayerParamsSchema,
|
|
1008
|
+
body: { contentType: "multipart/form-data" },
|
|
1009
|
+
responses: {
|
|
1010
|
+
200: { contentType: "application/json", schema: SignaturePreparedWireSchema },
|
|
1011
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1012
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1013
|
+
409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1014
|
+
},
|
|
1015
|
+
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)."
|
|
1016
|
+
},
|
|
1017
|
+
"doc.signatures.complete": {
|
|
1018
|
+
operationId: "doc.signatures.complete",
|
|
1019
|
+
title: "Complete a signature",
|
|
1020
|
+
summary: "Install the CMS into the prepared candidate and publish the sealed bytes as the document's next base version.",
|
|
1021
|
+
method: "POST",
|
|
1022
|
+
path: wireTemplates.layerSignatureComplete,
|
|
1023
|
+
credentials: docCredentials,
|
|
1024
|
+
scope: [],
|
|
1025
|
+
docCapabilities: ["doc.sign"],
|
|
1026
|
+
requestHeaders: [documentPasswordHeader],
|
|
1027
|
+
params: DocSigningParamsSchema,
|
|
1028
|
+
body: { contentType: "application/json", schema: SignatureCompleteBodySchema },
|
|
1029
|
+
responses: {
|
|
1030
|
+
200: { contentType: "application/json", schema: SignatureCompleteResultSchema },
|
|
1031
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1032
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1033
|
+
409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1034
|
+
},
|
|
1035
|
+
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."
|
|
1036
|
+
},
|
|
1037
|
+
"doc.signatures.abort": {
|
|
1038
|
+
operationId: "doc.signatures.abort",
|
|
1039
|
+
title: "Abort a signature",
|
|
1040
|
+
summary: "Discard a pending signing candidate.",
|
|
1041
|
+
method: "DELETE",
|
|
1042
|
+
path: wireTemplates.layerSignatureAbort,
|
|
1043
|
+
credentials: docCredentials,
|
|
1044
|
+
scope: [],
|
|
1045
|
+
docCapabilities: ["doc.sign"],
|
|
1046
|
+
requestHeaders: [documentPasswordHeader],
|
|
1047
|
+
params: DocSigningParamsSchema,
|
|
1048
|
+
responses: {
|
|
1049
|
+
200: { contentType: "application/json", schema: SignatureAbortResultSchema },
|
|
1050
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
"doc.versions.list": {
|
|
1054
|
+
operationId: "doc.versions.list",
|
|
1055
|
+
title: "List versions",
|
|
1056
|
+
summary: "The document's base versions, oldest first, and its head.",
|
|
1057
|
+
method: "GET",
|
|
1058
|
+
path: wireTemplates.docVersions,
|
|
1059
|
+
credentials: docCredentials,
|
|
1060
|
+
scope: [],
|
|
1061
|
+
docCapabilities: ["doc.open"],
|
|
1062
|
+
requestHeaders: [documentPasswordHeader],
|
|
1063
|
+
params: DocIdParamsSchema,
|
|
1064
|
+
responses: {
|
|
1065
|
+
200: { contentType: "application/json", schema: DocumentVersionsSchema },
|
|
1066
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1067
|
+
},
|
|
1068
|
+
notes: "Every completed signature publishes a new version. Never cached: the list grows."
|
|
1069
|
+
},
|
|
1070
|
+
"doc.versions.signatures": {
|
|
1071
|
+
operationId: "doc.versions.signatures",
|
|
1072
|
+
title: "Version signatures",
|
|
1073
|
+
summary: "The signature snapshot of one base version (immutable).",
|
|
1074
|
+
method: "GET",
|
|
1075
|
+
path: wireTemplates.docVersionSignatures,
|
|
1076
|
+
credentials: docCredentials,
|
|
1077
|
+
scope: [],
|
|
1078
|
+
docCapabilities: ["doc.forms.read"],
|
|
1079
|
+
requestHeaders: [documentPasswordHeader],
|
|
1080
|
+
params: DocVersionParamsSchema,
|
|
1081
|
+
responses: {
|
|
1082
|
+
200: { contentType: "application/json", schema: SignatureSnapshotSchema },
|
|
1083
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
"doc.versions.signatureContents": {
|
|
1087
|
+
operationId: "doc.versions.signatureContents",
|
|
1088
|
+
title: "Signature contents",
|
|
1089
|
+
summary: "The DER /Contents of a signed field in one base version (immutable).",
|
|
1090
|
+
method: "GET",
|
|
1091
|
+
path: wireTemplates.docVersionSignatureContents,
|
|
1092
|
+
credentials: docCredentials,
|
|
1093
|
+
scope: [],
|
|
1094
|
+
docCapabilities: ["doc.forms.read"],
|
|
1095
|
+
requestHeaders: [documentPasswordHeader],
|
|
1096
|
+
params: DocVersionFieldParamsSchema,
|
|
1097
|
+
responses: {
|
|
1098
|
+
200: { contentType: "application/pkcs7-signature" },
|
|
1099
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1100
|
+
},
|
|
1101
|
+
notes: "`fieldKey` is the field's fully qualified name, token-text encoded (the same encoding attachment keys use)."
|
|
1102
|
+
},
|
|
1103
|
+
"doc.versions.signatureDigest": {
|
|
1104
|
+
operationId: "doc.versions.signatureDigest",
|
|
1105
|
+
title: "Signature digest",
|
|
1106
|
+
summary: "The digest of a signed field's /ByteRange in one base version (immutable).",
|
|
1107
|
+
method: "GET",
|
|
1108
|
+
path: wireTemplates.docVersionSignatureDigest,
|
|
1109
|
+
credentials: docCredentials,
|
|
1110
|
+
scope: [],
|
|
1111
|
+
docCapabilities: ["doc.forms.read"],
|
|
1112
|
+
requestHeaders: [documentPasswordHeader],
|
|
1113
|
+
params: DocVersionDigestParamsSchema,
|
|
1114
|
+
responses: {
|
|
1115
|
+
200: { contentType: "application/octet-stream" },
|
|
1116
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1117
|
+
},
|
|
1118
|
+
notes: "What a CMS verifier compares its message digest to."
|
|
1119
|
+
},
|
|
1120
|
+
"doc.versions.analysis": {
|
|
1121
|
+
operationId: "doc.versions.analysis",
|
|
1122
|
+
title: "Analyze version history",
|
|
1123
|
+
summary: "What changed between two revisions of one base version (immutable).",
|
|
1124
|
+
method: "GET",
|
|
1125
|
+
path: wireTemplates.docVersionAnalysis,
|
|
1126
|
+
credentials: docCredentials,
|
|
1127
|
+
scope: [],
|
|
1128
|
+
docCapabilities: ["doc.forms.read"],
|
|
1129
|
+
requestHeaders: [documentPasswordHeader],
|
|
1130
|
+
params: DocVersionParamsSchema,
|
|
1131
|
+
query: VersionAnalysisQuerySchema,
|
|
1132
|
+
responses: {
|
|
1133
|
+
200: { contentType: "application/json", schema: ChangeAnalysisSchema },
|
|
1134
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1135
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1136
|
+
},
|
|
1137
|
+
notes: "Exactly one of `since.signature` / `since.revision`; `until=<revision>` defaults to the last. The same answer for every layer and every caller."
|
|
1138
|
+
},
|
|
1139
|
+
"doc.versions.download": {
|
|
1140
|
+
operationId: "doc.versions.download",
|
|
1141
|
+
title: "Download a version",
|
|
1142
|
+
summary: "The bytes of one base version (immutable).",
|
|
1143
|
+
method: "GET",
|
|
1144
|
+
path: wireTemplates.docVersionDownload,
|
|
1145
|
+
credentials: docCredentials,
|
|
1146
|
+
scope: [],
|
|
1147
|
+
docCapabilities: ["doc.download"],
|
|
1148
|
+
requestHeaders: [documentPasswordHeader],
|
|
1149
|
+
params: DocVersionParamsSchema,
|
|
1150
|
+
responses: {
|
|
1151
|
+
200: { contentType: "application/pdf" },
|
|
1152
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1153
|
+
}
|
|
1154
|
+
},
|
|
1155
|
+
"doc.versions.revision": {
|
|
1156
|
+
operationId: "doc.versions.revision",
|
|
1157
|
+
title: "Download a revision",
|
|
1158
|
+
summary: "The byte prefix of one revision of a base version: exactly what a signature over it signed (immutable).",
|
|
1159
|
+
method: "GET",
|
|
1160
|
+
path: wireTemplates.docVersionRevision,
|
|
1161
|
+
credentials: docCredentials,
|
|
1162
|
+
scope: [],
|
|
1163
|
+
docCapabilities: ["doc.download"],
|
|
1164
|
+
requestHeaders: [documentPasswordHeader],
|
|
1165
|
+
params: DocVersionRevisionParamsSchema,
|
|
1166
|
+
responses: {
|
|
1167
|
+
200: { contentType: "application/pdf" },
|
|
1168
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
923
1171
|
"doc.render": {
|
|
924
1172
|
operationId: "doc.render",
|
|
925
1173
|
title: "Render page",
|
|
@@ -1161,6 +1409,40 @@ var docOperations = {
|
|
|
1161
1409
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1162
1410
|
}
|
|
1163
1411
|
},
|
|
1412
|
+
"doc.pages.viewports": {
|
|
1413
|
+
operationId: "doc.pages.viewports",
|
|
1414
|
+
title: "Read measurement viewports",
|
|
1415
|
+
summary: "Read page measurement viewports in drawing order from the current layer.",
|
|
1416
|
+
method: "GET",
|
|
1417
|
+
path: wireTemplates.layerPageViewports,
|
|
1418
|
+
credentials: docCredentials,
|
|
1419
|
+
scope: [],
|
|
1420
|
+
docCapabilities: ["doc.open"],
|
|
1421
|
+
requestHeaders: [documentPasswordHeader],
|
|
1422
|
+
params: DocPageParamsSchema,
|
|
1423
|
+
responses: {
|
|
1424
|
+
200: { contentType: "application/json", schema: z.array(PageMeasurementViewportSchema) },
|
|
1425
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1426
|
+
}
|
|
1427
|
+
},
|
|
1428
|
+
"doc.pages.setScale": {
|
|
1429
|
+
operationId: "doc.pages.setScale",
|
|
1430
|
+
title: "Set page measurement scale",
|
|
1431
|
+
summary: "Upsert or remove EmbedPDF calibration while preserving foreign viewports. Existing annotation scales are unchanged.",
|
|
1432
|
+
method: "PUT",
|
|
1433
|
+
path: wireTemplates.layerPageScale,
|
|
1434
|
+
credentials: docCredentials,
|
|
1435
|
+
scope: [],
|
|
1436
|
+
docCapabilities: ["doc.annotate.modify"],
|
|
1437
|
+
requestHeaders: [documentPasswordHeader],
|
|
1438
|
+
params: DocPageParamsSchema,
|
|
1439
|
+
body: { contentType: "application/json", schema: PageScaleInputSchema },
|
|
1440
|
+
responses: {
|
|
1441
|
+
200: { contentType: "application/json", schema: PageScaleResultSchema },
|
|
1442
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1443
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1444
|
+
}
|
|
1445
|
+
},
|
|
1164
1446
|
"doc.pages.move": {
|
|
1165
1447
|
operationId: "doc.pages.move",
|
|
1166
1448
|
title: "Move pages",
|
|
@@ -1375,7 +1657,9 @@ var docsGroups = {
|
|
|
1375
1657
|
"doc.forms": { title: "Forms" },
|
|
1376
1658
|
"doc.metadata": { title: "Metadata" },
|
|
1377
1659
|
"doc.pages": { title: "Pages" },
|
|
1378
|
-
"doc.redactions": { title: "Redactions" }
|
|
1660
|
+
"doc.redactions": { title: "Redactions" },
|
|
1661
|
+
"doc.signatures": { title: "Digital signatures" },
|
|
1662
|
+
"doc.versions": { title: "Versions" }
|
|
1379
1663
|
};
|
|
1380
1664
|
|
|
1381
1665
|
// src/openapi.ts
|