@fluidframework/container-loader 0.59.3003 → 0.59.4000-71128

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 (70) hide show
  1. package/dist/collabWindowTracker.d.ts +1 -2
  2. package/dist/collabWindowTracker.d.ts.map +1 -1
  3. package/dist/collabWindowTracker.js +22 -23
  4. package/dist/collabWindowTracker.js.map +1 -1
  5. package/dist/connectionManager.d.ts.map +1 -1
  6. package/dist/connectionManager.js.map +1 -1
  7. package/dist/connectionState.d.ts +19 -0
  8. package/dist/connectionState.d.ts.map +1 -0
  9. package/dist/connectionState.js +23 -0
  10. package/dist/connectionState.js.map +1 -0
  11. package/dist/connectionStateHandler.d.ts +1 -1
  12. package/dist/connectionStateHandler.d.ts.map +1 -1
  13. package/dist/connectionStateHandler.js +12 -12
  14. package/dist/connectionStateHandler.js.map +1 -1
  15. package/dist/container.d.ts +9 -15
  16. package/dist/container.d.ts.map +1 -1
  17. package/dist/container.js +58 -39
  18. package/dist/container.js.map +1 -1
  19. package/dist/contracts.d.ts +1 -0
  20. package/dist/contracts.d.ts.map +1 -1
  21. package/dist/contracts.js.map +1 -1
  22. package/dist/index.d.ts +2 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +2 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/loader.js.map +1 -1
  27. package/dist/packageVersion.d.ts +1 -1
  28. package/dist/packageVersion.d.ts.map +1 -1
  29. package/dist/packageVersion.js +1 -1
  30. package/dist/packageVersion.js.map +1 -1
  31. package/lib/collabWindowTracker.d.ts +1 -2
  32. package/lib/collabWindowTracker.d.ts.map +1 -1
  33. package/lib/collabWindowTracker.js +22 -23
  34. package/lib/collabWindowTracker.js.map +1 -1
  35. package/lib/connectionManager.d.ts.map +1 -1
  36. package/lib/connectionManager.js.map +1 -1
  37. package/lib/connectionState.d.ts +19 -0
  38. package/lib/connectionState.d.ts.map +1 -0
  39. package/lib/connectionState.js +20 -0
  40. package/lib/connectionState.js.map +1 -0
  41. package/lib/connectionStateHandler.d.ts +1 -1
  42. package/lib/connectionStateHandler.d.ts.map +1 -1
  43. package/lib/connectionStateHandler.js +1 -1
  44. package/lib/connectionStateHandler.js.map +1 -1
  45. package/lib/container.d.ts +9 -15
  46. package/lib/container.d.ts.map +1 -1
  47. package/lib/container.js +40 -21
  48. package/lib/container.js.map +1 -1
  49. package/lib/contracts.d.ts +1 -0
  50. package/lib/contracts.d.ts.map +1 -1
  51. package/lib/contracts.js.map +1 -1
  52. package/lib/index.d.ts +2 -1
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +2 -1
  55. package/lib/index.js.map +1 -1
  56. package/lib/loader.js.map +1 -1
  57. package/lib/packageVersion.d.ts +1 -1
  58. package/lib/packageVersion.d.ts.map +1 -1
  59. package/lib/packageVersion.js +1 -1
  60. package/lib/packageVersion.js.map +1 -1
  61. package/package.json +16 -14
  62. package/src/collabWindowTracker.ts +27 -27
  63. package/src/connectionManager.ts +1 -1
  64. package/src/connectionState.ts +21 -0
  65. package/src/connectionStateHandler.ts +1 -1
  66. package/src/container.ts +47 -26
  67. package/src/contracts.ts +2 -0
  68. package/src/index.ts +1 -1
  69. package/src/loader.ts +1 -1
  70. package/src/packageVersion.ts +1 -1
