@fluidframework/driver-utils 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.246488

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 (287) hide show
  1. package/.eslintrc.cjs +5 -2
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +32 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/driver-utils.api.md +7 -10
  8. package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts +2 -2
  9. package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
  10. package/dist/adapters/compression/documentServiceCompressionAdapter.js +4 -4
  11. package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
  12. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +2 -2
  13. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
  14. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +7 -7
  15. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
  16. package/dist/adapters/compression/index.d.ts +3 -3
  17. package/dist/adapters/compression/index.d.ts.map +1 -1
  18. package/dist/adapters/compression/index.js +7 -7
  19. package/dist/adapters/compression/index.js.map +1 -1
  20. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +2 -2
  21. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  22. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +11 -11
  23. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  24. package/dist/adapters/compression/summaryblob/index.d.ts +1 -1
  25. package/dist/adapters/compression/summaryblob/index.d.ts.map +1 -1
  26. package/dist/adapters/compression/summaryblob/index.js +3 -3
  27. package/dist/adapters/compression/summaryblob/index.js.map +1 -1
  28. package/dist/adapters/index.d.ts +2 -2
  29. package/dist/adapters/index.d.ts.map +1 -1
  30. package/dist/adapters/index.js +6 -6
  31. package/dist/adapters/index.js.map +1 -1
  32. package/dist/adapters/predefinedAdapters.d.ts +1 -1
  33. package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
  34. package/dist/adapters/predefinedAdapters.js +4 -4
  35. package/dist/adapters/predefinedAdapters.js.map +1 -1
  36. package/dist/documentStorageServiceProxy.d.ts +0 -1
  37. package/dist/documentStorageServiceProxy.d.ts.map +1 -1
  38. package/dist/documentStorageServiceProxy.js +0 -3
  39. package/dist/documentStorageServiceProxy.js.map +1 -1
  40. package/dist/driver-utils-alpha.d.ts +2 -2
  41. package/dist/driver-utils-beta.d.ts +2 -2
  42. package/dist/driver-utils-public.d.ts +2 -2
  43. package/dist/driver-utils-untrimmed.d.ts +9 -9
  44. package/dist/index.d.ts +17 -17
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +63 -63
  47. package/dist/index.js.map +1 -1
  48. package/dist/insecureUrlResolver.d.ts +3 -2
  49. package/dist/insecureUrlResolver.d.ts.map +1 -1
  50. package/dist/insecureUrlResolver.js +8 -6
  51. package/dist/insecureUrlResolver.js.map +1 -1
  52. package/dist/messageRecognition.d.ts.map +1 -1
  53. package/dist/messageRecognition.js +2 -2
  54. package/dist/messageRecognition.js.map +1 -1
  55. package/dist/network.d.ts +2 -2
  56. package/dist/network.d.ts.map +1 -1
  57. package/dist/network.js.map +1 -1
  58. package/dist/networkUtils.d.ts +2 -3
  59. package/dist/networkUtils.d.ts.map +1 -1
  60. package/dist/networkUtils.js +3 -3
  61. package/dist/networkUtils.js.map +1 -1
  62. package/dist/package.json +3 -0
  63. package/dist/packageVersion.d.ts +1 -1
  64. package/dist/packageVersion.js +1 -1
  65. package/dist/packageVersion.js.map +1 -1
  66. package/dist/parallelRequests.d.ts +7 -3
  67. package/dist/parallelRequests.d.ts.map +1 -1
  68. package/dist/parallelRequests.js +12 -12
  69. package/dist/parallelRequests.js.map +1 -1
  70. package/dist/prefetchDocumentStorageService.d.ts +1 -1
  71. package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
  72. package/dist/prefetchDocumentStorageService.js +6 -6
  73. package/dist/prefetchDocumentStorageService.js.map +1 -1
  74. package/dist/runWithRetry.js +6 -6
  75. package/dist/runWithRetry.js.map +1 -1
  76. package/dist/treeConversions.d.ts.map +1 -1
  77. package/dist/treeConversions.js +7 -6
  78. package/dist/treeConversions.js.map +1 -1
  79. package/dist/tsdoc-metadata.json +1 -1
  80. package/lib/adapters/compression/{compressionTypes.d.mts → compressionTypes.d.ts} +1 -1
  81. package/lib/adapters/compression/compressionTypes.d.ts.map +1 -0
  82. package/lib/adapters/compression/{compressionTypes.mjs → compressionTypes.js} +1 -1
  83. package/lib/adapters/compression/compressionTypes.js.map +1 -0
  84. package/lib/adapters/compression/{documentServiceCompressionAdapter.d.mts → documentServiceCompressionAdapter.d.ts} +3 -3
  85. package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -0
  86. package/lib/adapters/compression/{documentServiceCompressionAdapter.mjs → documentServiceCompressionAdapter.js} +3 -3
  87. package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -0
  88. package/lib/adapters/compression/{documentServiceFactoryCompressionAdapter.d.mts → documentServiceFactoryCompressionAdapter.d.ts} +3 -3
  89. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -0
  90. package/lib/adapters/compression/{documentServiceFactoryCompressionAdapter.mjs → documentServiceFactoryCompressionAdapter.js} +4 -4
  91. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -0
  92. package/lib/adapters/compression/{index.d.mts → index.d.ts} +4 -4
  93. package/lib/adapters/compression/index.d.ts.map +1 -0
  94. package/lib/adapters/compression/{index.mjs → index.js} +4 -4
  95. package/lib/adapters/compression/index.js.map +1 -0
  96. package/lib/adapters/compression/summaryblob/{documentStorageServiceSummaryBlobCompressionAdapter.d.mts → documentStorageServiceSummaryBlobCompressionAdapter.d.ts} +3 -3
  97. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -0
  98. package/lib/adapters/compression/summaryblob/{documentStorageServiceSummaryBlobCompressionAdapter.mjs → documentStorageServiceSummaryBlobCompressionAdapter.js} +3 -3
  99. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -0
  100. package/lib/adapters/compression/summaryblob/{index.mjs → index.d.ts} +2 -2
  101. package/lib/adapters/compression/summaryblob/index.d.ts.map +1 -0
  102. package/lib/adapters/compression/summaryblob/{index.d.mts → index.js} +2 -2
  103. package/lib/adapters/compression/summaryblob/index.js.map +1 -0
  104. package/lib/adapters/{index.d.mts → index.d.ts} +3 -3
  105. package/lib/adapters/index.d.ts.map +1 -0
  106. package/lib/adapters/{index.mjs → index.js} +3 -3
  107. package/lib/adapters/index.js.map +1 -0
  108. package/lib/adapters/{predefinedAdapters.d.mts → predefinedAdapters.d.ts} +2 -2
  109. package/lib/adapters/predefinedAdapters.d.ts.map +1 -0
  110. package/lib/adapters/{predefinedAdapters.mjs → predefinedAdapters.js} +2 -2
  111. package/lib/adapters/predefinedAdapters.js.map +1 -0
  112. package/lib/{blob.d.mts → blob.d.ts} +1 -1
  113. package/lib/blob.d.ts.map +1 -0
  114. package/lib/{blob.mjs → blob.js} +1 -1
  115. package/lib/blob.js.map +1 -0
  116. package/lib/{buildSnapshotTree.d.mts → buildSnapshotTree.d.ts} +1 -1
  117. package/lib/buildSnapshotTree.d.ts.map +1 -0
  118. package/lib/{buildSnapshotTree.mjs → buildSnapshotTree.js} +1 -1
  119. package/lib/buildSnapshotTree.js.map +1 -0
  120. package/lib/{documentServiceFactoryProxy.d.mts → documentServiceFactoryProxy.d.ts} +1 -1
  121. package/lib/documentServiceFactoryProxy.d.ts.map +1 -0
  122. package/lib/{documentServiceFactoryProxy.mjs → documentServiceFactoryProxy.js} +1 -1
  123. package/lib/documentServiceFactoryProxy.js.map +1 -0
  124. package/lib/{documentServiceProxy.d.mts → documentServiceProxy.d.ts} +1 -1
  125. package/lib/documentServiceProxy.d.ts.map +1 -0
  126. package/lib/{documentServiceProxy.mjs → documentServiceProxy.js} +1 -1
  127. package/lib/documentServiceProxy.js.map +1 -0
  128. package/lib/{documentStorageServiceProxy.d.mts → documentStorageServiceProxy.d.ts} +1 -2
  129. package/lib/documentStorageServiceProxy.d.ts.map +1 -0
  130. package/lib/{documentStorageServiceProxy.mjs → documentStorageServiceProxy.js} +1 -4
  131. package/lib/documentStorageServiceProxy.js.map +1 -0
  132. package/lib/{driver-utils-alpha.d.mts → driver-utils-alpha.d.ts} +2 -2
  133. package/lib/{driver-utils-public.d.mts → driver-utils-beta.d.ts} +2 -2
  134. package/lib/{driver-utils-beta.d.mts → driver-utils-public.d.ts} +2 -2
  135. package/lib/{driver-utils-untrimmed.d.mts → driver-utils-untrimmed.d.ts} +9 -9
  136. package/lib/{error.d.mts → error.d.ts} +1 -1
  137. package/lib/error.d.ts.map +1 -0
  138. package/lib/{error.mjs → error.js} +1 -1
  139. package/lib/error.js.map +1 -0
  140. package/lib/{index.d.mts → index.d.ts} +18 -18
  141. package/lib/index.d.ts.map +1 -0
  142. package/lib/{index.mjs → index.js} +18 -18
  143. package/lib/index.js.map +1 -0
  144. package/lib/{insecureUrlResolver.d.mts → insecureUrlResolver.d.ts} +4 -3
  145. package/lib/insecureUrlResolver.d.ts.map +1 -0
  146. package/lib/{insecureUrlResolver.mjs → insecureUrlResolver.js} +9 -7
  147. package/lib/insecureUrlResolver.js.map +1 -0
  148. package/lib/{messageRecognition.d.mts → messageRecognition.d.ts} +5 -1
  149. package/lib/messageRecognition.d.ts.map +1 -0
  150. package/lib/{messageRecognition.mjs → messageRecognition.js} +5 -1
  151. package/lib/messageRecognition.js.map +1 -0
  152. package/lib/{network.d.mts → network.d.ts} +3 -3
  153. package/lib/network.d.ts.map +1 -0
  154. package/lib/{network.mjs → network.js} +1 -1
  155. package/lib/network.js.map +1 -0
  156. package/lib/networkUtils.d.ts +10 -0
  157. package/lib/networkUtils.d.ts.map +1 -0
  158. package/lib/{networkUtils.mjs → networkUtils.js} +2 -2
  159. package/lib/networkUtils.js.map +1 -0
  160. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  161. package/lib/packageVersion.d.ts.map +1 -0
  162. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  163. package/lib/packageVersion.js.map +1 -0
  164. package/lib/{parallelRequests.d.mts → parallelRequests.d.ts} +8 -4
  165. package/lib/parallelRequests.d.ts.map +1 -0
  166. package/lib/{parallelRequests.mjs → parallelRequests.js} +10 -5
  167. package/lib/parallelRequests.js.map +1 -0
  168. package/lib/{prefetchDocumentStorageService.d.mts → prefetchDocumentStorageService.d.ts} +6 -2
  169. package/lib/prefetchDocumentStorageService.d.ts.map +1 -0
  170. package/lib/{prefetchDocumentStorageService.mjs → prefetchDocumentStorageService.js} +7 -3
  171. package/lib/prefetchDocumentStorageService.js.map +1 -0
  172. package/lib/{rateLimiter.d.mts → rateLimiter.d.ts} +1 -1
  173. package/lib/rateLimiter.d.ts.map +1 -0
  174. package/lib/{rateLimiter.mjs → rateLimiter.js} +1 -1
  175. package/lib/rateLimiter.js.map +1 -0
  176. package/lib/{readAndParse.d.mts → readAndParse.d.ts} +1 -1
  177. package/lib/readAndParse.d.ts.map +1 -0
  178. package/lib/{readAndParse.mjs → readAndParse.js} +1 -1
  179. package/lib/readAndParse.js.map +1 -0
  180. package/lib/{runWithRetry.d.mts → runWithRetry.d.ts} +1 -1
  181. package/lib/runWithRetry.d.ts.map +1 -0
  182. package/lib/{runWithRetry.mjs → runWithRetry.js} +3 -3
  183. package/lib/runWithRetry.js.map +1 -0
  184. package/lib/{storageUtils.d.mts → storageUtils.d.ts} +1 -1
  185. package/lib/storageUtils.d.ts.map +1 -0
  186. package/lib/{storageUtils.mjs → storageUtils.js} +1 -1
  187. package/lib/storageUtils.js.map +1 -0
  188. package/lib/{summaryForCreateNew.d.mts → summaryForCreateNew.d.ts} +1 -1
  189. package/lib/summaryForCreateNew.d.ts.map +1 -0
  190. package/lib/{summaryForCreateNew.mjs → summaryForCreateNew.js} +1 -1
  191. package/lib/summaryForCreateNew.js.map +1 -0
  192. package/lib/test/insecureUrlResolverTest.spec.js +101 -0
  193. package/lib/test/insecureUrlResolverTest.spec.js.map +1 -0
  194. package/lib/test/parallelRequests.spec.js +186 -0
  195. package/lib/test/parallelRequests.spec.js.map +1 -0
  196. package/lib/test/rateLimiter.spec.js +85 -0
  197. package/lib/test/rateLimiter.spec.js.map +1 -0
  198. package/lib/test/runWithRetry.spec.js +180 -0
  199. package/lib/test/runWithRetry.spec.js.map +1 -0
  200. package/lib/test/summaryCompressionData.js +170 -0
  201. package/lib/test/summaryCompressionData.js.map +1 -0
  202. package/lib/test/summaryCompresssionTester.spec.js +429 -0
  203. package/lib/test/summaryCompresssionTester.spec.js.map +1 -0
  204. package/lib/test/types/validateDriverUtilsPrevious.generated.js +108 -0
  205. package/lib/test/types/validateDriverUtilsPrevious.generated.js.map +1 -0
  206. package/lib/{treeConversions.d.mts → treeConversions.d.ts} +1 -1
  207. package/lib/treeConversions.d.ts.map +1 -0
  208. package/lib/{treeConversions.mjs → treeConversions.js} +4 -3
  209. package/lib/treeConversions.js.map +1 -0
  210. package/package.json +74 -27
  211. package/src/adapters/compression/documentServiceCompressionAdapter.ts +3 -3
  212. package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +4 -4
  213. package/src/adapters/compression/index.ts +3 -3
  214. package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +2 -2
  215. package/src/adapters/compression/summaryblob/index.ts +1 -1
  216. package/src/adapters/index.ts +2 -2
  217. package/src/adapters/predefinedAdapters.ts +1 -1
  218. package/src/documentStorageServiceProxy.ts +0 -4
  219. package/src/index.ts +17 -17
  220. package/src/insecureUrlResolver.ts +7 -5
  221. package/src/messageRecognition.ts +1 -0
  222. package/src/network.ts +2 -2
  223. package/src/networkUtils.ts +3 -4
  224. package/src/packageVersion.ts +1 -1
  225. package/src/parallelRequests.ts +12 -11
  226. package/src/prefetchDocumentStorageService.ts +3 -2
  227. package/src/runWithRetry.ts +2 -2
  228. package/src/treeConversions.ts +3 -2
  229. package/tsconfig.cjs.json +7 -0
  230. package/tsconfig.json +2 -5
  231. package/lib/adapters/compression/compressionTypes.d.mts.map +0 -1
  232. package/lib/adapters/compression/compressionTypes.mjs.map +0 -1
  233. package/lib/adapters/compression/documentServiceCompressionAdapter.d.mts.map +0 -1
  234. package/lib/adapters/compression/documentServiceCompressionAdapter.mjs.map +0 -1
  235. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.mts.map +0 -1
  236. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.mjs.map +0 -1
  237. package/lib/adapters/compression/index.d.mts.map +0 -1
  238. package/lib/adapters/compression/index.mjs.map +0 -1
  239. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.mts.map +0 -1
  240. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.mjs.map +0 -1
  241. package/lib/adapters/compression/summaryblob/index.d.mts.map +0 -1
  242. package/lib/adapters/compression/summaryblob/index.mjs.map +0 -1
  243. package/lib/adapters/index.d.mts.map +0 -1
  244. package/lib/adapters/index.mjs.map +0 -1
  245. package/lib/adapters/predefinedAdapters.d.mts.map +0 -1
  246. package/lib/adapters/predefinedAdapters.mjs.map +0 -1
  247. package/lib/blob.d.mts.map +0 -1
  248. package/lib/blob.mjs.map +0 -1
  249. package/lib/buildSnapshotTree.d.mts.map +0 -1
  250. package/lib/buildSnapshotTree.mjs.map +0 -1
  251. package/lib/documentServiceFactoryProxy.d.mts.map +0 -1
  252. package/lib/documentServiceFactoryProxy.mjs.map +0 -1
  253. package/lib/documentServiceProxy.d.mts.map +0 -1
  254. package/lib/documentServiceProxy.mjs.map +0 -1
  255. package/lib/documentStorageServiceProxy.d.mts.map +0 -1
  256. package/lib/documentStorageServiceProxy.mjs.map +0 -1
  257. package/lib/error.d.mts.map +0 -1
  258. package/lib/error.mjs.map +0 -1
  259. package/lib/index.d.mts.map +0 -1
  260. package/lib/index.mjs.map +0 -1
  261. package/lib/insecureUrlResolver.d.mts.map +0 -1
  262. package/lib/insecureUrlResolver.mjs.map +0 -1
  263. package/lib/messageRecognition.d.mts.map +0 -1
  264. package/lib/messageRecognition.mjs.map +0 -1
  265. package/lib/network.d.mts.map +0 -1
  266. package/lib/network.mjs.map +0 -1
  267. package/lib/networkUtils.d.mts +0 -11
  268. package/lib/networkUtils.d.mts.map +0 -1
  269. package/lib/networkUtils.mjs.map +0 -1
  270. package/lib/packageVersion.d.mts.map +0 -1
  271. package/lib/packageVersion.mjs.map +0 -1
  272. package/lib/parallelRequests.d.mts.map +0 -1
  273. package/lib/parallelRequests.mjs.map +0 -1
  274. package/lib/prefetchDocumentStorageService.d.mts.map +0 -1
  275. package/lib/prefetchDocumentStorageService.mjs.map +0 -1
  276. package/lib/rateLimiter.d.mts.map +0 -1
  277. package/lib/rateLimiter.mjs.map +0 -1
  278. package/lib/readAndParse.d.mts.map +0 -1
  279. package/lib/readAndParse.mjs.map +0 -1
  280. package/lib/runWithRetry.d.mts.map +0 -1
  281. package/lib/runWithRetry.mjs.map +0 -1
  282. package/lib/storageUtils.d.mts.map +0 -1
  283. package/lib/storageUtils.mjs.map +0 -1
  284. package/lib/summaryForCreateNew.d.mts.map +0 -1
  285. package/lib/summaryForCreateNew.mjs.map +0 -1
  286. package/lib/treeConversions.d.mts.map +0 -1
  287. package/lib/treeConversions.mjs.map +0 -1
