@fluidframework/container-loader 0.51.3 → 0.53.0-46105
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/connectionStateHandler.d.ts +1 -0
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +11 -3
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +15 -23
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +125 -140
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +5 -4
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +4 -0
- package/dist/containerContext.js.map +1 -1
- package/dist/deltaManager.d.ts +0 -7
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +38 -50
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.d.ts +5 -1
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js.map +1 -1
- package/dist/loader.d.ts +8 -3
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +6 -1
- 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/utils.js +6 -5
- package/dist/utils.js.map +1 -1
- package/lib/connectionStateHandler.d.ts +1 -0
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +11 -3
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +15 -23
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +127 -142
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +5 -4
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +4 -0
- package/lib/containerContext.js.map +1 -1
- package/lib/deltaManager.d.ts +0 -7
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +38 -50
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.d.ts +5 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js.map +1 -1
- package/lib/loader.d.ts +8 -3
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +6 -1
- 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/utils.js +6 -5
- package/lib/utils.js.map +1 -1
- package/package.json +11 -11
- package/src/connectionStateHandler.ts +14 -4
- package/src/container.ts +150 -160
- package/src/containerContext.ts +8 -3
- package/src/deltaManager.ts +50 -56
- package/src/deltaQueue.ts +10 -1
- package/src/loader.ts +33 -24
- package/src/packageVersion.ts +1 -1
package/src/deltaManager.ts
CHANGED
|
@@ -93,6 +93,8 @@ const createReconnectError = (fluidErrorCode: string, err: any) =>
|
|
|
93
93
|
(errorMessage: string) => new GenericNetworkError(fluidErrorCode, errorMessage, true /* canRetry */),
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
+
const fatalConnectErrorProp = { fatalConnectError: true };
|
|
97
|
+
|
|
96
98
|
export interface IConnectionArgs {
|
|
97
99
|
mode?: ConnectionMode;
|
|
98
100
|
fetchOpsFromStorage?: boolean;
|
|
@@ -157,9 +159,6 @@ class NoDeltaStream
|
|
|
157
159
|
private _disposed = false;
|
|
158
160
|
public get disposed() { return this._disposed; }
|
|
159
161
|
public dispose() { this._disposed = true; }
|
|
160
|
-
|
|
161
|
-
// back-compat: became @deprecated in 0.45 / driver-definitions 0.40
|
|
162
|
-
public close(): void { this.dispose(); }
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
/**
|
|
@@ -334,7 +333,7 @@ export class DeltaManager
|
|
|
334
333
|
public get connectionMode(): ConnectionMode {
|
|
335
334
|
assert(!this.downgradedConnection || this.connection?.mode === "write",
|
|
336
335
|
0x277 /* "Did we forget to reset downgradedConnection on new connection?" */);
|
|
337
|
-
if (this.connection === undefined
|
|
336
|
+
if (this.connection === undefined) {
|
|
338
337
|
return "read";
|
|
339
338
|
}
|
|
340
339
|
return this.connection.mode;
|
|
@@ -350,23 +349,13 @@ export class DeltaManager
|
|
|
350
349
|
* and do not know if user has write access to a file.
|
|
351
350
|
* @deprecated - use readOnlyInfo
|
|
352
351
|
*/
|
|
353
|
-
|
|
352
|
+
public get readonly() {
|
|
354
353
|
if (this._forceReadonly) {
|
|
355
354
|
return true;
|
|
356
355
|
}
|
|
357
356
|
return this._readonlyPermissions;
|
|
358
357
|
}
|
|
359
358
|
|
|
360
|
-
/**
|
|
361
|
-
* Tells if user has no write permissions for file in storage
|
|
362
|
-
* It is undefined if we have not yet established websocket connection
|
|
363
|
-
* and do not know if user has write access to a file.
|
|
364
|
-
* @deprecated - use readOnlyInfo
|
|
365
|
-
*/
|
|
366
|
-
public get readonlyPermissions() {
|
|
367
|
-
return this._readonlyPermissions;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
359
|
public get readOnlyInfo(): ReadOnlyInfo {
|
|
371
360
|
const storageOnly = this.connection !== undefined && this.connection instanceof NoDeltaStream;
|
|
372
361
|
if (storageOnly || this._forceReadonly || this._readonlyPermissions === true) {
|
|
@@ -405,6 +394,7 @@ export class DeltaManager
|
|
|
405
394
|
return {
|
|
406
395
|
...common,
|
|
407
396
|
connectionMode: this.connectionMode,
|
|
397
|
+
relayServiceAgent: this.connection.relayServiceAgent,
|
|
408
398
|
};
|
|
409
399
|
} else {
|
|
410
400
|
return {
|
|
@@ -455,15 +445,15 @@ export class DeltaManager
|
|
|
455
445
|
value: readonly,
|
|
456
446
|
});
|
|
457
447
|
}
|
|
458
|
-
const oldValue = this.readonly;
|
|
448
|
+
const oldValue = this.readOnlyInfo.readonly;
|
|
459
449
|
this._forceReadonly = readonly;
|
|
460
450
|
|
|
461
|
-
if (oldValue !== this.readonly) {
|
|
451
|
+
if (oldValue !== this.readOnlyInfo.readonly) {
|
|
462
452
|
assert(this._reconnectMode !== ReconnectMode.Never,
|
|
463
453
|
0x279 /* "API is not supported for non-connecting or closed container" */);
|
|
464
454
|
|
|
465
455
|
let reconnect = false;
|
|
466
|
-
if (this.readonly === true) {
|
|
456
|
+
if (this.readOnlyInfo.readonly === true) {
|
|
467
457
|
// If we switch to readonly while connected, we should disconnect first
|
|
468
458
|
// See comment in the "readonly" event handler to deltaManager set up by
|
|
469
459
|
// the ContainerRuntime constructor
|
|
@@ -476,7 +466,7 @@ export class DeltaManager
|
|
|
476
466
|
|
|
477
467
|
reconnect = this.disconnectFromDeltaStream("Force readonly");
|
|
478
468
|
}
|
|
479
|
-
safeRaiseEvent(this, this.logger, "readonly", this.readonly);
|
|
469
|
+
safeRaiseEvent(this, this.logger, "readonly", this.readOnlyInfo.readonly);
|
|
480
470
|
if (reconnect) {
|
|
481
471
|
// reconnect if we disconnected from before.
|
|
482
472
|
this.triggerConnect({ reason: "forceReadonly", mode: "read", fetchOpsFromStorage: false });
|
|
@@ -508,15 +498,16 @@ export class DeltaManager
|
|
|
508
498
|
pendingOps: this.pending.length, // Do we have any pending ops?
|
|
509
499
|
pendingFirst: pendingSorted[0]?.sequenceNumber, // is the first pending op the one that we are missing?
|
|
510
500
|
haveHandler: this.handler !== undefined, // do we have handler installed?
|
|
511
|
-
|
|
501
|
+
inboundLength: this.inbound.length,
|
|
502
|
+
inboundPaused: this.inbound.paused,
|
|
512
503
|
});
|
|
513
504
|
}
|
|
514
505
|
|
|
515
506
|
private set_readonlyPermissions(readonly: boolean) {
|
|
516
|
-
const oldValue = this.readonly;
|
|
507
|
+
const oldValue = this.readOnlyInfo.readonly;
|
|
517
508
|
this._readonlyPermissions = readonly;
|
|
518
|
-
if (oldValue !== this.readonly) {
|
|
519
|
-
safeRaiseEvent(this, this.logger, "readonly", this.readonly);
|
|
509
|
+
if (oldValue !== this.readOnlyInfo.readonly) {
|
|
510
|
+
safeRaiseEvent(this, this.logger, "readonly", this.readOnlyInfo.readonly);
|
|
520
511
|
}
|
|
521
512
|
}
|
|
522
513
|
|
|
@@ -715,9 +706,7 @@ export class DeltaManager
|
|
|
715
706
|
}
|
|
716
707
|
|
|
717
708
|
const docService = this.serviceProvider();
|
|
718
|
-
|
|
719
|
-
throw new Error("Container is not attached");
|
|
720
|
-
}
|
|
709
|
+
assert(docService !== undefined, 0x2a7 /* "Container is not attached" */);
|
|
721
710
|
|
|
722
711
|
if (docService.policies?.storageOnly === true) {
|
|
723
712
|
const connection = new NoDeltaStream();
|
|
@@ -732,6 +721,7 @@ export class DeltaManager
|
|
|
732
721
|
let delayMs = InitialReconnectDelayInMs;
|
|
733
722
|
let connectRepeatCount = 0;
|
|
734
723
|
const connectStartTime = performance.now();
|
|
724
|
+
let lastError: any;
|
|
735
725
|
|
|
736
726
|
// This loop will keep trying to connect until successful, with a delay between each iteration.
|
|
737
727
|
while (connection === undefined) {
|
|
@@ -759,9 +749,8 @@ export class DeltaManager
|
|
|
759
749
|
|
|
760
750
|
// Socket.io error when we connect to wrong socket, or hit some multiplexing bug
|
|
761
751
|
if (!canRetryOnError(origError)) {
|
|
762
|
-
const error = normalizeError(origError);
|
|
752
|
+
const error = normalizeError(origError, { props: fatalConnectErrorProp });
|
|
763
753
|
this.close(error);
|
|
764
|
-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
765
754
|
throw error;
|
|
766
755
|
}
|
|
767
756
|
|
|
@@ -773,10 +762,13 @@ export class DeltaManager
|
|
|
773
762
|
{
|
|
774
763
|
delay: delayMs, // milliseconds
|
|
775
764
|
eventName: "DeltaConnectionFailureToConnect",
|
|
765
|
+
duration: TelemetryLogger.formatTick(performance.now() - connectStartTime),
|
|
776
766
|
},
|
|
777
767
|
origError);
|
|
778
768
|
}
|
|
779
769
|
|
|
770
|
+
lastError = origError;
|
|
771
|
+
|
|
780
772
|
const retryDelayFromError = getRetryDelayFromError(origError);
|
|
781
773
|
delayMs = retryDelayFromError ?? Math.min(delayMs * 2, MaxReconnectDelayInMs);
|
|
782
774
|
|
|
@@ -789,11 +781,14 @@ export class DeltaManager
|
|
|
789
781
|
|
|
790
782
|
// If we retried more than once, log an event about how long it took
|
|
791
783
|
if (connectRepeatCount > 1) {
|
|
792
|
-
this.logger.sendTelemetryEvent(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
784
|
+
this.logger.sendTelemetryEvent(
|
|
785
|
+
{
|
|
786
|
+
eventName: "MultipleDeltaConnectionFailures",
|
|
787
|
+
attempts: connectRepeatCount,
|
|
788
|
+
duration: TelemetryLogger.formatTick(performance.now() - connectStartTime),
|
|
789
|
+
},
|
|
790
|
+
lastError,
|
|
791
|
+
);
|
|
797
792
|
}
|
|
798
793
|
|
|
799
794
|
this.setupNewSuccessfulConnection(connection, requestedMode);
|
|
@@ -813,9 +808,11 @@ export class DeltaManager
|
|
|
813
808
|
const cleanupAndReject = (error) => {
|
|
814
809
|
this.connectionP = undefined;
|
|
815
810
|
this.removeListener("closed", cleanupAndReject);
|
|
811
|
+
|
|
816
812
|
// This error came from some logic error in this file. Fail-fast to learn and fix the issue faster
|
|
817
|
-
|
|
818
|
-
|
|
813
|
+
const normalizedError = normalizeError(error, { props: fatalConnectErrorProp });
|
|
814
|
+
this.close(normalizedError);
|
|
815
|
+
deferred.reject(normalizedError);
|
|
819
816
|
};
|
|
820
817
|
this.on("closed", cleanupAndReject);
|
|
821
818
|
|
|
@@ -853,7 +850,7 @@ export class DeltaManager
|
|
|
853
850
|
// const serializedContent = JSON.stringify(this.messageBuffer);
|
|
854
851
|
// const maxOpSize = this.context.deltaManager.maxMessageSize;
|
|
855
852
|
|
|
856
|
-
if (this.readonly === true) {
|
|
853
|
+
if (this.readOnlyInfo.readonly === true) {
|
|
857
854
|
assert(this.readOnlyInfo.readonly === true, 0x1f0 /* "Unexpected mismatch in readonly" */);
|
|
858
855
|
const error = new GenericError("deltaManagerReadonlySubmit", undefined /* error */, {
|
|
859
856
|
readonly: this.readOnlyInfo.readonly,
|
|
@@ -881,7 +878,7 @@ export class DeltaManager
|
|
|
881
878
|
// Note that we also want nacks to be rare and be treated as catastrophic failures.
|
|
882
879
|
// Be careful with reentrancy though - disconnected event should not be be raised in the
|
|
883
880
|
// middle of the current workflow, but rather on clean stack!
|
|
884
|
-
if (this.connectionMode === "read") {
|
|
881
|
+
if (this.connectionMode === "read" || this.downgradedConnection) {
|
|
885
882
|
if (!this.pendingReconnect) {
|
|
886
883
|
this.pendingReconnect = true;
|
|
887
884
|
Promise.resolve().then(async () => {
|
|
@@ -1020,7 +1017,8 @@ export class DeltaManager
|
|
|
1020
1017
|
from, // inclusive
|
|
1021
1018
|
to, // exclusive
|
|
1022
1019
|
controller.signal,
|
|
1023
|
-
cacheOnly
|
|
1020
|
+
cacheOnly,
|
|
1021
|
+
this.fetchReason);
|
|
1024
1022
|
|
|
1025
1023
|
// eslint-disable-next-line no-constant-condition
|
|
1026
1024
|
while (true) {
|
|
@@ -1055,8 +1053,12 @@ export class DeltaManager
|
|
|
1055
1053
|
|
|
1056
1054
|
this.closeAbortController.abort();
|
|
1057
1055
|
|
|
1056
|
+
const disconnectReason = error !== undefined
|
|
1057
|
+
? `Closing DeltaManager (${error.message})`
|
|
1058
|
+
: "Closing DeltaManager";
|
|
1059
|
+
|
|
1058
1060
|
// This raises "disconnect" event if we have active connection.
|
|
1059
|
-
this.disconnectFromDeltaStream(
|
|
1061
|
+
this.disconnectFromDeltaStream(disconnectReason);
|
|
1060
1062
|
|
|
1061
1063
|
this._inbound.clear();
|
|
1062
1064
|
this._outbound.clear();
|
|
@@ -1154,10 +1156,6 @@ export class DeltaManager
|
|
|
1154
1156
|
};
|
|
1155
1157
|
|
|
1156
1158
|
private readonly errorHandler = (error) => {
|
|
1157
|
-
// Observation based on early pre-production telemetry:
|
|
1158
|
-
// We are getting transport errors from WebSocket here, right before or after "disconnect".
|
|
1159
|
-
// This happens only in Firefox.
|
|
1160
|
-
logNetworkFailure(this.logger, { eventName: "DeltaConnectionError" }, error);
|
|
1161
1159
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1162
1160
|
this.reconnectOnError(
|
|
1163
1161
|
this.defaultReconnectionMode,
|
|
@@ -1201,7 +1199,7 @@ export class DeltaManager
|
|
|
1201
1199
|
|
|
1202
1200
|
if (this.closed) {
|
|
1203
1201
|
// Raise proper events, Log telemetry event and close connection.
|
|
1204
|
-
this.disconnectFromDeltaStream(
|
|
1202
|
+
this.disconnectFromDeltaStream("DeltaManager already closed");
|
|
1205
1203
|
return;
|
|
1206
1204
|
}
|
|
1207
1205
|
|
|
@@ -1233,6 +1231,9 @@ export class DeltaManager
|
|
|
1233
1231
|
clientId: connection.clientId,
|
|
1234
1232
|
mode: connection.mode,
|
|
1235
1233
|
};
|
|
1234
|
+
if (connection.relayServiceAgent !== undefined) {
|
|
1235
|
+
this.connectionStateProps.relayServiceAgent = connection.relayServiceAgent;
|
|
1236
|
+
}
|
|
1236
1237
|
this._hasCheckpointSequenceNumber = false;
|
|
1237
1238
|
|
|
1238
1239
|
// Some storages may provide checkpointSequenceNumber to identify how far client is behind.
|
|
@@ -1322,14 +1323,7 @@ export class DeltaManager
|
|
|
1322
1323
|
this._outbound.clear();
|
|
1323
1324
|
this.emit("disconnect", reason);
|
|
1324
1325
|
|
|
1325
|
-
|
|
1326
|
-
const disposable = connection as Partial<IDisposable>;
|
|
1327
|
-
|
|
1328
|
-
if (disposable.dispose !== undefined) {
|
|
1329
|
-
disposable.dispose();
|
|
1330
|
-
} else {
|
|
1331
|
-
connection.close();
|
|
1332
|
-
}
|
|
1326
|
+
connection.dispose();
|
|
1333
1327
|
|
|
1334
1328
|
this.connectionStateProps = {};
|
|
1335
1329
|
|
|
@@ -1375,11 +1369,13 @@ export class DeltaManager
|
|
|
1375
1369
|
const canRetry = error !== undefined ? canRetryOnError(error) : true;
|
|
1376
1370
|
|
|
1377
1371
|
// If reconnection is not an option, close the DeltaManager
|
|
1378
|
-
if (
|
|
1372
|
+
if (!canRetry) {
|
|
1373
|
+
this.close(normalizeError(error, { props: fatalConnectErrorProp }));
|
|
1374
|
+
} else if (this.reconnectMode === ReconnectMode.Never) {
|
|
1379
1375
|
// Do not raise container error if we are closing just because we lost connection.
|
|
1380
1376
|
// Those errors (like IdleDisconnect) would show up in telemetry dashboards and
|
|
1381
1377
|
// are very misleading, as first initial reaction - some logic is broken.
|
|
1382
|
-
this.close(
|
|
1378
|
+
this.close();
|
|
1383
1379
|
}
|
|
1384
1380
|
|
|
1385
1381
|
// If closed then we can't reconnect
|
|
@@ -1587,8 +1583,6 @@ export class DeltaManager
|
|
|
1587
1583
|
// We have been kicked out from quorum
|
|
1588
1584
|
this.logger.sendPerformanceEvent({ eventName: "ReadConnectionTransition" });
|
|
1589
1585
|
this.downgradedConnection = true;
|
|
1590
|
-
assert(this.connectionMode === "read",
|
|
1591
|
-
0x27c /* "effective connectionMode should be 'read' after downgrade" */);
|
|
1592
1586
|
}
|
|
1593
1587
|
}
|
|
1594
1588
|
|
package/src/deltaQueue.ts
CHANGED
|
@@ -7,7 +7,16 @@ import { IDeltaQueue, IDeltaQueueEvents } from "@fluidframework/container-defini
|
|
|
7
7
|
import { assert, performance, Deferred, TypedEventEmitter } from "@fluidframework/common-utils";
|
|
8
8
|
import Deque from "double-ended-queue";
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export interface IDeltaQueueWriter<T>
|
|
11
|
+
{
|
|
12
|
+
push(task: T): void;
|
|
13
|
+
clear(): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class DeltaQueue<T>
|
|
17
|
+
extends TypedEventEmitter<IDeltaQueueEvents<T>>
|
|
18
|
+
implements IDeltaQueue<T>, IDeltaQueueWriter<T>
|
|
19
|
+
{
|
|
11
20
|
private isDisposed: boolean = false;
|
|
12
21
|
private readonly q = new Deque<T>();
|
|
13
22
|
|
package/src/loader.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import { v4 as uuid } from "uuid";
|
|
7
7
|
import { ITelemetryBaseLogger, ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
8
|
import {
|
|
9
|
+
FluidObject,
|
|
9
10
|
IFluidCodeDetails,
|
|
10
|
-
IFluidObject,
|
|
11
11
|
IFluidRouter,
|
|
12
12
|
IProvideFluidCodeDetailsComparer,
|
|
13
13
|
IRequest,
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
} from "@fluidframework/driver-utils";
|
|
42
42
|
import { Container } from "./container";
|
|
43
43
|
import { IParsedUrl, parseUrl } from "./utils";
|
|
44
|
+
import { pkgVersion } from "./packageVersion";
|
|
44
45
|
|
|
45
46
|
function canUseCache(request: IRequest): boolean {
|
|
46
47
|
if (request.headers === undefined) {
|
|
@@ -124,32 +125,37 @@ export interface ILoaderOptions extends ILoaderOptions1{
|
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
/**
|
|
128
|
+
* @deprecated IFluidModuleWithDetails interface is moved to
|
|
129
|
+
* {@link @fluidframework/container-definition#IFluidModuleWithDetails}
|
|
130
|
+
* to have all the code loading modules in one package. #8193
|
|
127
131
|
* Encapsulates a module entry point with corresponding code details.
|
|
128
132
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
export interface IFluidModuleWithDetails {
|
|
134
|
+
/** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
|
|
135
|
+
module: IFluidModule;
|
|
136
|
+
/**
|
|
137
|
+
* Code details associated with the module. Represents a document schema this module supports.
|
|
138
|
+
* If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
|
|
139
|
+
* it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
|
|
140
|
+
*/
|
|
141
|
+
details: IFluidCodeDetails;
|
|
142
|
+
}
|
|
139
143
|
|
|
140
144
|
/**
|
|
145
|
+
* @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definition#ICodeDetailsLoader}
|
|
146
|
+
* to have code loading modules in one package. #8193
|
|
141
147
|
* Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
|
|
142
148
|
* a package name and package version range.
|
|
143
149
|
*/
|
|
144
150
|
export interface ICodeDetailsLoader
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
extends Partial<IProvideFluidCodeDetailsComparer> {
|
|
152
|
+
/**
|
|
153
|
+
* Load the code module (package) that is capable to interact with the document.
|
|
154
|
+
*
|
|
155
|
+
* @param source - Code proposal that articulates the current schema the document is written in.
|
|
156
|
+
* @returns - Code module entry point along with the code details associated with it.
|
|
157
|
+
*/
|
|
158
|
+
load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
/**
|
|
@@ -184,7 +190,7 @@ export interface ILoaderProps {
|
|
|
184
190
|
* Scope is provided to all container and is a set of shared
|
|
185
191
|
* services for container's to integrate with their host environment.
|
|
186
192
|
*/
|
|
187
|
-
readonly scope?:
|
|
193
|
+
readonly scope?: FluidObject;
|
|
188
194
|
|
|
189
195
|
/**
|
|
190
196
|
* Proxy loader factories for loading containers via proxy in other contexts,
|
|
@@ -235,7 +241,7 @@ export interface ILoaderServices {
|
|
|
235
241
|
* Scope is provided to all container and is a set of shared
|
|
236
242
|
* services for container's to integrate with their host environment.
|
|
237
243
|
*/
|
|
238
|
-
readonly scope:
|
|
244
|
+
readonly scope: FluidObject;
|
|
239
245
|
|
|
240
246
|
/**
|
|
241
247
|
* Proxy loader factories for loading containers via proxy in other contexts,
|
|
@@ -275,18 +281,21 @@ export class Loader implements IHostLoader {
|
|
|
275
281
|
private readonly logger: ITelemetryLogger;
|
|
276
282
|
|
|
277
283
|
constructor(loaderProps: ILoaderProps) {
|
|
278
|
-
const scope = { ...loaderProps.scope };
|
|
284
|
+
const scope = { ...loaderProps.scope as FluidObject<ILoader> };
|
|
279
285
|
if (loaderProps.options?.provideScopeLoader !== false) {
|
|
280
286
|
scope.ILoader = this;
|
|
281
287
|
}
|
|
282
|
-
|
|
288
|
+
const telemetryProps = {
|
|
289
|
+
loaderId: uuid(),
|
|
290
|
+
loaderVersion: pkgVersion,
|
|
291
|
+
};
|
|
283
292
|
this.services = {
|
|
284
293
|
urlResolver: createCachedResolver(MultiUrlResolver.create(loaderProps.urlResolver)),
|
|
285
294
|
documentServiceFactory: MultiDocumentServiceFactory.create(loaderProps.documentServiceFactory),
|
|
286
295
|
codeLoader: loaderProps.codeLoader,
|
|
287
296
|
options: loaderProps.options ?? {},
|
|
288
297
|
scope,
|
|
289
|
-
subLogger: DebugLogger.mixinDebugLogger("fluid:telemetry", loaderProps.logger, { all:
|
|
298
|
+
subLogger: DebugLogger.mixinDebugLogger("fluid:telemetry", loaderProps.logger, { all: telemetryProps }),
|
|
290
299
|
proxyLoaderFactories: loaderProps.proxyLoaderFactories ?? new Map<string, IProxyLoaderFactory>(),
|
|
291
300
|
detachedBlobStorage: loaderProps.detachedBlobStorage,
|
|
292
301
|
};
|
package/src/packageVersion.ts
CHANGED