@fluidframework/test-utils 2.0.0-rc.1.0.4 → 2.0.0-rc.2.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 (151) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +4 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +34 -0
  4. package/README.md +1 -1
  5. package/api-extractor-cjs.json +8 -0
  6. package/api-extractor-lint.json +1 -1
  7. package/api-extractor.json +1 -1
  8. package/api-report/test-utils.api.md +27 -9
  9. package/dist/DriverWrappers.d.ts +3 -0
  10. package/dist/DriverWrappers.d.ts.map +1 -1
  11. package/dist/DriverWrappers.js +3 -0
  12. package/dist/DriverWrappers.js.map +1 -1
  13. package/dist/TestConfigs.d.ts +14 -1
  14. package/dist/TestConfigs.d.ts.map +1 -1
  15. package/dist/TestConfigs.js +14 -3
  16. package/dist/TestConfigs.js.map +1 -1
  17. package/dist/TestSummaryUtils.d.ts +7 -2
  18. package/dist/TestSummaryUtils.d.ts.map +1 -1
  19. package/dist/TestSummaryUtils.js +39 -14
  20. package/dist/TestSummaryUtils.js.map +1 -1
  21. package/dist/containerUtils.d.ts +1 -1
  22. package/dist/containerUtils.d.ts.map +1 -1
  23. package/dist/containerUtils.js +2 -2
  24. package/dist/containerUtils.js.map +1 -1
  25. package/dist/debug.js +2 -2
  26. package/dist/debug.js.map +1 -1
  27. package/dist/index.d.ts +14 -14
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +44 -43
  30. package/dist/index.js.map +1 -1
  31. package/dist/loaderContainerTracker.d.ts +1 -1
  32. package/dist/loaderContainerTracker.d.ts.map +1 -1
  33. package/dist/loaderContainerTracker.js +11 -11
  34. package/dist/loaderContainerTracker.js.map +1 -1
  35. package/dist/localLoader.d.ts +1 -1
  36. package/dist/localLoader.d.ts.map +1 -1
  37. package/dist/localLoader.js +2 -2
  38. package/dist/localLoader.js.map +1 -1
  39. package/dist/package.json +3 -0
  40. package/dist/packageVersion.d.ts +1 -1
  41. package/dist/packageVersion.js +1 -1
  42. package/dist/packageVersion.js.map +1 -1
  43. package/dist/test-utils-alpha.d.ts +7 -3
  44. package/dist/test-utils-beta.d.ts +9 -3
  45. package/dist/test-utils-public.d.ts +9 -3
  46. package/dist/test-utils-untrimmed.d.ts +59 -14
  47. package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
  48. package/dist/testContainerRuntimeFactory.js +9 -2
  49. package/dist/testContainerRuntimeFactory.js.map +1 -1
  50. package/dist/testFluidObject.d.ts +1 -1
  51. package/dist/testFluidObject.d.ts.map +1 -1
  52. package/dist/testFluidObject.js.map +1 -1
  53. package/dist/testObjectProvider.d.ts +34 -11
  54. package/dist/testObjectProvider.d.ts.map +1 -1
  55. package/dist/testObjectProvider.js +71 -38
  56. package/dist/testObjectProvider.js.map +1 -1
  57. package/dist/timeoutUtils.d.ts.map +1 -1
  58. package/dist/timeoutUtils.js.map +1 -1
  59. package/dist/tsdoc-metadata.json +1 -1
  60. package/lib/DriverWrappers.d.ts +35 -0
  61. package/lib/DriverWrappers.d.ts.map +1 -0
  62. package/lib/DriverWrappers.js +54 -0
  63. package/lib/DriverWrappers.js.map +1 -0
  64. package/lib/TestConfigs.d.ts +23 -0
  65. package/lib/TestConfigs.d.ts.map +1 -0
  66. package/lib/TestConfigs.js +24 -0
  67. package/lib/TestConfigs.js.map +1 -0
  68. package/lib/TestSummaryUtils.d.ts +66 -0
  69. package/lib/TestSummaryUtils.d.ts.map +1 -0
  70. package/lib/TestSummaryUtils.js +153 -0
  71. package/lib/TestSummaryUtils.js.map +1 -0
  72. package/lib/containerUtils.d.ts +46 -0
  73. package/lib/containerUtils.d.ts.map +1 -0
  74. package/lib/containerUtils.js +79 -0
  75. package/lib/containerUtils.js.map +1 -0
  76. package/lib/debug.d.ts +7 -0
  77. package/lib/debug.d.ts.map +1 -0
  78. package/lib/debug.js +9 -0
  79. package/lib/debug.js.map +1 -0
  80. package/lib/index.d.ts +19 -0
  81. package/lib/index.d.ts.map +1 -0
  82. package/lib/index.js +18 -0
  83. package/lib/index.js.map +1 -0
  84. package/lib/interfaces.d.ts +25 -0
  85. package/lib/interfaces.d.ts.map +1 -0
  86. package/lib/interfaces.js +6 -0
  87. package/lib/interfaces.js.map +1 -0
  88. package/lib/loaderContainerTracker.d.ts +144 -0
  89. package/lib/loaderContainerTracker.d.ts.map +1 -0
  90. package/lib/loaderContainerTracker.js +631 -0
  91. package/lib/loaderContainerTracker.js.map +1 -0
  92. package/lib/localCodeLoader.d.ts +31 -0
  93. package/lib/localCodeLoader.d.ts.map +1 -0
  94. package/lib/localCodeLoader.js +73 -0
  95. package/lib/localCodeLoader.js.map +1 -0
  96. package/lib/localLoader.d.ts +26 -0
  97. package/lib/localLoader.d.ts.map +1 -0
  98. package/lib/localLoader.js +37 -0
  99. package/lib/localLoader.js.map +1 -0
  100. package/lib/packageVersion.d.ts +9 -0
  101. package/lib/packageVersion.d.ts.map +1 -0
  102. package/lib/packageVersion.js +9 -0
  103. package/lib/packageVersion.js.map +1 -0
  104. package/lib/retry.d.ts +18 -0
  105. package/lib/retry.d.ts.map +1 -0
  106. package/lib/retry.js +37 -0
  107. package/lib/retry.js.map +1 -0
  108. package/lib/test/timeoutUtils.spec.js +165 -0
  109. package/lib/test/timeoutUtils.spec.js.map +1 -0
  110. package/lib/test/types/validateTestUtilsPrevious.generated.js +90 -0
  111. package/lib/test/types/validateTestUtilsPrevious.generated.js.map +1 -0
  112. package/lib/test-utils-alpha.d.ts +309 -0
  113. package/lib/test-utils-beta.d.ts +208 -0
  114. package/lib/test-utils-public.d.ts +208 -0
  115. package/lib/test-utils-untrimmed.d.ts +1046 -0
  116. package/lib/testContainerRuntimeFactory.d.ts +46 -0
  117. package/lib/testContainerRuntimeFactory.d.ts.map +1 -0
  118. package/lib/testContainerRuntimeFactory.js +113 -0
  119. package/lib/testContainerRuntimeFactory.js.map +1 -0
  120. package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +23 -0
  121. package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -0
  122. package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js +28 -0
  123. package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -0
  124. package/lib/testFluidObject.d.ts +92 -0
  125. package/lib/testFluidObject.d.ts.map +1 -0
  126. package/lib/testFluidObject.js +159 -0
  127. package/lib/testFluidObject.js.map +1 -0
  128. package/lib/testObjectProvider.d.ts +435 -0
  129. package/lib/testObjectProvider.d.ts.map +1 -0
  130. package/lib/testObjectProvider.js +636 -0
  131. package/lib/testObjectProvider.js.map +1 -0
  132. package/lib/timeoutUtils.d.ts +60 -0
  133. package/lib/timeoutUtils.d.ts.map +1 -0
  134. package/lib/timeoutUtils.js +164 -0
  135. package/lib/timeoutUtils.js.map +1 -0
  136. package/package.json +105 -38
  137. package/src/DriverWrappers.ts +3 -0
  138. package/src/TestConfigs.ts +25 -3
  139. package/src/TestSummaryUtils.ts +36 -12
  140. package/src/containerUtils.ts +1 -1
  141. package/src/debug.ts +1 -1
  142. package/src/index.ts +19 -14
  143. package/src/loaderContainerTracker.ts +5 -5
  144. package/src/localLoader.ts +1 -1
  145. package/src/packageVersion.ts +1 -1
  146. package/src/testContainerRuntimeFactory.ts +12 -2
  147. package/src/testFluidObject.ts +1 -1
  148. package/src/testObjectProvider.ts +99 -34
  149. package/src/timeoutUtils.ts +1 -0
  150. package/tsconfig.cjs.json +7 -0
  151. package/tsconfig.json +3 -4
@@ -1 +1 @@
1
- {"version":3,"file":"containerUtils.js","sourceRoot":"","sources":["../src/containerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uEAAmE;AAEnE,2DAAoD;AAEpD,iDAAmF;AAEnF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,KAAK,UAAU,0BAA0B,CAC/C,SAAqB,EACrB,uBAAgC,IAAI,EACpC,cAAiC;IAEjC,IAAI,SAAS,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AC;KAChD;IACD,MAAM,QAAQ,GAAc,MAAO,SAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1E,IAAA,mBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,yCAAyC,CAAC,CAAC;IAC3E,OAAO,QAAQ,CAAC,KAAU,CAAC;AAC5B,CAAC;AAPD,4EAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainer } from \"@fluidframework/container-definitions\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport { IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDataStore } from \"@fluidframework/runtime-definitions\";\nimport { PromiseExecutor, timeoutPromise, TimeoutWithError } from \"./timeoutUtils\";\n\n/**\n * Utility function to wait for the specified Container to be in Connected state.\n * If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits\n * its 'connected' event.\n * If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event\n * before a 'connected' event.\n * @param container - The container to wait for.\n * @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event\n * before a 'connected' event.\n * Defaults to true.\n * @param timeoutOptions - Options related to the behavior of the timeout.\n * If provided, the returned Promise will reject if the container hasn't emitted relevant events in timeoutOptions.durationMs.\n * If not provided, the Promise will wait indefinitely for the Container to emit its 'connected' (or 'closed', if\n * failOnContainerClose === true) event.\n *\n * @returns A Promise that either:\n * - Resolves when the specified container emits a 'connected' event (or immediately if the Container is already connected).\n * - Rejects if failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event.\n * - Rejects after timeoutOptions.durationMs if timeoutOptions !== undefined and the container does not emit relevant\n * events, within that timeframe.\n * @internal\n */\nexport async function waitForContainerConnection(\n\tcontainer: IContainer,\n\tfailOnContainerClose: boolean = true,\n\ttimeoutOptions?: TimeoutWithError,\n): Promise<void> {\n\tif (container.connectionState !== ConnectionState.Connected) {\n\t\tconst executor: PromiseExecutor = (resolve, reject) => {\n\t\t\tcontainer.once(\"connected\", () => resolve());\n\t\t\tif (failOnContainerClose) {\n\t\t\t\tcontainer.once(\"closed\", (error) => reject(error));\n\t\t\t}\n\t\t};\n\n\t\treturn timeoutOptions === undefined\n\t\t\t? new Promise(executor)\n\t\t\t: timeoutPromise(executor, timeoutOptions);\n\t}\n}\n\n/**\n * This function should ONLY be used for back compat purposes\n * LTS versions of the Loader/Container will not have the \"getEntryPoint\" method, so we need to fallback to \"request\"\n * This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0\n * @internal\n */\nexport async function getContainerEntryPointBackCompat<T>(container: IContainer): Promise<T> {\n\tif (container.getEntryPoint !== undefined) {\n\t\tconst entryPoint = await container.getEntryPoint();\n\t\t// Note: We need to also check if the result of `getEntryPoint()` is defined. This is because when running\n\t\t// cross version compat testing scenarios, if we create with 1.X container and load with 2.X then the\n\t\t// function container.getEntryPoint will be defined for the 2.X container. However, it will not return undefined\n\t\t// since the container's runtime will be on version 1.X, which does not have an entry point defined.\n\t\tif (entryPoint !== undefined) {\n\t\t\treturn entryPoint as T;\n\t\t}\n\t}\n\tconst response: IResponse = await (container as any).request({ url: \"/\" });\n\tassert(response.status === 200, \"requesting '/' should return default data object\");\n\treturn response.value as T;\n}\n\n/**\n * This function should ONLY be used for back compat purposes\n * Older supported versions of IDataStore do not have the \"entryPoint\" property, so we need to fallback to \"request\"\n * This function can be removed once back-compat support for IDataStore moves to 2.0.0-internal.7.0.0\n *\n * @internal\n */\nexport async function getDataStoreEntryPointBackCompat<T>(dataStore: IDataStore): Promise<T> {\n\tif (dataStore.entryPoint !== undefined) {\n\t\treturn dataStore.entryPoint.get() as Promise<T>;\n\t}\n\tconst response: IResponse = await (dataStore as any).request({ url: \"\" });\n\tassert(response.status === 200, \"empty request should return data object\");\n\treturn response.value as T;\n}\n"]}
1
+ {"version":3,"file":"containerUtils.js","sourceRo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CAAC,CAAC;IACpF,OAAO,QAAQ,CAAC,KAAU,CAAC;AAC5B,CAAC;AAdD,4EAcC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,gCAAgC,CAAI,SAAqB;IAC9E,IAAI,SAAS,CAAC,UAAU,KAAK,SAAS,EAAE;QACvC,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,EAAgB,CAAC;KAChD;IACD,MAAM,QAAQ,GAAc,MAAO,SAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1E,IAAA,mBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,yCAAyC,CAAC,CAAC;IAC3E,OAAO,QAAQ,CAAC,KAAU,CAAC;AAC5B,CAAC;AAPD,4EAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainer } from \"@fluidframework/container-definitions\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport { IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDataStore } from \"@fluidframework/runtime-definitions\";\nimport { PromiseExecutor, timeoutPromise, TimeoutWithError } from \"./timeoutUtils.js\";\n\n/**\n * Utility function to wait for the specified Container to be in Connected state.\n * If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits\n * its 'connected' event.\n * If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event\n * before a 'connected' event.\n * @param container - The container to wait for.\n * @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event\n * before a 'connected' event.\n * Defaults to true.\n * @param timeoutOptions - Options related to the behavior of the timeout.\n * If provided, the returned Promise will reject if the container hasn't emitted relevant events in timeoutOptions.durationMs.\n * If not provided, the Promise will wait indefinitely for the Container to emit its 'connected' (or 'closed', if\n * failOnContainerClose === true) event.\n *\n * @returns A Promise that either:\n * - Resolves when the specified container emits a 'connected' event (or immediately if the Container is already connected).\n * - Rejects if failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event.\n * - Rejects after timeoutOptions.durationMs if timeoutOptions !== undefined and the container does not emit relevant\n * events, within that timeframe.\n * @internal\n */\nexport async function waitForContainerConnection(\n\tcontainer: IContainer,\n\tfailOnContainerClose: boolean = true,\n\ttimeoutOptions?: TimeoutWithError,\n): Promise<void> {\n\tif (container.connectionState !== ConnectionState.Connected) {\n\t\tconst executor: PromiseExecutor = (resolve, reject) => {\n\t\t\tcontainer.once(\"connected\", () => resolve());\n\t\t\tif (failOnContainerClose) {\n\t\t\t\tcontainer.once(\"closed\", (error) => reject(error));\n\t\t\t}\n\t\t};\n\n\t\treturn timeoutOptions === undefined\n\t\t\t? new Promise(executor)\n\t\t\t: timeoutPromise(executor, timeoutOptions);\n\t}\n}\n\n/**\n * This function should ONLY be used for back compat purposes\n * LTS versions of the Loader/Container will not have the \"getEntryPoint\" method, so we need to fallback to \"request\"\n * This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0\n * @internal\n */\nexport async function getContainerEntryPointBackCompat<T>(container: IContainer): Promise<T> {\n\tif (container.getEntryPoint !== undefined) {\n\t\tconst entryPoint = await container.getEntryPoint();\n\t\t// Note: We need to also check if the result of `getEntryPoint()` is defined. This is because when running\n\t\t// cross version compat testing scenarios, if we create with 1.X container and load with 2.X then the\n\t\t// function container.getEntryPoint will be defined for the 2.X container. However, it will not return undefined\n\t\t// since the container's runtime will be on version 1.X, which does not have an entry point defined.\n\t\tif (entryPoint !== undefined) {\n\t\t\treturn entryPoint as T;\n\t\t}\n\t}\n\tconst response: IResponse = await (container as any).request({ url: \"/\" });\n\tassert(response.status === 200, \"requesting '/' should return default data object\");\n\treturn response.value as T;\n}\n\n/**\n * This function should ONLY be used for back compat purposes\n * Older supported versions of IDataStore do not have the \"entryPoint\" property, so we need to fallback to \"request\"\n * This function can be removed once back-compat support for IDataStore moves to 2.0.0-internal.7.0.0\n *\n * @internal\n */\nexport async function getDataStoreEntryPointBackCompat<T>(dataStore: IDataStore): Promise<T> {\n\tif (dataStore.entryPoint !== undefined) {\n\t\treturn dataStore.entryPoint.get() as Promise<T>;\n\t}\n\tconst response: IResponse = await (dataStore as any).request({ url: \"\" });\n\tassert(response.status === 200, \"empty request should return data object\");\n\treturn response.value as T;\n}\n"]}
package/dist/debug.js CHANGED
@@ -9,7 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.debug = void 0;
11
11
  const debug_1 = __importDefault(require("debug"));
