@fluidframework/container-definitions 0.43.0-45414 → 0.45.0-49188

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 (52) hide show
  1. package/.eslintrc.js +4 -3
  2. package/BREAKING.md +6 -0
  3. package/api-report/container-definitions.api.md +94 -35
  4. package/dist/deltas.d.ts +1 -19
  5. package/dist/deltas.d.ts.map +1 -1
  6. package/dist/deltas.js.map +1 -1
  7. package/dist/error.d.ts +5 -1
  8. package/dist/error.d.ts.map +1 -1
  9. package/dist/error.js +4 -0
  10. package/dist/error.js.map +1 -1
  11. package/dist/fluidPackage.d.ts +109 -0
  12. package/dist/fluidPackage.d.ts.map +1 -0
  13. package/dist/fluidPackage.js +24 -0
  14. package/dist/fluidPackage.js.map +1 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/loader.d.ts +34 -16
  20. package/dist/loader.d.ts.map +1 -1
  21. package/dist/loader.js.map +1 -1
  22. package/dist/runtime.d.ts +18 -4
  23. package/dist/runtime.d.ts.map +1 -1
  24. package/dist/runtime.js.map +1 -1
  25. package/lib/deltas.d.ts +1 -19
  26. package/lib/deltas.d.ts.map +1 -1
  27. package/lib/deltas.js.map +1 -1
  28. package/lib/error.d.ts +5 -1
  29. package/lib/error.d.ts.map +1 -1
  30. package/lib/error.js +4 -0
  31. package/lib/error.js.map +1 -1
  32. package/lib/fluidPackage.d.ts +109 -0
  33. package/lib/fluidPackage.d.ts.map +1 -0
  34. package/lib/fluidPackage.js +19 -0
  35. package/lib/fluidPackage.js.map +1 -0
  36. package/lib/index.d.ts +1 -0
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +1 -0
  39. package/lib/index.js.map +1 -1
  40. package/lib/loader.d.ts +34 -16
  41. package/lib/loader.d.ts.map +1 -1
  42. package/lib/loader.js.map +1 -1
  43. package/lib/runtime.d.ts +18 -4
  44. package/lib/runtime.d.ts.map +1 -1
  45. package/lib/runtime.js.map +1 -1
  46. package/package.json +242 -24
  47. package/src/deltas.ts +1 -20
  48. package/src/error.ts +6 -1
  49. package/src/fluidPackage.ts +132 -0
  50. package/src/index.ts +1 -0
  51. package/src/loader.ts +37 -17
  52. package/src/runtime.ts +20 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-definitions",
3
- "version": "0.43.0-45414",
3
+ "version": "0.45.0-49188",
4
4
  "description": "Fluid container definitions",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": "https://github.com/microsoft/FluidFramework",
@@ -27,7 +27,7 @@
27
27
  "ci:test:coverage": "echo No test for this package",
28
28
  "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
29
29
  "eslint": "eslint --format stylish src",
30
- "eslint:fix": "eslint --format stylish src --fix",
30
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
31
31
  "lint": "npm run eslint",
32
32
  "lint:fix": "npm run eslint:fix",
33
33
  "tsc": "tsc",
