@cloudpdf/contract 3.0.0-next.12 → 3.0.0-next.13

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/openapi.js CHANGED
@@ -14,6 +14,13 @@ import {
14
14
  FormSnapshotSchema,
15
15
  MutationMetaSchema,
16
16
  PageTextSnapshotSchema,
17
+ ChangeAnalysisSchema,
18
+ DocumentVersionsSchema,
19
+ SignatureAbortResultSchema,
20
+ SignatureCompleteBodySchema,
21
+ SignatureCompleteResultSchema,
22
+ SignaturePreparedWireSchema,
23
+ SignatureSnapshotSchema,
17
24
  wireTemplates
18
25
  } from "@embedpdf/engine-core/wire";
19
26
  import { z } from "zod";
@@ -871,6 +878,32 @@ var documentPasswordHeader = {
871
878
  var looseJson = z.record(z.string(), z.unknown());
872
879
  var docCredentials = ["api-token", "doc-jwt"];
873
880
  var MutationResponseSchema = z.object({ meta: MutationMetaSchema }).passthrough();
881
+ var DocSigningParamsSchema = DocLayerParamsSchema.extend({
882
+ signingId: z.string().min(1)
883
+ });
884
+ var sha256Pattern = /^[0-9a-f]{64}$/;
885
+ var DocVersionParamsSchema = DocIdParamsSchema.extend({
886
+ sha: z.string().regex(sha256Pattern)
887
+ });
888
+ var DocVersionFieldParamsSchema = DocVersionParamsSchema.extend({
889
+ fieldKey: z.string().min(1)
890
+ });
891
+ var DocVersionDigestParamsSchema = DocVersionFieldParamsSchema.extend({
892
+ algorithm: z.enum(["sha1", "sha256", "sha384", "sha512"])
893
+ });
894
+ var DocVersionRevisionParamsSchema = DocVersionParamsSchema.extend({
895
+ index: z.coerce.number().int().min(0)
896
+ });
897
+ var LayerSignaturesAnalysisQuerySchema = z.object({
898
+ "since.signature": z.coerce.number().int().min(0).optional(),
899
+ "since.revision": z.coerce.number().int().min(0).optional(),
900
+ level: z.enum(["none", "lta", "fill", "annotate"]).optional()
901
+ });
902
+ var VersionAnalysisQuerySchema = LayerSignaturesAnalysisQuerySchema.extend({
903
+ until: z.coerce.number().int().min(0).optional(),
904
+ /** The judging policy version the caller expects — a cache key on this immutable URL, not an input. */
905
+ policy: z.coerce.number().int().min(1).optional()
906
+ });
874
907
  var docOperations = {
875
908
  "doc.head": {
876
909
  operationId: "doc.head",
@@ -920,6 +953,216 @@ var docOperations = {
920
953
  404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
921
954
  }
922
955
  },
956
+ "doc.signatures.list": {
957
+ operationId: "doc.signatures.list",
958
+ title: "List signatures",
959
+ summary: "The layer view of digital signatures: revisions, every signature field with its signed state, and the protection in force.",
960
+ method: "GET",
961
+ path: wireTemplates.layerSignatures,
962
+ credentials: docCredentials,
963
+ scope: [],
964
+ docCapabilities: ["doc.forms.read"],
965
+ requestHeaders: [documentPasswordHeader],
966
+ params: DocLayerParamsSchema,
967
+ responses: {
968
+ 200: { contentType: "application/json", schema: SignatureSnapshotSchema },
969
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
970
+ },
971
+ 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."
972
+ },
973
+ "doc.signatures.analysis": {
974
+ operationId: "doc.signatures.analysis",
975
+ title: "Analyze layer changes",
976
+ summary: "What the layer changed after a signature (or after any revision), judged against the restrictions in force.",
977
+ method: "GET",
978
+ path: wireTemplates.layerSignaturesAnalysis,
979
+ credentials: docCredentials,
980
+ scope: [],
981
+ docCapabilities: ["doc.forms.read"],
982
+ requestHeaders: [documentPasswordHeader],
983
+ params: DocLayerParamsSchema,
984
+ query: LayerSignaturesAnalysisQuerySchema,
985
+ responses: {
986
+ 200: { contentType: "application/json", schema: ChangeAnalysisSchema },
987
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
988
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
989
+ },
990
+ 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."
991
+ },
992
+ "doc.signatures.prepare": {
993
+ operationId: "doc.signatures.prepare",
994
+ title: "Prepare a signature",
995
+ summary: "Author and seal a signing candidate; returns the digest to sign and the version fences.",
996
+ method: "POST",
997
+ path: wireTemplates.layerSignaturesPrepare,
998
+ credentials: docCredentials,
999
+ scope: [],
1000
+ docCapabilities: ["doc.sign"],
1001
+ requestHeaders: [documentPasswordHeader],
1002
+ params: DocLayerParamsSchema,
1003
+ body: { contentType: "multipart/form-data" },
1004
+ responses: {
1005
+ 200: { contentType: "application/json", schema: SignaturePreparedWireSchema },
1006
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1007
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1008
+ 409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1009
+ },
1010
+ 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)."
1011
+ },
1012
+ "doc.signatures.complete": {
1013
+ operationId: "doc.signatures.complete",
1014
+ title: "Complete a signature",
1015
+ summary: "Install the CMS into the prepared candidate and publish the sealed bytes as the document's next base version.",
1016
+ method: "POST",
1017
+ path: wireTemplates.layerSignatureComplete,
1018
+ credentials: docCredentials,
1019
+ scope: [],
1020
+ docCapabilities: ["doc.sign"],
1021
+ requestHeaders: [documentPasswordHeader],
1022
+ params: DocSigningParamsSchema,
1023
+ body: { contentType: "application/json", schema: SignatureCompleteBodySchema },
1024
+ responses: {
1025
+ 200: { contentType: "application/json", schema: SignatureCompleteResultSchema },
1026
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1027
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1028
+ 409: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1029
+ },
1030
+ 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."
1031
+ },
1032
+ "doc.signatures.abort": {
1033
+ operationId: "doc.signatures.abort",
1034
+ title: "Abort a signature",
1035
+ summary: "Discard a pending signing candidate.",
1036
+ method: "DELETE",
1037
+ path: wireTemplates.layerSignatureAbort,
1038
+ credentials: docCredentials,
1039
+ scope: [],
1040
+ docCapabilities: ["doc.sign"],
1041
+ requestHeaders: [documentPasswordHeader],
1042
+ params: DocSigningParamsSchema,
1043
+ responses: {
1044
+ 200: { contentType: "application/json", schema: SignatureAbortResultSchema },
1045
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1046
+ }
1047
+ },
1048
+ "doc.versions.list": {
1049
+ operationId: "doc.versions.list",
1050
+ title: "List versions",
1051
+ summary: "The document's base versions, oldest first, and its head.",
1052
+ method: "GET",
1053
+ path: wireTemplates.docVersions,
1054
+ credentials: docCredentials,
1055
+ scope: [],
1056
+ docCapabilities: ["doc.open"],
1057
+ requestHeaders: [documentPasswordHeader],
1058
+ params: DocIdParamsSchema,
1059
+ responses: {
1060
+ 200: { contentType: "application/json", schema: DocumentVersionsSchema },
1061
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1062
+ },
1063
+ notes: "Every completed signature publishes a new version. Never cached: the list grows."
1064
+ },
1065
+ "doc.versions.signatures": {
1066
+ operationId: "doc.versions.signatures",
1067
+ title: "Version signatures",
1068
+ summary: "The signature snapshot of one base version (immutable).",
1069
+ method: "GET",
1070
+ path: wireTemplates.docVersionSignatures,
1071
+ credentials: docCredentials,
1072
+ scope: [],
1073
+ docCapabilities: ["doc.forms.read"],
1074
+ requestHeaders: [documentPasswordHeader],
1075
+ params: DocVersionParamsSchema,
1076
+ responses: {
1077
+ 200: { contentType: "application/json", schema: SignatureSnapshotSchema },
1078
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1079
+ }
1080
+ },
1081
+ "doc.versions.signatureContents": {
1082
+ operationId: "doc.versions.signatureContents",
1083
+ title: "Signature contents",
1084
+ summary: "The DER /Contents of a signed field in one base version (immutable).",
1085
+ method: "GET",
1086
+ path: wireTemplates.docVersionSignatureContents,
1087
+ credentials: docCredentials,
1088
+ scope: [],
1089
+ docCapabilities: ["doc.forms.read"],
1090
+ requestHeaders: [documentPasswordHeader],
1091
+ params: DocVersionFieldParamsSchema,
1092
+ responses: {
1093
+ 200: { contentType: "application/pkcs7-signature" },
1094
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1095
+ },
1096
+ notes: "`fieldKey` is the field's fully qualified name, token-text encoded (the same encoding attachment keys use)."
1097
+ },
1098
+ "doc.versions.signatureDigest": {
1099
+ operationId: "doc.versions.signatureDigest",
1100
+ title: "Signature digest",
1101
+ summary: "The digest of a signed field's /ByteRange in one base version (immutable).",
1102
+ method: "GET",
1103
+ path: wireTemplates.docVersionSignatureDigest,
1104
+ credentials: docCredentials,
1105
+ scope: [],
1106
+ docCapabilities: ["doc.forms.read"],
1107
+ requestHeaders: [documentPasswordHeader],
1108
+ params: DocVersionDigestParamsSchema,
1109
+ responses: {
1110
+ 200: { contentType: "application/octet-stream" },
1111
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1112
+ },
1113
+ notes: "What a CMS verifier compares its message digest to."
1114
+ },
1115
+ "doc.versions.analysis": {
1116
+ operationId: "doc.versions.analysis",
1117
+ title: "Analyze version history",
1118
+ summary: "What changed between two revisions of one base version (immutable).",
1119
+ method: "GET",
1120
+ path: wireTemplates.docVersionAnalysis,
1121
+ credentials: docCredentials,
1122
+ scope: [],
1123
+ docCapabilities: ["doc.forms.read"],
1124
+ requestHeaders: [documentPasswordHeader],
1125
+ params: DocVersionParamsSchema,
1126
+ query: VersionAnalysisQuerySchema,
1127
+ responses: {
1128
+ 200: { contentType: "application/json", schema: ChangeAnalysisSchema },
1129
+ 400: { contentType: "application/json", schema: EngineErrorPayloadSchema },
1130
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1131
+ },
1132
+ notes: "Exactly one of `since.signature` / `since.revision`; `until=<revision>` defaults to the last. The same answer for every layer and every caller."
1133
+ },
1134
+ "doc.versions.download": {
1135
+ operationId: "doc.versions.download",
1136
+ title: "Download a version",
1137
+ summary: "The bytes of one base version (immutable).",
1138
+ method: "GET",
1139
+ path: wireTemplates.docVersionDownload,
1140
+ credentials: docCredentials,
1141
+ scope: [],
1142
+ docCapabilities: ["doc.download"],
1143
+ requestHeaders: [documentPasswordHeader],
1144
+ params: DocVersionParamsSchema,
1145
+ responses: {
1146
+ 200: { contentType: "application/pdf" },
1147
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1148
+ }
1149
+ },
1150
+ "doc.versions.revision": {
1151
+ operationId: "doc.versions.revision",
1152
+ title: "Download a revision",
1153
+ summary: "The byte prefix of one revision of a base version: exactly what a signature over it signed (immutable).",
1154
+ method: "GET",
1155
+ path: wireTemplates.docVersionRevision,
1156
+ credentials: docCredentials,
1157
+ scope: [],
1158
+ docCapabilities: ["doc.download"],
1159
+ requestHeaders: [documentPasswordHeader],
1160
+ params: DocVersionRevisionParamsSchema,
1161
+ responses: {
1162
+ 200: { contentType: "application/pdf" },
1163
+ 404: { contentType: "application/json", schema: EngineErrorPayloadSchema }
1164
+ }
1165
+ },
923
1166
  "doc.render": {
924
1167
  operationId: "doc.render",
925
1168
  title: "Render page",
@@ -1375,7 +1618,9 @@ var docsGroups = {
1375
1618
  "doc.forms": { title: "Forms" },
1376
1619
  "doc.metadata": { title: "Metadata" },
1377
1620
  "doc.pages": { title: "Pages" },
1378
- "doc.redactions": { title: "Redactions" }
1621
+ "doc.redactions": { title: "Redactions" },
1622
+ "doc.signatures": { title: "Digital signatures" },
1623
+ "doc.versions": { title: "Versions" }
1379
1624
  };
1380
1625
 
1381
1626
  // src/openapi.ts