@fluidframework/container-loader 0.54.0-47413 → 0.55.0-48551
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/.eslintrc.js +1 -1
- package/dist/container.d.ts +3 -2
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +43 -38
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +5 -1
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +8 -3
- package/dist/containerContext.js.map +1 -1
- package/dist/loader.d.ts +3 -3
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/container.d.ts +3 -2
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +44 -39
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +5 -1
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +8 -3
- package/lib/containerContext.js.map +1 -1
- package/lib/loader.d.ts +3 -3
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +17 -16
- package/src/container.ts +55 -41
- package/src/containerContext.ts +11 -3
- package/src/loader.ts +3 -3
- package/src/packageVersion.ts +1 -1
package/.eslintrc.js
CHANGED
package/dist/container.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
78
78
|
static rehydrateDetachedFromSnapshot(loader: Loader, snapshot: string): Promise<Container>;
|
|
79
79
|
subLogger: TelemetryLogger;
|
|
80
80
|
private readonly _canReconnect;
|
|
81
|
-
private readonly
|
|
81
|
+
private readonly mc;
|
|
82
82
|
private _lifecycleState;
|
|
83
83
|
private get loaded();
|
|
84
84
|
private set loaded(value);
|
|
@@ -106,6 +106,7 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
106
106
|
private attachStarted;
|
|
107
107
|
private _dirtyContainer;
|
|
108
108
|
private lastVisible;
|
|
109
|
+
private readonly visibilityEventHandler;
|
|
109
110
|
private readonly connectionStateHandler;
|
|
110
111
|
private setAutoReconnectTime;
|
|
111
112
|
private readonly collabWindowTracker;
|
|
@@ -168,7 +169,7 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
168
169
|
get isDirty(): boolean;
|
|
169
170
|
private get serviceFactory();
|
|
170
171
|
private get urlResolver();
|
|
171
|
-
|
|
172
|
+
readonly options: ILoaderOptions;
|
|
172
173
|
private get scope();
|
|
173
174
|
private get codeLoader();
|
|
174
175
|
constructor(loader: Loader, config: IContainerConfig);
|
package/dist/container.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACH,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,iBAAiB,EAEpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS,EAET,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,WAAW,EAGX,YAAY,EACZ,kBAAkB,EACrB,MAAM,uCAAuC,CAAC;AAO/C,OAAO,EAEH,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAc5C,OAAO,EAGH,oBAAoB,EACpB,cAAc,EAGd,gBAAgB,EAEhB,OAAO,EAEP,yBAAyB,EAOzB,QAAQ,EAQX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEH,6BAA6B,EAG7B,eAAe,EAMlB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,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;CAG5B"}
|
package/dist/container.js
CHANGED
|
@@ -111,9 +111,9 @@ const getCodeProposal =
|
|
|
111
111
|
(quorum) => { var _a; return (_a = quorum.get("code")) !== null && _a !== void 0 ? _a : quorum.get("code2"); };
|
|
112
112
|
class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
113
113
|
constructor(loader, config) {
|
|
114
|
-
var _a, _b;
|
|
114
|
+
var _a, _b, _c;
|
|
115
115
|
super((name, error) => {
|
|
116
|
-
this.logger.sendErrorEvent({
|
|
116
|
+
this.mc.logger.sendErrorEvent({
|
|
117
117
|
eventName: "ContainerEventHandlerException",
|
|
118
118
|
name: typeof name === "string" ? name : undefined,
|
|
119
119
|
}, error);
|
|
@@ -154,7 +154,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
154
154
|
containerLifecycleState: () => this._lifecycleState,
|
|
155
155
|
containerConnectionState: () => ConnectionState[this.connectionState],
|
|
156
156
|
},
|
|
157
|
-
// we need to be judicious with our logging here to avoid
|
|
157
|
+
// we need to be judicious with our logging here to avoid generating too much data
|
|
158
158
|
// all data logged here should be broadly applicable, and not specific to a
|
|
159
159
|
// specific error or class of errors
|
|
160
160
|
error: {
|
|
@@ -167,12 +167,13 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
167
167
|
dmLastMsqSeqNumber: () => { var _a, _b; return (_b = (_a = this.deltaManager) === null || _a === void 0 ? void 0 : _a.lastMessage) === null || _b === void 0 ? void 0 : _b.sequenceNumber; },
|
|
168
168
|
dmLastMsqSeqTimestamp: () => { var _a, _b; return (_b = (_a = this.deltaManager) === null || _a === void 0 ? void 0 : _a.lastMessage) === null || _b === void 0 ? void 0 : _b.timestamp; },
|
|
169
169
|
dmLastMsqSeqClientId: () => { var _a, _b; return (_b = (_a = this.deltaManager) === null || _a === void 0 ? void 0 : _a.lastMessage) === null || _b === void 0 ? void 0 : _b.clientId; },
|
|
170
|
-
connectionState: () => ConnectionState[this.connectionState],
|
|
171
170
|
connectionStateDuration: () => common_utils_1.performance.now() - this.connectionTransitionTimes[this.connectionState],
|
|
172
171
|
},
|
|
173
172
|
});
|
|
174
173
|
// Prefix all events in this file with container-loader
|
|
175
|
-
this.
|
|
174
|
+
this.mc = telemetry_utils_1.loggerToMonitoringContext(telemetry_utils_1.ChildLogger.create(this.subLogger, "Container"));
|
|
175
|
+
const summarizeProtocolTree = (_c = this.mc.config.getBoolean("Fluid.Container.summarizeProtocolTree")) !== null && _c !== void 0 ? _c : this.loader.services.options.summarizeProtocolTree;
|
|
176
|
+
this.options = Object.assign(Object.assign({}, this.loader.services.options), { summarizeProtocolTree });
|
|
176
177
|
this.connectionStateHandler = new connectionStateHandler_1.ConnectionStateHandler({
|
|
177
178
|
protocolHandler: () => this._protocolHandler,
|
|
178
179
|
logConnectionStateChangeTelemetry: (value, oldState, reason) => this.logConnectionStateChangeTelemetry(value, oldState, reason),
|
|
@@ -191,14 +192,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
191
192
|
this.propagateConnectionState();
|
|
192
193
|
}
|
|
193
194
|
},
|
|
194
|
-
}, this.logger);
|
|
195
|
+
}, this.mc.logger);
|
|
195
196
|
this._deltaManager = this.createDeltaManager();
|
|
196
197
|
this._storage = new containerStorageAdapter_1.ContainerStorageAdapter(() => {
|
|
197
198
|
if (this.attachState !== container_definitions_1.AttachState.Attached) {
|
|
198
199
|
if (this.loader.services.detachedBlobStorage !== undefined) {
|
|
199
|
-
return new containerStorageAdapter_1.BlobOnlyStorage(this.loader.services.detachedBlobStorage, this.logger);
|
|
200
|
+
return new containerStorageAdapter_1.BlobOnlyStorage(this.loader.services.detachedBlobStorage, this.mc.logger);
|
|
200
201
|
}
|
|
201
|
-
this.logger.sendErrorEvent({
|
|
202
|
+
this.mc.logger.sendErrorEvent({
|
|
202
203
|
eventName: "NoRealStorageInDetachedContainer",
|
|
203
204
|
});
|
|
204
205
|
throw new Error("Real storage calls not allowed in Unattached container");
|
|
@@ -212,7 +213,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
212
213
|
// keep track of last time page was visible for telemetry
|
|
213
214
|
if (isDomAvailable) {
|
|
214
215
|
this.lastVisible = document.hidden ? common_utils_1.performance.now() : undefined;
|
|
215
|
-
|
|
216
|
+
this.visibilityEventHandler = () => {
|
|
216
217
|
if (document.hidden) {
|
|
217
218
|
this.lastVisible = common_utils_1.performance.now();
|
|
218
219
|
}
|
|
@@ -220,7 +221,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
220
221
|
// settimeout so this will hopefully fire after disconnect event if being hidden caused it
|
|
221
222
|
setTimeout(() => this.lastVisible = undefined, 0);
|
|
222
223
|
}
|
|
223
|
-
}
|
|
224
|
+
};
|
|
225
|
+
document.addEventListener("visibilitychange", this.visibilityEventHandler);
|
|
224
226
|
}
|
|
225
227
|
// We observed that most users of platform do not check Container.connected event on load, causing bugs.
|
|
226
228
|
// As such, we are raising events when new listener pops up.
|
|
@@ -253,7 +255,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
253
255
|
default:
|
|
254
256
|
}
|
|
255
257
|
}).catch((error) => {
|
|
256
|
-
this.logger.sendErrorEvent({ eventName: "RaiseConnectedEventError" }, error);
|
|
258
|
+
this.mc.logger.sendErrorEvent({ eventName: "RaiseConnectedEventError" }, error);
|
|
257
259
|
});
|
|
258
260
|
});
|
|
259
261
|
}
|
|
@@ -266,7 +268,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
266
268
|
resolvedUrl: loadOptions.resolvedUrl,
|
|
267
269
|
canReconnect: loadOptions.canReconnect,
|
|
268
270
|
});
|
|
269
|
-
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.logger, { eventName: "Load" }, async (event) => new Promise((
|
|
271
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
|
|
270
272
|
var _a;
|
|
271
273
|
container._lifecycleState = "loading";
|
|
272
274
|
const version = loadOptions.version;
|
|
@@ -276,7 +278,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
276
278
|
common_utils_1.assert(pendingLocalState === undefined || loadOptions.loadMode === undefined, 0x1e1 /* "pending state requires immediate connection!" */);
|
|
277
279
|
const mode = (_a = loadOptions.loadMode) !== null && _a !== void 0 ? _a : defaultMode;
|
|
278
280
|
const onClosed = (err) => {
|
|
279
|
-
|
|
281
|
+
reject(err !== null && err !== void 0 ? err : new container_utils_1.GenericError("containerClosedWithoutErrorDuringLoad"));
|
|
280
282
|
};
|
|
281
283
|
container.on("closed", onClosed);
|
|
282
284
|
container.load(version, mode, pendingLocalState)
|
|
@@ -285,7 +287,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
285
287
|
})
|
|
286
288
|
.then((props) => {
|
|
287
289
|
event.end(Object.assign(Object.assign({}, props), loadOptions.loadMode));
|
|
288
|
-
|
|
290
|
+
resolve(container);
|
|
289
291
|
}, (error) => {
|
|
290
292
|
const err = telemetry_utils_1.normalizeError(error);
|
|
291
293
|
// Depending where error happens, we can be attempting to connect to web socket
|
|
@@ -301,7 +303,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
301
303
|
*/
|
|
302
304
|
static async createDetached(loader, codeDetails) {
|
|
303
305
|
const container = new Container(loader, {});
|
|
304
|
-
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.logger, { eventName: "CreateDetached" }, async (_event) => {
|
|
306
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "CreateDetached" }, async (_event) => {
|
|
305
307
|
container._lifecycleState = "loading";
|
|
306
308
|
await container.createDetached(codeDetails);
|
|
307
309
|
return container;
|
|
@@ -313,7 +315,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
313
315
|
*/
|
|
314
316
|
static async rehydrateDetachedFromSnapshot(loader, snapshot) {
|
|
315
317
|
const container = new Container(loader, {});
|
|
316
|
-
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
|
|
318
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
|
|
317
319
|
const deserializedSummary = JSON.parse(snapshot);
|
|
318
320
|
container._lifecycleState = "loading";
|
|
319
321
|
await container.rehydrateDetachedFromSnapshot(deserializedSummary);
|
|
@@ -452,7 +454,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
452
454
|
}
|
|
453
455
|
get serviceFactory() { return this.loader.services.documentServiceFactory; }
|
|
454
456
|
get urlResolver() { return this.loader.services.urlResolver; }
|
|
455
|
-
get options() { return this.loader.services.options; }
|
|
456
457
|
get scope() { return this.loader.services.scope; }
|
|
457
458
|
get codeLoader() { return this.loader.services.codeLoader; }
|
|
458
459
|
/**
|
|
@@ -482,14 +483,17 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
482
483
|
(_d = this.service) === null || _d === void 0 ? void 0 : _d.dispose(error);
|
|
483
484
|
}
|
|
484
485
|
catch (exception) {
|
|
485
|
-
this.logger.sendErrorEvent({ eventName: "ContainerCloseException" }, exception);
|
|
486
|
+
this.mc.logger.sendErrorEvent({ eventName: "ContainerCloseException" }, exception);
|
|
486
487
|
}
|
|
487
|
-
this.logger.sendTelemetryEvent({
|
|
488
|
+
this.mc.logger.sendTelemetryEvent({
|
|
488
489
|
eventName: "ContainerClose",
|
|
489
490
|
category: error === undefined ? "generic" : "error",
|
|
490
491
|
}, error);
|
|
491
492
|
this.emit("closed", error);
|
|
492
493
|
this.removeAllListeners();
|
|
494
|
+
if (this.visibilityEventHandler !== undefined) {
|
|
495
|
+
document.removeEventListener("visibilitychange", this.visibilityEventHandler);
|
|
496
|
+
}
|
|
493
497
|
}
|
|
494
498
|
finally {
|
|
495
499
|
this._lifecycleState = "closed";
|
|
@@ -522,7 +526,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
522
526
|
return JSON.stringify(combinedSummary);
|
|
523
527
|
}
|
|
524
528
|
async attach(request) {
|
|
525
|
-
await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, { eventName: "Attach" }, async () => {
|
|
529
|
+
await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Attach" }, async () => {
|
|
526
530
|
if (this._lifecycleState !== "loaded") {
|
|
527
531
|
throw new container_utils_1.UsageError(`containerNotValidForAttach [${this._lifecycleState}]`);
|
|
528
532
|
}
|
|
@@ -552,7 +556,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
552
556
|
const createNewResolvedUrl = await this.urlResolver.resolve(request);
|
|
553
557
|
driver_utils_1.ensureFluidResolvedUrl(createNewResolvedUrl);
|
|
554
558
|
if (this.service === undefined) {
|
|
555
|
-
this.service = await driver_utils_1.runWithRetry(async () => this.serviceFactory.createContainer(summary, createNewResolvedUrl, this.subLogger), "containerAttach", this.logger, {});
|
|
559
|
+
this.service = await driver_utils_1.runWithRetry(async () => this.serviceFactory.createContainer(summary, createNewResolvedUrl, this.subLogger), "containerAttach", this.mc.logger, {});
|
|
556
560
|
}
|
|
557
561
|
const resolvedUrl = this.service.resolvedUrl;
|
|
558
562
|
driver_utils_1.ensureFluidResolvedUrl(resolvedUrl);
|
|
@@ -606,12 +610,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
606
610
|
}, { start: true, end: true, cancel: "generic" });
|
|
607
611
|
}
|
|
608
612
|
async request(path) {
|
|
609
|
-
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, { eventName: "Request" }, async () => this.context.request(path), { end: true, cancel: "error" });
|
|
613
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Request" }, async () => this.context.request(path), { end: true, cancel: "error" });
|
|
610
614
|
}
|
|
611
615
|
async snapshot(tagMessage, fullTree = false) {
|
|
612
616
|
// Only snapshot once a code quorum has been established
|
|
613
617
|
if (!this.protocolHandler.quorum.has("code") && !this.protocolHandler.quorum.has("code2")) {
|
|
614
|
-
this.logger.sendTelemetryEvent({ eventName: "SkipSnapshot" });
|
|
618
|
+
this.mc.logger.sendTelemetryEvent({ eventName: "SkipSnapshot" });
|
|
615
619
|
return;
|
|
616
620
|
}
|
|
617
621
|
// Stop inbound message processing while we complete the snapshot
|
|
@@ -620,7 +624,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
620
624
|
await this.snapshotCore(tagMessage, fullTree);
|
|
621
625
|
}
|
|
622
626
|
catch (ex) {
|
|
623
|
-
this.logger.sendErrorEvent({ eventName: "SnapshotExceptionError" }, ex);
|
|
627
|
+
this.mc.logger.sendErrorEvent({ eventName: "SnapshotExceptionError" }, ex);
|
|
624
628
|
throw ex;
|
|
625
629
|
}
|
|
626
630
|
finally {
|
|
@@ -639,7 +643,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
639
643
|
const now = common_utils_1.performance.now();
|
|
640
644
|
const duration = now - this.setAutoReconnectTime;
|
|
641
645
|
this.setAutoReconnectTime = now;
|
|
642
|
-
this.logger.sendTelemetryEvent({
|
|
646
|
+
this.mc.logger.sendTelemetryEvent({
|
|
643
647
|
eventName: reconnect ? "AutoReconnectEnabled" : "AutoReconnectDisabled",
|
|
644
648
|
connectionMode: this.connectionMode,
|
|
645
649
|
connectionState: ConnectionState[this.connectionState],
|
|
@@ -701,12 +705,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
701
705
|
throw new Error("Provided codeDetails are not IFluidCodeDetails");
|
|
702
706
|
}
|
|
703
707
|
if (this.codeLoader.IFluidCodeDetailsComparer) {
|
|
704
|
-
const
|
|
705
|
-
if (
|
|
708
|
+
const comparison = await this.codeLoader.IFluidCodeDetailsComparer.compare(codeDetails, this.getCodeDetailsFromQuorum());
|
|
709
|
+
if (comparison !== undefined && comparison <= 0) {
|
|
706
710
|
throw new Error("Proposed code details should be greater than the current");
|
|
707
711
|
}
|
|
708
712
|
}
|
|
709
|
-
return this.
|
|
713
|
+
return this.protocolHandler.quorum.propose("code", codeDetails)
|
|
710
714
|
.then(() => true)
|
|
711
715
|
.catch(() => false);
|
|
712
716
|
}
|
|
@@ -961,8 +965,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
961
965
|
common_utils_1.assert(this.service !== undefined, 0x1ef /* "services must be defined" */);
|
|
962
966
|
const storageService = await this.service.connectToStorage();
|
|
963
967
|
this._storageService =
|
|
964
|
-
new retriableDocumentStorageService_1.RetriableDocumentStorageService(storageService, this.logger);
|
|
968
|
+
new retriableDocumentStorageService_1.RetriableDocumentStorageService(storageService, this.mc.logger);
|
|
965
969
|
if (this.options.summarizeProtocolTree === true) {
|
|
970
|
+
this.mc.logger.sendTelemetryEvent({ eventName: "summarizeProtocolTreeEnabled" });
|
|
966
971
|
this._storageService =
|
|
967
972
|
new protocolTreeDocumentStorageService_1.ProtocolTreeStorageService(this._storageService, () => this.captureProtocolSummary());
|
|
968
973
|
}
|
|
@@ -1024,7 +1029,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1024
1029
|
protocol.quorum.on("approveProposal", (sequenceNumber, key, value) => {
|
|
1025
1030
|
if (key === "code" || key === "code2") {
|
|
1026
1031
|
if (!core_interfaces_1.isFluidCodeDetails(value)) {
|
|
1027
|
-
this.logger.sendErrorEvent({
|
|
1032
|
+
this.mc.logger.sendErrorEvent({
|
|
1028
1033
|
eventName: "CodeProposalNotIFluidCodeDetails",
|
|
1029
1034
|
});
|
|
1030
1035
|
}
|
|
@@ -1178,7 +1183,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1178
1183
|
connectionInitiationReason = "AutoReconnect";
|
|
1179
1184
|
}
|
|
1180
1185
|
}
|
|
1181
|
-
this.logger.sendPerformanceEvent(Object.assign({ eventName: `ConnectionStateChange_${ConnectionState[value]}`, from: ConnectionState[oldState], duration,
|
|
1186
|
+
this.mc.logger.sendPerformanceEvent(Object.assign({ eventName: `ConnectionStateChange_${ConnectionState[value]}`, from: ConnectionState[oldState], duration,
|
|
1182
1187
|
durationFromDisconnected,
|
|
1183
1188
|
reason,
|
|
1184
1189
|
connectionInitiationReason, pendingClientId: this.connectionStateHandler.pendingClientId, clientId: this.clientId, autoReconnect,
|
|
@@ -1201,9 +1206,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1201
1206
|
}
|
|
1202
1207
|
common_utils_1.assert(this.protocolHandler !== undefined, 0x0dc /* "Protocol handler should be set here" */);
|
|
1203
1208
|
this.protocolHandler.quorum.setConnectionState(state, this.clientId);
|
|
1204
|
-
telemetry_utils_1.raiseConnectedEvent(this.logger, this, state, this.clientId);
|
|
1209
|
+
telemetry_utils_1.raiseConnectedEvent(this.mc.logger, this, state, this.clientId);
|
|
1205
1210
|
if (logOpsOnReconnect) {
|
|
1206
|
-
this.logger.sendTelemetryEvent({ eventName: "OpsSentOnReconnect", count: this.messageCountAfterDisconnection });
|
|
1211
|
+
this.mc.logger.sendTelemetryEvent({ eventName: "OpsSentOnReconnect", count: this.messageCountAfterDisconnection });
|
|
1207
1212
|
}
|
|
1208
1213
|
}
|
|
1209
1214
|
submitContainerMessage(type, contents, batch, metadata) {
|
|
@@ -1233,7 +1238,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1233
1238
|
}
|
|
1234
1239
|
submitMessage(type, contents, batch, metadata) {
|
|
1235
1240
|
if (this.connectionState !== ConnectionState.Connected) {
|
|
1236
|
-
this.logger.sendErrorEvent({ eventName: "SubmitMessageWithNoConnection", type });
|
|
1241
|
+
this.mc.logger.sendErrorEvent({ eventName: "SubmitMessageWithNoConnection", type });
|
|
1237
1242
|
return -1;
|
|
1238
1243
|
}
|
|
1239
1244
|
this.messageCountAfterDisconnection += 1;
|
|
@@ -1299,12 +1304,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1299
1304
|
const version = await this.getVersion(specifiedVersion !== null && specifiedVersion !== void 0 ? specifiedVersion : this.id);
|
|
1300
1305
|
if (version === undefined && specifiedVersion !== undefined) {
|
|
1301
1306
|
// We should have a defined version to load from if specified version requested
|
|
1302
|
-
this.logger.sendErrorEvent({ eventName: "NoVersionFoundWhenSpecified", id: specifiedVersion });
|
|
1307
|
+
this.mc.logger.sendErrorEvent({ eventName: "NoVersionFoundWhenSpecified", id: specifiedVersion });
|
|
1303
1308
|
}
|
|
1304
1309
|
this._loadedFromVersion = version;
|
|
1305
1310
|
const snapshot = (_a = await this.storageService.getSnapshotTree(version)) !== null && _a !== void 0 ? _a : undefined;
|
|
1306
1311
|
if (snapshot === undefined && version !== undefined) {
|
|
1307
|
-
this.logger.sendErrorEvent({ eventName: "getSnapshotTreeFailed", id: version.id });
|
|
1312
|
+
this.mc.logger.sendErrorEvent({ eventName: "getSnapshotTreeFailed", id: version.id });
|
|
1308
1313
|
}
|
|
1309
1314
|
return { snapshot, versionId: version === null || version === void 0 ? void 0 : version.id };
|
|
1310
1315
|
}
|
|
@@ -1320,7 +1325,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1320
1325
|
common_utils_1.assert(((_a = this._context) === null || _a === void 0 ? void 0 : _a.disposed) !== false, 0x0dd /* "Existing context not disposed" */);
|
|
1321
1326
|
// If this assert fires, our state tracking is likely not synchronized between COntainer & runtime.
|
|
1322
1327
|
if (this._dirtyContainer) {
|
|
1323
|
-
this.logger.sendErrorEvent({ eventName: "DirtyContainerReloadContainer" });
|
|
1328
|
+
this.mc.logger.sendErrorEvent({ eventName: "DirtyContainerReloadContainer" });
|
|
1324
1329
|
}
|
|
1325
1330
|
// The relative loader will proxy requests to '/' to the loader itself assuming no non-cache flags
|
|
1326
1331
|
// are set. Global requests will still go directly to the loader
|
|
@@ -1334,7 +1339,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1334
1339
|
// Please avoid calling it directly.
|
|
1335
1340
|
// raiseContainerWarning() is the right flow for most cases
|
|
1336
1341
|
logContainerError(warning) {
|
|
1337
|
-
this.logger.sendErrorEvent({ eventName: "ContainerWarning" }, warning);
|
|
1342
|
+
this.mc.logger.sendErrorEvent({ eventName: "ContainerWarning" }, warning);
|
|
1338
1343
|
}
|
|
1339
1344
|
}
|
|
1340
1345
|
exports.Container = Container;
|