@fluidframework/container-loader 2.0.0-internal.5.3.2 → 2.0.0-internal.6.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 (124) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +6 -3
  3. package/dist/audience.d.ts +1 -0
  4. package/dist/audience.d.ts.map +1 -1
  5. package/dist/audience.js +3 -1
  6. package/dist/audience.js.map +1 -1
  7. package/dist/connectionManager.d.ts +1 -1
  8. package/dist/connectionManager.d.ts.map +1 -1
  9. package/dist/connectionManager.js +30 -36
  10. package/dist/connectionManager.js.map +1 -1
  11. package/dist/connectionStateHandler.d.ts +2 -1
  12. package/dist/connectionStateHandler.d.ts.map +1 -1
  13. package/dist/connectionStateHandler.js +9 -16
  14. package/dist/connectionStateHandler.js.map +1 -1
  15. package/dist/container.d.ts +12 -8
  16. package/dist/container.d.ts.map +1 -1
  17. package/dist/container.js +199 -156
  18. package/dist/container.js.map +1 -1
  19. package/dist/containerContext.d.ts +2 -12
  20. package/dist/containerContext.d.ts.map +1 -1
  21. package/dist/containerContext.js +1 -20
  22. package/dist/containerContext.js.map +1 -1
  23. package/dist/containerStorageAdapter.js +3 -5
  24. package/dist/containerStorageAdapter.js.map +1 -1
  25. package/dist/contracts.d.ts +11 -2
  26. package/dist/contracts.d.ts.map +1 -1
  27. package/dist/contracts.js +3 -3
  28. package/dist/contracts.js.map +1 -1
  29. package/dist/debugLogger.d.ts +30 -0
  30. package/dist/debugLogger.d.ts.map +1 -0
  31. package/dist/debugLogger.js +95 -0
  32. package/dist/debugLogger.js.map +1 -0
  33. package/dist/deltaManager.d.ts +16 -4
  34. package/dist/deltaManager.d.ts.map +1 -1
  35. package/dist/deltaManager.js +79 -33
  36. package/dist/deltaManager.js.map +1 -1
  37. package/dist/deltaQueue.js +1 -2
  38. package/dist/deltaQueue.js.map +1 -1
  39. package/dist/loader.d.ts +12 -0
  40. package/dist/loader.d.ts.map +1 -1
  41. package/dist/loader.js +73 -47
  42. package/dist/loader.js.map +1 -1
  43. package/dist/packageVersion.d.ts +1 -1
  44. package/dist/packageVersion.js +1 -1
  45. package/dist/packageVersion.js.map +1 -1
  46. package/dist/protocol.d.ts.map +1 -1
  47. package/dist/protocol.js +2 -3
  48. package/dist/protocol.js.map +1 -1
  49. package/dist/quorum.d.ts +4 -1
  50. package/dist/quorum.d.ts.map +1 -1
  51. package/dist/quorum.js +1 -13
  52. package/dist/quorum.js.map +1 -1
  53. package/dist/utils.d.ts +8 -1
  54. package/dist/utils.d.ts.map +1 -1
  55. package/dist/utils.js +24 -6
  56. package/dist/utils.js.map +1 -1
  57. package/lib/audience.d.ts +1 -0
  58. package/lib/audience.d.ts.map +1 -1
  59. package/lib/audience.js +3 -1
  60. package/lib/audience.js.map +1 -1
  61. package/lib/connectionManager.d.ts +1 -1
  62. package/lib/connectionManager.d.ts.map +1 -1
  63. package/lib/connectionManager.js +32 -35
  64. package/lib/connectionManager.js.map +1 -1
  65. package/lib/connectionStateHandler.d.ts +2 -1
  66. package/lib/connectionStateHandler.d.ts.map +1 -1
  67. package/lib/connectionStateHandler.js +9 -16
  68. package/lib/connectionStateHandler.js.map +1 -1
  69. package/lib/container.d.ts +12 -8
  70. package/lib/container.d.ts.map +1 -1
  71. package/lib/container.js +200 -157
  72. package/lib/container.js.map +1 -1
  73. package/lib/containerContext.d.ts +2 -12
  74. package/lib/containerContext.d.ts.map +1 -1
  75. package/lib/containerContext.js +1 -20
  76. package/lib/containerContext.js.map +1 -1
  77. package/lib/containerStorageAdapter.js +3 -5
  78. package/lib/containerStorageAdapter.js.map +1 -1
  79. package/lib/contracts.d.ts +11 -2
  80. package/lib/contracts.d.ts.map +1 -1
  81. package/lib/contracts.js +3 -3
  82. package/lib/contracts.js.map +1 -1
  83. package/lib/debugLogger.d.ts +30 -0
  84. package/lib/debugLogger.d.ts.map +1 -0
  85. package/lib/debugLogger.js +91 -0
  86. package/lib/debugLogger.js.map +1 -0
  87. package/lib/deltaManager.d.ts +16 -4
  88. package/lib/deltaManager.d.ts.map +1 -1
  89. package/lib/deltaManager.js +77 -28
  90. package/lib/deltaManager.js.map +1 -1
  91. package/lib/deltaQueue.js +1 -2
  92. package/lib/deltaQueue.js.map +1 -1
  93. package/lib/loader.d.ts +12 -0
  94. package/lib/loader.d.ts.map +1 -1
  95. package/lib/loader.js +73 -47
  96. package/lib/loader.js.map +1 -1
  97. package/lib/packageVersion.d.ts +1 -1
  98. package/lib/packageVersion.js +1 -1
  99. package/lib/packageVersion.js.map +1 -1
  100. package/lib/protocol.d.ts.map +1 -1
  101. package/lib/protocol.js +2 -3
  102. package/lib/protocol.js.map +1 -1
  103. package/lib/quorum.d.ts +4 -1
  104. package/lib/quorum.d.ts.map +1 -1
  105. package/lib/quorum.js +0 -11
  106. package/lib/quorum.js.map +1 -1
  107. package/lib/utils.d.ts +8 -1
  108. package/lib/utils.d.ts.map +1 -1
  109. package/lib/utils.js +22 -5
  110. package/lib/utils.js.map +1 -1
  111. package/package.json +14 -14
  112. package/src/audience.ts +6 -0
  113. package/src/connectionManager.ts +13 -14
  114. package/src/connectionStateHandler.ts +3 -2
  115. package/src/container.ts +178 -120
  116. package/src/containerContext.ts +0 -24
  117. package/src/contracts.ts +16 -5
  118. package/src/debugLogger.ts +113 -0
  119. package/src/deltaManager.ts +50 -9
  120. package/src/loader.ts +53 -30
  121. package/src/packageVersion.ts +1 -1
  122. package/src/protocol.ts +0 -1
  123. package/src/quorum.ts +0 -10
  124. package/src/utils.ts +29 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,90 @@
