@fluidframework/container-loader 2.0.0-internal.6.3.3 → 2.0.0-internal.7.0.0

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 (93) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/dist/catchUpMonitor.d.ts +2 -2
  3. package/dist/catchUpMonitor.d.ts.map +1 -1
  4. package/dist/connectionManager.d.ts +1 -15
  5. package/dist/connectionManager.d.ts.map +1 -1
  6. package/dist/connectionManager.js +90 -82
  7. package/dist/connectionManager.js.map +1 -1
  8. package/dist/connectionState.js +1 -1
  9. package/dist/connectionState.js.map +1 -1
  10. package/dist/connectionStateHandler.js +9 -9
  11. package/dist/connectionStateHandler.js.map +1 -1
  12. package/dist/container.d.ts +21 -2
  13. package/dist/container.d.ts.map +1 -1
  14. package/dist/container.js +222 -208
  15. package/dist/container.js.map +1 -1
  16. package/dist/containerContext.js +16 -16
  17. package/dist/containerContext.js.map +1 -1
  18. package/dist/containerStorageAdapter.d.ts.map +1 -1
  19. package/dist/containerStorageAdapter.js +6 -8
  20. package/dist/containerStorageAdapter.js.map +1 -1
  21. package/dist/contracts.d.ts +2 -1
  22. package/dist/contracts.d.ts.map +1 -1
  23. package/dist/contracts.js +1 -1
  24. package/dist/contracts.js.map +1 -1
  25. package/dist/debugLogger.d.ts.map +1 -1
  26. package/dist/debugLogger.js +5 -4
  27. package/dist/debugLogger.js.map +1 -1
  28. package/dist/deltaManager.d.ts.map +1 -1
  29. package/dist/deltaManager.js +87 -90
  30. package/dist/deltaManager.js.map +1 -1
  31. package/dist/deltaQueue.js +14 -14
  32. package/dist/deltaQueue.js.map +1 -1
  33. package/dist/loader.d.ts +3 -6
  34. package/dist/loader.d.ts.map +1 -1
  35. package/dist/loader.js +19 -84
  36. package/dist/loader.js.map +1 -1
  37. package/dist/packageVersion.d.ts +1 -1
  38. package/dist/packageVersion.js +1 -1
  39. package/dist/packageVersion.js.map +1 -1
  40. package/dist/protocol.d.ts +1 -2
  41. package/dist/protocol.d.ts.map +1 -1
  42. package/dist/protocol.js +3 -5
  43. package/dist/protocol.js.map +1 -1
  44. package/dist/tsdoc-metadata.json +1 -1
  45. package/lib/catchUpMonitor.d.ts +2 -2
  46. package/lib/catchUpMonitor.d.ts.map +1 -1
  47. package/lib/connectionManager.d.ts +1 -15
  48. package/lib/connectionManager.d.ts.map +1 -1
  49. package/lib/connectionManager.js +93 -83
  50. package/lib/connectionManager.js.map +1 -1
  51. package/lib/connectionStateHandler.js +9 -9
  52. package/lib/connectionStateHandler.js.map +1 -1
  53. package/lib/container.d.ts +21 -2
  54. package/lib/container.d.ts.map +1 -1
  55. package/lib/container.js +223 -209
  56. package/lib/container.js.map +1 -1
  57. package/lib/containerContext.js +16 -16
  58. package/lib/containerContext.js.map +1 -1
  59. package/lib/containerStorageAdapter.d.ts.map +1 -1
  60. package/lib/containerStorageAdapter.js +6 -8
  61. package/lib/containerStorageAdapter.js.map +1 -1
  62. package/lib/contracts.d.ts +2 -1
  63. package/lib/contracts.d.ts.map +1 -1
  64. package/lib/contracts.js.map +1 -1
  65. package/lib/debugLogger.d.ts.map +1 -1
  66. package/lib/debugLogger.js +5 -4
  67. package/lib/debugLogger.js.map +1 -1
  68. package/lib/deltaManager.d.ts.map +1 -1
  69. package/lib/deltaManager.js +87 -90
  70. package/lib/deltaManager.js.map +1 -1
  71. package/lib/deltaQueue.js +14 -14
  72. package/lib/deltaQueue.js.map +1 -1
  73. package/lib/loader.d.ts +3 -6
  74. package/lib/loader.d.ts.map +1 -1
  75. package/lib/loader.js +19 -84
  76. package/lib/loader.js.map +1 -1
  77. package/lib/packageVersion.d.ts +1 -1
  78. package/lib/packageVersion.js +1 -1
  79. package/lib/packageVersion.js.map +1 -1
  80. package/lib/protocol.d.ts +1 -2
  81. package/lib/protocol.d.ts.map +1 -1
  82. package/lib/protocol.js +1 -3
  83. package/lib/protocol.js.map +1 -1
  84. package/package.json +25 -19
  85. package/src/connectionManager.ts +38 -20
  86. package/src/container.ts +30 -16
  87. package/src/containerStorageAdapter.ts +0 -6
  88. package/src/contracts.ts +5 -1
  89. package/src/debugLogger.ts +1 -0
  90. package/src/deltaManager.ts +7 -9
  91. package/src/loader.ts +24 -92
  92. package/src/packageVersion.ts +1 -1
  93. package/src/protocol.ts +2 -6
