@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.
Files changed (135) hide show
  1. package/dist/AnnotationList-CkijRHet.d.cts +27163 -0
  2. package/dist/AnnotationList-CkijRHet.d.ts +27163 -0
  3. package/dist/Change-CKoxfTNY.js +889 -0
  4. package/dist/Change-CKoxfTNY.js.map +1 -0
  5. package/dist/Change-CjImsrN0.cjs +1020 -0
  6. package/dist/Change-CjImsrN0.cjs.map +1 -0
  7. package/dist/DocumentRenderService-BfFdFSwI.cjs +120 -0
  8. package/dist/DocumentRenderService-BfFdFSwI.cjs.map +1 -0
  9. package/dist/DocumentRenderService-DV3J9lMz.js +85 -0
  10. package/dist/DocumentRenderService-DV3J9lMz.js.map +1 -0
  11. package/dist/{DocumentSecurityService-_JRjqvoI.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts} +100 -112
  12. package/dist/{DocumentSecurityService-ClTZc0zO.d.cts → DocumentSecurityService-e6vp2de8.d.cts} +100 -112
  13. package/dist/LocalDocumentHandle-D02FMm-Z.cjs +53 -0
  14. package/dist/LocalDocumentHandle-D02FMm-Z.cjs.map +1 -0
  15. package/dist/LocalDocumentHandle-DAPdaOt_.js +30 -0
  16. package/dist/LocalDocumentHandle-DAPdaOt_.js.map +1 -0
  17. package/dist/LocalEngine-DFoBm4B3.d.cts +1565 -0
  18. package/dist/LocalEngine-DPriFujS.d.ts +1565 -0
  19. package/dist/PageInsertBlankInput-CXHAM7l6.cjs +17 -0
  20. package/dist/PageInsertBlankInput-CXHAM7l6.cjs.map +1 -0
  21. package/dist/PageInsertBlankInput-DhVYVJ_S.js +12 -0
  22. package/dist/PageInsertBlankInput-DhVYVJ_S.js.map +1 -0
  23. package/dist/authority-B3BklsB4.js +2239 -0
  24. package/dist/authority-B3BklsB4.js.map +1 -0
  25. package/dist/authority-DLMNR7ff.cjs +2676 -0
  26. package/dist/authority-DLMNR7ff.cjs.map +1 -0
  27. package/dist/builders-CNj0POeY.js +161 -0
  28. package/dist/builders-CNj0POeY.js.map +1 -0
  29. package/dist/builders-Cgdp_YCn.cjs +184 -0
  30. package/dist/builders-Cgdp_YCn.cjs.map +1 -0
  31. package/dist/calibrate-7T3fnP8-.js +2404 -0
  32. package/dist/calibrate-7T3fnP8-.js.map +1 -0
  33. package/dist/calibrate-DJBXnhLE.cjs +2919 -0
  34. package/dist/calibrate-DJBXnhLE.cjs.map +1 -0
  35. package/dist/charmap-Cprti1ta.js +239 -0
  36. package/dist/charmap-Cprti1ta.js.map +1 -0
  37. package/dist/charmap-aYlefQP9.cjs +304 -0
  38. package/dist/charmap-aYlefQP9.cjs.map +1 -0
  39. package/dist/conformance.cjs +16753 -5247
  40. package/dist/conformance.cjs.map +1 -1
  41. package/dist/conformance.d.cts +928 -165
  42. package/dist/conformance.d.ts +928 -165
  43. package/dist/conformance.js +16731 -5268
  44. package/dist/conformance.js.map +1 -1
  45. package/dist/format-Bp3QFSH1.cjs +574 -0
  46. package/dist/format-Bp3QFSH1.cjs.map +1 -0
  47. package/dist/format-Dgg428Kb.js +461 -0
  48. package/dist/format-Dgg428Kb.js.map +1 -0
  49. package/dist/index.cjs +330 -103
  50. package/dist/index.d.cts +2 -2
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +14 -5
  53. package/dist/pageRefs-B3ur7Ckm.cjs +51 -0
  54. package/dist/pageRefs-B3ur7Ckm.cjs.map +1 -0
  55. package/dist/pageRefs-DkbuxSCV.js +40 -0
  56. package/dist/pageRefs-DkbuxSCV.js.map +1 -0
  57. package/dist/public.cjs +57 -0
  58. package/dist/public.d.cts +5 -0
  59. package/dist/public.d.ts +5 -0
  60. package/dist/public.js +9 -0
  61. package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs +3646 -0
  62. package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs.map +1 -0
  63. package/dist/resolveAnnotationDraft-CUpf0SMh.js +3167 -0
  64. package/dist/resolveAnnotationDraft-CUpf0SMh.js.map +1 -0
  65. package/dist/{resolver-inAVzsWt.js → resolver-CzxmD9Ck.js} +294 -144
  66. package/dist/resolver-CzxmD9Ck.js.map +1 -0
  67. package/dist/{resolver-CYVNV4hn.cjs → resolver-D2OCtE8F.cjs} +347 -143
  68. package/dist/resolver-D2OCtE8F.cjs.map +1 -0
  69. package/dist/runtime-Cl0v56mm.d.ts +2032 -0
  70. package/dist/runtime-p1WDzDo4.d.cts +2032 -0
  71. package/dist/runtime.cjs +733 -284
  72. package/dist/runtime.cjs.map +1 -1
  73. package/dist/runtime.d.cts +5 -1348
  74. package/dist/runtime.d.ts +5 -1348
  75. package/dist/runtime.js +396 -179
  76. package/dist/runtime.js.map +1 -1
  77. package/dist/schema-C-gU4vj7.cjs +3034 -0
  78. package/dist/schema-C-gU4vj7.cjs.map +1 -0
  79. package/dist/schema-DzlUNk38.js +2081 -0
  80. package/dist/schema-DzlUNk38.js.map +1 -0
  81. package/dist/schemas-Berf1swF.cjs +2481 -0
  82. package/dist/schemas-Berf1swF.cjs.map +1 -0
  83. package/dist/schemas-D6xOGjqg.js +1654 -0
  84. package/dist/schemas-D6xOGjqg.js.map +1 -0
  85. package/dist/subtype-CG4WpIRj.js +129 -0
  86. package/dist/subtype-CG4WpIRj.js.map +1 -0
  87. package/dist/subtype-aDt5TFmK.cjs +158 -0
  88. package/dist/subtype-aDt5TFmK.cjs.map +1 -0
  89. package/dist/validation.cjs +578 -0
  90. package/dist/validation.cjs.map +1 -0
  91. package/dist/validation.d.cts +174 -0
  92. package/dist/validation.d.ts +174 -0
  93. package/dist/validation.js +571 -0
  94. package/dist/validation.js.map +1 -0
  95. package/dist/value-BFS1R8ek.cjs +435 -0
  96. package/dist/value-BFS1R8ek.cjs.map +1 -0
  97. package/dist/value-Dhc8eYcx.js +340 -0
  98. package/dist/value-Dhc8eYcx.js.map +1 -0
  99. package/dist/viewport-BJW13EGZ.js +540 -0
  100. package/dist/viewport-BJW13EGZ.js.map +1 -0
  101. package/dist/viewport-DlL5Bxbg.cjs +671 -0
  102. package/dist/viewport-DlL5Bxbg.cjs.map +1 -0
  103. package/dist/wire.cjs +1056 -379
  104. package/dist/wire.cjs.map +1 -1
  105. package/dist/wire.d.cts +15069 -725
  106. package/dist/wire.d.ts +15069 -725
  107. package/dist/wire.js +825 -239
  108. package/dist/wire.js.map +1 -1
  109. package/package.json +10 -1
  110. package/dist/AbortError-Cq2igpZ6.cjs +0 -38
  111. package/dist/AbortError-Cq2igpZ6.cjs.map +0 -1
  112. package/dist/AbortError-DHqPBnYc.js +0 -27
  113. package/dist/AbortError-DHqPBnYc.js.map +0 -1
  114. package/dist/AnnotationListSnapshot-D3mFut1e.d.cts +0 -6871
  115. package/dist/AnnotationListSnapshot-D3mFut1e.d.ts +0 -6871
  116. package/dist/Engine-Bx0NOfmd.d.cts +0 -1264
  117. package/dist/Engine-DxtpCYcP.d.ts +0 -1264
  118. package/dist/PageInsertBlankInput-CqXBmFhN.cjs +0 -449
  119. package/dist/PageInsertBlankInput-CqXBmFhN.cjs.map +0 -1
  120. package/dist/PageInsertBlankInput-cHq9-i-z.js +0 -378
  121. package/dist/PageInsertBlankInput-cHq9-i-z.js.map +0 -1
  122. package/dist/builders-Bqm8yTpi.cjs +0 -3564
  123. package/dist/builders-Bqm8yTpi.cjs.map +0 -1
  124. package/dist/builders-Dqo2X-dt.js +0 -3121
  125. package/dist/builders-Dqo2X-dt.js.map +0 -1
  126. package/dist/fold-2V29cxCV.cjs +0 -447
  127. package/dist/fold-2V29cxCV.cjs.map +0 -1
  128. package/dist/fold-CdEJTBTn.js +0 -334
  129. package/dist/fold-CdEJTBTn.js.map +0 -1
  130. package/dist/resolver-CYVNV4hn.cjs.map +0 -1
  131. package/dist/resolver-inAVzsWt.js.map +0 -1
  132. package/dist/schemas-BLARNCgx.js +0 -3113
  133. package/dist/schemas-BLARNCgx.js.map +0 -1
  134. package/dist/schemas-DIqFMmrC.cjs +0 -4468
  135. package/dist/schemas-DIqFMmrC.cjs.map +0 -1
