@fluidframework/container-loader 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.245554

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 (293) hide show
  1. package/.eslintrc.cjs +5 -6
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +48 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/container-loader.api.md +2 -2
  8. package/dist/attachment.d.ts +6 -7
  9. package/dist/attachment.d.ts.map +1 -1
  10. package/dist/attachment.js +6 -5
  11. package/dist/attachment.js.map +1 -1
  12. package/dist/audience.d.ts +9 -4
  13. package/dist/audience.d.ts.map +1 -1
  14. package/dist/audience.js +10 -4
  15. package/dist/audience.js.map +1 -1
  16. package/dist/connectionManager.d.ts +3 -3
  17. package/dist/connectionManager.d.ts.map +1 -1
  18. package/dist/connectionManager.js +20 -18
  19. package/dist/connectionManager.js.map +1 -1
  20. package/dist/connectionState.d.ts +1 -0
  21. package/dist/connectionState.d.ts.map +1 -1
  22. package/dist/connectionState.js +1 -0
  23. package/dist/connectionState.js.map +1 -1
  24. package/dist/connectionStateHandler.d.ts +7 -7
  25. package/dist/connectionStateHandler.d.ts.map +1 -1
  26. package/dist/connectionStateHandler.js +32 -32
  27. package/dist/connectionStateHandler.js.map +1 -1
  28. package/dist/container-loader-alpha.d.ts +1 -0
  29. package/dist/container-loader-beta.d.ts +3 -0
  30. package/dist/container-loader-public.d.ts +3 -0
  31. package/dist/container-loader-untrimmed.d.ts +4 -4
  32. package/dist/container.d.ts +11 -22
  33. package/dist/container.d.ts.map +1 -1
  34. package/dist/container.js +101 -194
  35. package/dist/container.js.map +1 -1
  36. package/dist/containerStorageAdapter.d.ts +2 -3
  37. package/dist/containerStorageAdapter.d.ts.map +1 -1
  38. package/dist/containerStorageAdapter.js +4 -10
  39. package/dist/containerStorageAdapter.js.map +1 -1
  40. package/dist/contracts.d.ts +3 -3
  41. package/dist/contracts.d.ts.map +1 -1
  42. package/dist/contracts.js.map +1 -1
  43. package/dist/debugLogger.js.map +1 -1
  44. package/dist/deltaManager.d.ts +5 -5
  45. package/dist/deltaManager.d.ts.map +1 -1
  46. package/dist/deltaManager.js +6 -6
  47. package/dist/deltaManager.js.map +1 -1
  48. package/dist/error.d.ts.map +1 -1
  49. package/dist/error.js.map +1 -1
  50. package/dist/index.d.ts +6 -6
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +11 -11
  53. package/dist/index.js.map +1 -1
  54. package/dist/loader.d.ts +2 -2
  55. package/dist/loader.d.ts.map +1 -1
  56. package/dist/loader.js +13 -17
  57. package/dist/loader.js.map +1 -1
  58. package/dist/location-redirection-utilities/index.d.ts +1 -1
  59. package/dist/location-redirection-utilities/index.d.ts.map +1 -1
  60. package/dist/location-redirection-utilities/index.js +3 -3
  61. package/dist/location-redirection-utilities/index.js.map +1 -1
  62. package/dist/package.json +3 -0
  63. package/dist/packageVersion.d.ts +1 -1
  64. package/dist/packageVersion.js +1 -1
  65. package/dist/packageVersion.js.map +1 -1
  66. package/dist/protocolTreeDocumentStorageService.d.ts +0 -1
  67. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  68. package/dist/protocolTreeDocumentStorageService.js +0 -3
  69. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  70. package/dist/retriableDocumentStorageService.d.ts +0 -1
  71. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  72. package/dist/retriableDocumentStorageService.js +0 -6
  73. package/dist/retriableDocumentStorageService.js.map +1 -1
  74. package/dist/serializedStateManager.d.ts +44 -0
  75. package/dist/serializedStateManager.d.ts.map +1 -0
  76. package/dist/serializedStateManager.js +149 -0
  77. package/dist/serializedStateManager.js.map +1 -0
  78. package/dist/tsdoc-metadata.json +1 -1
  79. package/dist/utils.d.ts +5 -6
  80. package/dist/utils.d.ts.map +1 -1
  81. package/dist/utils.js +10 -4
  82. package/dist/utils.js.map +1 -1
  83. package/lib/{attachment.d.mts → attachment.d.ts} +11 -8
  84. package/lib/attachment.d.ts.map +1 -0
  85. package/lib/{attachment.mjs → attachment.js} +11 -6
  86. package/lib/attachment.js.map +1 -0
  87. package/lib/{audience.d.mts → audience.d.ts} +14 -5
  88. package/lib/audience.d.ts.map +1 -0
  89. package/lib/{audience.mjs → audience.js} +14 -4
  90. package/lib/audience.js.map +1 -0
  91. package/lib/{catchUpMonitor.d.mts → catchUpMonitor.d.ts} +1 -1
  92. package/lib/catchUpMonitor.d.ts.map +1 -0
  93. package/lib/{catchUpMonitor.mjs → catchUpMonitor.js} +1 -1
  94. package/lib/catchUpMonitor.js.map +1 -0
  95. package/lib/{connectionManager.d.mts → connectionManager.d.ts} +4 -4
  96. package/lib/connectionManager.d.ts.map +1 -0
  97. package/lib/{connectionManager.mjs → connectionManager.js} +9 -7
  98. package/lib/connectionManager.js.map +1 -0
  99. package/lib/{connectionState.d.mts → connectionState.d.ts} +2 -1
  100. package/lib/connectionState.d.ts.map +1 -0
  101. package/lib/{connectionState.mjs → connectionState.js} +2 -1
  102. package/lib/connectionState.js.map +1 -0
  103. package/lib/{connectionStateHandler.d.mts → connectionStateHandler.d.ts} +8 -8
  104. package/lib/connectionStateHandler.d.ts.map +1 -0
  105. package/lib/{connectionStateHandler.mjs → connectionStateHandler.js} +3 -3
  106. package/lib/connectionStateHandler.js.map +1 -0
  107. package/lib/{container-loader-alpha.d.mts → container-loader-alpha.d.ts} +1 -0
  108. package/lib/{container-loader-beta.d.mts → container-loader-beta.d.ts} +3 -0
  109. package/lib/{container-loader-public.d.mts → container-loader-public.d.ts} +3 -0
  110. package/lib/{container-loader-untrimmed.d.mts → container-loader-untrimmed.d.ts} +4 -4
  111. package/lib/{container.d.mts → container.d.ts} +12 -23
  112. package/lib/container.d.ts.map +1 -0
  113. package/lib/{container.mjs → container.js} +55 -148
  114. package/lib/container.js.map +1 -0
  115. package/lib/{containerContext.d.mts → containerContext.d.ts} +1 -1
  116. package/lib/containerContext.d.ts.map +1 -0
  117. package/lib/{containerContext.mjs → containerContext.js} +1 -1
  118. package/lib/containerContext.js.map +1 -0
  119. package/lib/{containerStorageAdapter.d.mts → containerStorageAdapter.d.ts} +3 -4
  120. package/lib/containerStorageAdapter.d.ts.map +1 -0
  121. package/lib/{containerStorageAdapter.mjs → containerStorageAdapter.js} +3 -9
  122. package/lib/containerStorageAdapter.js.map +1 -0
  123. package/lib/{contracts.d.mts → contracts.d.ts} +4 -4
  124. package/lib/contracts.d.ts.map +1 -0
  125. package/lib/{contracts.mjs → contracts.js} +1 -1
  126. package/lib/contracts.js.map +1 -0
  127. package/lib/{debugLogger.d.mts → debugLogger.d.ts} +1 -1
  128. package/lib/debugLogger.d.ts.map +1 -0
  129. package/lib/{debugLogger.mjs → debugLogger.js} +2 -1
  130. package/lib/debugLogger.js.map +1 -0
  131. package/lib/{deltaManager.d.mts → deltaManager.d.ts} +6 -6
  132. package/lib/deltaManager.d.ts.map +1 -0
  133. package/lib/{deltaManager.mjs → deltaManager.js} +4 -4
  134. package/lib/deltaManager.js.map +1 -0
  135. package/lib/{deltaQueue.d.mts → deltaQueue.d.ts} +1 -1
  136. package/lib/deltaQueue.d.ts.map +1 -0
  137. package/lib/{deltaQueue.mjs → deltaQueue.js} +1 -1
  138. package/lib/deltaQueue.js.map +1 -0
  139. package/lib/{disposal.d.mts → disposal.d.ts} +1 -1
  140. package/lib/disposal.d.ts.map +1 -0
  141. package/lib/{disposal.mjs → disposal.js} +1 -1
  142. package/lib/disposal.js.map +1 -0
  143. package/lib/{error.d.mts → error.d.ts} +1 -1
  144. package/lib/error.d.ts.map +1 -0
  145. package/lib/{error.mjs → error.js} +1 -1
  146. package/lib/error.js.map +1 -0
  147. package/lib/{index.d.mts → index.d.ts} +7 -7
  148. package/lib/index.d.ts.map +1 -0
  149. package/lib/index.js +10 -0
  150. package/lib/index.js.map +1 -0
  151. package/lib/{loader.d.mts → loader.d.ts} +3 -3
  152. package/lib/loader.d.ts.map +1 -0
  153. package/lib/{loader.mjs → loader.js} +7 -11
  154. package/lib/loader.js.map +1 -0
  155. package/lib/location-redirection-utilities/{index.mjs → index.d.ts} +2 -2
  156. package/lib/location-redirection-utilities/index.d.ts.map +1 -0
  157. package/lib/location-redirection-utilities/{index.d.mts → index.js} +2 -2
  158. package/lib/location-redirection-utilities/index.js.map +1 -0
  159. package/lib/location-redirection-utilities/{resolveWithLocationRedirection.d.mts → resolveWithLocationRedirection.d.ts} +1 -1
  160. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
  161. package/lib/location-redirection-utilities/{resolveWithLocationRedirection.mjs → resolveWithLocationRedirection.js} +1 -1
  162. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
  163. package/lib/{noopHeuristic.d.mts → noopHeuristic.d.ts} +1 -1
  164. package/lib/noopHeuristic.d.ts.map +1 -0
  165. package/lib/{noopHeuristic.mjs → noopHeuristic.js} +1 -1
  166. package/lib/noopHeuristic.js.map +1 -0
  167. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  168. package/lib/packageVersion.d.ts.map +1 -0
  169. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  170. package/lib/packageVersion.js.map +1 -0
  171. package/lib/{protocol.d.mts → protocol.d.ts} +1 -1
  172. package/lib/protocol.d.ts.map +1 -0
  173. package/lib/{protocol.mjs → protocol.js} +1 -1
  174. package/lib/protocol.js.map +1 -0
  175. package/lib/{protocolTreeDocumentStorageService.d.mts → protocolTreeDocumentStorageService.d.ts} +1 -2
  176. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -0
  177. package/lib/{protocolTreeDocumentStorageService.mjs → protocolTreeDocumentStorageService.js} +1 -4
  178. package/lib/protocolTreeDocumentStorageService.js.map +1 -0
  179. package/lib/{quorum.d.mts → quorum.d.ts} +5 -1
  180. package/lib/quorum.d.ts.map +1 -0
  181. package/lib/{quorum.mjs → quorum.js} +1 -1
  182. package/lib/quorum.js.map +1 -0
  183. package/lib/{retriableDocumentStorageService.d.mts → retriableDocumentStorageService.d.ts} +1 -2
  184. package/lib/retriableDocumentStorageService.d.ts.map +1 -0
  185. package/lib/{retriableDocumentStorageService.mjs → retriableDocumentStorageService.js} +1 -7
  186. package/lib/retriableDocumentStorageService.js.map +1 -0
  187. package/lib/serializedStateManager.d.ts +44 -0
  188. package/lib/serializedStateManager.d.ts.map +1 -0
  189. package/lib/serializedStateManager.js +145 -0
  190. package/lib/serializedStateManager.js.map +1 -0
  191. package/lib/test/attachment.spec.js +380 -0
  192. package/lib/test/attachment.spec.js.map +1 -0
  193. package/lib/test/catchUpMonitor.spec.js +88 -0
  194. package/lib/test/catchUpMonitor.spec.js.map +1 -0
  195. package/lib/test/connectionManager.spec.js +201 -0
  196. package/lib/test/connectionManager.spec.js.map +1 -0
  197. package/lib/test/connectionStateHandler.spec.js +555 -0
  198. package/lib/test/connectionStateHandler.spec.js.map +1 -0
  199. package/lib/test/container.spec.js +64 -0
  200. package/lib/test/container.spec.js.map +1 -0
  201. package/lib/test/deltaManager.spec.js +405 -0
  202. package/lib/test/deltaManager.spec.js.map +1 -0
  203. package/lib/test/loader.spec.js +212 -0
  204. package/lib/test/loader.spec.js.map +1 -0
  205. package/lib/test/locationRedirectionTests.spec.js +44 -0
  206. package/lib/test/locationRedirectionTests.spec.js.map +1 -0
  207. package/lib/test/serializedStateManager.spec.js +148 -0
  208. package/lib/test/serializedStateManager.spec.js.map +1 -0
  209. package/lib/test/snapshotConversionTest.spec.js +79 -0
  210. package/lib/test/snapshotConversionTest.spec.js.map +1 -0
  211. package/lib/test/types/validateContainerLoaderPrevious.generated.js +38 -0
  212. package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +1 -0
  213. package/lib/test/utils.spec.js +31 -0
  214. package/lib/test/utils.spec.js.map +1 -0
  215. package/lib/{utils.d.mts → utils.d.ts} +6 -7
  216. package/lib/utils.d.ts.map +1 -0
  217. package/lib/{utils.mjs → utils.js} +11 -5
  218. package/lib/utils.js.map +1 -0
  219. package/package.json +56 -62
  220. package/src/attachment.ts +15 -12
  221. package/src/audience.ts +9 -3
  222. package/src/connectionManager.ts +13 -9
  223. package/src/connectionState.ts +1 -0
  224. package/src/connectionStateHandler.ts +8 -7
  225. package/src/container.ts +96 -191
  226. package/src/containerStorageAdapter.ts +6 -14
  227. package/src/contracts.ts +3 -3
  228. package/src/debugLogger.ts +2 -2
  229. package/src/deltaManager.ts +8 -8
  230. package/src/error.ts +2 -2
  231. package/src/index.ts +6 -6
  232. package/src/loader.ts +8 -12
  233. package/src/location-redirection-utilities/index.ts +1 -1
  234. package/src/packageVersion.ts +1 -1
  235. package/src/protocolTreeDocumentStorageService.ts +0 -3
  236. package/src/retriableDocumentStorageService.ts +0 -7
  237. package/src/serializedStateManager.ts +217 -0
  238. package/src/utils.ts +15 -10
  239. package/tsconfig.cjs.json +7 -0
  240. package/tsconfig.json +2 -5
  241. package/lib/attachment.d.mts.map +0 -1
  242. package/lib/attachment.mjs.map +0 -1
  243. package/lib/audience.d.mts.map +0 -1
  244. package/lib/audience.mjs.map +0 -1
  245. package/lib/catchUpMonitor.d.mts.map +0 -1
  246. package/lib/catchUpMonitor.mjs.map +0 -1
  247. package/lib/connectionManager.d.mts.map +0 -1
  248. package/lib/connectionManager.mjs.map +0 -1
  249. package/lib/connectionState.d.mts.map +0 -1
  250. package/lib/connectionState.mjs.map +0 -1
  251. package/lib/connectionStateHandler.d.mts.map +0 -1
  252. package/lib/connectionStateHandler.mjs.map +0 -1
  253. package/lib/container.d.mts.map +0 -1
  254. package/lib/container.mjs.map +0 -1
  255. package/lib/containerContext.d.mts.map +0 -1
  256. package/lib/containerContext.mjs.map +0 -1
  257. package/lib/containerStorageAdapter.d.mts.map +0 -1
  258. package/lib/containerStorageAdapter.mjs.map +0 -1
  259. package/lib/contracts.d.mts.map +0 -1
  260. package/lib/contracts.mjs.map +0 -1
  261. package/lib/debugLogger.d.mts.map +0 -1
  262. package/lib/debugLogger.mjs.map +0 -1
  263. package/lib/deltaManager.d.mts.map +0 -1
  264. package/lib/deltaManager.mjs.map +0 -1
  265. package/lib/deltaQueue.d.mts.map +0 -1
  266. package/lib/deltaQueue.mjs.map +0 -1
  267. package/lib/disposal.d.mts.map +0 -1
  268. package/lib/disposal.mjs.map +0 -1
  269. package/lib/error.d.mts.map +0 -1
  270. package/lib/error.mjs.map +0 -1
  271. package/lib/index.d.mts.map +0 -1
  272. package/lib/index.mjs +0 -10
  273. package/lib/index.mjs.map +0 -1
  274. package/lib/loader.d.mts.map +0 -1
  275. package/lib/loader.mjs.map +0 -1
  276. package/lib/location-redirection-utilities/index.d.mts.map +0 -1
  277. package/lib/location-redirection-utilities/index.mjs.map +0 -1
  278. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts.map +0 -1
  279. package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +0 -1
  280. package/lib/noopHeuristic.d.mts.map +0 -1
  281. package/lib/noopHeuristic.mjs.map +0 -1
  282. package/lib/packageVersion.d.mts.map +0 -1
  283. package/lib/packageVersion.mjs.map +0 -1
  284. package/lib/protocol.d.mts.map +0 -1
  285. package/lib/protocol.mjs.map +0 -1
  286. package/lib/protocolTreeDocumentStorageService.d.mts.map +0 -1
  287. package/lib/protocolTreeDocumentStorageService.mjs.map +0 -1
  288. package/lib/quorum.d.mts.map +0 -1
  289. package/lib/quorum.mjs.map +0 -1
  290. package/lib/retriableDocumentStorageService.d.mts.map +0 -1
  291. package/lib/retriableDocumentStorageService.mjs.map +0 -1
  292. package/lib/utils.d.mts.map +0 -1
  293. package/lib/utils.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotConversionTest.spec.js","sourceRoot":"","sources":["../../src/test/snapshotConversionTest.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CA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O,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,EAC1C,SAAS,EACT,wDAAwD,CACxD,CAAC;QAEF,6BAA6B;QAC7B,MAAM,CAAC,WAAW,CACjB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,EAC3C,IAAI,EACJ,qDAAqD,CACrD,CAAC;QAEF,+BAA+B;QAC/B,MAAM,CAAC,WAAW,CACjB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EACxC,OAAO,EACP,4CAA4C,CAC5C,CAAC;QAEF,+BAA+B;QAC/B,MAAM,CAAC,WAAW,CACjB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EACxC,OAAO,EACP,4CAA4C,CAC5C,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { ISummaryTree, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tcombineAppAndProtocolSummary,\n\tgetSnapshotTreeAndBlobsFromSerializedContainer,\n} from \"../utils.js\";\n\ndescribe(\"Dehydrate Container\", () => {\n\tconst protocolSummary: ISummaryTree = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: {\n\t\t\tattributes: {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: JSON.stringify(\"attributes\"),\n\t\t\t},\n\t\t\tquorumValues: {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: JSON.stringify(\"quorumValues\"),\n\t\t\t},\n\t\t},\n\t};\n\tconst appSummary: ISummaryTree = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: {\n\t\t\tdefault: {\n\t\t\t\ttype: SummaryType.Tree,\n\t\t\t\ttree: {\n\t\t\t\t\t\".component\": {\n\t\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t\t\tcontent: JSON.stringify(\"defaultDataStore\"),\n\t\t\t\t\t},\n\t\t\t\t\t\"root\": {\n\t\t\t\t\t\ttype: SummaryType.Tree,\n\t\t\t\t\t\ttree: {\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t\t\t\t\tcontent: JSON.stringify(\"rootattributes\"),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"unref\": {\n\t\t\t\t\t\ttype: SummaryType.Tree,\n\t\t\t\t\t\ttree: {},\n\t\t\t\t\t\tunreferenced: true,\n\t\t\t\t\t},\n\t\t\t\t\t\"groupId\": {\n\t\t\t\t\t\ttype: SummaryType.Tree,\n\t\t\t\t\t\ttree: {},\n\t\t\t\t\t\tgroupId: \"group\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n\n\tit(\"Summary to snapshottree and snapshotBlobs conversion\", async () => {\n\t\tconst combinedSummary = combineAppAndProtocolSummary(appSummary, protocolSummary);\n\t\tconst { tree, blobs } = getSnapshotTreeAndBlobsFromSerializedContainer(combinedSummary);\n\n\t\tassert.strictEqual(Object.keys(tree.trees).length, 2, \"2 trees should be there\");\n\t\tassert.strictEqual(\n\t\t\tObject.keys(tree.trees[\".protocol\"].blobs).length,\n\t\t\t2,\n\t\t\t\"2 protocol blobs should be there.\",\n\t\t);\n\n\t\t// Validate the \".component\" blob.\n\t\tconst defaultDataStoreBlobId = tree.trees.default.blobs[\".component\"];\n\t\tconst defaultDataStoreBlob = blobs[defaultDataStoreBlobId];\n\t\tassert.strict(defaultDataStoreBlob, \"defaultDataStoreBlob undefined\");\n\t\tassert.strictEqual(\n\t\t\tJSON.parse(defaultDataStoreBlob),\n\t\t\t\"defaultDataStore\",\n\t\t\t\"The .component blob's content is incorrect\",\n\t\t);\n\n\t\t// Validate \"root\" sub-tree.\n\t\tconst rootAttributesBlobId = tree.trees.default.trees.root.blobs.attributes;\n\t\tconst rootAttributesBlob = blobs[rootAttributesBlobId];\n\t\tassert.strict(rootAttributesBlob, \"rootAttributesBlob undefined\");\n\t\tassert.strictEqual(\n\t\t\tJSON.parse(rootAttributesBlob),\n\t\t\t\"rootattributes\",\n\t\t\t\"The root sub-tree's content is incorrect\",\n\t\t);\n\t\tassert.strictEqual(\n\t\t\ttree.trees.default.trees.root.unreferenced,\n\t\t\tundefined,\n\t\t\t\"The root sub-tree should not be marked as unreferenced\",\n\t\t);\n\n\t\t// Validate \"unref\" sub-tree.\n\t\tassert.strictEqual(\n\t\t\ttree.trees.default.trees.unref.unreferenced,\n\t\t\ttrue,\n\t\t\t\"The unref sub-tree should be marked as unreferenced\",\n\t\t);\n\n\t\t// Validate \"groupId\" sub-tree.\n\t\tassert.strictEqual(\n\t\t\ttree.trees.default.trees.groupId.groupId,\n\t\t\t\"group\",\n\t\t\t\"The groupId sub-tree should have a groupId\",\n\t\t);\n\n\t\t// Validate \"groupId\" sub-tree.\n\t\tassert.strictEqual(\n\t\t\ttree.trees.default.trees.groupId.groupId,\n\t\t\t\"group\",\n\t\t\t\"The groupId sub-tree should have a groupId\",\n\t\t);\n\t});\n});\n"]}
