@fluidframework/container-loader 0.52.0 → 0.54.0-47413

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 (77) hide show
  1. package/dist/connectionManager.d.ts +153 -0
  2. package/dist/connectionManager.d.ts.map +1 -0
  3. package/dist/connectionManager.js +664 -0
  4. package/dist/connectionManager.js.map +1 -0
  5. package/dist/connectionStateHandler.d.ts +1 -0
  6. package/dist/connectionStateHandler.d.ts.map +1 -1
  7. package/dist/connectionStateHandler.js +6 -0
  8. package/dist/connectionStateHandler.js.map +1 -1
  9. package/dist/container.d.ts +2 -22
  10. package/dist/container.d.ts.map +1 -1
  11. package/dist/container.js +121 -151
  12. package/dist/container.js.map +1 -1
  13. package/dist/containerContext.d.ts +1 -0
  14. package/dist/containerContext.d.ts.map +1 -1
  15. package/dist/containerContext.js +4 -0
  16. package/dist/containerContext.js.map +1 -1
  17. package/dist/contracts.d.ts +112 -0
  18. package/dist/contracts.d.ts.map +1 -0
  19. package/dist/contracts.js +14 -0
  20. package/dist/contracts.js.map +1 -0
  21. package/dist/deltaManager.d.ts +26 -142
  22. package/dist/deltaManager.d.ts.map +1 -1
  23. package/dist/deltaManager.js +143 -770
  24. package/dist/deltaManager.js.map +1 -1
  25. package/dist/loader.d.ts +14 -4
  26. package/dist/loader.d.ts.map +1 -1
  27. package/dist/loader.js +10 -4
  28. package/dist/loader.js.map +1 -1
  29. package/dist/packageVersion.d.ts +1 -1
  30. package/dist/packageVersion.d.ts.map +1 -1
  31. package/dist/packageVersion.js +1 -1
  32. package/dist/packageVersion.js.map +1 -1
  33. package/dist/protocolTreeDocumentStorageService.d.ts +2 -2
  34. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  35. package/lib/connectionManager.d.ts +153 -0
  36. package/lib/connectionManager.d.ts.map +1 -0
  37. package/lib/connectionManager.js +660 -0
  38. package/lib/connectionManager.js.map +1 -0
  39. package/lib/connectionStateHandler.d.ts +1 -0
  40. package/lib/connectionStateHandler.d.ts.map +1 -1
  41. package/lib/connectionStateHandler.js +6 -0
  42. package/lib/connectionStateHandler.js.map +1 -1
  43. package/lib/container.d.ts +2 -22
  44. package/lib/container.d.ts.map +1 -1
  45. package/lib/container.js +122 -152
  46. package/lib/container.js.map +1 -1
  47. package/lib/containerContext.d.ts +1 -0
  48. package/lib/containerContext.d.ts.map +1 -1
  49. package/lib/containerContext.js +4 -0
  50. package/lib/containerContext.js.map +1 -1
  51. package/lib/contracts.d.ts +112 -0
  52. package/lib/contracts.d.ts.map +1 -0
  53. package/lib/contracts.js +11 -0
  54. package/lib/contracts.js.map +1 -0
  55. package/lib/deltaManager.d.ts +26 -142
  56. package/lib/deltaManager.d.ts.map +1 -1
  57. package/lib/deltaManager.js +147 -774
  58. package/lib/deltaManager.js.map +1 -1
  59. package/lib/loader.d.ts +14 -4
  60. package/lib/loader.d.ts.map +1 -1
  61. package/lib/loader.js +11 -5
  62. package/lib/loader.js.map +1 -1
  63. package/lib/packageVersion.d.ts +1 -1
  64. package/lib/packageVersion.d.ts.map +1 -1
  65. package/lib/packageVersion.js +1 -1
  66. package/lib/packageVersion.js.map +1 -1
  67. package/lib/protocolTreeDocumentStorageService.d.ts +2 -2
  68. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  69. package/package.json +9 -9
  70. package/src/connectionManager.ts +892 -0
  71. package/src/connectionStateHandler.ts +8 -0
  72. package/src/container.ts +165 -187
  73. package/src/containerContext.ts +4 -0
  74. package/src/contracts.ts +156 -0
  75. package/src/deltaManager.ts +181 -978
  76. package/src/loader.ts +59 -27
  77. package/src/packageVersion.ts +1 -1
