@fluidframework/container-definitions 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.3.1.0.125672

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.
Files changed (72) hide show
  1. package/.eslintrc.js +20 -9
  2. package/README.md +5 -5
  3. package/api-extractor.json +2 -2
  4. package/dist/audience.d.ts +3 -4
  5. package/dist/audience.d.ts.map +1 -1
  6. package/dist/audience.js.map +1 -1
  7. package/dist/browserPackage.d.ts.map +1 -1
  8. package/dist/browserPackage.js +3 -3
  9. package/dist/browserPackage.js.map +1 -1
  10. package/dist/deltas.d.ts +12 -0
  11. package/dist/deltas.d.ts.map +1 -1
  12. package/dist/deltas.js.map +1 -1
  13. package/dist/error.d.ts.map +1 -1
  14. package/dist/error.js.map +1 -1
  15. package/dist/fluidModule.d.ts.map +1 -1
  16. package/dist/fluidModule.js.map +1 -1
  17. package/dist/fluidPackage.d.ts.map +1 -1
  18. package/dist/fluidPackage.js +5 -6
  19. package/dist/fluidPackage.js.map +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/loader.d.ts +20 -2
  24. package/dist/loader.d.ts.map +1 -1
  25. package/dist/loader.js.map +1 -1
  26. package/dist/runtime.d.ts +2 -1
  27. package/dist/runtime.d.ts.map +1 -1
  28. package/dist/runtime.js.map +1 -1
  29. package/dist/tokenProvider.d.ts.map +1 -1
  30. package/dist/tokenProvider.js.map +1 -1
  31. package/lib/audience.d.ts +3 -4
  32. package/lib/audience.d.ts.map +1 -1
  33. package/lib/audience.js.map +1 -1
  34. package/lib/browserPackage.d.ts.map +1 -1
  35. package/lib/browserPackage.js +3 -3
  36. package/lib/browserPackage.js.map +1 -1
  37. package/lib/deltas.d.ts +12 -0
  38. package/lib/deltas.d.ts.map +1 -1
  39. package/lib/deltas.js.map +1 -1
  40. package/lib/error.d.ts.map +1 -1
  41. package/lib/error.js.map +1 -1
  42. package/lib/fluidModule.d.ts.map +1 -1
  43. package/lib/fluidModule.js.map +1 -1
  44. package/lib/fluidPackage.d.ts.map +1 -1
  45. package/lib/fluidPackage.js +5 -6
  46. package/lib/fluidPackage.js.map +1 -1
  47. package/lib/index.d.ts +1 -1
  48. package/lib/index.d.ts.map +1 -1
  49. package/lib/index.js +1 -1
  50. package/lib/index.js.map +1 -1
  51. package/lib/loader.d.ts +20 -2
  52. package/lib/loader.d.ts.map +1 -1
  53. package/lib/loader.js.map +1 -1
  54. package/lib/runtime.d.ts +2 -1
  55. package/lib/runtime.d.ts.map +1 -1
  56. package/lib/runtime.js.map +1 -1
  57. package/lib/tokenProvider.d.ts.map +1 -1
  58. package/lib/tokenProvider.js.map +1 -1
  59. package/package.json +17 -14
  60. package/prettier.config.cjs +1 -1
  61. package/src/audience.ts +25 -22
  62. package/src/browserPackage.ts +33 -34
  63. package/src/deltas.ts +267 -245
  64. package/src/error.ts +58 -58
  65. package/src/fluidModule.ts +1 -1
  66. package/src/fluidPackage.ts +86 -86
  67. package/src/index.ts +51 -47
  68. package/src/loader.ts +498 -489
  69. package/src/runtime.ts +144 -148
  70. package/src/tokenProvider.ts +2 -2
  71. package/tsconfig.esnext.json +6 -6
  72. package/tsconfig.json +8 -15
package/src/runtime.ts CHANGED
@@ -4,23 +4,19 @@
4
4
  */
5
5
 
6
6
  import { ITelemetryBaseLogger, IDisposable } from "@fluidframework/common-definitions";
7
- import {
8
- FluidObject,
9
- IRequest,
10
- IResponse,
11
- } from "@fluidframework/core-interfaces";
7
+ import { FluidObject, IRequest, IResponse } from "@fluidframework/core-interfaces";
12
8
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
13
9
  import {
14
- IClientConfiguration,
15
- IClientDetails,
16
- ISequencedDocumentMessage,
17
- ISnapshotTree,
18
- MessageType,
19
- ISummaryTree,
20
- IVersion,
21
- IDocumentMessage,
22
- IQuorumClients,
23
- ISummaryContent,
10
+ IClientConfiguration,
11
+ IClientDetails,
12
+ ISequencedDocumentMessage,
13
+ ISnapshotTree,
14
+ MessageType,
15
+ ISummaryTree,
16
+ IVersion,
17
+ IDocumentMessage,
18
+ IQuorumClients,
19
+ ISummaryContent,
24
20
  } from "@fluidframework/protocol-definitions";