package/lib/container.js CHANGED
@@ -27,24 +27,10 @@ import { getProtocolSnapshotTree, getSnapshotTreeFromSerializedContainer } from
27
27
  import { initQuorumValuesFromCodeDetails, getCodeDetailsFromQuorumValues, QuorumProxy } from "./quorum";
28
28
  import { CollabWindowTracker } from "./collabWindowTracker";
29
29
  import { ConnectionManager } from "./connectionManager";
30
+ import { ConnectionState } from "./connectionState";
30
31
  const detachedContainerRefSeqNumber = 0;
31
32
  const dirtyContainerEvent = "dirty";
32
33
  const savedContainerEvent = "saved";
33
- export var ConnectionState;
34
- (function (ConnectionState) {
35
- /**
36
- * The document is no longer connected to the delta server
37
- */
38
- ConnectionState[ConnectionState["Disconnected"] = 0] = "Disconnected";
39
- /**
40
- * The document has an inbound connection but is still pending for outbound deltas
41
- */
42
- ConnectionState[ConnectionState["Connecting"] = 1] = "Connecting";
43
- /**
44
- * The document is fully connected
45
- */
46
- ConnectionState[ConnectionState["Connected"] = 2] = "Connected";
47
- })(ConnectionState || (ConnectionState = {}));
48
34
  /**
49
35
  * Waits until container connects to delta storage and gets up-to-date
50
36
  * Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being
@@ -114,7 +100,7 @@ const getCodeProposal =
114
100
  const summarizerClientType = "summarizer";
115
101
  export class Container extends EventEmitterWithErrorHandling {
116
102
  constructor(loader, config) {
117
- var _a, _b, _c;
103
+ var _a;
118
104
  super((name, error) => {
119
105
  this.mc.logger.sendErrorEvent({
120
106
  eventName: "ContainerEventHandlerException",
@@ -134,7 +120,6 @@ export class Container extends EventEmitterWithErrorHandling {
134
120
  this.attachStarted = false;
135
121
  this._dirtyContainer = false;
136
122
  this.setAutoReconnectTime = performance.now();
137
- this.collabWindowTracker = new CollabWindowTracker((type, contents) => this.submitMessage(type, contents), () => this.activeConnection(), (_a = this.loader.services.options) === null || _a === void 0 ? void 0 : _a.noopTimeFrequency, (_b = this.loader.services.options) === null || _b === void 0 ? void 0 : _b.noopCountFrequency);
138
123
  this._audience = new Audience();
139
124
  this.clientDetailsOverride = config.clientDetailsOverride;
140
125
  this._resolvedUrl = config.resolvedUrl;
@@ -175,7 +160,7 @@ export class Container extends EventEmitterWithErrorHandling {
175
160
  });
176
161
  // Prefix all events in this file with container-loader
177
162
  this.mc = loggerToMonitoringContext(ChildLogger.create(this.subLogger, "Container"));
178
- const summarizeProtocolTree = (_c = this.mc.config.getBoolean("Fluid.Container.summarizeProtocolTree")) !== null && _c !== void 0 ? _c : this.loader.services.options.summarizeProtocolTree;
163
+ const summarizeProtocolTree = (_a = this.mc.config.getBoolean("Fluid.Container.summarizeProtocolTree")) !== null && _a !== void 0 ? _a : this.loader.services.options.summarizeProtocolTree;
179
164
  this.options = Object.assign(Object.assign({}, this.loader.services.options), { summarizeProtocolTree });
180
165
  this.connectionStateHandler = new ConnectionStateHandler({
181
166
  quorumClients: () => { var _a; return (_a = this._protocolHandler) === null || _a === void 0 ? void 0 : _a.quorum; },
@@ -1069,7 +1054,8 @@ export class Container extends EventEmitterWithErrorHandling {
1069
1054
  this.connectionStateHandler.receivedConnectEvent(this.connectionMode, details);
1070
1055
  });
1071
1056
  deltaManager.on("disconnect", (reason) => {
1072
- this.collabWindowTracker.stopSequenceNumberUpdate();
1057
+ var _a;
1058
+ (_a = this.collabWindowTracker) === null || _a === void 0 ? void 0 : _a.stopSequenceNumberUpdate();
1073
1059
  this.connectionStateHandler.receivedDisconnectEvent(reason);
1074
1060
  });
1075
1061
  deltaManager.on("throttled", (warning) => {
@@ -1183,12 +1169,13 @@ export class Container extends EventEmitterWithErrorHandling {
1183
1169
  return this.submitMessage(type, contents, batch, metadata);
1184
1170
  }
1185
1171
  submitMessage(type, contents, batch, metadata) {
1172
+ var _a;
1186
1173
  if (this.connectionState !== ConnectionState.Connected) {
1187
1174
  this.mc.logger.sendErrorEvent({ eventName: "SubmitMessageWithNoConnection", type });
1188
1175
  return -1;
1189
1176
  }
1190
1177
  this.messageCountAfterDisconnection += 1;
1191
- this.collabWindowTracker.stopSequenceNumberUpdate();
1178
+ (_a = this.collabWindowTracker) === null || _a === void 0 ? void 0 : _a.stopSequenceNumberUpdate();
1192
1179
  return this._deltaManager.submit(type, contents, batch, metadata);
1193
1180
  }
1194
1181
  processRemoteMessage(message) {
@@ -1217,10 +1204,42 @@ export class Container extends EventEmitterWithErrorHandling {
1217
1204
  }
1218
1205
  // Allow the protocol handler to process the message
1219
1206
  const result = this.protocolHandler.processMessage(message, local);
1220
- this.collabWindowTracker.scheduleSequenceNumberUpdate(message, result.immediateNoOp === true);
1207
+ // Inactive (not in quorum or not writers) clients don't take part in the minimum sequence number calculation.
1208
+ if (this.activeConnection()) {
1209
+ if (this.collabWindowTracker === undefined) {
1210
+ // Note that config from first connection will be used for this container's lifetime.
1211
+ // That means that if relay service changes settings, such changes will impact only newly booted
1212
+ // clients.
1213
+ // All existing will continue to use settings they got earlier.
1214
+ const [noopTimeFrequency, noopCountFrequency] = this.getNoopConfig();
1215
+ this.collabWindowTracker = new CollabWindowTracker((type, contents) => {
1216
+ assert(this.activeConnection(), 0x241 /* "disconnect should result in stopSequenceNumberUpdate() call" */);
1217
+ this.submitMessage(type, contents);
1218
+ }, noopTimeFrequency, noopCountFrequency);
1219
+ }
1220
+ this.collabWindowTracker.scheduleSequenceNumberUpdate(message, result.immediateNoOp === true);
1221
+ }
1221
1222
  this.emit("op", message);
1222
1223
  return result;
1223
1224
  }
1225
+ /**
1226
+ * #260 (ADO)
1227
+ * back-compat: noopTimeFrequency & noopCountFrequency properties were added to
1228
+ * IClientConfiguration in 0.59.3000. During the integration, we must read the
1229
+ * available configuration from the loader options.
1230
+ */
1231
+ getNoopConfig() {
1232
+ var _a, _b;
1233
+ assert(this.serviceConfiguration !== undefined, 0x2e2);
1234
+ if (this.serviceConfiguration.noopTimeFrequency !== undefined ||
1235
+ this.serviceConfiguration.noopCountFrequency !== undefined) {
1236
+ return [
1237
+ this.serviceConfiguration.noopTimeFrequency,
1238
+ this.serviceConfiguration.noopCountFrequency,
1239
+ ];
1240
+ }
1241
+ return [(_a = this.loader.services.options) === null || _a === void 0 ? void 0 : _a.noopTimeFrequency, (_b = this.loader.services.options) === null || _b === void 0 ? void 0 : _b.noopCountFrequency];
1242
+ }
1224
1243
  submitSignal(message) {
1225
1244
  this._deltaManager.submitSignal(JSON.stringify(message));
1226
1245
  }