@fluidframework/container-loader 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.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 (240) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -2
  3. package/api-extractor-lint.json +13 -0
  4. package/api-extractor.json +3 -3
  5. package/api-report/container-loader.api.md +18 -18
  6. package/dist/{audience.js → audience.cjs} +1 -1
  7. package/dist/audience.cjs.map +1 -0
  8. package/dist/audience.d.ts +1 -0
  9. package/dist/audience.d.ts.map +1 -1
  10. package/dist/{catchUpMonitor.js → catchUpMonitor.cjs} +1 -1
  11. package/dist/catchUpMonitor.cjs.map +1 -0
  12. package/dist/{connectionManager.js → connectionManager.cjs} +23 -20
  13. package/dist/connectionManager.cjs.map +1 -0
  14. package/dist/connectionManager.d.ts.map +1 -1
  15. package/dist/{connectionState.js → connectionState.cjs} +4 -1
  16. package/dist/connectionState.cjs.map +1 -0
  17. package/dist/connectionState.d.ts +3 -0
  18. package/dist/connectionState.d.ts.map +1 -1
  19. package/dist/{connectionStateHandler.js → connectionStateHandler.cjs} +6 -6
  20. package/dist/connectionStateHandler.cjs.map +1 -0
  21. package/dist/connectionStateHandler.d.ts +10 -0
  22. package/dist/connectionStateHandler.d.ts.map +1 -1
  23. package/dist/container-loader-alpha.d.ts +240 -0
  24. package/dist/container-loader-beta.d.ts +96 -0
  25. package/dist/container-loader-public.d.ts +96 -0
  26. package/dist/container-loader-untrimmed.d.ts +351 -0
  27. package/dist/{container.js → container.cjs} +36 -29
  28. package/dist/container.cjs.map +1 -0
  29. package/dist/container.d.ts +4 -6
  30. package/dist/container.d.ts.map +1 -1
  31. package/dist/{containerContext.js → containerContext.cjs} +1 -1
  32. package/dist/containerContext.cjs.map +1 -0
  33. package/dist/{containerStorageAdapter.js → containerStorageAdapter.cjs} +6 -6
  34. package/dist/containerStorageAdapter.cjs.map +1 -0
  35. package/dist/{contracts.js → contracts.cjs} +1 -1
  36. package/dist/contracts.cjs.map +1 -0
  37. package/dist/{debugLogger.js → debugLogger.cjs} +10 -5
  38. package/dist/debugLogger.cjs.map +1 -0
  39. package/dist/debugLogger.d.ts.map +1 -1
  40. package/dist/{deltaManager.js → deltaManager.cjs} +21 -4
  41. package/dist/deltaManager.cjs.map +1 -0
  42. package/dist/deltaManager.d.ts.map +1 -1
  43. package/dist/{deltaQueue.js → deltaQueue.cjs} +1 -1
  44. package/dist/deltaQueue.cjs.map +1 -0
  45. package/dist/{disposal.js → disposal.cjs} +1 -1
  46. package/dist/disposal.cjs.map +1 -0
  47. package/dist/{error.js → error.cjs} +1 -1
  48. package/dist/error.cjs.map +1 -0
  49. package/dist/{index.js → index.cjs} +6 -6
  50. package/dist/index.cjs.map +1 -0
  51. package/dist/{loader.js → loader.cjs} +7 -5
  52. package/dist/loader.cjs.map +1 -0
  53. package/dist/loader.d.ts +12 -2
  54. package/dist/loader.d.ts.map +1 -1
  55. package/dist/location-redirection-utilities/{index.js → index.cjs} +2 -2
  56. package/dist/location-redirection-utilities/index.cjs.map +1 -0
  57. package/dist/location-redirection-utilities/{resolveWithLocationRedirection.js → resolveWithLocationRedirection.cjs} +3 -1
  58. package/dist/location-redirection-utilities/resolveWithLocationRedirection.cjs.map +1 -0
  59. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -0
  60. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  61. package/dist/{noopHeuristic.js → noopHeuristic.cjs} +1 -1
  62. package/dist/noopHeuristic.cjs.map +1 -0
  63. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  64. package/dist/packageVersion.cjs.map +1 -0
  65. package/dist/packageVersion.d.ts +1 -1
  66. package/dist/{protocol.js → protocol.cjs} +1 -1
  67. package/dist/protocol.cjs.map +1 -0
  68. package/dist/protocol.d.ts +4 -0
  69. package/dist/protocol.d.ts.map +1 -1
  70. package/dist/{protocolTreeDocumentStorageService.js → protocolTreeDocumentStorageService.cjs} +1 -1
  71. package/dist/protocolTreeDocumentStorageService.cjs.map +1 -0
  72. package/dist/{quorum.js → quorum.cjs} +1 -1
  73. package/dist/quorum.cjs.map +1 -0
  74. package/dist/{retriableDocumentStorageService.js → retriableDocumentStorageService.cjs} +1 -1
  75. package/dist/retriableDocumentStorageService.cjs.map +1 -0
  76. package/dist/tsdoc-metadata.json +1 -1
  77. package/dist/{utils.js → utils.cjs} +2 -1
  78. package/dist/utils.cjs.map +1 -0
  79. package/dist/utils.d.ts +2 -0
  80. package/dist/utils.d.ts.map +1 -1
  81. package/lib/audience.d.ts +1 -4
  82. package/lib/audience.d.ts.map +1 -1
  83. package/lib/{audience.js → audience.mjs} +1 -5
  84. package/lib/audience.mjs.map +1 -0
  85. package/lib/catchUpMonitor.d.ts.map +1 -1
  86. package/lib/{catchUpMonitor.js → catchUpMonitor.mjs} +1 -1
  87. package/lib/catchUpMonitor.mjs.map +1 -0
  88. package/lib/connectionManager.d.ts +1 -1
  89. package/lib/connectionManager.d.ts.map +1 -1
  90. package/lib/{connectionManager.js → connectionManager.mjs} +23 -20
  91. package/lib/connectionManager.mjs.map +1 -0
  92. package/lib/connectionState.d.ts +3 -0
  93. package/lib/connectionState.d.ts.map +1 -1
  94. package/lib/{connectionState.js → connectionState.mjs} +4 -1
  95. package/lib/connectionState.mjs.map +1 -0
  96. package/lib/connectionStateHandler.d.ts +13 -3
  97. package/lib/connectionStateHandler.d.ts.map +1 -1
  98. package/lib/{connectionStateHandler.js → connectionStateHandler.mjs} +6 -6
  99. package/lib/connectionStateHandler.mjs.map +1 -0
  100. package/lib/container-loader-alpha.d.ts +240 -0
  101. package/lib/container-loader-beta.d.ts +96 -0
  102. package/lib/container-loader-public.d.ts +96 -0
  103. package/lib/container-loader-untrimmed.d.ts +351 -0
  104. package/lib/container.d.ts +8 -10
  105. package/lib/container.d.ts.map +1 -1
  106. package/lib/{container.js → container.mjs} +36 -26
  107. package/lib/container.mjs.map +1 -0
  108. package/lib/containerContext.d.ts.map +1 -1
  109. package/lib/{containerContext.js → containerContext.mjs} +1 -1
  110. package/lib/containerContext.mjs.map +1 -0
  111. package/lib/containerStorageAdapter.d.ts +1 -1
  112. package/lib/containerStorageAdapter.d.ts.map +1 -1
  113. package/lib/{containerStorageAdapter.js → containerStorageAdapter.mjs} +6 -6
  114. package/lib/containerStorageAdapter.mjs.map +1 -0
  115. package/lib/contracts.d.ts.map +1 -1
  116. package/lib/{contracts.js → contracts.mjs} +1 -1
  117. package/lib/contracts.mjs.map +1 -0
  118. package/lib/debugLogger.d.ts.map +1 -1
  119. package/lib/{debugLogger.js → debugLogger.mjs} +3 -2
  120. package/lib/debugLogger.mjs.map +1 -0
  121. package/lib/deltaManager.d.ts +1 -1
  122. package/lib/deltaManager.d.ts.map +1 -1
  123. package/lib/{deltaManager.js → deltaManager.mjs} +21 -4
  124. package/lib/deltaManager.mjs.map +1 -0
  125. package/lib/deltaQueue.d.ts.map +1 -1
  126. package/lib/{deltaQueue.js → deltaQueue.mjs} +1 -1
  127. package/lib/deltaQueue.mjs.map +1 -0
  128. package/lib/disposal.d.ts.map +1 -1
  129. package/lib/{disposal.js → disposal.mjs} +1 -1
  130. package/lib/disposal.mjs.map +1 -0
  131. package/lib/error.d.ts.map +1 -1
  132. package/lib/{error.js → error.mjs} +1 -1
  133. package/lib/error.mjs.map +1 -0
  134. package/lib/index.d.ts +6 -6
  135. package/lib/index.d.ts.map +1 -1
  136. package/lib/index.mjs +10 -0
  137. package/lib/index.mjs.map +1 -0
  138. package/lib/loader.d.ts +14 -4
  139. package/lib/loader.d.ts.map +1 -1
  140. package/lib/{loader.js → loader.mjs} +7 -5
  141. package/lib/loader.mjs.map +1 -0
  142. package/lib/location-redirection-utilities/index.d.ts +1 -1
  143. package/lib/location-redirection-utilities/index.d.ts.map +1 -1
  144. package/lib/location-redirection-utilities/{index.js → index.mjs} +2 -2
  145. package/lib/location-redirection-utilities/index.mjs.map +1 -0
  146. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -0
  147. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  148. package/lib/location-redirection-utilities/{resolveWithLocationRedirection.js → resolveWithLocationRedirection.mjs} +3 -1
  149. package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +1 -0
  150. package/lib/noopHeuristic.d.ts.map +1 -1
  151. package/lib/{noopHeuristic.js → noopHeuristic.mjs} +1 -1
  152. package/lib/noopHeuristic.mjs.map +1 -0
  153. package/lib/packageVersion.d.ts +1 -1
  154. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  155. package/lib/packageVersion.mjs.map +1 -0
  156. package/lib/protocol.d.ts +4 -0
  157. package/lib/protocol.d.ts.map +1 -1
  158. package/lib/{protocol.js → protocol.mjs} +1 -1
  159. package/lib/protocol.mjs.map +1 -0
  160. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  161. package/lib/{protocolTreeDocumentStorageService.js → protocolTreeDocumentStorageService.mjs} +1 -1
  162. package/lib/protocolTreeDocumentStorageService.mjs.map +1 -0
  163. package/lib/quorum.d.ts +0 -4
  164. package/lib/quorum.d.ts.map +1 -1
  165. package/lib/{quorum.js → quorum.mjs} +1 -1
  166. package/lib/quorum.mjs.map +1 -0
  167. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  168. package/lib/{retriableDocumentStorageService.js → retriableDocumentStorageService.mjs} +1 -1
  169. package/lib/retriableDocumentStorageService.mjs.map +1 -0
  170. package/lib/utils.d.ts +2 -0
  171. package/lib/utils.d.ts.map +1 -1
  172. package/lib/{utils.js → utils.mjs} +2 -1
  173. package/lib/utils.mjs.map +1 -0
  174. package/package.json +48 -29
  175. package/src/connectionManager.ts +22 -14
  176. package/src/connectionState.ts +3 -0
  177. package/src/connectionStateHandler.ts +16 -3
  178. package/src/container.ts +34 -17
  179. package/src/containerStorageAdapter.ts +3 -3
  180. package/src/debugLogger.ts +7 -1
  181. package/src/deltaManager.ts +25 -1
  182. package/src/loader.ts +11 -1
  183. package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +2 -0
  184. package/src/packageVersion.ts +1 -1
  185. package/src/protocol.ts +4 -0
  186. package/src/utils.ts +2 -0
  187. package/tsc-multi.test.json +4 -0
  188. package/tsconfig.json +5 -3
  189. package/dist/audience.js.map +0 -1
  190. package/dist/catchUpMonitor.js.map +0 -1
  191. package/dist/connectionManager.js.map +0 -1
  192. package/dist/connectionState.js.map +0 -1
  193. package/dist/connectionStateHandler.js.map +0 -1
  194. package/dist/container.js.map +0 -1
  195. package/dist/containerContext.js.map +0 -1
  196. package/dist/containerStorageAdapter.js.map +0 -1
  197. package/dist/contracts.js.map +0 -1
  198. package/dist/debugLogger.js.map +0 -1
  199. package/dist/deltaManager.js.map +0 -1
  200. package/dist/deltaQueue.js.map +0 -1
  201. package/dist/disposal.js.map +0 -1
  202. package/dist/error.js.map +0 -1
  203. package/dist/index.js.map +0 -1
  204. package/dist/loader.js.map +0 -1
  205. package/dist/location-redirection-utilities/index.js.map +0 -1
  206. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +0 -1
  207. package/dist/noopHeuristic.js.map +0 -1
  208. package/dist/packageVersion.js.map +0 -1
  209. package/dist/protocol.js.map +0 -1
  210. package/dist/protocolTreeDocumentStorageService.js.map +0 -1
  211. package/dist/quorum.js.map +0 -1
  212. package/dist/retriableDocumentStorageService.js.map +0 -1
  213. package/dist/utils.js.map +0 -1
  214. package/lib/audience.js.map +0 -1
  215. package/lib/catchUpMonitor.js.map +0 -1
  216. package/lib/connectionManager.js.map +0 -1
  217. package/lib/connectionState.js.map +0 -1
  218. package/lib/connectionStateHandler.js.map +0 -1
  219. package/lib/container.js.map +0 -1
  220. package/lib/containerContext.js.map +0 -1
  221. package/lib/containerStorageAdapter.js.map +0 -1
  222. package/lib/contracts.js.map +0 -1
  223. package/lib/debugLogger.js.map +0 -1
  224. package/lib/deltaManager.js.map +0 -1
  225. package/lib/deltaQueue.js.map +0 -1
  226. package/lib/disposal.js.map +0 -1
  227. package/lib/error.js.map +0 -1
  228. package/lib/index.js +0 -10
  229. package/lib/index.js.map +0 -1
  230. package/lib/loader.js.map +0 -1
  231. package/lib/location-redirection-utilities/index.js.map +0 -1
  232. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +0 -1
  233. package/lib/noopHeuristic.js.map +0 -1
  234. package/lib/packageVersion.js.map +0 -1
  235. package/lib/protocol.js.map +0 -1
  236. package/lib/protocolTreeDocumentStorageService.js.map +0 -1
  237. package/lib/quorum.js.map +0 -1
  238. package/lib/retriableDocumentStorageService.js.map +0 -1
  239. package/lib/utils.js.map +0 -1
  240. package/tsconfig.esnext.json +0 -7
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { isLocationRedirectionError, resolveWithLocationRedirectionHandling, } from "./resolveWithLocationRedirection";
6
- //# sourceMappingURL=index.js.map
5
+ export { isLocationRedirectionError, resolveWithLocationRedirectionHandling, } from "./resolveWithLocationRedirection.mjs";
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/location-redirection-utilities/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,0BAA0B,EAC1B,sCAAsC,GACtC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tisLocationRedirectionError,\n\tresolveWithLocationRedirectionHandling,\n} from \"./resolveWithLocationRedirection\";\n"]}
@@ -8,6 +8,7 @@ import { ILocationRedirectionError, IUrlResolver } from "@fluidframework/driver-
8
8
  * Checks if the error is location redirection error.
