@cloudpdf/engine 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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { AbortError, AbortablePromise, AbortablePromise as AbortablePromise$1, AnnotationAppearanceImageOptions, AnnotationAppearanceImagesResult, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationCreateResult, AnnotationDeleteResult, AnnotationDraft, AnnotationFlattenResult, AnnotationListPageSnapshot, AnnotationListSnapshotAllPages, AnnotationMoveResult, AnnotationPatch, AnnotationRef, AnnotationUpdateResult, AttachmentContent, AttachmentsCache, DocumentAccessInfo, DocumentActionsService, DocumentAnnotationsService, DocumentAnnotationsService as DocumentAnnotationsService$1, DocumentAttachmentsService, DocumentCapabilities, DocumentEventStream, DocumentFormsService, DocumentHandle, DocumentHandle as DocumentHandle$1, DocumentIdentity, DocumentMetadata, DocumentPagesService, DocumentPagesService as DocumentPagesService$1, DocumentRedactionService, DocumentRenderService, DocumentSearchService, DocumentSecurityService, DocumentSecurityService as DocumentSecurityService$1, DocumentSecurityState, DocumentUnlockInput, DocumentUnlockResult, Engine, Engine as Engine$1, EngineError, EngineError as EngineError$1, EngineErrorCode, EngineFactory, MetadataCache, MetadataPatch, MetadataService, MetadataService as MetadataService$1, MetadataUpdateResult, MutationMeta, OpenInput, OpenInput as OpenInput$1, OpenInputShare, OpenOptions, OpenOptions as OpenOptions$1, PageAnnotationsService, PageAnnotationsService as PageAnnotationsService$1, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometryService, PageGeometryService as PageGeometryService$1, PageGeometrySnapshot, PageHandle, PageHandle as PageHandle$1, PageImageHandle, PageImageOptions, PageInsertBlankSpec, PageInsertResult, PageListSnapshot, PageMoveResult, PageNameInput, PageNameResult, PageObjectNumber, PageRaster, PageRemoveNameInput, PageRenderOptions, PageRenderService, PageRenderService as PageRenderService$1, PageRotateResult, PageRotation, PageStructureCache, PageTextService, PageTextService as PageTextService$1, PageTextSnapshot, PdfSaveMode, PdfSaveMode as PdfSaveMode$1, SearchRequest, SearchSlice, TokenSource, WeakAnnotationEditSession } from "@embedpdf/engine-core/runtime";
1
+ import { AbortError, AbortablePromise, AbortablePromise as AbortablePromise$1, AnnotationAppearanceImageOptions, AnnotationAppearanceImagesResult, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationCreateResult, AnnotationDeleteResult, AnnotationDraft, AnnotationFlattenResult, AnnotationListPageSnapshot, AnnotationListSnapshotAllPages, AnnotationMoveResult, AnnotationPatch, AnnotationRef, AnnotationUpdateResult, AttachmentContent, AttachmentsCache, DocumentAccessInfo, DocumentActionsService, DocumentAnnotationsService, DocumentAnnotationsService as DocumentAnnotationsService$1, DocumentAttachmentsService, DocumentCapabilities, DocumentEventStream, DocumentFormsService, DocumentHandle, DocumentHandle as DocumentHandle$1, DocumentIdentity, DocumentMetadata, DocumentPagesService, DocumentPagesService as DocumentPagesService$1, DocumentRedactionService, DocumentRenderService, DocumentSearchService, DocumentSecurityService, DocumentSecurityService as DocumentSecurityService$1, DocumentSecurityState, DocumentSignaturesService, DocumentUnlockInput, DocumentUnlockResult, Engine, Engine as Engine$1, EngineError, EngineError as EngineError$1, EngineErrorCode, EngineFactory, MetadataCache, MetadataPatch, MetadataService, MetadataService as MetadataService$1, MetadataUpdateResult, MutationMeta, OpenInput, OpenInput as OpenInput$1, OpenInputShare, OpenOptions, OpenOptions as OpenOptions$1, PageAnnotationsService, PageAnnotationsService as PageAnnotationsService$1, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometryService, PageGeometryService as PageGeometryService$1, PageGeometrySnapshot, PageHandle, PageHandle as PageHandle$1, PageImageHandle, PageImageOptions, PageInsertBlankSpec, PageInsertResult, PageListSnapshot, PageMoveResult, PageNameInput, PageNameResult, PageObjectNumber, PageRaster, PageRemoveNameInput, PageRenderOptions, PageRenderService, PageRenderService as PageRenderService$1, PageRotateResult, PageRotation, PageStructureCache, PageTextService, PageTextService as PageTextService$1, PageTextSnapshot, PdfSaveMode, PdfSaveMode as PdfSaveMode$1, SearchRequest, SearchSlice, TokenSource, WeakAnnotationEditSession } from "@embedpdf/engine-core/runtime";
2
2
  import { CdnAccessInfoForApply, DocumentHead, DocumentManifest, LayerScopePlane } from "@embedpdf/engine-core/wire";
