@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.
- package/dist/connectionManager.d.ts +153 -0
- package/dist/connectionManager.d.ts.map +1 -0
- package/dist/connectionManager.js +664 -0
- package/dist/connectionManager.js.map +1 -0
- package/dist/connectionStateHandler.d.ts +1 -0
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +6 -0
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +2 -22
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +121 -151
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +1 -0
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +4 -0
- package/dist/containerContext.js.map +1 -1
- package/dist/contracts.d.ts +112 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +14 -0
- package/dist/contracts.js.map +1 -0
- package/dist/deltaManager.d.ts +26 -142
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +143 -770
- package/dist/deltaManager.js.map +1 -1
- package/dist/loader.d.ts +14 -4
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +10 -4
- package/dist/loader.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +2 -2
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/connectionManager.d.ts +153 -0
- package/lib/connectionManager.d.ts.map +1 -0
- package/lib/connectionManager.js +660 -0
- package/lib/connectionManager.js.map +1 -0
- package/lib/connectionStateHandler.d.ts +1 -0
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +6 -0
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +2 -22
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +122 -152
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +1 -0
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +4 -0
- package/lib/containerContext.js.map +1 -1
- package/lib/contracts.d.ts +112 -0
- package/lib/contracts.d.ts.map +1 -0
- package/lib/contracts.js +11 -0
- package/lib/contracts.js.map +1 -0
- package/lib/deltaManager.d.ts +26 -142
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +147 -774
- package/lib/deltaManager.js.map +1 -1
- package/lib/loader.d.ts +14 -4
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +11 -5
- package/lib/loader.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +2 -2
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/connectionManager.ts +892 -0
- package/src/connectionStateHandler.ts +8 -0
- package/src/container.ts +165 -187
- package/src/containerContext.ts +4 -0
- package/src/contracts.ts +156 -0
- package/src/deltaManager.ts +181 -978
- package/src/loader.ts +59 -27
- 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 {
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
|
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:
|
|
319
|
+
subLogger: subMc.logger,
|
|
289
320
|
proxyLoaderFactories: loaderProps.proxyLoaderFactories ?? new Map<string, IProxyLoaderFactory>(),
|
|
290
321
|
detachedBlobStorage: loaderProps.detachedBlobStorage,
|
|
291
322
|
};
|
|
292
|
-
this.
|
|
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<
|
|
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<
|
|
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<
|
|
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,
|
package/src/packageVersion.ts
CHANGED