@@ -0,0 +1,429 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
6
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
7
+ /* eslint-disable @typescript-eslint/dot-notation */
8
+ import { strict as assert } from "assert";
9
+ import { TypedEventEmitter } from "@fluid-internal/client-utils";
10
+ import { SummaryType, } from "@fluidframework/protocol-definitions";
11
+ import { applyStorageCompression, SummaryCompressionAlgorithm, blobHeadersBlobName, } from "../adapters/index.js";
12
+ import { snapshotTree, summaryTemplate } from "./summaryCompressionData.js";
13
+ /**
14
+ * This function clones the imported summary and returns a new summary with the same content.
15
+ */
16
+ function cloneSummary() {
17
+ return JSON.parse(JSON.stringify(summaryTemplate));
18
+ }
19
+ /**
20
+ * This function generates the summary with the given content size. At first it clones the summary
21
+ * template, then it generates the content with the given size by loop, which will
22
+ * use repeated sequence from 0 to 10 to generate the content until the content size is achieved.
23
+ * The content is stored in the header of the summary.
24
+ * @param contentSize - The size of the content to be generated.
25
+ */
26
+ function generateSummaryWithContent(contentSize) {
27
+ const summary = cloneSummary();
28
+ const header = summary.tree[".channels"].tree.rootDOId.tree[".channels"].tree["7a99532d-94ec-43ac-8a53-d9f978ad4ae9"].tree.header;
29
+ let contentString = "";
30
+ while (contentString.length < contentSize) {
31
+ if (contentString.length + 10 > contentSize) {
32
+ contentString += "0123456789".substring(0, contentSize - contentString.length);
33
+ break;
34
+ }
35
+ else {
36
+ contentString += "0123456789";
37
+ }
38
+ }
39
+ header["content"] = `{"value": ${contentString}}`;
40
+ return summary;
41
+ }
42
+ function generateSummaryWithBinaryContent(startsWith, contentSize) {
43
+ const summary = cloneSummary();
44
+ const header = summary.tree[".channels"].tree.rootDOId.tree[".channels"].tree["7a99532d-94ec-43ac-8a53-d9f978ad4ae9"].tree.header;
45
+ const content = new Uint8Array(contentSize);
46
+ content[0] = startsWith;
47
+ for (let i = 1; i < contentSize; i = i + 10) {
48
+ for (let j = 0; j < 10; j++) {
49
+ content[i + j] = j;
50
+ }
51
+ }
52
+ header["content"] = content;
53
+ return summary;
54
+ }
55
+ const misotestid = "misotest-id";
56
+ const abcContent = "ABC";
57
+ class InternalTestStorage {
58
+ constructor() {
59
+ this.thisIsReallyOriginalStorage = "yes";
60
+ }
61
+ async getSnapshotTree(version, scenarioName) {
62
+ return JSON.parse(JSON.stringify(snapshotTree));
63
+ }
64
+ async getVersions(versionId, count, scenarioName, fetchSource) {
65
+ throw new Error("Method not implemented.");
66
+ }
67
+ async createBlob(file) {
68
+ throw new Error("Method not implemented.");
69
+ }
70
+ async readBlob(id) {
71
+ return id === misotestid
72
+ ? new TextEncoder().encode(abcContent)
73
+ : getHeaderContent(this._uploadedSummary);
74
+ }
75
+ async uploadSummaryWithContext(summary, context) {
76
+ this._uploadedSummary = summary;
77
+ return "test";
78
+ }
79
+ async downloadSummary(handle) {
80
+ return this._uploadedSummary;
81
+ }
82
+ dispose(error) {
83
+ throw new Error("Method not implemented.");
84
+ }
85
+ get uploadedSummary() {
86
+ return this._uploadedSummary;
87
+ }
88
+ }
89
+ function isOriginalStorage(storage) {
90
+ return storage.thisIsReallyOriginalStorage === "yes";
91
+ }
92
+ class InternalTestDocumentService extends TypedEventEmitter {
93
+ constructor() {
94
+ super();
95
+ this.resolvedUrl = {};
96
+ this.storage = new InternalTestStorage();
97
+ }
98
+ async connectToStorage() {
99
+ return this.storage;
100
+ }
101
+ async connectToDeltaStorage() {
102
+ throw new Error("Method not implemented.");
103
+ }
104
+ async connectToDeltaStream(client) {
105
+ throw new Error("Method not implemented.");
106
+ }
107
+ dispose(error) {
108
+ throw new Error("Method not implemented.");
109
+ }
110
+ }
111
+ class InternalTestDocumentServiceFactory {
112
+ constructor() {
113
+ this.documentService = new InternalTestDocumentService();
114
+ }
115
+ async createDocumentService(resolvedUrl, logger, clientIsSummarizer) {
116
+ return this.documentService;
117
+ }
118
+ async createContainer(createNewSummary, createNewResolvedUrl, logger, clientIsSummarizer) {
119
+ return this.documentService;
120
+ }
121
+ }
122
+ async function buildCompressionStorage(config) {
123
+ {
124
+ const factory = applyStorageCompression(new InternalTestDocumentServiceFactory(), config);
125
+ const documentService = await factory.createContainer(undefined, {});
126
+ const storage = await documentService.connectToStorage();
127
+ return storage;
128
+ }
129
+ }
130
+ const prefixForUncompressed = 0xb0;
131
+ const prefixForLZ4 = 0xb1;
132
+ describe("Summary Compression Test", () => {
133
+ it("Verify Proper Summary Generation", async () => {
134
+ const summary = generateSummaryWithContent(1000000);
135
+ const content = getHeaderContent(summary);
136
+ assert(content.length === 1000000 + 11, `The content size is ${content.length} and should be 1000011`);
137
+ });
138
+ it("Verify Config True", async () => {
139
+ const storage = await buildCompressionStorage(true);
140
+ checkCompressionConfig(storage, 500, SummaryCompressionAlgorithm.LZ4);
141
+ });
142
+ it("Verify Config False", async () => {
143
+ const storage = await buildCompressionStorage(false);
144
+ const config = storage._config;
145
+ assert(config === undefined, "The storage has compression");
146
+ assert(isOriginalStorage(storage), "The storage is not the original storage");
147
+ });
148
+ it("Verify Config Empty", async () => {
149
+ const storage = await buildCompressionStorage();
150
+ const config = storage._config;
151
+ assert(config === undefined, "The storage has compression");
152
+ assert(isOriginalStorage(storage), "The storage is not the original storage");
153
+ });
154
+ it("Verify Config Object (summary-blob markup)", async () => {
155
+ const config = {
156
+ algorithm: SummaryCompressionAlgorithm.None,
157
+ minSizeToCompress: 763,
158
+ };
159
+ const storage = await buildCompressionStorage(config);
160
+ checkCompressionConfig(storage, 763, SummaryCompressionAlgorithm.None);
161
+ });
162
+ it("Verify Compressed Markup at Summary (summary-blob markup)", async () => {
163
+ const config = {
164
+ algorithm: SummaryCompressionAlgorithm.LZ4,
165
+ minSizeToCompress: 500,
166
+ };
167
+ const storage = (await buildCompressionStorage(config));
168
+ const summary = generateSummaryWithContent(1000);
169
+ await storage.uploadSummaryWithContext(summary, {
170
+ referenceSequenceNumber: 0,
171
+ proposalHandle: "test",
172
+ ackHandle: "test",
173
+ });
174
+ const uploadedSummary = storage.service.uploadedSummary;
175
+ assert(uploadedSummary?.tree[blobHeadersBlobName] !== undefined, "The summary-blob markup is not added");
176
+ });
177
+ it("Verify Blob Enc/Dec Symmetry (summary-blob markup)", async () => {
178
+ const config = {
179
+ algorithm: SummaryCompressionAlgorithm.LZ4,
180
+ minSizeToCompress: 500,
181
+ };
182
+ await checkEncDec(config);
183
+ });
184
+ it("Verify Blob Enc/Dec no-compress Symmetry (summary-blob markup)", async () => {
185
+ const config = {
186
+ algorithm: SummaryCompressionAlgorithm.None,
187
+ minSizeToCompress: 500,
188
+ };
189
+ await checkEncDec(config);
190
+ });
191
+ it("Verify Upload / Download Summary (summary-blob markup)", async () => {
192
+ const config = {
193
+ algorithm: SummaryCompressionAlgorithm.LZ4,
194
+ minSizeToCompress: 500,
195
+ };
196
+ await checkUploadDownloadSummary(config);
197
+ });
198
+ it("Verify Upload / Download Summary no-compress (summary-blob markup)", async () => {
199
+ const config = {
200
+ algorithm: SummaryCompressionAlgorithm.None,
201
+ minSizeToCompress: 500,
202
+ };
203
+ await checkUploadDownloadSummary(config);
204
+ });
205
+ it("Verify no-compress small (summary-blob markup)", async () => {
206
+ const config = {
207
+ algorithm: SummaryCompressionAlgorithm.LZ4,
208
+ minSizeToCompress: 500,
209
+ };
210
+ const storage = (await buildCompressionStorage(config));
211
+ const summary = generateSummaryWithContent(300);
212
+ await storage.uploadSummaryWithContext(summary, {
213
+ referenceSequenceNumber: 0,
214
+ proposalHandle: "test",
215
+ ackHandle: "test",
216
+ });
217
+ const originalContent = getHeaderContent(summary);
218
+ const content = new TextDecoder().decode(await storage.readBlob("1234"));
219
+ assert(content === originalContent, `The content is not equal to original content \n${content} \n ${originalContent}`);
220
+ });
221
+ it("Verify no-compress prefix (summary-blob markup)", async () => {
222
+ const config = {
223
+ algorithm: SummaryCompressionAlgorithm.LZ4,
224
+ minSizeToCompress: 500,
225
+ };
226
+ const firstOriginalByte = 0xb3;
227
+ const contentSize = 30;
228
+ const uploadedContent = await uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config);
229
+ const firstByte = uploadedContent[0];
230
+ const secondByte = uploadedContent[1];
231
+ assert(firstByte === prefixForUncompressed, `The first byte should be ${prefixForUncompressed} but is ${firstByte}`);
232
+ assert(secondByte === firstOriginalByte, `The second byte should be ${firstOriginalByte} but is ${secondByte}`);
233
+ });
234
+ it("Verify compress prefix (summary-blob markup)", async () => {
235
+ const config = {
236
+ algorithm: SummaryCompressionAlgorithm.LZ4,
237
+ minSizeToCompress: 500,
238
+ };
239
+ const firstOriginalByte = 0xb3;
240
+ const contentSize = 800;
241
+ const uploadedContent = await uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config);
242
+ const firstByte = uploadedContent[0];
243
+ assert(firstByte === prefixForLZ4, `The first byte should be ${prefixForLZ4} but is ${firstByte}`);
244
+ });
245
+ it("Verify no-compress no-prefix (summary-blob markup)", async () => {
246
+ const config = {
247
+ algorithm: SummaryCompressionAlgorithm.LZ4,
248
+ minSizeToCompress: 500,
249
+ };
250
+ const contentSize = 30;
251
+ await testNoPrefix(contentSize, config);
252
+ });
253
+ it("Verify none-algorithm no-prefix (summary-blob markup)", async () => {
254
+ const config = {
255
+ algorithm: SummaryCompressionAlgorithm.None,
256
+ minSizeToCompress: 500,
257
+ };
258
+ const contentSize = 800;
259
+ await testNoPrefix(contentSize, config);
260
+ });
261
+ it("Verify prefix compressed (summary-blob markup)", async () => {
262
+ const config = {
263
+ algorithm: SummaryCompressionAlgorithm.LZ4,
264
+ minSizeToCompress: 500,
265
+ };
266
+ const contentSize = 800;
267
+ await testPrefix(contentSize, config);
268
+ });
269
+ it("Verify prefix uncompressed small size (summary-blob markup)", async () => {
270
+ const config = {
271
+ algorithm: SummaryCompressionAlgorithm.LZ4,
272
+ minSizeToCompress: 500,
273
+ };
274
+ const contentSize = 30;
275
+ await testPrefix(contentSize, config, 0xb0, 0xc0, prefixForUncompressed);
276
+ });
277
+ it("Verify prefix uncompressed algorithm none (summary-blob markup)", async () => {
278
+ const config = {
279
+ algorithm: SummaryCompressionAlgorithm.None,
280
+ minSizeToCompress: 500,
281
+ };
282
+ const contentSize = 800;
283
+ await testPrefix(contentSize, config, 0xb0, 0xc0, prefixForUncompressed);
284
+ });
285
+ it("Verify enc / dec compressed loop (summary-blob markup)", async () => {
286
+ const config = {
287
+ algorithm: SummaryCompressionAlgorithm.LZ4,
288
+ minSizeToCompress: 500,
289
+ };
290
+ const contentSize = 800;
291
+ await testEncDecBinaryLoop(contentSize, config);
292
+ });
293
+ it("Verify enc / dec uncompressed loop - algorithm none (summary-blob markup)", async () => {
294
+ const config = {
295
+ algorithm: SummaryCompressionAlgorithm.None,
296
+ minSizeToCompress: 500,
297
+ };
298
+ const contentSize = 800;
299
+ await testEncDecBinaryLoop(contentSize, config);
300
+ });
301
+ it("Verify enc / dec uncompressed loop - small (summary-blob markup)", async () => {
302
+ const config = {
303
+ algorithm: SummaryCompressionAlgorithm.None,
304
+ minSizeToCompress: 500,
305
+ };
306
+ const contentSize = 30;
307
+ await testEncDecBinaryLoop(contentSize, config);
308
+ });
309
+ });
310
+ async function testNoPrefix(contentSize, config) {
311
+ for (let i = 0; i < 256; i++) {
312
+ if (i >= 0xb0 && i <= 0xbf) {
313
+ continue;
314
+ }
315
+ const firstOriginalByte = i;
316
+ const uploadedContent = await uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config);
317
+ const firstByte = uploadedContent[0];
318
+ assert(firstByte === firstOriginalByte, `The first byte should be ${firstOriginalByte} but is ${firstByte}`);
319
+ }
320
+ }
321
+ async function testPrefix(contentSize, config, from = 0, to = 256, prefix = prefixForLZ4) {
322
+ for (let i = from; i < to; i++) {
323
+ const firstOriginalByte = i;
324
+ const uploadedContent = await uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config);
325
+ const firstByte = uploadedContent[0];
326
+ assert(firstByte === prefix, `The first byte should be ${prefix} but is ${firstByte}`);
327
+ }
328
+ }
329
+ async function uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config) {
330
+ const storage = (await buildCompressionStorage(config));
331
+ const summary = generateSummaryWithBinaryContent(firstOriginalByte, contentSize);
332
+ await storage.uploadSummaryWithContext(summary, {
333
+ referenceSequenceNumber: 0,
334
+ proposalHandle: "test",
335
+ ackHandle: "test",
336
+ });
337
+ const uploadedSummary = storage.service.uploadedSummary;
338
+ const uploadedContent = getHeaderContent(uploadedSummary);
339
+ return uploadedContent;
340
+ }
341
+ async function checkUploadDownloadSummary(config) {
342
+ const storage = (await buildCompressionStorage(config));
343
+ const summary = generateSummaryWithContent(1000);
344
+ const originBlobContent = getHeaderContent(summary);
345
+ await storage.uploadSummaryWithContext(summary, {
346
+ referenceSequenceNumber: 0,
347
+ proposalHandle: "test",
348
+ ackHandle: "test",
349
+ });
350
+ await storage.getSnapshotTree({ id: "test", treeId: "test" }, "test");
351
+ const summaryHandle = {
352
+ type: SummaryType.Handle,
353
+ handleType: SummaryType.Tree,
354
+ handle: "test",
355
+ };
356
+ const downloadedSummary = await storage.downloadSummary(summaryHandle);
357
+ const downloadedBlobContentBin = getHeaderContent(downloadedSummary);
358
+ // const blobStr = new TextDecoder().decode(blob);
359
+ const downloadedBlobContent = new TextDecoder().decode(downloadedBlobContentBin);
360
+ assert(originBlobContent === downloadedBlobContent, `The origin and the downloaded blob are not the same
361
+ \norigin : ${originBlobContent}
362
+ \ndownloaded : ${downloadedBlobContent}`);
363
+ return downloadedSummary;
364
+ }
365
+ async function checkEncDec(config) {
366
+ const summary = generateSummaryWithContent(1000);
367
+ await checkEncDecConfigurable(summary, config);
368
+ }
369
+ async function checkEncDecBinary(config, startsWith, contentSize) {
370
+ const summary = generateSummaryWithBinaryContent(startsWith, contentSize);
371
+ await checkEncDecConfigurable(summary, config, startsWith);
372
+ }
373
+ async function testEncDecBinaryLoop(contentSize, config, from = 0, to = 256) {
374
+ for (let i = from; i < to; i++) {
375
+ const firstOriginalByte = i;
376
+ await checkEncDecBinary(config, firstOriginalByte, contentSize);
377
+ }
378
+ }
379
+ function compareTwoBlobs(blob1, blob2) {
380
+ const blob1View = new Uint8Array(blob1);
381
+ const blob2View = new Uint8Array(blob2);
382
+ if (blob1View.length !== blob2View.length) {
383
+ return false;
384
+ }
385
+ for (let i = 0; i < blob1View.length; i++) {
386
+ if (blob1View[i] !== blob2View[i]) {
387
+ return false;
388
+ }
389
+ }
390
+ return true;
391
+ }
392
+ async function checkEncDecConfigurable(summary, config, startsWith = -1) {
393
+ const storage = (await buildCompressionStorage(config));
394
+ const originHeaderHolder = getHeaderHolder(summary);
395
+ const originBlob = originHeaderHolder.tree.header.content;
396
+ await storage.uploadSummaryWithContext(summary, {
397
+ referenceSequenceNumber: 0,
398
+ proposalHandle: "test",
399
+ ackHandle: "test",
400
+ });
401
+ await storage.getSnapshotTree({ id: "test", treeId: "test" }, "test");
402
+ const blob = await storage.readBlob("abcd");
403
+ if (typeof originBlob === "string") {
404
+ const blobStr = new TextDecoder().decode(blob);
405
+ assert(blobStr === originBlob, `The origin and the downloaded blob starting with ${startsWith} are not the same \n\n\n${blobStr}\n\n${originBlob}`);
406
+ }
407
+ else {
408
+ assert(compareTwoBlobs(blob, originBlob), `The origin and the downloaded blob are not the same \n\n\n${blob.byteLength}\n\n${originBlob.byteLength}.
409
+ The first bytes are ${blob[0]} and ${originBlob[0]}`);
410
+ }
411
+ }
412
+ function checkCompressionConfig(storage, expectedMinSizeToCompress, expectedAlgorithm) {
413
+ const config = storage._config;
414
+ assert(config !== undefined, "The storage has no compression");
415
+ assert((config.minSizeToCompress === expectedMinSizeToCompress,
416
+ `Unexpected minSizeToCompress config ${config.minSizeToCompress}`));
417
+ assert((config.algorithmm === expectedAlgorithm,
418
+ `Unexpected minSizeToCompress config ${config.algorithmm}`));
419
+ }
420
+ function getHeaderContent(summary) {
421
+ return getHeader(summary)["content"];
422
+ }
423
+ function getHeader(summary) {
424
+ return getHeaderHolder(summary).tree.header;
425
+ }
426
+ function getHeaderHolder(summary) {
427
+ return summary.tree[".channels"].tree.rootDOId.tree[".channels"].tree["7a99532d-94ec-43ac-8a53-d9f978ad4ae9"];
428
+ }
429
+ //# sourceMappingURL=summaryCompresssionTester.spec.js.map
@@ -0,0 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BAA2B,OAAO,OAAO,UAAU,EAAE,CACnH,CAAC;KACF;SAAM;QACN,MAAM,CACL,eAAe,CAAC,IAAI,EAAE,UAAU,CAAC,EACjC,6DAA6D,IAAI,CAAC,UAAU,OAAO,UAAU,CAAC,UAAU;yBAClF,IAAI,CAAC,CAAC,CAAC,QAAQ,UAAU,CAAC,CAAC,CAAC,EAAE,CACpD,CAAC;KACF;AACF,CAAC;AAED,SAAS,sBAAsB,CAC9B,OAAgC,EAChC,yBAAiC,EACjC,iBAA8C;IAE9C,MAAM,MAAM,GAAI,OAAe,CAAC,OAAO,CAAC;IACxC,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,gCAAgC,CAAC,CAAC;IAC/D,MAAM,CACL,CAAC,MAAM,CAAC,iBAAiB,KAAK,yBAAyB;QACvD,uCAAuC,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAClE,CAAC;IACF,MAAM,CACL,CAAC,MAAM,CAAC,UAAU,KAAK,iBAAiB;QACxC,uCAAuC,MAAM,CAAC,UAAU,EAAE,CAAC,CAC3D,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAqB;IAC9C,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,SAAS,CAAC,OAAqB;IACvC,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;AAC7C,CAAC;AAED,SAAS,eAAe,CAAC,OAAqB;IAC7C,OACG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAkB,CAAC,IAAI,CAAC,QAAyB,CAAC,IAAI,CAC/E,WAAW,CAEZ,CAAC,IAAI,CAAC,sCAAsC,CAAiB,CAAC;AAChE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/* eslint-disable @typescript-eslint/dot-notation */\nimport { strict as assert } from \"assert\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tIClient,\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryBlob,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tFetchSource,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServiceFactory,\n\tIDocumentServicePolicies,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tIResolvedUrl,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\tapplyStorageCompression,\n\tICompressionStorageConfig,\n\tSummaryCompressionAlgorithm,\n\tblobHeadersBlobName,\n} from \"../adapters/index.js\";\nimport { DocumentStorageServiceProxy } from \"../documentStorageServiceProxy.js\";\nimport { snapshotTree, summaryTemplate } from \"./summaryCompressionData.js\";\n\n/**\n * This function clones the imported summary and returns a new summary with the same content.\n */\nfunction cloneSummary(): ISummaryTree {\n\treturn JSON.parse(JSON.stringify(summaryTemplate)) as ISummaryTree;\n}\n\n/**\n * This function generates the summary with the given content size. At first it clones the summary\n * template, then it generates the content with the given size by loop, which will\n * use repeated sequence from 0 to 10 to generate the content until the content size is achieved.\n * The content is stored in the header of the summary.\n * @param contentSize - The size of the content to be generated.\n */\nfunction generateSummaryWithContent(contentSize: number) {\n\tconst summary = cloneSummary();\n\tconst header = (\n\t\t(\n\t\t\t((summary.tree[\".channels\"] as ISummaryTree).tree.rootDOId as ISummaryTree).tree[\n\t\t\t\t\".channels\"\n\t\t\t] as ISummaryTree\n\t\t).tree[\"7a99532d-94ec-43ac-8a53-d9f978ad4ae9\"] as ISummaryTree\n\t).tree.header;\n\tlet contentString = \"\";\n\twhile (contentString.length < contentSize) {\n\t\tif (contentString.length + 10 > contentSize) {\n\t\t\tcontentString += \"0123456789\".substring(0, contentSize - contentString.length);\n\t\t\tbreak;\n\t\t} else {\n\t\t\tcontentString += \"0123456789\";\n\t\t}\n\t}\n\theader[\"content\"] = `{\"value\": ${contentString}}`;\n\treturn summary;\n}\n\nfunction generateSummaryWithBinaryContent(startsWith: number, contentSize: number) {\n\tconst summary = cloneSummary();\n\tconst header = (\n\t\t(\n\t\t\t((summary.tree[\".channels\"] as ISummaryTree).tree.rootDOId as ISummaryTree).tree[\n\t\t\t\t\".channels\"\n\t\t\t] as ISummaryTree\n\t\t).tree[\"7a99532d-94ec-43ac-8a53-d9f978ad4ae9\"] as ISummaryTree\n\t).tree.header;\n\tconst content = new Uint8Array(contentSize);\n\tcontent[0] = startsWith;\n\tfor (let i = 1; i < contentSize; i = i + 10) {\n\t\tfor (let j = 0; j < 10; j++) {\n\t\t\tcontent[i + j] = j;\n\t\t}\n\t}\n\theader[\"content\"] = content;\n\treturn summary;\n}\n\nconst misotestid: string = \"misotest-id\";\n\nconst abcContent = \"ABC\";\nclass InternalTestStorage implements IDocumentStorageService {\n\tconstructor() {}\n\tprivate _uploadedSummary: ISummaryTree | undefined;\n\n\tpolicies?: IDocumentStorageServicePolicies | undefined;\n\n\tasync getSnapshotTree(\n\t\tversion?: IVersion | undefined,\n\t\tscenarioName?: string | undefined,\n\t): Promise<ISnapshotTree | null> {\n\t\treturn JSON.parse(JSON.stringify(snapshotTree));\n\t}\n\tasync getVersions(\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string | undefined,\n\t\tfetchSource?: FetchSource | undefined,\n\t): Promise<IVersion[]> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\tasync createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\tasync readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn id === misotestid\n\t\t\t? new TextEncoder().encode(abcContent)\n\t\t\t: getHeaderContent(this._uploadedSummary!);\n\t}\n\tasync uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tthis._uploadedSummary = summary;\n\t\treturn \"test\";\n\t}\n\tasync downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this._uploadedSummary!;\n\t}\n\tdisposed?: boolean | undefined;\n\tdispose?(error?: Error | undefined): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic get uploadedSummary(): ISummaryTree | undefined {\n\t\treturn this._uploadedSummary;\n\t}\n\n\tpublic thisIsReallyOriginalStorage: string = \"yes\";\n}\n\nfunction isOriginalStorage(storage: IDocumentStorageService): boolean {\n\treturn (storage as InternalTestStorage).thisIsReallyOriginalStorage === \"yes\";\n}\n\nclass InternalTestDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tconstructor() {\n\t\tsuper();\n\t}\n\tresolvedUrl: IResolvedUrl = {} as any;\n\tpolicies?: IDocumentServicePolicies | undefined;\n\tstorage: IDocumentStorageService = new InternalTestStorage();\n\tasync connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.storage;\n\t}\n\tasync connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\tasync connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\tdispose(error?: any): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n}\n\nclass InternalTestDocumentServiceFactory implements IDocumentServiceFactory {\n\tprivate readonly documentService: IDocumentService;\n\tconstructor() {\n\t\tthis.documentService = new InternalTestDocumentService();\n\t}\n\n\tasync createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger | undefined,\n\t\tclientIsSummarizer?: boolean | undefined,\n\t): Promise<IDocumentService> {\n\t\treturn this.documentService;\n\t}\n\tasync createContainer(\n\t\tcreateNewSummary: ISummaryTree | undefined,\n\t\tcreateNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger | undefined,\n\t\tclientIsSummarizer?: boolean | undefined,\n\t): Promise<IDocumentService> {\n\t\treturn this.documentService;\n\t}\n}\n\nasync function buildCompressionStorage(\n\tconfig?: ICompressionStorageConfig | boolean,\n): Promise<IDocumentStorageService> {\n\t{\n\t\tconst factory: IDocumentServiceFactory = applyStorageCompression(\n\t\t\tnew InternalTestDocumentServiceFactory(),\n\t\t\tconfig,\n\t\t);\n\t\tconst documentService = await factory.createContainer(undefined, {} as any);\n\t\tconst storage = await documentService.connectToStorage();\n\t\treturn storage;\n\t}\n}\n\nconst prefixForUncompressed = 0xb0;\nconst prefixForLZ4 = 0xb1;\ndescribe(\"Summary Compression Test\", () => {\n\tit(\"Verify Proper Summary Generation\", async () => {\n\t\tconst summary = generateSummaryWithContent(1000000);\n\t\tconst content = getHeaderContent(summary);\n\t\tassert(\n\t\t\tcontent.length === 1000000 + 11,\n\t\t\t`The content size is ${content.length} and should be 1000011`,\n\t\t);\n\t});\n\tit(\"Verify Config True\", async () => {\n\t\tconst storage = await buildCompressionStorage(true);\n\t\tcheckCompressionConfig(storage, 500, SummaryCompressionAlgorithm.LZ4);\n\t});\n\tit(\"Verify Config False\", async () => {\n\t\tconst storage = await buildCompressionStorage(false);\n\t\tconst config = (storage as any)._config;\n\t\tassert(config === undefined, \"The storage has compression\");\n\t\tassert(isOriginalStorage(storage), \"The storage is not the original storage\");\n\t});\n\tit(\"Verify Config Empty\", async () => {\n\t\tconst storage = await buildCompressionStorage();\n\t\tconst config = (storage as any)._config;\n\t\tassert(config === undefined, \"The storage has compression\");\n\t\tassert(isOriginalStorage(storage), \"The storage is not the original storage\");\n\t});\n\tit(\"Verify Config Object (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.None,\n\t\t\tminSizeToCompress: 763,\n\t\t};\n\t\tconst storage = await buildCompressionStorage(config);\n\t\tcheckCompressionConfig(storage, 763, SummaryCompressionAlgorithm.None);\n\t});\n\n\tit(\"Verify Compressed Markup at Summary (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst storage = (await buildCompressionStorage(config)) as DocumentStorageServiceProxy;\n\t\tconst summary = generateSummaryWithContent(1000);\n\t\tawait storage.uploadSummaryWithContext(summary, {\n\t\t\treferenceSequenceNumber: 0,\n\t\t\tproposalHandle: \"test\",\n\t\t\tackHandle: \"test\",\n\t\t});\n\t\tconst uploadedSummary = ((storage as any).service as InternalTestStorage).uploadedSummary;\n\t\tassert(\n\t\t\tuploadedSummary?.tree[blobHeadersBlobName] !== undefined,\n\t\t\t\"The summary-blob markup is not added\",\n\t\t);\n\t});\n\n\tit(\"Verify Blob Enc/Dec Symmetry (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tawait checkEncDec(config);\n\t});\n\n\tit(\"Verify Blob Enc/Dec no-compress Symmetry (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.None,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tawait checkEncDec(config);\n\t});\n\n\tit(\"Verify Upload / Download Summary (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tawait checkUploadDownloadSummary(config);\n\t});\n\n\tit(\"Verify Upload / Download Summary no-compress (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.None,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tawait checkUploadDownloadSummary(config);\n\t});\n\n\tit(\"Verify no-compress small (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst storage = (await buildCompressionStorage(config)) as DocumentStorageServiceProxy;\n\t\tconst summary = generateSummaryWithContent(300);\n\t\tawait storage.uploadSummaryWithContext(summary, {\n\t\t\treferenceSequenceNumber: 0,\n\t\t\tproposalHandle: \"test\",\n\t\t\tackHandle: \"test\",\n\t\t});\n\t\tconst originalContent = getHeaderContent(summary);\n\t\tconst content = new TextDecoder().decode(await storage.readBlob(\"1234\"));\n\t\tassert(\n\t\t\tcontent === originalContent,\n\t\t\t`The content is not equal to original content \\n${content} \\n ${originalContent}`,\n\t\t);\n\t});\n\n\tit(\"Verify no-compress prefix (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst firstOriginalByte = 0xb3;\n\t\tconst contentSize = 30;\n\t\tconst uploadedContent: ArrayBufferLike = await uploadSummaryWithBinaryContent(\n\t\t\tfirstOriginalByte,\n\t\t\tcontentSize,\n\t\t\tconfig,\n\t\t);\n\t\tconst firstByte = uploadedContent[0];\n\t\tconst secondByte = uploadedContent[1];\n\t\tassert(\n\t\t\tfirstByte === prefixForUncompressed,\n\t\t\t`The first byte should be ${prefixForUncompressed} but is ${firstByte}`,\n\t\t);\n\t\tassert(\n\t\t\tsecondByte === firstOriginalByte,\n\t\t\t`The second byte should be ${firstOriginalByte} but is ${secondByte}`,\n\t\t);\n\t});\n\n\tit(\"Verify compress prefix (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst firstOriginalByte = 0xb3;\n\t\tconst contentSize = 800;\n\t\tconst uploadedContent: ArrayBufferLike = await uploadSummaryWithBinaryContent(\n\t\t\tfirstOriginalByte,\n\t\t\tcontentSize,\n\t\t\tconfig,\n\t\t);\n\t\tconst firstByte = uploadedContent[0];\n\t\tassert(\n\t\t\tfirstByte === prefixForLZ4,\n\t\t\t`The first byte should be ${prefixForLZ4} but is ${firstByte}`,\n\t\t);\n\t});\n\n\tit(\"Verify no-compress no-prefix (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst contentSize = 30;\n\t\tawait testNoPrefix(contentSize, config);\n\t});\n\n\tit(\"Verify none-algorithm no-prefix (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.None,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst contentSize = 800;\n\t\tawait testNoPrefix(contentSize, config);\n\t});\n\n\tit(\"Verify prefix compressed (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst contentSize = 800;\n\t\tawait testPrefix(contentSize, config);\n\t});\n\n\tit(\"Verify prefix uncompressed small size (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst contentSize = 30;\n\t\tawait testPrefix(contentSize, config, 0xb0, 0xc0, prefixForUncompressed);\n\t});\n\n\tit(\"Verify prefix uncompressed algorithm none (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.None,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst contentSize = 800;\n\t\tawait testPrefix(contentSize, config, 0xb0, 0xc0, prefixForUncompressed);\n\t});\n\n\tit(\"Verify enc / dec compressed loop (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst contentSize = 800;\n\t\tawait testEncDecBinaryLoop(contentSize, config);\n\t});\n\n\tit(\"Verify enc / dec uncompressed loop - algorithm none (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.None,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst contentSize = 800;\n\t\tawait testEncDecBinaryLoop(contentSize, config);\n\t});\n\n\tit(\"Verify enc / dec uncompressed loop - small (summary-blob markup)\", async () => {\n\t\tconst config: ICompressionStorageConfig = {\n\t\t\talgorithm: SummaryCompressionAlgorithm.None,\n\t\t\tminSizeToCompress: 500,\n\t\t};\n\t\tconst contentSize = 30;\n\t\tawait testEncDecBinaryLoop(contentSize, config);\n\t});\n});\nasync function testNoPrefix(contentSize: number, config: ICompressionStorageConfig) {\n\tfor (let i = 0; i < 256; i++) {\n\t\tif (i >= 0xb0 && i <= 0xbf) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst firstOriginalByte = i;\n\n\t\tconst uploadedContent: ArrayBufferLike = await uploadSummaryWithBinaryContent(\n\t\t\tfirstOriginalByte,\n\t\t\tcontentSize,\n\t\t\tconfig,\n\t\t);\n\t\tconst firstByte = uploadedContent[0];\n\t\tassert(\n\t\t\tfirstByte === firstOriginalByte,\n\t\t\t`The first byte should be ${firstOriginalByte} but is ${firstByte}`,\n\t\t);\n\t}\n}\n\nasync function testPrefix(\n\tcontentSize: number,\n\tconfig: ICompressionStorageConfig,\n\tfrom: number = 0,\n\tto: number = 256,\n\tprefix: number = prefixForLZ4,\n) {\n\tfor (let i = from; i < to; i++) {\n\t\tconst firstOriginalByte = i;\n\t\tconst uploadedContent: ArrayBufferLike = await uploadSummaryWithBinaryContent(\n\t\t\tfirstOriginalByte,\n\t\t\tcontentSize,\n\t\t\tconfig,\n\t\t);\n\t\tconst firstByte = uploadedContent[0];\n\t\tassert(firstByte === prefix, `The first byte should be ${prefix} but is ${firstByte}`);\n\t}\n}\n\nasync function uploadSummaryWithBinaryContent(\n\tfirstOriginalByte: number,\n\tcontentSize: number,\n\tconfig: ICompressionStorageConfig,\n) {\n\tconst storage = (await buildCompressionStorage(config)) as DocumentStorageServiceProxy;\n\tconst summary = generateSummaryWithBinaryContent(firstOriginalByte, contentSize);\n\tawait storage.uploadSummaryWithContext(summary, {\n\t\treferenceSequenceNumber: 0,\n\t\tproposalHandle: \"test\",\n\t\tackHandle: \"test\",\n\t});\n\tconst uploadedSummary = ((storage as any).service as InternalTestStorage).uploadedSummary;\n\tconst uploadedContent: ArrayBufferLike = getHeaderContent(uploadedSummary!);\n\treturn uploadedContent;\n}\n\nasync function checkUploadDownloadSummary(\n\tconfig: ICompressionStorageConfig,\n): Promise<ISummaryTree> {\n\tconst storage = (await buildCompressionStorage(config)) as DocumentStorageServiceProxy;\n\tconst summary = generateSummaryWithContent(1000);\n\tconst originBlobContent = getHeaderContent(summary);\n\tawait storage.uploadSummaryWithContext(summary, {\n\t\treferenceSequenceNumber: 0,\n\t\tproposalHandle: \"test\",\n\t\tackHandle: \"test\",\n\t});\n\tawait storage.getSnapshotTree({ id: \"test\", treeId: \"test\" }, \"test\");\n\tconst summaryHandle: ISummaryHandle = {\n\t\ttype: SummaryType.Handle,\n\t\thandleType: SummaryType.Tree,\n\t\thandle: \"test\",\n\t};\n\tconst downloadedSummary: ISummaryTree = await storage.downloadSummary(summaryHandle);\n\tconst downloadedBlobContentBin = getHeaderContent(downloadedSummary);\n\t// const blobStr = new TextDecoder().decode(blob);\n\tconst downloadedBlobContent = new TextDecoder().decode(downloadedBlobContentBin);\n\tassert(\n\t\toriginBlobContent === downloadedBlobContent,\n\t\t`The origin and the downloaded blob are not the same\n\t\t\\norigin : ${originBlobContent} \n\t\t\\ndownloaded : ${downloadedBlobContent}`,\n\t);\n\treturn downloadedSummary;\n}\n\nasync function checkEncDec(config: ICompressionStorageConfig) {\n\tconst summary = generateSummaryWithContent(1000);\n\tawait checkEncDecConfigurable(summary, config);\n}\n\nasync function checkEncDecBinary(\n\tconfig: ICompressionStorageConfig,\n\tstartsWith: number,\n\tcontentSize: number,\n) {\n\tconst summary = generateSummaryWithBinaryContent(startsWith, contentSize);\n\tawait checkEncDecConfigurable(summary, config, startsWith);\n}\n\nasync function testEncDecBinaryLoop(\n\tcontentSize: number,\n\tconfig: ICompressionStorageConfig,\n\tfrom: number = 0,\n\tto: number = 256,\n) {\n\tfor (let i = from; i < to; i++) {\n\t\tconst firstOriginalByte = i;\n\t\tawait checkEncDecBinary(config, firstOriginalByte, contentSize);\n\t}\n}\n\nfunction compareTwoBlobs(blob1: ArrayBufferLike, blob2: ArrayBufferLike): boolean {\n\tconst blob1View = new Uint8Array(blob1);\n\tconst blob2View = new Uint8Array(blob2);\n\tif (blob1View.length !== blob2View.length) {\n\t\treturn false;\n\t}\n\tfor (let i = 0; i < blob1View.length; i++) {\n\t\tif (blob1View[i] !== blob2View[i]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nasync function checkEncDecConfigurable(\n\tsummary: ISummaryTree,\n\tconfig: ICompressionStorageConfig,\n\tstartsWith = -1,\n) {\n\tconst storage = (await buildCompressionStorage(config)) as DocumentStorageServiceProxy;\n\tconst originHeaderHolder: ISummaryTree = getHeaderHolder(summary);\n\tconst originBlob = (originHeaderHolder.tree.header as ISummaryBlob).content;\n\tawait storage.uploadSummaryWithContext(summary, {\n\t\treferenceSequenceNumber: 0,\n\t\tproposalHandle: \"test\",\n\t\tackHandle: \"test\",\n\t});\n\tawait storage.getSnapshotTree({ id: \"test\", treeId: \"test\" }, \"test\");\n\tconst blob: ArrayBufferLike = await storage.readBlob(\"abcd\");\n\tif (typeof originBlob === \"string\") {\n\t\tconst blobStr = new TextDecoder().decode(blob);\n\t\tassert(\n\t\t\tblobStr === originBlob,\n\t\t\t`The origin and the downloaded blob starting with ${startsWith} are not the same \\n\\n\\n${blobStr}\\n\\n${originBlob}`,\n\t\t);\n\t} else {\n\t\tassert(\n\t\t\tcompareTwoBlobs(blob, originBlob),\n\t\t\t`The origin and the downloaded blob are not the same \\n\\n\\n${blob.byteLength}\\n\\n${originBlob.byteLength}. \n\t\t\tThe first bytes are ${blob[0]} and ${originBlob[0]}`,\n\t\t);\n\t}\n}\n\nfunction checkCompressionConfig(\n\tstorage: IDocumentStorageService,\n\texpectedMinSizeToCompress: number,\n\texpectedAlgorithm: SummaryCompressionAlgorithm,\n) {\n\tconst config = (storage as any)._config;\n\tassert(config !== undefined, \"The storage has no compression\");\n\tassert(\n\t\t(config.minSizeToCompress === expectedMinSizeToCompress,\n\t\t`Unexpected minSizeToCompress config ${config.minSizeToCompress}`),\n\t);\n\tassert(\n\t\t(config.algorithmm === expectedAlgorithm,\n\t\t`Unexpected minSizeToCompress config ${config.algorithmm}`),\n\t);\n}\n\nfunction getHeaderContent(summary: ISummaryTree) {\n\treturn getHeader(summary)[\"content\"];\n}\n\nfunction getHeader(summary: ISummaryTree) {\n\treturn getHeaderHolder(summary).tree.header;\n}\n\nfunction getHeaderHolder(summary: ISummaryTree) {\n\treturn (\n\t\t((summary.tree[\".channels\"] as ISummaryTree).tree.rootDOId as ISummaryTree).tree[\n\t\t\t\".channels\"\n\t\t] as ISummaryTree\n\t).tree[\"7a99532d-94ec-43ac-8a53-d9f978ad4ae9\"] as ISummaryTree;\n}\n"]}
@@ -0,0 +1,108 @@
1
+ use_current_ClassDeclaration_AttachmentTreeEntry(get_old_ClassDeclaration_AttachmentTreeEntry());
2
+ use_old_ClassDeclaration_AttachmentTreeEntry(get_current_ClassDeclaration_AttachmentTreeEntry());
3
+ use_current_ClassDeclaration_AuthorizationError(get_old_ClassDeclaration_AuthorizationError());
4
+ use_old_ClassDeclaration_AuthorizationError(get_current_ClassDeclaration_AuthorizationError());
5
+ use_current_ClassDeclaration_BlobTreeEntry(get_old_ClassDeclaration_BlobTreeEntry());
6
+ use_old_ClassDeclaration_BlobTreeEntry(get_current_ClassDeclaration_BlobTreeEntry());
7
+ use_current_InterfaceDeclaration_CombinedAppAndProtocolSummary(get_old_InterfaceDeclaration_CombinedAppAndProtocolSummary());
8
+ use_old_InterfaceDeclaration_CombinedAppAndProtocolSummary(get_current_InterfaceDeclaration_CombinedAppAndProtocolSummary());
9
+ use_current_ClassDeclaration_DeltaStreamConnectionForbiddenError(get_old_ClassDeclaration_DeltaStreamConnectionForbiddenError());
10
+ use_old_ClassDeclaration_DeltaStreamConnectionForbiddenError(get_current_ClassDeclaration_DeltaStreamConnectionForbiddenError());
11
+ use_current_ClassDeclaration_DocumentStorageServiceProxy(
12
+ // @ts-expect-error compatibility expected to be broken
13
+ get_old_ClassDeclaration_DocumentStorageServiceProxy());
14
+ use_old_ClassDeclaration_DocumentStorageServiceProxy(
15
+ // @ts-expect-error compatibility expected to be broken
16
+ get_current_ClassDeclaration_DocumentStorageServiceProxy());
17
+ use_current_TypeAliasDeclaration_DriverErrorTelemetryProps(get_old_TypeAliasDeclaration_DriverErrorTelemetryProps());
18
+ use_old_TypeAliasDeclaration_DriverErrorTelemetryProps(get_current_TypeAliasDeclaration_DriverErrorTelemetryProps());
19
+ use_current_ClassDeclaration_FluidInvalidSchemaError(get_old_ClassDeclaration_FluidInvalidSchemaError());
20
+ use_old_ClassDeclaration_FluidInvalidSchemaError(get_current_ClassDeclaration_FluidInvalidSchemaError());
21
+ use_current_ClassDeclaration_GenericNetworkError(get_old_ClassDeclaration_GenericNetworkError());
22
+ use_old_ClassDeclaration_GenericNetworkError(get_current_ClassDeclaration_GenericNetworkError());
23
+ use_current_InterfaceDeclaration_ICompressionStorageConfig(get_old_InterfaceDeclaration_ICompressionStorageConfig());
24
+ use_old_InterfaceDeclaration_ICompressionStorageConfig(get_current_InterfaceDeclaration_ICompressionStorageConfig());
25
+ use_current_InterfaceDeclaration_IProgress(get_old_InterfaceDeclaration_IProgress());
26
+ use_old_InterfaceDeclaration_IProgress(get_current_InterfaceDeclaration_IProgress());
27
+ use_current_ClassDeclaration_InsecureUrlResolver(get_old_ClassDeclaration_InsecureUrlResolver());
28
+ use_old_ClassDeclaration_InsecureUrlResolver(get_current_ClassDeclaration_InsecureUrlResolver());
29
+ use_current_ClassDeclaration_LocationRedirectionError(get_old_ClassDeclaration_LocationRedirectionError());
30
+ use_old_ClassDeclaration_LocationRedirectionError(get_current_ClassDeclaration_LocationRedirectionError());
31
+ use_current_EnumDeclaration_MessageType2(get_old_EnumDeclaration_MessageType2());
32
+ use_old_EnumDeclaration_MessageType2(get_current_EnumDeclaration_MessageType2());
33
+ use_current_ClassDeclaration_NetworkErrorBasic(get_old_ClassDeclaration_NetworkErrorBasic());
34
+ use_old_ClassDeclaration_NetworkErrorBasic(get_current_ClassDeclaration_NetworkErrorBasic());
35
+ use_current_ClassDeclaration_NonRetryableError(get_old_ClassDeclaration_NonRetryableError());
36
+ use_old_ClassDeclaration_NonRetryableError(get_current_ClassDeclaration_NonRetryableError());
37
+ use_current_EnumDeclaration_OnlineStatus(get_old_EnumDeclaration_OnlineStatus());
38
+ use_old_EnumDeclaration_OnlineStatus(get_current_EnumDeclaration_OnlineStatus());
39
+ use_current_ClassDeclaration_ParallelRequests(get_old_ClassDeclaration_ParallelRequests());
40
+ use_old_ClassDeclaration_ParallelRequests(get_current_ClassDeclaration_ParallelRequests());
41
+ use_current_ClassDeclaration_PrefetchDocumentStorageService(
42
+ // @ts-expect-error compatibility expected to be broken
43
+ get_old_ClassDeclaration_PrefetchDocumentStorageService());
44
+ use_old_ClassDeclaration_PrefetchDocumentStorageService(
45
+ // @ts-expect-error compatibility expected to be broken
46
+ get_current_ClassDeclaration_PrefetchDocumentStorageService());
47
+ use_current_ClassDeclaration_Queue(get_old_ClassDeclaration_Queue());
48
+ use_old_ClassDeclaration_Queue(get_current_ClassDeclaration_Queue());
49
+ use_current_ClassDeclaration_RateLimiter(get_old_ClassDeclaration_RateLimiter());
50
+ use_old_ClassDeclaration_RateLimiter(get_current_ClassDeclaration_RateLimiter());
51
+ use_current_ClassDeclaration_RetryableError(get_old_ClassDeclaration_RetryableError());
52
+ use_old_ClassDeclaration_RetryableError(get_current_ClassDeclaration_RetryableError());
53
+ use_current_EnumDeclaration_SummaryCompressionAlgorithm(get_old_EnumDeclaration_SummaryCompressionAlgorithm());
54
+ use_old_EnumDeclaration_SummaryCompressionAlgorithm(get_current_EnumDeclaration_SummaryCompressionAlgorithm());
55
+ use_current_ClassDeclaration_ThrottlingError(get_old_ClassDeclaration_ThrottlingError());
56
+ use_old_ClassDeclaration_ThrottlingError(get_current_ClassDeclaration_ThrottlingError());
57
+ use_current_ClassDeclaration_TreeTreeEntry(get_old_ClassDeclaration_TreeTreeEntry());
58
+ use_old_ClassDeclaration_TreeTreeEntry(get_current_ClassDeclaration_TreeTreeEntry());
59
+ use_current_ClassDeclaration_UsageError(get_old_ClassDeclaration_UsageError());
60
+ use_old_ClassDeclaration_UsageError(get_current_ClassDeclaration_UsageError());
61
+ use_current_FunctionDeclaration_applyStorageCompression(get_old_FunctionDeclaration_applyStorageCompression());
62
+ use_old_FunctionDeclaration_applyStorageCompression(get_current_FunctionDeclaration_applyStorageCompression());
63
+ use_current_VariableDeclaration_blobHeadersBlobName(get_old_VariableDeclaration_blobHeadersBlobName());
64
+ use_old_VariableDeclaration_blobHeadersBlobName(get_current_VariableDeclaration_blobHeadersBlobName());
65
+ use_current_FunctionDeclaration_buildSnapshotTree(get_old_FunctionDeclaration_buildSnapshotTree());
66
+ use_old_FunctionDeclaration_buildSnapshotTree(get_current_FunctionDeclaration_buildSnapshotTree());
67
+ use_current_FunctionDeclaration_calculateMaxWaitTime(get_old_FunctionDeclaration_calculateMaxWaitTime());
68
+ use_old_FunctionDeclaration_calculateMaxWaitTime(get_current_FunctionDeclaration_calculateMaxWaitTime());
69
+ use_current_FunctionDeclaration_canBeCoalescedByService(get_old_FunctionDeclaration_canBeCoalescedByService());
70
+ use_old_FunctionDeclaration_canBeCoalescedByService(get_current_FunctionDeclaration_canBeCoalescedByService());
71
+ use_current_VariableDeclaration_canRetryOnError(get_old_VariableDeclaration_canRetryOnError());
72
+ use_old_VariableDeclaration_canRetryOnError(get_current_VariableDeclaration_canRetryOnError());
73
+ use_current_FunctionDeclaration_convertSummaryTreeToSnapshotITree(get_old_FunctionDeclaration_convertSummaryTreeToSnapshotITree());
74
+ use_old_FunctionDeclaration_convertSummaryTreeToSnapshotITree(get_current_FunctionDeclaration_convertSummaryTreeToSnapshotITree());
75
+ use_current_FunctionDeclaration_createGenericNetworkError(get_old_FunctionDeclaration_createGenericNetworkError());
76
+ use_old_FunctionDeclaration_createGenericNetworkError(get_current_FunctionDeclaration_createGenericNetworkError());
77
+ use_current_VariableDeclaration_createWriteError(get_old_VariableDeclaration_createWriteError());
78
+ use_old_VariableDeclaration_createWriteError(get_current_VariableDeclaration_createWriteError());
79
+ use_current_VariableDeclaration_emptyMessageStream(get_old_VariableDeclaration_emptyMessageStream());
80
+ use_old_VariableDeclaration_emptyMessageStream(get_current_VariableDeclaration_emptyMessageStream());
81
+ use_current_FunctionDeclaration_getDocAttributesFromProtocolSummary(get_old_FunctionDeclaration_getDocAttributesFromProtocolSummary());
82
+ use_old_FunctionDeclaration_getDocAttributesFromProtocolSummary(get_current_FunctionDeclaration_getDocAttributesFromProtocolSummary());
83
+ use_current_FunctionDeclaration_getQuorumValuesFromProtocolSummary(get_old_FunctionDeclaration_getQuorumValuesFromProtocolSummary());
84
+ use_old_FunctionDeclaration_getQuorumValuesFromProtocolSummary(get_current_FunctionDeclaration_getQuorumValuesFromProtocolSummary());
85
+ use_current_VariableDeclaration_getRetryDelayFromError(get_old_VariableDeclaration_getRetryDelayFromError());
86
+ use_old_VariableDeclaration_getRetryDelayFromError(get_current_VariableDeclaration_getRetryDelayFromError());
87
+ use_current_VariableDeclaration_getRetryDelaySecondsFromError(get_old_VariableDeclaration_getRetryDelaySecondsFromError());
88
+ use_old_VariableDeclaration_getRetryDelaySecondsFromError(get_current_VariableDeclaration_getRetryDelaySecondsFromError());
89
+ use_current_FunctionDeclaration_isCombinedAppAndProtocolSummary(get_old_FunctionDeclaration_isCombinedAppAndProtocolSummary());
90
+ use_old_FunctionDeclaration_isCombinedAppAndProtocolSummary(get_current_FunctionDeclaration_isCombinedAppAndProtocolSummary());
91
+ use_current_FunctionDeclaration_isOnline(get_old_FunctionDeclaration_isOnline());
92
+ use_old_FunctionDeclaration_isOnline(get_current_FunctionDeclaration_isOnline());
93
+ use_current_FunctionDeclaration_isRuntimeMessage(get_old_FunctionDeclaration_isRuntimeMessage());
94
+ use_old_FunctionDeclaration_isRuntimeMessage(get_current_FunctionDeclaration_isRuntimeMessage());
95
+ use_current_FunctionDeclaration_logNetworkFailure(get_old_FunctionDeclaration_logNetworkFailure());
96
+ use_old_FunctionDeclaration_logNetworkFailure(get_current_FunctionDeclaration_logNetworkFailure());
97
+ use_current_FunctionDeclaration_readAndParse(get_old_FunctionDeclaration_readAndParse());
98
+ use_old_FunctionDeclaration_readAndParse(get_current_FunctionDeclaration_readAndParse());
99
+ use_current_FunctionDeclaration_requestOps(get_old_FunctionDeclaration_requestOps());
100
+ use_old_FunctionDeclaration_requestOps(get_current_FunctionDeclaration_requestOps());
101
+ use_current_FunctionDeclaration_runWithRetry(get_old_FunctionDeclaration_runWithRetry());
102
+ use_old_FunctionDeclaration_runWithRetry(get_current_FunctionDeclaration_runWithRetry());
103
+ use_current_FunctionDeclaration_streamFromMessages(get_old_FunctionDeclaration_streamFromMessages());
104
+ use_old_FunctionDeclaration_streamFromMessages(get_current_FunctionDeclaration_streamFromMessages());
105
+ use_current_FunctionDeclaration_streamObserver(get_old_FunctionDeclaration_streamObserver());
106
+ use_old_FunctionDeclaration_streamObserver(get_current_FunctionDeclaration_streamObserver());
107
+ export {};
108
+ //# sourceMappingURL=validateDriverUtilsPrevious.generated.js.map