@@ -0,0 +1,38 @@
1
+ use_current_EnumDeclaration_ConnectionState(get_old_EnumDeclaration_ConnectionState());
2
+ use_old_EnumDeclaration_ConnectionState(get_current_EnumDeclaration_ConnectionState());
3
+ use_current_InterfaceDeclaration_ICodeDetailsLoader(get_old_InterfaceDeclaration_ICodeDetailsLoader());
4
+ use_old_InterfaceDeclaration_ICodeDetailsLoader(get_current_InterfaceDeclaration_ICodeDetailsLoader());
5
+ use_current_InterfaceDeclaration_IContainerExperimental(
6
+ // @ts-expect-error compatibility expected to be broken
7
+ get_old_InterfaceDeclaration_IContainerExperimental());
8
+ use_old_InterfaceDeclaration_IContainerExperimental(get_current_InterfaceDeclaration_IContainerExperimental());
9
+ use_current_TypeAliasDeclaration_IDetachedBlobStorage(get_old_TypeAliasDeclaration_IDetachedBlobStorage());
10
+ use_old_TypeAliasDeclaration_IDetachedBlobStorage(get_current_TypeAliasDeclaration_IDetachedBlobStorage());
11
+ use_current_InterfaceDeclaration_IFluidModuleWithDetails(get_old_InterfaceDeclaration_IFluidModuleWithDetails());
12
+ use_old_InterfaceDeclaration_IFluidModuleWithDetails(get_current_InterfaceDeclaration_IFluidModuleWithDetails());
13
+ use_current_InterfaceDeclaration_ILoaderOptions(get_old_InterfaceDeclaration_ILoaderOptions());
14
+ use_old_InterfaceDeclaration_ILoaderOptions(get_current_InterfaceDeclaration_ILoaderOptions());
15
+ use_current_InterfaceDeclaration_ILoaderProps(get_old_InterfaceDeclaration_ILoaderProps());
16
+ use_old_InterfaceDeclaration_ILoaderProps(get_current_InterfaceDeclaration_ILoaderProps());
17
+ use_current_InterfaceDeclaration_ILoaderServices(get_old_InterfaceDeclaration_ILoaderServices());
18
+ use_old_InterfaceDeclaration_ILoaderServices(get_current_InterfaceDeclaration_ILoaderServices());
19
+ use_current_InterfaceDeclaration_IParsedUrl(
20
+ // @ts-expect-error compatibility expected to be broken
21
+ get_old_InterfaceDeclaration_IParsedUrl());
22
+ use_old_InterfaceDeclaration_IParsedUrl(get_current_InterfaceDeclaration_IParsedUrl());
23
+ use_current_InterfaceDeclaration_IProtocolHandler(get_old_InterfaceDeclaration_IProtocolHandler());
24
+ use_old_InterfaceDeclaration_IProtocolHandler(get_current_InterfaceDeclaration_IProtocolHandler());
25
+ use_current_ClassDeclaration_Loader(get_old_ClassDeclaration_Loader());
26
+ use_old_ClassDeclaration_Loader(get_current_ClassDeclaration_Loader());
27
+ use_current_TypeAliasDeclaration_ProtocolHandlerBuilder(get_old_TypeAliasDeclaration_ProtocolHandlerBuilder());
28
+ use_old_TypeAliasDeclaration_ProtocolHandlerBuilder(get_current_TypeAliasDeclaration_ProtocolHandlerBuilder());
29
+ use_current_FunctionDeclaration_isLocationRedirectionError(get_old_FunctionDeclaration_isLocationRedirectionError());
30
+ use_old_FunctionDeclaration_isLocationRedirectionError(get_current_FunctionDeclaration_isLocationRedirectionError());
31
+ use_current_FunctionDeclaration_resolveWithLocationRedirectionHandling(get_old_FunctionDeclaration_resolveWithLocationRedirectionHandling());
32
+ use_old_FunctionDeclaration_resolveWithLocationRedirectionHandling(get_current_FunctionDeclaration_resolveWithLocationRedirectionHandling());
33
+ use_current_FunctionDeclaration_tryParseCompatibleResolvedUrl(get_old_FunctionDeclaration_tryParseCompatibleResolvedUrl());
34
+ use_old_FunctionDeclaration_tryParseCompatibleResolvedUrl(get_current_FunctionDeclaration_tryParseCompatibleResolvedUrl());
35
+ use_current_FunctionDeclaration_waitContainerToCatchUp(get_old_FunctionDeclaration_waitContainerToCatchUp());
36
+ use_old_FunctionDeclaration_waitContainerToCatchUp(get_current_FunctionDeclaration_waitContainerToCatchUp());
37
+ export {};
38
+ //# sourceMappingURL=validateContainerLoaderPrevious.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateContainerLoaderPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateContainerLoaderPrevious.generated.ts"],"names":[],"mappings":"AAgCA,2CAA2C,CACvC,uCAAuC,EAAE,CAAC,CAAC;AAW/C,uCAAuC,CACnC,2CAA2C,EAAE,CAAC,CAAC;AAWnD,mDAAmD,CAC/C,+CAA+C,EAAE,CAAC,CAAC;AAWvD,+CAA+C,CAC3C,mDAAmD,EAAE,CAAC,CAAC;AAW3D,uDAAuD;AACnD,uDAAuD;AACvD,mDAAmD,EAAE,CAAC,CAAC;AAW3D,mDAAmD,CAC/C,uDAAuD,EAAE,CAAC,CAAC;AAW/D,qDAAqD,CACjD,iDAAiD,EAAE,CAAC,CAAC;AAWzD,iDAAiD,CAC7C,qDAAqD,EAAE,CAAC,CAAC;AAW7D,wDAAwD,CACpD,oDAAoD,EAAE,CAAC,CAAC;AAW5D,oDAAoD,CAChD,wDAAwD,EAAE,CAAC,CAAC;AAWhE,+CAA+C,CAC3C,2CAA2C,EAAE,CAAC,CAAC;AAWnD,2CAA2C,CACvC,+CAA+C,EAAE,CAAC,CAAC;AAWvD,6CAA6C,CACzC,yCAAyC,EAAE,CAAC,CAAC;AAWjD,yCAAyC,CACrC,6CAA6C,EAAE,CAAC,CAAC;AAWrD,gDAAgD,CAC5C,4CAA4C,EAAE,CAAC,CAAC;AAWpD,4CAA4C,CACxC,gDAAgD,EAAE,CAAC,CAAC;AAWxD,2CAA2C;AACvC,uDAAuD;AACvD,uCAAuC,EAAE,CAAC,CAAC;AAW/C,uCAAuC,CACnC,2CAA2C,EAAE,CAAC,CAAC;AAWnD,iDAAiD,CAC7C,6CAA6C,EAAE,CAAC,CAAC;AAWrD,6CAA6C,CACzC,iDAAiD,EAAE,CAAC,CAAC;AAWzD,mCAAmC,CAC/B,+BAA+B,EAAE,CAAC,CAAC;AAWvC,+BAA+B,CAC3B,mCAAmC,EAAE,CAAC,CAAC;AAW3C,uDAAuD,CACnD,mDAAmD,EAAE,CAAC,CAAC;AAW3D,mDAAmD,CAC/C,uDAAuD,EAAE,CAAC,CAAC;AAW/D,0DAA0D,CACtD,sDAAsD,EAAE,CAAC,CAAC;AAW9D,sDAAsD,CAClD,0DAA0D,EAAE,CAAC,CAAC;AAWlE,sEAAsE,CAClE,kEAAkE,EAAE,CAAC,CAAC;AAW1E,kEAAkE,CAC9D,sEAAsE,EAAE,CAAC,CAAC;AAW9E,6DAA6D,CACzD,yDAAyD,EAAE,CAAC,CAAC;AAWjE,yDAAyD,CACrD,6DAA6D,EAAE,CAAC,CAAC;AAWrE,sDAAsD,CAClD,kDAAkD,EAAE,CAAC,CAAC;AAW1D,kDAAkD,CAC9C,sDAAsD,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/container-loader-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"EnumDeclaration_ConnectionState\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_EnumDeclaration_ConnectionState():\n TypeOnly<old.ConnectionState>;\ndeclare function use_current_EnumDeclaration_ConnectionState(\n use: TypeOnly<current.ConnectionState>): void;\nuse_current_EnumDeclaration_ConnectionState(\n get_old_EnumDeclaration_ConnectionState());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"EnumDeclaration_ConnectionState\": {\"backCompat\": false}\n*/\ndeclare function get_current_EnumDeclaration_ConnectionState():\n TypeOnly<current.ConnectionState>;\ndeclare function use_old_EnumDeclaration_ConnectionState(\n use: TypeOnly<old.ConnectionState>): void;\nuse_old_EnumDeclaration_ConnectionState(\n get_current_EnumDeclaration_ConnectionState());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ICodeDetailsLoader\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ICodeDetailsLoader():\n TypeOnly<old.ICodeDetailsLoader>;\ndeclare function use_current_InterfaceDeclaration_ICodeDetailsLoader(\n use: TypeOnly<current.ICodeDetailsLoader>): void;\nuse_current_InterfaceDeclaration_ICodeDetailsLoader(\n get_old_InterfaceDeclaration_ICodeDetailsLoader());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ICodeDetailsLoader\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ICodeDetailsLoader():\n TypeOnly<current.ICodeDetailsLoader>;\ndeclare function use_old_InterfaceDeclaration_ICodeDetailsLoader(\n use: TypeOnly<old.ICodeDetailsLoader>): void;\nuse_old_InterfaceDeclaration_ICodeDetailsLoader(\n get_current_InterfaceDeclaration_ICodeDetailsLoader());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IContainerExperimental\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IContainerExperimental():\n TypeOnly<old.IContainerExperimental>;\ndeclare function use_current_InterfaceDeclaration_IContainerExperimental(\n use: TypeOnly<current.IContainerExperimental>): void;\nuse_current_InterfaceDeclaration_IContainerExperimental(\n // @ts-expect-error compatibility expected to be broken\n get_old_InterfaceDeclaration_IContainerExperimental());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IContainerExperimental\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IContainerExperimental():\n TypeOnly<current.IContainerExperimental>;\ndeclare function use_old_InterfaceDeclaration_IContainerExperimental(\n use: TypeOnly<old.IContainerExperimental>): void;\nuse_old_InterfaceDeclaration_IContainerExperimental(\n get_current_InterfaceDeclaration_IContainerExperimental());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_IDetachedBlobStorage\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_IDetachedBlobStorage():\n TypeOnly<old.IDetachedBlobStorage>;\ndeclare function use_current_TypeAliasDeclaration_IDetachedBlobStorage(\n use: TypeOnly<current.IDetachedBlobStorage>): void;\nuse_current_TypeAliasDeclaration_IDetachedBlobStorage(\n get_old_TypeAliasDeclaration_IDetachedBlobStorage());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_IDetachedBlobStorage\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_IDetachedBlobStorage():\n TypeOnly<current.IDetachedBlobStorage>;\ndeclare function use_old_TypeAliasDeclaration_IDetachedBlobStorage(\n use: TypeOnly<old.IDetachedBlobStorage>): void;\nuse_old_TypeAliasDeclaration_IDetachedBlobStorage(\n get_current_TypeAliasDeclaration_IDetachedBlobStorage());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IFluidModuleWithDetails\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IFluidModuleWithDetails():\n TypeOnly<old.IFluidModuleWithDetails>;\ndeclare function use_current_InterfaceDeclaration_IFluidModuleWithDetails(\n use: TypeOnly<current.IFluidModuleWithDetails>): void;\nuse_current_InterfaceDeclaration_IFluidModuleWithDetails(\n get_old_InterfaceDeclaration_IFluidModuleWithDetails());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IFluidModuleWithDetails\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IFluidModuleWithDetails():\n TypeOnly<current.IFluidModuleWithDetails>;\ndeclare function use_old_InterfaceDeclaration_IFluidModuleWithDetails(\n use: TypeOnly<old.IFluidModuleWithDetails>): void;\nuse_old_InterfaceDeclaration_IFluidModuleWithDetails(\n get_current_InterfaceDeclaration_IFluidModuleWithDetails());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ILoaderOptions\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ILoaderOptions():\n TypeOnly<old.ILoaderOptions>;\ndeclare function use_current_InterfaceDeclaration_ILoaderOptions(\n use: TypeOnly<current.ILoaderOptions>): void;\nuse_current_InterfaceDeclaration_ILoaderOptions(\n get_old_InterfaceDeclaration_ILoaderOptions());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ILoaderOptions\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ILoaderOptions():\n TypeOnly<current.ILoaderOptions>;\ndeclare function use_old_InterfaceDeclaration_ILoaderOptions(\n use: TypeOnly<old.ILoaderOptions>): void;\nuse_old_InterfaceDeclaration_ILoaderOptions(\n get_current_InterfaceDeclaration_ILoaderOptions());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ILoaderProps\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ILoaderProps():\n TypeOnly<old.ILoaderProps>;\ndeclare function use_current_InterfaceDeclaration_ILoaderProps(\n use: TypeOnly<current.ILoaderProps>): void;\nuse_current_InterfaceDeclaration_ILoaderProps(\n get_old_InterfaceDeclaration_ILoaderProps());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ILoaderProps\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ILoaderProps():\n TypeOnly<current.ILoaderProps>;\ndeclare function use_old_InterfaceDeclaration_ILoaderProps(\n use: TypeOnly<old.ILoaderProps>): void;\nuse_old_InterfaceDeclaration_ILoaderProps(\n get_current_InterfaceDeclaration_ILoaderProps());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ILoaderServices\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ILoaderServices():\n TypeOnly<old.ILoaderServices>;\ndeclare function use_current_InterfaceDeclaration_ILoaderServices(\n use: TypeOnly<current.ILoaderServices>): void;\nuse_current_InterfaceDeclaration_ILoaderServices(\n get_old_InterfaceDeclaration_ILoaderServices());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ILoaderServices\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ILoaderServices():\n TypeOnly<current.ILoaderServices>;\ndeclare function use_old_InterfaceDeclaration_ILoaderServices(\n use: TypeOnly<old.ILoaderServices>): void;\nuse_old_InterfaceDeclaration_ILoaderServices(\n get_current_InterfaceDeclaration_ILoaderServices());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IParsedUrl\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IParsedUrl():\n TypeOnly<old.IParsedUrl>;\ndeclare function use_current_InterfaceDeclaration_IParsedUrl(\n use: TypeOnly<current.IParsedUrl>): void;\nuse_current_InterfaceDeclaration_IParsedUrl(\n // @ts-expect-error compatibility expected to be broken\n get_old_InterfaceDeclaration_IParsedUrl());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IParsedUrl\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IParsedUrl():\n TypeOnly<current.IParsedUrl>;\ndeclare function use_old_InterfaceDeclaration_IParsedUrl(\n use: TypeOnly<old.IParsedUrl>): void;\nuse_old_InterfaceDeclaration_IParsedUrl(\n get_current_InterfaceDeclaration_IParsedUrl());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IProtocolHandler\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IProtocolHandler():\n TypeOnly<old.IProtocolHandler>;\ndeclare function use_current_InterfaceDeclaration_IProtocolHandler(\n use: TypeOnly<current.IProtocolHandler>): void;\nuse_current_InterfaceDeclaration_IProtocolHandler(\n get_old_InterfaceDeclaration_IProtocolHandler());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IProtocolHandler\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IProtocolHandler():\n TypeOnly<current.IProtocolHandler>;\ndeclare function use_old_InterfaceDeclaration_IProtocolHandler(\n use: TypeOnly<old.IProtocolHandler>): void;\nuse_old_InterfaceDeclaration_IProtocolHandler(\n get_current_InterfaceDeclaration_IProtocolHandler());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_Loader\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_Loader():\n TypeOnly<old.Loader>;\ndeclare function use_current_ClassDeclaration_Loader(\n use: TypeOnly<current.Loader>): void;\nuse_current_ClassDeclaration_Loader(\n get_old_ClassDeclaration_Loader());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_Loader\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_Loader():\n TypeOnly<current.Loader>;\ndeclare function use_old_ClassDeclaration_Loader(\n use: TypeOnly<old.Loader>): void;\nuse_old_ClassDeclaration_Loader(\n get_current_ClassDeclaration_Loader());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_ProtocolHandlerBuilder\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_ProtocolHandlerBuilder():\n TypeOnly<old.ProtocolHandlerBuilder>;\ndeclare function use_current_TypeAliasDeclaration_ProtocolHandlerBuilder(\n use: TypeOnly<current.ProtocolHandlerBuilder>): void;\nuse_current_TypeAliasDeclaration_ProtocolHandlerBuilder(\n get_old_TypeAliasDeclaration_ProtocolHandlerBuilder());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_ProtocolHandlerBuilder\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_ProtocolHandlerBuilder():\n TypeOnly<current.ProtocolHandlerBuilder>;\ndeclare function use_old_TypeAliasDeclaration_ProtocolHandlerBuilder(\n use: TypeOnly<old.ProtocolHandlerBuilder>): void;\nuse_old_TypeAliasDeclaration_ProtocolHandlerBuilder(\n get_current_TypeAliasDeclaration_ProtocolHandlerBuilder());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_isLocationRedirectionError\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_isLocationRedirectionError():\n TypeOnly<typeof old.isLocationRedirectionError>;\ndeclare function use_current_FunctionDeclaration_isLocationRedirectionError(\n use: TypeOnly<typeof current.isLocationRedirectionError>): void;\nuse_current_FunctionDeclaration_isLocationRedirectionError(\n get_old_FunctionDeclaration_isLocationRedirectionError());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_isLocationRedirectionError\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_isLocationRedirectionError():\n TypeOnly<typeof current.isLocationRedirectionError>;\ndeclare function use_old_FunctionDeclaration_isLocationRedirectionError(\n use: TypeOnly<typeof old.isLocationRedirectionError>): void;\nuse_old_FunctionDeclaration_isLocationRedirectionError(\n get_current_FunctionDeclaration_isLocationRedirectionError());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_resolveWithLocationRedirectionHandling\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_resolveWithLocationRedirectionHandling():\n TypeOnly<typeof old.resolveWithLocationRedirectionHandling>;\ndeclare function use_current_FunctionDeclaration_resolveWithLocationRedirectionHandling(\n use: TypeOnly<typeof current.resolveWithLocationRedirectionHandling>): void;\nuse_current_FunctionDeclaration_resolveWithLocationRedirectionHandling(\n get_old_FunctionDeclaration_resolveWithLocationRedirectionHandling());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_resolveWithLocationRedirectionHandling\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_resolveWithLocationRedirectionHandling():\n TypeOnly<typeof current.resolveWithLocationRedirectionHandling>;\ndeclare function use_old_FunctionDeclaration_resolveWithLocationRedirectionHandling(\n use: TypeOnly<typeof old.resolveWithLocationRedirectionHandling>): void;\nuse_old_FunctionDeclaration_resolveWithLocationRedirectionHandling(\n get_current_FunctionDeclaration_resolveWithLocationRedirectionHandling());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_tryParseCompatibleResolvedUrl\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_tryParseCompatibleResolvedUrl():\n TypeOnly<typeof old.tryParseCompatibleResolvedUrl>;\ndeclare function use_current_FunctionDeclaration_tryParseCompatibleResolvedUrl(\n use: TypeOnly<typeof current.tryParseCompatibleResolvedUrl>): void;\nuse_current_FunctionDeclaration_tryParseCompatibleResolvedUrl(\n get_old_FunctionDeclaration_tryParseCompatibleResolvedUrl());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_tryParseCompatibleResolvedUrl\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_tryParseCompatibleResolvedUrl():\n TypeOnly<typeof current.tryParseCompatibleResolvedUrl>;\ndeclare function use_old_FunctionDeclaration_tryParseCompatibleResolvedUrl(\n use: TypeOnly<typeof old.tryParseCompatibleResolvedUrl>): void;\nuse_old_FunctionDeclaration_tryParseCompatibleResolvedUrl(\n get_current_FunctionDeclaration_tryParseCompatibleResolvedUrl());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_waitContainerToCatchUp\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_waitContainerToCatchUp():\n TypeOnly<typeof old.waitContainerToCatchUp>;\ndeclare function use_current_FunctionDeclaration_waitContainerToCatchUp(\n use: TypeOnly<typeof current.waitContainerToCatchUp>): void;\nuse_current_FunctionDeclaration_waitContainerToCatchUp(\n get_old_FunctionDeclaration_waitContainerToCatchUp());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_waitContainerToCatchUp\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_waitContainerToCatchUp():\n TypeOnly<typeof current.waitContainerToCatchUp>;\ndeclare function use_old_FunctionDeclaration_waitContainerToCatchUp(\n use: TypeOnly<typeof old.waitContainerToCatchUp>): void;\nuse_old_FunctionDeclaration_waitContainerToCatchUp(\n get_current_FunctionDeclaration_waitContainerToCatchUp());\n"]}
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { strict as assert } from "assert";
6
+ import { runSingle } from "../utils.js";
7
+ describe("container-loader utils", () => {
8
+ describe("runSingle", () => {
9
+ it("correctly calls internal func", async () => {
10
+ const wrappedFunc = runSingle(async (base, plus) => base + plus);
11
+ assert.strictEqual(await wrappedFunc(4, 1), 5);
12
+ });
13
+ it("returns same promise for same args", async () => {
14
+ const wrappedFunc = runSingle(async (base, plus) => base + plus);
15
+ const [p1, p2] = [wrappedFunc(4, 1), wrappedFunc(4, 1)];
16
+ assert.strictEqual(p2, p1);
17
+ assert.strictEqual(await p1, 5);
18
+ assert.strictEqual(await p2, 5);
19
+ });
20
+ it("fails for different args", async () => {
21
+ const wrappedFunc = runSingle(async (base, plus) => base + plus);
22
+ const [p1, p2] = [wrappedFunc(4, 1), wrappedFunc(4, 2)];
23
+ assert.notStrictEqual(p2, p1);
24
+ assert.strictEqual(await p1, 5);
25
+ await p2
26
+ .then(() => assert.fail("should fail"))
27
+ .catch((e) => assert.strictEqual(e.message, "Subsequent calls cannot use different arguments."));
28
+ });
29
+ });
30
+ });
31
+ //# sourceMappingURL=utils.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../src/test/utils.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;YAC9C,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,EAAE,IAAY,EAAE,IAAY,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;YAEjF,MAAM,CAAC,WAAW,CAAC,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;YACnD,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,EAAE,IAAY,EAAE,IAAY,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;YAEjF,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAExD,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC3B,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;YACzC,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,EAAE,IAAY,EAAE,IAAY,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;YAEjF,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAExD,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC9B,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;YAChC,MAAM,EAAE;iBACN,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;iBACtC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE,CACnB,MAAM,CAAC,WAAW,CACjB,CAAC,CAAC,OAAO,EACT,kDAAkD,CAClD,CACD,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { runSingle } from \"../utils.js\";\n\ndescribe(\"container-loader utils\", () => {\n\tdescribe(\"runSingle\", () => {\n\t\tit(\"correctly calls internal func\", async () => {\n\t\t\tconst wrappedFunc = runSingle(async (base: number, plus: number) => base + plus);\n\n\t\t\tassert.strictEqual(await wrappedFunc(4, 1), 5);\n\t\t});\n\n\t\tit(\"returns same promise for same args\", async () => {\n\t\t\tconst wrappedFunc = runSingle(async (base: number, plus: number) => base + plus);\n\n\t\t\tconst [p1, p2] = [wrappedFunc(4, 1), wrappedFunc(4, 1)];\n\n\t\t\tassert.strictEqual(p2, p1);\n\t\t\tassert.strictEqual(await p1, 5);\n\t\t\tassert.strictEqual(await p2, 5);\n\t\t});\n\n\t\tit(\"fails for different args\", async () => {\n\t\t\tconst wrappedFunc = runSingle(async (base: number, plus: number) => base + plus);\n\n\t\t\tconst [p1, p2] = [wrappedFunc(4, 1), wrappedFunc(4, 2)];\n\n\t\t\tassert.notStrictEqual(p2, p1);\n\t\t\tassert.strictEqual(await p1, 5);\n\t\t\tawait p2\n\t\t\t\t.then(() => assert.fail(\"should fail\"))\n\t\t\t\t.catch((e: Error) =>\n\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\te.message,\n\t\t\t\t\t\t\"Subsequent calls cannot use different arguments.\",\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t});\n\t});\n});\n"]}
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import { ISummaryTree, ISnapshotTree } from "@fluidframework/protocol-definitions";
6
6
  import { CombinedAppAndProtocolSummary, DeltaStreamConnectionForbiddenError } from "@fluidframework/driver-utils";