@@ -38,37 +38,40 @@
38
38
  "dependencies": {
39
39
  "@fluidframework/common-definitions": "^0.20.0",
40
40
  "@fluidframework/core-interfaces": "^0.41.0",
41
- "@fluidframework/driver-definitions": "^0.43.0-0",
41
+ "@fluidframework/driver-definitions": "^0.44.0-0",
42
42
  "@fluidframework/protocol-definitions": "^0.1026.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@fluidframework/build-common": "^0.23.0",
46
- "@fluidframework/build-tools": "^0.2.44827",
46
+ "@fluidframework/build-tools": "^0.2.46657",
47
47
  "@fluidframework/container-definitions-0.39.8": "npm:@fluidframework/container-definitions@0.39.8",
48
48
  "@fluidframework/container-definitions-0.40.0": "npm:@fluidframework/container-definitions@0.40.0",
49
49
  "@fluidframework/container-definitions-0.41.0": "npm:@fluidframework/container-definitions@0.41.0",
50
50
  "@fluidframework/container-definitions-0.42.0": "npm:@fluidframework/container-definitions@0.42.0",
51
- "@fluidframework/eslint-config-fluid": "^0.24.0",
51
+ "@fluidframework/container-definitions-0.43.0": "npm:@fluidframework/container-definitions@0.43.0",
52
+ "@fluidframework/container-definitions-0.44.0": "npm:@fluidframework/container-definitions@0.44.0",
53
+ "@fluidframework/eslint-config-fluid": "^0.25.0",
52
54
  "@microsoft/api-extractor": "^7.16.1",
55
+ "@rushstack/eslint-config": "^2.5.1",
53
56
  "@types/mocha": "^8.2.2",
54
- "@types/node": "^12.19.0",
55
- "@typescript-eslint/eslint-plugin": "~4.14.0",
56
- "@typescript-eslint/parser": "~4.14.0",
57
+ "@types/node": "^14.18.0",
58
+ "@typescript-eslint/eslint-plugin": "~5.9.0",
59
+ "@typescript-eslint/parser": "~5.9.0",
57
60
  "concurrently": "^6.2.0",
58
61
  "copyfiles": "^2.1.0",
59
- "eslint": "~7.18.0",
62
+ "eslint": "~8.6.0",
63
+ "eslint-plugin-editorconfig": "~3.2.0",
60
64
  "eslint-plugin-eslint-comments": "~3.2.0",
61
- "eslint-plugin-import": "~2.22.1",
65
+ "eslint-plugin-import": "~2.25.4",
62
66
  "eslint-plugin-no-null": "~1.0.2",
63
- "eslint-plugin-prefer-arrow": "~1.2.2",
64
- "eslint-plugin-react": "~7.22.0",
65
- "eslint-plugin-unicorn": "~26.0.1",
67
+ "eslint-plugin-react": "~7.28.0",
68
+ "eslint-plugin-unicorn": "~40.0.0",
66
69
  "rimraf": "^2.6.2",
67
70
  "typescript": "~4.1.3",
68
71
  "typescript-formatter": "7.1.0"
69
72
  },