@@ -136,7 +136,6 @@ export interface IPendingContainerState {
136
136
  */
137
137
  savedOps: ISequencedDocumentMessage[];
138
138
  url: string;
139
- term: number;
140
139
  clientId?: string;
141
140
  }
142
141
  export declare class Container extends EventEmitterWithErrorHandling<IContainerEvents> implements IContainer, IContainerExperimental {
@@ -214,11 +213,28 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
214
213
  private setAutoReconnectTime;
215
214
  private noopHeuristic;
216
215
  private get connectionMode();
216
+ /**
217
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
218
+ */
217
219
  get IFluidRouter(): IFluidRouter;
218
220
  get resolvedUrl(): IResolvedUrl | undefined;
219
221
  get readOnlyInfo(): ReadOnlyInfo;
220
222
  /**
221
- * Tracks host requiring read-only mode.
223
+ * Sends signal to runtime (and data stores) to be read-only.
224
+ * Hosts may have read only views, indicating to data stores that no edits are allowed.
225
+ * This is independent from this._readonlyPermissions (permissions) and this.connectionMode
226
+ * (server can return "write" mode even when asked for "read")
227
+ * Leveraging same "readonly" event as runtime & data stores should behave the same in such case
228
+ * as in read-only permissions.
229
+ * But this.active can be used by some DDSes to figure out if ops can be sent
230
+ * (for example, read-only view still participates in code proposals / upgrades decisions)
231
+ *
232
+ * Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
233
+ * the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
234
+ * there are pending in the outbound queue, it will stop sending until force readonly is
235
+ * cleared.
236
+ *
237
+ * @param readonly - set or clear force readonly.
222
238
  */
223
239
  forceReadonly(readonly: boolean): void;
224
240
  get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
@@ -281,6 +297,9 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
281
297
  attach(request: IRequest, attachProps?: {
282
298
  deltaConnection?: "none" | "delayed";
283
299
  }): Promise<void>;
300
+ /**
301
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
302
+ */
284
303
  request(path: IRequest): Promise<IResponse>;
285
304
  private setAutoReconnectInternal;
286
305
  connect(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAEN,oBAAoB,EAEpB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,WAAW,EAEX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,WAAW,EAEX,SAAS,EAET,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EAOjB,YAAY,EAEZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEN,uBAAuB,EAEvB,YAAY,EAEZ,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAU5C,OAAO,EAEN,cAAc,EAGd,gBAAgB,EAChB,cAAc,EAGd,yBAAyB,EAGzB,aAAa,EAMb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEN,6BAA6B,EAQ7B,mBAAmB,EAInB,MAAM,iCAAiC,CAAC;AAWzC,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAkB,MAAM,UAAU,CAAC;AAEhF,OAAO,EAIN,yBAAyB,EACzB,MAAM,2BAA2B,CAAC;AAUnC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAIN,sBAAsB,EAEtB,MAAM,YAAY,CAAC;AASpB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,YA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hC,OAAO,CAAC,wBAAwB;CA2BhC;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,UAAU;IACzD;;;;;;;OAOG;IACH,oBAAoB,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,4BAA4B,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjD"}
package/dist/container.js CHANGED
@@ -129,6 +129,219 @@ async function ReportIfTooLong(logger, eventName, action) {
129
129
  exports.ReportIfTooLong = ReportIfTooLong;
130
130
  const summarizerClientType = "summarizer";
131
131
  class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
132
+ /**
133
+ * Load an existing container.
134
+ * @internal
135
+ */
136
+ static async load(loadProps, createProps) {
137
+ const { version, pendingLocalState, loadMode, resolvedUrl, loadToSequenceNumber } = loadProps;
138
+ const container = new Container(createProps, loadProps);
139
+ const disableRecordHeapSize = container.mc.config.getBoolean("Fluid.Loader.DisableRecordHeapSize");
140
+ return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
141
+ const defaultMode = { opsBeforeReturn: "cached" };
142
+ // if we have pendingLocalState, anything we cached is not useful and we shouldn't wait for connection
143
+ // to return container, so ignore this value and use undefined for opsBeforeReturn
144
+ const mode = pendingLocalState
145
+ ? { ...(loadMode ?? defaultMode), opsBeforeReturn: undefined }
146
+ : loadMode ?? defaultMode;
147
+ const onClosed = (err) => {
148
+ // pre-0.58 error message: containerClosedWithoutErrorDuringLoad
149
+ reject(err ?? new telemetry_utils_1.GenericError("Container closed without error during load"));
150
+ };
151
+ container.on("closed", onClosed);
152
+ container
153
+ .load(version, mode, resolvedUrl, pendingLocalState, loadToSequenceNumber)
154
+ .finally(() => {
155
+ container.removeListener("closed", onClosed);
156
+ })
157
+ .then((props) => {
158
+ event.end({ ...props, ...loadMode });
159
+ resolve(container);
160
+ }, (error) => {
161
+ const err = (0, telemetry_utils_1.normalizeError)(error);
162
+ // Depending where error happens, we can be attempting to connect to web socket
163
+ // and continuously retrying (consider offline mode)
164
+ // Host has no container to close, so it's prudent to do it here
165
+ // Note: We could only dispose the container instead of just close but that would
166
+ // the telemetry where users sometimes search for ContainerClose event to look
167
+ // for load failures. So not removing this at this time.
168
+ container.close(err);
169
+ container.dispose(err);
170
+ onClosed(err);
171
+ });
172
+ }), { start: true, end: true, cancel: "generic" }, disableRecordHeapSize !== true /* recordHeapSize */);
173
+ }
174
+ /**
175
+ * Create a new container in a detached state.
176
+ */
177
+ static async createDetached(createProps, codeDetails) {
178
+ const container = new Container(createProps);
179
+ return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "CreateDetached" }, async (_event) => {
180
+ await container.createDetached(codeDetails);
181
+ return container;
182
+ }, { start: true, end: true, cancel: "generic" });
183
+ }
184
+ /**
185
+ * Create a new container in a detached state that is initialized with a
186
+ * snapshot from a previous detached container.
187
+ */
188
+ static async rehydrateDetachedFromSnapshot(createProps, snapshot) {
189
+ const container = new Container(createProps);
190
+ return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
191
+ const deserializedSummary = JSON.parse(snapshot);
192
+ await container.rehydrateDetachedFromSnapshot(deserializedSummary);
193
+ return container;
194
+ }, { start: true, end: true, cancel: "generic" });
195
+ }
196
+ setLoaded() {
197
+ // It's conceivable the container could be closed when this is called
198
+ // Only transition states if currently loading
199
+ if (this._lifecycleState === "loading") {
200
+ // Propagate current connection state through the system.
201
+ this.propagateConnectionState(true /* initial transition */);
202
+ this._lifecycleState = "loaded";
203
+ }
204
+ }
205
+ get closed() {
206
+ return (this._lifecycleState === "closing" || this._lifecycleState === "closed" || this.disposed);
207
+ }
208
+ get disposed() {
209
+ return this._lifecycleState === "disposing" || this._lifecycleState === "disposed";
210
+ }
211
+ get runtime() {
212
+ if (this._runtime === undefined) {
213
+ throw new Error("Attempted to access runtime before it was defined");
214
+ }
215
+ return this._runtime;
216
+ }
217
+ get protocolHandler() {
218
+ if (this._protocolHandler === undefined) {
219
+ throw new Error("Attempted to access protocolHandler before it was defined");
220
+ }
221
+ return this._protocolHandler;
222
+ }
223
+ get connectionMode() {
224
+ return this._deltaManager.connectionManager.connectionMode;
225
+ }
226
+ /**
227
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
228
+ */
229
+ // eslint-disable-next-line import/no-deprecated
230
+ get IFluidRouter() {
231
+ return this;
232
+ }
233
+ get resolvedUrl() {
234
+ /**
235
+ * All attached containers will have a document service,
236
+ * this is required, as attached containers are attached to
237
+ * a service. Detached containers will neither have a document
238
+ * service or a resolved url as they only exist locally.
239
+ * in order to create a document service a resolved url must
240
+ * first be obtained, this is how the container is identified.
241
+ * Because of this, the document service's resolved url
242
+ * is always the same as the containers, as we had to
243
+ * obtain the resolved url, and then create the service from it.
244
+ */
245
+ return this.service?.resolvedUrl;
246
+ }
247
+ get readOnlyInfo() {
248
+ return this._deltaManager.readOnlyInfo;
249
+ }
250
+ /**
251
+ * Sends signal to runtime (and data stores) to be read-only.
252
+ * Hosts may have read only views, indicating to data stores that no edits are allowed.
253
+ * This is independent from this._readonlyPermissions (permissions) and this.connectionMode
254
+ * (server can return "write" mode even when asked for "read")
255
+ * Leveraging same "readonly" event as runtime & data stores should behave the same in such case
256
+ * as in read-only permissions.
257
+ * But this.active can be used by some DDSes to figure out if ops can be sent
258
+ * (for example, read-only view still participates in code proposals / upgrades decisions)
259
+ *
260
+ * Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
261
+ * the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
262
+ * there are pending in the outbound queue, it will stop sending until force readonly is
263
+ * cleared.
264
+ *
265
+ * @param readonly - set or clear force readonly.
266
+ */
267
+ forceReadonly(readonly) {
268
+ this._deltaManager.connectionManager.forceReadonly(readonly);
269
+ }
270
+ get deltaManager() {
271
+ return this._deltaManager;
272
+ }
273
+ get connectionState() {
274
+ return this.connectionStateHandler.connectionState;
275
+ }
276
+ get connected() {
277
+ return this.connectionStateHandler.connectionState === connectionState_1.ConnectionState.Connected;
278
+ }
279
+ /**
280
+ * The server provided id of the client.
281
+ * Set once this.connected is true, otherwise undefined
282
+ */
283
+ get clientId() {
284
+ return this._clientId;
285
+ }
286
+ get offlineLoadEnabled() {
287
+ const enabled = this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad") ??
288
+ this.options?.enableOfflineLoad === true;
289
+ // summarizer will not have any pending state we want to save
290
+ return enabled && this.deltaManager.clientDetails.capabilities.interactive;
291
+ }
292
+ /**
293
+ * Get the code details that are currently specified for the container.
294
+ * @returns The current code details if any are specified, undefined if none are specified.
295
+ */
296
+ getSpecifiedCodeDetails() {
297
+ return this.getCodeDetailsFromQuorum();
298
+ }
299
+ /**
300
+ * Get the code details that were used to load the container.
301
+ * @returns The code details that were used to load the container if it is loaded, undefined if it is not yet
302
+ * loaded.
303
+ */
304
+ getLoadedCodeDetails() {
305
+ return this._loadedCodeDetails;
306
+ }
307
+ /**
308
+ * Retrieves the audience associated with the document
309
+ */
310
+ get audience() {
311
+ return this.protocolHandler.audience;
312
+ }
313
+ /**
314
+ * Returns true if container is dirty.
315
+ * Which means data loss if container is closed at that same moment
316
+ * Most likely that happens when there is no network connection to Relay Service
317
+ */
318
+ get isDirty() {
319
+ return this._dirtyContainer;
320
+ }
321
+ /**
322
+ * {@inheritDoc @fluidframework/container-definitions#IContainer.entryPoint}
323
+ */
324
+ async getEntryPoint() {
325
+ if (this._disposed) {
326
+ throw new telemetry_utils_1.UsageError("The context is already disposed");
327
+ }
328
+ if (this._runtime !== undefined) {
329
+ return this._runtime.getEntryPoint?.();
330
+ }
331
+ return new Promise((resolve, reject) => {
332
+ const runtimeInstantiatedHandler = () => {
333
+ (0, core_utils_1.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
334
+ resolve(this._runtime.getEntryPoint?.());
335
+ this._lifecycleEvents.off("disposed", disposedHandler);
336
+ };
337
+ const disposedHandler = () => {
338
+ reject(new Error("ContainerContext was disposed"));
339
+ this._lifecycleEvents.off("runtimeInstantiated", runtimeInstantiatedHandler);
340
+ };
341
+ this._lifecycleEvents.once("runtimeInstantiated", runtimeInstantiatedHandler);
342
+ this._lifecycleEvents.once("disposed", disposedHandler);
343
+ });
344
+ }
132
345
  /**
133
346
  * @internal
134
347
  */
@@ -331,201 +544,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
331
544
  document.addEventListener("visibilitychange", this.visibilityEventHandler);
332
545
  }