3
3
  import { SessionEventPublisher } from "@embedpdf/engine-services";
4
4
  //#region src/transport/HttpClient.d.ts
@@ -318,6 +318,7 @@ declare class CloudDocumentHandle implements DocumentHandle$1 {
318
318
  readonly annotations: DocumentAnnotationsService$1;
319
319
  readonly actions: DocumentActionsService;
320
320
  readonly attachments: DocumentAttachmentsService;
321
+ readonly signatures: DocumentSignaturesService;
321
322
  readonly forms: DocumentFormsService;
322
323
  readonly search: CloudDocumentSearchService;
323
324
  readonly pages: DocumentPagesService$1;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AbortError, AbortablePromise, AbortablePromise as AbortablePromise$1, AnnotationAppearanceImageOptions, AnnotationAppearanceImagesResult, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationCreateResult, AnnotationDeleteResult, AnnotationDraft, AnnotationFlattenResult, AnnotationListPageSnapshot, AnnotationListSnapshotAllPages, AnnotationMoveResult, AnnotationPatch, AnnotationRef, AnnotationUpdateResult, AttachmentContent, AttachmentsCache, DocumentAccessInfo, DocumentActionsService, DocumentAnnotationsService, DocumentAnnotationsService as DocumentAnnotationsService$1, DocumentAttachmentsService, DocumentCapabilities, DocumentEventStream, DocumentFormsService, DocumentHandle, DocumentHandle as DocumentHandle$1, DocumentIdentity, DocumentMetadata, DocumentPagesService, DocumentPagesService as DocumentPagesService$1, DocumentRedactionService, DocumentRenderService, DocumentSearchService, DocumentSecurityService, DocumentSecurityService as DocumentSecurityService$1, DocumentSecurityState, DocumentUnlockInput, DocumentUnlockResult, Engine, Engine as Engine$1, EngineError, EngineError as EngineError$1, EngineErrorCode, EngineFactory, MetadataCache, MetadataPatch, MetadataService, MetadataService as MetadataService$1, MetadataUpdateResult, MutationMeta, OpenInput, OpenInput as OpenInput$1, OpenInputShare, OpenOptions, OpenOptions as OpenOptions$1, PageAnnotationsService, PageAnnotationsService as PageAnnotationsService$1, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometryService, PageGeometryService as PageGeometryService$1, PageGeometrySnapshot, PageHandle, PageHandle as PageHandle$1, PageImageHandle, PageImageOptions, PageInsertBlankSpec, PageInsertResult, PageListSnapshot, PageMoveResult, PageNameInput, PageNameResult, PageObjectNumber, PageRaster, PageRemoveNameInput, PageRenderOptions, PageRenderService, PageRenderService as PageRenderService$1, PageRotateResult, PageRotation, PageStructureCache, PageTextService, PageTextService as PageTextService$1, PageTextSnapshot, PdfSaveMode, PdfSaveMode as PdfSaveMode$1, SearchRequest, SearchSlice, TokenSource, WeakAnnotationEditSession } from "@embedpdf/engine-core/runtime";
