@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/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
PageScaleInputSchema,
|
|
4
|
+
PageScaleResultSchema,
|
|
5
|
+
PageMeasurementViewportSchema
|
|
6
|
+
} from "@embedpdf/engine-core/wire";
|
|
2
7
|
import {
|
|
3
8
|
AnnotationListPageSnapshotSchema,
|
|
4
9
|
AnnotationListSnapshotAllPagesSchema,
|
|
@@ -9,6 +14,13 @@ import {
|
|
|
9
14
|
FormSnapshotSchema,
|
|
10
15
|
MutationMetaSchema,
|
|
11
16
|
PageTextSnapshotSchema,
|
|
17
|
+
ChangeAnalysisSchema,
|
|
18
|
+
DocumentVersionsSchema,
|
|
19
|
+
SignatureAbortResultSchema,
|
|
20
|
+
SignatureCompleteBodySchema,
|
|
21
|
+
SignatureCompleteResultSchema,
|
|
22
|
+
SignaturePreparedWireSchema,
|
|
23
|
+
SignatureSnapshotSchema,
|
|
12
24
|
wireTemplates
|
|
13
25
|
} from "@embedpdf/engine-core/wire";
|
|
14
26
|
import { z } from "zod";
|
|
@@ -867,6 +879,32 @@ var documentPasswordHeader = {
|
|
|
867
879
|
var looseJson = z.record(z.string(), z.unknown());
|
|
868
880
|
var docCredentials = ["api-token", "doc-jwt"];
|
|
869
881
|
var MutationResponseSchema = z.object({ meta: MutationMetaSchema }).passthrough();
|
|
882
|
+
var DocSigningParamsSchema = DocLayerParamsSchema.extend({
|
|
883
|
+
signingId: z.string().min(1)
|
|
884
|
+
});
|
|
885
|
+
var sha256Pattern = /^[0-9a-f]{64}$/;
|
|
886
|
+
var DocVersionParamsSchema = DocIdParamsSchema.extend({
|
|
887
|
+
sha: z.string().regex(sha256Pattern)
|
|
888
|
+
});
|
|
889
|
+
var DocVersionFieldParamsSchema = DocVersionParamsSchema.extend({
|
|
890
|
+
fieldKey: z.string().min(1)
|
|
891
|
+
});
|
|
892
|
+
var DocVersionDigestParamsSchema = DocVersionFieldParamsSchema.extend({
|
|
893
|
+
algorithm: z.enum(["sha1", "sha256", "sha384", "sha512"])
|
|
894
|
+
});
|
|
895
|
+
var DocVersionRevisionParamsSchema = DocVersionParamsSchema.extend({
|
|
896
|
+
index: z.coerce.number().int().min(0)
|
|
897
|
+
});
|
|
898
|
+
var LayerSignaturesAnalysisQuerySchema = z.object({
|
|
899
|
+
"since.signature": z.coerce.number().int().min(0).optional(),
|
|
900
|
+
"since.revision": z.coerce.number().int().min(0).optional(),
|
|
901
|
+
level: z.enum(["none", "lta", "fill", "annotate"]).optional()
|
|
902
|
+
});
|
|
903
|
+
var VersionAnalysisQuerySchema = LayerSignaturesAnalysisQuerySchema.extend({
|
|
904
|
+
until: z.coerce.number().int().min(0).optional(),
|
|
905
|
+
/** The judging policy version the caller expects — a cache key on this immutable URL, not an input. */
|
|
906
|
+
policy: z.coerce.number().int().min(1).optional()
|
|
907
|
+
});
|
|
870
908
|
var docOperations = {
|
|
871
909
|
"doc.head": {
|
|
872
910
|
operationId: "doc.head",
|
|
@@ -916,6 +954,216 @@ var docOperations = {
|
|
|
916
954
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
917
955
|
}
|
|
918
956
|
},
|
|
957
|
+
"doc.signatures.list": {
|
|
958
|
+
operationId: "doc.signatures.list",
|
|
959
|
+
title: "List signatures",
|
|
960
|
+
summary: "The layer view of digital signatures: revisions, every signature field with its signed state, and the protection in force.",
|
|
961
|
+
method: "GET",
|
|
962
|
+
path: wireTemplates.layerSignatures,
|
|
963
|
+
credentials: docCredentials,
|
|
964
|
+
scope: [],
|
|
965
|
+
docCapabilities: ["doc.forms.read"],
|
|
966
|
+
requestHeaders: [documentPasswordHeader],
|
|
967
|
+
params: DocLayerParamsSchema,
|
|
968
|
+
responses: {
|
|
969
|
+
200: { contentType: "application/json", schema: SignatureSnapshotSchema },
|
|
970
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
971
|
+
},
|
|
972
|
+
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."
|
|
973
|
+
},
|
|
974
|
+
"doc.signatures.analysis": {
|
|
975
|
+
operationId: "doc.signatures.analysis",
|
|
976
|
+
title: "Analyze layer changes",
|
|
977
|
+
summary: "What the layer changed after a signature (or after any revision), judged against the restrictions in force.",
|
|
978
|
+
method: "GET",
|
|
979
|
+
path: wireTemplates.layerSignaturesAnalysis,
|
|
980
|
+
credentials: docCredentials,
|
|
981
|
+
scope: [],
|
|
982
|
+
docCapabilities: ["doc.forms.read"],
|
|
983
|
+
requestHeaders: [documentPasswordHeader],
|
|
984
|
+
params: DocLayerParamsSchema,
|
|
985
|
+
query: LayerSignaturesAnalysisQuerySchema,
|
|
986
|
+
responses: {
|
|
987
|
+
200: { contentType: "application/json", schema: ChangeAnalysisSchema },
|
|
988
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
989
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
990
|
+
},
|
|
991
|
+
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."
|
|
992
|
+
},
|
|
993
|
+
"doc.signatures.prepare": {
|
|
994
|
+
operationId: "doc.signatures.prepare",
|
|
995
|
+
title: "Prepare a signature",
|
|
996
|
+
summary: "Author and seal a signing candidate; returns the digest to sign and the version fences.",
|
|
997
|
+
method: "POST",
|
|
998
|
+
path: wireTemplates.layerSignaturesPrepare,
|
|
999
|
+
credentials: docCredentials,
|
|
1000
|
+
scope: [],
|
|
1001
|
+
docCapabilities: ["doc.sign"],
|
|
1002
|
+
requestHeaders: [documentPasswordHeader],
|
|
1003
|
+
params: DocLayerParamsSchema,
|
|
1004
|
+
body: { contentType: "multipart/form-data" },
|
|
1005
|
+
responses: {
|
|
1006
|
+
200: { contentType: "application/json", schema: SignaturePreparedWireSchema },
|
|
1007
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1008
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1009
|
+
409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1010
|
+
},
|
|
1011
|
+
notes: "The multipart envelope: a JSON `body` part (field, subFilter, digest, contentsSize, signer, certify, lock, appearance) and an optional `resource:<key>` PDF part the body's `appearance.resource` names. A certification (`certify.permission`) additionally requires `doc.sign.certify`. The layer is read-only until the signing completes, is aborted, or expires (15 minutes). A layer behind the document head cannot sign (StaleBase)."
|
|
1012
|
+
},
|
|
1013
|
+
"doc.signatures.complete": {
|
|
1014
|
+
operationId: "doc.signatures.complete",
|
|
1015
|
+
title: "Complete a signature",
|
|
1016
|
+
summary: "Install the CMS into the prepared candidate and publish the sealed bytes as the document's next base version.",
|
|
1017
|
+
method: "POST",
|
|
1018
|
+
path: wireTemplates.layerSignatureComplete,
|
|
1019
|
+
credentials: docCredentials,
|
|
1020
|
+
scope: [],
|
|
1021
|
+
docCapabilities: ["doc.sign"],
|
|
1022
|
+
requestHeaders: [documentPasswordHeader],
|
|
1023
|
+
params: DocSigningParamsSchema,
|
|
1024
|
+
body: { contentType: "application/json", schema: SignatureCompleteBodySchema },
|
|
1025
|
+
responses: {
|
|
1026
|
+
200: { contentType: "application/json", schema: SignatureCompleteResultSchema },
|
|
1027
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1028
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1029
|
+
409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1030
|
+
},
|
|
1031
|
+
notes: "`cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. Every layer of the document then sits over the new version; refetch the manifest after a completion."
|
|
1032
|
+
},
|
|
1033
|
+
"doc.signatures.abort": {
|
|
1034
|
+
operationId: "doc.signatures.abort",
|
|
1035
|
+
title: "Abort a signature",
|
|
1036
|
+
summary: "Discard a pending signing candidate.",
|
|
1037
|
+
method: "DELETE",
|
|
1038
|
+
path: wireTemplates.layerSignatureAbort,
|
|
1039
|
+
credentials: docCredentials,
|
|
1040
|
+
scope: [],
|
|
1041
|
+
docCapabilities: ["doc.sign"],
|
|
1042
|
+
requestHeaders: [documentPasswordHeader],
|
|
1043
|
+
params: DocSigningParamsSchema,
|
|
1044
|
+
responses: {
|
|
1045
|
+
200: { contentType: "application/json", schema: SignatureAbortResultSchema },
|
|
1046
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
"doc.versions.list": {
|
|
1050
|
+
operationId: "doc.versions.list",
|
|
1051
|
+
title: "List versions",
|
|
1052
|
+
summary: "The document's base versions, oldest first, and its head.",
|
|
1053
|
+
method: "GET",
|
|
1054
|
+
path: wireTemplates.docVersions,
|
|
1055
|
+
credentials: docCredentials,
|
|
1056
|
+
scope: [],
|
|
1057
|
+
docCapabilities: ["doc.open"],
|
|
1058
|
+
requestHeaders: [documentPasswordHeader],
|
|
1059
|
+
params: DocIdParamsSchema,
|
|
1060
|
+
responses: {
|
|
1061
|
+
200: { contentType: "application/json", schema: DocumentVersionsSchema },
|
|
1062
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1063
|
+
},
|
|
1064
|
+
notes: "Every completed signature publishes a new version. Never cached: the list grows."
|
|
1065
|
+
},
|
|
1066
|
+
"doc.versions.signatures": {
|
|
1067
|
+
operationId: "doc.versions.signatures",
|
|
1068
|
+
title: "Version signatures",
|
|
1069
|
+
summary: "The signature snapshot of one base version (immutable).",
|
|
1070
|
+
method: "GET",
|
|
1071
|
+
path: wireTemplates.docVersionSignatures,
|
|
1072
|
+
credentials: docCredentials,
|
|
1073
|
+
scope: [],
|
|
1074
|
+
docCapabilities: ["doc.forms.read"],
|
|
1075
|
+
requestHeaders: [documentPasswordHeader],
|
|
1076
|
+
params: DocVersionParamsSchema,
|
|
1077
|
+
responses: {
|
|
1078
|
+
200: { contentType: "application/json", schema: SignatureSnapshotSchema },
|
|
1079
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1080
|
+
}
|
|
1081
|
+
},
|
|
1082
|
+
"doc.versions.signatureContents": {
|
|
1083
|
+
operationId: "doc.versions.signatureContents",
|
|
1084
|
+
title: "Signature contents",
|
|
1085
|
+
summary: "The DER /Contents of a signed field in one base version (immutable).",
|
|
1086
|
+
method: "GET",
|
|
1087
|
+
path: wireTemplates.docVersionSignatureContents,
|
|
1088
|
+
credentials: docCredentials,
|
|
1089
|
+
scope: [],
|
|
1090
|
+
docCapabilities: ["doc.forms.read"],
|
|
1091
|
+
requestHeaders: [documentPasswordHeader],
|
|
1092
|
+
params: DocVersionFieldParamsSchema,
|
|
1093
|
+
responses: {
|
|
1094
|
+
200: { contentType: "application/pkcs7-signature" },
|
|
1095
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1096
|
+
},
|
|
1097
|
+
notes: "`fieldKey` is the field's fully qualified name, token-text encoded (the same encoding attachment keys use)."
|
|
1098
|
+
},
|
|
1099
|
+
"doc.versions.signatureDigest": {
|
|
1100
|
+
operationId: "doc.versions.signatureDigest",
|
|
1101
|
+
title: "Signature digest",
|
|
1102
|
+
summary: "The digest of a signed field's /ByteRange in one base version (immutable).",
|
|
1103
|
+
method: "GET",
|
|
1104
|
+
path: wireTemplates.docVersionSignatureDigest,
|
|
1105
|
+
credentials: docCredentials,
|
|
1106
|
+
scope: [],
|
|
1107
|
+
docCapabilities: ["doc.forms.read"],
|
|
1108
|
+
requestHeaders: [documentPasswordHeader],
|
|
1109
|
+
params: DocVersionDigestParamsSchema,
|
|
1110
|
+
responses: {
|
|
1111
|
+
200: { contentType: "application/octet-stream" },
|
|
1112
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1113
|
+
},
|
|
1114
|
+
notes: "What a CMS verifier compares its message digest to."
|
|
1115
|
+
},
|
|
1116
|
+
"doc.versions.analysis": {
|
|
1117
|
+
operationId: "doc.versions.analysis",
|
|
1118
|
+
title: "Analyze version history",
|
|
1119
|
+
summary: "What changed between two revisions of one base version (immutable).",
|
|
1120
|
+
method: "GET",
|
|
1121
|
+
path: wireTemplates.docVersionAnalysis,
|
|
1122
|
+
credentials: docCredentials,
|
|
1123
|
+
scope: [],
|
|
1124
|
+
docCapabilities: ["doc.forms.read"],
|
|
1125
|
+
requestHeaders: [documentPasswordHeader],
|
|
1126
|
+
params: DocVersionParamsSchema,
|
|
1127
|
+
query: VersionAnalysisQuerySchema,
|
|
1128
|
+
responses: {
|
|
1129
|
+
200: { contentType: "application/json", schema: ChangeAnalysisSchema },
|
|
1130
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1131
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1132
|
+
},
|
|
1133
|
+
notes: "Exactly one of `since.signature` / `since.revision`; `until=<revision>` defaults to the last. The same answer for every layer and every caller."
|
|
1134
|
+
},
|
|
1135
|
+
"doc.versions.download": {
|
|
1136
|
+
operationId: "doc.versions.download",
|
|
1137
|
+
title: "Download a version",
|
|
1138
|
+
summary: "The bytes of one base version (immutable).",
|
|
1139
|
+
method: "GET",
|
|
1140
|
+
path: wireTemplates.docVersionDownload,
|
|
1141
|
+
credentials: docCredentials,
|
|
1142
|
+
scope: [],
|
|
1143
|
+
docCapabilities: ["doc.download"],
|
|
1144
|
+
requestHeaders: [documentPasswordHeader],
|
|
1145
|
+
params: DocVersionParamsSchema,
|
|
1146
|
+
responses: {
|
|
1147
|
+
200: { contentType: "application/pdf" },
|
|
1148
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
"doc.versions.revision": {
|
|
1152
|
+
operationId: "doc.versions.revision",
|
|
1153
|
+
title: "Download a revision",
|
|
1154
|
+
summary: "The byte prefix of one revision of a base version: exactly what a signature over it signed (immutable).",
|
|
1155
|
+
method: "GET",
|
|
1156
|
+
path: wireTemplates.docVersionRevision,
|
|
1157
|
+
credentials: docCredentials,
|
|
1158
|
+
scope: [],
|
|
1159
|
+
docCapabilities: ["doc.download"],
|
|
1160
|
+
requestHeaders: [documentPasswordHeader],
|
|
1161
|
+
params: DocVersionRevisionParamsSchema,
|
|
1162
|
+
responses: {
|
|
1163
|
+
200: { contentType: "application/pdf" },
|
|
1164
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
919
1167
|
"doc.render": {
|
|
920
1168
|
operationId: "doc.render",
|
|
921
1169
|
title: "Render page",
|
|
@@ -1157,6 +1405,40 @@ var docOperations = {
|
|
|
1157
1405
|
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1158
1406
|
}
|
|
1159
1407
|
},
|
|
1408
|
+
"doc.pages.viewports": {
|
|
1409
|
+
operationId: "doc.pages.viewports",
|
|
1410
|
+
title: "Read measurement viewports",
|
|
1411
|
+
summary: "Read page measurement viewports in drawing order from the current layer.",
|
|
1412
|
+
method: "GET",
|
|
1413
|
+
path: wireTemplates.layerPageViewports,
|
|
1414
|
+
credentials: docCredentials,
|
|
1415
|
+
scope: [],
|
|
1416
|
+
docCapabilities: ["doc.open"],
|
|
1417
|
+
requestHeaders: [documentPasswordHeader],
|
|
1418
|
+
params: DocPageParamsSchema,
|
|
1419
|
+
responses: {
|
|
1420
|
+
200: { contentType: "application/json", schema: z.array(PageMeasurementViewportSchema) },
|
|
1421
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1422
|
+
}
|
|
1423
|
+
},
|
|
1424
|
+
"doc.pages.setScale": {
|
|
1425
|
+
operationId: "doc.pages.setScale",
|
|
1426
|
+
title: "Set page measurement scale",
|
|
1427
|
+
summary: "Upsert or remove EmbedPDF calibration while preserving foreign viewports. Existing annotation scales are unchanged.",
|
|
1428
|
+
method: "PUT",
|
|
1429
|
+
path: wireTemplates.layerPageScale,
|
|
1430
|
+
credentials: docCredentials,
|
|
1431
|
+
scope: [],
|
|
1432
|
+
docCapabilities: ["doc.annotate.modify"],
|
|
1433
|
+
requestHeaders: [documentPasswordHeader],
|
|
1434
|
+
params: DocPageParamsSchema,
|
|
1435
|
+
body: { contentType: "application/json", schema: PageScaleInputSchema },
|
|
1436
|
+
responses: {
|
|
1437
|
+
200: { contentType: "application/json", schema: PageScaleResultSchema },
|
|
1438
|
+
400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
|
|
1439
|
+
404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
|
|
1440
|
+
}
|
|
1441
|
+
},
|
|
1160
1442
|
"doc.pages.move": {
|
|
1161
1443
|
operationId: "doc.pages.move",
|
|
1162
1444
|
title: "Move pages",
|
|
@@ -1371,7 +1653,9 @@ var docsGroups = {
|
|
|
1371
1653
|
"doc.forms": { title: "Forms" },
|
|
1372
1654
|
"doc.metadata": { title: "Metadata" },
|
|
1373
1655
|
"doc.pages": { title: "Pages" },
|
|
1374
|
-
"doc.redactions": { title: "Redactions" }
|
|
1656
|
+
"doc.redactions": { title: "Redactions" },
|
|
1657
|
+
"doc.signatures": { title: "Digital signatures" },
|
|
1658
|
+
"doc.versions": { title: "Versions" }
|
|
1375
1659
|
};
|
|
1376
1660
|
export {
|
|
1377
1661
|
ADMIN_DOCUMENT_LIST_DEFAULT_LIMIT,
|
|
@@ -1414,7 +1698,13 @@ export {
|
|
|
1414
1698
|
DocIdParamsSchema,
|
|
1415
1699
|
DocLayerParamsSchema,
|
|
1416
1700
|
DocPageParamsSchema,
|
|
1701
|
+
DocSigningParamsSchema,
|
|
1702
|
+
DocVersionDigestParamsSchema,
|
|
1703
|
+
DocVersionFieldParamsSchema,
|
|
1704
|
+
DocVersionParamsSchema,
|
|
1705
|
+
DocVersionRevisionParamsSchema,
|
|
1417
1706
|
DocumentStateSchema,
|
|
1707
|
+
LayerSignaturesAnalysisQuerySchema,
|
|
1418
1708
|
ShareExchangeRequestSchema,
|
|
1419
1709
|
ShareGrantCreateRequestSchema,
|
|
1420
1710
|
ShareGrantListQuerySchema,
|
|
@@ -1427,6 +1717,7 @@ export {
|
|
|
1427
1717
|
TenantUsageQuerySchema,
|
|
1428
1718
|
TenantUsageResponseSchema,
|
|
1429
1719
|
UploadPreferenceSchema,
|
|
1720
|
+
VersionAnalysisQuerySchema,
|
|
1430
1721
|
adminCredentials,
|
|
1431
1722
|
adminOperations,
|
|
1432
1723
|
adminTenantScopes,
|