333
546
  }
334
- /**
335
- * Load an existing container.
336
- * @internal
337
- */
338
- static async load(loadProps, createProps) {
339
- const { version, pendingLocalState, loadMode, resolvedUrl, loadToSequenceNumber } = loadProps;
340
- const container = new Container(createProps, loadProps);
341
- const disableRecordHeapSize = container.mc.config.getBoolean("Fluid.Loader.DisableRecordHeapSize");
342
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
343
- const defaultMode = { opsBeforeReturn: "cached" };
344
- // if we have pendingLocalState, anything we cached is not useful and we shouldn't wait for connection
345
- // to return container, so ignore this value and use undefined for opsBeforeReturn
346
- const mode = pendingLocalState
347
- ? { ...(loadMode ?? defaultMode), opsBeforeReturn: undefined }
348
- : loadMode ?? defaultMode;
349
- const onClosed = (err) => {
350
- // pre-0.58 error message: containerClosedWithoutErrorDuringLoad
351
- reject(err ?? new telemetry_utils_1.GenericError("Container closed without error during load"));
352
- };
353
- container.on("closed", onClosed);
354
- container
355
- .load(version, mode, resolvedUrl, pendingLocalState, loadToSequenceNumber)
356
- .finally(() => {
357
- container.removeListener("closed", onClosed);
358
- })
359
- .then((props) => {
360
- event.end({ ...props, ...loadMode });
361
- resolve(container);
362
- }, (error) => {
363
- const err = (0, telemetry_utils_1.normalizeError)(error);
364
- // Depending where error happens, we can be attempting to connect to web socket
365
- // and continuously retrying (consider offline mode)
366
- // Host has no container to close, so it's prudent to do it here
367
- // Note: We could only dispose the container instead of just close but that would
368
- // the telemetry where users sometimes search for ContainerClose event to look
369
- // for load failures. So not removing this at this time.
370
- container.close(err);
371
- container.dispose(err);
372
- onClosed(err);
373
- });
374
- }), { start: true, end: true, cancel: "generic" }, disableRecordHeapSize !== true /* recordHeapSize */);
375
- }
376
- /**
377
- * Create a new container in a detached state.
378
- */
379
- static async createDetached(createProps, codeDetails) {
380
- const container = new Container(createProps);
381
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "CreateDetached" }, async (_event) => {
382
- await container.createDetached(codeDetails);
383
- return container;
384
- }, { start: true, end: true, cancel: "generic" });
385
- }
386
- /**
387
- * Create a new container in a detached state that is initialized with a
388
- * snapshot from a previous detached container.
389
- */
390
- static async rehydrateDetachedFromSnapshot(createProps, snapshot) {
391
- const container = new Container(createProps);
392
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
393
- const deserializedSummary = JSON.parse(snapshot);
394
- await container.rehydrateDetachedFromSnapshot(deserializedSummary);
395
- return container;
396
- }, { start: true, end: true, cancel: "generic" });
397
- }
398
- setLoaded() {
399
- // It's conceivable the container could be closed when this is called
400
- // Only transition states if currently loading
401
- if (this._lifecycleState === "loading") {
402
- // Propagate current connection state through the system.
403
- this.propagateConnectionState(true /* initial transition */);
404
- this._lifecycleState = "loaded";
405
- }
406
- }
407
- get closed() {
408
- return (this._lifecycleState === "closing" || this._lifecycleState === "closed" || this.disposed);
409
- }
410
- get disposed() {
411
- return this._lifecycleState === "disposing" || this._lifecycleState === "disposed";
412
- }
413
- get runtime() {
414
- if (this._runtime === undefined) {
415
- throw new Error("Attempted to access runtime before it was defined");
416
- }
417
- return this._runtime;
418
- }
419
- get protocolHandler() {
420
- if (this._protocolHandler === undefined) {
421
- throw new Error("Attempted to access protocolHandler before it was defined");
422
- }
423
- return this._protocolHandler;
424
- }
425
- get connectionMode() {
426
- return this._deltaManager.connectionManager.connectionMode;
427
- }
428
- get IFluidRouter() {
429
- return this;
430
- }
431
- get resolvedUrl() {
432
- /**
433
- * All attached containers will have a document service,
434
- * this is required, as attached containers are attached to
435
- * a service. Detached containers will neither have a document
436
- * service or a resolved url as they only exist locally.
437
- * in order to create a document service a resolved url must
438
- * first be obtained, this is how the container is identified.
439
- * Because of this, the document service's resolved url
440
- * is always the same as the containers, as we had to
441
- * obtain the resolved url, and then create the service from it.
442
- */
443
- return this.service?.resolvedUrl;
444
- }
445
- get readOnlyInfo() {
446
- return this._deltaManager.readOnlyInfo;
447
- }
448
- /**
449
- * Tracks host requiring read-only mode.
450
- */
451
- forceReadonly(readonly) {
452
- this._deltaManager.connectionManager.forceReadonly(readonly);
453
- }
454
- get deltaManager() {
455
- return this._deltaManager;
456
- }
457
- get connectionState() {
458
- return this.connectionStateHandler.connectionState;
459
- }
460
- get connected() {
461
- return this.connectionStateHandler.connectionState === connectionState_1.ConnectionState.Connected;
462
- }
463
- /**
464
- * The server provided id of the client.
465
- * Set once this.connected is true, otherwise undefined
466
- */
467
- get clientId() {
468
- return this._clientId;
469
- }
470
- get offlineLoadEnabled() {
471
- const enabled = this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad") ??
472
- this.options?.enableOfflineLoad === true;
473
- // summarizer will not have any pending state we want to save
474
- return enabled && this.deltaManager.clientDetails.capabilities.interactive;
475
- }
476
- /**
477
- * Get the code details that are currently specified for the container.
478
- * @returns The current code details if any are specified, undefined if none are specified.
479
- */
480
- getSpecifiedCodeDetails() {
481
- return this.getCodeDetailsFromQuorum();
482
- }
483
- /**
484
- * Get the code details that were used to load the container.
485
- * @returns The code details that were used to load the container if it is loaded, undefined if it is not yet
486
- * loaded.
487
- */
488
- getLoadedCodeDetails() {
489
- return this._loadedCodeDetails;
490
- }
491
- /**
492
- * Retrieves the audience associated with the document
493
- */
494
- get audience() {
495
- return this.protocolHandler.audience;
496
- }
497
- /**
498
- * Returns true if container is dirty.
499
- * Which means data loss if container is closed at that same moment
500
- * Most likely that happens when there is no network connection to Relay Service
501
- */
502
- get isDirty() {
503
- return this._dirtyContainer;
504
- }
505
- /**
506
- * {@inheritDoc @fluidframework/container-definitions#IContainer.entryPoint}
507
- */
508
- async getEntryPoint() {
509
- if (this._disposed) {
510
- throw new telemetry_utils_1.UsageError("The context is already disposed");
511
- }
512
- if (this._runtime !== undefined) {
513
- return this._runtime.getEntryPoint?.();
514
- }
515
- return new Promise((resolve, reject) => {
516
- const runtimeInstantiatedHandler = () => {
517
- (0, core_utils_1.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
518
- resolve(this._runtime.getEntryPoint?.());
519
- this._lifecycleEvents.off("disposed", disposedHandler);
520
- };
521
- const disposedHandler = () => {
522
- reject(new Error("ContainerContext was disposed"));
523
- this._lifecycleEvents.off("runtimeInstantiated", runtimeInstantiatedHandler);
524
- };
525
- this._lifecycleEvents.once("runtimeInstantiated", runtimeInstantiatedHandler);
526
- this._lifecycleEvents.once("disposed", disposedHandler);
527
- });
528
- }
529
547
  /**
530
548
  * Retrieves the quorum associated with the document
531
549
  */
@@ -660,7 +678,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
660
678
  snapshotBlobs: this.baseSnapshotBlobs,
661
679
  savedOps: this.savedOps,
662
680
  url: this.resolvedUrl.url,
663
- term: protocol_1.OnlyValidTermValue,
664
681
  // no need to save this if there is no pending runtime state
665
682
  clientId: pendingRuntimeState !== undefined ? this.clientId : undefined,
666
683
  };