9
9
  * @param error - error whose type is to be determined.
10
10
  * @returns `true` is the error is location redirection error, otherwise `false`.
11
+ * @internal
11
12
  */
12
13
  export declare function isLocationRedirectionError(error: any): error is ILocationRedirectionError;
13
14
  /**
@@ -17,6 +18,7 @@ export declare function isLocationRedirectionError(error: any): error is ILocati
17
18
  * @param urlResolver - resolver used to resolve the url.
18
19
  * @param logger - logger to send events.
19
20
  * @returns Response from the API call.
21
+ * @internal
20
22
  */
21
23
  export declare function resolveWithLocationRedirectionHandling<T>(api: (request: IRequest) => Promise<T>, request: IRequest, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger): Promise<T>;
22
24
  //# sourceMappingURL=resolveWithLocationRedirection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveWithLocationRedirection.d.ts","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAEN,yBAAyB,EACzB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAG5C;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,yBAAyB,CAMzF;AAED;;;;;;;GAOG;AACH,wBAAsB,sCAAsC,CAAC,CAAC,EAC7D,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,OAAO,EAAE,QAAQ,EACjB,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAmBZ"}
1
+ {"version":3,"file":"resolveWithLocationRedirection.d.ts","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,iCAAiC;OACzE,EAEN,yBAAyB,EACzB,YAAY,EACZ,MAAM,oCAAoC;AAG3C;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,yBAAyB,CAMzF;AAED;;;;;;;;GAQG;AACH,wBAAsB,sCAAsC,CAAC,CAAC,EAC7D,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,OAAO,EAAE,QAAQ,EACjB,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAmBZ"}
@@ -8,6 +8,7 @@ import { createChildLogger } from "@fluidframework/telemetry-utils";
8
8
  * Checks if the error is location redirection error.
9
9
  * @param error - error whose type is to be determined.
10
10
  * @returns `true` is the error is location redirection error, otherwise `false`.
11
+ * @internal
11
12
  */