1
+ import { AbortError, AbortablePromise, AbortablePromise as AbortablePromise$1, AnnotationAppearanceImageOptions, AnnotationAppearanceImagesResult, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationCreateResult, AnnotationDeleteResult, AnnotationDraft, AnnotationFlattenResult, AnnotationListPageSnapshot, AnnotationListSnapshotAllPages, AnnotationMoveResult, AnnotationPatch, AnnotationRef, AnnotationUpdateResult, AttachmentContent, AttachmentsCache, DocumentAccessInfo, DocumentActionsService, DocumentAnnotationsService, DocumentAnnotationsService as DocumentAnnotationsService$1, DocumentAttachmentsService, DocumentCapabilities, DocumentEventStream, DocumentFormsService, DocumentHandle, DocumentHandle as DocumentHandle$1, DocumentIdentity, DocumentMetadata, DocumentPagesService, DocumentPagesService as DocumentPagesService$1, DocumentRedactionService, DocumentRenderService, DocumentSearchService, DocumentSecurityService, DocumentSecurityService as DocumentSecurityService$1, DocumentSecurityState, DocumentSignaturesService, DocumentUnlockInput, DocumentUnlockResult, Engine, Engine as Engine$1, EngineError, EngineError as EngineError$1, EngineErrorCode, EngineFactory, MetadataCache, MetadataPatch, MetadataService, MetadataService as MetadataService$1, MetadataUpdateResult, MutationMeta, OpenInput, OpenInput as OpenInput$1, OpenInputShare, OpenOptions, OpenOptions as OpenOptions$1, PageAnnotationsService, PageAnnotationsService as PageAnnotationsService$1, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometryService, PageGeometryService as PageGeometryService$1, PageGeometrySnapshot, PageHandle, PageHandle as PageHandle$1, PageImageHandle, PageImageOptions, PageInsertBlankSpec, PageInsertResult, PageListSnapshot, PageMoveResult, PageNameInput, PageNameResult, PageObjectNumber, PageRaster, PageRemoveNameInput, PageRenderOptions, PageRenderService, PageRenderService as PageRenderService$1, PageRotateResult, PageRotation, PageStructureCache, PageTextService, PageTextService as PageTextService$1, PageTextSnapshot, PdfSaveMode, PdfSaveMode as PdfSaveMode$1, SearchRequest, SearchSlice, TokenSource, WeakAnnotationEditSession } from "@embedpdf/engine-core/runtime";
2
2
  import { CdnAccessInfoForApply, DocumentHead, DocumentManifest, LayerScopePlane } from "@embedpdf/engine-core/wire";
3
3
  import { SessionEventPublisher } from "@embedpdf/engine-services";
4
4
  //#region src/transport/HttpClient.d.ts
@@ -318,6 +318,7 @@ declare class CloudDocumentHandle implements DocumentHandle$1 {
318
318
  readonly annotations: DocumentAnnotationsService$1;
319
319
  readonly actions: DocumentActionsService;
320
320
  readonly attachments: DocumentAttachmentsService;
321
+ readonly signatures: DocumentSignaturesService;
321
322
  readonly forms: DocumentFormsService;
322
323
  readonly search: CloudDocumentSearchService;
323
324
  readonly pages: DocumentPagesService$1;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AbortError, AbortError as AbortError$1, AbortablePromise, AbortablePromise as AbortablePromise$1, CONTINUOUS_RENDER_POLICY, DEFAULT_PDF_SAVE_MODE, EngineError, EngineError as EngineError$1, EngineErrorCode, EngineErrorCode as EngineErrorCode$1, canonicalSearchQuery, checkCapability, checkCollab, checkSetGroup, createPageImageHandle, decodePdfBits, encodeFieldRefKey, encodeStableIdKey, expandRawScope, normalizeAnnotationDraft, normalizeAnnotationPatch, normalizeAttachmentFileSource, passwordPromptFromState, searchContentEpoch, securityStateFromHead } from "@embedpdf/engine-core/runtime";