1
1
  # @fluidframework/container-loader
2
2
 
3
+ ## 2.0.0-internal.6.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Removed IContainerContext.existing [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
8
+
9
+ The recommended means of checking for existing changed to the instantiateRuntime param in 2021, and the IContainerContext.existing member was formally deprecated in 2.0.0-internal.2.0.0. This member is now removed.
10
+
11
+ - Remove closeAndGetPendingLocalState from IContainer [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
12
+
13
+ This change removes the deprecated and experimental method closeAndGetPendingLocalState from IContainer. It continues to
14
+ exist on IContainerExperimental.
15
+
16
+ IContainerExperimental is an interface that is easily casted to, which enables partners to access experimental features for testing and evaluation.
17
+ Moving the experimental method off IContainer will reduce exposure and churn on that production interface as we iterate
18
+ on and finalize our experimental features.
19
+
20
+ Experimental features should not be used in production environments.
21
+
22
+ - Loader container caching off by default [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
23
+
24
+ Loader container caching will now be off by default and the ability to control it is deprecated. Loader caching is deprecated and will be removed in a future release, as well as all caching functionality of containers. Please try not to rely on caching and inform us if you cannot do so.
25
+
26
+ If you run into trouble with this behavior, please report it ASAP to the FluidFramework team and use the following options (available in this release only) to unblock you:
27
+
28
+ - set `ILoaderProps.options.cache` to `true` when constructing a `Loader` object (see the `ILoaderOptions` interface)
29
+ - set `[LoaderHeader.cache]` header to `true` when requesting a container
30
+
31
+ - getPendingLocalState and closeAndGetPendingLocalState are now async [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
32
+
33
+ getPendingLocalState and closeAndGetPendingLocalState are now async to allow uploading blobs to attach to a DDS (in closing scenario). There is a new parameter in those methods at the container/runtime layer "notifyImminentClosure" which is true only when closing and ensures uploading blobs fast resolve and get attached. Once we apply stashed ops to new container, blob will try to reupload and we will know where to place its references.
34
+
35
+ - Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
36
+
37
+ Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
38
+
39
+ - `Loader.resolve()` throws if `LoaderHeader.sequenceNumber` and `IContainerLoadMode.opsBeforeReturn` do not match [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
40
+
41
+ Calling `Loader.resolve()` will now throw an error if `LoaderHeader.sequenceNumber` is defined but `IContainerLoadMode.opsBeforeReturn` is not set to "sequenceNumber". Vice versa, `Loader.resolve()` will also throw an error if `IContainerLoadMode.opsBeforeReturn` is set to "sequenceNumber" but `LoaderHeader.sequenceNumber` is not defined.
42
+
43
+ - IDeltaManager members disposed and dispose() removed [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
44
+
45
+ IDeltaManager members disposed and dispose() were deprecated in 2.0.0-internal.5.3.0 and have now been removed.
46
+
47
+ - Request APIs deprecated on ILoader [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
48
+
49
+ The `request` API (associated with the `IFluidRouter` interface) has been deprecated on `ILoader` and `Loader`.
50
+ Please migrate all usage to using the `IContainer.request(...)` method if using a dynamic request URL, or to the `IContainer.getEntryPoint()` method if trying to obtain the application-specified root object.
51
+
52
+ **Note:** The `IContainer.request(...)` method will be deprecated in an upcoming release, so do not rely on this method for a long-term solution (the APIs around `entryPoint` and `getEntryPoint()` will become required and available for usage in its place).
53
+
54
+ After calling `ILoader.resolve(...)`, call the `request(...)` method on the returned `IContainer` with a corresponding request URL. For converting a request URL from `Loader` to `Container`, use the `IUrlResolver` passed into the `Loader`'s constructor.
55
+ The following is an example of what this change may look like:
56
+
57
+ ```
58
+ // OLD
59
+ const request: IRequest;
60
+ const urlResolver = new YourUrlResolver();
61
+ const loader = new Loader({ urlResolver, ... });
62
+
63
+ await loader.resolve(request);
64
+ const response = loader.request(request);
65
+ ```
66
+
67
+ ```
68
+ // NEW
69
+ const request: IRequest;
70
+ const urlResolver = new YourUrlResolver();
71
+ const loader = new Loader({ urlResolver, ... });
72
+
73
+ const container = await loader.resolve(request);
74
+ const resolvedUrl: IRequest = urlResolver.resolve(request);
75
+
76
+ // Parse the `resolvedUrl.url` property as necessary before passing to `container.request(...)`
77
+ // For an example, see the `Loader.resolveCore(...)` method
78
+ const parsedResolvedUrl = // implement parse logic here
79
+ const response = container.request(parsedResolvedUrl);
80
+ ```
81
+
82
+ Status on removal of the request pattern is tracked in [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md)
83
+
84
+ ## 2.0.0-internal.5.4.0
85
+
86
+ Dependency updates only.
87
+
3
88
  ## 2.0.0-internal.5.3.0
4
89
 
5
90
  ### Minor Changes
package/README.md CHANGED
@@ -23,6 +23,7 @@ package for more information including tools to convert between version schemes.
23
23
  **Topics covered below:**
24
24
 
25
25
  - [@fluidframework/container-loader](#fluidframeworkcontainer-loader)
26
+ - [Using Fluid Framework libraries](#using-fluid-framework-libraries)
26
27
  - [Fluid Loader](#fluid-loader)
27
28
  - [Expectations from host implementers](#expectations-from-host-implementers)
28
29
  - [Expectations from container runtime and data store implementers](#expectations-from-container-runtime-and-data-store-implementers)
@@ -36,12 +37,14 @@ package for more information including tools to convert between version schemes.
36
37
  - [ClientID and client identification](#clientid-and-client-identification)
37
38
  - [Error handling](#error-handling)
38
39
  - [Connectivity events](#connectivity-events)
40
+ - [Connection State Transitions Flow Chart](#connection-state-transitions-flow-chart)
39
41
  - [Readonly states](#readonly-states)
40
42
  - [`readonly`](#readonly)
41
43
  - [`permissions`](#permissions)
42
44
  - [`forced`](#forced)
43
45
  - [`storageOnly`](#storageonly)
44
46
  - [Dirty events](#dirty-events)
47
+ - [Trademark](#trademark)
45
48
 
46
49
  **Related topics covered elsewhere:**
47
50
 
@@ -82,7 +85,7 @@ Please see specific sections for more details on these states and events - this
82
85
 
83
86
  Container is returned as result of Loader.resolve() call. Loader can cache containers, so if same URI is requested from same loader instance, earlier created container might be returned. This is important, as some of the headers (like `pause`) might be ignored because of Container reuse.
84
87
 
85
- `ILoaderHeader` in [loader.ts](../../../common/lib/container-definitions/src/loader.ts) describes properties controlling container loading.
88
+ `ILoaderHeader` in [loader.ts](../../common/container-definitions/src/loader.ts) describes properties controlling container loading.
86
89
 
87
90
  ### Connectivity
88
91
 
@@ -160,7 +163,7 @@ There are two ways errors are exposed:
160
163
 
161
164
  Critical errors can show up in #1 & #2 workflows. For example, data store URI may point to a deleted file, which will result in errors on container open. But file can also be deleted while container is opened, resulting in same error type being raised through "error" handler.
162
165
 
163
- Errors are of [ICriticalContainerError](../../../common/lib/container-definitions/src/error.ts) type, and warnings are of [ContainerWarning](../../../common/lib/container-definitions/src/error.ts) type. Both have `errorType` property, describing type of an error (and appropriate interface of error object):
166
+ Errors are of [ICriticalContainerError](../../common/container-definitions/src/error.ts) type, and warnings are of [ContainerWarning](../../common/container-definitions/src/error.ts) type. Both have `errorType` property, describing type of an error (and appropriate interface of error object):
164
167
 
165
168
  ```ts
166
169
  readonly errorType: string;
@@ -168,7 +171,7 @@ Errors are of [ICriticalContainerError](../../../common/lib/container-definition
168
171
 
169
172
  There are 4 sources of errors:
170
173
 
171
- 1. [ContainerErrorType](../../../common/lib/container-definitions/src/error.ts) - errors & warnings raised at loader level
174
+ 1. [ContainerErrorType](../../common/container-definitions/src/error.ts) - errors & warnings raised at loader level
172
175
  2. [DriverErrorType](../../common/driver-definitions/src/driverError.ts) - errors that are likely to be raised from the driver level
173
176
  3. [OdspErrorType](../../drivers/odsp-driver/src/odspError.ts) and [RouterliciousErrorType](../../drivers/routerlicious-driver/src/documentDeltaConnection.ts) - errors raised by ODSP and R11S drivers.
174
177
  4. Runtime errors, like `"summarizingError"`, `"dataCorruptionError"`. This class of errors is not pre-determined and depends on type of container loaded.
@@ -10,6 +10,7 @@ import { IClient } from "@fluidframework/protocol-definitions";
10
10
  */
11
11
  export declare class Audience extends EventEmitter implements IAudienceOwner {
12
12
  private readonly members;
13
+ constructor();
13
14
  on(event: "addMember" | "removeMember", listener: (clientId: string, client: IClient) => void): this;
14
15
  /**
15
16
  * Adds a new client to the audience
@@ -1 +1 @@
1
- {"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D;;GAEG;AACH,qBAAa,QAAS,SAAQ,YAAa,YAAW,cAAc;IACnE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IAE/C,EAAE,CACR,KAAK,EAAE,WAAW,GAAG,cAAc,EACnC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,GACnD,IAAI;IAKP;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAenD;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAW9C;;OAEG;IACI,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAIzC;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;CAGvD"}
1
+ {"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D;;GAEG;AACH,qBAAa,QAAS,SAAQ,YAAa,YAAW,cAAc;IACnE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;;IAQ/C,EAAE,CACR,KAAK,EAAE,WAAW,GAAG,cAAc,EACnC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,GACnD,IAAI;IAKP;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAenD;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAW9C;;OAEG;IACI,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAIzC;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;CAGvD"}
package/dist/audience.js CHANGED
@@ -12,8 +12,10 @@ const common_utils_1 = require("@fluidframework/common-utils");
12
12
  */
13
13
  class Audience extends events_1.EventEmitter {
14
14
  constructor() {
15
- super(...arguments);
15
+ super();
16
16
  this.members = new Map();
17
+ // We are expecting this class to have many listeners, so we suppress noisy "MaxListenersExceededWarning" logging.
18
+ super.setMaxListeners(0);
17
19
  }
18
20
  on(event, listener) {
19
21
  return super.on(event, listener);
@@ -1 +1 @@
1
- {"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAAsC;AACtC,+DAAsD;AAItD;;GAEG;AACH,MAAa,QAAS,SAAQ,qBAAY;IAA1C;;QACkB,YAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IAwDvD,CAAC;IAlDO,EAAE,CAAC,KAAa,EAAE,QAAkC;QAC1D,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB,EAAE,OAAgB;QAClD,mGAAmG;QACnG,+FAA+F;QAC/F,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC1C,IAAA,qBAAM,EACL,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAClD,KAAK,CAAC,wDAAwD,CAC9D,CAAC;SACF;aAAM;YACN,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC1C;IACF,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,QAAgB;QACnC,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,aAAa,KAAK,SAAS,EAAE;YAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC;SACZ;aAAM;YACN,OAAO,KAAK,CAAC;SACb;IACF,CAAC;IAED;;OAEG;IACI,UAAU;QAChB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACD;AAzDD,4BAyDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { EventEmitter } from \"events\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Audience represents all clients connected to the op stream.\n */\nexport class Audience extends EventEmitter implements IAudienceOwner {\n\tprivate readonly members = new Map<string, IClient>();\n\n\tpublic on(\n\t\tevent: \"addMember\" | \"removeMember\",\n\t\tlistener: (clientId: string, client: IClient) => void,\n\t): this;\n\tpublic on(event: string, listener: (...args: any[]) => void): this {\n\t\treturn super.on(event, listener);\n\t}\n\n\t/**\n\t * Adds a new client to the audience\n\t */\n\tpublic addMember(clientId: string, details: IClient) {\n\t\t// Given that signal delivery is unreliable process, we might observe same client being added twice\n\t\t// In such case we should see exactly same payload (IClient), and should not raise event twice!\n\t\tif (this.members.has(clientId)) {\n\t\t\tconst client = this.members.get(clientId);\n\t\t\tassert(\n\t\t\t\tJSON.stringify(client) === JSON.stringify(details),\n\t\t\t\t0x4b2 /* new client has different payload from existing one */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.members.set(clientId, details);\n\t\t\tthis.emit(\"addMember\", clientId, details);\n\t\t}\n\t}\n\n\t/**\n\t * Removes a client from the audience. Only emits an event if a client is actually removed\n\t * @returns if a client was removed from the audience\n\t */\n\tpublic removeMember(clientId: string): boolean {\n\t\tconst removedClient = this.members.get(clientId);\n\t\tif (removedClient !== undefined) {\n\t\t\tthis.members.delete(clientId);\n\t\t\tthis.emit(\"removeMember\", clientId, removedClient);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all the members in the audience\n\t */\n\tpublic getMembers(): Map<string, IClient> {\n\t\treturn new Map(this.members);\n\t}\n\n\t/**\n\t * Retrieves a specific member of the audience\n\t */\n\tpublic getMember(clientId: string): IClient | undefined {\n\t\treturn this.members.get(clientId);\n\t}\n}\n"]}
1
+ {"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAAsC;AACtC,+DAAsD;AAItD;;GAEG;AACH,MAAa,QAAS,SAAQ,qBAAY;IAGzC;QACC,KAAK,EAAE,CAAC;QAH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B,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACD;AA/DD,4BA+DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { EventEmitter } from \"events\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Audience represents all clients connected to the op stream.\n */\nexport class Audience extends EventEmitter implements IAudienceOwner {\n\tprivate readonly members = new Map<string, IClient>();\n\n\tconstructor() {\n\t\tsuper();\n\t\t// We are expecting this class to have many listeners, so we suppress noisy \"MaxListenersExceededWarning\" logging.\n\t\tsuper.setMaxListeners(0);\n\t}\n\n\tpublic on(\n\t\tevent: \"addMember\" | \"removeMember\",\n\t\tlistener: (clientId: string, client: IClient) => void,\n\t): this;\n\tpublic on(event: string, listener: (...args: any[]) => void): this {\n\t\treturn super.on(event, listener);\n\t}\n\n\t/**\n\t * Adds a new client to the audience\n\t */\n\tpublic addMember(clientId: string, details: IClient) {\n\t\t// Given that signal delivery is unreliable process, we might observe same client being added twice\n\t\t// In such case we should see exactly same payload (IClient), and should not raise event twice!\n\t\tif (this.members.has(clientId)) {\n\t\t\tconst client = this.members.get(clientId);\n\t\t\tassert(\n\t\t\t\tJSON.stringify(client) === JSON.stringify(details),\n\t\t\t\t0x4b2 /* new client has different payload from existing one */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.members.set(clientId, details);\n\t\t\tthis.emit(\"addMember\", clientId, details);\n\t\t}\n\t}\n\n\t/**\n\t * Removes a client from the audience. Only emits an event if a client is actually removed\n\t * @returns if a client was removed from the audience\n\t */\n\tpublic removeMember(clientId: string): boolean {\n\t\tconst removedClient = this.members.get(clientId);\n\t\tif (removedClient !== undefined) {\n\t\t\tthis.members.delete(clientId);\n\t\t\tthis.emit(\"removeMember\", clientId, removedClient);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all the members in the audience\n\t */\n\tpublic getMembers(): Map<string, IClient> {\n\t\treturn new Map(this.members);\n\t}\n\n\t/**\n\t * Retrieves a specific member of the audience\n\t */\n\tpublic getMember(clientId: string): IClient | undefined {\n\t\treturn this.members.get(clientId);\n\t}\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ITelemetryProperties } from "@fluidframework/core-interfaces";
6
- import { IDeltaQueue, ReadOnlyInfo, ICriticalContainerError } from "@fluidframework/container-definitions";
6
+ import { ICriticalContainerError, IDeltaQueue, ReadOnlyInfo } from "@fluidframework/container-definitions";
7
7
  import { IDocumentService } from "@fluidframework/driver-definitions";
8
8
  import { ConnectionMode, IClient, IClientConfiguration, IClientDetails, IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
9
9
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
@@ -1 +1 @@
1
- {"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAe,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEpF,OAAO,EACN,WAAW,EACX,YAAY,EAEZ,uBAAuB,EACvB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEN,gBAAgB,EAGhB,MAAM,oCAAoC,CAAC;AAS5C,OAAO,EACN,cAAc,EACd,OAAO,EACP,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAGhB,yBAAyB,EAOzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,mBAAmB,EAGnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAyH/F;;;;GAIG;AAC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B,EAC3B,KAAK,EAAE,6BAA6B;IAoB/C,OAAO,CAAC,KAAK,CAAC,EAAE,uBAAuB,EAAE,gBAAgB,GAAE,OAAc;IAwBhF;;;OAGG;IACI,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAclD;;;;;;;;;;;;;;;;OAgBG;IACI,aAAa,CAAC,QAAQ,EAAE,OAAO;IAoCtC,OAAO,CAAC,uBAAuB;IAQxB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc;YAOhD,WAAW;IA2KzB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IActB;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAwCjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAWxB;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IA+IpC;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;;OAMG;YACW,SAAS;IA2DhB,oBAAoB,CAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,GACrD,gBAAgB,GAAG,SAAS;IAuCxB,YAAY,CAAC,OAAO,EAAE,GAAG;IAQzB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE;IA+BzC,0BAA0B,CAAC,OAAO,EAAE,yBAAyB;IAgDpE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAGxB;IAGF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAkB1B;IAGF,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAIxC;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;CACF"}
@@ -3,12 +3,8 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
6
  Object.defineProperty(exports, "__esModule", { value: true });
10
7
  exports.ConnectionManager = void 0;
11
- const abort_controller_1 = __importDefault(require("abort-controller"));
12
8
  const common_utils_1 = require("@fluidframework/common-utils");
13
9
  const container_utils_1 = require("@fluidframework/container-utils");
14
10
  const driver_utils_1 = require("@fluidframework/driver-utils");
@@ -18,7 +14,6 @@ const contracts_1 = require("./contracts");
18
14
  const deltaQueue_1 = require("./deltaQueue");
19
15
  const protocol_1 = require("./protocol");
20
16
  const utils_1 = require("./utils");
21
- const MaxReconnectDelayInMs = 8000;
22
17
  const InitialReconnectDelayInMs = 1000;
23
18
  const DefaultChunkSize = 16 * 1024;
24
19
  const fatalConnectErrorProp = { fatalConnectError: true };
@@ -89,9 +84,8 @@ function isNoDeltaStreamConnection(connection) {
89
84
  return connection instanceof NoDeltaStream;
90
85
  }
91
86
  const waitForOnline = async () => {
92
- var _a;
93
87
  // Only wait if we have a strong signal that we're offline - otherwise assume we're online.
94
- if (((_a = globalThis.navigator) === null || _a === void 0 ? void 0 : _a.onLine) === false && globalThis.addEventListener !== undefined) {
88
+ if (globalThis.navigator?.onLine === false && globalThis.addEventListener !== undefined) {
95
89
  return new Promise((resolve) => {
96
90
  const resolveAndRemoveListener = () => {
97
91
  resolve();
@@ -175,15 +169,13 @@ class ConnectionManager {
175
169
  * The current connection mode, initially read.
176
170
  */
177
171
  get connectionMode() {
178
- var _a, _b;
179
- return (_b = (_a = this.connection) === null || _a === void 0 ? void 0 : _a.mode) !== null && _b !== void 0 ? _b : "read";
172
+ return this.connection?.mode ?? "read";
180
173
  }
181
174
  get connected() {
182
175
  return this.connection !== undefined;
183
176
  }
184
177
  get clientId() {
185
- var _a;
186
- return (_a = this.connection) === null || _a === void 0 ? void 0 : _a.clientId;
178
+ return this.connection?.clientId;
187
179
  }
188
180
  /**
189
181
  * Automatic reconnecting enabled or disabled.
@@ -193,8 +185,7 @@ class ConnectionManager {
193
185
  return this._reconnectMode;
194
186
  }
195
187
  get maxMessageSize() {
196
- var _a, _b, _c;
197
- return (_c = (_b = (_a = this.connection) === null || _a === void 0 ? void 0 : _a.serviceConfiguration) === null || _b === void 0 ? void 0 : _b.maxMessageSize) !== null && _c !== void 0 ? _c : DefaultChunkSize;
188
+ return this.connection?.serviceConfiguration?.maxMessageSize ?? DefaultChunkSize;
198
189
  }
199
190
  get version() {
200
191
  if (this.connection === undefined) {
@@ -203,12 +194,10 @@ class ConnectionManager {
203
194
  return this.connection.version;
204
195
  }
205
196
  get serviceConfiguration() {
206
- var _a;
207
- return (_a = this.connection) === null || _a === void 0 ? void 0 : _a.serviceConfiguration;
197
+ return this.connection?.serviceConfiguration;
208
198
  }
209
199
  get scopes() {
210
- var _a;
211
- return (_a = this.connection) === null || _a === void 0 ? void 0 : _a.claims.scopes;
200
+ return this.connection?.claims.scopes;
212
201
  }
213
202
  get outbound() {
214
203
  return this._outbound;
@@ -220,9 +209,11 @@ class ConnectionManager {
220
209
  get connectionProps() {
221
210
  return this.connection !== undefined
222
211
  ? this._connectionProps
223
- : Object.assign(Object.assign({}, this._connectionProps), {
212
+ : {
213
+ ...this._connectionProps,
224
214
  // Report how many ops this client sent in last disconnected session
225
- sentOps: this.clientSequenceNumber });
215
+ sentOps: this.clientSequenceNumber,
216
+ };
226
217
  }
227
218
  shouldJoinWrite() {
228
219
  // We don't have to wait for ack for topmost NoOps. So subtract those.
@@ -377,7 +368,6 @@ class ConnectionManager {
377
368
  });
378
369
  }
379
370
  async connectCore(reason, connectionMode) {
380
- var _a, _b, _c;
381
371
  (0, common_utils_1.assert)(!this._disposed, 0x26a /* "not closed" */);
382
372
  if (this.connection !== undefined) {
383
373
  return; // Connection attempt already completed successfully
@@ -389,7 +379,7 @@ class ConnectionManager {
389
379
  (0, common_utils_1.assert)(this.pendingConnection === undefined, 0x344 /* this.pendingConnection should be undefined */);
390
380
  }
391
381
  // If there is no specified ConnectionMode, try the previous mode, if there is no previous mode use default
392
- let requestedMode = (_a = connectionMode !== null && connectionMode !== void 0 ? connectionMode : pendingConnectionMode) !== null && _a !== void 0 ? _a : this.defaultReconnectionMode;
382
+ let requestedMode = connectionMode ?? pendingConnectionMode ?? this.defaultReconnectionMode;
393
383
  // if we have any non-acked ops from last connection, reconnect as "write".
394
384
  // without that we would connect in view-only mode, which will result in immediate
395
385
  // firing of "connected" event from Container and switch of current clientId (as tracked
@@ -401,7 +391,7 @@ class ConnectionManager {
401
391
  const docService = this.serviceProvider();
402
392
  (0, common_utils_1.assert)(docService !== undefined, 0x2a7 /* "Container is not attached" */);
403
393
  let connection;
404
- if (((_b = docService.policies) === null || _b === void 0 ? void 0 : _b.storageOnly) === true) {
394
+ if (docService.policies?.storageOnly === true) {
405
395
  connection = new NoDeltaStream();
406
396
  this.setupNewSuccessfulConnection(connection, "read", reason);
407
397
  (0, common_utils_1.assert)(this.pendingConnection === undefined, 0x2b3 /* "logic error" */);
@@ -411,7 +401,7 @@ class ConnectionManager {
411
401
  let connectRepeatCount = 0;
412
402
  const connectStartTime = common_utils_1.performance.now();
413
403
  let lastError;
414
- const abortController = new abort_controller_1.default();
404
+ const abortController = new AbortController();
415
405
  const abortSignal = abortController.signal;
416
406
  this.pendingConnection = {
417
407
  abort: () => {
@@ -429,7 +419,7 @@ class ConnectionManager {
429
419
  this.logger.sendTelemetryEvent({
430
420
  eventName: "ConnectionAttemptCancelled",
431
421
  attempts: connectRepeatCount,
432
- duration: telemetry_utils_1.TelemetryLogger.formatTick(common_utils_1.performance.now() - connectStartTime),
422
+ duration: (0, telemetry_utils_1.formatTick)(common_utils_1.performance.now() - connectStartTime),
433
423
  connectionEstablished: false,
434
424
  });
435
425
  return;
@@ -437,7 +427,10 @@ class ConnectionManager {
437
427
  connectRepeatCount++;
438
428
  try {
439
429
  this.client.mode = requestedMode;
440
- connection = await docService.connectToDeltaStream(Object.assign(Object.assign({}, this.client), { mode: requestedMode }));
430
+ connection = await docService.connectToDeltaStream({
431
+ ...this.client,
432
+ mode: requestedMode,
433
+ });
441
434
  if (connection.disposed) {
442
435
  // Nobody observed this connection, so drop it on the floor and retry.
443
436
  this.logger.sendTelemetryEvent({ eventName: "ReceivedClosedConnection" });
@@ -461,7 +454,7 @@ class ConnectionManager {
461
454
  attempts: connectRepeatCount,
462
455
  delay: delayMs,
463
456
  eventName: "DeltaConnectionFailureToConnect",
464
- duration: telemetry_utils_1.TelemetryLogger.formatTick(common_utils_1.performance.now() - connectStartTime),
457
+ duration: (0, telemetry_utils_1.formatTick)(common_utils_1.performance.now() - connectStartTime),
465
458
  }, origError);
466
459
  lastError = origError;
467
460
  const waitStartTime = common_utils_1.performance.now();
@@ -473,12 +466,12 @@ class ConnectionManager {
473
466
  setTimeout(resolve, retryDelayFromError);
474
467
  });
475
468
  }
476
- else if (((_c = globalThis.navigator) === null || _c === void 0 ? void 0 : _c.onLine) !== false) {
469
+ else if (globalThis.navigator?.onLine !== false) {
477
470
  // If the error didn't tell us to wait, let's still wait a little bit before retrying.
478
471
  // We skip this delay if we're confident we're offline, because we probably just need to wait to come back online.
479
472
  await new Promise((resolve) => {
480
473
  setTimeout(resolve, delayMs);
481
- delayMs = Math.min(delayMs * 2, MaxReconnectDelayInMs);
474
+ delayMs = Math.min(delayMs * 2, (0, driver_utils_1.calculateMaxWaitTime)(origError));
482
475
  });
483
476
  }
484
477
  // If we believe we're offline, we assume there's no point in trying until we at least think we're online.
@@ -500,7 +493,7 @@ class ConnectionManager {
500
493
  (0, driver_utils_1.logNetworkFailure)(this.logger, {
501
494
  eventName: "MultipleDeltaConnectionFailures",
502
495
  attempts: connectRepeatCount,
503
- duration: telemetry_utils_1.TelemetryLogger.formatTick(common_utils_1.performance.now() - connectStartTime),
496
+ duration: (0, telemetry_utils_1.formatTick)(common_utils_1.performance.now() - connectStartTime),
504
497
  }, lastError);
505
498
  }
506
499
  // Check for abort signal after while loop as well
@@ -509,7 +502,7 @@ class ConnectionManager {
509
502
  this.logger.sendTelemetryEvent({
510
503
  eventName: "ConnectionAttemptCancelled",
511
504
  attempts: connectRepeatCount,
512
- duration: telemetry_utils_1.TelemetryLogger.formatTick(common_utils_1.performance.now() - connectStartTime),
505
+ duration: (0, telemetry_utils_1.formatTick)(common_utils_1.performance.now() - connectStartTime),
513
506
  connectionEstablished: true,
514
507
  });
515
508
  return;
@@ -583,7 +576,6 @@ class ConnectionManager {
583
576
  * @param connection - The newly established connection
584
577
  */
585
578
  setupNewSuccessfulConnection(connection, requestedMode, reason) {
586
- var _a;
587
579
  // Old connection should have been cleaned up before establishing a new one
588
580
  (0, common_utils_1.assert)(this.connection === undefined, 0x0e6 /* "old connection exists on new connection setup" */);
589
581
  (0, common_utils_1.assert)(!connection.disposed, 0x28a /* "can't be disposed - Callers need to ensure that!" */);
@@ -664,7 +656,7 @@ class ConnectionManager {
664
656
  }),
665
657
  };
666
658
  this.props.signalHandler(clearSignal);
667
- for (const priorClient of (_a = connection.initialClients) !== null && _a !== void 0 ? _a : []) {
659
+ for (const priorClient of connection.initialClients ?? []) {
668
660
  const joinSignal = {
669
661
  clientId: null,
670
662
  content: JSON.stringify({
@@ -743,7 +735,6 @@ class ConnectionManager {
743
735
  : `Reconnecting due to: ${disconnectMessage}`, requestedMode);
744
736
  }
745
737
  prepareMessageToSend(message) {
746
- var _a, _b;
747
738
  if (this.readonly === true) {
748
739
  (0, common_utils_1.assert)(this.readOnlyInfo.readonly === true, 0x1f0 /* "Unexpected mismatch in readonly" */);
749
740
  const error = new container_utils_1.GenericError("deltaManagerReadonlySubmit", undefined /* error */, {
@@ -760,8 +751,8 @@ class ConnectionManager {
760
751
  // we keep info about old connection as long as possible to be able to account for all non-acked ops
761
752
  // that we pick up on next connection.
762
753
  (0, common_utils_1.assert)(!!this.connection, 0x0e4 /* "Lost old connection!" */);
763
- if (this.lastSubmittedClientId !== ((_a = this.connection) === null || _a === void 0 ? void 0 : _a.clientId)) {
764
- this.lastSubmittedClientId = (_b = this.connection) === null || _b === void 0 ? void 0 : _b.clientId;
754
+ if (this.lastSubmittedClientId !== this.connection?.clientId) {
755
+ this.lastSubmittedClientId = this.connection?.clientId;
765
756
  this.clientSequenceNumber = 0;
766
757
  this.clientSequenceNumberObserved = 0;
767
758
  }
@@ -771,7 +762,10 @@ class ConnectionManager {
771
762
  else {
772
763
  this.localOpsToIgnore = 0;
773
764
  }
774
- return Object.assign(Object.assign({}, message), { clientSequenceNumber: ++this.clientSequenceNumber });
765
+ return {
766
+ ...message,
767
+ clientSequenceNumber: ++this.clientSequenceNumber,
768
+ };
775
769
  }
776
770
  submitSignal(content) {
777
771
  if (this.connection !== undefined) {