@fluidframework/legacy-dds 2.50.0-345060
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/.eslintrc.cjs +11 -0
- package/.mocharc.cjs +12 -0
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/api-extractor/api-extractor-lint-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-public.esm.json +5 -0
- package/api-extractor/api-extractor.current.json +5 -0
- package/api-extractor/api-extractor.legacy.json +4 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +4 -0
- package/api-report/legacy-dds.beta.api.md +9 -0
- package/api-report/legacy-dds.legacy.alpha.api.md +140 -0
- package/api-report/legacy-dds.legacy.public.api.md +9 -0
- package/api-report/legacy-dds.public.api.md +9 -0
- package/biome.jsonc +4 -0
- package/dist/array/index.d.ts +10 -0
- package/dist/array/index.d.ts.map +1 -0
- package/dist/array/index.js +16 -0
- package/dist/array/index.js.map +1 -0
- package/dist/array/interfaces.d.ts +142 -0
- package/dist/array/interfaces.d.ts.map +1 -0
- package/dist/array/interfaces.js +7 -0
- package/dist/array/interfaces.js.map +1 -0
- package/dist/array/sharedArray.d.ts +175 -0
- package/dist/array/sharedArray.d.ts.map +1 -0
- package/dist/array/sharedArray.js +652 -0
- package/dist/array/sharedArray.js.map +1 -0
- package/dist/array/sharedArrayFactory.d.ts +31 -0
- package/dist/array/sharedArrayFactory.d.ts.map +1 -0
- package/dist/array/sharedArrayFactory.js +61 -0
- package/dist/array/sharedArrayFactory.js.map +1 -0
- package/dist/array/sharedArrayOperations.d.ts +77 -0
- package/dist/array/sharedArrayOperations.d.ts.map +1 -0
- package/dist/array/sharedArrayOperations.js +19 -0
- package/dist/array/sharedArrayOperations.js.map +1 -0
- package/dist/array/sharedArrayRevertible.d.ts +17 -0
- package/dist/array/sharedArrayRevertible.d.ts.map +1 -0
- package/dist/array/sharedArrayRevertible.js +47 -0
- package/dist/array/sharedArrayRevertible.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/legacy.d.ts +31 -0
- package/dist/package.json +4 -0
- package/dist/packageVersion.d.ts +9 -0
- package/dist/packageVersion.d.ts.map +1 -0
- package/dist/packageVersion.js +12 -0
- package/dist/packageVersion.js.map +1 -0
- package/dist/public.d.ts +12 -0
- package/dist/signal/index.d.ts +7 -0
- package/dist/signal/index.d.ts.map +1 -0
- package/dist/signal/index.js +11 -0
- package/dist/signal/index.js.map +1 -0
- package/dist/signal/interfaces.d.ts +36 -0
- package/dist/signal/interfaces.d.ts.map +1 -0
- package/dist/signal/interfaces.js +7 -0
- package/dist/signal/interfaces.js.map +1 -0
- package/dist/signal/sharedSignal.d.ts +68 -0
- package/dist/signal/sharedSignal.d.ts.map +1 -0
- package/dist/signal/sharedSignal.js +122 -0
- package/dist/signal/sharedSignal.js.map +1 -0
- package/dist/signal/sharedSignalFactory.d.ts +24 -0
- package/dist/signal/sharedSignalFactory.d.ts.map +1 -0
- package/dist/signal/sharedSignalFactory.js +45 -0
- package/dist/signal/sharedSignalFactory.js.map +1 -0
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/array/index.d.ts +10 -0
- package/lib/array/index.d.ts.map +1 -0
- package/lib/array/index.js +8 -0
- package/lib/array/index.js.map +1 -0
- package/lib/array/interfaces.d.ts +142 -0
- package/lib/array/interfaces.d.ts.map +1 -0
- package/lib/array/interfaces.js +6 -0
- package/lib/array/interfaces.js.map +1 -0
- package/lib/array/sharedArray.d.ts +175 -0
- package/lib/array/sharedArray.d.ts.map +1 -0
- package/lib/array/sharedArray.js +648 -0
- package/lib/array/sharedArray.js.map +1 -0
- package/lib/array/sharedArrayFactory.d.ts +31 -0
- package/lib/array/sharedArrayFactory.d.ts.map +1 -0
- package/lib/array/sharedArrayFactory.js +56 -0
- package/lib/array/sharedArrayFactory.js.map +1 -0
- package/lib/array/sharedArrayOperations.d.ts +77 -0
- package/lib/array/sharedArrayOperations.d.ts.map +1 -0
- package/lib/array/sharedArrayOperations.js +16 -0
- package/lib/array/sharedArrayOperations.js.map +1 -0
- package/lib/array/sharedArrayRevertible.d.ts +17 -0
- package/lib/array/sharedArrayRevertible.d.ts.map +1 -0
- package/lib/array/sharedArrayRevertible.js +43 -0
- package/lib/array/sharedArrayRevertible.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/legacy.d.ts +31 -0
- package/lib/packageVersion.d.ts +9 -0
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/packageVersion.js +9 -0
- package/lib/packageVersion.js.map +1 -0
- package/lib/public.d.ts +12 -0
- package/lib/signal/index.d.ts +7 -0
- package/lib/signal/index.d.ts.map +1 -0
- package/lib/signal/index.js +6 -0
- package/lib/signal/index.js.map +1 -0
- package/lib/signal/interfaces.d.ts +36 -0
- package/lib/signal/interfaces.d.ts.map +1 -0
- package/lib/signal/interfaces.js +6 -0
- package/lib/signal/interfaces.js.map +1 -0
- package/lib/signal/sharedSignal.d.ts +68 -0
- package/lib/signal/sharedSignal.d.ts.map +1 -0
- package/lib/signal/sharedSignal.js +118 -0
- package/lib/signal/sharedSignal.js.map +1 -0
- package/lib/signal/sharedSignalFactory.d.ts +24 -0
- package/lib/signal/sharedSignalFactory.d.ts.map +1 -0
- package/lib/signal/sharedSignalFactory.js +41 -0
- package/lib/signal/sharedSignalFactory.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +158 -0
- package/src/array/README.md +32 -0
- package/src/array/index.ts +28 -0
- package/src/array/interfaces.ts +169 -0
- package/src/array/sharedArray.ts +835 -0
- package/src/array/sharedArrayFactory.ts +88 -0
- package/src/array/sharedArrayOperations.ts +89 -0
- package/src/array/sharedArrayRevertible.ts +50 -0
- package/src/index.ts +32 -0
- package/src/packageVersion.ts +9 -0
- package/src/signal/README.md +25 -0
- package/src/signal/index.ts +12 -0
- package/src/signal/interfaces.ts +53 -0
- package/src/signal/sharedSignal.ts +169 -0
- package/src/signal/sharedSignalFactory.ts +62 -0
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +10 -0
- package/tsdoc.json +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/signal/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport type {\n\tISharedObject,\n\tISharedObjectEvents,\n} from \"@fluidframework/shared-object-base/internal\";\n\n/**\n * Basic types for the SharedSignal DDS\n * It can be used as a generic constraint (`extends SerializableTypeForSharedSignal`) but is\n * *never* meant to be a concrete/real type on its own.\n * @legacy\n * @alpha\n */\nexport type SerializableTypeForSharedSignal =\n\t| boolean\n\t| number\n\t| string\n\t| IFluidHandle\n\t| object;\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISharedSignalEvents<T extends SerializableTypeForSharedSignal>\n\textends ISharedObjectEvents {\n\t/* eslint-disable-next-line @typescript-eslint/no-explicit-any\n-- TODO: Using 'any' type defeats the purpose of TypeScript. Consider replacing it with a concrete type, or 'unknown'. */\n\t(event: \"notify\", listener: (value: T, isLocal: boolean) => void): any;\n}\n\n/**\n * @legacy\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ISharedSignal<T extends SerializableTypeForSharedSignal = any>\n\textends ISharedObject<ISharedSignalEvents<T>> {\n\tnotify(metadata?: T): void;\n}\n\n/**\n * @internal\n */\nexport interface ISignalOperation<out T = unknown> {\n\ttype: \"signal\";\n\treadonly metadata?: T;\n}\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService, IChannelFactory } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
+
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import type { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
+
import type { IFluidSerializer } from "@fluidframework/shared-object-base/internal";
|
|
9
|
+
import { SharedObject } from "@fluidframework/shared-object-base/internal";
|
|
10
|
+
import type { ISharedSignal, ISharedSignalEvents, SerializableTypeForSharedSignal } from "./interfaces.js";
|
|
11
|
+
/**
|
|
12
|
+
* Represents a shared signal that allows communication between distributed clients.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare class SharedSignalClass<T extends SerializableTypeForSharedSignal = any> extends SharedObject<ISharedSignalEvents<T>> implements ISharedSignal<T> {
|
|
17
|
+
/**
|
|
18
|
+
* Create a new shared signal
|
|
19
|
+
*
|
|
20
|
+
* @param runtime - data store runtime the new shared signal belongs to
|
|
21
|
+
* @param id - optional name of the shared signal
|
|
22
|
+
* @returns newly create shared signal (but not attached yet)
|
|
23
|
+
*/
|
|
24
|
+
static create(runtime: IFluidDataStoreRuntime, id?: string): SharedSignalClass;
|
|
25
|
+
/**
|
|
26
|
+
* Get a factory for SharedSignal to register with the data store.
|
|
27
|
+
*
|
|
28
|
+
* @returns a factory that creates and load SharedSignal
|
|
29
|
+
*/
|
|
30
|
+
static getFactory(): IChannelFactory;
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a new shared signal. If the object is non-local an id and service interfaces will
|
|
33
|
+
* be provided
|
|
34
|
+
* @param id - optional name of the shared signal
|
|
35
|
+
* @param runtime - data store runtime the shared signal belongs to
|
|
36
|
+
* @param attributes - represents the attributes of a channel/DDS.
|
|
37
|
+
*/
|
|
38
|
+
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
|
|
39
|
+
/**
|
|
40
|
+
* Method used for generating a signal.
|
|
41
|
+
*/
|
|
42
|
+
notify(metadata?: T): void;
|
|
43
|
+
protected summarizeCore(_serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
44
|
+
/**
|
|
45
|
+
* Load share signal from snapshot
|
|
46
|
+
*
|
|
47
|
+
* @param _storage - the storage to get the snapshot from
|
|
48
|
+
* @returns - promise that resolved when the load is completed
|
|
49
|
+
*/
|
|
50
|
+
protected loadCore(_storage: IChannelStorageService): Promise<void>;
|
|
51
|
+
protected initializeLocalCore(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Callback on disconnect
|
|
54
|
+
*/
|
|
55
|
+
protected onDisconnect(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Process a shared signal operation
|
|
58
|
+
*
|
|
59
|
+
* @param message - the message to prepare
|
|
60
|
+
* @param local - whether the message was sent by the local client
|
|
61
|
+
* @param _localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
62
|
+
* For messages from a remote client, this will be undefined.
|
|
63
|
+
*/
|
|
64
|
+
protected processCore(message: ISequencedDocumentMessage, local: boolean, _localOpMetadata: unknown): void;
|
|
65
|
+
private notifyCore;
|
|
66
|
+
protected applyStashedOp(_content: unknown): void;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=sharedSignal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedSignal.d.ts","sourceRoot":"","sources":["../../src/signal/sharedSignal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,MAAM,gDAAgD,CAAC;AAExD,OAAO,KAAK,EACX,yBAAyB,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 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SharedSignalClass = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/driver-definitions/internal");
|
|
9
|
+
const internal_2 = require("@fluidframework/runtime-utils/internal");
|
|
10
|
+
const internal_3 = require("@fluidframework/shared-object-base/internal");
|
|
11
|
+
const sharedSignalFactory_js_1 = require("./sharedSignalFactory.js");
|
|
12
|
+
const snapshotFileName = "header";
|
|
13
|
+
/**
|
|
14
|
+
* Represents a shared signal that allows communication between distributed clients.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
class SharedSignalClass extends internal_3.SharedObject {
|
|
19
|
+
/**
|
|
20
|
+
* Create a new shared signal
|
|
21
|
+
*
|
|
22
|
+
* @param runtime - data store runtime the new shared signal belongs to
|
|
23
|
+
* @param id - optional name of the shared signal
|
|
24
|
+
* @returns newly create shared signal (but not attached yet)
|
|
25
|
+
*/
|
|
26
|
+
static create(runtime, id) {
|
|
27
|
+
return runtime.createChannel(id, sharedSignalFactory_js_1.SharedSignalFactory.Type);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get a factory for SharedSignal to register with the data store.
|
|
31
|
+
*
|
|
32
|
+
* @returns a factory that creates and load SharedSignal
|
|
33
|
+
*/
|
|
34
|
+
static getFactory() {
|
|
35
|
+
return new sharedSignalFactory_js_1.SharedSignalFactory();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a new shared signal. If the object is non-local an id and service interfaces will
|
|
39
|
+
* be provided
|
|
40
|
+
* @param id - optional name of the shared signal
|
|
41
|
+
* @param runtime - data store runtime the shared signal belongs to
|
|
42
|
+
* @param attributes - represents the attributes of a channel/DDS.
|
|
43
|
+
*/
|
|
44
|
+
constructor(id, runtime, attributes) {
|
|
45
|
+
super(id, runtime, attributes, "loop_sharedSignal_" /* telemetryContextPrefix */);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Method used for generating a signal.
|
|
49
|
+
*/
|
|
50
|
+
notify(metadata) {
|
|
51
|
+
// If we are not attached, don't submit the op.
|
|
52
|
+
if (!this.isAttached()) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const op = {
|
|
56
|
+
type: "signal",
|
|
57
|
+
metadata,
|
|
58
|
+
};
|
|
59
|
+
this.notifyCore(op, true);
|
|
60
|
+
this.submitLocalMessage(op);
|
|
61
|
+
}
|
|
62
|
+
summarizeCore(_serializer) {
|
|
63
|
+
const tree = {
|
|
64
|
+
entries: [
|
|
65
|
+
{
|
|
66
|
+
mode: internal_1.FileMode.File,
|
|
67
|
+
path: snapshotFileName,
|
|
68
|
+
type: internal_1.TreeEntry[internal_1.TreeEntry.Blob],
|
|
69
|
+
value: {
|
|
70
|
+
contents: JSON.stringify(""),
|
|
71
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case
|
|
72
|
+
encoding: "utf-8",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
const summaryTreeWithStats = (0, internal_2.convertToSummaryTreeWithStats)(tree);
|
|
78
|
+
return summaryTreeWithStats;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Load share signal from snapshot
|
|
82
|
+
*
|
|
83
|
+
* @param _storage - the storage to get the snapshot from
|
|
84
|
+
* @returns - promise that resolved when the load is completed
|
|
85
|
+
*/
|
|
86
|
+
async loadCore(_storage) { }
|
|
87
|
+
initializeLocalCore() { }
|
|
88
|
+
/**
|
|
89
|
+
* Callback on disconnect
|
|
90
|
+
*/
|
|
91
|
+
onDisconnect() { }
|
|
92
|
+
/**
|
|
93
|
+
* Process a shared signal operation
|
|
94
|
+
*
|
|
95
|
+
* @param message - the message to prepare
|
|
96
|
+
* @param local - whether the message was sent by the local client
|
|
97
|
+
* @param _localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
98
|
+
* For messages from a remote client, this will be undefined.
|
|
99
|
+
*/
|
|
100
|
+
processCore(message, local, _localOpMetadata) {
|
|
101
|
+
if (message.type === internal_1.MessageType.Operation && !local) {
|
|
102
|
+
const op = message.contents;
|
|
103
|
+
switch (op.type) {
|
|
104
|
+
case "signal": {
|
|
105
|
+
this.notifyCore(op, local);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
default: {
|
|
109
|
+
throw new Error("Unknown operation");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
notifyCore(op, isLocal) {
|
|
115
|
+
this.emit("notify", op.metadata, isLocal);
|
|
116
|
+
}
|
|
117
|
+
applyStashedOp(_content) {
|
|
118
|
+
throw new Error("Not implemented");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.SharedSignalClass = SharedSignalClass;
|
|
122
|
+
//# sourceMappingURL=sharedSignal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedSignal.js","sourceRoot":"","sources":["../../src/signal/sharedSignal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,0EAA+F;AAM/F,qEAAuF;AAEvF,0EAA2E;AAQ3E,qEAA+D;AAE/D,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAa,iBACZ,SAAQ,uBAAoC;IAG5C;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAChE,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,4CAAmB,CAAC,IAAI,CAAsB,CAAC;IACjF,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU;QACvB,OAAO,IAAI,4CAAmB,EAAE,CAAC;IAClC,CAAC;IAED;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,EAAE,GAAG,OAAO,CAAC,QAA+B,CAAC;YAEnD,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;gBACjB,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACf,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;oBAC3B,MAAM;gBACP,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACT,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBACtC,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAEO,UAAU,CAAC,EAAuB,EAAE,OAAgB;QAC3D,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAES,cAAc,CAAC,QAAiB;QACzC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD;AAlID,8CAkIC","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 */\n\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\tprotected applyStashedOp(_content: unknown): void {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IChannelAttributes, IFluidDataStoreRuntime, IChannelFactory, IChannelServices } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
+
import type { ISharedSignal } from "./interfaces.js";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare class SharedSignalFactory implements IChannelFactory<ISharedSignal> {
|
|
11
|
+
static readonly Type: string;
|
|
12
|
+
static readonly Attributes: IChannelAttributes;
|
|
13
|
+
get type(): string;
|
|
14
|
+
get attributes(): IChannelAttributes;
|
|
15
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<ISharedSignal>;
|
|
16
|
+
create(document: IFluidDataStoreRuntime, id: string): ISharedSignal;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Entrypoint for {@link ISharedSignal} creation.
|
|
20
|
+
* @legacy
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export declare const SharedSignal: import("@fluidframework/shared-object-base/internal").ISharedObjectKind<ISharedSignal<any>> & import("@fluidframework/shared-object-base/internal").SharedObjectKind<ISharedSignal<any>>;
|
|
24
|
+
//# sourceMappingURL=sharedSignalFactory.d.ts.map
|
|
@@ -0,0 +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;;;;GAIG;AACH,eAAO,MAAM,YAAY,0LAA6D,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SharedSignal = exports.SharedSignalFactory = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/shared-object-base/internal");
|
|
9
|
+
const packageVersion_js_1 = require("../packageVersion.js");
|
|
10
|
+
const sharedSignal_js_1 = require("./sharedSignal.js");
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
class SharedSignalFactory {
|
|
15
|
+
get type() {
|
|
16
|
+
return SharedSignalFactory.Type;
|
|
17
|
+
}
|
|
18
|
+
get attributes() {
|
|
19
|
+
return SharedSignalFactory.Attributes;
|
|
20
|
+
}
|
|
21
|
+
async load(runtime, id, services, attributes) {
|
|
22
|
+
const signal = new sharedSignal_js_1.SharedSignalClass(id, runtime, attributes);
|
|
23
|
+
await signal.load(services);
|
|
24
|
+
return signal;
|
|
25
|
+
}
|
|
26
|
+
create(document, id) {
|
|
27
|
+
const signal = new sharedSignal_js_1.SharedSignalClass(id, document, this.attributes);
|
|
28
|
+
signal.initializeLocal();
|
|
29
|
+
return signal;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.SharedSignalFactory = SharedSignalFactory;
|
|
33
|
+
SharedSignalFactory.Type = "https://graph.microsoft.com/types/signal";
|
|
34
|
+
SharedSignalFactory.Attributes = {
|
|
35
|
+
type: SharedSignalFactory.Type,
|
|
36
|
+
snapshotFormatVersion: "0.1",
|
|
37
|
+
packageVersion: packageVersion_js_1.pkgVersion,
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Entrypoint for {@link ISharedSignal} creation.
|
|
41
|
+
* @legacy
|
|
42
|
+
* @alpha
|
|
43
|
+
*/
|
|
44
|
+
exports.SharedSignal = (0, internal_1.createSharedObjectKind)(SharedSignalFactory);
|
|
45
|
+
//# sourceMappingURL=sharedSignalFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedSignalFactory.js","sourceRoot":"","sources":["../../src/signal/sharedSignalFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,0EAAqF;AAErF,4DAAkD;AAGlD,uDAAsD;AAEtD;;GAEG;AACH,MAAa,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,mCAAiB,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,mCAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,CAAC,eAAe,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC;;AAhCF,kDAiCC;AAhCuB,wBAAI,GAAW,0CAA0C,CAAC;AAE1D,8BAAU,GAAuB;IACvD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,8BAAU;CAC1B,CAAC;AA4BH;;;;GAIG;AACU,QAAA,YAAY,GAAG,IAAA,iCAAsB,EAAgB,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\n * @alpha\n */\nexport const SharedSignal = createSharedObjectKind<ISharedSignal>(SharedSignalFactory);\n"]}
|
package/internal.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export * from "./lib/index.js";
|
package/legacy.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export * from "./lib/legacy.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { SharedArrayFactory, SharedArray, SharedArrayBuilder, } from "./sharedArrayFactory.js";
|
|
6
|
+
export { SharedArrayRevertible } from "./sharedArrayRevertible.js";
|
|
7
|
+
export type { SerializableTypeForSharedArray, ISharedArray, ISharedArrayEvents, ISharedArrayRevertible, IRevertible, } from "./interfaces.js";
|
|
8
|
+
export type { ISharedArrayOperation, IInsertOperation, IDeleteOperation, IMoveOperation, ISharedArrayRevertibleOperation, IToggleMoveOperation, IToggleOperation, } from "./sharedArrayOperations.js";
|
|
9
|
+
export { OperationType } from "./sharedArrayOperations.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/array/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,WAAW,EACX,kBAAkB,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EACX,8BAA8B,EAC9B,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACX,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,+BAA+B,EAC/B,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { SharedArrayFactory, SharedArray, SharedArrayBuilder, } from "./sharedArrayFactory.js";
|
|
6
|
+
export { SharedArrayRevertible } from "./sharedArrayRevertible.js";
|
|
7
|
+
export { OperationType } from "./sharedArrayOperations.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/array/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,WAAW,EACX,kBAAkB,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAiBnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tSharedArrayFactory,\n\tSharedArray,\n\tSharedArrayBuilder,\n} from \"./sharedArrayFactory.js\";\nexport { SharedArrayRevertible } from \"./sharedArrayRevertible.js\";\nexport type {\n\tSerializableTypeForSharedArray,\n\tISharedArray,\n\tISharedArrayEvents,\n\tISharedArrayRevertible,\n\tIRevertible,\n} from \"./interfaces.js\";\nexport type {\n\tISharedArrayOperation,\n\tIInsertOperation,\n\tIDeleteOperation,\n\tIMoveOperation,\n\tISharedArrayRevertibleOperation,\n\tIToggleMoveOperation,\n\tIToggleOperation,\n} from \"./sharedArrayOperations.js\";\nexport { OperationType } from \"./sharedArrayOperations.js\";\n"]}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IEventThisPlaceHolder, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { Serializable } from "@fluidframework/datastore-definitions/internal";
|
|
7
|
+
import type { ISharedObjectEvents, ISharedObject } from "@fluidframework/shared-object-base/internal";
|
|
8
|
+
import type { ISharedArrayOperation } from "./sharedArrayOperations.js";
|
|
9
|
+
/**
|
|
10
|
+
* Basic types for the SharedArray DDS
|
|
11
|
+
* It can be used as a generic constraint (`extends SerializableTypeForSharedArray`) but is
|
|
12
|
+
* *never* meant to be a concrete/real type on its own.
|
|
13
|
+
*
|
|
14
|
+
* @legacy
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export type SerializableTypeForSharedArray = boolean | number | string | object | IFluidHandle;
|
|
18
|
+
/**
|
|
19
|
+
* Interface defining the events that can be emitted by the SharedArray DDS
|
|
20
|
+
* and the events that can be listened to by the SharedArray DDS
|
|
21
|
+
*
|
|
22
|
+
* @legacy
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export interface ISharedArrayEvents extends ISharedObjectEvents {
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param event - The event name.
|
|
29
|
+
* @param listener - An event listener.
|
|
30
|
+
*
|
|
31
|
+
* @eventProperty
|
|
32
|
+
*/
|
|
33
|
+
(event: "valueChanged", listener: (op: ISharedArrayOperation, isLocal: boolean, target: IEventThisPlaceHolder) => void): void;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param event - The event name.
|
|
37
|
+
* @param listener - An event listener.
|
|
38
|
+
*
|
|
39
|
+
* @eventProperty
|
|
40
|
+
*/
|
|
41
|
+
(event: "revertible", listener: (revertible: IRevertible) => void): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Interface defining the SharedArray DDS
|
|
45
|
+
* It is a generic interface that can be used to create a SharedArray of any type
|
|
46
|
+
* The type of the SharedArray is defined by the type parameter T
|
|
47
|
+
*
|
|
48
|
+
* @typeParam T - The type of the SharedArray
|
|
49
|
+
*
|
|
50
|
+
* @legacy
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export interface ISharedArray<T extends SerializableTypeForSharedArray> extends ISharedObject<ISharedArrayEvents> {
|
|
54
|
+
get(): readonly T[];
|
|
55
|
+
insert<TWrite>(index: number, value: Serializable<TWrite> & T): void;
|
|
56
|
+
delete(index: number): void;
|
|
57
|
+
move(oldIndex: number, newIndex: number): void;
|
|
58
|
+
toggle(entryId: string): void;
|
|
59
|
+
toggleMove(oldEntryId: string, newEntryId: string): void;
|
|
60
|
+
insertBulkAfter<TWrite>(ref: T | undefined, values: (Serializable<TWrite> & T)[]): void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export interface ISharedArrayRevertible extends ISharedObject<ISharedArrayEvents> {
|
|
67
|
+
toggle(entryId: string): void;
|
|
68
|
+
toggleMove(oldEntryId: string, newEntryId: string): void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Interface defining the in memory shared array entry of the DDS
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export interface SharedArrayEntry<T extends SerializableTypeForSharedArray> extends SharedArrayEntryCore<T> {
|
|
76
|
+
/**
|
|
77
|
+
* Flag that tracks whether an ack from the server has been received for a local insert.
|
|
78
|
+
* True for local changes.
|
|
79
|
+
*/
|
|
80
|
+
isAckPending: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Counter is shared by delete and undo/redo (of delete and insert) as undo/redo simply
|
|
83
|
+
* operates on the isDeleted flag of the DDS. This flag will help us skip local op acks as
|
|
84
|
+
* they have already inflicted state change. The flag helps us ignore remote ops if there is a
|
|
85
|
+
* local pending delete as we would be getting the pending op after server stamping
|
|
86
|
+
*/
|
|
87
|
+
isLocalPendingDelete: number;
|
|
88
|
+
/**
|
|
89
|
+
* Counter is for move and its undo/redo. This flag will be used to skip local op acks as
|
|
90
|
+
* they have already inflicted state change. The flag helps us ignore remote ops if there is a
|
|
91
|
+
* local pending delete as we would be getting the pending op after server stamping. Only exception
|
|
92
|
+
* being if there is a remote delete, we will have to respect that
|
|
93
|
+
*/
|
|
94
|
+
isLocalPendingMove: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Interface defining the core entry attributes
|
|
98
|
+
*
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
export interface SharedArrayEntryCore<T extends SerializableTypeForSharedArray> {
|
|
102
|
+
/**
|
|
103
|
+
* a unique ID for this particular entry
|
|
104
|
+
*/
|
|
105
|
+
entryId: string;
|
|
106
|
+
/**
|
|
107
|
+
* the value stored in this entry, may not be unique
|
|
108
|
+
*/
|
|
109
|
+
value: T;
|
|
110
|
+
/**
|
|
111
|
+
* Flag to track whether this entry is deleted or not.
|
|
112
|
+
*/
|
|
113
|
+
isDeleted: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Primarily used for move op and tracks the old entry id from which this entry was changed from.
|
|
116
|
+
*/
|
|
117
|
+
prevEntryId?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Primarily used for move op and tracks the new entry id to which this entry was changed to.
|
|
120
|
+
*/
|
|
121
|
+
nextEntryId?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Format of the snapshot for the DDS
|
|
125
|
+
*
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
export interface SnapshotFormat<T> {
|
|
129
|
+
/**
|
|
130
|
+
* Array of the data entries that represent the DDS in-memory representation
|
|
131
|
+
*/
|
|
132
|
+
dataArray: T[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @legacy
|
|
136
|
+
* @alpha
|
|
137
|
+
*/
|
|
138
|
+
export interface IRevertible {
|
|
139
|
+
revert(): void;
|
|
140
|
+
dispose(): void;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/array/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,KAAK,EACX,mBAAmB,EACnB,aAAa,EACb,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE;;;;;;;GAOG;AACH,MAAM,MAAM,8BAA8B,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM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AAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACzD;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,8BAA8B,CACzE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IAC/B;;;OAGG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,8BAA8B;IAC7E;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,SAAS,EAAE,CAAC,EAAE,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/array/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IEventThisPlaceHolder, IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport type { Serializable } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tISharedObjectEvents,\n\tISharedObject,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedArrayOperation } from \"./sharedArrayOperations.js\";\n/**\n * Basic types for the SharedArray DDS\n * It can be used as a generic constraint (`extends SerializableTypeForSharedArray`) but is\n * *never* meant to be a concrete/real type on its own.\n *\n * @legacy\n * @alpha\n */\nexport type SerializableTypeForSharedArray = boolean | number | string | object | IFluidHandle;\n\n/**\n * Interface defining the events that can be emitted by the SharedArray DDS\n * and the events that can be listened to by the SharedArray DDS\n *\n * @legacy\n * @alpha\n */\nexport interface ISharedArrayEvents extends ISharedObjectEvents {\n\t/**\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (\n\t\t\top: ISharedArrayOperation,\n\t\t\tisLocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t): void;\n\n\t/**\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"revertible\", listener: (revertible: IRevertible) => void): void;\n}\n\n/**\n * Interface defining the SharedArray DDS\n * It is a generic interface that can be used to create a SharedArray of any type\n * The type of the SharedArray is defined by the type parameter T\n *\n * @typeParam T - The type of the SharedArray\n *\n * @legacy\n * @alpha\n */\nexport interface ISharedArray<T extends SerializableTypeForSharedArray>\n\textends ISharedObject<ISharedArrayEvents> {\n\tget(): readonly T[];\n\tinsert<TWrite>(index: number, value: Serializable<TWrite> & T): void;\n\tdelete(index: number): void;\n\tmove(oldIndex: number, newIndex: number): void;\n\ttoggle(entryId: string): void;\n\ttoggleMove(oldEntryId: string, newEntryId: string): void;\n\tinsertBulkAfter<TWrite>(ref: T | undefined, values: (Serializable<TWrite> & T)[]): void;\n}\n\n/**\n *\n * @internal\n */\nexport interface ISharedArrayRevertible extends ISharedObject<ISharedArrayEvents> {\n\ttoggle(entryId: string): void;\n\ttoggleMove(oldEntryId: string, newEntryId: string): void;\n}\n\n/**\n * Interface defining the in memory shared array entry of the DDS\n *\n * @internal\n */\nexport interface SharedArrayEntry<T extends SerializableTypeForSharedArray>\n\textends SharedArrayEntryCore<T> {\n\t/**\n\t * Flag that tracks whether an ack from the server has been received for a local insert.\n\t * True for local changes.\n\t */\n\tisAckPending: boolean;\n\n\t/**\n\t * Counter is shared by delete and undo/redo (of delete and insert) as undo/redo simply\n\t * operates on the isDeleted flag of the DDS. This flag will help us skip local op acks as\n\t * they have already inflicted state change. The flag helps us ignore remote ops if there is a\n\t * local pending delete as we would be getting the pending op after server stamping\n\t */\n\tisLocalPendingDelete: number;\n\n\t/**\n\t * Counter is for move and its undo/redo. This flag will be used to skip local op acks as\n\t * they have already inflicted state change. The flag helps us ignore remote ops if there is a\n\t * local pending delete as we would be getting the pending op after server stamping. Only exception\n\t * being if there is a remote delete, we will have to respect that\n\t */\n\tisLocalPendingMove: number;\n}\n\n/**\n * Interface defining the core entry attributes\n *\n * @internal\n */\nexport interface SharedArrayEntryCore<T extends SerializableTypeForSharedArray> {\n\t/**\n\t * a unique ID for this particular entry\n\t */\n\tentryId: string;\n\n\t/**\n\t * the value stored in this entry, may not be unique\n\t */\n\tvalue: T;\n\n\t/**\n\t * Flag to track whether this entry is deleted or not.\n\t */\n\tisDeleted: boolean;\n\n\t/**\n\t * Primarily used for move op and tracks the old entry id from which this entry was changed from.\n\t */\n\tprevEntryId?: string;\n\n\t/**\n\t * Primarily used for move op and tracks the new entry id to which this entry was changed to.\n\t */\n\tnextEntryId?: string;\n}\n\n/**\n * Format of the snapshot for the DDS\n *\n * @internal\n */\nexport interface SnapshotFormat<T> {\n\t/**\n\t * Array of the data entries that represent the DDS in-memory representation\n\t */\n\tdataArray: T[];\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IRevertible {\n\trevert(): void;\n\tdispose(): void;\n}\n"]}
|