12
13
  export function isLocationRedirectionError(error) {
13
14
  return (typeof error === "object" &&
@@ -21,6 +22,7 @@ export function isLocationRedirectionError(error) {
21
22
  * @param urlResolver - resolver used to resolve the url.
22
23
  * @param logger - logger to send events.
23
24
  * @returns Response from the API call.
25
+ * @internal
24
26
  */
25
27
  export async function resolveWithLocationRedirectionHandling(api, request, urlResolver, logger) {
26
28
  let req = request;
@@ -43,4 +45,4 @@ export async function resolveWithLocationRedirectionHandling(api, request, urlRe
43
45
  }
44
46
  }
45
47
  }
46
- //# sourceMappingURL=resolveWithLocationRedirection.js.map
48
+ //# sourceMappingURL=resolveWithLocationRedirection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveWithLocationRedirection.mjs","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,gBAAgB,GAGhB,MAAM,oCAAoC;OACpC,EAAE,iBAAiB,EAAE,MAAM,iCAAiC;AAEnE;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAU;IACpD,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,CAAC,SAAS,KAAK,gBAAgB,CAAC,mBAAmB,CACxD,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC3D,GAAsC,EACtC,OAAiB,EACjB,WAAyB,EACzB,MAA6B;IAE7B,IAAI,GAAG,GAAa,OAAO,CAAC;IAC5B,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACpF,SAAS;QACR,IAAI;YACH,OAAO,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;SACtB;QAAC,OAAO,KAAU,EAAE;YACpB,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE;gBACvC,MAAM,KAAK,CAAC;aACZ;YACD,WAAW,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,CAAC;YAC1E,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;YACtC,yGAAyG;YACzG,kGAAkG;YAClG,oCAAoC;YACpC,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;YACjF,GAAG,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;SACjD;KACD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger, IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverErrorTypes,\n\tILocationRedirectionError,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils\";\n\n/**\n * Checks if the error is location redirection error.\n * @param error - error whose type is to be determined.\n * @returns `true` is the error is location redirection error, otherwise `false`.\n * @internal\n */\nexport function isLocationRedirectionError(error: any): error is ILocationRedirectionError {\n\treturn (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\terror.errorType === DriverErrorTypes.locationRedirection\n\t);\n}\n\n/**\n * Handles location redirection while fulfilling the loader request.\n * @param api - Callback in which user can wrap the loader.resolve or loader.request call.\n * @param request - request to be resolved.\n * @param urlResolver - resolver used to resolve the url.\n * @param logger - logger to send events.\n * @returns Response from the API call.\n * @internal\n */\nexport async function resolveWithLocationRedirectionHandling<T>(\n\tapi: (request: IRequest) => Promise<T>,\n\trequest: IRequest,\n\turlResolver: IUrlResolver,\n\tlogger?: ITelemetryBaseLogger,\n): Promise<T> {\n\tlet req: IRequest = request;\n\tconst childLogger = createChildLogger({ logger, namespace: \"LocationRedirection\" });\n\tfor (;;) {\n\t\ttry {\n\t\t\treturn await api(req);\n\t\t} catch (error: any) {\n\t\t\tif (!isLocationRedirectionError(error)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tchildLogger.sendTelemetryEvent({ eventName: \"LocationRedirectionError\" });\n\t\t\tconst resolvedUrl = error.redirectUrl;\n\t\t\t// Generate the new request with new location details from the resolved url. For datastore/relative path,\n\t\t\t// we don't need to pass \"/\" as host could have asked for a specific data store. So driver need to\n\t\t\t// extract it from the resolved url.\n\t\t\tconst absoluteUrl = await urlResolver.getAbsoluteUrl(resolvedUrl, \"\", undefined);\n\t\t\treq = { url: absoluteUrl, headers: req.headers };\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"noopHeuristic.d.ts","sourceRoot":"","sources":["../src/noopHeuristic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAKzD,MAAM,WAAW,iBAAkB,SAAQ,MAAM;IAChD,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAE;CAC3C;AAqBD,qBAAa,aAAc,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC;IAMrE,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IALpC,OAAO,CAAC,uBAAuB,CAAK;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;gBAGzC,iBAAiB,GAAE,MAAiC,EACnC,kBAAkB,GAAE,MAAkC;IAcxE;;OAEG;IACI,sBAAsB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAqChE,gBAAgB,IAAI,IAAI;IAKxB,iBAAiB,IAAI,IAAI;CAIhC"}
1
+ {"version":3,"file":"noopHeuristic.d.ts","sourceRoot":"","sources":["../src/noopHeuristic.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OAEzD,EAAE,yBAAyB,EAAE,MAAM,sCAAsC;OAEzE,EAAE,MAAM,EAAE,MAAM,iCAAiC;AAKxD,MAAM,WAAW,iBAAkB,SAAQ,MAAM;IAChD,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAE;CAC3C;AAqBD,qBAAa,aAAc,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC;IAMrE,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IALpC,OAAO,CAAC,uBAAuB,CAAK;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;gBAGzC,iBAAiB,GAAE,MAAiC,EACnC,kBAAkB,GAAE,MAAkC;IAcxE;;OAEG;IACI,sBAAsB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAqChE,gBAAgB,IAAI,IAAI;IAKxB,iBAAiB,IAAI,IAAI;CAIhC"}
@@ -83,4 +83,4 @@ export class NoopHeuristic extends TypedEventEmitter {
83
83
  this.opsProcessedSinceOpSent = 0;
84
84
  }
85
85
  }
86
- //# sourceMappingURL=noopHeuristic.js.map
86
+ //# sourceMappingURL=noopHeuristic.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noopHeuristic.mjs","sourceRoot":"","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,IAAI,IAAI,CAAC,uBAAuB,KAAK,IAAI,CAAC,kBAAkB,EAAE;YAC7D,qGAAqG;YACrG,gJAAgJ;YAChJ,+FAA+F;YAC/F,cAAc,CAAC,GAAG,EAAE;gBACnB,IAAI,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,kBAAkB,EAAE;oBAC5D,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBACvB,MAAM,CACL,IAAI,CAAC,uBAAuB,KAAK,CAAC,EAClC,KAAK,CAAC,gDAAgD,CACtD,CAAC;iBACF;gBACD,OAAO;YACR,CAAC,CAAC,CAAC;SACH;QAED,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC7B,yDAAyD;YACzD,6HAA6H;YAC7H,IAAI,IAAI,CAAC,uBAAuB,KAAK,CAAC,EAAE;gBACvC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;aACrB;YAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;SACrD;IACF,CAAC;IAEM,gBAAgB;QACtB,2GAA2G;QAC3G,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;IAClC,CAAC;IAEM,iBAAiB;QACvB,6DAA6D;QAC7D,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;IAClC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert, Timer } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils\";\nimport { IEvent } from \"@fluidframework/core-interfaces\";\n\nconst defaultNoopTimeFrequency = 2000;\nconst defaultNoopCountFrequency = 50;\n\nexport interface INoopSenderEvents extends IEvent {\n\t(event: \"wantsNoop\", listener: () => void);\n}\n\n// Here are key considerations when deciding conditions for when to send non-immediate noops:\n// 1. Sending them too often results in increase in file size and bandwidth, as well as catch up performance\n// 2. Sending too infrequently ensures that collab window is large, and as result Sequence DDS would have\n// large catchUp blobs - see Issue #6364\n// 3. Similarly, processes that rely on \"core\" snapshot (and can't parse trailing ops, including above), like search\n// parser in SPO, will result in non-accurate results due to presence of catch up blobs.\n// 4. Ordering service used 250ms timeout to coalesce non-immediate noops. It was changed to 2000 ms to allow more\n// aggressive noop sending from client side.\n// 5. Number of ops sent by all clients is proportional to number of \"write\" clients (every client sends noops),\n// but number of sequenced noops is a function of time (one op per 2 seconds at most).\n// We should consider impact to both outbound traffic (might be huge, depends on number of clients) and file size.\n// Please also see Issue #5629 for more discussions.\n//\n// With that, the current algorithm is as follows:\n// 1. Sent noop 2000 ms of receiving an op if no ops were sent by this client within this timeframe.\n// This will ensure that MSN moves forward with reasonable speed. If that results in too many sequenced noops,\n// server timeout of 2000ms should be reconsidered to be increased.\n// 2. If there are more than 50 ops received without sending any ops, send noop to keep collab window small.\n// Note that system ops (including noops themselves) are excluded, so it's 1 noop per 50 real ops.\nexport class NoopHeuristic extends TypedEventEmitter<INoopSenderEvents> {\n\tprivate opsProcessedSinceOpSent = 0;\n\tprivate readonly timer: Timer | undefined;\n\n\tconstructor(\n\t\tNoopTimeFrequency: number = defaultNoopTimeFrequency,\n\t\tprivate readonly NoopCountFrequency: number = defaultNoopCountFrequency,\n\t) {\n\t\tsuper();\n\t\tif (NoopTimeFrequency !== Infinity) {\n\t\t\tthis.timer = new Timer(NoopTimeFrequency, () => {\n\t\t\t\t// We allow the timer to expire even if an op is sent or we disconnect.\n\t\t\t\t// This condition is to guard against trying to send a noop anyway in that case.\n\t\t\t\tif (this.opsProcessedSinceOpSent !== 0) {\n\t\t\t\t\tthis.emit(\"wantsNoop\");\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Schedules as ack to the server to update the reference sequence number\n\t */\n\tpublic notifyMessageProcessed(message: ISequencedDocumentMessage): void {\n\t\t// We don't acknowledge no-ops to avoid acknowledgement cycles (i.e. ack the MSN\n\t\t// update, which updates the MSN, then ack the update, etc...).\n\t\t// Intent here is for runtime (and DDSes) not to keep too much tracking state / memory\n\t\t// due to runtime ops from other clients.\n\t\tif (!isRuntimeMessage(message)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.opsProcessedSinceOpSent++;\n\t\tif (this.opsProcessedSinceOpSent === this.NoopCountFrequency) {\n\t\t\t// Wait to send a noop if we are still synchronously processing ops. This guards against two things:\n\t\t\t// 1. If we're processing many ops, we may pass the frequency threshold many times. We only need to send one noop at the very end in this case.\n\t\t\t// 2. We may send another (non-noop) op in response to processing those ops, e.g. an Accept op.\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (this.opsProcessedSinceOpSent >= this.NoopCountFrequency) {\n\t\t\t\t\tthis.emit(\"wantsNoop\");\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.opsProcessedSinceOpSent === 0,\n\t\t\t\t\t\t0x243 /* \"Expected a noop to be synchronously sent\" */,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t});\n\t\t}\n\n\t\tif (this.timer !== undefined) {\n\t\t\t// Start the timer if we newly have ops that want a noop.\n\t\t\t// If the timer was already running (e.g. we surpassed the op count and sent a noop) this will reset it to its full duration.\n\t\t\tif (this.opsProcessedSinceOpSent === 1) {\n\t\t\t\tthis.timer.restart();\n\t\t\t}\n\n\t\t\tassert(this.timer.hasTimer, 0x242 /* \"has timer\" */);\n\t\t}\n\t}\n\n\tpublic notifyDisconnect(): void {\n\t\t// No need to noop for any ops processed prior to disconnect - we are already removed from MSN calculation.\n\t\tthis.opsProcessedSinceOpSent = 0;\n\t}\n\n\tpublic notifyMessageSent(): void {\n\t\t// Sending any message is as good as a noop for updating MSN.\n\t\tthis.opsProcessedSinceOpSent = 0;\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/container-loader";
8
- export declare const pkgVersion = "2.0.0-internal.7.2.2";
8
+ export declare const pkgVersion = "2.0.0-internal.7.4.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/container-loader";
8
- export const pkgVersion = "2.0.0-internal.7.2.2";
9
- //# sourceMappingURL=packageVersion.js.map
8
+ export const pkgVersion = "2.0.0-internal.7.4.0";
9
+ //# sourceMappingURL=packageVersion.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-loader\";\nexport const pkgVersion = \"2.0.0-internal.7.4.0\";\n"]}
package/lib/protocol.d.ts CHANGED
@@ -12,8 +12,12 @@ export declare enum SignalType {
12
12
  }
13
13
  /**
14
14
  * Function to be used for creating a protocol handler.
15
+ * @alpha
15
16
  */
16
17
  export type ProtocolHandlerBuilder = (attributes: IDocumentAttributes, snapshot: IQuorumSnapshot, sendProposal: (key: string, value: any) => number) => IProtocolHandler;
18
+ /**
19
+ * @alpha
20
+ */
17
21
  export interface IProtocolHandler extends IBaseProtocolHandler {
18
22
  readonly audience: IAudienceOwner;
19
23
  processSignal(message: ISignalMessage): any;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.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AAc,WAWzE"}
@@ -91,4 +91,4 @@ export function protocolHandlerShouldProcessSignal(message) {
91
91
  }
92
92
  return false;
93
93
  }
94
- //# sourceMappingURL=protocol.js.map
94
+ //# sourceMappingURL=protocol.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.mjs","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,uBAAuB,EAAE,MAAM,8BAA8B;OAC/D,EAGN,iBAAiB,GACjB,MAAM,+BAA+B;OAC/B,EAMN,WAAW,GACX,MAAM,sCAAsC;AAE7C,mDAAmD;AACnD,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACrB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AAChB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAoBD,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IACrD,YACC,UAA+B,EAC/B,cAA+B,EAC/B,YAAiD,EACjC,QAAwB,EACvB,oBAAmD;QAEpE,KAAK,CACJ,UAAU,CAAC,qBAAqB,EAChC,UAAU,CAAC,cAAc,EACzB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,MAAM,EACrB,YAAY,CACZ,CAAC;QAVc,aAAQ,GAAR,QAAQ,CAAgB;QACvB,yBAAoB,GAApB,oBAAoB,CAA+B;QAWpE,oFAAoF;QACpF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CACjD,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAC5C,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9E,KAAK,MAAM,CAAC,QA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Y,CAAC,QAAQ,CAAC,CAAC;qBACrC;iBACD;gBACD,MAAM;aACN;YACD,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC;gBAC3B,MAAM,SAAS,GAAG,YAAY,CAAC,OAAwB,CAAC;gBACxD,2DAA2D;gBAC3D,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE;oBACrC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;iBAC9D;gBACD,MAAM;aACN;YACD,KAAK,UAAU,CAAC,WAAW,CAAC,CAAC;gBAC5B,MAAM,YAAY,GAAG,YAAY,CAAC,OAAiB,CAAC;gBACpD,2DAA2D;gBAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,KAAK,MAAM,EAAE;oBAC3D,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;iBACzC;gBACD,MAAM;aACN;YACD;gBACC,MAAM;SACP;IACF,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAAC,OAAuB;IACzE,gCAAgC;IAChC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE;QAC9B,MAAM,YAAY,GAAG,OAAO,CAAC,OAA6C,CAAC;QAC3E,OAAO,CACN,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,KAAK;YACtC,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,UAAU;YAC3C,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,CAC5C,CAAC;KACF;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IAudienceOwner } from \"@fluidframework/container-definitions\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\nimport {\n\tIProtocolHandler as IBaseProtocolHandler,\n\tIQuorumSnapshot,\n\tProtocolOpHandler,\n} from \"@fluidframework/protocol-base\";\nimport {\n\tIDocumentAttributes,\n\tIProcessMessageResult,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n// ADO: #1986: Start using enum from protocol-base.\nexport enum SignalType {\n\tClientJoin = \"join\", // same value as MessageType.ClientJoin,\n\tClientLeave = \"leave\", // same value as MessageType.ClientLeave,\n\tClear = \"clear\", // used only by client for synthetic signals\n}\n\n/**\n * Function to be used for creating a protocol handler.\n * @alpha\n */\nexport type ProtocolHandlerBuilder = (\n\tattributes: IDocumentAttributes,\n\tsnapshot: IQuorumSnapshot,\n\tsendProposal: (key: string, value: any) => number,\n) => IProtocolHandler;\n\n/**\n * @alpha\n */\nexport interface IProtocolHandler extends IBaseProtocolHandler {\n\treadonly audience: IAudienceOwner;\n\tprocessSignal(message: ISignalMessage);\n}\n\nexport class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandler {\n\tconstructor(\n\t\tattributes: IDocumentAttributes,\n\t\tquorumSnapshot: IQuorumSnapshot,\n\t\tsendProposal: (key: string, value: any) => number,\n\t\tpublic readonly audience: IAudienceOwner,\n\t\tprivate readonly shouldClientHaveLeft: (clientId: string) => boolean,\n\t) {\n\t\tsuper(\n\t\t\tattributes.minimumSequenceNumber,\n\t\t\tattributes.sequenceNumber,\n\t\t\tquorumSnapshot.members,\n\t\t\tquorumSnapshot.proposals,\n\t\t\tquorumSnapshot.values,\n\t\t\tsendProposal,\n\t\t);\n\n\t\t// Join / leave signals are ignored for \"write\" clients in favor of join / leave ops\n\t\tthis.quorum.on(\"addMember\", (clientId, details) =>\n\t\t\taudience.addMember(clientId, details.client),\n\t\t);\n\t\tthis.quorum.on(\"removeMember\", (clientId) => audience.removeMember(clientId));\n\t\tfor (const [clientId, details] of this.quorum.getMembers()) {\n\t\t\tthis.audience.addMember(clientId, details.client);\n\t\t}\n\t}\n\n\tpublic processMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t): IProcessMessageResult {\n\t\t// Check and report if we're getting messages from a clientId that we previously\n\t\t// flagged as shouldHaveLeft, or from a client that's not in the quorum but should be\n\t\tif (message.clientId != null) {\n\t\t\tconst client = this.quorum.getMember(message.clientId);\n\n\t\t\tif (client === undefined && message.type !== MessageType.ClientJoin) {\n\t\t\t\t// pre-0.58 error message: messageClientIdMissingFromQuorum\n\t\t\t\tthrow new Error(\"Remote message's clientId is missing from the quorum\");\n\t\t\t}\n\n\t\t\t// Here checking canBeCoalescedByService is used as an approximation of \"is benign to process despite being unexpected\".\n\t\t\t// It's still not good to see these messages from unexpected clientIds, but since they don't harm the integrity of the\n\t\t\t// document we don't need to blow up aggressively.\n\t\t\tif (this.shouldClientHaveLeft(message.clientId) && !canBeCoalescedByService(message)) {\n\t\t\t\t// pre-0.58 error message: messageClientIdShouldHaveLeft\n\t\t\t\tthrow new Error(\"Remote message's clientId already should have left\");\n\t\t\t}\n\t\t}\n\n\t\treturn super.processMessage(message, local);\n\t}\n\n\tpublic processSignal(message: ISignalMessage) {\n\t\tconst innerContent = message.content as { content: any; type: string };\n\t\tswitch (innerContent.type) {\n\t\t\tcase SignalType.Clear: {\n\t\t\t\tconst members = this.audience.getMembers();\n\t\t\t\tfor (const [clientId, client] of members) {\n\t\t\t\t\tif (client.mode === \"read\") {\n\t\t\t\t\t\tthis.audience.removeMember(clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientJoin: {\n\t\t\t\tconst newClient = innerContent.content as ISignalClient;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (newClient.client.mode === \"read\") {\n\t\t\t\t\tthis.audience.addMember(newClient.clientId, newClient.client);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientLeave: {\n\t\t\t\tconst leftClientId = innerContent.content as string;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (this.audience.getMember(leftClientId)?.mode === \"read\") {\n\t\t\t\t\tthis.audience.removeMember(leftClientId);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/**\n * Function to check whether the protocol handler should process the Signal.\n * The protocol handler should strictly handle only ClientJoin, ClientLeave\n * and Clear signal types.\n */\nexport function protocolHandlerShouldProcessSignal(message: ISignalMessage) {\n\t// Signal originates from server\n\tif (message.clientId === null) {\n\t\tconst innerContent = message.content as { content: unknown; type: string };\n\t\treturn (\n\t\t\tinnerContent.type === SignalType.Clear ||\n\t\t\tinnerContent.type === SignalType.ClientJoin ||\n\t\t\tinnerContent.type === SignalType.ClientLeave\n\t\t);\n\t}\n\treturn false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"protocolTreeDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB,EAAE,WAAW;IAErF,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,2BAA2B;gBAD3B,sBAAsB,EAAE,uBAAuB,GAAG,WAAW,EAC7D,2BAA2B,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,YAAY;IAE1F,IAAW,QAAQ,6FAElB;IACD,IAAW,aAAa,WAEvB;IACD,IAAW,QAAQ,YAElB;IAED,eAAe,qMAAiF;IAChG,WAAW,yOAA6E;IACxF,UAAU,yGAA4E;IACtF,QAAQ,2CAA0E;IAClF,eAAe,mGAAiF;IAChG,OAAO,sCAAyE;IAE1E,wBAAwB,CAC7B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;CAMlB"}
1
+ {"version":3,"file":"protocolTreeDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,MAAM,iCAAiC;OACtD,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oCAAoC;OACtF,EAAE,YAAY,EAAE,MAAM,sCAAsC;AAEnE;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB,EAAE,WAAW;IAErF,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,2BAA2B;gBAD3B,sBAAsB,EAAE,uBAAuB,GAAG,WAAW,EAC7D,2BAA2B,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,YAAY;IAE1F,IAAW,QAAQ,6FAElB;IACD,IAAW,aAAa,WAEvB;IACD,IAAW,QAAQ,YAElB;IAED,eAAe,qMAAiF;IAChG,WAAW,yOAA6E;IACxF,UAAU,yGAA4E;IACtF,QAAQ,2CAA0E;IAClF,eAAe,mGAAiF;IAChG,OAAO,sCAAyE;IAE1E,wBAAwB,CAC7B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;CAMlB"}
@@ -30,4 +30,4 @@ export class ProtocolTreeStorageService {
30
30
  return this.internalStorageService.uploadSummaryWithContext(this.addProtocolSummaryIfMissing(summary), context);
31
31
  }
32
32
  }
33
- //# sourceMappingURL=protocolTreeDocumentStorageService.js.map
33
+ //# sourceMappingURL=protocolTreeDocumentStorageService.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocolTreeDocumentStorageService.mjs","sourceRoot":"","sources":["../src/protocolTreeDocument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;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * A storage service wrapper whose sole job is to intercept calls to uploadSummaryWithContext and ensure they include\n * the protocol summary, using the provided callback to add it if necessary.\n */\nexport class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService & IDisposable,\n\t\tprivate readonly addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree,\n\t) {}\n\tpublic get policies() {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get repositoryUrl() {\n\t\treturn this.internalStorageService.repositoryUrl;\n\t}\n\tpublic get disposed() {\n\t\treturn this.internalStorageService.disposed;\n\t}\n\n\tgetSnapshotTree = this.internalStorageService.getSnapshotTree.bind(this.internalStorageService);\n\tgetVersions = this.internalStorageService.getVersions.bind(this.internalStorageService);\n\tcreateBlob = this.internalStorageService.createBlob.bind(this.internalStorageService);\n\treadBlob = this.internalStorageService.readBlob.bind(this.internalStorageService);\n\tdownloadSummary = this.internalStorageService.downloadSummary.bind(this.internalStorageService);\n\tdispose = this.internalStorageService.dispose.bind(this.internalStorageService);\n\n\tasync uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\treturn this.internalStorageService.uploadSummaryWithContext(\n\t\t\tthis.addProtocolSummaryIfMissing(summary),\n\t\t\tcontext,\n\t\t);\n\t}\n}\n"]}
package/lib/quorum.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
1
  import { IFluidCodeDetails } from "@fluidframework/core-interfaces";
6
2
  import { ICommittedProposal } from "@fluidframework/protocol-definitions";
7
3
  export declare function initQuorumValuesFromCodeDetails(source: IFluidCodeDetails): [string, ICommittedProposal][];
@@ -1 +1 @@
1
- {"version":3,"file":"quorum.d.ts","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE1E,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,iBAAiB,GACvB,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAUhC"}
1
+ {"version":3,"file":"quorum.d.ts","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"OAIO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC;OAC5D,EAAE,kBAAkB,EAAE,MAAM,sCAAsC;AAEzE,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,iBAAiB,GACvB,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAUhC"}
@@ -9,4 +9,4 @@ export function initQuorumValuesFromCodeDetails(source) {
9
9
  };
10
10
  return [["code", committedCodeProposal]];
11
11
  }
12
- //# sourceMappingURL=quorum.js.map
12
+ //# sourceMappingURL=quorum.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quorum.mjs","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,+BAA+B,CAC9C,MAAyB;IAEzB,kEAAkE;IAClE,MAAM,qBAAqB,GAAuB;QACjD,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,MAAM;QACb,sBAAsB,EAAE,CAAC;QACzB,oBAAoB,EAAE,CAAC;QACvB,cAAc,EAAE,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidCodeDetails } from \"@fluidframework/core-interfaces\";\nimport { ICommittedProposal } from \"@fluidframework/protocol-definitions\";\n\nexport function initQuorumValuesFromCodeDetails(\n\tsource: IFluidCodeDetails,\n): [string, ICommittedProposal][] {\n\t// Seed the base quorum to be an empty list with a code quorum set\n\tconst committedCodeProposal: ICommittedProposal = {\n\t\tkey: \"code\",\n\t\tvalue: source,\n\t\tapprovalSequenceNumber: 0,\n\t\tcommitSequenceNumber: 0,\n\t\tsequenceNumber: 0,\n\t};\n\treturn [[\"code\", committedCodeProposal]];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"retriableDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAgB,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGpF,qBAAa,+BAAgC,YAAW,uBAAuB,EAAE,WAAW;IAI1F,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJxB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,sBAAsB,CAAsC;gBAElD,uBAAuB,EAAE,OAAO,CAAC,uBAAuB,CAAC,EACzD,MAAM,EAAE,mBAAmB;IAK7C,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAKjE;IACD,IAAW,QAAQ,YAElB;IACM,OAAO;IAId,IAAW,aAAa,IAAI,MAAM,CAKjC;IAEY,eAAe,CAC3B,OAAO,CAAC,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAUnB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAO9C,WAAW,CACvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUT,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IA8BL,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAO9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO5E,OAAO,CAAC,oBAAoB;YAiBd,YAAY;CAM1B"}
1
+ {"version":3,"file":"retriableDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,oCAAoC;OACpC,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC;OACtC,EAAE,WAAW,EAAE,MAAM,iCAAiC;OACtD,EAAgB,mBAAmB,EAAE,MAAM,iCAAiC;AAGnF,qBAAa,+BAAgC,YAAW,uBAAuB,EAAE,WAAW;IAI1F,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJxB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,sBAAsB,CAAsC;gBAElD,uBAAuB,EAAE,OAAO,CAAC,uBAAuB,CAAC,EACzD,MAAM,EAAE,mBAAmB;IAK7C,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAKjE;IACD,IAAW,QAAQ,YAElB;IACM,OAAO;IAId,IAAW,aAAa,IAAI,MAAM,CAKjC;IAEY,eAAe,CAC3B,OAAO,CAAC,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAUnB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAO9C,WAAW,CACvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUT,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IA8BL,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAO9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO5E,OAAO,CAAC,oBAAoB;YAiBd,YAAY;CAM1B"}
@@ -81,4 +81,4 @@ export class RetriableDocumentStorageService {
81
81
  });