25
21
  import { IAudience } from "./audience";
26
22
  import { IDeltaManager } from "./deltas";
@@ -33,22 +29,22 @@ import { IFluidCodeDetails } from "./fluidPackage";
33
29
  * service. The transition from detached to attached state is a one-way transition.
34
30
  */
35
31
  export enum AttachState {
36
- /**
37
- * In detached state, the data is only present on the local client's machine. It has not yet been uploaded
38
- * to the service.
39
- */
40
- Detached = "Detached",
41
-
42
- /**
43
- * In attaching state, the data has started the upload to the service, but has not yet completed.
44
- */
45
- Attaching = "Attaching",
46
-
47
- /**
48
- * In attached state, the data has completed upload to the service. It can be accessed by other clients after
49
- * reaching attached state.
50
- */
51
- Attached = "Attached",
32
+ /**
33
+ * In detached state, the data is only present on the local client's machine. It has not yet been uploaded
34
+ * to the service.
35
+ */
36
+ Detached = "Detached",
37
+
38
+ /**
39
+ * In attaching state, the data has started the upload to the service, but has not yet completed.
40
+ */
41
+ Attaching = "Attaching",
42
+
43
+ /**
44
+ * In attached state, the data has completed upload to the service. It can be accessed by other clients after
45
+ * reaching attached state.
46
+ */
47
+ Attached = "Attached",
52
48
  }
53
49
 
54
50
  /**
@@ -56,61 +52,60 @@ export enum AttachState {
56
52
  * Primarily held by the ContainerContext to be able to interact with the running instance of the Container.
57
53
  */
58
54
  export interface IRuntime extends IDisposable {
59
-
60
- /**
61
- * Executes a request against the runtime
62
- */
63
- request(request: IRequest): Promise<IResponse>;
64
-
65
- /**
66
- * Notifies the runtime of a change in the connection state
67
- */
68
- setConnectionState(connected: boolean, clientId?: string);
69
-
70
- /**
71
- * Processes the given op (message)
72
- */
73
- process(message: ISequencedDocumentMessage, local: boolean);
74
-
75
- /**
76
- * Processes the given signal
77
- */
78
- processSignal(message: any, local: boolean);
79
-
80
- /**
81
- * Create a summary. Used when attaching or serializing a detached container.
82
- *
83
- * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
84
- * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
85
- * new storage IDs so requests can be redirected.
86
- */
87
- createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree;
88
-
89
- /**
90
- * Propagate the container state when container is attaching or attached.
91
- * @param attachState - State of the container.
92
- */
93
- setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
94
-
95
- /**
96
- * Get pending local state in a serializable format to be given back to a newly loaded container
97
- */
98
- getPendingLocalState(): unknown;
99
-
100
- /**
101
- * Notify runtime that container is moving to "Attaching" state
102
- * @param snapshot - snapshot created at attach time
103
- */
104
- notifyAttaching(snapshot: ISnapshotTreeWithBlobContents): void;
55
+ /**
56
+ * Executes a request against the runtime
57
+ */
58
+ request(request: IRequest): Promise<IResponse>;
59
+
60
+ /**
61
+ * Notifies the runtime of a change in the connection state
62
+ */
63
+ setConnectionState(connected: boolean, clientId?: string);
64
+
65
+ /**
66
+ * Processes the given op (message)
67
+ */
68
+ process(message: ISequencedDocumentMessage, local: boolean);
69
+
70
+ /**
71
+ * Processes the given signal
72
+ */
73
+ processSignal(message: any, local: boolean);
74
+
75
+ /**
76
+ * Create a summary. Used when attaching or serializing a detached container.
77
+ *
78
+ * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
79
+ * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
80
+ * new storage IDs so requests can be redirected.
81
+ */
82
+ createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree;
83
+
84
+ /**
85
+ * Propagate the container state when container is attaching or attached.
86
+ * @param attachState - State of the container.
87
+ */
88
+ setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
89
+
90
+ /**
91
+ * Get pending local state in a serializable format to be given back to a newly loaded container
92
+ */
93
+ getPendingLocalState(): unknown;
94
+
95
+ /**
96
+ * Notify runtime that container is moving to "Attaching" state
97
+ * @param snapshot - snapshot created at attach time
98
+ */
99
+ notifyAttaching(snapshot: ISnapshotTreeWithBlobContents): void;
105
100
  }
