@inditextech/weave-store-websockets 0.2.1 → 0.3.1
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/client.cjs +39 -6
- package/dist/client.d.cts +55 -25
- package/dist/client.d.ts +55 -25
- package/dist/client.js +11 -1
- package/dist/server.cjs +42 -8
- package/dist/server.d.cts +31 -2
- package/dist/server.d.ts +31 -2
- package/dist/server.js +10 -2
- package/package.json +6 -5
- package/dist/types-BH9hIv5b.cjs +0 -63
- package/dist/types-Cq7de9Ah.js +0 -13
- package/dist/types.d-BmaSRpK3.d.ts +0 -33
- package/dist/types.d-BvFBHeXv.d.cts +0 -33
package/dist/client.cjs
CHANGED
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
//#region rolldown:runtime
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
const __inditextech_weave_sdk = __toESM(require("@inditextech/weave-sdk"));
|
|
4
26
|
require("@inditextech/weave-types");
|
|
5
|
-
|
|
27
|
+
require("yjs");
|
|
28
|
+
require("http");
|
|
29
|
+
const y_websocket = __toESM(require("y-websocket"));
|
|
30
|
+
|
|
31
|
+
//#region src/constants.ts
|
|
32
|
+
const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
33
|
+
const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS = {
|
|
34
|
+
["CONNECTING"]: "connecting",
|
|
35
|
+
["CONNECTED"]: "connected",
|
|
36
|
+
["DISCONNECTED"]: "disconnected"
|
|
37
|
+
};
|
|
6
38
|
|
|
39
|
+
//#endregion
|
|
7
40
|
//#region src/store-websockets.ts
|
|
8
41
|
var WeaveStoreWebsockets = class extends __inditextech_weave_sdk.WeaveStore {
|
|
9
|
-
name =
|
|
42
|
+
name = WEAVE_STORE_WEBSOCKETS;
|
|
10
43
|
supportsUndoManager = true;
|
|
11
44
|
constructor(storeOptions, websocketOptions) {
|
|
12
45
|
super(storeOptions);
|
|
@@ -47,6 +80,6 @@ var WeaveStoreWebsockets = class extends __inditextech_weave_sdk.WeaveStore {
|
|
|
47
80
|
};
|
|
48
81
|
|
|
49
82
|
//#endregion
|
|
50
|
-
exports.WEAVE_STORE_WEBSOCKETS =
|
|
51
|
-
exports.WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS =
|
|
83
|
+
exports.WEAVE_STORE_WEBSOCKETS = WEAVE_STORE_WEBSOCKETS
|
|
84
|
+
exports.WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS = WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS
|
|
52
85
|
exports.WeaveStoreWebsockets = WeaveStoreWebsockets
|
package/dist/client.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ExtractRoomId, FetchInitialState, FetchRoom, PerformUpgrade, PersistRoom, WEAVE_STORE_WEBSOCKETS, WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS, WeaveStoreWebsocketsCallbacks, WeaveStoreWebsocketsConnectionStatus, WeaveStoreWebsocketsConnectionStatusKeys, WeaveStoreWebsocketsOptions } from "./types.d-BvFBHeXv.cjs";
|
|
2
1
|
import Konva from "konva";
|
|
3
2
|
import { Vector2d } from "konva/lib/types";
|
|
3
|
+
import * as Y$1 from "yjs";
|
|
4
4
|
import * as Y from "yjs";
|
|
5
5
|
import { Doc } from "yjs";
|
|
6
6
|
import Emittery from "emittery";
|
|
7
7
|
import pino, { Logger } from "pino";
|
|
8
8
|
import { StageConfig } from "konva/lib/Stage";
|
|
9
|
+
import { IncomingMessage } from "http";
|
|
9
10
|
import { WebsocketProvider } from "y-websocket";
|
|
10
11
|
|
|
11
12
|
//#region ../sdk/dist/sdk.d.ts
|
|
@@ -29,7 +30,7 @@ declare const WEAVE_EXPORT_FORMATS: {
|
|
|
29
30
|
//#endregion
|
|
30
31
|
//#region src/base/action.d.ts
|
|
31
32
|
interface WeaveActionBase {
|
|
32
|
-
|
|
33
|
+
onInit?(): void;
|
|
33
34
|
trigger(cancelAction: () => void, params?: unknown): unknown;
|
|
34
35
|
internalUpdate?(): void;
|
|
35
36
|
cleanup?(): void;
|
|
@@ -38,8 +39,8 @@ interface WeaveActionBase {
|
|
|
38
39
|
//#endregion
|
|
39
40
|
//#region src/base/plugin.d.ts
|
|
40
41
|
interface WeavePluginBase {
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
onInit?(): void;
|
|
43
|
+
onRender?(): void;
|
|
43
44
|
enable(): void;
|
|
44
45
|
disable(): void;
|
|
45
46
|
isEnabled(): boolean;
|
|
@@ -158,15 +159,15 @@ declare type docElementTypeDescription = "xml" | "text" | Array<any> | object;
|
|
|
158
159
|
declare type DocTypeDescription = {
|
|
159
160
|
[key: string]: docElementTypeDescription;
|
|
160
161
|
};
|
|
161
|
-
declare type MappedTypeDescription<T extends DocTypeDescription> = { readonly [P in keyof T]: T[P] extends "xml" ? Y.XmlFragment : T[P] extends "text" ? Y.Text : T[P] extends Array<any> ? T[P] : T[P] extends object ? Partial<T[P]> : never };
|
|
162
|
+
declare type MappedTypeDescription<T extends DocTypeDescription> = { readonly [P in keyof T]: T[P] extends "xml" ? Y$1.XmlFragment : T[P] extends "text" ? Y$1.Text : T[P] extends Array<any> ? T[P] : T[P] extends object ? Partial<T[P]> : never };
|
|
162
163
|
//#endregion
|
|
163
164
|
//#region src/base/node.d.ts
|
|
164
165
|
interface WeaveNodeBase {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
create(id: string, props: WeaveElementAttributes): WeaveStateElement;
|
|
167
|
+
onRender(props: WeaveElementAttributes): WeaveElementInstance;
|
|
168
|
+
onUpdate(instance: WeaveElementInstance, nextProps: WeaveElementAttributes): void;
|
|
169
|
+
onDestroy(instance: WeaveElementInstance): void;
|
|
170
|
+
serialize(instance: WeaveElementInstance): WeaveStateElement;
|
|
170
171
|
} //#endregion
|
|
171
172
|
//#region src/stores/store.d.ts
|
|
172
173
|
|
|
@@ -215,8 +216,8 @@ declare abstract class WeavePlugin implements WeavePluginBase {
|
|
|
215
216
|
getName(): string;
|
|
216
217
|
getLogger(): Logger;
|
|
217
218
|
isEnabled(): boolean;
|
|
218
|
-
abstract
|
|
219
|
-
abstract
|
|
219
|
+
abstract onInit?(): void;
|
|
220
|
+
abstract onRender?(): void;
|
|
220
221
|
abstract enable(): void;
|
|
221
222
|
abstract disable(): void;
|
|
222
223
|
}
|
|
@@ -240,12 +241,12 @@ declare class WeaveNodesSelectionPlugin extends WeavePlugin {
|
|
|
240
241
|
private selecting;
|
|
241
242
|
private initialized;
|
|
242
243
|
private callbacks;
|
|
243
|
-
|
|
244
|
+
onRender: undefined;
|
|
244
245
|
constructor(callbacks: WeaveNodesSelectionPluginCallbacks);
|
|
245
246
|
getName(): string;
|
|
246
247
|
getLayerName(): string;
|
|
247
248
|
initLayer(): void;
|
|
248
|
-
|
|
249
|
+
onInit(): void;
|
|
249
250
|
private getLayer;
|
|
250
251
|
private triggerSelectedNodesEvent;
|
|
251
252
|
private initEvents;
|
|
@@ -274,11 +275,11 @@ declare abstract class WeaveNode implements WeaveNodeBase {
|
|
|
274
275
|
isPasting(): boolean;
|
|
275
276
|
isNodeSelected(ele: Konva.Node): boolean;
|
|
276
277
|
setupDefaultNodeEvents(node: Konva.Node): void;
|
|
277
|
-
|
|
278
|
-
abstract
|
|
279
|
-
abstract
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
create(key: string, props: WeaveElementAttributes): WeaveStateElement;
|
|
279
|
+
abstract onRender(props: WeaveElementAttributes): WeaveElementInstance;
|
|
280
|
+
abstract onUpdate(instance: WeaveElementInstance, nextProps: WeaveElementAttributes): void;
|
|
281
|
+
onDestroy(nodeInstance: WeaveElementInstance): void;
|
|
282
|
+
serialize(instance: WeaveElementInstance): WeaveStateElement;
|
|
282
283
|
}
|
|
283
284
|
|
|
284
285
|
//#endregion
|
|
@@ -302,7 +303,7 @@ declare abstract class WeaveAction {
|
|
|
302
303
|
register(instance: Weave): WeaveAction;
|
|
303
304
|
updateProps(props: WeaveElementAttributes): void;
|
|
304
305
|
getProps(): WeaveElementAttributes;
|
|
305
|
-
abstract
|
|
306
|
+
abstract onInit?(): void;
|
|
306
307
|
abstract trigger(cancelAction: () => void, params?: unknown): unknown;
|
|
307
308
|
abstract internalUpdate?(): void;
|
|
308
309
|
abstract cleanup?(): void;
|
|
@@ -334,8 +335,8 @@ declare class WeaveRegisterManager {
|
|
|
334
335
|
getPlugins(): Record<string, WeavePlugin>;
|
|
335
336
|
getNodesHandlers(): Record<string, WeaveNode>;
|
|
336
337
|
getActionsHandlers(): Record<string, WeaveAction>;
|
|
337
|
-
getPlugin<T
|
|
338
|
-
getActionHandler<T
|
|
338
|
+
getPlugin<T>(pluginName: string): T;
|
|
339
|
+
getActionHandler<T>(actionName: string): T;
|
|
339
340
|
getNodeHandler(nodeType: string): WeaveNode;
|
|
340
341
|
registerPlugins(): void;
|
|
341
342
|
registerPlugin(plugin: WeavePlugin): void;
|
|
@@ -407,11 +408,11 @@ declare class Weave extends Emittery {
|
|
|
407
408
|
getInstanceRecursive(instance: Konva.Node, filterInstanceType?: string[]): Konva.Node;
|
|
408
409
|
getRegisterManager(): WeaveRegisterManager;
|
|
409
410
|
getPlugins(): Record<string, WeavePlugin>;
|
|
410
|
-
getPlugin<T
|
|
411
|
+
getPlugin<T>(pluginName: string): T;
|
|
411
412
|
getNodesHandlers(): Record<string, WeaveNode>;
|
|
412
|
-
getNodeHandler<T
|
|
413
|
+
getNodeHandler<T>(nodeType: string): T;
|
|
413
414
|
getActionsHandlers(): Record<string, WeaveAction>;
|
|
414
|
-
getActionHandler<T
|
|
415
|
+
getActionHandler<T>(actionName: string): T;
|
|
415
416
|
getStore<T extends WeaveStore>(): T;
|
|
416
417
|
registerPlugin(plugin: WeavePlugin): void;
|
|
417
418
|
registerNodeHandler(node: WeaveNode): void;
|
|
@@ -473,6 +474,35 @@ type WeaveUndoManagerOptions = {
|
|
|
473
474
|
trackedOrigins?: Set<any>;
|
|
474
475
|
};
|
|
475
476
|
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/constants.d.ts
|
|
479
|
+
declare const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
480
|
+
declare const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS: {
|
|
481
|
+
readonly "CONNECTING": "connecting";
|
|
482
|
+
readonly "CONNECTED": "connected";
|
|
483
|
+
readonly "DISCONNECTED": "disconnected";
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/types.d.ts
|
|
488
|
+
type WeaveStoreWebsocketsConnectionStatusKeys = keyof typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS;
|
|
489
|
+
type WeaveStoreWebsocketsConnectionStatus = (typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS)[WeaveStoreWebsocketsConnectionStatusKeys];
|
|
490
|
+
type WeaveStoreWebsocketsOptions = {
|
|
491
|
+
roomId: string;
|
|
492
|
+
wsOptions: {
|
|
493
|
+
serverUrl: string;
|
|
494
|
+
};
|
|
495
|
+
callbacks?: WeaveStoreWebsocketsCallbacks;
|
|
496
|
+
};
|
|
497
|
+
type WeaveStoreWebsocketsCallbacks = {
|
|
498
|
+
onConnectionStatusChange?: (status: WeaveStoreWebsocketsConnectionStatus) => void;
|
|
499
|
+
};
|
|
500
|
+
type PerformUpgrade = (req: IncomingMessage) => Promise<boolean>;
|
|
501
|
+
type ExtractRoomId = (req: IncomingMessage) => string | undefined;
|
|
502
|
+
type FetchInitialState = (doc: Y.Doc) => void;
|
|
503
|
+
type PersistRoom = (roomId: string, actualState: Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
504
|
+
type FetchRoom = (roomId: string) => Promise<Uint8Array | null>;
|
|
505
|
+
|
|
476
506
|
//#endregion
|
|
477
507
|
//#region src/store-websockets.d.ts
|
|
478
508
|
declare class WeaveStoreWebsockets extends WeaveStore {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Y$1 from "yjs";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
import { Doc } from "yjs";
|
|
4
|
+
import { IncomingMessage } from "http";
|
|
4
5
|
import { WebsocketProvider } from "y-websocket";
|
|
5
6
|
import Konva from "konva";
|
|
6
7
|
import { Vector2d } from "konva/lib/types";
|
|
@@ -29,7 +30,7 @@ declare const WEAVE_EXPORT_FORMATS: {
|
|
|
29
30
|
//#endregion
|
|
30
31
|
//#region src/base/action.d.ts
|
|
31
32
|
interface WeaveActionBase {
|
|
32
|
-
|
|
33
|
+
onInit?(): void;
|
|
33
34
|
trigger(cancelAction: () => void, params?: unknown): unknown;
|
|
34
35
|
internalUpdate?(): void;
|
|
35
36
|
cleanup?(): void;
|
|
@@ -38,8 +39,8 @@ interface WeaveActionBase {
|
|
|
38
39
|
//#endregion
|
|
39
40
|
//#region src/base/plugin.d.ts
|
|
40
41
|
interface WeavePluginBase {
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
onInit?(): void;
|
|
43
|
+
onRender?(): void;
|
|
43
44
|
enable(): void;
|
|
44
45
|
disable(): void;
|
|
45
46
|
isEnabled(): boolean;
|
|
@@ -158,15 +159,15 @@ declare type docElementTypeDescription = "xml" | "text" | Array<any> | object;
|
|
|
158
159
|
declare type DocTypeDescription = {
|
|
159
160
|
[key: string]: docElementTypeDescription;
|
|
160
161
|
};
|
|
161
|
-
declare type MappedTypeDescription<T extends DocTypeDescription> = { readonly [P in keyof T]: T[P] extends "xml" ? Y.XmlFragment : T[P] extends "text" ? Y.Text : T[P] extends Array<any> ? T[P] : T[P] extends object ? Partial<T[P]> : never };
|
|
162
|
+
declare type MappedTypeDescription<T extends DocTypeDescription> = { readonly [P in keyof T]: T[P] extends "xml" ? Y$1.XmlFragment : T[P] extends "text" ? Y$1.Text : T[P] extends Array<any> ? T[P] : T[P] extends object ? Partial<T[P]> : never };
|
|
162
163
|
//#endregion
|
|
163
164
|
//#region src/base/node.d.ts
|
|
164
165
|
interface WeaveNodeBase {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
create(id: string, props: WeaveElementAttributes): WeaveStateElement;
|
|
167
|
+
onRender(props: WeaveElementAttributes): WeaveElementInstance;
|
|
168
|
+
onUpdate(instance: WeaveElementInstance, nextProps: WeaveElementAttributes): void;
|
|
169
|
+
onDestroy(instance: WeaveElementInstance): void;
|
|
170
|
+
serialize(instance: WeaveElementInstance): WeaveStateElement;
|
|
170
171
|
} //#endregion
|
|
171
172
|
//#region src/stores/store.d.ts
|
|
172
173
|
|
|
@@ -215,8 +216,8 @@ declare abstract class WeavePlugin implements WeavePluginBase {
|
|
|
215
216
|
getName(): string;
|
|
216
217
|
getLogger(): Logger;
|
|
217
218
|
isEnabled(): boolean;
|
|
218
|
-
abstract
|
|
219
|
-
abstract
|
|
219
|
+
abstract onInit?(): void;
|
|
220
|
+
abstract onRender?(): void;
|
|
220
221
|
abstract enable(): void;
|
|
221
222
|
abstract disable(): void;
|
|
222
223
|
}
|
|
@@ -240,12 +241,12 @@ declare class WeaveNodesSelectionPlugin extends WeavePlugin {
|
|
|
240
241
|
private selecting;
|
|
241
242
|
private initialized;
|
|
242
243
|
private callbacks;
|
|
243
|
-
|
|
244
|
+
onRender: undefined;
|
|
244
245
|
constructor(callbacks: WeaveNodesSelectionPluginCallbacks);
|
|
245
246
|
getName(): string;
|
|
246
247
|
getLayerName(): string;
|
|
247
248
|
initLayer(): void;
|
|
248
|
-
|
|
249
|
+
onInit(): void;
|
|
249
250
|
private getLayer;
|
|
250
251
|
private triggerSelectedNodesEvent;
|
|
251
252
|
private initEvents;
|
|
@@ -274,11 +275,11 @@ declare abstract class WeaveNode implements WeaveNodeBase {
|
|
|
274
275
|
isPasting(): boolean;
|
|
275
276
|
isNodeSelected(ele: Konva.Node): boolean;
|
|
276
277
|
setupDefaultNodeEvents(node: Konva.Node): void;
|
|
277
|
-
|
|
278
|
-
abstract
|
|
279
|
-
abstract
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
create(key: string, props: WeaveElementAttributes): WeaveStateElement;
|
|
279
|
+
abstract onRender(props: WeaveElementAttributes): WeaveElementInstance;
|
|
280
|
+
abstract onUpdate(instance: WeaveElementInstance, nextProps: WeaveElementAttributes): void;
|
|
281
|
+
onDestroy(nodeInstance: WeaveElementInstance): void;
|
|
282
|
+
serialize(instance: WeaveElementInstance): WeaveStateElement;
|
|
282
283
|
}
|
|
283
284
|
|
|
284
285
|
//#endregion
|
|
@@ -302,7 +303,7 @@ declare abstract class WeaveAction {
|
|
|
302
303
|
register(instance: Weave): WeaveAction;
|
|
303
304
|
updateProps(props: WeaveElementAttributes): void;
|
|
304
305
|
getProps(): WeaveElementAttributes;
|
|
305
|
-
abstract
|
|
306
|
+
abstract onInit?(): void;
|
|
306
307
|
abstract trigger(cancelAction: () => void, params?: unknown): unknown;
|
|
307
308
|
abstract internalUpdate?(): void;
|
|
308
309
|
abstract cleanup?(): void;
|
|
@@ -334,8 +335,8 @@ declare class WeaveRegisterManager {
|
|
|
334
335
|
getPlugins(): Record<string, WeavePlugin>;
|
|
335
336
|
getNodesHandlers(): Record<string, WeaveNode>;
|
|
336
337
|
getActionsHandlers(): Record<string, WeaveAction>;
|
|
337
|
-
getPlugin<T
|
|
338
|
-
getActionHandler<T
|
|
338
|
+
getPlugin<T>(pluginName: string): T;
|
|
339
|
+
getActionHandler<T>(actionName: string): T;
|
|
339
340
|
getNodeHandler(nodeType: string): WeaveNode;
|
|
340
341
|
registerPlugins(): void;
|
|
341
342
|
registerPlugin(plugin: WeavePlugin): void;
|
|
@@ -407,11 +408,11 @@ declare class Weave extends Emittery {
|
|
|
407
408
|
getInstanceRecursive(instance: Konva.Node, filterInstanceType?: string[]): Konva.Node;
|
|
408
409
|
getRegisterManager(): WeaveRegisterManager;
|
|
409
410
|
getPlugins(): Record<string, WeavePlugin>;
|
|
410
|
-
getPlugin<T
|
|
411
|
+
getPlugin<T>(pluginName: string): T;
|
|
411
412
|
getNodesHandlers(): Record<string, WeaveNode>;
|
|
412
|
-
getNodeHandler<T
|
|
413
|
+
getNodeHandler<T>(nodeType: string): T;
|
|
413
414
|
getActionsHandlers(): Record<string, WeaveAction>;
|
|
414
|
-
getActionHandler<T
|
|
415
|
+
getActionHandler<T>(actionName: string): T;
|
|
415
416
|
getStore<T extends WeaveStore>(): T;
|
|
416
417
|
registerPlugin(plugin: WeavePlugin): void;
|
|
417
418
|
registerNodeHandler(node: WeaveNode): void;
|
|
@@ -473,6 +474,35 @@ type WeaveUndoManagerOptions = {
|
|
|
473
474
|
trackedOrigins?: Set<any>;
|
|
474
475
|
};
|
|
475
476
|
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/constants.d.ts
|
|
479
|
+
declare const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
480
|
+
declare const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS: {
|
|
481
|
+
readonly "CONNECTING": "connecting";
|
|
482
|
+
readonly "CONNECTED": "connected";
|
|
483
|
+
readonly "DISCONNECTED": "disconnected";
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/types.d.ts
|
|
488
|
+
type WeaveStoreWebsocketsConnectionStatusKeys = keyof typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS;
|
|
489
|
+
type WeaveStoreWebsocketsConnectionStatus = (typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS)[WeaveStoreWebsocketsConnectionStatusKeys];
|
|
490
|
+
type WeaveStoreWebsocketsOptions = {
|
|
491
|
+
roomId: string;
|
|
492
|
+
wsOptions: {
|
|
493
|
+
serverUrl: string;
|
|
494
|
+
};
|
|
495
|
+
callbacks?: WeaveStoreWebsocketsCallbacks;
|
|
496
|
+
};
|
|
497
|
+
type WeaveStoreWebsocketsCallbacks = {
|
|
498
|
+
onConnectionStatusChange?: (status: WeaveStoreWebsocketsConnectionStatus) => void;
|
|
499
|
+
};
|
|
500
|
+
type PerformUpgrade = (req: IncomingMessage) => Promise<boolean>;
|
|
501
|
+
type ExtractRoomId = (req: IncomingMessage) => string | undefined;
|
|
502
|
+
type FetchInitialState = (doc: Y.Doc) => void;
|
|
503
|
+
type PersistRoom = (roomId: string, actualState: Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
504
|
+
type FetchRoom = (roomId: string) => Promise<Uint8Array | null>;
|
|
505
|
+
|
|
476
506
|
//#endregion
|
|
477
507
|
//#region src/store-websockets.d.ts
|
|
478
508
|
declare class WeaveStoreWebsockets extends WeaveStore {
|
package/dist/client.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { WEAVE_STORE_WEBSOCKETS, WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS } from "./types-Cq7de9Ah.js";
|
|
2
1
|
import { WeaveStore } from "@inditextech/weave-sdk";
|
|
3
2
|
import "@inditextech/weave-types";
|
|
3
|
+
import "yjs";
|
|
4
|
+
import { IncomingMessage } from "http";
|
|
4
5
|
import { WebsocketProvider } from "y-websocket";
|
|
5
6
|
|
|
7
|
+
//#region src/constants.ts
|
|
8
|
+
const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
9
|
+
const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS = {
|
|
10
|
+
["CONNECTING"]: "connecting",
|
|
11
|
+
["CONNECTED"]: "connected",
|
|
12
|
+
["DISCONNECTED"]: "disconnected"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
6
16
|
//#region src/store-websockets.ts
|
|
7
17
|
var WeaveStoreWebsockets = class extends WeaveStore {
|
|
8
18
|
name = WEAVE_STORE_WEBSOCKETS;
|
package/dist/server.cjs
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from$1, except, desc) => {
|
|
12
|
+
if (from$1 && typeof from$1 === "object" || typeof from$1 === "function") for (var keys$1 = __getOwnPropNames(from$1), i = 0, n = keys$1.length, key; i < n; i++) {
|
|
13
|
+
key = keys$1[i];
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: ((k) => from$1[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from$1, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
value: mod,
|
|
23
|
+
enumerable: true
|
|
24
|
+
}) : target, mod));
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
const http = __toESM(require("http"));
|
|
3
28
|
require("https");
|
|
4
|
-
const ws =
|
|
5
|
-
const yjs =
|
|
29
|
+
const ws = __toESM(require("ws"));
|
|
30
|
+
const yjs = __toESM(require("yjs"));
|
|
6
31
|
require("node:http");
|
|
7
32
|
|
|
8
33
|
//#region ../../node_modules/lib0/math.js
|
|
@@ -1005,7 +1030,7 @@ const applyAwarenessUpdate = (awareness, update, origin) => {
|
|
|
1005
1030
|
|
|
1006
1031
|
//#endregion
|
|
1007
1032
|
//#region ../../node_modules/lodash.debounce/index.js
|
|
1008
|
-
var require_lodash =
|
|
1033
|
+
var require_lodash = __commonJS({ "../../node_modules/lodash.debounce/index.js"(exports, module) {
|
|
1009
1034
|
/**
|
|
1010
1035
|
* lodash (Custom Build) <https://lodash.com/>
|
|
1011
1036
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
@@ -1299,7 +1324,7 @@ var require_lodash = require_types.__commonJS({ "../../node_modules/lodash.debou
|
|
|
1299
1324
|
}
|
|
1300
1325
|
module.exports = debounce;
|
|
1301
1326
|
} });
|
|
1302
|
-
var import_lodash =
|
|
1327
|
+
var import_lodash = __toESM(require_lodash(), 1);
|
|
1303
1328
|
|
|
1304
1329
|
//#endregion
|
|
1305
1330
|
//#region src/server/websockets-callbacks.ts
|
|
@@ -1359,6 +1384,15 @@ const getContent = (objName, objType, doc) => {
|
|
|
1359
1384
|
}
|
|
1360
1385
|
};
|
|
1361
1386
|
|
|
1387
|
+
//#endregion
|
|
1388
|
+
//#region src/constants.ts
|
|
1389
|
+
const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
1390
|
+
const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS = {
|
|
1391
|
+
["CONNECTING"]: "connecting",
|
|
1392
|
+
["CONNECTED"]: "connected",
|
|
1393
|
+
["DISCONNECTED"]: "disconnected"
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1362
1396
|
//#endregion
|
|
1363
1397
|
//#region src/server/websockets-utils.ts
|
|
1364
1398
|
let actualServer = void 0;
|
|
@@ -1588,6 +1622,6 @@ var WeaveWebsocketsServer = class {
|
|
|
1588
1622
|
};
|
|
1589
1623
|
|
|
1590
1624
|
//#endregion
|
|
1591
|
-
exports.WEAVE_STORE_WEBSOCKETS =
|
|
1592
|
-
exports.WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS =
|
|
1625
|
+
exports.WEAVE_STORE_WEBSOCKETS = WEAVE_STORE_WEBSOCKETS
|
|
1626
|
+
exports.WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS = WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS
|
|
1593
1627
|
exports.WeaveWebsocketsServer = WeaveWebsocketsServer
|
package/dist/server.d.cts
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import http from "http";
|
|
1
|
+
import http, { IncomingMessage } from "http";
|
|
3
2
|
import https from "https";
|
|
3
|
+
import * as Y from "yjs";
|
|
4
4
|
|
|
5
|
+
//#region src/constants.d.ts
|
|
6
|
+
declare const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
7
|
+
declare const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS: {
|
|
8
|
+
readonly "CONNECTING": "connecting";
|
|
9
|
+
readonly "CONNECTED": "connected";
|
|
10
|
+
readonly "DISCONNECTED": "disconnected";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/types.d.ts
|
|
15
|
+
type WeaveStoreWebsocketsConnectionStatusKeys = keyof typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS;
|
|
16
|
+
type WeaveStoreWebsocketsConnectionStatus = (typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS)[WeaveStoreWebsocketsConnectionStatusKeys];
|
|
17
|
+
type WeaveStoreWebsocketsOptions = {
|
|
18
|
+
roomId: string;
|
|
19
|
+
wsOptions: {
|
|
20
|
+
serverUrl: string;
|
|
21
|
+
};
|
|
22
|
+
callbacks?: WeaveStoreWebsocketsCallbacks;
|
|
23
|
+
};
|
|
24
|
+
type WeaveStoreWebsocketsCallbacks = {
|
|
25
|
+
onConnectionStatusChange?: (status: WeaveStoreWebsocketsConnectionStatus) => void;
|
|
26
|
+
};
|
|
27
|
+
type PerformUpgrade = (req: IncomingMessage) => Promise<boolean>;
|
|
28
|
+
type ExtractRoomId = (req: IncomingMessage) => string | undefined;
|
|
29
|
+
type FetchInitialState = (doc: Y.Doc) => void;
|
|
30
|
+
type PersistRoom = (roomId: string, actualState: Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
31
|
+
type FetchRoom = (roomId: string) => Promise<Uint8Array | null>;
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
5
34
|
//#region src/server/websockets-server.d.ts
|
|
6
35
|
type WeaveWebsocketsServerParams = {
|
|
7
36
|
initialState?: FetchInitialState;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import http from "http";
|
|
1
|
+
import http, { IncomingMessage } from "http";
|
|
3
2
|
import https from "https";
|
|
3
|
+
import * as Y from "yjs";
|
|
4
4
|
|
|
5
|
+
//#region src/constants.d.ts
|
|
6
|
+
declare const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
7
|
+
declare const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS: {
|
|
8
|
+
readonly "CONNECTING": "connecting";
|
|
9
|
+
readonly "CONNECTED": "connected";
|
|
10
|
+
readonly "DISCONNECTED": "disconnected";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/types.d.ts
|
|
15
|
+
type WeaveStoreWebsocketsConnectionStatusKeys = keyof typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS;
|
|
16
|
+
type WeaveStoreWebsocketsConnectionStatus = (typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS)[WeaveStoreWebsocketsConnectionStatusKeys];
|
|
17
|
+
type WeaveStoreWebsocketsOptions = {
|
|
18
|
+
roomId: string;
|
|
19
|
+
wsOptions: {
|
|
20
|
+
serverUrl: string;
|
|
21
|
+
};
|
|
22
|
+
callbacks?: WeaveStoreWebsocketsCallbacks;
|
|
23
|
+
};
|
|
24
|
+
type WeaveStoreWebsocketsCallbacks = {
|
|
25
|
+
onConnectionStatusChange?: (status: WeaveStoreWebsocketsConnectionStatus) => void;
|
|
26
|
+
};
|
|
27
|
+
type PerformUpgrade = (req: IncomingMessage) => Promise<boolean>;
|
|
28
|
+
type ExtractRoomId = (req: IncomingMessage) => string | undefined;
|
|
29
|
+
type FetchInitialState = (doc: Y.Doc) => void;
|
|
30
|
+
type PersistRoom = (roomId: string, actualState: Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
31
|
+
type FetchRoom = (roomId: string) => Promise<Uint8Array | null>;
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
5
34
|
//#region src/server/websockets-server.d.ts
|
|
6
35
|
type WeaveWebsocketsServerParams = {
|
|
7
36
|
initialState?: FetchInitialState;
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import http from "http";
|
|
1
|
+
import http, { IncomingMessage } from "http";
|
|
3
2
|
import https from "https";
|
|
4
3
|
import { WebSocketServer } from "ws";
|
|
5
4
|
import * as Y$2 from "yjs";
|
|
@@ -1387,6 +1386,15 @@ const getContent = (objName, objType, doc) => {
|
|
|
1387
1386
|
}
|
|
1388
1387
|
};
|
|
1389
1388
|
|
|
1389
|
+
//#endregion
|
|
1390
|
+
//#region src/constants.ts
|
|
1391
|
+
const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
1392
|
+
const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS = {
|
|
1393
|
+
["CONNECTING"]: "connecting",
|
|
1394
|
+
["CONNECTED"]: "connected",
|
|
1395
|
+
["DISCONNECTED"]: "disconnected"
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1390
1398
|
//#endregion
|
|
1391
1399
|
//#region src/server/websockets-utils.ts
|
|
1392
1400
|
let actualServer = void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inditextech/weave-store-websockets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build:snapshot": "tsdown --sourcemap",
|
|
31
|
-
"build": "tsdown",
|
|
30
|
+
"build:snapshot": "tsc --noEmit && tsdown --sourcemap",
|
|
31
|
+
"build": "tsc --noEmit && tsdown",
|
|
32
32
|
"bump:snapshot": "npm version $npm_package_version.$(date \"+%s\")",
|
|
33
33
|
"bundle:analyze": "vite-bundle-visualizer",
|
|
34
34
|
"check": "echo \"Monorepo test script\" && exit 0",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"version:release": "npm version $RELEASE_VERSION -m \"[npm-scripts] prepare release $RELEASE_VERSION\" --tag-version-prefix \"\""
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@inditextech/weave-sdk": "0.3.1",
|
|
53
|
+
"@inditextech/weave-types": "0.3.1",
|
|
52
54
|
"@syncedstore/core": "0.6.0",
|
|
53
|
-
"@inditextech/weave-sdk": "0.2.1",
|
|
54
|
-
"@inditextech/weave-types": "0.2.1",
|
|
55
55
|
"konva": "9.3.20",
|
|
56
56
|
"ws": "8.18.1",
|
|
57
57
|
"y-websocket": "3.0.0",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/express": "^5.0.1",
|
|
62
62
|
"@types/lodash.debounce": "^4.0.9",
|
|
63
|
+
"@types/node": "^22.15.3",
|
|
63
64
|
"@types/ws": "^8.18.1",
|
|
64
65
|
"@typescript-eslint/eslint-plugin": "8.26.0",
|
|
65
66
|
"@typescript-eslint/parser": "8.26.0",
|
package/dist/types-BH9hIv5b.cjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//#region rolldown:runtime
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJS = (cb, mod) => function() {
|
|
10
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
-
key = keys[i];
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: ((k) => from[k]).bind(null, key),
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
const http = __toESM(require("http"));
|
|
29
|
-
const yjs = __toESM(require("yjs"));
|
|
30
|
-
|
|
31
|
-
//#region src/constants.ts
|
|
32
|
-
const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
33
|
-
const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS = {
|
|
34
|
-
["CONNECTING"]: "connecting",
|
|
35
|
-
["CONNECTED"]: "connected",
|
|
36
|
-
["DISCONNECTED"]: "disconnected"
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
Object.defineProperty(exports, 'WEAVE_STORE_WEBSOCKETS', {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () {
|
|
43
|
-
return WEAVE_STORE_WEBSOCKETS;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(exports, 'WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS', {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
get: function () {
|
|
49
|
-
return WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(exports, '__commonJS', {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function () {
|
|
55
|
-
return __commonJS;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(exports, '__toESM', {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: function () {
|
|
61
|
-
return __toESM;
|
|
62
|
-
}
|
|
63
|
-
});
|
package/dist/types-Cq7de9Ah.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IncomingMessage } from "http";
|
|
2
|
-
import "yjs";
|
|
3
|
-
|
|
4
|
-
//#region src/constants.ts
|
|
5
|
-
const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
6
|
-
const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS = {
|
|
7
|
-
["CONNECTING"]: "connecting",
|
|
8
|
-
["CONNECTED"]: "connected",
|
|
9
|
-
["DISCONNECTED"]: "disconnected"
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { WEAVE_STORE_WEBSOCKETS, WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IncomingMessage } from "http";
|
|
2
|
-
import * as Y from "yjs";
|
|
3
|
-
|
|
4
|
-
//#region src/constants.d.ts
|
|
5
|
-
declare const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
6
|
-
declare const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS: {
|
|
7
|
-
readonly "CONNECTING": "connecting";
|
|
8
|
-
readonly "CONNECTED": "connected";
|
|
9
|
-
readonly "DISCONNECTED": "disconnected";
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/types.d.ts
|
|
14
|
-
type WeaveStoreWebsocketsConnectionStatusKeys = keyof typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS;
|
|
15
|
-
type WeaveStoreWebsocketsConnectionStatus = (typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS)[WeaveStoreWebsocketsConnectionStatusKeys];
|
|
16
|
-
type WeaveStoreWebsocketsOptions = {
|
|
17
|
-
roomId: string;
|
|
18
|
-
wsOptions: {
|
|
19
|
-
serverUrl: string;
|
|
20
|
-
};
|
|
21
|
-
callbacks?: WeaveStoreWebsocketsCallbacks;
|
|
22
|
-
};
|
|
23
|
-
type WeaveStoreWebsocketsCallbacks = {
|
|
24
|
-
onConnectionStatusChange?: (status: WeaveStoreWebsocketsConnectionStatus) => void;
|
|
25
|
-
};
|
|
26
|
-
type PerformUpgrade = (req: IncomingMessage) => Promise<boolean>;
|
|
27
|
-
type ExtractRoomId = (req: IncomingMessage) => string | undefined;
|
|
28
|
-
type FetchInitialState = (doc: Y.Doc) => void;
|
|
29
|
-
type PersistRoom = (roomId: string, actualState: Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
30
|
-
type FetchRoom = (roomId: string) => Promise<Uint8Array | null>;
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { ExtractRoomId, FetchInitialState, FetchRoom, PerformUpgrade, PersistRoom, WEAVE_STORE_WEBSOCKETS as WEAVE_STORE_WEBSOCKETS$1, WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS as WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS$1, WeaveStoreWebsocketsCallbacks, WeaveStoreWebsocketsConnectionStatus, WeaveStoreWebsocketsConnectionStatusKeys, WeaveStoreWebsocketsOptions };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as Y from "yjs";
|
|
2
|
-
import { IncomingMessage } from "http";
|
|
3
|
-
|
|
4
|
-
//#region src/constants.d.ts
|
|
5
|
-
declare const WEAVE_STORE_WEBSOCKETS = "store-websockets";
|
|
6
|
-
declare const WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS: {
|
|
7
|
-
readonly "CONNECTING": "connecting";
|
|
8
|
-
readonly "CONNECTED": "connected";
|
|
9
|
-
readonly "DISCONNECTED": "disconnected";
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/types.d.ts
|
|
14
|
-
type WeaveStoreWebsocketsConnectionStatusKeys = keyof typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS;
|
|
15
|
-
type WeaveStoreWebsocketsConnectionStatus = (typeof WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS)[WeaveStoreWebsocketsConnectionStatusKeys];
|
|
16
|
-
type WeaveStoreWebsocketsOptions = {
|
|
17
|
-
roomId: string;
|
|
18
|
-
wsOptions: {
|
|
19
|
-
serverUrl: string;
|
|
20
|
-
};
|
|
21
|
-
callbacks?: WeaveStoreWebsocketsCallbacks;
|
|
22
|
-
};
|
|
23
|
-
type WeaveStoreWebsocketsCallbacks = {
|
|
24
|
-
onConnectionStatusChange?: (status: WeaveStoreWebsocketsConnectionStatus) => void;
|
|
25
|
-
};
|
|
26
|
-
type PerformUpgrade = (req: IncomingMessage) => Promise<boolean>;
|
|
27
|
-
type ExtractRoomId = (req: IncomingMessage) => string | undefined;
|
|
28
|
-
type FetchInitialState = (doc: Y.Doc) => void;
|
|
29
|
-
type PersistRoom = (roomId: string, actualState: Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
30
|
-
type FetchRoom = (roomId: string) => Promise<Uint8Array | null>;
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { ExtractRoomId, FetchInitialState, FetchRoom, PerformUpgrade, PersistRoom, WEAVE_STORE_WEBSOCKETS, WEAVE_STORE_WEBSOCKETS_CONNECTION_STATUS, WeaveStoreWebsocketsCallbacks, WeaveStoreWebsocketsConnectionStatus, WeaveStoreWebsocketsConnectionStatusKeys, WeaveStoreWebsocketsOptions };
|