@fluid-experimental/data-objects 2.0.0-dev.5.3.2.178189 → 2.0.0-dev.6.4.0.191457
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/CHANGELOG.md +51 -0
- package/dist/signaler/signaler.d.ts +1 -1
- package/dist/signaler/signaler.d.ts.map +1 -1
- package/dist/signaler/signaler.js +2 -1
- package/dist/signaler/signaler.js.map +1 -1
- package/lib/signaler/signaler.d.ts +1 -1
- package/lib/signaler/signaler.d.ts.map +1 -1
- package/lib/signaler/signaler.js +2 -1
- package/lib/signaler/signaler.js.map +1 -1
- package/package.json +14 -14
- package/src/signaler/signaler.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @fluid-experimental/data-objects
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.6.3.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.0.0-internal.6.2.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
12
|
+
|
|
13
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
14
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
15
|
+
|
|
16
|
+
- interface IDisposable
|
|
17
|
+
- interface IErrorEvent
|
|
18
|
+
- interface IErrorEvent
|
|
19
|
+
- interface IEvent
|
|
20
|
+
- interface IEventProvider
|
|
21
|
+
- interface ILoggingError
|
|
22
|
+
- interface ITaggedTelemetryPropertyType
|
|
23
|
+
- interface ITelemetryBaseEvent
|
|
24
|
+
- interface ITelemetryBaseLogger
|
|
25
|
+
- interface ITelemetryErrorEvent
|
|
26
|
+
- interface ITelemetryGenericEvent
|
|
27
|
+
- interface ITelemetryLogger
|
|
28
|
+
- interface ITelemetryPerformanceEvent
|
|
29
|
+
- interface ITelemetryProperties
|
|
30
|
+
- type ExtendEventProvider
|
|
31
|
+
- type IEventThisPlaceHolder
|
|
32
|
+
- type IEventTransformer
|
|
33
|
+
- type ReplaceIEventThisPlaceHolder
|
|
34
|
+
- type ReplaceIEventThisPlaceHolder
|
|
35
|
+
- type TelemetryEventCategory
|
|
36
|
+
- type TelemetryEventPropertyType
|
|
37
|
+
|
|
38
|
+
## 2.0.0-internal.6.1.0
|
|
39
|
+
|
|
40
|
+
Dependency updates only.
|
|
41
|
+
|
|
42
|
+
## 2.0.0-internal.6.0.0
|
|
43
|
+
|
|
44
|
+
### Major Changes
|
|
45
|
+
|
|
46
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
47
|
+
|
|
48
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
49
|
+
|
|
50
|
+
## 2.0.0-internal.5.4.0
|
|
51
|
+
|
|
52
|
+
Dependency updates only.
|
|
53
|
+
|
|
3
54
|
## 2.0.0-internal.5.3.0
|
|
4
55
|
|
|
5
56
|
Dependency updates only.
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/// <reference types="node" />
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
7
|
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
8
|
-
import { IErrorEvent } from "@fluidframework/common-definitions";
|
|
9
8
|
import { Jsonable } from "@fluidframework/datastore-definitions";
|
|
10
9
|
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
10
|
+
import { IErrorEvent } from "@fluidframework/core-interfaces";
|
|
11
11
|
export declare type SignalListener = (clientId: string, local: boolean, payload: Jsonable) => void;
|
|
12
12
|
/**
|
|
13
13
|
* ISignaler defines an interface for working with signals that is similar to the more common
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signaler.d.ts","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"signaler.d.ts","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGzE,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAM9D,oBAAY,cAAc,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;AAE3F;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;IAClE;;;;;;OAMG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;IACnE;;;;OAIG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,OAAE;CACrD;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,OAAE;IACxF,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;CAC/C;AAsED;;;GAGG;AACH,qBAAa,QACZ,SAAQ,UAAU,CAAC;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAC1C,YAAW,YAAY,EAAE,SAAS;IAElC,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,KAAK,QAAQ,GAGnB;IAED,WAAkB,IAAI,WAErB;IAED,gBAAuB,OAAO;gBAbD,WAAW;OAagD;cAExE,cAAc;IASvB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS;IAKjE,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS;IAKlE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ;CAG1D"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
6
|
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
7
|
-
import {
|
|
7
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
8
|
+
import { assert } from "@fluidframework/core-utils";
|
|
8
9
|
/**
|
|
9
10
|
* Note: currently experimental and under development
|
|
10
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signaler.js","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,0BAA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AAI,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,qDAAqD;IAE9C,QAAQ,CAAC,UAAkB,EAAE,QAAwB;QAC3D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,SAAS,CAAC,UAAkB,EAAE,QAAwB;QAC5D,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,YAAY,CAAC,UAAkB,EAAE,OAAkB;QACzD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;;AAvBsB,gBAAO,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { EventEmitter } from \"events\";\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { Jsonable } from \"@fluidframework/datastore-definitions\";\nimport { IInboundSignalMessage } from \"@fluidframework/runtime-definitions\";\nimport { IErrorEvent } from \"@fluidframework/core-interfaces\";\n\n// TODO:\n// add way to mark with current sequence number for ordering signals relative to ops\n// throttling and batching\n\nexport type SignalListener = (clientId: string, local: boolean, payload: Jsonable) => void;\n\n/**\n * ISignaler defines an interface for working with signals that is similar to the more common\n * eventing patterns of EventEmitter. In addition to sending and responding to signals, it\n * provides explicit methods around signal requests to other connected clients.\n */\nexport interface ISignaler {\n\t/**\n\t * Adds a listener for the specified signal. It behaves in the same way as EventEmitter's `on`\n\t * method regarding multiple registrations, callback order, etc.\n\t * @param signalName - The name of the signal\n\t * @param listener - The callback signal handler to add\n\t * @returns This ISignaler\n\t */\n\tonSignal(signalName: string, listener: SignalListener): ISignaler;\n\t/**\n\t * Remove a listener for the specified signal. It behaves in the same way as EventEmitter's\n\t * `off` method regarding multiple registrations, removal order, etc.\n\t * @param signalName - The name of the signal\n\t * @param listener - The callback signal handler to remove\n\t * @returns This ISignaler\n\t */\n\toffSignal(signalName: string, listener: SignalListener): ISignaler;\n\t/**\n\t * Send a signal with payload to its connected listeners.\n\t * @param signalName - The name of the signal\n\t * @param payload - The data to send with the signal\n\t */\n\tsubmitSignal(signalName: string, payload?: Jsonable);\n}\n\n/**\n * Duck type of something that provides the expected signalling functionality:\n * A way to verify we can signal, a way to send a signal, and a way to listen for incoming signals\n */\nexport interface IRuntimeSignaler {\n\tconnected: boolean;\n\ton(event: \"signal\", listener: (message: IInboundSignalMessage, local: boolean) => void);\n\tsubmitSignal(type: string, content: any): void;\n}\n\n/**\n * Note: currently experimental and under development\n *\n * Helper class to assist common scenarios around working with signals. InternalSignaler wraps a runtime\n * object with signaling functionality (e.g. ContainerRuntime or FluidDataStoreRuntime) and can\n * then be used in place of the original signaler. It uses a separate internal EventEmitter to\n * manage callbacks, and thus will reflect that behavior with regards to callback registration and\n * deregistration.\n */\nclass InternalSignaler extends TypedEventEmitter<IErrorEvent> implements ISignaler {\n\tprivate readonly emitter = new EventEmitter();\n\n\tprivate readonly signalerId: string | undefined;\n\n\tconstructor(\n\t\t/**\n\t\t * Object to wrap that can submit and listen to signals\n\t\t */\n\t\tprivate readonly signaler: IRuntimeSignaler,\n\t\t/**\n\t\t * Optional id to assign to this manager that will be attached to\n\t\t * signal names. Useful to avoid collisions if there are multiple\n\t\t * signal users at the Container level\n\t\t */\n\t\tsignalerId?: string,\n\t) {\n\t\tsuper();\n\t\tthis.emitter.on(\"error\", (error) => {\n\t\t\tthis.emit(\"error\", error);\n\t\t});\n\t\tthis.signalerId = signalerId ? `#${signalerId}` : undefined;\n\t\tthis.signaler.on(\"signal\", (message: IInboundSignalMessage, local: boolean) => {\n\t\t\tconst clientId = message.clientId;\n\t\t\t// Only call listeners when the runtime is connected and if the signal has an\n\t\t\t// identifiable sender clientId. The listener is responsible for deciding how\n\t\t\t// it wants to handle local/remote signals\n\t\t\tif (this.signaler.connected && clientId !== null) {\n\t\t\t\tthis.emitter.emit(message.type, clientId, local, message.content);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate getSignalerSignalName(signalName: string): string {\n\t\treturn this.signalerId ? `${signalName}${this.signalerId}` : signalName;\n\t}\n\n\t// ISignaler methods\n\n\tpublic onSignal(signalName: string, listener: SignalListener): ISignaler {\n\t\tconst signalerSignalName = this.getSignalerSignalName(signalName);\n\t\tthis.emitter.on(signalerSignalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic offSignal(signalName: string, listener: SignalListener): ISignaler {\n\t\tconst signalerSignalName = this.getSignalerSignalName(signalName);\n\t\tthis.emitter.off(signalerSignalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic submitSignal(signalName: string, payload?: Jsonable) {\n\t\tconst signalerSignalName = this.getSignalerSignalName(signalName);\n\t\tif (this.signaler.connected) {\n\t\t\tthis.signaler.submitSignal(signalerSignalName, payload);\n\t\t}\n\t}\n}\n\n/**\n * DataObject implementation of ISignaler for fluid-static plug-and-play. Allows fluid-static\n * users to get an ISignaler without a custom DO.\n */\nexport class Signaler\n\textends DataObject<{ Events: IErrorEvent }>\n\timplements EventEmitter, ISignaler\n{\n\tprivate _signaler: InternalSignaler | undefined;\n\tprivate get signaler(): InternalSignaler {\n\t\tassert(this._signaler !== undefined, 0x24b /* \"internal signaler should be defined\" */);\n\t\treturn this._signaler;\n\t}\n\n\tpublic static get Name() {\n\t\treturn \"@fluid-example/signaler\";\n\t}\n\n\tpublic static readonly factory = new DataObjectFactory(Signaler.Name, Signaler, [], {});\n\n\tprotected async hasInitialized() {\n\t\tthis._signaler = new InternalSignaler(this.runtime);\n\t\tthis.signaler.on(\"error\", (error) => {\n\t\t\tthis.emit(\"error\", error);\n\t\t});\n\t}\n\n\t// ISignaler methods Note these are all passthroughs\n\n\tpublic onSignal(signalName: string, listener: SignalListener): ISignaler {\n\t\tthis.signaler.onSignal(signalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic offSignal(signalName: string, listener: SignalListener): ISignaler {\n\t\tthis.signaler.offSignal(signalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic submitSignal(signalName: string, payload?: Jsonable) {\n\t\tthis.signaler.submitSignal(signalName, payload);\n\t}\n}\n"]}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/// <reference types="node" />
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
7
|
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
8
|
-
import { IErrorEvent } from "@fluidframework/common-definitions";
|
|
9
8
|
import { Jsonable } from "@fluidframework/datastore-definitions";
|
|
10
9
|
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
10
|
+
import { IErrorEvent } from "@fluidframework/core-interfaces";
|
|
11
11
|
export declare type SignalListener = (clientId: string, local: boolean, payload: Jsonable) => void;
|
|
12
12
|
/**
|
|
13
13
|
* ISignaler defines an interface for working with signals that is similar to the more common
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signaler.d.ts","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"signaler.d.ts","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings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uB,OAAO;gBAbD,WAAW;OAagD;cAExE,cAAc;IASvB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS;IAKjE,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS;IAKlE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ;CAG1D"}
|
package/lib/signaler/signaler.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
6
|
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
7
|
-
import {
|
|
7
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
8
|
+
import { assert } from "@fluidframework/core-utils";
|
|
8
9
|
/**
|
|
9
10
|
* Note: currently experimental and under development
|
|
10
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signaler.js","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"signaler.js","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAmDpD;;;;;;;;GAQG;AACH,MAAM,gBAAiB,SAAQ,iBAA8B;IAK5D;IACC;;OAEG;IACc,QAA0B;IAC3C;;;;OAIG;IACH,UAAmB;Q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C,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,YAAY,CAAC,UAAkB,EAAE,OAAkB;QACzD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;;AAvBsB,gBAAO,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { EventEmitter } from \"events\";\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { Jsonable } from \"@fluidframework/datastore-definitions\";\nimport { IInboundSignalMessage } from \"@fluidframework/runtime-definitions\";\nimport { IErrorEvent } from \"@fluidframework/core-interfaces\";\n\n// TODO:\n// add way to mark with current sequence number for ordering signals relative to ops\n// throttling and batching\n\nexport type SignalListener = (clientId: string, local: boolean, payload: Jsonable) => void;\n\n/**\n * ISignaler defines an interface for working with signals that is similar to the more common\n * eventing patterns of EventEmitter. In addition to sending and responding to signals, it\n * provides explicit methods around signal requests to other connected clients.\n */\nexport interface ISignaler {\n\t/**\n\t * Adds a listener for the specified signal. It behaves in the same way as EventEmitter's `on`\n\t * method regarding multiple registrations, callback order, etc.\n\t * @param signalName - The name of the signal\n\t * @param listener - The callback signal handler to add\n\t * @returns This ISignaler\n\t */\n\tonSignal(signalName: string, listener: SignalListener): ISignaler;\n\t/**\n\t * Remove a listener for the specified signal. It behaves in the same way as EventEmitter's\n\t * `off` method regarding multiple registrations, removal order, etc.\n\t * @param signalName - The name of the signal\n\t * @param listener - The callback signal handler to remove\n\t * @returns This ISignaler\n\t */\n\toffSignal(signalName: string, listener: SignalListener): ISignaler;\n\t/**\n\t * Send a signal with payload to its connected listeners.\n\t * @param signalName - The name of the signal\n\t * @param payload - The data to send with the signal\n\t */\n\tsubmitSignal(signalName: string, payload?: Jsonable);\n}\n\n/**\n * Duck type of something that provides the expected signalling functionality:\n * A way to verify we can signal, a way to send a signal, and a way to listen for incoming signals\n */\nexport interface IRuntimeSignaler {\n\tconnected: boolean;\n\ton(event: \"signal\", listener: (message: IInboundSignalMessage, local: boolean) => void);\n\tsubmitSignal(type: string, content: any): void;\n}\n\n/**\n * Note: currently experimental and under development\n *\n * Helper class to assist common scenarios around working with signals. InternalSignaler wraps a runtime\n * object with signaling functionality (e.g. ContainerRuntime or FluidDataStoreRuntime) and can\n * then be used in place of the original signaler. It uses a separate internal EventEmitter to\n * manage callbacks, and thus will reflect that behavior with regards to callback registration and\n * deregistration.\n */\nclass InternalSignaler extends TypedEventEmitter<IErrorEvent> implements ISignaler {\n\tprivate readonly emitter = new EventEmitter();\n\n\tprivate readonly signalerId: string | undefined;\n\n\tconstructor(\n\t\t/**\n\t\t * Object to wrap that can submit and listen to signals\n\t\t */\n\t\tprivate readonly signaler: IRuntimeSignaler,\n\t\t/**\n\t\t * Optional id to assign to this manager that will be attached to\n\t\t * signal names. Useful to avoid collisions if there are multiple\n\t\t * signal users at the Container level\n\t\t */\n\t\tsignalerId?: string,\n\t) {\n\t\tsuper();\n\t\tthis.emitter.on(\"error\", (error) => {\n\t\t\tthis.emit(\"error\", error);\n\t\t});\n\t\tthis.signalerId = signalerId ? `#${signalerId}` : undefined;\n\t\tthis.signaler.on(\"signal\", (message: IInboundSignalMessage, local: boolean) => {\n\t\t\tconst clientId = message.clientId;\n\t\t\t// Only call listeners when the runtime is connected and if the signal has an\n\t\t\t// identifiable sender clientId. The listener is responsible for deciding how\n\t\t\t// it wants to handle local/remote signals\n\t\t\tif (this.signaler.connected && clientId !== null) {\n\t\t\t\tthis.emitter.emit(message.type, clientId, local, message.content);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate getSignalerSignalName(signalName: string): string {\n\t\treturn this.signalerId ? `${signalName}${this.signalerId}` : signalName;\n\t}\n\n\t// ISignaler methods\n\n\tpublic onSignal(signalName: string, listener: SignalListener): ISignaler {\n\t\tconst signalerSignalName = this.getSignalerSignalName(signalName);\n\t\tthis.emitter.on(signalerSignalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic offSignal(signalName: string, listener: SignalListener): ISignaler {\n\t\tconst signalerSignalName = this.getSignalerSignalName(signalName);\n\t\tthis.emitter.off(signalerSignalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic submitSignal(signalName: string, payload?: Jsonable) {\n\t\tconst signalerSignalName = this.getSignalerSignalName(signalName);\n\t\tif (this.signaler.connected) {\n\t\t\tthis.signaler.submitSignal(signalerSignalName, payload);\n\t\t}\n\t}\n}\n\n/**\n * DataObject implementation of ISignaler for fluid-static plug-and-play. Allows fluid-static\n * users to get an ISignaler without a custom DO.\n */\nexport class Signaler\n\textends DataObject<{ Events: IErrorEvent }>\n\timplements EventEmitter, ISignaler\n{\n\tprivate _signaler: InternalSignaler | undefined;\n\tprivate get signaler(): InternalSignaler {\n\t\tassert(this._signaler !== undefined, 0x24b /* \"internal signaler should be defined\" */);\n\t\treturn this._signaler;\n\t}\n\n\tpublic static get Name() {\n\t\treturn \"@fluid-example/signaler\";\n\t}\n\n\tpublic static readonly factory = new DataObjectFactory(Signaler.Name, Signaler, [], {});\n\n\tprotected async hasInitialized() {\n\t\tthis._signaler = new InternalSignaler(this.runtime);\n\t\tthis.signaler.on(\"error\", (error) => {\n\t\t\tthis.emit(\"error\", error);\n\t\t});\n\t}\n\n\t// ISignaler methods Note these are all passthroughs\n\n\tpublic onSignal(signalName: string, listener: SignalListener): ISignaler {\n\t\tthis.signaler.onSignal(signalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic offSignal(signalName: string, listener: SignalListener): ISignaler {\n\t\tthis.signaler.offSignal(signalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic submitSignal(signalName: string, payload?: Jsonable) {\n\t\tthis.signaler.submitSignal(signalName, payload);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/data-objects",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.6.4.0.191457",
|
|
4
4
|
"description": "A collection of ready to use Fluid Data Objects",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
"module": "lib/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@fluidframework/
|
|
20
|
-
"@fluidframework/
|
|
21
|
-
"@fluidframework/
|
|
22
|
-
"@fluidframework/
|
|
23
|
-
"@fluidframework/
|
|
18
|
+
"@fluid-internal/client-utils": "2.0.0-dev.6.4.0.191457",
|
|
19
|
+
"@fluidframework/aqueduct": "2.0.0-dev.6.4.0.191457",
|
|
20
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.6.4.0.191457",
|
|
21
|
+
"@fluidframework/core-utils": "2.0.0-dev.6.4.0.191457",
|
|
22
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev.6.4.0.191457",
|
|
23
|
+
"@fluidframework/map": "2.0.0-dev.6.4.0.191457",
|
|
24
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev.6.4.0.191457",
|
|
24
25
|
"events": "^3.1.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@fluid-tools/build-cli": "^0.
|
|
28
|
-
"@fluidframework/build-common": "^
|
|
29
|
-
"@fluidframework/build-tools": "^0.
|
|
30
|
-
"@fluidframework/eslint-config-fluid": "^2.
|
|
28
|
+
"@fluid-tools/build-cli": "^0.22.0",
|
|
29
|
+
"@fluidframework/build-common": "^2.0.0",
|
|
30
|
+
"@fluidframework/build-tools": "^0.22.0",
|
|
31
|
+
"@fluidframework/eslint-config-fluid": "^2.1.0",
|
|
31
32
|
"@microsoft/api-extractor": "^7.34.4",
|
|
32
|
-
"@types/node": "^
|
|
33
|
-
"concurrently": "^7.6.0",
|
|
33
|
+
"@types/node": "^16.18.38",
|
|
34
34
|
"copyfiles": "^2.4.1",
|
|
35
35
|
"cross-env": "^7.0.3",
|
|
36
36
|
"eslint": "~8.6.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
48
48
|
"build:compile": "fluid-build . --task compile",
|
|
49
49
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
50
|
-
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
50
|
+
"clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log'",
|
|
51
51
|
"eslint": "eslint --format stylish src",
|
|
52
52
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
53
53
|
"format": "npm run prettier:fix",
|
package/src/signaler/signaler.ts
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
7
|
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
8
|
-
import {
|
|
9
|
-
import { assert
|
|
8
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
9
|
+
import { assert } from "@fluidframework/core-utils";
|
|
10
10
|
import { Jsonable } from "@fluidframework/datastore-definitions";
|
|
11
11
|
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
12
|
+
import { IErrorEvent } from "@fluidframework/core-interfaces";
|
|
12
13
|
|
|
13
14
|
// TODO:
|
|
14
15
|
// add way to mark with current sequence number for ordering signals relative to ops
|