2
- import { AccessResponseSchema, AnnotationAppearanceManifestSchema, AnnotationCreateResultSchema, AnnotationDeleteResultSchema, AnnotationFlattenResultSchema, AnnotationListPageSnapshotSchema, AnnotationListSnapshotAllPagesSchema, AnnotationMoveResultSchema, AnnotationUpdateResultSchema, AttachmentCreateResultSchema, AttachmentDeleteResultSchema, DEFAULT_LAYER_NAME, DocumentActionsSnapshotSchema, DocumentHeadSchema, DocumentManifestSchema, DocumentMetadataSchema, EmbeddedFileItemSchema, EngineErrorPayloadSchema, FormEffectsResultSchema, FormFieldCreateResultSchema, FormFieldDTOSchema, FormFieldDeleteResultSchema, FormFieldUpdateResultSchema, FormImportResultSchema, FormRepairResultSchema, FormSetValueResultSchema, FormSnapshotSchema, FormWidgetLinkResultSchema, MetadataUpdateResultSchema, PageDeleteResultSchema, PageFlattenResultSchema, PageGeometrySnapshotSchema, PageInsertResultSchema, PageListSnapshotSchema, PageMoveResultSchema, PageNameResultSchema, PageRotateResultSchema, PageTextSnapshotSchema, RedactionApplyResultSchema, SearchSliceSchema, WeakAnnotationSessionResponseSchema, annotationAppearancesImageOptionsToWire, applyCdnAccess, decodeSearchToken, decodeTokenText, encodeSearchToken, renderImageOptionsToWire, wirePaths } from "@embedpdf/engine-core/wire";
2
+ import { AccessResponseSchema, AnnotationAppearanceManifestSchema, AnnotationCreateResultSchema, AnnotationDeleteResultSchema, AnnotationFlattenResultSchema, AnnotationListPageSnapshotSchema, AnnotationListSnapshotAllPagesSchema, AnnotationMoveResultSchema, AnnotationUpdateResultSchema, AttachmentCreateResultSchema, AttachmentDeleteResultSchema, ChangeAnalysisSchema, DEFAULT_LAYER_NAME, DocumentActionsSnapshotSchema, DocumentHeadSchema, DocumentManifestSchema, DocumentMetadataSchema, EmbeddedFileItemSchema, EngineErrorPayloadSchema, FormEffectsResultSchema, FormFieldCreateResultSchema, FormFieldDTOSchema, FormFieldDeleteResultSchema, FormFieldUpdateResultSchema, FormImportResultSchema, FormRepairResultSchema, FormSetValueResultSchema, FormSnapshotSchema, FormWidgetLinkResultSchema, MetadataUpdateResultSchema, PageDeleteResultSchema, PageFlattenResultSchema, PageGeometrySnapshotSchema, PageInsertResultSchema, PageListSnapshotSchema, PageMoveResultSchema, PageNameResultSchema, PageRotateResultSchema, PageTextSnapshotSchema, RedactionApplyResultSchema, SearchSliceSchema, SignatureAbortResultSchema, SignatureCompleteResultSchema, SignaturePreparedWireSchema, SignatureSnapshotSchema, WeakAnnotationSessionResponseSchema, annotationAppearancesImageOptionsToWire, applyCdnAccess, decodePrepared, decodeSearchToken, decodeTokenText, encodeSearchToken, renderImageOptionsToWire, toBase64, wirePaths } from "@embedpdf/engine-core/wire";
3
3
  import { EventHub, SessionEventPublisher, generateUuid } from "@embedpdf/engine-services";
4
4
  //#region src/document/planes.ts