package/src/loader.ts CHANGED
@@ -25,7 +25,16 @@ import {
25
25
  IProxyLoaderFactory,
26
26
  LoaderHeader,
27
27
  } from "@fluidframework/container-definitions";
28
- import { ChildLogger, DebugLogger, PerformanceEvent } from "@fluidframework/telemetry-utils";
28
+ import {
29
+ ChildLogger,
30
+ DebugLogger,
31
+ IConfigProviderBase,
32
+ loggerToMonitoringContext,
33
+ mixinMonitoringContext,
34
+ MonitoringContext,
35
+ PerformanceEvent,
36
+ sessionStorageConfigProvider,
37
+ } from "@fluidframework/telemetry-utils";
29
38
  import {
30
39
  IDocumentServiceFactory,
31
40
  IDocumentStorageService,
@@ -41,6 +50,7 @@ import {
41
50
  } from "@fluidframework/driver-utils";
42
51
  import { Container } from "./container";
43
52
  import { IParsedUrl, parseUrl } from "./utils";
53
+ import { pkgVersion } from "./packageVersion";
44
54
 
45
55
  function canUseCache(request: IRequest): boolean {
46
56
  if (request.headers === undefined) {
@@ -124,32 +134,37 @@ export interface ILoaderOptions extends ILoaderOptions1{
124
134
  }
125
135
 
126
136
  /**
137
+ * @deprecated IFluidModuleWithDetails interface is moved to
138
+ * {@link @fluidframework/container-definition#IFluidModuleWithDetails}
139
+ * to have all the code loading modules in one package. #8193
127
140
  * Encapsulates a module entry point with corresponding code details.
128
141
  */
129
- export interface IFluidModuleWithDetails {
130
- /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
131
- module: IFluidModule;
132
- /**
133
- * Code details associated with the module. Represents a document schema this module supports.
134
- * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
135
- * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
136
- */
137
- details: IFluidCodeDetails;
138
- }
142
+ export interface IFluidModuleWithDetails {
143
+ /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
144
+ module: IFluidModule;
145
+ /**
146
+ * Code details associated with the module. Represents a document schema this module supports.
147
+ * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
148
+ * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
149
+ */
150
+ details: IFluidCodeDetails;
151
+ }
139
152
 
140
153
  /**
154
+ * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definition#ICodeDetailsLoader}
155
+ * to have code loading modules in one package. #8193
141
156
  * Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
142
157
  * a package name and package version range.
143
158
  */
144
159
  export interface ICodeDetailsLoader
145
- extends Partial<IProvideFluidCodeDetailsComparer> {
146
- /**
147
- * Load the code module (package) that is capable to interact with the document.
148
- *
149
- * @param source - Code proposal that articulates the current schema the document is written in.
150
- * @returns - Code module entry point along with the code details associated with it.
151
- */
152
- load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
160
+ extends Partial<IProvideFluidCodeDetailsComparer> {
161
+ /**
162
+ * Load the code module (package) that is capable to interact with the document.
163
+ *
164
+ * @param source - Code proposal that articulates the current schema the document is written in.
165
+ * @returns - Code module entry point along with the code details associated with it.
166
+ */
167
+ load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
153
168
  }
154
169
 
155
170
  /**
@@ -201,6 +216,11 @@ export interface ILoaderProps {
201
216
  * Blobs storage for detached containers.
202
217
  */
203
218
  readonly detachedBlobStorage?: IDetachedBlobStorage;
219
+
220
+ /**
221
+ * The configuration provider which may be used to control features.
222
+ */
223
+ readonly configProvider?: IConfigProviderBase;
204
224
  }
205
225
 
206
226
  /**
@@ -272,29 +292,41 @@ export type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" |
272
292
  export class Loader implements IHostLoader {
273
293
  private readonly containers = new Map<string, Promise<Container>>();
274
294
  public readonly services: ILoaderServices;
275
- private readonly logger: ITelemetryLogger;
295
+ private readonly mc: MonitoringContext;
276
296
 
277
297
  constructor(loaderProps: ILoaderProps) {
278
298
  const scope = { ...loaderProps.scope as FluidObject<ILoader> };
279
299
  if (loaderProps.options?.provideScopeLoader !== false) {
280
300
  scope.ILoader = this;
281
301
  }
302
+ const telemetryProps = {
303
+ loaderId: uuid(),
304
+ loaderVersion: pkgVersion,
305
+ };
306
+
307
+ const subMc = mixinMonitoringContext(
308
+ DebugLogger.mixinDebugLogger("fluid:telemetry", loaderProps.logger, { all: telemetryProps }),
309
+ sessionStorageConfigProvider.value,
310
+ loaderProps.configProvider,
311
+ );
312
+
282
313
  this.services = {
283
314
  urlResolver: createCachedResolver(MultiUrlResolver.create(loaderProps.urlResolver)),
284
315
  documentServiceFactory: MultiDocumentServiceFactory.create(loaderProps.documentServiceFactory),
285
316
  codeLoader: loaderProps.codeLoader,
286
317
  options: loaderProps.options ?? {},
287
318
  scope,
288
- subLogger: DebugLogger.mixinDebugLogger("fluid:telemetry", loaderProps.logger, { all:{loaderId: uuid()} }),
319
+ subLogger: subMc.logger,
289
320
  proxyLoaderFactories: loaderProps.proxyLoaderFactories ?? new Map<string, IProxyLoaderFactory>(),
290
321
  detachedBlobStorage: loaderProps.detachedBlobStorage,
291
322
  };
292
- this.logger = ChildLogger.create(this.services.subLogger, "Loader");
323
+ this.mc = loggerToMonitoringContext(
324
+ ChildLogger.create(this.services.subLogger, "Loader"));
293
325
  }
294
326
 
295
327
  public get IFluidRouter(): IFluidRouter { return this; }
296
328
 
297
- public async createDetachedContainer(codeDetails: IFluidCodeDetails): Promise<Container> {
329
+ public async createDetachedContainer(codeDetails: IFluidCodeDetails): Promise<IContainer> {
298
330
  const container = await Container.createDetached(
299
331
  this,
300
332
  codeDetails,
@@ -313,13 +345,13 @@ export class Loader implements IHostLoader {
313
345
  return container;
314
346
  }
315
347
 
316
- public async rehydrateDetachedContainerFromSnapshot(snapshot: string): Promise<Container> {
348
+ public async rehydrateDetachedContainerFromSnapshot(snapshot: string): Promise<IContainer> {
317
349
  return Container.rehydrateDetachedFromSnapshot(this, snapshot);
318
350
  }
319
351
 
320
- public async resolve(request: IRequest, pendingLocalState?: string): Promise<Container> {
352
+ public async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {
321
353
  const eventName = pendingLocalState === undefined ? "Resolve" : "ResolveWithPendingState";
322
- return PerformanceEvent.timedExecAsync(this.logger, { eventName }, async () => {
354
+ return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {
323
355
  const resolved = await this.resolveCore(
324
356
  request,
325
357
  pendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,
@@ -329,7 +361,7 @@ export class Loader implements IHostLoader {
329
361
  }
330
362
 
331
363
  public async request(request: IRequest): Promise<IResponse> {
332
- return PerformanceEvent.timedExecAsync(this.logger, { eventName: "Request" }, async () => {
364
+ return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Request" }, async () => {
333
365
  const resolved = await this.resolveCore(request);
334
366
  return resolved.container.request({
335
367
  ...request,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-loader";
9
- export const pkgVersion = "0.52.0";
9
+ export const pkgVersion = "0.54.0-47413";