@fluid-experimental/data-objects 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.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/CHANGELOG.md +23 -0
- package/api-report/data-objects.api.md +3 -3
- package/dist/signaler/signaler.d.ts +3 -3
- package/dist/signaler/signaler.d.ts.map +1 -1
- package/dist/signaler/signaler.js +5 -5
- package/dist/signaler/signaler.js.map +1 -1
- package/lib/signaler/signaler.d.ts +3 -3
- package/lib/signaler/signaler.d.ts.map +1 -1
- package/lib/signaler/signaler.js +2 -2
- package/lib/signaler/signaler.js.map +1 -1
- package/package.json +22 -56
- package/src/signaler/signaler.ts +4 -4
- package/api-extractor-cjs.json +0 -8
- package/dist/data-objects-alpha.d.ts +0 -16
- package/dist/data-objects-beta.d.ts +0 -22
- package/dist/data-objects-public.d.ts +0 -22
- package/dist/data-objects-untrimmed.d.ts +0 -75
- package/lib/data-objects-alpha.d.ts +0 -16
- package/lib/data-objects-beta.d.ts +0 -22
- package/lib/data-objects-public.d.ts +0 -22
- package/lib/data-objects-untrimmed.d.ts +0 -75
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @fluid-experimental/data-objects
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
8
|
+
|
|
9
|
+
Fluid Framework packages have been updated to use the [package.json "exports"
|
|
10
|
+
field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
|
|
11
|
+
TypeScript types and implementation code.
|
|
12
|
+
|
|
13
|
+
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
14
|
+
|
|
15
|
+
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
16
|
+
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
17
|
+
|
|
18
|
+
We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
|
|
19
|
+
for use with modern versions of Node.js _and_ Bundlers.
|
|
20
|
+
[See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
|
|
21
|
+
regarding the module and moduleResolution options.
|
|
22
|
+
|
|
23
|
+
**Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
|
|
24
|
+
to distinguish stable APIs from those that are in development.**
|
|
25
|
+
|
|
3
26
|
## 2.0.0-rc.2.0.0
|
|
4
27
|
|
|
5
28
|
Dependency updates only.
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
8
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
7
|
+
import { DataObject } from '@fluidframework/aqueduct/internal';
|
|
8
|
+
import { DataObjectFactory } from '@fluidframework/aqueduct/internal';
|
|
9
9
|
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
10
10
|
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
11
11
|
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
12
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
12
|
+
import { Jsonable } from '@fluidframework/datastore-definitions/internal';
|
|
13
13
|
|
|
14
14
|
// @internal
|
|
15
15
|
export interface IRuntimeSignaler {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
6
5
|
import { EventEmitter } from "@fluid-internal/client-utils";
|
|
7
|
-
import {
|
|
8
|
-
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
6
|
+
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct/internal";
|
|
9
7
|
import { IErrorEvent } from "@fluidframework/core-interfaces";
|
|
8
|
+
import { Jsonable } from "@fluidframework/datastore-definitions/internal";
|
|
9
|
+
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signaler.d.ts","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"signaler.d.ts","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAqB,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAM5E;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEjG;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACxE;;;;;;OAMG;IACH,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ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 = require("@fluid-internal/client-utils");
|
|
10
|
-
const
|
|
9
|
+
const internal_1 = require("@fluidframework/aqueduct/internal");
|
|
10
|
+
const internal_2 = require("@fluidframework/core-utils/internal");
|
|
11
11
|
/**
|
|
12
12
|
* Note: currently experimental and under development
|
|
13
13
|
*
|
|
@@ -72,9 +72,9 @@ class InternalSignaler extends client_utils_1.TypedEventEmitter {
|
|
|
72
72
|
* users to get an ISignaler without a custom DO.
|
|
73
73
|
* @internal
|
|
74
74
|
*/
|
|
75
|
-
class Signaler extends
|
|
75
|
+
class Signaler extends internal_1.DataObject {
|
|
76
76
|
get signaler() {
|
|
77
|
-
(0,
|
|
77
|
+
(0, internal_2.assert)(this._signaler !== undefined, 0x24b /* "internal signaler should be defined" */);
|
|
78
78
|
return this._signaler;
|
|
79
79
|
}
|
|
80
80
|
async hasInitialized() {
|
|
@@ -98,5 +98,5 @@ class Signaler extends aqueduct_1.DataObject {
|
|
|
98
98
|
}
|
|
99
99
|
exports.Signaler = Signaler;
|
|
100
100
|
Signaler.Name = "@fluid-example/signaler";
|
|
101
|
-
Signaler.factory = new
|
|
101
|
+
Signaler.factory = new internal_1.DataObjectFactory(Signaler.Name, Signaler, [], {});
|
|
102
102
|
//# sourceMappingURL=signaler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signaler.js","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH
|
|
1
|
+
{"version":3,"file":"signaler.js","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA+E;AAC/E,gEAAkF;AAElF,kEAA6D;AAuD7D;;;;;;;;GAQG;AACH,MAAM,gBAAiB,SAAQ,gCAA8B;IAK5D;IACC;;OAEG;IACc,QAA0B;IAC3C;;;;OAIG;IACH,UAAmB;QAEnB,KAAK,EAAE,CAAC;QARS,aAAQ,GAAR,QAAQ,CAAkB;QAR3B,YAAO,G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,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;;AAnCF,4BAoCC;AA1BuB,aAAI,GAAG,yBAAyB,CAAC;AAEjC,gBAAO,GAAG,IAAI,4BAAiB,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, TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct/internal\";\nimport { IErrorEvent } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { Jsonable } from \"@fluidframework/datastore-definitions/internal\";\nimport { IInboundSignalMessage } from \"@fluidframework/runtime-definitions\";\n\n// TODO:\n// add way to mark with current sequence number for ordering signals relative to ops\n// throttling and batching\n\n/**\n * @internal\n */\nexport type SignalListener<T> = (clientId: string, local: boolean, payload: Jsonable<T>) => 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 * @internal\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<T>(signalName: string, listener: SignalListener<T>): 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<T>(signalName: string, listener: SignalListener<T>): 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<T>(signalName: string, payload?: Jsonable<T>);\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 * @internal\n */\nexport interface IRuntimeSignaler {\n\tconnected: boolean;\n\ton(event: \"signal\", listener: (message: IInboundSignalMessage, local: boolean) => void);\n\tsubmitSignal(type: string, content: Jsonable<unknown>): 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<T>(signalName: string, listener: SignalListener<T>): 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<T>(signalName: string, listener: SignalListener<T>): 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<T>(signalName: string, payload?: Jsonable<T>) {\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 * @internal\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 readonly Name = \"@fluid-example/signaler\";\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<T>(signalName: string, listener: SignalListener<T>): ISignaler {\n\t\tthis.signaler.onSignal(signalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic offSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler {\n\t\tthis.signaler.offSignal(signalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic submitSignal<T>(signalName: string, payload?: Jsonable<T>) {\n\t\tthis.signaler.submitSignal(signalName, payload);\n\t}\n}\n"]}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
6
5
|
import { EventEmitter } from "@fluid-internal/client-utils";
|
|
7
|
-
import {
|
|
8
|
-
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
6
|
+
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct/internal";
|
|
9
7
|
import { IErrorEvent } from "@fluidframework/core-interfaces";
|
|
8
|
+
import { Jsonable } from "@fluidframework/datastore-definitions/internal";
|
|
9
|
+
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signaler.d.ts","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"signaler.d.ts","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAqB,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAM5E;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,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KxE,YAAY,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;CAGhE"}
|
package/lib/signaler/signaler.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
6
5
|
import { EventEmitter, TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
7
|
-
import {
|
|
6
|
+
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct/internal";
|
|
7
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
8
|
/**
|
|
9
9
|
* Note: currently experimental and under development
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signaler.js","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"signaler.js","sourceRoot":"","sources":["../../src/signaler/signaler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAuD7D;;;;;;;;GAQG;AACH,MAAM,gBAAiB,SAAQ,iBAA8B;IAK5D;IACC;;OAEG;IACc,QAA0B;IAC3C;;;;OAIG;IACH,UAAmB;QAEnB,KAAK,EAAE,CAAC;QARS,aAAQ,GAAR,QAAQ,CAAkB;QAR3B,YAAO,GAAG,IAAI,YAAY,EAAE,CAAC;QAiB7C,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;Y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jC,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, TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct/internal\";\nimport { IErrorEvent } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { Jsonable } from \"@fluidframework/datastore-definitions/internal\";\nimport { IInboundSignalMessage } from \"@fluidframework/runtime-definitions\";\n\n// TODO:\n// add way to mark with current sequence number for ordering signals relative to ops\n// throttling and batching\n\n/**\n * @internal\n */\nexport type SignalListener<T> = (clientId: string, local: boolean, payload: Jsonable<T>) => 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 * @internal\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<T>(signalName: string, listener: SignalListener<T>): 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<T>(signalName: string, listener: SignalListener<T>): 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<T>(signalName: string, payload?: Jsonable<T>);\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 * @internal\n */\nexport interface IRuntimeSignaler {\n\tconnected: boolean;\n\ton(event: \"signal\", listener: (message: IInboundSignalMessage, local: boolean) => void);\n\tsubmitSignal(type: string, content: Jsonable<unknown>): 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<T>(signalName: string, listener: SignalListener<T>): 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<T>(signalName: string, listener: SignalListener<T>): 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<T>(signalName: string, payload?: Jsonable<T>) {\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 * @internal\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 readonly Name = \"@fluid-example/signaler\";\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<T>(signalName: string, listener: SignalListener<T>): ISignaler {\n\t\tthis.signaler.onSignal(signalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic offSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler {\n\t\tthis.signaler.offSignal(signalName, listener);\n\t\treturn this;\n\t}\n\n\tpublic submitSignal<T>(signalName: string, payload?: Jsonable<T>) {\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-rc.
|
|
3
|
+
"version": "2.0.0-rc.3.0.0",
|
|
4
4
|
"description": "A collection of ready to use Fluid Data Objects",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -22,45 +22,26 @@
|
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
23
|
"default": "./dist/index.js"
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
"./public": {
|
|
27
|
-
"import": {
|
|
28
|
-
"types": "./lib/data-objects-public.d.ts",
|
|
29
|
-
"default": "./lib/index.js"
|
|
30
|
-
},
|
|
31
|
-
"require": {
|
|
32
|
-
"types": "./dist/data-objects-public.d.ts",
|
|
33
|
-
"default": "./dist/index.js"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"./internal": {
|
|
37
|
-
"import": {
|
|
38
|
-
"types": "./lib/index.d.ts",
|
|
39
|
-
"default": "./lib/index.js"
|
|
40
|
-
},
|
|
41
|
-
"require": {
|
|
42
|
-
"types": "./dist/index.d.ts",
|
|
43
|
-
"default": "./dist/index.js"
|
|
44
|
-
}
|
|
45
25
|
}
|
|
46
26
|
},
|
|
47
|
-
"main": "
|
|
48
|
-
"types": "
|
|
27
|
+
"main": "lib/index.js",
|
|
28
|
+
"types": "lib/index.d.ts",
|
|
49
29
|
"dependencies": {
|
|
50
|
-
"@fluid-internal/client-utils": ">=2.0.0-rc.
|
|
51
|
-
"@fluidframework/aqueduct": ">=2.0.0-rc.
|
|
52
|
-
"@fluidframework/core-interfaces": ">=2.0.0-rc.
|
|
53
|
-
"@fluidframework/core-utils": ">=2.0.0-rc.
|
|
54
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-rc.
|
|
55
|
-
"@fluidframework/map": ">=2.0.0-rc.
|
|
56
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-rc.
|
|
30
|
+
"@fluid-internal/client-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
|
|
31
|
+
"@fluidframework/aqueduct": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
|
|
32
|
+
"@fluidframework/core-interfaces": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
|
|
33
|
+
"@fluidframework/core-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
|
|
34
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
|
|
35
|
+
"@fluidframework/map": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
|
|
36
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0"
|
|
57
37
|
},
|
|
58
38
|
"devDependencies": {
|
|
59
|
-
"@arethetypeswrong/cli": "^0.
|
|
60
|
-
"@
|
|
39
|
+
"@arethetypeswrong/cli": "^0.15.2",
|
|
40
|
+
"@biomejs/biome": "^1.6.2",
|
|
41
|
+
"@fluid-tools/build-cli": "^0.37.0",
|
|
61
42
|
"@fluidframework/build-common": "^2.0.3",
|
|
62
|
-
"@fluidframework/build-tools": "^0.
|
|
63
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
43
|
+
"@fluidframework/build-tools": "^0.37.0",
|
|
44
|
+
"@fluidframework/eslint-config-fluid": "^5.1.0",
|
|
64
45
|
"@microsoft/api-extractor": "^7.42.3",
|
|
65
46
|
"@types/node": "^18.19.0",
|
|
66
47
|
"copyfiles": "^2.4.1",
|
|
@@ -70,40 +51,25 @@
|
|
|
70
51
|
"rimraf": "^4.4.0",
|
|
71
52
|
"typescript": "~5.1.6"
|
|
72
53
|
},
|
|
73
|
-
"fluidBuild": {
|
|
74
|
-
"tasks": {
|
|
75
|
-
"build:docs": {
|
|
76
|
-
"dependsOn": [
|
|
77
|
-
"...",
|
|
78
|
-
"api-extractor:commonjs",
|
|
79
|
-
"api-extractor:esnext"
|
|
80
|
-
],
|
|
81
|
-
"script": false
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
54
|
"typeValidation": {
|
|
86
55
|
"disabled": true,
|
|
87
56
|
"broken": {}
|
|
88
57
|
},
|
|
89
58
|
"scripts": {
|
|
90
|
-
"api": "fluid-build . --task api",
|
|
91
|
-
"api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
|
|
92
|
-
"api-extractor:esnext": "api-extractor run --local",
|
|
93
59
|
"build": "fluid-build . --task build",
|
|
94
60
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
95
61
|
"build:compile": "fluid-build . --task compile",
|
|
96
|
-
"build:docs": "
|
|
62
|
+
"build:docs": "api-extractor run --local",
|
|
97
63
|
"build:esnext": "tsc --project ./tsconfig.json",
|
|
98
|
-
"check:are-the-types-wrong": "attw --pack .
|
|
64
|
+
"check:are-the-types-wrong": "attw --pack .",
|
|
65
|
+
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
99
66
|
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
|
|
100
67
|
"eslint": "eslint --format stylish src",
|
|
101
68
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
102
|
-
"format": "
|
|
103
|
-
"
|
|
104
|
-
"lint
|
|
105
|
-
"
|
|
106
|
-
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
69
|
+
"format": "fluid-build --task format .",
|
|
70
|
+
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
71
|
+
"lint": "fluid-build . --task lint",
|
|
72
|
+
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
107
73
|
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist"
|
|
108
74
|
}
|
|
109
75
|
}
|
package/src/signaler/signaler.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
7
6
|
import { EventEmitter, TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
8
|
-
import {
|
|
9
|
-
import { Jsonable } from "@fluidframework/datastore-definitions";
|
|
10
|
-
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
7
|
+
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct/internal";
|
|
11
8
|
import { IErrorEvent } from "@fluidframework/core-interfaces";
|
|
9
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
10
|
+
import { Jsonable } from "@fluidframework/datastore-definitions/internal";
|
|
11
|
+
import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
12
12
|
|
|
13
13
|
// TODO:
|
|
14
14
|
// add way to mark with current sequence number for ordering signals relative to ops
|
package/api-extractor-cjs.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
|
|
4
|
-
// CJS is actually secondary; so, no report.
|
|
5
|
-
"apiReport": {
|
|
6
|
-
"enabled": false
|
|
7
|
-
}
|
|
8
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
2
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
3
|
-
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
4
|
-
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: IRuntimeSignaler */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: ISignaler */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: Signaler */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: SignalListener */
|
|
15
|
-
|
|
16
|
-
export { }
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
2
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
3
|
-
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
4
|
-
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: DataObject */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: DataObjectFactory */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: IRuntimeSignaler */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: ISignaler */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: Jsonable */
|
|
17
|
-
|
|
18
|
-
/* Excluded from this release type: Signaler */
|
|
19
|
-
|
|
20
|
-
/* Excluded from this release type: SignalListener */
|
|
21
|
-
|
|
22
|
-
export { }
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
2
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
3
|
-
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
4
|
-
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: DataObject */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: DataObjectFactory */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: IRuntimeSignaler */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: ISignaler */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: Jsonable */
|
|
17
|
-
|
|
18
|
-
/* Excluded from this release type: Signaler */
|
|
19
|
-
|
|
20
|
-
/* Excluded from this release type: SignalListener */
|
|
21
|
-
|
|
22
|
-
export { }
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
2
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
3
|
-
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
4
|
-
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Duck type of something that provides the expected signalling functionality:
|
|
10
|
-
* A way to verify we can signal, a way to send a signal, and a way to listen for incoming signals
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export declare interface IRuntimeSignaler {
|
|
14
|
-
connected: boolean;
|
|
15
|
-
on(event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void): any;
|
|
16
|
-
submitSignal(type: string, content: Jsonable<unknown>): void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* ISignaler defines an interface for working with signals that is similar to the more common
|
|
21
|
-
* eventing patterns of EventEmitter. In addition to sending and responding to signals, it
|
|
22
|
-
* provides explicit methods around signal requests to other connected clients.
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
export declare interface ISignaler {
|
|
26
|
-
/**
|
|
27
|
-
* Adds a listener for the specified signal. It behaves in the same way as EventEmitter's `on`
|
|
28
|
-
* method regarding multiple registrations, callback order, etc.
|
|
29
|
-
* @param signalName - The name of the signal
|
|
30
|
-
* @param listener - The callback signal handler to add
|
|
31
|
-
* @returns This ISignaler
|
|
32
|
-
*/
|
|
33
|
-
onSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler;
|
|
34
|
-
/**
|
|
35
|
-
* Remove a listener for the specified signal. It behaves in the same way as EventEmitter's
|
|
36
|
-
* `off` method regarding multiple registrations, removal order, etc.
|
|
37
|
-
* @param signalName - The name of the signal
|
|
38
|
-
* @param listener - The callback signal handler to remove
|
|
39
|
-
* @returns This ISignaler
|
|
40
|
-
*/
|
|
41
|
-
offSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler;
|
|
42
|
-
/**
|
|
43
|
-
* Send a signal with payload to its connected listeners.
|
|
44
|
-
* @param signalName - The name of the signal
|
|
45
|
-
* @param payload - The data to send with the signal
|
|
46
|
-
*/
|
|
47
|
-
submitSignal<T>(signalName: string, payload?: Jsonable<T>): any;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* DataObject implementation of ISignaler for fluid-static plug-and-play. Allows fluid-static
|
|
52
|
-
* users to get an ISignaler without a custom DO.
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
export declare class Signaler extends DataObject<{
|
|
56
|
-
Events: IErrorEvent;
|
|
57
|
-
}> implements EventEmitter, ISignaler {
|
|
58
|
-
private _signaler;
|
|
59
|
-
private get signaler();
|
|
60
|
-
static readonly Name = "@fluid-example/signaler";
|
|
61
|
-
static readonly factory: DataObjectFactory<Signaler, {
|
|
62
|
-
Events: IErrorEvent;
|
|
63
|
-
}>;
|
|
64
|
-
protected hasInitialized(): Promise<void>;
|
|
65
|
-
onSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler;
|
|
66
|
-
offSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler;
|
|
67
|
-
submitSignal<T>(signalName: string, payload?: Jsonable<T>): void;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
export declare type SignalListener<T> = (clientId: string, local: boolean, payload: Jsonable<T>) => void;
|
|
74
|
-
|
|
75
|
-
export { }
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
2
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
3
|
-
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
4
|
-
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: IRuntimeSignaler */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: ISignaler */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: Signaler */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: SignalListener */
|
|
15
|
-
|
|
16
|
-
export { }
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
2
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
3
|
-
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
4
|
-
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: DataObject */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: DataObjectFactory */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: IRuntimeSignaler */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: ISignaler */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: Jsonable */
|
|
17
|
-
|
|
18
|
-
/* Excluded from this release type: Signaler */
|
|
19
|
-
|
|
20
|
-
/* Excluded from this release type: SignalListener */
|
|
21
|
-
|
|
22
|
-
export { }
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
2
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
3
|
-
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
4
|
-
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: DataObject */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: DataObjectFactory */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: IRuntimeSignaler */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: ISignaler */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: Jsonable */
|
|
17
|
-
|
|
18
|
-
/* Excluded from this release type: Signaler */
|
|
19
|
-
|
|
20
|
-
/* Excluded from this release type: SignalListener */
|
|
21
|
-
|
|
22
|
-
export { }
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { DataObject } from '@fluidframework/aqueduct';
|
|
2
|
-
import { DataObjectFactory } from '@fluidframework/aqueduct';
|
|
3
|
-
import { EventEmitter } from '@fluid-internal/client-utils';
|
|
4
|
-
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Duck type of something that provides the expected signalling functionality:
|
|
10
|
-
* A way to verify we can signal, a way to send a signal, and a way to listen for incoming signals
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export declare interface IRuntimeSignaler {
|
|
14
|
-
connected: boolean;
|
|
15
|
-
on(event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void): any;
|
|
16
|
-
submitSignal(type: string, content: Jsonable<unknown>): void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* ISignaler defines an interface for working with signals that is similar to the more common
|
|
21
|
-
* eventing patterns of EventEmitter. In addition to sending and responding to signals, it
|
|
22
|
-
* provides explicit methods around signal requests to other connected clients.
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
export declare interface ISignaler {
|
|
26
|
-
/**
|
|
27
|
-
* Adds a listener for the specified signal. It behaves in the same way as EventEmitter's `on`
|
|
28
|
-
* method regarding multiple registrations, callback order, etc.
|
|
29
|
-
* @param signalName - The name of the signal
|
|
30
|
-
* @param listener - The callback signal handler to add
|
|
31
|
-
* @returns This ISignaler
|
|
32
|
-
*/
|
|
33
|
-
onSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler;
|
|
34
|
-
/**
|
|
35
|
-
* Remove a listener for the specified signal. It behaves in the same way as EventEmitter's
|
|
36
|
-
* `off` method regarding multiple registrations, removal order, etc.
|
|
37
|
-
* @param signalName - The name of the signal
|
|
38
|
-
* @param listener - The callback signal handler to remove
|
|
39
|
-
* @returns This ISignaler
|
|
40
|
-
*/
|
|
41
|
-
offSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler;
|
|
42
|
-
/**
|
|
43
|
-
* Send a signal with payload to its connected listeners.
|
|
44
|
-
* @param signalName - The name of the signal
|
|
45
|
-
* @param payload - The data to send with the signal
|
|
46
|
-
*/
|
|
47
|
-
submitSignal<T>(signalName: string, payload?: Jsonable<T>): any;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* DataObject implementation of ISignaler for fluid-static plug-and-play. Allows fluid-static
|
|
52
|
-
* users to get an ISignaler without a custom DO.
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
export declare class Signaler extends DataObject<{
|
|
56
|
-
Events: IErrorEvent;
|
|
57
|
-
}> implements EventEmitter, ISignaler {
|
|
58
|
-
private _signaler;
|
|
59
|
-
private get signaler();
|
|
60
|
-
static readonly Name = "@fluid-example/signaler";
|
|
61
|
-
static readonly factory: DataObjectFactory<Signaler, {
|
|
62
|
-
Events: IErrorEvent;
|
|
63
|
-
}>;
|
|
64
|
-
protected hasInitialized(): Promise<void>;
|
|
65
|
-
onSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler;
|
|
66
|
-
offSignal<T>(signalName: string, listener: SignalListener<T>): ISignaler;
|
|
67
|
-
submitSignal<T>(signalName: string, payload?: Jsonable<T>): void;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
export declare type SignalListener<T> = (clientId: string, local: boolean, payload: Jsonable<T>) => void;
|
|
74
|
-
|
|
75
|
-
export { }
|
|
File without changes
|