@fluidframework/container-loader 2.0.0-rc.1.0.3 → 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 (298) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +5 -6
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +48 -0
  4. package/README.md +3 -3
  5. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  6. package/api-extractor-lint.json +1 -1
  7. package/api-extractor.json +1 -1
  8. package/api-report/container-loader.api.md +2 -2
  9. package/dist/attachment.d.ts +115 -0
  10. package/dist/attachment.d.ts.map +1 -0
  11. package/dist/attachment.js +83 -0
  12. package/dist/attachment.js.map +1 -0
  13. package/dist/audience.d.ts +9 -4
  14. package/dist/audience.d.ts.map +1 -1
  15. package/dist/audience.js +10 -4
  16. package/dist/audience.js.map +1 -1
  17. package/dist/connectionManager.d.ts +3 -3
  18. package/dist/connectionManager.d.ts.map +1 -1
  19. package/dist/connectionManager.js +17 -18
  20. package/dist/connectionManager.js.map +1 -1
  21. package/dist/connectionState.d.ts +1 -0
  22. package/dist/connectionState.d.ts.map +1 -1
  23. package/dist/connectionState.js +1 -0
  24. package/dist/connectionState.js.map +1 -1
  25. package/dist/connectionStateHandler.d.ts +7 -7
  26. package/dist/connectionStateHandler.d.ts.map +1 -1
  27. package/dist/connectionStateHandler.js +32 -32
  28. package/dist/connectionStateHandler.js.map +1 -1
  29. package/dist/container-loader-alpha.d.ts +2 -1
  30. package/dist/container-loader-beta.d.ts +3 -0
  31. package/dist/container-loader-public.d.ts +3 -0
  32. package/dist/container-loader-untrimmed.d.ts +5 -5
  33. package/dist/container.d.ts +29 -27
  34. package/dist/container.d.ts.map +1 -1
  35. package/dist/container.js +219 -284
  36. package/dist/container.js.map +1 -1
  37. package/dist/containerContext.d.ts +3 -2
  38. package/dist/containerContext.d.ts.map +1 -1
  39. package/dist/containerContext.js +2 -1
  40. package/dist/containerContext.js.map +1 -1
  41. package/dist/containerStorageAdapter.d.ts +5 -6
  42. package/dist/containerStorageAdapter.d.ts.map +1 -1
  43. package/dist/containerStorageAdapter.js +14 -21
  44. package/dist/containerStorageAdapter.js.map +1 -1
  45. package/dist/contracts.d.ts +3 -3
  46. package/dist/contracts.d.ts.map +1 -1
  47. package/dist/contracts.js.map +1 -1
  48. package/dist/debugLogger.js.map +1 -1
  49. package/dist/deltaManager.d.ts +5 -5
  50. package/dist/deltaManager.d.ts.map +1 -1
  51. package/dist/deltaManager.js +6 -6
  52. package/dist/deltaManager.js.map +1 -1
  53. package/dist/error.d.ts.map +1 -1
  54. package/dist/error.js.map +1 -1
  55. package/dist/index.d.ts +6 -6
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +11 -11
  58. package/dist/index.js.map +1 -1
  59. package/dist/loader.d.ts +3 -3
  60. package/dist/loader.d.ts.map +1 -1
  61. package/dist/loader.js +13 -17
  62. package/dist/loader.js.map +1 -1
  63. package/dist/location-redirection-utilities/index.d.ts +1 -1
  64. package/dist/location-redirection-utilities/index.d.ts.map +1 -1
  65. package/dist/location-redirection-utilities/index.js +3 -3
  66. package/dist/location-redirection-utilities/index.js.map +1 -1
  67. package/dist/package.json +3 -0
  68. package/dist/packageVersion.d.ts +1 -1
  69. package/dist/packageVersion.js +1 -1
  70. package/dist/packageVersion.js.map +1 -1
  71. package/dist/protocolTreeDocumentStorageService.d.ts +1 -1
  72. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  73. package/dist/protocolTreeDocumentStorageService.js +1 -3
  74. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  75. package/dist/retriableDocumentStorageService.d.ts +2 -2
  76. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  77. package/dist/retriableDocumentStorageService.js +8 -6
  78. package/dist/retriableDocumentStorageService.js.map +1 -1
  79. package/dist/serializedStateManager.d.ts +44 -0
  80. package/dist/serializedStateManager.d.ts.map +1 -0
  81. package/dist/serializedStateManager.js +149 -0
  82. package/dist/serializedStateManager.js.map +1 -0
  83. package/dist/tsdoc-metadata.json +1 -1
  84. package/dist/utils.d.ts +16 -11
  85. package/dist/utils.d.ts.map +1 -1
  86. package/dist/utils.js +107 -32
  87. package/dist/utils.js.map +1 -1
  88. package/lib/attachment.d.ts +115 -0
  89. package/lib/attachment.d.ts.map +1 -0
  90. package/lib/attachment.js +79 -0
  91. package/lib/attachment.js.map +1 -0
  92. package/lib/{audience.d.mts → audience.d.ts} +14 -5
  93. package/lib/audience.d.ts.map +1 -0
  94. package/lib/{audience.mjs → audience.js} +14 -4
  95. package/lib/audience.js.map +1 -0
  96. package/lib/{catchUpMonitor.d.mts → catchUpMonitor.d.ts} +1 -1
  97. package/lib/catchUpMonitor.d.ts.map +1 -0
  98. package/lib/{catchUpMonitor.mjs → catchUpMonitor.js} +1 -1
  99. package/lib/catchUpMonitor.js.map +1 -0
  100. package/lib/{connectionManager.d.mts → connectionManager.d.ts} +4 -4
  101. package/lib/connectionManager.d.ts.map +1 -0
  102. package/lib/{connectionManager.mjs → connectionManager.js} +7 -10
  103. package/lib/connectionManager.js.map +1 -0
  104. package/lib/{connectionState.d.mts → connectionState.d.ts} +2 -1
  105. package/lib/connectionState.d.ts.map +1 -0
  106. package/lib/{connectionState.mjs → connectionState.js} +2 -1
  107. package/lib/connectionState.js.map +1 -0
  108. package/lib/{connectionStateHandler.d.mts → connectionStateHandler.d.ts} +8 -8
  109. package/lib/connectionStateHandler.d.ts.map +1 -0
  110. package/lib/{connectionStateHandler.mjs → connectionStateHandler.js} +3 -3
  111. package/lib/connectionStateHandler.js.map +1 -0
  112. package/lib/{container-loader-alpha.d.mts → container-loader-alpha.d.ts} +2 -1
  113. package/lib/{container-loader-beta.d.mts → container-loader-beta.d.ts} +3 -0
  114. package/lib/{container-loader-public.d.mts → container-loader-public.d.ts} +3 -0
  115. package/lib/{container-loader-untrimmed.d.mts → container-loader-untrimmed.d.ts} +5 -5
  116. package/lib/{container.d.mts → container.d.ts} +30 -28
  117. package/lib/container.d.ts.map +1 -0
  118. package/lib/{container.mjs → container.js} +179 -247
  119. package/lib/container.js.map +1 -0
  120. package/lib/{containerContext.d.mts → containerContext.d.ts} +4 -3
  121. package/lib/containerContext.d.ts.map +1 -0
  122. package/lib/{containerContext.mjs → containerContext.js} +3 -2
  123. package/lib/containerContext.js.map +1 -0
  124. package/lib/{containerStorageAdapter.d.mts → containerStorageAdapter.d.ts} +6 -7
  125. package/lib/containerStorageAdapter.d.ts.map +1 -0
  126. package/lib/{containerStorageAdapter.mjs → containerStorageAdapter.js} +13 -20
  127. package/lib/containerStorageAdapter.js.map +1 -0
  128. package/lib/{contracts.d.mts → contracts.d.ts} +4 -4
  129. package/lib/contracts.d.ts.map +1 -0
  130. package/lib/{contracts.mjs → contracts.js} +1 -1
  131. package/lib/contracts.js.map +1 -0
  132. package/lib/{debugLogger.d.mts → debugLogger.d.ts} +1 -1
  133. package/lib/debugLogger.d.ts.map +1 -0
  134. package/lib/{debugLogger.mjs → debugLogger.js} +2 -1
  135. package/lib/debugLogger.js.map +1 -0
  136. package/lib/{deltaManager.d.mts → deltaManager.d.ts} +6 -6
  137. package/lib/deltaManager.d.ts.map +1 -0
  138. package/lib/{deltaManager.mjs → deltaManager.js} +4 -4
  139. package/lib/deltaManager.js.map +1 -0
  140. package/lib/{deltaQueue.d.mts → deltaQueue.d.ts} +1 -1
  141. package/lib/deltaQueue.d.ts.map +1 -0
  142. package/lib/{deltaQueue.mjs → deltaQueue.js} +1 -1
  143. package/lib/deltaQueue.js.map +1 -0
  144. package/lib/{disposal.d.mts → disposal.d.ts} +1 -1
  145. package/lib/disposal.d.ts.map +1 -0
  146. package/lib/{disposal.mjs → disposal.js} +1 -1
  147. package/lib/disposal.js.map +1 -0
  148. package/lib/{error.d.mts → error.d.ts} +1 -1
  149. package/lib/error.d.ts.map +1 -0
  150. package/lib/{error.mjs → error.js} +1 -1
  151. package/lib/error.js.map +1 -0
  152. package/lib/{index.d.mts → index.d.ts} +7 -7
  153. package/lib/index.d.ts.map +1 -0
  154. package/lib/index.js +10 -0
  155. package/lib/index.js.map +1 -0
  156. package/lib/{loader.d.mts → loader.d.ts} +4 -4
  157. package/lib/loader.d.ts.map +1 -0
  158. package/lib/{loader.mjs → loader.js} +7 -11
  159. package/lib/loader.js.map +1 -0
  160. package/lib/location-redirection-utilities/{index.mjs → index.d.ts} +2 -2
  161. package/lib/location-redirection-utilities/index.d.ts.map +1 -0
  162. package/lib/location-redirection-utilities/{index.d.mts → index.js} +2 -2
  163. package/lib/location-redirection-utilities/index.js.map +1 -0
  164. package/lib/location-redirection-utilities/{resolveWithLocationRedirection.d.mts → resolveWithLocationRedirection.d.ts} +1 -1
  165. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
  166. package/lib/location-redirection-utilities/{resolveWithLocationRedirection.mjs → resolveWithLocationRedirection.js} +1 -1
  167. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
  168. package/lib/{noopHeuristic.d.mts → noopHeuristic.d.ts} +1 -1
  169. package/lib/noopHeuristic.d.ts.map +1 -0
  170. package/lib/{noopHeuristic.mjs → noopHeuristic.js} +1 -1
  171. package/lib/noopHeuristic.js.map +1 -0
  172. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  173. package/lib/packageVersion.d.ts.map +1 -0
  174. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  175. package/lib/packageVersion.js.map +1 -0
  176. package/lib/{protocol.d.mts → protocol.d.ts} +1 -1
  177. package/lib/protocol.d.ts.map +1 -0
  178. package/lib/{protocol.mjs → protocol.js} +1 -1
  179. package/lib/protocol.js.map +1 -0
  180. package/lib/{protocolTreeDocumentStorageService.d.mts → protocolTreeDocumentStorageService.d.ts} +2 -2
  181. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -0
  182. package/lib/{protocolTreeDocumentStorageService.mjs → protocolTreeDocumentStorageService.js} +2 -4
  183. package/lib/protocolTreeDocumentStorageService.js.map +1 -0
  184. package/lib/{quorum.d.mts → quorum.d.ts} +5 -1
  185. package/lib/quorum.d.ts.map +1 -0
  186. package/lib/{quorum.mjs → quorum.js} +1 -1
  187. package/lib/quorum.js.map +1 -0
  188. package/lib/{retriableDocumentStorageService.d.mts → retriableDocumentStorageService.d.ts} +3 -3
  189. package/lib/retriableDocumentStorageService.d.ts.map +1 -0
  190. package/lib/{retriableDocumentStorageService.mjs → retriableDocumentStorageService.js} +10 -8
  191. package/lib/retriableDocumentStorageService.js.map +1 -0
  192. package/lib/serializedStateManager.d.ts +44 -0
  193. package/lib/serializedStateManager.d.ts.map +1 -0
  194. package/lib/serializedStateManager.js +145 -0
  195. package/lib/serializedStateManager.js.map +1 -0
  196. package/lib/test/attachment.spec.js +380 -0
  197. package/lib/test/attachment.spec.js.map +1 -0
  198. package/lib/test/catchUpMonitor.spec.js +88 -0
  199. package/lib/test/catchUpMonitor.spec.js.map +1 -0
  200. package/lib/test/connectionManager.spec.js +201 -0
  201. package/lib/test/connectionManager.spec.js.map +1 -0
  202. package/lib/test/connectionStateHandler.spec.js +555 -0
  203. package/lib/test/connectionStateHandler.spec.js.map +1 -0
  204. package/lib/test/container.spec.js +64 -0
  205. package/lib/test/container.spec.js.map +1 -0
  206. package/lib/test/deltaManager.spec.js +405 -0
  207. package/lib/test/deltaManager.spec.js.map +1 -0
  208. package/lib/test/loader.spec.js +212 -0
  209. package/lib/test/loader.spec.js.map +1 -0
  210. package/lib/test/locationRedirectionTests.spec.js +44 -0
  211. package/lib/test/locationRedirectionTests.spec.js.map +1 -0
  212. package/lib/test/serializedStateManager.spec.js +148 -0
  213. package/lib/test/serializedStateManager.spec.js.map +1 -0
  214. package/lib/test/snapshotConversionTest.spec.js +79 -0
  215. package/lib/test/snapshotConversionTest.spec.js.map +1 -0
  216. package/lib/test/types/validateContainerLoaderPrevious.generated.js +38 -0
  217. package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +1 -0
  218. package/lib/test/utils.spec.js +31 -0
  219. package/lib/test/utils.spec.js.map +1 -0
  220. package/lib/{utils.d.mts → utils.d.ts} +17 -12
  221. package/lib/utils.d.ts.map +1 -0
  222. package/lib/utils.js +206 -0
  223. package/lib/utils.js.map +1 -0
  224. package/package.json +63 -63
  225. package/src/attachment.ts +222 -0
  226. package/src/audience.ts +9 -3
  227. package/src/connectionManager.ts +9 -11
  228. package/src/connectionState.ts +1 -0
  229. package/src/connectionStateHandler.ts +8 -7
  230. package/src/container.ts +297 -323
  231. package/src/containerContext.ts +2 -1
  232. package/src/containerStorageAdapter.ts +21 -26
  233. package/src/contracts.ts +3 -3
  234. package/src/debugLogger.ts +2 -2
  235. package/src/deltaManager.ts +8 -8
  236. package/src/error.ts +2 -2
  237. package/src/index.ts +6 -6
  238. package/src/loader.ts +9 -13
  239. package/src/location-redirection-utilities/index.ts +1 -1
  240. package/src/packageVersion.ts +1 -1
  241. package/src/protocolTreeDocumentStorageService.ts +1 -3
  242. package/src/retriableDocumentStorageService.ts +18 -8
  243. package/src/serializedStateManager.ts +217 -0
  244. package/src/utils.ts +140 -43
  245. package/tsconfig.cjs.json +7 -0
  246. package/tsconfig.json +2 -5
  247. package/lib/audience.d.mts.map +0 -1
  248. package/lib/audience.mjs.map +0 -1
  249. package/lib/catchUpMonitor.d.mts.map +0 -1
  250. package/lib/catchUpMonitor.mjs.map +0 -1
  251. package/lib/connectionManager.d.mts.map +0 -1
  252. package/lib/connectionManager.mjs.map +0 -1
  253. package/lib/connectionState.d.mts.map +0 -1
  254. package/lib/connectionState.mjs.map +0 -1
  255. package/lib/connectionStateHandler.d.mts.map +0 -1
  256. package/lib/connectionStateHandler.mjs.map +0 -1
  257. package/lib/container.d.mts.map +0 -1
  258. package/lib/container.mjs.map +0 -1
  259. package/lib/containerContext.d.mts.map +0 -1
  260. package/lib/containerContext.mjs.map +0 -1
  261. package/lib/containerStorageAdapter.d.mts.map +0 -1
  262. package/lib/containerStorageAdapter.mjs.map +0 -1
  263. package/lib/contracts.d.mts.map +0 -1
  264. package/lib/contracts.mjs.map +0 -1
  265. package/lib/debugLogger.d.mts.map +0 -1
  266. package/lib/debugLogger.mjs.map +0 -1
  267. package/lib/deltaManager.d.mts.map +0 -1
  268. package/lib/deltaManager.mjs.map +0 -1
  269. package/lib/deltaQueue.d.mts.map +0 -1
  270. package/lib/deltaQueue.mjs.map +0 -1
  271. package/lib/disposal.d.mts.map +0 -1
  272. package/lib/disposal.mjs.map +0 -1
  273. package/lib/error.d.mts.map +0 -1
  274. package/lib/error.mjs.map +0 -1
  275. package/lib/index.d.mts.map +0 -1
  276. package/lib/index.mjs +0 -10
  277. package/lib/index.mjs.map +0 -1
  278. package/lib/loader.d.mts.map +0 -1
  279. package/lib/loader.mjs.map +0 -1
  280. package/lib/location-redirection-utilities/index.d.mts.map +0 -1
  281. package/lib/location-redirection-utilities/index.mjs.map +0 -1
  282. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts.map +0 -1
  283. package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +0 -1
  284. package/lib/noopHeuristic.d.mts.map +0 -1
  285. package/lib/noopHeuristic.mjs.map +0 -1
  286. package/lib/packageVersion.d.mts.map +0 -1
  287. package/lib/packageVersion.mjs.map +0 -1
  288. package/lib/protocol.d.mts.map +0 -1
  289. package/lib/protocol.mjs.map +0 -1
  290. package/lib/protocolTreeDocumentStorageService.d.mts.map +0 -1
  291. package/lib/protocolTreeDocumentStorageService.mjs.map +0 -1
  292. package/lib/quorum.d.mts.map +0 -1
  293. package/lib/quorum.mjs.map +0 -1
  294. package/lib/retriableDocumentStorageService.d.mts.map +0 -1
  295. package/lib/retriableDocumentStorageService.mjs.map +0 -1
  296. package/lib/utils.d.mts.map +0 -1
  297. package/lib/utils.mjs +0 -133
  298. package/lib/utils.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-loader",
