@fluidframework/container-loader 2.0.0-dev-rc.2.0.0.246488 → 2.0.0-dev-rc.3.0.0.253463

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 (236) hide show
  1. package/api-report/container-loader.api.md +11 -11
  2. package/dist/attachment.d.ts +6 -9
  3. package/dist/attachment.d.ts.map +1 -1
  4. package/dist/attachment.js +3 -3
  5. package/dist/attachment.js.map +1 -1
  6. package/dist/audience.d.ts +1 -1
  7. package/dist/audience.d.ts.map +1 -1
  8. package/dist/audience.js +2 -2
  9. package/dist/audience.js.map +1 -1
  10. package/dist/catchUpMonitor.d.ts +1 -1
  11. package/dist/catchUpMonitor.d.ts.map +1 -1
  12. package/dist/catchUpMonitor.js +2 -2
  13. package/dist/catchUpMonitor.js.map +1 -1
  14. package/dist/connectionManager.d.ts +4 -4
  15. package/dist/connectionManager.d.ts.map +1 -1
  16. package/dist/connectionManager.js +42 -42
  17. package/dist/connectionManager.js.map +1 -1
  18. package/dist/connectionStateHandler.d.ts +3 -3
  19. package/dist/connectionStateHandler.d.ts.map +1 -1
  20. package/dist/connectionStateHandler.js +27 -27
  21. package/dist/connectionStateHandler.js.map +1 -1
  22. package/dist/container-loader-alpha.d.ts +11 -11
  23. package/dist/container-loader-beta.d.ts +11 -11
  24. package/dist/container-loader-public.d.ts +11 -11
  25. package/dist/container-loader-untrimmed.d.ts +11 -11
  26. package/dist/container.d.ts +9 -46
  27. package/dist/container.d.ts.map +1 -1
  28. package/dist/container.js +96 -108
  29. package/dist/container.js.map +1 -1
  30. package/dist/containerContext.d.ts +19 -7
  31. package/dist/containerContext.d.ts.map +1 -1
  32. package/dist/containerContext.js +7 -2
  33. package/dist/containerContext.js.map +1 -1
  34. package/dist/containerStorageAdapter.d.ts +3 -3
  35. package/dist/containerStorageAdapter.d.ts.map +1 -1
  36. package/dist/containerStorageAdapter.js +6 -6
  37. package/dist/containerStorageAdapter.js.map +1 -1
  38. package/dist/contracts.d.ts +4 -3
  39. package/dist/contracts.d.ts.map +1 -1
  40. package/dist/contracts.js +2 -2
  41. package/dist/contracts.js.map +1 -1
  42. package/dist/debugLogger.d.ts +2 -1
  43. package/dist/debugLogger.d.ts.map +1 -1
  44. package/dist/debugLogger.js +4 -4
  45. package/dist/debugLogger.js.map +1 -1
  46. package/dist/deltaManager.d.ts +7 -6
  47. package/dist/deltaManager.d.ts.map +1 -1
  48. package/dist/deltaManager.js +45 -45
  49. package/dist/deltaManager.js.map +1 -1
  50. package/dist/deltaQueue.d.ts +1 -1
  51. package/dist/deltaQueue.d.ts.map +1 -1
  52. package/dist/deltaQueue.js +5 -5
  53. package/dist/deltaQueue.js.map +1 -1
  54. package/dist/error.d.ts +3 -2
  55. package/dist/error.d.ts.map +1 -1
  56. package/dist/error.js +5 -5
  57. package/dist/error.js.map +1 -1
  58. package/dist/loader.d.ts +4 -4
  59. package/dist/loader.d.ts.map +1 -1
  60. package/dist/loader.js +23 -23
  61. package/dist/loader.js.map +1 -1
  62. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -2
  63. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  64. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
  65. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  66. package/dist/noopHeuristic.d.ts +1 -1
  67. package/dist/noopHeuristic.d.ts.map +1 -1
  68. package/dist/noopHeuristic.js +6 -6
  69. package/dist/noopHeuristic.js.map +1 -1
  70. package/dist/packageVersion.d.ts +1 -1
  71. package/dist/packageVersion.js +1 -1
  72. package/dist/packageVersion.js.map +1 -1
  73. package/dist/protocol.d.ts +1 -1
  74. package/dist/protocol.d.ts.map +1 -1
  75. package/dist/protocol.js +2 -2
  76. package/dist/protocol.js.map +1 -1
  77. package/dist/protocolTreeDocumentStorageService.d.ts +4 -4
  78. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  79. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  80. package/dist/quorum.d.ts +1 -1
  81. package/dist/quorum.d.ts.map +1 -1
  82. package/dist/quorum.js.map +1 -1
  83. package/dist/retriableDocumentStorageService.d.ts +2 -2
  84. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  85. package/dist/retriableDocumentStorageService.js +7 -7
  86. package/dist/retriableDocumentStorageService.js.map +1 -1
  87. package/dist/serializedStateManager.d.ts +87 -16
  88. package/dist/serializedStateManager.d.ts.map +1 -1
  89. package/dist/serializedStateManager.js +164 -80
  90. package/dist/serializedStateManager.js.map +1 -1
  91. package/dist/utils.d.ts +6 -7
  92. package/dist/utils.d.ts.map +1 -1
  93. package/dist/utils.js +39 -23
  94. package/dist/utils.js.map +1 -1
  95. package/lib/attachment.d.ts +6 -9
  96. package/lib/attachment.d.ts.map +1 -1
  97. package/lib/attachment.js +1 -1
  98. package/lib/attachment.js.map +1 -1
  99. package/lib/audience.d.ts +1 -1
  100. package/lib/audience.d.ts.map +1 -1
  101. package/lib/audience.js +1 -1
  102. package/lib/audience.js.map +1 -1
  103. package/lib/catchUpMonitor.d.ts +1 -1
  104. package/lib/catchUpMonitor.d.ts.map +1 -1
  105. package/lib/catchUpMonitor.js +1 -1
  106. package/lib/catchUpMonitor.js.map +1 -1
  107. package/lib/connectionManager.d.ts +4 -4
  108. package/lib/connectionManager.d.ts.map +1 -1
  109. package/lib/connectionManager.js +5 -5
  110. package/lib/connectionManager.js.map +1 -1
  111. package/lib/connectionStateHandler.d.ts +3 -3
  112. package/lib/connectionStateHandler.d.ts.map +1 -1
  113. package/lib/connectionStateHandler.js +2 -2
  114. package/lib/connectionStateHandler.js.map +1 -1
  115. package/lib/container-loader-alpha.d.ts +11 -11
  116. package/lib/container-loader-beta.d.ts +11 -11
  117. package/lib/container-loader-public.d.ts +11 -11
  118. package/lib/container-loader-untrimmed.d.ts +11 -11
  119. package/lib/container.d.ts +9 -46
  120. package/lib/container.d.ts.map +1 -1
  121. package/lib/container.js +28 -40
  122. package/lib/container.js.map +1 -1
  123. package/lib/containerContext.d.ts +19 -7
  124. package/lib/containerContext.d.ts.map +1 -1
  125. package/lib/containerContext.js +7 -2
  126. package/lib/containerContext.js.map +1 -1
  127. package/lib/containerStorageAdapter.d.ts +3 -3
  128. package/lib/containerStorageAdapter.d.ts.map +1 -1
  129. package/lib/containerStorageAdapter.js +2 -2
  130. package/lib/containerStorageAdapter.js.map +1 -1
  131. package/lib/contracts.d.ts +4 -3
  132. package/lib/contracts.d.ts.map +1 -1
  133. package/lib/contracts.js +1 -1
  134. package/lib/contracts.js.map +1 -1
  135. package/lib/debugLogger.d.ts +2 -1
  136. package/lib/debugLogger.d.ts.map +1 -1
  137. package/lib/debugLogger.js +1 -1
  138. package/lib/debugLogger.js.map +1 -1
  139. package/lib/deltaManager.d.ts +7 -6
  140. package/lib/deltaManager.d.ts.map +1 -1
  141. package/lib/deltaManager.js +5 -5
  142. package/lib/deltaManager.js.map +1 -1
  143. package/lib/deltaQueue.d.ts +1 -1
  144. package/lib/deltaQueue.d.ts.map +1 -1
  145. package/lib/deltaQueue.js +2 -2
  146. package/lib/deltaQueue.js.map +1 -1
  147. package/lib/error.d.ts +3 -2
  148. package/lib/error.d.ts.map +1 -1
  149. package/lib/error.js +2 -2
  150. package/lib/error.js.map +1 -1
  151. package/lib/loader.d.ts +4 -4
  152. package/lib/loader.d.ts.map +1 -1
  153. package/lib/loader.js +4 -4
  154. package/lib/loader.js.map +1 -1
  155. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -2
  156. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  157. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
  158. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  159. package/lib/noopHeuristic.d.ts +1 -1
  160. package/lib/noopHeuristic.d.ts.map +1 -1
  161. package/lib/noopHeuristic.js +2 -2
  162. package/lib/noopHeuristic.js.map +1 -1
  163. package/lib/packageVersion.d.ts +1 -1
  164. package/lib/packageVersion.js +1 -1
  165. package/lib/packageVersion.js.map +1 -1
  166. package/lib/protocol.d.ts +1 -1
  167. package/lib/protocol.d.ts.map +1 -1
  168. package/lib/protocol.js +1 -1
  169. package/lib/protocol.js.map +1 -1
  170. package/lib/protocolTreeDocumentStorageService.d.ts +4 -4
  171. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  172. package/lib/protocolTreeDocumentStorageService.js.map +1 -1
  173. package/lib/quorum.d.ts +1 -1
  174. package/lib/quorum.d.ts.map +1 -1
  175. package/lib/quorum.js.map +1 -1
  176. package/lib/retriableDocumentStorageService.d.ts +2 -2
  177. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  178. package/lib/retriableDocumentStorageService.js +3 -3
  179. package/lib/retriableDocumentStorageService.js.map +1 -1
  180. package/lib/serializedStateManager.d.ts +87 -16
  181. package/lib/serializedStateManager.d.ts.map +1 -1
  182. package/lib/serializedStateManager.js +156 -75
  183. package/lib/serializedStateManager.js.map +1 -1
  184. package/lib/tsdoc-metadata.json +11 -0
  185. package/lib/utils.d.ts +6 -7
  186. package/lib/utils.d.ts.map +1 -1
  187. package/lib/utils.js +27 -12
  188. package/lib/utils.js.map +1 -1
  189. package/package.json +19 -28
  190. package/src/attachment.ts +9 -8
  191. package/src/audience.ts +2 -2
  192. package/src/catchUpMonitor.ts +2 -2
  193. package/src/connectionManager.ts +19 -19
  194. package/src/connectionStateHandler.ts +7 -7
  195. package/src/container.ts +78 -133
  196. package/src/containerContext.ts +22 -12
  197. package/src/containerStorageAdapter.ts +7 -6
  198. package/src/contracts.ts +4 -5
  199. package/src/debugLogger.ts +3 -4
  200. package/src/deltaManager.ts +31 -25
  201. package/src/deltaQueue.ts +2 -2
  202. package/src/error.ts +5 -4
  203. package/src/loader.ts +25 -23
  204. package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +4 -4
  205. package/src/noopHeuristic.ts +3 -3
  206. package/src/packageVersion.ts +1 -1
  207. package/src/protocol.ts +2 -2
  208. package/src/protocolTreeDocumentStorageService.ts +4 -1
  209. package/src/quorum.ts +1 -1
  210. package/src/retriableDocumentStorageService.ts +6 -5
  211. package/src/serializedStateManager.ts +276 -110
  212. package/src/utils.ts +51 -20
  213. package/lib/test/attachment.spec.js +0 -380
  214. package/lib/test/attachment.spec.js.map +0 -1
  215. package/lib/test/catchUpMonitor.spec.js +0 -88
  216. package/lib/test/catchUpMonitor.spec.js.map +0 -1
  217. package/lib/test/connectionManager.spec.js +0 -201
  218. package/lib/test/connectionManager.spec.js.map +0 -1
  219. package/lib/test/connectionStateHandler.spec.js +0 -555
  220. package/lib/test/connectionStateHandler.spec.js.map +0 -1
  221. package/lib/test/container.spec.js +0 -64
  222. package/lib/test/container.spec.js.map +0 -1
  223. package/lib/test/deltaManager.spec.js +0 -405
  224. package/lib/test/deltaManager.spec.js.map +0 -1
  225. package/lib/test/loader.spec.js +0 -212
  226. package/lib/test/loader.spec.js.map +0 -1
  227. package/lib/test/locationRedirectionTests.spec.js +0 -44
  228. package/lib/test/locationRedirectionTests.spec.js.map +0 -1
  229. package/lib/test/serializedStateManager.spec.js +0 -148
  230. package/lib/test/serializedStateManager.spec.js.map +0 -1
  231. package/lib/test/snapshotConversionTest.spec.js +0 -79
  232. package/lib/test/snapshotConversionTest.spec.js.map +0 -1
  233. package/lib/test/types/validateContainerLoaderPrevious.generated.js +0 -38
  234. package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +0 -1
  235. package/lib/test/utils.spec.js +0 -31
  236. package/lib/test/utils.spec.js.map +0 -1
