@docx-editor.dev/editor-api 2.28.0 → 2.30.0
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/OFFICE_JS_GUIDE.md +19 -0
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{server-By7dFq5s.d.mts → server-BHhcVU2-.d.mts} +242 -136
- package/dist/{server-By7dFq5s.d.ts → server-BHhcVU2-.d.ts} +242 -136
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, RevisionAuthorResult, AutomationHost, AutomationCapabilities, AutomationPaginationOptions } from '@docx-editor.dev/core/automation';
|
|
1
|
+
import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, RevisionAuthorResult, DiagnosticCode, AutomationHost, AutomationCapabilities, AutomationPaginationOptions, ByteSizeBucket, DocumentOpenDiagnosticCode, DocumentPartKind, DiagnosticErrorName, EditDiagnosticCode } from '@docx-editor.dev/core/automation';
|
|
2
2
|
import { CollaborationModuleContribution } from '@docx-editor.dev/core/collaboration';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -2141,6 +2141,186 @@ declare class Document extends ModelObject {
|
|
|
2141
2141
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
2142
2142
|
}
|
|
2143
2143
|
|
|
2144
|
+
/** What went wrong, as a value a consumer may branch on. */
|
|
2145
|
+
type DocxEditorErrorCode =
|
|
2146
|
+
/** A property was read before a `load(...)` for it completed in a `sync()`. */
|
|
2147
|
+
'PropertyNotLoaded'
|
|
2148
|
+
/** A `ClientResult` value was read before the sync that fills it. */
|
|
2149
|
+
| 'ValueNotLoaded'
|
|
2150
|
+
/**
|
|
2151
|
+
* The object cannot be addressed, in either of the two ways that happens.
|
|
2152
|
+
*
|
|
2153
|
+
* NOT YET: an item accessor answers a proxy the read that names it has not answered for, and it
|
|
2154
|
+
* becomes usable at the next `sync()`. NOT ANY MORE: its run ended and nothing tracked it, which
|
|
2155
|
+
* is terminal. One code because from a consumer's side both are "this object cannot be used
|
|
2156
|
+
* here"; the message says which one, because the fix for one is not the fix for the other.
|
|
2157
|
+
*/
|
|
2158
|
+
| 'InvalidObjectPath'
|
|
2159
|
+
/** The object still belongs to a run that has not finished, so it cannot be handed over. */
|
|
2160
|
+
| 'ObjectInUse'
|
|
2161
|
+
/** An argument or load option this API does not accept. */
|
|
2162
|
+
| 'InvalidArgument'
|
|
2163
|
+
/** Opening the document exceeded a bounded reader resource limit. */
|
|
2164
|
+
| 'ResourceLimitExceeded'
|
|
2165
|
+
/** The collection has no such item — `getFirst()` on an empty one. */
|
|
2166
|
+
| 'ItemNotFound'
|
|
2167
|
+
/** The host cannot do this at all — a capability it reports false. */
|
|
2168
|
+
| 'NotSupported'
|
|
2169
|
+
/**
|
|
2170
|
+
* The member exists in this API's shape but this version does not implement it.
|
|
2171
|
+
*
|
|
2172
|
+
* Distinct from `NotSupported`, which is about the HOST: a headless document really has no
|
|
2173
|
+
* caret, and no version of this library will give it one. This code means the library, not the
|
|
2174
|
+
* document, is the limit — so a consumer knows to check the release notes rather than the host.
|
|
2175
|
+
*/
|
|
2176
|
+
| 'NotImplemented'
|
|
2177
|
+
/**
|
|
2178
|
+
* Two calls in one batch make claims on the same paragraph that cannot both hold.
|
|
2179
|
+
*
|
|
2180
|
+
* A batch is one transaction planned against the state at its start, which stops being
|
|
2181
|
+
* unambiguous once two calls restructure the same paragraph. Split them across two `sync()`
|
|
2182
|
+
* calls and each gets exactly what it asked for.
|
|
2183
|
+
*/
|
|
2184
|
+
| 'ConflictingChanges'
|
|
2185
|
+
/** The request context's `run` has finished, so it can no longer be used. */
|
|
2186
|
+
| 'InvalidRequestContext'
|
|
2187
|
+
/** The runtime was disposed. Every later operation fails this way. */
|
|
2188
|
+
| 'RuntimeDisposed'
|
|
2189
|
+
/**
|
|
2190
|
+
* The request was built from an older read, so nothing was applied: another writer moved the
|
|
2191
|
+
* document, or a range's text moved since the range was read, including by this context's own
|
|
2192
|
+
* earlier sync. Read again before retrying.
|
|
2193
|
+
*/
|
|
2194
|
+
| 'StaleDocument'
|
|
2195
|
+
/** The host is live but holds no document right now — an editor between mounts. */
|
|
2196
|
+
| 'DocumentUnavailable'
|
|
2197
|
+
/** The document refused the change, or answered something this runtime cannot use. */
|
|
2198
|
+
| 'GeneralException';
|
|
2199
|
+
/**
|
|
2200
|
+
* The fields a {@link DocxEditorError} is constructed from.
|
|
2201
|
+
*
|
|
2202
|
+
* @public
|
|
2203
|
+
*/
|
|
2204
|
+
interface DocxEditorErrorInit {
|
|
2205
|
+
/** Which refusal this is. The stable thing to branch on. */
|
|
2206
|
+
readonly code: DocxEditorErrorCode;
|
|
2207
|
+
/** The resource limit exceeded while opening a document. */
|
|
2208
|
+
readonly limit?: 'zip.maxEntries' | 'zip.maxTotalBytes' | 'zip.maxRatio' | 'xml.maxBytes' | 'xml.maxElements' | 'xml.maxDepth' | 'maxXmlParts' | 'maxRelationships';
|
|
2209
|
+
/**
|
|
2210
|
+
* The consumer-facing path of the object or property involved — `document.body.text`, not a
|
|
2211
|
+
* handle. Omitted when there is nothing to name.
|
|
2212
|
+
*/
|
|
2213
|
+
readonly target?: string;
|
|
2214
|
+
/** The revision the context had read at, for `StaleDocument`. */
|
|
2215
|
+
readonly expectedRevision?: number;
|
|
2216
|
+
/** The revision the document was actually at, for `StaleDocument`. */
|
|
2217
|
+
readonly actualRevision?: number;
|
|
2218
|
+
/**
|
|
2219
|
+
* The engine's public diagnostic code for this refusal, when it has one. It becomes
|
|
2220
|
+
* `debugInfo.innerError`.
|
|
2221
|
+
*/
|
|
2222
|
+
readonly diagnostic?: DiagnosticCode;
|
|
2223
|
+
}
|
|
2224
|
+
/**
|
|
2225
|
+
* Why the engine refused, as a public diagnostic code with its fixed hint.
|
|
2226
|
+
*
|
|
2227
|
+
* @public
|
|
2228
|
+
*/
|
|
2229
|
+
interface DocxEditorInnerError {
|
|
2230
|
+
/** A stable public diagnostic code, such as `edit.tracked-drawing-delete-unsupported`. */
|
|
2231
|
+
readonly code: DiagnosticCode;
|
|
2232
|
+
/** The fixed hint for the code: the cause, then the action. Never document content. */
|
|
2233
|
+
readonly message: string;
|
|
2234
|
+
}
|
|
2235
|
+
/**
|
|
2236
|
+
* Debug details in the shape of Office.js `OfficeExtension.DebugInfo`.
|
|
2237
|
+
*
|
|
2238
|
+
* @public
|
|
2239
|
+
*/
|
|
2240
|
+
interface DocxEditorDebugInfo {
|
|
2241
|
+
/** The same code as {@link DocxEditorError.code}. */
|
|
2242
|
+
readonly code: DocxEditorErrorCode;
|
|
2243
|
+
/** The same message as the error's own. */
|
|
2244
|
+
readonly message: string;
|
|
2245
|
+
/** The consumer-facing path of the object or property involved, when there is one. */
|
|
2246
|
+
readonly errorLocation?: string;
|
|
2247
|
+
/**
|
|
2248
|
+
* Why the engine refused, when it knows a specific reason. Handle the outer `code`; read
|
|
2249
|
+
* `innerError.message` to tell a person or a model what to change.
|
|
2250
|
+
*/
|
|
2251
|
+
readonly innerError?: DocxEditorInnerError;
|
|
2252
|
+
}
|
|
2253
|
+
/**
|
|
2254
|
+
* Every refusal this runtime throws.
|
|
2255
|
+
*
|
|
2256
|
+
* Branch on {@link DocxEditorError.code}, never on the message. Codes are stable public API —
|
|
2257
|
+
* added rather than repurposed — so a consumer that handles `PropertyNotLoaded` by loading and
|
|
2258
|
+
* syncing again keeps working across versions.
|
|
2259
|
+
*
|
|
2260
|
+
* Nothing from the engine appears in the message. Host rejection reasons, opaque handle refs and
|
|
2261
|
+
* offset ranges are all withheld: a ref in a message is a name a consumer can start depending on,
|
|
2262
|
+
* and a store's rejection reason would become a documented one the moment somebody matched on it.
|
|
2263
|
+
* What a consumer gets instead is a stable code, a fixed sentence, and `target` — the
|
|
2264
|
+
* consumer-facing path they wrote themselves.
|
|
2265
|
+
*
|
|
2266
|
+
* @example
|
|
2267
|
+
* ```ts
|
|
2268
|
+
* try {
|
|
2269
|
+
* await context.sync();
|
|
2270
|
+
* } catch (error) {
|
|
2271
|
+
* if (isDocxEditorError(error) && error.code === 'StaleDocument') {
|
|
2272
|
+
* // Re-read, re-anchor, and reconsider: someone else changed the document first.
|
|
2273
|
+
* }
|
|
2274
|
+
* }
|
|
2275
|
+
* ```
|
|
2276
|
+
*
|
|
2277
|
+
* @public
|
|
2278
|
+
*/
|
|
2279
|
+
declare class DocxEditorError extends Error {
|
|
2280
|
+
/** Which refusal this is. Stable across versions; the thing to branch on. */
|
|
2281
|
+
readonly code: DocxEditorErrorCode;
|
|
2282
|
+
/** For `ResourceLimitExceeded`: the resource limit that prevented opening. */
|
|
2283
|
+
readonly limit?: DocxEditorErrorInit['limit'];
|
|
2284
|
+
/** Consumer-facing path of the object or property involved, when there is one to name. */
|
|
2285
|
+
readonly target?: string;
|
|
2286
|
+
/**
|
|
2287
|
+
* For `StaleDocument`: the revision the context had last read at, when the refused batch
|
|
2288
|
+
* wrote. Absent for a batch that only read, on every host.
|
|
2289
|
+
*
|
|
2290
|
+
* When it equals {@link DocxEditorError.actualRevision}, the document is where this context
|
|
2291
|
+
* last saw it, and a range it holds is out of date: an edit after the range was read (often
|
|
2292
|
+
* this context's own earlier sync) moved its text. Search for the text again. When the two
|
|
2293
|
+
* differ, another writer changed the document after this context's last read. Read again
|
|
2294
|
+
* before you decide.
|
|
2295
|
+
*/
|
|
2296
|
+
readonly expectedRevision?: number;
|
|
2297
|
+
/** For `StaleDocument`: the revision the document was actually at. */
|
|
2298
|
+
readonly actualRevision?: number;
|
|
2299
|
+
/**
|
|
2300
|
+
* Debug details, as Office.js `OfficeExtension.Error.debugInfo` has them. `innerError` names
|
|
2301
|
+
* the engine's reason with a stable diagnostic code and a fixed hint, when there is one.
|
|
2302
|
+
*
|
|
2303
|
+
* @example
|
|
2304
|
+
* ```ts
|
|
2305
|
+
* catch (error) {
|
|
2306
|
+
* if (isDocxEditorError(error) && error.debugInfo.innerError) {
|
|
2307
|
+
* console.warn(error.debugInfo.innerError.code, error.debugInfo.innerError.message);
|
|
2308
|
+
* }
|
|
2309
|
+
* }
|
|
2310
|
+
* ```
|
|
2311
|
+
*/
|
|
2312
|
+
readonly debugInfo: DocxEditorDebugInfo;
|
|
2313
|
+
constructor(init: DocxEditorErrorInit);
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* Whether a caught value is one of ours.
|
|
2317
|
+
*
|
|
2318
|
+
* By `name` as well as by `instanceof`: a consumer can end up with two copies of this module
|
|
2319
|
+
* (a bundle plus a dependency's), and an `instanceof` that fails across them would send a
|
|
2320
|
+
* perfectly ordinary `PropertyNotLoaded` down a consumer's unexpected-error path.
|
|
2321
|
+
*/
|
|
2322
|
+
declare function isDocxEditorError(value: unknown): value is DocxEditorError;
|
|
2323
|
+
|
|
2144
2324
|
/** What a `run` callback is given, and what it may answer with. */
|
|
2145
2325
|
type RunCallback<T> = (context: RequestContext) => Promise<T>;
|
|
2146
2326
|
/** Capabilities exposed by a DocxEditor runtime, frozen for its lifetime. */
|
|
@@ -2237,6 +2417,16 @@ interface RuntimeSession {
|
|
|
2237
2417
|
readonly author?: string;
|
|
2238
2418
|
/** Revision view used by standard Office-compatible text reads and searches. */
|
|
2239
2419
|
readonly revisionTextView: RevisionTextView;
|
|
2420
|
+
/**
|
|
2421
|
+
* Told about each refused batch before it is thrown, with the batch's operations. A listener
|
|
2422
|
+
* that throws is ignored.
|
|
2423
|
+
*/
|
|
2424
|
+
readonly onRefusal?: (error: DocxEditorError, operations: readonly AutomationOperation[]) => void;
|
|
2425
|
+
/**
|
|
2426
|
+
* Told about each batch that threw an error other than a refusal, before it propagates: an
|
|
2427
|
+
* engine defect. A listener that throws is ignored.
|
|
2428
|
+
*/
|
|
2429
|
+
readonly onException?: (error: unknown, operations: readonly AutomationOperation[]) => void;
|
|
2240
2430
|
/** Identity for adoption checks. The session object itself. */
|
|
2241
2431
|
readonly id: object;
|
|
2242
2432
|
roots(): RootHandles;
|
|
@@ -2486,138 +2676,6 @@ declare abstract class ClientObject implements RuntimeManagedObject {
|
|
|
2486
2676
|
[REBIND](context: RequestContext): void;
|
|
2487
2677
|
}
|
|
2488
2678
|
|
|
2489
|
-
/** What went wrong, as a value a consumer may branch on. */
|
|
2490
|
-
type DocxEditorErrorCode =
|
|
2491
|
-
/** A property was read before a `load(...)` for it completed in a `sync()`. */
|
|
2492
|
-
'PropertyNotLoaded'
|
|
2493
|
-
/** A `ClientResult` value was read before the sync that fills it. */
|
|
2494
|
-
| 'ValueNotLoaded'
|
|
2495
|
-
/**
|
|
2496
|
-
* The object cannot be addressed, in either of the two ways that happens.
|
|
2497
|
-
*
|
|
2498
|
-
* NOT YET: an item accessor answers a proxy the read that names it has not answered for, and it
|
|
2499
|
-
* becomes usable at the next `sync()`. NOT ANY MORE: its run ended and nothing tracked it, which
|
|
2500
|
-
* is terminal. One code because from a consumer's side both are "this object cannot be used
|
|
2501
|
-
* here"; the message says which one, because the fix for one is not the fix for the other.
|
|
2502
|
-
*/
|
|
2503
|
-
| 'InvalidObjectPath'
|
|
2504
|
-
/** The object still belongs to a run that has not finished, so it cannot be handed over. */
|
|
2505
|
-
| 'ObjectInUse'
|
|
2506
|
-
/** An argument or load option this API does not accept. */
|
|
2507
|
-
| 'InvalidArgument'
|
|
2508
|
-
/** Opening the document exceeded a bounded reader resource limit. */
|
|
2509
|
-
| 'ResourceLimitExceeded'
|
|
2510
|
-
/** The collection has no such item — `getFirst()` on an empty one. */
|
|
2511
|
-
| 'ItemNotFound'
|
|
2512
|
-
/** The host cannot do this at all — a capability it reports false. */
|
|
2513
|
-
| 'NotSupported'
|
|
2514
|
-
/**
|
|
2515
|
-
* The member exists in this API's shape but this version does not implement it.
|
|
2516
|
-
*
|
|
2517
|
-
* Distinct from `NotSupported`, which is about the HOST: a headless document really has no
|
|
2518
|
-
* caret, and no version of this library will give it one. This code means the library, not the
|
|
2519
|
-
* document, is the limit — so a consumer knows to check the release notes rather than the host.
|
|
2520
|
-
*/
|
|
2521
|
-
| 'NotImplemented'
|
|
2522
|
-
/**
|
|
2523
|
-
* Two calls in one batch make claims on the same paragraph that cannot both hold.
|
|
2524
|
-
*
|
|
2525
|
-
* A batch is one transaction planned against the state at its start, which stops being
|
|
2526
|
-
* unambiguous once two calls restructure the same paragraph. Split them across two `sync()`
|
|
2527
|
-
* calls and each gets exactly what it asked for.
|
|
2528
|
-
*/
|
|
2529
|
-
| 'ConflictingChanges'
|
|
2530
|
-
/** The request context's `run` has finished, so it can no longer be used. */
|
|
2531
|
-
| 'InvalidRequestContext'
|
|
2532
|
-
/** The runtime was disposed. Every later operation fails this way. */
|
|
2533
|
-
| 'RuntimeDisposed'
|
|
2534
|
-
/**
|
|
2535
|
-
* The request was built from an older read, so nothing was applied: another writer moved the
|
|
2536
|
-
* document, or a range's text moved since the range was read, including by this context's own
|
|
2537
|
-
* earlier sync. Read again before retrying.
|
|
2538
|
-
*/
|
|
2539
|
-
| 'StaleDocument'
|
|
2540
|
-
/** The host is live but holds no document right now — an editor between mounts. */
|
|
2541
|
-
| 'DocumentUnavailable'
|
|
2542
|
-
/** The document refused the change, or answered something this runtime cannot use. */
|
|
2543
|
-
| 'GeneralException';
|
|
2544
|
-
/**
|
|
2545
|
-
* The fields a {@link DocxEditorError} is constructed from.
|
|
2546
|
-
*
|
|
2547
|
-
* @public
|
|
2548
|
-
*/
|
|
2549
|
-
interface DocxEditorErrorInit {
|
|
2550
|
-
/** Which refusal this is. The stable thing to branch on. */
|
|
2551
|
-
readonly code: DocxEditorErrorCode;
|
|
2552
|
-
/** The resource limit exceeded while opening a document. */
|
|
2553
|
-
readonly limit?: 'zip.maxEntries' | 'zip.maxTotalBytes' | 'zip.maxRatio' | 'xml.maxBytes' | 'xml.maxElements' | 'xml.maxDepth' | 'maxXmlParts' | 'maxRelationships';
|
|
2554
|
-
/**
|
|
2555
|
-
* The consumer-facing path of the object or property involved — `document.body.text`, not a
|
|
2556
|
-
* handle. Omitted when there is nothing to name.
|
|
2557
|
-
*/
|
|
2558
|
-
readonly target?: string;
|
|
2559
|
-
/** The revision the context had read at, for `StaleDocument`. */
|
|
2560
|
-
readonly expectedRevision?: number;
|
|
2561
|
-
/** The revision the document was actually at, for `StaleDocument`. */
|
|
2562
|
-
readonly actualRevision?: number;
|
|
2563
|
-
}
|
|
2564
|
-
/**
|
|
2565
|
-
* Every refusal this runtime throws.
|
|
2566
|
-
*
|
|
2567
|
-
* Branch on {@link DocxEditorError.code}, never on the message. Codes are stable public API —
|
|
2568
|
-
* added rather than repurposed — so a consumer that handles `PropertyNotLoaded` by loading and
|
|
2569
|
-
* syncing again keeps working across versions.
|
|
2570
|
-
*
|
|
2571
|
-
* Nothing from the engine appears in the message. Host rejection reasons, opaque handle refs and
|
|
2572
|
-
* offset ranges are all withheld: a ref in a message is a name a consumer can start depending on,
|
|
2573
|
-
* and a store's rejection reason would become a documented one the moment somebody matched on it.
|
|
2574
|
-
* What a consumer gets instead is a stable code, a fixed sentence, and `target` — the
|
|
2575
|
-
* consumer-facing path they wrote themselves.
|
|
2576
|
-
*
|
|
2577
|
-
* @example
|
|
2578
|
-
* ```ts
|
|
2579
|
-
* try {
|
|
2580
|
-
* await context.sync();
|
|
2581
|
-
* } catch (error) {
|
|
2582
|
-
* if (isDocxEditorError(error) && error.code === 'StaleDocument') {
|
|
2583
|
-
* // Re-read, re-anchor, and reconsider: someone else changed the document first.
|
|
2584
|
-
* }
|
|
2585
|
-
* }
|
|
2586
|
-
* ```
|
|
2587
|
-
*
|
|
2588
|
-
* @public
|
|
2589
|
-
*/
|
|
2590
|
-
declare class DocxEditorError extends Error {
|
|
2591
|
-
/** Which refusal this is. Stable across versions; the thing to branch on. */
|
|
2592
|
-
readonly code: DocxEditorErrorCode;
|
|
2593
|
-
/** For `ResourceLimitExceeded`: the resource limit that prevented opening. */
|
|
2594
|
-
readonly limit?: DocxEditorErrorInit['limit'];
|
|
2595
|
-
/** Consumer-facing path of the object or property involved, when there is one to name. */
|
|
2596
|
-
readonly target?: string;
|
|
2597
|
-
/**
|
|
2598
|
-
* For `StaleDocument`: the revision the context had last read at, when the refused batch
|
|
2599
|
-
* wrote. Absent for a batch that only read, on every host.
|
|
2600
|
-
*
|
|
2601
|
-
* When it equals {@link DocxEditorError.actualRevision}, the document is where this context
|
|
2602
|
-
* last saw it, and a range it holds is out of date: an edit after the range was read (often
|
|
2603
|
-
* this context's own earlier sync) moved its text. Search for the text again. When the two
|
|
2604
|
-
* differ, another writer changed the document after this context's last read. Read again
|
|
2605
|
-
* before you decide.
|
|
2606
|
-
*/
|
|
2607
|
-
readonly expectedRevision?: number;
|
|
2608
|
-
/** For `StaleDocument`: the revision the document was actually at. */
|
|
2609
|
-
readonly actualRevision?: number;
|
|
2610
|
-
constructor(init: DocxEditorErrorInit);
|
|
2611
|
-
}
|
|
2612
|
-
/**
|
|
2613
|
-
* Whether a caught value is one of ours.
|
|
2614
|
-
*
|
|
2615
|
-
* By `name` as well as by `instanceof`: a consumer can end up with two copies of this module
|
|
2616
|
-
* (a bundle plus a dependency's), and an `instanceof` that fails across them would send a
|
|
2617
|
-
* perfectly ordinary `PropertyNotLoaded` down a consumer's unexpected-error path.
|
|
2618
|
-
*/
|
|
2619
|
-
declare function isDocxEditorError(value: unknown): value is DocxEditorError;
|
|
2620
|
-
|
|
2621
2679
|
/** Word's shape types. Supported text-bearing shapes expose their own body. @public */
|
|
2622
2680
|
declare enum ShapeType {
|
|
2623
2681
|
unsupported = "Unsupported",
|
|
@@ -2807,6 +2865,47 @@ declare class Body extends ModelObject {
|
|
|
2807
2865
|
interface ServerPaginationOptions extends AutomationPaginationOptions {
|
|
2808
2866
|
}
|
|
2809
2867
|
|
|
2868
|
+
/**
|
|
2869
|
+
* A diagnostic from a headless runtime: the open, and each refused batch.
|
|
2870
|
+
* Each one is also a valid `EditorDiagnostic`, so a telemetry module written for the editor
|
|
2871
|
+
* receives these unchanged.
|
|
2872
|
+
*
|
|
2873
|
+
* @public
|
|
2874
|
+
*/
|
|
2875
|
+
type RuntimeDiagnostic = {
|
|
2876
|
+
readonly schemaVersion: number;
|
|
2877
|
+
/** Random for each runtime and never stored. */
|
|
2878
|
+
readonly editorSessionId: string;
|
|
2879
|
+
readonly time: number;
|
|
2880
|
+
} & ({
|
|
2881
|
+
readonly kind: 'document.open';
|
|
2882
|
+
readonly outcome: 'opened';
|
|
2883
|
+
readonly sizeBucket: ByteSizeBucket;
|
|
2884
|
+
readonly durationMs: number;
|
|
2885
|
+
} | {
|
|
2886
|
+
readonly kind: 'document.open';
|
|
2887
|
+
readonly outcome: 'rejected';
|
|
2888
|
+
readonly code: DocumentOpenDiagnosticCode;
|
|
2889
|
+
readonly sizeBucket?: ByteSizeBucket;
|
|
2890
|
+
/** The engine's own reason. See `diagnosticCauses()`. */
|
|
2891
|
+
readonly cause?: string;
|
|
2892
|
+
/** The role of the part that failed. Never its name. */
|
|
2893
|
+
readonly part?: DocumentPartKind;
|
|
2894
|
+
/** The class of the exception when `cause` is `exception`. */
|
|
2895
|
+
readonly errorName?: DiagnosticErrorName;
|
|
2896
|
+
} | {
|
|
2897
|
+
readonly kind: 'edit.rejected';
|
|
2898
|
+
readonly code: EditDiagnosticCode;
|
|
2899
|
+
readonly origin: 'automation';
|
|
2900
|
+
readonly tracked: boolean;
|
|
2901
|
+
/** The engine's own reason. See `diagnosticCauses()`. */
|
|
2902
|
+
readonly cause?: string;
|
|
2903
|
+
/** The class of the exception when `cause` is `exception`. */
|
|
2904
|
+
readonly errorName?: DiagnosticErrorName;
|
|
2905
|
+
/** `automation` when `cause` is `exception`. */
|
|
2906
|
+
readonly stage?: 'automation';
|
|
2907
|
+
});
|
|
2908
|
+
|
|
2810
2909
|
/**
|
|
2811
2910
|
* Capability module accepted by {@link createServer}. Collaboration attaches
|
|
2812
2911
|
* through a collaboration contribution. Other contributions are ignored here.
|
|
@@ -2816,6 +2915,11 @@ interface ServerPaginationOptions extends AutomationPaginationOptions {
|
|
|
2816
2915
|
interface EditorModule {
|
|
2817
2916
|
readonly id: string;
|
|
2818
2917
|
readonly collaboration?: CollaborationModuleContribution;
|
|
2918
|
+
/**
|
|
2919
|
+
* Told about this runtime's anonymous diagnostics: the open, and each refused batch with a
|
|
2920
|
+
* known reason. A telemetry module's listener fits here unchanged.
|
|
2921
|
+
*/
|
|
2922
|
+
readonly onDiagnostic?: (event: RuntimeDiagnostic) => void;
|
|
2819
2923
|
}
|
|
2820
2924
|
/** Resource limits for the DOCX archive. */
|
|
2821
2925
|
interface DocumentZipLimits {
|
|
@@ -2869,7 +2973,9 @@ interface CreateServerOptions {
|
|
|
2869
2973
|
readonly pagination?: ServerPaginationOptions;
|
|
2870
2974
|
/**
|
|
2871
2975
|
* Capability modules to register. Collaboration attaches only through a
|
|
2872
|
-
* collaboration contribution on this list.
|
|
2976
|
+
* collaboration contribution on this list. A module with `onDiagnostic`, such as a telemetry
|
|
2977
|
+
* module, receives the anonymous diagnostics of this runtime: the open, and each refused
|
|
2978
|
+
* batch with a known reason.
|
|
2873
2979
|
*/
|
|
2874
2980
|
readonly modules?: readonly EditorModule[];
|
|
2875
2981
|
/**
|
|
@@ -2898,5 +3004,5 @@ interface CreateServerOptions {
|
|
|
2898
3004
|
/** Options for {@link createCollaborative}. @public */
|
|
2899
3005
|
type CreateCollaborativeOptions = CreateServerOptions;
|
|
2900
3006
|
|
|
2901
|
-
export { Alignment as A, DocxEditorError as
|
|
2902
|
-
export type {
|
|
3007
|
+
export { NoteItem as $, Alignment as A, DocxEditorError as F, Field as L, FieldCollection as M, FieldType as N, Font as P, InlinePicture as R, InlinePictureCollection as S, InsertLocation as T, List as U, ListBullet as V, ListCollection as W, ListItem as X, ListNumbering as Y, NoteItemCollection as a0, PageOrientation as a2, PageSetup as a3, Paragraph as a4, ParagraphCollection as a6, Range as a9, TrackedObjects as aA, UnderlineType as aB, VerticalAlignment as aC, isDocxEditorError as aD, RangeCollection as aa, RemoveDocInfoType as ac, RequestContext as ad, Revision as ae, RevisionCollection as ah, Section as an, SectionCollection as ao, Shape as ar, ShapeCollection as as, ShapeType as at, Table as au, TableCell as av, TableCellCollection as aw, TableCollection as ax, TableRow as ay, TableRowCollection as az, Body as b, Bookmark as e, BookmarkCollection as f, BreakType as g, ChangeTrackingMode as h, ClientObject as i, ClientResult as j, Comment as k, CommentCollection as l, CommentReply as m, CommentReplyCollection as n, ContentControl as o, ContentControlCollection as p, ContentControlType as s, Document as u, DocumentProperties as x };
|
|
3008
|
+
export type { BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocxEditorDebugInfo as E, DocxEditorErrorCode as G, DocxEditorErrorInit as H, DocxEditorInnerError as I, DocxEditorRuntime as J, EditorModule as K, FieldTypeLiteral as O, HeaderFooterType as Q, LoadOption as Z, LoadQueryOptions as _, CreateCollaborativeOptions as a, NoteItemType as a1, ParagraphAlignment as a5, ParagraphInsertTextLocation as a7, ParagraphReadingOrder as a8, RangeInsertTextLocation as ab, RevisionAuthorOptions as af, RevisionAuthorSelection as ag, RevisionTextView as ai, RevisionType as aj, RunCallback as ak, RuntimeDiagnostic as al, SearchOptions as am, SelectionMode as ap, ServerPaginationOptions as aq, BodyInsertParagraphLocation as c, BodyInsertTextLocation as d, ContentControlLockState as q, ContentControlSubtype as r, ContentControlValue as t, DocumentCapabilities as v, DocumentLimits as w, DocumentXmlLimits as y, DocumentZipLimits as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/editor-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.30.0",
|
|
4
4
|
"description": "Document automation for DOCX: a batching object model that drives a document from a server or from an editor already open in a page",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"engines": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
],
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "node ../../scripts/check-built-siblings.mjs && tsup && node ../../scripts/inject-package-doc.mjs --package @docx-editor.dev/editor-api",
|
|
49
|
-
"typecheck": "
|
|
49
|
+
"typecheck": "bun check",
|
|
50
50
|
"license:check": "license-check-and-add check -f license-check.json",
|
|
51
51
|
"license:add": "license-check-and-add add -f license-check.json",
|
|
52
52
|
"api:extract": "node ../../scripts/api-extractor.mjs --package @docx-editor.dev/editor-api --local",
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@docx-editor.dev/core": "~2.
|
|
86
|
+
"@docx-editor.dev/core": "~2.30.0"
|
|
87
87
|
}
|
|
88
88
|
}
|