3
- "version": "2.0.0-rc.1.0.3",
3
+ "version": "2.0.0-rc.2.0.0",
4
4
  "description": "Fluid container loader",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,11 +11,12 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
+ "type": "module",
14
15
  "exports": {
15
16
  ".": {
16
17
  "import": {
17
- "types": "./lib/index.d.mts",
18
- "default": "./lib/index.mjs"
18
+ "types": "./lib/index.d.ts",
19
+ "default": "./lib/index.js"
19
20
  },
20
21
  "require": {
21
22
  "types": "./dist/index.d.ts",
@@ -24,8 +25,8 @@
24
25
  },
25
26
  "./test/container": {
26
27
  "import": {
27
- "types": "./lib/container.d.mts",
28
- "default": "./lib/container.mjs"
28
+ "types": "./lib/container.d.ts",
29
+ "default": "./lib/container.js"
29
30
  },
30
31
  "require": {
31
32
  "types": "./dist/container.d.ts",
@@ -34,8 +35,8 @@
34
35
  },
35
36
  "./test/contracts": {
36
37
  "import": {
37
- "types": "./lib/contracts.d.mts",
38
- "default": "./lib/contracts.mjs"
38
+ "types": "./lib/contracts.d.ts",
39
+ "default": "./lib/contracts.js"
39
40
  },
40
41
  "require": {
41
42
  "types": "./dist/contracts.d.ts",
@@ -44,8 +45,8 @@
44
45
  },
45
46
  "./test/connectionManager": {
46
47
  "import": {
47
- "types": "./lib/connectionManager.d.mts",
48
- "default": "./lib/connectionManager.mjs"
48
+ "types": "./lib/connectionManager.d.ts",
49
+ "default": "./lib/connectionManager.js"
49
50
  },
50
51
  "require": {
51
52
  "types": "./dist/connectionManager.d.ts",
@@ -54,8 +55,8 @@
54
55
  },
55
56
  "./test/deltaManager": {
56
57
  "import": {
57
- "types": "./lib/deltaManager.d.mts",
58
- "default": "./lib/deltaManager.mjs"
58
+ "types": "./lib/deltaManager.d.ts",
59
+ "default": "./lib/deltaManager.js"
59
60
  },
60
61
  "require": {
61
62
  "types": "./dist/deltaManager.d.ts",
@@ -64,57 +65,46 @@
64
65
  },
65
66
  "./test/utils": {
66
67
  "import": {
67
- "types": "./lib/utils.d.mts",
68
- "default": "./lib/utils.mjs"
68
+ "types": "./lib/utils.d.ts",
69
+ "default": "./lib/utils.js"
69
70
  },
70
71
  "require": {
71
72
  "types": "./dist/utils.d.ts",
72
73
  "default": "./dist/utils.js"
73
74
  }
74
75
  },
75
- "./alpha": {
76
+ "./public": {
76
77
  "import": {
77
- "types": "./lib/container-loader-alpha.d.mts",
78
- "default": "./lib/index.mjs"
78
+ "types": "./lib/container-loader-public.d.ts",
79
+ "default": "./lib/index.js"
79
80
  },
80
81
  "require": {
81
- "types": "./dist/container-loader-alpha.d.ts",
82
+ "types": "./dist/container-loader-public.d.ts",
82
83
  "default": "./dist/index.js"
83
84
  }
84
85
  },
85
- "./beta": {
86
+ "./alpha": {
86
87
  "import": {
87
- "types": "./lib/container-loader-beta.d.mts",
88
- "default": "./lib/index.mjs"
88
+ "types": "./lib/container-loader-alpha.d.ts",
89
+ "default": "./lib/index.js"
89
90
  },
90
91
  "require": {
91
- "types": "./dist/container-loader-beta.d.ts",
92
+ "types": "./dist/container-loader-alpha.d.ts",
92
93
  "default": "./dist/index.js"
93
94
  }
94
95
  },
95
96
  "./internal": {
96
97
  "import": {
97
- "types": "./lib/index.d.mts",
98
- "default": "./lib/index.mjs"
98
+ "types": "./lib/index.d.ts",
99
+ "default": "./lib/index.js"
99
100
  },
100
101
  "require": {
101
102
  "types": "./dist/index.d.ts",
102
103
  "default": "./dist/index.js"
103
104
  }
104
- },
105
- "./public": {
106
- "import": {
107
- "types": "./lib/container-loader-public.d.mts",
108
- "default": "./lib/index.mjs"
109
- },
110
- "require": {
111
- "types": "./dist/container-loader-public.d.ts",
112
- "default": "./dist/index.js"
113
- }
114
105
  }
115
106
  },
116
107
  "main": "dist/index.js",
117
- "module": "lib/index.mjs",
118
108
  "types": "dist/index.d.ts",
119
109
  "c8": {
120
110
  "all": true,
@@ -137,49 +127,48 @@
137
127
  "temp-directory": "nyc/.nyc_output"
138
128
  },
139
129
  "dependencies": {
140
- "@fluid-internal/client-utils": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
141
- "@fluidframework/container-definitions": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
142
- "@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
143
- "@fluidframework/core-utils": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
144
- "@fluidframework/driver-definitions": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
145
- "@fluidframework/driver-utils": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
146
- "@fluidframework/protocol-base": "^3.0.0",
147
- "@fluidframework/protocol-definitions": "^3.1.0",
148
- "@fluidframework/telemetry-utils": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
130
+ "@fluid-internal/client-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
131
+ "@fluidframework/container-definitions": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
132
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
133
+ "@fluidframework/core-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
134
+ "@fluidframework/driver-definitions": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
135
+ "@fluidframework/driver-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
136
+ "@fluidframework/protocol-base": "^4.0.0",
137
+ "@fluidframework/protocol-definitions": "^3.2.0",
138
+ "@fluidframework/telemetry-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
139
+ "@ungap/structured-clone": "^1.2.0",
149
140
  "debug": "^4.3.4",
150
141
  "double-ended-queue": "^2.1.0-0",
151
- "events": "^3.1.0",
152
- "url": "^0.11.0",
153
142
  "uuid": "^9.0.0"
154
143
  },
155
144
  "devDependencies": {
156
145
  "@arethetypeswrong/cli": "^0.13.3",
157
- "@fluid-private/test-loader-utils": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
158
- "@fluid-tools/build-cli": "^0.29.0",
146
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
147
+ "@fluid-private/test-loader-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
148
+ "@fluid-tools/build-cli": "^0.34.0",
159
149
  "@fluidframework/build-common": "^2.0.3",
160
- "@fluidframework/build-tools": "^0.29.0",
150
+ "@fluidframework/build-tools": "^0.34.0",
161
151
  "@fluidframework/container-loader-previous": "npm:@fluidframework/container-loader@2.0.0-internal.8.0.0",
162
- "@fluidframework/eslint-config-fluid": "^3.2.0",
163
- "@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.3 <2.0.0-rc.1.1.0",
164
- "@microsoft/api-extractor": "^7.38.3",
152
+ "@fluidframework/eslint-config-fluid": "^4.0.0",
153
+ "@microsoft/api-extractor": "^7.42.3",
165
154
  "@types/debug": "^4.1.5",
166
155
  "@types/double-ended-queue": "^2.1.0",
167
- "@types/events": "^3.0.0",
168
156
  "@types/mocha": "^9.1.1",
169
157
  "@types/node": "^18.19.0",
170
- "@types/sinon": "^7.0.13",
158
+ "@types/sinon": "^17.0.3",
159
+ "@types/ungap__structured-clone": "^1.2.0",
160
+ "@types/uuid": "^9.0.2",
171
161
  "c8": "^8.0.1",
172
162
  "copyfiles": "^2.4.1",
173
163
  "cross-env": "^7.0.3",
174
- "eslint": "~8.50.0",
164
+ "eslint": "~8.55.0",
175
165
  "mocha": "^10.2.0",
176
166
  "mocha-json-output-reporter": "^2.0.1",
177
167
  "mocha-multi-reporters": "^1.5.1",
178
168
  "moment": "^2.21.0",
179
169
  "prettier": "~3.0.3",
180
170
  "rimraf": "^4.4.0",
181
- "sinon": "^7.4.2",
182
- "tsc-multi": "^1.1.0",
171
+ "sinon": "^17.0.1",
183
172
  "typescript": "~5.1.6"
184
173
  },
185
174
  "fluidBuild": {
@@ -195,19 +184,28 @@
195
184
  }
196
185
  },
197
186
  "typeValidation": {
198
- "broken": {}
187
+ "broken": {
188
+ "InterfaceDeclaration_IContainerExperimental": {
189
+ "forwardCompat": false
190
+ },
191
+ "InterfaceDeclaration_IParsedUrl": {
192
+ "forwardCompat": false
193
+ }
194
+ }
199
195
  },
200
196
  "scripts": {
201
197
  "api": "fluid-build . --task api",
202
- "api-extractor:commonjs": "api-extractor run --local",
203
- "api-extractor:esnext": "api-extractor run --config ./api-extractor-esm.json",
198
+ "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
199
+ "api-extractor:esnext": "api-extractor run --local",
204
200
  "build": "fluid-build . --task build",
205
201
  "build:commonjs": "fluid-build . --task commonjs",
206
202
  "build:compile": "fluid-build . --task compile",
207
203
  "build:docs": "fluid-build . --task api",
208
- "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
204
+ "build:esnext": "tsc --project ./tsconfig.json",
209
205
  "build:genver": "gen-version",
210
- "build:test": "tsc --project ./src/test/tsconfig.json",
206
+ "build:test": "npm run build:test:esm && npm run build:test:cjs",
207
+ "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
208
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
211
209
  "check:are-the-types-wrong": "attw --pack . --entrypoints .",
212
210
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
213
211
  "ci:build:docs": "api-extractor run",
@@ -221,9 +219,11 @@
221
219
  "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
222
220
  "test": "npm run test:mocha",
223
221
  "test:coverage": "c8 npm test",
224
- "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
222
+ "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
223
+ "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
224
+ "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
225
225
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
226
- "tsc": "tsc",
226
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
227
227
  "tsc:watch": "tsc --watch",
228
228
  "typetests:gen": "fluid-type-test-generator",
229
229
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
@@ -0,0 +1,222 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { AttachState } from "@fluidframework/container-definitions";
6
+ import { CombinedAppAndProtocolSummary } from "@fluidframework/driver-utils";
7
+ import { ISnapshotTree, ISummaryTree } from "@fluidframework/protocol-definitions";
8
+ import { assert } from "@fluidframework/core-utils";
9
+ import { IDocumentStorageService } from "@fluidframework/driver-definitions";
10
+ import { getSnapshotTreeAndBlobsFromSerializedContainer } from "./utils.js";
11
+ import { ISerializableBlobContents } from "./containerStorageAdapter.js";
12
+ import { IDetachedBlobStorage } from "./index.js";
13
+
14
+ /**
15
+ * The default state a newly created detached container will have.
16
+ * All but the state are optional and undefined, they just exist
17
+ * to make the union easy to deal with for both Detached types
18
+ */
19
+ export interface DetachedDefaultData {
20
+ readonly state: AttachState.Detached;
21
+ readonly blobs?: undefined;
22
+ readonly summary?: undefined;
23
+ readonly redirectTable?: undefined;
24
+ }
25
+
26
+ /**
27
+ * This always follows DetachedDefaultData when there are
28
+ * outstanding blobs in the detached blob storage.
29
+ * The redirect table will get filled up to include data
30
+ * about the blobs as they are uploaded.
31
+ */
32
+ export interface DetachedDataWithOutstandingBlobs {
33
+ readonly state: AttachState.Detached;
34
+ readonly blobs: "outstanding";
35
+ readonly summary?: undefined;
36
+ readonly redirectTable: Map<string, string>;
37
+ }
38
+
39
+ /**
40
+ * This state always follows DetachedDataWithOutstandingBlobs.
41
+ * It signals that all outstanding blobs are done being uploaded,
42
+ * so the container can move to the attaching state.
43
+ */
44
+ export interface AttachingDataWithBlobs {
45
+ readonly state: AttachState.Attaching;
46
+ readonly blobs: "done";
47
+ readonly summary: CombinedAppAndProtocolSummary;
48
+ }
49
+
50
+ /**
51
+ * This always follows DefaultDetachedState when there are
52
+ * no blobs in the detached blob storage. Because there are
53
+ * no blobs we can immediately get the summary and transition
54
+ * to the attaching state.
55
+ */
56
+ export interface AttachingDataWithoutBlobs {
57
+ readonly state: AttachState.Attaching;
58
+ readonly summary: CombinedAppAndProtocolSummary;
59
+ readonly blobs: "none";
60
+ }
61
+
62
+ /**
63
+ * The final attachment state which signals the container is fully attached.
64
+ * The baseSnapshotAndBlobs will only be enabled when offline load is enabled.
65
+ */
66
+ export interface AttachedData {
67
+ readonly state: AttachState.Attached;
68
+ }
69
+
70
+ /**
71
+ * A union of all the attachment data types for
72
+ * tracking across all container attachment states
73
+ */
74
+ export type AttachmentData =
75
+ | DetachedDefaultData
76
+ | DetachedDataWithOutstandingBlobs
77
+ | AttachingDataWithoutBlobs
78
+ | AttachingDataWithBlobs
79
+ | AttachedData;
80
+
81
+ /**
82
+ * The data and services necessary for runRetriableAttachProcess.
83
+ */
84
+ export interface AttachProcessProps {
85
+ /**
86
+ * The initial attachment data this call should start with
87
+ */
88
+ readonly initialAttachmentData: Exclude<AttachmentData, AttachedData>;
89
+
90
+ /**
91
+ * The caller should use this callback to keep track of the current
92
+ * attachment data, and perform any other operations necessary
93
+ * for dealing with attachment state changes, like emitting events
94
+ *
95
+ * @param attachmentData - the updated attachment data */
96
+ readonly setAttachmentData: (attachmentData: AttachmentData) => void;
97
+
98
+ /**
99
+ * The caller should create and or get services based on the data, and its own information.
100
+ * @param data - the data to create services from,
101
+ * the summary property being the most relevant part of the data.
102
+ * @returns A compatible storage service
103
+ */
104
+ readonly createOrGetStorageService: (
105
+ data: ISummaryTree | undefined,
106
+ ) => Promise<Pick<IDocumentStorageService, "createBlob" | "uploadSummaryWithContext">>;
107
+
108
+ /**
109
+ * The detached blob storage if it exists.
110
+ */
111
+ readonly detachedBlobStorage?: Pick<IDetachedBlobStorage, "getBlobIds" | "readBlob" | "size">;
112
+
113
+ /**
114
+ * The caller should create the attachment summary for the container.
115
+ * @param redirectTable - Maps local blob ids to remote blobs ids.
116
+ * @returns The attachment summary for the container.
117
+ */
118
+ readonly createAttachmentSummary: (
119
+ redirectTable?: Map<string, string>,
120
+ ) => CombinedAppAndProtocolSummary;
121
+
122
+ /**
123
+ * Whether offline load is enabled or not.
124
+ */
125
+ readonly offlineLoadEnabled: boolean;
126
+ }
127
+
128
+ /**
129
+ * Executes the attach process state machine based on the provided data and services.
130
+ * This method is retriable on failure. Based on the provided initialAttachmentData
131
+ * this method will resume the attachment process and attempt to complete it.
132
+ *
133
+ * @param props - The data and services necessary to run the attachment process
134
+ */
135
+ export const runRetriableAttachProcess = async (
136
+ props: AttachProcessProps,
137
+ ): Promise<{ tree: ISnapshotTree; blobs: ISerializableBlobContents } | undefined> => {
138
+ const {
139
+ detachedBlobStorage,
140
+ createOrGetStorageService,
141
+ setAttachmentData,
142
+ createAttachmentSummary,
143
+ offlineLoadEnabled,
144
+ } = props;
145
+ let currentData: AttachmentData = props.initialAttachmentData;
146
+
147
+ if (currentData.blobs === undefined) {
148
+ // If attachment blobs were uploaded in detached state we will go through a different attach flow
149
+ const outstandingAttachmentBlobs =
150
+ detachedBlobStorage !== undefined && detachedBlobStorage.size > 0;
151
+ // Determine the next phase of attaching which depends on if there are attachment blobs
152
+ // if there are, we will stay detached, so an empty file can be created, and the blobs
153
+ // uploaded, otherwise we will get the summary to create the file with and move to attaching
154
+ currentData = outstandingAttachmentBlobs
155
+ ? {
156
+ state: AttachState.Detached,
157
+ blobs: "outstanding",
158
+ redirectTable: new Map<string, string>(),
159
+ }
160
+ : {
161
+ state: AttachState.Attaching,
162
+ summary: props.createAttachmentSummary(),
163
+ blobs: "none",
164
+ };
165
+ setAttachmentData(currentData);
166
+ }
167
+
168
+ // this has to run here, as it is what creates the file
169
+ // and we need to file for all possible cases after this point
170
+ const storage = await createOrGetStorageService(currentData.summary);
171
+
172
+ if (currentData.blobs === "outstanding") {
173
+ const { redirectTable } = currentData;
174
+ // upload blobs to storage
175
+ assert(!!detachedBlobStorage, 0x24e /* "assertion for type narrowing" */);
176
+
177
+ // build a table mapping IDs assigned locally to IDs assigned by storage and pass it to runtime to
178
+ // support blob handles that only know about the local IDs
179
+ while (redirectTable.size < detachedBlobStorage.size) {
180
+ const newIds = detachedBlobStorage.getBlobIds().filter((id) => !redirectTable.has(id));
181
+ for (const id of newIds) {
182
+ const blob = await detachedBlobStorage.readBlob(id);
183
+ const response = await storage.createBlob(blob);
184
+ redirectTable.set(id, response.id);
185
+ }
186
+ }
187
+ setAttachmentData(
188
+ (currentData = {
189
+ state: AttachState.Attaching,
190
+ summary: createAttachmentSummary(redirectTable),
191
+ blobs: "done",
192
+ }),
193
+ );
194
+ }
195
+
196
+ assert(
197
+ currentData.state === AttachState.Attaching,
198
+ 0x8e2 /* must be attaching by this point */,
199
+ );
200
+
201
+ if (currentData.blobs === "done") {
202
+ // done means outstanding blobs were uploaded.
203
+ // in that case an empty file was created, the blobs were uploaded
204
+ // and now this finally uploads the summary
205
+ await storage.uploadSummaryWithContext(currentData.summary, {
206
+ referenceSequenceNumber: 0,
207
+ ackHandle: undefined,
208
+ proposalHandle: undefined,
209
+ });
210
+ }
211
+
212
+ const snapshot = offlineLoadEnabled
213
+ ? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)
214
+ : undefined;
215
+
216
+ setAttachmentData(
217
+ (currentData = {
218
+ state: AttachState.Attached,
219
+ }),
220
+ );
221
+ return snapshot;
222
+ };
package/src/audience.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { EventEmitter } from "events";
5
+ import { EventEmitter } from "@fluid-internal/client-utils";
6
6
  import { assert } from "@fluidframework/core-utils";
7
7
  import { IAudienceOwner } from "@fluidframework/container-definitions";
8
8
  import { IClient } from "@fluidframework/protocol-definitions";
@@ -61,14 +61,20 @@ export class Audience extends EventEmitter implements IAudienceOwner {
61
61
  }
62
62
 
63
63
  /**
64
- * Retrieves all the members in the audience
64
+ * Retrieves all the members in the audience.
65
+ *
66
+ * @remarks When the container is disconnected, this will keep returning the audience as it was last seen before the
67
+ * container disconnected.
65
68
  */
66
69
  public getMembers(): Map<string, IClient> {
67
70
  return new Map(this.members);
68
71
  }
69
72
 
70
73
  /**
71
- * Retrieves a specific member of the audience
74
+ * Retrieves a specific member of the audience.
75
+ *
76
+ * @remarks When the container is disconnected, this will keep returning members from the audience as it was last seen
77
+ * before the container disconnected.
72
78
  */
73
79
  public getMember(clientId: string): IClient | undefined {
74
80
  return this.members.get(clientId);
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IDisposable, ITelemetryProperties, LogLevel } from "@fluidframework/core-interfaces";
6
+ import { IDisposable, ITelemetryBaseProperties, LogLevel } from "@fluidframework/core-interfaces";
7
7
  import { assert } from "@fluidframework/core-utils";
8
8
  import { performance, TypedEventEmitter } from "@fluid-internal/client-utils";
9
9
  import {
@@ -16,8 +16,7 @@ import {
16
16
  IDocumentService,
17
17
  IDocumentDeltaConnection,
18
18
  IDocumentDeltaConnectionEvents,
19
- // eslint-disable-next-line import/no-deprecated
20
- DriverErrorType,
19
+ DriverErrorTypes,
21
20
  } from "@fluidframework/driver-definitions";
22
21
  import {
23
22
  canRetryOnError,
@@ -58,10 +57,10 @@ import {
58
57
  IConnectionManagerFactoryArgs,
59
58
  IConnectionDetailsInternal,
60
59
  IConnectionStateChangeReason,
61
- } from "./contracts";
62
- import { DeltaQueue } from "./deltaQueue";
63
- import { SignalType } from "./protocol";
64
- import { isDeltaStreamConnectionForbiddenError } from "./utils";
60
+ } from "./contracts.js";
61
+ import { DeltaQueue } from "./deltaQueue.js";
62
+ import { SignalType } from "./protocol.js";
63
+ import { isDeltaStreamConnectionForbiddenError } from "./utils.js";
65
64
 
66
65
  // We double this value in first try in when we calculate time to wait for in "calculateMaxWaitTime" function.
67
66
  const InitialReconnectDelayInMs = 500;
@@ -230,7 +229,7 @@ export class ConnectionManager implements IConnectionManager {
230
229
 
231
230
  private _connectionVerboseProps: Record<string, string | number> = {};
232
231
 
233
- private _connectionProps: ITelemetryProperties = {};
232
+ private _connectionProps: ITelemetryBaseProperties = {};
234
233
 
235
234
  private _disposed = false;
236
235
 
@@ -291,7 +290,7 @@ export class ConnectionManager implements IConnectionManager {
291
290
  * Returns set of props that can be logged in telemetry that provide some insights / statistics
292
291
  * about current or last connection (if there is no connection at the moment)
293
292
  */
294
- public get connectionProps(): ITelemetryProperties {
293
+ public get connectionProps(): ITelemetryBaseProperties {
295
294
  return this.connection !== undefined
296
295
  ? this._connectionProps
297
296
  : {
@@ -612,8 +611,7 @@ export class ConnectionManager implements IConnectionManager {
612
611
  break;
613
612
  } else if (
614
613
  isFluidError(origError) &&
615
- // eslint-disable-next-line import/no-deprecated
616
- origError.errorType === DriverErrorType.outOfStorageError
614
+ origError.errorType === DriverErrorTypes.outOfStorageError
617
615
  ) {
618
616
  // If we get out of storage error from calling joinsession, then use the NoDeltaStream object so
619
617
  // that user can at least load the container.
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  /**
7
+ * The state of the Container's connection to the service.
7
8
  * @public
8
9
  */
9
10
  export enum ConnectionState {
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryProperties, TelemetryEventCategory } from "@fluidframework/core-interfaces";
6
+ import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
7
7
  import { assert, Timer } from "@fluidframework/core-utils";
8
8
  import { IDeltaManager } from "@fluidframework/container-definitions";
9
9
  import { ISequencedClient, IClient } from "@fluidframework/protocol-definitions";
@@ -11,12 +11,13 @@ import {
11
11
  ITelemetryLoggerExt,
12
12
  PerformanceEvent,
13
13
  loggerToMonitoringContext,
14
+ type TelemetryEventCategory,
14
15
  } from "@fluidframework/telemetry-utils";
15
16
  import { IAnyDriverError } from "@fluidframework/driver-definitions";
16
- import { CatchUpMonitor, ICatchUpMonitor } from "./catchUpMonitor";
17
- import { ConnectionState } from "./connectionState";
18
- import { IConnectionDetailsInternal, IConnectionStateChangeReason } from "./contracts";
19
- import { IProtocolHandler } from "./protocol";
17
+ import { CatchUpMonitor, ICatchUpMonitor } from "./catchUpMonitor.js";
18
+ import { ConnectionState } from "./connectionState.js";
19
+ import { IConnectionDetailsInternal, IConnectionStateChangeReason } from "./contracts.js";
20
+ import { IProtocolHandler } from "./protocol.js";
20
21
 
21
22
  // Based on recent data, it looks like majority of cases where we get stuck are due to really slow or
22
23
  // timing out ops fetches. So attempt recovery infrequently. Also fetch uses 30 second timeout, so
@@ -43,7 +44,7 @@ export interface IConnectionStateHandlerInputs {
43
44
  logConnectionIssue: (
44
45
  eventName: string,
45
46
  category: TelemetryEventCategory,
46
- details?: ITelemetryProperties,
47
+ details?: ITelemetryBaseProperties,
47
48
  ) => void;
48
49
  /** Callback to note that an old local client ID is still present in the Quorum that should have left and should now be considered invalid */
49
50
  clientShouldHaveLeft: (clientId: string) => void;
@@ -188,7 +189,7 @@ class ConnectionStateHandlerPassThrough
188
189
  public logConnectionIssue(
189
190
  eventName: string,
190
191
  category: TelemetryEventCategory,
191
- details?: ITelemetryProperties,
192
+ details?: ITelemetryBaseProperties,
192
193
  ) {
193
194
  return this.inputs.logConnectionIssue(eventName, category, details);
194
195
  }