@fluidframework/datastore-definitions 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229
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.js +5 -7
- package/README.md +7 -7
- package/api-extractor.json +2 -2
- package/dist/channel.d.ts +45 -14
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +9 -0
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jsonable.d.ts.map +1 -1
- package/dist/jsonable.js.map +1 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js.map +1 -1
- package/package.json +30 -35
- package/prettier.config.cjs +1 -1
- package/src/channel.ts +212 -179
- package/src/dataStoreRuntime.ts +118 -108
- package/src/index.ts +5 -5
- package/src/jsonable.ts +14 -11
- package/src/storage.ts +13 -13
- package/tsconfig.json +8 -12
package/src/dataStoreRuntime.ts
CHANGED
|
@@ -3,128 +3,138 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IDisposable, IEvent, IEventProvider, ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
6
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
IDisposable,
|
|
8
|
+
IEvent,
|
|
9
|
+
IEventProvider,
|
|
10
|
+
ITelemetryLogger,
|
|
11
|
+
} from "@fluidframework/common-definitions";
|
|
12
|
+
import {
|
|
13
|
+
IFluidHandleContext,
|
|
14
|
+
IFluidRouter,
|
|
15
|
+
IFluidHandle,
|
|
16
|
+
FluidObject,
|
|
12
17
|
} from "@fluidframework/core-interfaces";
|
|
13
18
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
IAudience,
|
|
20
|
+
IDeltaManager,
|
|
21
|
+
AttachState,
|
|
22
|
+
ILoaderOptions,
|
|
18
23
|
} from "@fluidframework/container-definitions";
|
|
19
24
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
IDocumentMessage,
|
|
26
|
+
IQuorumClients,
|
|
27
|
+
ISequencedDocumentMessage,
|
|
23
28
|
} from "@fluidframework/protocol-definitions";
|
|
24
29
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
IInboundSignalMessage,
|
|
31
|
+
IProvideFluidDataStoreRegistry,
|
|
27
32
|
} from "@fluidframework/runtime-definitions";
|
|
28
33
|
import { IChannel } from ".";
|
|
29
34
|
|
|
30
35
|
export interface IFluidDataStoreRuntimeEvents extends IEvent {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
36
|
-
(event: "op", listener: (message: ISequencedDocumentMessage) => void);
|
|
37
|
-
(event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void);
|
|
38
|
-
(event: "connected", listener: (clientId: string) => void);
|
|
36
|
+
(event: "disconnected" | "dispose" | "attaching" | "attached", listener: () => void);
|
|
37
|
+
(event: "op", listener: (message: ISequencedDocumentMessage) => void);
|
|
38
|
+
(event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void);
|
|
39
|
+
(event: "connected", listener: (clientId: string) => void);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Represents the runtime for the data store. Contains helper functions/state of the data store.
|
|
43
44
|
*/
|
|
44
|
-
export interface IFluidDataStoreRuntime
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
45
|
+
export interface IFluidDataStoreRuntime
|
|
46
|
+
extends IFluidRouter,
|
|
47
|
+
IEventProvider<IFluidDataStoreRuntimeEvents>,
|
|
48
|
+
IDisposable,
|
|
49
|
+
Partial<IProvideFluidDataStoreRegistry> {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
|
|
52
|
+
readonly IFluidHandleContext: IFluidHandleContext;
|
|
53
|
+
|
|
54
|
+
readonly rootRoutingContext: IFluidHandleContext;
|
|
55
|
+
readonly channelsRoutingContext: IFluidHandleContext;
|
|
56
|
+
readonly objectsRoutingContext: IFluidHandleContext;
|
|
57
|
+
|
|
58
|
+
readonly options: ILoaderOptions;
|
|
59
|
+
|
|
60
|
+
readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
61
|
+
|
|
62
|
+
readonly clientId: string | undefined;
|
|
63
|
+
|
|
64
|
+
readonly connected: boolean;
|
|
65
|
+
|
|
66
|
+
readonly logger: ITelemetryLogger;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Indicates the attachment state of the data store to a host service.
|
|
70
|
+
*/
|
|
71
|
+
readonly attachState: AttachState;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns the channel with the given id
|
|
75
|
+
*/
|
|
76
|
+
getChannel(id: string): Promise<IChannel>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Invokes the given callback and expects that no ops are submitted
|
|
80
|
+
* until execution finishes. If an op is submitted, an error will be raised.
|
|
81
|
+
*
|
|
82
|
+
* Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
|
|
83
|
+
*
|
|
84
|
+
* @param callback - the callback to be invoked
|
|
85
|
+
*/
|
|
86
|
+
ensureNoDataModelChanges<T>(callback: () => T): T;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Creates a new channel of the given type.
|
|
90
|
+
* @param id - ID of the channel to be created. A unique ID will be generated if left undefined.
|
|
91
|
+
* @param type - Type of the channel.
|
|
92
|
+
*/
|
|
93
|
+
createChannel(id: string | undefined, type: string): IChannel;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Bind the channel with the data store runtime. If the runtime
|
|
97
|
+
* is attached then we attach the channel to make it live.
|
|
98
|
+
*/
|
|
99
|
+
bindChannel(channel: IChannel): void;
|
|
100
|
+
|
|
101
|
+
// Blob related calls
|
|
102
|
+
/**
|
|
103
|
+
* Api to upload a blob of data.
|
|
104
|
+
* @param blob - blob to be uploaded.
|
|
105
|
+
*/
|
|
106
|
+
uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Submits the signal to be sent to other clients.
|
|
110
|
+
* @param type - Type of the signal.
|
|
111
|
+
* @param content - Content of the signal.
|
|
112
|
+
*/
|
|
113
|
+
submitSignal(type: string, content: any): void;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Returns the current quorum.
|
|
117
|
+
*/
|
|
118
|
+
getQuorum(): IQuorumClients;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Returns the current audience.
|
|
122
|
+
*/
|
|
123
|
+
getAudience(): IAudience;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Resolves when a local data store is attached.
|
|
127
|
+
*/
|
|
128
|
+
waitAttached(): Promise<void>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting
|
|
132
|
+
* with it. If this property is undefined (meaning that exposing the entryPoint hasn't been implemented in a
|
|
133
|
+
* particular scenario) fall back to the current approach of requesting the root object through the request pattern.
|
|
134
|
+
*
|
|
135
|
+
* @remarks The plan is that eventually the data store will stop providing IFluidRouter functionality, this property
|
|
136
|
+
* will become non-optional and return an IFluidHandle (no undefined) and will become the only way to access
|
|
137
|
+
* the data store's entryPoint.
|
|
138
|
+
*/
|
|
139
|
+
readonly entryPoint?: IFluidHandle<FluidObject>;
|
|
130
140
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* This library defines the interfaces required to implement and/or communicate
|
|
8
|
-
* with a data store.
|
|
9
|
-
*
|
|
10
|
-
* @packageDocumentation
|
|
11
|
-
*/
|
|
7
|
+
* This library defines the interfaces required to implement and/or communicate
|
|
8
|
+
* with a data store.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
12
|
|
|
13
13
|
export {
|
|
14
14
|
IChannel,
|
package/src/jsonable.ts
CHANGED
|
@@ -41,14 +41,17 @@
|
|
|
41
41
|
* function foo<T>(value: Jsonable<T>) { ... }
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export type Jsonable<T = any, TReplaced = void> =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
export type Jsonable<T = any, TReplaced = void> = T extends
|
|
45
|
+
| undefined
|
|
46
|
+
| null
|
|
47
|
+
| boolean
|
|
48
|
+
| number
|
|
49
|
+
| string
|
|
50
|
+
| TReplaced
|
|
51
|
+
? T
|
|
52
|
+
: // eslint-disable-next-line @typescript-eslint/ban-types
|
|
53
|
+
Extract<T, Function> extends never
|
|
54
|
+
? {
|
|
55
|
+
[K in keyof T]: Extract<K, symbol> extends never ? Jsonable<T[K], TReplaced> : never;
|
|
56
|
+
}
|
|
57
|
+
: never;
|
package/src/storage.ts
CHANGED
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
* Represents the attributes of a channel/DDS.
|
|
8
8
|
*/
|
|
9
9
|
export interface IChannelAttributes {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Type name of the DDS for factory look up with ISharedObjectRegistry
|
|
12
|
+
*/
|
|
13
|
+
readonly type: string;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Format version of the snapshot
|
|
17
|
+
* Currently, only use to display a debug message if the version is incompatible
|
|
18
|
+
*/
|
|
19
|
+
readonly snapshotFormatVersion: string;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The package version of the code of the DDS, for debug only
|
|
23
|
+
*/
|
|
24
|
+
readonly packageVersion?: string;
|
|
25
25
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*"
|
|
13
|
-
]
|
|
2
|
+
"extends": "@fluidframework/build-common/ts-common-config.json",
|
|
3
|
+
"exclude": ["src/test/**/*"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"composite": true,
|
|
8
|
+
},
|
|
9
|
+
"include": ["src/**/*"],
|
|
14
10
|
}
|