@fluidframework/container-loader 2.0.0-dev.4.1.0.148229 → 2.0.0-dev.4.2.0.153917
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/CHANGELOG.md +14 -0
- package/README.md +38 -0
- package/dist/connectionManager.d.ts +2 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +16 -6
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.js +2 -2
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +12 -16
- package/dist/container.js.map +1 -1
- package/dist/deltaManager.d.ts +1 -3
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +3 -8
- package/dist/deltaManager.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +4 -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/dist/protocol.d.ts +1 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +4 -2
- package/dist/protocol.js.map +1 -1
- package/lib/connectionManager.d.ts +2 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +16 -6
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.js +2 -2
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +13 -17
- package/lib/container.js.map +1 -1
- package/lib/deltaManager.d.ts +1 -3
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +3 -8
- package/lib/deltaManager.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +4 -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/lib/protocol.d.ts +1 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +3 -1
- package/lib/protocol.js.map +1 -1
- package/package.json +11 -11
- package/src/connectionManager.ts +17 -7
- package/src/connectionStateHandler.ts +2 -2
- package/src/container.ts +18 -24
- package/src/deltaManager.ts +3 -10
- package/src/index.ts +1 -0
- package/src/loader.ts +4 -1
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +4 -1
package/lib/container.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line import/no-internal-modules
|
|
6
6
|
import merge from "lodash/merge";
|
|
7
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
8
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
7
9
|
import { v4 as uuid } from "uuid";
|
|
8
10
|
import { assert, performance, unreachableCase } from "@fluidframework/common-utils";
|
|
9
11
|
import { AttachState, isFluidCodeDetails, } from "@fluidframework/container-definitions";
|
|
@@ -25,7 +27,7 @@ import { initQuorumValuesFromCodeDetails, getCodeDetailsFromQuorumValues, Quorum
|
|
|
25
27
|
import { CollabWindowTracker } from "./collabWindowTracker";
|
|
26
28
|
import { ConnectionManager } from "./connectionManager";
|
|
27
29
|
import { ConnectionState } from "./connectionState";
|
|
28
|
-
import { ProtocolHandler } from "./protocol";
|
|
30
|
+
import { OnlyValidTermValue, ProtocolHandler, } from "./protocol";
|
|
29
31
|
const detachedContainerRefSeqNumber = 0;
|
|
30
32
|
const dirtyContainerEvent = "dirty";
|
|
31
33
|
const savedContainerEvent = "saved";
|
|
@@ -208,7 +210,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
208
210
|
});
|
|
209
211
|
// Prefix all events in this file with container-loader
|
|
210
212
|
this.mc = loggerToMonitoringContext(ChildLogger.create(this.subLogger, "Container"));
|
|
211
|
-
this.options =
|
|
213
|
+
this.options = cloneDeep(this.loader.services.options);
|
|
212
214
|
this._deltaManager = this.createDeltaManager();
|
|
213
215
|
this.connectionStateHandler = createConnectionStateHandler({
|
|
214
216
|
logger: this.mc.logger,
|
|
@@ -623,16 +625,15 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
623
625
|
assert(this.attachState === AttachState.Attached, 0x0d1 /* "Container should be attached before close" */);
|
|
624
626
|
assert(this.resolvedUrl !== undefined && this.resolvedUrl.type === "fluid", 0x0d2 /* "resolved url should be valid Fluid url" */);
|
|
625
627
|
assert(!!this._protocolHandler, 0x2e3 /* "Must have a valid protocol handler instance" */);
|
|
626
|
-
assert(this.
|
|
627
|
-
assert(!!this.
|
|
628
|
-
assert(!!this.baseSnapshotBlobs, "no snapshot blobs");
|
|
628
|
+
assert(!!this.baseSnapshot, 0x5d4 /* no base snapshot */);
|
|
629
|
+
assert(!!this.baseSnapshotBlobs, 0x5d5 /* no snapshot blobs */);
|
|
629
630
|
const pendingState = {
|
|
630
631
|
pendingRuntimeState: this.context.getPendingLocalState(),
|
|
631
632
|
baseSnapshot: this.baseSnapshot,
|
|
632
633
|
snapshotBlobs: this.baseSnapshotBlobs,
|
|
633
634
|
savedOps: this.savedOps,
|
|
634
635
|
url: this.resolvedUrl.url,
|
|
635
|
-
term:
|
|
636
|
+
term: OnlyValidTermValue,
|
|
636
637
|
clientId: this.clientId,
|
|
637
638
|
};
|
|
638
639
|
this.mc.logger.sendTelemetryEvent({ eventName: "CloseAndGetPendingLocalState" });
|
|
@@ -980,7 +981,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
980
981
|
}
|
|
981
982
|
pendingLocalState.savedOps = [];
|
|
982
983
|
// now set clientId to stashed clientId so live ops are correctly processed as local
|
|
983
|
-
assert(this.clientId === undefined,
|
|
984
|
+
assert(this.clientId === undefined, 0x5d6 /* Unexpected clientId when setting stashed clientId */);
|
|
984
985
|
this._clientId = pendingLocalState === null || pendingLocalState === void 0 ? void 0 : pendingLocalState.clientId;
|
|
985
986
|
}
|
|
986
987
|
// We might have hit some failure that did not manifest itself in exception in this flow,
|
|
@@ -1032,7 +1033,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1032
1033
|
async createDetached(source) {
|
|
1033
1034
|
const attributes = {
|
|
1034
1035
|
sequenceNumber: detachedContainerRefSeqNumber,
|
|
1035
|
-
term:
|
|
1036
|
+
term: OnlyValidTermValue,
|
|
1036
1037
|
minimumSequenceNumber: 0,
|
|
1037
1038
|
};
|
|
1038
1039
|
await this.attachDeltaManagerOpHandler(attributes);
|
|
@@ -1075,7 +1076,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1075
1076
|
return {
|
|
1076
1077
|
minimumSequenceNumber: 0,
|
|
1077
1078
|
sequenceNumber: 0,
|
|
1078
|
-
term:
|
|
1079
|
+
term: OnlyValidTermValue,
|
|
1079
1080
|
};
|
|
1080
1081
|
}
|
|
1081
1082
|
// Backward compatibility: old docs would have ".attributes" instead of "attributes"
|
|
@@ -1083,10 +1084,6 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1083
1084
|
? tree.trees[".protocol"].blobs.attributes
|
|
1084
1085
|
: tree.blobs[".attributes"];
|
|
1085
1086
|
const attributes = await readAndParse(storage, attributesHash);
|
|
1086
|
-
// Backward compatibility for older summaries with no term
|
|
1087
|
-
if (attributes.term === undefined) {
|
|
1088
|
-
attributes.term = 1;
|
|
1089
|
-
}
|
|
1090
1087
|
return attributes;
|
|
1091
1088
|
}
|
|
1092
1089
|
async initializeProtocolStateFromSnapshot(attributes, storage, snapshot) {
|
|
@@ -1206,7 +1203,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1206
1203
|
}
|
|
1207
1204
|
createDeltaManager() {
|
|
1208
1205
|
const serviceProvider = () => this.service;
|
|
1209
|
-
const deltaManager = new DeltaManager(serviceProvider, ChildLogger.create(this.subLogger, "DeltaManager"), () => this.activeConnection(), (props) => new ConnectionManager(serviceProvider, this.client, this._canReconnect, ChildLogger.create(this.subLogger, "ConnectionManager"), props));
|
|
1206
|
+
const deltaManager = new DeltaManager(serviceProvider, ChildLogger.create(this.subLogger, "DeltaManager"), () => this.activeConnection(), (props) => new ConnectionManager(serviceProvider, () => this.isDirty, this.client, this._canReconnect, ChildLogger.create(this.subLogger, "ConnectionManager"), props));
|
|
1210
1207
|
// Disable inbound queues as Container is not ready to accept any ops until we are fully loaded!
|
|
1211
1208
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1212
1209
|
deltaManager.inbound.pause();
|
|
@@ -1245,8 +1242,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1245
1242
|
return deltaManager;
|
|
1246
1243
|
}
|
|
1247
1244
|
async attachDeltaManagerOpHandler(attributes, prefetchType) {
|
|
1248
|
-
|
|
1249
|
-
return this._deltaManager.attachOpHandler(attributes.minimumSequenceNumber, attributes.sequenceNumber, (_a = attributes.term) !== null && _a !== void 0 ? _a : 1, {
|
|
1245
|
+
return this._deltaManager.attachOpHandler(attributes.minimumSequenceNumber, attributes.sequenceNumber, {
|
|
1250
1246
|
process: (message) => this.processRemoteMessage(message),
|
|
1251
1247
|
processSignal: (message) => {
|
|
1252
1248
|
this.processSignal(message);
|
|
@@ -1309,7 +1305,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1309
1305
|
this.messageCountAfterDisconnection = 0;
|
|
1310
1306
|
}
|
|
1311
1307
|
// Both protocol and context should not be undefined if we got so far.
|
|
1312
|
-
this.setContextConnectedState(state, (_a = this.
|
|
1308
|
+
this.setContextConnectedState(state, (_a = this.readOnlyInfo.readonly) !== null && _a !== void 0 ? _a : false);
|
|
1313
1309
|
this.protocolHandler.setConnectionState(state, this.clientId);
|
|
1314
1310
|
raiseConnectedEvent(this.mc.logger, this, state, this.clientId, disconnectedReason);
|
|
1315
1311
|
if (logOpsOnReconnect) {
|