7
- import { ISerializableBlobContents } from "./containerStorageAdapter.mjs";
8
- import { IPendingDetachedContainerState } from "./container.mjs";
7
+ import { ISerializableBlobContents } from "./containerStorageAdapter.js";
8
+ import { IPendingDetachedContainerState } from "./container.js";
9
9
  export interface ISnapshotTreeWithBlobContents extends ISnapshotTree {
10
10
  blobsContents: {
11
11
  [path: string]: ArrayBufferLike;
@@ -34,11 +34,10 @@ export interface IParsedUrl {
34
34
  */
35
35
  query: string;
36
36
  /**
37
- * Null means do not use snapshots, undefined means load latest snapshot
38
- * otherwise it's version ID passed to IDocumentStorageService.getVersions() to figure out what snapshot to use.
39
- * If needed, can add undefined which is treated by Container.load() as load latest snapshot.
37
+ * Undefined means load latest snapshot, otherwise it's version ID passed to IDocumentStorageService.getVersions()
38
+ * to figure out what snapshot to use.
40
39
  */
41
- version: string | null | undefined;
40
+ version: string | undefined;
42
41
  }
43
42
  /**
44
43
  * Utility api to parse the IResolvedUrl.url into specific parts like querystring, path to get
@@ -70,4 +69,4 @@ export declare function getDetachedContainerStateFromSerializedContainer(seriali
70
69
  * If there are multiple calls they will all get the same promise to wait on.
71
70
  */
72
71
  export declare const runSingle: <A extends any[], R>(func: (...args: A) => Promise<R>) => (...args: A) => Promise<R>;
73
- //# sourceMappingURL=utils.d.mts.map
72
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,sCAAsC,CAAC;AAEhG,OAAO,EACN,6BAA6B,EAC7B,mCAAmC,EAEnC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAIhE,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;;;OAGG;IACH,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAiBjF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,UAAU,EAAE,YAAY,EACxB,eAAe,EAAE,YAAY,GAC3B,6BAA6B,CAiB/B;AA2ED,eAAO,MAAM,8CAA8C,8BAC/B,YAAY,KACrC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,yBAAyB,CAAA;CAYzD,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAE9E;AAED,eAAO,MAAM,mCAAmC,iBACjC,aAAa,iBACZ,yBAAyB,KACtC,6BAwBF,CAAC;AAEF,wBAAgB,qCAAqC,CACpD,KAAK,EAAE,GAAG,GACR,KAAK,IAAI,mCAAmC,CAM9C;AAoBD,wBAAgB,gDAAgD,CAC/D,mBAAmB,EAAE,MAAM,GACzB,8BAA8B,CAkBhC;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,sFAsBrB,CAAC"}
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { parse } from "url";
6
5
  import { v4 as uuid } from "uuid";
7
6
  import { Uint8ArrayToString, stringToBuffer } from "@fluid-internal/client-utils";
8
7
  import { assert, compareArrays, unreachableCase } from "@fluidframework/core-utils";
@@ -20,7 +19,7 @@ import { DriverErrorTypes } from "@fluidframework/driver-definitions";
20
19
  * @internal
21
20
  */
22
21
  export function tryParseCompatibleResolvedUrl(url) {
23
- const parsed = parse(url, true);
22
+ const parsed = new URL(url);
24
23
  if (typeof parsed.pathname !== "string") {
25
24
  throw new LoggingError("Failed to parse pathname");
26
25
  }
@@ -28,7 +27,13 @@ export function tryParseCompatibleResolvedUrl(url) {
28
27
  const regex = /^\/([^/]*\/[^/]*)(\/?.*)$/;
29
28
  const match = regex.exec(parsed.pathname);
30
29
  return match?.length === 3
31
- ? { id: match[1], path: match[2], query, version: parsed.query.version }
30
+ ? {
31
+ id: match[1],
32
+ path: match[2],
33
+ query,
34
+ // URLSearchParams returns null if the param is not provided.
35
+ version: parsed.searchParams.get("version") ?? undefined,
36
+ }
32
37
  : undefined;
33
38
  }
34
39
  /**
@@ -61,6 +66,7 @@ function convertSummaryToSnapshotAndBlobs(summary) {
61
66
  trees: {},
62
67
  id: uuid(),
63
68
  unreferenced: summary.unreferenced,
69
+ groupId: summary.groupId,
64
70
  };
65
71
  const keys = Object.keys(summary.tree);
66
72
  for (const key of keys) {
@@ -109,7 +115,7 @@ function convertProtocolAndAppSummaryToSnapshotAndBlobs(protocolSummaryTree, app
109
115
  return snapshotTreeWithBlobContents;
110
116
  }
111
117
  export const getSnapshotTreeAndBlobsFromSerializedContainer = (detachedContainerSnapshot) => {
112
- assert(isCombinedAppAndProtocolSummary(detachedContainerSnapshot), "Protocol and App summary trees should be present");
118
+ assert(isCombinedAppAndProtocolSummary(detachedContainerSnapshot), 0x8e6 /* Protocol and App summary trees should be present */);
113
119
  const protocolSummaryTree = detachedContainerSnapshot.tree[".protocol"];
114
120
  const appSummaryTree = detachedContainerSnapshot.tree[".app"];
115
121
  const snapshotTreeWithBlobContents = convertProtocolAndAppSummaryToSnapshotAndBlobs(protocolSummaryTree, appSummaryTree);
@@ -197,4 +203,4 @@ export const runSingle = (func) => {
197
203
  return running.result;
198
204
  };
199
205
  };
200
- //# sourceMappingURL=utils.mjs.map
206
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAA+B,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAGN,+BAA+B,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAqCt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AC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { Uint8ArrayToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert, compareArrays, unreachableCase } from \"@fluidframework/core-utils\";\nimport { ISummaryTree, ISnapshotTree, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { LoggingError, UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tCombinedAppAndProtocolSummary,\n\tDeltaStreamConnectionForbiddenError,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions\";\nimport { ISerializableBlobContents } from \"./containerStorageAdapter.js\";\nimport { IPendingDetachedContainerState } from \"./container.js\";\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 * Undefined means load latest snapshot, otherwise it's version ID passed to IDocumentStorageService.getVersions()\n\t * to figure out what snapshot to use.\n\t */\n\tversion: string | 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 = new URL(url);\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? {\n\t\t\t\tid: match[1],\n\t\t\t\tpath: match[2],\n\t\t\t\tquery,\n\t\t\t\t// URLSearchParams returns null if the param is not provided.\n\t\t\t\tversion: parsed.searchParams.get(\"version\") ?? undefined,\n\t\t }\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 a summary to snapshot tree and separate its blob contents\n * to align detached container format with IPendingContainerState\n * @param summary - ISummaryTree\n */\nfunction convertSummaryToSnapshotAndBlobs(summary: ISummaryTree): {\n\ttree: ISnapshotTree;\n\tblobs: ISerializableBlobContents;\n} {\n\tlet blobContents: ISerializableBlobContents = {};\n\tconst treeNode: ISnapshotTree = {\n\t\tblobs: {},\n\t\ttrees: {},\n\t\tid: uuid(),\n\t\tunreferenced: summary.unreferenced,\n\t\tgroupId: summary.groupId,\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\tconst { tree, blobs } = convertSummaryToSnapshotAndBlobs(summaryObject);\n\t\t\t\ttreeNode.trees[key] = tree;\n\t\t\t\tblobContents = { ...blobContents, ...blobs };\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 contentString: string =\n\t\t\t\t\tsummaryObject.content instanceof Uint8Array\n\t\t\t\t\t\t? Uint8ArrayToString(summaryObject.content)\n\t\t\t\t\t\t: summaryObject.content;\n\t\t\t\tblobContents[blobId] = contentString;\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 { tree: treeNode, blobs: blobContents };\n}\n\n/**\n * Converts summary parts into a SnapshotTree and its blob contents.\n * @param protocolSummaryTree - Protocol Summary Tree\n * @param appSummaryTree - App Summary Tree\n */\nfunction convertProtocolAndAppSummaryToSnapshotAndBlobs(\n\tprotocolSummaryTree: ISummaryTree,\n\tappSummaryTree: ISummaryTree,\n): { tree: ISnapshotTree; blobs: ISerializableBlobContents } {\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 = convertSummaryToSnapshotAndBlobs(combinedSummary);\n\treturn snapshotTreeWithBlobContents;\n}\n\nexport const getSnapshotTreeAndBlobsFromSerializedContainer = (\n\tdetachedContainerSnapshot: ISummaryTree,\n): { tree: ISnapshotTree; blobs: ISerializableBlobContents } => {\n\tassert(\n\t\tisCombinedAppAndProtocolSummary(detachedContainerSnapshot),\n\t\t0x8e6 /* 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 = convertProtocolAndAppSummaryToSnapshotAndBlobs(\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 const combineSnapshotTreeAndSnapshotBlobs = (\n\tbaseSnapshot: ISnapshotTree,\n\tsnapshotBlobs: ISerializableBlobContents,\n): ISnapshotTreeWithBlobContents => {\n\tconst blobsContents: { [path: string]: ArrayBufferLike } = {};\n\n\t// Process blobs in the current level\n\tfor (const [, id] of Object.entries(baseSnapshot.blobs)) {\n\t\tif (snapshotBlobs[id]) {\n\t\t\tblobsContents[id] = stringToBuffer(snapshotBlobs[id], \"utf8\");\n\t\t}\n\t}\n\n\t// Recursively process trees in the current level\n\tconst trees: { [path: string]: ISnapshotTreeWithBlobContents } = {};\n\tfor (const [path, tree] of Object.entries(baseSnapshot.trees)) {\n\t\ttrees[path] = combineSnapshotTreeAndSnapshotBlobs(tree, snapshotBlobs);\n\t}\n\n\t// Create a new snapshot tree with blob contents and processed trees\n\tconst snapshotTreeWithBlobContents: ISnapshotTreeWithBlobContents = {\n\t\t...baseSnapshot,\n\t\tblobsContents,\n\t\ttrees,\n\t};\n\n\treturn snapshotTreeWithBlobContents;\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\n/**\n * Validates format in parsed string get from detached container\n * serialization using IPendingDetachedContainerState format.\n */\nfunction isPendingDetachedContainerState(\n\tdetachedContainerState: IPendingDetachedContainerState,\n): detachedContainerState is IPendingDetachedContainerState {\n\tif (\n\t\tdetachedContainerState?.attached === undefined ||\n\t\tdetachedContainerState?.baseSnapshot === undefined ||\n\t\tdetachedContainerState?.snapshotBlobs === undefined ||\n\t\tdetachedContainerState?.hasAttachmentBlobs === undefined\n\t) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nexport function getDetachedContainerStateFromSerializedContainer(\n\tserializedContainer: string,\n): IPendingDetachedContainerState {\n\tconst hasBlobsSummaryTree = \".hasAttachmentBlobs\";\n\tconst parsedContainerState = JSON.parse(serializedContainer);\n\tif (isPendingDetachedContainerState(parsedContainerState)) {\n\t\treturn parsedContainerState;\n\t} else if (isCombinedAppAndProtocolSummary(parsedContainerState)) {\n\t\tconst { tree, blobs } =\n\t\t\tgetSnapshotTreeAndBlobsFromSerializedContainer(parsedContainerState);\n\t\tconst detachedContainerState: IPendingDetachedContainerState = {\n\t\t\tattached: false,\n\t\t\tbaseSnapshot: tree,\n\t\t\tsnapshotBlobs: blobs,\n\t\t\thasAttachmentBlobs: parsedContainerState.tree[hasBlobsSummaryTree] !== undefined,\n\t\t};\n\t\treturn detachedContainerState;\n\t} else {\n\t\tthrow new UsageError(\"Cannot rehydrate detached container. Incorrect format\");\n\t}\n}\n\n/**\n * Ensures only a single instance of the provided async function is running.\n * If there are multiple calls they will all get the same promise to wait on.\n */\nexport const runSingle = <A extends any[], R>(func: (...args: A) => Promise<R>) => {\n\tlet running:\n\t\t| {\n\t\t\t\targs: A;\n\t\t\t\tresult: Promise<R>;\n\t\t }\n\t\t| undefined;\n\t// don't mark this function async, so we return the same promise,\n\t// rather than one that is wrapped due to async\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\treturn (...args: A) => {\n\t\tif (running !== undefined) {\n\t\t\tif (!compareArrays(running.args, args)) {\n\t\t\t\treturn Promise.reject(\n\t\t\t\t\tnew UsageError(\"Subsequent calls cannot use different arguments.\"),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn running.result;\n\t\t}\n\t\trunning = { args, result: func(...args).finally(() => (running = undefined)) };\n\t\treturn running.result;\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-dev-rc.1.0.0.232845",
3
+ "version": "2.0.0-dev-rc.2.0.0.245554",
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,51 +127,48 @@
137
127
  "temp-directory": "nyc/.nyc_output"
138
128
  },