70
73
  "typeValidation": {
71
- "version": "0.43.0",
74
+ "version": "0.45.0",
72
75
  "broken": {
73
76
  "0.39.8": {
74
77
  "EnumDeclaration_ContainerErrorType": {
@@ -122,9 +125,27 @@
122
125
  },
123
126
  "InterfaceDeclaration_IThrottlingWarning": {
124
127
  "backCompat": false
128
+ },
129
+ "InterfaceDeclaration_IDeltaManager": {
130
+ "backCompat": false
131
+ },
132
+ "InterfaceDeclaration_IConnectionDetails": {
133
+ "backCompat": false
125
134
  }
126
135
  },
127
136
  "0.40.0": {
137
+ "InterfaceDeclaration_IUsageError": {
138
+ "backCompat": false
139
+ },
140
+ "InterfaceDeclaration_IThrottlingWarning": {
141
+ "backCompat": false
142
+ },
143
+ "InterfaceDeclaration_IGenericError": {
144
+ "backCompat": false
145
+ },
146
+ "EnumDeclaration_ContainerErrorType": {
147
+ "backCompat": false
148
+ },
128
149
  "InterfaceDeclaration_ICodeLoader": {
129
150
  "forwardCompat": false,
130
151
  "backCompat": false
@@ -146,58 +167,255 @@
146
167
  "backCompat": false
147
168
  },
148
169
  "InterfaceDeclaration_ILoader": {
149
- "backCompat": false
170
+ "backCompat": false,
171
+ "forwardCompat": false
150
172
  },
151
173
  "InterfaceDeclaration_IProxyLoaderFactory": {
152
- "backCompat": false
174
+ "backCompat": false,
175
+ "forwardCompat": false
153
176
  },
154
177
  "InterfaceDeclaration_IHostLoader": {
155
- "backCompat": false
178
+ "backCompat": false,
179
+ "forwardCompat": false
156
180
  },
157
181
  "InterfaceDeclaration_IContainer": {
182
+ "backCompat": false,
183
+ "forwardCompat": false
184
+ },
185
+ "InterfaceDeclaration_IDeltaManager": {
186
+ "backCompat": false
187
+ },
188
+ "InterfaceDeclaration_IConnectionDetails": {
158
189
  "backCompat": false
159
190
  }
160
191
  },
161
192
  "0.41.0": {
162
- "InterfaceDeclaration_ILoader": {
193
+ "InterfaceDeclaration_IUsageError": {
194
+ "backCompat": false
195
+ },
196
+ "InterfaceDeclaration_IThrottlingWarning": {
197
+ "backCompat": false
198
+ },
199
+ "InterfaceDeclaration_IGenericError": {
200
+ "backCompat": false
201
+ },
202
+ "EnumDeclaration_ContainerErrorType": {
163
203
  "backCompat": false
164
204
  },
205
+ "InterfaceDeclaration_ILoader": {
206
+ "backCompat": false,
207
+ "forwardCompat": false
208
+ },
165
209
  "InterfaceDeclaration_IProxyLoaderFactory": {
210
+ "backCompat": false,
211
+ "forwardCompat": false
212
+ },
213
+ "InterfaceDeclaration_IHostLoader": {
214
+ "backCompat": false,
215
+ "forwardCompat": false
216
+ },
217
+ "InterfaceDeclaration_IFluidModule": {
218
+ "backCompat": false,
219
+ "forwardCompat": false
220
+ },
221
+ "InterfaceDeclaration_IContainerContext": {
222
+ "backCompat": false,
223
+ "forwardCompat": false
224
+ },
225
+ "InterfaceDeclaration_IContainer": {
226
+ "backCompat": false,
227
+ "forwardCompat": false
228
+ },
229
+ "InterfaceDeclaration_ICodeLoader": {
230
+ "backCompat": false,
231
+ "forwardCompat": false
232
+ },
233
+ "InterfaceDeclaration_IDeltaManager": {
234
+ "backCompat": false
235
+ },
236
+ "InterfaceDeclaration_IConnectionDetails": {
166
237
  "backCompat": false
167
238
  },
239
+ "InterfaceDeclaration_IProvideRuntimeFactory": {
240
+ "backCompat": false,
241
+ "forwardCompat": false
242
+ },
243
+ "InterfaceDeclaration_IRuntimeFactory": {
244
+ "backCompat": false,
245
+ "forwardCompat": false
246
+ }
247
+ },
248
+ "0.42.0": {
249
+ "InterfaceDeclaration_IUsageError": {
250
+ "backCompat": false
251
+ },
252
+ "InterfaceDeclaration_IThrottlingWarning": {
253
+ "backCompat": false
254
+ },
255
+ "InterfaceDeclaration_IGenericError": {
256
+ "backCompat": false
257
+ },
258
+ "EnumDeclaration_ContainerErrorType": {
259
+ "backCompat": false
260
+ },
261
+ "InterfaceDeclaration_ILoader": {
262
+ "backCompat": false,
263
+ "forwardCompat": false
264
+ },
265
+ "InterfaceDeclaration_IProxyLoaderFactory": {
266
+ "backCompat": false,
267
+ "forwardCompat": false
268
+ },
168
269
  "InterfaceDeclaration_IHostLoader": {
270
+ "backCompat": false,
271
+ "forwardCompat": false
272
+ },
273
+ "InterfaceDeclaration_IContainerContext": {
274
+ "backCompat": false,
275
+ "forwardCompat": false
276
+ },
277
+ "InterfaceDeclaration_IContainer": {
278
+ "backCompat": false,
279
+ "forwardCompat": false
280
+ },
281
+ "InterfaceDeclaration_IProvideLoader": {
282
+ "backCompat": false,
283
+ "forwardCompat": false
284
+ },
285
+ "InterfaceDeclaration_IProvideRuntimeFactory": {
286
+ "backCompat": false,
287
+ "forwardCompat": false
288
+ },
289
+ "InterfaceDeclaration_IRuntimeFactory": {
290
+ "backCompat": false,
291
+ "forwardCompat": false
292
+ },
293
+ "InterfaceDeclaration_IDeltaManager": {
294
+ "backCompat": false
295
+ },
296
+ "InterfaceDeclaration_IConnectionDetails": {
297
+ "backCompat": false
298
+ },
299
+ "InterfaceDeclaration_ICodeLoader": {
169
300
  "backCompat": false
170
301
  },
171
302
  "InterfaceDeclaration_IFluidModule": {
172
303
  "backCompat": false
304
+ }
305
+ },
306
+ "0.43.0": {
307
+ "InterfaceDeclaration_IUsageError": {
308
+ "backCompat": false
173
309
  },
174
- "InterfaceDeclaration_IContainerContext": {
310
+ "InterfaceDeclaration_IThrottlingWarning": {
175
311
  "backCompat": false
176
312
  },
313
+ "InterfaceDeclaration_IGenericError": {
314
+ "backCompat": false
315
+ },
316
+ "EnumDeclaration_ContainerErrorType": {
317
+ "backCompat": false
318
+ },
319
+ "InterfaceDeclaration_ILoader": {
320
+ "backCompat": false,
321
+ "forwardCompat": false
322
+ },
323
+ "InterfaceDeclaration_IHostLoader": {
324
+ "backCompat": false,
325
+ "forwardCompat": false
326
+ },
327
+ "InterfaceDeclaration_IContainerContext": {
328
+ "backCompat": false,
329
+ "forwardCompat": false
330
+ },
177
331
  "InterfaceDeclaration_IContainer": {
332
+ "backCompat": false,
333
+ "forwardCompat": false
334
+ },
335
+ "InterfaceDeclaration_IProvideLoader": {
336
+ "backCompat": false,
337
+ "forwardCompat": false
338
+ },
339
+ "InterfaceDeclaration_IProxyLoaderFactory": {
340
+ "backCompat": false,
341
+ "forwardCompat": false
342
+ },
343
+ "InterfaceDeclaration_ICodeDetailsLoader": {
178
344
  "backCompat": false
179
345
  },
180
346
  "InterfaceDeclaration_ICodeLoader": {
181
347
  "backCompat": false
348
+ },
349
+ "InterfaceDeclaration_IFluidModule": {
350
+ "backCompat": false
351
+ },
352
+ "InterfaceDeclaration_IFluidModuleWithDetails": {
353
+ "backCompat": false
354
+ },
355
+ "InterfaceDeclaration_IProvideRuntimeFactory": {
356
+ "backCompat": false,
357
+ "forwardCompat": false
358
+ },
359
+ "InterfaceDeclaration_IRuntimeFactory": {
360
+ "backCompat": false,
361
+ "forwardCompat": false
182
362
  }
183
363
  },
184
- "0.42.0": {
185
- "InterfaceDeclaration_ILoader": {
364
+ "0.44.0": {
365
+ "EnumDeclaration_ContainerErrorType": {
186
366
  "backCompat": false
187
367
  },
188
- "InterfaceDeclaration_IProxyLoaderFactory": {
368
+ "InterfaceDeclaration_ICodeDetailsLoader": {
189
369
  "backCompat": false
190
370
  },
191
- "InterfaceDeclaration_IHostLoader": {
371
+ "InterfaceDeclaration_ICodeLoader": {
192
372
  "backCompat": false
193
373
  },
374
+ "InterfaceDeclaration_IContainer": {
375
+ "backCompat": false,
376
+ "forwardCompat": false
377
+ },
194
378
  "InterfaceDeclaration_IContainerContext": {
379
+ "backCompat": false,
380
+ "forwardCompat": false
381
+ },
382
+ "InterfaceDeclaration_IFluidModule": {
195
383
  "backCompat": false
196
384
  },
197
- "InterfaceDeclaration_IContainer": {
385
+ "InterfaceDeclaration_IFluidModuleWithDetails": {
386
+ "backCompat": false
387
+ },
388
+ "InterfaceDeclaration_IGenericError": {
198
389
  "backCompat": false
199
390
  },
391
+ "InterfaceDeclaration_IHostLoader": {
392
+ "backCompat": false,
393
+ "forwardCompat": false
394
+ },
395
+ "InterfaceDeclaration_ILoader": {
396
+ "backCompat": false,
397
+ "forwardCompat": false
398
+ },
200
399
  "InterfaceDeclaration_IProvideLoader": {
400
+ "backCompat": false,
401
+ "forwardCompat": false
402
+ },
403
+ "InterfaceDeclaration_IProvideRuntimeFactory": {
404
+ "backCompat": false,
405
+ "forwardCompat": false
406
+ },
407
+ "InterfaceDeclaration_IProxyLoaderFactory": {
408
+ "backCompat": false,
409
+ "forwardCompat": false
410
+ },
411
+ "InterfaceDeclaration_IRuntimeFactory": {
412
+ "backCompat": false,
413
+ "forwardCompat": false
414
+ },
415
+ "InterfaceDeclaration_IThrottlingWarning": {
416
+ "backCompat": false
417
+ },
418
+ "InterfaceDeclaration_IUsageError": {
201
419
  "backCompat": false
202
420
  }
203
421
  }
package/src/deltas.ts CHANGED
@@ -25,10 +25,6 @@ export interface IConnectionDetails {
25
25
  mode: ConnectionMode;
26
26
  version: string;
27
27
  initialClients: ISignalClient[];
28
- /**
29
- * @deprecated - please use `serviceConfiguration.maxMessageSize`
30
- */
31
- maxMessageSize: number;
32
28
  serviceConfiguration: IClientConfiguration;
33
29
  /**
34
30
  * Last known sequence number to ordering service at the time of connection
@@ -152,24 +148,9 @@ export interface IDeltaManager<T, U> extends IEventProvider<IDeltaManagerEvents>
152
148
  /** Flag to indicate whether the client can write or not. */
153
149
  readonly active: boolean;
154
150
 
155
- /**
156
- * Tells if container is in read-only mode.
157
- * Data stores should listen for "readonly" notifications and disallow user making changes to data stores.
158
- * Readonly state can be because of no storage write permission,
159
- * or due to host forcing readonly mode for container.
160
- *
161
- * We do not differentiate here between no write access to storage vs. host disallowing changes to container -
162
- * in all cases container runtime and data stores should respect readonly state and not allow local changes.
163
- *
164
- * It is undefined if we have not yet established websocket connection
165
- * and do not know if user has write access to a file.
166
- * @deprecated - use readOnlyInfo
167
- */
168
- readonly readonly?: boolean;
169
-
170
151
  readonly readOnlyInfo: ReadOnlyInfo;
171
152
 
172
- /** Terminate the connection to storage */
153
+ /** @deprecated - Use Container.close() or IContainerContext.closeFn() */
173
154
  close(): void;
174
155
 
175
156
  /** Submit a signal to the service to be broadcast to other connected clients, but not persisted */
package/src/error.ts CHANGED
@@ -33,7 +33,12 @@ export enum ContainerErrorType {
33
33
  * Error indicating an API is being used improperly resulting in an invalid operation.
34
34
  */
35
35
  usageError = "usageError",
36
- }
36
+
37
+ /**
38
+ * Error indicating an client session has expired.
39
+ */
40
+ clientSessionExpiredError = "clientSessionExpiredError",
41
+ }
37
42
 
38
43
  /**
39
44
  * Base interface for all errors and warnings at container level
@@ -0,0 +1,132 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Specifies an environment on Fluid property of a IFluidPackage
8
+ */
9
+ export interface IFluidPackageEnvironment {
10
+
11
+ /**
12
+ * The name of the target. For a browser environment, this could be umd for scripts
13
+ * or css for styles.
14
+ */
15
+ [target: string]: undefined | {
16
+ /**
17
+ * List of files for the target. These can be relative or absolute.
18
+ * The code loader should resolve relative paths, and validate all
19
+ * full urls.
20
+ */
21
+ files: string[];
22
+
23
+ /**
24
+ * General access for extended fields as specific usages will
25
+ * likely have additional infornamation like a definition
26
+ * of Library, the entrypoint for umd packages
27
+ */
28
+ [key: string]: unknown;
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Fluid-specific properties expected on a package to be loaded by the code loader.
34
+ * While compatible with the npm package format it is not necessary that that package is an
35
+ * npm package:
36
+ * {@link https://stackoverflow.com/questions/10065564/add-custom-metadata-or-config-to-package-json-is-it-valid}
37
+ */
38
+ export interface IFluidPackage {
39
+ /**
40
+ * The name of the package that this code represnets
41
+ */
42
+ name: string;
43
+ /**
44
+ * This object represents the Fluid specific properties of the package
45
+ */
46
+ fluid: {
47
+ /**
48
+ * The name of the of the environment. This should be something like browser, or node
49
+ * and contain the necessary targets for loading this code in that environment.
50
+ */
51
+ [environment: string]: undefined | IFluidPackageEnvironment;
52
+ };
53
+ /**
54
+ * General access for extended fields as specific usages will
55
+ * likely have additional infornamation like a definition of
56
+ * compatible versions, or deployment information like rings or rollouts.
57
+ */
58
+ [key: string]: unknown;
59
+ }
60
+
61
+ /**
62
+ * Check if the package.json defines a Fluid package
63
+ * @param pkg - the package json data to check if it is a Fluid package.
64
+ */
65
+ export const isFluidPackage = (pkg: any): pkg is Readonly<IFluidPackage> =>
66
+ typeof pkg === "object"
67
+ && typeof pkg?.name === "string"
68
+ && typeof pkg?.fluid === "object";
69
+
70
+ /**
71
+ * Package manager configuration. Provides a key value mapping of config values
72
+ */
73
+ export interface IFluidCodeDetailsConfig {
74
+ readonly [key: string]: string;
75
+ }
76
+
77
+ /**
78
+ * Data structure used to describe the code to load on the Fluid document
79
+ */
80
+ export interface IFluidCodeDetails {
81
+ /**
82
+ * The code package to be used on the Fluid document. This is either the package name which will be loaded
83
+ * from a package manager. Or the expanded Fluid package.
84
+ */
85
+ readonly package: string | Readonly<IFluidPackage>;
86
+
87
+ /**
88
+ * Configuration details. This includes links to the package manager and base CDNs.
89
+ */
90
+ readonly config?: IFluidCodeDetailsConfig;
91
+ }
92
+
93
+ export const isFluidCodeDetails = (details: unknown): details is Readonly<IFluidCodeDetails> =>{
94
+ const maybeCodeDetails = details as Partial<IFluidCodeDetails> | undefined;
95
+ return typeof maybeCodeDetails === "object"
96
+ && (typeof maybeCodeDetails?.package === "string" || isFluidPackage(maybeCodeDetails?.package))
97
+ && (maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === "object");
98
+ };
99
+
100
+ export const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer = "IFluidCodeDetailsComparer";
101
+
102
+ export interface IProvideFluidCodeDetailsComparer {
103
+ readonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer ;
104
+ }
105
+
106
+ /**
107
+ * Provides capability to compare Fluid code details.
108
+ */
109
+ export interface IFluidCodeDetailsComparer extends IProvideFluidCodeDetailsComparer {
110
+
111
+ /**
112
+ * Determines if the `candidate` code details satisfy the constraints specified in `constraint` code details.
113
+ *
114
+ * Similar semantics to:
115
+ * {@link https://github.com/npm/node-semver#usage}
116
+ */
117
+ satisfies(candidate: IFluidCodeDetails, constraint: IFluidCodeDetails): Promise<boolean>;
118
+
119
+ /* eslint-disable max-len */
120
+ /**
121
+ * Return a number representing the ascending sort order of the `a` and `b` code details;
122
+ * `< 0` if `a < b`.
123
+ * `= 0` if `a === b`.
124
+ * `> 0` if `a > b`.
125
+ * `undefined` if `a` is not comparable to `b`.
126
+ *
127
+ * Similar semantics to:
128
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description | Array.sort}
129
+ */
130
+ compare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined>;
131
+ /* eslint-enable max-len */
132
+ }
package/src/index.ts CHANGED
@@ -10,5 +10,6 @@ export * from "./deltas";
10
10
  export * from "./error";
11
11
  export * from "./loader";
12
12
  export * from "./fluidModule";
13
+ export * from "./fluidPackage";
13
14
  export * from "./proxyLoader";
14
15
  export * from "./runtime";
package/src/loader.ts CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  IClientDetails,
16
16
  IDocumentMessage,
17
17
  IPendingProposal,
18
- IQuorum,
18
+ IQuorumClients,
19
19
  ISequencedDocumentMessage,
20
20
  } from "@fluidframework/protocol-definitions";
21
21
  import { IResolvedUrl } from "@fluidframework/driver-definitions";
@@ -38,6 +38,35 @@ export interface ICodeLoader extends Partial<IProvideFluidCodeDetailsComparer> {
38
38
  load(source: IFluidCodeDetails): Promise<IFluidModule>;
39
39
  }
40
40
 
41
+ /**
42
+ * Encapsulates a module entry point with corresponding code details.
43
+ */
44
+ export interface IFluidModuleWithDetails {
45
+ /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
46
+ module: IFluidModule;
47
+ /**
48
+ * Code details associated with the module. Represents a document schema this module supports.
49
+ * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
50
+ * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
51
+ */
52
+ details: IFluidCodeDetails;
53
+ }
54
+
55
+ /**
56
+ * Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
57
+ * a package name and package version range.
58
+ */
59
+ export interface ICodeDetailsLoader
60
+ extends Partial<IProvideFluidCodeDetailsComparer> {
61
+ /**
62
+ * Load the code module (package) that is capable to interact with the document.
63
+ *
64
+ * @param source - Code proposal that articulates the current schema the document is written in.
65
+ * @returns - Code module entry point along with the code details associated with it.
66
+ */
67
+ load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
68
+ }
69
+
41
70
  /**
42
71
  * The interface returned from a IFluidCodeResolver which represents IFluidCodeDetails
43
72
  * that have been resolved and are ready to load
@@ -133,7 +162,7 @@ export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRout
133
162
  * The collection of write clients which were connected as of the current sequence number.
134
163
  * Also contains a map of key-value pairs that must be agreed upon by all clients before being accepted.
135
164
  */
136
- getQuorum(): IQuorum;
165
+ getQuorum(): IQuorumClients;
137
166
 
138
167
  /**
139
168
  * Represents the resolved url to the Container
@@ -145,27 +174,18 @@ export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRout
145
174
  */
146
175
  readonly attachState: AttachState;
147
176
 
148
- /**
149
- * The current code details for the container's runtime
150
- * @deprecated use getSpecifiedCodeDetails for the code details currently specified for this container, or
151
- * getLoadedCodeDetails for the code details that the container's context was loaded with.
152
- * To be removed after getSpecifiedCodeDetails and getLoadedCodeDetails become ubiquitous.
153
- * This is now marked as optional and due to be removed in next release.
154
- */
155
- readonly codeDetails?: IFluidCodeDetails | undefined;
156
-
157
177
  /**
158
178
  * Get the code details that are currently specified for the container.
159
179
  * @returns The current code details if any are specified, undefined if none are specified.
160
180
  */
161
- getSpecifiedCodeDetails?(): IFluidCodeDetails | undefined;
181
+ getSpecifiedCodeDetails(): IFluidCodeDetails | undefined;
162
182
 
163
183
  /**
164
184
  * Get the code details that were used to load the container.
165
185
  * @returns The code details that were used to load the container if it is loaded, undefined if it is not yet
166
186
  * loaded.
167
187
  */
168
- getLoadedCodeDetails?(): IFluidCodeDetails | undefined;
188
+ getLoadedCodeDetails(): IFluidCodeDetails | undefined;
169
189
 
170
190
  /**
171
191
  * Returns true if the container has been closed, otherwise false
@@ -228,12 +248,12 @@ export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRout
228
248
  /**
229
249
  * Provides the current connected state of the container
230
250
  */
231
- readonly connectionState?: ConnectionState;
251
+ readonly connectionState: ConnectionState;
232
252
 
233
253
  /**
234
254
  * Boolean indicating whether the container is currently connected or not
235
255
  */
236
- readonly connected?: boolean;
256
+ readonly connected: boolean;
237
257
 
238
258
  /**
239
259
  * Dictates whether or not the current container will automatically attempt to reconnect to the delta stream
@@ -252,7 +272,7 @@ export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRout
252
272
  /**
253
273
  * The audience information for all clients currently associated with the document in the current session
254
274
  */
255
- readonly audience?: IAudience;
275
+ readonly audience: IAudience;
256
276
 
257
277
  /**
258
278
  * The server provided ID of the client.
@@ -273,7 +293,7 @@ export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRout
273
293
  * It is undefined if we have not yet established websocket connection
274
294
  * and do not know if user has write access to a file.
275
295
  */
276
- readonly readOnlyInfo?: ReadOnlyInfo;
296
+ readonly readOnlyInfo: ReadOnlyInfo;
277
297
 
278
298
  /**
279
299
  * Allows the host to have the container force to be in read-only mode