@fluidframework/odsp-driver 2.118.1 → 3.0.1

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 (234) hide show
  1. package/CHANGELOG.md +45 -11
  2. package/README.md +53 -50
  3. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
  4. package/api-report/odsp-driver.legacy.alpha.api.md +1 -3
  5. package/api-report/odsp-driver.legacy.beta.api.md +1 -3
  6. package/dist/ReadBufferUtils.js +2 -1
  7. package/dist/ReadBufferUtils.js.map +1 -1
  8. package/dist/WriteBufferUtils.js +4 -6
  9. package/dist/WriteBufferUtils.js.map +1 -1
  10. package/dist/checkUrl.js +1 -2
  11. package/dist/checkUrl.js.map +1 -1
  12. package/dist/compactSnapshotParser.d.ts.map +1 -1
  13. package/dist/compactSnapshotParser.js +5 -4
  14. package/dist/compactSnapshotParser.js.map +1 -1
  15. package/dist/compactSnapshotWriter.js +1 -2
  16. package/dist/compactSnapshotWriter.js.map +1 -1
  17. package/dist/createFile/createFile.js +4 -5
  18. package/dist/createFile/createFile.js.map +1 -1
  19. package/dist/createFile/createNewContainerOnExistingFile.js +1 -2
  20. package/dist/createFile/createNewContainerOnExistingFile.js.map +1 -1
  21. package/dist/createFile/createNewUtils.d.ts.map +1 -1
  22. package/dist/createFile/createNewUtils.js +4 -5
  23. package/dist/createFile/createNewUtils.js.map +1 -1
  24. package/dist/createFile/index.js +1 -2
  25. package/dist/createFile/index.js.map +1 -1
  26. package/dist/createOdspCreateContainerRequest.js +1 -2
  27. package/dist/createOdspCreateContainerRequest.js.map +1 -1
  28. package/dist/createOdspUrl.js +1 -2
  29. package/dist/createOdspUrl.js.map +1 -1
  30. package/dist/epochTracker.d.ts.map +1 -1
  31. package/dist/epochTracker.js +17 -6
  32. package/dist/epochTracker.js.map +1 -1
  33. package/dist/fetchSnapshot.d.ts.map +1 -1
  34. package/dist/fetchSnapshot.js +5 -5
  35. package/dist/fetchSnapshot.js.map +1 -1
  36. package/dist/getFileLink.d.ts.map +1 -1
  37. package/dist/getQueryString.js +1 -2
  38. package/dist/getQueryString.js.map +1 -1
  39. package/dist/getUrlAndHeadersWithAuth.js +1 -2
  40. package/dist/getUrlAndHeadersWithAuth.js.map +1 -1
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +2 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/legacy.d.ts +0 -1
  46. package/dist/legacyAlpha.d.ts +0 -1
  47. package/dist/localOdspDriver/localOdspDeltaStorageService.js +2 -0
  48. package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
  49. package/dist/localOdspDriver/localOdspDocumentService.js +5 -1
  50. package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
  51. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +2 -1
  52. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  53. package/dist/localOdspDriver/localOdspDocumentStorageManager.js +4 -1
  54. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  55. package/dist/mockify.js +2 -2
  56. package/dist/mockify.js.map +1 -1
  57. package/dist/odspCache.js +7 -8
  58. package/dist/odspCache.js.map +1 -1
  59. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  60. package/dist/odspDelayLoadedDeltaStream.js +42 -26
  61. package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
  62. package/dist/odspDeltaStorageService.js +14 -1
  63. package/dist/odspDeltaStorageService.js.map +1 -1
  64. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  65. package/dist/odspDocumentDeltaConnection.js +58 -41
  66. package/dist/odspDocumentDeltaConnection.js.map +1 -1
  67. package/dist/odspDocumentService.js +16 -1
  68. package/dist/odspDocumentService.js.map +1 -1
  69. package/dist/odspDocumentServiceFactory.d.ts +1 -17
  70. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  71. package/dist/odspDocumentServiceFactory.js +14 -45
  72. package/dist/odspDocumentServiceFactory.js.map +1 -1
  73. package/dist/odspDocumentServiceFactoryCore.d.ts +9 -0
  74. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  75. package/dist/odspDocumentServiceFactoryCore.js +38 -9
  76. package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
  77. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  78. package/dist/odspDocumentStorageManager.js +31 -13
  79. package/dist/odspDocumentStorageManager.js.map +1 -1
  80. package/dist/odspDocumentStorageServiceBase.js +23 -20
  81. package/dist/odspDocumentStorageServiceBase.js.map +1 -1
  82. package/dist/odspDriverUrlResolver.js +2 -2
  83. package/dist/odspDriverUrlResolver.js.map +1 -1
  84. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  85. package/dist/odspDriverUrlResolverForShareLink.js +6 -1
  86. package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
  87. package/dist/odspError.js +1 -2
  88. package/dist/odspError.js.map +1 -1
  89. package/dist/odspFluidFileLink.js +4 -4
  90. package/dist/odspFluidFileLink.js.map +1 -1
  91. package/dist/odspLayerCompatState.d.ts +8 -1
  92. package/dist/odspLayerCompatState.d.ts.map +1 -1
  93. package/dist/odspLayerCompatState.js +20 -1
  94. package/dist/odspLayerCompatState.js.map +1 -1
  95. package/dist/odspLocationRedirection.js +1 -2
  96. package/dist/odspLocationRedirection.js.map +1 -1
  97. package/dist/odspPublicUtils.js +1 -2
  98. package/dist/odspPublicUtils.js.map +1 -1
  99. package/dist/odspSnapshotParser.js +1 -2
  100. package/dist/odspSnapshotParser.js.map +1 -1
  101. package/dist/odspSummaryUploadManager.js +7 -0
  102. package/dist/odspSummaryUploadManager.js.map +1 -1
  103. package/dist/odspUrlHelper.js +6 -7
  104. package/dist/odspUrlHelper.js.map +1 -1
  105. package/dist/odspUtils.d.ts.map +1 -1
  106. package/dist/odspUtils.js +21 -21
  107. package/dist/odspUtils.js.map +1 -1
  108. package/dist/odspVersionManager/odspFileVersionFetcher.js +1 -2
  109. package/dist/odspVersionManager/odspFileVersionFetcher.js.map +1 -1
  110. package/dist/odspVersionManager/odspVersionManager.js +9 -8
  111. package/dist/odspVersionManager/odspVersionManager.js.map +1 -1
  112. package/dist/opsCaching.js +7 -1
  113. package/dist/opsCaching.js.map +1 -1
  114. package/dist/packageVersion.d.ts +1 -1
  115. package/dist/packageVersion.d.ts.map +1 -1
  116. package/dist/packageVersion.js +1 -1
  117. package/dist/packageVersion.js.map +1 -1
  118. package/dist/pointInTimeDriver/createPointInTimeDocumentService.d.ts.map +1 -1
  119. package/dist/pointInTimeDriver/createPointInTimeDocumentService.js +15 -4
  120. package/dist/pointInTimeDriver/createPointInTimeDocumentService.js.map +1 -1
  121. package/dist/pointInTimeDriver/odspPointInTimeDocumentService.js +10 -6
  122. package/dist/pointInTimeDriver/odspPointInTimeDocumentService.js.map +1 -1
  123. package/dist/prefetchLatestSnapshot.js +1 -2
  124. package/dist/prefetchLatestSnapshot.js.map +1 -1
  125. package/dist/retryErrorsStorageAdapter.js +3 -1
  126. package/dist/retryErrorsStorageAdapter.js.map +1 -1
  127. package/dist/retryUtils.js +1 -2
  128. package/dist/retryUtils.js.map +1 -1
  129. package/dist/vroom.d.ts.map +1 -1
  130. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  131. package/dist/zipItDataRepresentationUtils.js +20 -15
  132. package/dist/zipItDataRepresentationUtils.js.map +1 -1
  133. package/lib/ReadBufferUtils.js +2 -1
  134. package/lib/ReadBufferUtils.js.map +1 -1
  135. package/lib/WriteBufferUtils.js +2 -4
  136. package/lib/WriteBufferUtils.js.map +1 -1
  137. package/lib/compactSnapshotParser.d.ts.map +1 -1
  138. package/lib/compactSnapshotParser.js +3 -2
  139. package/lib/compactSnapshotParser.js.map +1 -1
  140. package/lib/createFile/createNewUtils.d.ts.map +1 -1
  141. package/lib/createFile/createNewUtils.js +2 -2
  142. package/lib/createFile/createNewUtils.js.map +1 -1
  143. package/lib/epochTracker.d.ts.map +1 -1
  144. package/lib/epochTracker.js +15 -4
  145. package/lib/epochTracker.js.map +1 -1
  146. package/lib/fetchSnapshot.d.ts.map +1 -1
  147. package/lib/getFileLink.d.ts.map +1 -1
  148. package/lib/index.d.ts +2 -2
  149. package/lib/index.d.ts.map +1 -1
  150. package/lib/index.js +2 -2
  151. package/lib/index.js.map +1 -1
  152. package/lib/legacy.d.ts +1 -2
  153. package/lib/legacyAlpha.d.ts +1 -2
  154. package/lib/localOdspDriver/localOdspDeltaStorageService.js +2 -0
  155. package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
  156. package/lib/localOdspDriver/localOdspDocumentService.js +5 -1
  157. package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -1
  158. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js +2 -1
  159. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  160. package/lib/localOdspDriver/localOdspDocumentStorageManager.js +4 -1
  161. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  162. package/lib/odspCache.js +7 -8
  163. package/lib/odspCache.js.map +1 -1
  164. package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  165. package/lib/odspDelayLoadedDeltaStream.js +42 -26
  166. package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
  167. package/lib/odspDeltaStorageService.js +14 -1
  168. package/lib/odspDeltaStorageService.js.map +1 -1
  169. package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
  170. package/lib/odspDocumentDeltaConnection.js +58 -41
  171. package/lib/odspDocumentDeltaConnection.js.map +1 -1
  172. package/lib/odspDocumentService.js +16 -1
  173. package/lib/odspDocumentService.js.map +1 -1
  174. package/lib/odspDocumentServiceFactory.d.ts +1 -17
  175. package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
  176. package/lib/odspDocumentServiceFactory.js +11 -41
  177. package/lib/odspDocumentServiceFactory.js.map +1 -1
  178. package/lib/odspDocumentServiceFactoryCore.d.ts +9 -0
  179. package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  180. package/lib/odspDocumentServiceFactoryCore.js +39 -10
  181. package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
  182. package/lib/odspDocumentStorageManager.d.ts.map +1 -1
  183. package/lib/odspDocumentStorageManager.js +32 -14
  184. package/lib/odspDocumentStorageManager.js.map +1 -1
  185. package/lib/odspDocumentStorageServiceBase.js +23 -20
  186. package/lib/odspDocumentStorageServiceBase.js.map +1 -1
  187. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  188. package/lib/odspDriverUrlResolverForShareLink.js +6 -1
  189. package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
  190. package/lib/odspLayerCompatState.d.ts +8 -1
  191. package/lib/odspLayerCompatState.d.ts.map +1 -1
  192. package/lib/odspLayerCompatState.js +20 -1
  193. package/lib/odspLayerCompatState.js.map +1 -1
  194. package/lib/odspSummaryUploadManager.js +7 -0
  195. package/lib/odspSummaryUploadManager.js.map +1 -1
  196. package/lib/odspUtils.d.ts.map +1 -1
  197. package/lib/odspVersionManager/odspVersionManager.js +7 -6
  198. package/lib/odspVersionManager/odspVersionManager.js.map +1 -1
  199. package/lib/opsCaching.js +7 -1
  200. package/lib/opsCaching.js.map +1 -1
  201. package/lib/packageVersion.d.ts +1 -1
  202. package/lib/packageVersion.d.ts.map +1 -1
  203. package/lib/packageVersion.js +1 -1
  204. package/lib/packageVersion.js.map +1 -1
  205. package/lib/pointInTimeDriver/createPointInTimeDocumentService.d.ts.map +1 -1
  206. package/lib/pointInTimeDriver/createPointInTimeDocumentService.js +13 -1
  207. package/lib/pointInTimeDriver/createPointInTimeDocumentService.js.map +1 -1
  208. package/lib/pointInTimeDriver/odspPointInTimeDocumentService.js +10 -6
  209. package/lib/pointInTimeDriver/odspPointInTimeDocumentService.js.map +1 -1
  210. package/lib/public.d.ts +1 -1
  211. package/lib/retryErrorsStorageAdapter.js +3 -1
  212. package/lib/retryErrorsStorageAdapter.js.map +1 -1
  213. package/lib/vroom.d.ts.map +1 -1
  214. package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
  215. package/lib/zipItDataRepresentationUtils.js +10 -5
  216. package/lib/zipItDataRepresentationUtils.js.map +1 -1
  217. package/package.json +43 -62
  218. package/src/compactSnapshotParser.ts +6 -2
  219. package/src/createFile/createNewUtils.ts +6 -2
  220. package/src/index.ts +4 -2
  221. package/src/odspDocumentServiceFactory.ts +0 -34
  222. package/src/odspDocumentServiceFactoryCore.ts +15 -1
  223. package/src/odspDocumentStorageManager.ts +2 -2
  224. package/src/odspLayerCompatState.ts +29 -1
  225. package/src/packageVersion.ts +1 -1
  226. package/src/pointInTimeDriver/createPointInTimeDocumentService.ts +19 -6
  227. package/src/zipItDataRepresentationUtils.ts +3 -3
  228. package/tsconfig.json +1 -1
  229. package/internal.d.ts +0 -11
  230. package/legacy/alpha.d.ts +0 -11
  231. package/legacy/point-in-time.d.ts +0 -6
  232. package/legacy.d.ts +0 -11
  233. /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
  234. /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,gCAAgC,CAAC;AACrD,eAAO,MAAM,UAAU,YAAY,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,gCAAgC,CAAC;AACrD,eAAO,MAAM,UAAU,UAAU,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/odsp-driver";
