@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
package/dist/{DocumentSecurityService-_JRjqvoI.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts}
RENAMED
|
@@ -1,77 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/promise/AbortablePromise.d.ts
|
|
3
|
-
type AbortableExecutor<T, P> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason: unknown) => void, progress: (p: P) => void, signal: AbortSignal) => void;
|
|
4
|
-
/**
|
|
5
|
-
* Awaitable Promise subclass with abort and progress.
|
|
6
|
-
*
|
|
7
|
-
* Symbol.species returns plain Promise so chained .then/.catch/.finally
|
|
8
|
-
* return regular promises and never try to synthesize a new
|
|
9
|
-
* AbortablePromise (which would have no executor).
|
|
10
|
-
*
|
|
11
|
-
* Settlement contract:
|
|
12
|
-
* - The first settlement wins. resolve/reject handed to the executor
|
|
13
|
-
* are wrapped so that any subsequent call (whether by the executor,
|
|
14
|
-
* by abort(), or by both racing) becomes a silent no-op.
|
|
15
|
-
* - abort() rejects the public promise with AbortError immediately,
|
|
16
|
-
* even if the executor never observes the AbortSignal. The executor
|
|
17
|
-
* still receives the AbortSignal so it can stop real work
|
|
18
|
-
* cooperatively (release a queue slot, abort fetch, post a worker
|
|
19
|
-
* abort, etc.). Anything the executor does after that — including
|
|
20
|
-
* a late resolve(value), a late reject(error), or a rejected inner
|
|
21
|
-
* Promise inside AbortablePromise.run — is dropped silently.
|
|
22
|
-
* - abort() after settlement is a no-op.
|
|
23
|
-
*/
|
|
24
|
-
declare class AbortablePromise<T, P = never> extends Promise<T> {
|
|
25
|
-
static get [Symbol.species](): PromiseConstructor;
|
|
26
|
-
readonly signal: AbortSignal;
|
|
27
|
-
private readonly _ctrl;
|
|
28
|
-
private readonly _progressCbs;
|
|
29
|
-
private readonly _state;
|
|
30
|
-
private readonly _internalReject;
|
|
31
|
-
constructor(executor: AbortableExecutor<T, P>);
|
|
32
|
-
/**
|
|
33
|
-
* Abort the underlying operation.
|
|
34
|
-
*
|
|
35
|
-
* - If the promise has already settled, this is a no-op.
|
|
36
|
-
* - Otherwise the public promise rejects synchronously with an
|
|
37
|
-
* AbortError (wrapping the supplied reason if it is not already an
|
|
38
|
-
* AbortError) and the AbortSignal fires for any cooperative
|
|
39
|
-
* cancellation the executor wired up.
|
|
40
|
-
*/
|
|
41
|
-
abort(reason?: unknown): void;
|
|
42
|
-
/**
|
|
43
|
-
* Subscribe to progress events. Returns an unsubscribe function.
|
|
44
|
-
*/
|
|
45
|
-
onProgress(cb: (p: P) => void): () => void;
|
|
46
|
-
/**
|
|
47
|
-
* Wrap a value in an already-resolved AbortablePromise. Mirrors Promise.resolve.
|
|
48
|
-
*/
|
|
49
|
-
static resolveValue<T>(value: T | PromiseLike<T>): AbortablePromise<T>;
|
|
50
|
-
/**
|
|
51
|
-
* Wrap a thrown reason in an already-rejected AbortablePromise.
|
|
52
|
-
*/
|
|
53
|
-
static rejectReason<T = never>(reason: unknown): AbortablePromise<T>;
|
|
54
|
-
/**
|
|
55
|
-
* Run an async function as an AbortablePromise so callers get .abort() and .signal.
|
|
56
|
-
* The async function receives the AbortSignal (and a progress emitter) so it can
|
|
57
|
-
* cooperate with the abort.
|
|
58
|
-
*
|
|
59
|
-
* If abort() fires while the inner async function is still running, the
|
|
60
|
-
* public promise rejects with AbortError immediately. The inner async
|
|
61
|
-
* function's eventual settlement (resolve or reject) is funneled through
|
|
62
|
-
* the wrapped settlers and silently dropped — including a late rejection
|
|
63
|
-
* from the underlying work, which prevents an UnhandledRejection because
|
|
64
|
-
* the .then(resolve, reject) below "handles" it via the no-op.
|
|
65
|
-
*/
|
|
66
|
-
static run<T, P = never>(fn: (signal: AbortSignal, progress: (p: P) => void) => Promise<T>): AbortablePromise<T, P>;
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
1
|
+
import { C_ as DocCapability, Du as BundleLimits, E_ as Identity, M_ as PdfBits, P_ as AbortablePromise, Wh as DocumentProtection, Xd as EditSessionAccess, ph as FieldRights } from "./AnnotationList-CkijRHet.js";
|
|
69
2
|
//#region src/engine/passwordPrompt.d.ts
|
|
70
3
|
type PasswordPrompt = {
|
|
71
4
|
readonly state: 'none';
|
|
72
5
|
} | {
|
|
73
6
|
readonly state: 'required';
|
|
74
7
|
readonly hint: 'user' | 'owner' | null;
|
|
8
|
+
/**
|
|
9
|
+
* The last password tried (at `open()` or `unlock()`) was wrong, so a
|
|
10
|
+
* prompt can say so. A wrong password opens the document locked, as no
|
|
11
|
+
* password does: one path for "this file needs a password".
|
|
12
|
+
*/
|
|
13
|
+
readonly incorrect: boolean;
|
|
75
14
|
} | {
|
|
76
15
|
readonly state: 'optional';
|
|
77
16
|
readonly hint: 'owner';
|
|
@@ -80,7 +19,7 @@ type PasswordPrompt = {
|
|
|
80
19
|
* Derive the high-level password prompt from the raw security state.
|
|
81
20
|
*
|
|
82
21
|
* The function is pure and total — every `DocumentSecurityState`
|
|
83
|
-
* maps to exactly one `PasswordPrompt`. Use this as the
|
|
22
|
+
* maps to exactly one `PasswordPrompt`. Use this as the single source
|
|
84
23
|
* of truth wherever the SDK exposes a "do you need a password?" flag:
|
|
85
24
|
* both `LocalDocumentSecurityService` and `CloudDocumentSecurityService`
|
|
86
25
|
* call it, so the contract can never drift.
|
|
@@ -110,7 +49,7 @@ type PasswordPrompt = {
|
|
|
110
49
|
*
|
|
111
50
|
* 6. fallthrough → { state: 'none' } open and nothing more available
|
|
112
51
|
*/
|
|
113
|
-
declare function passwordPromptFromState(state: DocumentSecurityState): PasswordPrompt;
|
|
52
|
+
declare function passwordPromptFromState(state: DocumentSecurityState, incorrect?: boolean): PasswordPrompt;
|
|
114
53
|
//#endregion
|
|
115
54
|
//#region src/engine/DocumentSecurityService.d.ts
|
|
116
55
|
type DocumentOpenMode = 'none' | 'user' | 'owner';
|
|
@@ -123,10 +62,9 @@ type DocumentAccessReason = 'password' | 'cdn' | 'permissions-unknown';
|
|
|
123
62
|
* not the raw bit names — so docs can render "Print: disabled" without
|
|
124
63
|
* the reader needing to know PDF bit positions.
|
|
125
64
|
*
|
|
126
|
-
* Computed from {@link PdfBits}
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* form fill is satisfied by bit 6 OR bit 9
|
|
65
|
+
* Computed from {@link PdfBits} as `pdf.permissions` reads them, which
|
|
66
|
+
* is what Acrobat allows on the file: for example, form fill comes with
|
|
67
|
+
* bit 4, 6 or 9, and form modification needs both bit 4 and bit 6.
|
|
130
68
|
*/
|
|
131
69
|
interface PdfPermissionAdvisory {
|
|
132
70
|
readonly canPrint: boolean;
|
|
@@ -240,12 +178,13 @@ interface DocumentAccessInfo {
|
|
|
240
178
|
* Sorted alphabetically for stable display.
|
|
241
179
|
*/
|
|
242
180
|
readonly effectiveScope: string[];
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
181
|
+
/**
|
|
182
|
+
* What the document's signatures forbid (`null` when it has none): a
|
|
183
|
+
* certification or a signed lock takes capabilities away from every
|
|
184
|
+
* caller, and `effectiveScope` already leaves them out.
|
|
185
|
+
*/
|
|
186
|
+
readonly protection: DocumentProtection | null;
|
|
187
|
+
readonly identity: Identity;
|
|
249
188
|
readonly originPasswordPolicy: {
|
|
250
189
|
readonly mode: 'not-needed' | 'client-retry' | 'server-session';
|
|
251
190
|
};
|
|
@@ -255,7 +194,7 @@ interface DocumentAccessInfo {
|
|
|
255
194
|
* `viewport.width` points whose renders are durable, CDN-shared
|
|
256
195
|
* artifacts, plus the reserved tile-pyramid block. Local engines report
|
|
257
196
|
* nothing here (continuous rendering); cloud engines surface it so
|
|
258
|
-
* `snapFullPageViewport` can conform requests
|
|
197
|
+
* `snapFullPageViewport` can conform requests explicitly — the SDK
|
|
259
198
|
* never snaps implicitly (engine parity).
|
|
260
199
|
*/
|
|
261
200
|
readonly renderPolicy?: {
|
|
@@ -274,6 +213,17 @@ interface DocumentAccessInfo {
|
|
|
274
213
|
readonly background: 'white';
|
|
275
214
|
readonly enforced: boolean;
|
|
276
215
|
};
|
|
216
|
+
/**
|
|
217
|
+
* The deployment's limits for an annotation import: the cloud client
|
|
218
|
+
* checks a bundle against these before its bytes move.
|
|
219
|
+
*/
|
|
220
|
+
readonly bundleLimits: BundleLimits;
|
|
221
|
+
/**
|
|
222
|
+
* The caller's editing session and the object numbers handed to it,
|
|
223
|
+
* present when the caller may create objects and named its session
|
|
224
|
+
* (`X-Engine-Session-Id`).
|
|
225
|
+
*/
|
|
226
|
+
readonly edit?: EditSessionAccess;
|
|
277
227
|
}
|
|
278
228
|
interface DocumentUnlockInput {
|
|
279
229
|
readonly password: string;
|
|
@@ -283,56 +233,65 @@ interface DocumentUnlockResult {
|
|
|
283
233
|
readonly security: DocumentSecurityState;
|
|
284
234
|
readonly access?: DocumentAccessInfo;
|
|
285
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* What an annotation is and whose: what `allowsAnnotation('update' |
|
|
238
|
+
* 'delete', …)` reads. An `Annotation` is one; so is `{ userId, groupId }`.
|
|
239
|
+
* A widget (`subtype: 'widget'`) belongs to a form field: changing or
|
|
240
|
+
* deleting one takes `doc.forms.modify`, whoever's it is.
|
|
241
|
+
*/
|
|
242
|
+
interface AnnotationOwner {
|
|
243
|
+
subtype?: string;
|
|
244
|
+
userId?: string | null;
|
|
245
|
+
groupId?: string | null;
|
|
246
|
+
}
|
|
286
247
|
interface DocumentSecurityService {
|
|
287
248
|
/**
|
|
288
249
|
* Raw structured security probe. Stable across engines, refreshed
|
|
289
|
-
* after unlock
|
|
290
|
-
*
|
|
250
|
+
* after an unlock. Power users and diagnostic tools read this; most
|
|
251
|
+
* code uses the higher-level accessors below.
|
|
291
252
|
*/
|
|
292
|
-
readonly
|
|
253
|
+
readonly state: DocumentSecurityState;
|
|
293
254
|
/**
|
|
294
255
|
* The caller's expanded capability set — raw scope + pdf bits +
|
|
295
|
-
* implication rules, enumerated for
|
|
256
|
+
* implication rules, enumerated for display ("here's what you can
|
|
296
257
|
* do"). Identical shape on local and cloud; cloud uses the
|
|
297
258
|
* server-canonical value when available, else computes locally from
|
|
298
259
|
* JWT scope + /head bits.
|
|
299
260
|
*
|
|
300
|
-
*
|
|
301
|
-
* admin wildcard and unbounded parametric collab grants are
|
|
261
|
+
* Note: this is an *enumeration*, not an authorization check. The `*`
|
|
262
|
+
* admin wildcard and unbounded parametric collab grants are not
|
|
302
263
|
* listed here (they can't be). To gate UI, use {@link allows} — the
|
|
303
264
|
* same wildcard-aware predicate the engine enforces with.
|
|
304
265
|
*/
|
|
305
|
-
readonly
|
|
266
|
+
readonly scope: ReadonlyArray<string>;
|
|
306
267
|
/**
|
|
307
|
-
* Wildcard-aware authorization check — the
|
|
268
|
+
* Wildcard-aware authorization check — the same predicate the engine
|
|
308
269
|
* enforces with (`checkCapability`). A shown control gated on this
|
|
309
270
|
* mirrors exactly what the engine will allow: the `*` admin grant and
|
|
310
271
|
* `pdf.permissions`-derived bits are both honored. Use this for edit
|
|
311
|
-
* gating (e.g. `allows('doc.pages.assemble')`); use `
|
|
312
|
-
*
|
|
272
|
+
* gating (e.g. `allows('doc.pages.assemble')`); use `scope` only to
|
|
273
|
+
* *display* the concrete grants.
|
|
313
274
|
*/
|
|
314
275
|
allows(capability: DocCapability): boolean;
|
|
315
276
|
/**
|
|
316
|
-
* Per-record annotation authorization mirrors — the
|
|
277
|
+
* Per-record annotation authorization mirrors — the same resolver the
|
|
317
278
|
* engine enforces with (`checkCollab`'s narrowing rule: an applicable
|
|
318
|
-
* `annotations:<action>:<filter>` grant
|
|
279
|
+
* `annotations:<action>:<filter>` grant shadows the coarse
|
|
319
280
|
* `doc.annotate.modify` fallback for that action), over the same
|
|
320
281
|
* inputs (raw scope + identity claims + PDF bits). `allows()` cannot
|
|
321
282
|
* answer these: it enumerates capabilities, and a filtered collab
|
|
322
283
|
* grant is not a capability — whether "update" is allowed depends on
|
|
323
|
-
*
|
|
284
|
+
* whose annotation you're touching.
|
|
324
285
|
*
|
|
325
|
-
*
|
|
326
|
-
* - create derives
|
|
327
|
-
* (`:self` trivially passes; `:group=X` matches the
|
|
328
|
-
* default group),
|
|
329
|
-
* - update
|
|
330
|
-
* owner (`userId`/`groupId
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
* (`annotations:set-group:` ladder; the caller's own default
|
|
335
|
-
* group is always assignable).
|
|
286
|
+
* The target depends on the action:
|
|
287
|
+
* - `create` needs none: it derives the target from the caller's
|
|
288
|
+
* own identity (`:self` trivially passes; `:group=X` matches the
|
|
289
|
+
* caller's default group),
|
|
290
|
+
* - `update`/`delete` take the annotation itself, asked about its
|
|
291
|
+
* stamped owner (`userId`/`groupId`; an unstamped annotation is
|
|
292
|
+
* denied under any narrowed grant, as the engine does),
|
|
293
|
+
* - `set-group` takes the destination group (`annotations:set-group:`
|
|
294
|
+
* ladder; the caller's own default group is always assignable).
|
|
336
295
|
*
|
|
337
296
|
* These are a courtesy for UI gating — the engine (and the server,
|
|
338
297
|
* on cloud) independently enforces every mutation with the same
|
|
@@ -340,13 +299,42 @@ interface DocumentSecurityService {
|
|
|
340
299
|
* access. Returns false when no scope context exists (legacy local
|
|
341
300
|
* open without `scope`, cloud open without a token before /access).
|
|
342
301
|
*/
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
302
|
+
allowsAnnotation(action: 'create'): boolean;
|
|
303
|
+
allowsAnnotation(action: 'update' | 'delete', annotation: AnnotationOwner): boolean;
|
|
304
|
+
allowsAnnotation(action: 'set-group', target: {
|
|
305
|
+
groupId: string;
|
|
306
|
+
}): boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Per-field form authorization, mirroring what the engine checks on every
|
|
309
|
+
* fill, signing and form design write:
|
|
310
|
+
* - `fill`/`sign` take the field (its `groupId`): a `fields:fill` /
|
|
311
|
+
* `fields:sign` scope for its group, or, without one, `doc.forms.fill`
|
|
312
|
+
* / `doc.sign` for every field;
|
|
313
|
+
* - `set-group` takes the destination group (`fields:set-group:` ladder;
|
|
314
|
+
* the caller's own default group is always assignable).
|
|
315
|
+
*
|
|
316
|
+
* A courtesy for UI gating, like {@link allowsAnnotation}: the engine
|
|
317
|
+
* enforces every write with the same predicates.
|
|
318
|
+
*/
|
|
319
|
+
allowsField(action: 'fill' | 'sign', field: {
|
|
320
|
+
groupId: string | null;
|
|
321
|
+
}): boolean;
|
|
322
|
+
allowsField(action: 'set-group', target: {
|
|
323
|
+
groupId: string;
|
|
324
|
+
}): boolean;
|
|
325
|
+
/**
|
|
326
|
+
* The same rules as {@link allowsField}, as lists: for filling in, signing
|
|
327
|
+
* and putting a field in a group, every field (`{ all: true }`) or the
|
|
328
|
+
* groups the session's scope names. A form designer offers exactly these
|
|
329
|
+
* groups, and a filler sees whose fields are theirs. A courtesy for UI,
|
|
330
|
+
* like `allowsField`.
|
|
331
|
+
*/
|
|
332
|
+
fieldRights(): FieldRights;
|
|
346
333
|
/**
|
|
347
|
-
*
|
|
334
|
+
* Who the session acts for: from the document token's `identity` claim on
|
|
335
|
+
* the cloud, from `engine.open()` locally. Null when anonymous.
|
|
348
336
|
*/
|
|
349
|
-
readonly identity:
|
|
337
|
+
readonly identity: Identity | null;
|
|
350
338
|
/**
|
|
351
339
|
* "Should I prompt the user for a password?" — the single source
|
|
352
340
|
* of truth. Three states, each carrying exactly the data needed:
|
|
@@ -359,5 +347,5 @@ interface DocumentSecurityService {
|
|
|
359
347
|
unlock(input: DocumentUnlockInput): AbortablePromise<DocumentUnlockResult>;
|
|
360
348
|
}
|
|
361
349
|
//#endregion
|
|
362
|
-
export {
|
|
363
|
-
//# sourceMappingURL=DocumentSecurityService-
|
|
350
|
+
export { DocumentAccessReason as a, DocumentSecurityService as c, DocumentUnlockResult as d, PdfPermissionAdvisory as f, passwordPromptFromState as h, DocumentAccessInfo as i, DocumentSecurityState as l, PasswordPrompt as m, CdnAccessInfo as n, DocumentEncryptionState as o, PdfPermissionInfo as p, CdnAdapter as r, DocumentOpenMode as s, AnnotationOwner as t, DocumentUnlockInput as u };
|
|
351
|
+
//# sourceMappingURL=DocumentSecurityService-CU1M6Q7m.d.ts.map
|
package/dist/{DocumentSecurityService-ClTZc0zO.d.cts → DocumentSecurityService-e6vp2de8.d.cts}
RENAMED
|
@@ -1,77 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/promise/AbortablePromise.d.ts
|
|
3
|
-
type AbortableExecutor<T, P> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason: unknown) => void, progress: (p: P) => void, signal: AbortSignal) => void;
|
|
4
|
-
/**
|
|
5
|
-
* Awaitable Promise subclass with abort and progress.
|
|
6
|
-
*
|
|
7
|
-
* Symbol.species returns plain Promise so chained .then/.catch/.finally
|
|
8
|
-
* return regular promises and never try to synthesize a new
|
|
9
|
-
* AbortablePromise (which would have no executor).
|
|
10
|
-
*
|
|
11
|
-
* Settlement contract:
|
|
12
|
-
* - The first settlement wins. resolve/reject handed to the executor
|
|
13
|
-
* are wrapped so that any subsequent call (whether by the executor,
|
|
14
|
-
* by abort(), or by both racing) becomes a silent no-op.
|
|
15
|
-
* - abort() rejects the public promise with AbortError immediately,
|
|
16
|
-
* even if the executor never observes the AbortSignal. The executor
|
|
17
|
-
* still receives the AbortSignal so it can stop real work
|
|
18
|
-
* cooperatively (release a queue slot, abort fetch, post a worker
|
|
19
|
-
* abort, etc.). Anything the executor does after that — including
|
|
20
|
-
* a late resolve(value), a late reject(error), or a rejected inner
|
|
21
|
-
* Promise inside AbortablePromise.run — is dropped silently.
|
|
22
|
-
* - abort() after settlement is a no-op.
|
|
23
|
-
*/
|
|
24
|
-
declare class AbortablePromise<T, P = never> extends Promise<T> {
|
|
25
|
-
static get [Symbol.species](): PromiseConstructor;
|
|
26
|
-
readonly signal: AbortSignal;
|
|
27
|
-
private readonly _ctrl;
|
|
28
|
-
private readonly _progressCbs;
|
|
29
|
-
private readonly _state;
|
|
30
|
-
private readonly _internalReject;
|
|
31
|
-
constructor(executor: AbortableExecutor<T, P>);
|
|
32
|
-
/**
|
|
33
|
-
* Abort the underlying operation.
|
|
34
|
-
*
|
|
35
|
-
* - If the promise has already settled, this is a no-op.
|
|
36
|
-
* - Otherwise the public promise rejects synchronously with an
|
|
37
|
-
* AbortError (wrapping the supplied reason if it is not already an
|
|
38
|
-
* AbortError) and the AbortSignal fires for any cooperative
|
|
39
|
-
* cancellation the executor wired up.
|
|
40
|
-
*/
|
|
41
|
-
abort(reason?: unknown): void;
|
|
42
|
-
/**
|
|
43
|
-
* Subscribe to progress events. Returns an unsubscribe function.
|
|
44
|
-
*/
|
|
45
|
-
onProgress(cb: (p: P) => void): () => void;
|
|
46
|
-
/**
|
|
47
|
-
* Wrap a value in an already-resolved AbortablePromise. Mirrors Promise.resolve.
|
|
48
|
-
*/
|
|
49
|
-
static resolveValue<T>(value: T | PromiseLike<T>): AbortablePromise<T>;
|
|
50
|
-
/**
|
|
51
|
-
* Wrap a thrown reason in an already-rejected AbortablePromise.
|
|
52
|
-
*/
|
|
53
|
-
static rejectReason<T = never>(reason: unknown): AbortablePromise<T>;
|
|
54
|
-
/**
|
|
55
|
-
* Run an async function as an AbortablePromise so callers get .abort() and .signal.
|
|
56
|
-
* The async function receives the AbortSignal (and a progress emitter) so it can
|
|
57
|
-
* cooperate with the abort.
|
|
58
|
-
*
|
|
59
|
-
* If abort() fires while the inner async function is still running, the
|
|
60
|
-
* public promise rejects with AbortError immediately. The inner async
|
|
61
|
-
* function's eventual settlement (resolve or reject) is funneled through
|
|
62
|
-
* the wrapped settlers and silently dropped — including a late rejection
|
|
63
|
-
* from the underlying work, which prevents an UnhandledRejection because
|
|
64
|
-
* the .then(resolve, reject) below "handles" it via the no-op.
|
|
65
|
-
*/
|
|
66
|
-
static run<T, P = never>(fn: (signal: AbortSignal, progress: (p: P) => void) => Promise<T>): AbortablePromise<T, P>;
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
1
|
+
import { C_ as DocCapability, Du as BundleLimits, E_ as Identity, M_ as PdfBits, P_ as AbortablePromise, Wh as DocumentProtection, Xd as EditSessionAccess, ph as FieldRights } from "./AnnotationList-CkijRHet.cjs";
|
|
69
2
|
//#region src/engine/passwordPrompt.d.ts
|
|
70
3
|
type PasswordPrompt = {
|
|
71
4
|
readonly state: 'none';
|
|
72
5
|
} | {
|
|
73
6
|
readonly state: 'required';
|
|
74
7
|
readonly hint: 'user' | 'owner' | null;
|
|
8
|
+
/**
|
|
9
|
+
* The last password tried (at `open()` or `unlock()`) was wrong, so a
|
|
10
|
+
* prompt can say so. A wrong password opens the document locked, as no
|
|
11
|
+
* password does: one path for "this file needs a password".
|
|
12
|
+
*/
|
|
13
|
+
readonly incorrect: boolean;
|
|
75
14
|
} | {
|
|
76
15
|
readonly state: 'optional';
|
|
77
16
|
readonly hint: 'owner';
|
|
@@ -80,7 +19,7 @@ type PasswordPrompt = {
|
|
|
80
19
|
* Derive the high-level password prompt from the raw security state.
|
|
81
20
|
*
|
|
82
21
|
* The function is pure and total — every `DocumentSecurityState`
|
|
83
|
-
* maps to exactly one `PasswordPrompt`. Use this as the
|
|
22
|
+
* maps to exactly one `PasswordPrompt`. Use this as the single source
|
|
84
23
|
* of truth wherever the SDK exposes a "do you need a password?" flag:
|
|
85
24
|
* both `LocalDocumentSecurityService` and `CloudDocumentSecurityService`
|
|
86
25
|
* call it, so the contract can never drift.
|
|
@@ -110,7 +49,7 @@ type PasswordPrompt = {
|
|
|
110
49
|
*
|
|
111
50
|
* 6. fallthrough → { state: 'none' } open and nothing more available
|
|
112
51
|
*/
|
|
113
|
-
declare function passwordPromptFromState(state: DocumentSecurityState): PasswordPrompt;
|
|
52
|
+
declare function passwordPromptFromState(state: DocumentSecurityState, incorrect?: boolean): PasswordPrompt;
|
|
114
53
|
//#endregion
|
|
115
54
|
//#region src/engine/DocumentSecurityService.d.ts
|
|
116
55
|
type DocumentOpenMode = 'none' | 'user' | 'owner';
|
|
@@ -123,10 +62,9 @@ type DocumentAccessReason = 'password' | 'cdn' | 'permissions-unknown';
|
|
|
123
62
|
* not the raw bit names — so docs can render "Print: disabled" without
|
|
124
63
|
* the reader needing to know PDF bit positions.
|
|
125
64
|
*
|
|
126
|
-
* Computed from {@link PdfBits}
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* form fill is satisfied by bit 6 OR bit 9
|
|
65
|
+
* Computed from {@link PdfBits} as `pdf.permissions` reads them, which
|
|
66
|
+
* is what Acrobat allows on the file: for example, form fill comes with
|
|
67
|
+
* bit 4, 6 or 9, and form modification needs both bit 4 and bit 6.
|
|
130
68
|
*/
|
|
131
69
|
interface PdfPermissionAdvisory {
|
|
132
70
|
readonly canPrint: boolean;
|
|
@@ -240,12 +178,13 @@ interface DocumentAccessInfo {
|
|
|
240
178
|
* Sorted alphabetically for stable display.
|
|
241
179
|
*/
|
|
242
180
|
readonly effectiveScope: string[];
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
181
|
+
/**
|
|
182
|
+
* What the document's signatures forbid (`null` when it has none): a
|
|
183
|
+
* certification or a signed lock takes capabilities away from every
|
|
184
|
+
* caller, and `effectiveScope` already leaves them out.
|
|
185
|
+
*/
|
|
186
|
+
readonly protection: DocumentProtection | null;
|
|
187
|
+
readonly identity: Identity;
|
|
249
188
|
readonly originPasswordPolicy: {
|
|
250
189
|
readonly mode: 'not-needed' | 'client-retry' | 'server-session';
|
|
251
190
|
};
|
|
@@ -255,7 +194,7 @@ interface DocumentAccessInfo {
|
|
|
255
194
|
* `viewport.width` points whose renders are durable, CDN-shared
|
|
256
195
|
* artifacts, plus the reserved tile-pyramid block. Local engines report
|
|
257
196
|
* nothing here (continuous rendering); cloud engines surface it so
|
|
258
|
-
* `snapFullPageViewport` can conform requests
|
|
197
|
+
* `snapFullPageViewport` can conform requests explicitly — the SDK
|
|
259
198
|
* never snaps implicitly (engine parity).
|
|
260
199
|
*/
|
|
261
200
|
readonly renderPolicy?: {
|
|
@@ -274,6 +213,17 @@ interface DocumentAccessInfo {
|
|
|
274
213
|
readonly background: 'white';
|
|
275
214
|
readonly enforced: boolean;
|
|
276
215
|
};
|
|
216
|
+
/**
|
|
217
|
+
* The deployment's limits for an annotation import: the cloud client
|
|
218
|
+
* checks a bundle against these before its bytes move.
|
|
219
|
+
*/
|
|
220
|
+
readonly bundleLimits: BundleLimits;
|
|
221
|
+
/**
|
|
222
|
+
* The caller's editing session and the object numbers handed to it,
|
|
223
|
+
* present when the caller may create objects and named its session
|
|
224
|
+
* (`X-Engine-Session-Id`).
|
|
225
|
+
*/
|
|
226
|
+
readonly edit?: EditSessionAccess;
|
|
277
227
|
}
|
|
278
228
|
interface DocumentUnlockInput {
|
|
279
229
|
readonly password: string;
|
|
@@ -283,56 +233,65 @@ interface DocumentUnlockResult {
|
|
|
283
233
|
readonly security: DocumentSecurityState;
|
|
284
234
|
readonly access?: DocumentAccessInfo;
|
|
285
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* What an annotation is and whose: what `allowsAnnotation('update' |
|
|
238
|
+
* 'delete', …)` reads. An `Annotation` is one; so is `{ userId, groupId }`.
|
|
239
|
+
* A widget (`subtype: 'widget'`) belongs to a form field: changing or
|
|
240
|
+
* deleting one takes `doc.forms.modify`, whoever's it is.
|
|
241
|
+
*/
|
|
242
|
+
interface AnnotationOwner {
|
|
243
|
+
subtype?: string;
|
|
244
|
+
userId?: string | null;
|
|
245
|
+
groupId?: string | null;
|
|
246
|
+
}
|
|
286
247
|
interface DocumentSecurityService {
|
|
287
248
|
/**
|
|
288
249
|
* Raw structured security probe. Stable across engines, refreshed
|
|
289
|
-
* after unlock
|
|
290
|
-
*
|
|
250
|
+
* after an unlock. Power users and diagnostic tools read this; most
|
|
251
|
+
* code uses the higher-level accessors below.
|
|
291
252
|
*/
|
|
292
|
-
readonly
|
|
253
|
+
readonly state: DocumentSecurityState;
|
|
293
254
|
/**
|
|
294
255
|
* The caller's expanded capability set — raw scope + pdf bits +
|
|
295
|
-
* implication rules, enumerated for
|
|
256
|
+
* implication rules, enumerated for display ("here's what you can
|
|
296
257
|
* do"). Identical shape on local and cloud; cloud uses the
|
|
297
258
|
* server-canonical value when available, else computes locally from
|
|
298
259
|
* JWT scope + /head bits.
|
|
299
260
|
*
|
|
300
|
-
*
|
|
301
|
-
* admin wildcard and unbounded parametric collab grants are
|
|
261
|
+
* Note: this is an *enumeration*, not an authorization check. The `*`
|
|
262
|
+
* admin wildcard and unbounded parametric collab grants are not
|
|
302
263
|
* listed here (they can't be). To gate UI, use {@link allows} — the
|
|
303
264
|
* same wildcard-aware predicate the engine enforces with.
|
|
304
265
|
*/
|
|
305
|
-
readonly
|
|
266
|
+
readonly scope: ReadonlyArray<string>;
|
|
306
267
|
/**
|
|
307
|
-
* Wildcard-aware authorization check — the
|
|
268
|
+
* Wildcard-aware authorization check — the same predicate the engine
|
|
308
269
|
* enforces with (`checkCapability`). A shown control gated on this
|
|
309
270
|
* mirrors exactly what the engine will allow: the `*` admin grant and
|
|
310
271
|
* `pdf.permissions`-derived bits are both honored. Use this for edit
|
|
311
|
-
* gating (e.g. `allows('doc.pages.assemble')`); use `
|
|
312
|
-
*
|
|
272
|
+
* gating (e.g. `allows('doc.pages.assemble')`); use `scope` only to
|
|
273
|
+
* *display* the concrete grants.
|
|
313
274
|
*/
|
|
314
275
|
allows(capability: DocCapability): boolean;
|
|
315
276
|
/**
|
|
316
|
-
* Per-record annotation authorization mirrors — the
|
|
277
|
+
* Per-record annotation authorization mirrors — the same resolver the
|
|
317
278
|
* engine enforces with (`checkCollab`'s narrowing rule: an applicable
|
|
318
|
-
* `annotations:<action>:<filter>` grant
|
|
279
|
+
* `annotations:<action>:<filter>` grant shadows the coarse
|
|
319
280
|
* `doc.annotate.modify` fallback for that action), over the same
|
|
320
281
|
* inputs (raw scope + identity claims + PDF bits). `allows()` cannot
|
|
321
282
|
* answer these: it enumerates capabilities, and a filtered collab
|
|
322
283
|
* grant is not a capability — whether "update" is allowed depends on
|
|
323
|
-
*
|
|
284
|
+
* whose annotation you're touching.
|
|
324
285
|
*
|
|
325
|
-
*
|
|
326
|
-
* - create derives
|
|
327
|
-
* (`:self` trivially passes; `:group=X` matches the
|
|
328
|
-
* default group),
|
|
329
|
-
* - update
|
|
330
|
-
* owner (`userId`/`groupId
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
* (`annotations:set-group:` ladder; the caller's own default
|
|
335
|
-
* group is always assignable).
|
|
286
|
+
* The target depends on the action:
|
|
287
|
+
* - `create` needs none: it derives the target from the caller's
|
|
288
|
+
* own identity (`:self` trivially passes; `:group=X` matches the
|
|
289
|
+
* caller's default group),
|
|
290
|
+
* - `update`/`delete` take the annotation itself, asked about its
|
|
291
|
+
* stamped owner (`userId`/`groupId`; an unstamped annotation is
|
|
292
|
+
* denied under any narrowed grant, as the engine does),
|
|
293
|
+
* - `set-group` takes the destination group (`annotations:set-group:`
|
|
294
|
+
* ladder; the caller's own default group is always assignable).
|
|
336
295
|
*
|
|
337
296
|
* These are a courtesy for UI gating — the engine (and the server,
|
|
338
297
|
* on cloud) independently enforces every mutation with the same
|
|
@@ -340,13 +299,42 @@ interface DocumentSecurityService {
|
|
|
340
299
|
* access. Returns false when no scope context exists (legacy local
|
|
341
300
|
* open without `scope`, cloud open without a token before /access).
|
|
342
301
|
*/
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
302
|
+
allowsAnnotation(action: 'create'): boolean;
|
|
303
|
+
allowsAnnotation(action: 'update' | 'delete', annotation: AnnotationOwner): boolean;
|
|
304
|
+
allowsAnnotation(action: 'set-group', target: {
|
|
305
|
+
groupId: string;
|
|
306
|
+
}): boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Per-field form authorization, mirroring what the engine checks on every
|
|
309
|
+
* fill, signing and form design write:
|
|
310
|
+
* - `fill`/`sign` take the field (its `groupId`): a `fields:fill` /
|
|
311
|
+
* `fields:sign` scope for its group, or, without one, `doc.forms.fill`
|
|
312
|
+
* / `doc.sign` for every field;
|
|
313
|
+
* - `set-group` takes the destination group (`fields:set-group:` ladder;
|
|
314
|
+
* the caller's own default group is always assignable).
|
|
315
|
+
*
|
|
316
|
+
* A courtesy for UI gating, like {@link allowsAnnotation}: the engine
|
|
317
|
+
* enforces every write with the same predicates.
|
|
318
|
+
*/
|
|
319
|
+
allowsField(action: 'fill' | 'sign', field: {
|
|
320
|
+
groupId: string | null;
|
|
321
|
+
}): boolean;
|
|
322
|
+
allowsField(action: 'set-group', target: {
|
|
323
|
+
groupId: string;
|
|
324
|
+
}): boolean;
|
|
325
|
+
/**
|
|
326
|
+
* The same rules as {@link allowsField}, as lists: for filling in, signing
|
|
327
|
+
* and putting a field in a group, every field (`{ all: true }`) or the
|
|
328
|
+
* groups the session's scope names. A form designer offers exactly these
|
|
329
|
+
* groups, and a filler sees whose fields are theirs. A courtesy for UI,
|
|
330
|
+
* like `allowsField`.
|
|
331
|
+
*/
|
|
332
|
+
fieldRights(): FieldRights;
|
|
346
333
|
/**
|
|
347
|
-
*
|
|
334
|
+
* Who the session acts for: from the document token's `identity` claim on
|
|
335
|
+
* the cloud, from `engine.open()` locally. Null when anonymous.
|
|
348
336
|
*/
|
|
349
|
-
readonly identity:
|
|
337
|
+
readonly identity: Identity | null;
|
|
350
338
|
/**
|
|
351
339
|
* "Should I prompt the user for a password?" — the single source
|
|
352
340
|
* of truth. Three states, each carrying exactly the data needed:
|
|
@@ -359,5 +347,5 @@ interface DocumentSecurityService {
|
|
|
359
347
|
unlock(input: DocumentUnlockInput): AbortablePromise<DocumentUnlockResult>;
|
|
360
348
|
}
|
|
361
349
|
//#endregion
|
|
362
|
-
export {
|
|
363
|
-
//# sourceMappingURL=DocumentSecurityService-
|
|
350
|
+
export { DocumentAccessReason as a, DocumentSecurityService as c, DocumentUnlockResult as d, PdfPermissionAdvisory as f, passwordPromptFromState as h, DocumentAccessInfo as i, DocumentSecurityState as l, PasswordPrompt as m, CdnAccessInfo as n, DocumentEncryptionState as o, PdfPermissionInfo as p, CdnAdapter as r, DocumentOpenMode as s, AnnotationOwner as t, DocumentUnlockInput as u };
|
|
351
|
+
//# sourceMappingURL=DocumentSecurityService-e6vp2de8.d.cts.map
|