@@ -782,6 +799,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
782
799
  }
783
800
  }, { start: true, end: true, cancel: "generic" });
784
801
  }
802
+ /**
803
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
804
+ */
785
805
  async request(path) {
786
806
  return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Request" }, async () => this.runtime.request(path), { end: true, cancel: "error" });
787
807
  }
@@ -932,18 +952,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
932
952
  async load(specifiedVersion, loadMode, resolvedUrl, pendingLocalState, loadToSequenceNumber) {
933
953
  const timings = { phase1: client_utils_1.performance.now() };
934
954
  this.service = await this.serviceFactory.createDocumentService(resolvedUrl, this.subLogger, this.client.details.type === summarizerClientType);
935
- // Ideally we always connect as "read" by default.
936
- // Currently that works with SPO & r11s, because we get "write" connection when connecting to non-existing file.
937
- // We should not rely on it by (one of them will address the issue, but we need to address both)
938
- // 1) switching create new flow to one where we create file by posting snapshot
939
- // 2) Fixing quorum workflows (have retry logic)
940
- // That all said, "read" does not work with memorylicious workflows (that opens two simultaneous
941
- // connections to same file) in two ways:
942
- // A) creation flow breaks (as one of the clients "sees" file as existing, and hits #2 above)
943
- // B) Once file is created, transition from view-only connection to write does not work - some bugs to be fixed.
955
+ // Except in cases where it has stashed ops or requested by feature gate, the container will connect in "read" mode
956
+ const mode = this.mc.config.getBoolean("Fluid.Container.ForceWriteConnection") === true ||
957
+ (pendingLocalState?.savedOps.length ?? 0) > 0
958
+ ? "write"
959
+ : "read";
944
960
  const connectionArgs = {
945
961
  reason: { text: "DocumentOpen" },
946
- mode: "write",
962
+ mode,
947
963
  fetchOpsFromStorage: false,
948
964
  };
949
965
  // Start websocket connection as soon as possible. Note that there is no op handler attached yet, but the
@@ -1108,7 +1124,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1108
1124
  async createDetached(codeDetails) {
1109
1125
  const attributes = {
1110
1126
  sequenceNumber: detachedContainerRefSeqNumber,
1111
- term: protocol_1.OnlyValidTermValue,
1112
1127
  minimumSequenceNumber: 0,
1113
1128
  };
1114
1129
  await this.attachDeltaManagerOpHandler(attributes);
@@ -1148,7 +1163,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1148
1163
  return {
1149
1164
  minimumSequenceNumber: 0,
1150
1165
  sequenceNumber: 0,
1151
- term: protocol_1.OnlyValidTermValue,
1152
1166
  };
1153
1167
  }
1154
1168
  // Backward compatibility: old docs would have ".attributes" instead of "attributes"