12
- const packageVersion_1 = require("./packageVersion");
12
+ const packageVersion_js_1 = require("./packageVersion.js");
13
13
  exports.debug = (0, debug_1.default)("fluid:test-utils");
14
- (0, exports.debug)(`Package: ${packageVersion_1.pkgName} - Version: ${packageVersion_1.pkgVersion}`);
14
+ (0, exports.debug)(`Package: ${packageVersion_js_1.pkgName} - Version: ${packageVersion_js_1.pkgVersion}`);
15
15
  //# sourceMappingURL=debug.js.map
package/dist/debug.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAAkC;AAClC,qDAAuD;AAE1C,QAAA,KAAK,GAAG,IAAA,eAAa,EAAC,kBAAkB,CAAC,CAAC;AACvD,IAAA,aAAK,EAAC,YAAY,wBAAO,eAAe,2BAAU,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport registerDebug from \"debug\";\nimport { pkgName, pkgVersion } from \"./packageVersion\";\n\nexport const debug = registerDebug(\"fluid:test-utils\");\ndebug(`Package: ${pkgName} - Version: ${pkgVersion}`);\n"]}
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAAkC;AAClC,2DAA0D;AAE7C,QAAA,KAAK,GAAG,IAAA,eAAa,EAAC,kBAAkB,CAAC,CAAC;AACvD,IAAA,aAAK,EAAC,YAAY,2BAAO,eAAe,8BAAU,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport registerDebug from \"debug\";\nimport { pkgName, pkgVersion } from \"./packageVersion.js\";\n\nexport const debug = registerDebug(\"fluid:test-utils\");\ndebug(`Package: ${pkgName} - Version: ${pkgVersion}`);\n"]}
package/dist/index.d.ts CHANGED
@@ -2,18 +2,18 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { wrapDocumentService, wrapDocumentServiceFactory, wrapDocumentStorageService, } from "./DriverWrappers";
6
- export { IProvideTestFluidObject, ITestFluidObject } from "./interfaces";
7
- export { LoaderContainerTracker } from "./loaderContainerTracker";
8
- export { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces } from "./localCodeLoader";
9
- export { createAndAttachContainer, createLoader } from "./localLoader";
10
- export { retryWithEventualValue } from "./retry";
11
- export { mockConfigProvider } from "./TestConfigs";
12
- export { createTestContainerRuntimeFactory, TestContainerRuntimeFactory, } from "./testContainerRuntimeFactory";
13
- export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory } from "./testFluidObject";
14
- export { createDocumentId, DataObjectFactoryType, EventAndErrorTrackingLogger, getUnexpectedLogErrorException, IDocumentIdStrategy, IOpProcessingController, ITestContainerConfig, ITestObjectProvider, TestObjectProvider, TestObjectProviderWithVersionedLoad, } from "./testObjectProvider";
15
- export { createSummarizer, createSummarizerFromFactory, summarizeNow, SummaryInfo, } from "./TestSummaryUtils";
16
- export { defaultTimeoutDurationMs, timeoutAwait, timeoutPromise, TimeoutWithError, TimeoutWithValue, } from "./timeoutUtils";
17
- export { waitForContainerConnection, getContainerEntryPointBackCompat, getDataStoreEntryPointBackCompat, } from "./containerUtils";
18
- export { createContainerRuntimeFactoryWithDefaultDataStore } from "./testContainerRuntimeFactoryWithDefaultDataStore";
5
+ export { wrapDocumentService, wrapDocumentServiceFactory, wrapDocumentStorageService, } from "./DriverWrappers.js";
6
+ export { IProvideTestFluidObject, ITestFluidObject } from "./interfaces.js";
7
+ export { LoaderContainerTracker } from "./loaderContainerTracker.js";
8
+ export { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces } from "./localCodeLoader.js";
9
+ export { createAndAttachContainer, createLoader } from "./localLoader.js";
10
+ export { retryWithEventualValue } from "./retry.js";
11
+ export { createTestConfigProvider, ITestConfigProvider } from "./TestConfigs.js";
12
+ export { createTestContainerRuntimeFactory, TestContainerRuntimeFactory, } from "./testContainerRuntimeFactory.js";
13
+ export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory, } from "./testFluidObject.js";
14
+ export { createDocumentId, DataObjectFactoryType, EventAndErrorTrackingLogger, getUnexpectedLogErrorException, IDocumentIdStrategy, IOpProcessingController, ITestContainerConfig, ITestObjectProvider, TestObjectProvider, TestObjectProviderWithVersionedLoad, } from "./testObjectProvider.js";
15
+ export { createSummarizer, createSummarizerCore, createSummarizerFromFactory, summarizeNow, SummaryInfo, } from "./TestSummaryUtils.js";
16
+ export { defaultTimeoutDurationMs, timeoutAwait, timeoutPromise, TimeoutWithError, TimeoutWithValue, } from "./timeoutUtils.js";
17
+ export { waitForContainerConnection, getContainerEntryPointBackCompat, getDataStoreEntryPointBackCompat, } from "./containerUtils.js";
18
+ export { createContainerRuntimeFactoryWithDefaultDataStore } from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAu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AC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACN,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,EAC9B,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mCAAmC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iDAAiD,EAAE,MAAM,sDAAsD,CAAC"}
package/dist/index.js CHANGED
@@ -4,47 +4,48 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.timeoutPromise = exports.timeoutAwait = exports.defaultTimeoutDurationMs = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = exports.DataObjectFactoryType = exports.createDocumentId = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.mockConfigProvider = exports.retryWithEventualValue = exports.createLoader = exports.createAndAttachContainer = exports.LocalCodeLoader = exports.LoaderContainerTracker = exports.wrapDocumentStorageService = exports.wrapDocumentServiceFactory = exports.wrapDocumentService = void 0;
8
- var DriverWrappers_1 = require("./DriverWrappers");
9
- Object.defineProperty(exports, "wrapDocumentService", { enumerable: true, get: function () { return DriverWrappers_1.wrapDocumentService; } });
10
- Object.defineProperty(exports, "wrapDocumentServiceFactory", { enumerable: true, get: function () { return DriverWrappers_1.wrapDocumentServiceFactory; } });
11
- Object.defineProperty(exports, "wrapDocumentStorageService", { enumerable: true, get: function () { return DriverWrappers_1.wrapDocumentStorageService; } });
12
- var loaderContainerTracker_1 = require("./loaderContainerTracker");
13
- Object.defineProperty(exports, "LoaderContainerTracker", { enumerable: true, get: function () { return loaderContainerTracker_1.LoaderContainerTracker; } });
14
- var localCodeLoader_1 = require("./localCodeLoader");
15
- Object.defineProperty(exports, "LocalCodeLoader", { enumerable: true, get: function () { return localCodeLoader_1.LocalCodeLoader; } });
16
- var localLoader_1 = require("./localLoader");
17
- Object.defineProperty(exports, "createAndAttachContainer", { enumerable: true, get: function () { return localLoader_1.createAndAttachContainer; } });
18
- Object.defineProperty(exports, "createLoader", { enumerable: true, get: function () { return localLoader_1.createLoader; } });
19
- var retry_1 = require("./retry");
20
- Object.defineProperty(exports, "retryWithEventualValue", { enumerable: true, get: function () { return retry_1.retryWithEventualValue; } });
21
- var TestConfigs_1 = require("./TestConfigs");
22
- Object.defineProperty(exports, "mockConfigProvider", { enumerable: true, get: function () { return TestConfigs_1.mockConfigProvider; } });
23
- var testContainerRuntimeFactory_1 = require("./testContainerRuntimeFactory");
24
- Object.defineProperty(exports, "createTestContainerRuntimeFactory", { enumerable: true, get: function () { return testContainerRuntimeFactory_1.createTestContainerRuntimeFactory; } });
25
- Object.defineProperty(exports, "TestContainerRuntimeFactory", { enumerable: true, get: function () { return testContainerRuntimeFactory_1.TestContainerRuntimeFactory; } });
26
- var testFluidObject_1 = require("./testFluidObject");
27
- Object.defineProperty(exports, "TestFluidObject", { enumerable: true, get: function () { return testFluidObject_1.TestFluidObject; } });
28
- Object.defineProperty(exports, "TestFluidObjectFactory", { enumerable: true, get: function () { return testFluidObject_1.TestFluidObjectFactory; } });
29
- var testObjectProvider_1 = require("./testObjectProvider");
30
- Object.defineProperty(exports, "createDocumentId", { enumerable: true, get: function () { return testObjectProvider_1.createDocumentId; } });
31
- Object.defineProperty(exports, "DataObjectFactoryType", { enumerable: true, get: function () { return testObjectProvider_1.DataObjectFactoryType; } });
32
- Object.defineProperty(exports, "EventAndErrorTrackingLogger", { enumerable: true, get: function () { return testObjectProvider_1.EventAndErrorTrackingLogger; } });
33
- Object.defineProperty(exports, "getUnexpectedLogErrorException", { enumerable: true, get: function () { return testObjectProvider_1.getUnexpectedLogErrorException; } });
34
- Object.defineProperty(exports, "TestObjectProvider", { enumerable: true, get: function () { return testObjectProvider_1.TestObjectProvider; } });
35
- Object.defineProperty(exports, "TestObjectProviderWithVersionedLoad", { enumerable: true, get: function () { return testObjectProvider_1.TestObjectProviderWithVersionedLoad; } });
36
- var TestSummaryUtils_1 = require("./TestSummaryUtils");
37
- Object.defineProperty(exports, "createSummarizer", { enumerable: true, get: function () { return TestSummaryUtils_1.createSummarizer; } });
38
- Object.defineProperty(exports, "createSummarizerFromFactory", { enumerable: true, get: function () { return TestSummaryUtils_1.createSummarizerFromFactory; } });
39
- Object.defineProperty(exports, "summarizeNow", { enumerable: true, get: function () { return TestSummaryUtils_1.summarizeNow; } });
40
- var timeoutUtils_1 = require("./timeoutUtils");
41
- Object.defineProperty(exports, "defaultTimeoutDurationMs", { enumerable: true, get: function () { return timeoutUtils_1.defaultTimeoutDurationMs; } });
42
- Object.defineProperty(exports, "timeoutAwait", { enumerable: true, get: function () { return timeoutUtils_1.timeoutAwait; } });
43
- Object.defineProperty(exports, "timeoutPromise", { enumerable: true, get: function () { return timeoutUtils_1.timeoutPromise; } });
44
- var containerUtils_1 = require("./containerUtils");
45
- Object.defineProperty(exports, "waitForContainerConnection", { enumerable: true, get: function () { return containerUtils_1.waitForContainerConnection; } });
46
- Object.defineProperty(exports, "getContainerEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_1.getContainerEntryPointBackCompat; } });
47
- Object.defineProperty(exports, "getDataStoreEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_1.getDataStoreEntryPointBackCompat; } });
48
- var testContainerRuntimeFactoryWithDefaultDataStore_1 = require("./testContainerRuntimeFactoryWithDefaultDataStore");
49
- Object.defineProperty(exports, "createContainerRuntimeFactoryWithDefaultDataStore", { enumerable: true, get: function () { return testContainerRuntimeFactoryWithDefaultDataStore_1.createContainerRuntimeFactoryWithDefaultDataStore; } });
7
+ exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.timeoutPromise = exports.timeoutAwait = exports.defaultTimeoutDurationMs = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizerCore = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = exports.DataObjectFactoryType = exports.createDocumentId = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.createTestConfigProvider = exports.retryWithEventualValue = exports.createLoader = exports.createAndAttachContainer = exports.LocalCodeLoader = exports.LoaderContainerTracker = exports.wrapDocumentStorageService = exports.wrapDocumentServiceFactory = exports.wrapDocumentService = void 0;
8
+ var DriverWrappers_js_1 = require("./DriverWrappers.js");
9
+ Object.defineProperty(exports, "wrapDocumentService", { enumerable: true, get: function () { return DriverWrappers_js_1.wrapDocumentService; } });
10
+ Object.defineProperty(exports, "wrapDocumentServiceFactory", { enumerable: true, get: function () { return DriverWrappers_js_1.wrapDocumentServiceFactory; } });
11
+ Object.defineProperty(exports, "wrapDocumentStorageService", { enumerable: true, get: function () { return DriverWrappers_js_1.wrapDocumentStorageService; } });
12
+ var loaderContainerTracker_js_1 = require("./loaderContainerTracker.js");
13
+ Object.defineProperty(exports, "LoaderContainerTracker", { enumerable: true, get: function () { return loaderContainerTracker_js_1.LoaderContainerTracker; } });
14
+ var localCodeLoader_js_1 = require("./localCodeLoader.js");
15
+ Object.defineProperty(exports, "LocalCodeLoader", { enumerable: true, get: function () { return localCodeLoader_js_1.LocalCodeLoader; } });
16
+ var localLoader_js_1 = require("./localLoader.js");
17
+ Object.defineProperty(exports, "createAndAttachContainer", { enumerable: true, get: function () { return localLoader_js_1.createAndAttachContainer; } });
18
+ Object.defineProperty(exports, "createLoader", { enumerable: true, get: function () { return localLoader_js_1.createLoader; } });
19
+ var retry_js_1 = require("./retry.js");
20
+ Object.defineProperty(exports, "retryWithEventualValue", { enumerable: true, get: function () { return retry_js_1.retryWithEventualValue; } });
21
+ var TestConfigs_js_1 = require("./TestConfigs.js");
22
+ Object.defineProperty(exports, "createTestConfigProvider", { enumerable: true, get: function () { return TestConfigs_js_1.createTestConfigProvider; } });
23
+ var testContainerRuntimeFactory_js_1 = require("./testContainerRuntimeFactory.js");
24
+ Object.defineProperty(exports, "createTestContainerRuntimeFactory", { enumerable: true, get: function () { return testContainerRuntimeFactory_js_1.createTestContainerRuntimeFactory; } });
25
+ Object.defineProperty(exports, "TestContainerRuntimeFactory", { enumerable: true, get: function () { return testContainerRuntimeFactory_js_1.TestContainerRuntimeFactory; } });
26
+ var testFluidObject_js_1 = require("./testFluidObject.js");
27
+ Object.defineProperty(exports, "TestFluidObject", { enumerable: true, get: function () { return testFluidObject_js_1.TestFluidObject; } });
28
+ Object.defineProperty(exports, "TestFluidObjectFactory", { enumerable: true, get: function () { return testFluidObject_js_1.TestFluidObjectFactory; } });
29
+ var testObjectProvider_js_1 = require("./testObjectProvider.js");
30
+ Object.defineProperty(exports, "createDocumentId", { enumerable: true, get: function () { return testObjectProvider_js_1.createDocumentId; } });
31
+ Object.defineProperty(exports, "DataObjectFactoryType", { enumerable: true, get: function () { return testObjectProvider_js_1.DataObjectFactoryType; } });
32
+ Object.defineProperty(exports, "EventAndErrorTrackingLogger", { enumerable: true, get: function () { return testObjectProvider_js_1.EventAndErrorTrackingLogger; } });
33
+ Object.defineProperty(exports, "getUnexpectedLogErrorException", { enumerable: true, get: function () { return testObjectProvider_js_1.getUnexpectedLogErrorException; } });
34
+ Object.defineProperty(exports, "TestObjectProvider", { enumerable: true, get: function () { return testObjectProvider_js_1.TestObjectProvider; } });
35
+ Object.defineProperty(exports, "TestObjectProviderWithVersionedLoad", { enumerable: true, get: function () { return testObjectProvider_js_1.TestObjectProviderWithVersionedLoad; } });
36
+ var TestSummaryUtils_js_1 = require("./TestSummaryUtils.js");
37
+ Object.defineProperty(exports, "createSummarizer", { enumerable: true, get: function () { return TestSummaryUtils_js_1.createSummarizer; } });
38
+ Object.defineProperty(exports, "createSummarizerCore", { enumerable: true, get: function () { return TestSummaryUtils_js_1.createSummarizerCore; } });
39
+ Object.defineProperty(exports, "createSummarizerFromFactory", { enumerable: true, get: function () { return TestSummaryUtils_js_1.createSummarizerFromFactory; } });
40
+ Object.defineProperty(exports, "summarizeNow", { enumerable: true, get: function () { return TestSummaryUtils_js_1.summarizeNow; } });
41
+ var timeoutUtils_js_1 = require("./timeoutUtils.js");
42
+ Object.defineProperty(exports, "defaultTimeoutDurationMs", { enumerable: true, get: function () { return timeoutUtils_js_1.defaultTimeoutDurationMs; } });
43
+ Object.defineProperty(exports, "timeoutAwait", { enumerable: true, get: function () { return timeoutUtils_js_1.timeoutAwait; } });
44
+ Object.defineProperty(exports, "timeoutPromise", { enumerable: true, get: function () { return timeoutUtils_js_1.timeoutPromise; } });
45
+ var containerUtils_js_1 = require("./containerUtils.js");
46
+ Object.defineProperty(exports, "waitForContainerConnection", { enumerable: true, get: function () { return containerUtils_js_1.waitForContainerConnection; } });
47
+ Object.defineProperty(exports, "getContainerEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_js_1.getContainerEntryPointBackCompat; } });
48
+ Object.defineProperty(exports, "getDataStoreEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_js_1.getDataStoreEntryPointBackCompat; } });
49
+ var testContainerRuntimeFactoryWithDefaultDataStore_js_1 = require("./testContainerRuntimeFactoryWithDefaultDataStore.js");
50
+ Object.defineProperty(exports, "createContainerRuntimeFactoryWithDefaultDataStore", { enumerable: true, get: function () { return testContainerRuntimeFactoryWithDefaultDataStore_js_1.createContainerRuntimeFactoryWithDefaultDataStore; } });
50
51
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mDAI0B;AAHzB,qHAAA,mBAAmB,OAAA;AACnB,4HAAA,0BAA0B,OAAA;AAC1B,4HAAA,0BAA0B,OAAA;AAG3B,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,qDAAgG;AAAtE,kHAAA,eAAe,OAAA;AACzC,6CAAuE;AAA9D,uHAAA,wBAAwB,OAAA;AAAE,2GAAA,YAAY,OAAA;AAC/C,iCAAiD;AAAxC,+GAAA,sBAAsB,OAAA;AAC/B,6CAAmD;AAA1C,iHAAA,kBAAkB,OAAA;AAC3B,6EAGuC;AAFtC,gJAAA,iCAAiC,OAAA;AACjC,0IAAA,2BAA2B,OAAA;AAE5B,qDAAoG;AAAnE,kHAAA,eAAe,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AACxE,2DAW8B;AAV7B,sHAAA,gBAAgB,OAAA;AAChB,2HAAA,qBAAqB,OAAA;AACrB,iIAAA,2BAA2B,OAAA;AAC3B,oIAAA,8BAA8B,OAAA;AAK9B,wHAAA,kBAAkB,OAAA;AAClB,yIAAA,mCAAmC,OAAA;AAEpC,uDAK4B;AAJ3B,oHAAA,gBAAgB,OAAA;AAChB,+HAAA,2BAA2B,OAAA;AAC3B,gHAAA,YAAY,OAAA;AAGb,+CAMwB;AALvB,wHAAA,wBAAwB,OAAA;AACxB,4GAAA,YAAY,OAAA;AACZ,8GAAA,cAAc,OAAA;AAIf,mDAI0B;AAHzB,4HAAA,0BAA0B,OAAA;AAC1B,kIAAA,gCAAgC,OAAA;AAChC,kIAAA,gCAAgC,OAAA;AAEjC,qHAAsH;AAA7G,oLAAA,iDAAiD,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\twrapDocumentService,\n\twrapDocumentServiceFactory,\n\twrapDocumentStorageService,\n} from \"./DriverWrappers\";\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces\";\nexport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nexport { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces } from \"./localCodeLoader\";\nexport { createAndAttachContainer, createLoader } from \"./localLoader\";\nexport { retryWithEventualValue } from \"./retry\";\nexport { mockConfigProvider } from \"./TestConfigs\";\nexport {\n\tcreateTestContainerRuntimeFactory,\n\tTestContainerRuntimeFactory,\n} from \"./testContainerRuntimeFactory\";\nexport { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory } from \"./testFluidObject\";\nexport {\n\tcreateDocumentId,\n\tDataObjectFactoryType,\n\tEventAndErrorTrackingLogger,\n\tgetUnexpectedLogErrorException,\n\tIDocumentIdStrategy,\n\tIOpProcessingController,\n\tITestContainerConfig,\n\tITestObjectProvider,\n\tTestObjectProvider,\n\tTestObjectProviderWithVersionedLoad,\n} from \"./testObjectProvider\";\nexport {\n\tcreateSummarizer,\n\tcreateSummarizerFromFactory,\n\tsummarizeNow,\n\tSummaryInfo,\n} from \"./TestSummaryUtils\";\nexport {\n\tdefaultTimeoutDurationMs,\n\ttimeoutAwait,\n\ttimeoutPromise,\n\tTimeoutWithError,\n\tTimeoutWithValue,\n} from \"./timeoutUtils\";\nexport {\n\twaitForContainerConnection,\n\tgetContainerEntryPointBackCompat,\n\tgetDataStoreEntryPointBackCompat,\n} from \"./containerUtils\";\nexport { createContainerRuntimeFactoryWithDefaultDataStore } from \"./testContainerRuntimeFactoryWithDefaultDataStore\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAI6B;AAH5B,wHAAA,mBAAmB,OAAA;AACnB,+HAAA,0BAA0B,OAAA;AAC1B,+HAAA,0BAA0B,OAAA;AAG3B,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,2DAAmG;AAAzE,qHAAA,eAAe,OAAA;AACzC,mDAA0E;AAAjE,0HAAA,wBAAwB,OAAA;AAAE,8GAAA,YAAY,OAAA;AAC/C,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAC/B,mDAAiF;AAAxE,0HAAA,wBAAwB,OAAA;AACjC,mFAG0C;AAFzC,mJAAA,iCAAiC,OAAA;AACjC,6IAAA,2BAA2B,OAAA;AAE5B,2DAI8B;AAF7B,qHAAA,eAAe,OAAA;AACf,4HAAA,sBAAsB,OAAA;AAEvB,iEAWiC;AAVhC,yHAAA,gBAAgB,OAAA;AAChB,8HAAA,qBAAqB,OAAA;AACrB,oIAAA,2BAA2B,OAAA;AAC3B,uIAAA,8BAA8B,OAAA;AAK9B,2HAAA,kBAAkB,OAAA;AAClB,4IAAA,mCAAmC,OAAA;AAEpC,6DAM+B;AAL9B,uHAAA,gBAAgB,OAAA;AAChB,2HAAA,oBAAoB,OAAA;AACpB,kIAAA,2BAA2B,OAAA;AAC3B,mHAAA,YAAY,OAAA;AAGb,qDAM2B;AAL1B,2HAAA,wBAAwB,OAAA;AACxB,+GAAA,YAAY,OAAA;AACZ,iHAAA,cAAc,OAAA;AAIf,yDAI6B;AAH5B,+HAAA,0BAA0B,OAAA;AAC1B,qIAAA,gCAAgC,OAAA;AAChC,qIAAA,gCAAgC,OAAA;AAEjC,2HAAyH;AAAhH,uLAAA,iDAAiD,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\twrapDocumentService,\n\twrapDocumentServiceFactory,\n\twrapDocumentStorageService,\n} from \"./DriverWrappers.js\";\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces.js\";\nexport { LoaderContainerTracker } from \"./loaderContainerTracker.js\";\nexport { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces } from \"./localCodeLoader.js\";\nexport { createAndAttachContainer, createLoader } from \"./localLoader.js\";\nexport { retryWithEventualValue } from \"./retry.js\";\nexport { createTestConfigProvider, ITestConfigProvider } from \"./TestConfigs.js\";\nexport {\n\tcreateTestContainerRuntimeFactory,\n\tTestContainerRuntimeFactory,\n} from \"./testContainerRuntimeFactory.js\";\nexport {\n\tChannelFactoryRegistry,\n\tTestFluidObject,\n\tTestFluidObjectFactory,\n} from \"./testFluidObject.js\";\nexport {\n\tcreateDocumentId,\n\tDataObjectFactoryType,\n\tEventAndErrorTrackingLogger,\n\tgetUnexpectedLogErrorException,\n\tIDocumentIdStrategy,\n\tIOpProcessingController,\n\tITestContainerConfig,\n\tITestObjectProvider,\n\tTestObjectProvider,\n\tTestObjectProviderWithVersionedLoad,\n} from \"./testObjectProvider.js\";\nexport {\n\tcreateSummarizer,\n\tcreateSummarizerCore,\n\tcreateSummarizerFromFactory,\n\tsummarizeNow,\n\tSummaryInfo,\n} from \"./TestSummaryUtils.js\";\nexport {\n\tdefaultTimeoutDurationMs,\n\ttimeoutAwait,\n\ttimeoutPromise,\n\tTimeoutWithError,\n\tTimeoutWithValue,\n} from \"./timeoutUtils.js\";\nexport {\n\twaitForContainerConnection,\n\tgetContainerEntryPointBackCompat,\n\tgetDataStoreEntryPointBackCompat,\n} from \"./containerUtils.js\";\nexport { createContainerRuntimeFactoryWithDefaultDataStore } from \"./testContainerRuntimeFactoryWithDefaultDataStore.js\";\n"]}
@@ -1,5 +1,5 @@
1
1
  import { IContainer, IHostLoader } from "@fluidframework/container-definitions";
2
- import { IOpProcessingController } from "./testObjectProvider";
2
+ import { IOpProcessingController } from "./testObjectProvider.js";
3
3
  /**
4
4
  * @alpha
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"loaderContainerTracker.d.ts","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAe,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAe7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAuB/D;;GAEG;AACH,qBAAa,sBAAuB,YAAW,uBAAuB;IAIzD,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAHlD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IACrE,OAAO,CAAC,kBAAkB,CAAa;gBAEV,qBAAqB,GAAE,OAAe;IAEnE;;;OAGG;IACI,GAAG,CAAC,UAAU,SAAS,WAAW,EAAE,MAAM,EAAE,UAAU;IAmB7D;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAoDpB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAuC1B,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACI,KAAK;IAUZ;;;;;;;;;;;;;;;OAeG;IACU,kBAAkB,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA2E3E;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IA8BzB;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,qBAAqB;IAO7B;;;;;;;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E3E;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IA8BzB;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,qBAAqB;IAO7B;;;;;;;OAOG;YACW,qBAAqB;IAoCnC;;;OAGG;YACW,oBAAoB;IAclC;;OAEG;IACI,gBAAgB,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAoBnD;;;;;;;;OAQG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAexD;;;;;;;;OAQG;YACW,cAAc;IAwD5B;;;;;;OAMG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAIxD;;;;;;OAMG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAIxD;;OAEG;YACW,YAAY;IAgD1B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,UAAU;IAwElB;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAKrB"}
@@ -9,11 +9,11 @@ const core_utils_1 = require("@fluidframework/core-utils");
9
9
  const container_loader_1 = require("@fluidframework/container-loader");
10
10
  const driver_utils_1 = require("@fluidframework/driver-utils");
11
11
  const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
12
- const containerUtils_1 = require("./containerUtils");
13
- const debug_1 = require("./debug");
14
- const timeoutUtils_1 = require("./timeoutUtils");
15
- const debugOp = debug_1.debug.extend("ops");
16
- const debugWait = debug_1.debug.extend("wait");
12
+ const containerUtils_js_1 = require("./containerUtils.js");
13
+ const debug_js_1 = require("./debug.js");
14
+ const timeoutUtils_js_1 = require("./timeoutUtils.js");
15
+ const debugOp = debug_js_1.debug.extend("ops");
16
+ const debugWait = debug_js_1.debug.extend("wait");
17
17
  /**
18
18
  * @alpha
19
19
  */
@@ -192,13 +192,13 @@ class LoaderContainerTracker {
192
192
  debugWait(needSync.message);
193
193
  }
194
194
  // Wait for one inbounds ops which might change the state of things
195
- await (0, timeoutUtils_1.timeoutAwait)(this.waitForAnyInboundOps(containersToApply), {
195
+ await (0, timeoutUtils_js_1.timeoutAwait)(this.waitForAnyInboundOps(containersToApply), {
196
196
  errorMsg: `Timeout on ${needSync.message}`,
197
197
  });
198
198
  }
199
199
  else {
200
200
  waitingSequenceNumberSynchronized = undefined;
201
- await (0, timeoutUtils_1.timeoutAwait)(this.waitForPendingClients(pendingClients), {
201
+ await (0, timeoutUtils_js_1.timeoutAwait)(this.waitForPendingClients(pendingClients), {
202
202
  errorMsg: "Timeout on waiting for pending join or leave op",
203
203
  });
204
204
  }
@@ -208,7 +208,7 @@ class LoaderContainerTracker {
208
208
  debugWait(`Waiting container to be saved ${this.containerIndexStrings(dirtyContainers)}`);
209
209
  waitingSequenceNumberSynchronized = undefined;
210
210
  await Promise.all(dirtyContainers.map(async (c) => Promise.race([
211
- (0, timeoutUtils_1.timeoutPromise)((resolve) => c.once("saved", () => resolve()), {
211
+ (0, timeoutUtils_js_1.timeoutPromise)((resolve) => c.once("saved", () => resolve()), {
212
212
  errorMsg: "Timeout on waiting a container to be saved",
213
213
  }),
214
214
  new Promise((resolve) => c.once("closed", resolve)),
@@ -218,7 +218,7 @@ class LoaderContainerTracker {
218
218
  // Pause all container that was resumed
219
219
  // don't call pause if resumed is empty and pause everything, which is not what we want
220
220
  if (resumed.length !== 0) {
221
- await (0, timeoutUtils_1.timeoutAwait)(this.pauseProcessing(...resumed), {
221
+ await (0, timeoutUtils_js_1.timeoutAwait)(this.pauseProcessing(...resumed), {
222
222
  errorMsg: "Timeout on waiting for pausing all resumed containers",
223
223
  });
224
224
  }
@@ -431,7 +431,7 @@ class LoaderContainerTracker {
431
431
  // Ensure the container is connected first.
432
432
  if (container.connectionState !== container_loader_1.ConnectionState.Connected) {
433
433
  debugWait(`${record.index}: Wait for container connection`);
434
- await (0, containerUtils_1.waitForContainerConnection)(container);
434
+ await (0, containerUtils_js_1.waitForContainerConnection)(container);
435
435
  }
436
436
  // Check if the container is in write mode
437
437
  if (!container.deltaManager.active) {
@@ -456,7 +456,7 @@ class LoaderContainerTracker {
456
456
  // Ensure the container is reconnect.
457
457
  if (container.connectionState !== container_loader_1.ConnectionState.Connected) {
458
458
  debugWait(`${record.index}: Wait for container reconnection`);
459
- await (0, containerUtils_1.waitForContainerConnection)(container);
459
+ await (0, containerUtils_js_1.waitForContainerConnection)(container);
460
460
  }
461
461
  }
462
462
  debugWait(`${record.index}: pausing container inbound queues`);
@@ -1 +1 @@
1
- {"version":3,"file":"loaderContainerTracker.js","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAoD;AAEpD,uEAAmE;AACnE,+DAAuE;AACvE,+EAI8C;AAM9C,qDAA8D;AAC9D,mCAAgC;AAEhC,iDAA8D;AAE9D,MAAM,OAAO,GAAG,aAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpC,MAAM,SAAS,GAAG,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAmBvC;;GAEG;AACH,MAAa,sBAAsB;IAIlC,YAA6B,wBAAiC,KAAK;QAAtC,0BAAqB,GAArB,qBAAqB,CAAiB;QAHlD,eAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,uBAAkB,GAAW,CAAC,CAAC;IAE+B,CAAC;IAEvE;;;OAGG;IACI,GAAG,CAAiC,MAAkB;QAC5D,oFAAoF;QACpF,MAAM,KAAK,GAAG,CAA0B,EAA2B,EAAE,EAAE;YACtE,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,OAAO,KAAK,EAAE,GAAG,IAAS,EAAE,EAAE;gBAC7B,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;gBACzC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;gBAC7B,OAAO,SAAS,CAAC;YAClB,CAAC,CAAC;QACH,CAAC,CAAC;QACF,sDA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,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;CACD;AAttBD,wDAstBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IContainer, IDeltaQueue, IHostLoader } from \"@fluidframework/container-definitions\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tIContainerCreateProps,\n\tIContainerLoadProps,\n\t// eslint-disable-next-line import/no-internal-modules\n} from \"@fluidframework/container-loader/dist/container\";\nimport { waitForContainerConnection } from \"./containerUtils\";\nimport { debug } from \"./debug\";\nimport { IOpProcessingController } from \"./testObjectProvider\";\nimport { timeoutAwait, timeoutPromise } from \"./timeoutUtils\";\n\nconst debugOp = debug.extend(\"ops\");\nconst debugWait = debug.extend(\"wait\");\n\ninterface ContainerRecord {\n\t// A short number for debug output\n\tindex: number;\n\n\t// LoaderContainerTracker paused state\n\tpaused: boolean;\n\tpauseP?: Promise<void>; // promise for for the pause that is in progress\n\n\t// Tracking trailing no-op that may or may be acked by the server so we can discount them\n\t// See issue #5629\n\tstartTrailingNoOps: number;\n\ttrailingNoOps: number;\n\n\t// Track last proposal to ensure no unresolved proposal\n\tlastProposal: number;\n}\n\n/**\n * @alpha\n */\nexport class LoaderContainerTracker implements IOpProcessingController {\n\tprivate readonly containers = new Map<IContainer, ContainerRecord>();\n\tprivate lastProposalSeqNum: number = 0;\n\n\tconstructor(private readonly syncSummarizerClients: boolean = false) {}\n\n\t/**\n\t * Add a loader to start to track any container created from them\n\t * @param loader - loader to start tracking any container created.\n\t */\n\tpublic add<LoaderType extends IHostLoader>(loader: LoaderType) {\n\t\t// TODO: Expose Loader API to able to intercept container creation (See issue #5114)\n\t\tconst patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n\t\t\tconst boundFn = fn.bind(loader);\n\t\t\treturn async (...args: T[]) => {\n\t\t\t\tconst container = await boundFn(...args);\n\t\t\t\tthis.addContainer(container);\n\t\t\t\treturn container;\n\t\t\t};\n\t\t};\n\t\t/* eslint-disable @typescript-eslint/unbound-method */\n\t\tloader.resolve = patch(loader.resolve);\n\t\tloader.createDetachedContainer = patch(loader.createDetachedContainer);\n\t\tloader.rehydrateDetachedContainerFromSnapshot = patch(\n\t\t\tloader.rehydrateDetachedContainerFromSnapshot,\n\t\t);\n\t\t/* eslint-enable @typescript-eslint/unbound-method */\n\t}\n\n\t/**\n\t * Utility function to add container to be tracked.\n\t *\n\t * @param container - container to add\n\t */\n\tprivate addContainer(container: IContainer) {\n\t\t// don't add container that is already tracked\n\t\tif (this.containers.has(container)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Container has a `clone` method that can be used to create another container without going through\n\t\t// the Loader. Such containers won't be added by the `add` method so do it here. For example, summarizer\n\t\t// containers are created via the `clone` method.\n\t\t// Created a type with clone (which is not on IContainer and is readonly) rather than typing to any.\n\t\ttype ContainerWithClone = IContainer & {\n\t\t\tclone: (\n\t\t\t\tloadProps: IContainerLoadProps,\n\t\t\t\tcreateParamOverrides: Partial<IContainerCreateProps>,\n\t\t\t) => Promise<IContainer>;\n\t\t};\n\t\tconst containerWithClone = container as ContainerWithClone;\n\n\t\t// back-compat: Check for undefined because this function was added recently and older containers won't have it.\n\t\tif (containerWithClone.clone !== undefined) {\n\t\t\tconst patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n\t\t\t\tconst boundFn = fn.bind(containerWithClone);\n\t\t\t\treturn async (...args: T[]) => {\n\t\t\t\t\tconst newContainer = await boundFn(...args);\n\t\t\t\t\tthis.addContainer(newContainer);\n\t\t\t\t\treturn newContainer;\n\t\t\t\t};\n\t\t\t};\n\t\t\tcontainerWithClone.clone = patch(containerWithClone.clone);\n\t\t}\n\n\t\t// ignore summarizer\n\t\tif (\n\t\t\t!container.deltaManager.clientDetails.capabilities.interactive &&\n\t\t\t!this.syncSummarizerClients\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = {\n\t\t\tindex: this.containers.size,\n\t\t\tpaused: false,\n\t\t\tstartTrailingNoOps: 0,\n\t\t\ttrailingNoOps: 0,\n\t\t\tlastProposal: 0,\n\t\t};\n\t\tthis.containers.set(container, record);\n\t\tthis.trackTrailingNoOps(container, record);\n\t\tthis.trackLastProposal(container);\n\t\tthis.setupTrace(container, record.index);\n\t}\n\n\t/**\n\t * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.\n\t * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.\n\t *\n\t * @param container - the container to track\n\t * @param record - the record to update the trailing op information\n\t */\n\tprivate trackTrailingNoOps(container: IContainer, record: ContainerRecord) {\n\t\tcontainer.deltaManager.outbound.on(\"op\", (messages) => {\n\t\t\tfor (const msg of messages) {\n\t\t\t\tif (canBeCoalescedByService(msg)) {\n\t\t\t\t\t// Track the NoOp that was sent.\n\t\t\t\t\tif (record.trailingNoOps === 0) {\n\t\t\t\t\t\t// record the starting sequence number of the trailing no ops if we haven't been tracking yet.\n\t\t\t\t\t\trecord.startTrailingNoOps = msg.clientSequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\trecord.trailingNoOps++;\n\t\t\t\t} else {\n\t\t\t\t\t// Other ops has been sent. We would like to see those ack'ed, so no more need to track NoOps\n\t\t\t\t\trecord.trailingNoOps = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tcontainer.deltaManager.inbound.on(\"push\", (message) => {\n\t\t\t// Received the no op back, update the record if we are tracking\n\t\t\tif (\n\t\t\t\tcanBeCoalescedByService(message) &&\n\t\t\t\tmessage.clientId === container.clientId &&\n\t\t\t\trecord.trailingNoOps !== 0 &&\n\t\t\t\trecord.startTrailingNoOps <= message.clientSequenceNumber\n\t\t\t) {\n\t\t\t\t// NoOp might have coalesced and skipped ahead some sequence number\n\t\t\t\t// update the record and skip ahead as well\n\t\t\t\tconst oldStartTrailingNoOps = record.startTrailingNoOps;\n\t\t\t\trecord.startTrailingNoOps = message.clientSequenceNumber + 1;\n\t\t\t\trecord.trailingNoOps -= record.startTrailingNoOps - oldStartTrailingNoOps;\n\t\t\t}\n\t\t});\n\n\t\tcontainer.on(\"disconnected\", () => {\n\t\t\t// reset on disconnect.\n\t\t\trecord.trailingNoOps = 0;\n\t\t});\n\t}\n\n\tprivate trackLastProposal(container: IContainer) {\n\t\tcontainer.on(\"codeDetailsProposed\", (value, proposal) => {\n\t\t\tif (proposal.sequenceNumber > this.lastProposalSeqNum) {\n\t\t\t\tthis.lastProposalSeqNum = proposal.sequenceNumber;\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Reset the tracker, closing all containers and stop tracking them.\n\t */\n\tpublic reset() {\n\t\tthis.lastProposalSeqNum = 0;\n\t\tfor (const container of this.containers.keys()) {\n\t\t\tcontainer.close();\n\t\t}\n\t\tthis.containers.clear();\n\n\t\t// REVIEW: do we need to unpatch the loaders?\n\t}\n\n\t/**\n\t * Make sure all the tracked containers are synchronized.\n\t *\n\t * No isDirty (non-readonly) containers\n\t * No extra clientId in quorum of any container that is not tracked and still opened.\n\t * - i.e. no pending Join/Leave message.\n\t * No unresolved proposal (minSeqNum \\>= lastProposalSeqNum)\n\t * lastSequenceNumber of all container is the same\n\t * clientSequenceNumberObserved is the same as clientSequenceNumber sent\n\t * - this overlaps with !isDirty, but include task scheduler ops.\n\t * - Trailing NoOp is tracked and don't count as pending ops.\n\t *\n\t * Containers that are already pause will resume process and paused again once\n\t * everything is synchronized. Containers that aren't paused will remain unpaused when this\n\t * function returns.\n\t */\n\tpublic async ensureSynchronized(...containers: IContainer[]): Promise<void> {\n\t\tconst resumed = this.resumeProcessing(...containers);\n\n\t\tlet waitingSequenceNumberSynchronized: string | undefined;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\t// yield a turn to allow side effect of resuming or the ops we just processed execute before we check\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tsetTimeout(resolve, 0);\n\t\t\t});\n\n\t\t\tconst containersToApply = this.getContainers(containers);\n\t\t\tif (containersToApply.length === 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Ignore readonly dirty containers, because it can't sent ops and nothing can be done about it being dirty\n\t\t\tconst dirtyContainers = containersToApply.filter((c) => {\n\t\t\t\tconst { deltaManager, isDirty } = c;\n\t\t\t\treturn deltaManager.readOnlyInfo.readonly !== true && isDirty;\n\t\t\t});\n\t\t\tif (dirtyContainers.length === 0) {\n\t\t\t\t// Wait for all the leave messages\n\t\t\t\tconst pendingClients = this.getPendingClients(containersToApply);\n\t\t\t\tif (pendingClients.length === 0) {\n\t\t\t\t\tconst needSync = this.needSequenceNumberSynchronize(containersToApply);\n\t\t\t\t\tif (needSync === undefined) {\n\t\t\t\t\t\t// done, we are in sync\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (waitingSequenceNumberSynchronized !== needSync.reason) {\n\t\t\t\t\t\t// Don't repeat writing to console if it is the same reason\n\t\t\t\t\t\twaitingSequenceNumberSynchronized = needSync.reason;\n\t\t\t\t\t\tdebugWait(needSync.message);\n\t\t\t\t\t}\n\t\t\t\t\t// Wait for one inbounds ops which might change the state of things\n\t\t\t\t\tawait timeoutAwait(this.waitForAnyInboundOps(containersToApply), {\n\t\t\t\t\t\terrorMsg: `Timeout on ${needSync.message}`,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twaitingSequenceNumberSynchronized = undefined;\n\t\t\t\t\tawait timeoutAwait(this.waitForPendingClients(pendingClients), {\n\t\t\t\t\t\terrorMsg: \"Timeout on waiting for pending join or leave op\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Wait for all the containers to be saved\n\t\t\t\tdebugWait(\n\t\t\t\t\t`Waiting container to be saved ${this.containerIndexStrings(dirtyContainers)}`,\n\t\t\t\t);\n\t\t\t\twaitingSequenceNumberSynchronized = undefined;\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tdirtyContainers.map(async (c) =>\n\t\t\t\t\t\tPromise.race([\n\t\t\t\t\t\t\ttimeoutPromise((resolve) => c.once(\"saved\", () => resolve()), {\n\t\t\t\t\t\t\t\terrorMsg: \"Timeout on waiting a container to be saved\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tnew Promise((resolve) => c.once(\"closed\", resolve)),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Pause all container that was resumed\n\t\t// don't call pause if resumed is empty and pause everything, which is not what we want\n\t\tif (resumed.length !== 0) {\n\t\t\tawait timeoutAwait(this.pauseProcessing(...resumed), {\n\t\t\t\terrorMsg: \"Timeout on waiting for pausing all resumed containers\",\n\t\t\t});\n\t\t}\n\n\t\tdebugWait(\"Synchronized\");\n\t}\n\n\t/**\n\t * Utility to calculate the set of clientId per container in quorum that is NOT associated with\n\t * any container we tracked, indicating there is a pending join or leave op that we need to wait.\n\t *\n\t * @param containersToApply - the set of containers to check\n\t */\n\tprivate getPendingClients(containersToApply: IContainer[]) {\n\t\t// All the clientId we track should be a superset of the quorum, otherwise, we are missing\n\t\t// leave messages\n\t\tconst openedDocuments = Array.from(this.containers.keys()).filter((c) => !c.closed);\n\t\tconst openedClientId = openedDocuments.map((container) => container.clientId);\n\n\t\tconst pendingClients: [IContainer, Set<string>][] = [];\n\t\tcontainersToApply.forEach((container) => {\n\t\t\tconst pendingClientId = new Set<string>();\n\t\t\tconst quorum = container.getQuorum();\n\t\t\tquorum.getMembers().forEach((client, clientId) => {\n\t\t\t\t// ignore summarizer\n\t\t\t\tif (\n\t\t\t\t\t!client.client.details.capabilities.interactive &&\n\t\t\t\t\t!this.syncSummarizerClients\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!openedClientId.includes(clientId)) {\n\t\t\t\t\tpendingClientId.add(clientId);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (pendingClientId.size !== 0) {\n\t\t\t\tpendingClients.push([container, pendingClientId]);\n\t\t\t}\n\t\t});\n\t\treturn pendingClients;\n\t}\n\n\t/**\n\t * Utility to check synchronization based on sequence number\n\t * See ensureSynchronized for more detail\n\t *\n\t * @param containersToApply - the set of containers to check\n\t */\n\tprivate needSequenceNumberSynchronize(containersToApply: IContainer[]) {\n\t\t// If there is a pending proposal, wait for it to be accepted\n\t\tconst minSeqNum = containersToApply[0].deltaManager.minimumSequenceNumber;\n\t\tif (minSeqNum < this.lastProposalSeqNum) {\n\t\t\treturn {\n\t\t\t\treason: \"Proposal\",\n\t\t\t\tmessage: `waiting for MSN to advance to proposal at sequence number ${this.lastProposalSeqNum}`,\n\t\t\t};\n\t\t}\n\n\t\t// clientSequenceNumber check detects ops in flight, both on the wire and in the outbound queue\n\t\t// We need both client sequence number and isDirty check because:\n\t\t// - Currently isDirty flag ignores ops for task scheduler, so we need the client sequence number check\n\t\t// - But isDirty flags include ops during forceReadonly and disconnected, because we don't submit\n\t\t// the ops in the first place, clientSequenceNumber is not assigned\n\n\t\tconst containerWithInflightOps = containersToApply.filter((container) => {\n\t\t\tif (container.deltaManager.readOnlyInfo.readonly === true) {\n\t\t\t\t// Ignore readonly container. the clientSeqNum and clientSeqNumObserved might be out of sync\n\t\t\t\t// because we transition to readonly when outbound is not empty or the in transit op got lost\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// Note that in read only mode, the op won't be submitted\n\t\t\tlet deltaManager = container.deltaManager as any;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst { trailingNoOps } = this.containers.get(container)!;\n\t\t\t// Back-compat: lastSubmittedClientId/clientSequenceNumber/clientSequenceNumberObserved moved to ConnectionManager in 0.53\n\t\t\tif (!(\"clientSequenceNumber\" in deltaManager)) {\n\t\t\t\tdeltaManager = deltaManager.connectionManager;\n\t\t\t}\n\t\t\tassert(\"clientSequenceNumber\" in deltaManager, \"no clientSequenceNumber\");\n\t\t\tassert(\"clientSequenceNumberObserved\" in deltaManager, \"no clientSequenceNumber\");\n\t\t\t// If last submittedClientId isn't the current clientId, then we haven't send any ops\n\t\t\treturn (\n\t\t\t\tdeltaManager.lastSubmittedClientId === container.clientId &&\n\t\t\t\tdeltaManager.clientSequenceNumber !==\n\t\t\t\t\t(deltaManager.clientSequenceNumberObserved as number) + trailingNoOps\n\t\t\t);\n\t\t});\n\n\t\tif (containerWithInflightOps.length !== 0) {\n\t\t\treturn {\n\t\t\t\treason: \"InflightOps\",\n\t\t\t\tmessage: `waiting for containers with inflight ops: ${this.containerIndexStrings(\n\t\t\t\t\tcontainerWithInflightOps,\n\t\t\t\t)}`,\n\t\t\t};\n\t\t}\n\n\t\t// Check to see if all the container has process the same number of ops.\n\t\tconst maxSeqNum = Math.max(\n\t\t\t...containersToApply.map((c) => c.deltaManager.lastSequenceNumber),\n\t\t);\n\t\tconst containerWithPendingIncoming = containersToApply.filter(\n\t\t\t(c) => c.deltaManager.lastSequenceNumber !== maxSeqNum,\n\t\t);\n\t\tif (containerWithPendingIncoming.length !== 0) {\n\t\t\treturn {\n\t\t\t\treason: \"Pending\",\n\t\t\t\tmessage: `waiting for containers with pending incoming ops up to sequence number ${maxSeqNum}: ${this.containerIndexStrings(\n\t\t\t\t\tcontainerWithPendingIncoming,\n\t\t\t\t)}`,\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate containerIndexStrings(containers: IContainer[]) {\n\t\treturn containers.map(\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t(c) => this.containers.get(c)!.index,\n\t\t);\n\t}\n\n\t/**\n\t * Utility to wait for any clientId in quorum that is NOT associated with any container we\n\t * tracked, indicating there is a pending join or leave op that we need to wait.\n\t *\n\t * Note that this function doesn't account for container that got added after we started waiting\n\t *\n\t * @param containersToApply - the set of containers to wait for any inbound ops for\n\t */\n\tprivate async waitForPendingClients(pendingClients: [IContainer, Set<string>][]) {\n\t\tconst unconnectedClients = Array.from(this.containers.keys()).filter(\n\t\t\t(c) => !c.closed && c.connectionState !== ConnectionState.Connected,\n\t\t);\n\t\treturn Promise.all(\n\t\t\tpendingClients.map(async ([container, pendingClientId]) => {\n\t\t\t\treturn new Promise<void>((resolve) => {\n\t\t\t\t\tconst cleanup = () => {\n\t\t\t\t\t\tunconnectedClients.forEach((c) => c.off(\"connected\", handler));\n\t\t\t\t\t\tcontainer.getQuorum().off(\"removeMember\", handler);\n\t\t\t\t\t};\n\t\t\t\t\tconst handler = (clientId: string) => {\n\t\t\t\t\t\tpendingClientId.delete(clientId);\n\t\t\t\t\t\tif (pendingClientId.size === 0) {\n\t\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst index = this.containers.get(container)!.index;\n\t\t\t\t\tdebugWait(\n\t\t\t\t\t\t`${index}: Waiting for pending clients ${Array.from(\n\t\t\t\t\t\t\tpendingClientId.keys(),\n\t\t\t\t\t\t)}`,\n\t\t\t\t\t);\n\t\t\t\t\tunconnectedClients.forEach((c) => c.on(\"connected\", handler));\n\t\t\t\t\tcontainer.getQuorum().on(\"removeMember\", handler);\n\t\t\t\t\tcontainer.on(\"closed\", () => {\n\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Utility to wait for any inbound ops from a set of containers\n\t * @param containersToApply - the set of containers to wait for any inbound ops for\n\t */\n\tprivate async waitForAnyInboundOps(containersToApply: IContainer[]) {\n\t\treturn new Promise<void>((resolve) => {\n\t\t\tconst handler = () => {\n\t\t\t\tcontainersToApply.map((c) => {\n\t\t\t\t\tc.deltaManager.inbound.off(\"push\", handler);\n\t\t\t\t});\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\tcontainersToApply.map((c) => {\n\t\t\t\tc.deltaManager.inbound.on(\"push\", handler);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Resume all queue activities on all paused tracked containers and return them\n\t */\n\tpublic resumeProcessing(...containers: IContainer[]) {\n\t\tconst resumed: IContainer[] = [];\n\t\tconst containersToApply = this.getContainers(containers);\n\t\tfor (const container of containersToApply) {\n\t\t\tconst record = this.containers.get(container);\n\t\t\tassert(\n\t\t\t\trecord?.pauseP === undefined,\n\t\t\t\t\"Cannot resume container while pausing is in progress\",\n\t\t\t);\n\t\t\tif (record?.paused === true) {\n\t\t\t\tdebugWait(`${record.index}: container resumed`);\n\t\t\t\tcontainer.deltaManager.inbound.resume();\n\t\t\t\tcontainer.deltaManager.outbound.resume();\n\t\t\t\tresumed.push(container);\n\t\t\t\trecord.paused = false;\n\t\t\t}\n\t\t}\n\t\treturn resumed;\n\t}\n\n\t/**\n\t * Pause all queue activities on the containers given, or all tracked containers\n\t * Any containers given that is not tracked will be ignored.\n\t *\n\t * When a container is paused, it is assumed that we want fine grain control over op\n\t * sequencing. This function will prepare the container and force it into write mode to\n\t * avoid missing join messages or change the sequence of event when switching from read to\n\t * write mode.\n\t */\n\tpublic async pauseProcessing(...containers: IContainer[]) {\n\t\tconst waitP: Promise<void>[] = [];\n\t\tconst containersToApply = this.getContainers(containers);\n\t\tfor (const container of containersToApply) {\n\t\t\tconst record = this.containers.get(container);\n\t\t\tif (record !== undefined && !record.paused) {\n\t\t\t\tif (record.pauseP === undefined) {\n\t\t\t\t\trecord.pauseP = this.pauseContainer(container, record);\n\t\t\t\t}\n\t\t\t\twaitP.push(record.pauseP);\n\t\t\t}\n\t\t}\n\t\tawait Promise.all(waitP);\n\t}\n\n\t/**\n\t * When a container is paused, it is assumed that we want fine grain control over op\n\t * sequencing. This function will prepare the container and force it into write mode to\n\t * avoid missing join messages or change the sequence of event when switching from read to\n\t * write mode.\n\t *\n\t * @param container - the container to pause\n\t * @param record - the record for the container\n\t */\n\tprivate async pauseContainer(container: IContainer, record: ContainerRecord) {\n\t\tdebugWait(`${record.index}: pausing container`);\n\t\tassert(!container.deltaManager.outbound.paused, \"Container should not be paused yet\");\n\t\tassert(!container.deltaManager.inbound.paused, \"Container should not be paused yet\");\n\n\t\t// Pause outbound\n\t\tdebugWait(`${record.index}: pausing container outbound queues`);\n\t\tawait container.deltaManager.outbound.pause();\n\n\t\t// Ensure the container is connected first.\n\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\tdebugWait(`${record.index}: Wait for container connection`);\n\t\t\tawait waitForContainerConnection(container);\n\t\t}\n\n\t\t// Check if the container is in write mode\n\t\tif (!container.deltaManager.active) {\n\t\t\tlet proposalP: Promise<boolean> | undefined;\n\t\t\tif (container.deltaManager.outbound.idle) {\n\t\t\t\t// Need to generate an op to force write mode\n\t\t\t\tdebugWait(`${record.index}: container force write connection`);\n\t\t\t\tconst maybeContainer = container as Partial<IContainer>;\n\t\t\t\tconst codeProposal = maybeContainer.getLoadedCodeDetails\n\t\t\t\t\t? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t container.getLoadedCodeDetails()!\n\t\t\t\t\t: (container as any).chaincodePackage;\n\n\t\t\t\tproposalP = container.proposeCodeDetails(codeProposal);\n\t\t\t}\n\n\t\t\t// Wait for nack\n\t\t\tdebugWait(`${record.index}: Wait for container disconnect`);\n\t\t\tcontainer.deltaManager.outbound.resume();\n\t\t\tawait new Promise<void>((resolve) => container.once(\"disconnected\", resolve));\n\t\t\tconst accepted = proposalP ? await proposalP : false;\n\t\t\tassert(!accepted, \"A proposal in read mode should be rejected\");\n\t\t\tawait container.deltaManager.outbound.pause();\n\n\t\t\t// Ensure the container is reconnect.\n\t\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\t\tdebugWait(`${record.index}: Wait for container reconnection`);\n\t\t\t\tawait waitForContainerConnection(container);\n\t\t\t}\n\t\t}\n\n\t\tdebugWait(`${record.index}: pausing container inbound queues`);\n\n\t\t// Pause inbound\n\t\tawait container.deltaManager.inbound.pause();\n\n\t\tdebugWait(`${record.index}: container paused`);\n\n\t\trecord.pauseP = undefined;\n\t\trecord.paused = true;\n\t}\n\n\t/**\n\t * Pause all queue activities on all tracked containers, and resume only\n\t * inbound to process ops until it is idle. All queues are left in the paused state\n\t * after the function.\n\t *\n\t * Pausing will switch the container to write mode. See `pauseProcessing`\n\t */\n\tpublic async processIncoming(...containers: IContainer[]) {\n\t\treturn this.processQueue(containers, (container) => container.deltaManager.inbound);\n\t}\n\n\t/**\n\t * Pause all queue activities on all tracked containers, and resume only\n\t * outbound to process ops until it is idle. All queues are left in the paused state\n\t * after the function.\n\t *\n\t * Pausing will switch the container to write mode. See `pauseProcessing`\n\t */\n\tpublic async processOutgoing(...containers: IContainer[]) {\n\t\treturn this.processQueue(containers, (container) => container.deltaManager.outbound);\n\t}\n\n\t/**\n\t * Implementation of processIncoming and processOutgoing\n\t */\n\tprivate async processQueue<U>(\n\t\tcontainers: IContainer[],\n\t\tgetQueue: (container: IContainer) => IDeltaQueue<U>,\n\t) {\n\t\tawait this.pauseProcessing(...containers);\n\t\tconst resumed: IDeltaQueue<U>[] = [];\n\n\t\tconst containersToApply = this.getContainers(containers);\n\n\t\tconst inflightTracker = new Map<IContainer, number>();\n\t\tconst cleanup: (() => void)[] = [];\n\t\tfor (const container of containersToApply) {\n\t\t\tassert(\n\t\t\t\tcontainer.deltaManager.active,\n\t\t\t\t\"Container should be connected in write mode already\",\n\t\t\t);\n\n\t\t\tconst queue = getQueue(container);\n\n\t\t\t// track the outgoing ops (if any) to make sure they make the round trip to at least to the same client\n\t\t\t// to make sure they are sequenced.\n\t\t\tcleanup.push(this.setupInOutTracker(container, inflightTracker));\n\t\t\tqueue.resume();\n\t\t\tresumed.push(queue);\n\t\t}\n\n\t\twhile (resumed.some((queue) => !queue.idle)) {\n\t\t\tdebugWait(\"Wait until queue is idle\");\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tsetTimeout(resolve, 0);\n\t\t\t});\n\t\t}\n\n\t\t// Make sure all the op that we sent out are acked first\n\t\t// This is no op if we are processing incoming\n\t\tif (inflightTracker.size) {\n\t\t\tdebugWait(\"Wait for inflight ops\");\n\t\t\tdo {\n\t\t\t\tawait this.waitForAnyInboundOps(containersToApply);\n\t\t\t} while (inflightTracker.size);\n\t\t}\n\n\t\t// remove the handlers\n\t\tcleanup.forEach((clean) => clean());\n\n\t\tawait Promise.all(resumed.map(async (queue) => queue.pause()));\n\t}\n\n\t/**\n\t * Utility to set up listener to track the outbound ops until it round trip back\n\t * Returns a function to remove the handler after it is done.\n\t *\n\t * @param container - the container to setup\n\t * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back\n\t */\n\tprivate setupInOutTracker(container: IContainer, inflightTracker: Map<IContainer, number>) {\n\t\tconst outHandler = (messages: IDocumentMessage[]) => {\n\t\t\tfor (const message of messages) {\n\t\t\t\tif (!canBeCoalescedByService(message)) {\n\t\t\t\t\tinflightTracker.set(container, message.clientSequenceNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst inHandler = (message: ISequencedDocumentMessage) => {\n\t\t\tif (\n\t\t\t\t!canBeCoalescedByService(message) &&\n\t\t\t\tmessage.clientId === container.clientId &&\n\t\t\t\tinflightTracker.get(container) === message.clientSequenceNumber\n\t\t\t) {\n\t\t\t\tinflightTracker.delete(container);\n\t\t\t}\n\t\t};\n\n\t\tcontainer.deltaManager.outbound.on(\"op\", outHandler);\n\t\tcontainer.deltaManager.inbound.on(\"push\", inHandler);\n\n\t\treturn () => {\n\t\t\tcontainer.deltaManager.outbound.off(\"op\", outHandler);\n\t\t\tcontainer.deltaManager.inbound.off(\"push\", inHandler);\n\t\t};\n\t}\n\n\t/**\n\t * Setup debug traces for connection and ops\n\t */\n\tprivate setupTrace(container: IContainer, index: number) {\n\t\tif (debugOp.enabled) {\n\t\t\tconst getContentsString = (type: string, msgContents: any) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (type !== MessageType.Operation) {\n\t\t\t\t\t\tif (typeof msgContents === \"string\") {\n\t\t\t\t\t\t\treturn msgContents;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn JSON.stringify(msgContents);\n\t\t\t\t\t}\n\t\t\t\t\tlet address = \"\";\n\n\t\t\t\t\t// contents comes in the wire as JSON string (\"push\" event)\n\t\t\t\t\t// But already parsed when apply (\"op\" event)\n\t\t\t\t\tlet contents =\n\t\t\t\t\t\ttypeof msgContents === \"string\" ? JSON.parse(msgContents) : msgContents;\n\t\t\t\t\twhile (contents !== undefined && contents !== null) {\n\t\t\t\t\t\tif (contents.contents?.address !== undefined) {\n\t\t\t\t\t\t\taddress += `/${contents.contents.address}`;\n\t\t\t\t\t\t\tcontents = contents.contents.contents;\n\t\t\t\t\t\t} else if (contents.content?.address !== undefined) {\n\t\t\t\t\t\t\taddress += `/${contents.content.address}`;\n\t\t\t\t\t\t\tcontents = contents.content.contents;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (address) {\n\t\t\t\t\t\treturn `${address} ${JSON.stringify(contents)}`;\n\t\t\t\t\t}\n\t\t\t\t\treturn JSON.stringify(contents);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\treturn `${e.message}: ${e.stack}`;\n\t\t\t\t}\n\t\t\t};\n\t\t\tdebugOp(`${index}: ADD: clientId: ${container.clientId}`);\n\t\t\tcontainer.deltaManager.outbound.on(\"op\", (messages) => {\n\t\t\t\tfor (const msg of messages) {\n\t\t\t\t\tdebugOp(\n\t\t\t\t\t\t`${index}: OUT: ` +\n\t\t\t\t\t\t\t`cli: ${msg.clientSequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`${msg.type} ${getContentsString(msg.type, msg.contents)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t\tconst getInboundHandler = (type: string) => {\n\t\t\t\treturn (msg: ISequencedDocumentMessage) => {\n\t\t\t\t\tconst clientSeq =\n\t\t\t\t\t\tmsg.clientId === container.clientId\n\t\t\t\t\t\t\t? `cli: ${msg.clientSequenceNumber.toString().padStart(3)}`\n\t\t\t\t\t\t\t: \" \";\n\t\t\t\t\tdebugOp(\n\t\t\t\t\t\t`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`${clientSeq} min: ${msg.minimumSequenceNumber\n\t\t\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t\t\t.padStart(3)} ` +\n\t\t\t\t\t\t\t`${msg.type} ${getContentsString(msg.type, msg.contents)}`,\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t};\n\t\t\tcontainer.deltaManager.inbound.on(\"push\", getInboundHandler(\"IN \"));\n\t\t\tcontainer.deltaManager.inbound.on(\"op\", getInboundHandler(\"OP \"));\n\t\t\tcontainer.deltaManager.on(\"connect\", (details) => {\n\t\t\t\tdebugOp(`${index}: CON: clientId: ${details.clientId}`);\n\t\t\t});\n\t\t\tcontainer.deltaManager.on(\"disconnect\", (reason) => {\n\t\t\t\tdebugOp(`${index}: DIS: ${reason}`);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Filter out the opened containers based on param.\n\t * @param containers - The container to filter to. If the array is empty, it means don't filter and return\n\t * all open containers.\n\t */\n\tprivate getContainers(containers: IContainer[]) {\n\t\tconst containersToApply =\n\t\t\tcontainers.length === 0 ? Array.from(this.containers.keys()) : containers;\n\t\treturn containersToApply.filter((container) => !container.closed);\n\t}\n}\n"]}
1
+ {"version":3,"file":"loaderContainerTracker.js","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAoD;AAEpD,uEA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,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YACpE,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YAClE,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;gBAChD,OAAO,CAAC,GAAG,KAAK,oBAAoB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;gBAClD,OAAO,CAAC,GAAG,KAAK,UAAU,MAAM,EAAE,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;SACH;IACF,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,UAAwB;QAC7C,MAAM,iBAAiB,GACtB,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC3E,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;CACD;AAttBD,wDAstBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IContainer, IDeltaQueue, IHostLoader } from \"@fluidframework/container-definitions\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tIContainerCreateProps,\n\tIContainerLoadProps,\n\t// eslint-disable-next-line import/no-internal-modules\n} from \"@fluidframework/container-loader/test/container\";\nimport { waitForContainerConnection } from \"./containerUtils.js\";\nimport { debug } from \"./debug.js\";\nimport { IOpProcessingController } from \"./testObjectProvider.js\";\nimport { timeoutAwait, timeoutPromise } from \"./timeoutUtils.js\";\n\nconst debugOp = debug.extend(\"ops\");\nconst debugWait = debug.extend(\"wait\");\n\ninterface ContainerRecord {\n\t// A short number for debug output\n\tindex: number;\n\n\t// LoaderContainerTracker paused state\n\tpaused: boolean;\n\tpauseP?: Promise<void>; // promise for for the pause that is in progress\n\n\t// Tracking trailing no-op that may or may be acked by the server so we can discount them\n\t// See issue #5629\n\tstartTrailingNoOps: number;\n\ttrailingNoOps: number;\n\n\t// Track last proposal to ensure no unresolved proposal\n\tlastProposal: number;\n}\n\n/**\n * @alpha\n */\nexport class LoaderContainerTracker implements IOpProcessingController {\n\tprivate readonly containers = new Map<IContainer, ContainerRecord>();\n\tprivate lastProposalSeqNum: number = 0;\n\n\tconstructor(private readonly syncSummarizerClients: boolean = false) {}\n\n\t/**\n\t * Add a loader to start to track any container created from them\n\t * @param loader - loader to start tracking any container created.\n\t */\n\tpublic add<LoaderType extends IHostLoader>(loader: LoaderType) {\n\t\t// TODO: Expose Loader API to able to intercept container creation (See issue #5114)\n\t\tconst patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n\t\t\tconst boundFn = fn.bind(loader);\n\t\t\treturn async (...args: T[]) => {\n\t\t\t\tconst container = await boundFn(...args);\n\t\t\t\tthis.addContainer(container);\n\t\t\t\treturn container;\n\t\t\t};\n\t\t};\n\t\t/* eslint-disable @typescript-eslint/unbound-method */\n\t\tloader.resolve = patch(loader.resolve);\n\t\tloader.createDetachedContainer = patch(loader.createDetachedContainer);\n\t\tloader.rehydrateDetachedContainerFromSnapshot = patch(\n\t\t\tloader.rehydrateDetachedContainerFromSnapshot,\n\t\t);\n\t\t/* eslint-enable @typescript-eslint/unbound-method */\n\t}\n\n\t/**\n\t * Utility function to add container to be tracked.\n\t *\n\t * @param container - container to add\n\t */\n\tprivate addContainer(container: IContainer) {\n\t\t// don't add container that is already tracked\n\t\tif (this.containers.has(container)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Container has a `clone` method that can be used to create another container without going through\n\t\t// the Loader. Such containers won't be added by the `add` method so do it here. For example, summarizer\n\t\t// containers are created via the `clone` method.\n\t\t// Created a type with clone (which is not on IContainer and is readonly) rather than typing to any.\n\t\ttype ContainerWithClone = IContainer & {\n\t\t\tclone: (\n\t\t\t\tloadProps: IContainerLoadProps,\n\t\t\t\tcreateParamOverrides: Partial<IContainerCreateProps>,\n\t\t\t) => Promise<IContainer>;\n\t\t};\n\t\tconst containerWithClone = container as ContainerWithClone;\n\n\t\t// back-compat: Check for undefined because this function was added recently and older containers won't have it.\n\t\tif (containerWithClone.clone !== undefined) {\n\t\t\tconst patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n\t\t\t\tconst boundFn = fn.bind(containerWithClone);\n\t\t\t\treturn async (...args: T[]) => {\n\t\t\t\t\tconst newContainer = await boundFn(...args);\n\t\t\t\t\tthis.addContainer(newContainer);\n\t\t\t\t\treturn newContainer;\n\t\t\t\t};\n\t\t\t};\n\t\t\tcontainerWithClone.clone = patch(containerWithClone.clone);\n\t\t}\n\n\t\t// ignore summarizer\n\t\tif (\n\t\t\t!container.deltaManager.clientDetails.capabilities.interactive &&\n\t\t\t!this.syncSummarizerClients\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = {\n\t\t\tindex: this.containers.size,\n\t\t\tpaused: false,\n\t\t\tstartTrailingNoOps: 0,\n\t\t\ttrailingNoOps: 0,\n\t\t\tlastProposal: 0,\n\t\t};\n\t\tthis.containers.set(container, record);\n\t\tthis.trackTrailingNoOps(container, record);\n\t\tthis.trackLastProposal(container);\n\t\tthis.setupTrace(container, record.index);\n\t}\n\n\t/**\n\t * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.\n\t * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.\n\t *\n\t * @param container - the container to track\n\t * @param record - the record to update the trailing op information\n\t */\n\tprivate trackTrailingNoOps(container: IContainer, record: ContainerRecord) {\n\t\tcontainer.deltaManager.outbound.on(\"op\", (messages) => {\n\t\t\tfor (const msg of messages) {\n\t\t\t\tif (canBeCoalescedByService(msg)) {\n\t\t\t\t\t// Track the NoOp that was sent.\n\t\t\t\t\tif (record.trailingNoOps === 0) {\n\t\t\t\t\t\t// record the starting sequence number of the trailing no ops if we haven't been tracking yet.\n\t\t\t\t\t\trecord.startTrailingNoOps = msg.clientSequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\trecord.trailingNoOps++;\n\t\t\t\t} else {\n\t\t\t\t\t// Other ops has been sent. We would like to see those ack'ed, so no more need to track NoOps\n\t\t\t\t\trecord.trailingNoOps = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tcontainer.deltaManager.inbound.on(\"push\", (message) => {\n\t\t\t// Received the no op back, update the record if we are tracking\n\t\t\tif (\n\t\t\t\tcanBeCoalescedByService(message) &&\n\t\t\t\tmessage.clientId === container.clientId &&\n\t\t\t\trecord.trailingNoOps !== 0 &&\n\t\t\t\trecord.startTrailingNoOps <= message.clientSequenceNumber\n\t\t\t) {\n\t\t\t\t// NoOp might have coalesced and skipped ahead some sequence number\n\t\t\t\t// update the record and skip ahead as well\n\t\t\t\tconst oldStartTrailingNoOps = record.startTrailingNoOps;\n\t\t\t\trecord.startTrailingNoOps = message.clientSequenceNumber + 1;\n\t\t\t\trecord.trailingNoOps -= record.startTrailingNoOps - oldStartTrailingNoOps;\n\t\t\t}\n\t\t});\n\n\t\tcontainer.on(\"disconnected\", () => {\n\t\t\t// reset on disconnect.\n\t\t\trecord.trailingNoOps = 0;\n\t\t});\n\t}\n\n\tprivate trackLastProposal(container: IContainer) {\n\t\tcontainer.on(\"codeDetailsProposed\", (value, proposal) => {\n\t\t\tif (proposal.sequenceNumber > this.lastProposalSeqNum) {\n\t\t\t\tthis.lastProposalSeqNum = proposal.sequenceNumber;\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Reset the tracker, closing all containers and stop tracking them.\n\t */\n\tpublic reset() {\n\t\tthis.lastProposalSeqNum = 0;\n\t\tfor (const container of this.containers.keys()) {\n\t\t\tcontainer.close();\n\t\t}\n\t\tthis.containers.clear();\n\n\t\t// REVIEW: do we need to unpatch the loaders?\n\t}\n\n\t/**\n\t * Make sure all the tracked containers are synchronized.\n\t *\n\t * No isDirty (non-readonly) containers\n\t * No extra clientId in quorum of any container that is not tracked and still opened.\n\t * - i.e. no pending Join/Leave message.\n\t * No unresolved proposal (minSeqNum \\>= lastProposalSeqNum)\n\t * lastSequenceNumber of all container is the same\n\t * clientSequenceNumberObserved is the same as clientSequenceNumber sent\n\t * - this overlaps with !isDirty, but include task scheduler ops.\n\t * - Trailing NoOp is tracked and don't count as pending ops.\n\t *\n\t * Containers that are already pause will resume process and paused again once\n\t * everything is synchronized. Containers that aren't paused will remain unpaused when this\n\t * function returns.\n\t */\n\tpublic async ensureSynchronized(...containers: IContainer[]): Promise<void> {\n\t\tconst resumed = this.resumeProcessing(...containers);\n\n\t\tlet waitingSequenceNumberSynchronized: string | undefined;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\t// yield a turn to allow side effect of resuming or the ops we just processed execute before we check\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tsetTimeout(resolve, 0);\n\t\t\t});\n\n\t\t\tconst containersToApply = this.getContainers(containers);\n\t\t\tif (containersToApply.length === 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Ignore readonly dirty containers, because it can't sent ops and nothing can be done about it being dirty\n\t\t\tconst dirtyContainers = containersToApply.filter((c) => {\n\t\t\t\tconst { deltaManager, isDirty } = c;\n\t\t\t\treturn deltaManager.readOnlyInfo.readonly !== true && isDirty;\n\t\t\t});\n\t\t\tif (dirtyContainers.length === 0) {\n\t\t\t\t// Wait for all the leave messages\n\t\t\t\tconst pendingClients = this.getPendingClients(containersToApply);\n\t\t\t\tif (pendingClients.length === 0) {\n\t\t\t\t\tconst needSync = this.needSequenceNumberSynchronize(containersToApply);\n\t\t\t\t\tif (needSync === undefined) {\n\t\t\t\t\t\t// done, we are in sync\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (waitingSequenceNumberSynchronized !== needSync.reason) {\n\t\t\t\t\t\t// Don't repeat writing to console if it is the same reason\n\t\t\t\t\t\twaitingSequenceNumberSynchronized = needSync.reason;\n\t\t\t\t\t\tdebugWait(needSync.message);\n\t\t\t\t\t}\n\t\t\t\t\t// Wait for one inbounds ops which might change the state of things\n\t\t\t\t\tawait timeoutAwait(this.waitForAnyInboundOps(containersToApply), {\n\t\t\t\t\t\terrorMsg: `Timeout on ${needSync.message}`,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twaitingSequenceNumberSynchronized = undefined;\n\t\t\t\t\tawait timeoutAwait(this.waitForPendingClients(pendingClients), {\n\t\t\t\t\t\terrorMsg: \"Timeout on waiting for pending join or leave op\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Wait for all the containers to be saved\n\t\t\t\tdebugWait(\n\t\t\t\t\t`Waiting container to be saved ${this.containerIndexStrings(dirtyContainers)}`,\n\t\t\t\t);\n\t\t\t\twaitingSequenceNumberSynchronized = undefined;\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tdirtyContainers.map(async (c) =>\n\t\t\t\t\t\tPromise.race([\n\t\t\t\t\t\t\ttimeoutPromise((resolve) => c.once(\"saved\", () => resolve()), {\n\t\t\t\t\t\t\t\terrorMsg: \"Timeout on waiting a container to be saved\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tnew Promise((resolve) => c.once(\"closed\", resolve)),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Pause all container that was resumed\n\t\t// don't call pause if resumed is empty and pause everything, which is not what we want\n\t\tif (resumed.length !== 0) {\n\t\t\tawait timeoutAwait(this.pauseProcessing(...resumed), {\n\t\t\t\terrorMsg: \"Timeout on waiting for pausing all resumed containers\",\n\t\t\t});\n\t\t}\n\n\t\tdebugWait(\"Synchronized\");\n\t}\n\n\t/**\n\t * Utility to calculate the set of clientId per container in quorum that is NOT associated with\n\t * any container we tracked, indicating there is a pending join or leave op that we need to wait.\n\t *\n\t * @param containersToApply - the set of containers to check\n\t */\n\tprivate getPendingClients(containersToApply: IContainer[]) {\n\t\t// All the clientId we track should be a superset of the quorum, otherwise, we are missing\n\t\t// leave messages\n\t\tconst openedDocuments = Array.from(this.containers.keys()).filter((c) => !c.closed);\n\t\tconst openedClientId = openedDocuments.map((container) => container.clientId);\n\n\t\tconst pendingClients: [IContainer, Set<string>][] = [];\n\t\tcontainersToApply.forEach((container) => {\n\t\t\tconst pendingClientId = new Set<string>();\n\t\t\tconst quorum = container.getQuorum();\n\t\t\tquorum.getMembers().forEach((client, clientId) => {\n\t\t\t\t// ignore summarizer\n\t\t\t\tif (\n\t\t\t\t\t!client.client.details.capabilities.interactive &&\n\t\t\t\t\t!this.syncSummarizerClients\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!openedClientId.includes(clientId)) {\n\t\t\t\t\tpendingClientId.add(clientId);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (pendingClientId.size !== 0) {\n\t\t\t\tpendingClients.push([container, pendingClientId]);\n\t\t\t}\n\t\t});\n\t\treturn pendingClients;\n\t}\n\n\t/**\n\t * Utility to check synchronization based on sequence number\n\t * See ensureSynchronized for more detail\n\t *\n\t * @param containersToApply - the set of containers to check\n\t */\n\tprivate needSequenceNumberSynchronize(containersToApply: IContainer[]) {\n\t\t// If there is a pending proposal, wait for it to be accepted\n\t\tconst minSeqNum = containersToApply[0].deltaManager.minimumSequenceNumber;\n\t\tif (minSeqNum < this.lastProposalSeqNum) {\n\t\t\treturn {\n\t\t\t\treason: \"Proposal\",\n\t\t\t\tmessage: `waiting for MSN to advance to proposal at sequence number ${this.lastProposalSeqNum}`,\n\t\t\t};\n\t\t}\n\n\t\t// clientSequenceNumber check detects ops in flight, both on the wire and in the outbound queue\n\t\t// We need both client sequence number and isDirty check because:\n\t\t// - Currently isDirty flag ignores ops for task scheduler, so we need the client sequence number check\n\t\t// - But isDirty flags include ops during forceReadonly and disconnected, because we don't submit\n\t\t// the ops in the first place, clientSequenceNumber is not assigned\n\n\t\tconst containerWithInflightOps = containersToApply.filter((container) => {\n\t\t\tif (container.deltaManager.readOnlyInfo.readonly === true) {\n\t\t\t\t// Ignore readonly container. the clientSeqNum and clientSeqNumObserved might be out of sync\n\t\t\t\t// because we transition to readonly when outbound is not empty or the in transit op got lost\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// Note that in read only mode, the op won't be submitted\n\t\t\tlet deltaManager = container.deltaManager as any;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst { trailingNoOps } = this.containers.get(container)!;\n\t\t\t// Back-compat: lastSubmittedClientId/clientSequenceNumber/clientSequenceNumberObserved moved to ConnectionManager in 0.53\n\t\t\tif (!(\"clientSequenceNumber\" in deltaManager)) {\n\t\t\t\tdeltaManager = deltaManager.connectionManager;\n\t\t\t}\n\t\t\tassert(\"clientSequenceNumber\" in deltaManager, \"no clientSequenceNumber\");\n\t\t\tassert(\"clientSequenceNumberObserved\" in deltaManager, \"no clientSequenceNumber\");\n\t\t\t// If last submittedClientId isn't the current clientId, then we haven't send any ops\n\t\t\treturn (\n\t\t\t\tdeltaManager.lastSubmittedClientId === container.clientId &&\n\t\t\t\tdeltaManager.clientSequenceNumber !==\n\t\t\t\t\t(deltaManager.clientSequenceNumberObserved as number) + trailingNoOps\n\t\t\t);\n\t\t});\n\n\t\tif (containerWithInflightOps.length !== 0) {\n\t\t\treturn {\n\t\t\t\treason: \"InflightOps\",\n\t\t\t\tmessage: `waiting for containers with inflight ops: ${this.containerIndexStrings(\n\t\t\t\t\tcontainerWithInflightOps,\n\t\t\t\t)}`,\n\t\t\t};\n\t\t}\n\n\t\t// Check to see if all the container has process the same number of ops.\n\t\tconst maxSeqNum = Math.max(\n\t\t\t...containersToApply.map((c) => c.deltaManager.lastSequenceNumber),\n\t\t);\n\t\tconst containerWithPendingIncoming = containersToApply.filter(\n\t\t\t(c) => c.deltaManager.lastSequenceNumber !== maxSeqNum,\n\t\t);\n\t\tif (containerWithPendingIncoming.length !== 0) {\n\t\t\treturn {\n\t\t\t\treason: \"Pending\",\n\t\t\t\tmessage: `waiting for containers with pending incoming ops up to sequence number ${maxSeqNum}: ${this.containerIndexStrings(\n\t\t\t\t\tcontainerWithPendingIncoming,\n\t\t\t\t)}`,\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate containerIndexStrings(containers: IContainer[]) {\n\t\treturn containers.map(\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t(c) => this.containers.get(c)!.index,\n\t\t);\n\t}\n\n\t/**\n\t * Utility to wait for any clientId in quorum that is NOT associated with any container we\n\t * tracked, indicating there is a pending join or leave op that we need to wait.\n\t *\n\t * Note that this function doesn't account for container that got added after we started waiting\n\t *\n\t * @param containersToApply - the set of containers to wait for any inbound ops for\n\t */\n\tprivate async waitForPendingClients(pendingClients: [IContainer, Set<string>][]) {\n\t\tconst unconnectedClients = Array.from(this.containers.keys()).filter(\n\t\t\t(c) => !c.closed && c.connectionState !== ConnectionState.Connected,\n\t\t);\n\t\treturn Promise.all(\n\t\t\tpendingClients.map(async ([container, pendingClientId]) => {\n\t\t\t\treturn new Promise<void>((resolve) => {\n\t\t\t\t\tconst cleanup = () => {\n\t\t\t\t\t\tunconnectedClients.forEach((c) => c.off(\"connected\", handler));\n\t\t\t\t\t\tcontainer.getQuorum().off(\"removeMember\", handler);\n\t\t\t\t\t};\n\t\t\t\t\tconst handler = (clientId: string) => {\n\t\t\t\t\t\tpendingClientId.delete(clientId);\n\t\t\t\t\t\tif (pendingClientId.size === 0) {\n\t\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst index = this.containers.get(container)!.index;\n\t\t\t\t\tdebugWait(\n\t\t\t\t\t\t`${index}: Waiting for pending clients ${Array.from(\n\t\t\t\t\t\t\tpendingClientId.keys(),\n\t\t\t\t\t\t)}`,\n\t\t\t\t\t);\n\t\t\t\t\tunconnectedClients.forEach((c) => c.on(\"connected\", handler));\n\t\t\t\t\tcontainer.getQuorum().on(\"removeMember\", handler);\n\t\t\t\t\tcontainer.on(\"closed\", () => {\n\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Utility to wait for any inbound ops from a set of containers\n\t * @param containersToApply - the set of containers to wait for any inbound ops for\n\t */\n\tprivate async waitForAnyInboundOps(containersToApply: IContainer[]) {\n\t\treturn new Promise<void>((resolve) => {\n\t\t\tconst handler = () => {\n\t\t\t\tcontainersToApply.map((c) => {\n\t\t\t\t\tc.deltaManager.inbound.off(\"push\", handler);\n\t\t\t\t});\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\tcontainersToApply.map((c) => {\n\t\t\t\tc.deltaManager.inbound.on(\"push\", handler);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Resume all queue activities on all paused tracked containers and return them\n\t */\n\tpublic resumeProcessing(...containers: IContainer[]) {\n\t\tconst resumed: IContainer[] = [];\n\t\tconst containersToApply = this.getContainers(containers);\n\t\tfor (const container of containersToApply) {\n\t\t\tconst record = this.containers.get(container);\n\t\t\tassert(\n\t\t\t\trecord?.pauseP === undefined,\n\t\t\t\t\"Cannot resume container while pausing is in progress\",\n\t\t\t);\n\t\t\tif (record?.paused === true) {\n\t\t\t\tdebugWait(`${record.index}: container resumed`);\n\t\t\t\tcontainer.deltaManager.inbound.resume();\n\t\t\t\tcontainer.deltaManager.outbound.resume();\n\t\t\t\tresumed.push(container);\n\t\t\t\trecord.paused = false;\n\t\t\t}\n\t\t}\n\t\treturn resumed;\n\t}\n\n\t/**\n\t * Pause all queue activities on the containers given, or all tracked containers\n\t * Any containers given that is not tracked will be ignored.\n\t *\n\t * When a container is paused, it is assumed that we want fine grain control over op\n\t * sequencing. This function will prepare the container and force it into write mode to\n\t * avoid missing join messages or change the sequence of event when switching from read to\n\t * write mode.\n\t */\n\tpublic async pauseProcessing(...containers: IContainer[]) {\n\t\tconst waitP: Promise<void>[] = [];\n\t\tconst containersToApply = this.getContainers(containers);\n\t\tfor (const container of containersToApply) {\n\t\t\tconst record = this.containers.get(container);\n\t\t\tif (record !== undefined && !record.paused) {\n\t\t\t\tif (record.pauseP === undefined) {\n\t\t\t\t\trecord.pauseP = this.pauseContainer(container, record);\n\t\t\t\t}\n\t\t\t\twaitP.push(record.pauseP);\n\t\t\t}\n\t\t}\n\t\tawait Promise.all(waitP);\n\t}\n\n\t/**\n\t * When a container is paused, it is assumed that we want fine grain control over op\n\t * sequencing. This function will prepare the container and force it into write mode to\n\t * avoid missing join messages or change the sequence of event when switching from read to\n\t * write mode.\n\t *\n\t * @param container - the container to pause\n\t * @param record - the record for the container\n\t */\n\tprivate async pauseContainer(container: IContainer, record: ContainerRecord) {\n\t\tdebugWait(`${record.index}: pausing container`);\n\t\tassert(!container.deltaManager.outbound.paused, \"Container should not be paused yet\");\n\t\tassert(!container.deltaManager.inbound.paused, \"Container should not be paused yet\");\n\n\t\t// Pause outbound\n\t\tdebugWait(`${record.index}: pausing container outbound queues`);\n\t\tawait container.deltaManager.outbound.pause();\n\n\t\t// Ensure the container is connected first.\n\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\tdebugWait(`${record.index}: Wait for container connection`);\n\t\t\tawait waitForContainerConnection(container);\n\t\t}\n\n\t\t// Check if the container is in write mode\n\t\tif (!container.deltaManager.active) {\n\t\t\tlet proposalP: Promise<boolean> | undefined;\n\t\t\tif (container.deltaManager.outbound.idle) {\n\t\t\t\t// Need to generate an op to force write mode\n\t\t\t\tdebugWait(`${record.index}: container force write connection`);\n\t\t\t\tconst maybeContainer = container as Partial<IContainer>;\n\t\t\t\tconst codeProposal = maybeContainer.getLoadedCodeDetails\n\t\t\t\t\t? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t container.getLoadedCodeDetails()!\n\t\t\t\t\t: (container as any).chaincodePackage;\n\n\t\t\t\tproposalP = container.proposeCodeDetails(codeProposal);\n\t\t\t}\n\n\t\t\t// Wait for nack\n\t\t\tdebugWait(`${record.index}: Wait for container disconnect`);\n\t\t\tcontainer.deltaManager.outbound.resume();\n\t\t\tawait new Promise<void>((resolve) => container.once(\"disconnected\", resolve));\n\t\t\tconst accepted = proposalP ? await proposalP : false;\n\t\t\tassert(!accepted, \"A proposal in read mode should be rejected\");\n\t\t\tawait container.deltaManager.outbound.pause();\n\n\t\t\t// Ensure the container is reconnect.\n\t\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\t\tdebugWait(`${record.index}: Wait for container reconnection`);\n\t\t\t\tawait waitForContainerConnection(container);\n\t\t\t}\n\t\t}\n\n\t\tdebugWait(`${record.index}: pausing container inbound queues`);\n\n\t\t// Pause inbound\n\t\tawait container.deltaManager.inbound.pause();\n\n\t\tdebugWait(`${record.index}: container paused`);\n\n\t\trecord.pauseP = undefined;\n\t\trecord.paused = true;\n\t}\n\n\t/**\n\t * Pause all queue activities on all tracked containers, and resume only\n\t * inbound to process ops until it is idle. All queues are left in the paused state\n\t * after the function.\n\t *\n\t * Pausing will switch the container to write mode. See `pauseProcessing`\n\t */\n\tpublic async processIncoming(...containers: IContainer[]) {\n\t\treturn this.processQueue(containers, (container) => container.deltaManager.inbound);\n\t}\n\n\t/**\n\t * Pause all queue activities on all tracked containers, and resume only\n\t * outbound to process ops until it is idle. All queues are left in the paused state\n\t * after the function.\n\t *\n\t * Pausing will switch the container to write mode. See `pauseProcessing`\n\t */\n\tpublic async processOutgoing(...containers: IContainer[]) {\n\t\treturn this.processQueue(containers, (container) => container.deltaManager.outbound);\n\t}\n\n\t/**\n\t * Implementation of processIncoming and processOutgoing\n\t */\n\tprivate async processQueue<U>(\n\t\tcontainers: IContainer[],\n\t\tgetQueue: (container: IContainer) => IDeltaQueue<U>,\n\t) {\n\t\tawait this.pauseProcessing(...containers);\n\t\tconst resumed: IDeltaQueue<U>[] = [];\n\n\t\tconst containersToApply = this.getContainers(containers);\n\n\t\tconst inflightTracker = new Map<IContainer, number>();\n\t\tconst cleanup: (() => void)[] = [];\n\t\tfor (const container of containersToApply) {\n\t\t\tassert(\n\t\t\t\tcontainer.deltaManager.active,\n\t\t\t\t\"Container should be connected in write mode already\",\n\t\t\t);\n\n\t\t\tconst queue = getQueue(container);\n\n\t\t\t// track the outgoing ops (if any) to make sure they make the round trip to at least to the same client\n\t\t\t// to make sure they are sequenced.\n\t\t\tcleanup.push(this.setupInOutTracker(container, inflightTracker));\n\t\t\tqueue.resume();\n\t\t\tresumed.push(queue);\n\t\t}\n\n\t\twhile (resumed.some((queue) => !queue.idle)) {\n\t\t\tdebugWait(\"Wait until queue is idle\");\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tsetTimeout(resolve, 0);\n\t\t\t});\n\t\t}\n\n\t\t// Make sure all the op that we sent out are acked first\n\t\t// This is no op if we are processing incoming\n\t\tif (inflightTracker.size) {\n\t\t\tdebugWait(\"Wait for inflight ops\");\n\t\t\tdo {\n\t\t\t\tawait this.waitForAnyInboundOps(containersToApply);\n\t\t\t} while (inflightTracker.size);\n\t\t}\n\n\t\t// remove the handlers\n\t\tcleanup.forEach((clean) => clean());\n\n\t\tawait Promise.all(resumed.map(async (queue) => queue.pause()));\n\t}\n\n\t/**\n\t * Utility to set up listener to track the outbound ops until it round trip back\n\t * Returns a function to remove the handler after it is done.\n\t *\n\t * @param container - the container to setup\n\t * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back\n\t */\n\tprivate setupInOutTracker(container: IContainer, inflightTracker: Map<IContainer, number>) {\n\t\tconst outHandler = (messages: IDocumentMessage[]) => {\n\t\t\tfor (const message of messages) {\n\t\t\t\tif (!canBeCoalescedByService(message)) {\n\t\t\t\t\tinflightTracker.set(container, message.clientSequenceNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst inHandler = (message: ISequencedDocumentMessage) => {\n\t\t\tif (\n\t\t\t\t!canBeCoalescedByService(message) &&\n\t\t\t\tmessage.clientId === container.clientId &&\n\t\t\t\tinflightTracker.get(container) === message.clientSequenceNumber\n\t\t\t) {\n\t\t\t\tinflightTracker.delete(container);\n\t\t\t}\n\t\t};\n\n\t\tcontainer.deltaManager.outbound.on(\"op\", outHandler);\n\t\tcontainer.deltaManager.inbound.on(\"push\", inHandler);\n\n\t\treturn () => {\n\t\t\tcontainer.deltaManager.outbound.off(\"op\", outHandler);\n\t\t\tcontainer.deltaManager.inbound.off(\"push\", inHandler);\n\t\t};\n\t}\n\n\t/**\n\t * Setup debug traces for connection and ops\n\t */\n\tprivate setupTrace(container: IContainer, index: number) {\n\t\tif (debugOp.enabled) {\n\t\t\tconst getContentsString = (type: string, msgContents: any) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (type !== MessageType.Operation) {\n\t\t\t\t\t\tif (typeof msgContents === \"string\") {\n\t\t\t\t\t\t\treturn msgContents;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn JSON.stringify(msgContents);\n\t\t\t\t\t}\n\t\t\t\t\tlet address = \"\";\n\n\t\t\t\t\t// contents comes in the wire as JSON string (\"push\" event)\n\t\t\t\t\t// But already parsed when apply (\"op\" event)\n\t\t\t\t\tlet contents =\n\t\t\t\t\t\ttypeof msgContents === \"string\" ? JSON.parse(msgContents) : msgContents;\n\t\t\t\t\twhile (contents !== undefined && contents !== null) {\n\t\t\t\t\t\tif (contents.contents?.address !== undefined) {\n\t\t\t\t\t\t\taddress += `/${contents.contents.address}`;\n\t\t\t\t\t\t\tcontents = contents.contents.contents;\n\t\t\t\t\t\t} else if (contents.content?.address !== undefined) {\n\t\t\t\t\t\t\taddress += `/${contents.content.address}`;\n\t\t\t\t\t\t\tcontents = contents.content.contents;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (address) {\n\t\t\t\t\t\treturn `${address} ${JSON.stringify(contents)}`;\n\t\t\t\t\t}\n\t\t\t\t\treturn JSON.stringify(contents);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\treturn `${e.message}: ${e.stack}`;\n\t\t\t\t}\n\t\t\t};\n\t\t\tdebugOp(`${index}: ADD: clientId: ${container.clientId}`);\n\t\t\tcontainer.deltaManager.outbound.on(\"op\", (messages) => {\n\t\t\t\tfor (const msg of messages) {\n\t\t\t\t\tdebugOp(\n\t\t\t\t\t\t`${index}: OUT: ` +\n\t\t\t\t\t\t\t`cli: ${msg.clientSequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`${msg.type} ${getContentsString(msg.type, msg.contents)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t\tconst getInboundHandler = (type: string) => {\n\t\t\t\treturn (msg: ISequencedDocumentMessage) => {\n\t\t\t\t\tconst clientSeq =\n\t\t\t\t\t\tmsg.clientId === container.clientId\n\t\t\t\t\t\t\t? `cli: ${msg.clientSequenceNumber.toString().padStart(3)}`\n\t\t\t\t\t\t\t: \" \";\n\t\t\t\t\tdebugOp(\n\t\t\t\t\t\t`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`${clientSeq} min: ${msg.minimumSequenceNumber\n\t\t\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t\t\t.padStart(3)} ` +\n\t\t\t\t\t\t\t`${msg.type} ${getContentsString(msg.type, msg.contents)}`,\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t};\n\t\t\tcontainer.deltaManager.inbound.on(\"push\", getInboundHandler(\"IN \"));\n\t\t\tcontainer.deltaManager.inbound.on(\"op\", getInboundHandler(\"OP \"));\n\t\t\tcontainer.deltaManager.on(\"connect\", (details) => {\n\t\t\t\tdebugOp(`${index}: CON: clientId: ${details.clientId}`);\n\t\t\t});\n\t\t\tcontainer.deltaManager.on(\"disconnect\", (reason) => {\n\t\t\t\tdebugOp(`${index}: DIS: ${reason}`);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Filter out the opened containers based on param.\n\t * @param containers - The container to filter to. If the array is empty, it means don't filter and return\n\t * all open containers.\n\t */\n\tprivate getContainers(containers: IContainer[]) {\n\t\tconst containersToApply =\n\t\t\tcontainers.length === 0 ? Array.from(this.containers.keys()) : containers;\n\t\treturn containersToApply.filter((container) => !container.closed);\n\t}\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  import { IContainer, IHostLoader, ILoaderOptions, IFluidCodeDetails } from "@fluidframework/container-definitions";
6
6
  import { ITelemetryBaseLogger, IRequest } from "@fluidframework/core-interfaces";
7
7
  import { IDocumentServiceFactory, IUrlResolver } from "@fluidframework/driver-definitions";
8
- import { fluidEntryPoint } from "./localCodeLoader";
8
+ import { fluidEntryPoint } from "./localCodeLoader.js";
9
9
  /**
10
10
  * Creates a loader with the given package entries and driver.
11
11
  * @param packageEntries - A list of code details to Fluid entry points.
@@ -1 +1 @@
1
- {"version":3,"file":"localLoader.d.ts","sourceRoot":"","sources":["../src/localLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,UAAU,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,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EAAE,iBAAiB,EACzB,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,QAAQ,GACrB,OAAO,CAAC,UAAU,CAAC,CAKrB"}
@@ -6,7 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createAndAttachContainer = exports.createLoader = void 0;
8
8
  const container_loader_1 = require("@fluidframework/container-loader");
9
- const localCodeLoader_1 = require("./localCodeLoader");
9
+ const localCodeLoader_js_1 = require("./localCodeLoader.js");
10
10
  /**
11
11
  * Creates a loader with the given package entries and driver.
12
12
  * @param packageEntries - A list of code details to Fluid entry points.
@@ -16,7 +16,7 @@ const localCodeLoader_1 = require("./localCodeLoader");
16
16
  * @internal
17
17
  */
18
18
  function createLoader(packageEntries, documentServiceFactory, urlResolver, logger, options) {
19
- const codeLoader = new localCodeLoader_1.LocalCodeLoader(packageEntries);
19
+ const codeLoader = new localCodeLoader_js_1.LocalCodeLoader(packageEntries);
20
20
  return new container_loader_1.Loader({
21
21
  urlResolver,
22
22
  documentServiceFactory,