package/dist/container.js CHANGED
@@ -8,31 +8,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Container = exports.ReportIfTooLong = exports.waitContainerToCatchUp = void 0;
11
- const uuid_1 = require("uuid");
12
- const core_utils_1 = require("@fluidframework/core-utils");
13
11
  const client_utils_1 = require("@fluid-internal/client-utils");
14
- const core_interfaces_1 = require("@fluidframework/core-interfaces");
15
12
  const container_definitions_1 = require("@fluidframework/container-definitions");
16
- const driver_utils_1 = require("@fluidframework/driver-utils");
13
+ const internal_1 = require("@fluidframework/container-definitions/internal");
14
+ const core_interfaces_1 = require("@fluidframework/core-interfaces");
15
+ const internal_2 = require("@fluidframework/core-utils/internal");
16
+ const internal_3 = require("@fluidframework/driver-utils/internal");
17
17
  const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
18
- const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
18
+ const internal_4 = require("@fluidframework/telemetry-utils/internal");
19
19
  const structured_clone_1 = __importDefault(require("@ungap/structured-clone"));
20
+ const uuid_1 = require("uuid");
21
+ const attachment_js_1 = require("./attachment.js");
20
22
  const audience_js_1 = require("./audience.js");
23
+ const connectionManager_js_1 = require("./connectionManager.js");
24
+ const connectionState_js_1 = require("./connectionState.js");
25
+ const connectionStateHandler_js_1 = require("./connectionStateHandler.js");
21
26
  const containerContext_js_1 = require("./containerContext.js");