106
101
 
107
102
  /**
108
103
  * Payload type for IContainerContext.submitBatchFn()
109
104
  */
110
105
  export interface IBatchMessage {
111
- contents?: string;
112
- metadata: Record<string, unknown> | undefined;
113
- compression?: string;
106
+ contents?: string;
107
+ metadata: Record<string, unknown> | undefined;
108
+ compression?: string;
114
109
  }
115
110
 
116
111
  /**
@@ -122,71 +117,72 @@ export interface IBatchMessage {
122
117
  * and the Container has created a new ContainerContext.
123
118
  */
124
119
  export interface IContainerContext extends IDisposable {
125
- /** @deprecated Please pass in existing directly in instantiateRuntime */
126
- readonly existing: boolean | undefined;
127
- readonly options: ILoaderOptions;
128
- readonly clientId: string | undefined;
129
- readonly clientDetails: IClientDetails;
130
- readonly storage: IDocumentStorageService;
131
- readonly connected: boolean;
132
- readonly baseSnapshot: ISnapshotTree | undefined;
133
- /** @deprecated Please use submitBatchFn & submitSummaryFn */
134
- readonly submitFn: (type: MessageType, contents: any, batch: boolean, appData?: any) => number;
135
- /** @returns clientSequenceNumber of last message in a batch */
136
- readonly submitBatchFn: (batch: IBatchMessage[]) => number;
137
- readonly submitSummaryFn: (summaryOp: ISummaryContent) => number;
138
- readonly submitSignalFn: (contents: any) => void;
139
- readonly closeFn: (error?: ICriticalContainerError) => void;
140
- readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
141
- readonly quorum: IQuorumClients;
142
- /**
143
- * @deprecated This method is provided as a migration tool for customers currently reading the code details
144
- * from within the Container by directly accessing the Quorum proposals. The code details should not be accessed
145
- * from within the Container as this requires coupling between the container contents and the code loader.
146
- * Direct access to Quorum proposals will be removed in an upcoming release, and in a further future release this
147
- * migration tool will be removed.
148
- */
149
- getSpecifiedCodeDetails?(): IFluidCodeDetails | undefined;
150
- readonly audience: IAudience | undefined;
151
- readonly loader: ILoader;
152
- // The logger implementation, which would support tagged events, should be provided by the loader.
153
- readonly taggedLogger: ITelemetryBaseLogger;
154
- readonly serviceConfiguration: IClientConfiguration | undefined;
155
- pendingLocalState?: unknown;
156
-
157
- /**
158
- * Ambient services provided with the context
159
- */
160
- readonly scope: FluidObject;
161
-
162
- /**
163
- * Get an absolute url for a provided container-relative request.
164
- * @param relativeUrl - A relative request within the container
165
- *
166
- * TODO: Optional for backwards compatibility. Make non-optional in version 0.19
167
- */
168
- getAbsoluteUrl?(relativeUrl: string): Promise<string | undefined>;
169
-
170
- /**
171
- * Indicates the attachment state of the container to a host service.
172
- */
173
- readonly attachState: AttachState;
174
-
175
- getLoadedFromVersion(): IVersion | undefined;
176
-
177
- updateDirtyContainerState(dirty: boolean): void;
178
- /**
179
- * WARNING: this id is meant for telemetry usages ONLY, not recommended for other consumption
180
- * This id is not supposed to be exposed anywhere else. It is dependant on usage or drivers
181
- * and scenarios which can change in the future.
182
- */
183
- readonly id: string;
120
+ /** @deprecated Please pass in existing directly in instantiateRuntime */
121
+ readonly existing: boolean | undefined;
122
+ readonly options: ILoaderOptions;
123
+ readonly clientId: string | undefined;
124
+ readonly clientDetails: IClientDetails;
125
+ readonly storage: IDocumentStorageService;
126
+ readonly connected: boolean;
127
+ readonly baseSnapshot: ISnapshotTree | undefined;
128
+ /** @deprecated Please use submitBatchFn & submitSummaryFn */
129
+ readonly submitFn: (type: MessageType, contents: any, batch: boolean, appData?: any) => number;
130
+ /** @returns clientSequenceNumber of last message in a batch */
131
+ readonly submitBatchFn: (batch: IBatchMessage[]) => number;
132
+ readonly submitSummaryFn: (summaryOp: ISummaryContent) => number;
133
+ readonly submitSignalFn: (contents: any) => void;
134
+ readonly disposeFn?: (error?: ICriticalContainerError) => void;
135
+ readonly closeFn: (error?: ICriticalContainerError) => void;
136
+ readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
137
+ readonly quorum: IQuorumClients;
138
+ /**
139
+ * @deprecated This method is provided as a migration tool for customers currently reading the code details
140
+ * from within the Container by directly accessing the Quorum proposals. The code details should not be accessed
141
+ * from within the Container as this requires coupling between the container contents and the code loader.
142
+ * Direct access to Quorum proposals will be removed in an upcoming release, and in a further future release this
143
+ * migration tool will be removed.
144
+ */
145
+ getSpecifiedCodeDetails?(): IFluidCodeDetails | undefined;
146
+ readonly audience: IAudience | undefined;
147
+ readonly loader: ILoader;
148
+ // The logger implementation, which would support tagged events, should be provided by the loader.
149
+ readonly taggedLogger: ITelemetryBaseLogger;
150
+ readonly serviceConfiguration: IClientConfiguration | undefined;
151
+ pendingLocalState?: unknown;
152
+
153
+ /**
154
+ * Ambient services provided with the context
155
+ */
156
+ readonly scope: FluidObject;
157
+
158
+ /**
159
+ * Get an absolute url for a provided container-relative request.
160
+ * @param relativeUrl - A relative request within the container
161
+ *
162
+ * TODO: Optional for backwards compatibility. Make non-optional in version 0.19
163
+ */
164
+ getAbsoluteUrl?(relativeUrl: string): Promise<string | undefined>;
165
+
166
+ /**
167
+ * Indicates the attachment state of the container to a host service.
168
+ */
169
+ readonly attachState: AttachState;
170
+
171
+ getLoadedFromVersion(): IVersion | undefined;
172
+
173
+ updateDirtyContainerState(dirty: boolean): void;
174
+ /**
175
+ * WARNING: this id is meant for telemetry usages ONLY, not recommended for other consumption
176
+ * This id is not supposed to be exposed anywhere else. It is dependant on usage or drivers
177
+ * and scenarios which can change in the future.
178
+ */
179
+ readonly id: string;
184
180
  }