139
129
  "dependencies": {
140
- "@fluid-internal/client-utils": "2.0.0-dev-rc.1.0.0.232845",
141
- "@fluidframework/container-definitions": "2.0.0-dev-rc.1.0.0.232845",
142
- "@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.232845",
143
- "@fluidframework/core-utils": "2.0.0-dev-rc.1.0.0.232845",
144
- "@fluidframework/driver-definitions": "2.0.0-dev-rc.1.0.0.232845",
145
- "@fluidframework/driver-utils": "2.0.0-dev-rc.1.0.0.232845",
146
- "@fluidframework/protocol-base": "^3.1.0-231702",
147
- "@fluidframework/protocol-definitions": "^3.2.0-231454",
148
- "@fluidframework/telemetry-utils": "2.0.0-dev-rc.1.0.0.232845",
130
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.2.0.0.245554",
131
+ "@fluidframework/container-definitions": "2.0.0-dev-rc.2.0.0.245554",
132
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.2.0.0.245554",
133
+ "@fluidframework/core-utils": "2.0.0-dev-rc.2.0.0.245554",
134
+ "@fluidframework/driver-definitions": "2.0.0-dev-rc.2.0.0.245554",
135
+ "@fluidframework/driver-utils": "2.0.0-dev-rc.2.0.0.245554",
136
+ "@fluidframework/protocol-base": "^4.0.0",
137
+ "@fluidframework/protocol-definitions": "^3.2.0",
138
+ "@fluidframework/telemetry-utils": "2.0.0-dev-rc.2.0.0.245554",
149
139
  "@ungap/structured-clone": "^1.2.0",
150
140
  "debug": "^4.3.4",
151
141
  "double-ended-queue": "^2.1.0-0",
152
- "events": "^3.1.0",
153
- "url": "^0.11.0",
154
142
  "uuid": "^9.0.0"
155
143
  },
