@embedpdf/engine-core 3.0.0-next.13 → 3.0.0-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnnotationList-CkijRHet.d.cts +27163 -0
- package/dist/AnnotationList-CkijRHet.d.ts +27163 -0
- package/dist/Change-CKoxfTNY.js +889 -0
- package/dist/Change-CKoxfTNY.js.map +1 -0
- package/dist/Change-CjImsrN0.cjs +1020 -0
- package/dist/Change-CjImsrN0.cjs.map +1 -0
- package/dist/DocumentRenderService-BfFdFSwI.cjs +120 -0
- package/dist/DocumentRenderService-BfFdFSwI.cjs.map +1 -0
- package/dist/DocumentRenderService-DV3J9lMz.js +85 -0
- package/dist/DocumentRenderService-DV3J9lMz.js.map +1 -0
- package/dist/{DocumentSecurityService-_JRjqvoI.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts} +100 -112
- package/dist/{DocumentSecurityService-ClTZc0zO.d.cts → DocumentSecurityService-e6vp2de8.d.cts} +100 -112
- package/dist/LocalDocumentHandle-D02FMm-Z.cjs +53 -0
- package/dist/LocalDocumentHandle-D02FMm-Z.cjs.map +1 -0
- package/dist/LocalDocumentHandle-DAPdaOt_.js +30 -0
- package/dist/LocalDocumentHandle-DAPdaOt_.js.map +1 -0
- package/dist/LocalEngine-DFoBm4B3.d.cts +1565 -0
- package/dist/LocalEngine-DPriFujS.d.ts +1565 -0
- package/dist/PageInsertBlankInput-CXHAM7l6.cjs +17 -0
- package/dist/PageInsertBlankInput-CXHAM7l6.cjs.map +1 -0
- package/dist/PageInsertBlankInput-DhVYVJ_S.js +12 -0
- package/dist/PageInsertBlankInput-DhVYVJ_S.js.map +1 -0
- package/dist/authority-B3BklsB4.js +2239 -0
- package/dist/authority-B3BklsB4.js.map +1 -0
- package/dist/authority-DLMNR7ff.cjs +2676 -0
- package/dist/authority-DLMNR7ff.cjs.map +1 -0
- package/dist/builders-CNj0POeY.js +161 -0
- package/dist/builders-CNj0POeY.js.map +1 -0
- package/dist/builders-Cgdp_YCn.cjs +184 -0
- package/dist/builders-Cgdp_YCn.cjs.map +1 -0
- package/dist/calibrate-7T3fnP8-.js +2404 -0
- package/dist/calibrate-7T3fnP8-.js.map +1 -0
- package/dist/calibrate-DJBXnhLE.cjs +2919 -0
- package/dist/calibrate-DJBXnhLE.cjs.map +1 -0
- package/dist/charmap-Cprti1ta.js +239 -0
- package/dist/charmap-Cprti1ta.js.map +1 -0
- package/dist/charmap-aYlefQP9.cjs +304 -0
- package/dist/charmap-aYlefQP9.cjs.map +1 -0
- package/dist/conformance.cjs +16753 -5247
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +928 -165
- package/dist/conformance.d.ts +928 -165
- package/dist/conformance.js +16731 -5268
- package/dist/conformance.js.map +1 -1
- package/dist/format-Bp3QFSH1.cjs +574 -0
- package/dist/format-Bp3QFSH1.cjs.map +1 -0
- package/dist/format-Dgg428Kb.js +461 -0
- package/dist/format-Dgg428Kb.js.map +1 -0
- package/dist/index.cjs +330 -103
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -5
- package/dist/pageRefs-B3ur7Ckm.cjs +51 -0
- package/dist/pageRefs-B3ur7Ckm.cjs.map +1 -0
- package/dist/pageRefs-DkbuxSCV.js +40 -0
- package/dist/pageRefs-DkbuxSCV.js.map +1 -0
- package/dist/public.cjs +57 -0
- package/dist/public.d.cts +5 -0
- package/dist/public.d.ts +5 -0
- package/dist/public.js +9 -0
- package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs +3646 -0
- package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs.map +1 -0
- package/dist/resolveAnnotationDraft-CUpf0SMh.js +3167 -0
- package/dist/resolveAnnotationDraft-CUpf0SMh.js.map +1 -0
- package/dist/{resolver-inAVzsWt.js → resolver-CzxmD9Ck.js} +294 -144
- package/dist/resolver-CzxmD9Ck.js.map +1 -0
- package/dist/{resolver-CYVNV4hn.cjs → resolver-D2OCtE8F.cjs} +347 -143
- package/dist/resolver-D2OCtE8F.cjs.map +1 -0
- package/dist/runtime-Cl0v56mm.d.ts +2032 -0
- package/dist/runtime-p1WDzDo4.d.cts +2032 -0
- package/dist/runtime.cjs +733 -284
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +5 -1348
- package/dist/runtime.d.ts +5 -1348
- package/dist/runtime.js +396 -179
- package/dist/runtime.js.map +1 -1
- package/dist/schema-C-gU4vj7.cjs +3034 -0
- package/dist/schema-C-gU4vj7.cjs.map +1 -0
- package/dist/schema-DzlUNk38.js +2081 -0
- package/dist/schema-DzlUNk38.js.map +1 -0
- package/dist/schemas-Berf1swF.cjs +2481 -0
- package/dist/schemas-Berf1swF.cjs.map +1 -0
- package/dist/schemas-D6xOGjqg.js +1654 -0
- package/dist/schemas-D6xOGjqg.js.map +1 -0
- package/dist/subtype-CG4WpIRj.js +129 -0
- package/dist/subtype-CG4WpIRj.js.map +1 -0
- package/dist/subtype-aDt5TFmK.cjs +158 -0
- package/dist/subtype-aDt5TFmK.cjs.map +1 -0
- package/dist/validation.cjs +578 -0
- package/dist/validation.cjs.map +1 -0
- package/dist/validation.d.cts +174 -0
- package/dist/validation.d.ts +174 -0
- package/dist/validation.js +571 -0
- package/dist/validation.js.map +1 -0
- package/dist/value-BFS1R8ek.cjs +435 -0
- package/dist/value-BFS1R8ek.cjs.map +1 -0
- package/dist/value-Dhc8eYcx.js +340 -0
- package/dist/value-Dhc8eYcx.js.map +1 -0
- package/dist/viewport-BJW13EGZ.js +540 -0
- package/dist/viewport-BJW13EGZ.js.map +1 -0
- package/dist/viewport-DlL5Bxbg.cjs +671 -0
- package/dist/viewport-DlL5Bxbg.cjs.map +1 -0
- package/dist/wire.cjs +1056 -379
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +15069 -725
- package/dist/wire.d.ts +15069 -725
- package/dist/wire.js +825 -239
- package/dist/wire.js.map +1 -1
- package/package.json +10 -1
- package/dist/AbortError-Cq2igpZ6.cjs +0 -38
- package/dist/AbortError-Cq2igpZ6.cjs.map +0 -1
- package/dist/AbortError-DHqPBnYc.js +0 -27
- package/dist/AbortError-DHqPBnYc.js.map +0 -1
- package/dist/AnnotationListSnapshot-D3mFut1e.d.cts +0 -6871
- package/dist/AnnotationListSnapshot-D3mFut1e.d.ts +0 -6871
- package/dist/Engine-Bx0NOfmd.d.cts +0 -1264
- package/dist/Engine-DxtpCYcP.d.ts +0 -1264
- package/dist/PageInsertBlankInput-CqXBmFhN.cjs +0 -449
- package/dist/PageInsertBlankInput-CqXBmFhN.cjs.map +0 -1
- package/dist/PageInsertBlankInput-cHq9-i-z.js +0 -378
- package/dist/PageInsertBlankInput-cHq9-i-z.js.map +0 -1
- package/dist/builders-Bqm8yTpi.cjs +0 -3564
- package/dist/builders-Bqm8yTpi.cjs.map +0 -1
- package/dist/builders-Dqo2X-dt.js +0 -3121
- package/dist/builders-Dqo2X-dt.js.map +0 -1
- package/dist/fold-2V29cxCV.cjs +0 -447
- package/dist/fold-2V29cxCV.cjs.map +0 -1
- package/dist/fold-CdEJTBTn.js +0 -334
- package/dist/fold-CdEJTBTn.js.map +0 -1
- package/dist/resolver-CYVNV4hn.cjs.map +0 -1
- package/dist/resolver-inAVzsWt.js.map +0 -1
- package/dist/schemas-BLARNCgx.js +0 -3113
- package/dist/schemas-BLARNCgx.js.map +0 -1
- package/dist/schemas-DIqFMmrC.cjs +0 -4468
- package/dist/schemas-DIqFMmrC.cjs.map +0 -1
|
@@ -0,0 +1,2032 @@
|
|
|
1
|
+
import { $h as SignatureCompleteResult, $l as PageFlattenResult, $n as PageDeleteResult, Aa as FormFieldValue, Ag as Coordinates, Bh as BaseVersionInfo, Bl as AnnotationImportResult, Dl as WidgetPatch, Du as BundleLimits, Eh as ChangeAuthority, Fd as WireAnnotationResources, Gn as RedactionApplyResult, Gu as AttachmentRef, Ho as SearchSlice, I_ as DocumentActionsSnapshot, Jm as CustomMetadata, Jp as PageRaster, Kn as RedactionApplyScope, Ku as WireAttachmentFile, M_ as PdfBits, Mc as AttachmentDeleteResult, Ng as PageBox, Pa as FormFieldPatch, Qc as FormFieldUpdateResult, Qh as SignatureCompleteInput, Qn as PageInsertResult, Sa as CustomMetadataUpdateResult, Th as AnnotationAuthority, To as WidgetPlacement, Vh as DigestAlgorithm, Vm as PageListSnapshot, Vo as SearchRequest, Wc as FormValuesImportResult, Wh as DocumentProtection, Xc as FormFieldCreateResult, Xg as PdfSize, Yc as FormCalculationsReorderResult, Yf as FontIdentityInfo, Yg as PdfRotation, Ym as MetadataPatch, Zc as FormFieldDeleteResult, Zg as FormFieldRef, Zh as SignatureCancelResult, Zi as Change, _a as PagePosition, _p as PageGeometrySnapshot, _v as DocumentMetadata, au as AnnotationUpdateResult, bs as AnnotationDraft, bu as WireAnnotationBundle, cg as SignatureSnapshot, cl as FormWidgetsReorderResult, d_ as SerializedEngineError, dp as AnnotationAppearancesResult, ed as WireResourceMap, el as FormRepairResult, em as PageRenderOptions, ep as PdfSaveMode, fd as PageMeasurementViewport, fl as FormExportSelection, gl as FormSnapshot, gu as AnnotationExportSelection, ha as FieldPosition, hd as PdfMeasure, hi as ChangeAnalysis, hn as PageScaleResult, ia as RecordedChange, ig as SignaturePrepared, il as FormWidgetLinkResult, iu as AnnotationReorderResult, jc as AttachmentCreateResult, jg as PageCoordinates, ju as BundleImportPages, l_ as EngineError, lp as AnnotationAppearanceRenderOptions, ma as AnnotationPosition, na as ChangeResult, nd as AnnotationFamily, nl as FormSetValueResult, nu as AnnotationCreateResult, o_ as AnnotationRef, or as AnnotationFlattenResult, pa as MetadataUpdateResult, pi as AnalyzeInput, qm as CustomMetadataPatch, qp as PageNetworkRenderFormat, rg as SignaturePrepareInput, rl as FormWidgetDeleteResult, ru as AnnotationDeleteResult, sl as FormWidgetUpdateResult, sp as AnnotationAppearanceMode, sr as PageNameResult, t as AnnotationList, tf as ObjectNumberRange, tg as SignatureDTO, tl as FormResetResult, tr as PageRotateResult, tu as PageFlattenUsage, ug as SignedDocumentPolicy, ur as PageReorderResult, uv as PageRef, vo as FormFieldDraft, wp as PageTextSnapshot, xl as WireFormBundle, xs as AnnotationPatch, y_ as AnnotationActor, zc as FormImportResult, zu as Attachment } from "./AnnotationList-CkijRHet.js";
|
|
2
|
+
import { C as DocumentEventStream, D as DocumentEventOf, E as DocumentEventInit, O as DocumentEventType, S as WorkingSetPage, T as DocumentEvent, d as PieceInfoPatch, l as PieceInfoUpdateResult, p as PieceInfoSnapshot, s as PieceInfoDeleteResult, x as CallPriority } from "./LocalEngine-DPriFujS.js";
|
|
3
|
+
import { f as PdfPermissionAdvisory, l as DocumentSecurityState, p as PdfPermissionInfo } from "./DocumentSecurityService-CU1M6Q7m.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
|
+
/**
|
|
378
|
+
* The annotations of the given pages, or of every page: a raw read off the
|
|
379
|
+
* document (no page is loaded), one snapshot per page.
|
|
380
|
+
*/
|
|
381
|
+
interface AnnotationsListWorkerRequest {
|
|
382
|
+
kind: 'annotations.list';
|
|
383
|
+
effect: 'read';
|
|
384
|
+
jobId: WorkerJobId;
|
|
385
|
+
docId: string;
|
|
386
|
+
layerName?: string;
|
|
387
|
+
/** In the order to list them; every page when omitted. */
|
|
388
|
+
pages?: PageRef[];
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Batch-render every appearance stream of one family on a page. Acquires a
|
|
392
|
+
* `pagePtr`, iterates `/Annots`, and renders each annotation's `/AP` via
|
|
393
|
+
* `EPDF_RenderAnnotBitmap` into its own raster. Read-only.
|
|
394
|
+
*/
|
|
395
|
+
interface AnnotationsRenderAppearancesWorkerRequest {
|
|
396
|
+
kind: 'annotations.renderAppearances';
|
|
397
|
+
effect: 'read';
|
|
398
|
+
jobId: WorkerJobId;
|
|
399
|
+
docId: string;
|
|
400
|
+
layerName?: string;
|
|
401
|
+
page: PageRef;
|
|
402
|
+
/** The page's annotations except widgets, or its widgets (`page.forms`). */
|
|
403
|
+
family: AnnotationFamily;
|
|
404
|
+
options?: AnnotationAppearanceRenderOptions;
|
|
405
|
+
}
|
|
406
|
+
interface AnnotationsCreateWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
|
|
407
|
+
kind: 'annotations.create';
|
|
408
|
+
effect: 'write';
|
|
409
|
+
jobId: WorkerJobId;
|
|
410
|
+
docId: string;
|
|
411
|
+
layerName?: string;
|
|
412
|
+
page: PageRef;
|
|
413
|
+
draft: AnnotationDraft<C>;
|
|
414
|
+
/** The object number the annotation gets; the next free one when absent. */
|
|
415
|
+
objectNumber?: number;
|
|
416
|
+
/**
|
|
417
|
+
* The bytes beside the draft, by role. The producer puts each buffer on
|
|
418
|
+
* the wirePack transfer list (zero-copy, same convention as `PageRaster`).
|
|
419
|
+
*/
|
|
420
|
+
resources?: WireAnnotationResources;
|
|
421
|
+
artifactPath?: string;
|
|
422
|
+
/**
|
|
423
|
+
* Identity to stamp on the newly created annotation:
|
|
424
|
+
* - `displayName` → /T (PDF author field)
|
|
425
|
+
* - `userId` / `groupId` → /EMBD_Metadata/{UserID,GroupID,CreatedBy,UpdatedBy}
|
|
426
|
+
* Optional — when absent (engine-local with no identity, anonymous tests),
|
|
427
|
+
* the worker still stamps the standard /M (modification date) but skips
|
|
428
|
+
* EMBD_Metadata.
|
|
429
|
+
*/
|
|
430
|
+
actor?: AnnotationActor;
|
|
431
|
+
}
|
|
432
|
+
interface AnnotationsUpdateWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
|
|
433
|
+
kind: 'annotations.update';
|
|
434
|
+
effect: 'write';
|
|
435
|
+
jobId: WorkerJobId;
|
|
436
|
+
docId: string;
|
|
437
|
+
layerName?: string;
|
|
438
|
+
ref: AnnotationRef;
|
|
439
|
+
patch: AnnotationPatch<C>;
|
|
440
|
+
/** The bytes beside the patch, by role — see the create request. */
|
|
441
|
+
resources?: WireAnnotationResources;
|
|
442
|
+
artifactPath?: string;
|
|
443
|
+
/**
|
|
444
|
+
* Who the update acts for and what they may do, checked against the
|
|
445
|
+
* annotation inside the write. Its identity refreshes
|
|
446
|
+
* /EMBD_Metadata/UpdatedBy; UserID, GroupID and CreatedBy stay unless the
|
|
447
|
+
* patch reassigns the group.
|
|
448
|
+
*/
|
|
449
|
+
authority: AnnotationAuthority;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* One change (`doc.apply`): its ops in order, as one transaction, or the
|
|
453
|
+
* reverse of an earlier write (`{ undoOf }`). Each op is checked as its
|
|
454
|
+
* single verb's job checks it, inside the write.
|
|
455
|
+
*/
|
|
456
|
+
interface DocumentApplyWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
|
|
457
|
+
kind: 'document.apply';
|
|
458
|
+
effect: 'write';
|
|
459
|
+
jobId: WorkerJobId;
|
|
460
|
+
docId: string;
|
|
461
|
+
layerName?: string;
|
|
462
|
+
/** The ops, with their bytes by role on the transfer list, as the single verbs send them. */
|
|
463
|
+
change: Change<C, WireAnnotationResources>;
|
|
464
|
+
/**
|
|
465
|
+
* Who the change acts for, what they may do and what the document's
|
|
466
|
+
* signatures forbid, checked inside the write against each op (the ops of
|
|
467
|
+
* an undo included) and each annotation an op creates, changes or removes.
|
|
468
|
+
* Creates stamp its identity, in the group the draft names; an undo needs
|
|
469
|
+
* its user to be the one who made the change.
|
|
470
|
+
*/
|
|
471
|
+
authority: ChangeAuthority;
|
|
472
|
+
artifactPath?: string;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* What the engine kept of a change so it can undo it, as it crosses the
|
|
476
|
+
* worker boundary: who made it and the steps that reverse it. Its steps are
|
|
477
|
+
* the engine's own; a caller stores them and hands them back, never reads
|
|
478
|
+
* them.
|
|
479
|
+
*/
|
|
480
|
+
interface ChangeRecordPayload {
|
|
481
|
+
readonly userId: string | null;
|
|
482
|
+
readonly steps: readonly unknown[];
|
|
483
|
+
}
|
|
484
|
+
/** One change of a server request (see `DocumentApplyChangesWorkerRequest`). */
|
|
485
|
+
interface ServerChange<C extends Coordinates = PageCoordinates> {
|
|
486
|
+
opId: string;
|
|
487
|
+
/** Its ops (a single-verb route's one op, an import's among them), or an undo. */
|
|
488
|
+
change: RecordedChange<C, WireAnnotationResources>;
|
|
489
|
+
/** Who the change acts for (see `DocumentApplyWorkerRequest.authority`). */
|
|
490
|
+
authority: ChangeAuthority;
|
|
491
|
+
/**
|
|
492
|
+
* For an undo of a change outside this request: the record that change
|
|
493
|
+
* left, or null when it left none (it was refused, or wrote nothing). The
|
|
494
|
+
* caller checked who may undo it and that nothing ended undo since. An undo
|
|
495
|
+
* of an earlier change of the same request leaves it out: the job keeps
|
|
496
|
+
* the records of its own changes.
|
|
497
|
+
*/
|
|
498
|
+
record?: ChangeRecordPayload | null;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* A server request's changes, as one job: each runs in its own layer
|
|
502
|
+
* transaction, committed or rolled back on its own, in order. A refusal is
|
|
503
|
+
* that change's answer; anything else fails the job. The job saves one
|
|
504
|
+
* artifact for the changes that applied.
|
|
505
|
+
*/
|
|
506
|
+
interface DocumentApplyChangesWorkerRequest<C extends Coordinates = PageCoordinates> {
|
|
507
|
+
kind: 'document.applyChanges';
|
|
508
|
+
effect: 'write';
|
|
509
|
+
jobId: WorkerJobId;
|
|
510
|
+
docId: string;
|
|
511
|
+
layerName?: string;
|
|
512
|
+
changes: ServerChange<C>[];
|
|
513
|
+
/** See `WriteJobFields.objectNumberFloor`. */
|
|
514
|
+
objectNumberFloor?: number;
|
|
515
|
+
artifactPath?: string;
|
|
516
|
+
}
|
|
517
|
+
/** What one change of a server request answered. */
|
|
518
|
+
type ServerChangeOutcome<C extends Coordinates = PageCoordinates> = {
|
|
519
|
+
opId: string;
|
|
520
|
+
status: 'applied';
|
|
521
|
+
result: ChangeResult<C>;
|
|
522
|
+
/** What undoes it, for the caller to keep; null when nothing can. */
|
|
523
|
+
record: ChangeRecordPayload | null;
|
|
524
|
+
} | {
|
|
525
|
+
opId: string;
|
|
526
|
+
status: 'refused';
|
|
527
|
+
error: SerializedEngineError;
|
|
528
|
+
};
|
|
529
|
+
interface AnnotationsDeleteWorkerRequest extends WriteJobFields {
|
|
530
|
+
kind: 'annotations.delete';
|
|
531
|
+
effect: 'write';
|
|
532
|
+
jobId: WorkerJobId;
|
|
533
|
+
docId: string;
|
|
534
|
+
layerName?: string;
|
|
535
|
+
ref: AnnotationRef;
|
|
536
|
+
/**
|
|
537
|
+
* Who the delete acts for and what they may do, checked inside the write
|
|
538
|
+
* against the annotation and everything deleted with it (`deletedWith`).
|
|
539
|
+
*/
|
|
540
|
+
authority: AnnotationAuthority;
|
|
541
|
+
artifactPath?: string;
|
|
542
|
+
}
|
|
543
|
+
/** Flatten a chosen set of one page's annotations into its content — see
|
|
544
|
+
* `AnnotationFlattenInput`. A content + annotation mutation of that page. */
|
|
545
|
+
interface AnnotationsFlattenWorkerRequest extends WriteJobFields {
|
|
546
|
+
kind: 'annotations.flatten';
|
|
547
|
+
effect: 'contentWrite';
|
|
548
|
+
jobId: WorkerJobId;
|
|
549
|
+
docId: string;
|
|
550
|
+
layerName?: string;
|
|
551
|
+
page: PageRef;
|
|
552
|
+
refs: AnnotationRef[];
|
|
553
|
+
usage: PageFlattenUsage;
|
|
554
|
+
artifactPath?: string;
|
|
555
|
+
}
|
|
556
|
+
/** Flatten a chosen set of one page's annotation appearances into a new
|
|
557
|
+
* single-page PDF (bytes). A read: no artifact, no revision. */
|
|
558
|
+
interface AnnotationsExportAppearanceWorkerRequest {
|
|
559
|
+
kind: 'annotations.exportAppearance';
|
|
560
|
+
effect: 'snapshot';
|
|
561
|
+
jobId: WorkerJobId;
|
|
562
|
+
docId: string;
|
|
563
|
+
layerName?: string;
|
|
564
|
+
page: PageRef;
|
|
565
|
+
refs: AnnotationRef[];
|
|
566
|
+
}
|
|
567
|
+
/** Annotations and their resources as one bundle (`doc.annotations.export`). A read. */
|
|
568
|
+
interface AnnotationsExportWorkerRequest {
|
|
569
|
+
kind: 'annotations.export';
|
|
570
|
+
effect: 'snapshot';
|
|
571
|
+
jobId: WorkerJobId;
|
|
572
|
+
docId: string;
|
|
573
|
+
layerName?: string;
|
|
574
|
+
selection: AnnotationExportSelection;
|
|
575
|
+
/** The limits the bundle must stay within; the defaults otherwise. */
|
|
576
|
+
limits?: BundleLimits;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* A bundle's annotations, created as one change (`doc.annotations.import`).
|
|
580
|
+
* The producer puts each resource's buffer on the transfer list. The bundle
|
|
581
|
+
* stays in page space on its way in: the import measures each item on the
|
|
582
|
+
* page it goes to, which only the import works out.
|
|
583
|
+
*/
|
|
584
|
+
interface AnnotationsImportWorkerRequest extends WriteJobFields {
|
|
585
|
+
kind: 'annotations.import';
|
|
586
|
+
effect: 'write';
|
|
587
|
+
jobId: WorkerJobId;
|
|
588
|
+
docId: string;
|
|
589
|
+
layerName?: string;
|
|
590
|
+
bundle: WireAnnotationBundle;
|
|
591
|
+
pages?: BundleImportPages;
|
|
592
|
+
attribution: 'restore' | 'stamp';
|
|
593
|
+
/**
|
|
594
|
+
* The session: who `'stamp'` attributes each annotation to, as on create,
|
|
595
|
+
* and whose user `'restore'` records as `importedBy`.
|
|
596
|
+
*/
|
|
597
|
+
actor?: AnnotationActor;
|
|
598
|
+
/** The limits the bundle must stay within; the defaults otherwise. */
|
|
599
|
+
limits?: BundleLimits;
|
|
600
|
+
artifactPath?: string;
|
|
601
|
+
}
|
|
602
|
+
/** An annotation's `appearance` resource: its drawing, as a one-page PDF (bytes). A read. */
|
|
603
|
+
interface AnnotationsReadAppearanceWorkerRequest {
|
|
604
|
+
kind: 'annotations.readAppearance';
|
|
605
|
+
effect: 'read';
|
|
606
|
+
jobId: WorkerJobId;
|
|
607
|
+
docId: string;
|
|
608
|
+
layerName?: string;
|
|
609
|
+
page: PageRef;
|
|
610
|
+
ref: AnnotationRef;
|
|
611
|
+
}
|
|
612
|
+
/** A page's annotations' stacking order: `refs` go together to `position`. */
|
|
613
|
+
interface AnnotationsReorderWorkerRequest extends WriteJobFields {
|
|
614
|
+
kind: 'annotations.reorder';
|
|
615
|
+
effect: 'write';
|
|
616
|
+
jobId: WorkerJobId;
|
|
617
|
+
docId: string;
|
|
618
|
+
layerName?: string;
|
|
619
|
+
page: PageRef;
|
|
620
|
+
refs: AnnotationRef[];
|
|
621
|
+
position: AnnotationPosition;
|
|
622
|
+
/** Who the reorder acts for and what they may do: checked against each annotation, inside the write. */
|
|
623
|
+
authority: AnnotationAuthority;
|
|
624
|
+
artifactPath?: string;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Complete reconciled form snapshot. Cheap between mutations: the worker
|
|
628
|
+
* caches the underlying EPDFForm model keyed on the session's mutation
|
|
629
|
+
* counter and rebuilds only after a write.
|
|
630
|
+
*/
|
|
631
|
+
interface FormsListWorkerRequest {
|
|
632
|
+
kind: 'forms.list';
|
|
633
|
+
effect: 'read';
|
|
634
|
+
jobId: WorkerJobId;
|
|
635
|
+
docId: string;
|
|
636
|
+
layerName?: string;
|
|
637
|
+
}
|
|
638
|
+
interface FormsSetValueWorkerRequest extends WriteJobFields {
|
|
639
|
+
kind: 'forms.setValue';
|
|
640
|
+
effect: 'write';
|
|
641
|
+
jobId: WorkerJobId;
|
|
642
|
+
docId: string;
|
|
643
|
+
layerName?: string;
|
|
644
|
+
ref: FormFieldRef;
|
|
645
|
+
value: FormFieldValue;
|
|
646
|
+
artifactPath?: string;
|
|
647
|
+
/**
|
|
648
|
+
* Who the write acts for (stamped as its filler or creator) and their
|
|
649
|
+
* grants, checked field by field inside the write.
|
|
650
|
+
*/
|
|
651
|
+
authority: ChangeAuthority;
|
|
652
|
+
}
|
|
653
|
+
interface FormsResetWorkerRequest extends WriteJobFields {
|
|
654
|
+
kind: 'forms.reset';
|
|
655
|
+
effect: 'write';
|
|
656
|
+
jobId: WorkerJobId;
|
|
657
|
+
docId: string;
|
|
658
|
+
layerName?: string;
|
|
659
|
+
/** The fields to reset; absent resets the whole form. */
|
|
660
|
+
refs?: FormFieldRef[];
|
|
661
|
+
artifactPath?: string;
|
|
662
|
+
/**
|
|
663
|
+
* Who the write acts for (stamped as its filler or creator) and their
|
|
664
|
+
* grants, checked field by field inside the write.
|
|
665
|
+
*/
|
|
666
|
+
authority: ChangeAuthority;
|
|
667
|
+
}
|
|
668
|
+
/** `doc.forms.export`: the fields a selection takes, as a bundle. A snapshot read. */
|
|
669
|
+
interface FormsExportWorkerRequest {
|
|
670
|
+
kind: 'forms.export';
|
|
671
|
+
effect: 'snapshot';
|
|
672
|
+
jobId: WorkerJobId;
|
|
673
|
+
docId: string;
|
|
674
|
+
layerName?: string;
|
|
675
|
+
selection: FormExportSelection;
|
|
676
|
+
/** The limits the bundle must stay within; the defaults otherwise. */
|
|
677
|
+
limits?: BundleLimits;
|
|
678
|
+
}
|
|
679
|
+
/** `doc.forms.import`: a bundle's design, as one change (see `FormImportOp`). */
|
|
680
|
+
interface FormsImportWorkerRequest extends WriteJobFields {
|
|
681
|
+
kind: 'forms.import';
|
|
682
|
+
effect: 'write';
|
|
683
|
+
jobId: WorkerJobId;
|
|
684
|
+
docId: string;
|
|
685
|
+
layerName?: string;
|
|
686
|
+
/** Page space; each resource on the transfer list. */
|
|
687
|
+
bundle: WireFormBundle;
|
|
688
|
+
pages?: BundleImportPages;
|
|
689
|
+
attribution: 'restore' | 'stamp';
|
|
690
|
+
values: boolean;
|
|
691
|
+
/**
|
|
692
|
+
* Who imports and their grants: whom `'stamp'` makes the creator and
|
|
693
|
+
* filler, whose user `'restore'` records as `importedBy`, and who may put
|
|
694
|
+
* the fields in which groups.
|
|
695
|
+
*/
|
|
696
|
+
authority: ChangeAuthority;
|
|
697
|
+
limits?: BundleLimits;
|
|
698
|
+
/** Whether the caller holds `doc.forms.script`: without it, scripts, submits and links are left out. */
|
|
699
|
+
mayScript: boolean;
|
|
700
|
+
artifactPath?: string;
|
|
701
|
+
}
|
|
702
|
+
/** `doc.forms.importValues`: a bundle's values, as one change (see `FormImportOp`). */
|
|
703
|
+
interface FormsImportValuesWorkerRequest extends WriteJobFields {
|
|
704
|
+
kind: 'forms.importValues';
|
|
705
|
+
effect: 'write';
|
|
706
|
+
jobId: WorkerJobId;
|
|
707
|
+
docId: string;
|
|
708
|
+
layerName?: string;
|
|
709
|
+
bundle: WireFormBundle;
|
|
710
|
+
attribution: 'restore' | 'stamp';
|
|
711
|
+
/**
|
|
712
|
+
* Who imports and their grants: whom `'stamp'` makes the filler, whose
|
|
713
|
+
* user `'restore'` records as `importedBy`, and which fields they may fill.
|
|
714
|
+
*/
|
|
715
|
+
authority: ChangeAuthority;
|
|
716
|
+
limits?: BundleLimits;
|
|
717
|
+
artifactPath?: string;
|
|
718
|
+
}
|
|
719
|
+
interface FormsRepairWorkerRequest extends WriteJobFields {
|
|
720
|
+
kind: 'forms.repair';
|
|
721
|
+
effect: 'write';
|
|
722
|
+
jobId: WorkerJobId;
|
|
723
|
+
docId: string;
|
|
724
|
+
layerName?: string;
|
|
725
|
+
bakeAppearances?: boolean;
|
|
726
|
+
artifactPath?: string;
|
|
727
|
+
}
|
|
728
|
+
interface FormsCreateFieldWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
|
|
729
|
+
kind: 'forms.createField';
|
|
730
|
+
effect: 'write';
|
|
731
|
+
jobId: WorkerJobId;
|
|
732
|
+
docId: string;
|
|
733
|
+
layerName?: string;
|
|
734
|
+
draft: FormFieldDraft<C>;
|
|
735
|
+
/** The field's object number; the next free one when absent. */
|
|
736
|
+
objectNumber?: number;
|
|
737
|
+
/** Its widgets' object numbers, in `draft.widgets` order; the next free ones when absent. */
|
|
738
|
+
widgetObjectNumbers?: number[];
|
|
739
|
+
artifactPath?: string;
|
|
740
|
+
/**
|
|
741
|
+
* Who creates the field (stamped as its creator, and whose group it goes
|
|
742
|
+
* in by default) and their grants: which groups they may put it in.
|
|
743
|
+
*/
|
|
744
|
+
authority: ChangeAuthority;
|
|
745
|
+
}
|
|
746
|
+
interface FormsUpdateFieldWorkerRequest extends WriteJobFields {
|
|
747
|
+
kind: 'forms.updateField';
|
|
748
|
+
effect: 'write';
|
|
749
|
+
jobId: WorkerJobId;
|
|
750
|
+
docId: string;
|
|
751
|
+
layerName?: string;
|
|
752
|
+
ref: FormFieldRef;
|
|
753
|
+
patch: FormFieldPatch;
|
|
754
|
+
artifactPath?: string;
|
|
755
|
+
/** Who changes the field and their grants: which group they may move it to. */
|
|
756
|
+
authority: ChangeAuthority;
|
|
757
|
+
}
|
|
758
|
+
/** Draw a PDF page into every widget of an unsigned signature field (the visual fill). */
|
|
759
|
+
interface FormsSetSignatureAppearanceWorkerRequest extends WriteJobFields {
|
|
760
|
+
kind: 'forms.setSignatureAppearance';
|
|
761
|
+
effect: 'write';
|
|
762
|
+
jobId: WorkerJobId;
|
|
763
|
+
docId: string;
|
|
764
|
+
layerName?: string;
|
|
765
|
+
ref: FormFieldRef;
|
|
766
|
+
pdf: ArrayBuffer;
|
|
767
|
+
artifactPath?: string;
|
|
768
|
+
/** Who draws the look and their grants: the field must be theirs to sign. */
|
|
769
|
+
authority: ChangeAuthority;
|
|
770
|
+
}
|
|
771
|
+
interface FormsDeleteFieldWorkerRequest extends WriteJobFields {
|
|
772
|
+
kind: 'forms.deleteField';
|
|
773
|
+
effect: 'write';
|
|
774
|
+
jobId: WorkerJobId;
|
|
775
|
+
docId: string;
|
|
776
|
+
layerName?: string;
|
|
777
|
+
ref: FormFieldRef;
|
|
778
|
+
artifactPath?: string;
|
|
779
|
+
}
|
|
780
|
+
interface FormsAddWidgetWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
|
|
781
|
+
kind: 'forms.addWidget';
|
|
782
|
+
effect: 'write';
|
|
783
|
+
jobId: WorkerJobId;
|
|
784
|
+
docId: string;
|
|
785
|
+
layerName?: string;
|
|
786
|
+
ref: FormFieldRef;
|
|
787
|
+
placement: WidgetPlacement<C>;
|
|
788
|
+
/** The new widget's object number; the next free one when absent. */
|
|
789
|
+
objectNumber?: number;
|
|
790
|
+
/** Where a merged field's widget moves when it splits; the next free one when absent. */
|
|
791
|
+
splitObjectNumber?: number;
|
|
792
|
+
artifactPath?: string;
|
|
793
|
+
}
|
|
794
|
+
interface FormsDetachWidgetWorkerRequest extends WriteJobFields {
|
|
795
|
+
kind: 'forms.detachWidget';
|
|
796
|
+
effect: 'write';
|
|
797
|
+
jobId: WorkerJobId;
|
|
798
|
+
docId: string;
|
|
799
|
+
layerName?: string;
|
|
800
|
+
ref: FormFieldRef;
|
|
801
|
+
widget: AnnotationRef;
|
|
802
|
+
artifactPath?: string;
|
|
803
|
+
}
|
|
804
|
+
/** A widget leaves its page, and its field when it has one. */
|
|
805
|
+
interface FormsDeleteWidgetWorkerRequest extends WriteJobFields {
|
|
806
|
+
kind: 'forms.deleteWidget';
|
|
807
|
+
effect: 'write';
|
|
808
|
+
jobId: WorkerJobId;
|
|
809
|
+
docId: string;
|
|
810
|
+
layerName?: string;
|
|
811
|
+
widget: AnnotationRef;
|
|
812
|
+
artifactPath?: string;
|
|
813
|
+
}
|
|
814
|
+
/** The form's calculation order: `fields` go together to `position`. */
|
|
815
|
+
interface FormsReorderCalculationsWorkerRequest extends WriteJobFields {
|
|
816
|
+
kind: 'forms.reorderCalculations';
|
|
817
|
+
effect: 'write';
|
|
818
|
+
jobId: WorkerJobId;
|
|
819
|
+
docId: string;
|
|
820
|
+
layerName?: string;
|
|
821
|
+
fields: FormFieldRef[];
|
|
822
|
+
position: FieldPosition;
|
|
823
|
+
artifactPath?: string;
|
|
824
|
+
}
|
|
825
|
+
/** A page's widgets' stacking order: `widgets` go together to `position`. */
|
|
826
|
+
interface FormsReorderWidgetsWorkerRequest extends WriteJobFields {
|
|
827
|
+
kind: 'forms.reorderWidgets';
|
|
828
|
+
effect: 'write';
|
|
829
|
+
jobId: WorkerJobId;
|
|
830
|
+
docId: string;
|
|
831
|
+
layerName?: string;
|
|
832
|
+
page: PageRef;
|
|
833
|
+
widgets: AnnotationRef[];
|
|
834
|
+
position: AnnotationPosition;
|
|
835
|
+
artifactPath?: string;
|
|
836
|
+
}
|
|
837
|
+
interface FormsUpdateWidgetWorkerRequest<C extends Coordinates = PageCoordinates> extends WriteJobFields {
|
|
838
|
+
kind: 'forms.updateWidget';
|
|
839
|
+
effect: 'write';
|
|
840
|
+
jobId: WorkerJobId;
|
|
841
|
+
docId: string;
|
|
842
|
+
layerName?: string;
|
|
843
|
+
widget: AnnotationRef;
|
|
844
|
+
patch: WidgetPatch<C>;
|
|
845
|
+
artifactPath?: string;
|
|
846
|
+
}
|
|
847
|
+
interface PagesListWorkerRequest {
|
|
848
|
+
kind: 'pages.list';
|
|
849
|
+
effect: 'read';
|
|
850
|
+
jobId: WorkerJobId;
|
|
851
|
+
docId: string;
|
|
852
|
+
layerName?: string;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Per-page plain-text extraction. Acquires a pagePtr and runs PDFium's
|
|
856
|
+
* `FPDFText_LoadPage` → `FPDFText_GetText` chain: a slow-path per-page
|
|
857
|
+
* read keyed by indirect object number.
|
|
858
|
+
*/
|
|
859
|
+
interface PagesTextWorkerRequest {
|
|
860
|
+
kind: 'pages.text';
|
|
861
|
+
effect: 'read';
|
|
862
|
+
jobId: WorkerJobId;
|
|
863
|
+
docId: string;
|
|
864
|
+
layerName?: string;
|
|
865
|
+
page: PageRef;
|
|
866
|
+
}
|
|
867
|
+
interface PagesGeometryWorkerRequest {
|
|
868
|
+
kind: 'pages.geometry';
|
|
869
|
+
effect: 'read';
|
|
870
|
+
jobId: WorkerJobId;
|
|
871
|
+
docId: string;
|
|
872
|
+
layerName?: string;
|
|
873
|
+
page: PageRef;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* A search request as the worker runs it: the request plus `skip`, a trusted
|
|
877
|
+
* absolute resume position (scan-order pages already searched). For callers
|
|
878
|
+
* that pin content versions themselves — the cloud wire pins the search
|
|
879
|
+
* content epoch in the URL, so its routes resume by position alone.
|
|
880
|
+
* Everyone else uses `cursor`, which also guards against changes between
|
|
881
|
+
* batches; `cursor` takes precedence when both are set.
|
|
882
|
+
*/
|
|
883
|
+
interface SearchScanRequest extends SearchRequest {
|
|
884
|
+
skip?: number;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* One budgeted search batch (see `DocumentSearchService`). Read-only: the
|
|
888
|
+
* worker's per-page corpus cache is version-keyed on the session mutation
|
|
889
|
+
* counter, so repeated batches between mutations reuse extracted text.
|
|
890
|
+
*/
|
|
891
|
+
interface SearchQueryWorkerRequest {
|
|
892
|
+
kind: 'search.query';
|
|
893
|
+
effect: 'read';
|
|
894
|
+
jobId: WorkerJobId;
|
|
895
|
+
docId: string;
|
|
896
|
+
layerName?: string;
|
|
897
|
+
request: SearchScanRequest;
|
|
898
|
+
}
|
|
899
|
+
interface PagesRenderWorkerRequest<C extends Coordinates = PageCoordinates> {
|
|
900
|
+
kind: 'pages.render';
|
|
901
|
+
effect: 'read';
|
|
902
|
+
jobId: WorkerJobId;
|
|
903
|
+
docId: string;
|
|
904
|
+
layerName?: string;
|
|
905
|
+
page: PageRef;
|
|
906
|
+
options?: PageRenderOptions<C>;
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* One-shot file render — open the base document from a file path, render
|
|
910
|
+
* one page by display index, close. No session is bound (the ingestion
|
|
911
|
+
* `runAdHoc` pattern, like `document.probeSecurityFile`): this is the
|
|
912
|
+
* derived-artifact warmer's producer, used when no live document session
|
|
913
|
+
* exists yet. The payload reports the page's durable object number so the
|
|
914
|
+
* caller can key the artifact it persists.
|
|
915
|
+
*/
|
|
916
|
+
interface DocumentRenderPageFileWorkerRequest {
|
|
917
|
+
kind: 'document.renderPageFile';
|
|
918
|
+
effect: 'read';
|
|
919
|
+
jobId: WorkerJobId;
|
|
920
|
+
path: string;
|
|
921
|
+
password: string | null;
|
|
922
|
+
/** Display index (0-based) — ingest knows "first page", not object numbers. */
|
|
923
|
+
pageIndex: number;
|
|
924
|
+
options?: PageRenderOptions;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Encode instruction for the `*.renderEncoded` request family. Cloud-server
|
|
928
|
+
* surface (like the file-path ops): the server worker injects an image
|
|
929
|
+
* encoder into its `WorkerHost`, so the raster is encoded where IT is
|
|
930
|
+
* produced and only the compressed image crosses the engine boundary —
|
|
931
|
+
* kilobytes over the host IPC pipe instead of a megabytes-scale rgba
|
|
932
|
+
* copy. Engines without an injected encoder (browser/local workers, which
|
|
933
|
+
* encode via canvas instead) reject these kinds with `NotImplemented`.
|
|
934
|
+
* Policy stays caller-side: format and quality always arrive in the
|
|
935
|
+
* request; the engine plane holds no image-policy defaults.
|
|
936
|
+
*/
|
|
937
|
+
interface RenderEncode {
|
|
938
|
+
format: PageNetworkRenderFormat;
|
|
939
|
+
quality?: number;
|
|
940
|
+
}
|
|
941
|
+
/** An encoded render result. `width`/`height` are the source raster's output
|
|
942
|
+
* dimensions (they feed the advisory image-dimension headers). `bytes` must
|
|
943
|
+
* own its buffer — it rides the transfer manifest zero-copy, so a pooled
|
|
944
|
+
* view (e.g. a Node `Buffer` slab slice) would detach unrelated data. */
|
|
945
|
+
interface EncodedImageWire {
|
|
946
|
+
contentType: string;
|
|
947
|
+
width: number;
|
|
948
|
+
height: number;
|
|
949
|
+
bytes: Uint8Array;
|
|
950
|
+
}
|
|
951
|
+
interface PagesRenderEncodedWorkerRequest<C extends Coordinates = PageCoordinates> {
|
|
952
|
+
kind: 'pages.renderEncoded';
|
|
953
|
+
effect: 'read';
|
|
954
|
+
jobId: WorkerJobId;
|
|
955
|
+
docId: string;
|
|
956
|
+
layerName?: string;
|
|
957
|
+
page: PageRef;
|
|
958
|
+
options?: PageRenderOptions<C>;
|
|
959
|
+
encode: RenderEncode;
|
|
960
|
+
}
|
|
961
|
+
/** `document.renderPageFile` + in-worker encode — same one-shot transient
|
|
962
|
+
* session semantics; see that request's docs. */
|
|
963
|
+
interface DocumentRenderPageFileEncodedWorkerRequest {
|
|
964
|
+
kind: 'document.renderPageFileEncoded';
|
|
965
|
+
effect: 'read';
|
|
966
|
+
jobId: WorkerJobId;
|
|
967
|
+
path: string;
|
|
968
|
+
password: string | null;
|
|
969
|
+
/** Display index (0-based) — ingest knows "first page", not object numbers. */
|
|
970
|
+
pageIndex: number;
|
|
971
|
+
options?: PageRenderOptions;
|
|
972
|
+
encode: RenderEncode;
|
|
973
|
+
}
|
|
974
|
+
interface AnnotationsRenderAppearancesEncodedWorkerRequest {
|
|
975
|
+
kind: 'annotations.renderAppearancesEncoded';
|
|
976
|
+
effect: 'read';
|
|
977
|
+
jobId: WorkerJobId;
|
|
978
|
+
docId: string;
|
|
979
|
+
layerName?: string;
|
|
980
|
+
page: PageRef;
|
|
981
|
+
/** The page's annotations except widgets, or its widgets (`page.forms`). */
|
|
982
|
+
family: AnnotationFamily;
|
|
983
|
+
options?: AnnotationAppearanceRenderOptions;
|
|
984
|
+
encode: RenderEncode;
|
|
985
|
+
}
|
|
986
|
+
/** Encoded counterpart of `AnnotationAppearanceRaster`: same identity and
|
|
987
|
+
* placement metadata, image instead of raster. */
|
|
988
|
+
interface EncodedAppearanceWire<C extends Coordinates = PageCoordinates> {
|
|
989
|
+
ref: AnnotationRef;
|
|
990
|
+
mode: AnnotationAppearanceMode;
|
|
991
|
+
state: string | null;
|
|
992
|
+
rect: C['box'];
|
|
993
|
+
image: EncodedImageWire;
|
|
994
|
+
}
|
|
995
|
+
interface AnnotationAppearancesEncodedResultWire<C extends Coordinates = PageCoordinates> {
|
|
996
|
+
page: PageRef;
|
|
997
|
+
appearances: EncodedAppearanceWire<C>[];
|
|
998
|
+
}
|
|
999
|
+
interface PagesReorderWorkerRequest extends WriteJobFields {
|
|
1000
|
+
kind: 'pages.reorder';
|
|
1001
|
+
effect: 'contentWrite';
|
|
1002
|
+
jobId: WorkerJobId;
|
|
1003
|
+
docId: string;
|
|
1004
|
+
layerName?: string;
|
|
1005
|
+
pages: PageRef[];
|
|
1006
|
+
position: PagePosition;
|
|
1007
|
+
artifactPath?: string;
|
|
1008
|
+
}
|
|
1009
|
+
interface PagesRotateWorkerRequest extends WriteJobFields {
|
|
1010
|
+
kind: 'pages.rotate';
|
|
1011
|
+
effect: 'contentWrite';
|
|
1012
|
+
jobId: WorkerJobId;
|
|
1013
|
+
docId: string;
|
|
1014
|
+
layerName?: string;
|
|
1015
|
+
pages: PageRef[];
|
|
1016
|
+
/** Absolute rotation in degrees clockwise — see `PageRotateInput`. */
|
|
1017
|
+
rotation: PdfRotation;
|
|
1018
|
+
artifactPath?: string;
|
|
1019
|
+
}
|
|
1020
|
+
interface PagesDeleteWorkerRequest extends WriteJobFields {
|
|
1021
|
+
kind: 'pages.delete';
|
|
1022
|
+
effect: 'contentWrite';
|
|
1023
|
+
jobId: WorkerJobId;
|
|
1024
|
+
docId: string;
|
|
1025
|
+
layerName?: string;
|
|
1026
|
+
pages: PageRef[];
|
|
1027
|
+
artifactPath?: string;
|
|
1028
|
+
}
|
|
1029
|
+
/** Register/rename a `/Names /Pages` entry — see `PageNameInput`. */
|
|
1030
|
+
interface PagesSetNameWorkerRequest extends WriteJobFields {
|
|
1031
|
+
kind: 'pages.setName';
|
|
1032
|
+
effect: 'write';
|
|
1033
|
+
jobId: WorkerJobId;
|
|
1034
|
+
docId: string;
|
|
1035
|
+
layerName?: string;
|
|
1036
|
+
name: string;
|
|
1037
|
+
page: PageRef;
|
|
1038
|
+
replace?: string;
|
|
1039
|
+
artifactPath?: string;
|
|
1040
|
+
}
|
|
1041
|
+
/** Remove a `/Names /Pages` entry — see `PageRemoveNameInput`. */
|
|
1042
|
+
interface PagesRemoveNameWorkerRequest extends WriteJobFields {
|
|
1043
|
+
kind: 'pages.removeName';
|
|
1044
|
+
effect: 'write';
|
|
1045
|
+
jobId: WorkerJobId;
|
|
1046
|
+
docId: string;
|
|
1047
|
+
layerName?: string;
|
|
1048
|
+
name: string;
|
|
1049
|
+
artifactPath?: string;
|
|
1050
|
+
}
|
|
1051
|
+
interface PagesFlattenWorkerRequest extends WriteJobFields {
|
|
1052
|
+
kind: 'pages.flatten';
|
|
1053
|
+
effect: 'contentWrite';
|
|
1054
|
+
jobId: WorkerJobId;
|
|
1055
|
+
docId: string;
|
|
1056
|
+
layerName?: string;
|
|
1057
|
+
pages: PageRef[];
|
|
1058
|
+
usage: PageFlattenUsage;
|
|
1059
|
+
artifactPath?: string;
|
|
1060
|
+
}
|
|
1061
|
+
interface RedactionApplyWorkerRequest extends WriteJobFields {
|
|
1062
|
+
kind: 'redaction.apply';
|
|
1063
|
+
effect: 'contentWrite';
|
|
1064
|
+
jobId: WorkerJobId;
|
|
1065
|
+
docId: string;
|
|
1066
|
+
layerName?: string;
|
|
1067
|
+
scope: RedactionApplyScope;
|
|
1068
|
+
artifactPath?: string;
|
|
1069
|
+
}
|
|
1070
|
+
/** Export the given pages as a standalone PDF (a read — the source
|
|
1071
|
+
* session is untouched, so no layer artifact rides the result). */
|
|
1072
|
+
interface PagesExtractWorkerRequest {
|
|
1073
|
+
kind: 'pages.extract';
|
|
1074
|
+
effect: 'snapshot';
|
|
1075
|
+
jobId: WorkerJobId;
|
|
1076
|
+
docId: string;
|
|
1077
|
+
layerName?: string;
|
|
1078
|
+
pages: PageRef[];
|
|
1079
|
+
}
|
|
1080
|
+
/** List the document catalog's `/EmbeddedFiles` name tree (a read). */
|
|
1081
|
+
interface AttachmentsListWorkerRequest {
|
|
1082
|
+
kind: 'attachments.list';
|
|
1083
|
+
effect: 'read';
|
|
1084
|
+
jobId: WorkerJobId;
|
|
1085
|
+
docId: string;
|
|
1086
|
+
layerName?: string;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Decode one document-level embedded file (a read — no revision bump, no
|
|
1090
|
+
* layer artifact). Two delivery modes, the `artifactPath?` pattern:
|
|
1091
|
+
* `path` absent → browser mode, decoded bytes ride the transfer list;
|
|
1092
|
+
* `path` present → server mode, the worker streams the decoded file to
|
|
1093
|
+
* that path (`EPDFAttachment_ExtractFile` + `FPDF_FILEWRITE`) so the
|
|
1094
|
+
* payload never crosses the thread boundary and HTTP can stream it from
|
|
1095
|
+
* disk with backpressure.
|
|
1096
|
+
*/
|
|
1097
|
+
interface AttachmentsReadFileWorkerRequest {
|
|
1098
|
+
kind: 'attachments.readFile';
|
|
1099
|
+
effect: 'read';
|
|
1100
|
+
jobId: WorkerJobId;
|
|
1101
|
+
docId: string;
|
|
1102
|
+
layerName?: string;
|
|
1103
|
+
ref: AttachmentRef;
|
|
1104
|
+
path?: string;
|
|
1105
|
+
/** Decompression-bomb cap forwarded to the runtime. Absent/0 = unlimited. */
|
|
1106
|
+
maxDecodedBytes?: number;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Create a document-level embedded file (a mutation — layer sessions
|
|
1110
|
+
* persist an artifact). `file` is the same post-normalization wire shape
|
|
1111
|
+
* the file-attachment annotation draft uses: metadata in JSON, bytes
|
|
1112
|
+
* out-of-band under the referenced resource key. `file.name` becomes the
|
|
1113
|
+
* name-tree key.
|
|
1114
|
+
*/
|
|
1115
|
+
interface AttachmentsCreateWorkerRequest extends WriteJobFields {
|
|
1116
|
+
kind: 'attachments.create';
|
|
1117
|
+
effect: 'write';
|
|
1118
|
+
jobId: WorkerJobId;
|
|
1119
|
+
docId: string;
|
|
1120
|
+
layerName?: string;
|
|
1121
|
+
file: WireAttachmentFile;
|
|
1122
|
+
/** Binary payload referenced by `file.resources.file` — transfer-list bytes. */
|
|
1123
|
+
resources?: WireResourceMap;
|
|
1124
|
+
artifactPath?: string;
|
|
1125
|
+
}
|
|
1126
|
+
/** Delete a document-level embedded file by key (a mutation). */
|
|
1127
|
+
interface AttachmentsDeleteWorkerRequest extends WriteJobFields {
|
|
1128
|
+
kind: 'attachments.delete';
|
|
1129
|
+
effect: 'write';
|
|
1130
|
+
jobId: WorkerJobId;
|
|
1131
|
+
docId: string;
|
|
1132
|
+
layerName?: string;
|
|
1133
|
+
ref: AttachmentRef;
|
|
1134
|
+
artifactPath?: string;
|
|
1135
|
+
}
|
|
1136
|
+
/** Decode the file embedded in a FileAttachment annotation's `/FS`.
|
|
1137
|
+
* Same read semantics and delivery modes as `attachments.readFile`. */
|
|
1138
|
+
interface AnnotationsReadFileWorkerRequest {
|
|
1139
|
+
kind: 'annotations.readFile';
|
|
1140
|
+
effect: 'read';
|
|
1141
|
+
jobId: WorkerJobId;
|
|
1142
|
+
docId: string;
|
|
1143
|
+
layerName?: string;
|
|
1144
|
+
page: PageRef;
|
|
1145
|
+
ref: AnnotationRef;
|
|
1146
|
+
path?: string;
|
|
1147
|
+
/** Decompression-bomb cap forwarded to the runtime. Absent/0 = unlimited. */
|
|
1148
|
+
maxDecodedBytes?: number;
|
|
1149
|
+
}
|
|
1150
|
+
/** Insert every page of a standalone PDF (transferable `bytes`) at
|
|
1151
|
+
* `position` (omitted → `'end'`). A structural mutation: layer sessions
|
|
1152
|
+
* persist an artifact like reorder/rotate/delete. */
|
|
1153
|
+
interface PagesInsertWorkerRequest extends WriteJobFields {
|
|
1154
|
+
kind: 'pages.insert';
|
|
1155
|
+
effect: 'contentWrite';
|
|
1156
|
+
jobId: WorkerJobId;
|
|
1157
|
+
docId: string;
|
|
1158
|
+
layerName?: string;
|
|
1159
|
+
bytes: ArrayBuffer;
|
|
1160
|
+
position?: PagePosition;
|
|
1161
|
+
artifactPath?: string;
|
|
1162
|
+
}
|
|
1163
|
+
/** Create `count` (default 1) blank pages of `size` (PDF points) at
|
|
1164
|
+
* `position` (omitted → `'end'`). A structural mutation exactly like
|
|
1165
|
+
* `pages.insert`, minus the bytes: pure parameters, so nothing transfers;
|
|
1166
|
+
* layer sessions persist an artifact identically. */
|
|
1167
|
+
interface PagesInsertBlankWorkerRequest extends WriteJobFields {
|
|
1168
|
+
kind: 'pages.insertBlank';
|
|
1169
|
+
effect: 'contentWrite';
|
|
1170
|
+
jobId: WorkerJobId;
|
|
1171
|
+
docId: string;
|
|
1172
|
+
layerName?: string;
|
|
1173
|
+
size: PdfSize;
|
|
1174
|
+
count?: number;
|
|
1175
|
+
position?: PagePosition;
|
|
1176
|
+
/** The object numbers the new pages get, one per page; the next free ones when absent. */
|
|
1177
|
+
objectNumbers?: number[];
|
|
1178
|
+
artifactPath?: string;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* `/PieceInfo` private application data (ISO 32000 §14.5). One job family
|
|
1182
|
+
* serves both levels: `pageObjectNumber` present → the page's `/PieceInfo`,
|
|
1183
|
+
* absent → the document catalog's — mirroring the native API symmetry.
|
|
1184
|
+
* `update`/`clear` are mutations (a layer session persists an artifact);
|
|
1185
|
+
* `read`/`applications` are plain reads.
|
|
1186
|
+
*/
|
|
1187
|
+
interface MeasureViewportsWorkerRequest {
|
|
1188
|
+
kind: 'measure.viewports';
|
|
1189
|
+
effect: 'read';
|
|
1190
|
+
jobId: WorkerJobId;
|
|
1191
|
+
docId: string;
|
|
1192
|
+
layerName?: string;
|
|
1193
|
+
page: PageRef;
|
|
1194
|
+
}
|
|
1195
|
+
interface MeasureSetScaleWorkerRequest extends WriteJobFields {
|
|
1196
|
+
kind: 'measure.setScale';
|
|
1197
|
+
effect: 'write';
|
|
1198
|
+
jobId: WorkerJobId;
|
|
1199
|
+
docId: string;
|
|
1200
|
+
layerName?: string;
|
|
1201
|
+
page: PageRef;
|
|
1202
|
+
measure: PdfMeasure | null;
|
|
1203
|
+
artifactPath?: string;
|
|
1204
|
+
}
|
|
1205
|
+
interface PieceInfoReadWorkerRequest {
|
|
1206
|
+
kind: 'pieceInfo.read';
|
|
1207
|
+
effect: 'read';
|
|
1208
|
+
jobId: WorkerJobId;
|
|
1209
|
+
docId: string;
|
|
1210
|
+
layerName?: string;
|
|
1211
|
+
page?: PageRef;
|
|
1212
|
+
application: string;
|
|
1213
|
+
}
|
|
1214
|
+
interface PieceInfoUpdateWorkerRequest extends WriteJobFields {
|
|
1215
|
+
kind: 'pieceInfo.update';
|
|
1216
|
+
effect: 'write';
|
|
1217
|
+
jobId: WorkerJobId;
|
|
1218
|
+
docId: string;
|
|
1219
|
+
layerName?: string;
|
|
1220
|
+
page?: PageRef;
|
|
1221
|
+
application: string;
|
|
1222
|
+
patch: PieceInfoPatch;
|
|
1223
|
+
artifactPath?: string;
|
|
1224
|
+
}
|
|
1225
|
+
interface PieceInfoApplicationsWorkerRequest {
|
|
1226
|
+
kind: 'pieceInfo.applications';
|
|
1227
|
+
effect: 'read';
|
|
1228
|
+
jobId: WorkerJobId;
|
|
1229
|
+
docId: string;
|
|
1230
|
+
layerName?: string;
|
|
1231
|
+
page?: PageRef;
|
|
1232
|
+
}
|
|
1233
|
+
interface PieceInfoDeleteWorkerRequest extends WriteJobFields {
|
|
1234
|
+
kind: 'pieceInfo.delete';
|
|
1235
|
+
effect: 'write';
|
|
1236
|
+
jobId: WorkerJobId;
|
|
1237
|
+
docId: string;
|
|
1238
|
+
layerName?: string;
|
|
1239
|
+
page?: PageRef;
|
|
1240
|
+
application: string;
|
|
1241
|
+
artifactPath?: string;
|
|
1242
|
+
}
|
|
1243
|
+
interface DocumentSaveBufferWorkerRequest {
|
|
1244
|
+
kind: 'document.saveBuffer';
|
|
1245
|
+
effect: 'snapshot';
|
|
1246
|
+
jobId: WorkerJobId;
|
|
1247
|
+
docId: string;
|
|
1248
|
+
layerName?: string;
|
|
1249
|
+
mode: PdfSaveMode;
|
|
1250
|
+
}
|
|
1251
|
+
interface DocumentSaveFileWorkerRequest {
|
|
1252
|
+
kind: 'document.saveFile';
|
|
1253
|
+
effect: 'snapshot';
|
|
1254
|
+
jobId: WorkerJobId;
|
|
1255
|
+
docId: string;
|
|
1256
|
+
layerName?: string;
|
|
1257
|
+
mode: PdfSaveMode;
|
|
1258
|
+
path: string;
|
|
1259
|
+
}
|
|
1260
|
+
/** Export just the layer artifact (the overlay diff) to a transferable buffer.
|
|
1261
|
+
* Layer sessions only; the host rejects a base-only session. */
|
|
1262
|
+
interface DocumentSaveLayerBufferWorkerRequest {
|
|
1263
|
+
kind: 'document.saveLayerBuffer';
|
|
1264
|
+
effect: 'snapshot';
|
|
1265
|
+
jobId: WorkerJobId;
|
|
1266
|
+
docId: string;
|
|
1267
|
+
layerName?: string;
|
|
1268
|
+
}
|
|
1269
|
+
interface DocumentSecurityProbeInfo {
|
|
1270
|
+
encryptionState: 'unknown' | 'none' | 'encrypted' | 'unsupported';
|
|
1271
|
+
encryptionRequiresPassword: boolean | null;
|
|
1272
|
+
securityHandlerRevision: number | null;
|
|
1273
|
+
pdfPermissionsBits: number | null;
|
|
1274
|
+
pdfPermissionsAllAllowed: boolean | null;
|
|
1275
|
+
pdfOpenedAs: 'none' | 'user' | 'owner' | null;
|
|
1276
|
+
securityProbedAt: number | null;
|
|
1277
|
+
}
|
|
1278
|
+
interface DocumentProbeSecurityFileWorkerRequest {
|
|
1279
|
+
kind: 'document.probeSecurityFile';
|
|
1280
|
+
effect: 'read';
|
|
1281
|
+
jobId: WorkerJobId;
|
|
1282
|
+
path: string;
|
|
1283
|
+
password: string | null;
|
|
1284
|
+
}
|
|
1285
|
+
interface DocumentCheckPasswordPermissionsWorkerRequest {
|
|
1286
|
+
kind: 'document.checkPasswordPermissions';
|
|
1287
|
+
effect: 'open';
|
|
1288
|
+
jobId: WorkerJobId;
|
|
1289
|
+
docId: string;
|
|
1290
|
+
layerName?: string;
|
|
1291
|
+
password: string;
|
|
1292
|
+
mode?: 'any' | 'owner';
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Register a runtime font on the host's PDFium thread. Carries the font bytes
|
|
1296
|
+
* as a transferable `ArrayBuffer` (declared in the producer's transfer
|
|
1297
|
+
* manifest, like `open.fatMem`). Runtime-global: not tied to any docId. The
|
|
1298
|
+
* host keeps the volatile native `FontId` keyed by `fontKey`; the wire only
|
|
1299
|
+
* ever references the stable `fontKey`.
|
|
1300
|
+
*/
|
|
1301
|
+
interface FontsRegisterWorkerRequest {
|
|
1302
|
+
kind: 'fonts.register';
|
|
1303
|
+
effect: 'runtimeWrite';
|
|
1304
|
+
jobId: WorkerJobId;
|
|
1305
|
+
fontKey: string;
|
|
1306
|
+
/** `""` → infer the base font name from the file. */
|
|
1307
|
+
familyName: string;
|
|
1308
|
+
/** `0` → infer the weight from the file. */
|
|
1309
|
+
weight: number;
|
|
1310
|
+
/** `-1` → infer / `0` non-italic / `1` italic. */
|
|
1311
|
+
italic: number;
|
|
1312
|
+
data: ArrayBuffer;
|
|
1313
|
+
}
|
|
1314
|
+
interface FontsAddFallbackWorkerRequest {
|
|
1315
|
+
kind: 'fonts.addFallback';
|
|
1316
|
+
effect: 'runtimeWrite';
|
|
1317
|
+
jobId: WorkerJobId;
|
|
1318
|
+
fontKey: string;
|
|
1319
|
+
}
|
|
1320
|
+
interface FontsClearFallbacksWorkerRequest {
|
|
1321
|
+
kind: 'fonts.clearFallbacks';
|
|
1322
|
+
effect: 'runtimeWrite';
|
|
1323
|
+
jobId: WorkerJobId;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Hand the session `count` more object numbers: the layer's last object
|
|
1327
|
+
* number moves up by `count`, and the numbers passed become the session's to
|
|
1328
|
+
* name objects with. Only a session that hands numbers out itself
|
|
1329
|
+
* (`objectNumbers: 'session'`) takes it. Refused with `LayerFull` past
|
|
1330
|
+
* `OBJECT_NUMBER_ISSUE_LIMIT`.
|
|
1331
|
+
*/
|
|
1332
|
+
interface ObjectNumbersReserveWorkerRequest {
|
|
1333
|
+
kind: 'objectNumbers.reserve';
|
|
1334
|
+
effect: 'session';
|
|
1335
|
+
jobId: WorkerJobId;
|
|
1336
|
+
docId: string;
|
|
1337
|
+
layerName?: string;
|
|
1338
|
+
count: number;
|
|
1339
|
+
}
|
|
1340
|
+
interface FontsClearWorkerRequest {
|
|
1341
|
+
kind: 'fonts.clear';
|
|
1342
|
+
effect: 'runtimeWrite';
|
|
1343
|
+
jobId: WorkerJobId;
|
|
1344
|
+
}
|
|
1345
|
+
/** The application asserts a licence permitting editing with a font. */
|
|
1346
|
+
interface FontsAuthorizeEditingWorkerRequest {
|
|
1347
|
+
kind: 'fonts.authorizeEditing';
|
|
1348
|
+
effect: 'runtimeWrite';
|
|
1349
|
+
jobId: WorkerJobId;
|
|
1350
|
+
fontKey: string;
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Per-document font and text-layout settings (session state on the host's
|
|
1354
|
+
* document, never written to the file). Every member is optional: only the
|
|
1355
|
+
* ones given change.
|
|
1356
|
+
*/
|
|
1357
|
+
interface DocumentSetFontSettingsWorkerRequest {
|
|
1358
|
+
kind: 'document.setFontSettings';
|
|
1359
|
+
effect: 'session';
|
|
1360
|
+
jobId: WorkerJobId;
|
|
1361
|
+
docId: string;
|
|
1362
|
+
layerName?: string;
|
|
1363
|
+
embeddingPolicy?: 'default' | 'subset' | 'full';
|
|
1364
|
+
typographicFeatures?: boolean;
|
|
1365
|
+
}
|
|
1366
|
+
interface CloseWorkerRequest {
|
|
1367
|
+
kind: 'close';
|
|
1368
|
+
effect: 'close';
|
|
1369
|
+
jobId: WorkerJobId;
|
|
1370
|
+
docId: string;
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Close exactly one layer session, leaving the base document, sibling
|
|
1374
|
+
* layer sessions, and the caller's doc↔worker binding intact. Idempotent:
|
|
1375
|
+
* closing an absent session is a no-op ack.
|
|
1376
|
+
*
|
|
1377
|
+
* This is the reload seam for layer-session freshness (the server closes
|
|
1378
|
+
* a stale layer session and re-opens it from the current durable
|
|
1379
|
+
* artifact) — `close` is the whole-document teardown, this is the
|
|
1380
|
+
* layer-scoped sibling.
|
|
1381
|
+
*/
|
|
1382
|
+
interface LayerCloseWorkerRequest {
|
|
1383
|
+
kind: 'layer.close';
|
|
1384
|
+
effect: 'close';
|
|
1385
|
+
jobId: WorkerJobId;
|
|
1386
|
+
docId: string;
|
|
1387
|
+
layerName: string;
|
|
1388
|
+
}
|
|
1389
|
+
interface AbortWorkerRequest {
|
|
1390
|
+
kind: 'abort';
|
|
1391
|
+
jobId: WorkerJobId;
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* What a view shows of a document (`DocumentHandle.setWorkingSet`): the order
|
|
1395
|
+
* its parsed pages close in. The worker takes it on arrival, even while a
|
|
1396
|
+
* render runs, and never answers: `jobId` only names the message.
|
|
1397
|
+
*/
|
|
1398
|
+
interface PagesWorkingSetWorkerRequest {
|
|
1399
|
+
kind: 'pages.workingSet';
|
|
1400
|
+
jobId: WorkerJobId;
|
|
1401
|
+
docId: string;
|
|
1402
|
+
layerName?: string;
|
|
1403
|
+
view: string;
|
|
1404
|
+
pages: WorkingSetPage[];
|
|
1405
|
+
}
|
|
1406
|
+
interface ShutdownWorkerRequest {
|
|
1407
|
+
kind: 'shutdown';
|
|
1408
|
+
jobId: WorkerJobId;
|
|
1409
|
+
}
|
|
1410
|
+
interface LayerArtifactWorkerPayload {
|
|
1411
|
+
bytes: ArrayBuffer;
|
|
1412
|
+
size: number;
|
|
1413
|
+
/** The layer's last object number as saved: every object it has is at or below it. */
|
|
1414
|
+
lastObjectNumber: number;
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Result of an attachment file read (`attachments.readFile` /
|
|
1418
|
+
* `annotations.readFile`): the decoded file's metadata plus exactly one
|
|
1419
|
+
* delivery mode, mirroring the request's `path?` — `bytes` on the
|
|
1420
|
+
* transfer list (browser), or the `path` the worker wrote (server).
|
|
1421
|
+
*/
|
|
1422
|
+
interface AttachmentFileWorkerPayload {
|
|
1423
|
+
name: string;
|
|
1424
|
+
mimeType?: string;
|
|
1425
|
+
size: number;
|
|
1426
|
+
bytes?: ArrayBuffer;
|
|
1427
|
+
path?: string;
|
|
1428
|
+
}
|
|
1429
|
+
interface LayerArtifactFileWorkerPayload {
|
|
1430
|
+
path: string;
|
|
1431
|
+
/** The layer's last object number as saved: every object it has is at or below it. */
|
|
1432
|
+
lastObjectNumber: number;
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Every request a worker takes. `C` is where a request's places are: page
|
|
1436
|
+
* space as callers send them, the file's coordinates once the worker has
|
|
1437
|
+
* converted them for its handlers.
|
|
1438
|
+
*/
|
|
1439
|
+
type WorkerRequest<C extends Coordinates = PageCoordinates> = OpenWorkerRequest | MetadataReadWorkerRequest | MetadataUpdateWorkerRequest | MetadataReadCustomWorkerRequest | MetadataUpdateCustomWorkerRequest | ActionsReadWorkerRequest | AnnotationsListWorkerRequest | AnnotationsRenderAppearancesWorkerRequest | AnnotationsRenderAppearancesEncodedWorkerRequest | AnnotationsCreateWorkerRequest<C> | AnnotationsUpdateWorkerRequest<C> | AnnotationsDeleteWorkerRequest | AnnotationsReorderWorkerRequest | DocumentApplyWorkerRequest<C> | DocumentApplyChangesWorkerRequest<C> | FormsListWorkerRequest | FormsSetValueWorkerRequest | FormsResetWorkerRequest | FormsExportWorkerRequest | FormsImportWorkerRequest | FormsImportValuesWorkerRequest | FormsRepairWorkerRequest | FormsCreateFieldWorkerRequest<C> | FormsUpdateFieldWorkerRequest | FormsSetSignatureAppearanceWorkerRequest | FormsDeleteFieldWorkerRequest | FormsAddWidgetWorkerRequest<C> | FormsDetachWidgetWorkerRequest | FormsDeleteWidgetWorkerRequest | FormsReorderWidgetsWorkerRequest | FormsReorderCalculationsWorkerRequest | FormsUpdateWidgetWorkerRequest<C> | PagesListWorkerRequest | PagesReorderWorkerRequest | PagesRotateWorkerRequest | PagesDeleteWorkerRequest | AnnotationsFlattenWorkerRequest | AnnotationsExportAppearanceWorkerRequest | PagesSetNameWorkerRequest | PagesRemoveNameWorkerRequest | PagesFlattenWorkerRequest | RedactionApplyWorkerRequest | PagesExtractWorkerRequest | PagesInsertWorkerRequest | PagesInsertBlankWorkerRequest | AttachmentsListWorkerRequest | AttachmentsReadFileWorkerRequest | AttachmentsCreateWorkerRequest | AttachmentsDeleteWorkerRequest | 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;
|
|
1440
|
+
/** The messages that aren't jobs: the worker takes them on arrival and runs nothing for them. */
|
|
1441
|
+
type WorkerControlMessage = AbortWorkerRequest | PagesWorkingSetWorkerRequest | ShutdownWorkerRequest;
|
|
1442
|
+
/**
|
|
1443
|
+
* A request the worker runs as a job. Every one states its
|
|
1444
|
+
* {@link RequestEffect}: a request type without one fails `StatesItsEffect`,
|
|
1445
|
+
* so it doesn't compile.
|
|
1446
|
+
*/
|
|
1447
|
+
type WorkerJobRequest<C extends Coordinates = PageCoordinates> = StatesItsEffect<Exclude<WorkerRequest<C>, WorkerControlMessage>>;
|
|
1448
|
+
type StatesItsEffect<T extends {
|
|
1449
|
+
effect: RequestEffect;
|
|
1450
|
+
}> = T;
|
|
1451
|
+
/**
|
|
1452
|
+
* What a job returns. `C` is the space its positions are in: the handlers
|
|
1453
|
+
* work in PDF space, and the worker converts every result to page space
|
|
1454
|
+
* before it leaves (`resultInPageSpace`).
|
|
1455
|
+
*/
|
|
1456
|
+
type WorkerResultPayload<C extends Coordinates = PageCoordinates> = {
|
|
1457
|
+
tag: 'open';
|
|
1458
|
+
docId: string;
|
|
1459
|
+
security: DocumentSecurityProbeInfo;
|
|
1460
|
+
/** What the document's signatures forbid; `null` when unsigned or not probed (a locked open). */
|
|
1461
|
+
protection?: DocumentProtection | null;
|
|
1462
|
+
/** A locked open whose password was given and wrong. */
|
|
1463
|
+
passwordRejected?: boolean;
|
|
1464
|
+
/** The numbers `reserveObjectNumbers` asked for; absent for a locked open. */
|
|
1465
|
+
objectNumbers?: ObjectNumberRange;
|
|
1466
|
+
/** The layer's last object number as it opened; absent for a locked open. */
|
|
1467
|
+
lastObjectNumber?: number;
|
|
1468
|
+
} | {
|
|
1469
|
+
tag: 'objectNumbers.reserve';
|
|
1470
|
+
range: ObjectNumberRange;
|
|
1471
|
+
} | {
|
|
1472
|
+
tag: 'signatures.list';
|
|
1473
|
+
snapshot: SignatureSnapshot;
|
|
1474
|
+
} | {
|
|
1475
|
+
tag: 'signatures.contents';
|
|
1476
|
+
bytes: ArrayBuffer;
|
|
1477
|
+
} | {
|
|
1478
|
+
tag: 'signatures.digest';
|
|
1479
|
+
digest: ArrayBuffer;
|
|
1480
|
+
} | {
|
|
1481
|
+
tag: 'signatures.revisionBytes';
|
|
1482
|
+
bytes: ArrayBuffer;
|
|
1483
|
+
size: number;
|
|
1484
|
+
} | {
|
|
1485
|
+
tag: 'document.version';
|
|
1486
|
+
version: BaseVersionInfo;
|
|
1487
|
+
} | {
|
|
1488
|
+
tag: 'signatures.prepare';
|
|
1489
|
+
result: SignaturePrepared;
|
|
1490
|
+
} | {
|
|
1491
|
+
tag: 'signatures.complete';
|
|
1492
|
+
result: SignatureCompleteResult;
|
|
1493
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1494
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1495
|
+
} | {
|
|
1496
|
+
tag: 'signatures.cancel';
|
|
1497
|
+
result: SignatureCancelResult;
|
|
1498
|
+
} | {
|
|
1499
|
+
tag: 'signatures.analyze';
|
|
1500
|
+
analysis: ChangeAnalysis;
|
|
1501
|
+
} | {
|
|
1502
|
+
tag: 'signatures.finalizeCandidate';
|
|
1503
|
+
/**
|
|
1504
|
+
* The installed signature as the sealed file reports it, in page space:
|
|
1505
|
+
* the finalizer measures it while its own session is open.
|
|
1506
|
+
*/
|
|
1507
|
+
signature: SignatureDTO;
|
|
1508
|
+
/** The sealed file's last object number: every object it has is at or below it. */
|
|
1509
|
+
lastObjectNumber: number;
|
|
1510
|
+
/** What the sealed file's signatures forbid from now on. */
|
|
1511
|
+
protection: DocumentProtection;
|
|
1512
|
+
/** The version the sealed file is (hash and length of the whole file). */
|
|
1513
|
+
version: BaseVersionInfo;
|
|
1514
|
+
} | {
|
|
1515
|
+
tag: 'metadata.read';
|
|
1516
|
+
metadata: DocumentMetadata;
|
|
1517
|
+
} | {
|
|
1518
|
+
tag: 'actions.read';
|
|
1519
|
+
snapshot: DocumentActionsSnapshot<C['destination']>;
|
|
1520
|
+
} | {
|
|
1521
|
+
tag: 'metadata.update';
|
|
1522
|
+
result: MetadataUpdateResult;
|
|
1523
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1524
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1525
|
+
} | {
|
|
1526
|
+
tag: 'metadata.readCustom';
|
|
1527
|
+
custom: CustomMetadata;
|
|
1528
|
+
} | {
|
|
1529
|
+
tag: 'metadata.updateCustom';
|
|
1530
|
+
result: CustomMetadataUpdateResult;
|
|
1531
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1532
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1533
|
+
} | {
|
|
1534
|
+
tag: 'annotations.list';
|
|
1535
|
+
list: AnnotationList<C>;
|
|
1536
|
+
} | {
|
|
1537
|
+
tag: 'annotations.renderAppearances';
|
|
1538
|
+
page: PageRef;
|
|
1539
|
+
result: AnnotationAppearancesResult<C>;
|
|
1540
|
+
} | {
|
|
1541
|
+
tag: 'annotations.renderAppearancesEncoded';
|
|
1542
|
+
page: PageRef;
|
|
1543
|
+
result: AnnotationAppearancesEncodedResultWire<C>;
|
|
1544
|
+
} | {
|
|
1545
|
+
tag: 'annotations.create';
|
|
1546
|
+
result: AnnotationCreateResult<C>;
|
|
1547
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1548
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1549
|
+
} | {
|
|
1550
|
+
tag: 'annotations.update';
|
|
1551
|
+
result: AnnotationUpdateResult<C>;
|
|
1552
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1553
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1554
|
+
} | {
|
|
1555
|
+
tag: 'annotations.delete';
|
|
1556
|
+
result: AnnotationDeleteResult;
|
|
1557
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1558
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1559
|
+
} | {
|
|
1560
|
+
tag: 'annotations.flatten';
|
|
1561
|
+
result: AnnotationFlattenResult;
|
|
1562
|
+
/** False when nothing was applied: no artifact, event, or version bump. */
|
|
1563
|
+
wrote: boolean;
|
|
1564
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1565
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1566
|
+
} | {
|
|
1567
|
+
tag: 'annotations.exportAppearance';
|
|
1568
|
+
bytes: ArrayBuffer;
|
|
1569
|
+
size: number;
|
|
1570
|
+
} | {
|
|
1571
|
+
tag: 'annotations.readAppearance';
|
|
1572
|
+
bytes: ArrayBuffer;
|
|
1573
|
+
size: number;
|
|
1574
|
+
} |
|
|
1575
|
+
/** A bundle is page space on both sides: the exporter measures what leaves. */
|
|
1576
|
+
{
|
|
1577
|
+
tag: 'annotations.export';
|
|
1578
|
+
bundle: WireAnnotationBundle;
|
|
1579
|
+
} | {
|
|
1580
|
+
tag: 'annotations.import';
|
|
1581
|
+
result: AnnotationImportResult<C>;
|
|
1582
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1583
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1584
|
+
} | {
|
|
1585
|
+
tag: 'annotations.reorder';
|
|
1586
|
+
result: AnnotationReorderResult;
|
|
1587
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1588
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1589
|
+
} | {
|
|
1590
|
+
tag: 'document.applyChanges';
|
|
1591
|
+
/** One per change, in order. */
|
|
1592
|
+
outcomes: ServerChangeOutcome<C>[];
|
|
1593
|
+
/** The artifact, when at least one change applied. */
|
|
1594
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1595
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1596
|
+
} | {
|
|
1597
|
+
tag: 'document.apply';
|
|
1598
|
+
result: ChangeResult<C>;
|
|
1599
|
+
/**
|
|
1600
|
+
* True when this answers an `opId` that already had one: nothing ran
|
|
1601
|
+
* again, so nothing is published again.
|
|
1602
|
+
*/
|
|
1603
|
+
replayed: boolean;
|
|
1604
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1605
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1606
|
+
} | {
|
|
1607
|
+
tag: 'forms.list';
|
|
1608
|
+
snapshot: FormSnapshot<C>;
|
|
1609
|
+
} | {
|
|
1610
|
+
tag: 'forms.setValue';
|
|
1611
|
+
result: FormSetValueResult<C>;
|
|
1612
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1613
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1614
|
+
} | {
|
|
1615
|
+
tag: 'forms.reset';
|
|
1616
|
+
result: FormResetResult<C>;
|
|
1617
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1618
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1619
|
+
} | {
|
|
1620
|
+
tag: 'forms.export';
|
|
1621
|
+
bundle: WireFormBundle;
|
|
1622
|
+
} | {
|
|
1623
|
+
tag: 'forms.import';
|
|
1624
|
+
result: FormImportResult<C>;
|
|
1625
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1626
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1627
|
+
} | {
|
|
1628
|
+
tag: 'forms.importValues';
|
|
1629
|
+
result: FormValuesImportResult<C>;
|
|
1630
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1631
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1632
|
+
} | {
|
|
1633
|
+
tag: 'forms.repair';
|
|
1634
|
+
result: FormRepairResult;
|
|
1635
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1636
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1637
|
+
} | {
|
|
1638
|
+
tag: 'forms.createField';
|
|
1639
|
+
result: FormFieldCreateResult<C>;
|
|
1640
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1641
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1642
|
+
} | {
|
|
1643
|
+
tag: 'forms.updateField';
|
|
1644
|
+
result: FormFieldUpdateResult<C>;
|
|
1645
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1646
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1647
|
+
} | {
|
|
1648
|
+
tag: 'forms.setSignatureAppearance';
|
|
1649
|
+
result: FormFieldUpdateResult<C>;
|
|
1650
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1651
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1652
|
+
} | {
|
|
1653
|
+
tag: 'forms.deleteField';
|
|
1654
|
+
result: FormFieldDeleteResult;
|
|
1655
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1656
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1657
|
+
} | {
|
|
1658
|
+
tag: 'forms.addWidget';
|
|
1659
|
+
result: FormWidgetLinkResult<C>;
|
|
1660
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1661
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1662
|
+
} | {
|
|
1663
|
+
tag: 'forms.detachWidget';
|
|
1664
|
+
result: FormWidgetLinkResult<C>;
|
|
1665
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1666
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1667
|
+
} | {
|
|
1668
|
+
tag: 'forms.reorderWidgets';
|
|
1669
|
+
result: FormWidgetsReorderResult;
|
|
1670
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1671
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1672
|
+
} | {
|
|
1673
|
+
tag: 'forms.reorderCalculations';
|
|
1674
|
+
result: FormCalculationsReorderResult;
|
|
1675
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1676
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1677
|
+
} | {
|
|
1678
|
+
tag: 'forms.updateWidget';
|
|
1679
|
+
result: FormWidgetUpdateResult<C>;
|
|
1680
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1681
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1682
|
+
} | {
|
|
1683
|
+
tag: 'forms.deleteWidget';
|
|
1684
|
+
result: FormWidgetDeleteResult<C>;
|
|
1685
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1686
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1687
|
+
} | {
|
|
1688
|
+
tag: 'pages.list';
|
|
1689
|
+
snapshot: PageListSnapshot<C>;
|
|
1690
|
+
} | {
|
|
1691
|
+
tag: 'pages.reorder';
|
|
1692
|
+
result: PageReorderResult<C>;
|
|
1693
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1694
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1695
|
+
} | {
|
|
1696
|
+
tag: 'pages.rotate';
|
|
1697
|
+
result: PageRotateResult<C>;
|
|
1698
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1699
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1700
|
+
} | {
|
|
1701
|
+
tag: 'pages.delete';
|
|
1702
|
+
result: PageDeleteResult<C>;
|
|
1703
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1704
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1705
|
+
} | {
|
|
1706
|
+
tag: 'pages.setName';
|
|
1707
|
+
result: PageNameResult<C>;
|
|
1708
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1709
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1710
|
+
} | {
|
|
1711
|
+
tag: 'pages.removeName';
|
|
1712
|
+
result: PageNameResult<C>;
|
|
1713
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1714
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1715
|
+
} | {
|
|
1716
|
+
tag: 'pages.flatten';
|
|
1717
|
+
result: PageFlattenResult;
|
|
1718
|
+
/** False when nothing was applied: no artifact, event, or version bump. */
|
|
1719
|
+
wrote: boolean;
|
|
1720
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1721
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1722
|
+
} | {
|
|
1723
|
+
tag: 'redaction.apply';
|
|
1724
|
+
result: RedactionApplyResult;
|
|
1725
|
+
/** False when nothing was applied: no artifact, event, or version bump. */
|
|
1726
|
+
wrote: boolean;
|
|
1727
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1728
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1729
|
+
} | {
|
|
1730
|
+
tag: 'pages.extract';
|
|
1731
|
+
bytes: ArrayBuffer;
|
|
1732
|
+
size: number;
|
|
1733
|
+
} | {
|
|
1734
|
+
tag: 'attachments.list';
|
|
1735
|
+
attachments: Attachment[];
|
|
1736
|
+
} | {
|
|
1737
|
+
tag: 'attachments.readFile';
|
|
1738
|
+
content: AttachmentFileWorkerPayload;
|
|
1739
|
+
} | {
|
|
1740
|
+
tag: 'attachments.create';
|
|
1741
|
+
result: AttachmentCreateResult;
|
|
1742
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1743
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1744
|
+
} | {
|
|
1745
|
+
tag: 'attachments.delete';
|
|
1746
|
+
result: AttachmentDeleteResult;
|
|
1747
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1748
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1749
|
+
} | {
|
|
1750
|
+
tag: 'annotations.readFile';
|
|
1751
|
+
content: AttachmentFileWorkerPayload;
|
|
1752
|
+
} | {
|
|
1753
|
+
tag: 'pages.insert';
|
|
1754
|
+
result: PageInsertResult<C>;
|
|
1755
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1756
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1757
|
+
} | {
|
|
1758
|
+
tag: 'pages.insertBlank';
|
|
1759
|
+
result: PageInsertResult<C>;
|
|
1760
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1761
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1762
|
+
} | {
|
|
1763
|
+
tag: 'measure.viewports';
|
|
1764
|
+
page: PageRef;
|
|
1765
|
+
viewports: PageMeasurementViewport<C>[];
|
|
1766
|
+
} | {
|
|
1767
|
+
tag: 'measure.setScale';
|
|
1768
|
+
result: PageScaleResult;
|
|
1769
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1770
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1771
|
+
} | {
|
|
1772
|
+
tag: 'pieceInfo.read';
|
|
1773
|
+
snapshot: PieceInfoSnapshot | null;
|
|
1774
|
+
} | {
|
|
1775
|
+
tag: 'pieceInfo.update';
|
|
1776
|
+
result: PieceInfoUpdateResult;
|
|
1777
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1778
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1779
|
+
} | {
|
|
1780
|
+
tag: 'pieceInfo.applications';
|
|
1781
|
+
applications: string[];
|
|
1782
|
+
} | {
|
|
1783
|
+
tag: 'pieceInfo.delete';
|
|
1784
|
+
result: PieceInfoDeleteResult;
|
|
1785
|
+
artifact?: LayerArtifactWorkerPayload;
|
|
1786
|
+
artifactFile?: LayerArtifactFileWorkerPayload;
|
|
1787
|
+
} | {
|
|
1788
|
+
tag: 'pages.text';
|
|
1789
|
+
snapshot: PageTextSnapshot;
|
|
1790
|
+
} | {
|
|
1791
|
+
tag: 'pages.geometry';
|
|
1792
|
+
page: PageRef;
|
|
1793
|
+
snapshot: PageGeometrySnapshot<C>;
|
|
1794
|
+
} | {
|
|
1795
|
+
tag: 'pages.render';
|
|
1796
|
+
page: PageRef;
|
|
1797
|
+
/** The area of the page the pixels show. */
|
|
1798
|
+
area: C['box'];
|
|
1799
|
+
raster: PageRaster;
|
|
1800
|
+
} | {
|
|
1801
|
+
tag: 'pages.renderEncoded';
|
|
1802
|
+
image: EncodedImageWire;
|
|
1803
|
+
} | {
|
|
1804
|
+
tag: 'search.query';
|
|
1805
|
+
slice: SearchSlice<C>;
|
|
1806
|
+
} | {
|
|
1807
|
+
tag: 'document.saveBuffer';
|
|
1808
|
+
bytes: ArrayBuffer;
|
|
1809
|
+
size: number;
|
|
1810
|
+
} | {
|
|
1811
|
+
tag: 'document.saveLayerBuffer';
|
|
1812
|
+
bytes: ArrayBuffer;
|
|
1813
|
+
size: number;
|
|
1814
|
+
} | {
|
|
1815
|
+
tag: 'document.saveFile';
|
|
1816
|
+
path: string;
|
|
1817
|
+
} | {
|
|
1818
|
+
tag: 'document.probeSecurityFile';
|
|
1819
|
+
security: DocumentSecurityProbeInfo;
|
|
1820
|
+
} | {
|
|
1821
|
+
tag: 'document.renderPageFile';
|
|
1822
|
+
/** Durable page identity of the rendered index — the artifact key's page. */
|
|
1823
|
+
page: PageRef;
|
|
1824
|
+
pageCount: number;
|
|
1825
|
+
raster: PageRaster;
|
|
1826
|
+
} | {
|
|
1827
|
+
tag: 'document.renderPageFileEncoded';
|
|
1828
|
+
/** Durable page identity of the rendered index — the artifact key's page. */
|
|
1829
|
+
page: PageRef;
|
|
1830
|
+
pageCount: number;
|
|
1831
|
+
image: EncodedImageWire;
|
|
1832
|
+
} | {
|
|
1833
|
+
tag: 'document.checkPasswordPermissions';
|
|
1834
|
+
security: DocumentSecurityProbeInfo;
|
|
1835
|
+
protection?: DocumentProtection | null;
|
|
1836
|
+
} | {
|
|
1837
|
+
tag: 'fonts.register';
|
|
1838
|
+
fontKey: string;
|
|
1839
|
+
identity: FontIdentityInfo;
|
|
1840
|
+
} | {
|
|
1841
|
+
tag: 'fonts.addFallback';
|
|
1842
|
+
} | {
|
|
1843
|
+
tag: 'fonts.clearFallbacks';
|
|
1844
|
+
} | {
|
|
1845
|
+
tag: 'fonts.clear';
|
|
1846
|
+
} | {
|
|
1847
|
+
tag: 'fonts.authorizeEditing';
|
|
1848
|
+
identity: FontIdentityInfo;
|
|
1849
|
+
} | {
|
|
1850
|
+
tag: 'document.setFontSettings';
|
|
1851
|
+
} | {
|
|
1852
|
+
tag: 'close';
|
|
1853
|
+
} | {
|
|
1854
|
+
tag: 'shutdown';
|
|
1855
|
+
};
|
|
1856
|
+
type WorkerResponse = {
|
|
1857
|
+
kind: 'resolve';
|
|
1858
|
+
jobId: WorkerJobId;
|
|
1859
|
+
result: WorkerResultPayload;
|
|
1860
|
+
} | {
|
|
1861
|
+
kind: 'reject';
|
|
1862
|
+
jobId: WorkerJobId;
|
|
1863
|
+
error: SerializedEngineError;
|
|
1864
|
+
};
|
|
1865
|
+
type WorkerLifecycleMessage = {
|
|
1866
|
+
kind: 'ready';
|
|
1867
|
+
} | {
|
|
1868
|
+
kind: 'init-error';
|
|
1869
|
+
error: string;
|
|
1870
|
+
};
|
|
1871
|
+
//#endregion
|
|
1872
|
+
//#region src/engine/document-security-state.d.ts
|
|
1873
|
+
interface DocumentHeadLike {
|
|
1874
|
+
encryption: {
|
|
1875
|
+
state: DocumentSecurityState['encryption']['state'];
|
|
1876
|
+
requiresPassword: boolean | null;
|
|
1877
|
+
};
|
|
1878
|
+
permissions: DocumentSecurityState['permissions'];
|
|
1879
|
+
access: DocumentSecurityState['access'];
|
|
1880
|
+
}
|
|
1881
|
+
declare function securityStateFromHead(head: DocumentHeadLike): DocumentSecurityState;
|
|
1882
|
+
declare function permissionInfoFromProbe(info: DocumentSecurityProbeInfo): PdfPermissionInfo | null;
|
|
1883
|
+
/**
|
|
1884
|
+
* Same as {@link permissionInfoFromProbe} but additionally populates
|
|
1885
|
+
* `flags` (typed PdfBits view) and `advisory` (capability-shaped
|
|
1886
|
+
* booleans for UI badges). Used by routes that have a decoded `PdfBits`
|
|
1887
|
+
* in hand — notably `/access`, which always does.
|
|
1888
|
+
*
|
|
1889
|
+
* Returns `null` for the same reason as the base function — when the
|
|
1890
|
+
* PDF hasn't been probed yet so bits are unknown.
|
|
1891
|
+
*/
|
|
1892
|
+
declare function permissionInfoWithAdvisory(info: DocumentSecurityProbeInfo, pdfBits: PdfBits): PdfPermissionInfo | null;
|
|
1893
|
+
/**
|
|
1894
|
+
* Translate a {@link PdfBits} view into the capability-shaped
|
|
1895
|
+
* {@link PdfPermissionAdvisory}: what `pdf.permissions` grants on a file
|
|
1896
|
+
* with these bits.
|
|
1897
|
+
*/
|
|
1898
|
+
declare function advisoryFromPdfBits(b: PdfBits): PdfPermissionAdvisory;
|
|
1899
|
+
declare function securityStateFromProbe(info: DocumentSecurityProbeInfo, opts?: {
|
|
1900
|
+
accessEndpoint?: string;
|
|
1901
|
+
cdnRequired?: boolean;
|
|
1902
|
+
}): DocumentSecurityState;
|
|
1903
|
+
//#endregion
|
|
1904
|
+
//#region src/scheduling/place.d.ts
|
|
1905
|
+
/** Where a job's page is: on screen, placed just off it, or in no view. */
|
|
1906
|
+
type Place = 'visible' | 'near' | 'elsewhere';
|
|
1907
|
+
/** A job's place, and the device pixels of its page on screen there. */
|
|
1908
|
+
interface Placed {
|
|
1909
|
+
readonly place: Place;
|
|
1910
|
+
readonly pixels: number;
|
|
1911
|
+
}
|
|
1912
|
+
/** What a job is about, for its place: its page, the part of it, and the view it serves. */
|
|
1913
|
+
interface JobTarget {
|
|
1914
|
+
/** Absent: the job is about the whole document. */
|
|
1915
|
+
readonly page?: PageRef;
|
|
1916
|
+
/** The part of the page, in page space (a tile). Absent: the whole page. */
|
|
1917
|
+
readonly region?: PageBox;
|
|
1918
|
+
readonly view?: string;
|
|
1919
|
+
}
|
|
1920
|
+
/** One document's working sets: per view, the pages it shows by object number. */
|
|
1921
|
+
type ViewSets = ReadonlyMap<string, ReadonlyMap<number, WorkingSetPage>>;
|
|
1922
|
+
/** What {@link rank} needs to know about a job besides its place. */
|
|
1923
|
+
interface RankedJob {
|
|
1924
|
+
readonly priority: CallPriority;
|
|
1925
|
+
/** Present for a job about part of a page (a tile). */
|
|
1926
|
+
readonly region?: PageBox;
|
|
1927
|
+
}
|
|
1928
|
+
/** Whether `a` is the better place: on screen before near before elsewhere, then more pixels. */
|
|
1929
|
+
declare function placedBefore(a: Placed, b: Placed): boolean;
|
|
1930
|
+
/**
|
|
1931
|
+
* A job's place in one view: its page's role there, except that a part of a
|
|
1932
|
+
* visible page that's off screen (a tile of the ring around what shows) is
|
|
1933
|
+
* `near`.
|
|
1934
|
+
*/
|
|
1935
|
+
declare function placeIn(entry: WorkingSetPage | undefined, job: JobTarget): Placed;
|
|
1936
|
+
/**
|
|
1937
|
+
* A job's place among a document's views: in the view it serves, or, when it
|
|
1938
|
+
* serves none (or one that said nothing), the best place its page has in any
|
|
1939
|
+
* view. A job about the whole document serves what's shown, so it counts as
|
|
1940
|
+
* on screen. While no view says anything, every job is on screen alike, and
|
|
1941
|
+
* jobs run in the order they were asked.
|
|
1942
|
+
*/
|
|
1943
|
+
declare function placeFor(job: JobTarget, views: ViewSets): Placed;
|
|
1944
|
+
/**
|
|
1945
|
+
* How soon a job runs among those that may run: higher first. It compares, in
|
|
1946
|
+
* turn:
|
|
1947
|
+
* 1. background last: a `low` call is about nothing the views show;
|
|
1948
|
+
* 2. where its page is: on screen, then just off it, then elsewhere;
|
|
1949
|
+
* 3. its priority: `high` (the picture of the page itself) before `auto`;
|
|
1950
|
+
* 4. a whole page before a part of one: a tile is only of use once its page
|
|
1951
|
+
* is there;
|
|
1952
|
+
* 5. the device pixels its page shows.
|
|
1953
|
+
* Equal ranks run in the order they were asked, so a caller sequences its own work.
|
|
1954
|
+
*/
|
|
1955
|
+
declare function rank(job: RankedJob, placed: Placed): number;
|
|
1956
|
+
/**
|
|
1957
|
+
* Whether rank `a` beats rank `b` on more than pixels (any of the first four
|
|
1958
|
+
* steps of {@link rank}). A running job gives way only to a job that clearly
|
|
1959
|
+
* outranks it, so two pages on screen never stop each other's work, and jobs
|
|
1960
|
+
* don't flip back and forth while the camera moves.
|
|
1961
|
+
*/
|
|
1962
|
+
declare function clearlyOutranks(a: number, b: number): boolean;
|
|
1963
|
+
//#endregion
|
|
1964
|
+
//#region src/wire/WirePack.d.ts
|
|
1965
|
+
/**
|
|
1966
|
+
* Wire-level packaging for messages crossing a Web Worker / Node
|
|
1967
|
+
* `worker_thread` boundary.
|
|
1968
|
+
*
|
|
1969
|
+
* `WirePack<P>` is the typed pair every producer hands to a transport:
|
|
1970
|
+
* the structured payload (validated against the wire schema) and an
|
|
1971
|
+
* explicit, ordered list of `Transferable` objects that the producer
|
|
1972
|
+
* intends to move (zero-copy) to the receiver.
|
|
1973
|
+
*
|
|
1974
|
+
* Why this is a first-class type and not a transport-side argument:
|
|
1975
|
+
*
|
|
1976
|
+
* - **Producer is the only one who knows.** Whether a particular
|
|
1977
|
+
* `ArrayBuffer` should be moved (zero-copy, sender's reference
|
|
1978
|
+
* detached) or copied (structured-cloned, both sides retain
|
|
1979
|
+
* access) is a semantic decision belonging to the code that
|
|
1980
|
+
* produced the buffer. Inferring it later — by walking the
|
|
1981
|
+
* payload looking for `ArrayBuffer` instances and assuming they
|
|
1982
|
+
* should all be transferred — detaches buffers the producer
|
|
1983
|
+
* meant to keep.
|
|
1984
|
+
*
|
|
1985
|
+
* - **Type-checked at the boundary.** A handler returning
|
|
1986
|
+
* `WirePack<RenderResult>` cannot forget to declare its
|
|
1987
|
+
* transfer list; the producer literally writes
|
|
1988
|
+
* `wirePack({ ..., pixels }, [pixels.buffer])` in a single
|
|
1989
|
+
* return statement. Forgetting yields a structurally identical
|
|
1990
|
+
* copy (slow but correct), never a silent leak.
|
|
1991
|
+
*
|
|
1992
|
+
* - **Symmetric across the boundary.** Same `WirePack<P>` on the
|
|
1993
|
+
* request path (main → worker) and the response path (worker →
|
|
1994
|
+
* main). Inline transports treat `transfer` as a no-op since
|
|
1995
|
+
* there's no thread boundary to cross.
|
|
1996
|
+
*
|
|
1997
|
+
* - **Schema-orthogonal.** Zod schemas validate `payload` and
|
|
1998
|
+
* nothing else. `transfer` is not data; it's a memory-ownership
|
|
1999
|
+
* manifest, and the design keeps those concerns separate.
|
|
2000
|
+
*
|
|
2001
|
+
* The receiver of a `postMessage(payload, { transfer })` call gets
|
|
2002
|
+
* the payload back **with the listed buffers already moved into it**
|
|
2003
|
+
* — there's no second argument on the receiving end. So `WirePack`
|
|
2004
|
+
* only ever travels the producer-to-transport leg of the trip; the
|
|
2005
|
+
* consumer side just sees the unwrapped `payload`.
|
|
2006
|
+
*/
|
|
2007
|
+
interface WirePack<P> {
|
|
2008
|
+
readonly payload: P;
|
|
2009
|
+
readonly transfer: readonly Transferable[];
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Singleton empty transfer list. Frozen so accidental in-place
|
|
2013
|
+
* mutation throws in strict mode rather than silently mutating the
|
|
2014
|
+
* default for future calls.
|
|
2015
|
+
*/
|
|
2016
|
+
declare const EMPTY_TRANSFER: readonly Transferable[];
|
|
2017
|
+
/**
|
|
2018
|
+
* Producer-side helper: pair a typed payload with its transfer list.
|
|
2019
|
+
*
|
|
2020
|
+
* The `transfer` argument is optional; omitting it (or passing `[]`)
|
|
2021
|
+
* is the explicit, type-checked way to say "I declare this message
|
|
2022
|
+
* carries no transferables." The declaration is made at construction
|
|
2023
|
+
* time, in the producer's own code, where the knowledge actually lives.
|
|
2024
|
+
*
|
|
2025
|
+
* wirePack({ kind: 'metadata.read', jobId, docId })
|
|
2026
|
+
* wirePack({ kind: 'open.fatMem', jobId, docId, bytes }, [bytes])
|
|
2027
|
+
* wirePack({ tag: 'page.render', pixels }, [pixels.buffer])
|
|
2028
|
+
*/
|
|
2029
|
+
declare function wirePack<P>(payload: P, transfer?: readonly Transferable[]): WirePack<P>;
|
|
2030
|
+
//#endregion
|
|
2031
|
+
export { DocumentVersionWorkerRequest as $, PieceInfoApplicationsWorkerRequest as $t, AnnotationsReadFileWorkerRequest as A, LOCAL_ENGINE_BRAND as An, MetadataReadCustomWorkerRequest as At, ChangeRecordPayload as B, PagesFlattenWorkerRequest as Bt, AnnotationsDeleteWorkerRequest as C, WorkerLifecycleMessage as Cn, FormsUpdateWidgetWorkerRequest as Ct, AnnotationsImportWorkerRequest as D, changeEvents as Dn, LayerOpenSource as Dt, AnnotationsFlattenWorkerRequest as E, WorkerResultPayload as En, LayerCloseWorkerRequest as Et, AttachmentFileWorkerPayload as F, OpenLayerFileBaseWorkerRequest as Ft, DocumentProbeSecurityFileWorkerRequest as G, PagesRemoveNameWorkerRequest as Gt, DocumentApplyChangesWorkerRequest as H, PagesInsertBlankWorkerRequest as Ht, AttachmentsCreateWorkerRequest as I, OpenLayerMemoryBaseWorkerRequest as It, DocumentSaveBufferWorkerRequest as J, PagesReorderWorkerRequest as Jt, DocumentRenderPageFileEncodedWorkerRequest as K, PagesRenderEncodedWorkerRequest as Kt, AttachmentsDeleteWorkerRequest as L, OpenWorkerRequest as Lt, AnnotationsRenderAppearancesWorkerRequest as M, isAbortError as Mn, MetadataUpdateCustomWorkerRequest as Mt, AnnotationsReorderWorkerRequest as N, MetadataUpdateWorkerRequest as Nt, AnnotationsListWorkerRequest as O, EventHub as On, MeasureSetScaleWorkerRequest as Ot, AnnotationsUpdateWorkerRequest as P, OpenFatMemoryWorkerRequest as Pt, DocumentSetFontSettingsWorkerRequest as Q, PagesWorkingSetWorkerRequest as Qt, AttachmentsListWorkerRequest as R, PagesDeleteWorkerRequest as Rt, AnnotationsCreateWorkerRequest as S, WorkerJobRequest as Sn, FormsUpdateFieldWorkerRequest as St, AnnotationsExportWorkerRequest as T, WorkerResponse as Tn, LayerArtifactWorkerPayload as Tt, DocumentApplyWorkerRequest as U, PagesInsertWorkerRequest as Ut, CloseWorkerRequest as V, PagesGeometryWorkerRequest as Vt, DocumentCheckPasswordPermissionsWorkerRequest as W, PagesListWorkerRequest as Wt, DocumentSaveLayerBufferWorkerRequest as X, PagesSetNameWorkerRequest as Xt, DocumentSaveFileWorkerRequest as Y, PagesRotateWorkerRequest as Yt, DocumentSecurityProbeInfo as Z, PagesTextWorkerRequest as Zt, securityStateFromHead as _, SignaturesListWorkerRequest as _n, FormsReorderWidgetsWorkerRequest as _t, Place as a, RequestEffect as an, FontsClearWorkerRequest as at, ActionsReadWorkerRequest as b, WorkerControlMessage as bn, FormsSetSignatureAppearanceWorkerRequest as bt, ViewSets as c, ServerChange as cn, FormsCreateFieldWorkerRequest as ct, placeIn as d, SignaturesAnalyzeWorkerRequest as dn, FormsDetachWidgetWorkerRequest as dt, PieceInfoDeleteWorkerRequest as en, EncodedAppearanceWire as et, placedBefore as f, SignaturesCancelWorkerRequest as fn, FormsExportWorkerRequest as ft, permissionInfoWithAdvisory as g, SignaturesFinalizeCandidateWorkerRequest as gn, FormsReorderCalculationsWorkerRequest as gt, permissionInfoFromProbe as h, SignaturesDigestWorkerRequest as hn, FormsListWorkerRequest as ht, JobTarget as i, RenderEncode as in, FontsClearFallbacksWorkerRequest as it, AnnotationsRenderAppearancesEncodedWorkerRequest as j, AbortError as jn, MetadataReadWorkerRequest as jt, AnnotationsReadAppearanceWorkerRequest as k, SessionEventPublisher as kn, MeasureViewportsWorkerRequest as kt, clearlyOutranks as l, ServerChangeOutcome as ln, FormsDeleteFieldWorkerRequest as lt, advisoryFromPdfBits as m, SignaturesContentsWorkerRequest as mn, FormsImportWorkerRequest as mt, WirePack as n, PieceInfoUpdateWorkerRequest as nn, FontsAddFallbackWorkerRequest as nt, Placed as o, SearchQueryWorkerRequest as on, FontsRegisterWorkerRequest as ot, rank as p, SignaturesCompleteWorkerRequest as pn, FormsImportValuesWorkerRequest as pt, DocumentRenderPageFileWorkerRequest as q, PagesRenderWorkerRequest as qt, wirePack as r, RedactionApplyWorkerRequest as rn, FontsAuthorizeEditingWorkerRequest as rt, RankedJob as s, SearchScanRequest as sn, FormsAddWidgetWorkerRequest as st, EMPTY_TRANSFER as t, PieceInfoReadWorkerRequest as tn, EncodedImageWire as tt, placeFor as u, ShutdownWorkerRequest as un, FormsDeleteWidgetWorkerRequest as ut, securityStateFromProbe as v, SignaturesPrepareWorkerRequest as vn, FormsRepairWorkerRequest as vt, AnnotationsExportAppearanceWorkerRequest as w, WorkerRequest as wn, LayerArtifactFileWorkerPayload as wt, AnnotationAppearancesEncodedResultWire as x, WorkerJobId as xn, FormsSetValueWorkerRequest as xt, AbortWorkerRequest as y, SignaturesRevisionBytesWorkerRequest as yn, FormsResetWorkerRequest as yt, AttachmentsReadFileWorkerRequest as z, PagesExtractWorkerRequest as zt };
|
|
2032
|
+
//# sourceMappingURL=runtime-Cl0v56mm.d.ts.map
|