@superdoc-dev/cli 0.12.0-next.1 → 0.12.0-next.5
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/index.js +371 -141
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -2368,7 +2368,7 @@ More content with **bold** and *italic*.`
|
|
|
2368
2368
|
},
|
|
2369
2369
|
"format.paragraph.setAlignment": {
|
|
2370
2370
|
memberPath: "format.paragraph.setAlignment",
|
|
2371
|
-
description: "Set paragraph alignment
|
|
2371
|
+
description: "Set visual paragraph alignment on a paragraph-like block. For RTL paragraphs, left/right are translated to Word-compatible stored justification values.",
|
|
2372
2372
|
expectedResult: "Returns a ParagraphMutationResult; reports NO_OP if the alignment already matches.",
|
|
2373
2373
|
requiresDocumentContext: true,
|
|
2374
2374
|
metadata: mutationOperation({
|
|
@@ -10405,10 +10405,13 @@ var init_schemas = __esm(() => {
|
|
|
10405
10405
|
failure: paragraphMutationFailureSchemaFor("format.paragraph.resetDirectFormatting")
|
|
10406
10406
|
},
|
|
10407
10407
|
"format.paragraph.setAlignment": {
|
|
10408
|
-
input: objectSchema({
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10408
|
+
input: objectSchema({
|
|
10409
|
+
target: paragraphTargetSchema,
|
|
10410
|
+
alignment: {
|
|
10411
|
+
enum: [...PARAGRAPH_ALIGNMENTS],
|
|
10412
|
+
description: "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
|
|
10413
|
+
}
|
|
10414
|
+
}, ["target", "alignment"]),
|
|
10412
10415
|
output: paragraphMutationResultSchemaFor("format.paragraph.setAlignment"),
|
|
10413
10416
|
success: paragraphMutationSuccessSchema,
|
|
10414
10417
|
failure: paragraphMutationFailureSchemaFor("format.paragraph.setAlignment")
|
|
@@ -29179,6 +29182,212 @@ var init_y_websocket = __esm(() => {
|
|
|
29179
29182
|
};
|
|
29180
29183
|
});
|
|
29181
29184
|
|
|
29185
|
+
// src/lib/collaboration/diagnostics.ts
|
|
29186
|
+
function isSensitiveDiagnosticKey(key) {
|
|
29187
|
+
const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
29188
|
+
if (!normalized)
|
|
29189
|
+
return false;
|
|
29190
|
+
return normalized === "key" || normalized === "apikey" || normalized === "authorization" || normalized.includes("token") || normalized.includes("auth") || normalized.includes("secret") || normalized.includes("password") || normalized.includes("credential");
|
|
29191
|
+
}
|
|
29192
|
+
function sanitizeUrlCandidate(value) {
|
|
29193
|
+
try {
|
|
29194
|
+
const parsed = new URL(value);
|
|
29195
|
+
for (const key of Array.from(parsed.searchParams.keys())) {
|
|
29196
|
+
if (isSensitiveDiagnosticKey(key)) {
|
|
29197
|
+
parsed.searchParams.set(key, REDACTED);
|
|
29198
|
+
}
|
|
29199
|
+
}
|
|
29200
|
+
return parsed.toString();
|
|
29201
|
+
} catch {
|
|
29202
|
+
return value;
|
|
29203
|
+
}
|
|
29204
|
+
}
|
|
29205
|
+
function sanitizeDiagnosticString(value) {
|
|
29206
|
+
const withSanitizedUrls = value.replace(/\b(?:wss?|https?):\/\/[^\s"'<>]+/gi, sanitizeUrlCandidate);
|
|
29207
|
+
return withSanitizedUrls.replace(/([?&])([^=&#\s"']+)=([^&#\s"']*)/g, (match, prefix, key) => {
|
|
29208
|
+
let decodedKey;
|
|
29209
|
+
try {
|
|
29210
|
+
decodedKey = decodeURIComponent(key.replace(/\+/g, " "));
|
|
29211
|
+
} catch {
|
|
29212
|
+
decodedKey = key;
|
|
29213
|
+
}
|
|
29214
|
+
if (!isSensitiveDiagnosticKey(decodedKey))
|
|
29215
|
+
return match;
|
|
29216
|
+
return `${prefix}${key}=${REDACTED}`;
|
|
29217
|
+
});
|
|
29218
|
+
}
|
|
29219
|
+
function summarizeError(error) {
|
|
29220
|
+
return {
|
|
29221
|
+
name: sanitizeDiagnosticString(error.name),
|
|
29222
|
+
message: sanitizeDiagnosticString(error.message)
|
|
29223
|
+
};
|
|
29224
|
+
}
|
|
29225
|
+
function isRecord4(value) {
|
|
29226
|
+
return !!value && typeof value === "object";
|
|
29227
|
+
}
|
|
29228
|
+
function summarizeEventLike(value) {
|
|
29229
|
+
if ("code" in value && "reason" in value && "wasClean" in value) {
|
|
29230
|
+
return {
|
|
29231
|
+
code: typeof value.code === "number" ? value.code : undefined,
|
|
29232
|
+
reason: sanitizeDiagnosticString(String(value.reason ?? "")),
|
|
29233
|
+
wasClean: Boolean(value.wasClean)
|
|
29234
|
+
};
|
|
29235
|
+
}
|
|
29236
|
+
if ("message" in value && "type" in value) {
|
|
29237
|
+
return {
|
|
29238
|
+
type: sanitizeDiagnosticString(String(value.type ?? "")),
|
|
29239
|
+
message: sanitizeDiagnosticString(String(value.message ?? ""))
|
|
29240
|
+
};
|
|
29241
|
+
}
|
|
29242
|
+
return null;
|
|
29243
|
+
}
|
|
29244
|
+
function sanitizeDiagnosticValue(value, depth = 0) {
|
|
29245
|
+
if (value == null)
|
|
29246
|
+
return value;
|
|
29247
|
+
if (typeof value === "string")
|
|
29248
|
+
return sanitizeDiagnosticString(value);
|
|
29249
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
29250
|
+
return value;
|
|
29251
|
+
if (typeof value === "bigint")
|
|
29252
|
+
return value.toString();
|
|
29253
|
+
if (value instanceof Error)
|
|
29254
|
+
return summarizeError(value);
|
|
29255
|
+
if (depth >= MAX_OBJECT_DEPTH)
|
|
29256
|
+
return "[Truncated]";
|
|
29257
|
+
if (Array.isArray(value)) {
|
|
29258
|
+
return value.map((entry) => sanitizeDiagnosticValue(entry, depth + 1));
|
|
29259
|
+
}
|
|
29260
|
+
if (!isRecord4(value)) {
|
|
29261
|
+
return Object.prototype.toString.call(value);
|
|
29262
|
+
}
|
|
29263
|
+
const eventSummary = summarizeEventLike(value);
|
|
29264
|
+
if (eventSummary)
|
|
29265
|
+
return eventSummary;
|
|
29266
|
+
const output = {};
|
|
29267
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
29268
|
+
if (typeof entry === "function" || typeof entry === "symbol" || typeof entry === "undefined")
|
|
29269
|
+
continue;
|
|
29270
|
+
output[key] = sanitizeDiagnosticValue(entry, depth + 1);
|
|
29271
|
+
}
|
|
29272
|
+
return output;
|
|
29273
|
+
}
|
|
29274
|
+
function sanitizeProviderState(provider) {
|
|
29275
|
+
const record = provider;
|
|
29276
|
+
return sanitizeDiagnosticValue({
|
|
29277
|
+
synced: record.synced,
|
|
29278
|
+
isSynced: record.isSynced,
|
|
29279
|
+
status: record.status,
|
|
29280
|
+
wsconnected: record.wsconnected,
|
|
29281
|
+
wsconnecting: record.wsconnecting,
|
|
29282
|
+
shouldConnect: record.shouldConnect
|
|
29283
|
+
});
|
|
29284
|
+
}
|
|
29285
|
+
function firstUsefulArg(args2) {
|
|
29286
|
+
return args2[0];
|
|
29287
|
+
}
|
|
29288
|
+
function attachProviderDiagnostics(provider, context) {
|
|
29289
|
+
const eventCounts = {};
|
|
29290
|
+
const cleanup = [];
|
|
29291
|
+
let lastStatus;
|
|
29292
|
+
let lastConnectionError;
|
|
29293
|
+
let lastConnectionClose;
|
|
29294
|
+
let lastClose;
|
|
29295
|
+
let lastDisconnect;
|
|
29296
|
+
let lastAuthenticationFailed;
|
|
29297
|
+
let detached = false;
|
|
29298
|
+
const capture = (eventName, args2) => {
|
|
29299
|
+
eventCounts[eventName] = (eventCounts[eventName] ?? 0) + 1;
|
|
29300
|
+
const payload = firstUsefulArg(args2);
|
|
29301
|
+
if (eventName === "connection-close" && payload == null)
|
|
29302
|
+
return;
|
|
29303
|
+
const sanitizedPayload = sanitizeDiagnosticValue(payload);
|
|
29304
|
+
switch (eventName) {
|
|
29305
|
+
case "status":
|
|
29306
|
+
lastStatus = sanitizedPayload;
|
|
29307
|
+
break;
|
|
29308
|
+
case "connection-error":
|
|
29309
|
+
lastConnectionError = sanitizedPayload;
|
|
29310
|
+
break;
|
|
29311
|
+
case "connection-close":
|
|
29312
|
+
lastConnectionClose = sanitizedPayload;
|
|
29313
|
+
break;
|
|
29314
|
+
case "close":
|
|
29315
|
+
lastClose = sanitizedPayload;
|
|
29316
|
+
break;
|
|
29317
|
+
case "disconnect":
|
|
29318
|
+
lastDisconnect = sanitizedPayload;
|
|
29319
|
+
break;
|
|
29320
|
+
case "authenticationFailed":
|
|
29321
|
+
lastAuthenticationFailed = sanitizedPayload;
|
|
29322
|
+
break;
|
|
29323
|
+
}
|
|
29324
|
+
};
|
|
29325
|
+
const subscribe3 = (eventName) => {
|
|
29326
|
+
if (!provider.on)
|
|
29327
|
+
return;
|
|
29328
|
+
try {
|
|
29329
|
+
const handler = (...args2) => capture(eventName, args2);
|
|
29330
|
+
provider.on(eventName, handler);
|
|
29331
|
+
cleanup.push(() => {
|
|
29332
|
+
try {
|
|
29333
|
+
provider.off?.(eventName, handler);
|
|
29334
|
+
} catch {}
|
|
29335
|
+
});
|
|
29336
|
+
} catch {}
|
|
29337
|
+
};
|
|
29338
|
+
for (const eventName of [
|
|
29339
|
+
"status",
|
|
29340
|
+
"sync",
|
|
29341
|
+
"synced",
|
|
29342
|
+
"connection-error",
|
|
29343
|
+
"connection-close",
|
|
29344
|
+
"close",
|
|
29345
|
+
"disconnect",
|
|
29346
|
+
"authenticationFailed",
|
|
29347
|
+
"authenticated"
|
|
29348
|
+
]) {
|
|
29349
|
+
subscribe3(eventName);
|
|
29350
|
+
}
|
|
29351
|
+
return {
|
|
29352
|
+
toTimeoutDetails(providerForSnapshot, timeoutMs, elapsedMs) {
|
|
29353
|
+
const details = {
|
|
29354
|
+
timeoutMs,
|
|
29355
|
+
elapsedMs,
|
|
29356
|
+
providerType: context.providerType,
|
|
29357
|
+
url: sanitizeDiagnosticString(context.url),
|
|
29358
|
+
documentId: sanitizeDiagnosticString(context.documentId),
|
|
29359
|
+
tokenEnvConfigured: context.tokenEnvConfigured,
|
|
29360
|
+
authTokenResolved: context.authTokenResolved,
|
|
29361
|
+
paramsKeys: [...context.paramsKeys],
|
|
29362
|
+
eventCounts: { ...eventCounts },
|
|
29363
|
+
providerState: sanitizeProviderState(providerForSnapshot)
|
|
29364
|
+
};
|
|
29365
|
+
if (lastStatus !== undefined)
|
|
29366
|
+
details.lastStatus = lastStatus;
|
|
29367
|
+
if (lastConnectionError !== undefined)
|
|
29368
|
+
details.lastConnectionError = lastConnectionError;
|
|
29369
|
+
if (lastConnectionClose !== undefined)
|
|
29370
|
+
details.lastConnectionClose = lastConnectionClose;
|
|
29371
|
+
if (lastClose !== undefined)
|
|
29372
|
+
details.lastClose = lastClose;
|
|
29373
|
+
if (lastDisconnect !== undefined)
|
|
29374
|
+
details.lastDisconnect = lastDisconnect;
|
|
29375
|
+
if (lastAuthenticationFailed !== undefined)
|
|
29376
|
+
details.lastAuthenticationFailed = lastAuthenticationFailed;
|
|
29377
|
+
return details;
|
|
29378
|
+
},
|
|
29379
|
+
detach() {
|
|
29380
|
+
if (detached)
|
|
29381
|
+
return;
|
|
29382
|
+
detached = true;
|
|
29383
|
+
for (const run of cleanup.splice(0)) {
|
|
29384
|
+
run();
|
|
29385
|
+
}
|
|
29386
|
+
}
|
|
29387
|
+
};
|
|
29388
|
+
}
|
|
29389
|
+
var REDACTED = "[REDACTED]", MAX_OBJECT_DEPTH = 5;
|
|
29390
|
+
|
|
29182
29391
|
// ../../node_modules/.pnpm/@liveblocks+core@3.15.5_@types+json-schema@7.0.15/node_modules/@liveblocks/core/dist/index.js
|
|
29183
29392
|
function error(msg) {
|
|
29184
29393
|
if (false) {} else {
|
|
@@ -42343,10 +42552,11 @@ var init_liveblocks = __esm(() => {
|
|
|
42343
42552
|
function isSynced(provider) {
|
|
42344
42553
|
return provider.synced === true || provider.isSynced === true;
|
|
42345
42554
|
}
|
|
42346
|
-
function waitForProviderSync(provider, timeoutMs) {
|
|
42555
|
+
function waitForProviderSync(provider, timeoutMs, diagnostics) {
|
|
42347
42556
|
if (isSynced(provider))
|
|
42348
42557
|
return Promise.resolve();
|
|
42349
42558
|
return new Promise((resolve, reject) => {
|
|
42559
|
+
const startedAt = Date.now();
|
|
42350
42560
|
let settled = false;
|
|
42351
42561
|
const cleanup = [];
|
|
42352
42562
|
const finish = (error3) => {
|
|
@@ -42374,8 +42584,9 @@ function waitForProviderSync(provider, timeoutMs) {
|
|
|
42374
42584
|
cleanup.push(() => provider.off?.("sync", onSync));
|
|
42375
42585
|
}
|
|
42376
42586
|
const timer = setTimeout(() => {
|
|
42587
|
+
const elapsedMs = Date.now() - startedAt;
|
|
42377
42588
|
finish(new CliError("COLLABORATION_SYNC_TIMEOUT", `Collaboration sync timed out after ${timeoutMs}ms.`, {
|
|
42378
|
-
timeoutMs
|
|
42589
|
+
...diagnostics?.toTimeoutDetails(provider, timeoutMs, elapsedMs) ?? { timeoutMs }
|
|
42379
42590
|
}));
|
|
42380
42591
|
}, timeoutMs);
|
|
42381
42592
|
cleanup.push(() => clearTimeout(timer));
|
|
@@ -42412,11 +42623,20 @@ function createWebSocketRuntime(profile) {
|
|
|
42412
42623
|
preserveConnection: false
|
|
42413
42624
|
});
|
|
42414
42625
|
}
|
|
42626
|
+
const diagnostics = attachProviderDiagnostics(provider, {
|
|
42627
|
+
providerType: profile.providerType,
|
|
42628
|
+
url: profile.url,
|
|
42629
|
+
documentId: profile.documentId,
|
|
42630
|
+
tokenEnvConfigured: Boolean(profile.tokenEnv),
|
|
42631
|
+
authTokenResolved: Boolean(token),
|
|
42632
|
+
paramsKeys: Object.keys(profile.params ?? {})
|
|
42633
|
+
});
|
|
42415
42634
|
return {
|
|
42416
42635
|
ydoc,
|
|
42417
42636
|
provider,
|
|
42418
|
-
waitForSync: () => waitForProviderSync(provider, syncTimeoutMs),
|
|
42637
|
+
waitForSync: () => waitForProviderSync(provider, syncTimeoutMs, diagnostics),
|
|
42419
42638
|
dispose() {
|
|
42639
|
+
diagnostics?.detach();
|
|
42420
42640
|
provider.disconnect?.();
|
|
42421
42641
|
provider.destroy?.();
|
|
42422
42642
|
ydoc.destroy();
|
|
@@ -66558,7 +66778,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
66558
66778
|
emptyOptions2 = {};
|
|
66559
66779
|
});
|
|
66560
66780
|
|
|
66561
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
66781
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-UqLu6KQU.es.js
|
|
66562
66782
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
66563
66783
|
const fieldValue = extension$1.config[field];
|
|
66564
66784
|
if (typeof fieldValue === "function")
|
|
@@ -67413,28 +67633,28 @@ function assertTargetPresent2(target, operationName) {
|
|
|
67413
67633
|
if (target === undefined || target === null)
|
|
67414
67634
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} requires a target.`);
|
|
67415
67635
|
}
|
|
67416
|
-
function
|
|
67636
|
+
function isRecord5(value) {
|
|
67417
67637
|
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
67418
67638
|
}
|
|
67419
67639
|
function isInteger3(value) {
|
|
67420
67640
|
return typeof value === "number" && Number.isInteger(value);
|
|
67421
67641
|
}
|
|
67422
67642
|
function isTextAddress2(value) {
|
|
67423
|
-
if (!
|
|
67643
|
+
if (!isRecord5(value))
|
|
67424
67644
|
return false;
|
|
67425
67645
|
if (value.kind !== "text")
|
|
67426
67646
|
return false;
|
|
67427
67647
|
if (typeof value.blockId !== "string")
|
|
67428
67648
|
return false;
|
|
67429
67649
|
const range = value.range;
|
|
67430
|
-
if (!
|
|
67650
|
+
if (!isRecord5(range))
|
|
67431
67651
|
return false;
|
|
67432
67652
|
if (!isInteger3(range.start) || !isInteger3(range.end))
|
|
67433
67653
|
return false;
|
|
67434
67654
|
return range.start <= range.end;
|
|
67435
67655
|
}
|
|
67436
67656
|
function isTextTarget2(value) {
|
|
67437
|
-
if (!
|
|
67657
|
+
if (!isRecord5(value))
|
|
67438
67658
|
return false;
|
|
67439
67659
|
if (value.kind !== "text")
|
|
67440
67660
|
return false;
|
|
@@ -67442,12 +67662,12 @@ function isTextTarget2(value) {
|
|
|
67442
67662
|
if (!Array.isArray(segments) || segments.length === 0)
|
|
67443
67663
|
return false;
|
|
67444
67664
|
for (const seg of segments) {
|
|
67445
|
-
if (!
|
|
67665
|
+
if (!isRecord5(seg))
|
|
67446
67666
|
return false;
|
|
67447
67667
|
if (typeof seg.blockId !== "string")
|
|
67448
67668
|
return false;
|
|
67449
67669
|
const range = seg.range;
|
|
67450
|
-
if (!
|
|
67670
|
+
if (!isRecord5(range))
|
|
67451
67671
|
return false;
|
|
67452
67672
|
if (!isInteger3(range.start) || !isInteger3(range.end))
|
|
67453
67673
|
return false;
|
|
@@ -67457,7 +67677,7 @@ function isTextTarget2(value) {
|
|
|
67457
67677
|
return true;
|
|
67458
67678
|
}
|
|
67459
67679
|
function isBlockNodeAddress2(value) {
|
|
67460
|
-
if (!
|
|
67680
|
+
if (!isRecord5(value))
|
|
67461
67681
|
return false;
|
|
67462
67682
|
if (value.kind !== "block")
|
|
67463
67683
|
return false;
|
|
@@ -67475,7 +67695,7 @@ function assertNoUnknownFields3(input, allowlist, operationName) {
|
|
|
67475
67695
|
function validateNestingPolicyValue2(value) {
|
|
67476
67696
|
if (value === undefined)
|
|
67477
67697
|
return;
|
|
67478
|
-
if (!
|
|
67698
|
+
if (!isRecord5(value))
|
|
67479
67699
|
throw new DocumentApiValidationError2("INVALID_INPUT", `nestingPolicy must be an object, got ${typeof value}.`, {
|
|
67480
67700
|
field: "nestingPolicy",
|
|
67481
67701
|
value
|
|
@@ -67504,7 +67724,7 @@ function runAttributeCarrier2(runPropertyKey) {
|
|
|
67504
67724
|
};
|
|
67505
67725
|
}
|
|
67506
67726
|
function isObjectPatch2(value) {
|
|
67507
|
-
return
|
|
67727
|
+
return isRecord5(value) && !Array.isArray(value);
|
|
67508
67728
|
}
|
|
67509
67729
|
function assertNonEmptyObject2(value, propertyKey) {
|
|
67510
67730
|
if (Object.keys(value).length === 0)
|
|
@@ -67694,12 +67914,12 @@ function executeWrite2(adapter, request, options) {
|
|
|
67694
67914
|
return adapter.write(request, normalizeMutationOptions2(options));
|
|
67695
67915
|
}
|
|
67696
67916
|
function assertParagraphTarget2(input, operation) {
|
|
67697
|
-
if (!
|
|
67917
|
+
if (!isRecord5(input))
|
|
67698
67918
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operation} input must be a non-null object.`);
|
|
67699
67919
|
const { target } = input;
|
|
67700
67920
|
if (target === undefined || target === null)
|
|
67701
67921
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operation} requires a target.`);
|
|
67702
|
-
if (!
|
|
67922
|
+
if (!isRecord5(target))
|
|
67703
67923
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operation} target must be an object.`, { field: "target" });
|
|
67704
67924
|
if (target.kind !== "block")
|
|
67705
67925
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operation} target.kind must be 'block'.`, {
|
|
@@ -68191,7 +68411,7 @@ function validateValue2(path2, value, schema) {
|
|
|
68191
68411
|
}
|
|
68192
68412
|
}
|
|
68193
68413
|
function validateObjectValue2(path2, value, children) {
|
|
68194
|
-
if (!
|
|
68414
|
+
if (!isRecord5(value))
|
|
68195
68415
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${path2} must be a non-null object, got ${typeof value}.`, {
|
|
68196
68416
|
field: path2,
|
|
68197
68417
|
value
|
|
@@ -68219,13 +68439,13 @@ function validateArrayValue2(path2, value, itemSchema) {
|
|
|
68219
68439
|
validateValue2(`${path2}[${i$1}]`, value[i$1], itemSchema);
|
|
68220
68440
|
}
|
|
68221
68441
|
function validateStylesApplyInput2(input) {
|
|
68222
|
-
if (!
|
|
68442
|
+
if (!isRecord5(input))
|
|
68223
68443
|
throw new DocumentApiValidationError2("INVALID_INPUT", "styles.apply input must be a non-null object.");
|
|
68224
68444
|
assertNoUnknownFields$1(input, INPUT_ALLOWED_KEYS2);
|
|
68225
68445
|
const { target, patch } = input;
|
|
68226
68446
|
if (target === undefined || target === null)
|
|
68227
68447
|
throw new DocumentApiValidationError2("INVALID_TARGET", "styles.apply requires a target object.");
|
|
68228
|
-
if (!
|
|
68448
|
+
if (!isRecord5(target))
|
|
68229
68449
|
throw new DocumentApiValidationError2("INVALID_TARGET", "target must be a non-null object.", {
|
|
68230
68450
|
field: "target",
|
|
68231
68451
|
value: target
|
|
@@ -68244,7 +68464,7 @@ function validateStylesApplyInput2(input) {
|
|
|
68244
68464
|
const channel = target.channel;
|
|
68245
68465
|
if (patch === undefined || patch === null)
|
|
68246
68466
|
throw new DocumentApiValidationError2("INVALID_INPUT", "styles.apply requires a patch object.");
|
|
68247
|
-
if (!
|
|
68467
|
+
if (!isRecord5(patch))
|
|
68248
68468
|
throw new DocumentApiValidationError2("INVALID_INPUT", "patch must be a non-null object.", {
|
|
68249
68469
|
field: "patch",
|
|
68250
68470
|
value: patch
|
|
@@ -68283,7 +68503,7 @@ function validateStylesApplyInput2(input) {
|
|
|
68283
68503
|
function validateStylesApplyOptions2(options) {
|
|
68284
68504
|
if (options === undefined || options === null)
|
|
68285
68505
|
return;
|
|
68286
|
-
if (!
|
|
68506
|
+
if (!isRecord5(options))
|
|
68287
68507
|
throw new DocumentApiValidationError2("INVALID_INPUT", "styles.apply options must be a non-null object.");
|
|
68288
68508
|
for (const key of Object.keys(options))
|
|
68289
68509
|
if (!OPTIONS_ALLOWED_KEYS2.has(key))
|
|
@@ -69137,7 +69357,7 @@ function derivePropertyStateFromDirect2(direct) {
|
|
|
69137
69357
|
}
|
|
69138
69358
|
}
|
|
69139
69359
|
function isSelectionEdgeNodeAddress2(value) {
|
|
69140
|
-
if (!
|
|
69360
|
+
if (!isRecord5(value))
|
|
69141
69361
|
return false;
|
|
69142
69362
|
if (value.kind !== "block")
|
|
69143
69363
|
return false;
|
|
@@ -69148,7 +69368,7 @@ function isSelectionEdgeNodeAddress2(value) {
|
|
|
69148
69368
|
return true;
|
|
69149
69369
|
}
|
|
69150
69370
|
function isSelectionPoint2(value) {
|
|
69151
|
-
if (!
|
|
69371
|
+
if (!isRecord5(value))
|
|
69152
69372
|
return false;
|
|
69153
69373
|
if (value.kind === "text")
|
|
69154
69374
|
return typeof value.blockId === "string" && value.blockId !== "" && isInteger3(value.offset) && value.offset >= 0;
|
|
@@ -69157,7 +69377,7 @@ function isSelectionPoint2(value) {
|
|
|
69157
69377
|
return false;
|
|
69158
69378
|
}
|
|
69159
69379
|
function isSelectionTarget2(value) {
|
|
69160
|
-
if (!
|
|
69380
|
+
if (!isRecord5(value))
|
|
69161
69381
|
return false;
|
|
69162
69382
|
if (value.kind !== "selection")
|
|
69163
69383
|
return false;
|
|
@@ -69173,7 +69393,7 @@ function validateStoryLocator2(value, field) {
|
|
|
69173
69393
|
});
|
|
69174
69394
|
}
|
|
69175
69395
|
function validateAnchor2(value, fieldName) {
|
|
69176
|
-
if (!
|
|
69396
|
+
if (!isRecord5(value))
|
|
69177
69397
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${fieldName} must be a non-null object.`, { field: fieldName });
|
|
69178
69398
|
if (typeof value.kind !== "string" || !VALID_ANCHOR_KINDS2.has(value.kind))
|
|
69179
69399
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${fieldName}.kind must be "document", "point", or "ref", got ${JSON.stringify(value.kind)}.`, {
|
|
@@ -69210,7 +69430,7 @@ function validateAnchor2(value, fieldName) {
|
|
|
69210
69430
|
}
|
|
69211
69431
|
}
|
|
69212
69432
|
function validateResolveRangeInput2(input) {
|
|
69213
|
-
if (!
|
|
69433
|
+
if (!isRecord5(input))
|
|
69214
69434
|
throw new DocumentApiValidationError2("INVALID_INPUT", "ranges.resolve input must be a non-null object.");
|
|
69215
69435
|
assertNoUnknownFields3(input, RESOLVE_RANGE_ALLOWED_KEYS2, "ranges.resolve");
|
|
69216
69436
|
if (input.start === undefined)
|
|
@@ -69233,7 +69453,7 @@ function executeResolveRange2(adapter, input) {
|
|
|
69233
69453
|
function validateSelectionCurrentInput2(input) {
|
|
69234
69454
|
if (input === undefined)
|
|
69235
69455
|
return;
|
|
69236
|
-
if (!
|
|
69456
|
+
if (!isRecord5(input))
|
|
69237
69457
|
throw new DocumentApiValidationError2("INVALID_INPUT", "selection.current input must be a non-null object.");
|
|
69238
69458
|
assertNoUnknownFields3(input, SELECTION_CURRENT_ALLOWED_KEYS2, "selection.current");
|
|
69239
69459
|
if (input.includeText !== undefined && typeof input.includeText !== "boolean")
|
|
@@ -69250,7 +69470,7 @@ function executeMarkdownToFragment2(adapter, input) {
|
|
|
69250
69470
|
return adapter.markdownToFragment(input);
|
|
69251
69471
|
}
|
|
69252
69472
|
function validateCreateCommentInput2(input) {
|
|
69253
|
-
if (!
|
|
69473
|
+
if (!isRecord5(input))
|
|
69254
69474
|
throw new DocumentApiValidationError2("INVALID_INPUT", "comments.create input must be a non-null object.");
|
|
69255
69475
|
assertNoUnknownFields3(input, CREATE_COMMENT_ALLOWED_KEYS2, "comments.create");
|
|
69256
69476
|
const { target, text: text$2, parentCommentId } = input;
|
|
@@ -69280,7 +69500,7 @@ function validateCreateCommentInput2(input) {
|
|
|
69280
69500
|
});
|
|
69281
69501
|
}
|
|
69282
69502
|
function validatePatchCommentInput2(input) {
|
|
69283
|
-
if (!
|
|
69503
|
+
if (!isRecord5(input))
|
|
69284
69504
|
throw new DocumentApiValidationError2("INVALID_INPUT", "comments.patch input must be a non-null object.");
|
|
69285
69505
|
assertNoUnknownFields3(input, PATCH_COMMENT_ALLOWED_KEYS2, "comments.patch");
|
|
69286
69506
|
const { commentId, target } = input;
|
|
@@ -69356,7 +69576,7 @@ function executeCommentsPatch2(adapter, input, options) {
|
|
|
69356
69576
|
throw new DocumentApiValidationError2("INTERNAL_ERROR", "comments.patch: no mutation field matched after validation. This is a bug.");
|
|
69357
69577
|
}
|
|
69358
69578
|
function validateCommentIdInput2(input, operationName) {
|
|
69359
|
-
if (!
|
|
69579
|
+
if (!isRecord5(input))
|
|
69360
69580
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} input must be a non-null object.`);
|
|
69361
69581
|
if (typeof input.commentId !== "string" || input.commentId.length === 0)
|
|
69362
69582
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} commentId must be a non-empty string.`, {
|
|
@@ -69373,7 +69593,7 @@ function executeGetComment2(adapter, input) {
|
|
|
69373
69593
|
return adapter.get(input);
|
|
69374
69594
|
}
|
|
69375
69595
|
function executeListComments2(adapter, query2) {
|
|
69376
|
-
if (query2 !== undefined && !
|
|
69596
|
+
if (query2 !== undefined && !isRecord5(query2))
|
|
69377
69597
|
throw new DocumentApiValidationError2("INVALID_INPUT", "comments.list query must be an object if provided.");
|
|
69378
69598
|
return adapter.list(query2);
|
|
69379
69599
|
}
|
|
@@ -69399,7 +69619,7 @@ function validateTargetLocator$1(input, operation) {
|
|
|
69399
69619
|
});
|
|
69400
69620
|
}
|
|
69401
69621
|
function validateStyleApplyInput2(input) {
|
|
69402
|
-
if (!
|
|
69622
|
+
if (!isRecord5(input))
|
|
69403
69623
|
throw new DocumentApiValidationError2("INVALID_INPUT", "format.apply input must be a non-null object.");
|
|
69404
69624
|
assertNoUnknownFields3(input, STYLE_APPLY_INPUT_ALLOWED_KEYS2, "format.apply");
|
|
69405
69625
|
validateStoryLocator2(input.in, "in");
|
|
@@ -69435,7 +69655,7 @@ function normalizeInlineAliasValue2(key, value) {
|
|
|
69435
69655
|
}
|
|
69436
69656
|
function validateInlineAliasInput2(key, input) {
|
|
69437
69657
|
const operation = `format.${key}`;
|
|
69438
|
-
const candidate =
|
|
69658
|
+
const candidate = isRecord5(input) ? input : {};
|
|
69439
69659
|
assertNoUnknownFields3(candidate, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, operation);
|
|
69440
69660
|
validateStoryLocator2(candidate.in, "in");
|
|
69441
69661
|
validateTargetLocator$1(candidate, operation);
|
|
@@ -69468,19 +69688,19 @@ function executeGet2(adapter, input) {
|
|
|
69468
69688
|
return adapter.get(input);
|
|
69469
69689
|
}
|
|
69470
69690
|
function executeGetText2(adapter, input) {
|
|
69471
|
-
if (!
|
|
69691
|
+
if (!isRecord5(input))
|
|
69472
69692
|
throw new DocumentApiValidationError2("INVALID_INPUT", "getText input must be a non-null object.");
|
|
69473
69693
|
validateStoryLocator2(input.in, "in");
|
|
69474
69694
|
return adapter.getText(input);
|
|
69475
69695
|
}
|
|
69476
69696
|
function executeGetMarkdown2(adapter, input) {
|
|
69477
|
-
if (!
|
|
69697
|
+
if (!isRecord5(input))
|
|
69478
69698
|
throw new DocumentApiValidationError2("INVALID_INPUT", "getMarkdown input must be a non-null object.");
|
|
69479
69699
|
validateStoryLocator2(input.in, "in");
|
|
69480
69700
|
return adapter.getMarkdown(input);
|
|
69481
69701
|
}
|
|
69482
69702
|
function executeGetHtml2(adapter, input) {
|
|
69483
|
-
if (!
|
|
69703
|
+
if (!isRecord5(input))
|
|
69484
69704
|
throw new DocumentApiValidationError2("INVALID_INPUT", "getHtml input must be a non-null object.");
|
|
69485
69705
|
validateStoryLocator2(input.in, "in");
|
|
69486
69706
|
return adapter.getHtml(input);
|
|
@@ -69495,7 +69715,7 @@ function executeClearContent2(adapter, input, options) {
|
|
|
69495
69715
|
return adapter.clearContent(input, options);
|
|
69496
69716
|
}
|
|
69497
69717
|
function validateDeleteInput2(input) {
|
|
69498
|
-
if (!
|
|
69718
|
+
if (!isRecord5(input))
|
|
69499
69719
|
throw new DocumentApiValidationError2("INVALID_TARGET", "Delete input must be a non-null object.");
|
|
69500
69720
|
assertNoUnknownFields3(input, DELETE_INPUT_ALLOWED_KEYS2, "delete");
|
|
69501
69721
|
validateStoryLocator2(input.in, "in");
|
|
@@ -69550,7 +69770,7 @@ function validateDocumentFragment2(fragment2) {
|
|
|
69550
69770
|
if (nodes.length === 0)
|
|
69551
69771
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", "Fragment must contain at least one node.");
|
|
69552
69772
|
const first = nodes[0];
|
|
69553
|
-
if (
|
|
69773
|
+
if (isRecord5(first) && typeof first.kind === "string") {
|
|
69554
69774
|
validateSDFragment2(fragment2);
|
|
69555
69775
|
return;
|
|
69556
69776
|
}
|
|
@@ -69576,7 +69796,7 @@ function validateContentNode2(node3, seenIds) {
|
|
|
69576
69796
|
validateContentByKind2(rec, kind, seenIds);
|
|
69577
69797
|
}
|
|
69578
69798
|
function assertPlainObject2(node3) {
|
|
69579
|
-
if (!
|
|
69799
|
+
if (!isRecord5(node3))
|
|
69580
69800
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", "Each node in a fragment must be a plain object.");
|
|
69581
69801
|
}
|
|
69582
69802
|
function assertKindField2(rec) {
|
|
@@ -69598,7 +69818,7 @@ function validatePayloadKeyMatchesKind2(rec, kind) {
|
|
|
69598
69818
|
return;
|
|
69599
69819
|
if (!(kind in rec))
|
|
69600
69820
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", `Node with kind "${kind}" must have a "${kind}" payload key.`, { kind });
|
|
69601
|
-
if (rec[kind] !== undefined && !
|
|
69821
|
+
if (rec[kind] !== undefined && !isRecord5(rec[kind]))
|
|
69602
69822
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", `"${kind}" payload must be an object.`, { kind });
|
|
69603
69823
|
}
|
|
69604
69824
|
function collectAndCheckId2(rec, seenIds) {
|
|
@@ -69642,7 +69862,7 @@ function validateParagraphPayload2(rec, seenIds) {
|
|
|
69642
69862
|
const payload = rec.paragraph;
|
|
69643
69863
|
if (!payload)
|
|
69644
69864
|
return;
|
|
69645
|
-
if (payload.numbering != null &&
|
|
69865
|
+
if (payload.numbering != null && isRecord5(payload.numbering)) {
|
|
69646
69866
|
const numbering = payload.numbering;
|
|
69647
69867
|
if (typeof numbering.level === "number") {
|
|
69648
69868
|
const level = numbering.level;
|
|
@@ -69652,7 +69872,7 @@ function validateParagraphPayload2(rec, seenIds) {
|
|
|
69652
69872
|
}
|
|
69653
69873
|
if (Array.isArray(payload.tabs)) {
|
|
69654
69874
|
for (const tab of payload.tabs)
|
|
69655
|
-
if (
|
|
69875
|
+
if (isRecord5(tab)) {
|
|
69656
69876
|
const pos = tab.position;
|
|
69657
69877
|
if (typeof pos === "number" && pos <= 0)
|
|
69658
69878
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", `paragraph.tabs position must be positive, got ${pos}.`, { field: "tabs.position" });
|
|
@@ -69722,7 +69942,7 @@ function validateListPayload2(rec, seenIds) {
|
|
|
69722
69942
|
}
|
|
69723
69943
|
}
|
|
69724
69944
|
function rejectNumberingInsideListItem2(node3) {
|
|
69725
|
-
if (!
|
|
69945
|
+
if (!isRecord5(node3))
|
|
69726
69946
|
return;
|
|
69727
69947
|
const rec = node3;
|
|
69728
69948
|
const kind = rec.kind;
|
|
@@ -69762,9 +69982,9 @@ function validateTocPayload2(rec) {
|
|
|
69762
69982
|
const payload = rec.toc;
|
|
69763
69983
|
if (!payload)
|
|
69764
69984
|
return;
|
|
69765
|
-
const sourceConfig =
|
|
69766
|
-
const displayConfig =
|
|
69767
|
-
if (sourceConfig &&
|
|
69985
|
+
const sourceConfig = isRecord5(payload.sourceConfig) ? payload.sourceConfig : undefined;
|
|
69986
|
+
const displayConfig = isRecord5(payload.displayConfig) ? payload.displayConfig : undefined;
|
|
69987
|
+
if (sourceConfig && isRecord5(sourceConfig.outlineLevels)) {
|
|
69768
69988
|
const range = sourceConfig.outlineLevels;
|
|
69769
69989
|
const from4 = range.from;
|
|
69770
69990
|
const to = range.to;
|
|
@@ -69775,7 +69995,7 @@ function validateTocPayload2(rec) {
|
|
|
69775
69995
|
if (typeof from4 === "number" && typeof to === "number" && from4 > to)
|
|
69776
69996
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", `TOC sourceConfig.outlineLevels.from (${from4}) must be <= to (${to}).`);
|
|
69777
69997
|
}
|
|
69778
|
-
if (sourceConfig &&
|
|
69998
|
+
if (sourceConfig && isRecord5(sourceConfig.tcFieldLevels)) {
|
|
69779
69999
|
const range = sourceConfig.tcFieldLevels;
|
|
69780
70000
|
const from4 = range.from;
|
|
69781
70001
|
const to = range.to;
|
|
@@ -69787,7 +70007,7 @@ function validateTocPayload2(rec) {
|
|
|
69787
70007
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", `TOC sourceConfig.tcFieldLevels.from (${from4}) must be <= to (${to}).`);
|
|
69788
70008
|
}
|
|
69789
70009
|
if (displayConfig) {
|
|
69790
|
-
if (displayConfig.includePageNumbers === false &&
|
|
70010
|
+
if (displayConfig.includePageNumbers === false && isRecord5(displayConfig.omitPageNumberLevels))
|
|
69791
70011
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", "TOC cannot set displayConfig.includePageNumbers=false and also provide displayConfig.omitPageNumberLevels.");
|
|
69792
70012
|
if (displayConfig.tabLeader !== undefined && displayConfig.separator !== undefined)
|
|
69793
70013
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", "TOC cannot set both displayConfig.tabLeader and displayConfig.separator.");
|
|
@@ -69835,7 +70055,7 @@ function validateLegacyTopLevelNode2(node3) {
|
|
|
69835
70055
|
validateLegacyNodeContent2(rec, type);
|
|
69836
70056
|
}
|
|
69837
70057
|
function assertLegacyNodeShape2(node3) {
|
|
69838
|
-
if (!
|
|
70058
|
+
if (!isRecord5(node3))
|
|
69839
70059
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", "Each node in a fragment must be a plain object.");
|
|
69840
70060
|
const rec = node3;
|
|
69841
70061
|
if (typeof rec.kind !== "string" && typeof rec.type !== "string")
|
|
@@ -69934,7 +70154,7 @@ function validateLegacyInlineArray2(content$2, parentType) {
|
|
|
69934
70154
|
validateLegacyInlineContent2(item, parentType);
|
|
69935
70155
|
}
|
|
69936
70156
|
function validateLegacyInlineContent2(item, parentType) {
|
|
69937
|
-
if (!
|
|
70157
|
+
if (!isRecord5(item))
|
|
69938
70158
|
throw new DocumentApiValidationError2("INVALID_PAYLOAD", `Each inline content item in ${parentType} must be a plain object.`);
|
|
69939
70159
|
const itemType = item.type;
|
|
69940
70160
|
if (itemType !== "text" && itemType !== "image")
|
|
@@ -70009,7 +70229,7 @@ function isStructuralInsertInput2(input) {
|
|
|
70009
70229
|
return "content" in input && input.content !== undefined;
|
|
70010
70230
|
}
|
|
70011
70231
|
function validateInsertInput2(input) {
|
|
70012
|
-
if (!
|
|
70232
|
+
if (!isRecord5(input))
|
|
70013
70233
|
throw new DocumentApiValidationError2("INVALID_TARGET", "Insert input must be a non-null object.");
|
|
70014
70234
|
const hasValue = "value" in input && input.value !== undefined;
|
|
70015
70235
|
const hasContent2 = "content" in input && input.content !== undefined;
|
|
@@ -70117,13 +70337,13 @@ function executeInsert2(selectionAdapter, writeAdapter, input, options) {
|
|
|
70117
70337
|
}, options));
|
|
70118
70338
|
}
|
|
70119
70339
|
function validateListInput2(input, operationName) {
|
|
70120
|
-
if (!
|
|
70340
|
+
if (!isRecord5(input))
|
|
70121
70341
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} input must be a non-null object.`);
|
|
70122
70342
|
}
|
|
70123
70343
|
function validateListItemAddress2(value, field, operationName) {
|
|
70124
70344
|
if (value === undefined || value === null)
|
|
70125
70345
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} requires a ${field}.`);
|
|
70126
|
-
if (!
|
|
70346
|
+
if (!isRecord5(value))
|
|
70127
70347
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} ${field} must be an object.`, {
|
|
70128
70348
|
field,
|
|
70129
70349
|
value
|
|
@@ -70149,7 +70369,7 @@ function validateListItemTarget2(input, operationName) {
|
|
|
70149
70369
|
validateListItemAddress2(input.target, "target", operationName);
|
|
70150
70370
|
}
|
|
70151
70371
|
function validateBlockAddress2(value, field, operationName) {
|
|
70152
|
-
if (!
|
|
70372
|
+
if (!isRecord5(value))
|
|
70153
70373
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} ${field} must be an object.`, {
|
|
70154
70374
|
field,
|
|
70155
70375
|
value
|
|
@@ -70172,7 +70392,7 @@ function validateBlockAddress2(value, field, operationName) {
|
|
|
70172
70392
|
});
|
|
70173
70393
|
}
|
|
70174
70394
|
function validateBlockAddressOrRange2(value, field, operationName) {
|
|
70175
|
-
if (!
|
|
70395
|
+
if (!isRecord5(value))
|
|
70176
70396
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} ${field} must be an object.`, {
|
|
70177
70397
|
field,
|
|
70178
70398
|
value
|
|
@@ -70235,7 +70455,7 @@ function optionalLevelsArray2(value, field, operationName) {
|
|
|
70235
70455
|
});
|
|
70236
70456
|
}
|
|
70237
70457
|
function validateListLevelTemplate2(entry, path2, operationName) {
|
|
70238
|
-
if (!
|
|
70458
|
+
if (!isRecord5(entry))
|
|
70239
70459
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} ${path2} must be an object.`, {
|
|
70240
70460
|
field: path2,
|
|
70241
70461
|
value: entry
|
|
@@ -70270,7 +70490,7 @@ function validateListLevelTemplate2(entry, path2, operationName) {
|
|
|
70270
70490
|
if (e.tabStopAt !== undefined && e.tabStopAt !== null)
|
|
70271
70491
|
optionalNumber2(e.tabStopAt, `${path2}.tabStopAt`, operationName);
|
|
70272
70492
|
if (e.indents !== undefined) {
|
|
70273
|
-
if (!
|
|
70493
|
+
if (!isRecord5(e.indents))
|
|
70274
70494
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} ${path2}.indents must be an object.`, {
|
|
70275
70495
|
field: `${path2}.indents`,
|
|
70276
70496
|
value: e.indents
|
|
@@ -70282,7 +70502,7 @@ function validateListLevelTemplate2(entry, path2, operationName) {
|
|
|
70282
70502
|
}
|
|
70283
70503
|
}
|
|
70284
70504
|
function validateListTemplate2(value, field, operationName) {
|
|
70285
|
-
if (!
|
|
70505
|
+
if (!isRecord5(value))
|
|
70286
70506
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} ${field} must be an object.`, {
|
|
70287
70507
|
field,
|
|
70288
70508
|
value
|
|
@@ -70313,7 +70533,7 @@ function validateListsCreateFields2(raw) {
|
|
|
70313
70533
|
});
|
|
70314
70534
|
}
|
|
70315
70535
|
if (raw.sequence !== undefined) {
|
|
70316
|
-
if (!
|
|
70536
|
+
if (!isRecord5(raw.sequence))
|
|
70317
70537
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${op} sequence must be an object.`, {
|
|
70318
70538
|
field: "sequence",
|
|
70319
70539
|
value: raw.sequence
|
|
@@ -70338,7 +70558,7 @@ function validateListsCreateFields2(raw) {
|
|
|
70338
70558
|
}
|
|
70339
70559
|
function executeListsList2(adapter, query2) {
|
|
70340
70560
|
if (query2 !== undefined) {
|
|
70341
|
-
if (!
|
|
70561
|
+
if (!isRecord5(query2))
|
|
70342
70562
|
throw new DocumentApiValidationError2("INVALID_INPUT", "lists.list query must be an object if provided.");
|
|
70343
70563
|
const q$1 = query2;
|
|
70344
70564
|
if (q$1.kind !== undefined)
|
|
@@ -70348,7 +70568,7 @@ function executeListsList2(adapter, query2) {
|
|
|
70348
70568
|
optionalInteger2(q$1.offset, "offset", "lists.list");
|
|
70349
70569
|
optionalInteger2(q$1.ordinal, "ordinal", "lists.list");
|
|
70350
70570
|
if (q$1.within !== undefined) {
|
|
70351
|
-
if (!
|
|
70571
|
+
if (!isRecord5(q$1.within))
|
|
70352
70572
|
throw new DocumentApiValidationError2("INVALID_INPUT", "lists.list within must be an object.", {
|
|
70353
70573
|
field: "within",
|
|
70354
70574
|
value: q$1.within
|
|
@@ -70641,7 +70861,7 @@ function executeListsSetLevelStart2(adapter, input, options) {
|
|
|
70641
70861
|
function executeListsSetLevelLayout2(adapter, input, options) {
|
|
70642
70862
|
validateListItemTarget2(input, "lists.setLevelLayout");
|
|
70643
70863
|
requireLevel2(input.level, "lists.setLevelLayout");
|
|
70644
|
-
if (!
|
|
70864
|
+
if (!isRecord5(input.layout))
|
|
70645
70865
|
throw new DocumentApiValidationError2("INVALID_INPUT", "lists.setLevelLayout layout must be an object.", {
|
|
70646
70866
|
field: "layout",
|
|
70647
70867
|
value: input.layout
|
|
@@ -70679,7 +70899,7 @@ function validateTargetLocator3(input, operation) {
|
|
|
70679
70899
|
});
|
|
70680
70900
|
}
|
|
70681
70901
|
function validateReplaceInput2(input) {
|
|
70682
|
-
if (!
|
|
70902
|
+
if (!isRecord5(input))
|
|
70683
70903
|
throw new DocumentApiValidationError2("INVALID_TARGET", "Replace input must be a non-null object.");
|
|
70684
70904
|
const hasText = "text" in input && input.text !== undefined;
|
|
70685
70905
|
const hasContent2 = "content" in input && input.content !== undefined;
|
|
@@ -70804,7 +71024,7 @@ function validateCreateSectionBreakInput2(input) {
|
|
|
70804
71024
|
}
|
|
70805
71025
|
}
|
|
70806
71026
|
function executeCreateParagraph2(adapter, input, options) {
|
|
70807
|
-
if (!
|
|
71027
|
+
if (!isRecord5(input))
|
|
70808
71028
|
throw new DocumentApiValidationError2("INVALID_INPUT", "create.paragraph input must be a non-null object.");
|
|
70809
71029
|
validateStoryLocator2(input.in, "in");
|
|
70810
71030
|
const normalized = {
|
|
@@ -70814,7 +71034,7 @@ function executeCreateParagraph2(adapter, input, options) {
|
|
|
70814
71034
|
return adapter.paragraph(normalized, normalizeMutationOptions2(options));
|
|
70815
71035
|
}
|
|
70816
71036
|
function executeCreateHeading2(adapter, input, options) {
|
|
70817
|
-
if (!
|
|
71037
|
+
if (!isRecord5(input))
|
|
70818
71038
|
throw new DocumentApiValidationError2("INVALID_INPUT", "create.heading input must be a non-null object.");
|
|
70819
71039
|
validateStoryLocator2(input.in, "in");
|
|
70820
71040
|
if (!isInteger3(input.level) || !VALID_HEADING_LEVELS2.has(input.level))
|
|
@@ -70831,7 +71051,7 @@ function executeCreateHeading2(adapter, input, options) {
|
|
|
70831
71051
|
return adapter.heading(normalized, normalizeMutationOptions2(options));
|
|
70832
71052
|
}
|
|
70833
71053
|
function executeCreateTable2(adapter, input, options) {
|
|
70834
|
-
if (!
|
|
71054
|
+
if (!isRecord5(input))
|
|
70835
71055
|
throw new DocumentApiValidationError2("INVALID_INPUT", "create.table input must be a non-null object.");
|
|
70836
71056
|
if (!isInteger3(input.rows) || input.rows < 1)
|
|
70837
71057
|
throw new DocumentApiValidationError2("INVALID_INPUT", `create.table rows must be a positive integer, got ${JSON.stringify(input.rows)}.`, {
|
|
@@ -71645,17 +71865,17 @@ function assertBoolean$1(value, fieldName) {
|
|
|
71645
71865
|
});
|
|
71646
71866
|
}
|
|
71647
71867
|
function assertSectionAddress$1(value, fieldName) {
|
|
71648
|
-
if (!
|
|
71868
|
+
if (!isRecord5(value) || value.kind !== "section" || typeof value.sectionId !== "string" || value.sectionId.length === 0)
|
|
71649
71869
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${fieldName} must be a section address.`, {
|
|
71650
71870
|
field: fieldName,
|
|
71651
71871
|
value
|
|
71652
71872
|
});
|
|
71653
71873
|
}
|
|
71654
71874
|
function assertHeaderFooterSlotTarget2(input, operationName) {
|
|
71655
|
-
if (!
|
|
71875
|
+
if (!isRecord5(input))
|
|
71656
71876
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} input must be an object.`);
|
|
71657
71877
|
const target = input.target;
|
|
71658
|
-
if (!
|
|
71878
|
+
if (!isRecord5(target) || target.kind !== "headerFooterSlot")
|
|
71659
71879
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName}.target must be a headerFooterSlot address.`, {
|
|
71660
71880
|
field: `${operationName}.target`,
|
|
71661
71881
|
value: target
|
|
@@ -71665,10 +71885,10 @@ function assertHeaderFooterSlotTarget2(input, operationName) {
|
|
|
71665
71885
|
assertOneOf$1(target.variant, `${operationName}.target.variant`, HEADER_FOOTER_VARIANTS$1);
|
|
71666
71886
|
}
|
|
71667
71887
|
function assertHeaderFooterPartTarget2(input, operationName) {
|
|
71668
|
-
if (!
|
|
71888
|
+
if (!isRecord5(input))
|
|
71669
71889
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} input must be an object.`);
|
|
71670
71890
|
const target = input.target;
|
|
71671
|
-
if (!
|
|
71891
|
+
if (!isRecord5(target) || target.kind !== "headerFooterPart")
|
|
71672
71892
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName}.target must be a headerFooterPart address.`, {
|
|
71673
71893
|
field: `${operationName}.target`,
|
|
71674
71894
|
value: target
|
|
@@ -71720,14 +71940,14 @@ function executeHeaderFootersPartsDelete2(adapter, input, options) {
|
|
|
71720
71940
|
return adapter.parts.delete(input, normalizeMutationOptions2(options));
|
|
71721
71941
|
}
|
|
71722
71942
|
function assertSectionAddress3(value, fieldName) {
|
|
71723
|
-
if (!
|
|
71943
|
+
if (!isRecord5(value) || value.kind !== "section" || typeof value.sectionId !== "string" || value.sectionId.length === 0)
|
|
71724
71944
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${fieldName} must be a section address.`, {
|
|
71725
71945
|
field: fieldName,
|
|
71726
71946
|
value
|
|
71727
71947
|
});
|
|
71728
71948
|
}
|
|
71729
71949
|
function assertSectionTarget2(input, operationName) {
|
|
71730
|
-
if (!
|
|
71950
|
+
if (!isRecord5(input))
|
|
71731
71951
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} input must be an object.`);
|
|
71732
71952
|
assertSectionAddress3(input.target, `${operationName}.target`);
|
|
71733
71953
|
}
|
|
@@ -71779,7 +71999,7 @@ function hasAnyDefined2(value, keys$1) {
|
|
|
71779
71999
|
return keys$1.some((key) => value[key] !== undefined);
|
|
71780
72000
|
}
|
|
71781
72001
|
function assertObject2(value, fieldName) {
|
|
71782
|
-
if (!
|
|
72002
|
+
if (!isRecord5(value))
|
|
71783
72003
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${fieldName} must be an object.`, {
|
|
71784
72004
|
field: fieldName,
|
|
71785
72005
|
value
|
|
@@ -72250,7 +72470,7 @@ function validateInsertionTarget2(target, operationName) {
|
|
|
72250
72470
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} target.anchor must have nodeType 'paragraph' and a string nodeId.`, { target });
|
|
72251
72471
|
}
|
|
72252
72472
|
function validateTocInput2(input, operationName) {
|
|
72253
|
-
if (!
|
|
72473
|
+
if (!isRecord5(input))
|
|
72254
72474
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} input must be a non-null object.`);
|
|
72255
72475
|
}
|
|
72256
72476
|
function executeTocList2(adapter, query2) {
|
|
@@ -72302,7 +72522,7 @@ function executeTocGetEntry2(adapter, input) {
|
|
|
72302
72522
|
return adapter.getEntry(input);
|
|
72303
72523
|
}
|
|
72304
72524
|
function validateTocEditEntryPatch2(patch, operationName) {
|
|
72305
|
-
if (!
|
|
72525
|
+
if (!isRecord5(patch))
|
|
72306
72526
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} patch must be a non-null object.`, {
|
|
72307
72527
|
field: "patch",
|
|
72308
72528
|
value: patch
|
|
@@ -72340,16 +72560,16 @@ function executeTocEditEntry2(adapter, input, options) {
|
|
|
72340
72560
|
return adapter.editEntry(input, normalizeMutationOptions2(options));
|
|
72341
72561
|
}
|
|
72342
72562
|
function isHyperlinkTarget2(value) {
|
|
72343
|
-
if (!
|
|
72563
|
+
if (!isRecord5(value))
|
|
72344
72564
|
return false;
|
|
72345
72565
|
if (value.kind !== "inline" || value.nodeType !== "hyperlink")
|
|
72346
72566
|
return false;
|
|
72347
72567
|
const anchor = value.anchor;
|
|
72348
|
-
if (!
|
|
72568
|
+
if (!isRecord5(anchor))
|
|
72349
72569
|
return false;
|
|
72350
72570
|
const start = anchor.start;
|
|
72351
72571
|
const end = anchor.end;
|
|
72352
|
-
if (!
|
|
72572
|
+
if (!isRecord5(start) || !isRecord5(end))
|
|
72353
72573
|
return false;
|
|
72354
72574
|
return typeof start.blockId === "string" && typeof start.offset === "number" && typeof end.blockId === "string" && typeof end.offset === "number";
|
|
72355
72575
|
}
|
|
@@ -72360,7 +72580,7 @@ function validateHyperlinkTarget2(target, operationName) {
|
|
|
72360
72580
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} target must be a HyperlinkTarget with kind 'inline', nodeType 'hyperlink', and a valid anchor.`, { target });
|
|
72361
72581
|
}
|
|
72362
72582
|
function validateDestination2(destination, operationName) {
|
|
72363
|
-
if (!
|
|
72583
|
+
if (!isRecord5(destination))
|
|
72364
72584
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} requires a destination object.`);
|
|
72365
72585
|
const hasHref = typeof destination.href === "string" && destination.href.length > 0;
|
|
72366
72586
|
const hasAnchor = typeof destination.anchor === "string" && destination.anchor.length > 0;
|
|
@@ -72368,12 +72588,12 @@ function validateDestination2(destination, operationName) {
|
|
|
72368
72588
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} destination must have at least one of 'href' or 'anchor'.`);
|
|
72369
72589
|
}
|
|
72370
72590
|
function validateHyperlinkSpec2(link2, operationName) {
|
|
72371
|
-
if (!
|
|
72591
|
+
if (!isRecord5(link2))
|
|
72372
72592
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} requires a link specification object.`);
|
|
72373
72593
|
validateDestination2(link2.destination, operationName);
|
|
72374
72594
|
}
|
|
72375
72595
|
function validatePatch2(patch, operationName) {
|
|
72376
|
-
if (!
|
|
72596
|
+
if (!isRecord5(patch))
|
|
72377
72597
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} requires a patch object.`);
|
|
72378
72598
|
for (const key of Object.keys(patch))
|
|
72379
72599
|
if (!PATCH_FIELDS2.has(key))
|
|
@@ -72425,11 +72645,11 @@ function executeHyperlinksRemove2(adapter, input, options) {
|
|
|
72425
72645
|
return adapter.remove(input, normalizeMutationOptions2(options));
|
|
72426
72646
|
}
|
|
72427
72647
|
function validateCCInput2(input, operationName) {
|
|
72428
|
-
if (!
|
|
72648
|
+
if (!isRecord5(input))
|
|
72429
72649
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} input must be a non-null object.`);
|
|
72430
72650
|
}
|
|
72431
72651
|
function validateCCTarget2(target, operationName) {
|
|
72432
|
-
if (!
|
|
72652
|
+
if (!isRecord5(target))
|
|
72433
72653
|
throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} requires a valid target with { kind, nodeType: 'sdt', nodeId }.`, {
|
|
72434
72654
|
field: "target",
|
|
72435
72655
|
value: target
|
|
@@ -72494,14 +72714,14 @@ function validateContentPayload2(input, operationName) {
|
|
|
72494
72714
|
validateContentFormat2(input.format, "format", operationName);
|
|
72495
72715
|
}
|
|
72496
72716
|
function validateSymbol2(value, field, operationName) {
|
|
72497
|
-
if (!
|
|
72717
|
+
if (!isRecord5(value) || typeof value.font !== "string" || typeof value.char !== "string")
|
|
72498
72718
|
throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} ${field} must be { font: string, char: string }.`, {
|
|
72499
72719
|
field,
|
|
72500
72720
|
value
|
|
72501
72721
|
});
|
|
72502
72722
|
}
|
|
72503
72723
|
function executeContentControlsList2(adapter, query2) {
|
|
72504
|
-
if (query2 !== undefined && !
|
|
72724
|
+
if (query2 !== undefined && !isRecord5(query2))
|
|
72505
72725
|
throw new DocumentApiValidationError2("INVALID_INPUT", "contentControls.list query must be an object if provided.");
|
|
72506
72726
|
return adapter.list(query2);
|
|
72507
72727
|
}
|
|
@@ -72681,7 +72901,7 @@ function executeContentControlsPatchRawProperties2(adapter, input, options) {
|
|
|
72681
72901
|
});
|
|
72682
72902
|
for (let i$1 = 0;i$1 < input.patches.length; i$1++) {
|
|
72683
72903
|
const patch = input.patches[i$1];
|
|
72684
|
-
if (!
|
|
72904
|
+
if (!isRecord5(patch))
|
|
72685
72905
|
throw new DocumentApiValidationError2("INVALID_INPUT", `contentControls.patchRawProperties patches[${i$1}] must be an object.`, {
|
|
72686
72906
|
field: `patches[${i$1}]`,
|
|
72687
72907
|
value: patch
|
|
@@ -72812,7 +73032,7 @@ function executeContentControlsChoiceListSetItems2(adapter, input, options) {
|
|
|
72812
73032
|
});
|
|
72813
73033
|
for (let i$1 = 0;i$1 < input.items.length; i$1++) {
|
|
72814
73034
|
const item = input.items[i$1];
|
|
72815
|
-
if (!
|
|
73035
|
+
if (!isRecord5(item) || typeof item.displayText !== "string" || typeof item.value !== "string")
|
|
72816
73036
|
throw new DocumentApiValidationError2("INVALID_INPUT", `contentControls.choiceList.setItems items[${i$1}] must be { displayText: string, value: string }.`, {
|
|
72817
73037
|
field: `items[${i$1}]`,
|
|
72818
73038
|
value: item
|
|
@@ -120534,7 +120754,7 @@ var isRegExp = (value) => {
|
|
|
120534
120754
|
state.kern = kernNode.attributes["w:val"];
|
|
120535
120755
|
}
|
|
120536
120756
|
}, SuperConverter;
|
|
120537
|
-
var
|
|
120757
|
+
var init_SuperConverter_UqLu6KQU_es = __esm(() => {
|
|
120538
120758
|
init_rolldown_runtime_Bg48TavK_es();
|
|
120539
120759
|
init_jszip_C49i9kUs_es();
|
|
120540
120760
|
init_xml_js_CqGKpaft_es();
|
|
@@ -124353,7 +124573,7 @@ var init_SuperConverter_SvCYq2KK_es = __esm(() => {
|
|
|
124353
124573
|
},
|
|
124354
124574
|
"format.paragraph.setAlignment": {
|
|
124355
124575
|
memberPath: "format.paragraph.setAlignment",
|
|
124356
|
-
description: "Set paragraph alignment
|
|
124576
|
+
description: "Set visual paragraph alignment on a paragraph-like block. For RTL paragraphs, left/right are translated to Word-compatible stored justification values.",
|
|
124357
124577
|
expectedResult: "Returns a ParagraphMutationResult; reports NO_OP if the alignment already matches.",
|
|
124358
124578
|
requiresDocumentContext: true,
|
|
124359
124579
|
metadata: mutationOperation2({
|
|
@@ -132283,7 +132503,10 @@ var init_SuperConverter_SvCYq2KK_es = __esm(() => {
|
|
|
132283
132503
|
}
|
|
132284
132504
|
}, ["target", "styleId"]), paragraphMutationResultSchemaFor2("styles.paragraph.setStyle"), paragraphMutationFailureSchemaFor2("styles.paragraph.setStyle"), objectSchema2({ target: paragraphTargetSchema2 }, ["target"]), paragraphMutationResultSchemaFor2("styles.paragraph.clearStyle"), paragraphMutationFailureSchemaFor2("styles.paragraph.clearStyle"), objectSchema2({ target: paragraphTargetSchema2 }, ["target"]), paragraphMutationResultSchemaFor2("format.paragraph.resetDirectFormatting"), paragraphMutationFailureSchemaFor2("format.paragraph.resetDirectFormatting"), objectSchema2({
|
|
132285
132505
|
target: paragraphTargetSchema2,
|
|
132286
|
-
alignment: {
|
|
132506
|
+
alignment: {
|
|
132507
|
+
enum: [...PARAGRAPH_ALIGNMENTS2],
|
|
132508
|
+
description: "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
|
|
132509
|
+
}
|
|
132287
132510
|
}, ["target", "alignment"]), paragraphMutationResultSchemaFor2("format.paragraph.setAlignment"), paragraphMutationFailureSchemaFor2("format.paragraph.setAlignment"), objectSchema2({ target: paragraphTargetSchema2 }, ["target"]), paragraphMutationResultSchemaFor2("format.paragraph.clearAlignment"), paragraphMutationFailureSchemaFor2("format.paragraph.clearAlignment"), { ...objectSchema2({
|
|
132288
132511
|
target: paragraphTargetSchema2,
|
|
132289
132512
|
left: {
|
|
@@ -158711,7 +158934,7 @@ var init_SuperConverter_SvCYq2KK_es = __esm(() => {
|
|
|
158711
158934
|
};
|
|
158712
158935
|
});
|
|
158713
158936
|
|
|
158714
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
158937
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-QcQvy-nD.es.js
|
|
158715
158938
|
function parseSizeUnit(val = "0") {
|
|
158716
158939
|
const length3 = val.toString() || "0";
|
|
158717
158940
|
const value = Number.parseFloat(length3);
|
|
@@ -161994,6 +162217,7 @@ function getWordChanges(oldText, newText) {
|
|
|
161994
162217
|
i4++;
|
|
161995
162218
|
continue;
|
|
161996
162219
|
}
|
|
162220
|
+
const groupStart = i4;
|
|
161997
162221
|
let deleteStart = -1;
|
|
161998
162222
|
let deleteEnd = -1;
|
|
161999
162223
|
let insertText2 = "";
|
|
@@ -162022,7 +162246,7 @@ function getWordChanges(oldText, newText) {
|
|
|
162022
162246
|
oldTo: deleteEnd
|
|
162023
162247
|
});
|
|
162024
162248
|
else if (insertText2.length > 0) {
|
|
162025
|
-
const prevStep =
|
|
162249
|
+
const prevStep = groupStart > 0 ? steps[groupStart - 1] : null;
|
|
162026
162250
|
let insertAt = 0;
|
|
162027
162251
|
if (prevStep && prevStep.type === "equal") {
|
|
162028
162252
|
const prevToken = oldTokens[prevStep.oldIdx];
|
|
@@ -163479,7 +163703,7 @@ function resolveKind(node3) {
|
|
|
163479
163703
|
function resolvePayload(node3, kind) {
|
|
163480
163704
|
return node3[kind] ?? node3;
|
|
163481
163705
|
}
|
|
163482
|
-
function
|
|
163706
|
+
function isRecord6(value) {
|
|
163483
163707
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
163484
163708
|
}
|
|
163485
163709
|
function materializeFragment(schema, fragment2, existingDocIds = /* @__PURE__ */ new Set, operation = "insert", options) {
|
|
@@ -163556,7 +163780,7 @@ function materializeTable(schema, node3, seenIds, existingDocIds, operation, opt
|
|
|
163556
163780
|
paraId: v4_default()
|
|
163557
163781
|
};
|
|
163558
163782
|
const styleRef = payload.styleRef ?? payload.style;
|
|
163559
|
-
const tableProperties =
|
|
163783
|
+
const tableProperties = isRecord6(payload.tableProperties) ? { ...payload.tableProperties } : {};
|
|
163560
163784
|
if (styleRef) {
|
|
163561
163785
|
attrs.tableStyleId = styleRef;
|
|
163562
163786
|
tableProperties.tableStyleId = styleRef;
|
|
@@ -163574,7 +163798,7 @@ function materializeTable(schema, node3, seenIds, existingDocIds, operation, opt
|
|
|
163574
163798
|
attrs.justification = justification;
|
|
163575
163799
|
tableProperties.justification = justification;
|
|
163576
163800
|
}
|
|
163577
|
-
if (payload.props?.borders &&
|
|
163801
|
+
if (payload.props?.borders && isRecord6(payload.props.borders)) {
|
|
163578
163802
|
attrs.borders = payload.props.borders;
|
|
163579
163803
|
tableProperties.borders = payload.props.borders;
|
|
163580
163804
|
}
|
|
@@ -163620,7 +163844,7 @@ function normalizeTableGridColumns(columns) {
|
|
|
163620
163844
|
if (!Array.isArray(columns) || columns.length === 0)
|
|
163621
163845
|
return;
|
|
163622
163846
|
const normalized = columns.map((column) => {
|
|
163623
|
-
const raw = typeof column === "number" ? column :
|
|
163847
|
+
const raw = typeof column === "number" ? column : isRecord6(column) && typeof column.width === "number" ? column.width : undefined;
|
|
163624
163848
|
if (typeof raw !== "number" || !Number.isFinite(raw))
|
|
163625
163849
|
return null;
|
|
163626
163850
|
return { col: Math.round(raw) };
|
|
@@ -163628,7 +163852,7 @@ function normalizeTableGridColumns(columns) {
|
|
|
163628
163852
|
return normalized.length > 0 ? normalized : undefined;
|
|
163629
163853
|
}
|
|
163630
163854
|
function mapSDTableWidthToMeasurement(width) {
|
|
163631
|
-
if (
|
|
163855
|
+
if (isRecord6(width)) {
|
|
163632
163856
|
if ("kind" in width && typeof width.kind === "string")
|
|
163633
163857
|
switch (width.kind) {
|
|
163634
163858
|
case "auto":
|
|
@@ -163682,15 +163906,15 @@ function mapSDTableAlignmentToJustification(value) {
|
|
|
163682
163906
|
function resolveNeedsTableStyleNormalization(node3, payload) {
|
|
163683
163907
|
if (payload.needsTableStyleNormalization === true)
|
|
163684
163908
|
return true;
|
|
163685
|
-
if (!
|
|
163909
|
+
if (!isRecord6(node3))
|
|
163686
163910
|
return false;
|
|
163687
163911
|
const ext = node3.ext;
|
|
163688
|
-
if (!
|
|
163912
|
+
if (!isRecord6(ext))
|
|
163689
163913
|
return false;
|
|
163690
163914
|
if (ext.needsTableStyleNormalization === true)
|
|
163691
163915
|
return true;
|
|
163692
163916
|
const superdocExt = ext.superdoc;
|
|
163693
|
-
if (
|
|
163917
|
+
if (isRecord6(superdocExt) && superdocExt.needsTableStyleNormalization === true)
|
|
163694
163918
|
return true;
|
|
163695
163919
|
return false;
|
|
163696
163920
|
}
|
|
@@ -167617,6 +167841,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
167617
167841
|
const documentId = activeEditor?.options?.documentId;
|
|
167618
167842
|
if (!documentId)
|
|
167619
167843
|
return null;
|
|
167844
|
+
if (typeof superdoc.getPresentationEditorForDocument === "function")
|
|
167845
|
+
return superdoc.getPresentationEditorForDocument(documentId);
|
|
167620
167846
|
return (superdoc.superdocStore?.documents ?? []).find((doc2) => doc2.getEditor?.()?.options?.documentId === documentId)?.getPresentationEditor?.() ?? null;
|
|
167621
167847
|
}, resolveToolbarSources = (superdoc) => {
|
|
167622
167848
|
const presentationEditor = resolvePresentationEditor(superdoc);
|
|
@@ -168363,17 +168589,21 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
168363
168589
|
active: false,
|
|
168364
168590
|
disabled: isCommandDisabled(context) || !inTable
|
|
168365
168591
|
};
|
|
168592
|
+
}, lookupCommentByCommentId = (superdoc, commentId) => {
|
|
168593
|
+
if (typeof superdoc?.getComment === "function")
|
|
168594
|
+
return superdoc.getComment(commentId) ?? null;
|
|
168595
|
+
const store = superdoc?.commentsStore;
|
|
168596
|
+
if (typeof store?.getComment === "function")
|
|
168597
|
+
return store.getComment(commentId) ?? null;
|
|
168598
|
+
return null;
|
|
168366
168599
|
}, enrichTrackedChanges = (trackedChanges = [], superdoc) => {
|
|
168367
168600
|
if (!trackedChanges.length)
|
|
168368
168601
|
return trackedChanges;
|
|
168369
|
-
const store = superdoc?.commentsStore;
|
|
168370
|
-
if (!store?.getComment)
|
|
168371
|
-
return trackedChanges;
|
|
168372
168602
|
return trackedChanges.map((change) => {
|
|
168373
168603
|
const commentId = change.id;
|
|
168374
168604
|
if (!commentId)
|
|
168375
168605
|
return change;
|
|
168376
|
-
const storeComment =
|
|
168606
|
+
const storeComment = lookupCommentByCommentId(superdoc, commentId);
|
|
168377
168607
|
if (!storeComment)
|
|
168378
168608
|
return change;
|
|
168379
168609
|
const comment = typeof storeComment.getValues === "function" ? storeComment.getValues() : storeComment;
|
|
@@ -168721,8 +168951,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
168721
168951
|
}
|
|
168722
168952
|
};
|
|
168723
168953
|
};
|
|
168724
|
-
var
|
|
168725
|
-
|
|
168954
|
+
var init_create_headless_toolbar_QcQvy_nD_es = __esm(() => {
|
|
168955
|
+
init_SuperConverter_UqLu6KQU_es();
|
|
168726
168956
|
init_uuid_qzgm05fK_es();
|
|
168727
168957
|
init_constants_DrU4EASo_es();
|
|
168728
168958
|
init_dist_B8HfvhaK_es();
|
|
@@ -183513,14 +183743,14 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
183513
183743
|
var mixinPluginNames = Object.keys(mixinPlugins);
|
|
183514
183744
|
|
|
183515
183745
|
class ExpressionParser extends LValParser {
|
|
183516
|
-
checkProto(prop,
|
|
183746
|
+
checkProto(prop, isRecord7, sawProto, refExpressionErrors) {
|
|
183517
183747
|
if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {
|
|
183518
183748
|
return sawProto;
|
|
183519
183749
|
}
|
|
183520
183750
|
const key2 = prop.key;
|
|
183521
183751
|
const name = key2.type === "Identifier" ? key2.name : key2.value;
|
|
183522
183752
|
if (name === "__proto__") {
|
|
183523
|
-
if (
|
|
183753
|
+
if (isRecord7) {
|
|
183524
183754
|
this.raise(Errors.RecordNoProto, key2);
|
|
183525
183755
|
return true;
|
|
183526
183756
|
}
|
|
@@ -184583,8 +184813,8 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
184583
184813
|
parseTemplateSubstitution() {
|
|
184584
184814
|
return this.parseExpression();
|
|
184585
184815
|
}
|
|
184586
|
-
parseObjectLike(close2, isPattern,
|
|
184587
|
-
if (
|
|
184816
|
+
parseObjectLike(close2, isPattern, isRecord7, refExpressionErrors) {
|
|
184817
|
+
if (isRecord7) {
|
|
184588
184818
|
this.expectPlugin("recordAndTuple");
|
|
184589
184819
|
}
|
|
184590
184820
|
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
|
|
@@ -184609,9 +184839,9 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
184609
184839
|
prop = this.parseBindingProperty();
|
|
184610
184840
|
} else {
|
|
184611
184841
|
prop = this.parsePropertyDefinition(refExpressionErrors);
|
|
184612
|
-
sawProto = this.checkProto(prop,
|
|
184842
|
+
sawProto = this.checkProto(prop, isRecord7, sawProto, refExpressionErrors);
|
|
184613
184843
|
}
|
|
184614
|
-
if (
|
|
184844
|
+
if (isRecord7 && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
|
|
184615
184845
|
this.raise(Errors.InvalidRecordProperty, prop);
|
|
184616
184846
|
}
|
|
184617
184847
|
if (prop.shorthand) {
|
|
@@ -184624,7 +184854,7 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
184624
184854
|
let type = "ObjectExpression";
|
|
184625
184855
|
if (isPattern) {
|
|
184626
184856
|
type = "ObjectPattern";
|
|
184627
|
-
} else if (
|
|
184857
|
+
} else if (isRecord7) {
|
|
184628
184858
|
type = "RecordExpression";
|
|
184629
184859
|
}
|
|
184630
184860
|
return this.finishNode(node3, type);
|
|
@@ -217927,7 +218157,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
217927
218157
|
init_remark_gfm_BhnWr3yf_es();
|
|
217928
218158
|
});
|
|
217929
218159
|
|
|
217930
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
218160
|
+
// ../../packages/superdoc/dist/chunks/src-BJQRcFsD.es.js
|
|
217931
218161
|
function deleteProps(obj, propOrProps) {
|
|
217932
218162
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
217933
218163
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -231407,8 +231637,8 @@ function projectTable(pmNode) {
|
|
|
231407
231637
|
result.table.columns = columns;
|
|
231408
231638
|
}
|
|
231409
231639
|
if (pmAttrs?.needsTableStyleNormalization === true) {
|
|
231410
|
-
const ext =
|
|
231411
|
-
const superdocExt =
|
|
231640
|
+
const ext = isRecord7(result.ext) ? { ...result.ext } : {};
|
|
231641
|
+
const superdocExt = isRecord7(ext.superdoc) ? { ...ext.superdoc } : {};
|
|
231412
231642
|
superdocExt.needsTableStyleNormalization = true;
|
|
231413
231643
|
result.ext = {
|
|
231414
231644
|
...ext,
|
|
@@ -231880,7 +232110,7 @@ function resolveSdtNodeId(pmNode) {
|
|
|
231880
232110
|
return String(id2);
|
|
231881
232111
|
return typeof id2 === "string" && id2.length > 0 ? id2 : undefined;
|
|
231882
232112
|
}
|
|
231883
|
-
function
|
|
232113
|
+
function isRecord7(value) {
|
|
231884
232114
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
231885
232115
|
}
|
|
231886
232116
|
function extractTableProps(attrs, pmAttrs) {
|
|
@@ -231923,7 +232153,7 @@ function mapTableAlignmentToSD(value) {
|
|
|
231923
232153
|
}
|
|
231924
232154
|
}
|
|
231925
232155
|
function extractTableWidth(width) {
|
|
231926
|
-
if (!
|
|
232156
|
+
if (!isRecord7(width))
|
|
231927
232157
|
return;
|
|
231928
232158
|
const type = typeof width.type === "string" ? width.type.toLowerCase() : undefined;
|
|
231929
232159
|
const value = typeof width.value === "number" ? width.value : typeof width.width === "number" ? width.width : undefined;
|
|
@@ -306316,13 +306546,13 @@ menclose::after {
|
|
|
306316
306546
|
return;
|
|
306317
306547
|
console.log(...args$1);
|
|
306318
306548
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
306319
|
-
var
|
|
306549
|
+
var init_src_BJQRcFsD_es = __esm(() => {
|
|
306320
306550
|
init_rolldown_runtime_Bg48TavK_es();
|
|
306321
|
-
|
|
306551
|
+
init_SuperConverter_UqLu6KQU_es();
|
|
306322
306552
|
init_jszip_C49i9kUs_es();
|
|
306323
306553
|
init_xml_js_CqGKpaft_es();
|
|
306324
306554
|
init_uuid_qzgm05fK_es();
|
|
306325
|
-
|
|
306555
|
+
init_create_headless_toolbar_QcQvy_nD_es();
|
|
306326
306556
|
init_constants_DrU4EASo_es();
|
|
306327
306557
|
init_dist_B8HfvhaK_es();
|
|
306328
306558
|
init_unified_Dsuw2be5_es();
|
|
@@ -344038,11 +344268,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344038
344268
|
];
|
|
344039
344269
|
});
|
|
344040
344270
|
|
|
344041
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
344271
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-FWAQonYc.es.js
|
|
344042
344272
|
var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
344043
|
-
var
|
|
344044
|
-
|
|
344045
|
-
|
|
344273
|
+
var init_create_super_doc_ui_FWAQonYc_es = __esm(() => {
|
|
344274
|
+
init_SuperConverter_UqLu6KQU_es();
|
|
344275
|
+
init_create_headless_toolbar_QcQvy_nD_es();
|
|
344046
344276
|
MOD_ALIASES = new Set([
|
|
344047
344277
|
"Mod",
|
|
344048
344278
|
"Meta",
|
|
@@ -344084,16 +344314,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
344084
344314
|
|
|
344085
344315
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
344086
344316
|
var init_super_editor_es = __esm(() => {
|
|
344087
|
-
|
|
344088
|
-
|
|
344317
|
+
init_src_BJQRcFsD_es();
|
|
344318
|
+
init_SuperConverter_UqLu6KQU_es();
|
|
344089
344319
|
init_jszip_C49i9kUs_es();
|
|
344090
344320
|
init_xml_js_CqGKpaft_es();
|
|
344091
|
-
|
|
344321
|
+
init_create_headless_toolbar_QcQvy_nD_es();
|
|
344092
344322
|
init_constants_DrU4EASo_es();
|
|
344093
344323
|
init_dist_B8HfvhaK_es();
|
|
344094
344324
|
init_unified_Dsuw2be5_es();
|
|
344095
344325
|
init_DocxZipper_CZMPWpOp_es();
|
|
344096
|
-
|
|
344326
|
+
init_create_super_doc_ui_FWAQonYc_es();
|
|
344097
344327
|
init_ui_C5PAS9hY_es();
|
|
344098
344328
|
init_eventemitter3_BnGqBE_Q_es();
|
|
344099
344329
|
init_errors_CNaD6vcg_es();
|
|
@@ -393847,13 +394077,13 @@ var init_special_handlers = __esm(() => {
|
|
|
393847
394077
|
});
|
|
393848
394078
|
|
|
393849
394079
|
// src/lib/invoke-input.ts
|
|
393850
|
-
function
|
|
394080
|
+
function isRecord8(value2) {
|
|
393851
394081
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
393852
394082
|
}
|
|
393853
394083
|
function isTextAddressLike(value2) {
|
|
393854
|
-
if (!
|
|
394084
|
+
if (!isRecord8(value2) || value2.kind !== "text" || typeof value2.blockId !== "string")
|
|
393855
394085
|
return false;
|
|
393856
|
-
if (!
|
|
394086
|
+
if (!isRecord8(value2.range))
|
|
393857
394087
|
return false;
|
|
393858
394088
|
return typeof value2.range.start === "number" && typeof value2.range.end === "number";
|
|
393859
394089
|
}
|
|
@@ -393881,7 +394111,7 @@ function assertLegacySelectionTargetSupported(operationId, target2) {
|
|
|
393881
394111
|
}
|
|
393882
394112
|
}
|
|
393883
394113
|
function normalizeFlatTargetFlags(operationId, apiInput) {
|
|
393884
|
-
if (!
|
|
394114
|
+
if (!isRecord8(apiInput))
|
|
393885
394115
|
return apiInput;
|
|
393886
394116
|
if (apiInput.target !== undefined) {
|
|
393887
394117
|
if (SELECTION_TARGET_OPERATIONS.has(operationId) && isTextAddressLike(apiInput.target)) {
|
|
@@ -397322,11 +397552,11 @@ var init_close = __esm(() => {
|
|
|
397322
397552
|
});
|
|
397323
397553
|
|
|
397324
397554
|
// src/commands/insert-inline-special.ts
|
|
397325
|
-
function
|
|
397555
|
+
function isRecord9(value2) {
|
|
397326
397556
|
return typeof value2 === "object" && value2 != null && !Array.isArray(value2);
|
|
397327
397557
|
}
|
|
397328
397558
|
function isSelectionTarget3(value2) {
|
|
397329
|
-
return
|
|
397559
|
+
return isRecord9(value2) && value2.kind === "selection" && isRecord9(value2.start) && isRecord9(value2.end);
|
|
397330
397560
|
}
|
|
397331
397561
|
function isCollapsedTextSelectionTarget(target2) {
|
|
397332
397562
|
return target2.start.kind === "text" && target2.end.kind === "text" && target2.start.blockId === target2.end.blockId && target2.start.offset === target2.end.offset;
|
|
@@ -397337,7 +397567,7 @@ function buildPrettyOutput3(kind2, revision, outputPath) {
|
|
|
397337
397567
|
}
|
|
397338
397568
|
async function resolveInsertionPoint(editor, input2, kind2) {
|
|
397339
397569
|
const apiInput = extractInvokeInput("insert", input2);
|
|
397340
|
-
if (!
|
|
397570
|
+
if (!isRecord9(apiInput)) {
|
|
397341
397571
|
throw new CliError("INVALID_ARGUMENT", `insert ${COMMAND_BY_KIND[kind2].label}: invalid target input.`);
|
|
397342
397572
|
}
|
|
397343
397573
|
const ref4 = typeof apiInput.ref === "string" ? apiInput.ref : undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.12.0-next.
|
|
3
|
+
"version": "0.12.0-next.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
"@types/node": "22.19.2",
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
|
-
"@superdoc/pm-adapter": "0.0.0",
|
|
28
27
|
"@superdoc/document-api": "0.0.1",
|
|
29
|
-
"superdoc": "
|
|
30
|
-
"@superdoc/
|
|
28
|
+
"@superdoc/super-editor": "0.0.1",
|
|
29
|
+
"@superdoc/pm-adapter": "0.0.0",
|
|
30
|
+
"superdoc": "1.34.0"
|
|
31
31
|
},
|
|
32
32
|
"module": "src/index.ts",
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.12.0-next.
|
|
38
|
-
"@superdoc-dev/cli-darwin-x64": "0.12.0-next.
|
|
39
|
-
"@superdoc-dev/cli-linux-
|
|
40
|
-
"@superdoc-dev/cli-linux-
|
|
41
|
-
"@superdoc-dev/cli-windows-x64": "0.12.0-next.
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.12.0-next.5",
|
|
38
|
+
"@superdoc-dev/cli-darwin-x64": "0.12.0-next.5",
|
|
39
|
+
"@superdoc-dev/cli-linux-arm64": "0.12.0-next.5",
|
|
40
|
+
"@superdoc-dev/cli-linux-x64": "0.12.0-next.5",
|
|
41
|
+
"@superdoc-dev/cli-windows-x64": "0.12.0-next.5"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|