11
- exports.pkgVersion = "2.118.1";
11
+ exports.pkgVersion = "3.0.1";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,UAAU,GAAG,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.118.1\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"3.0.1\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createPointInTimeDocumentService.d.ts","sourceRoot":"","sources":["../../src/pointInTimeDriver/createPointInTimeDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlF,OAAO,KAAK,EAAE,kDAAkD,EAAE,MAAM,sCAAsC,CAAC;AAM/G,OAAO,EAEN,KAAK,mBAAmB,EAExB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,UAAU,uCAAuC;IAChD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC/B,eAAe,EAAE,gBAAgB,EACjC,MAAM,EAAE,kBAAkB,EAC1B,YAAY,EAAE,YAAY,KACtB,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACxD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAC7B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,KACf,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1C;AA+CD;;;;;;;;;;GAUG;AACH,wBAAsB,gCAAgC,CACrD,KAAK,EAAE,kDAAkD,GACvD,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,CACzD,EACC,WAAW,EACX,oBAAoB,EACpB,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,qBAAqB,GACrB,EAAE,kDAAkD,EACrD,YAAY,GAAE,uCAA4C,GACxD,OAAO,CAAC,8BAA8B,CAAC,CAsDzC"}
1
+ {"version":3,"file":"createPointInTimeDocumentService.d.ts","sourceRoot":"","sources":["../../src/pointInTimeDriver/createPointInTimeDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlF,OAAO,KAAK,EAAE,kDAAkD,EAAE,MAAM,sCAAsC,CAAC;AAM/G,OAAO,EAEN,KAAK,mBAAmB,EAExB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,UAAU,uCAAuC;IAChD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC/B,eAAe,EAAE,gBAAgB,EACjC,MAAM,EAAE,kBAAkB,EAC1B,YAAY,EAAE,YAAY,KACtB,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACxD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAC7B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,KACf,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1C;AA+CD;;;;;;;;;;GAUG;AACH,wBAAsB,gCAAgC,CACrD,KAAK,EAAE,kDAAkD,GACvD,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,CACzD,EACC,WAAW,EACX,oBAAoB,EACpB,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,qBAAqB,GACrB,EAAE,kDAAkD,EACrD,YAAY,GAAE,uCAA4C,GACxD,OAAO,CAAC,8BAA8B,CAAC,CAmEzC"}
@@ -4,7 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createPointInTimeDocumentServiceCore = exports.createPointInTimeDocumentService = void 0;
7
+ exports.createPointInTimeDocumentService = createPointInTimeDocumentService;
8
+ exports.createPointInTimeDocumentServiceCore = createPointInTimeDocumentServiceCore;
8
9
  const internal_1 = require("@fluidframework/driver-utils/internal");
9
10
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
11
  const epochTracker_js_1 = require("../epochTracker.js");
@@ -58,7 +59,6 @@ async function resolveFileVersion(resolvedUrl, fileVersion) {
58
59
  async function createPointInTimeDocumentService(props) {
59
60
  return createPointInTimeDocumentServiceCore(props);
60
61
  }
61
- exports.createPointInTimeDocumentService = createPointInTimeDocumentService;
62
62
  /**
63
63
  * Creates the point-in-time service with replaceable dependencies for testing.
64
64
  * @internal
@@ -83,8 +83,19 @@ async function createPointInTimeDocumentServiceCore({ resolvedUrl, targetSequenc
83
83
  }
84
84
  const recoverableResolvedUrl = await (dependencies.resolveFileVersion ?? resolveFileVersion)(resolvedUrl, baseResult.base.versionId);
85
85
  const recoverableDocumentService = await createDocumentService(recoverableResolvedUrl, odspLogger, cacheAndTracker, clientIsSummarizer);
86
- const liveDocumentService = await createDocumentService(resolvedUrl, odspLogger, cacheAndTracker, clientIsSummarizer);
86
+ let liveDocumentService;
87
+ try {
88
+ liveDocumentService = await createDocumentService(resolvedUrl, odspLogger, cacheAndTracker, clientIsSummarizer);
89
+ }
90
+ catch (error) {
91
+ try {
92
+ recoverableDocumentService.dispose();
93
+ }
94
+ catch (disposeError) {
95
+ extLogger.sendErrorEvent({ eventName: "PointInTimeRecoverableDocumentServiceDisposeError" }, disposeError);
96
+ }
97
+ throw error;
98
+ }
87
99
  return new odspPointInTimeDocumentService_js_1.OdspPointInTimeDocumentService(recoverableResolvedUrl, recoverableDocumentService, liveDocumentService, targetSequenceNumber);
88
100
  }
89
- exports.createPointInTimeDocumentServiceCore = createPointInTimeDocumentServiceCore;
90
101
  //# sourceMappingURL=createPointInTimeDocumentService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createPointInTimeDocumentService.js","sourceRoot":"","sources":["../../src/pointInTimeDriver/createPointInTimeDocumentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,oEAAmE;AAKnE,uEAGkD;AAElD,wDAAkF;AAClF,kDAAqD;AACrD,0EAAoE;AAEpE,kDAIyB;AACzB,uFAIqD;AAErD,2FAAqF;AAcrF,KAAK,UAAU,oBAAoB,CAClC,eAAiC,EACjC,MAA0B,EAC1B,YAA0B,EAC1B,eAAsF;IAEtF,MAAM,QAAQ,GAAkB;QAC/B,OAAO,EAAE,eAAe,CAAC,OAAO;QAChC,OAAO,EAAE,eAAe,CAAC,O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CAAC;IACF,MAAM,0BAA0B,GAAG,MAAM,qBAAqB,CAC7D,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,kBAAkB,CAClB,CAAC;IACF,MAAM,mBAAmB,GAAG,MAAM,qBAAqB,CACtD,WAAW,EACX,UAAU,EACV,eAAe,EACf,kBAAkB,CAClB,CAAC;IACF,OAAO,IAAI,kEAA8B,CACxC,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,CACpB,CAAC;AACH,CAAC;AAjED,oFAiEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIDocumentService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tIOdspResolvedUrl,\n\tIOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tcreateChildLogger,\n\ttype TelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { createOdspCacheAndTracker, type EpochTracker } from \"../epochTracker.js\";\nimport { NonPersistentCache } from \"../odspCache.js\";\nimport { OdspDriverUrlResolver } from \"../odspDriverUrlResolver.js\";\nimport type { IOdspPointInTimeDocumentServiceImplementationProps } from \"../odspDocumentServiceFactoryCore.js\";\nimport {\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\ttoInstrumentedOdspStorageTokenFetcher,\n} from \"../odspUtils.js\";\nimport {\n\tcreateOdspVersionManager,\n\ttype IOdspVersionManager,\n\t// eslint-disable-next-line import-x/no-internal-modules -- the feature implementation owns version selection\n} from \"../odspVersionManager/odspVersionManager.js\";\n\nimport { OdspPointInTimeDocumentService } from \"./odspPointInTimeDocumentService.js\";\n\ninterface IPointInTimeDocumentServiceDependencies {\n\treadonly createVersionManager?: (\n\t\todspResolvedUrl: IOdspResolvedUrl,\n\t\tlogger: TelemetryLoggerExt,\n\t\tepochTracker: EpochTracker,\n\t) => IOdspVersionManager | Promise<IOdspVersionManager>;\n\treadonly resolveFileVersion?: (\n\t\tresolvedUrl: IResolvedUrl,\n\t\tfileVersion: string,\n\t) => IResolvedUrl | Promise<IResolvedUrl>;\n}\n\nasync function createVersionManager(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tlogger: TelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n\tgetStorageToken: IOdspPointInTimeDocumentServiceImplementationProps[\"getStorageToken\"],\n): Promise<IOdspVersionManager> {\n\tconst urlParts: IOdspUrlParts = {\n\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\tdriveId: odspResolvedUrl.driveId,\n\t\titemId: odspResolvedUrl.itemId,\n\t};\n\tconst getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\tlogger,\n\t\turlParts,\n\t\tgetStorageToken,\n\t);\n\treturn createOdspVersionManager({\n\t\turlParts,\n\t\tgetAuthHeader,\n\t\tepochTracker,\n\t\tlogger,\n\t});\n}\n\nasync function resolveFileVersion(\n\tresolvedUrl: IResolvedUrl,\n\tfileVersion: string,\n): Promise<IResolvedUrl> {\n\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\tconst query = new URLSearchParams({\n\t\tdriveId: odspResolvedUrl.driveId,\n\t\titemId: odspResolvedUrl.itemId,\n\t\tfileVersion,\n\t});\n\tif (odspResolvedUrl.dataStorePath !== undefined) {\n\t\tquery.set(\"path\", odspResolvedUrl.dataStorePath);\n\t}\n\tif (odspResolvedUrl.codeHint?.containerPackageName !== undefined) {\n\t\tquery.set(\"containerPackageName\", odspResolvedUrl.codeHint.containerPackageName);\n\t}\n\treturn new OdspDriverUrlResolver().resolve({\n\t\turl: `${odspResolvedUrl.siteUrl}?${query.toString()}`,\n\t});\n}\n\n/**\n * ODSP's point-in-time document service implementation.\n *\n * @remarks Import this function from the dedicated point-in-time entrypoint and inject it through\n * {@link IOdspDocumentServiceFactoryOptions.pointInTimeDocumentServiceImplementation}.\n *\n * @param props - ODSP service dependencies and point-in-time load parameters supplied by the factory.\n * @returns A read-only ODSP document service materialized at the requested sequence number.\n *\n * @legacy @beta\n */\nexport async function createPointInTimeDocumentService(\n\tprops: IOdspPointInTimeDocumentServiceImplementationProps,\n): Promise<IDocumentService> {\n\treturn createPointInTimeDocumentServiceCore(props);\n}\n\n/**\n * Creates the point-in-time service with replaceable dependencies for testing.\n * @internal\n */\nexport async function createPointInTimeDocumentServiceCore(\n\t{\n\t\tresolvedUrl,\n\t\ttargetSequenceNumber,\n\t\tlogger,\n\t\tclientIsSummarizer,\n\t\tpersistedCache,\n\t\tgetStorageToken,\n\t\tcreateDocumentService,\n\t}: IOdspPointInTimeDocumentServiceImplementationProps,\n\tdependencies: IPointInTimeDocumentServiceDependencies = {},\n): Promise<OdspPointInTimeDocumentService> {\n\tconst odspLogger = createOdspLogger(logger);\n\tconst extLogger = createChildLogger({ logger: odspLogger });\n\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\tconst cacheAndTracker = createOdspCacheAndTracker(\n\t\tpersistedCache,\n\t\tnew NonPersistentCache(),\n\t\t{\n\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t\tfileVersion: odspResolvedUrl.fileVersion,\n\t\t},\n\t\textLogger,\n\t\tclientIsSummarizer,\n\t);\n\n\tconst versionManager = await (\n\t\tdependencies.createVersionManager ??\n\t\t(async (url, versionLogger, epochTracker) =>\n\t\t\tcreateVersionManager(url, versionLogger, epochTracker, getStorageToken))\n\t)(odspResolvedUrl, extLogger, cacheAndTracker.epochTracker);\n\tconst baseResult = await versionManager.findBaseForSeq(targetSequenceNumber);\n\tif (baseResult.kind === \"noBaseVersion\") {\n\t\tconst oldestResolvedSequenceDetail =\n\t\t\tbaseResult.oldestResolvedSeq === undefined\n\t\t\t\t? \"\"\n\t\t\t\t: ` The oldest resolved file version is at sequence number ${baseResult.oldestResolvedSeq}.`;\n\t\tthrow new UsageError(\n\t\t\t`No ODSP file version is available at or before sequence number ${targetSequenceNumber}.${oldestResolvedSequenceDetail}`,\n\t\t);\n\t}\n\n\tconst recoverableResolvedUrl = await (dependencies.resolveFileVersion ?? resolveFileVersion)(\n\t\tresolvedUrl,\n\t\tbaseResult.base.versionId,\n\t);\n\tconst recoverableDocumentService = await createDocumentService(\n\t\trecoverableResolvedUrl,\n\t\todspLogger,\n\t\tcacheAndTracker,\n\t\tclientIsSummarizer,\n\t);\n\tconst liveDocumentService = await createDocumentService(\n\t\tresolvedUrl,\n\t\todspLogger,\n\t\tcacheAndTracker,\n\t\tclientIsSummarizer,\n\t);\n\treturn new OdspPointInTimeDocumentService(\n\t\trecoverableResolvedUrl,\n\t\trecoverableDocumentService,\n\t\tliveDocumentService,\n\t\ttargetSequenceNumber,\n\t);\n}\n"]}
1
+ {"version":3,"file":"createPointInTimeDocumentService.js","sourceRoot":"","sources":["../../src/pointInTimeDriver/createPointInTimeDocumentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAqGH,4EAIC;AAMD,oFA8EC;AAvLD,oEAAmE;AAKnE,uEAGkD;AAElD,wDAAkF;AAClF,kDAAqD;AACrD,0EAAoE;AAEpE,kDAIyB;AACzB,uFAIqD;AAErD,2FAAqF;AAcrF,KAAK,UAAU,oBAAoB,CAClC,eAAiC,EACjC,MAA0B,EAC1B,YAA0B,EAC1B,eAAsF;IAEtF,MAAM,QAAQ,GAAkB;QAC/B,OAAO,EAAE,eAAe,CAAC,OAAO;QAChC,OAAO,EAAE,eAAe,CAAC,OAAO;QAChC,MAAM,EAAE,eAAe,CAAC,MAAM;KAC9B,CAAC;IACF,MAAM,aAAa,GAAG,IAAA,oDAAqC,EAC1D,MAAM,EACN,QAAQ,EACR,eAAe,CACf,CAAC;IACF,OAAO,IAAA,gDAAwB,EAAC;QAC/B,QAAQ;QACR,aAAa;QACb,YAAY;QACZ,MAAM;KACN,CAAC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,kBAAkB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AAC;QAChB,IAAI,CAAC;YACJ,0BAA0B,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC;QAAC,OAAO,YAAY,EAAE,CAAC;YACvB,SAAS,CAAC,cAAc,CACvB,EAAE,SAAS,EAAE,mDAAmD,EAAE,EAClE,YAAY,CACZ,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;IACD,OAAO,IAAI,kEAA8B,CACxC,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,CACpB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIDocumentService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tIOdspResolvedUrl,\n\tIOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tcreateChildLogger,\n\ttype TelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { createOdspCacheAndTracker, type EpochTracker } from \"../epochTracker.js\";\nimport { NonPersistentCache } from \"../odspCache.js\";\nimport { OdspDriverUrlResolver } from \"../odspDriverUrlResolver.js\";\nimport type { IOdspPointInTimeDocumentServiceImplementationProps } from \"../odspDocumentServiceFactoryCore.js\";\nimport {\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\ttoInstrumentedOdspStorageTokenFetcher,\n} from \"../odspUtils.js\";\nimport {\n\tcreateOdspVersionManager,\n\ttype IOdspVersionManager,\n\t// eslint-disable-next-line import-x/no-internal-modules -- the feature implementation owns version selection\n} from \"../odspVersionManager/odspVersionManager.js\";\n\nimport { OdspPointInTimeDocumentService } from \"./odspPointInTimeDocumentService.js\";\n\ninterface IPointInTimeDocumentServiceDependencies {\n\treadonly createVersionManager?: (\n\t\todspResolvedUrl: IOdspResolvedUrl,\n\t\tlogger: TelemetryLoggerExt,\n\t\tepochTracker: EpochTracker,\n\t) => IOdspVersionManager | Promise<IOdspVersionManager>;\n\treadonly resolveFileVersion?: (\n\t\tresolvedUrl: IResolvedUrl,\n\t\tfileVersion: string,\n\t) => IResolvedUrl | Promise<IResolvedUrl>;\n}\n\nasync function createVersionManager(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tlogger: TelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n\tgetStorageToken: IOdspPointInTimeDocumentServiceImplementationProps[\"getStorageToken\"],\n): Promise<IOdspVersionManager> {\n\tconst urlParts: IOdspUrlParts = {\n\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\tdriveId: odspResolvedUrl.driveId,\n\t\titemId: odspResolvedUrl.itemId,\n\t};\n\tconst getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\tlogger,\n\t\turlParts,\n\t\tgetStorageToken,\n\t);\n\treturn createOdspVersionManager({\n\t\turlParts,\n\t\tgetAuthHeader,\n\t\tepochTracker,\n\t\tlogger,\n\t});\n}\n\nasync function resolveFileVersion(\n\tresolvedUrl: IResolvedUrl,\n\tfileVersion: string,\n): Promise<IResolvedUrl> {\n\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\tconst query = new URLSearchParams({\n\t\tdriveId: odspResolvedUrl.driveId,\n\t\titemId: odspResolvedUrl.itemId,\n\t\tfileVersion,\n\t});\n\tif (odspResolvedUrl.dataStorePath !== undefined) {\n\t\tquery.set(\"path\", odspResolvedUrl.dataStorePath);\n\t}\n\tif (odspResolvedUrl.codeHint?.containerPackageName !== undefined) {\n\t\tquery.set(\"containerPackageName\", odspResolvedUrl.codeHint.containerPackageName);\n\t}\n\treturn new OdspDriverUrlResolver().resolve({\n\t\turl: `${odspResolvedUrl.siteUrl}?${query.toString()}`,\n\t});\n}\n\n/**\n * ODSP's point-in-time document service implementation.\n *\n * @remarks Import this function from the dedicated point-in-time entrypoint and inject it through\n * {@link IOdspDocumentServiceFactoryOptions.pointInTimeDocumentServiceImplementation}.\n *\n * @param props - ODSP service dependencies and point-in-time load parameters supplied by the factory.\n * @returns A read-only ODSP document service materialized at the requested sequence number.\n *\n * @legacy @beta\n */\nexport async function createPointInTimeDocumentService(\n\tprops: IOdspPointInTimeDocumentServiceImplementationProps,\n): Promise<IDocumentService> {\n\treturn createPointInTimeDocumentServiceCore(props);\n}\n\n/**\n * Creates the point-in-time service with replaceable dependencies for testing.\n * @internal\n */\nexport async function createPointInTimeDocumentServiceCore(\n\t{\n\t\tresolvedUrl,\n\t\ttargetSequenceNumber,\n\t\tlogger,\n\t\tclientIsSummarizer,\n\t\tpersistedCache,\n\t\tgetStorageToken,\n\t\tcreateDocumentService,\n\t}: IOdspPointInTimeDocumentServiceImplementationProps,\n\tdependencies: IPointInTimeDocumentServiceDependencies = {},\n): Promise<OdspPointInTimeDocumentService> {\n\tconst odspLogger = createOdspLogger(logger);\n\tconst extLogger = createChildLogger({ logger: odspLogger });\n\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\tconst cacheAndTracker = createOdspCacheAndTracker(\n\t\tpersistedCache,\n\t\tnew NonPersistentCache(),\n\t\t{\n\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t\tfileVersion: odspResolvedUrl.fileVersion,\n\t\t},\n\t\textLogger,\n\t\tclientIsSummarizer,\n\t);\n\n\tconst versionManager = await (\n\t\tdependencies.createVersionManager ??\n\t\t(async (url, versionLogger, epochTracker) =>\n\t\t\tcreateVersionManager(url, versionLogger, epochTracker, getStorageToken))\n\t)(odspResolvedUrl, extLogger, cacheAndTracker.epochTracker);\n\tconst baseResult = await versionManager.findBaseForSeq(targetSequenceNumber);\n\tif (baseResult.kind === \"noBaseVersion\") {\n\t\tconst oldestResolvedSequenceDetail =\n\t\t\tbaseResult.oldestResolvedSeq === undefined\n\t\t\t\t? \"\"\n\t\t\t\t: ` The oldest resolved file version is at sequence number ${baseResult.oldestResolvedSeq}.`;\n\t\tthrow new UsageError(\n\t\t\t`No ODSP file version is available at or before sequence number ${targetSequenceNumber}.${oldestResolvedSequenceDetail}`,\n\t\t);\n\t}\n\n\tconst recoverableResolvedUrl = await (dependencies.resolveFileVersion ?? resolveFileVersion)(\n\t\tresolvedUrl,\n\t\tbaseResult.base.versionId,\n\t);\n\tconst recoverableDocumentService = await createDocumentService(\n\t\trecoverableResolvedUrl,\n\t\todspLogger,\n\t\tcacheAndTracker,\n\t\tclientIsSummarizer,\n\t);\n\tlet liveDocumentService: IDocumentService;\n\ttry {\n\t\tliveDocumentService = await createDocumentService(\n\t\t\tresolvedUrl,\n\t\t\todspLogger,\n\t\t\tcacheAndTracker,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t} catch (error) {\n\t\ttry {\n\t\t\trecoverableDocumentService.dispose();\n\t\t} catch (disposeError) {\n\t\t\textLogger.sendErrorEvent(\n\t\t\t\t{ eventName: \"PointInTimeRecoverableDocumentServiceDisposeError\" },\n\t\t\t\tdisposeError,\n\t\t\t);\n\t\t}\n\t\tthrow error;\n\t}\n\treturn new OdspPointInTimeDocumentService(\n\t\trecoverableResolvedUrl,\n\t\trecoverableDocumentService,\n\t\tliveDocumentService,\n\t\ttargetSequenceNumber,\n\t);\n}\n"]}
@@ -29,6 +29,10 @@ const client_utils_1 = require("@fluid-internal/client-utils");
29
29
  * @internal
30
30
  */
31
31
  class OdspPointInTimeDocumentService extends client_utils_1.TypedEventEmitter {
32
+ resolvedUrl;
33
+ recoverableDocumentService;
34
+ liveDocumentService;
35
+ targetSequenceNumber;
32
36
  constructor(resolvedUrl,
33
37
  // Serves the snapshot: a read-only document service bound to the closest file version at or
34
38
  // before the target sequence number. Its storage is the base we replay ops on top of.
@@ -38,14 +42,11 @@ class OdspPointInTimeDocumentService extends client_utils_1.TypedEventEmitter {
38
42
  this.recoverableDocumentService = recoverableDocumentService;
39
43
  this.liveDocumentService = liveDocumentService;
40
44
  this.targetSequenceNumber = targetSequenceNumber;
41
- // storageOnly makes the connection manager synthesize a read-only frozen delta stream (no live
42
- // socket) and force the container read-only - see the class remarks.
43
- this.policies = { storageOnly: true };
44
- this.metadataUpdateHandler = (metadata) => {
45
- this.emit("metadataUpdate", metadata);
46
- };
47
45
  this.liveDocumentService.on("metadataUpdate", this.metadataUpdateHandler);
48
46
  }
47
+ // storageOnly makes the connection manager synthesize a read-only frozen delta stream (no live
48
+ // socket) and force the container read-only - see the class remarks.
49
+ policies = { storageOnly: true };
49
50
  dispose() {
50
51
  this.liveDocumentService.off("metadataUpdate", this.metadataUpdateHandler);
51
52
  this.recoverableDocumentService.dispose();
@@ -68,6 +69,9 @@ class OdspPointInTimeDocumentService extends client_utils_1.TypedEventEmitter {
68
69
  // Reaching here indicates a regression of that short-circuit.
69
70
  throw new Error("OdspPointInTimeDocumentService is storage-only; connectToDeltaStream should not be called");
70
71
  }
72
+ metadataUpdateHandler = (metadata) => {
73
+ this.emit("metadataUpdate", metadata);
74
+ };
71
75
  }
72
76
  exports.OdspPointInTimeDocumentService = OdspPointInTimeDocumentService;
73
77
  //# sourceMappingURL=odspPointInTimeDocumentService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"odspPointInTimeDocumentService.js","sourceRoot":"","sources":["../../src/pointInTimeDriver/odspPointInTimeDocumentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAYjE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,8BACZ,SAAQ,gCAAyC;IAGjD,YACiB,WAAyB;IACzC,4FAA4F;IAC5F,sFAAsF;IACrE,0BAA4C,EAC5C,mBAAqC,EACrC,oBAA4B;QAE7C,KAAK,EAAE,CAAC;QAPQ,gBAAW,GAAX,WAAW,CAAc;QAGxB,+BAA0B,GAA1B,0BAA0B,CAAkB;QAC5C,wBAAmB,GAAnB,mBAAmB,CAAkB;QACrC,yBAAoB,GAApB,oBAAoB,CAAQ;QAM9C,+FAA+F;QAC/F,qEAAqE;QACrD,aAAQ,GAA6B,EAAE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AKD;AA1DD,wEA0DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tIClient,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServicePolicies,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * A read-only document service that materializes a document at a target sequence number by combining\n * a recoverable snapshot with a bounded replay of live ops.\n *\n * @remarks\n * Storage (the snapshot) is served from the closest file version at or before the target sequence\n * number. The ops needed to advance from that snapshot to the target are read from the live\n * document's delta storage, bounded so that no op past the target is ever fetched.\n *\n * The service advertises the {@link IDocumentServicePolicies.storageOnly} policy. This reuses the\n * loader's \"frozen\" load mechanism: the connection manager synthesizes a read-only frozen delta\n * stream instead of opening a live socket, and forces the container read-only. The delta manager\n * still catches up from the snapshot's sequence number through delta storage, which is exactly the\n * bounded replay we want. As a result no live delta-stream connection is ever established.\n *\n * Op availability is enforced by the delta storage stack itself: it validates that fetched batches\n * are contiguous from the requested start, keeps requesting until the bounded range is fully\n * delivered, and fails the fetch if the ops never materialize. So a stream that completes has\n * necessarily served the whole bridge, and no additional checks are needed here.\n *\n * @internal\n */\nexport class OdspPointInTimeDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tpublic constructor(\n\t\tpublic readonly resolvedUrl: IResolvedUrl,\n\t\t// Serves the snapshot: a read-only document service bound to the closest file version at or\n\t\t// before the target sequence number. Its storage is the base we replay ops on top of.\n\t\tprivate readonly recoverableDocumentService: IDocumentService,\n\t\tprivate readonly liveDocumentService: IDocumentService,\n\t\tprivate readonly targetSequenceNumber: number,\n\t) {\n\t\tsuper();\n\t\tthis.liveDocumentService.on(\"metadataUpdate\", this.metadataUpdateHandler);\n\t}\n\n\t// storageOnly makes the connection manager synthesize a read-only frozen delta stream (no live\n\t// socket) and force the container read-only - see the class remarks.\n\tpublic readonly policies: IDocumentServicePolicies = { storageOnly: true };\n\n\tpublic dispose(): void {\n\t\tthis.liveDocumentService.off(\"metadataUpdate\", this.metadataUpdateHandler);\n\t\tthis.recoverableDocumentService.dispose();\n\t\tthis.liveDocumentService.dispose();\n\t}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.recoverableDocumentService.connectToStorage();\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\tconst liveDeltaStorage = await this.liveDocumentService.connectToDeltaStorage();\n\t\t// The exclusive upper bound needed to include the target op itself.\n\t\tconst boundedTo = this.targetSequenceNumber + 1;\n\t\treturn {\n\t\t\tfetchMessages: (from, to, abortSignal, cachedOnly, fetchReason) =>\n\t\t\t\tliveDeltaStorage.fetchMessages(\n\t\t\t\t\tfrom,\n\t\t\t\t\tto === undefined ? boundedTo : Math.min(to, boundedTo),\n\t\t\t\t\tabortSignal,\n\t\t\t\t\tcachedOnly,\n\t\t\t\t\tfetchReason,\n\t\t\t\t),\n\t\t};\n\t}\n\n\tpublic async connectToDeltaStream(_client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// Unreachable under normal flow: the connection manager short-circuits on the storageOnly\n\t\t// policy and synthesizes a frozen delta stream before ever calling connectToDeltaStream.\n\t\t// Reaching here indicates a regression of that short-circuit.\n\t\tthrow new Error(\n\t\t\t\"OdspPointInTimeDocumentService is storage-only; connectToDeltaStream should not be called\",\n\t\t);\n\t}\n\n\tprivate readonly metadataUpdateHandler = (metadata: Record<string, string>): void => {\n\t\tthis.emit(\"metadataUpdate\", metadata);\n\t};\n}\n"]}
1
+ {"version":3,"file":"odspPointInTimeDocumentService.js","sourceRoot":"","sources":["../../src/pointInTimeDriver/odspPointInTimeDocumentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAYjE;;;;;;;;;;;;;;;;;;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IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,EACtD,WAAW,EACX,UAAU,EACV,WAAW,CACX;SACF,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,OAAgB;QACjD,0FAA0F;QAC1F,yFAAyF;QACzF,8DAA8D;QAC9D,MAAM,IAAI,KAAK,CACd,2FAA2F,CAC3F,CAAC;IACH,CAAC;IAEgB,qBAAqB,GAAG,CAAC,QAAgC,EAAQ,EAAE;QACnF,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC,CAAC;CACF;AA1DD,wEA0DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tIClient,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServicePolicies,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * A read-only document service that materializes a document at a target sequence number by combining\n * a recoverable snapshot with a bounded replay of live ops.\n *\n * @remarks\n * Storage (the snapshot) is served from the closest file version at or before the target sequence\n * number. The ops needed to advance from that snapshot to the target are read from the live\n * document's delta storage, bounded so that no op past the target is ever fetched.\n *\n * The service advertises the {@link IDocumentServicePolicies.storageOnly} policy. This reuses the\n * loader's \"frozen\" load mechanism: the connection manager synthesizes a read-only frozen delta\n * stream instead of opening a live socket, and forces the container read-only. The delta manager\n * still catches up from the snapshot's sequence number through delta storage, which is exactly the\n * bounded replay we want. As a result no live delta-stream connection is ever established.\n *\n * Op availability is enforced by the delta storage stack itself: it validates that fetched batches\n * are contiguous from the requested start, keeps requesting until the bounded range is fully\n * delivered, and fails the fetch if the ops never materialize. So a stream that completes has\n * necessarily served the whole bridge, and no additional checks are needed here.\n *\n * @internal\n */\nexport class OdspPointInTimeDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tpublic constructor(\n\t\tpublic readonly resolvedUrl: IResolvedUrl,\n\t\t// Serves the snapshot: a read-only document service bound to the closest file version at or\n\t\t// before the target sequence number. Its storage is the base we replay ops on top of.\n\t\tprivate readonly recoverableDocumentService: IDocumentService,\n\t\tprivate readonly liveDocumentService: IDocumentService,\n\t\tprivate readonly targetSequenceNumber: number,\n\t) {\n\t\tsuper();\n\t\tthis.liveDocumentService.on(\"metadataUpdate\", this.metadataUpdateHandler);\n\t}\n\n\t// storageOnly makes the connection manager synthesize a read-only frozen delta stream (no live\n\t// socket) and force the container read-only - see the class remarks.\n\tpublic readonly policies: IDocumentServicePolicies = { storageOnly: true };\n\n\tpublic dispose(): void {\n\t\tthis.liveDocumentService.off(\"metadataUpdate\", this.metadataUpdateHandler);\n\t\tthis.recoverableDocumentService.dispose();\n\t\tthis.liveDocumentService.dispose();\n\t}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.recoverableDocumentService.connectToStorage();\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\tconst liveDeltaStorage = await this.liveDocumentService.connectToDeltaStorage();\n\t\t// The exclusive upper bound needed to include the target op itself.\n\t\tconst boundedTo = this.targetSequenceNumber + 1;\n\t\treturn {\n\t\t\tfetchMessages: (from, to, abortSignal, cachedOnly, fetchReason) =>\n\t\t\t\tliveDeltaStorage.fetchMessages(\n\t\t\t\t\tfrom,\n\t\t\t\t\tto === undefined ? boundedTo : Math.min(to, boundedTo),\n\t\t\t\t\tabortSignal,\n\t\t\t\t\tcachedOnly,\n\t\t\t\t\tfetchReason,\n\t\t\t\t),\n\t\t};\n\t}\n\n\tpublic async connectToDeltaStream(_client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// Unreachable under normal flow: the connection manager short-circuits on the storageOnly\n\t\t// policy and synthesizes a frozen delta stream before ever calling connectToDeltaStream.\n\t\t// Reaching here indicates a regression of that short-circuit.\n\t\tthrow new Error(\n\t\t\t\"OdspPointInTimeDocumentService is storage-only; connectToDeltaStream should not be called\",\n\t\t);\n\t}\n\n\tprivate readonly metadataUpdateHandler = (metadata: Record<string, string>): void => {\n\t\tthis.emit(\"metadataUpdate\", metadata);\n\t};\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.prefetchLatestSnapshot = void 0;
7
+ exports.prefetchLatestSnapshot = prefetchLatestSnapshot;
8
8
  const client_utils_1 = require("@fluid-internal/client-utils");
9
9
  const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  const internal_2 = require("@fluidframework/driver-utils/internal");
@@ -102,5 +102,4 @@ async function prefetchLatestSnapshot(resolvedUrl, getStorageToken, persistedCac
102
102
  return false;
103
103
  });
104
104
  }
105
- exports.prefetchLatestSnapshot = prefetchLatestSnapshot;
106
105
  //# sourceMappingURL=prefetchLatestSnapshot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prefetchLatestSnapshot.js","sourceRoot":"","sources":["../src/prefetchLatestSnapshot.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAE9D,kEAAuE;AAKvE,oEAA4E;AAS5E,uEAGkD;AAGlD,yDAK4B;AAG5B,iDAOwB;AAExB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,KAAK,UAAU,sBAAsB,CAC3C,WAAyB,EACzB,eAA4D,EAC5D,cAA+B,EAC/B,uCAAgD,EAChD,MAA4B,EAC5B,wBAAsD,EACtD,uBAAgC,IAAI,EACpC,0BAAoC,EACpC,wBAAoD,EACpD,0BAAuD;IAEvD,MAAM,EAAE,GAAG,IAAA,uCAA4B,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACnF,MAAM,UAAU,GAAG,IAAA,+BAAgB,EAAC,EAAE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C,CAAC,KAAK,EAAE,EAAE;YAChB,gEAAgE;YAChE,0BAA0B,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC;YAC1D,0BAA0B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzC,MAAM,KAAK,CAAC;QACb,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACb,CAAC,CACD,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACvB,UAAU,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,6BAA6B,EAAE,EAAE,KAAK,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACJ,CAAC;AAxHD,wDAwHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIPersistedCache,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { getKeyForCacheEntry } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tIOdspResolvedUrl,\n\tIOdspUrlParts,\n\tISnapshotOptions,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\tInstrumentedStorageTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IVersionedValueWithEpoch } from \"./contracts.js\";\nimport {\n\ttype ISnapshotRequestAndResponseOptions,\n\ttype SnapshotFormatSupportType,\n\tdownloadSnapshot,\n\tfetchSnapshotWithRedeem,\n} from \"./fetchSnapshot.js\";\nimport type { IPrefetchSnapshotContents } from \"./odspCache.js\";\nimport type { OdspDocumentServiceFactory } from \"./odspDocumentServiceFactory.js\";\nimport {\n\tcreateCacheSnapshotKey,\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\tsnapshotWithLoadingGroupIdSupported,\n\ttoInstrumentedOdspStorageTokenFetcher,\n\ttype TokenFetchOptionsEx,\n} from \"./odspUtils.js\";\n\n/**\n * Function to prefetch the snapshot and cached it in the persistent cache, so that when the container is loaded\n * the cached latest snapshot could be used and removes the network call from the critical path.\n *\n * @param resolvedUrl - Resolved url to fetch the snapshot.\n * @param getStorageToken - function that can provide the storage token for a given site. This is\n * is also referred to as the \"VROOM\" token in SPO.\n * @param persistedCache - Cache to store the fetched snapshot.\n * @param _forceAccessTokenViaAuthorizationHeader - Deprecated and not used.\n * @param logger - Logger to have telemetry events.\n * @param hostSnapshotFetchOptions - Options to fetch the snapshot if any. Otherwise default will be used.\n * @param enableRedeemFallback - True to have the sharing link redeem fallback in case the Trees Latest/Redeem\n * 1RT call fails with redeem error. During fallback it will first redeem the sharing link and then make\n * the Trees latest call.\n * Note: this can be considered deprecated - it will be replaced with `snapshotFormatFetchType`.\n * @param _fetchBinarySnapshotFormat - Deprecated and not used.\n * @param _snapshotFormatFetchType - Deprecated and not used.\n * @param odspDocumentServiceFactory - factory to access the non persistent cache and store the prefetch promise.\n *\n * @returns `true` if the snapshot is cached, `false` otherwise.\n * @legacy\n * @beta\n */\nexport async function prefetchLatestSnapshot(\n\tresolvedUrl: IResolvedUrl,\n\tgetStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\tpersistedCache: IPersistedCache,\n\t_forceAccessTokenViaAuthorizationHeader: boolean,\n\tlogger: ITelemetryBaseLogger,\n\thostSnapshotFetchOptions: ISnapshotOptions | undefined,\n\tenableRedeemFallback: boolean = true,\n\t_fetchBinarySnapshotFormat?: boolean,\n\t_snapshotFormatFetchType?: SnapshotFormatSupportType,\n\todspDocumentServiceFactory?: OdspDocumentServiceFactory,\n): Promise<boolean> {\n\tconst mc = createChildMonitoringContext({ logger, namespace: \"PrefetchSnapshot\" });\n\tconst odspLogger = createOdspLogger(mc.logger);\n\tconst useGroupIdsForSnapshotFetch = snapshotWithLoadingGroupIdSupported(mc.config);\n\t// For prefetch, we just want to fetch the ungrouped data and want to use the new API if the\n\t// feature gate is set, so provide an empty array.\n\tconst loadingGroupIds = useGroupIdsForSnapshotFetch ? [] : undefined;\n\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\tconst resolvedUrlData: IOdspUrlParts = {\n\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\tdriveId: odspResolvedUrl.driveId,\n\t\titemId: odspResolvedUrl.itemId,\n\t};\n\tconst getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\todspLogger,\n\t\tresolvedUrlData,\n\t\tgetStorageToken,\n\t);\n\n\tconst snapshotDownloader = async (\n\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\tstorageTokenFetcher: InstrumentedStorageTokenFetcher,\n\t\ttokenFetchOptions: TokenFetchOptionsEx,\n\t\tloadingGroupId: string[] | undefined,\n\t\tsnapshotOptions: ISnapshotOptions | undefined,\n\t\tcontroller?: AbortController,\n\t): Promise<ISnapshotRequestAndResponseOptions> => {\n\t\treturn downloadSnapshot(\n\t\t\tfinalOdspResolvedUrl,\n\t\t\tstorageTokenFetcher,\n\t\t\ttokenFetchOptions,\n\t\t\tloadingGroupId,\n\t\t\tsnapshotOptions,\n\t\t\todspLogger,\n\t\t\tundefined,\n\t\t\tcontroller,\n\t\t);\n\t};\n\tconst snapshotKey = createCacheSnapshotKey(odspResolvedUrl, useGroupIdsForSnapshotFetch);\n\tlet cacheP: Promise<void> | undefined;\n\tlet snapshotEpoch: string | undefined;\n\tconst putInCache = async (valueWithEpoch: IVersionedValueWithEpoch): Promise<void> => {\n\t\tsnapshotEpoch = valueWithEpoch.fluidEpoch;\n\t\tcacheP = persistedCache.put(snapshotKey, valueWithEpoch);\n\t\treturn cacheP;\n\t};\n\n\tconst removeEntries = async (): Promise<void> =>\n\t\tpersistedCache.removeEntries(snapshotKey.file);\n\treturn PerformanceEvent.timedExecAsync(\n\t\todspLogger,\n\t\t{ eventName: \"PrefetchLatestSnapshot\" },\n\t\tasync () => {\n\t\t\tconst prefetchStartTime = performanceNow();\n\t\t\t// Add the deferred promise to the cache, so that it can be leveraged while loading the container.\n\t\t\tconst snapshotContentsWithEpochP = new Deferred<IPrefetchSnapshotContents>();\n\t\t\tconst nonPersistentCacheKey = getKeyForCacheEntry(snapshotKey);\n\t\t\tconst snapshotNonPersistentCache =\n\t\t\t\todspDocumentServiceFactory?.snapshotPrefetchResultCache;\n\t\t\tsnapshotNonPersistentCache?.add(\n\t\t\t\tnonPersistentCacheKey,\n\t\t\t\tasync () => snapshotContentsWithEpochP.promise,\n\t\t\t);\n\t\t\tawait fetchSnapshotWithRedeem(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tgetAuthHeader,\n\t\t\t\thostSnapshotFetchOptions,\n\t\t\t\todspLogger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t\tputInCache,\n\t\t\t\tremoveEntries,\n\t\t\t\tloadingGroupIds,\n\t\t\t\tenableRedeemFallback,\n\t\t\t)\n\t\t\t\t.then(async (value) => {\n\t\t\t\t\tassert(!!snapshotEpoch, 0x585 /* prefetched snapshot should have a valid epoch */);\n\t\t\t\t\tsnapshotContentsWithEpochP.resolve({\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\tfluidEpoch: snapshotEpoch,\n\t\t\t\t\t\tprefetchStartTime,\n\t\t\t\t\t});\n\t\t\t\t\tassert(cacheP !== undefined, 0x1e7 /* \"caching was not performed!\" */);\n\t\t\t\t\tawait cacheP;\n\t\t\t\t\t// Schedule it to remove from cache after 5s.\n\t\t\t\t\t// 1. While it's in snapshotNonPersistentCache: Load flow will use this value and will not attempt\n\t\t\t\t\t// to fetch snapshot from network again. That's the best from perf POV, but cache will not be\n\t\t\t\t\t// updated if we keep it in this cache, thus we want to eventually remove snapshot from this cache.\n\t\t\t\t\t// 2. After it's removed from snapshotNonPersistentCache: snapshot is present in persistent cache,\n\t\t\t\t\t// so we sill still use it (in accordance with cache policy controlled by host). But load flow will\n\t\t\t\t\t// also fetch snapshot (in parallel) from storage and update cache. This is fine long term,\n\t\t\t\t\t// but is an extra cost (unneeded network call). However since it is 5s older, new network call\n\t\t\t\t\t// will update the snapshot in cache.\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tsnapshotNonPersistentCache?.remove(nonPersistentCacheKey);\n\t\t\t\t\t}, 5000);\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\t// Remove it from the non persistent cache if an error occurred.\n\t\t\t\t\tsnapshotNonPersistentCache?.remove(nonPersistentCacheKey);\n\t\t\t\t\tsnapshotContentsWithEpochP.reject(error);\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\treturn true;\n\t\t},\n\t).catch(async (error) => {\n\t\todspLogger.sendErrorEvent({ eventName: \"PrefetchLatestSnapshotError\" }, error);\n\t\treturn false;\n\t});\n}\n"]}
1
+ {"version":3,"file":"prefetchLatestSnapshot.js","sourceRoot":"","sources":["../src/prefetchLatestSnapshot.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAgEH,wDAwHC;AAtLD,+DAA8D;AAE9D,kEAAuE;AAKvE,oEAA4E;AAS5E,uEAGkD;AAGlD,yDAK4B;AAG5B,iDAOwB;AAExB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,KAAK,UAAU,sBAAsB,CAC3C,WAAyB,EACzB,eAA4D,EAC5D,cAA+B,EAC/B,uCAAgD,EAChD,MAA4B,EAC5B,wBAAsD,EACtD,uBAAgC,IAAI,EACpC,0BAAoC,EACpC,wBAAoD,EACpD,0BAAuD;IAEvD,MAAM,EAAE,GAAG,IAAA,uCAA4B,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACnF,MAAM,UAAU,GAAG,IAAA,+BAAgB,EAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,2BAA2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E,0BAA0B,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC;YAC1D,0BAA0B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzC,MAAM,KAAK,CAAC;QACb,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACb,CAAC,CACD,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACvB,UAAU,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,6BAA6B,EAAE,EAAE,KAAK,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIPersistedCache,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { getKeyForCacheEntry } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tIOdspResolvedUrl,\n\tIOdspUrlParts,\n\tISnapshotOptions,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\tInstrumentedStorageTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IVersionedValueWithEpoch } from \"./contracts.js\";\nimport {\n\ttype ISnapshotRequestAndResponseOptions,\n\ttype SnapshotFormatSupportType,\n\tdownloadSnapshot,\n\tfetchSnapshotWithRedeem,\n} from \"./fetchSnapshot.js\";\nimport type { IPrefetchSnapshotContents } from \"./odspCache.js\";\nimport type { OdspDocumentServiceFactory } from \"./odspDocumentServiceFactory.js\";\nimport {\n\tcreateCacheSnapshotKey,\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\tsnapshotWithLoadingGroupIdSupported,\n\ttoInstrumentedOdspStorageTokenFetcher,\n\ttype TokenFetchOptionsEx,\n} from \"./odspUtils.js\";\n\n/**\n * Function to prefetch the snapshot and cached it in the persistent cache, so that when the container is loaded\n * the cached latest snapshot could be used and removes the network call from the critical path.\n *\n * @param resolvedUrl - Resolved url to fetch the snapshot.\n * @param getStorageToken - function that can provide the storage token for a given site. This is\n * is also referred to as the \"VROOM\" token in SPO.\n * @param persistedCache - Cache to store the fetched snapshot.\n * @param _forceAccessTokenViaAuthorizationHeader - Deprecated and not used.\n * @param logger - Logger to have telemetry events.\n * @param hostSnapshotFetchOptions - Options to fetch the snapshot if any. Otherwise default will be used.\n * @param enableRedeemFallback - True to have the sharing link redeem fallback in case the Trees Latest/Redeem\n * 1RT call fails with redeem error. During fallback it will first redeem the sharing link and then make\n * the Trees latest call.\n * Note: this can be considered deprecated - it will be replaced with `snapshotFormatFetchType`.\n * @param _fetchBinarySnapshotFormat - Deprecated and not used.\n * @param _snapshotFormatFetchType - Deprecated and not used.\n * @param odspDocumentServiceFactory - factory to access the non persistent cache and store the prefetch promise.\n *\n * @returns `true` if the snapshot is cached, `false` otherwise.\n * @legacy\n * @beta\n */\nexport async function prefetchLatestSnapshot(\n\tresolvedUrl: IResolvedUrl,\n\tgetStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\tpersistedCache: IPersistedCache,\n\t_forceAccessTokenViaAuthorizationHeader: boolean,\n\tlogger: ITelemetryBaseLogger,\n\thostSnapshotFetchOptions: ISnapshotOptions | undefined,\n\tenableRedeemFallback: boolean = true,\n\t_fetchBinarySnapshotFormat?: boolean,\n\t_snapshotFormatFetchType?: SnapshotFormatSupportType,\n\todspDocumentServiceFactory?: OdspDocumentServiceFactory,\n): Promise<boolean> {\n\tconst mc = createChildMonitoringContext({ logger, namespace: \"PrefetchSnapshot\" });\n\tconst odspLogger = createOdspLogger(mc.logger);\n\tconst useGroupIdsForSnapshotFetch = snapshotWithLoadingGroupIdSupported(mc.config);\n\t// For prefetch, we just want to fetch the ungrouped data and want to use the new API if the\n\t// feature gate is set, so provide an empty array.\n\tconst loadingGroupIds = useGroupIdsForSnapshotFetch ? [] : undefined;\n\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\tconst resolvedUrlData: IOdspUrlParts = {\n\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\tdriveId: odspResolvedUrl.driveId,\n\t\titemId: odspResolvedUrl.itemId,\n\t};\n\tconst getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\todspLogger,\n\t\tresolvedUrlData,\n\t\tgetStorageToken,\n\t);\n\n\tconst snapshotDownloader = async (\n\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\tstorageTokenFetcher: InstrumentedStorageTokenFetcher,\n\t\ttokenFetchOptions: TokenFetchOptionsEx,\n\t\tloadingGroupId: string[] | undefined,\n\t\tsnapshotOptions: ISnapshotOptions | undefined,\n\t\tcontroller?: AbortController,\n\t): Promise<ISnapshotRequestAndResponseOptions> => {\n\t\treturn downloadSnapshot(\n\t\t\tfinalOdspResolvedUrl,\n\t\t\tstorageTokenFetcher,\n\t\t\ttokenFetchOptions,\n\t\t\tloadingGroupId,\n\t\t\tsnapshotOptions,\n\t\t\todspLogger,\n\t\t\tundefined,\n\t\t\tcontroller,\n\t\t);\n\t};\n\tconst snapshotKey = createCacheSnapshotKey(odspResolvedUrl, useGroupIdsForSnapshotFetch);\n\tlet cacheP: Promise<void> | undefined;\n\tlet snapshotEpoch: string | undefined;\n\tconst putInCache = async (valueWithEpoch: IVersionedValueWithEpoch): Promise<void> => {\n\t\tsnapshotEpoch = valueWithEpoch.fluidEpoch;\n\t\tcacheP = persistedCache.put(snapshotKey, valueWithEpoch);\n\t\treturn cacheP;\n\t};\n\n\tconst removeEntries = async (): Promise<void> =>\n\t\tpersistedCache.removeEntries(snapshotKey.file);\n\treturn PerformanceEvent.timedExecAsync(\n\t\todspLogger,\n\t\t{ eventName: \"PrefetchLatestSnapshot\" },\n\t\tasync () => {\n\t\t\tconst prefetchStartTime = performanceNow();\n\t\t\t// Add the deferred promise to the cache, so that it can be leveraged while loading the container.\n\t\t\tconst snapshotContentsWithEpochP = new Deferred<IPrefetchSnapshotContents>();\n\t\t\tconst nonPersistentCacheKey = getKeyForCacheEntry(snapshotKey);\n\t\t\tconst snapshotNonPersistentCache =\n\t\t\t\todspDocumentServiceFactory?.snapshotPrefetchResultCache;\n\t\t\tsnapshotNonPersistentCache?.add(\n\t\t\t\tnonPersistentCacheKey,\n\t\t\t\tasync () => snapshotContentsWithEpochP.promise,\n\t\t\t);\n\t\t\tawait fetchSnapshotWithRedeem(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tgetAuthHeader,\n\t\t\t\thostSnapshotFetchOptions,\n\t\t\t\todspLogger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t\tputInCache,\n\t\t\t\tremoveEntries,\n\t\t\t\tloadingGroupIds,\n\t\t\t\tenableRedeemFallback,\n\t\t\t)\n\t\t\t\t.then(async (value) => {\n\t\t\t\t\tassert(!!snapshotEpoch, 0x585 /* prefetched snapshot should have a valid epoch */);\n\t\t\t\t\tsnapshotContentsWithEpochP.resolve({\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\tfluidEpoch: snapshotEpoch,\n\t\t\t\t\t\tprefetchStartTime,\n\t\t\t\t\t});\n\t\t\t\t\tassert(cacheP !== undefined, 0x1e7 /* \"caching was not performed!\" */);\n\t\t\t\t\tawait cacheP;\n\t\t\t\t\t// Schedule it to remove from cache after 5s.\n\t\t\t\t\t// 1. While it's in snapshotNonPersistentCache: Load flow will use this value and will not attempt\n\t\t\t\t\t// to fetch snapshot from network again. That's the best from perf POV, but cache will not be\n\t\t\t\t\t// updated if we keep it in this cache, thus we want to eventually remove snapshot from this cache.\n\t\t\t\t\t// 2. After it's removed from snapshotNonPersistentCache: snapshot is present in persistent cache,\n\t\t\t\t\t// so we sill still use it (in accordance with cache policy controlled by host). But load flow will\n\t\t\t\t\t// also fetch snapshot (in parallel) from storage and update cache. This is fine long term,\n\t\t\t\t\t// but is an extra cost (unneeded network call). However since it is 5s older, new network call\n\t\t\t\t\t// will update the snapshot in cache.\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tsnapshotNonPersistentCache?.remove(nonPersistentCacheKey);\n\t\t\t\t\t}, 5000);\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\t// Remove it from the non persistent cache if an error occurred.\n\t\t\t\t\tsnapshotNonPersistentCache?.remove(nonPersistentCacheKey);\n\t\t\t\t\tsnapshotContentsWithEpochP.reject(error);\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\treturn true;\n\t\t},\n\t).catch(async (error) => {\n\t\todspLogger.sendErrorEvent({ eventName: \"PrefetchLatestSnapshotError\" }, error);\n\t\treturn false;\n\t});\n}\n"]}
@@ -8,10 +8,12 @@ exports.RetryErrorsStorageAdapter = void 0;
8
8
  const internal_1 = require("@fluidframework/telemetry-utils/internal");
9
9
  const retryUtils_js_1 = require("./retryUtils.js");
10
10
  class RetryErrorsStorageAdapter {
11
+ internalStorageService;
12
+ logger;
13
+ _disposed = false;
11
14
  constructor(internalStorageService, logger) {
12
15
  this.internalStorageService = internalStorageService;
13
16
  this.logger = logger;
14
- this._disposed = false;
15
17
  }
16
18
  get policies() {
17
19
  return this.internalStorageService.policies;
@@ -1 +1 @@
1
- {"version":3,"file":"retryErrorsStorageAdapter.js","sourceRoot":"","sources":["../src/retryErrorsStorageAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,uEAIkD;AAElD,mDAA+C;AAE/C,MAAa,yBAAyB;IAErC,YACkB,sBAA+C,EAC/C,MAA0B;QAD1B,2BAAsB,GAAtB,sBAAsB,CAAyB;QAC/C,WAAM,GAAN,MAAM,CAAoB;QAHpC,cAAS,GAAG,KAAK,CAAC;IAIvB,CAAC;IAEJ,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBA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AExB,4DAA4D;QAC5D,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAClF,kCAAkC,CAClC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAClD,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,EAC/D,yBAAyB,CACzB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,EACxD,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEO,oBAAoB;QAC3B,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,4DAA4D;YAC5D,MAAM,IAAI,uBAAY,CAAC,2CAA2C,EAAE;gBACnE,QAAQ,EAAE,KAAK;aACf,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,IAAA,4BAAY,EAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACpF,CAAC;CACD;AA5FD,8DA4FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IDisposable } from \"@fluidframework/core-interfaces\";\nimport type { ISummaryHandle, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tLoggingError,\n\ttype TelemetryLoggerExt,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { runWithRetry } from \"./retryUtils.js\";\n\nexport class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisposable {\n\tprivate _disposed = false;\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t) {}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose(): void {\n\t\tthis._disposed = true;\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.getSnapshotTree(version),\n\t\t\t\"storage_getSnapshotTree\",\n\t\t);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\treturn this.runWithRetry(async () => {\n\t\t\tif (this.internalStorageService.getSnapshot !== undefined) {\n\t\t\t\treturn this.internalStorageService.getSnapshot(snapshotFetchOptions);\n\t\t\t}\n\t\t\tthrow new UsageError(\"getSnapshot should exist in storage adapter in ODSP driver\");\n\t\t}, \"storage_getSnapshot\");\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.readBlob(id),\n\t\t\t\"storage_readBlob\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageService.getVersions(versionId, count, scenarioName, fetchSource),\n\t\t\t\"storage_getVersions\",\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// Creation flow with attachment blobs - need to do retries!\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.uploadSummaryWithContext(summary, context),\n\t\t\t\"storage_uploadSummaryWithContext\",\n\t\t);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.downloadSummary(handle),\n\t\t\t\"storage_downloadSummary\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.createBlob(file),\n\t\t\t\"storage_createBlob\",\n\t\t);\n\t}\n\n\tprivate checkStorageDisposed(): void {\n\t\tif (this._disposed) {\n\t\t\t// pre-0.58 error message: storageServiceDisposedCannotRetry\n\t\t\tthrow new LoggingError(\"Storage Service is disposed. Cannot retry\", {\n\t\t\t\tcanRetry: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(api, callName, this.logger, () => this.checkStorageDisposed());\n\t}\n}\n"]}
1
+ {"version":3,"file":"retryErrorsStorageAdapter.js","sourceRoot":"","sources":["../src/retryErrorsStorageAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,uEAIkD;AAElD,mDAA+C;AAE/C,MAAa,yBAAyB;IAGnB;IACA;IAHV,SAAS,GAAG,KAAK,CAAC;IAC1B,YACkB,sBAA+C,EAC/C,MAA0B;QAD1B,2BAAsB,GAAtB,sBAAsB,CAAyB;QAC/C,WAAM,GAAN,MAAM,CAAoB;IACzC,CAAC;IAE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K,CAAC,wBAAwB,CACpC,OAAqB,EACrB,OAAwB;QAExB,4DAA4D;QAC5D,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAClF,kCAAkC,CAClC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAClD,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,EAC/D,yBAAyB,CACzB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,EACxD,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEO,oBAAoB;QAC3B,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,4DAA4D;YAC5D,MAAM,IAAI,uBAAY,CAAC,2CAA2C,EAAE;gBACnE,QAAQ,EAAE,KAAK;aACf,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,IAAA,4BAAY,EAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACpF,CAAC;CACD;AA5FD,8DA4FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IDisposable } from \"@fluidframework/core-interfaces\";\nimport type { ISummaryHandle, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tLoggingError,\n\ttype TelemetryLoggerExt,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { runWithRetry } from \"./retryUtils.js\";\n\nexport class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisposable {\n\tprivate _disposed = false;\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t) {}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose(): void {\n\t\tthis._disposed = true;\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.getSnapshotTree(version),\n\t\t\t\"storage_getSnapshotTree\",\n\t\t);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\treturn this.runWithRetry(async () => {\n\t\t\tif (this.internalStorageService.getSnapshot !== undefined) {\n\t\t\t\treturn this.internalStorageService.getSnapshot(snapshotFetchOptions);\n\t\t\t}\n\t\t\tthrow new UsageError(\"getSnapshot should exist in storage adapter in ODSP driver\");\n\t\t}, \"storage_getSnapshot\");\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.readBlob(id),\n\t\t\t\"storage_readBlob\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageService.getVersions(versionId, count, scenarioName, fetchSource),\n\t\t\t\"storage_getVersions\",\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// Creation flow with attachment blobs - need to do retries!\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.uploadSummaryWithContext(summary, context),\n\t\t\t\"storage_uploadSummaryWithContext\",\n\t\t);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.downloadSummary(handle),\n\t\t\t\"storage_downloadSummary\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.createBlob(file),\n\t\t\t\"storage_createBlob\",\n\t\t);\n\t}\n\n\tprivate checkStorageDisposed(): void {\n\t\tif (this._disposed) {\n\t\t\t// pre-0.58 error message: storageServiceDisposedCannotRetry\n\t\t\tthrow new LoggingError(\"Storage Service is disposed. Cannot retry\", {\n\t\t\t\tcanRetry: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(api, callName, this.logger, () => this.checkStorageDisposed());\n\t}\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.runWithRetry = void 0;
7
+ exports.runWithRetry = runWithRetry;
8
8
  const client_utils_1 = require("@fluid-internal/client-utils");
9
9
  const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  const internal_2 = require("@fluidframework/driver-utils/internal");
@@ -81,5 +81,4 @@ async function runWithRetry(api, callName, logger, checkDisposed) {
81
81
  }
82
82
  }
83
83
  }
84
- exports.runWithRetry = runWithRetry;
85
84
  //# sourceMappingURL=retryUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retryUtils.js","sourceRoot":"","sources":["../src/retryUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA4D;AAC5D,oEAG+C;AAC/C,+EAAkF;AAGlF,uDAAiD;AAEjD;;GAEG;AACI,KAAK,UAAU,YAAY,CACjC,GAAqB,EACrB,QAAgB,EAChB,MAA0B,EAC1B,aAA0B;IAE1B,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,MAAM,KAAK,GAAG,IAAA,6BAAc,GAAE,CAAC;IAC/B,IAAI,SAAkB,CAAC;IACvB,KAAK,IAAI,QAAQ,GAAG,CAAC,GAAI,QAAQ,EAAE,EAAE,CAAC;QACrC,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YACjC,aAAa,EAAE,CAAC;QACjB,CAAC;QACD,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC;YAC3B,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;gBAClB,MAAM,CAAC,kBAAkB,CACxB;oBACC,SAAS,EAAE,iBAAiB;oBAC5B,QAAQ;oBACR,QAAQ;oBACR,QAAQ,EAAE,IAAA,6BAAc,GAAE,GAAG,KAAK;iBAClC,EACD,SAAS,CACT,CAAC;YACH,CAAC;YACD,OAAO,MAAM,CAAC;YACd,8DAA8D;QAC/D,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,MAAM,QAAQ,GAAG,IAAA,0BAAe,EAAC,KAAK,CAAC,CAAC;YAExC,sEAAsE;YACtE,MAAM,cAAc,GAAG,KAAK,EAAE,CAAC,8BAAY,CAAC,KAAK,IAAI,CAAC;YACtD,sEAAsE;YACtE,MAAM,oBAAoB,GAAG,KAAK,EAAE,SAAS,KAAK,yBAAc,CAAC,eAAe,CAA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":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport { delay } from \"@fluidframework/core-utils/internal\";\nimport {\n\tcanRetryOnError,\n\tgetRetryDelayFromError,\n} from \"@fluidframework/driver-utils/internal\";\nimport { OdspErrorTypes } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { Odsp409Error } from \"./epochTracker.js\";\n\n/**\n * This method retries only for retriable coherency and service read only errors.\n */\nexport async function runWithRetry<T>(\n\tapi: () => Promise<T>,\n\tcallName: string,\n\tlogger: TelemetryLoggerExt,\n\tcheckDisposed?: () => void,\n): Promise<T> {\n\tlet retryAfter = 1000;\n\tconst start = performanceNow();\n\tlet lastError: unknown;\n\tfor (let attempts = 1; ; attempts++) {\n\t\tif (checkDisposed !== undefined) {\n\t\t\tcheckDisposed();\n\t\t}\n\t\ttry {\n\t\t\tconst result = await api();\n\t\t\tif (attempts > 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"MultipleRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performanceNow() - start,\n\t\t\t\t\t},\n\t\t\t\t\tlastError,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn result;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\tconst canRetry = canRetryOnError(error);\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tconst coherencyError = error?.[Odsp409Error] === true;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tconst serviceReadonlyError = error?.errorType === OdspErrorTypes.serviceReadOnly;\n\n\t\t\t// logging the first failed retry instead of every attempt. We want to avoid filling telemetry\n\t\t\t// when we have tight loop of retrying in offline mode, but we also want to know what caused\n\t\t\t// the failure in the first place\n\t\t\tif (attempts === 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${callName}_firstFailed`,\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performanceNow() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Retry for retriable 409 coherency errors or serviceReadOnly errors. These errors are always retriable\n\t\t\t// unless someone specifically set canRetry = false on the error like in fetchSnapshot() flow. So in\n\t\t\t// that case don't retry.\n\t\t\tif (!((coherencyError || serviceReadonlyError) && canRetry)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// SPO itself does number of retries internally before returning 409 to client.\n\t\t\t// That multiplied to 5 suggests need to reconsider current design, as client spends\n\t\t\t// too much time / bandwidth doing the same thing without any progress.\n\t\t\tif (attempts === 5) {\n\t\t\t\tlogger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: coherencyError\n\t\t\t\t\t\t\t? \"CoherencyErrorTooManyRetries\"\n\t\t\t\t\t\t\t: \"ServiceReadonlyErrorTooManyRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performanceNow() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t\t// Fail hard.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\terror.canRetry = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tretryAfter = getRetryDelayFromError(error) ?? retryAfter;\n\t\t\tawait delay(Math.floor(retryAfter));\n\t\t\tretryAfter += (retryAfter / 4) * (1 + Math.random());\n\t\t\tlastError = error;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"retryUtils.js","sourceRoot":"","sources":["../src/ret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AE,GAAG,QAAQ,cAAc;oBACpC,QAAQ;oBACR,QAAQ;oBACR,QAAQ,EAAE,IAAA,6BAAc,GAAE,GAAG,KAAK,EAAE,0BAA0B;iBAC9D,EACD,KAAK,CACL,CAAC;YACH,CAAC;YAED,wGAAwG;YACxG,oGAAoG;YACpG,yBAAyB;YACzB,IAAI,CAAC,CAAC,CAAC,cAAc,IAAI,oBAAoB,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC;gBAC7D,MAAM,KAAK,CAAC;YACb,CAAC;YAED,+EAA+E;YAC/E,oFAAoF;YACpF,uEAAuE;YACvE,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,CAAC,cAAc,CACpB;oBACC,SAAS,EAAE,cAAc;wBACxB,CAAC,CAAC,8BAA8B;wBAChC,CAAC,CAAC,oCAAoC;oBACvC,QAAQ;oBACR,QAAQ;oBACR,QAAQ,EAAE,IAAA,6BAAc,GAAE,GAAG,KAAK,EAAE,0BAA0B;iBAC9D,EACD,KAAK,CACL,CAAC;gBACF,aAAa;gBACb,sEAAsE;gBACtE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACvB,MAAM,KAAK,CAAC;YACb,CAAC;YAED,UAAU,GAAG,IAAA,iCAAsB,EAAC,KAAK,CAAC,IAAI,UAAU,CAAC;YACzD,MAAM,IAAA,gBAAK,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;YACpC,UAAU,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACrD,SAAS,GAAG,KAAK,CAAC;QACnB,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport { delay } from \"@fluidframework/core-utils/internal\";\nimport {\n\tcanRetryOnError,\n\tgetRetryDelayFromError,\n} from \"@fluidframework/driver-utils/internal\";\nimport { OdspErrorTypes } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { Odsp409Error } from \"./epochTracker.js\";\n\n/**\n * This method retries only for retriable coherency and service read only errors.\n */\nexport async function runWithRetry<T>(\n\tapi: () => Promise<T>,\n\tcallName: string,\n\tlogger: TelemetryLoggerExt,\n\tcheckDisposed?: () => void,\n): Promise<T> {\n\tlet retryAfter = 1000;\n\tconst start = performanceNow();\n\tlet lastError: unknown;\n\tfor (let attempts = 1; ; attempts++) {\n\t\tif (checkDisposed !== undefined) {\n\t\t\tcheckDisposed();\n\t\t}\n\t\ttry {\n\t\t\tconst result = await api();\n\t\t\tif (attempts > 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"MultipleRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performanceNow() - start,\n\t\t\t\t\t},\n\t\t\t\t\tlastError,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn result;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\tconst canRetry = canRetryOnError(error);\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tconst coherencyError = error?.[Odsp409Error] === true;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tconst serviceReadonlyError = error?.errorType === OdspErrorTypes.serviceReadOnly;\n\n\t\t\t// logging the first failed retry instead of every attempt. We want to avoid filling telemetry\n\t\t\t// when we have tight loop of retrying in offline mode, but we also want to know what caused\n\t\t\t// the failure in the first place\n\t\t\tif (attempts === 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${callName}_firstFailed`,\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performanceNow() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Retry for retriable 409 coherency errors or serviceReadOnly errors. These errors are always retriable\n\t\t\t// unless someone specifically set canRetry = false on the error like in fetchSnapshot() flow. So in\n\t\t\t// that case don't retry.\n\t\t\tif (!((coherencyError || serviceReadonlyError) && canRetry)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// SPO itself does number of retries internally before returning 409 to client.\n\t\t\t// That multiplied to 5 suggests need to reconsider current design, as client spends\n\t\t\t// too much time / bandwidth doing the same thing without any progress.\n\t\t\tif (attempts === 5) {\n\t\t\t\tlogger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: coherencyError\n\t\t\t\t\t\t\t? \"CoherencyErrorTooManyRetries\"\n\t\t\t\t\t\t\t: \"ServiceReadonlyErrorTooManyRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performanceNow() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t\t// Fail hard.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\terror.canRetry = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tretryAfter = getRetryDelayFromError(error) ?? retryAfter;\n\t\t\tawait delay(Math.floor(retryAfter));\n\t\t\tretryAfter += (retryAfter / 4) * (1 + Math.random());\n\t\t\tlastError = error;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"vroom.d.ts","sourceRoot":"","sources":["../src/vroom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,aAAa,EACb,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQ1D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,6CAEjB,aAAa,QACjB,MAAM,UACJ,KAAK,GAAG,MAAM,UACd,kBAAkB,iBACX,+BAA+B,gBAChC,YAAY,sBACN,OAAO,WAClB,mBAAmB,6BACD,OAAO,GAAG,SAAS,2BACrB,OAAO,eACnB,MAAM,GAAG,SAAS,KAC7B,QAAQ,uBAAuB,CAAC,CAuFnC,CAAC"}
1
+ {"version":3,"file":"vroom.d.ts","sourceRoot":"","sources":["../src/vroom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,aAAa,EACb,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQ1D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,6CAEjB,aAAa,QACjB,MAAM,UACJ,KAAK,GAAG,MAAM,UACd,kBAAkB,iBACX,+BAA+B,gBAChC,YAAY,sBACN,OAAO,WAClB,mBAAmB,6BACD,OAAO,GAAG,SAAS,2BACrB,OAAO,eACnB,MAAM,GAAG,SAAS,KAC7B,OAAO,CAAC,uBAAuB,CAAC,CAuFnC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"zipItDataRepresentationUtils.d.ts","sourceRoot":"","sources":["../src/zipItDataRepresentationUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,KAAK,EAAE,kBAAkB,E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;CA8CnB;AAED;;;GAGG;AACH,qBAAa,WAAY,SAAQ,QAAQ;IACxC,MAAM,CAAC,IAAI,CACV,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,kBAAkB,GACxB;QACF,OAAO,EAAE,WAAW,CAAC;QACrB,cAAc,EAAE;YACf,iBAAiB,EAAE,MAAM,CAAC;YAC1B,eAAe,EAAE,MAAM,CAAC;SACxB,CAAC;KACF;CAMD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAK1E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM1E;AAED,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,IAAI,QAAQ,CAK1B;AAED,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,IAAI,QAAQ,CAK1B;AAED,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,IAAI,MAAM,CAKxB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAK5F"}
@@ -4,7 +4,17 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.assertBoolInstance = exports.assertNumberInstance = exports.assertNodeCoreInstance = exports.assertBlobCoreInstance = exports.getStringInstance = exports.getMaybeStringInstance = exports.TreeBuilder = exports.NodeCore = exports.addBoolProperty = exports.addNumberProperty = exports.addDictionaryStringProperty = exports.addStringProperty = exports.BlobShallowCopy = exports.BlobCore = exports.iterate = exports.iteratePairs = exports.getNodeProps = exports.getValueSafely = exports.codeToBytesMap = exports.MarkerCodesEnd = exports.MarkerCodesStart = exports.MarkerCodes = void 0;
7
+ exports.TreeBuilder = exports.NodeCore = exports.addBoolProperty = exports.addNumberProperty = exports.addDictionaryStringProperty = exports.addStringProperty = exports.BlobShallowCopy = exports.BlobCore = exports.codeToBytesMap = exports.MarkerCodesEnd = exports.MarkerCodesStart = exports.MarkerCodes = void 0;
8
+ exports.getValueSafely = getValueSafely;
9
+ exports.getNodeProps = getNodeProps;
10
+ exports.iteratePairs = iteratePairs;
11
+ exports.iterate = iterate;
12
+ exports.getMaybeStringInstance = getMaybeStringInstance;
13
+ exports.getStringInstance = getStringInstance;
14
+ exports.assertBlobCoreInstance = assertBlobCoreInstance;
15
+ exports.assertNodeCoreInstance = assertNodeCoreInstance;
16
+ exports.assertNumberInstance = assertNumberInstance;
17
+ exports.assertBoolInstance = assertBoolInstance;
8
18
  /**
9
19
  * Data representation which is followed(zipIt Protocol) here is described in this document:
10
20
  * https://microsoft.sharepoint-df.com/:w:/t/ODSPFileStore/ER06b64K_XdDjEyAKl-UT60BJiId39SCVkYSyo_2pvH9gQ?e=KYQ0c5
@@ -101,7 +111,6 @@ function getValueSafely(map, key) {
101
111
  (0, internal_1.assert)(val !== undefined, 0x287 /* key must exist in the map */);
102
112
  return val;
103
113
  }
104
- exports.getValueSafely = getValueSafely;
105
114
  function getNodeProps(node) {
106
115
  const res = {};
107
116
  for (const [keyNode, valueNode] of node.iteratePairs()) {
@@ -110,7 +119,6 @@ function getNodeProps(node) {
110
119
  }
111
120
  return res;
112
121
  }
113
- exports.getNodeProps = getNodeProps;
114
122
  function iteratePairs(it) {
115
123
  const res = {
116
124
  next: () => {
@@ -129,7 +137,6 @@ function iteratePairs(it) {
129
137
  };
130
138
  return res;
131
139
  }
132
- exports.iteratePairs = iteratePairs;
133
140
  /**
134
141
  * Helper function that returns iterator from an object
135
142
  * @param obj - object that supports iteration
@@ -137,7 +144,6 @@ exports.iteratePairs = iteratePairs;
137
144
  function iterate(obj) {
138
145
  return obj[Symbol.iterator]();
139
146
  }
140
- exports.iterate = iterate;
141
147
  /**
142
148
  * Base class to represent binary blob element.
143
149
  * Binary blob is one of three types supported as a leaf node of a tree.
@@ -156,6 +162,7 @@ exports.BlobCore = BlobCore;
156
162
  * is a reference to underlying binary stream (ReadBuffer).
157
163
  */
158
164
  class BlobDeepCopy extends BlobCore {
165
+ data;
159
166
  /**
160
167
  * Represents a deep copy of the blob.
161
168
  * @param data - Data array of the blob
@@ -168,7 +175,7 @@ class BlobDeepCopy extends BlobCore {
168
175
  return this.data;
169
176
  }
170
177
  get arrayBuffer() {
171
- return (0, client_utils_1.Uint8ArrayToArrayBuffer)(this.buffer);
178
+ return (0, client_utils_1.Uint8ArrayToArrayBufferLike)(this.buffer);
172
179
  }
173
180
  static read(buffer, lengthLen) {
174
181
  const length = buffer.read(lengthLen);
@@ -184,6 +191,9 @@ class BlobDeepCopy extends BlobCore {
184
191
  * it was constructed from. It takes much less memory compared to BlobDeepCopy
185
192
  */
186
193
  class BlobShallowCopy extends BlobCore {
194
+ data;
195
+ start;
196
+ end;
187
197
  /**
188
198
  * Represents a shallow copy of the blob. It is not a separate blob, just reference to original blobs.
189
199
  * @param data - Data array of the blob
@@ -199,7 +209,7 @@ class BlobShallowCopy extends BlobCore {
199
209
  get buffer() {
200
210
  return this.data.subarray(this.start, this.end);
201
211
  }
202
- // Equivalent to Uint8ArrayToArrayBuffer(this.buffer)
212
+ // Equivalent to Uint8ArrayToArrayBufferLike(this.buffer)
203
213
  get arrayBuffer() {
204
214
  const offset = this.data.byteOffset;
205
215
  return this.data.buffer.slice(this.start + offset, this.end + offset);
@@ -236,13 +246,14 @@ exports.addBoolProperty = addBoolProperty;
236
246
  * Node - node in the tree (non-leaf element of the tree)
237
247
  */
238
248
  class NodeCore {
249
+ type;
250
+ // It is an array of nodes.
251
+ children = [];
239
252
  get nodes() {
240
253
  return this.children;
241
254
  }
242
255
  constructor(type = "set") {
243
256
  this.type = type;
244
- // It is an array of nodes.
245
- this.children = [];
246
257
  }
247
258
  [Symbol.iterator]() {
248
259
  return this.children[Symbol.iterator]();
@@ -500,7 +511,6 @@ function getMaybeStringInstance(node) {
500
511
  return maybeString.content;
501
512
  }
502
513
  }
503
- exports.getMaybeStringInstance = getMaybeStringInstance;
504
514
  function getStringInstance(node, message) {
505
515
  const maybeString = node;
506
516
  if (maybeString._stringElement) {
@@ -508,35 +518,30 @@ function getStringInstance(node, message) {
508
518
  }
509
519
  throwBufferParseException(node, "BlobCore", message);
510
520
  }
511
- exports.getStringInstance = getStringInstance;
512
521
  function assertBlobCoreInstance(node, message) {
513
522
  if (node instanceof BlobCore) {
514
523
  return;
515
524
  }
516
525
  throwBufferParseException(node, "BlobCore", message);
517
526
  }
518
- exports.assertBlobCoreInstance = assertBlobCoreInstance;
519
527
  function assertNodeCoreInstance(node, message) {
520
528
  if (node instanceof NodeCore) {
521
529
  return;
522
530
  }
523
531
  throwBufferParseException(node, "NodeCore", message);
524
532
  }
525
- exports.assertNodeCoreInstance = assertNodeCoreInstance;
526
533
  function assertNumberInstance(node, message) {
527
534
  if (typeof node === "number") {
528
535
  return;
529
536
  }
530
537
  throwBufferParseException(node, "Number", message);
531
538
  }
532
- exports.assertNumberInstance = assertNumberInstance;
533
539
  function assertBoolInstance(node, message) {
534
540
  if (typeof node === "boolean") {
535
541
  return;
536
542
  }
537
543
  throwBufferParseException(node, "Boolean", message);
538
544
  }
539
- exports.assertBoolInstance = assertBoolInstance;
540
545
  function throwBufferParseException(node, expectedNodeType, message) {
541
546
  throw new internal_2.NonRetryableError(`Buffer parsing exception: ${message}`, internal_3.OdspErrorTypes.incorrectServerResponse, {
542
547
  nodeType: getNodeType(node),