superdoc 2.16.1-next.3 → 2.16.1-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/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/capabilities/capabilities.d.ts +31 -1
- package/dist/document-api/src/contract/command-catalog.d.ts +5 -1
- package/dist/document-api/src/contract/metadata-types.d.ts +6 -0
- package/dist/document-api/src/contract/operation-definitions.d.ts +162 -43
- package/dist/document-api/src/contract/operation-registry.d.ts +20 -2037
- package/dist/document-api/src/contract/types.d.ts +1 -1
- package/dist/document-api/src/index.d.ts +6 -2
- package/dist/document-api/src/invoke/invoke.d.ts +3 -7
- 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/src/public/ui/types.d.ts +1 -1
- package/dist/superdoc/src/public/ui.d.cts +2 -0
- package/dist/superdoc/src/public/ui.d.ts +1 -1
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OperationId } from './operation-definitions.js';
|
|
2
2
|
import { CommandStaticMetadata } from './metadata-types.js';
|
|
3
|
-
export { OPERATION_IDEMPOTENCY_VALUES, type OperationIdempotency, PRE_APPLY_THROW_CODES, type PreApplyThrowCode, type CommandThrowPolicy, type CommandStaticMetadata, } from './metadata-types.js';
|
|
3
|
+
export { OPERATION_IDEMPOTENCY_VALUES, type OperationIdempotency, OPERATION_TRACKED_SUPPORT_VALUES, type OperationTrackedSupport, PRE_APPLY_THROW_CODES, type PreApplyThrowCode, type CommandThrowPolicy, type CommandStaticMetadata, } from './metadata-types.js';
|
|
4
4
|
export { type OperationId, OPERATION_IDS, SINGLETON_OPERATION_IDS, NAMESPACED_OPERATION_IDS, } from './operation-definitions.js';
|
|
5
5
|
export declare const CONTRACT_VERSION = "0.1.0";
|
|
6
6
|
export declare const JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
@@ -32,7 +32,7 @@ import { TableLocator, TableMutationResult, TablesConvertFromTextInput, TablesMo
|
|
|
32
32
|
import { TrackChangesAdapter, TrackChangesApi } from './track-changes/track-changes.js';
|
|
33
33
|
import { MutationOptions, RichContentMutationOptions, WriteAdapter } from './write/write.js';
|
|
34
34
|
import { SelectionMutationAdapter } from './selection-mutation.js';
|
|
35
|
-
import { CapabilitiesAdapter, DocumentApiCapabilities } from './capabilities/capabilities.js';
|
|
35
|
+
import { CapabilitiesAdapter, DocumentApiCapabilities, OperationCapabilityResolveInput, OperationCapabilityResolveResult } from './capabilities/capabilities.js';
|
|
36
36
|
import { SDHtmlMarkdownSupportCheckInput, SDHtmlMarkdownSupportCheckResult } from './capabilities/html-markdown-support.js';
|
|
37
37
|
import { OperationId } from './contract/types.js';
|
|
38
38
|
import { DynamicInvokeRequest, InvokeRequest, InvokeResult } from './contract/operation-registry.js';
|
|
@@ -242,6 +242,7 @@ export interface CapabilitiesApi {
|
|
|
242
242
|
(): DocumentApiCapabilities;
|
|
243
243
|
get(): DocumentApiCapabilities;
|
|
244
244
|
check(input: SDHtmlMarkdownSupportCheckInput): Promise<SDHtmlMarkdownSupportCheckResult>;
|
|
245
|
+
resolve(input: OperationCapabilityResolveInput): OperationCapabilityResolveResult;
|
|
245
246
|
}
|
|
246
247
|
export interface QueryApi {
|
|
247
248
|
/** Accepts canonical nested input or a selector shorthand normalized to `{ select: ... }` internally. */
|
|
@@ -267,7 +268,7 @@ export interface MutationsAdapter {
|
|
|
267
268
|
/**
|
|
268
269
|
* The Document API interface for querying and inspecting document nodes.
|
|
269
270
|
*/
|
|
270
|
-
export interface
|
|
271
|
+
export interface DocumentApiSurface {
|
|
271
272
|
/**
|
|
272
273
|
* Read the full document as an SDDocument structure.
|
|
273
274
|
* @param input - Get input with optional read options.
|
|
@@ -511,6 +512,9 @@ export interface DocumentApi {
|
|
|
511
512
|
* Callable directly (`capabilities()`) or via `.get()`.
|
|
512
513
|
*/
|
|
513
514
|
capabilities: CapabilitiesApi;
|
|
515
|
+
}
|
|
516
|
+
/** Complete Document API surface, including typed dynamic invocation. */
|
|
517
|
+
export interface DocumentApi extends DocumentApiSurface {
|
|
514
518
|
/**
|
|
515
519
|
* Dynamically dispatch any operation by its operation ID.
|
|
516
520
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OperationId } from '../contract/types.js';
|
|
2
1
|
import { OperationRegistry } from '../contract/operation-registry.js';
|
|
2
|
+
import { OperationId } from '../contract/types.js';
|
|
3
3
|
import { DocumentApi } from '../index.js';
|
|
4
4
|
type DispatchOutput<K extends OperationId> = K extends 'mutations.preview' | 'mutations.apply' ? Promise<OperationRegistry[K]['output']> : K extends 'plan.execute' ? OperationRegistry[K]['output'] | Promise<OperationRegistry[K]['output']> : OperationRegistry[K]['output'];
|
|
5
5
|
type TypedDispatchHandler<K extends OperationId> = OperationRegistry[K]['options'] extends never ? (input: OperationRegistry[K]['input']) => DispatchOutput<K> : (input: OperationRegistry[K]['input'], options?: OperationRegistry[K]['options']) => DispatchOutput<K>;
|
|
@@ -7,12 +7,8 @@ export type TypedDispatchTable = {
|
|
|
7
7
|
[K in OperationId]: TypedDispatchHandler<K>;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
|
-
* Builds
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Each entry delegates to the direct method: no parallel execution path.
|
|
14
|
-
* The return type is {@link TypedDispatchTable}, which validates at compile
|
|
15
|
-
* time that each handler conforms to the {@link OperationRegistry} contract.
|
|
10
|
+
* Builds the generic invoke dispatch from the same operation definitions that
|
|
11
|
+
* publish operation IDs and direct API member paths.
|
|
16
12
|
*/
|
|
17
13
|
export declare function buildDispatchTable(api: DocumentApi): TypedDispatchTable;
|
|
18
14
|
export {};
|
|
@@ -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
|
}
|
|
@@ -30,7 +30,7 @@ import { BuiltInCommandId } from './commands.js';
|
|
|
30
30
|
* (`scripts/ensure-types.cjs` `rewriteDocApiPaths`), so no bare private
|
|
31
31
|
* specifier leaks into the emitted `.d.ts`.
|
|
32
32
|
*/
|
|
33
|
-
export type { Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, DocumentApi, EntityAddress, CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, RichContentInsertInput, SDHtmlMarkdownSupportCheckResult, PictureWatermarkInput, TextWatermark, WatermarkInfo, WatermarkTarget, } from '../../../../document-api/src/index.js';
|
|
33
|
+
export type { Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, DocumentApi, EntityAddress, CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, RichContentInsertInput, OperationCapabilityResolveResult, SDHtmlMarkdownSupportCheckResult, PictureWatermarkInput, TextWatermark, WatermarkInfo, WatermarkTarget, } from '../../../../document-api/src/index.js';
|
|
34
34
|
export type { StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, } from '../../../../document-api/src/index.js';
|
|
35
35
|
export type { ListPresetId } from '../../../../document-api/src/index.js';
|
|
36
36
|
export type { BrowserDocumentApi, PartialBrowserDocumentApi } from '../browser-document-api.js';
|
|
@@ -40,6 +40,7 @@ import type { FontsHandle as __Cjs_FontsHandle } from './ui.js' with { "resoluti
|
|
|
40
40
|
import type { FontSizeOption as __Cjs_FontSizeOption } from './ui.js' with { "resolution-mode": "import" };
|
|
41
41
|
import type { FontsSlice as __Cjs_FontsSlice } from './ui.js' with { "resolution-mode": "import" };
|
|
42
42
|
import type { MetadataHandle as __Cjs_MetadataHandle } from './ui.js' with { "resolution-mode": "import" };
|
|
43
|
+
import type { OperationCapabilityResolveResult as __Cjs_OperationCapabilityResolveResult } from './ui.js' with { "resolution-mode": "import" };
|
|
43
44
|
import type { PartialBrowserDocumentApi as __Cjs_PartialBrowserDocumentApi } from './ui.js' with { "resolution-mode": "import" };
|
|
44
45
|
import type { PictureWatermarkInput as __Cjs_PictureWatermarkInput } from './ui.js' with { "resolution-mode": "import" };
|
|
45
46
|
import type { Receipt as __Cjs_Receipt } from './ui.js' with { "resolution-mode": "import" };
|
|
@@ -154,6 +155,7 @@ export type { __Cjs_FontsHandle as FontsHandle };
|
|
|
154
155
|
export type { __Cjs_FontSizeOption as FontSizeOption };
|
|
155
156
|
export type { __Cjs_FontsSlice as FontsSlice };
|
|
156
157
|
export type { __Cjs_MetadataHandle as MetadataHandle };
|
|
158
|
+
export type { __Cjs_OperationCapabilityResolveResult as OperationCapabilityResolveResult };
|
|
157
159
|
export type { __Cjs_PartialBrowserDocumentApi as PartialBrowserDocumentApi };
|
|
158
160
|
export type { __Cjs_PictureWatermarkInput as PictureWatermarkInput };
|
|
159
161
|
export type { __Cjs_Receipt as Receipt };
|
|
@@ -26,4 +26,4 @@
|
|
|
26
26
|
export { createSuperDocUI } from './ui/create-super-doc-ui.js';
|
|
27
27
|
export { shallowEqual } from './ui/equality.js';
|
|
28
28
|
export { BUILT_IN_COMMAND_IDS } from './ui/commands.js';
|
|
29
|
-
export type { EqualityFn, SelectorFn, Subscribable, SuperDocUI, BorrowedSuperDocUI, SuperDocUIOptions, SuperDocUIState, SuperDocUIScope, SuperDocLike, SuperDocEditorLike, CommandHandle, CommandState, CommandExecutionResult, WorkflowReceipt, WorkflowActionResult, WorkflowScrollResult, SelectionRestoreResult, SuperDocUIReason, CommandId, CommandsHandle, ContextMenuItem, ContextMenuHandle, SearchController, SearchHandle, SearchQueryOptions, CustomCommandContext, CustomCommandHandle, CustomCommandHandleState, CustomCommandRegistration, CustomCommandRegistrationResult, MetadataHandle, SelectionHandle, ToolbarHandle, BuiltInCommandId, ToolbarCommandId, CommentsHandle, TrackChangesHandle, ContentControlsHandle, ContentControlFocusResult, ContentControlHighlightResult, FontsHandle, ZoomHandle, DocumentHandle, DocumentReplacementResult, ViewportHandle, StylesHandle, ActiveParagraphStyle, SliceStatus, SelectionSlice, SelectionCapture, CommentAnchorCapture, ToolbarSnapshotSlice, CommentsSlice, TrackChangesSlice, ContentControlsSlice, FontsSlice, ZoomSlice, DocumentSlice, StylesSlice, SearchSnapshot, SearchSlice, StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, CommentInfo, CommentsListQuery, TrackChangeInfo, TrackChangePointHit, TrackChangesItem, FontFamilyOption, FontSizeOption, CommentAddress, TrackedChangeAddress, ContentControlViewportAddress, ViewportEntityAddress, ViewportEntityHit, ViewportContext, ViewportRect, ViewportGetRectInput, ViewportRectResult, BrowserDocumentApi, PartialBrowserDocumentApi, DocumentApi, Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, EntityAddress, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, RichContentInsertInput, SDHtmlMarkdownSupportCheckResult, PictureWatermarkInput, TextWatermark, WatermarkInfo, WatermarkTarget, } from './ui/types.js';
|
|
29
|
+
export type { EqualityFn, SelectorFn, Subscribable, SuperDocUI, BorrowedSuperDocUI, SuperDocUIOptions, SuperDocUIState, SuperDocUIScope, SuperDocLike, SuperDocEditorLike, CommandHandle, CommandState, CommandExecutionResult, WorkflowReceipt, WorkflowActionResult, WorkflowScrollResult, SelectionRestoreResult, SuperDocUIReason, CommandId, CommandsHandle, ContextMenuItem, ContextMenuHandle, SearchController, SearchHandle, SearchQueryOptions, CustomCommandContext, CustomCommandHandle, CustomCommandHandleState, CustomCommandRegistration, CustomCommandRegistrationResult, MetadataHandle, SelectionHandle, ToolbarHandle, BuiltInCommandId, ToolbarCommandId, CommentsHandle, TrackChangesHandle, ContentControlsHandle, ContentControlFocusResult, ContentControlHighlightResult, FontsHandle, ZoomHandle, DocumentHandle, DocumentReplacementResult, ViewportHandle, StylesHandle, ActiveParagraphStyle, SliceStatus, SelectionSlice, SelectionCapture, CommentAnchorCapture, ToolbarSnapshotSlice, CommentsSlice, TrackChangesSlice, ContentControlsSlice, FontsSlice, ZoomSlice, DocumentSlice, StylesSlice, SearchSnapshot, SearchSlice, StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, CommentInfo, CommentsListQuery, TrackChangeInfo, TrackChangePointHit, TrackChangesItem, FontFamilyOption, FontSizeOption, CommentAddress, TrackedChangeAddress, ContentControlViewportAddress, ViewportEntityAddress, ViewportEntityHit, ViewportContext, ViewportRect, ViewportGetRectInput, ViewportRectResult, BrowserDocumentApi, PartialBrowserDocumentApi, DocumentApi, Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, EntityAddress, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, RichContentInsertInput, OperationCapabilityResolveResult, SDHtmlMarkdownSupportCheckResult, PictureWatermarkInput, TextWatermark, WatermarkInfo, WatermarkTarget, } from './ui/types.js';
|
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.5";
|
|
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.5";
|
|
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.5";
|
|
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.5";
|
|
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
|
};
|