@embedpdf/engine-core 3.0.0-next.14 → 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.
Files changed (135) hide show
  1. package/dist/AnnotationList-DcyhF2kU.d.cts +27691 -0
  2. package/dist/AnnotationList-DcyhF2kU.d.ts +27691 -0
  3. package/dist/Change-Ct-dB8D5.cjs +1133 -0
  4. package/dist/Change-Ct-dB8D5.cjs.map +1 -0
  5. package/dist/Change-tMR34hTU.js +978 -0
  6. package/dist/Change-tMR34hTU.js.map +1 -0
  7. package/dist/DocumentRenderService-9IjSQEIU.cjs +121 -0
  8. package/dist/DocumentRenderService-9IjSQEIU.cjs.map +1 -0
  9. package/dist/DocumentRenderService-DFrZ9wfW.js +86 -0
  10. package/dist/DocumentRenderService-DFrZ9wfW.js.map +1 -0
  11. package/dist/{DocumentSecurityService-Ca6EK3-3.d.ts → DocumentSecurityService-D2zA4NKi.d.cts} +100 -112
  12. package/dist/{DocumentSecurityService-CIx1MT0T.d.cts → DocumentSecurityService-YJV9df8P.d.ts} +100 -112
  13. package/dist/LocalDocumentHandle-D02FMm-Z.cjs +53 -0
  14. package/dist/LocalDocumentHandle-D02FMm-Z.cjs.map +1 -0
  15. package/dist/LocalDocumentHandle-DAPdaOt_.js +30 -0
  16. package/dist/LocalDocumentHandle-DAPdaOt_.js.map +1 -0
  17. package/dist/LocalEngine-DBt2-GWF.d.ts +1649 -0
  18. package/dist/LocalEngine-IA9zh3Jh.d.cts +1649 -0
  19. package/dist/PageInsertBlankInput-CXHAM7l6.cjs +17 -0
  20. package/dist/PageInsertBlankInput-CXHAM7l6.cjs.map +1 -0
  21. package/dist/PageInsertBlankInput-DhVYVJ_S.js +12 -0
  22. package/dist/PageInsertBlankInput-DhVYVJ_S.js.map +1 -0
  23. package/dist/authority-BFp6XM04.cjs +2997 -0
  24. package/dist/authority-BFp6XM04.cjs.map +1 -0
  25. package/dist/authority-PuxpGFhJ.js +2506 -0
  26. package/dist/authority-PuxpGFhJ.js.map +1 -0
  27. package/dist/builders-DV62HA3I.js +165 -0
  28. package/dist/builders-DV62HA3I.js.map +1 -0
  29. package/dist/builders-DgTAj_tP.cjs +188 -0
  30. package/dist/builders-DgTAj_tP.cjs.map +1 -0
  31. package/dist/calibrate-DJbi1wuK.cjs +3012 -0
  32. package/dist/calibrate-DJbi1wuK.cjs.map +1 -0
  33. package/dist/calibrate-nQFgCuki.js +2461 -0
  34. package/dist/calibrate-nQFgCuki.js.map +1 -0
  35. package/dist/charmap-Cprti1ta.js +239 -0
  36. package/dist/charmap-Cprti1ta.js.map +1 -0
  37. package/dist/charmap-aYlefQP9.cjs +304 -0
  38. package/dist/charmap-aYlefQP9.cjs.map +1 -0
  39. package/dist/conformance.cjs +18146 -5258
  40. package/dist/conformance.cjs.map +1 -1
  41. package/dist/conformance.d.cts +1024 -170
  42. package/dist/conformance.d.ts +1024 -170
  43. package/dist/conformance.js +18148 -5309
  44. package/dist/conformance.js.map +1 -1
  45. package/dist/format-Bp3QFSH1.cjs +574 -0
  46. package/dist/format-Bp3QFSH1.cjs.map +1 -0
  47. package/dist/format-Dgg428Kb.js +461 -0
  48. package/dist/format-Dgg428Kb.js.map +1 -0
  49. package/dist/index.cjs +342 -116
  50. package/dist/index.d.cts +2 -2
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +14 -5
  53. package/dist/pageRefs-B3ur7Ckm.cjs +51 -0
  54. package/dist/pageRefs-B3ur7Ckm.cjs.map +1 -0
  55. package/dist/pageRefs-DkbuxSCV.js +40 -0
  56. package/dist/pageRefs-DkbuxSCV.js.map +1 -0
  57. package/dist/public.cjs +59 -0
  58. package/dist/public.d.cts +5 -0
  59. package/dist/public.d.ts +5 -0
  60. package/dist/public.js +9 -0
  61. package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs +3646 -0
  62. package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs.map +1 -0
  63. package/dist/resolveAnnotationDraft-CUpf0SMh.js +3167 -0
  64. package/dist/resolveAnnotationDraft-CUpf0SMh.js.map +1 -0
  65. package/dist/{resolver-inAVzsWt.js → resolver-BBggAxQc.js} +298 -145
  66. package/dist/resolver-BBggAxQc.js.map +1 -0
  67. package/dist/{resolver-CYVNV4hn.cjs → resolver-BWSWSF6R.cjs} +351 -144
  68. package/dist/resolver-BWSWSF6R.cjs.map +1 -0
  69. package/dist/runtime-BaDKjxiu.d.ts +1959 -0
  70. package/dist/runtime-CWEuiwbk.d.cts +1959 -0
  71. package/dist/runtime.cjs +986 -297
  72. package/dist/runtime.cjs.map +1 -1
  73. package/dist/runtime.d.cts +5 -1372
  74. package/dist/runtime.d.ts +5 -1372
  75. package/dist/runtime.js +634 -179
  76. package/dist/runtime.js.map +1 -1
  77. package/dist/schema-6S2VmlAj.js +2087 -0
  78. package/dist/schema-6S2VmlAj.js.map +1 -0
  79. package/dist/schema-miH6tWQC.cjs +3046 -0
  80. package/dist/schema-miH6tWQC.cjs.map +1 -0
  81. package/dist/schemas-BE2QGOit.js +1851 -0
  82. package/dist/schemas-BE2QGOit.js.map +1 -0
  83. package/dist/schemas-DljJR9ut.cjs +2798 -0
  84. package/dist/schemas-DljJR9ut.cjs.map +1 -0
  85. package/dist/subtype-CG4WpIRj.js +129 -0
  86. package/dist/subtype-CG4WpIRj.js.map +1 -0
  87. package/dist/subtype-aDt5TFmK.cjs +158 -0
  88. package/dist/subtype-aDt5TFmK.cjs.map +1 -0
  89. package/dist/validation.cjs +578 -0
  90. package/dist/validation.cjs.map +1 -0
  91. package/dist/validation.d.cts +174 -0
  92. package/dist/validation.d.ts +174 -0
  93. package/dist/validation.js +571 -0
  94. package/dist/validation.js.map +1 -0
  95. package/dist/value-BFS1R8ek.cjs +435 -0
  96. package/dist/value-BFS1R8ek.cjs.map +1 -0
  97. package/dist/value-Dhc8eYcx.js +340 -0
  98. package/dist/value-Dhc8eYcx.js.map +1 -0
  99. package/dist/viewport-CHG9qQUb.cjs +671 -0
  100. package/dist/viewport-CHG9qQUb.cjs.map +1 -0
  101. package/dist/viewport-DQR5LyX3.js +540 -0
  102. package/dist/viewport-DQR5LyX3.js.map +1 -0
  103. package/dist/wire.cjs +1242 -420
  104. package/dist/wire.cjs.map +1 -1
  105. package/dist/wire.d.cts +14840 -830
  106. package/dist/wire.d.ts +14840 -830
  107. package/dist/wire.js +985 -261
  108. package/dist/wire.js.map +1 -1
  109. package/package.json +10 -1
  110. package/dist/AbortError-DwuHPK_I.js +0 -27
  111. package/dist/AbortError-DwuHPK_I.js.map +0 -1
  112. package/dist/AbortError-P0RU0Mgg.cjs +0 -38
  113. package/dist/AbortError-P0RU0Mgg.cjs.map +0 -1
  114. package/dist/AnnotationListSnapshot-D9R5n2Kf.d.cts +0 -7101
  115. package/dist/AnnotationListSnapshot-D9R5n2Kf.d.ts +0 -7101
  116. package/dist/Engine-EWWHhEIi.d.ts +0 -1277
  117. package/dist/Engine-FNaAEjfb.d.cts +0 -1277
  118. package/dist/derive-BbsDk_Kz.cjs +0 -880
  119. package/dist/derive-BbsDk_Kz.cjs.map +0 -1
  120. package/dist/derive-DAFJolWu.js +0 -647
  121. package/dist/derive-DAFJolWu.js.map +0 -1
  122. package/dist/format-Bbphf4zR.js +0 -435
  123. package/dist/format-Bbphf4zR.js.map +0 -1
  124. package/dist/format-D_epWlob.cjs +0 -518
  125. package/dist/format-D_epWlob.cjs.map +0 -1
  126. package/dist/resolver-CYVNV4hn.cjs.map +0 -1
  127. package/dist/resolver-inAVzsWt.js.map +0 -1
  128. package/dist/schemas-CFQGvWiu.js +0 -3243
  129. package/dist/schemas-CFQGvWiu.js.map +0 -1
  130. package/dist/schemas-D0g6tKa9.cjs +0 -4694
  131. package/dist/schemas-D0g6tKa9.cjs.map +0 -1
  132. package/dist/viewport-BWeNHZmb.cjs +0 -3503
  133. package/dist/viewport-BWeNHZmb.cjs.map +0 -1
  134. package/dist/viewport-CvMcadfQ.js +0 -3072
  135. package/dist/viewport-CvMcadfQ.js.map +0 -1