27
+ const containerStorageAdapter_js_1 = require("./containerStorageAdapter.js");
22
28
  const contracts_js_1 = require("./contracts.js");
23
29
  const deltaManager_js_1 = require("./deltaManager.js");
24
30
  const loader_js_1 = require("./loader.js");
25
- const packageVersion_js_1 = require("./packageVersion.js");
26
- const containerStorageAdapter_js_1 = require("./containerStorageAdapter.js");
27
- const connectionStateHandler_js_1 = require("./connectionStateHandler.js");
28
- const utils_js_1 = require("./utils.js");
29
- const quorum_js_1 = require("./quorum.js");
30
31
  const noopHeuristic_js_1 = require("./noopHeuristic.js");
31
- const connectionManager_js_1 = require("./connectionManager.js");
32
- const connectionState_js_1 = require("./connectionState.js");
32
+ const packageVersion_js_1 = require("./packageVersion.js");
33
33
  const protocol_js_1 = require("./protocol.js");
34
- const attachment_js_1 = require("./attachment.js");
34
+ const quorum_js_1 = require("./quorum.js");
35
35
  const serializedStateManager_js_1 = require("./serializedStateManager.js");
36
+ const utils_js_1 = require("./utils.js");
36
37
  const detachedContainerRefSeqNumber = 0;
37
38
  const dirtyContainerEvent = "dirty";
38
39
  const savedContainerEvent = "saved";
