@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,169 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IEventThisPlaceHolder, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
|
+
import type { Serializable } from "@fluidframework/datastore-definitions/internal";
|
|
8
|
+
import type {
|
|
9
|
+
ISharedObjectEvents,
|
|
10
|
+
ISharedObject,
|
|
11
|
+
} from "@fluidframework/shared-object-base/internal";
|
|
12
|
+
|
|
13
|
+
import type { ISharedArrayOperation } from "./sharedArrayOperations.js";
|
|
14
|
+
/**
|
|
15
|
+
* Basic types for the SharedArray DDS
|
|
16
|
+
* It can be used as a generic constraint (`extends SerializableTypeForSharedArray`) but is
|
|
17
|
+
* *never* meant to be a concrete/real type on its own.
|
|
18
|
+
*
|
|
19
|
+
* @legacy
|
|
20
|
+
* @alpha
|
|
21
|
+
*/
|
|
22
|
+
export type SerializableTypeForSharedArray = boolean | number | string | object | IFluidHandle;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Interface defining the events that can be emitted by the SharedArray DDS
|
|
26
|
+
* and the events that can be listened to by the SharedArray DDS
|
|
27
|
+
*
|
|
28
|
+
* @legacy
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export interface ISharedArrayEvents extends ISharedObjectEvents {
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param event - The event name.
|
|
35
|
+
* @param listener - An event listener.
|
|
36
|
+
*
|
|
37
|
+
* @eventProperty
|
|
38
|
+
*/
|
|
39
|
+
(
|
|
40
|
+
event: "valueChanged",
|
|
41
|
+
listener: (
|
|
42
|
+
op: ISharedArrayOperation,
|
|
43
|
+
isLocal: boolean,
|
|
44
|
+
target: IEventThisPlaceHolder,
|
|
45
|
+
) => void,
|
|
46
|
+
): void;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param event - The event name.
|
|
51
|
+
* @param listener - An event listener.
|
|
52
|
+
*
|
|
53
|
+
* @eventProperty
|
|
54
|
+
*/
|
|
55
|
+
(event: "revertible", listener: (revertible: IRevertible) => void): void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Interface defining the SharedArray DDS
|
|
60
|
+
* It is a generic interface that can be used to create a SharedArray of any type
|
|
61
|
+
* The type of the SharedArray is defined by the type parameter T
|
|
62
|
+
*
|
|
63
|
+
* @typeParam T - The type of the SharedArray
|
|
64
|
+
*
|
|
65
|
+
* @legacy
|
|
66
|
+
* @alpha
|
|
67
|
+
*/
|
|
68
|
+
export interface ISharedArray<T extends SerializableTypeForSharedArray>
|
|
69
|
+
extends ISharedObject<ISharedArrayEvents> {
|
|
70
|
+
get(): readonly T[];
|
|
71
|
+
insert<TWrite>(index: number, value: Serializable<TWrite> & T): void;
|
|
72
|
+
delete(index: number): void;
|
|
73
|
+
move(oldIndex: number, newIndex: number): void;
|
|
74
|
+
toggle(entryId: string): void;
|
|
75
|
+
toggleMove(oldEntryId: string, newEntryId: string): void;
|
|
76
|
+
insertBulkAfter<TWrite>(ref: T | undefined, values: (Serializable<TWrite> & T)[]): void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
export interface ISharedArrayRevertible extends ISharedObject<ISharedArrayEvents> {
|
|
84
|
+
toggle(entryId: string): void;
|
|
85
|
+
toggleMove(oldEntryId: string, newEntryId: string): void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Interface defining the in memory shared array entry of the DDS
|
|
90
|
+
*
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
export interface SharedArrayEntry<T extends SerializableTypeForSharedArray>
|
|
94
|
+
extends SharedArrayEntryCore<T> {
|
|
95
|
+
/**
|
|
96
|
+
* Flag that tracks whether an ack from the server has been received for a local insert.
|
|
97
|
+
* True for local changes.
|
|
98
|
+
*/
|
|
99
|
+
isAckPending: boolean;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Counter is shared by delete and undo/redo (of delete and insert) as undo/redo simply
|
|
103
|
+
* operates on the isDeleted flag of the DDS. This flag will help us skip local op acks as
|
|
104
|
+
* they have already inflicted state change. The flag helps us ignore remote ops if there is a
|
|
105
|
+
* local pending delete as we would be getting the pending op after server stamping
|
|
106
|
+
*/
|
|
107
|
+
isLocalPendingDelete: number;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Counter is for move and its undo/redo. This flag will be used to skip local op acks as
|
|
111
|
+
* they have already inflicted state change. The flag helps us ignore remote ops if there is a
|
|
112
|
+
* local pending delete as we would be getting the pending op after server stamping. Only exception
|
|
113
|
+
* being if there is a remote delete, we will have to respect that
|
|
114
|
+
*/
|
|
115
|
+
isLocalPendingMove: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Interface defining the core entry attributes
|
|
120
|
+
*
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
export interface SharedArrayEntryCore<T extends SerializableTypeForSharedArray> {
|
|
124
|
+
/**
|
|
125
|
+
* a unique ID for this particular entry
|
|
126
|
+
*/
|
|
127
|
+
entryId: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* the value stored in this entry, may not be unique
|
|
131
|
+
*/
|
|
132
|
+
value: T;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Flag to track whether this entry is deleted or not.
|
|
136
|
+
*/
|
|
137
|
+
isDeleted: boolean;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Primarily used for move op and tracks the old entry id from which this entry was changed from.
|
|
141
|
+
*/
|
|
142
|
+
prevEntryId?: string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Primarily used for move op and tracks the new entry id to which this entry was changed to.
|
|
146
|
+
*/
|
|
147
|
+
nextEntryId?: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Format of the snapshot for the DDS
|
|
152
|
+
*
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
export interface SnapshotFormat<T> {
|
|
156
|
+
/**
|
|
157
|
+
* Array of the data entries that represent the DDS in-memory representation
|
|
158
|
+
*/
|
|
159
|
+
dataArray: T[];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @legacy
|
|
164
|
+
* @alpha
|
|
165
|
+
*/
|
|
166
|
+
export interface IRevertible {
|
|
167
|
+
revert(): void;
|
|
168
|
+
dispose(): void;
|
|
169
|
+
}
|