@@ -0,0 +1,1959 @@
1
+ import { $l as AnnotationImportResult, $u as AttachmentRef, Ap as PageGeometrySnapshot, Ba as FormFieldValue, Bg as SignatureCompleteResult, Bl as WidgetPatch, Bo as WidgetPlacement, Ca as AnnotationPosition, Cd as PdfMeasure, Cp as PageExtractFlatten, Cu as AnnotationExportSelection, Cv as DocumentActionsSnapshot, Dg as BaseVersionInfo, Du as WireAnnotationBundle, Fs as AnnotationDraft, Gg as SignaturePrepared, Gi as Change, Gn as RedactionApplyResult, Hg as SignatureDTO, Is as AnnotationPatch, Kn as RedactionApplyScope, Lp as PageTextSnapshot, Ma as CustomMetadataUpdateResult, Mm as PageFlattenResult, No as FormFieldDraft, Og as DigestAlgorithm, Pl as WireFormBundle, Pm as PageFlattenUsage, Pu as BundleLimits, Q_ as SerializedEngineError, Qc as FormImportResult, Qi as RecordedChange, R_ as FormFieldRef, Rg as SignatureCancelResult, Ru as BundleImportPages, Sa as MetadataUpdateResult, Th as DocumentOutline, Tl as FormExportSelection, Ud as WireAnnotationResources, Wa as FormFieldPatch, Wg as SignaturePrepareInput, X_ as EngineError, Xi as ChangeResult, Yg as SignatureSnapshot, Zg as SignedDocumentPolicy, Zv as PageRef, __ as Coordinates, _l as FormWidgetLinkResult, _p as AnnotationAppearanceRenderOptions, b_ as PageBox, bd as PageMeasurementViewport, bh as CustomMetadata, bl as FormWidgetUpdateResult, cl as FormCalculationsReorderResult, cm as PageNetworkRenderFormat, cp as PdfSaveMode, dl as FormFieldUpdateResult, du as AnnotationReorderResult, fg as AnnotationAuthority, fu as AnnotationUpdateResult, gl as FormWidgetDeleteResult, gm as PageRenderOptions, hl as FormSetValueResult, hn as PageScaleResult, hp as AnnotationAppearanceMode, iy as DocumentMetadata, jg as DocumentProtection, kl as FormSnapshot, lf as ObjectNumberRange, li as ChangeAnalysis, ll as FormFieldCreateResult, lu as AnnotationCreateResult, ml as FormResetResult, nr as PageNameResult, ns as SearchRequest, ov as AnnotationActor, pg as ChangeAuthority, ph as PageListSnapshot, pl as FormRepairResult, q_ as AnnotationRef, qu as Attachment, rl as FormValuesImportResult, rp as FontIdentityInfo, rs as SearchSlice, si as AnalyzeInput, su as WriteOptions, t as AnnotationList, tr as AnnotationFlattenResult, ud as AnnotationFamily, ul as FormFieldDeleteResult, um as PageRaster, uu as AnnotationDeleteResult, v_ as PageCoordinates, wa as FieldPosition, xh as MetadataPatch, xl as FormWidgetsReorderResult, xv as AbortablePromise, yh as CustomMetadataPatch, yp as AnnotationAppearancesResult, yv as PdfBits, zg as SignatureCompleteInput } from "./AnnotationList-DcyhF2kU.js";
2
+ import { C as DocumentEventStream, D as DocumentEventOf, E as DocumentEventInit, O as DocumentEventType, Q as DocumentOutlineService, S as WorkingSetPage, T as DocumentEvent, Z as DocumentPagesService, d as PieceInfoPatch, l as PieceInfoUpdateResult, nt as DocumentAttachmentsService, p as PieceInfoSnapshot, s as PieceInfoDeleteResult, x as CallPriority } from "./LocalEngine-DBt2-GWF.js";
3
+ import { f as PdfPermissionAdvisory, l as DocumentSecurityState, p as PdfPermissionInfo } from "./DocumentSecurityService-YJV9df8P.js";
4
+ //#region src/promise/AbortError.d.ts
5
+ /**
6
+ * What a cancelled call rejects with: an `EngineError` with code `Aborted`,
7
+ * named `AbortError` like the DOM's, so both `EngineError.is(err,
8
+ * EngineErrorCode.Aborted)` and `err.name === 'AbortError'` recognise it.
9
+ */
10
+ declare class AbortError extends EngineError {
11
+ readonly name: string;
12
+ readonly reason: unknown;
13
+ constructor(reason?: unknown);
14
+ }
15
+ declare function isAbortError(value: unknown): value is AbortError;
16
+ //#endregion
17
+ //#region src/engine/localEngineBrand.d.ts
18
+ /**
19
+ * Marks what the local engine makes (its engine, documents and pages), so
20
+ * `isLocalEngine()` and `isLocalDocument()` can tell them apart from another
21
+ * engine's. `Symbol.for`, so two copies of this package agree.
22
+ */
23
+ declare const LOCAL_ENGINE_BRAND: unique symbol;
24
+ //#endregion
25
+ //#region src/events/EventHub.d.ts
26
+ /**
27
+ * The in-process implementation of `DocumentEventStream`, shared by both
28
+ * engine shells (one hub per open `DocumentHandle`). The engine that
29
+ * performs a mutation publishes here at confirmation time; the cloud
30
+ * engine's remote channel will also publish here for other sessions'
31
+ * mutations — listeners never learn which transport delivered an event.
32
+ *
33
+ * Delivery contract:
34
+ * - synchronous fan-out in subscription order;
35
+ * - error isolation: a throwing listener is re-thrown on a microtask
36
+ * (so it surfaces to the host's unhandled-error reporting) without
37
+ * blocking other listeners or failing the mutation path;
38
+ * - `lastServerId` tracks the highest remote cursor seen, for the
39
+ * remote channel's reconnect/backfill.
40
+ */
41
+ declare class EventHub implements DocumentEventStream {
42
+ /** Where a throwing listener's error goes. Defaults to an async
43
+ * rethrow so it reaches the host's unhandled-error reporting. */
44
+ private readonly onListenerError;
45
+ private readonly listeners;
46
+ private serverId;
47
+ constructor(
48
+ /** Where a throwing listener's error goes. Defaults to an async
49
+ * rethrow so it reaches the host's unhandled-error reporting. */
50
+ onListenerError?: (err: unknown) => void);
51
+ subscribe(listener: (event: DocumentEvent) => void): () => void;
52
+ on<T extends DocumentEventType>(type: T, listener: (event: DocumentEventOf<T>) => void): () => void;
53
+ publish(event: DocumentEvent): void;
54
+ lastServerId(): number | null;
55
+ /** Drop every listener (handle close). Idempotent. */
56
+ clear(): void;
57
+ }
58
+ /**
59
+ * Stamps provenance onto events a mutation path produces. One per open
60
+ * handle: the engine shell constructs it with the instance's `sessionId`
61
+ * (and, on cloud, the authenticated `sub` when known) and hands it to the
62
+ * mutation services — they publish results, never build origins.
63
+ */
64
+ declare class SessionEventPublisher {
65
+ private readonly hub;
66
+ private readonly sessionId;
67
+ private readonly sub;
68
+ constructor(hub: EventHub, sessionId: string, sub?: string | null);
69
+ /**
70
+ * Publish what one write of this session just committed: one
71
+ * event per fact, in order, all carrying the write's `opId` as
72
+ * `origin.tx`.
73
+ */
74
+ publishWrite(opId: string, ...events: DocumentEventInit[]): void;
75
+ /**
76
+ * Publish what one change committed: its events as {@link publishWrite}
77
+ * does, and for an undo, the `opId` of the change it undid.
78
+ */
79
+ publishChange(opId: string, events: readonly DocumentEventInit[], undoOf?: string): void;
80
+ }
81
+ //#endregion
82
+ //#region src/events/changeEvents.d.ts
83
+ /**
84
+ * The events a change publishes: each op's events as its single verb
85
+ * publishes them, in op order. An op an undo left alone entirely publishes
86
+ * nothing. The publisher stamps them all with the change's `opId`.
87
+ */
88
+ declare function changeEvents(result: ChangeResult): DocumentEventInit[];
89
+ //#endregion
90
+ //#region src/wire/worker-protocol.d.ts
91
+ /**
92
+ * Wire protocol used between an Engine-side queue and any Worker host
93
+ * (browser Web Worker, Node worker_thread, inline). Cloud HTTP traffic
94
+ * uses a different envelope; this is purely the worker boundary.
95
+ *
96
+ * Identical between @embedpdf/engine and @cloudpdf/server because
97
+ * the WorkerHost dispatch logic is the same on both sides — only the
98
+ * underlying PdfRuntimeModule (WASM vs native) differs.
99
+ */
100
+ type WorkerJobId = number;
101
+ /**
102
+ * What a job does to its document: part of every job request's definition,
103
+ * so the one fact has one home. The worker queue keeps each document's jobs
104
+ * in the order this asks for, and the worker closes parsed pages a write may
105
+ * have changed.
106
+ *
107
+ * - `read`: changes nothing. It sees every write asked before it, and may see
108
+ * one asked after it.
109
+ * - `snapshot`: reads the document as of its call, so writes asked after it
110
+ * wait for it (saving, exporting, preparing a signing).
111
+ * - `session`: changes the session, not the document, so writes asked after it
112
+ * wait for it (font settings, cancelling a signing). Reads don't.
113
+ * - `write`: changes the document, but no page's content (annotations, forms,
114
+ * metadata, attachments, names).
115
+ * - `contentWrite`: may change what pages show (page edits, flattening,
116
+ * redaction, a completed signing).
117
+ * - `runtimeWrite`: changes the runtime, for every document (fonts).
118
+ * - `open`: opens the document, or unlocks it; everything after it waits.
119
+ * - `close`: closes the document, or one layer of it, after everything before it.
120
+ */
121
+ type RequestEffect = 'read' | 'snapshot' | 'session' | 'write' | 'contentWrite' | 'runtimeWrite' | 'open' | 'close';
122
+ /** What every document write request may carry besides its own fields. */
123
+ interface WriteJobFields {
124
+ /**
125
+ * The write's id (`WriteOptions.opId`, or the one minted for it). The
126
+ * worker answers a second job with the same id from the first one's
127
+ * outcome, and keys what undoing the write needs under it.
128
+ */
129
+ opId: string;
130
+ /**
131
+ * The first object number the objects the write makes for itself may take
132
+ * (appearance streams, fonts). The worker raises the layer's last object
133
+ * number to just below it before the write runs. A caller that hands
134
+ * object numbers to editing sessions keeps them all below it, so the
135
+ * write's own objects never land on one.
136
+ */
137
+ objectNumberFloor?: number;
138
+ }
139
+ interface OpenFatMemoryWorkerRequest {
140
+ kind: 'open.fatMem';
141
+ effect: 'open';
142
+ jobId: WorkerJobId;
143
+ docId: string;
144
+ bytes: ArrayBuffer;
145
+ password: string | null;
146
+ /** Default `protect`. */
147
+ signedDocumentPolicy?: SignedDocumentPolicy;
148
+ /**
149
+ * Who decides which object numbers a create may name. `'session'` (the
150
+ * default) hands numbers out itself (`objectNumbers.reserve`, and
151
+ * `reserveObjectNumbers` here) and refuses a create naming one it doesn't
152
+ * hold. `'caller'` trusts the caller, which checked every number before
153
+ * sending the job (a server that hands numbers to editing sessions).
154
+ */
155
+ objectNumbers?: 'session' | 'caller';
156
+ /** Object numbers to hand this session as it opens (`'session'` only); the result has them. */
157
+ reserveObjectNumbers?: number;
158
+ }
159
+ type LayerOpenSource = {
160
+ kind: 'fresh';
161
+ } | {
162
+ kind: 'raw-delta';
163
+ bytes: ArrayBuffer;
164
+ } | {
165
+ kind: 'artifact';
166
+ bytes: ArrayBuffer;
167
+ } | {
168
+ kind: 'artifact-file';
169
+ path: string;
170
+ };
171
+ interface OpenLayerMemoryBaseWorkerRequest {
172
+ kind: 'open.layerMemBase';
173
+ effect: 'open';
174
+ jobId: WorkerJobId;
175
+ docId: string;
176
+ /**
177
+ * Omit for a handle whose docId already uniquely identifies the layer
178
+ * session. Cloud layer sessions supply a real layer name when multiple
179
+ * layer views must live under one docId.
180
+ */
181
+ layerName?: string;
182
+ baseKey: string;
183
+ baseBytes: ArrayBuffer;
184
+ layer: LayerOpenSource;
185
+ password: string | null;
186
+ signedDocumentPolicy?: SignedDocumentPolicy;
187
+ /**
188
+ * SHA-256 (hex) of the base bytes, when the caller already holds a
189
+ * verified one. Saves the runtime a full pass over the file; an identity
190
+ * claim only (a wrong value breaks the caller's own layer artifacts).
191
+ */
192
+ baseSha256?: string;
193
+ /**
194
+ * Who decides which object numbers a create may name. `'session'` (the
195
+ * default) hands numbers out itself (`objectNumbers.reserve`, and
196
+ * `reserveObjectNumbers` here) and refuses a create naming one it doesn't
197
+ * hold. `'caller'` trusts the caller, which checked every number before
198
+ * sending the job (a server that hands numbers to editing sessions).
199
+ */
200
+ objectNumbers?: 'session' | 'caller';
201
+ /** Object numbers to hand this session as it opens (`'session'` only); the result has them. */
202
+ reserveObjectNumbers?: number;
203
+ }
204
+ interface OpenLayerFileBaseWorkerRequest {
205
+ kind: 'open.layerFileBase';
206
+ effect: 'open';
207
+ jobId: WorkerJobId;
208
+ docId: string;
209
+ /**
210
+ * Omit for the base-view session. Supplying a name opens a separate
211
+ * layer session under the same docId.
212
+ */
213
+ layerName?: string;
214
+ baseKey: string;
215
+ basePath: string;
216
+ layer: LayerOpenSource;
217
+ password: string | null;
218
+ signedDocumentPolicy?: SignedDocumentPolicy;
219
+ /** See `OpenLayerMemoryBaseWorkerRequest.baseSha256`. */
220
+ baseSha256?: string;
221
+ /**
222
+ * Who decides which object numbers a create may name. `'session'` (the
223
+ * default) hands numbers out itself (`objectNumbers.reserve`, and
224
+ * `reserveObjectNumbers` here) and refuses a create naming one it doesn't
225
+ * hold. `'caller'` trusts the caller, which checked every number before
226
+ * sending the job (a server that hands numbers to editing sessions).
227
+ */
228
+ objectNumbers?: 'session' | 'caller';
229
+ /** Object numbers to hand this session as it opens (`'session'` only); the result has them. */
230
+ reserveObjectNumbers?: number;
231
+ }
232
+ type OpenWorkerRequest = OpenFatMemoryWorkerRequest | OpenLayerMemoryBaseWorkerRequest | OpenLayerFileBaseWorkerRequest;
233
+ interface SignaturesListWorkerRequest {
234
+ kind: 'signatures.list';
235
+ effect: 'read';
236
+ jobId: WorkerJobId;
237
+ docId: string;
238
+ layerName?: string;
239
+ /**
240
+ * Read the session's working copy (its unsaved state as one more revision
241
+ * over the loaded bytes) instead of the loaded bytes. The cloud server
242
+ * sets it: its layer sessions keep every committed edit in memory, so the
243
+ * layer's durable state is the working copy. No-op without unsaved edits.
244
+ */
245
+ workingCopy?: boolean;
246
+ }
247
+ interface SignaturesContentsWorkerRequest {
248
+ kind: 'signatures.contents';
249
+ effect: 'read';
250
+ jobId: WorkerJobId;
251
+ docId: string;
252
+ layerName?: string;
253
+ ref: FormFieldRef;
254
+ }
255
+ interface SignaturesDigestWorkerRequest {
256
+ kind: 'signatures.digest';
257
+ effect: 'read';
258
+ jobId: WorkerJobId;
259
+ docId: string;
260
+ layerName?: string;
261
+ ref: FormFieldRef;
262
+ algorithm: DigestAlgorithm;
263
+ }
264
+ interface SignaturesRevisionBytesWorkerRequest {
265
+ kind: 'signatures.revisionBytes';
266
+ effect: 'read';
267
+ jobId: WorkerJobId;
268
+ docId: string;
269
+ layerName?: string;
270
+ revisionIndex: number;
271
+ }
272
+ interface DocumentVersionWorkerRequest {
273
+ kind: 'document.version';
274
+ effect: 'read';
275
+ jobId: WorkerJobId;
276
+ docId: string;
277
+ layerName?: string;
278
+ }
279
+ interface SignaturesPrepareWorkerRequest {
280
+ kind: 'signatures.prepare';
281
+ effect: 'snapshot';
282
+ jobId: WorkerJobId;
283
+ docId: string;
284
+ layerName?: string;
285
+ input: SignaturePrepareInput;
286
+ /** Who signs and their grants: the field must be theirs to sign. */
287
+ authority: ChangeAuthority;
288
+ }
289
+ interface SignaturesCompleteWorkerRequest extends WriteJobFields {
290
+ kind: 'signatures.complete';
291
+ effect: 'contentWrite';
292
+ jobId: WorkerJobId;
293
+ docId: string;
294
+ layerName?: string;
295
+ input: SignatureCompleteInput;
296
+ artifactPath?: string;
297
+ /** Who signs and their grants: the field must still be theirs to sign. */
298
+ authority: ChangeAuthority;
299
+ }
300
+ interface SignaturesCancelWorkerRequest {
301
+ kind: 'signatures.cancel';
302
+ effect: 'session';
303
+ jobId: WorkerJobId;
304
+ docId: string;
305
+ layerName?: string;
306
+ signingId: string;
307
+ }
308
+ interface SignaturesAnalyzeWorkerRequest {
309
+ kind: 'signatures.analyze';
310
+ effect: 'read';
311
+ jobId: WorkerJobId;
312
+ docId: string;
313
+ layerName?: string;
314
+ input: AnalyzeInput;
315
+ }
316
+ /**
317
+ * Session-less: install a CMS into a signing candidate file and verify the
318
+ * result. The server rebuilds the candidate (base ⊕ durable tail) on
319
+ * whichever replica completes the signing, so this never addresses a
320
+ * session: the file is patched in place, opened into a transient session
321
+ * for the checks, and closed. The caller keeps the sealed file.
322
+ */
323
+ interface SignaturesFinalizeCandidateWorkerRequest {
324
+ kind: 'signatures.finalizeCandidate';
325
+ effect: 'read';
326
+ jobId: WorkerJobId;
327
+ /** The candidate on the worker's filesystem; its /Contents hole is patched in place. */
328
+ path: string;
329
+ /** The /ByteRange the prepare reported — the fence every check is made against. */
330
+ byteRange: [number, number, number, number];
331
+ /** The reserved /Contents size the prepare reported (the hole holds twice as many hex digits). */
332
+ contentsSize: number;
333
+ fieldObjectNumber: number;
334
+ /** The detached CMS over the prepared digest. */
335
+ cms: ArrayBuffer;
336
+ password?: string | null;
337
+ }
338
+ interface MetadataReadWorkerRequest {
339
+ kind: 'metadata.read';
340
+ effect: 'read';
341
+ jobId: WorkerJobId;
342
+ docId: string;
343
+ layerName?: string;
344
+ }
345
+ interface MetadataUpdateWorkerRequest extends WriteJobFields {
346
+ kind: 'metadata.update';
347
+ effect: 'write';
348
+ jobId: WorkerJobId;
349
+ docId: string;
350
+ layerName?: string;
351
+ patch: MetadataPatch;
352
+ artifactPath?: string;
353
+ }
354
+ interface MetadataReadCustomWorkerRequest {
355
+ kind: 'metadata.readCustom';
356
+ effect: 'read';
357
+ jobId: WorkerJobId;
358
+ docId: string;
359
+ layerName?: string;
360
+ }
361
+ interface MetadataUpdateCustomWorkerRequest extends WriteJobFields {
362
+ kind: 'metadata.updateCustom';
363
+ effect: 'write';
364
+ jobId: WorkerJobId;
365
+ docId: string;
366
+ layerName?: string;
367
+ patch: CustomMetadataPatch;
368
+ artifactPath?: string;
369
+ }
370
+ interface ActionsReadWorkerRequest {
371
+ kind: 'actions.read';
372
+ effect: 'read';
373
+ jobId: WorkerJobId;
374
+ docId: string;
375
+ layerName?: string;
376
+ }
377
+ /** The document's outline: every item, depth first (no page is loaded). */
378
+ interface OutlineReadWorkerRequest {
379
+ kind: 'outline.read';
380
+ effect: 'read';
381
+ jobId: WorkerJobId;
382
+ docId: string;
383
+ layerName?: string;
384
+ }
385
+ /**
386
+ * The annotations of the given pages, or of every page: a raw read off the
387
+ * document (no page is loaded), one snapshot per page.
388
+ */
389
+ interface AnnotationsListWorkerRequest {
390
+ kind: 'annotations.list';
391
+ effect: 'read';
392
+ jobId: WorkerJobId;
393
+ docId: string;
394
+ layerName?: string;
395
+ /** In the order to list them; every page when omitted. */
396
+ pages?: PageRef[];
397
+ }
398
+ /**
399
+ * Batch-render every appearance stream of one family on a page. Acquires a
400
+ * `pagePtr`, iterates `/Annots`, and renders each annotation's `/AP` via
401
+ * `EPDF_RenderAnnotBitmap` into its own raster. Read-only.
402
+ */
403
+ interface AnnotationsRenderAppearancesWorkerRequest {
404
+ kind: 'annotations.renderAppearances';
405
+ effect: 'read';
406
+ jobId: WorkerJobId;
407
+ docId: string;
408
+ layerName?: string;
409
+ page: PageRef;
410
+ /** The page's annotations except widgets, or its widgets (`page.forms`). */
411
+ family: AnnotationFamily;
412
+ options?: AnnotationAppearanceRenderOptions;
413
+ }
414
+ interface AnnotationsCreateWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
415
+ kind: 'annotations.create';
416
+ effect: 'write';
417
+ jobId: WorkerJobId;
418
+ docId: string;
419
+ layerName?: string;
420
+ page: PageRef;
421
+ draft: AnnotationDraft<C>;
422
+ /** The object number the annotation gets; the next free one when absent. */
423
+ objectNumber?: number;
424
+ /**
425
+ * The bytes beside the draft, by role. The producer puts each buffer on
426
+ * the wirePack transfer list (zero-copy, same convention as `PageRaster`).
427
+ */
428
+ resources?: WireAnnotationResources;
429
+ artifactPath?: string;
430
+ /**
431
+ * Identity to stamp on the newly created annotation:
432
+ * - `displayName` → /T (PDF author field)
433
+ * - `userId` / `groupId` → /EMBD_Metadata/{UserID,GroupID,CreatedBy,UpdatedBy}
434
+ * Optional — when absent (engine-local with no identity, anonymous tests),
435
+ * the worker still stamps the standard /M (modification date) but skips
436
+ * EMBD_Metadata.
437
+ */
438
+ actor?: AnnotationActor;
439
+ }
440
+ interface AnnotationsUpdateWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
441
+ kind: 'annotations.update';
442
+ effect: 'write';
443
+ jobId: WorkerJobId;
444
+ docId: string;
445
+ layerName?: string;
446
+ ref: AnnotationRef;
447
+ patch: AnnotationPatch<C>;
448
+ /** The bytes beside the patch, by role — see the create request. */
449
+ resources?: WireAnnotationResources;
450
+ artifactPath?: string;
451
+ /**
452
+ * Who the update acts for and what they may do, checked against the
453
+ * annotation inside the write. Its identity refreshes
454
+ * /EMBD_Metadata/UpdatedBy; UserID, GroupID and CreatedBy stay unless the
455
+ * patch reassigns the group.
456
+ */
457
+ authority: AnnotationAuthority;
458
+ }
459
+ /**
460
+ * One change (`doc.apply`): its ops in order, as one transaction, or the
461
+ * reverse of an earlier write (`{ undoOf }`). Each op is checked as its
462
+ * single verb's job checks it, inside the write.
463
+ *
464
+ * A change stays in page space across the worker, both ways: each op's places
465
+ * turn into the file's coordinates right before it runs, and its answer's
466
+ * back right after, against the document as it is then. An earlier op of the
467
+ * same change can add, remove or put back a page a later one names.
468
+ */
469
+ interface DocumentApplyWorkerRequest extends WriteJobFields {
470
+ kind: 'document.apply';
471
+ effect: 'write';
472
+ jobId: WorkerJobId;
473
+ docId: string;
474
+ layerName?: string;
475
+ /** The ops, with their bytes by role on the transfer list, as the single verbs send them. */
476
+ change: Change<PageCoordinates, WireAnnotationResources>;
477
+ /**
478
+ * Who the change acts for, what they may do and what the document's
479
+ * signatures forbid, checked inside the write against each op (the ops of
480
+ * an undo included) and each annotation an op creates, changes or removes.
481
+ * Creates stamp its identity, in the group the draft names; an undo needs
482
+ * its user to be the one who made the change.
483
+ */
484
+ authority: ChangeAuthority;
485
+ artifactPath?: string;
486
+ }
487
+ /**
488
+ * What the engine kept of a change so it can undo it, as it crosses the
489
+ * worker boundary: who made it and the steps that reverse it. Its steps are
490
+ * the engine's own; a caller stores them and hands them back, never reads
491
+ * them.
492
+ */
493
+ interface ChangeRecordPayload {
494
+ readonly userId: string | null;
495
+ readonly steps: readonly unknown[];
496
+ }
497
+ /** One change of a server request (see `DocumentApplyChangesWorkerRequest`). */
498
+ interface ServerChange {
499
+ opId: string;
500
+ /** Its ops (a single-verb route's one op, an import's among them), or an undo. */
501
+ change: RecordedChange<PageCoordinates, WireAnnotationResources>;
502
+ /** Who the change acts for (see `DocumentApplyWorkerRequest.authority`). */
503
+ authority: ChangeAuthority;
504
+ /**
505
+ * For an undo of a change outside this request: the record that change
506
+ * left, or null when it left none (it was refused, or wrote nothing). The
507
+ * caller checked who may undo it and that nothing ended undo since. An undo
508
+ * of an earlier change of the same request leaves it out: the job keeps
509
+ * the records of its own changes.
510
+ */
511
+ record?: ChangeRecordPayload | null;
512
+ }
513
+ /**
514
+ * A server request's changes, as one job: each runs in its own layer
515
+ * transaction, committed or rolled back on its own, in order. A refusal is
516
+ * that change's answer; anything else fails the job. The job saves one
517
+ * artifact for the changes that applied. Page space both ways, each op
518
+ * converted as it runs (see `DocumentApplyWorkerRequest`).
519
+ */
520
+ interface DocumentApplyChangesWorkerRequest {
521
+ kind: 'document.applyChanges';
522
+ effect: 'write';
523
+ jobId: WorkerJobId;
524
+ docId: string;
525
+ layerName?: string;
526
+ changes: ServerChange[];
527
+ /** See `WriteJobFields.objectNumberFloor`. */
528
+ objectNumberFloor?: number;
529
+ artifactPath?: string;
530
+ }
531
+ /** What one change of a server request answered. */
532
+ type ServerChangeOutcome = {
533
+ opId: string;
534
+ status: 'applied';
535
+ result: ChangeResult;
536
+ /** What undoes it, for the caller to keep; null when nothing can. */
537
+ record: ChangeRecordPayload | null;
538
+ } | {
539
+ opId: string;
540
+ status: 'refused';
541
+ error: SerializedEngineError;
542
+ };
543
+ interface AnnotationsDeleteWorkerRequest extends WriteJobFields {
544
+ kind: 'annotations.delete';
545
+ effect: 'write';
546
+ jobId: WorkerJobId;
547
+ docId: string;
548
+ layerName?: string;
549
+ ref: AnnotationRef;
550
+ /**
551
+ * Who the delete acts for and what they may do, checked inside the write
552
+ * against the annotation and everything deleted with it (`deletedWith`).
553
+ */
554
+ authority: AnnotationAuthority;
555
+ artifactPath?: string;
556
+ }
557
+ /** Flatten a chosen set of one page's annotations into its content — see
558
+ * `AnnotationFlattenInput`. A content + annotation mutation of that page. */
559
+ interface AnnotationsFlattenWorkerRequest extends WriteJobFields {
560
+ kind: 'annotations.flatten';
561
+ effect: 'contentWrite';
562
+ jobId: WorkerJobId;
563
+ docId: string;
564
+ layerName?: string;
565
+ page: PageRef;
566
+ refs: AnnotationRef[];
567
+ usage: PageFlattenUsage;
568
+ artifactPath?: string;
569
+ }
570
+ /** Flatten a chosen set of one page's annotation appearances into a new
571
+ * single-page PDF (bytes). A read: no artifact, no revision. */
572
+ interface AnnotationsExportAppearanceWorkerRequest {
573
+ kind: 'annotations.exportAppearance';
574
+ effect: 'snapshot';
575
+ jobId: WorkerJobId;
576
+ docId: string;
577
+ layerName?: string;
578
+ page: PageRef;
579
+ refs: AnnotationRef[];
580
+ }
581
+ /** Annotations and their resources as one bundle (`doc.annotations.export`). A read. */
582
+ interface AnnotationsExportWorkerRequest {
583
+ kind: 'annotations.export';
584
+ effect: 'snapshot';
585
+ jobId: WorkerJobId;
586
+ docId: string;
587
+ layerName?: string;
588
+ selection: AnnotationExportSelection;
589
+ /** The limits the bundle must stay within; the defaults otherwise. */
590
+ limits?: BundleLimits;
591
+ }
592
+ /**
593
+ * A bundle's annotations, created as one change (`doc.annotations.import`).
594
+ * The producer puts each resource's buffer on the transfer list. The bundle
595
+ * stays in page space on its way in: the import measures each item on the
596
+ * page it goes to, which only the import works out.
597
+ */
598
+ interface AnnotationsImportWorkerRequest extends WriteJobFields {
599
+ kind: 'annotations.import';
600
+ effect: 'write';
601
+ jobId: WorkerJobId;
602
+ docId: string;
603
+ layerName?: string;
604
+ bundle: WireAnnotationBundle;
605
+ pages?: BundleImportPages;
606
+ attribution: 'restore' | 'stamp';
607
+ /**
608
+ * The session: who `'stamp'` attributes each annotation to, as on create,
609
+ * and whose user `'restore'` records as `importedBy`.
610
+ */
611
+ actor?: AnnotationActor;
612
+ /** The limits the bundle must stay within; the defaults otherwise. */
613
+ limits?: BundleLimits;
614
+ artifactPath?: string;
615
+ }
616
+ /** An annotation's `appearance` resource: its drawing, as a one-page PDF (bytes). A read. */
617
+ interface AnnotationsReadAppearanceWorkerRequest {
618
+ kind: 'annotations.readAppearance';
619
+ effect: 'read';
620
+ jobId: WorkerJobId;
621
+ docId: string;
622
+ layerName?: string;
623
+ page: PageRef;
624
+ ref: AnnotationRef;
625
+ }
626
+ /** A page's annotations' stacking order: `refs` go together to `position`. */
627
+ interface AnnotationsReorderWorkerRequest extends WriteJobFields {
628
+ kind: 'annotations.reorder';
629
+ effect: 'write';
630
+ jobId: WorkerJobId;
631
+ docId: string;
632
+ layerName?: string;
633
+ page: PageRef;
634
+ refs: AnnotationRef[];
635
+ position: AnnotationPosition;
636
+ /** Who the reorder acts for and what they may do: checked against each annotation, inside the write. */
637
+ authority: AnnotationAuthority;
638
+ artifactPath?: string;
639
+ }
640
+ /**
641
+ * Complete reconciled form snapshot. Cheap between mutations: the worker
642
+ * caches the underlying EPDFForm model keyed on the session's mutation
643
+ * counter and rebuilds only after a write.
644
+ */
645
+ interface FormsListWorkerRequest {
646
+ kind: 'forms.list';
647
+ effect: 'read';
648
+ jobId: WorkerJobId;
649
+ docId: string;
650
+ layerName?: string;
651
+ }
652
+ interface FormsSetValueWorkerRequest extends WriteJobFields {
653
+ kind: 'forms.setValue';
654
+ effect: 'write';
655
+ jobId: WorkerJobId;
656
+ docId: string;
657
+ layerName?: string;
658
+ ref: FormFieldRef;
659
+ value: FormFieldValue;
660
+ artifactPath?: string;
661
+ /**
662
+ * Who the write acts for (stamped as its filler or creator) and their
663
+ * grants, checked field by field inside the write.
664
+ */
665
+ authority: ChangeAuthority;
666
+ }
667
+ interface FormsResetWorkerRequest extends WriteJobFields {
668
+ kind: 'forms.reset';
669
+ effect: 'write';
670
+ jobId: WorkerJobId;
671
+ docId: string;
672
+ layerName?: string;
673
+ /** The fields to reset; absent resets the whole form. */
674
+ refs?: FormFieldRef[];
675
+ artifactPath?: string;
676
+ /**
677
+ * Who the write acts for (stamped as its filler or creator) and their
678
+ * grants, checked field by field inside the write.
679
+ */
680
+ authority: ChangeAuthority;
681
+ }
682
+ /** `doc.forms.export`: the fields a selection takes, as a bundle. A snapshot read. */
683
+ interface FormsExportWorkerRequest {
684
+ kind: 'forms.export';
685
+ effect: 'snapshot';
686
+ jobId: WorkerJobId;
687
+ docId: string;
688
+ layerName?: string;
689
+ selection: FormExportSelection;
690
+ /** The limits the bundle must stay within; the defaults otherwise. */
691
+ limits?: BundleLimits;
692
+ }
693
+ /** `doc.forms.import`: a bundle's design, as one change (see `FormImportOp`). */
694
+ interface FormsImportWorkerRequest extends WriteJobFields {
695
+ kind: 'forms.import';
696
+ effect: 'write';
697
+ jobId: WorkerJobId;
698
+ docId: string;
699
+ layerName?: string;
700
+ /** Page space; each resource on the transfer list. */
701
+ bundle: WireFormBundle;
702
+ pages?: BundleImportPages;
703
+ attribution: 'restore' | 'stamp';
704
+ values: boolean;
705
+ /**
706
+ * Who imports and their grants: whom `'stamp'` makes the creator and
707
+ * filler, whose user `'restore'` records as `importedBy`, and who may put
708
+ * the fields in which groups.
709
+ */
710
+ authority: ChangeAuthority;
711
+ limits?: BundleLimits;
712
+ /** Whether the caller holds `doc.forms.script`: without it, scripts, submits and links are left out. */
713
+ mayScript: boolean;
714
+ artifactPath?: string;
715
+ }
716
+ /** `doc.forms.importValues`: a bundle's values, as one change (see `FormImportOp`). */
717
+ interface FormsImportValuesWorkerRequest extends WriteJobFields {
718
+ kind: 'forms.importValues';
719
+ effect: 'write';
720
+ jobId: WorkerJobId;
721
+ docId: string;
722
+ layerName?: string;
723
+ bundle: WireFormBundle;
724
+ attribution: 'restore' | 'stamp';
725
+ /**
726
+ * Who imports and their grants: whom `'stamp'` makes the filler, whose
727
+ * user `'restore'` records as `importedBy`, and which fields they may fill.
728
+ */
729
+ authority: ChangeAuthority;
730
+ limits?: BundleLimits;
731
+ artifactPath?: string;
732
+ }
733
+ interface FormsRepairWorkerRequest extends WriteJobFields {
734
+ kind: 'forms.repair';
735
+ effect: 'write';
736
+ jobId: WorkerJobId;
737
+ docId: string;
738
+ layerName?: string;
739
+ bakeAppearances?: boolean;
740
+ artifactPath?: string;
741
+ }
742
+ interface FormsCreateFieldWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
743
+ kind: 'forms.createField';
744
+ effect: 'write';
745
+ jobId: WorkerJobId;
746
+ docId: string;
747
+ layerName?: string;
748
+ draft: FormFieldDraft<C>;
749
+ /** The field's object number; the next free one when absent. */
750
+ objectNumber?: number;
751
+ /** Its widgets' object numbers, in `draft.widgets` order; the next free ones when absent. */
752
+ widgetObjectNumbers?: number[];
753
+ artifactPath?: string;
754
+ /**
755
+ * Who creates the field (stamped as its creator, and whose group it goes
756
+ * in by default) and their grants: which groups they may put it in.
757
+ */
758
+ authority: ChangeAuthority;
759
+ }
760
+ interface FormsUpdateFieldWorkerRequest extends WriteJobFields {
761
+ kind: 'forms.updateField';
762
+ effect: 'write';
763
+ jobId: WorkerJobId;
764
+ docId: string;
765
+ layerName?: string;
766
+ ref: FormFieldRef;
767
+ patch: FormFieldPatch;
768
+ artifactPath?: string;
769
+ /** Who changes the field and their grants: which group they may move it to. */
770
+ authority: ChangeAuthority;
771
+ }
772
+ /** Draw a PDF page into every widget of an unsigned signature field (the visual fill). */
773
+ interface FormsSetSignatureAppearanceWorkerRequest extends WriteJobFields {
774
+ kind: 'forms.setSignatureAppearance';
775
+ effect: 'write';
776
+ jobId: WorkerJobId;
777
+ docId: string;
778
+ layerName?: string;
779
+ ref: FormFieldRef;
780
+ pdf: ArrayBuffer;
781
+ artifactPath?: string;
782
+ /** Who draws the look and their grants: the field must be theirs to sign. */
783
+ authority: ChangeAuthority;
784
+ }
785
+ interface FormsDeleteFieldWorkerRequest extends WriteJobFields {
786
+ kind: 'forms.deleteField';
787
+ effect: 'write';
788
+ jobId: WorkerJobId;
789
+ docId: string;
790
+ layerName?: string;
791
+ ref: FormFieldRef;
792
+ artifactPath?: string;
793
+ }
794
+ interface FormsAddWidgetWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
795
+ kind: 'forms.addWidget';
796
+ effect: 'write';
797
+ jobId: WorkerJobId;
798
+ docId: string;
799
+ layerName?: string;
800
+ ref: FormFieldRef;
801
+ placement: WidgetPlacement<C>;
802
+ /** The new widget's object number; the next free one when absent. */
803
+ objectNumber?: number;
804
+ /** Where a merged field's widget moves when it splits; the next free one when absent. */
805
+ splitObjectNumber?: number;
806
+ artifactPath?: string;
807
+ }
808
+ interface FormsDetachWidgetWorkerRequest extends WriteJobFields {
809
+ kind: 'forms.detachWidget';
810
+ effect: 'write';
811
+ jobId: WorkerJobId;
812
+ docId: string;
813
+ layerName?: string;
814
+ ref: FormFieldRef;
815
+ widget: AnnotationRef;
816
+ artifactPath?: string;
817
+ }
818
+ /** A widget leaves its page, and its field when it has one. */
819
+ interface FormsDeleteWidgetWorkerRequest extends WriteJobFields {
820
+ kind: 'forms.deleteWidget';
821
+ effect: 'write';
822
+ jobId: WorkerJobId;
823
+ docId: string;
824
+ layerName?: string;
825
+ widget: AnnotationRef;
826
+ artifactPath?: string;
827
+ }
828
+ /** The form's calculation order: `fields` go together to `position`. */
829
+ interface FormsReorderCalculationsWorkerRequest extends WriteJobFields {
830
+ kind: 'forms.reorderCalculations';
831
+ effect: 'write';
832
+ jobId: WorkerJobId;
833
+ docId: string;
834
+ layerName?: string;
835
+ fields: FormFieldRef[];
836
+ position: FieldPosition;
837
+ artifactPath?: string;
838
+ }
839
+ /** A page's widgets' stacking order: `widgets` go together to `position`. */
840
+ interface FormsReorderWidgetsWorkerRequest extends WriteJobFields {
841
+ kind: 'forms.reorderWidgets';
842
+ effect: 'write';
843
+ jobId: WorkerJobId;
844
+ docId: string;
845
+ layerName?: string;
846
+ page: PageRef;
847
+ widgets: AnnotationRef[];
848
+ position: AnnotationPosition;
849
+ artifactPath?: string;
850
+ }
851
+ interface FormsUpdateWidgetWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
852
+ kind: 'forms.updateWidget';
853
+ effect: 'write';
854
+ jobId: WorkerJobId;
855
+ docId: string;
856
+ layerName?: string;
857
+ widget: AnnotationRef;
858
+ patch: WidgetPatch<C>;
859
+ artifactPath?: string;
860
+ }
861
+ interface PagesListWorkerRequest {
862
+ kind: 'pages.list';
863
+ effect: 'read';
864
+ jobId: WorkerJobId;
865
+ docId: string;
866
+ layerName?: string;
867
+ }
868
+ /**
869
+ * Per-page plain-text extraction. Acquires a pagePtr and runs PDFium's
870
+ * `FPDFText_LoadPage` → `FPDFText_GetText` chain: a slow-path per-page
871
+ * read keyed by indirect object number.
872
+ */
873
+ interface PagesTextWorkerRequest {
874
+ kind: 'pages.text';
875
+ effect: 'read';
876
+ jobId: WorkerJobId;
877
+ docId: string;
878
+ layerName?: string;
879
+ page: PageRef;
880
+ }
881
+ interface PagesGeometryWorkerRequest {
882
+ kind: 'pages.geometry';
883
+ effect: 'read';
884
+ jobId: WorkerJobId;
885
+ docId: string;
886
+ layerName?: string;
887
+ page: PageRef;
888
+ }
889
+ /**
890
+ * A search request as the worker runs it: the request plus `skip`, a trusted
891
+ * absolute resume position (scan-order pages already searched). For callers
892
+ * that pin content versions themselves — the cloud wire pins the search
893
+ * content epoch in the URL, so its routes resume by position alone.
894
+ * Everyone else uses `cursor`, which also guards against changes between
895
+ * batches; `cursor` takes precedence when both are set.
896
+ */
897
+ interface SearchScanRequest extends SearchRequest {
898
+ skip?: number;
899
+ }
900
+ /**
901
+ * One budgeted search batch (see `DocumentSearchService`). Read-only: the
902
+ * worker's per-page corpus cache is version-keyed on the session mutation
903
+ * counter, so repeated batches between mutations reuse extracted text.
904
+ */
905
+ interface SearchQueryWorkerRequest {
906
+ kind: 'search.query';
907
+ effect: 'read';
908
+ jobId: WorkerJobId;
909
+ docId: string;
910
+ layerName?: string;
911
+ request: SearchScanRequest;
912
+ }
913
+ interface PagesRenderWorkerRequest<C extends Coordinates = PageCoordinates> {
914
+ kind: 'pages.render';
915
+ effect: 'read';
916
+ jobId: WorkerJobId;
917
+ docId: string;
918
+ layerName?: string;
919
+ page: PageRef;
920
+ options?: PageRenderOptions<C>;
921
+ }
922
+ /**
923
+ * One-shot file render — open the base document from a file path, render
924
+ * one page by display index, close. No session is bound (the ingestion
925
+ * `runAdHoc` pattern, like `document.probeSecurityFile`): this is the
926
+ * derived-artifact warmer's producer, used when no live document session
927
+ * exists yet. The payload reports the page's durable object number so the
928
+ * caller can key the artifact it persists.
929
+ */
930
+ interface DocumentRenderPageFileWorkerRequest {
931
+ kind: 'document.renderPageFile';
932
+ effect: 'read';
933
+ jobId: WorkerJobId;
934
+ path: string;
935
+ password: string | null;
936
+ /** Display index (0-based) — ingest knows "first page", not object numbers. */
937
+ pageIndex: number;
938
+ options?: PageRenderOptions;
939
+ }
940
+ /**
941
+ * Encode instruction for the `*.renderEncoded` request family. Cloud-server
942
+ * surface (like the file-path ops): the server worker injects an image
943
+ * encoder into its `WorkerHost`, so the raster is encoded where IT is
944
+ * produced and only the compressed image crosses the engine boundary —
945
+ * kilobytes over the host IPC pipe instead of a megabytes-scale rgba
946
+ * copy. Engines without an injected encoder (browser/local workers, which
947
+ * encode via canvas instead) reject these kinds with `NotImplemented`.
948
+ * Policy stays caller-side: format and quality always arrive in the
949
+ * request; the engine plane holds no image-policy defaults.
950
+ */
951
+ interface RenderEncode {
952
+ format: PageNetworkRenderFormat;
953
+ quality?: number;
954
+ }
955
+ /** An encoded render result. `width`/`height` are the source raster's output
956
+ * dimensions (they feed the advisory image-dimension headers). `bytes` must
957
+ * own its buffer — it rides the transfer manifest zero-copy, so a pooled
958
+ * view (e.g. a Node `Buffer` slab slice) would detach unrelated data. */
959
+ interface EncodedImageWire {
960
+ contentType: string;
961
+ width: number;
962
+ height: number;
963
+ bytes: Uint8Array;
964
+ }
965
+ interface PagesRenderEncodedWorkerRequest<C extends Coordinates = PageCoordinates> {
966
+ kind: 'pages.renderEncoded';
967
+ effect: 'read';
968
+ jobId: WorkerJobId;
969
+ docId: string;
970
+ layerName?: string;
971
+ page: PageRef;
972
+ options?: PageRenderOptions<C>;
973
+ encode: RenderEncode;
974
+ }
975
+ /** `document.renderPageFile` + in-worker encode — same one-shot transient
976
+ * session semantics; see that request's docs. */
977
+ interface DocumentRenderPageFileEncodedWorkerRequest {
978
+ kind: 'document.renderPageFileEncoded';
979
+ effect: 'read';
980
+ jobId: WorkerJobId;
981
+ path: string;
982
+ password: string | null;
983
+ /** Display index (0-based) — ingest knows "first page", not object numbers. */
984
+ pageIndex: number;
985
+ options?: PageRenderOptions;
986
+ encode: RenderEncode;
987
+ }
988
+ interface AnnotationsRenderAppearancesEncodedWorkerRequest {
989
+ kind: 'annotations.renderAppearancesEncoded';
990
+ effect: 'read';
991
+ jobId: WorkerJobId;
992
+ docId: string;
993
+ layerName?: string;
994
+ page: PageRef;
995
+ /** The page's annotations except widgets, or its widgets (`page.forms`). */
996
+ family: AnnotationFamily;
997
+ options?: AnnotationAppearanceRenderOptions;
998
+ encode: RenderEncode;
999
+ }
1000
+ /** Encoded counterpart of `AnnotationAppearanceRaster`: same identity and
1001
+ * placement metadata, image instead of raster. */
1002
+ interface EncodedAppearanceWire<C extends Coordinates = PageCoordinates> {
1003
+ ref: AnnotationRef;
1004
+ mode: AnnotationAppearanceMode;
1005
+ state: string | null;
1006
+ rect: C['box'];
1007
+ image: EncodedImageWire;
1008
+ }
1009
+ interface AnnotationAppearancesEncodedResultWire<C extends Coordinates = PageCoordinates> {
1010
+ page: PageRef;
1011
+ appearances: EncodedAppearanceWire<C>[];
1012
+ }
1013
+ /** Register/rename a `/Names /Pages` entry — see `PageNameInput`. */
1014
+ interface PagesSetNameWorkerRequest extends WriteJobFields {
1015
+ kind: 'pages.setName';
1016
+ effect: 'write';
1017
+ jobId: WorkerJobId;
1018
+ docId: string;
1019
+ layerName?: string;
1020
+ name: string;
1021
+ page: PageRef;
1022
+ replace?: string;
1023
+ artifactPath?: string;
1024
+ }
1025
+ /** Remove a `/Names /Pages` entry — see `PageRemoveNameInput`. */
1026
+ interface PagesRemoveNameWorkerRequest extends WriteJobFields {
1027
+ kind: 'pages.removeName';
1028
+ effect: 'write';
1029
+ jobId: WorkerJobId;
1030
+ docId: string;
1031
+ layerName?: string;
1032
+ name: string;
1033
+ artifactPath?: string;
1034
+ }
1035
+ interface PagesFlattenWorkerRequest extends WriteJobFields {
1036
+ kind: 'pages.flatten';
1037
+ effect: 'contentWrite';
1038
+ jobId: WorkerJobId;
1039
+ docId: string;
1040
+ layerName?: string;
1041
+ pages: PageRef[];
1042
+ usage: PageFlattenUsage;
1043
+ artifactPath?: string;
1044
+ }
1045
+ interface RedactionApplyWorkerRequest extends WriteJobFields {
1046
+ kind: 'redaction.apply';
1047
+ effect: 'contentWrite';
1048
+ jobId: WorkerJobId;
1049
+ docId: string;
1050
+ layerName?: string;
1051
+ scope: RedactionApplyScope;
1052
+ artifactPath?: string;
1053
+ }
1054
+ /** Export the given pages as a standalone PDF (a read — the source
1055
+ * session is untouched, so no layer artifact rides the result). */
1056
+ interface PagesExtractWorkerRequest {
1057
+ kind: 'pages.extract';
1058
+ effect: 'snapshot';
1059
+ jobId: WorkerJobId;
1060
+ docId: string;
1061
+ layerName?: string;
1062
+ pages: PageRef[];
1063
+ /** A flattened copy: what it paints, already checked against the caller's
1064
+ * rights (`resolvePageExtract`). Absent for a plain copy. */
1065
+ flatten?: PageExtractFlatten;
1066
+ }
1067
+ /** List the document catalog's `/EmbeddedFiles` name tree (a read). */
1068
+ interface AttachmentsListWorkerRequest {
1069
+ kind: 'attachments.list';
1070
+ effect: 'read';
1071
+ jobId: WorkerJobId;
1072
+ docId: string;
1073
+ layerName?: string;
1074
+ }
1075
+ /**
1076
+ * Decode one document-level embedded file (a read — no revision bump, no
1077
+ * layer artifact). Two delivery modes, the `artifactPath?` pattern:
1078
+ * `path` absent → browser mode, decoded bytes ride the transfer list;
1079
+ * `path` present → server mode, the worker streams the decoded file to
1080
+ * that path (`EPDFAttachment_ExtractFile` + `FPDF_FILEWRITE`) so the
1081
+ * payload never crosses the thread boundary and HTTP can stream it from
1082
+ * disk with backpressure.
1083
+ */
1084
+ interface AttachmentsReadFileWorkerRequest {
1085
+ kind: 'attachments.readFile';
1086
+ effect: 'read';
1087
+ jobId: WorkerJobId;
1088
+ docId: string;
1089
+ layerName?: string;
1090
+ ref: AttachmentRef;
1091
+ path?: string;
1092
+ /** Decompression-bomb cap forwarded to the runtime. Absent/0 = unlimited. */
1093
+ maxDecodedBytes?: number;
1094
+ }
1095
+ /** Decode the file embedded in a FileAttachment annotation's `/FS`.
1096
+ * Same read semantics and delivery modes as `attachments.readFile`. */
1097
+ interface AnnotationsReadFileWorkerRequest {
1098
+ kind: 'annotations.readFile';
1099
+ effect: 'read';
1100
+ jobId: WorkerJobId;
1101
+ docId: string;
1102
+ layerName?: string;
1103
+ page: PageRef;
1104
+ ref: AnnotationRef;
1105
+ path?: string;
1106
+ /** Decompression-bomb cap forwarded to the runtime. Absent/0 = unlimited. */
1107
+ maxDecodedBytes?: number;
1108
+ }
1109
+ /**
1110
+ * `/PieceInfo` private application data (ISO 32000 §14.5). One job family
1111
+ * serves both levels: `pageObjectNumber` present → the page's `/PieceInfo`,
1112
+ * absent → the document catalog's — mirroring the native API symmetry.
1113
+ * `update`/`clear` are mutations (a layer session persists an artifact);
1114
+ * `read`/`applications` are plain reads.
1115
+ */
1116
+ interface MeasureViewportsWorkerRequest {
1117
+ kind: 'measure.viewports';
1118
+ effect: 'read';
1119
+ jobId: WorkerJobId;
1120
+ docId: string;
1121
+ layerName?: string;
1122
+ page: PageRef;
1123
+ }
1124
+ interface MeasureSetScaleWorkerRequest extends WriteJobFields {
1125
+ kind: 'measure.setScale';
1126
+ effect: 'write';
1127
+ jobId: WorkerJobId;
1128
+ docId: string;
1129
+ layerName?: string;
1130
+ page: PageRef;
1131
+ measure: PdfMeasure | null;
1132
+ artifactPath?: string;
1133
+ }
1134
+ interface PieceInfoReadWorkerRequest {
1135
+ kind: 'pieceInfo.read';
1136
+ effect: 'read';
1137
+ jobId: WorkerJobId;
1138
+ docId: string;
1139
+ layerName?: string;
1140
+ page?: PageRef;
1141
+ application: string;
1142
+ }
1143
+ interface PieceInfoUpdateWorkerRequest extends WriteJobFields {
1144
+ kind: 'pieceInfo.update';
1145
+ effect: 'write';
1146
+ jobId: WorkerJobId;
1147
+ docId: string;
1148
+ layerName?: string;
1149
+ page?: PageRef;
1150
+ application: string;
1151
+ patch: PieceInfoPatch;
1152
+ artifactPath?: string;
1153
+ }
1154
+ interface PieceInfoApplicationsWorkerRequest {
1155
+ kind: 'pieceInfo.applications';
1156
+ effect: 'read';
1157
+ jobId: WorkerJobId;
1158
+ docId: string;
1159
+ layerName?: string;
1160
+ page?: PageRef;
1161
+ }
1162
+ interface PieceInfoDeleteWorkerRequest extends WriteJobFields {
1163
+ kind: 'pieceInfo.delete';
1164
+ effect: 'write';
1165
+ jobId: WorkerJobId;
1166
+ docId: string;
1167
+ layerName?: string;
1168
+ page?: PageRef;
1169
+ application: string;
1170
+ artifactPath?: string;
1171
+ }
1172
+ interface DocumentSaveBufferWorkerRequest {
1173
+ kind: 'document.saveBuffer';
1174
+ effect: 'snapshot';
1175
+ jobId: WorkerJobId;
1176
+ docId: string;
1177
+ layerName?: string;
1178
+ mode: PdfSaveMode;
1179
+ }
1180
+ interface DocumentSaveFileWorkerRequest {
1181
+ kind: 'document.saveFile';
1182
+ effect: 'snapshot';
1183
+ jobId: WorkerJobId;
1184
+ docId: string;
1185
+ layerName?: string;
1186
+ mode: PdfSaveMode;
1187
+ path: string;
1188
+ }
1189
+ /** Export just the layer artifact (the overlay diff) to a transferable buffer.
1190
+ * Layer sessions only; the host rejects a base-only session. */
1191
+ interface DocumentSaveLayerBufferWorkerRequest {
1192
+ kind: 'document.saveLayerBuffer';
1193
+ effect: 'snapshot';
1194
+ jobId: WorkerJobId;
1195
+ docId: string;
1196
+ layerName?: string;
1197
+ }
1198
+ interface DocumentSecurityProbeInfo {
1199
+ encryptionState: 'unknown' | 'none' | 'encrypted' | 'unsupported';
1200
+ encryptionRequiresPassword: boolean | null;
1201
+ securityHandlerRevision: number | null;
1202
+ pdfPermissionsBits: number | null;
1203
+ pdfPermissionsAllAllowed: boolean | null;
1204
+ pdfOpenedAs: 'none' | 'user' | 'owner' | null;
1205
+ securityProbedAt: number | null;
1206
+ }
1207
+ interface DocumentProbeSecurityFileWorkerRequest {
1208
+ kind: 'document.probeSecurityFile';
1209
+ effect: 'read';
1210
+ jobId: WorkerJobId;
1211
+ path: string;
1212
+ password: string | null;
1213
+ }
1214
+ interface DocumentCheckPasswordPermissionsWorkerRequest {
1215
+ kind: 'document.checkPasswordPermissions';
1216
+ effect: 'open';
1217
+ jobId: WorkerJobId;
1218
+ docId: string;
1219
+ layerName?: string;
1220
+ password: string;
1221
+ mode?: 'any' | 'owner';
1222
+ }
1223
+ /**
1224
+ * Register a runtime font on the host's PDFium thread. Carries the font bytes
1225
+ * as a transferable `ArrayBuffer` (declared in the producer's transfer
1226
+ * manifest, like `open.fatMem`). Runtime-global: not tied to any docId. The
1227
+ * host keeps the volatile native `FontId` keyed by `fontKey`; the wire only
1228
+ * ever references the stable `fontKey`.
1229
+ */
1230
+ interface FontsRegisterWorkerRequest {
1231
+ kind: 'fonts.register';
1232
+ effect: 'runtimeWrite';
1233
+ jobId: WorkerJobId;
1234
+ fontKey: string;
1235
+ /** `""` → infer the base font name from the file. */
1236
+ familyName: string;
1237
+ /** `0` → infer the weight from the file. */
1238
+ weight: number;
1239
+ /** `-1` → infer / `0` non-italic / `1` italic. */
1240
+ italic: number;
1241
+ data: ArrayBuffer;
1242
+ }
1243
+ interface FontsAddFallbackWorkerRequest {
1244
+ kind: 'fonts.addFallback';
1245
+ effect: 'runtimeWrite';
1246
+ jobId: WorkerJobId;
1247
+ fontKey: string;
1248
+ }
1249
+ interface FontsClearFallbacksWorkerRequest {
1250
+ kind: 'fonts.clearFallbacks';
1251
+ effect: 'runtimeWrite';
1252
+ jobId: WorkerJobId;
1253
+ }
1254
+ /**
1255
+ * Hand the session `count` more object numbers: the layer's last object
1256
+ * number moves up by `count`, and the numbers passed become the session's to
1257
+ * name objects with. Only a session that hands numbers out itself
1258
+ * (`objectNumbers: 'session'`) takes it. Refused with `LayerFull` past
1259
+ * `OBJECT_NUMBER_ISSUE_LIMIT`.
1260
+ */
1261
+ interface ObjectNumbersReserveWorkerRequest {
1262
+ kind: 'objectNumbers.reserve';
1263
+ effect: 'session';
1264
+ jobId: WorkerJobId;
1265
+ docId: string;
1266
+ layerName?: string;
1267
+ count: number;
1268
+ }
1269
+ interface FontsClearWorkerRequest {
1270
+ kind: 'fonts.clear';
1271
+ effect: 'runtimeWrite';
1272
+ jobId: WorkerJobId;
1273
+ }
1274
+ /** The application asserts a licence permitting editing with a font. */
1275
+ interface FontsAuthorizeEditingWorkerRequest {
1276
+ kind: 'fonts.authorizeEditing';
1277
+ effect: 'runtimeWrite';
1278
+ jobId: WorkerJobId;
1279
+ fontKey: string;
1280
+ }
1281
+ /**
1282
+ * Per-document font and text-layout settings (session state on the host's
1283
+ * document, never written to the file). Every member is optional: only the
1284
+ * ones given change.
1285
+ */
1286
+ interface DocumentSetFontSettingsWorkerRequest {
1287
+ kind: 'document.setFontSettings';
1288
+ effect: 'session';
1289
+ jobId: WorkerJobId;
1290
+ docId: string;
1291
+ layerName?: string;
1292
+ embeddingPolicy?: 'default' | 'subset' | 'full';
1293
+ typographicFeatures?: boolean;
1294
+ }
1295
+ interface CloseWorkerRequest {
1296
+ kind: 'close';
1297
+ effect: 'close';
1298
+ jobId: WorkerJobId;
1299
+ docId: string;
1300
+ }
1301
+ /**
1302
+ * Close exactly one layer session, leaving the base document, sibling
1303
+ * layer sessions, and the caller's doc↔worker binding intact. Idempotent:
1304
+ * closing an absent session is a no-op ack.
1305
+ *
1306
+ * This is the reload seam for layer-session freshness (the server closes
1307
+ * a stale layer session and re-opens it from the current durable
1308
+ * artifact) — `close` is the whole-document teardown, this is the
1309
+ * layer-scoped sibling.
1310
+ */
1311
+ interface LayerCloseWorkerRequest {
1312
+ kind: 'layer.close';
1313
+ effect: 'close';
1314
+ jobId: WorkerJobId;
1315
+ docId: string;
1316
+ layerName: string;
1317
+ }
1318
+ interface AbortWorkerRequest {
1319
+ kind: 'abort';
1320
+ jobId: WorkerJobId;
1321
+ }
1322
+ /**
1323
+ * What a view shows of a document (`DocumentHandle.setWorkingSet`): the order
1324
+ * its parsed pages close in. The worker takes it on arrival, even while a
1325
+ * render runs, and never answers: `jobId` only names the message.
1326
+ */
1327
+ interface PagesWorkingSetWorkerRequest {
1328
+ kind: 'pages.workingSet';
1329
+ jobId: WorkerJobId;
1330
+ docId: string;
1331
+ layerName?: string;
1332
+ view: string;
1333
+ pages: WorkingSetPage[];
1334
+ }
1335
+ interface ShutdownWorkerRequest {
1336
+ kind: 'shutdown';
1337
+ jobId: WorkerJobId;
1338
+ }
1339
+ interface LayerArtifactWorkerPayload {
1340
+ bytes: ArrayBuffer;
1341
+ size: number;
1342
+ /** The layer's last object number as saved: every object it has is at or below it. */
1343
+ lastObjectNumber: number;
1344
+ }
1345
+ /**
1346
+ * Result of an attachment file read (`attachments.readFile` /
1347
+ * `annotations.readFile`): the decoded file's metadata plus exactly one
1348
+ * delivery mode, mirroring the request's `path?` — `bytes` on the
1349
+ * transfer list (browser), or the `path` the worker wrote (server).
1350
+ */
1351
+ interface AttachmentFileWorkerPayload {
1352
+ name: string;
1353
+ mimeType?: string;
1354
+ size: number;
1355
+ bytes?: ArrayBuffer;
1356
+ path?: string;
1357
+ }
1358
+ interface LayerArtifactFileWorkerPayload {
1359
+ path: string;
1360
+ /** The layer's last object number as saved: every object it has is at or below it. */
1361
+ lastObjectNumber: number;
1362
+ }
1363
+ /**
1364
+ * Every request a worker takes. `C` is where a request's places are: page
1365
+ * space as callers send them, the file's coordinates once the worker has
1366
+ * converted them for its handlers.
1367
+ */
1368
+ type WorkerRequest<C extends Coordinates = PageCoordinates> = OpenWorkerRequest | MetadataReadWorkerRequest | MetadataUpdateWorkerRequest | MetadataReadCustomWorkerRequest | MetadataUpdateCustomWorkerRequest | ActionsReadWorkerRequest | OutlineReadWorkerRequest | AnnotationsListWorkerRequest | AnnotationsRenderAppearancesWorkerRequest | AnnotationsRenderAppearancesEncodedWorkerRequest | AnnotationsCreateWorkerRequest<C> | AnnotationsUpdateWorkerRequest<C> | AnnotationsDeleteWorkerRequest | AnnotationsReorderWorkerRequest | DocumentApplyWorkerRequest | DocumentApplyChangesWorkerRequest | FormsListWorkerRequest | FormsSetValueWorkerRequest | FormsResetWorkerRequest | FormsExportWorkerRequest | FormsImportWorkerRequest | FormsImportValuesWorkerRequest | FormsRepairWorkerRequest | FormsCreateFieldWorkerRequest<C> | FormsUpdateFieldWorkerRequest | FormsSetSignatureAppearanceWorkerRequest | FormsDeleteFieldWorkerRequest | FormsAddWidgetWorkerRequest<C> | FormsDetachWidgetWorkerRequest | FormsDeleteWidgetWorkerRequest | FormsReorderWidgetsWorkerRequest | FormsReorderCalculationsWorkerRequest | FormsUpdateWidgetWorkerRequest<C> | PagesListWorkerRequest | AnnotationsFlattenWorkerRequest | AnnotationsExportAppearanceWorkerRequest | PagesSetNameWorkerRequest | PagesRemoveNameWorkerRequest | PagesFlattenWorkerRequest | RedactionApplyWorkerRequest | PagesExtractWorkerRequest | AttachmentsListWorkerRequest | AttachmentsReadFileWorkerRequest | AnnotationsReadFileWorkerRequest | AnnotationsReadAppearanceWorkerRequest | AnnotationsExportWorkerRequest | AnnotationsImportWorkerRequest | MeasureViewportsWorkerRequest | MeasureSetScaleWorkerRequest | PieceInfoReadWorkerRequest | PieceInfoUpdateWorkerRequest | PieceInfoApplicationsWorkerRequest | PieceInfoDeleteWorkerRequest | PagesTextWorkerRequest | PagesGeometryWorkerRequest | PagesRenderWorkerRequest<C> | PagesRenderEncodedWorkerRequest<C> | SearchQueryWorkerRequest | DocumentSaveBufferWorkerRequest | DocumentSaveFileWorkerRequest | DocumentSaveLayerBufferWorkerRequest | DocumentProbeSecurityFileWorkerRequest | DocumentRenderPageFileWorkerRequest | DocumentRenderPageFileEncodedWorkerRequest | DocumentCheckPasswordPermissionsWorkerRequest | SignaturesListWorkerRequest | SignaturesContentsWorkerRequest | SignaturesDigestWorkerRequest | SignaturesRevisionBytesWorkerRequest | DocumentVersionWorkerRequest | SignaturesPrepareWorkerRequest | SignaturesCompleteWorkerRequest | SignaturesCancelWorkerRequest | SignaturesAnalyzeWorkerRequest | SignaturesFinalizeCandidateWorkerRequest | FontsRegisterWorkerRequest | FontsAddFallbackWorkerRequest | FontsClearFallbacksWorkerRequest | FontsClearWorkerRequest | FontsAuthorizeEditingWorkerRequest | ObjectNumbersReserveWorkerRequest | DocumentSetFontSettingsWorkerRequest | CloseWorkerRequest | LayerCloseWorkerRequest | WorkerControlMessage;
1369
+ /** The messages that aren't jobs: the worker takes them on arrival and runs nothing for them. */
1370
+ type WorkerControlMessage = AbortWorkerRequest | PagesWorkingSetWorkerRequest | ShutdownWorkerRequest;
1371
+ /**
1372
+ * A request the worker runs as a job. Every one states its
1373
+ * {@link RequestEffect}: a request type without one fails `StatesItsEffect`,
1374
+ * so it doesn't compile.
1375
+ */
1376
+ type WorkerJobRequest<C extends Coordinates = PageCoordinates> = StatesItsEffect<Exclude<WorkerRequest<C>, WorkerControlMessage>>;
1377
+ type StatesItsEffect<T extends {
1378
+ effect: RequestEffect;
1379
+ }> = T;
1380
+ /**
1381
+ * What a job returns. `C` is the space its positions are in: the handlers
1382
+ * work in PDF space, and the worker converts every result to page space
1383
+ * before it leaves (`resultInPageSpace`).
1384
+ */
1385
+ type WorkerResultPayload<C extends Coordinates = PageCoordinates> = {
1386
+ tag: 'open';
1387
+ docId: string;
1388
+ security: DocumentSecurityProbeInfo;
1389
+ /** What the document's signatures forbid; `null` when unsigned or not probed (a locked open). */
1390
+ protection?: DocumentProtection | null;
1391
+ /** A locked open whose password was given and wrong. */
1392
+ passwordRejected?: boolean;
1393
+ /** The numbers `reserveObjectNumbers` asked for; absent for a locked open. */
1394
+ objectNumbers?: ObjectNumberRange;
1395
+ /** The layer's last object number as it opened; absent for a locked open. */
1396
+ lastObjectNumber?: number;
1397
+ } | {
1398
+ tag: 'objectNumbers.reserve';
1399
+ range: ObjectNumberRange;
1400
+ } | {
1401
+ tag: 'signatures.list';
1402
+ snapshot: SignatureSnapshot;
1403
+ } | {
1404
+ tag: 'signatures.contents';
1405
+ bytes: ArrayBuffer;
1406
+ } | {
1407
+ tag: 'signatures.digest';
1408
+ digest: ArrayBuffer;
1409
+ } | {
1410
+ tag: 'signatures.revisionBytes';
1411
+ bytes: ArrayBuffer;
1412
+ size: number;
1413
+ } | {
1414
+ tag: 'document.version';
1415
+ version: BaseVersionInfo;
1416
+ } | {
1417
+ tag: 'signatures.prepare';
1418
+ result: SignaturePrepared;
1419
+ } | {
1420
+ tag: 'signatures.complete';
1421
+ result: SignatureCompleteResult;
1422
+ artifact?: LayerArtifactWorkerPayload;
1423
+ artifactFile?: LayerArtifactFileWorkerPayload;
1424
+ } | {
1425
+ tag: 'signatures.cancel';
1426
+ result: SignatureCancelResult;
1427
+ } | {
1428
+ tag: 'signatures.analyze';
1429
+ analysis: ChangeAnalysis;
1430
+ } | {
1431
+ tag: 'signatures.finalizeCandidate';
1432
+ /**
1433
+ * The installed signature as the sealed file reports it, in page space:
1434
+ * the finalizer measures it while its own session is open.
1435
+ */
1436
+ signature: SignatureDTO;
1437
+ /** The sealed file's last object number: every object it has is at or below it. */
1438
+ lastObjectNumber: number;
1439
+ /** What the sealed file's signatures forbid from now on. */
1440
+ protection: DocumentProtection;
1441
+ /** The version the sealed file is (hash and length of the whole file). */
1442
+ version: BaseVersionInfo;
1443
+ } | {
1444
+ tag: 'metadata.read';
1445
+ metadata: DocumentMetadata;
1446
+ } | {
1447
+ tag: 'actions.read';
1448
+ snapshot: DocumentActionsSnapshot<C['destination']>;
1449
+ } | {
1450
+ tag: 'outline.read';
1451
+ outline: DocumentOutline<C['destination']>;
1452
+ } | {
1453
+ tag: 'metadata.update';
1454
+ result: MetadataUpdateResult;
1455
+ artifact?: LayerArtifactWorkerPayload;
1456
+ artifactFile?: LayerArtifactFileWorkerPayload;
1457
+ } | {
1458
+ tag: 'metadata.readCustom';
1459
+ custom: CustomMetadata;
1460
+ } | {
1461
+ tag: 'metadata.updateCustom';
1462
+ result: CustomMetadataUpdateResult;
1463
+ artifact?: LayerArtifactWorkerPayload;
1464
+ artifactFile?: LayerArtifactFileWorkerPayload;
1465
+ } | {
1466
+ tag: 'annotations.list';
1467
+ list: AnnotationList<C>;
1468
+ } | {
1469
+ tag: 'annotations.renderAppearances';
1470
+ page: PageRef;
1471
+ result: AnnotationAppearancesResult<C>;
1472
+ } | {
1473
+ tag: 'annotations.renderAppearancesEncoded';
1474
+ page: PageRef;
1475
+ result: AnnotationAppearancesEncodedResultWire<C>;
1476
+ } | {
1477
+ tag: 'annotations.create';
1478
+ result: AnnotationCreateResult<C>;
1479
+ artifact?: LayerArtifactWorkerPayload;
1480
+ artifactFile?: LayerArtifactFileWorkerPayload;
1481
+ } | {
1482
+ tag: 'annotations.update';
1483
+ result: AnnotationUpdateResult<C>;
1484
+ artifact?: LayerArtifactWorkerPayload;
1485
+ artifactFile?: LayerArtifactFileWorkerPayload;
1486
+ } | {
1487
+ tag: 'annotations.delete';
1488
+ result: AnnotationDeleteResult;
1489
+ artifact?: LayerArtifactWorkerPayload;
1490
+ artifactFile?: LayerArtifactFileWorkerPayload;
1491
+ } | {
1492
+ tag: 'annotations.flatten';
1493
+ result: AnnotationFlattenResult;
1494
+ /** False when nothing was applied: no artifact, event, or version bump. */
1495
+ wrote: boolean;
1496
+ artifact?: LayerArtifactWorkerPayload;
1497
+ artifactFile?: LayerArtifactFileWorkerPayload;
1498
+ } | {
1499
+ tag: 'annotations.exportAppearance';
1500
+ bytes: ArrayBuffer;
1501
+ size: number;
1502
+ } | {
1503
+ tag: 'annotations.readAppearance';
1504
+ bytes: ArrayBuffer;
1505
+ size: number;
1506
+ } |
1507
+ /** A bundle is page space on both sides: the exporter measures what leaves. */
1508
+ {
1509
+ tag: 'annotations.export';
1510
+ bundle: WireAnnotationBundle;
1511
+ } | {
1512
+ tag: 'annotations.import';
1513
+ result: AnnotationImportResult<C>;
1514
+ artifact?: LayerArtifactWorkerPayload;
1515
+ artifactFile?: LayerArtifactFileWorkerPayload;
1516
+ } | {
1517
+ tag: 'annotations.reorder';
1518
+ result: AnnotationReorderResult;
1519
+ artifact?: LayerArtifactWorkerPayload;
1520
+ artifactFile?: LayerArtifactFileWorkerPayload;
1521
+ } | {
1522
+ tag: 'document.applyChanges';
1523
+ /** One per change, in order. */
1524
+ outcomes: ServerChangeOutcome[];
1525
+ /** The artifact, when at least one change applied. */
1526
+ artifact?: LayerArtifactWorkerPayload;
1527
+ artifactFile?: LayerArtifactFileWorkerPayload;
1528
+ } | {
1529
+ tag: 'document.apply';
1530
+ result: ChangeResult;
1531
+ /**
1532
+ * True when this answers an `opId` that already had one: nothing ran
1533
+ * again, so nothing is published again.
1534
+ */
1535
+ replayed: boolean;
1536
+ artifact?: LayerArtifactWorkerPayload;
1537
+ artifactFile?: LayerArtifactFileWorkerPayload;
1538
+ } | {
1539
+ tag: 'forms.list';
1540
+ snapshot: FormSnapshot<C>;
1541
+ } | {
1542
+ tag: 'forms.setValue';
1543
+ result: FormSetValueResult<C>;
1544
+ artifact?: LayerArtifactWorkerPayload;
1545
+ artifactFile?: LayerArtifactFileWorkerPayload;
1546
+ } | {
1547
+ tag: 'forms.reset';
1548
+ result: FormResetResult<C>;
1549
+ artifact?: LayerArtifactWorkerPayload;
1550
+ artifactFile?: LayerArtifactFileWorkerPayload;
1551
+ } | {
1552
+ tag: 'forms.export';
1553
+ bundle: WireFormBundle;
1554
+ } | {
1555
+ tag: 'forms.import';
1556
+ result: FormImportResult<C>;
1557
+ artifact?: LayerArtifactWorkerPayload;
1558
+ artifactFile?: LayerArtifactFileWorkerPayload;
1559
+ } | {
1560
+ tag: 'forms.importValues';
1561
+ result: FormValuesImportResult<C>;
1562
+ artifact?: LayerArtifactWorkerPayload;
1563
+ artifactFile?: LayerArtifactFileWorkerPayload;
1564
+ } | {
1565
+ tag: 'forms.repair';
1566
+ result: FormRepairResult;
1567
+ artifact?: LayerArtifactWorkerPayload;
1568
+ artifactFile?: LayerArtifactFileWorkerPayload;
1569
+ } | {
1570
+ tag: 'forms.createField';
1571
+ result: FormFieldCreateResult<C>;
1572
+ artifact?: LayerArtifactWorkerPayload;
1573
+ artifactFile?: LayerArtifactFileWorkerPayload;
1574
+ } | {
1575
+ tag: 'forms.updateField';
1576
+ result: FormFieldUpdateResult<C>;
1577
+ artifact?: LayerArtifactWorkerPayload;
1578
+ artifactFile?: LayerArtifactFileWorkerPayload;
1579
+ } | {
1580
+ tag: 'forms.setSignatureAppearance';
1581
+ result: FormFieldUpdateResult<C>;
1582
+ artifact?: LayerArtifactWorkerPayload;
1583
+ artifactFile?: LayerArtifactFileWorkerPayload;
1584
+ } | {
1585
+ tag: 'forms.deleteField';
1586
+ result: FormFieldDeleteResult;
1587
+ artifact?: LayerArtifactWorkerPayload;
1588
+ artifactFile?: LayerArtifactFileWorkerPayload;
1589
+ } | {
1590
+ tag: 'forms.addWidget';
1591
+ result: FormWidgetLinkResult<C>;
1592
+ artifact?: LayerArtifactWorkerPayload;
1593
+ artifactFile?: LayerArtifactFileWorkerPayload;
1594
+ } | {
1595
+ tag: 'forms.detachWidget';
1596
+ result: FormWidgetLinkResult<C>;
1597
+ artifact?: LayerArtifactWorkerPayload;
1598
+ artifactFile?: LayerArtifactFileWorkerPayload;
1599
+ } | {
1600
+ tag: 'forms.reorderWidgets';
1601
+ result: FormWidgetsReorderResult;
1602
+ artifact?: LayerArtifactWorkerPayload;
1603
+ artifactFile?: LayerArtifactFileWorkerPayload;
1604
+ } | {
1605
+ tag: 'forms.reorderCalculations';
1606
+ result: FormCalculationsReorderResult;
1607
+ artifact?: LayerArtifactWorkerPayload;
1608
+ artifactFile?: LayerArtifactFileWorkerPayload;
1609
+ } | {
1610
+ tag: 'forms.updateWidget';
1611
+ result: FormWidgetUpdateResult<C>;
1612
+ artifact?: LayerArtifactWorkerPayload;
1613
+ artifactFile?: LayerArtifactFileWorkerPayload;
1614
+ } | {
1615
+ tag: 'forms.deleteWidget';
1616
+ result: FormWidgetDeleteResult<C>;
1617
+ artifact?: LayerArtifactWorkerPayload;
1618
+ artifactFile?: LayerArtifactFileWorkerPayload;
1619
+ } | {
1620
+ tag: 'pages.list';
1621
+ snapshot: PageListSnapshot<C>;
1622
+ } | {
1623
+ tag: 'pages.setName';
1624
+ result: PageNameResult<C>;
1625
+ artifact?: LayerArtifactWorkerPayload;
1626
+ artifactFile?: LayerArtifactFileWorkerPayload;
1627
+ } | {
1628
+ tag: 'pages.removeName';
1629
+ result: PageNameResult<C>;
1630
+ artifact?: LayerArtifactWorkerPayload;
1631
+ artifactFile?: LayerArtifactFileWorkerPayload;
1632
+ } | {
1633
+ tag: 'pages.flatten';
1634
+ result: PageFlattenResult;
1635
+ /** False when nothing was applied: no artifact, event, or version bump. */
1636
+ wrote: boolean;
1637
+ artifact?: LayerArtifactWorkerPayload;
1638
+ artifactFile?: LayerArtifactFileWorkerPayload;
1639
+ } | {
1640
+ tag: 'redaction.apply';
1641
+ result: RedactionApplyResult;
1642
+ /** False when nothing was applied: no artifact, event, or version bump. */
1643
+ wrote: boolean;
1644
+ artifact?: LayerArtifactWorkerPayload;
1645
+ artifactFile?: LayerArtifactFileWorkerPayload;
1646
+ } | {
1647
+ tag: 'pages.extract';
1648
+ bytes: ArrayBuffer;
1649
+ size: number;
1650
+ } | {
1651
+ tag: 'attachments.list';
1652
+ attachments: Attachment[];
1653
+ } | {
1654
+ tag: 'attachments.readFile';
1655
+ content: AttachmentFileWorkerPayload;
1656
+ } | {
1657
+ tag: 'annotations.readFile';
1658
+ content: AttachmentFileWorkerPayload;
1659
+ } | {
1660
+ tag: 'measure.viewports';
1661
+ page: PageRef;
1662
+ viewports: PageMeasurementViewport<C>[];
1663
+ } | {
1664
+ tag: 'measure.setScale';
1665
+ result: PageScaleResult;
1666
+ artifact?: LayerArtifactWorkerPayload;
1667
+ artifactFile?: LayerArtifactFileWorkerPayload;
1668
+ } | {
1669
+ tag: 'pieceInfo.read';
1670
+ snapshot: PieceInfoSnapshot | null;
1671
+ } | {
1672
+ tag: 'pieceInfo.update';
1673
+ result: PieceInfoUpdateResult;
1674
+ artifact?: LayerArtifactWorkerPayload;
1675
+ artifactFile?: LayerArtifactFileWorkerPayload;
1676
+ } | {
1677
+ tag: 'pieceInfo.applications';
1678
+ applications: string[];
1679
+ } | {
1680
+ tag: 'pieceInfo.delete';
1681
+ result: PieceInfoDeleteResult;
1682
+ artifact?: LayerArtifactWorkerPayload;
1683
+ artifactFile?: LayerArtifactFileWorkerPayload;
1684
+ } | {
1685
+ tag: 'pages.text';
1686
+ snapshot: PageTextSnapshot;
1687
+ } | {
1688
+ tag: 'pages.geometry';
1689
+ page: PageRef;
1690
+ snapshot: PageGeometrySnapshot<C>;
1691
+ } | {
1692
+ tag: 'pages.render';
1693
+ page: PageRef;
1694
+ /** The area of the page the pixels show. */
1695
+ area: C['box'];
1696
+ raster: PageRaster;
1697
+ } | {
1698
+ tag: 'pages.renderEncoded';
1699
+ image: EncodedImageWire;
1700
+ } | {
1701
+ tag: 'search.query';
1702
+ slice: SearchSlice<C>;
1703
+ } | {
1704
+ tag: 'document.saveBuffer';
1705
+ bytes: ArrayBuffer;
1706
+ size: number;
1707
+ } | {
1708
+ tag: 'document.saveLayerBuffer';
1709
+ bytes: ArrayBuffer;
1710
+ size: number;
1711
+ } | {
1712
+ tag: 'document.saveFile';
1713
+ path: string;
1714
+ } | {
1715
+ tag: 'document.probeSecurityFile';
1716
+ security: DocumentSecurityProbeInfo;
1717
+ } | {
1718
+ tag: 'document.renderPageFile';
1719
+ /** Durable page identity of the rendered index — the artifact key's page. */
1720
+ page: PageRef;
1721
+ pageCount: number;
1722
+ raster: PageRaster;
1723
+ } | {
1724
+ tag: 'document.renderPageFileEncoded';
1725
+ /** Durable page identity of the rendered index — the artifact key's page. */
1726
+ page: PageRef;
1727
+ pageCount: number;
1728
+ image: EncodedImageWire;
1729
+ } | {
1730
+ tag: 'document.checkPasswordPermissions';
1731
+ security: DocumentSecurityProbeInfo;
1732
+ protection?: DocumentProtection | null;
1733
+ } | {
1734
+ tag: 'fonts.register';
1735
+ fontKey: string;
1736
+ identity: FontIdentityInfo;
1737
+ } | {
1738
+ tag: 'fonts.addFallback';
1739
+ } | {
1740
+ tag: 'fonts.clearFallbacks';
1741
+ } | {
1742
+ tag: 'fonts.clear';
1743
+ } | {
1744
+ tag: 'fonts.authorizeEditing';
1745
+ identity: FontIdentityInfo;
1746
+ } | {
1747
+ tag: 'document.setFontSettings';
1748
+ } | {
1749
+ tag: 'close';
1750
+ } | {
1751
+ tag: 'shutdown';
1752
+ };
1753
+ type WorkerResponse = {
1754
+ kind: 'resolve';
1755
+ jobId: WorkerJobId;
1756
+ result: WorkerResultPayload;
1757
+ } | {
1758
+ kind: 'reject';
1759
+ jobId: WorkerJobId;
1760
+ error: SerializedEngineError;
1761
+ };
1762
+ type WorkerLifecycleMessage = {
1763
+ kind: 'ready';
1764
+ } | {
1765
+ kind: 'init-error';
1766
+ error: string;
1767
+ };
1768
+ //#endregion
1769
+ //#region src/engine/document-security-state.d.ts
1770
+ interface DocumentHeadLike {
1771
+ encryption: {
1772
+ state: DocumentSecurityState['encryption']['state'];
1773
+ requiresPassword: boolean | null;
1774
+ };
1775
+ permissions: DocumentSecurityState['permissions'];
1776
+ access: DocumentSecurityState['access'];
1777
+ }
1778
+ declare function securityStateFromHead(head: DocumentHeadLike): DocumentSecurityState;
1779
+ declare function permissionInfoFromProbe(info: DocumentSecurityProbeInfo): PdfPermissionInfo | null;
1780
+ /**
1781
+ * Same as {@link permissionInfoFromProbe} but additionally populates
1782
+ * `flags` (typed PdfBits view) and `advisory` (capability-shaped
1783
+ * booleans for UI badges). Used by routes that have a decoded `PdfBits`
1784
+ * in hand — notably `/access`, which always does.
1785
+ *
1786
+ * Returns `null` for the same reason as the base function — when the
1787
+ * PDF hasn't been probed yet so bits are unknown.
1788
+ */
1789
+ declare function permissionInfoWithAdvisory(info: DocumentSecurityProbeInfo, pdfBits: PdfBits): PdfPermissionInfo | null;
1790
+ /**
1791
+ * Translate a {@link PdfBits} view into the capability-shaped
1792
+ * {@link PdfPermissionAdvisory}: what `pdf.permissions` grants on a file
1793
+ * with these bits.
1794
+ */
1795
+ declare function advisoryFromPdfBits(b: PdfBits): PdfPermissionAdvisory;
1796
+ declare function securityStateFromProbe(info: DocumentSecurityProbeInfo, opts?: {
1797
+ accessEndpoint?: string;
1798
+ cdnRequired?: boolean;
1799
+ }): DocumentSecurityState;
1800
+ //#endregion
1801
+ //#region src/scheduling/place.d.ts
1802
+ /** Where a job's page is: on screen, placed just off it, or in no view. */
1803
+ type Place = 'visible' | 'near' | 'elsewhere';
1804
+ /** A job's place, and the device pixels of its page on screen there. */
1805
+ interface Placed {
1806
+ readonly place: Place;
1807
+ readonly pixels: number;
1808
+ }
1809
+ /** What a job is about, for its place: its page, the part of it, and the view it serves. */
1810
+ interface JobTarget {
1811
+ /** Absent: the job is about the whole document. */
1812
+ readonly page?: PageRef;
1813
+ /** The part of the page, in page space (a tile). Absent: the whole page. */
1814
+ readonly region?: PageBox;
1815
+ readonly view?: string;
1816
+ }
1817
+ /** One document's working sets: per view, the pages it shows by object number. */
1818
+ type ViewSets = ReadonlyMap<string, ReadonlyMap<number, WorkingSetPage>>;
1819
+ /** What {@link rank} needs to know about a job besides its place. */
1820
+ interface RankedJob {
1821
+ readonly priority: CallPriority;
1822
+ /** Present for a job about part of a page (a tile). */
1823
+ readonly region?: PageBox;
1824
+ }
1825
+ /** Whether `a` is the better place: on screen before near before elsewhere, then more pixels. */
1826
+ declare function placedBefore(a: Placed, b: Placed): boolean;
1827
+ /**
1828
+ * A job's place in one view: its page's role there, except that a part of a
1829
+ * visible page that's off screen (a tile of the ring around what shows) is
1830
+ * `near`.
1831
+ */
1832
+ declare function placeIn(entry: WorkingSetPage | undefined, job: JobTarget): Placed;
1833
+ /**
1834
+ * A job's place among a document's views: in the view it serves, or, when it
1835
+ * serves none (or one that said nothing), the best place its page has in any
1836
+ * view. A job about the whole document serves what's shown, so it counts as
1837
+ * on screen. While no view says anything, every job is on screen alike, and
1838
+ * jobs run in the order they were asked.
1839
+ */
1840
+ declare function placeFor(job: JobTarget, views: ViewSets): Placed;
1841
+ /**
1842
+ * How soon a job runs among those that may run: higher first. It compares, in
1843
+ * turn:
1844
+ * 1. background last: a `low` call is about nothing the views show;
1845
+ * 2. where its page is: on screen, then just off it, then elsewhere;
1846
+ * 3. its priority: `high` (the picture of the page itself) before `auto`;
1847
+ * 4. a whole page before a part of one: a tile is only of use once its page
1848
+ * is there;
1849
+ * 5. the device pixels its page shows.
1850
+ * Equal ranks run in the order they were asked, so a caller sequences its own work.
1851
+ */
1852
+ declare function rank(job: RankedJob, placed: Placed): number;
1853
+ /**
1854
+ * Whether rank `a` beats rank `b` on more than pixels (any of the first four
1855
+ * steps of {@link rank}). A running job gives way only to a job that clearly
1856
+ * outranks it, so two pages on screen never stop each other's work, and jobs
1857
+ * don't flip back and forth while the camera moves.
1858
+ */
1859
+ declare function clearlyOutranks(a: number, b: number): boolean;
1860
+ //#endregion
1861
+ //#region src/engine/attachmentVerbs.d.ts
1862
+ /** The verbs of `doc.attachments` that change the document: each one op of a change. */
1863
+ type AttachmentWriteVerb = 'create' | 'delete';
1864
+ /**
1865
+ * `doc.attachments` on any engine: the reads `rest` holds (`list`,
1866
+ * `download`), and each write as a one-op change through `apply`, so a verb
1867
+ * has its op's checks, events and undo (its `opId` undoes it) and answers as
1868
+ * its single verb did.
1869
+ */
1870
+ declare function attachmentVerbs(rest: Omit<DocumentAttachmentsService, AttachmentWriteVerb>, apply: (change: Change, options?: WriteOptions) => AbortablePromise<ChangeResult>): DocumentAttachmentsService;
1871
+ //#endregion
1872
+ //#region src/engine/outlineVerbs.d.ts
1873
+ /**
1874
+ * `doc.outline` on any engine: its read, and each verb as a one-op change
1875
+ * through `apply`, so a verb has its op's checks, events and undo (its
1876
+ * `opId` undoes it) and answers with the op's item.
1877
+ */
1878
+ declare function outlineVerbs(get: () => AbortablePromise<DocumentOutline>, apply: (change: Change, options?: WriteOptions) => AbortablePromise<ChangeResult>): DocumentOutlineService;
1879
+ //#endregion
1880
+ //#region src/engine/pageVerbs.d.ts
1881
+ /** The verbs of `doc.pages` that change the page structure: each one op of a change. */
1882
+ type PageStructureVerb = 'reorder' | 'rotate' | 'delete' | 'insert' | 'insertBlank';
1883
+ /**
1884
+ * `doc.pages` on any engine: what `rest` holds (the reads, extract, flatten
1885
+ * and the page names), and each structure verb as a one-op change through
1886
+ * `apply`, so a verb has its op's checks, events and undo (its `opId` undoes
1887
+ * it) and answers as its single verb did.
1888
+ */
1889
+ declare function pageVerbs(rest: Omit<DocumentPagesService, PageStructureVerb>, apply: (change: Change, options?: WriteOptions) => AbortablePromise<ChangeResult>): DocumentPagesService;
1890
+ //#endregion
1891
+ //#region src/wire/WirePack.d.ts
1892
+ /**
1893
+ * Wire-level packaging for messages crossing a Web Worker / Node
1894
+ * `worker_thread` boundary.
1895
+ *
1896
+ * `WirePack<P>` is the typed pair every producer hands to a transport:
1897
+ * the structured payload (validated against the wire schema) and an
1898
+ * explicit, ordered list of `Transferable` objects that the producer
1899
+ * intends to move (zero-copy) to the receiver.
1900
+ *
1901
+ * Why this is a first-class type and not a transport-side argument:
1902
+ *
1903
+ * - **Producer is the only one who knows.** Whether a particular
1904
+ * `ArrayBuffer` should be moved (zero-copy, sender's reference
1905
+ * detached) or copied (structured-cloned, both sides retain
1906
+ * access) is a semantic decision belonging to the code that
1907
+ * produced the buffer. Inferring it later — by walking the
1908
+ * payload looking for `ArrayBuffer` instances and assuming they
1909
+ * should all be transferred — detaches buffers the producer
1910
+ * meant to keep.
1911
+ *
1912
+ * - **Type-checked at the boundary.** A handler returning
1913
+ * `WirePack<RenderResult>` cannot forget to declare its
1914
+ * transfer list; the producer literally writes
1915
+ * `wirePack({ ..., pixels }, [pixels.buffer])` in a single
1916
+ * return statement. Forgetting yields a structurally identical
1917
+ * copy (slow but correct), never a silent leak.
1918
+ *
1919
+ * - **Symmetric across the boundary.** Same `WirePack<P>` on the
1920
+ * request path (main → worker) and the response path (worker →
1921
+ * main). Inline transports treat `transfer` as a no-op since
1922
+ * there's no thread boundary to cross.
1923
+ *
1924
+ * - **Schema-orthogonal.** Zod schemas validate `payload` and
1925
+ * nothing else. `transfer` is not data; it's a memory-ownership
1926
+ * manifest, and the design keeps those concerns separate.
1927
+ *
1928
+ * The receiver of a `postMessage(payload, { transfer })` call gets
1929
+ * the payload back **with the listed buffers already moved into it**
1930
+ * — there's no second argument on the receiving end. So `WirePack`
1931
+ * only ever travels the producer-to-transport leg of the trip; the
1932
+ * consumer side just sees the unwrapped `payload`.
1933
+ */
1934
+ interface WirePack<P> {
1935
+ readonly payload: P;
1936
+ readonly transfer: readonly Transferable[];
1937
+ }
1938
+ /**
1939
+ * Singleton empty transfer list. Frozen so accidental in-place
1940
+ * mutation throws in strict mode rather than silently mutating the
1941
+ * default for future calls.
1942
+ */
1943
+ declare const EMPTY_TRANSFER: readonly Transferable[];
1944
+ /**
1945
+ * Producer-side helper: pair a typed payload with its transfer list.
1946
+ *
1947
+ * The `transfer` argument is optional; omitting it (or passing `[]`)
1948
+ * is the explicit, type-checked way to say "I declare this message
1949
+ * carries no transferables." The declaration is made at construction
1950
+ * time, in the producer's own code, where the knowledge actually lives.
1951
+ *
1952
+ * wirePack({ kind: 'metadata.read', jobId, docId })
1953
+ * wirePack({ kind: 'open.fatMem', jobId, docId, bytes }, [bytes])
1954
+ * wirePack({ tag: 'page.render', pixels }, [pixels.buffer])
1955
+ */
1956
+ declare function wirePack<P>(payload: P, transfer?: readonly Transferable[]): WirePack<P>;
1957
+ //#endregion
1958
+ export { DocumentSaveLayerBufferWorkerRequest as $, PieceInfoDeleteWorkerRequest as $t, AnnotationsExportWorkerRequest as A, AbortError as An, LayerOpenSource as At, AttachmentFileWorkerPayload as B, OpenWorkerRequest as Bt, securityStateFromProbe as C, WorkerRequest as Cn, FormsSetSignatureAppearanceWorkerRequest as Ct, AnnotationsCreateWorkerRequest as D, EventHub as Dn, LayerArtifactFileWorkerPayload as Dt, AnnotationAppearancesEncodedResultWire as E, changeEvents as En, FormsUpdateWidgetWorkerRequest as Et, AnnotationsReadFileWorkerRequest as F, MetadataUpdateCustomWorkerRequest as Ft, DocumentApplyChangesWorkerRequest as G, PagesListWorkerRequest as Gt, AttachmentsReadFileWorkerRequest as H, PagesExtractWorkerRequest as Ht, AnnotationsRenderAppearancesEncodedWorkerRequest as I, MetadataUpdateWorkerRequest as It, DocumentProbeSecurityFileWorkerRequest as J, PagesRenderWorkerRequest as Jt, DocumentApplyWorkerRequest as K, PagesRemoveNameWorkerRequest as Kt, AnnotationsRenderAppearancesWorkerRequest as L, OpenFatMemoryWorkerRequest as Lt, AnnotationsImportWorkerRequest as M, MeasureViewportsWorkerRequest as Mt, AnnotationsListWorkerRequest as N, MetadataReadCustomWorkerRequest as Nt, AnnotationsDeleteWorkerRequest as O, SessionEventPublisher as On, LayerArtifactWorkerPayload as Ot, AnnotationsReadAppearanceWorkerRequest as P, MetadataReadWorkerRequest as Pt, DocumentSaveFileWorkerRequest as Q, PieceInfoApplicationsWorkerRequest as Qt, AnnotationsReorderWorkerRequest as R, OpenLayerFileBaseWorkerRequest as Rt, securityStateFromHead as S, WorkerLifecycleMessage as Sn, FormsResetWorkerRequest as St, ActionsReadWorkerRequest as T, WorkerResultPayload as Tn, FormsUpdateFieldWorkerRequest as Tt, ChangeRecordPayload as U, PagesFlattenWorkerRequest as Ut, AttachmentsListWorkerRequest as V, OutlineReadWorkerRequest as Vt, CloseWorkerRequest as W, PagesGeometryWorkerRequest as Wt, DocumentRenderPageFileWorkerRequest as X, PagesTextWorkerRequest as Xt, DocumentRenderPageFileEncodedWorkerRequest as Y, PagesSetNameWorkerRequest as Yt, DocumentSaveBufferWorkerRequest as Z, PagesWorkingSetWorkerRequest as Zt, placedBefore as _, SignaturesPrepareWorkerRequest as _n, FormsImportWorkerRequest as _t, pageVerbs as a, SearchQueryWorkerRequest as an, FontsAddFallbackWorkerRequest as at, permissionInfoFromProbe as b, WorkerJobId as bn, FormsReorderWidgetsWorkerRequest as bt, attachmentVerbs as c, ServerChangeOutcome as cn, FontsClearWorkerRequest as ct, Placed as d, SignaturesCancelWorkerRequest as dn, FormsCreateFieldWorkerRequest as dt, PieceInfoReadWorkerRequest as en, DocumentSecurityProbeInfo as et, RankedJob as f, SignaturesCompleteWorkerRequest as fn, FormsDeleteFieldWorkerRequest as ft, placeIn as g, SignaturesListWorkerRequest as gn, FormsImportValuesWorkerRequest as gt, placeFor as h, SignaturesFinalizeCandidateWorkerRequest as hn, FormsExportWorkerRequest as ht, PageStructureVerb as i, RequestEffect as in, EncodedImageWire as it, AnnotationsFlattenWorkerRequest as j, isAbortError as jn, MeasureSetScaleWorkerRequest as jt, AnnotationsExportAppearanceWorkerRequest as k, LOCAL_ENGINE_BRAND as kn, LayerCloseWorkerRequest as kt, JobTarget as l, ShutdownWorkerRequest as ln, FontsRegisterWorkerRequest as lt, clearlyOutranks as m, SignaturesDigestWorkerRequest as mn, FormsDetachWidgetWorkerRequest as mt, WirePack as n, RedactionApplyWorkerRequest as nn, DocumentVersionWorkerRequest as nt, outlineVerbs as o, SearchScanRequest as on, FontsAuthorizeEditingWorkerRequest as ot, ViewSets as p, SignaturesContentsWorkerRequest as pn, FormsDeleteWidgetWorkerRequest as pt, DocumentCheckPasswordPermissionsWorkerRequest as q, PagesRenderEncodedWorkerRequest as qt, wirePack as r, RenderEncode as rn, EncodedAppearanceWire as rt, AttachmentWriteVerb as s, ServerChange as sn, FontsClearFallbacksWorkerRequest as st, EMPTY_TRANSFER as t, PieceInfoUpdateWorkerRequest as tn, DocumentSetFontSettingsWorkerRequest as tt, Place as u, SignaturesAnalyzeWorkerRequest as un, FormsAddWidgetWorkerRequest as ut, rank as v, SignaturesRevisionBytesWorkerRequest as vn, FormsListWorkerRequest as vt, AbortWorkerRequest as w, WorkerResponse as wn, FormsSetValueWorkerRequest as wt, permissionInfoWithAdvisory as x, WorkerJobRequest as xn, FormsRepairWorkerRequest as xt, advisoryFromPdfBits as y, WorkerControlMessage as yn, FormsReorderCalculationsWorkerRequest as yt, AnnotationsUpdateWorkerRequest as z, OpenLayerMemoryBaseWorkerRequest as zt };
1959
+ //# sourceMappingURL=runtime-BaDKjxiu.d.ts.map