superdoc 2.16.1-next.2 → 2.16.1-next.4
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/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/clear-content/clear-content.d.ts +4 -8
- package/dist/document-api/src/contract/operation-definitions.d.ts +1 -1
- package/dist/document-api/src/contract/operation-registry.d.ts +1 -1
- package/dist/document-api/src/diff/diff.types.d.ts +2 -0
- package/dist/document-api/src/hyperlinks/hyperlinks.types.d.ts +4 -2
- package/dist/document-api/src/index.d.ts +2 -2
- package/dist/document-api/src/write/write.d.ts +2 -3
- package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +3 -1
- package/dist/superdoc/src/core/types/index.d.ts +8 -0
- package/dist/superdoc.cjs +31 -6
- package/dist/superdoc.es.js +31 -6
- package/dist-cdn/superdoc.min.js +35 -35
- package/package.json +2 -2
|
@@ -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.16.1-next.
|
|
22
|
+
superdocVersion: "2.16.1-next.4",
|
|
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.16.1-next.
|
|
21
|
+
superdocVersion: "2.16.1-next.4",
|
|
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Receipt } from '../types/receipt.js';
|
|
2
|
-
import {
|
|
2
|
+
import { MutationOptions } from '../write/write.js';
|
|
3
3
|
export type ClearContentInput = Record<string, never>;
|
|
4
4
|
/**
|
|
5
5
|
* Engine-specific adapter that clears all document body content.
|
|
@@ -8,18 +8,14 @@ export interface ClearContentAdapter {
|
|
|
8
8
|
/**
|
|
9
9
|
* Clear the document body, replacing all content with a single empty paragraph.
|
|
10
10
|
*/
|
|
11
|
-
clearContent(input: ClearContentInput, options?:
|
|
11
|
+
clearContent(input: ClearContentInput, options?: MutationOptions): Receipt;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Execute a clearContent operation through the provided adapter.
|
|
15
15
|
*
|
|
16
|
-
* clearContent is a destructive reset: tracked mode and dry run are not
|
|
17
|
-
* meaningful, so this accepts {@link RevisionGuardOptions} rather than
|
|
18
|
-
* `MutationOptions`.
|
|
19
|
-
*
|
|
20
16
|
* @param adapter - Engine-specific clear-content adapter.
|
|
21
17
|
* @param input - Canonical clear-content input (empty object).
|
|
22
|
-
* @param options - Optional revision guard options.
|
|
18
|
+
* @param options - Optional change mode, preview and revision guard options.
|
|
23
19
|
* @returns A Receipt indicating success or NO_OP if already empty.
|
|
24
20
|
*/
|
|
25
|
-
export declare function executeClearContent(adapter: ClearContentAdapter, input: ClearContentInput, options?:
|
|
21
|
+
export declare function executeClearContent(adapter: ClearContentAdapter, input: ClearContentInput, options?: MutationOptions): Receipt;
|
|
@@ -1689,7 +1689,7 @@ export declare const OPERATION_DEFINITIONS: {
|
|
|
1689
1689
|
readonly 'create.image': {
|
|
1690
1690
|
readonly memberPath: "create.image";
|
|
1691
1691
|
readonly description: "Insert a new image at the target position.";
|
|
1692
|
-
readonly expectedResult: "Returns a CreateImageResult with the new image address. Tracked-mode results include `trackedChangeRefs` pointing at the tracked insertion review entity.";
|
|
1692
|
+
readonly expectedResult: "Returns a CreateImageResult with the new image address. Tracked-mode results include `trackedChangeRefs` pointing at the tracked insertion review entity. When the target is an inherited or missing header/footer slot, Word-compatible ownership materialization applies immediately; review controls the inserted image.";
|
|
1693
1693
|
readonly requiresDocumentContext: true;
|
|
1694
1694
|
readonly metadata: CommandStaticMetadata;
|
|
1695
1695
|
readonly referenceDocPath: "create/image.mdx";
|
|
@@ -111,4 +111,6 @@ export type DiffChangeMode = 'direct' | 'tracked';
|
|
|
111
111
|
/** Options for `diff.apply`. Omitted `changeMode` applies story content directly. */
|
|
112
112
|
export interface DiffApplyOptions {
|
|
113
113
|
changeMode?: DiffChangeMode;
|
|
114
|
+
/** Requires the current document revision; a mismatch fails before any diff operation applies. */
|
|
115
|
+
expectedRevision?: string;
|
|
114
116
|
}
|
|
@@ -34,7 +34,7 @@ export interface HyperlinkSpec {
|
|
|
34
34
|
tooltip?: string;
|
|
35
35
|
/** Link target frame (_blank, _self, etc.). */
|
|
36
36
|
target?: string;
|
|
37
|
-
/**
|
|
37
|
+
/** Browser relationship tokens kept for the current editing session; not persisted in DOCX or reviewed by Word. */
|
|
38
38
|
rel?: string;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -49,15 +49,17 @@ export interface HyperlinkPatch {
|
|
|
49
49
|
docLocation?: string | null;
|
|
50
50
|
tooltip?: string | null;
|
|
51
51
|
target?: string | null;
|
|
52
|
+
/** Session-only browser relationship tokens. Null or an empty string clears them; omission preserves them. */
|
|
52
53
|
rel?: string | null;
|
|
53
54
|
}
|
|
54
|
-
/**
|
|
55
|
+
/** Native hyperlink properties and browser metadata for the current editing session. */
|
|
55
56
|
export interface HyperlinkReadProperties {
|
|
56
57
|
href?: string;
|
|
57
58
|
anchor?: string;
|
|
58
59
|
docLocation?: string;
|
|
59
60
|
tooltip?: string;
|
|
60
61
|
target?: string;
|
|
62
|
+
/** Browser relationship tokens for this session. A fresh DOCX open does not restore them. */
|
|
61
63
|
rel?: string;
|
|
62
64
|
}
|
|
63
65
|
/** Domain payload for discovery items in hyperlinks.list. */
|
|
@@ -30,7 +30,7 @@ import { CreateAdapter, CreateApi } from './create/create.js';
|
|
|
30
30
|
import { BlocksAdapter, BlocksApi } from './blocks/blocks.js';
|
|
31
31
|
import { TableLocator, TableMutationResult, TablesConvertFromTextInput, TablesMoveInput, TablesSplitInput, TablesConvertToTextInput, TablesSetLayoutInput, TablesInsertRowInput, TablesDeleteRowInput, TablesMoveRowInput, TablesSetRowHeightInput, TablesDistributeRowsInput, TablesSetRowOptionsInput, TablesInsertColumnInput, TablesDeleteColumnInput, TablesMoveColumnInput, TablesSetColumnWidthInput, TablesDistributeColumnsInput, TablesInsertCellInput, TablesDeleteCellInput, TablesMergeCellsInput, TablesUnmergeCellsInput, TablesSplitCellInput, TablesSetCellPropertiesInput, TablesSetCellTextInput, TablesSortInput, TablesSetAltTextInput, TablesSetStyleInput, TablesClearStyleInput, TablesSetStyleOptionInput, TablesSetBorderInput, TablesClearBorderInput, TablesApplyBorderPresetInput, TablesSetShadingInput, TablesClearShadingInput, TablesSetTablePaddingInput, TablesSetCellPaddingInput, TablesSetCellSpacingInput, TablesClearCellSpacingInput, TablesApplyStyleInput, TablesSetBordersInput, TablesSetTableOptionsInput, TablesApplyPresetInput, TablesGetInput, TablesGetOutput, TablesGetCellsInput, TablesGetCellsOutput, TablesGetPropertiesInput, TablesGetPropertiesOutput, TablesGetStylesInput, TablesGetStylesOutput, TablesSetDefaultStyleInput, TablesClearDefaultStyleInput } from './types/table-operations.types.js';
|
|
32
32
|
import { TrackChangesAdapter, TrackChangesApi } from './track-changes/track-changes.js';
|
|
33
|
-
import { MutationOptions,
|
|
33
|
+
import { MutationOptions, RichContentMutationOptions, WriteAdapter } from './write/write.js';
|
|
34
34
|
import { SelectionMutationAdapter } from './selection-mutation.js';
|
|
35
35
|
import { CapabilitiesAdapter, DocumentApiCapabilities } from './capabilities/capabilities.js';
|
|
36
36
|
import { SDHtmlMarkdownSupportCheckInput, SDHtmlMarkdownSupportCheckResult } from './capabilities/html-markdown-support.js';
|
|
@@ -326,7 +326,7 @@ export interface DocumentApi {
|
|
|
326
326
|
/**
|
|
327
327
|
* Clear all document body content, leaving a single empty paragraph.
|
|
328
328
|
*/
|
|
329
|
-
clearContent(input: ClearContentInput, options?:
|
|
329
|
+
clearContent(input: ClearContentInput, options?: MutationOptions): Receipt;
|
|
330
330
|
/**
|
|
331
331
|
* Comment operations.
|
|
332
332
|
*/
|
|
@@ -8,9 +8,8 @@ export type ChangeMode = 'direct' | 'tracked';
|
|
|
8
8
|
* Shared semantic validation for the `changeMode` mutation option.
|
|
9
9
|
*
|
|
10
10
|
* Error-code policy (v2-tracked-change-decision-error-contract plan, WS3):
|
|
11
|
-
* - A `changeMode` value of the wrong
|
|
12
|
-
*
|
|
13
|
-
* `VALIDATION_ERROR`). This validator does not touch non-string values.
|
|
11
|
+
* - A `changeMode` value of the wrong type is a malformed shape and surfaces
|
|
12
|
+
* `VALIDATION_ERROR`, including dynamic calls without upstream schema validation.
|
|
14
13
|
* - A `changeMode` *string* outside the accepted enum is a semantic option
|
|
15
14
|
* error and fails closed with `INVALID_INPUT`, not the generic
|
|
16
15
|
* `VALIDATION_ERROR`. This keeps semantic option failures distinct from
|
|
@@ -20,7 +20,7 @@ export type SupportedV2ProviderFamily = 'y-websocket' | 'hocuspocus' | 'livebloc
|
|
|
20
20
|
* collaboration room. These strings are part of the diagnostic contract and are
|
|
21
21
|
* safe to assert against in tests; they never carry caller-provided values.
|
|
22
22
|
*/
|
|
23
|
-
export type V2CollaborationUnsupportedReason = 'missing-target' | 'invalid-document-id' | 'invalid-server-url' | 'invalid-room-mode' | 'invalid-auth-endpoint' | 'invalid-adapter-id' | 'invalid-provider-options' | 'missing-auth' | 'mixed-auth' | 'unsupported-document-type' | 'unsupported-multi-document' | 'unsupported-legacy-provider' | 'unsupported-provider-family';
|
|
23
|
+
export type V2CollaborationUnsupportedReason = 'missing-target' | 'invalid-document-id' | 'invalid-server-url' | 'invalid-room-mode' | 'invalid-auth-endpoint' | 'invalid-adapter-id' | 'invalid-provider-options' | 'invalid-sync-timeout' | 'missing-auth' | 'mixed-auth' | 'unsupported-document-type' | 'unsupported-multi-document' | 'unsupported-legacy-provider' | 'unsupported-provider-family';
|
|
24
24
|
/**
|
|
25
25
|
* Normalized, supported v2 collaboration room target.
|
|
26
26
|
*
|
|
@@ -47,6 +47,8 @@ export interface NormalizedV2CollaborationTarget {
|
|
|
47
47
|
adapterId?: string;
|
|
48
48
|
/** Structured-clone-safe options interpreted by the registered adapter. */
|
|
49
49
|
providerOptions?: unknown;
|
|
50
|
+
/** Maximum initial synchronization wait in milliseconds. */
|
|
51
|
+
syncTimeoutMs?: number;
|
|
50
52
|
/** Explicit room operation; join is the default at the untrusted input boundary. */
|
|
51
53
|
roomMode: 'join' | 'create';
|
|
52
54
|
}
|
|
@@ -644,6 +644,8 @@ export interface V2YWebsocketCollaborationConfig {
|
|
|
644
644
|
* an auth token). Values are strings.
|
|
645
645
|
*/
|
|
646
646
|
params?: Record<string, string> | null;
|
|
647
|
+
/** Maximum initial synchronization wait in milliseconds. Defaults to 30,000. */
|
|
648
|
+
syncTimeoutMs?: number;
|
|
647
649
|
/** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
|
|
648
650
|
roomMode?: 'join' | 'create';
|
|
649
651
|
}
|
|
@@ -660,6 +662,8 @@ export interface V2HocuspocusCollaborationConfig {
|
|
|
660
662
|
params?: Record<string, string> | null;
|
|
661
663
|
/** Static auth token or resolver invoked for every Hocuspocus connection. */
|
|
662
664
|
token?: string | (() => string | Promise<string>);
|
|
665
|
+
/** Maximum initial synchronization wait in milliseconds. Defaults to 30,000. */
|
|
666
|
+
syncTimeoutMs?: number;
|
|
663
667
|
/** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
|
|
664
668
|
roomMode?: 'join' | 'create';
|
|
665
669
|
}
|
|
@@ -683,6 +687,8 @@ export interface V2LiveblocksCollaborationConfig {
|
|
|
683
687
|
* page; non-browser SDK/CLI callers must use an absolute HTTP(S) URL.
|
|
684
688
|
*/
|
|
685
689
|
authEndpoint?: string;
|
|
690
|
+
/** Maximum initial synchronization wait in milliseconds. Defaults to 30,000. */
|
|
691
|
+
syncTimeoutMs?: number;
|
|
686
692
|
/** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
|
|
687
693
|
roomMode?: 'join' | 'create';
|
|
688
694
|
}
|
|
@@ -697,6 +703,8 @@ export interface V2ProviderExtensionCollaborationConfig {
|
|
|
697
703
|
providerOptions?: unknown;
|
|
698
704
|
/** Optional host-owned credential resolver available to the adapter. */
|
|
699
705
|
token?: string | (() => string | Promise<string>);
|
|
706
|
+
/** Maximum initial synchronization wait in milliseconds. Defaults to 30,000. */
|
|
707
|
+
syncTimeoutMs?: number;
|
|
700
708
|
/** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
|
|
701
709
|
roomMode?: 'join' | 'create';
|
|
702
710
|
}
|
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.16.1-next.
|
|
319
|
+
return "2.16.1-next.4";
|
|
320
320
|
} catch {
|
|
321
321
|
return "unknown";
|
|
322
322
|
}
|
|
@@ -5380,6 +5380,20 @@ function normalizeRoomMode(value) {
|
|
|
5380
5380
|
if (value === void 0) return "join";
|
|
5381
5381
|
return value === "join" || value === "create" ? value : null;
|
|
5382
5382
|
}
|
|
5383
|
+
function normalizeSyncTimeoutMs(value) {
|
|
5384
|
+
if (value === void 0) return void 0;
|
|
5385
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 && value <= 2147483647 ? value : null;
|
|
5386
|
+
}
|
|
5387
|
+
function withSyncTimeout(resolution, syncTimeoutMs) {
|
|
5388
|
+
if (!resolution.ok || syncTimeoutMs === void 0) return resolution;
|
|
5389
|
+
return {
|
|
5390
|
+
ok: true,
|
|
5391
|
+
target: {
|
|
5392
|
+
...resolution.target,
|
|
5393
|
+
syncTimeoutMs
|
|
5394
|
+
}
|
|
5395
|
+
};
|
|
5396
|
+
}
|
|
5383
5397
|
function invalidRoomMode() {
|
|
5384
5398
|
return {
|
|
5385
5399
|
ok: false,
|
|
@@ -5567,11 +5581,17 @@ function resolveV2CollaborationTarget(input) {
|
|
|
5567
5581
|
reason: "unsupported-legacy-provider",
|
|
5568
5582
|
message: "SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."
|
|
5569
5583
|
};
|
|
5584
|
+
const syncTimeoutMs = normalizeSyncTimeoutMs(candidate.syncTimeoutMs);
|
|
5585
|
+
if (syncTimeoutMs === null) return {
|
|
5586
|
+
ok: false,
|
|
5587
|
+
reason: "invalid-sync-timeout",
|
|
5588
|
+
message: "SuperDoc v2 collaboration syncTimeoutMs must be a finite positive number within the JavaScript timer range."
|
|
5589
|
+
};
|
|
5570
5590
|
const providerType = readProviderType(candidate);
|
|
5571
|
-
if (providerType === null || providerType === "y-websocket") return resolveWebsocketFamily("y-websocket", candidate);
|
|
5572
|
-
if (providerType === "hocuspocus") return resolveWebsocketFamily("hocuspocus", candidate);
|
|
5573
|
-
if (providerType === "liveblocks") return resolveLiveblocksFamily(candidate, authEndpointBaseUrl);
|
|
5574
|
-
if (providerType === "extension") return resolveProviderExtension(candidate);
|
|
5591
|
+
if (providerType === null || providerType === "y-websocket") return withSyncTimeout(resolveWebsocketFamily("y-websocket", candidate), syncTimeoutMs);
|
|
5592
|
+
if (providerType === "hocuspocus") return withSyncTimeout(resolveWebsocketFamily("hocuspocus", candidate), syncTimeoutMs);
|
|
5593
|
+
if (providerType === "liveblocks") return withSyncTimeout(resolveLiveblocksFamily(candidate, authEndpointBaseUrl), syncTimeoutMs);
|
|
5594
|
+
if (providerType === "extension") return withSyncTimeout(resolveProviderExtension(candidate), syncTimeoutMs);
|
|
5575
5595
|
return {
|
|
5576
5596
|
ok: false,
|
|
5577
5597
|
reason: "unsupported-provider-family",
|
|
@@ -45690,7 +45710,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
45690
45710
|
this.config.colors = shuffleArray(this.config.colors);
|
|
45691
45711
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
45692
45712
|
this.colorIndex = 0;
|
|
45693
|
-
this.version = "2.16.1-next.
|
|
45713
|
+
this.version = "2.16.1-next.4";
|
|
45694
45714
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
45695
45715
|
this.superdocId = config.superdocId || require_uuid.v4();
|
|
45696
45716
|
this.colors = this.config.colors ?? [];
|
|
@@ -46351,11 +46371,13 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46351
46371
|
storeDoc.v2Collaboration = value;
|
|
46352
46372
|
}
|
|
46353
46373
|
#toV2CollaborationConfig(target) {
|
|
46374
|
+
const syncTimeoutOption = target.syncTimeoutMs === void 0 ? {} : { syncTimeoutMs: target.syncTimeoutMs };
|
|
46354
46375
|
if (target.providerFamily === "extension") return {
|
|
46355
46376
|
providerType: "extension",
|
|
46356
46377
|
adapterId: target.adapterId,
|
|
46357
46378
|
documentId: target.documentId,
|
|
46358
46379
|
roomMode: target.roomMode,
|
|
46380
|
+
...syncTimeoutOption,
|
|
46359
46381
|
...target.providerOptions !== void 0 ? { providerOptions: target.providerOptions } : {},
|
|
46360
46382
|
...target.token ? { token: target.token } : {}
|
|
46361
46383
|
};
|
|
@@ -46363,6 +46385,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46363
46385
|
providerType: "liveblocks",
|
|
46364
46386
|
documentId: target.documentId,
|
|
46365
46387
|
roomMode: target.roomMode,
|
|
46388
|
+
...syncTimeoutOption,
|
|
46366
46389
|
...target.publicApiKey ? { publicApiKey: target.publicApiKey } : {},
|
|
46367
46390
|
...target.authEndpoint ? { authEndpoint: target.authEndpoint } : {}
|
|
46368
46391
|
};
|
|
@@ -46370,6 +46393,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46370
46393
|
providerType: "hocuspocus",
|
|
46371
46394
|
documentId: target.documentId,
|
|
46372
46395
|
roomMode: target.roomMode,
|
|
46396
|
+
...syncTimeoutOption,
|
|
46373
46397
|
...target.serverUrl ? { serverUrl: target.serverUrl } : {},
|
|
46374
46398
|
...target.params ? { params: target.params } : {},
|
|
46375
46399
|
...target.token ? { token: target.token } : {}
|
|
@@ -46378,6 +46402,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46378
46402
|
providerType: "y-websocket",
|
|
46379
46403
|
documentId: target.documentId,
|
|
46380
46404
|
roomMode: target.roomMode,
|
|
46405
|
+
...syncTimeoutOption,
|
|
46381
46406
|
...target.serverUrl ? { serverUrl: target.serverUrl } : {},
|
|
46382
46407
|
...target.params ? { params: target.params } : {}
|
|
46383
46408
|
};
|
package/dist/superdoc.es.js
CHANGED
|
@@ -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.16.1-next.
|
|
318
|
+
return "2.16.1-next.4";
|
|
319
319
|
} catch {
|
|
320
320
|
return "unknown";
|
|
321
321
|
}
|
|
@@ -5379,6 +5379,20 @@ function normalizeRoomMode(value) {
|
|
|
5379
5379
|
if (value === void 0) return "join";
|
|
5380
5380
|
return value === "join" || value === "create" ? value : null;
|
|
5381
5381
|
}
|
|
5382
|
+
function normalizeSyncTimeoutMs(value) {
|
|
5383
|
+
if (value === void 0) return void 0;
|
|
5384
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 && value <= 2147483647 ? value : null;
|
|
5385
|
+
}
|
|
5386
|
+
function withSyncTimeout(resolution, syncTimeoutMs) {
|
|
5387
|
+
if (!resolution.ok || syncTimeoutMs === void 0) return resolution;
|
|
5388
|
+
return {
|
|
5389
|
+
ok: true,
|
|
5390
|
+
target: {
|
|
5391
|
+
...resolution.target,
|
|
5392
|
+
syncTimeoutMs
|
|
5393
|
+
}
|
|
5394
|
+
};
|
|
5395
|
+
}
|
|
5382
5396
|
function invalidRoomMode() {
|
|
5383
5397
|
return {
|
|
5384
5398
|
ok: false,
|
|
@@ -5566,11 +5580,17 @@ function resolveV2CollaborationTarget(input) {
|
|
|
5566
5580
|
reason: "unsupported-legacy-provider",
|
|
5567
5581
|
message: "SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."
|
|
5568
5582
|
};
|
|
5583
|
+
const syncTimeoutMs = normalizeSyncTimeoutMs(candidate.syncTimeoutMs);
|
|
5584
|
+
if (syncTimeoutMs === null) return {
|
|
5585
|
+
ok: false,
|
|
5586
|
+
reason: "invalid-sync-timeout",
|
|
5587
|
+
message: "SuperDoc v2 collaboration syncTimeoutMs must be a finite positive number within the JavaScript timer range."
|
|
5588
|
+
};
|
|
5569
5589
|
const providerType = readProviderType(candidate);
|
|
5570
|
-
if (providerType === null || providerType === "y-websocket") return resolveWebsocketFamily("y-websocket", candidate);
|
|
5571
|
-
if (providerType === "hocuspocus") return resolveWebsocketFamily("hocuspocus", candidate);
|
|
5572
|
-
if (providerType === "liveblocks") return resolveLiveblocksFamily(candidate, authEndpointBaseUrl);
|
|
5573
|
-
if (providerType === "extension") return resolveProviderExtension(candidate);
|
|
5590
|
+
if (providerType === null || providerType === "y-websocket") return withSyncTimeout(resolveWebsocketFamily("y-websocket", candidate), syncTimeoutMs);
|
|
5591
|
+
if (providerType === "hocuspocus") return withSyncTimeout(resolveWebsocketFamily("hocuspocus", candidate), syncTimeoutMs);
|
|
5592
|
+
if (providerType === "liveblocks") return withSyncTimeout(resolveLiveblocksFamily(candidate, authEndpointBaseUrl), syncTimeoutMs);
|
|
5593
|
+
if (providerType === "extension") return withSyncTimeout(resolveProviderExtension(candidate), syncTimeoutMs);
|
|
5574
5594
|
return {
|
|
5575
5595
|
ok: false,
|
|
5576
5596
|
reason: "unsupported-provider-family",
|
|
@@ -45621,7 +45641,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
45621
45641
|
this.config.colors = shuffleArray(this.config.colors);
|
|
45622
45642
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
45623
45643
|
this.colorIndex = 0;
|
|
45624
|
-
this.version = "2.16.1-next.
|
|
45644
|
+
this.version = "2.16.1-next.4";
|
|
45625
45645
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
45626
45646
|
this.superdocId = config.superdocId || v4();
|
|
45627
45647
|
this.colors = this.config.colors ?? [];
|
|
@@ -46282,11 +46302,13 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46282
46302
|
storeDoc.v2Collaboration = value;
|
|
46283
46303
|
}
|
|
46284
46304
|
#toV2CollaborationConfig(target) {
|
|
46305
|
+
const syncTimeoutOption = target.syncTimeoutMs === void 0 ? {} : { syncTimeoutMs: target.syncTimeoutMs };
|
|
46285
46306
|
if (target.providerFamily === "extension") return {
|
|
46286
46307
|
providerType: "extension",
|
|
46287
46308
|
adapterId: target.adapterId,
|
|
46288
46309
|
documentId: target.documentId,
|
|
46289
46310
|
roomMode: target.roomMode,
|
|
46311
|
+
...syncTimeoutOption,
|
|
46290
46312
|
...target.providerOptions !== void 0 ? { providerOptions: target.providerOptions } : {},
|
|
46291
46313
|
...target.token ? { token: target.token } : {}
|
|
46292
46314
|
};
|
|
@@ -46294,6 +46316,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46294
46316
|
providerType: "liveblocks",
|
|
46295
46317
|
documentId: target.documentId,
|
|
46296
46318
|
roomMode: target.roomMode,
|
|
46319
|
+
...syncTimeoutOption,
|
|
46297
46320
|
...target.publicApiKey ? { publicApiKey: target.publicApiKey } : {},
|
|
46298
46321
|
...target.authEndpoint ? { authEndpoint: target.authEndpoint } : {}
|
|
46299
46322
|
};
|
|
@@ -46301,6 +46324,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46301
46324
|
providerType: "hocuspocus",
|
|
46302
46325
|
documentId: target.documentId,
|
|
46303
46326
|
roomMode: target.roomMode,
|
|
46327
|
+
...syncTimeoutOption,
|
|
46304
46328
|
...target.serverUrl ? { serverUrl: target.serverUrl } : {},
|
|
46305
46329
|
...target.params ? { params: target.params } : {},
|
|
46306
46330
|
...target.token ? { token: target.token } : {}
|
|
@@ -46309,6 +46333,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46309
46333
|
providerType: "y-websocket",
|
|
46310
46334
|
documentId: target.documentId,
|
|
46311
46335
|
roomMode: target.roomMode,
|
|
46336
|
+
...syncTimeoutOption,
|
|
46312
46337
|
...target.serverUrl ? { serverUrl: target.serverUrl } : {},
|
|
46313
46338
|
...target.params ? { params: target.params } : {}
|
|
46314
46339
|
};
|