@fluidframework/legacy-dds 2.53.1 → 2.61.0-355054
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/.mocharc.cjs +1 -2
- package/CHANGELOG.md +4 -0
- package/api-report/{legacy-dds.legacy.alpha.api.md → legacy-dds.legacy.beta.api.md} +20 -20
- package/dist/array/interfaces.d.ts +4 -8
- package/dist/array/interfaces.d.ts.map +1 -1
- package/dist/array/interfaces.js.map +1 -1
- package/dist/array/sharedArray.d.ts +8 -0
- package/dist/array/sharedArray.d.ts.map +1 -1
- package/dist/array/sharedArray.js +131 -8
- package/dist/array/sharedArray.js.map +1 -1
- package/dist/array/sharedArrayFactory.d.ts +2 -4
- package/dist/array/sharedArrayFactory.d.ts.map +1 -1
- package/dist/array/sharedArrayFactory.js +2 -4
- package/dist/array/sharedArrayFactory.js.map +1 -1
- package/dist/array/sharedArrayOperations.d.ts +9 -18
- package/dist/array/sharedArrayOperations.d.ts.map +1 -1
- package/dist/array/sharedArrayOperations.js +1 -2
- package/dist/array/sharedArrayOperations.js.map +1 -1
- package/dist/legacy.d.ts +2 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/signal/interfaces.d.ts +3 -6
- package/dist/signal/interfaces.d.ts.map +1 -1
- package/dist/signal/interfaces.js.map +1 -1
- package/dist/signal/sharedSignal.d.ts +1 -0
- package/dist/signal/sharedSignal.d.ts.map +1 -1
- package/dist/signal/sharedSignal.js +23 -9
- package/dist/signal/sharedSignal.js.map +1 -1
- package/dist/signal/sharedSignalFactory.d.ts +1 -2
- package/dist/signal/sharedSignalFactory.d.ts.map +1 -1
- package/dist/signal/sharedSignalFactory.js +1 -2
- package/dist/signal/sharedSignalFactory.js.map +1 -1
- package/internal.d.ts +1 -1
- package/legacy.d.ts +1 -1
- package/lib/array/interfaces.d.ts +4 -8
- package/lib/array/interfaces.d.ts.map +1 -1
- package/lib/array/interfaces.js.map +1 -1
- package/lib/array/sharedArray.d.ts +8 -0
- package/lib/array/sharedArray.d.ts.map +1 -1
- package/lib/array/sharedArray.js +131 -8
- package/lib/array/sharedArray.js.map +1 -1
- package/lib/array/sharedArrayFactory.d.ts +2 -4
- package/lib/array/sharedArrayFactory.d.ts.map +1 -1
- package/lib/array/sharedArrayFactory.js +2 -4
- package/lib/array/sharedArrayFactory.js.map +1 -1
- package/lib/array/sharedArrayOperations.d.ts +9 -18
- package/lib/array/sharedArrayOperations.d.ts.map +1 -1
- package/lib/array/sharedArrayOperations.js +1 -2
- package/lib/array/sharedArrayOperations.js.map +1 -1
- package/lib/legacy.d.ts +2 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/signal/interfaces.d.ts +3 -6
- package/lib/signal/interfaces.d.ts.map +1 -1
- package/lib/signal/interfaces.js.map +1 -1
- package/lib/signal/sharedSignal.d.ts +1 -0
- package/lib/signal/sharedSignal.d.ts.map +1 -1
- package/lib/signal/sharedSignal.js +15 -1
- package/lib/signal/sharedSignal.js.map +1 -1
- package/lib/signal/sharedSignalFactory.d.ts +1 -2
- package/lib/signal/sharedSignalFactory.d.ts.map +1 -1
- package/lib/signal/sharedSignalFactory.js +1 -2
- package/lib/signal/sharedSignalFactory.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +24 -24
- package/src/array/interfaces.ts +4 -8
- package/src/array/sharedArray.ts +146 -10
- package/src/array/sharedArrayFactory.ts +2 -4
- package/src/array/sharedArrayOperations.ts +9 -18
- package/src/packageVersion.ts +1 -1
- package/src/signal/interfaces.ts +3 -6
- package/src/signal/sharedSignal.ts +16 -2
- package/src/signal/sharedSignalFactory.ts +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedSignal.js","sourceRoot":"","sources":["../../src/signal/sharedSignal.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"sharedSignal.js","sourceRoot":"","sources":["../../src/signal/sharedSignal.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { FileMode, MessageType, TreeEntry } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tISequencedDocumentMessage,\n\tITree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { convertToSummaryTreeWithStats } from \"@fluidframework/runtime-utils/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport { SharedObject } from \"@fluidframework/shared-object-base/internal\";\n\nimport type {\n\tISharedSignal,\n\tISharedSignalEvents,\n\tISignalOperation,\n\tSerializableTypeForSharedSignal,\n} from \"./interfaces.js\";\nimport { SharedSignalFactory } from \"./sharedSignalFactory.js\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * Represents a shared signal that allows communication between distributed clients.\n *\n * @internal\n */\nexport class SharedSignalClass<T extends SerializableTypeForSharedSignal = any>\n\textends SharedObject<ISharedSignalEvents<T>>\n\timplements ISharedSignal<T>\n{\n\t/**\n\t * Create a new shared signal\n\t *\n\t * @param runtime - data store runtime the new shared signal belongs to\n\t * @param id - optional name of the shared signal\n\t * @returns newly create shared signal (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedSignalClass {\n\t\treturn runtime.createChannel(id, SharedSignalFactory.Type) as SharedSignalClass;\n\t}\n\n\t/**\n\t * Get a factory for SharedSignal to register with the data store.\n\t *\n\t * @returns a factory that creates and load SharedSignal\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new SharedSignalFactory();\n\t}\n\n\t/**\n\t * Constructs a new shared signal. If the object is non-local an id and service interfaces will\n\t * be provided\n\t * @param id - optional name of the shared signal\n\t * @param runtime - data store runtime the shared signal belongs to\n\t * @param attributes - represents the attributes of a channel/DDS.\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"loop_sharedSignal_\" /* telemetryContextPrefix */);\n\t}\n\n\t/**\n\t * Method used for generating a signal.\n\t */\n\tpublic notify(metadata?: T): void {\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: ISignalOperation<T> = {\n\t\t\ttype: \"signal\",\n\t\t\tmetadata,\n\t\t};\n\n\t\tthis.notifyCore(op, true);\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tprotected summarizeCore(_serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst tree: ITree = {\n\t\t\tentries: [\n\t\t\t\t{\n\t\t\t\t\tmode: FileMode.File,\n\t\t\t\t\tpath: snapshotFileName,\n\t\t\t\t\ttype: TreeEntry[TreeEntry.Blob],\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tcontents: JSON.stringify(\"\"),\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/text-encoding-identifier-case\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\n\t\tconst summaryTreeWithStats = convertToSummaryTreeWithStats(tree);\n\n\t\treturn summaryTreeWithStats;\n\t}\n\n\t/**\n\t * Load share signal from snapshot\n\t *\n\t * @param _storage - the storage to get the snapshot from\n\t * @returns - promise that resolved when the load is completed\n\t */\n\tprotected async loadCore(_storage: IChannelStorageService): Promise<void> {}\n\n\tprotected override initializeLocalCore(): void {}\n\n\t/**\n\t * Callback on disconnect\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Process a shared signal operation\n\t *\n\t * @param message - the message to prepare\n\t * @param local - whether the message was sent by the local client\n\t * @param _localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\t_localOpMetadata: unknown,\n\t): void {\n\t\tif ((message.type as MessageType) === MessageType.Operation && !local) {\n\t\t\tconst op = message.contents as ISignalOperation<T>;\n\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"signal\": {\n\t\t\t\t\tthis.notifyCore(op, local);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate notifyCore(op: ISignalOperation<T>, isLocal: boolean): void {\n\t\tthis.emit(\"notify\", op.metadata, isLocal);\n\t}\n\n\t// Nothing to roll back. Allowing other DDSs to handle rollback if necessary.\n\tpublic rollback(content: unknown, _localOpMetadata: unknown): void {\n\t\treturn;\n\t}\n\n\tprotected applyStashedOp(_content: unknown): void {\n\t\tconst op = _content as ISignalOperation<T>;\n\n\t\tswitch (op.type) {\n\t\t\tcase \"signal\": {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(op as never);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -17,8 +17,7 @@ export declare class SharedSignalFactory implements IChannelFactory<ISharedSigna
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Entrypoint for {@link ISharedSignal} creation.
|
|
20
|
-
* @legacy
|
|
21
|
-
* @alpha
|
|
20
|
+
* @legacy @beta
|
|
22
21
|
*/
|
|
23
22
|
export declare const SharedSignal: import("@fluidframework/shared-object-base/internal").ISharedObjectKind<ISharedSignal<any>> & import("@fluidframework/shared-object-base/internal").SharedObjectKind<ISharedSignal<any>>;
|
|
24
23
|
//# sourceMappingURL=sharedSignalFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedSignalFactory.d.ts","sourceRoot":"","sources":["../../src/signal/sharedSignalFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AAKxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;GAEG;AACH,qBAAa,mBAAoB,YAAW,eAAe,CAAC,aAAa,CAAC;IACzE,gBAAuB,IAAI,EAAE,MAAM,CAA8C;IAEjF,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAEY,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,aAAa,CAAC;IAMlB,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa;CAK1E;AAED
|
|
1
|
+
{"version":3,"file":"sharedSignalFactory.d.ts","sourceRoot":"","sources":["../../src/signal/sharedSignalFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AAKxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;GAEG;AACH,qBAAa,mBAAoB,YAAW,eAAe,CAAC,aAAa,CAAC;IACzE,gBAAuB,IAAI,EAAE,MAAM,CAA8C;IAEjF,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAEY,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,aAAa,CAAC;IAMlB,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa;CAK1E;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,0LAA6D,CAAC"}
|
|
@@ -34,8 +34,7 @@ SharedSignalFactory.Attributes = {
|
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* Entrypoint for {@link ISharedSignal} creation.
|
|
37
|
-
* @legacy
|
|
38
|
-
* @alpha
|
|
37
|
+
* @legacy @beta
|
|
39
38
|
*/
|
|
40
39
|
export const SharedSignal = createSharedObjectKind(SharedSignalFactory);
|
|
41
40
|
//# sourceMappingURL=sharedSignalFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedSignalFactory.js","sourceRoot":"","sources":["../../src/signal/sharedSignalFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAS/B,IAAW,IAAI;QACd,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACjC,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC9D,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,CAAC,eAAe,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC;;AA/BsB,wBAAI,GAAW,0CAA0C,CAAC;AAE1D,8BAAU,GAAuB;IACvD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,UAAU;CAC1B,CAAC;AA4BH
|
|
1
|
+
{"version":3,"file":"sharedSignalFactory.js","sourceRoot":"","sources":["../../src/signal/sharedSignalFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAS/B,IAAW,IAAI;QACd,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACjC,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC9D,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,CAAC,eAAe,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC;;AA/BsB,wBAAI,GAAW,0CAA0C,CAAC;AAE1D,8BAAU,GAAuB;IACvD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,UAAU;CAC1B,CAAC;AA4BH;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAgB,mBAAmB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelFactory,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { createSharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { pkgVersion } from \"../packageVersion.js\";\n\nimport type { ISharedSignal } from \"./interfaces.js\";\nimport { SharedSignalClass } from \"./sharedSignal.js\";\n\n/**\n * @internal\n */\nexport class SharedSignalFactory implements IChannelFactory<ISharedSignal> {\n\tpublic static readonly Type: string = \"https://graph.microsoft.com/types/signal\";\n\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: SharedSignalFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic get type(): string {\n\t\treturn SharedSignalFactory.Type;\n\t}\n\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn SharedSignalFactory.Attributes;\n\t}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedSignal> {\n\t\tconst signal = new SharedSignalClass(id, runtime, attributes);\n\t\tawait signal.load(services);\n\t\treturn signal;\n\t}\n\n\tpublic create(document: IFluidDataStoreRuntime, id: string): ISharedSignal {\n\t\tconst signal = new SharedSignalClass(id, document, this.attributes);\n\t\tsignal.initializeLocal();\n\t\treturn signal;\n\t}\n}\n\n/**\n * Entrypoint for {@link ISharedSignal} creation.\n * @legacy @beta\n */\nexport const SharedSignal = createSharedObjectKind<ISharedSignal>(SharedSignalFactory);\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/legacy-dds",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.61.0-355054",
|
|
4
4
|
"description": "Legacy DDSs for the Fluid Framework. These are not intended for use in new code.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -81,34 +81,34 @@
|
|
|
81
81
|
"temp-directory": "nyc/.nyc_output"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@fluid-internal/client-utils": "
|
|
85
|
-
"@fluidframework/core-interfaces": "
|
|
86
|
-
"@fluidframework/core-utils": "
|
|
87
|
-
"@fluidframework/datastore-definitions": "
|
|
88
|
-
"@fluidframework/driver-definitions": "
|
|
89
|
-
"@fluidframework/driver-utils": "
|
|
90
|
-
"@fluidframework/runtime-definitions": "
|
|
91
|
-
"@fluidframework/runtime-utils": "
|
|
92
|
-
"@fluidframework/shared-object-base": "
|
|
84
|
+
"@fluid-internal/client-utils": "2.61.0-355054",
|
|
85
|
+
"@fluidframework/core-interfaces": "2.61.0-355054",
|
|
86
|
+
"@fluidframework/core-utils": "2.61.0-355054",
|
|
87
|
+
"@fluidframework/datastore-definitions": "2.61.0-355054",
|
|
88
|
+
"@fluidframework/driver-definitions": "2.61.0-355054",
|
|
89
|
+
"@fluidframework/driver-utils": "2.61.0-355054",
|
|
90
|
+
"@fluidframework/runtime-definitions": "2.61.0-355054",
|
|
91
|
+
"@fluidframework/runtime-utils": "2.61.0-355054",
|
|
92
|
+
"@fluidframework/shared-object-base": "2.61.0-355054",
|
|
93
93
|
"uuid": "^11.1.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
97
97
|
"@biomejs/biome": "~1.9.3",
|
|
98
|
-
"@fluid-internal/mocha-test-setup": "
|
|
99
|
-
"@fluid-private/stochastic-test-utils": "
|
|
100
|
-
"@fluid-private/test-dds-utils": "
|
|
101
|
-
"@fluid-tools/build-cli": "^0.
|
|
98
|
+
"@fluid-internal/mocha-test-setup": "2.61.0-355054",
|
|
99
|
+
"@fluid-private/stochastic-test-utils": "2.61.0-355054",
|
|
100
|
+
"@fluid-private/test-dds-utils": "2.61.0-355054",
|
|
101
|
+
"@fluid-tools/build-cli": "^0.58.2",
|
|
102
102
|
"@fluidframework/build-common": "^2.0.3",
|
|
103
|
-
"@fluidframework/build-tools": "^0.
|
|
104
|
-
"@fluidframework/container-definitions": "
|
|
105
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
106
|
-
"@fluidframework/test-runtime-utils": "
|
|
107
|
-
"@microsoft/api-extractor": "7.52.
|
|
103
|
+
"@fluidframework/build-tools": "^0.58.2",
|
|
104
|
+
"@fluidframework/container-definitions": "2.61.0-355054",
|
|
105
|
+
"@fluidframework/eslint-config-fluid": "^6.0.0",
|
|
106
|
+
"@fluidframework/test-runtime-utils": "2.61.0-355054",
|
|
107
|
+
"@microsoft/api-extractor": "7.52.11",
|
|
108
108
|
"@types/jest": "29.5.3",
|
|
109
109
|
"@types/mocha": "^10.0.10",
|
|
110
110
|
"@types/node": "^18.19.0",
|
|
111
|
-
"c8": "^
|
|
111
|
+
"c8": "^10.1.3",
|
|
112
112
|
"concurrently": "^8.2.1",
|
|
113
113
|
"copyfiles": "^2.4.1",
|
|
114
114
|
"cross-env": "^7.0.3",
|
|
@@ -125,8 +125,8 @@
|
|
|
125
125
|
},
|
|
126
126
|
"scripts": {
|
|
127
127
|
"api": "fluid-build . --task api",
|
|
128
|
-
"api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
|
|
129
|
-
"api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
|
|
128
|
+
"api-extractor:commonjs": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./dist",
|
|
129
|
+
"api-extractor:esnext": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat",
|
|
130
130
|
"build": "fluid-build . --task build",
|
|
131
131
|
"build:api-reports": "concurrently \"npm:build:api-reports:*\"",
|
|
132
132
|
"build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
|
|
@@ -162,8 +162,8 @@
|
|
|
162
162
|
"test": "npm run test:mocha",
|
|
163
163
|
"test:coverage": "c8 npm test",
|
|
164
164
|
"test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
|
|
165
|
-
"test:mocha:cjs": "
|
|
166
|
-
"test:mocha:esm": "mocha
|
|
165
|
+
"test:mocha:cjs": "cross-env MOCHA_SPEC=dist/test mocha",
|
|
166
|
+
"test:mocha:esm": "mocha",
|
|
167
167
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
168
168
|
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
|
|
169
169
|
"typetests:gen": "flub generate typetests --dir . -v",
|
package/src/array/interfaces.ts
CHANGED
|
@@ -16,8 +16,7 @@ import type { ISharedArrayOperation } from "./sharedArrayOperations.js";
|
|
|
16
16
|
* It can be used as a generic constraint (`extends SerializableTypeForSharedArray`) but is
|
|
17
17
|
* *never* meant to be a concrete/real type on its own.
|
|
18
18
|
*
|
|
19
|
-
* @legacy
|
|
20
|
-
* @alpha
|
|
19
|
+
* @legacy @beta
|
|
21
20
|
*/
|
|
22
21
|
export type SerializableTypeForSharedArray = boolean | number | string | object | IFluidHandle;
|
|
23
22
|
|
|
@@ -25,8 +24,7 @@ export type SerializableTypeForSharedArray = boolean | number | string | object
|
|
|
25
24
|
* Interface defining the events that can be emitted by the SharedArray DDS
|
|
26
25
|
* and the events that can be listened to by the SharedArray DDS
|
|
27
26
|
*
|
|
28
|
-
* @legacy
|
|
29
|
-
* @alpha
|
|
27
|
+
* @legacy @beta
|
|
30
28
|
*/
|
|
31
29
|
export interface ISharedArrayEvents extends ISharedObjectEvents {
|
|
32
30
|
/**
|
|
@@ -62,8 +60,7 @@ export interface ISharedArrayEvents extends ISharedObjectEvents {
|
|
|
62
60
|
*
|
|
63
61
|
* @typeParam T - The type of the SharedArray
|
|
64
62
|
*
|
|
65
|
-
* @legacy
|
|
66
|
-
* @alpha
|
|
63
|
+
* @legacy @beta
|
|
67
64
|
*/
|
|
68
65
|
export interface ISharedArray<T extends SerializableTypeForSharedArray>
|
|
69
66
|
extends ISharedObject<ISharedArrayEvents> {
|
|
@@ -160,8 +157,7 @@ export interface SnapshotFormat<T> {
|
|
|
160
157
|
}
|
|
161
158
|
|
|
162
159
|
/**
|
|
163
|
-
* @legacy
|
|
164
|
-
* @alpha
|
|
160
|
+
* @legacy @beta
|
|
165
161
|
*/
|
|
166
162
|
export interface IRevertible {
|
|
167
163
|
revert(): void;
|
package/src/array/sharedArray.ts
CHANGED
|
@@ -68,6 +68,13 @@ export class SharedArrayClass<T extends SerializableTypeForSharedArray>
|
|
|
68
68
|
*/
|
|
69
69
|
private readonly idToEntryMap: Map<string, SharedArrayEntry<T>>;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Set of entry IDs that are marked for deletion by remote clients, but have local pending deletes.
|
|
73
|
+
* Used to prevent resuscitating entries while rolling back a delete operation.
|
|
74
|
+
* We should not rollback to life an entry that was deleted by remote clients.
|
|
75
|
+
*/
|
|
76
|
+
private readonly remoteDeleteWithLocalPendingDelete: Set<string> = new Set<string>();
|
|
77
|
+
|
|
71
78
|
/**
|
|
72
79
|
* Create a new shared array
|
|
73
80
|
*
|
|
@@ -350,7 +357,6 @@ export class SharedArrayClass<T extends SerializableTypeForSharedArray>
|
|
|
350
357
|
|
|
351
358
|
this.submitLocalMessage(op);
|
|
352
359
|
}
|
|
353
|
-
|
|
354
360
|
/**
|
|
355
361
|
* Method to do undo/redo of move operation. All entries of the same payload/value are stored
|
|
356
362
|
* in the same doubly linked skip list. This skip list is updated upon every move by adding the
|
|
@@ -386,6 +392,94 @@ export class SharedArrayClass<T extends SerializableTypeForSharedArray>
|
|
|
386
392
|
this.submitLocalMessage(op);
|
|
387
393
|
}
|
|
388
394
|
|
|
395
|
+
public rollback(op: unknown, _localOpMetadata: unknown): void {
|
|
396
|
+
const arrayOp = op as ISharedArrayOperation<T>;
|
|
397
|
+
switch (arrayOp.type) {
|
|
398
|
+
case OperationType.insertEntry: {
|
|
399
|
+
const liveEntry = this.getLiveEntry(arrayOp.entryId);
|
|
400
|
+
liveEntry.isDeleted = true;
|
|
401
|
+
const deleteOp: IDeleteOperation = {
|
|
402
|
+
type: OperationType.deleteEntry,
|
|
403
|
+
entryId: arrayOp.entryId,
|
|
404
|
+
};
|
|
405
|
+
this.emitValueChangedEvent(deleteOp, true /* isLocal */);
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
case OperationType.deleteEntry: {
|
|
409
|
+
if (this.remoteDeleteWithLocalPendingDelete.has(arrayOp.entryId)) {
|
|
410
|
+
// If remote already deleted the entry, we should not resurrect it.
|
|
411
|
+
// Just remove the local pending delete.
|
|
412
|
+
this.remoteDeleteWithLocalPendingDelete.delete(arrayOp.entryId);
|
|
413
|
+
} else {
|
|
414
|
+
const liveEntry = this.getLiveEntry(arrayOp.entryId);
|
|
415
|
+
liveEntry.isDeleted = false;
|
|
416
|
+
const insertOp = {
|
|
417
|
+
type: OperationType.insertEntry,
|
|
418
|
+
entryId: arrayOp.entryId,
|
|
419
|
+
value: liveEntry.value,
|
|
420
|
+
};
|
|
421
|
+
this.emitValueChangedEvent(insertOp, true /* isLocal */);
|
|
422
|
+
const entry = this.getEntryForId(arrayOp.entryId);
|
|
423
|
+
if (entry !== undefined && entry.isLocalPendingDelete > 0) {
|
|
424
|
+
entry.isLocalPendingDelete -= 1;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
case OperationType.moveEntry: {
|
|
430
|
+
const { entryId: oldEntryId, changedToEntryId: newEntryId } = arrayOp;
|
|
431
|
+
if (this.getEntryForId(newEntryId).isDeleted) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
this.updateLiveEntry(newEntryId, oldEntryId);
|
|
435
|
+
const inputEntry = this.getEntryForId(oldEntryId);
|
|
436
|
+
inputEntry.prevEntryId = undefined;
|
|
437
|
+
inputEntry.nextEntryId = undefined;
|
|
438
|
+
inputEntry.isLocalPendingMove = 0;
|
|
439
|
+
const moveOp: IMoveOperation = {
|
|
440
|
+
type: OperationType.moveEntry,
|
|
441
|
+
entryId: newEntryId,
|
|
442
|
+
changedToEntryId: oldEntryId,
|
|
443
|
+
};
|
|
444
|
+
this.emitValueChangedEvent(moveOp, true /* isLocal */);
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
case OperationType.toggle: {
|
|
448
|
+
const entryId = arrayOp.entryId;
|
|
449
|
+
const liveEntry = this.getLiveEntry(entryId);
|
|
450
|
+
const isDeleted = liveEntry.isDeleted;
|
|
451
|
+
|
|
452
|
+
// Toggling the isDeleted flag to undo the last operation for the skip list payload/value
|
|
453
|
+
liveEntry.isDeleted = !isDeleted;
|
|
454
|
+
liveEntry.isLocalPendingDelete -= 1;
|
|
455
|
+
|
|
456
|
+
const toggleOp: IToggleOperation = {
|
|
457
|
+
type: OperationType.toggle,
|
|
458
|
+
entryId,
|
|
459
|
+
isDeleted: liveEntry.isDeleted,
|
|
460
|
+
};
|
|
461
|
+
this.emitValueChangedEvent(toggleOp, true /* isLocal */);
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
case OperationType.toggleMove: {
|
|
465
|
+
const { entryId: oldEntryId, changedToEntryId: newEntryId } = arrayOp;
|
|
466
|
+
this.getEntryForId(oldEntryId).isLocalPendingMove -= 1;
|
|
467
|
+
this.updateLiveEntry(oldEntryId, newEntryId);
|
|
468
|
+
|
|
469
|
+
const toggleMoveOp: IToggleMoveOperation = {
|
|
470
|
+
type: OperationType.toggleMove,
|
|
471
|
+
entryId: newEntryId,
|
|
472
|
+
changedToEntryId: oldEntryId,
|
|
473
|
+
};
|
|
474
|
+
this.emitValueChangedEvent(toggleMoveOp, true /* isLocal */);
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
default: {
|
|
478
|
+
unreachableCase(arrayOp);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
389
483
|
/**
|
|
390
484
|
* Load share array from snapshot
|
|
391
485
|
*
|
|
@@ -541,9 +635,11 @@ export class SharedArrayClass<T extends SerializableTypeForSharedArray>
|
|
|
541
635
|
if (local) {
|
|
542
636
|
// Decrementing local pending counter as op is already applied to local state
|
|
543
637
|
opEntry.isLocalPendingDelete -= 1;
|
|
638
|
+
this.remoteDeleteWithLocalPendingDelete.delete(op.entryId);
|
|
544
639
|
} else {
|
|
545
|
-
|
|
546
|
-
|
|
640
|
+
if (this.isLocalPending(op.entryId, "isLocalPendingDelete")) {
|
|
641
|
+
this.remoteDeleteWithLocalPendingDelete.add(op.entryId);
|
|
642
|
+
} else {
|
|
547
643
|
// last element in skip list is the most recent and live entry, so marking it deleted
|
|
548
644
|
this.getLiveEntry(op.entryId).isDeleted = true;
|
|
549
645
|
}
|
|
@@ -841,33 +937,73 @@ export class SharedArrayClass<T extends SerializableTypeForSharedArray>
|
|
|
841
937
|
deadEntry.isDeleted = true;
|
|
842
938
|
}
|
|
843
939
|
|
|
940
|
+
private handleStashedInsert(
|
|
941
|
+
entryId: string,
|
|
942
|
+
insertAfterEntryId: string | undefined,
|
|
943
|
+
value: Serializable<SerializableTypeForSharedArray> & T,
|
|
944
|
+
): void {
|
|
945
|
+
let index = 0;
|
|
946
|
+
if (insertAfterEntryId !== undefined) {
|
|
947
|
+
index = this.findIndexOfEntryId(insertAfterEntryId) + 1;
|
|
948
|
+
}
|
|
949
|
+
const newEntry = this.createNewEntry<SerializableTypeForSharedArray>(entryId, value);
|
|
950
|
+
newEntry.isAckPending = true;
|
|
951
|
+
this.addEntry(index, newEntry);
|
|
952
|
+
}
|
|
953
|
+
|
|
844
954
|
protected applyStashedOp(content: unknown): void {
|
|
845
955
|
const op = content as ISharedArrayOperation<T>;
|
|
846
956
|
|
|
847
957
|
switch (op.type) {
|
|
848
958
|
case OperationType.insertEntry: {
|
|
849
|
-
this.
|
|
959
|
+
this.handleStashedInsert(
|
|
850
960
|
op.entryId,
|
|
851
961
|
op.insertAfterEntryId,
|
|
852
|
-
|
|
853
|
-
op.value,
|
|
962
|
+
op.value as Serializable<SerializableTypeForSharedArray> & T,
|
|
854
963
|
);
|
|
855
964
|
break;
|
|
856
965
|
}
|
|
857
966
|
case OperationType.deleteEntry: {
|
|
858
|
-
this.
|
|
967
|
+
this.getLiveEntry(op.entryId).isDeleted = true;
|
|
968
|
+
this.getEntryForId(op.entryId).isLocalPendingDelete += 1;
|
|
859
969
|
break;
|
|
860
970
|
}
|
|
861
971
|
case OperationType.moveEntry: {
|
|
862
|
-
this.
|
|
972
|
+
const opEntry = this.getEntryForId(op.entryId);
|
|
973
|
+
this.handleStashedInsert(
|
|
974
|
+
op.changedToEntryId,
|
|
975
|
+
op.insertAfterEntryId,
|
|
976
|
+
opEntry.value as Serializable<SerializableTypeForSharedArray> & T,
|
|
977
|
+
);
|
|
978
|
+
|
|
979
|
+
const newElementEntryId = op.changedToEntryId;
|
|
980
|
+
const newElement = this.getEntryForId(newElementEntryId);
|
|
981
|
+
if (
|
|
982
|
+
this.isLocalPending(op.entryId, "isLocalPendingDelete") ||
|
|
983
|
+
this.isLocalPending(op.entryId, "isLocalPendingMove")
|
|
984
|
+
) {
|
|
985
|
+
this.updateDeadEntry(op.entryId, newElementEntryId);
|
|
986
|
+
} else {
|
|
987
|
+
// move the element
|
|
988
|
+
const liveEntry = this.getLiveEntry(op.entryId);
|
|
989
|
+
const isDeleted = liveEntry.isDeleted;
|
|
990
|
+
this.updateLiveEntry(liveEntry.entryId, newElementEntryId);
|
|
991
|
+
// mark newly added element as deleted if existing live element was already deleted
|
|
992
|
+
if (isDeleted) {
|
|
993
|
+
newElement.isDeleted = isDeleted;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
newElement.isLocalPendingMove += 1;
|
|
863
997
|
break;
|
|
864
998
|
}
|
|
865
999
|
case OperationType.toggle: {
|
|
866
|
-
this.
|
|
1000
|
+
this.getLiveEntry(op.entryId).isDeleted = op.isDeleted;
|
|
1001
|
+
this.getEntryForId(op.entryId).isLocalPendingDelete += 1;
|
|
867
1002
|
break;
|
|
868
1003
|
}
|
|
869
1004
|
case OperationType.toggleMove: {
|
|
870
|
-
this.
|
|
1005
|
+
this.updateLiveEntry(this.getLiveEntry(op.entryId).entryId, op.entryId);
|
|
1006
|
+
this.getEntryForId(op.entryId).isLocalPendingMove += 1;
|
|
871
1007
|
break;
|
|
872
1008
|
}
|
|
873
1009
|
default: {
|
|
@@ -68,8 +68,7 @@ export class SharedArrayFactory<T extends SerializableTypeForSharedArray>
|
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Entrypoint for {@link ISharedArray} creation.
|
|
71
|
-
* @legacy
|
|
72
|
-
* @alpha
|
|
71
|
+
* @legacy @beta
|
|
73
72
|
*/
|
|
74
73
|
export const SharedArray: ISharedObjectKind<ISharedArray<SerializableTypeForSharedArray>> &
|
|
75
74
|
SharedObjectKind<ISharedArray<SerializableTypeForSharedArray>> =
|
|
@@ -77,8 +76,7 @@ export const SharedArray: ISharedObjectKind<ISharedArray<SerializableTypeForShar
|
|
|
77
76
|
|
|
78
77
|
/**
|
|
79
78
|
* Entrypoint for {@link ISharedArray} creation.
|
|
80
|
-
* @legacy
|
|
81
|
-
* @alpha
|
|
79
|
+
* @legacy @beta
|
|
82
80
|
*/
|
|
83
81
|
export const SharedArrayBuilder = <
|
|
84
82
|
T extends SerializableTypeForSharedArray,
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @legacy
|
|
8
|
-
* @alpha
|
|
7
|
+
* @legacy @beta
|
|
9
8
|
*/
|
|
10
9
|
export const OperationType = {
|
|
11
10
|
insertEntry: 0,
|
|
@@ -16,14 +15,12 @@ export const OperationType = {
|
|
|
16
15
|
} as const;
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
|
-
* @legacy
|
|
20
|
-
* @alpha
|
|
18
|
+
* @legacy @beta
|
|
21
19
|
*/
|
|
22
20
|
export type OperationType = (typeof OperationType)[keyof typeof OperationType];
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
|
-
* @legacy
|
|
26
|
-
* @alpha
|
|
23
|
+
* @legacy @beta
|
|
27
24
|
*/
|
|
28
25
|
export interface IInsertOperation<T = unknown> {
|
|
29
26
|
type: typeof OperationType.insertEntry;
|
|
@@ -33,8 +30,7 @@ export interface IInsertOperation<T = unknown> {
|
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
/**
|
|
36
|
-
* @legacy
|
|
37
|
-
* @alpha
|
|
33
|
+
* @legacy @beta
|
|
38
34
|
*/
|
|
39
35
|
export interface IDeleteOperation {
|
|
40
36
|
type: typeof OperationType.deleteEntry;
|
|
@@ -42,8 +38,7 @@ export interface IDeleteOperation {
|
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
/**
|
|
45
|
-
* @legacy
|
|
46
|
-
* @alpha
|
|
41
|
+
* @legacy @beta
|
|
47
42
|
*/
|
|
48
43
|
export interface IMoveOperation {
|
|
49
44
|
type: typeof OperationType.moveEntry;
|
|
@@ -53,8 +48,7 @@ export interface IMoveOperation {
|
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
/**
|
|
56
|
-
* @legacy
|
|
57
|
-
* @alpha
|
|
51
|
+
* @legacy @beta
|
|
58
52
|
*/
|
|
59
53
|
export interface IToggleOperation {
|
|
60
54
|
type: typeof OperationType.toggle;
|
|
@@ -63,8 +57,7 @@ export interface IToggleOperation {
|
|
|
63
57
|
}
|
|
64
58
|
|
|
65
59
|
/**
|
|
66
|
-
* @legacy
|
|
67
|
-
* @alpha
|
|
60
|
+
* @legacy @beta
|
|
68
61
|
*/
|
|
69
62
|
export interface IToggleMoveOperation {
|
|
70
63
|
type: typeof OperationType.toggleMove;
|
|
@@ -73,14 +66,12 @@ export interface IToggleMoveOperation {
|
|
|
73
66
|
}
|
|
74
67
|
|
|
75
68
|
/**
|
|
76
|
-
* @legacy
|
|
77
|
-
* @alpha
|
|
69
|
+
* @legacy @beta
|
|
78
70
|
*/
|
|
79
71
|
export type ISharedArrayRevertibleOperation = IToggleOperation | IToggleMoveOperation;
|
|
80
72
|
|
|
81
73
|
/**
|
|
82
|
-
* @legacy
|
|
83
|
-
* @alpha
|
|
74
|
+
* @legacy @beta
|
|
84
75
|
*/
|
|
85
76
|
export type ISharedArrayOperation<T = unknown> =
|
|
86
77
|
| IInsertOperation<T>
|
package/src/packageVersion.ts
CHANGED
package/src/signal/interfaces.ts
CHANGED
|
@@ -13,8 +13,7 @@ import type {
|
|
|
13
13
|
* Basic types for the SharedSignal DDS
|
|
14
14
|
* It can be used as a generic constraint (`extends SerializableTypeForSharedSignal`) but is
|
|
15
15
|
* *never* meant to be a concrete/real type on its own.
|
|
16
|
-
* @legacy
|
|
17
|
-
* @alpha
|
|
16
|
+
* @legacy @beta
|
|
18
17
|
*/
|
|
19
18
|
export type SerializableTypeForSharedSignal =
|
|
20
19
|
| boolean
|
|
@@ -24,8 +23,7 @@ export type SerializableTypeForSharedSignal =
|
|
|
24
23
|
| object;
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
|
-
* @legacy
|
|
28
|
-
* @alpha
|
|
26
|
+
* @legacy @beta
|
|
29
27
|
*/
|
|
30
28
|
export interface ISharedSignalEvents<T extends SerializableTypeForSharedSignal>
|
|
31
29
|
extends ISharedObjectEvents {
|
|
@@ -35,8 +33,7 @@ export interface ISharedSignalEvents<T extends SerializableTypeForSharedSignal>
|
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
/**
|
|
38
|
-
* @legacy
|
|
39
|
-
* @alpha
|
|
36
|
+
* @legacy @beta
|
|
40
37
|
*/
|
|
41
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
39
|
export interface ISharedSignal<T extends SerializableTypeForSharedSignal = any>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
-
|
|
7
|
+
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import type {
|
|
9
9
|
IChannelAttributes,
|
|
10
10
|
IFluidDataStoreRuntime,
|
|
@@ -163,7 +163,21 @@ export class SharedSignalClass<T extends SerializableTypeForSharedSignal = any>
|
|
|
163
163
|
this.emit("notify", op.metadata, isLocal);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
// Nothing to roll back. Allowing other DDSs to handle rollback if necessary.
|
|
167
|
+
public rollback(content: unknown, _localOpMetadata: unknown): void {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
166
171
|
protected applyStashedOp(_content: unknown): void {
|
|
167
|
-
|
|
172
|
+
const op = _content as ISignalOperation<T>;
|
|
173
|
+
|
|
174
|
+
switch (op.type) {
|
|
175
|
+
case "signal": {
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
default: {
|
|
179
|
+
unreachableCase(op as never);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
168
182
|
}
|
|
169
183
|
}
|
|
@@ -56,7 +56,6 @@ export class SharedSignalFactory implements IChannelFactory<ISharedSignal> {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Entrypoint for {@link ISharedSignal} creation.
|
|
59
|
-
* @legacy
|
|
60
|
-
* @alpha
|
|
59
|
+
* @legacy @beta
|
|
61
60
|
*/
|
|
62
61
|
export const SharedSignal = createSharedObjectKind<ISharedSignal>(SharedSignalFactory);
|