156
144
  "devDependencies": {
157
145
  "@arethetypeswrong/cli": "^0.13.3",
158
- "@fluid-private/test-loader-utils": "2.0.0-dev-rc.1.0.0.232845",
159
- "@fluid-tools/build-cli": "^0.29.0",
146
+ "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.2.0.0.245554",
147
+ "@fluid-private/test-loader-utils": "2.0.0-dev-rc.2.0.0.245554",
148
+ "@fluid-tools/build-cli": "^0.34.0",
160
149
  "@fluidframework/build-common": "^2.0.3",
161
- "@fluidframework/build-tools": "^0.29.0",
150
+ "@fluidframework/build-tools": "^0.34.0",
162
151
  "@fluidframework/container-loader-previous": "npm:@fluidframework/container-loader@2.0.0-internal.8.0.0",
163
- "@fluidframework/eslint-config-fluid": "^3.3.0",
164
- "@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.232845",
165
- "@microsoft/api-extractor": "^7.39.1",
152
+ "@fluidframework/eslint-config-fluid": "^5.1.0",
153
+ "@microsoft/api-extractor": "^7.42.3",
166
154
  "@types/debug": "^4.1.5",
167
155
  "@types/double-ended-queue": "^2.1.0",
168
- "@types/events": "^3.0.0",
169
156
  "@types/mocha": "^9.1.1",
170
157
  "@types/node": "^18.19.0",
171
- "@types/sinon": "^7.0.13",
158
+ "@types/sinon": "^17.0.3",
172
159
  "@types/ungap__structured-clone": "^1.2.0",
160
+ "@types/uuid": "^9.0.2",
173
161
  "c8": "^8.0.1",
174
162
  "copyfiles": "^2.4.1",
175
163
  "cross-env": "^7.0.3",
176
- "eslint": "~8.50.0",
164
+ "eslint": "~8.55.0",
177
165
  "mocha": "^10.2.0",
178
166
  "mocha-json-output-reporter": "^2.0.1",
179
167
  "mocha-multi-reporters": "^1.5.1",
180
168
  "moment": "^2.21.0",
181
169
  "prettier": "~3.0.3",
182
170
  "rimraf": "^4.4.0",
183
- "sinon": "^7.4.2",
184
- "tsc-multi": "^1.1.0",
171
+ "sinon": "^17.0.1",
185
172
  "typescript": "~5.1.6"
186
173
  },