82
82
  }
83
83
  }
84
- //# sourceMappingURL=retriableDocumentStorageService.js.map
84
+ //# sourceMappingURL=retriableDocumentStorageService.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retriableDocumentStorageService.mjs","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAe5C,EAAE,YAAY,EAAuB,MAAM,iCAAiC;OAC5E,EAAE,YAAY,EAAE,MAAM,8BAA8B;AAE3D,MAAM,OAAO,+BAA+B;IAG3C,YACkB,uBAAyD,EACzD,MAA2B;QAD3B,4BAAuB,GAAvB,uBAAuB,CAAkC;QACz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AAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,EACrF,yBAAyB,CACzB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAC9E,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEO,oBAAoB,CAAC,QAAgB,EAAE,KAAc;QAC5D,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAC7B;gBACC,SAAS,EAAE,GAAG,QAAQ,yBAAyB;gBAC/C,aAAa,EAAE,QAAQ,EAAE,gDAAgD;aACzE,EACD,KAAK,CACL,CAAC;YACF,4DAA4D;YAC5D,MAAM,IAAI,YAAY,CAAC,2CAA2C,EAAE;gBACnE,QAAQ,EAAE,KAAK;aACf,CAAC,CAAC;SACH;QACD,OAAO;IACR,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE;YAC/C,OAAO,EAAE,CAAC,UAAkB,EAAE,KAAc,EAAE,EAAE,CAC/C,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC;SAC3C,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { GenericError, ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { runWithRetry } from \"@fluidframework/driver-utils\";\n\nexport class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {\n\tprivate _disposed = false;\n\tprivate internalStorageService: IDocumentStorageService | undefined;\n\tconstructor(\n\t\tprivate readonly internalStorageServiceP: Promise<IDocumentStorageService>,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.internalStorageServiceP.then((s) => (this.internalStorageService = s)).catch(() => {});\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\tif (this.internalStorageService) {\n\t\t\treturn this.internalStorageService.policies;\n\t\t}\n\t\tthrow new Error(\"storage service not yet instantiated\");\n\t}\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose() {\n\t\tthis._disposed = true;\n\t}\n\n\tpublic get repositoryUrl(): string {\n\t\tif (this.internalStorageService) {\n\t\t\treturn this.internalStorageService.repositoryUrl;\n\t\t}\n\t\tthrow new Error(\"storage service not yet instantiated\");\n\t}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: IVersion,\n\t\tscenarioName?: string,\n\t): Promise<ISnapshotTree | null> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.getSnapshotTree(version, scenarioName),\n\t\t\t\t),\n\t\t\t\"storage_getSnapshotTree\",\n\t\t);\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.readBlob(id)),\n\t\t\t\"storage_readBlob\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.getVersions(versionId, count, scenarioName, fetchSource),\n\t\t\t\t),\n\t\t\t\"storage_getVersions\",\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// Not using retry loop here. Couple reasons:\n\t\t// 1. If client lost connectivity, then retry loop will result in uploading stale summary\n\t\t// by stale summarizer after connectivity comes back. It will cause failures for this client and for\n\t\t// real (new) summarizer. This problem in particular should be solved in future by supplying abort handle\n\t\t// on all APIs and caller (ContainerRuntime.submitSummary) aborting call on loss of connectivity\n\t\t// 2. Similar, if we get 429 with retryAfter = 10 minutes, it's likely not the right call to retry summary\n\t\t// upload in 10 minutes - it's better to keep processing ops and retry later. Though caller needs to take\n\t\t// retryAfter into account!\n\t\t// But retry loop is required for creation flow (Container.attach)\n\t\tassert(\n\t\t\t(context.referenceSequenceNumber === 0) === (context.ackHandle === undefined),\n\t\t\t0x251 /* \"creation summary has to have seq=0 && handle === undefined\" */,\n\t\t);\n\t\tif (context.referenceSequenceNumber !== 0) {\n\t\t\treturn this.internalStorageServiceP.then(async (s) =>\n\t\t\t\ts.uploadSummaryWithContext(summary, context),\n\t\t\t);\n\t\t}\n\n\t\t// Creation flow with attachment blobs - need to do retries!\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.uploadSummaryWithContext(summary, context),\n\t\t\t\t),\n\t\t\t\"storage_uploadSummaryWithContext\",\n\t\t);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.downloadSummary(handle)),\n\t\t\t\"storage_downloadSummary\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.createBlob(file)),\n\t\t\t\"storage_createBlob\",\n\t\t);\n\t}\n\n\tprivate checkStorageDisposed(callName: string, error: unknown) {\n\t\tif (this._disposed) {\n\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: `${callName}_abortedStorageDisposed`,\n\t\t\t\t\tfetchCallName: callName, // fetchCallName matches logs in runWithRetry.ts\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\t// pre-0.58 error message: storageServiceDisposedCannotRetry\n\t\t\tthrow new GenericError(\"Storage Service is disposed. Cannot retry\", {\n\t\t\t\tcanRetry: false,\n\t\t\t});\n\t\t}\n\t\treturn;\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(api, callName, this.logger, {\n\t\t\tonRetry: (_delayInMs: number, error: unknown) =>\n\t\t\t\tthis.checkStorageDisposed(callName, error),\n\t\t});\n\t}\n}\n"]}
package/lib/utils.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface ISnapshotTreeWithBlobContents extends ISnapshotTree {
16
16
  * Interface to represent the parsed parts of IResolvedUrl.url to help
17
17
  * in getting info about different parts of the url.
18
18
  * May not be compatible or relevant for any Url Resolver
19
+ * @internal
19
20
  */
20
21
  export interface IParsedUrl {
21
22
  /**
@@ -44,6 +45,7 @@ export interface IParsedUrl {
44
45
  * with urls of type: protocol://<string>/.../..?<querystring>
45
46
  * @param url - This is the IResolvedUrl.url part of the resolved url.
46
47
  * @returns The IParsedUrl representing the input URL, or undefined if the format was not supported
48
+ * @internal
47
49
  */
48
50
  export declare function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined;
49
51
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,sCAAsC,CAAC;AAEhG,OAAO,EACN,6BAA6B,EAC7B,mCAAmC,EAEnC,MAAM,8BAA8B,CAAC;AAKtC,MAAM,WAAW,6BAA8B,SAAQ,aAAa;IACnE,aAAa,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAC;IACnD,KAAK,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,6BAA6B,CAAA;KAAE,CAAC;CACzD;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAWjF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,UAAU,EAAE,YAAY,EACxB,eAAe,EAAE,YAAY,GAC3B,6BAA6B,CAiB/B;AA0DD;;;;GAIG;AACH,wBAAgB,0CAA0C,CACzD,mBAAmB,EAAE,YAAY,EACjC,cAAc,EAAE,YAAY,GAC1B,6BAA6B,CAW/B;AAID,eAAO,MAAM,sCAAsC,8BACvB,YAAY,KACrC,6BAYF,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAE9E;AAED,wBAAgB,qCAAqC,CACpD,KAAK,EAAE,GAAG,GACR,KAAK,IAAI,mCAAmC,CAM9C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAMI,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,sCAAsC;OAExF,EACN,6BAA6B,EAC7B,mCAAmC,EAEnC,MAAM,8BAA8B;AAKrC,MAAM,WAAW,6BAA8B,SAAQ,aAAa;IACnE,aAAa,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAC;IACnD,KAAK,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,6BAA6B,CAAA;KAAE,CAAC;CACzD;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAWjF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,UAAU,EAAE,YAAY,EACxB,eAAe,EAAE,YAAY,GAC3B,6BAA6B,CAiB/B;AA0DD;;;;GAIG;AACH,wBAAgB,0CAA0C,CACzD,mBAAmB,EAAE,YAAY,EACjC,cAAc,EAAE,YAAY,GAC1B,6BAA6B,CAW/B;AAID,eAAO,MAAM,sCAAsC,8BACvB,YAAY,KACrC,6BAYF,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAE9E;AAED,wBAAgB,qCAAqC,CACpD,KAAK,EAAE,GAAG,GACR,KAAK,IAAI,mCAAmC,CAM9C"}
@@ -17,6 +17,7 @@ import { DriverErrorTypes } from "@fluidframework/driver-definitions";
17
17
  * with urls of type: protocol://<string>/.../..?<querystring>
18
18
  * @param url - This is the IResolvedUrl.url part of the resolved url.
19
19
  * @returns The IParsedUrl representing the input URL, or undefined if the format was not supported
20
+ * @internal
20
21
  */
21
22
  export function tryParseCompatibleResolvedUrl(url) {
22
23
  const parsed = parse(url, true);
@@ -129,4 +130,4 @@ export function isDeltaStreamConnectionForbiddenError(error) {
129
130
  error !== null &&
130
131
  error?.errorType === DriverErrorTypes.deltaStreamConnectionForbidden);
131
132
  }
132
- //# sourceMappingURL=utils.js.map
133
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,KAAK,EAAE,MAAM,KAAK;OACpB,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM;OAC1B,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,8BAA8B;OAC/E,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,4BAA4B;OAC7D,EAA+B,WAAW,EAAE,MAAM,sCAAsC;OACxF,EAAE,YAAY,EAAE,MAAM,iCAAiC;OACvD,EAGN,+BAA+B,GAC/B,MAAM,8BAA8B;OAC9B,EAAE,gBAAgB,EAAE,MAAM,oCAAoC;AAoCrE;;;;;;;;GAQG;AACH,MAAM,UAAU,6BAA6B,CAAC,GAAW;IACxD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAChC,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACxC,MAAM,IAAI,YAAY,CAAC,0BAA0B,CAAC,CAAC;KACnD;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,2BAA2B,CAAC;IAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,KAAK,EAAE,MAAM,KAAK,CAA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ACrD,yBAAuC,EACP,EAAE;IAClC,MAAM,CACL,+BAA+B,CAAC,yBAAyB,CAAC,EAC1D,KAAK,CAAC,wDAAwD,CAC9D,CAAC;IACF,MAAM,mBAAmB,GAAG,yBAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxE,MAAM,cAAc,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,4BAA4B,GAAG,0CAA0C,CAC9E,mBAAmB,EACnB,cAAc,CACd,CAAC;IACF,OAAO,4BAA4B,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,UAAU,uBAAuB,CAAC,QAAuB;IAC9D,OAAO,WAAW,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,qCAAqC,CACpD,KAAU;IAEV,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,EAAE,SAAS,KAAK,gBAAgB,CAAC,8BAA8B,CACpE,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport { v4 as uuid } from \"uuid\";\nimport { stringToBuffer, Uint8ArrayToArrayBuffer } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport { ISummaryTree, ISnapshotTree, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { LoggingError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tCombinedAppAndProtocolSummary,\n\tDeltaStreamConnectionForbiddenError,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions\";\n\n// This is used when we rehydrate a container from the snapshot. Here we put the blob contents\n// in separate property: blobContents.\nexport interface ISnapshotTreeWithBlobContents extends ISnapshotTree {\n\tblobsContents: { [path: string]: ArrayBufferLike };\n\ttrees: { [path: string]: ISnapshotTreeWithBlobContents };\n}\n\n/**\n * Interface to represent the parsed parts of IResolvedUrl.url to help\n * in getting info about different parts of the url.\n * May not be compatible or relevant for any Url Resolver\n * @internal\n */\nexport interface IParsedUrl {\n\t/**\n\t * It is combination of tenantid/docId part of the url.\n\t */\n\tid: string;\n\t/**\n\t * It is the deep link path in the url.\n\t */\n\tpath: string;\n\t/**\n\t * Query string part of the url.\n\t */\n\tquery: string;\n\t/**\n\t * Null means do not use snapshots, undefined means load latest snapshot\n\t * otherwise it's version ID passed to IDocumentStorageService.getVersions() to figure out what snapshot to use.\n\t * If needed, can add undefined which is treated by Container.load() as load latest snapshot.\n\t */\n\tversion: string | null | undefined;\n}\n\n/**\n * Utility api to parse the IResolvedUrl.url into specific parts like querystring, path to get\n * deep link info etc.\n * Warning - This function may not be compatible with any Url Resolver's resolved url. It works\n * with urls of type: protocol://<string>/.../..?<querystring>\n * @param url - This is the IResolvedUrl.url part of the resolved url.\n * @returns The IParsedUrl representing the input URL, or undefined if the format was not supported\n * @internal\n */\nexport function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined {\n\tconst parsed = parse(url, true);\n\tif (typeof parsed.pathname !== \"string\") {\n\t\tthrow new LoggingError(\"Failed to parse pathname\");\n\t}\n\tconst query = parsed.search ?? \"\";\n\tconst regex = /^\\/([^/]*\\/[^/]*)(\\/?.*)$/;\n\tconst match = regex.exec(parsed.pathname);\n\treturn match?.length === 3\n\t\t? { id: match[1], path: match[2], query, version: parsed.query.version as string }\n\t\t: undefined;\n}\n\n/**\n * Combine the app summary and protocol summary in 1 tree.\n * @param appSummary - Summary of the app.\n * @param protocolSummary - Summary of the protocol.\n * @internal\n */\nexport function combineAppAndProtocolSummary(\n\tappSummary: ISummaryTree,\n\tprotocolSummary: ISummaryTree,\n): CombinedAppAndProtocolSummary {\n\tassert(\n\t\t!isCombinedAppAndProtocolSummary(appSummary),\n\t\t0x5a8 /* app summary is already a combined tree! */,\n\t);\n\tassert(\n\t\t!isCombinedAppAndProtocolSummary(protocolSummary),\n\t\t0x5a9 /* protocol summary is already a combined tree! */,\n\t);\n\tconst createNewSummary: CombinedAppAndProtocolSummary = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: {\n\t\t\t\".protocol\": protocolSummary,\n\t\t\t\".app\": appSummary,\n\t\t},\n\t};\n\treturn createNewSummary;\n}\n\n/**\n * Converts summary tree (for upload) to snapshot tree (for download).\n * Summary tree blobs contain contents, but snapshot tree blobs normally\n * contain IDs pointing to storage. This will create 2 blob entries in the\n * snapshot tree for each blob in the summary tree. One will be the regular\n * path pointing to a uniquely generated ID. Then there will be another\n * entry with the path as that uniquely generated ID, and value as the\n * blob contents as a base-64 string.\n * @param summary - summary to convert\n */\nfunction convertSummaryToSnapshotWithEmbeddedBlobContents(\n\tsummary: ISummaryTree,\n): ISnapshotTreeWithBlobContents {\n\tconst treeNode: ISnapshotTreeWithBlobContents = {\n\t\tblobs: {},\n\t\tblobsContents: {},\n\t\ttrees: {},\n\t\tid: uuid(),\n\t\tunreferenced: summary.unreferenced,\n\t};\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\ttreeNode.trees[key] =\n\t\t\t\t\tconvertSummaryToSnapshotWithEmbeddedBlobContents(summaryObject);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Attachment:\n\t\t\t\ttreeNode.blobs[key] = summaryObject.id;\n\t\t\t\tbreak;\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst blobId = uuid();\n\t\t\t\ttreeNode.blobs[key] = blobId;\n\t\t\t\tconst contentBuffer =\n\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t? stringToBuffer(summaryObject.content, \"utf8\")\n\t\t\t\t\t\t: Uint8ArrayToArrayBuffer(summaryObject.content);\n\t\t\t\ttreeNode.blobsContents[blobId] = contentBuffer;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle:\n\t\t\t\tthrow new LoggingError(\n\t\t\t\t\t\"No handles should be there in summary in detached container!!\",\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(summaryObject, `Unknown tree type ${(summaryObject as any).type}`);\n\t\t\t}\n\t\t}\n\t}\n\treturn treeNode;\n}\n\n/**\n * Combine and convert protocol and app summary tree to format which is readable by container while rehydrating.\n * @param protocolSummaryTree - Protocol Summary Tree\n * @param appSummaryTree - App Summary Tree\n */\nexport function convertProtocolAndAppSummaryToSnapshotTree(\n\tprotocolSummaryTree: ISummaryTree,\n\tappSummaryTree: ISummaryTree,\n): ISnapshotTreeWithBlobContents {\n\t// Shallow copy is fine, since we are doing a deep clone below.\n\tconst combinedSummary: ISummaryTree = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: { ...appSummaryTree.tree },\n\t};\n\n\tcombinedSummary.tree[\".protocol\"] = protocolSummaryTree;\n\tconst snapshotTreeWithBlobContents =\n\t\tconvertSummaryToSnapshotWithEmbeddedBlobContents(combinedSummary);\n\treturn snapshotTreeWithBlobContents;\n}\n\n// This function converts the snapshot taken in detached container(by serialize api) to snapshotTree with which\n// a detached container can be rehydrated.\nexport const getSnapshotTreeFromSerializedContainer = (\n\tdetachedContainerSnapshot: ISummaryTree,\n): ISnapshotTreeWithBlobContents => {\n\tassert(\n\t\tisCombinedAppAndProtocolSummary(detachedContainerSnapshot),\n\t\t0x1e0 /* \"Protocol and App summary trees should be present\" */,\n\t);\n\tconst protocolSummaryTree = detachedContainerSnapshot.tree[\".protocol\"];\n\tconst appSummaryTree = detachedContainerSnapshot.tree[\".app\"];\n\tconst snapshotTreeWithBlobContents = convertProtocolAndAppSummaryToSnapshotTree(\n\t\tprotocolSummaryTree,\n\t\tappSummaryTree,\n\t);\n\treturn snapshotTreeWithBlobContents;\n};\n\nexport function getProtocolSnapshotTree(snapshot: ISnapshotTree): ISnapshotTree {\n\treturn \".protocol\" in snapshot.trees ? snapshot.trees[\".protocol\"] : snapshot;\n}\n\nexport function isDeltaStreamConnectionForbiddenError(\n\terror: any,\n): error is DeltaStreamConnectionForbiddenError {\n\treturn (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\terror?.errorType === DriverErrorTypes.deltaStreamConnectionForbidden\n\t);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-loader",
3
- "version": "2.0.0-internal.7.2.2",
3
+ "version": "2.0.0-internal.7.4.0",
4
4
  "description": "Fluid container loader",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,8 +11,8 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
- "main": "dist/index.js",
15
- "module": "lib/index.js",
14
+ "main": "dist/index.cjs",
15
+ "module": "lib/index.mjs",
16
16
  "types": "dist/index.d.ts",
17
17
  "c8": {
18
18
  "all": true,
@@ -35,38 +35,39 @@
35
35
  "temp-directory": "nyc/.nyc_output"
36
36
  },
37
37
  "dependencies": {
38
- "@fluid-internal/client-utils": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
39
- "@fluidframework/container-definitions": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
40
- "@fluidframework/core-interfaces": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
41
- "@fluidframework/core-utils": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
42
- "@fluidframework/driver-definitions": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
43
- "@fluidframework/driver-utils": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
38
+ "@fluid-internal/client-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
39
+ "@fluidframework/container-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
40
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
41
+ "@fluidframework/core-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
42
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
43
+ "@fluidframework/driver-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
44
44
  "@fluidframework/protocol-base": "^2.0.1",
45
45
  "@fluidframework/protocol-definitions": "^3.0.0",
46
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
46
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
47
47
  "debug": "^4.3.4",
48
48
  "double-ended-queue": "^2.1.0-0",
49
49
  "events": "^3.1.0",
50
- "lodash": "^4.17.21",
51
50
  "url": "^0.11.0",
52
51
  "uuid": "^9.0.0"
53
52
  },
54
53
  "devDependencies": {
55
- "@fluid-internal/test-loader-utils": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
56
- "@fluid-tools/build-cli": "^0.26.1",
54
+ "@arethetypeswrong/cli": "^0.13.3",
55
+ "@fluid-private/test-loader-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
56
+ "@fluid-tools/build-cli": "^0.28.0",
57
57
  "@fluidframework/build-common": "^2.0.3",
58
- "@fluidframework/build-tools": "^0.26.1",
59
- "@fluidframework/container-loader-previous": "npm:@fluidframework/container-loader@2.0.0-internal.7.2.1",
60
- "@fluidframework/eslint-config-fluid": "^3.0.0",
61
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.2.2 <2.0.0-internal.7.3.0",
62
- "@microsoft/api-extractor": "^7.37.0",
58
+ "@fluidframework/build-tools": "^0.28.0",
59
+ "@fluidframework/container-loader-previous": "npm:@fluidframework/container-loader@2.0.0-internal.7.2.0",
60
+ "@fluidframework/eslint-config-fluid": "^3.1.0",
61
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
62
+ "@microsoft/api-extractor": "^7.38.3",
63
+ "@types/debug": "^4.1.5",
63
64
  "@types/double-ended-queue": "^2.1.0",
64
65
  "@types/events": "^3.0.0",
65
- "@types/lodash": "^4.14.118",
66
66
  "@types/mocha": "^9.1.1",
67
- "@types/node": "^16.18.38",
67
+ "@types/node": "^18.19.0",
68
68
  "@types/sinon": "^7.0.13",
69
69
  "c8": "^7.7.1",
70
+ "copyfiles": "^2.4.1",
70
71
  "cross-env": "^7.0.3",
71
72
  "eslint": "~8.50.0",
72
73
  "mocha": "^10.2.0",
@@ -76,33 +77,51 @@
76
77
  "prettier": "~3.0.3",
77
78
  "rimraf": "^4.4.0",
78
79
  "sinon": "^7.4.2",
80
+ "tsc-multi": "^1.1.0",
79
81
  "typescript": "~5.1.6"
80
82
  },
83
+ "fluidBuild": {
84
+ "tasks": {
85
+ "build:docs": {
86
+ "dependsOn": [
87
+ "...",
88
+ "api-extractor:commonjs",
89
+ "api-extractor:esnext"
90
+ ],
91
+ "script": false
92
+ }
93
+ }
94
+ },
81
95
  "typeValidation": {
82
96
  "broken": {}
83
97
  },
84
98
  "scripts": {
99
+ "api": "fluid-build . --task api",
100
+ "api-extractor:commonjs": "api-extractor run --local",
101
+ "api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
85
102
  "build": "fluid-build . --task build",
86
103
  "build:commonjs": "fluid-build . --task commonjs",
87
104
  "build:compile": "fluid-build . --task compile",
88
- "build:docs": "api-extractor run --local",
89
- "build:esnext": "tsc --project ./tsconfig.esnext.json",
105
+ "build:docs": "fluid-build . --task api",
106
+ "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
90
107
  "build:genver": "gen-version",
91
- "build:test": "tsc --project ./src/test/tsconfig.json",
108
+ "build:test": "tsc-multi --config tsc-multi.test.json",
109
+ "check:are-the-types-wrong": "attw --pack",
110
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
92
111
  "ci:build:docs": "api-extractor run",
93
- "clean": "rimraf --glob dist lib \"*.tsbuildinfo\" \"*.build.log\" _api-extractor-temp nyc",
112
+ "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
94
113
  "eslint": "eslint --format stylish src",
95
114
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
96
115
  "format": "npm run prettier:fix",
97
- "lint": "npm run prettier && npm run eslint",
116
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
98
117
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
99
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
100
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
118
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
119
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
101
120
  "test": "npm run test:mocha",
102
121
  "test:coverage": "c8 npm test",
103
- "test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
122
+ "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
104
123
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
105
- "tsc": "tsc",
124
+ "tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
106
125
  "tsc:watch": "tsc --watch",
107
126
  "typetests:gen": "fluid-type-test-generator",
108
127
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
@@ -63,7 +63,8 @@ import { DeltaQueue } from "./deltaQueue";
63
63
  import { SignalType } from "./protocol";
64
64
  import { isDeltaStreamConnectionForbiddenError } from "./utils";
65
65
 
66
- const InitialReconnectDelayInMs = 1000;
66
+ // We double this value in first try in when we calculate time to wait for in "calculateMaxWaitTime" function.
67
+ const InitialReconnectDelayInMs = 500;
67
68
  const DefaultChunkSize = 16 * 1024;
68
69
 
69
70
  const fatalConnectErrorProp = { fatalConnectError: true };
@@ -594,6 +595,14 @@ export class ConnectionManager implements IConnectionManager {
594
595
  LogLevel.verbose,
595
596
  );
596
597
  } catch (origError: any) {
598
+ this.logger.sendTelemetryEvent(
599
+ {
600
+ eventName: "ConnectToDeltaStreamException",
601
+ connected: connection !== undefined && connection.disposed === false,
602
+ },
603
+ undefined,
604
+ LogLevel.verbose,
605
+ );
597
606
  if (isDeltaStreamConnectionForbiddenError(origError)) {
598
607
  connection = new NoDeltaStream(origError.storageOnlyReason, {
599
608
  text: origError.message,
@@ -639,20 +648,19 @@ export class ConnectionManager implements IConnectionManager {
639
648
 
640
649
  const waitStartTime = performance.now();
641
650
  const retryDelayFromError = getRetryDelayFromError(origError);
642
- if (retryDelayFromError !== undefined) {
643
- // If the error told us to wait, then we wait.
644
- this.props.reconnectionDelayHandler(retryDelayFromError, origError);
645
- await new Promise<void>((resolve) => {
646
- setTimeout(resolve, retryDelayFromError);
647
- });
648
- } else if (globalThis.navigator?.onLine !== false) {
649
- // If the error didn't tell us to wait, let's still wait a little bit before retrying.
650
- // We skip this delay if we're confident we're offline, because we probably just need to wait to come back online.
651
- await new Promise<void>((resolve) => {
652
- setTimeout(resolve, delayMs);
653
- delayMs = Math.min(delayMs * 2, calculateMaxWaitTime(origError));
654
- });
651
+ // If the error told us to wait or browser signals us that we are offline, then calculate the time we
652
+ // want to wait for before retrying. then we wait for that time. If the error didn't tell us to wait,
653
+ // let's still wait a little bit before retrying. We can skip this delay if we're confident we're offline,
654
+ // because we probably just need to wait to come back online. But we never have strong signal of being
655
+ // offline, so we at least wait for sometime.
656
+ if (retryDelayFromError !== undefined || globalThis.navigator?.onLine !== false) {
657
+ delayMs = calculateMaxWaitTime(delayMs, origError);
655
658
  }
659
+ // Raise event in case the delay was there.
660
+ this.props.reconnectionDelayHandler(delayMs, origError);
661
+ await new Promise<void>((resolve) => {
662
+ setTimeout(resolve, delayMs);
663
+ });
656
664
 
657
665
  // If we believe we're offline, we assume there's no point in trying until we at least think we're online.
658
666
  // NOTE: This isn't strictly true for drivers that don't require network (e.g. local driver). Really this logic
@@ -3,6 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ /**
7
+ * @internal
8
+ */
6
9
  export enum ConnectionState {
7
10
  /**
8
11
  * The container is not connected to the ordering service
@@ -312,12 +312,25 @@ class ConnectionStateCatchup extends ConnectionStateHandlerPassThrough {
312
312
  class ConnectionStateHandler implements IConnectionStateHandler {
313
313
  private _connectionState = ConnectionState.Disconnected;
314
314
  private _pendingClientId: string | undefined;
315
+
316
+ /**
317
+ * Tracks that we observe the "leave" op within the timeout for our previous clientId (see comment on ConnectionStateHandler class)
318
+ * ! This ensures we do not switch to a new clientId until we process all potential messages from old clientId
319
+ * ! i.e. We will always see the "leave" op for a client after we have seen all the ops it has sent
320
+ * ! This check helps prevent the same op from being resubmitted by the PendingStateManager upon reconnecting
321
+ */
315
322
  private readonly prevClientLeftTimer: Timer;
323
+
324
+ /**
325
+ * Tracks that we observe our own "join" op within the timeout after receiving a "connected" event from the DeltaManager
326
+ */
316
327
  private readonly joinOpTimer: Timer;
328
+
317
329
  private protocol?: IProtocolHandler;
318
330
  private connection?: IConnectionDetailsInternal;
319
331
  private _clientId?: string;
320
332
 
333
+ /** Track how long we waited to see "leave" op for previous clientId */
321
334
  private waitEvent: PerformanceEvent | undefined;
322
335
 
323
336
  public get connectionState(): ConnectionState {
@@ -453,9 +466,9 @@ class ConnectionStateHandler implements IConnectionStateHandler {
453
466
  0x2e2 /* "Must only wait for leave message when clientId in quorum" */,
454
467
  );
455
468
 
456
- // Move to connected state only if we are in Connecting state, we have seen our join op
457
- // and there is no timer running which means we are not waiting for previous client to leave
458
- // or timeout has occurred while doing so.
469
+ // Move to connected state only if:
470
+ // 1. We have seen our own "join" op (i.e. for this.pendingClientId)
471
+ // 2. There is no "leave" timer running, meaning this is our first connection or the previous client has left (via this.prevClientLeftTimer)
459
472
  if (
460
473
  this.pendingClientId !== this.clientId &&
461
474
  this.hasMember(this.pendingClientId) &&