@@ -1,77 +1,16 @@
1
- import { Su as PdfBits, gu as IdentityClaims, hl as CollabTarget, hu as DocCapability } from "./AnnotationListSnapshot-D3mFut1e.js";
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 SINGLE source
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} via the strict ISO 32000 rules:
127
- * bit 12 only meaningful when bit 3 is also set
128
- * form modification requires both bit 6 AND bit 4
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
- readonly identity: {
244
- readonly user_id?: string;
245
- readonly group_id?: string;
246
- readonly groups?: string[];
247
- readonly display_name?: string;
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 EXPLICITLY — the SDK
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/refresh. Power users and diagnostic tools read this;
290
- * most dev code uses the higher-level accessors below.
250
+ * after an unlock. Power users and diagnostic tools read this; most
251
+ * code uses the higher-level accessors below.
291
252
  */
292
- readonly current: DocumentSecurityState;
253
+ readonly state: DocumentSecurityState;
293
254
  /**
294
255
  * The caller's expanded capability set — raw scope + pdf bits +
295
- * implication rules, enumerated for DISPLAY ("here's what you can
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
- * NOTE: this is an *enumeration*, not an authorization check. The `*`
301
- * admin wildcard and unbounded parametric collab grants are NOT
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 effectiveScope: ReadonlyArray<string>;
266
+ readonly scope: ReadonlyArray<string>;
306
267
  /**
307
- * Wildcard-aware authorization check — the SAME predicate the engine
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 `effectiveScope`
312
- * only to *display* the concrete grants.
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 SAME resolver 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 SHADOWS the coarse
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
- * WHOSE annotation you're touching.
284
+ * whose annotation you're touching.
324
285
  *
325
- * Three surfaces because the questions genuinely differ:
326
- * - create derives its target from the caller's OWN identity
327
- * (`:self` trivially passes; `:group=X` matches the caller's
328
- * default group),
329
- * - update/delete are asked about the TARGET record's stamped
330
- * owner (`userId`/`groupId` from its EMBD metadata; pass `{}`
331
- * when unstamped — matching the engine, which denies unstamped
332
- * targets under any narrowed grant),
333
- * - group assignment is asked about the DESTINATION group
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
- allowsAnnotationCreate(): boolean;
344
- allowsAnnotationMutation(action: 'update' | 'delete', target: CollabTarget): boolean;
345
- allowsAnnotationGroupAssignment(groupId: string): boolean;
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
- * Identity of the current caller, or null when anonymous.
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: IdentityClaims | null;
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 { DocumentEncryptionState as a, DocumentSecurityState as c, PdfPermissionAdvisory as d, PdfPermissionInfo as f, AbortablePromise as g, AbortableExecutor as h, DocumentAccessReason as i, DocumentUnlockInput as l, passwordPromptFromState as m, CdnAdapter as n, DocumentOpenMode as o, PasswordPrompt as p, DocumentAccessInfo as r, DocumentSecurityService as s, CdnAccessInfo as t, DocumentUnlockResult as u };
363
- //# sourceMappingURL=DocumentSecurityService-_JRjqvoI.d.ts.map
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
@@ -1,77 +1,16 @@
1
- import { Su as PdfBits, gu as IdentityClaims, hl as CollabTarget, hu as DocCapability } from "./AnnotationListSnapshot-D3mFut1e.cjs";
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 SINGLE source
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} via the strict ISO 32000 rules:
127
- * bit 12 only meaningful when bit 3 is also set
128
- * form modification requires both bit 6 AND bit 4
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
- readonly identity: {
244
- readonly user_id?: string;
245
- readonly group_id?: string;
246
- readonly groups?: string[];
247
- readonly display_name?: string;
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 EXPLICITLY — the SDK
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/refresh. Power users and diagnostic tools read this;
290
- * most dev code uses the higher-level accessors below.
250
+ * after an unlock. Power users and diagnostic tools read this; most
251
+ * code uses the higher-level accessors below.
291
252
  */
292
- readonly current: DocumentSecurityState;
253
+ readonly state: DocumentSecurityState;
293
254
  /**
294
255
  * The caller's expanded capability set — raw scope + pdf bits +
295
- * implication rules, enumerated for DISPLAY ("here's what you can
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
- * NOTE: this is an *enumeration*, not an authorization check. The `*`
301
- * admin wildcard and unbounded parametric collab grants are NOT
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 effectiveScope: ReadonlyArray<string>;
266
+ readonly scope: ReadonlyArray<string>;
306
267
  /**
307
- * Wildcard-aware authorization check — the SAME predicate the engine
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 `effectiveScope`
312
- * only to *display* the concrete grants.
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 SAME resolver 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 SHADOWS the coarse
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
- * WHOSE annotation you're touching.
284
+ * whose annotation you're touching.
324
285
  *
325
- * Three surfaces because the questions genuinely differ:
326
- * - create derives its target from the caller's OWN identity
327
- * (`:self` trivially passes; `:group=X` matches the caller's
328
- * default group),
329
- * - update/delete are asked about the TARGET record's stamped
330
- * owner (`userId`/`groupId` from its EMBD metadata; pass `{}`
331
- * when unstamped — matching the engine, which denies unstamped
332
- * targets under any narrowed grant),
333
- * - group assignment is asked about the DESTINATION group
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
- allowsAnnotationCreate(): boolean;
344
- allowsAnnotationMutation(action: 'update' | 'delete', target: CollabTarget): boolean;
345
- allowsAnnotationGroupAssignment(groupId: string): boolean;
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
- * Identity of the current caller, or null when anonymous.
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: IdentityClaims | null;
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 { DocumentEncryptionState as a, DocumentSecurityState as c, PdfPermissionAdvisory as d, PdfPermissionInfo as f, AbortablePromise as g, AbortableExecutor as h, DocumentAccessReason as i, DocumentUnlockInput as l, passwordPromptFromState as m, CdnAdapter as n, DocumentOpenMode as o, PasswordPrompt as p, DocumentAccessInfo as r, DocumentSecurityService as s, CdnAccessInfo as t, DocumentUnlockResult as u };
363
- //# sourceMappingURL=DocumentSecurityService-ClTZc0zO.d.cts.map
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