superdoc 2.13.0-next.1 → 2.13.0-next.2

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.
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.13.0-next.1",
22
+ superdocVersion: "2.13.0-next.2",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.13.0-next.1",
21
+ superdocVersion: "2.13.0-next.2",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -2012,7 +2012,7 @@ export type InvokeRequest<T extends OperationId> = OperationRegistry[T]['options
2012
2012
  /**
2013
2013
  * Typed invoke result, narrowed by operationId.
2014
2014
  */
2015
- export type InvokeResult<T extends OperationId> = OperationRegistry[T]['output'];
2015
+ export type InvokeResult<T extends OperationId> = T extends 'mutations.preview' | 'mutations.apply' ? Promise<OperationRegistry[T]['output']> : T extends 'plan.execute' ? OperationRegistry[T]['output'] | Promise<OperationRegistry[T]['output']> : OperationRegistry[T]['output'];
2016
2016
  /**
2017
2017
  * Loose invoke request for dynamic callers who don't know the operation at compile time.
2018
2018
  * Invalid inputs will produce adapter-level errors, not input-validation errors.
@@ -36,7 +36,7 @@ import { CapabilitiesAdapter, DocumentApiCapabilities } from './capabilities/cap
36
36
  import { SDHtmlMarkdownSupportCheckInput, SDHtmlMarkdownSupportCheckResult } from './capabilities/html-markdown-support.js';
37
37
  import { OperationId } from './contract/types.js';
38
38
  import { DynamicInvokeRequest, InvokeRequest, InvokeResult } from './contract/operation-registry.js';
39
- import { PlanApi } from './plan/plan.js';
39
+ import { PlanApi, PlanExecuteResult } from './plan/plan.js';
40
40
  import { HistoryAdapter, HistoryApi } from './history/history.js';
41
41
  import { DiffAdapter, DiffApi } from './diff/diff.js';
42
42
  import { ExportAdapter, ExportApi } from './export/export.js';
@@ -242,8 +242,8 @@ export interface QueryApi {
242
242
  match(input: QueryMatchInput | TextSelector | NodeSelector): QueryMatchOutput;
243
243
  }
244
244
  export interface MutationsApi {
245
- preview(input: MutationsPreviewInput): MutationsPreviewOutput;
246
- apply(input: MutationsApplyInput): PlanReceipt;
245
+ preview(input: MutationsPreviewInput): Promise<MutationsPreviewOutput>;
246
+ apply(input: MutationsApplyInput): Promise<PlanReceipt>;
247
247
  }
248
248
  export interface RangesApi {
249
249
  resolve(input: ResolveRangeInput): ResolveRangeOutput;
@@ -255,8 +255,8 @@ export interface QueryAdapter {
255
255
  match(input: QueryMatchInput): QueryMatchOutput;
256
256
  }
257
257
  export interface MutationsAdapter {
258
- preview(input: MutationsPreviewInput): MutationsPreviewOutput;
259
- apply(input: MutationsApplyInput): PlanReceipt;
258
+ preview(input: MutationsPreviewInput): Promise<MutationsPreviewOutput>;
259
+ apply(input: MutationsApplyInput): Promise<PlanReceipt>;
260
260
  }
261
261
  /**
262
262
  * The Document API interface for querying and inspecting document nodes.
@@ -460,7 +460,7 @@ export interface DocumentApi {
460
460
  /**
461
461
  * Throughput-oriented batch executor with stepwise operation semantics.
462
462
  */
463
- plan: PlanApi;
463
+ plan: PlanApi<PlanExecuteResult | Promise<PlanExecuteResult>>;
464
464
  /**
465
465
  * Snapshot-based document comparison and replay.
466
466
  */
@@ -1,7 +1,8 @@
1
1
  import { OperationId } from '../contract/types.js';
2
2
  import { OperationRegistry } from '../contract/operation-registry.js';
3
3
  import { DocumentApi } from '../index.js';
4
- type TypedDispatchHandler<K extends OperationId> = OperationRegistry[K]['options'] extends never ? (input: OperationRegistry[K]['input']) => OperationRegistry[K]['output'] : (input: OperationRegistry[K]['input'], options?: OperationRegistry[K]['options']) => OperationRegistry[K]['output'];
4
+ type DispatchOutput<K extends OperationId> = K extends 'mutations.preview' | 'mutations.apply' ? Promise<OperationRegistry[K]['output']> : K extends 'plan.execute' ? OperationRegistry[K]['output'] | Promise<OperationRegistry[K]['output']> : OperationRegistry[K]['output'];
5
+ type TypedDispatchHandler<K extends OperationId> = OperationRegistry[K]['options'] extends never ? (input: OperationRegistry[K]['input']) => DispatchOutput<K> : (input: OperationRegistry[K]['input'], options?: OperationRegistry[K]['options']) => DispatchOutput<K>;
5
6
  export type TypedDispatchTable = {
6
7
  [K in OperationId]: TypedDispatchHandler<K>;
7
8
  };
@@ -66,6 +66,10 @@ export type TextRewriteStep = {
66
66
  where: StepWhere;
67
67
  args: {
68
68
  replacement: ReplacementPayload;
69
+ /** Interpret positional `$1`…`$99` and `$&` tokens for regex matches. */
70
+ replacementMode?: 'literal' | 'regex-template';
71
+ /** Preserve the matched text's casing pattern instead of using replacement casing verbatim. */
72
+ caseHandling?: 'exact' | 'preserve-match';
69
73
  /**
70
74
  * Style policy for the replacement text.
71
75
  * When omitted, defaults to preserve mode:
@@ -157,10 +161,18 @@ export type MutationsPreviewInput = {
157
161
  atomic: true;
158
162
  changeMode: ChangeMode;
159
163
  steps: MutationStep[];
164
+ /** Optional page over verbose resolved-target details. Defaults to the first 100 targets. */
165
+ detail?: {
166
+ offset?: number;
167
+ limit?: number;
168
+ };
160
169
  };
161
170
  /** Maximum number of steps per mutation plan. */
162
171
  export declare const MAX_PLAN_STEPS = 200;
163
- /** Maximum total resolved targets across all steps in a plan. */
172
+ /**
173
+ * @deprecated Historical compatibility metadata. Text replacement no longer
174
+ * enforces this value; callers must not treat it as a supported target limit.
175
+ */
164
176
  export declare const MAX_PLAN_RESOLVED_TARGETS = 500;
165
177
  export type StepEffect = 'changed' | 'noop' | 'error' | 'assert_passed' | 'assert_failed';
166
178
  /** Resolution for a single-block (range) target. */
@@ -189,9 +201,14 @@ export type SelectionStepResolution = {
189
201
  };
190
202
  export type TextStepData = {
191
203
  domain: 'text';
192
- resolutions: TextStepResolution[];
193
- spanResolutions?: SpanStepResolution[];
194
- selectionResolutions?: SelectionStepResolution[];
204
+ /** Exact number of targets selected from the step's input revision. */
205
+ matchedCount: number;
206
+ /** Exact number of targets whose content changed. */
207
+ changedCount: number;
208
+ /** Exact number of targets already equal to their requested replacement. */
209
+ noopCount: number;
210
+ /** Exact number of tracked-change identities authored by this step. */
211
+ trackedChangeCount: number;
195
212
  };
196
213
  export type AssertStepData = {
197
214
  domain: 'assert';
@@ -247,7 +264,14 @@ export type PreviewFailure = {
247
264
  export type StepPreview = {
248
265
  stepId: string;
249
266
  op: string;
267
+ /** Exact number of targets resolved for this step. */
268
+ matchCount?: number;
250
269
  resolutions?: TextStepResolution[];
270
+ detailPage?: {
271
+ offset: number;
272
+ limit: number;
273
+ returned: number;
274
+ };
251
275
  spanResolutions?: SpanStepResolution[];
252
276
  selectionResolutions?: SelectionStepResolution[];
253
277
  style?: unknown;
package/dist/superdoc.cjs CHANGED
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
316
316
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
317
317
  function getSuperdocVersion() {
318
318
  try {
319
- return "2.13.0-next.1";
319
+ return "2.13.0-next.2";
320
320
  } catch {
321
321
  return "unknown";
322
322
  }
@@ -45356,7 +45356,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
45356
45356
  this.config.colors = shuffleArray(this.config.colors);
45357
45357
  this.userColorMap = /* @__PURE__ */ new Map();
45358
45358
  this.colorIndex = 0;
45359
- this.version = "2.13.0-next.1";
45359
+ this.version = "2.13.0-next.2";
45360
45360
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
45361
45361
  this.superdocId = config.superdocId || require_uuid.v4();
45362
45362
  this.colors = this.config.colors ?? [];
@@ -315,7 +315,7 @@ var shuffleArray = (array) => {
315
315
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
316
316
  function getSuperdocVersion() {
317
317
  try {
318
- return "2.13.0-next.1";
318
+ return "2.13.0-next.2";
319
319
  } catch {
320
320
  return "unknown";
321
321
  }
@@ -45287,7 +45287,7 @@ var SuperDoc = class extends import_eventemitter3.default {
45287
45287
  this.config.colors = shuffleArray(this.config.colors);
45288
45288
  this.userColorMap = /* @__PURE__ */ new Map();
45289
45289
  this.colorIndex = 0;
45290
- this.version = "2.13.0-next.1";
45290
+ this.version = "2.13.0-next.2";
45291
45291
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
45292
45292
  this.superdocId = config.superdocId || v4();
45293
45293
  this.colors = this.config.colors ?? [];