@@ -57,7 +58,7 @@ const packageNotFactoryError = "Code package does not implement IRuntimeFactory"
57
58
  async function waitContainerToCatchUp(container) {
58
59
  // Make sure we stop waiting if container is closed.
59
60
  if (container.closed) {
60
- throw new telemetry_utils_1.UsageError("waitContainerToCatchUp: Container closed");
61
+ throw new internal_4.UsageError("waitContainerToCatchUp: Container closed");
61
62
  }
62
63
  return new Promise((resolve, reject) => {
63
64
  const deltaManager = container.deltaManager;
@@ -65,8 +66,8 @@ async function waitContainerToCatchUp(container) {
65
66
  container.off("closed", closedCallback);
66
67
  const baseMessage = "Container closed while waiting to catch up";
67
68
  reject(err !== undefined
68
- ? (0, telemetry_utils_1.wrapError)(err, (innerMessage) => new telemetry_utils_1.GenericError(`${baseMessage}: ${innerMessage}`))
69
- : new telemetry_utils_1.GenericError(baseMessage));
69
+ ? (0, internal_4.wrapError)(err, (innerMessage) => new internal_4.GenericError(`${baseMessage}: ${innerMessage}`))
70
+ : new internal_4.GenericError(baseMessage));
70
71
  };
71
72
  container.on("closed", closedCallback);
72
73
  // Depending on config, transition to "connected" state may include the guarantee
@@ -74,11 +75,11 @@ async function waitContainerToCatchUp(container) {
74
75
  // Waiting for "connected" state in either case gets us at least to our own Join op
75
76
  // which is a reasonable approximation of "caught up"
76
77
  const waitForOps = () => {
77
- (0, core_utils_1.assert)(container.connectionState === connectionState_js_1.ConnectionState.CatchingUp ||
78
+ (0, internal_2.assert)(container.connectionState === connectionState_js_1.ConnectionState.CatchingUp ||
78
79
  container.connectionState === connectionState_js_1.ConnectionState.Connected, 0x0cd /* "Container disconnected while waiting for ops!" */);
79
80
  const hasCheckpointSequenceNumber = deltaManager.hasCheckpointSequenceNumber;
80
81
  const connectionOpSeqNumber = deltaManager.lastKnownSeqNumber;
81
- (0, core_utils_1.assert)(deltaManager.lastSequenceNumber <= connectionOpSeqNumber, 0x266 /* "lastKnownSeqNumber should never be below last processed sequence number" */);
82
+ (0, internal_2.assert)(deltaManager.lastSequenceNumber <= connectionOpSeqNumber, 0x266 /* "lastKnownSeqNumber should never be below last processed sequence number" */);
82
83
  if (deltaManager.lastSequenceNumber === connectionOpSeqNumber) {
83
84
  container.off("closed", closedCallback);
84
85
  resolve(hasCheckpointSequenceNumber);
@@ -102,10 +103,10 @@ async function waitContainerToCatchUp(container) {
102
103
  return;
103
104
  }
104
105
  const callback = () => {
105
- container.off(telemetry_utils_1.connectedEventName, callback);
106
+ container.off(internal_4.connectedEventName, callback);
106
107
  waitForOps();
107
108
  };
108
- container.on(telemetry_utils_1.connectedEventName, callback);
109
+ container.on(internal_4.connectedEventName, callback);
109
110
  if (container.connectionState === connectionState_js_1.ConnectionState.Disconnected) {
110
111
  container.connect();
111
112
  }
@@ -120,7 +121,7 @@ const getCodeProposal = (quorum) => quorum.get("code") ?? quorum.get("code2");
120
121
  * @param action - functor to call and measure
121
122
  */
122
123
  async function ReportIfTooLong(logger, eventName, action) {
123
- const event = telemetry_utils_1.PerformanceEvent.start(logger, { eventName });
124
+ const event = internal_4.PerformanceEvent.start(logger, { eventName });
124
125
  const props = await action();
125
126
  if (event.duration > 200) {
126
127
  event.end(props);
@@ -128,7 +129,7 @@ async function ReportIfTooLong(logger, eventName, action) {
128
129
  }
129
130
  exports.ReportIfTooLong = ReportIfTooLong;
130
131
  const summarizerClientType = "summarizer";
131
- class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
132
+ class Container extends internal_4.EventEmitterWithErrorHandling {
132
133
  /**
133
134
  * Load an existing container.
134
135
  */
@@ -136,7 +137,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
136
137
  const { version, pendingLocalState, loadMode, resolvedUrl, loadToSequenceNumber } = loadProps;
137
138
  const container = new Container(createProps, loadProps);
138
139
  const disableRecordHeapSize = container.mc.config.getBoolean("Fluid.Loader.DisableRecordHeapSize");
139
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
140
+ return internal_4.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
140
141
  const defaultMode = { opsBeforeReturn: "cached" };
141
142
  // if we have pendingLocalState, anything we cached is not useful and we shouldn't wait for connection
142
143
  // to return container, so ignore this value and use undefined for opsBeforeReturn
@@ -145,7 +146,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
145
146
  : loadMode ?? defaultMode;
146
147
  const onClosed = (err) => {
147
148
  // pre-0.58 error message: containerClosedWithoutErrorDuringLoad
148
- reject(err ?? new telemetry_utils_1.GenericError("Container closed without error during load"));
149
+ reject(err ?? new internal_4.GenericError("Container closed without error during load"));
149
150
  };
150
151
  container.on("closed", onClosed);
151
152
  container
@@ -157,7 +158,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
157
158
  event.end({ ...props, ...loadMode });
158
159
  resolve(container);
159
160
  }, (error) => {
160
- const err = (0, telemetry_utils_1.normalizeError)(error);
161
+ const err = (0, internal_4.normalizeError)(error);
161
162
  // Depending where error happens, we can be attempting to connect to web socket
162
163
  // and continuously retrying (consider offline mode)
163
164
  // Host has no container to close, so it's prudent to do it here
@@ -175,7 +176,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
175
176
  */
176
177
  static async createDetached(createProps, codeDetails) {
177
178
  const container = new Container(createProps);
178
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "CreateDetached" }, async (_event) => {
179
+ return internal_4.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "CreateDetached" }, async (_event) => {
179
180
  await container.createDetached(codeDetails);
180
181
  return container;
181
182
  }, { start: true, end: true, cancel: "generic" });
@@ -186,7 +187,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
186
187
  */
187
188
  static async rehydrateDetachedFromSnapshot(createProps, snapshot) {
188
189
  const container = new Container(createProps);
189
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
190
+ return internal_4.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
190
191
  const detachedContainerState = (0, utils_js_1.getDetachedContainerStateFromSerializedContainer)(snapshot);
191
192
  await container.rehydrateDetachedFromSnapshot(detachedContainerState);
192
193
  return container;
@@ -315,14 +316,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
315
316
  */
316
317
  async getEntryPoint() {
317
318
  if (this._disposed) {
318
- throw new telemetry_utils_1.UsageError("The context is already disposed");
319
+ throw new internal_4.UsageError("The context is already disposed");
319
320
  }
320
321
  if (this._runtime !== undefined) {
321
322
  return this._runtime.getEntryPoint?.();
322
323
  }
323
324
  return new Promise((resolve, reject) => {
324
325
  const runtimeInstantiatedHandler = () => {
325
- (0, core_utils_1.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
326
+ (0, internal_2.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
326
327
  resolve(this._runtime.getEntryPoint?.());
327
328
  this._lifecycleEvents.off("disposed", disposedHandler);
328
329
  };
@@ -369,14 +370,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
369
370
  this._lifecycleEvents = new client_utils_1.TypedEventEmitter();
370
371
  this._disposed = false;
371
372
  this.attach = (0, utils_js_1.runSingle)(async (request, attachProps) => {
372
- await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Attach" }, async () => {
373
+ await internal_4.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Attach" }, async () => {
373
374
  if (this._lifecycleState !== "loaded" ||
374
375
  this.attachmentData.state === container_definitions_1.AttachState.Attached) {
375
376
  // pre-0.58 error message: containerNotValidForAttach
376
- throw new telemetry_utils_1.UsageError(`The Container is not in a valid state for attach [${this._lifecycleState}] and [${this.attachState}]`);
377
+ throw new internal_4.UsageError(`The Container is not in a valid state for attach [${this._lifecycleState}] and [${this.attachState}]`);
377
378
  }
378
379
  const normalizeErrorAndClose = (error) => {
379
- const newError = (0, telemetry_utils_1.normalizeError)(error);
380
+ const newError = (0, internal_4.normalizeError)(error);
380
381
  this.close(newError);
381
382
  // add resolved URL on error object so that host has the ability to find this document and delete it
382
383
  newError.addTelemetryProperties({
@@ -400,7 +401,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
400
401
  };
401
402
  const createAttachmentSummary = (redirectTable) => {
402
403
  try {
403
- (0, core_utils_1.assert)(this.deltaManager.inbound.length === 0, 0x0d6 /* "Inbound queue should be empty when attaching" */);
404
+ (0, internal_2.assert)(this.deltaManager.inbound.length === 0, 0x0d6 /* "Inbound queue should be empty when attaching" */);
404
405
  return (0, utils_js_1.combineAppAndProtocolSummary)(this.runtime.createSummary(redirectTable), this.captureProtocolSummary());
405
406
  }
406
407
  catch (error) {
@@ -411,9 +412,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
411
412
  // Actually go and create the resolved document
412
413
  if (this.service === undefined) {
413
414
  const createNewResolvedUrl = await this.urlResolver.resolve(request);
414
- (0, core_utils_1.assert)(this.client.details.type !== summarizerClientType &&
415
+ (0, internal_2.assert)(this.client.details.type !== summarizerClientType &&
415
416
  createNewResolvedUrl !== undefined, 0x2c4 /* "client should not be summarizer before container is created" */);
416
- this.service = await (0, driver_utils_1.runWithRetry)(async () => this.serviceFactory.createContainer(summary, createNewResolvedUrl, this.subLogger, false), "containerAttach", this.mc.logger, {
417
+ this.service = await (0, internal_3.runWithRetry)(async () => this.serviceFactory.createContainer(summary, createNewResolvedUrl, this.subLogger, false), "containerAttach", this.mc.logger, {
417
418
  cancel: this._deltaManager.closeAbortController.signal,
418
419
  });
419
420
  }
@@ -493,7 +494,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
493
494
  const clientType = `${interactive ? "interactive" : "noninteractive"}${type !== undefined && type !== "" ? `/${type}` : ""}`;
494
495
  // Need to use the property getter for docId because for detached flow we don't have the docId initially.
495
496
  // We assign the id later so property getter is used.
496
- this.subLogger = (0, telemetry_utils_1.createChildLogger)({
497
+ this.subLogger = (0, internal_4.createChildLogger)({
497
498
  logger: subLogger,
498
499
  properties: {
499
500
  all: {
@@ -528,7 +529,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
528
529
  },
529
530
  });
530
531
  // Prefix all events in this file with container-loader
531
- this.mc = (0, telemetry_utils_1.createChildMonitoringContext)({ logger: this.subLogger, namespace: "Container" });
532
+ this.mc = (0, internal_4.createChildMonitoringContext)({ logger: this.subLogger, namespace: "Container" });
532
533
  this._deltaManager = this.createDeltaManager();
533
534
  this.connectionStateHandler = (0, connectionStateHandler_js_1.createConnectionStateHandler)({
534
535
  logger: this.mc.logger,
@@ -584,7 +585,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
584
585
  // We expose our storage publicly, so it's possible others may call uploadSummaryWithContext() with a
585
586
  // non-combined summary tree (in particular, ContainerRuntime.submitSummary). We'll intercept those calls
586
587
  // using this callback and fix them up.
587
- const addProtocolSummaryIfMissing = (summaryTree) => (0, driver_utils_1.isCombinedAppAndProtocolSummary)(summaryTree) === true
588
+ const addProtocolSummaryIfMissing = (summaryTree) => (0, internal_3.isCombinedAppAndProtocolSummary)(summaryTree) === true
588
589
  ? summaryTree
589
590
  : (0, utils_js_1.combineAppAndProtocolSummary)(summaryTree, this.captureProtocolSummary());
590
591
  // Whether the combined summary tree has been forced on by either the loader option or the monitoring context.
@@ -636,11 +637,11 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
636
637
  this.verifyClosed();
637
638
  }
638
639
  verifyClosed() {
639
- (0, core_utils_1.assert)(this.connectionState === connectionState_js_1.ConnectionState.Disconnected, 0x0cf /* "disconnect event was not raised!" */);
640
- (0, core_utils_1.assert)(this._lifecycleState === "closed" || this._lifecycleState === "disposed", 0x314 /* Container properly closed */);
640
+ (0, internal_2.assert)(this.connectionState === connectionState_js_1.ConnectionState.Disconnected, 0x0cf /* "disconnect event was not raised!" */);
641
+ (0, internal_2.assert)(this._lifecycleState === "closed" || this._lifecycleState === "disposed", 0x314 /* Container properly closed */);
641
642
  }
642
643
  closeCore(error) {
643
- (0, core_utils_1.assert)(!this.closed, 0x315 /* re-entrancy */);
644
+ (0, internal_2.assert)(!this.closed, 0x315 /* re-entrancy */);
644
645
  try {
645
646
  // Ensure that we raise all key events even if one of these throws
646
647
  try {
@@ -679,7 +680,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
679
680
  }
680
681
  }
681
682
  disposeCore(error) {
682
- (0, core_utils_1.assert)(!this._disposed, 0x54c /* Container already disposed */);
683
+ (0, internal_2.assert)(!this._disposed, 0x54c /* Container already disposed */);
683
684
  this._disposed = true;
684
685
  try {
685
686
  // Ensure that we raise all key events even if one of these throws
@@ -735,10 +736,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
735
736
  }
736
737
  async getPendingLocalStateCore(props) {
737
738
  if (this.closed || this._disposed) {
738
- throw new telemetry_utils_1.UsageError("Pending state cannot be retried if the container is closed or disposed");
739
+ throw new internal_4.UsageError("Pending state cannot be retried if the container is closed or disposed");
739
740
  }
740
- (0, core_utils_1.assert)(this.attachmentData.state === container_definitions_1.AttachState.Attached, 0x0d1 /* "Container should be attached before close" */);
741
- (0, core_utils_1.assert)(this.resolvedUrl !== undefined && this.resolvedUrl.type === "fluid", 0x0d2 /* "resolved url should be valid Fluid url" */);
741
+ (0, internal_2.assert)(this.attachmentData.state === container_definitions_1.AttachState.Attached, 0x0d1 /* "Container should be attached before close" */);
742
+ (0, internal_2.assert)(this.resolvedUrl !== undefined && this.resolvedUrl.type === "fluid", 0x0d2 /* "resolved url should be valid Fluid url" */);
742
743
  const pendingState = await this.serializedStateManager.getPendingLocalStateCore(props, this.clientId, this.runtime, this.resolvedUrl);
743
744
  return pendingState;
744
745
  }
@@ -747,18 +748,18 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
747
748
  }
748
749
  serialize() {
749
750
  if (this.attachmentData.state === container_definitions_1.AttachState.Attached || this.closed) {
750
- throw new telemetry_utils_1.UsageError("Container must not be attached or closed.");
751
+ throw new internal_4.UsageError("Container must not be attached or closed.");
751
752
  }
752
753
  const attachingData = this.attachmentData.state === container_definitions_1.AttachState.Attaching ? this.attachmentData : undefined;
753
754
  const combinedSummary = attachingData?.summary ??
754
755
  (0, utils_js_1.combineAppAndProtocolSummary)(this.runtime.createSummary(), this.captureProtocolSummary());
755
- const { tree: snapshot, blobs } = (0, utils_js_1.getSnapshotTreeAndBlobsFromSerializedContainer)(combinedSummary);
756
+ const { baseSnapshot, snapshotBlobs } = (0, utils_js_1.getSnapshotTreeAndBlobsFromSerializedContainer)(combinedSummary);
756
757
  const pendingRuntimeState = attachingData !== undefined ? this.runtime.getPendingLocalState() : undefined;
757
- (0, core_utils_1.assert)(!(0, core_utils_1.isPromiseLike)(pendingRuntimeState), 0x8e3 /* should not be a promise */);
758
+ (0, internal_2.assert)(!(0, internal_2.isPromiseLike)(pendingRuntimeState), 0x8e3 /* should not be a promise */);
758
759
  const detachedContainerState = {
759
760
  attached: false,
760
- baseSnapshot: snapshot,
761
- snapshotBlobs: blobs,
761
+ baseSnapshot,
762
+ snapshotBlobs,
762
763
  pendingRuntimeState,
763
764
  hasAttachmentBlobs: !!this.detachedBlobStorage && this.detachedBlobStorage.size > 0,
764
765
  };
@@ -782,10 +783,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
782
783
  }
783
784
  connect() {
784
785
  if (this.closed) {
785
- throw new telemetry_utils_1.UsageError(`The Container is closed and cannot be connected`);
786
+ throw new internal_4.UsageError(`The Container is closed and cannot be connected`);
786
787
  }
787
788
  else if (this.attachState !== container_definitions_1.AttachState.Attached) {
788
- throw new telemetry_utils_1.UsageError(`The Container is not attached and cannot be connected`);
789
+ throw new internal_4.UsageError(`The Container is not attached and cannot be connected`);
789
790
  }
790
791
  else if (!this.connected) {
791
792
  // Note: no need to fetch ops as we do it preemptively as part of DeltaManager.attachOpHandler().
@@ -798,8 +799,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
798
799
  }
799
800
  }
800
801
  connectInternal(args) {
801
- (0, core_utils_1.assert)(!this.closed, 0x2c5 /* "Attempting to connect() a closed Container" */);
802
- (0, core_utils_1.assert)(this.attachState === container_definitions_1.AttachState.Attached, 0x2c6 /* "Attempting to connect() a container that is not attached" */);
802
+ (0, internal_2.assert)(!this.closed, 0x2c5 /* "Attempting to connect() a closed Container" */);
803
+ (0, internal_2.assert)(this.attachState === container_definitions_1.AttachState.Attached, 0x2c6 /* "Attempting to connect() a container that is not attached" */);
803
804
  // Resume processing ops and connect to delta stream
804
805
  this.resumeInternal(args);
805
806
  // Set Auto Reconnect Mode
@@ -808,20 +809,20 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
808
809
  }
809
810
  disconnect() {
810
811
  if (this.closed) {
811
- throw new telemetry_utils_1.UsageError(`The Container is closed and cannot be disconnected`);
812
+ throw new internal_4.UsageError(`The Container is closed and cannot be disconnected`);
812
813
  }
813
814
  else {
814
815
  this.disconnectInternal({ text: "DocumentDisconnect" });
815
816
  }
816
817
  }
817
818
  disconnectInternal(reason) {
818
- (0, core_utils_1.assert)(!this.closed, 0x2c7 /* "Attempting to disconnect() a closed Container" */);
819
+ (0, internal_2.assert)(!this.closed, 0x2c7 /* "Attempting to disconnect() a closed Container" */);
819
820
  // Set Auto Reconnect Mode
820
821
  const mode = contracts_js_1.ReconnectMode.Disabled;
821
822
  this.setAutoReconnectInternal(mode, reason);
822
823
  }
823
824
  resumeInternal(args) {
824
- (0, core_utils_1.assert)(!this.closed, 0x0d9 /* "Attempting to connect() a closed DeltaManager" */);
825
+ (0, internal_2.assert)(!this.closed, 0x0d9 /* "Attempting to connect() a closed DeltaManager" */);
825
826
  // Resume processing ops
826
827
  if (this.inboundQueuePausedFromInit) {
827
828
  this.inboundQueuePausedFromInit = false;
@@ -832,7 +833,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
832
833
  this.connectToDeltaStream(args);
833
834
  }
834
835
  async proposeCodeDetails(codeDetails) {
835
- if (!(0, container_definitions_1.isFluidCodeDetails)(codeDetails)) {
836
+ if (!(0, internal_1.isFluidCodeDetails)(codeDetails)) {
836
837
  throw new Error("Provided codeDetails are not IFluidCodeDetails");
837
838
  }
838
839
  if (this.codeLoader.IFluidCodeDetailsComparer) {
@@ -858,7 +859,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
858
859
  return;
859
860
  }
860
861
  // pre-0.58 error message: existingContextDoesNotSatisfyIncomingProposal
861
- const error = new telemetry_utils_1.GenericError("Existing context does not satisfy incoming proposal");
862
+ const error = new internal_4.GenericError("Existing context does not satisfy incoming proposal");
862
863
  this.close(error);
863
864
  }
864
865
  /**
@@ -935,10 +936,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
935
936
  state: container_definitions_1.AttachState.Attached,
936
937
  };
937
938
  timings.phase2 = client_utils_1.performance.now();
939
+ const supportGetSnapshotApi = this.mc.config.getBoolean("Fluid.Container.UseLoadingGroupIdForSnapshotFetch") ===
940
+ true && this.service?.policies?.supportGetSnapshotApi === true;
938
941
  // Fetch specified snapshot.
939
- const { snapshotTree, version } = await this.serializedStateManager.fetchSnapshot(specifiedVersion, this.service?.policies?.supportGetSnapshotApi);
942
+ const { baseSnapshot, version } = await this.serializedStateManager.fetchSnapshot(specifiedVersion, supportGetSnapshotApi);
940
943
  this._loadedFromVersion = version;
941
- const attributes = await this.getDocumentAttributes(this.storageAdapter, snapshotTree);
944
+ const attributes = await (0, utils_js_1.getDocumentAttributes)(this.storageAdapter, baseSnapshot);
942
945
  // If we saved ops, we will replay them and don't need DeltaManager to fetch them
943
946
  const sequenceNumber = pendingLocalState?.savedOps[pendingLocalState.savedOps.length - 1]?.sequenceNumber;
944
947
  const dmAttributes = sequenceNumber !== undefined ? { ...attributes, sequenceNumber } : attributes;
@@ -946,7 +949,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
946
949
  if (loadMode.pauseAfterLoad === true) {
947
950
  // If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.
948
951
  if (loadMode.opsBeforeReturn === "sequenceNumber") {
949
- (0, core_utils_1.assert)(loadToSequenceNumber !== undefined, 0x727 /* sequenceNumber should be defined */);
952
+ (0, internal_2.assert)(loadToSequenceNumber !== undefined, 0x727 /* sequenceNumber should be defined */);
950
953
  // Note: It is possible that we think the latest snapshot is newer than the specified sequence number
951
954
  // due to saved ops that may be replayed after the snapshot.
952
955
  // https://dev.azure.com/fluidframework/internal/_workitems/edit/5055
@@ -999,16 +1002,16 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
999
1002
  opsBeforeReturnP = this.attachDeltaManagerOpHandler(dmAttributes, loadMode.opsBeforeReturn);
1000
1003
  break;
1001
1004
  default:
1002
- (0, core_utils_1.unreachableCase)(loadMode.opsBeforeReturn);
1005
+ (0, internal_2.unreachableCase)(loadMode.opsBeforeReturn);
1003
1006
  }
1004
1007
  // ...load in the existing quorum
1005
1008
  // Initialize the protocol handler
1006
- await this.initializeProtocolStateFromSnapshot(attributes, this.storageAdapter, snapshotTree);
1009
+ await this.initializeProtocolStateFromSnapshot(attributes, this.storageAdapter, baseSnapshot);
1007
1010
  timings.phase3 = client_utils_1.performance.now();
1008
1011
  const codeDetails = this.getCodeDetailsFromQuorum();
1009
- await this.instantiateRuntime(codeDetails, snapshotTree,
1012
+ await this.instantiateRuntime(codeDetails, baseSnapshot,
1010
1013
  // give runtime a dummy value so it knows we're loading from a stash blob
1011
- pendingLocalState ? pendingLocalState?.pendingRuntimeState ?? {} : undefined, (0, driver_utils_1.isInstanceOfISnapshot)(snapshotTree) ? snapshotTree : undefined);
1014
+ pendingLocalState ? pendingLocalState?.pendingRuntimeState ?? {} : undefined, (0, internal_3.isInstanceOfISnapshot)(baseSnapshot) ? baseSnapshot : undefined);
1012
1015
  // replay saved ops
1013
1016
  if (pendingLocalState) {
1014
1017
  for (const message of pendingLocalState.savedOps) {
@@ -1026,8 +1029,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1026
1029
  if (!this.closed) {
1027
1030
  if (opsBeforeReturnP !== undefined) {
1028
1031
  this._deltaManager.inbound.resume();
1029
- await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "WaitOps" }, async () => opsBeforeReturnP);
1030
- await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "WaitOpProcessing" }, async () => this._deltaManager.inbound.waitTillProcessingDone());
1032
+ await internal_4.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "WaitOps" }, async () => opsBeforeReturnP);
1033
+ await internal_4.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "WaitOpProcessing" }, async () => this._deltaManager.inbound.waitTillProcessingDone());
1031
1034
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
1032
1035
  this._deltaManager.inbound.pause();
1033
1036
  }
@@ -1086,15 +1089,15 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1086
1089
  }
1087
1090
  async rehydrateDetachedFromSnapshot({ baseSnapshot, snapshotBlobs, hasAttachmentBlobs, pendingRuntimeState, }) {
1088
1091
  if (hasAttachmentBlobs) {
1089
- (0, core_utils_1.assert)(!!this.detachedBlobStorage && this.detachedBlobStorage.size > 0, 0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */);
1092
+ (0, internal_2.assert)(!!this.detachedBlobStorage && this.detachedBlobStorage.size > 0, 0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */);
1090
1093
  }
1091
1094
  const snapshotTreeWithBlobContents = (0, utils_js_1.combineSnapshotTreeAndSnapshotBlobs)(baseSnapshot, snapshotBlobs);
1092
1095
  this.storageAdapter.loadSnapshotFromSnapshotBlobs(snapshotBlobs);
1093
- const attributes = await this.getDocumentAttributes(this.storageAdapter, snapshotTreeWithBlobContents);
1096
+ const attributes = await (0, utils_js_1.getDocumentAttributes)(this.storageAdapter, snapshotTreeWithBlobContents);
1094
1097
  await this.attachDeltaManagerOpHandler(attributes);
1095
1098
  // Initialize the protocol handler
1096
1099
  const baseTree = (0, utils_js_1.getProtocolSnapshotTree)(snapshotTreeWithBlobContents);
1097
- const qValues = await (0, driver_utils_1.readAndParse)(this.storageAdapter, baseTree.blobs.quorumValues);
1100
+ const qValues = await (0, internal_3.readAndParse)(this.storageAdapter, baseTree.blobs.quorumValues);
1098
1101
  this.initializeProtocolState(attributes, {
1099
1102
  members: [],
1100
1103
  proposals: [],
@@ -1104,20 +1107,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1104
1107
  await this.instantiateRuntime(codeDetails, snapshotTreeWithBlobContents, pendingRuntimeState);
1105
1108
  this.setLoaded();
1106
1109
  }
1107
- async getDocumentAttributes(storage, tree) {
1108
- if (tree === undefined) {
1109
- return {
1110
- minimumSequenceNumber: 0,
1111
- sequenceNumber: 0,
1112
- };
1113
- }
1114
- // Backward compatibility: old docs would have ".attributes" instead of "attributes"
1115
- const attributesHash = ".protocol" in tree.trees
1116
- ? tree.trees[".protocol"].blobs.attributes
1117
- : tree.blobs[".attributes"];
1118
- const attributes = await (0, driver_utils_1.readAndParse)(storage, attributesHash);
1119
- return attributes;
1120
- }
1121
1110
  async initializeProtocolStateFromSnapshot(attributes, storage, snapshot) {
1122
1111
  const quorumSnapshot = {
1123
1112
  members: [],
@@ -1128,16 +1117,16 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1128
1117
  const baseTree = (0, utils_js_1.getProtocolSnapshotTree)(snapshot);
1129
1118
  [quorumSnapshot.members, quorumSnapshot.proposals, quorumSnapshot.values] =
1130
1119
  await Promise.all([
1131
- (0, driver_utils_1.readAndParse)(storage, baseTree.blobs.quorumMembers),
1132
- (0, driver_utils_1.readAndParse)(storage, baseTree.blobs.quorumProposals),
1133
- (0, driver_utils_1.readAndParse)(storage, baseTree.blobs.quorumValues),
1120
+ (0, internal_3.readAndParse)(storage, baseTree.blobs.quorumMembers),
1121
+ (0, internal_3.readAndParse)(storage, baseTree.blobs.quorumProposals),
1122
+ (0, internal_3.readAndParse)(storage, baseTree.blobs.quorumValues),
1134
1123
  ]);
1135
1124
  }
1136
1125
  this.initializeProtocolState(attributes, quorumSnapshot);
1137
1126
  }
1138
1127
  initializeProtocolState(attributes, quorumSnapshot) {
1139
1128
  const protocol = this.protocolHandlerBuilder(attributes, quorumSnapshot, (key, value) => this.submitMessage(protocol_definitions_1.MessageType.Propose, JSON.stringify({ key, value })));
1140
- const protocolLogger = (0, telemetry_utils_1.createChildLogger)({
1129
+ const protocolLogger = (0, internal_4.createChildLogger)({
1141
1130
  logger: this.subLogger,
1142
1131
  namespace: "ProtocolHandler",
1143
1132
  });
@@ -1153,13 +1142,13 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1153
1142
  });
1154
1143
  protocol.quorum.on("approveProposal", (sequenceNumber, key, value) => {
1155
1144
  if (key === "code" || key === "code2") {
1156
- if (!(0, container_definitions_1.isFluidCodeDetails)(value)) {
1145
+ if (!(0, internal_1.isFluidCodeDetails)(value)) {
1157
1146
  this.mc.logger.sendErrorEvent({
1158
1147
  eventName: "CodeProposalNotIFluidCodeDetails",
1159
1148
  });
1160
1149
  }
1161
1150
  this.processCodeProposal().catch((error) => {
1162
- const normalizedError = (0, telemetry_utils_1.normalizeError)(error);
1151
+ const normalizedError = (0, internal_4.normalizeError)(error);
1163
1152
  this.close(normalizedError);
1164
1153
  throw error;
1165
1154
  });
@@ -1241,14 +1230,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1241
1230
  }
1242
1231
  createDeltaManager() {
1243
1232
  const serviceProvider = () => this.service;
1244
- const deltaManager = new deltaManager_js_1.DeltaManager(serviceProvider, (0, telemetry_utils_1.createChildLogger)({ logger: this.subLogger, namespace: "DeltaManager" }), () => this.activeConnection(), (props) => new connectionManager_js_1.ConnectionManager(serviceProvider, () => this.isDirty, this.client, this._canReconnect, (0, telemetry_utils_1.createChildLogger)({ logger: this.subLogger, namespace: "ConnectionManager" }), props));
1233
+ const deltaManager = new deltaManager_js_1.DeltaManager(serviceProvider, (0, internal_4.createChildLogger)({ logger: this.subLogger, namespace: "DeltaManager" }), () => this.activeConnection(), (props) => new connectionManager_js_1.ConnectionManager(serviceProvider, () => this.isDirty, this.client, this._canReconnect, (0, internal_4.createChildLogger)({ logger: this.subLogger, namespace: "ConnectionManager" }), props));
1245
1234
  // Disable inbound queues as Container is not ready to accept any ops until we are fully loaded!
1246
1235
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
1247
1236
  deltaManager.inbound.pause();
1248
1237
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
1249
1238
  deltaManager.inboundSignal.pause();
1250
1239
  deltaManager.on("connect", (details, _opsBehind) => {
1251
- (0, core_utils_1.assert)(this.connectionMode === details.mode, 0x4b7 /* mismatch */);
1240
+ (0, internal_2.assert)(this.connectionMode === details.mode, 0x4b7 /* mismatch */);
1252
1241
  this.connectionStateHandler.receivedConnectEvent(details);
1253
1242
  });
1254
1243
  deltaManager.on("establishingConnection", (reason) => {
@@ -1309,7 +1298,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1309
1298
  if (value === connectionState_js_1.ConnectionState.Connected) {
1310
1299
  durationFromDisconnected =
1311
1300
  time - this.connectionTransitionTimes[connectionState_js_1.ConnectionState.Disconnected];
1312
- durationFromDisconnected = (0, telemetry_utils_1.formatTick)(durationFromDisconnected);
1301
+ durationFromDisconnected = (0, internal_4.formatTick)(durationFromDisconnected);
1313
1302
  }
1314
1303
  else if (value === connectionState_js_1.ConnectionState.CatchingUp) {
1315
1304
  // This info is of most interesting while Catching Up.
@@ -1333,7 +1322,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1333
1322
  clientId: this.clientId,
1334
1323
  autoReconnect,
1335
1324
  opsBehind,
1336
- online: driver_utils_1.OnlineStatus[(0, driver_utils_1.isOnline)()],
1325
+ online: internal_3.OnlineStatus[(0, internal_3.isOnline)()],
1337
1326
  lastVisible: this.lastVisible !== undefined
1338
1327
  ? client_utils_1.performance.now() - this.lastVisible
1339
1328
  : undefined,
@@ -1359,7 +1348,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1359
1348
  // Both protocol and context should not be undefined if we got so far.
1360
1349
  this.setContextConnectedState(state, this.readOnlyInfo.readonly ?? false);
1361
1350
  this.protocolHandler.setConnectionState(state, this.clientId);
1362
- (0, telemetry_utils_1.raiseConnectedEvent)(this.mc.logger, this, state, this.clientId, disconnectedReason?.text);
1351
+ (0, internal_4.raiseConnectedEvent)(this.mc.logger, this, state, this.clientId, disconnectedReason?.text);
1363
1352
  }
1364
1353
  // back-compat: ADO #1385: Remove in the future, summary op should come through submitSummaryMessage()
1365
1354
  submitContainerMessage(type, contents, batch, metadata) {
@@ -1369,7 +1358,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1369
1358
  case protocol_definitions_1.MessageType.Summarize:
1370
1359
  return this.submitSummaryMessage(contents);
1371
1360
  default: {
1372
- const newError = new telemetry_utils_1.GenericError("invalidContainerSubmitOpType", undefined /* error */, { messageType: type });
1361
+ const newError = new internal_4.GenericError("invalidContainerSubmitOpType", undefined /* error */, { messageType: type });
1373
1362
  this.close(newError);
1374
1363
  return -1;
1375
1364
  }
@@ -1419,13 +1408,13 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1419
1408
  // That means that if relay service changes settings, such changes will impact only newly booted
1420
1409
  // clients.
1421
1410
  // All existing will continue to use settings they got earlier.
1422
- (0, core_utils_1.assert)(serviceConfiguration !== undefined, 0x2e4 /* "there should be service config for active connection" */);
1411
+ (0, internal_2.assert)(serviceConfiguration !== undefined, 0x2e4 /* "there should be service config for active connection" */);
1423
1412
  this.noopHeuristic = new noopHeuristic_js_1.NoopHeuristic(serviceConfiguration.noopTimeFrequency, serviceConfiguration.noopCountFrequency);
1424
1413
  this.noopHeuristic.on("wantsNoop", () => {
1425
1414
  // On disconnect we notify the heuristic which should prevent it from wanting a noop.
1426
1415
  // Hitting this assert would imply we lost activeConnection between notifying the heuristic of a processed message and
1427
1416
  // running the microtask that the heuristic queued in response.
1428
- (0, core_utils_1.assert)(this.activeConnection(), 0x241 /* "Trying to send noop without active connection" */);
1417
+ (0, internal_2.assert)(this.activeConnection(), 0x241 /* "Trying to send noop without active connection" */);
1429
1418
  this.submitMessage(protocol_definitions_1.MessageType.NoOp);
1430
1419
  });
1431
1420
  }
@@ -1433,11 +1422,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1433
1422
  // The contract with the protocolHandler is that returning "immediateNoOp" is equivalent to "please immediately accept the proposal I just processed".
1434
1423
  if (result.immediateNoOp === true) {
1435
1424
  // ADO:1385: Remove cast and use MessageType once definition changes propagate
1436
- this.submitMessage(driver_utils_1.MessageType2.Accept);
1425
+ this.submitMessage(internal_3.MessageType2.Accept);
1437
1426
  }
1438
1427
  }
1439
1428
  this.emit("op", message);
1440
1429
  }
1430
+ // unknown should be removed once `@alpha` tag is removed from IContainerContext
1441
1431
  submitSignal(content, targetClientId) {
1442
1432
  this._deltaManager.submitSignal(JSON.stringify(content), targetClientId);
1443
1433
  }
@@ -1452,12 +1442,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1452
1442
  }
1453
1443
  }
1454
1444
  async instantiateRuntime(codeDetails, snapshotTree, pendingLocalState, snapshot) {
1455
- (0, core_utils_1.assert)(this._runtime?.disposed !== false, 0x0dd /* "Existing runtime not disposed" */);
1445
+ (0, internal_2.assert)(this._runtime?.disposed !== false, 0x0dd /* "Existing runtime not disposed" */);
1456
1446
  // The relative loader will proxy requests to '/' to the loader itself assuming no non-cache flags
1457
1447
  // are set. Global requests will still go directly to the loader
1458
1448
  const maybeLoader = this.scope;
1459
1449
  const loader = new loader_js_1.RelativeLoader(this, maybeLoader.ILoader);
1460
- const loadCodeResult = await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "CodeLoad" }, async () => this.codeLoader.load(codeDetails));
1450
+ const loadCodeResult = await internal_4.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "CodeLoad" }, async () => this.codeLoader.load(codeDetails));
1461
1451
  this._loadedModule = {
1462
1452
  module: loadCodeResult.module,
1463
1453
  // An older interface ICodeLoader could return an IFluidModule which didn't have details.
@@ -1470,11 +1460,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1470
1460
  if (runtimeFactory === undefined) {
1471
1461
  throw new Error(packageNotFactoryError);
1472
1462
  }
1473
- const getSpecifiedCodeDetails = () => (this.protocolHandler.quorum.get("code") ??
1474
- this.protocolHandler.quorum.get("code2"));
1475
1463
  const existing = snapshotTree !== undefined;
1476
- const context = new containerContext_js_1.ContainerContext(this.options, this.scope, snapshotTree, this._loadedFromVersion, this._deltaManager, this.storageAdapter, this.protocolHandler.quorum, this.protocolHandler.audience, loader, (type, contents, batch, metadata) => this.submitContainerMessage(type, contents, batch, metadata), (summaryOp, referenceSequenceNumber) => this.submitSummaryMessage(summaryOp, referenceSequenceNumber), (batch, referenceSequenceNumber) => this.submitBatch(batch, referenceSequenceNumber), (content, targetClientId) => this.submitSignal(content, targetClientId), (error) => this.dispose(error), (error) => this.close(error), this.updateDirtyContainerState, this.getAbsoluteUrl, () => this.resolvedUrl?.id, () => this.clientId, () => this.attachState, () => this.connected, getSpecifiedCodeDetails, this._deltaManager.clientDetails, existing, this.subLogger, pendingLocalState, snapshot);
1477
- this._runtime = await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(context, existing));
1464
+ const context = new containerContext_js_1.ContainerContext(this.options, this.scope, snapshotTree, this._loadedFromVersion, this._deltaManager, this.storageAdapter, this.protocolHandler.quorum, this.protocolHandler.audience, loader, (type, contents, batch, metadata) => this.submitContainerMessage(type, contents, batch, metadata), (summaryOp, referenceSequenceNumber) => this.submitSummaryMessage(summaryOp, referenceSequenceNumber), (batch, referenceSequenceNumber) => this.submitBatch(batch, referenceSequenceNumber), (content, targetClientId) => this.submitSignal(content, targetClientId), (error) => this.dispose(error), (error) => this.close(error), this.updateDirtyContainerState, this.getAbsoluteUrl, () => this.resolvedUrl?.id, () => this.clientId, () => this.attachState, () => this.connected, this._deltaManager.clientDetails, existing, this.subLogger, pendingLocalState, snapshot);
1465
+ this._runtime = await internal_4.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(context, existing));
1478
1466
  this._lifecycleEvents.emit("runtimeInstantiated");
1479
1467
  this._loadedCodeDetails = codeDetails;
1480
1468
  }
@@ -1504,7 +1492,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1504
1492
  }
1505
1493
  // intentional fallthrough
1506
1494
  case "delayed":
1507
- (0, core_utils_1.assert)(this.inboundQueuePausedFromInit, 0x346 /* inboundQueuePausedFromInit should be true */);
1495
+ (0, internal_2.assert)(this.inboundQueuePausedFromInit, 0x346 /* inboundQueuePausedFromInit should be true */);
1508
1496
  this.inboundQueuePausedFromInit = false;
1509
1497
  this._deltaManager.inbound.resume();
1510
1498
  this._deltaManager.inboundSignal.resume();
@@ -1512,7 +1500,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
1512
1500
  case "none":
1513
1501
  break;
1514
1502
  default:
1515
- (0, core_utils_1.unreachableCase)(deltaConnectionArg);
1503
+ (0, internal_2.unreachableCase)(deltaConnectionArg);
1516
1504
  }
1517
1505
  }
1518
1506
  }