@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.
@@ -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
- IFluidHandleContext,
9
- IFluidRouter,
10
- IFluidHandle,
11
- FluidObject,
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
- IAudience,
15
- IDeltaManager,
16
- AttachState,
17
- ILoaderOptions,
19
+ IAudience,
20
+ IDeltaManager,
21
+ AttachState,
22
+ ILoaderOptions,
18
23
  } from "@fluidframework/container-definitions";
19
24
  import {
20
- IDocumentMessage,
21
- IQuorumClients,
22
- ISequencedDocumentMessage,
25
+ IDocumentMessage,
26
+ IQuorumClients,
27
+ ISequencedDocumentMessage,
23
28
  } from "@fluidframework/protocol-definitions";
24
29
  import {
25
- IInboundSignalMessage,
26
- IProvideFluidDataStoreRegistry,
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
- // eslint-disable-next-line @typescript-eslint/unified-signatures
33
- event: "disconnected" | "dispose" | "attaching" | "attached",
34
- listener: () => void,
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 extends
45
- IFluidRouter,
46
- IEventProvider<IFluidDataStoreRuntimeEvents>,
47
- IDisposable,
48
- Partial<IProvideFluidDataStoreRegistry> {
49
-
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
- * Creates a new channel of the given type.
80
- * @param id - ID of the channel to be created. A unique ID will be generated if left undefined.
81
- * @param type - Type of the channel.
82
- */
83
- createChannel(id: string | undefined, type: string): IChannel;
84
-
85
- /**
86
- * Bind the channel with the data store runtime. If the runtime
87
- * is attached then we attach the channel to make it live.
88
- */
89
- bindChannel(channel: IChannel): void;
90
-
91
- // Blob related calls
92
- /**
93
- * Api to upload a blob of data.
94
- * @param blob - blob to be uploaded.
95
- */
96
- uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
97
-
98
- /**
99
- * Submits the signal to be sent to other clients.
100
- * @param type - Type of the signal.
101
- * @param content - Content of the signal.
102
- */
103
- submitSignal(type: string, content: any): void;
104
-
105
- /**
106
- * Returns the current quorum.
107
- */
108
- getQuorum(): IQuorumClients;
109
-
110
- /**
111
- * Returns the current audience.
112
- */
113
- getAudience(): IAudience;
114
-
115
- /**
116
- * Resolves when a local data store is attached.
117
- */
118
- waitAttached(): Promise<void>;
119
-
120
- /**
121
- * Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting
122
- * with it. If this property is undefined (meaning that exposing the entryPoint hasn't been implemented in a
123
- * particular scenario) fall back to the current approach of requesting the root object through the request pattern.
124
- *
125
- * @remarks The plan is that eventually the data store will stop providing IFluidRouter functionality, this property
126
- * will become non-optional and return an IFluidHandle (no undefined) and will become the only way to access
127
- * the data store's entryPoint.
128
- */
129
- readonly entryPoint?: IFluidHandle<FluidObject>;
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
- T extends undefined | null | boolean | number | string | TReplaced
46
- ? T
47
- // eslint-disable-next-line @typescript-eslint/ban-types
48
- : Extract<T, Function> extends never
49
- ? {
50
- [K in keyof T]: Extract<K, symbol> extends never
51
- ? Jsonable<T[K], TReplaced>
52
- : never
53
- }
54
- : never;
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
- * Type name of the DDS for factory look up with ISharedObjectRegistry
12
- */
13
- readonly type: string;
10
+ /**
11
+ * Type name of the DDS for factory look up with ISharedObjectRegistry
12
+ */
13
+ readonly type: string;
14
14
 
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;
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
- * The package version of the code of the DDS, for debug only
23
- */
24
- readonly packageVersion?: string;
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
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "exclude": [
4
- "src/test/**/*"
5
- ],
6
- "compilerOptions": {
7
- "rootDir": "./src",
8
- "outDir": "./dist",
9
- "composite": true,
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
  }