5
5
  /**
@@ -434,6 +434,24 @@ var CloudDocumentFormsService = class {
434
434
  return this.absorbMutation(result, "form.fieldUpdated");
435
435
  });
436
436
  }
437
+ setSignatureAppearance(ref, appearance) {
438
+ const rejected = this.rejectIfClosed();
439
+ if (rejected) return rejected;
440
+ return AbortablePromise$1.run(async (signal) => {
441
+ const bytes = new ArrayBuffer(appearance.pdf.byteLength);
442
+ new Uint8Array(bytes).set(appearance.pdf);
443
+ const form = buildMutationForm({
444
+ resource: "r0",
445
+ pageIndex: appearance.pageIndex ?? 0
446
+ }, { r0: {
447
+ bytes,
448
+ mimeType: "application/pdf",
449
+ name: "appearance.pdf"
450
+ } });
451
+ const result = await this.http.postMultipartJson(wirePaths.layerFormFieldSignatureAppearance(this.docId, this.layerName, encodeFieldRefKey(ref)), form, (raw) => FormFieldUpdateResultSchema.parse(raw), signal);
452
+ return this.absorbMutation(result, "form.fieldUpdated");
453
+ });
454
+ }
437
455
  deleteField(ref) {
438
456
  const rejected = this.rejectIfClosed();
439
457
  if (rejected) return rejected;
@@ -1014,6 +1032,176 @@ function identityFromClaims(claims) {
1014
1032
  return Object.keys(out).length > 0 ? out : null;
1015
1033
  }
1016
1034
  //#endregion
1035
+ //#region src/document/CloudDocumentSignaturesService.ts
1036
+ /**
1037
+ * Cloud-side digital signatures. Two kinds of read, two kinds of URL:
1038
+ *
1039
+ * - The LAYER view (`list`, and `analyze` of the working copy) is pinned
1040
+ * by the manifest's `docVersion`, like every other layer read: a
1041
+ * signature is a layer state change, the immutable URL moves with it.
1042
+ * - Signed BYTES (`contents`, `digest`, `revisionBytes`, and `analyze`
1043
+ * of history) belong to a base VERSION and are content-addressed by
1044
+ * the manifest's `baseSha`: immutable forever, shared by every layer
1045
+ * and every caller.
1046
+ *
1047
+ * Signing is the server's two-phase protocol over the same wire shapes
1048
+ * the local engine uses. `prepare` and `complete` change the manifest in
1049
+ * ways no delta carries (a publish moves `baseSha` itself), so both
1050
+ * refresh it before returning.
1051
+ */
1052
+ var CloudDocumentSignaturesService = class {
1053
+ constructor(http, docId, layerName, isClosed, manifest, publisher) {
1054
+ this.http = http;
1055
+ this.docId = docId;
1056
+ this.layerName = layerName;
1057
+ this.isClosed = isClosed;
1058
+ this.manifest = manifest;
1059
+ this.publisher = publisher;
1060
+ }
1061
+ list() {
1062
+ const rejected = this.closedRejection();
1063
+ if (rejected) return rejected;
1064
+ return AbortablePromise$1.run(async (signal) => this.http.getJsonWithRefresh(async (s) => {
1065
+ const manifest = await this.manifest.get(s);
1066
+ return wirePaths.layerSignatures(this.docId, this.layerName, manifest.docVersion);
1067
+ }, (raw) => SignatureSnapshotSchema.parse(raw), async (s) => {
1068
+ await this.manifest.refresh(s);
1069
+ }, signal));
1070
+ }
1071
+ contents(field) {
1072
+ const rejected = this.closedRejection();
1073
+ if (rejected) return rejected;
1074
+ return AbortablePromise$1.run(async (signal) => {
1075
+ const manifest = await this.manifest.get(signal);
1076
+ const name = await this.fieldName(field, signal);
1077
+ return this.http.getBytes(wirePaths.docVersionSignatureContents(this.docId, manifest.baseSha, name), signal);
1078
+ });
1079
+ }
1080
+ digest(field, algorithm) {
1081
+ const rejected = this.closedRejection();
1082
+ if (rejected) return rejected;
1083
+ return AbortablePromise$1.run(async (signal) => {
1084
+ const manifest = await this.manifest.get(signal);
1085
+ const name = await this.fieldName(field, signal);
1086
+ return this.http.getBytes(wirePaths.docVersionSignatureDigest(this.docId, manifest.baseSha, name, algorithm), signal);
1087
+ });
1088
+ }
1089
+ revisionBytes(revisionIndex) {
1090
+ const rejected = this.closedRejection();
1091
+ if (rejected) return rejected;
1092
+ return AbortablePromise$1.run(async (signal) => {
1093
+ const manifest = await this.manifest.get(signal);
1094
+ return this.http.getBytes(wirePaths.docVersionRevision(this.docId, manifest.baseSha, revisionIndex), signal);
1095
+ });
1096
+ }
1097
+ /**
1098
+ * `until: 'working-copy'` (or unset while the layer holds edits) judges
1099
+ * the layer's pending edits against the base at the layer URL; anything
1100
+ * else is history of the base version and resolves at the version URL.
1101
+ */
1102
+ analyze(input) {
1103
+ const rejected = this.closedRejection();
1104
+ if (rejected) return rejected;
1105
+ return AbortablePromise$1.run(async (signal) => {
1106
+ const manifest = await this.manifest.get(signal);
1107
+ if (input.until === "working-copy" || input.until === void 0 && manifest.working) return this.http.getJsonWithRefresh(async (s) => {
1108
+ const current = await this.manifest.get(s);
1109
+ return wirePaths.layerSignaturesAnalysis(this.docId, this.layerName, {
1110
+ docVersion: current.docVersion,
1111
+ since: input.since,
1112
+ ...input.exploratoryLevel !== void 0 ? { exploratoryLevel: input.exploratoryLevel } : {},
1113
+ ...input.detail !== void 0 ? { detail: input.detail } : {}
1114
+ });
1115
+ }, (raw) => ChangeAnalysisSchema.parse(raw), async (s) => {
1116
+ await this.manifest.refresh(s);
1117
+ }, signal);
1118
+ return this.http.getJson(wirePaths.docVersionAnalysis(this.docId, manifest.baseSha, {
1119
+ since: input.since,
1120
+ ...typeof input.until === "object" ? { until: input.until.revisionIndex } : {},
1121
+ ...input.exploratoryLevel !== void 0 ? { exploratoryLevel: input.exploratoryLevel } : {},
1122
+ ...input.detail !== void 0 ? { detail: input.detail } : {}
1123
+ }), (raw) => ChangeAnalysisSchema.parse(raw), signal);
1124
+ });
1125
+ }
1126
+ prepare(input) {
1127
+ const rejected = this.closedRejection();
1128
+ if (rejected) return rejected;
1129
+ return AbortablePromise$1.run(async (signal) => {
1130
+ const { appearance, ...rest } = input;
1131
+ const form = buildMutationForm({
1132
+ ...rest,
1133
+ ...appearance ? { appearance: {
1134
+ resource: "appearance",
1135
+ ...appearance.pageIndex !== void 0 ? { pageIndex: appearance.pageIndex } : {}
1136
+ } } : {}
1137
+ }, appearance ? { appearance: {
1138
+ bytes: appearance.pdf.slice().buffer,
1139
+ mimeType: "application/pdf",
1140
+ name: "appearance.pdf"
1141
+ } } : {});
1142
+ const prepared = await this.http.postMultipartJson(wirePaths.layerSignaturesPrepare(this.docId, this.layerName), form, (raw) => decodePrepared(SignaturePreparedWireSchema.parse(raw)), signal);
1143
+ await this.manifest.refresh(signal);
1144
+ this.publisher.publishLocal({
1145
+ type: "signature.prepared",
1146
+ signingId: prepared.signingId,
1147
+ field: input.field
1148
+ });
1149
+ return prepared;
1150
+ });
1151
+ }
1152
+ complete(input) {
1153
+ const rejected = this.closedRejection();
1154
+ if (rejected) return rejected;
1155
+ return AbortablePromise$1.run(async (signal) => {
1156
+ const result = await this.http.postJson(wirePaths.layerSignatureComplete(this.docId, this.layerName, input.signingId), {
1157
+ cms: toBase64(input.cms),
1158
+ expectedVersion: input.expectedVersion
1159
+ }, (raw) => SignatureCompleteResultSchema.parse(raw), signal);
1160
+ await this.manifest.refresh(signal);
1161
+ if (result.status === "completed") {
1162
+ this.publisher.publishLocal({
1163
+ type: "signature.completed",
1164
+ signingId: input.signingId,
1165
+ ...result
1166
+ });
1167
+ this.publisher.publishLocal({
1168
+ type: "document.versioned",
1169
+ version: result.version
1170
+ });
1171
+ }
1172
+ return result;
1173
+ });
1174
+ }
1175
+ abort(signingId) {
1176
+ const rejected = this.closedRejection();
1177
+ if (rejected) return rejected;
1178
+ return AbortablePromise$1.run(async (signal) => {
1179
+ const result = await this.http.deleteJson(wirePaths.layerSignatureAbort(this.docId, this.layerName, signingId), (raw) => SignatureAbortResultSchema.parse(raw), signal);
1180
+ if (result.status === "aborted") this.publisher.publishLocal({
1181
+ type: "signature.aborted",
1182
+ signingId
1183
+ });
1184
+ return result;
1185
+ });
1186
+ }
1187
+ /** Version routes address a field by its fully qualified name; an object-number ref is resolved through the snapshot. */
1188
+ async fieldName(field, signal) {
1189
+ if (field.kind === "fqn") return field.name;
1190
+ const match = (await this.http.getJsonWithRefresh(async (s) => {
1191
+ const manifest = await this.manifest.get(s);
1192
+ return wirePaths.layerSignatures(this.docId, this.layerName, manifest.docVersion);
1193
+ }, (raw) => SignatureSnapshotSchema.parse(raw), async (s) => {
1194
+ await this.manifest.refresh(s);
1195
+ }, signal)).signatures.find((s) => s.field.kind === "objectNumber" && s.field.fieldObjectNumber === field.fieldObjectNumber);
1196
+ if (!match) throw new EngineError$1(EngineErrorCode$1.NotFound, `no signature field #${field.fieldObjectNumber}`);
1197
+ return match.fieldName;
1198
+ }
1199
+ closedRejection() {
1200
+ if (!this.isClosed()) return null;
1201
+ return AbortablePromise$1.rejectReason(new EngineError$1(EngineErrorCode$1.DocNotOpen, `document ${this.docId} is closed`));
1202
+ }
1203
+ };
1204
+ //#endregion
1017
1205
  //#region src/document/CloudMetadataService.ts