185
181
 
186
182
  export const IRuntimeFactory: keyof IProvideRuntimeFactory = "IRuntimeFactory";
187
183
 
188
184
  export interface IProvideRuntimeFactory {
189
- readonly IRuntimeFactory: IRuntimeFactory;
185
+ readonly IRuntimeFactory: IRuntimeFactory;
190
186
  }
191
187
 
192
188
  /**
@@ -196,12 +192,12 @@ export interface IProvideRuntimeFactory {
196
192
  * to start up the running instance of the Container.
197
193
  */
198
194
  export interface IRuntimeFactory extends IProvideRuntimeFactory {
199
- /**
200
- * Instantiates a new IRuntime for the given IContainerContext to proxy to
201
- * This is the main entry point to the Container's business logic
202
- *
203
- * @param context - container context to be supplied to the runtime
204
- * @param existing - whether to instantiate for the first time or from an existing context
205
- */
206
- instantiateRuntime(context: IContainerContext, existing?: boolean): Promise<IRuntime>;
195
+ /**
196
+ * Instantiates a new IRuntime for the given IContainerContext to proxy to
197
+ * This is the main entry point to the Container's business logic
198
+ *
199
+ * @param context - container context to be supplied to the runtime
200
+ * @param existing - whether to instantiate for the first time or from an existing context
201
+ */
202
+ instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
207
203
  }
@@ -6,9 +6,9 @@
6
6
  export const IFluidTokenProvider: keyof IProvideFluidTokenProvider = "IFluidTokenProvider";
7
7
 
8
8
  export interface IProvideFluidTokenProvider {
9
- readonly IFluidTokenProvider: IFluidTokenProvider;
9
+ readonly IFluidTokenProvider: IFluidTokenProvider;
10
10
  }
11
11
 
12
12
  export interface IFluidTokenProvider extends IProvideFluidTokenProvider {
13
- intelligence: { [service: string]: any; };
13
+ intelligence: { [service: string]: any };
14
14
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- "module": "esnext"
6
- },
7
- }
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./lib",
5
+ "module": "esnext",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,17 +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
- "types": [
11
- "node"
12
- ]
13
- },
14
- "include": [
15
- "src/**/*"
16
- ]
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/**/*"],
17
10
  }