@inditextech/weave-store-azure-web-pubsub 0.2.0 → 0.3.0
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 +1075 -46
- package/dist/client.d.cts +60 -21
- package/dist/client.d.ts +61 -22
- package/dist/client.js +1010 -3
- package/dist/server.cjs +1059 -30
- package/dist/server.d.cts +36 -1
- package/dist/server.d.ts +36 -1
- package/dist/server.js +1009 -2
- package/package.json +6 -5
- package/dist/awareness-CJH5s1Gv.cjs +0 -1153
- package/dist/awareness-CZbSemWr.js +0 -1010
- package/dist/types.d-BjiC_a5v.d.cts +0 -38
- package/dist/types.d-Cw5mafrL.d.ts +0 -38
package/dist/client.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FetchClient, FetchInitialState, FetchRoom, PersistRoom, WEAVE_STORE_AZURE_WEB_PUBSUB, WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS, WeaveAzureWebPubsubConfig, WeaveStoreAzureWebPubsubConnectionStatus, WeaveStoreAzureWebPubsubConnectionStatusKeys, WeaveStoreAzureWebPubsubOptions, WeaveStoreAzureWebPubsubStoreCallbacks } from "./types.d-BjiC_a5v.cjs";
|
|
2
1
|
import Konva from "konva";
|
|
3
2
|
import { Vector2d } from "konva/lib/types";
|
|
4
|
-
import
|
|
3
|
+
import * as Y$1 from "yjs";
|
|
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";
|
|
@@ -30,7 +30,7 @@ declare const WEAVE_EXPORT_FORMATS: {
|
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/base/action.d.ts
|
|
32
32
|
interface WeaveActionBase {
|
|
33
|
-
|
|
33
|
+
onInit?(): void;
|
|
34
34
|
trigger(cancelAction: () => void, params?: unknown): unknown;
|
|
35
35
|
internalUpdate?(): void;
|
|
36
36
|
cleanup?(): void;
|
|
@@ -39,8 +39,8 @@ interface WeaveActionBase {
|
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/base/plugin.d.ts
|
|
41
41
|
interface WeavePluginBase {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
onInit?(): void;
|
|
43
|
+
onRender?(): void;
|
|
44
44
|
enable(): void;
|
|
45
45
|
disable(): void;
|
|
46
46
|
isEnabled(): boolean;
|
|
@@ -155,15 +155,19 @@ type WeaveCallbacks = {
|
|
|
155
155
|
onStateChange?: (state: WeaveState) => void;
|
|
156
156
|
onUndoManagerStatusChange?: (undoManagerStatus: WeaveUndoRedoChange) => void;
|
|
157
157
|
};
|
|
158
|
-
|
|
158
|
+
declare type docElementTypeDescription = "xml" | "text" | Array<any> | object;
|
|
159
|
+
declare type DocTypeDescription = {
|
|
160
|
+
[key: string]: docElementTypeDescription;
|
|
161
|
+
};
|
|
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 };
|
|
159
163
|
//#endregion
|
|
160
164
|
//#region src/base/node.d.ts
|
|
161
165
|
interface WeaveNodeBase {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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;
|
|
167
171
|
} //#endregion
|
|
168
172
|
//#region src/stores/store.d.ts
|
|
169
173
|
|
|
@@ -212,8 +216,8 @@ declare abstract class WeavePlugin implements WeavePluginBase {
|
|
|
212
216
|
getName(): string;
|
|
213
217
|
getLogger(): Logger;
|
|
214
218
|
isEnabled(): boolean;
|
|
215
|
-
abstract
|
|
216
|
-
abstract
|
|
219
|
+
abstract onInit?(): void;
|
|
220
|
+
abstract onRender?(): void;
|
|
217
221
|
abstract enable(): void;
|
|
218
222
|
abstract disable(): void;
|
|
219
223
|
}
|
|
@@ -237,12 +241,12 @@ declare class WeaveNodesSelectionPlugin extends WeavePlugin {
|
|
|
237
241
|
private selecting;
|
|
238
242
|
private initialized;
|
|
239
243
|
private callbacks;
|
|
240
|
-
|
|
244
|
+
onRender: undefined;
|
|
241
245
|
constructor(callbacks: WeaveNodesSelectionPluginCallbacks);
|
|
242
246
|
getName(): string;
|
|
243
247
|
getLayerName(): string;
|
|
244
248
|
initLayer(): void;
|
|
245
|
-
|
|
249
|
+
onInit(): void;
|
|
246
250
|
private getLayer;
|
|
247
251
|
private triggerSelectedNodesEvent;
|
|
248
252
|
private initEvents;
|
|
@@ -271,11 +275,11 @@ declare abstract class WeaveNode implements WeaveNodeBase {
|
|
|
271
275
|
isPasting(): boolean;
|
|
272
276
|
isNodeSelected(ele: Konva.Node): boolean;
|
|
273
277
|
setupDefaultNodeEvents(node: Konva.Node): void;
|
|
274
|
-
|
|
275
|
-
abstract
|
|
276
|
-
abstract
|
|
277
|
-
|
|
278
|
-
|
|
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;
|
|
279
283
|
}
|
|
280
284
|
|
|
281
285
|
//#endregion
|
|
@@ -299,7 +303,7 @@ declare abstract class WeaveAction {
|
|
|
299
303
|
register(instance: Weave): WeaveAction;
|
|
300
304
|
updateProps(props: WeaveElementAttributes): void;
|
|
301
305
|
getProps(): WeaveElementAttributes;
|
|
302
|
-
abstract
|
|
306
|
+
abstract onInit?(): void;
|
|
303
307
|
abstract trigger(cancelAction: () => void, params?: unknown): unknown;
|
|
304
308
|
abstract internalUpdate?(): void;
|
|
305
309
|
abstract cleanup?(): void;
|
|
@@ -470,6 +474,41 @@ type WeaveUndoManagerOptions = {
|
|
|
470
474
|
trackedOrigins?: Set<any>;
|
|
471
475
|
};
|
|
472
476
|
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/constants.d.ts
|
|
479
|
+
declare const WEAVE_STORE_AZURE_WEB_PUBSUB = "store-azure-web-pubsub";
|
|
480
|
+
declare const WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS: {
|
|
481
|
+
readonly "CONNECTED": "connected";
|
|
482
|
+
readonly "DISCONNECTED": "disconnected";
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/types.d.ts
|
|
487
|
+
type WeaveStoreAzureWebPubsubConnectionStatusKeys = keyof typeof WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS;
|
|
488
|
+
type WeaveStoreAzureWebPubsubConnectionStatus = (typeof WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS)[WeaveStoreAzureWebPubsubConnectionStatusKeys];
|
|
489
|
+
type WeaveAzureWebPubsubConfig = {
|
|
490
|
+
endpoint: string;
|
|
491
|
+
key: string;
|
|
492
|
+
hubName: string;
|
|
493
|
+
};
|
|
494
|
+
type WeaveStoreAzureWebPubsubOptions = {
|
|
495
|
+
roomId: string;
|
|
496
|
+
url: string;
|
|
497
|
+
fetchClient?: FetchClient;
|
|
498
|
+
callbacks?: WeaveStoreAzureWebPubsubStoreCallbacks;
|
|
499
|
+
};
|
|
500
|
+
type WeaveStoreAzureWebPubsubStoreCallbacks = {
|
|
501
|
+
onFetchConnectionUrl?: (payload: {
|
|
502
|
+
loading: boolean;
|
|
503
|
+
error: Error | null;
|
|
504
|
+
}) => void;
|
|
505
|
+
onConnectionStatusChange?: (status: WeaveStoreAzureWebPubsubConnectionStatus) => void;
|
|
506
|
+
};
|
|
507
|
+
type FetchClient = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
508
|
+
type FetchInitialState = (doc: Y.Doc) => void;
|
|
509
|
+
type PersistRoom = (roomId: string, actualState: Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
510
|
+
type FetchRoom = (roomId: string) => Promise<Uint8Array | null>;
|
|
511
|
+
|
|
473
512
|
//#endregion
|
|
474
513
|
//#region src/client.d.ts
|
|
475
514
|
interface ClientOptions {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FetchClient, FetchInitialState, FetchRoom, PersistRoom, WEAVE_STORE_AZURE_WEB_PUBSUB$1 as WEAVE_STORE_AZURE_WEB_PUBSUB, WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS$1 as WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS, WeaveAzureWebPubsubConfig, WeaveStoreAzureWebPubsubConnectionStatus, WeaveStoreAzureWebPubsubConnectionStatusKeys, WeaveStoreAzureWebPubsubOptions, WeaveStoreAzureWebPubsubStoreCallbacks } from "./types.d-Cw5mafrL.js";
|
|
2
|
-
import { Doc } from "yjs";
|
|
3
1
|
import Emittery from "emittery";
|
|
2
|
+
import * as Y$1 from "yjs";
|
|
3
|
+
import * as Y from "yjs";
|
|
4
|
+
import { Doc } from "yjs";
|
|
4
5
|
import ReconnectingWebSocket from "reconnecting-websocket";
|
|
5
6
|
import Konva from "konva";
|
|
6
7
|
import { Vector2d } from "konva/lib/types";
|
|
7
|
-
import { MappedTypeDescription } from "@syncedstore/core/types/doc";
|
|
8
8
|
import pino, { Logger } from "pino";
|
|
9
9
|
import { StageConfig } from "konva/lib/Stage";
|
|
10
10
|
import * as awarenessProtocol from "y-protocols/awareness";
|
|
@@ -30,7 +30,7 @@ declare const WEAVE_EXPORT_FORMATS: {
|
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/base/action.d.ts
|
|
32
32
|
interface WeaveActionBase {
|
|
33
|
-
|
|
33
|
+
onInit?(): void;
|
|
34
34
|
trigger(cancelAction: () => void, params?: unknown): unknown;
|
|
35
35
|
internalUpdate?(): void;
|
|
36
36
|
cleanup?(): void;
|
|
@@ -39,8 +39,8 @@ interface WeaveActionBase {
|
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/base/plugin.d.ts
|
|
41
41
|
interface WeavePluginBase {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
onInit?(): void;
|
|
43
|
+
onRender?(): void;
|
|
44
44
|
enable(): void;
|
|
45
45
|
disable(): void;
|
|
46
46
|
isEnabled(): boolean;
|
|
@@ -155,15 +155,19 @@ type WeaveCallbacks = {
|
|
|
155
155
|
onStateChange?: (state: WeaveState) => void;
|
|
156
156
|
onUndoManagerStatusChange?: (undoManagerStatus: WeaveUndoRedoChange) => void;
|
|
157
157
|
};
|
|
158
|
-
|
|
158
|
+
declare type docElementTypeDescription = "xml" | "text" | Array<any> | object;
|
|
159
|
+
declare type DocTypeDescription = {
|
|
160
|
+
[key: string]: docElementTypeDescription;
|
|
161
|
+
};
|
|
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 };
|
|
159
163
|
//#endregion
|
|
160
164
|
//#region src/base/node.d.ts
|
|
161
165
|
interface WeaveNodeBase {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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;
|
|
167
171
|
} //#endregion
|
|
168
172
|
//#region src/stores/store.d.ts
|
|
169
173
|
|
|
@@ -212,8 +216,8 @@ declare abstract class WeavePlugin implements WeavePluginBase {
|
|
|
212
216
|
getName(): string;
|
|
213
217
|
getLogger(): Logger;
|
|
214
218
|
isEnabled(): boolean;
|
|
215
|
-
abstract
|
|
216
|
-
abstract
|
|
219
|
+
abstract onInit?(): void;
|
|
220
|
+
abstract onRender?(): void;
|
|
217
221
|
abstract enable(): void;
|
|
218
222
|
abstract disable(): void;
|
|
219
223
|
}
|
|
@@ -237,12 +241,12 @@ declare class WeaveNodesSelectionPlugin extends WeavePlugin {
|
|
|
237
241
|
private selecting;
|
|
238
242
|
private initialized;
|
|
239
243
|
private callbacks;
|
|
240
|
-
|
|
244
|
+
onRender: undefined;
|
|
241
245
|
constructor(callbacks: WeaveNodesSelectionPluginCallbacks);
|
|
242
246
|
getName(): string;
|
|
243
247
|
getLayerName(): string;
|
|
244
248
|
initLayer(): void;
|
|
245
|
-
|
|
249
|
+
onInit(): void;
|
|
246
250
|
private getLayer;
|
|
247
251
|
private triggerSelectedNodesEvent;
|
|
248
252
|
private initEvents;
|
|
@@ -271,11 +275,11 @@ declare abstract class WeaveNode implements WeaveNodeBase {
|
|
|
271
275
|
isPasting(): boolean;
|
|
272
276
|
isNodeSelected(ele: Konva.Node): boolean;
|
|
273
277
|
setupDefaultNodeEvents(node: Konva.Node): void;
|
|
274
|
-
|
|
275
|
-
abstract
|
|
276
|
-
abstract
|
|
277
|
-
|
|
278
|
-
|
|
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;
|
|
279
283
|
}
|
|
280
284
|
|
|
281
285
|
//#endregion
|
|
@@ -299,7 +303,7 @@ declare abstract class WeaveAction {
|
|
|
299
303
|
register(instance: Weave): WeaveAction;
|
|
300
304
|
updateProps(props: WeaveElementAttributes): void;
|
|
301
305
|
getProps(): WeaveElementAttributes;
|
|
302
|
-
abstract
|
|
306
|
+
abstract onInit?(): void;
|
|
303
307
|
abstract trigger(cancelAction: () => void, params?: unknown): unknown;
|
|
304
308
|
abstract internalUpdate?(): void;
|
|
305
309
|
abstract cleanup?(): void;
|
|
@@ -470,6 +474,41 @@ type WeaveUndoManagerOptions = {
|
|
|
470
474
|
trackedOrigins?: Set<any>;
|
|
471
475
|
};
|
|
472
476
|
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/constants.d.ts
|
|
479
|
+
declare const WEAVE_STORE_AZURE_WEB_PUBSUB = "store-azure-web-pubsub";
|
|
480
|
+
declare const WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS: {
|
|
481
|
+
readonly "CONNECTED": "connected";
|
|
482
|
+
readonly "DISCONNECTED": "disconnected";
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/types.d.ts
|
|
487
|
+
type WeaveStoreAzureWebPubsubConnectionStatusKeys = keyof typeof WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS;
|
|
488
|
+
type WeaveStoreAzureWebPubsubConnectionStatus = (typeof WEAVE_STORE_AZURE_WEB_PUBSUB_CONNECTION_STATUS)[WeaveStoreAzureWebPubsubConnectionStatusKeys];
|
|
489
|
+
type WeaveAzureWebPubsubConfig = {
|
|
490
|
+
endpoint: string;
|
|
491
|
+
key: string;
|
|
492
|
+
hubName: string;
|
|
493
|
+
};
|
|
494
|
+
type WeaveStoreAzureWebPubsubOptions = {
|
|
495
|
+
roomId: string;
|
|
496
|
+
url: string;
|
|
497
|
+
fetchClient?: FetchClient;
|
|
498
|
+
callbacks?: WeaveStoreAzureWebPubsubStoreCallbacks;
|
|
499
|
+
};
|
|
500
|
+
type WeaveStoreAzureWebPubsubStoreCallbacks = {
|
|
501
|
+
onFetchConnectionUrl?: (payload: {
|
|
502
|
+
loading: boolean;
|
|
503
|
+
error: Error | null;
|
|
504
|
+
}) => void;
|
|
505
|
+
onConnectionStatusChange?: (status: WeaveStoreAzureWebPubsubConnectionStatus) => void;
|
|
506
|
+
};
|
|
507
|
+
type FetchClient = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
508
|
+
type FetchInitialState = (doc: Y.Doc) => void;
|
|
509
|
+
type PersistRoom = (roomId: string, actualState: Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
510
|
+
type FetchRoom = (roomId: string) => Promise<Uint8Array | null>;
|
|
511
|
+
|
|
473
512
|
//#endregion
|
|
474
513
|
//#region src/client.d.ts
|
|
475
514
|
interface ClientOptions {
|