1018
1206
  var CloudMetadataService = class {
1019
1207
  constructor(http, docId, layerName, isClosed, manifest, publisher) {
@@ -1561,7 +1749,8 @@ function auditRowToEvent(row, mySessionId) {
1561
1749
  origin,
1562
1750
  ...row.payload
1563
1751
  };
1564
- case "form.updateField": return {
1752
+ case "form.updateField":
1753
+ case "form.setSignatureAppearance": return {
1565
1754
  type: "form.fieldUpdated",
1566
1755
  origin,
1567
1756
  ...row.payload
@@ -1701,6 +1890,7 @@ var CloudDocumentHandle = class {
1701
1890
  _defineProperty(this, "annotations", void 0);
1702
1891
  _defineProperty(this, "actions", void 0);
1703
1892
  _defineProperty(this, "attachments", void 0);
1893
+ _defineProperty(this, "signatures", void 0);
1704
1894
  _defineProperty(this, "forms", void 0);
1705
1895
  _defineProperty(this, "search", void 0);
1706
1896
  _defineProperty(this, "pages", void 0);
@@ -1770,6 +1960,7 @@ var CloudDocumentHandle = class {
1770
1960
  this.annotations = new CloudDocumentAnnotationsService(http, id, layerName, () => this.closed, this.manifestAccessor);
1771
1961
  this.actions = new CloudDocumentActionsService(http, id, layerName, () => this.closed, this.manifestAccessor);
1772
1962
  this.attachments = new CloudDocumentAttachmentsService(http, id, layerName, () => this.closed, this.manifestAccessor, this.publisher);
1963
+ this.signatures = new CloudDocumentSignaturesService(http, id, layerName, () => this.closed, this.manifestAccessor, this.publisher);
1773
1964
  this.forms = new CloudDocumentFormsService(http, id, layerName, () => this.closed, this.manifestAccessor, this.publisher);
1774
1965
  this.search = new CloudDocumentSearchService(http, id, layerName, () => this.closed, this.manifestAccessor);
1775
1966
  this.pages = new CloudDocumentPagesService(http, id, layerName, () => this.closed, this.manifestAccessor, this.publisher);
@@ -1872,6 +2063,8 @@ var CloudDocumentHandle = class {
1872
2063
  ...this.manifestCache,
1873
2064
  docVersion: delta?.docVersion ?? this.manifestCache.docVersion,
1874
2065
  ...delta?.annotationsVersion !== void 0 ? { annotationsVersion: delta.annotationsVersion } : {},
2066
+ ...delta?.layerVersion !== void 0 ? { layerVersion: delta.layerVersion } : {},
2067
+ ...delta?.working !== void 0 ? { working: delta.working } : {},
1875
2068
  pages: Array.from(byPageObjectNumber.values()).sort((a, b) => a.state.pageObjectNumber - b.state.pageObjectNumber)
1876
2069
  };
1877
2070
  }