187
174
  "fluidBuild": {
@@ -200,20 +187,25 @@
200
187
  "broken": {
201
188
  "InterfaceDeclaration_IContainerExperimental": {
202
189
  "forwardCompat": false
190
+ },
191
+ "InterfaceDeclaration_IParsedUrl": {
192
+ "forwardCompat": false
203
193
  }
204
194
  }
205
195
  },
206
196
  "scripts": {
207
197
  "api": "fluid-build . --task api",
208
- "api-extractor:commonjs": "api-extractor run --local",
209
- "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",
210
200
  "build": "fluid-build . --task build",
211
201
  "build:commonjs": "fluid-build . --task commonjs",
212
202
  "build:compile": "fluid-build . --task compile",
213
203
  "build:docs": "fluid-build . --task api",
214
- "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
204
+ "build:esnext": "tsc --project ./tsconfig.json",
215
205
  "build:genver": "gen-version",
216
- "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",
217
209
  "check:are-the-types-wrong": "attw --pack . --entrypoints .",
218
210
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
219
211
  "ci:build:docs": "api-extractor run",
@@ -227,9 +219,11 @@
227
219
  "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
228
220
  "test": "npm run test:mocha",
229
221
  "test:coverage": "c8 npm test",
230
- "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",
231
225
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
232
- "tsc": "tsc",
226
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
233
227
  "tsc:watch": "tsc --watch",
234
228
  "typetests:gen": "fluid-type-test-generator",
235
229
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
package/src/attachment.ts CHANGED
@@ -7,9 +7,9 @@ import { CombinedAppAndProtocolSummary } from "@fluidframework/driver-utils";
7
7
  import { ISnapshotTree, ISummaryTree } from "@fluidframework/protocol-definitions";
8
8
  import { assert } from "@fluidframework/core-utils";
9
9
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
10
- import { getSnapshotTreeAndBlobsFromSerializedContainer } from "./utils";
11
- import { ISerializableBlobContents } from "./containerStorageAdapter";
12
- import { IDetachedBlobStorage } from ".";
10
+ import { getSnapshotTreeAndBlobsFromSerializedContainer } from "./utils.js";
11
+ import { ISerializableBlobContents } from "./containerStorageAdapter.js";
12
+ import { IDetachedBlobStorage } from "./index.js";
13
13
 
14
14
  /**
15
15
  * The default state a newly created detached container will have.
@@ -65,10 +65,6 @@ export interface AttachingDataWithoutBlobs {
65
65
  */
66
66
  export interface AttachedData {
67
67
  readonly state: AttachState.Attached;
68
- readonly snapshot?: {
69
- tree: ISnapshotTree;
70
- blobs: ISerializableBlobContents;
71
- };
72
68
  }
73
69
 
74
70
  /**
@@ -136,7 +132,9 @@ export interface AttachProcessProps {
136
132
  *
137
133
  * @param props - The data and services necessary to run the attachment process
138
134
  */
139
- export const runRetriableAttachProcess = async (props: AttachProcessProps): Promise<void> => {
135
+ export const runRetriableAttachProcess = async (
136
+ props: AttachProcessProps,
137
+ ): Promise<{ tree: ISnapshotTree; blobs: ISerializableBlobContents } | undefined> => {
140
138
  const {
141
139
  detachedBlobStorage,
142
140
  createOrGetStorageService,
@@ -195,7 +193,10 @@ export const runRetriableAttachProcess = async (props: AttachProcessProps): Prom
195
193
  );
196
194
  }
197
195
 
198
- assert(currentData.state === AttachState.Attaching, "must be attaching by this point");
196
+ assert(
197
+ currentData.state === AttachState.Attaching,
198
+ 0x8e2 /* must be attaching by this point */,
199
+ );
199
200
 
200
201
  if (currentData.blobs === "done") {
201
202
  // done means outstanding blobs were uploaded.
@@ -208,12 +209,14 @@ export const runRetriableAttachProcess = async (props: AttachProcessProps): Prom
208
209
  });
209
210
  }
210
211
 
212
+ const snapshot = offlineLoadEnabled
213
+ ? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)
214
+ : undefined;
215
+
211
216
  setAttachmentData(
212
217
  (currentData = {
213
218
  state: AttachState.Attached,
214
- snapshot: offlineLoadEnabled
215
- ? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)
216
- : undefined,
217
219
  }),
218
220
  );
221
+ return snapshot;
219
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);