@fluidframework/container-loader 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 (297) hide show
  1. package/.eslintrc.cjs +5 -6
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +48 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/container-loader.api.md +2 -2
  8. package/dist/attachment.d.ts +6 -7
  9. package/dist/attachment.d.ts.map +1 -1
  10. package/dist/attachment.js +8 -7
  11. package/dist/attachment.js.map +1 -1
  12. package/dist/audience.d.ts +9 -4
  13. package/dist/audience.d.ts.map +1 -1
  14. package/dist/audience.js +12 -6
  15. package/dist/audience.js.map +1 -1
  16. package/dist/connectionManager.d.ts +3 -3
  17. package/dist/connectionManager.d.ts.map +1 -1
  18. package/dist/connectionManager.js +20 -18
  19. package/dist/connectionManager.js.map +1 -1
  20. package/dist/connectionState.d.ts +1 -0
  21. package/dist/connectionState.d.ts.map +1 -1
  22. package/dist/connectionState.js +1 -0
  23. package/dist/connectionState.js.map +1 -1
  24. package/dist/connectionStateHandler.d.ts +7 -7
  25. package/dist/connectionStateHandler.d.ts.map +1 -1
  26. package/dist/connectionStateHandler.js +32 -32
  27. package/dist/connectionStateHandler.js.map +1 -1
  28. package/dist/container-loader-alpha.d.ts +1 -0
  29. package/dist/container-loader-beta.d.ts +3 -0
  30. package/dist/container-loader-public.d.ts +3 -0
  31. package/dist/container-loader-untrimmed.d.ts +4 -4
  32. package/dist/container.d.ts +11 -22
  33. package/dist/container.d.ts.map +1 -1
  34. package/dist/container.js +101 -194
  35. package/dist/container.js.map +1 -1
  36. package/dist/containerStorageAdapter.d.ts +2 -3
  37. package/dist/containerStorageAdapter.d.ts.map +1 -1
  38. package/dist/containerStorageAdapter.js +4 -10
  39. package/dist/containerStorageAdapter.js.map +1 -1
  40. package/dist/contracts.d.ts +3 -3
  41. package/dist/contracts.d.ts.map +1 -1
  42. package/dist/contracts.js.map +1 -1
  43. package/dist/debugLogger.js.map +1 -1
  44. package/dist/deltaManager.d.ts +5 -5
  45. package/dist/deltaManager.d.ts.map +1 -1
  46. package/dist/deltaManager.js +6 -6
  47. package/dist/deltaManager.js.map +1 -1
  48. package/dist/error.d.ts.map +1 -1
  49. package/dist/error.js.map +1 -1
  50. package/dist/index.d.ts +6 -6
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +11 -11
  53. package/dist/index.js.map +1 -1
  54. package/dist/loader.d.ts +2 -2
  55. package/dist/loader.d.ts.map +1 -1
  56. package/dist/loader.js +13 -17
  57. package/dist/loader.js.map +1 -1
  58. package/dist/location-redirection-utilities/index.d.ts +1 -1
  59. package/dist/location-redirection-utilities/index.d.ts.map +1 -1
  60. package/dist/location-redirection-utilities/index.js +3 -3
  61. package/dist/location-redirection-utilities/index.js.map +1 -1
  62. package/dist/package.json +3 -0
  63. package/dist/packageVersion.d.ts +1 -1
  64. package/dist/packageVersion.js +1 -1
  65. package/dist/packageVersion.js.map +1 -1
  66. package/dist/protocolTreeDocumentStorageService.d.ts +0 -1
  67. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  68. package/dist/protocolTreeDocumentStorageService.js +0 -3
  69. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  70. package/dist/quorum.d.ts.map +1 -1
  71. package/dist/quorum.js +4 -0
  72. package/dist/quorum.js.map +1 -1
  73. package/dist/retriableDocumentStorageService.d.ts +0 -1
  74. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  75. package/dist/retriableDocumentStorageService.js +0 -6
  76. package/dist/retriableDocumentStorageService.js.map +1 -1
  77. package/dist/serializedStateManager.d.ts +44 -0
  78. package/dist/serializedStateManager.d.ts.map +1 -0
  79. package/dist/serializedStateManager.js +149 -0
  80. package/dist/serializedStateManager.js.map +1 -0
  81. package/dist/tsdoc-metadata.json +1 -1
  82. package/dist/utils.d.ts +5 -6
  83. package/dist/utils.d.ts.map +1 -1
  84. package/dist/utils.js +10 -4
  85. package/dist/utils.js.map +1 -1
  86. package/lib/{attachment.d.mts → attachment.d.ts} +11 -8
  87. package/lib/attachment.d.ts.map +1 -0
  88. package/lib/{attachment.mjs → attachment.js} +11 -6
  89. package/lib/attachment.js.map +1 -0
  90. package/lib/{audience.d.mts → audience.d.ts} +14 -5
  91. package/lib/audience.d.ts.map +1 -0
  92. package/lib/{audience.mjs → audience.js} +14 -4
  93. package/lib/audience.js.map +1 -0
  94. package/lib/{catchUpMonitor.d.mts → catchUpMonitor.d.ts} +1 -1
  95. package/lib/catchUpMonitor.d.ts.map +1 -0
  96. package/lib/{catchUpMonitor.mjs → catchUpMonitor.js} +1 -1
  97. package/lib/catchUpMonitor.js.map +1 -0
  98. package/lib/{connectionManager.d.mts → connectionManager.d.ts} +4 -4
  99. package/lib/connectionManager.d.ts.map +1 -0
  100. package/lib/{connectionManager.mjs → connectionManager.js} +9 -7
  101. package/lib/connectionManager.js.map +1 -0
  102. package/lib/{connectionState.d.mts → connectionState.d.ts} +2 -1
  103. package/lib/connectionState.d.ts.map +1 -0
  104. package/lib/{connectionState.mjs → connectionState.js} +2 -1
  105. package/lib/connectionState.js.map +1 -0
  106. package/lib/{connectionStateHandler.d.mts → connectionStateHandler.d.ts} +8 -8
  107. package/lib/connectionStateHandler.d.ts.map +1 -0
  108. package/lib/{connectionStateHandler.mjs → connectionStateHandler.js} +3 -3
  109. package/lib/connectionStateHandler.js.map +1 -0
  110. package/lib/{container-loader-alpha.d.mts → container-loader-alpha.d.ts} +1 -0
  111. package/lib/{container-loader-beta.d.mts → container-loader-beta.d.ts} +3 -0
  112. package/lib/{container-loader-public.d.mts → container-loader-public.d.ts} +3 -0
  113. package/lib/{container-loader-untrimmed.d.mts → container-loader-untrimmed.d.ts} +4 -4
  114. package/lib/{container.d.mts → container.d.ts} +12 -23
  115. package/lib/container.d.ts.map +1 -0
  116. package/lib/{container.mjs → container.js} +55 -148
  117. package/lib/container.js.map +1 -0
  118. package/lib/{containerContext.d.mts → containerContext.d.ts} +1 -1
  119. package/lib/containerContext.d.ts.map +1 -0
  120. package/lib/{containerContext.mjs → containerContext.js} +1 -1
  121. package/lib/containerContext.js.map +1 -0
  122. package/lib/{containerStorageAdapter.d.mts → containerStorageAdapter.d.ts} +3 -4
  123. package/lib/containerStorageAdapter.d.ts.map +1 -0
  124. package/lib/{containerStorageAdapter.mjs → containerStorageAdapter.js} +3 -9
  125. package/lib/containerStorageAdapter.js.map +1 -0
  126. package/lib/{contracts.d.mts → contracts.d.ts} +4 -4
  127. package/lib/contracts.d.ts.map +1 -0
  128. package/lib/{contracts.mjs → contracts.js} +1 -1
  129. package/lib/contracts.js.map +1 -0
  130. package/lib/{debugLogger.d.mts → debugLogger.d.ts} +1 -1
  131. package/lib/debugLogger.d.ts.map +1 -0
  132. package/lib/{debugLogger.mjs → debugLogger.js} +2 -1
  133. package/lib/debugLogger.js.map +1 -0
  134. package/lib/{deltaManager.d.mts → deltaManager.d.ts} +6 -6
  135. package/lib/deltaManager.d.ts.map +1 -0
  136. package/lib/{deltaManager.mjs → deltaManager.js} +4 -4
  137. package/lib/deltaManager.js.map +1 -0
  138. package/lib/{deltaQueue.d.mts → deltaQueue.d.ts} +1 -1
  139. package/lib/deltaQueue.d.ts.map +1 -0
  140. package/lib/{deltaQueue.mjs → deltaQueue.js} +1 -1
  141. package/lib/deltaQueue.js.map +1 -0
  142. package/lib/{disposal.d.mts → disposal.d.ts} +1 -1
  143. package/lib/disposal.d.ts.map +1 -0
  144. package/lib/{disposal.mjs → disposal.js} +1 -1
  145. package/lib/disposal.js.map +1 -0
  146. package/lib/{error.d.mts → error.d.ts} +1 -1
  147. package/lib/error.d.ts.map +1 -0
  148. package/lib/{error.mjs → error.js} +1 -1
  149. package/lib/error.js.map +1 -0
  150. package/lib/{index.d.mts → index.d.ts} +7 -7
  151. package/lib/index.d.ts.map +1 -0
  152. package/lib/index.js +10 -0
  153. package/lib/index.js.map +1 -0
  154. package/lib/{loader.d.mts → loader.d.ts} +3 -3
  155. package/lib/loader.d.ts.map +1 -0
  156. package/lib/{loader.mjs → loader.js} +7 -11
  157. package/lib/loader.js.map +1 -0
  158. package/lib/location-redirection-utilities/{index.mjs → index.d.ts} +2 -2
  159. package/lib/location-redirection-utilities/index.d.ts.map +1 -0
  160. package/lib/location-redirection-utilities/{index.d.mts → index.js} +2 -2
  161. package/lib/location-redirection-utilities/index.js.map +1 -0
  162. package/lib/location-redirection-utilities/{resolveWithLocationRedirection.d.mts → resolveWithLocationRedirection.d.ts} +1 -1
  163. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
  164. package/lib/location-redirection-utilities/{resolveWithLocationRedirection.mjs → resolveWithLocationRedirection.js} +1 -1
  165. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
  166. package/lib/{noopHeuristic.d.mts → noopHeuristic.d.ts} +1 -1
  167. package/lib/noopHeuristic.d.ts.map +1 -0
  168. package/lib/{noopHeuristic.mjs → noopHeuristic.js} +1 -1
  169. package/lib/noopHeuristic.js.map +1 -0
  170. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  171. package/lib/packageVersion.d.ts.map +1 -0
  172. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  173. package/lib/packageVersion.js.map +1 -0
  174. package/lib/{protocol.d.mts → protocol.d.ts} +1 -1
  175. package/lib/protocol.d.ts.map +1 -0
  176. package/lib/{protocol.mjs → protocol.js} +1 -1
  177. package/lib/protocol.js.map +1 -0
  178. package/lib/{protocolTreeDocumentStorageService.d.mts → protocolTreeDocumentStorageService.d.ts} +1 -2
  179. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -0
  180. package/lib/{protocolTreeDocumentStorageService.mjs → protocolTreeDocumentStorageService.js} +1 -4
  181. package/lib/protocolTreeDocumentStorageService.js.map +1 -0
  182. package/lib/{quorum.d.mts → quorum.d.ts} +5 -1
  183. package/lib/quorum.d.ts.map +1 -0
  184. package/lib/{quorum.mjs → quorum.js} +5 -1
  185. package/lib/quorum.js.map +1 -0
  186. package/lib/{retriableDocumentStorageService.d.mts → retriableDocumentStorageService.d.ts} +1 -2
  187. package/lib/retriableDocumentStorageService.d.ts.map +1 -0
  188. package/lib/{retriableDocumentStorageService.mjs → retriableDocumentStorageService.js} +1 -7
  189. package/lib/retriableDocumentStorageService.js.map +1 -0
  190. package/lib/serializedStateManager.d.ts +44 -0
  191. package/lib/serializedStateManager.d.ts.map +1 -0
  192. package/lib/serializedStateManager.js +145 -0
  193. package/lib/serializedStateManager.js.map +1 -0
  194. package/lib/test/attachment.spec.js +380 -0
  195. package/lib/test/attachment.spec.js.map +1 -0
  196. package/lib/test/catchUpMonitor.spec.js +88 -0
  197. package/lib/test/catchUpMonitor.spec.js.map +1 -0
  198. package/lib/test/connectionManager.spec.js +201 -0
  199. package/lib/test/connectionManager.spec.js.map +1 -0
  200. package/lib/test/connectionStateHandler.spec.js +555 -0
  201. package/lib/test/connectionStateHandler.spec.js.map +1 -0
  202. package/lib/test/container.spec.js +64 -0
  203. package/lib/test/container.spec.js.map +1 -0
  204. package/lib/test/deltaManager.spec.js +405 -0
  205. package/lib/test/deltaManager.spec.js.map +1 -0
  206. package/lib/test/loader.spec.js +212 -0
  207. package/lib/test/loader.spec.js.map +1 -0
  208. package/lib/test/locationRedirectionTests.spec.js +44 -0
  209. package/lib/test/locationRedirectionTests.spec.js.map +1 -0
  210. package/lib/test/serializedStateManager.spec.js +148 -0
  211. package/lib/test/serializedStateManager.spec.js.map +1 -0
  212. package/lib/test/snapshotConversionTest.spec.js +79 -0
  213. package/lib/test/snapshotConversionTest.spec.js.map +1 -0
  214. package/lib/test/types/validateContainerLoaderPrevious.generated.js +38 -0
  215. package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +1 -0
  216. package/lib/test/utils.spec.js +31 -0
  217. package/lib/test/utils.spec.js.map +1 -0
  218. package/lib/{utils.d.mts → utils.d.ts} +6 -7
  219. package/lib/utils.d.ts.map +1 -0
  220. package/lib/{utils.mjs → utils.js} +11 -5
  221. package/lib/utils.js.map +1 -0
  222. package/package.json +56 -62
  223. package/src/attachment.ts +16 -12
  224. package/src/audience.ts +10 -3
  225. package/src/connectionManager.ts +13 -9
  226. package/src/connectionState.ts +1 -0
  227. package/src/connectionStateHandler.ts +8 -7
  228. package/src/container.ts +96 -191
  229. package/src/containerStorageAdapter.ts +6 -14
  230. package/src/contracts.ts +3 -3
  231. package/src/debugLogger.ts +2 -2
  232. package/src/deltaManager.ts +8 -8
  233. package/src/error.ts +2 -2
  234. package/src/index.ts +6 -6
  235. package/src/loader.ts +8 -12
  236. package/src/location-redirection-utilities/index.ts +1 -1
  237. package/src/packageVersion.ts +1 -1
  238. package/src/protocolTreeDocumentStorageService.ts +0 -3
  239. package/src/quorum.ts +1 -0
  240. package/src/retriableDocumentStorageService.ts +0 -7
  241. package/src/serializedStateManager.ts +217 -0
  242. package/src/utils.ts +15 -10
  243. package/tsconfig.cjs.json +7 -0
  244. package/tsconfig.json +2 -5
  245. package/lib/attachment.d.mts.map +0 -1
  246. package/lib/attachment.mjs.map +0 -1
  247. package/lib/audience.d.mts.map +0 -1
  248. package/lib/audience.mjs.map +0 -1
  249. package/lib/catchUpMonitor.d.mts.map +0 -1
  250. package/lib/catchUpMonitor.mjs.map +0 -1
  251. package/lib/connectionManager.d.mts.map +0 -1
  252. package/lib/connectionManager.mjs.map +0 -1
  253. package/lib/connectionState.d.mts.map +0 -1
  254. package/lib/connectionState.mjs.map +0 -1
  255. package/lib/connectionStateHandler.d.mts.map +0 -1
  256. package/lib/connectionStateHandler.mjs.map +0 -1
  257. package/lib/container.d.mts.map +0 -1
  258. package/lib/container.mjs.map +0 -1
  259. package/lib/containerContext.d.mts.map +0 -1
  260. package/lib/containerContext.mjs.map +0 -1
  261. package/lib/containerStorageAdapter.d.mts.map +0 -1
  262. package/lib/containerStorageAdapter.mjs.map +0 -1
  263. package/lib/contracts.d.mts.map +0 -1
  264. package/lib/contracts.mjs.map +0 -1
  265. package/lib/debugLogger.d.mts.map +0 -1
  266. package/lib/debugLogger.mjs.map +0 -1
  267. package/lib/deltaManager.d.mts.map +0 -1
  268. package/lib/deltaManager.mjs.map +0 -1
  269. package/lib/deltaQueue.d.mts.map +0 -1
  270. package/lib/deltaQueue.mjs.map +0 -1
  271. package/lib/disposal.d.mts.map +0 -1
  272. package/lib/disposal.mjs.map +0 -1
  273. package/lib/error.d.mts.map +0 -1
  274. package/lib/error.mjs.map +0 -1
  275. package/lib/index.d.mts.map +0 -1
  276. package/lib/index.mjs +0 -10
  277. package/lib/index.mjs.map +0 -1
  278. package/lib/loader.d.mts.map +0 -1
  279. package/lib/loader.mjs.map +0 -1
  280. package/lib/location-redirection-utilities/index.d.mts.map +0 -1
  281. package/lib/location-redirection-utilities/index.mjs.map +0 -1
  282. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts.map +0 -1
  283. package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +0 -1
  284. package/lib/noopHeuristic.d.mts.map +0 -1
  285. package/lib/noopHeuristic.mjs.map +0 -1
  286. package/lib/packageVersion.d.mts.map +0 -1
  287. package/lib/packageVersion.mjs.map +0 -1
  288. package/lib/protocol.d.mts.map +0 -1
  289. package/lib/protocol.mjs.map +0 -1
  290. package/lib/protocolTreeDocumentStorageService.d.mts.map +0 -1
  291. package/lib/protocolTreeDocumentStorageService.mjs.map +0 -1
  292. package/lib/quorum.d.mts.map +0 -1
  293. package/lib/quorum.mjs.map +0 -1
  294. package/lib/retriableDocumentStorageService.d.mts.map +0 -1
  295. package/lib/retriableDocumentStorageService.mjs.map +0 -1
  296. package/lib/utils.d.mts.map +0 -1
  297. package/lib/utils.mjs.map +0 -1
@@ -25,9 +25,9 @@ import {
25
25
  ISummaryTree,
26
26
  IVersion,
27
27
  } from "@fluidframework/protocol-definitions";
28
- import { IDetachedBlobStorage } from "./loader";
29
- import { ProtocolTreeStorageService } from "./protocolTreeDocumentStorageService";
30
- import { RetriableDocumentStorageService } from "./retriableDocumentStorageService";
28
+ import { IDetachedBlobStorage } from "./loader.js";
29
+ import { ProtocolTreeStorageService } from "./protocolTreeDocumentStorageService.js";
30
+ import { RetriableDocumentStorageService } from "./retriableDocumentStorageService.js";
31
31
 
32
32
  /**
33
33
  * Stringified blobs from a summary/snapshot tree.
@@ -118,10 +118,6 @@ export class ContainerStorageAdapter implements IDocumentStorageService, IDispos
118
118
  return undefined;
119
119
  }
120
120
 
121
- public get repositoryUrl(): string {
122
- return this._storageService.repositoryUrl;
123
- }
124
-
125
121
  public async getSnapshotTree(
126
122
  version?: IVersion,
127
123
  scenarioName?: string,
@@ -204,10 +200,6 @@ class BlobOnlyStorage implements IDocumentStorageService {
204
200
  return this.notCalled();
205
201
  }
206
202
 
207
- public get repositoryUrl(): string {
208
- return this.notCalled();
209
- }
210
-
211
203
  /* eslint-disable @typescript-eslint/unbound-method */
212
204
  public getSnapshotTree: () => Promise<ISnapshotTree | null> = this.notCalled;
213
205
  public getSnapshot: () => Promise<ISnapshot> = this.notCalled;
@@ -242,7 +234,7 @@ const redirectTableBlobName = ".redirectTable";
242
234
  */
243
235
  export async function getBlobContentsFromTree(
244
236
  snapshot: ISnapshotTree,
245
- storage: IDocumentStorageService,
237
+ storage: Pick<IDocumentStorageService, "readBlob">,
246
238
  ): Promise<ISerializableBlobContents> {
247
239
  const blobs = {};
248
240
  await getBlobContentsFromTreeCore(snapshot, blobs, storage);
@@ -252,7 +244,7 @@ export async function getBlobContentsFromTree(
252
244
  async function getBlobContentsFromTreeCore(
253
245
  tree: ISnapshotTree,
254
246
  blobs: ISerializableBlobContents,
255
- storage: IDocumentStorageService,
247
+ storage: Pick<IDocumentStorageService, "readBlob">,
256
248
  root = true,
257
249
  ) {
258
250
  const treePs: Promise<any>[] = [];
@@ -275,7 +267,7 @@ async function getBlobContentsFromTreeCore(
275
267
  async function getBlobManagerTreeFromTree(
276
268
  tree: ISnapshotTree,
277
269
  blobs: ISerializableBlobContents,
278
- storage: IDocumentStorageService,
270
+ storage: Pick<IDocumentStorageService, "readBlob">,
279
271
  ) {
280
272
  const id = tree.blobs[redirectTableBlobName];
281
273
  const blob = await storage.readBlob(id);
package/src/contracts.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IErrorBase, ITelemetryProperties } from "@fluidframework/core-interfaces";
6
+ import { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
7
7
  import {
8
8
  IConnectionDetails,
9
9
  ICriticalContainerError,
@@ -73,12 +73,12 @@ export interface IConnectionManager {
73
73
  // Various connectivity properties for telemetry describing type of current connection
74
74
  // Things like connection mode, service info, etc.
75
75
  // Called when connection state changes (connect / disconnect)
76
- readonly connectionProps: ITelemetryProperties;
76
+ readonly connectionProps: ITelemetryBaseProperties;
77
77
 
78
78
  // Verbose information about connection logged to telemetry in case of issues with
79
79
  // maintaining healthy connection, including op gaps, not receiving join op in time, etc.
80
80
  // Contains details information, like sequence numbers at connection time, initial ops info, etc.
81
- readonly connectionVerboseProps: ITelemetryProperties;
81
+ readonly connectionVerboseProps: ITelemetryBaseProperties;
82
82
 
83
83
  /**
84
84
  * Prepares message to be sent. Fills in clientSequenceNumber.
@@ -6,7 +6,7 @@
6
6
  import {
7
7
  ITelemetryBaseEvent,
8
8
  ITelemetryBaseLogger,
9
- ITelemetryProperties,
9
+ ITelemetryBaseProperties,
10
10
  } from "@fluidframework/core-interfaces";
11
11
  import { performance } from "@fluid-internal/client-utils";
12
12
 
@@ -77,7 +77,7 @@ export class DebugLogger implements ITelemetryBaseLogger {
77
77
  * @param event - the event to send
78
78
  */
79
79
  public send(event: ITelemetryBaseEvent): void {
80
- const newEvent: ITelemetryProperties = { ...event };
80
+ const newEvent: ITelemetryBaseProperties = { ...event };
81
81
  const isError = newEvent.category === "error";
82
82
  let logger = isError ? this.debugErr : this.debug;
83
83
 
@@ -7,8 +7,7 @@ import { v4 as uuid } from "uuid";
7
7
  import {
8
8
  IThrottlingWarning,
9
9
  IEventProvider,
10
- ITelemetryProperties,
11
- ITelemetryErrorEvent,
10
+ ITelemetryBaseProperties,
12
11
  type ITelemetryBaseEvent,
13
12
  } from "@fluidframework/core-interfaces";
14
13
  import {
@@ -29,6 +28,7 @@ import {
29
28
  DataCorruptionError,
30
29
  UsageError,
31
30
  type ITelemetryGenericEventExt,
31
+ type ITelemetryErrorEventExt,
32
32
  } from "@fluidframework/telemetry-utils";
33
33
  import {
34
34
  IDocumentDeltaStorageService,
@@ -49,9 +49,9 @@ import {
49
49
  IConnectionManager,
50
50
  IConnectionManagerFactoryArgs,
51
51
  IConnectionStateChangeReason,
52
- } from "./contracts";
53
- import { DeltaQueue } from "./deltaQueue";
54
- import { ThrottlingWarning } from "./error";
52
+ } from "./contracts.js";
53
+ import { DeltaQueue } from "./deltaQueue.js";
54
+ import { ThrottlingWarning } from "./error.js";
55
55
 
56
56
  export interface IConnectionArgs {
57
57
  mode?: ConnectionMode;
@@ -361,7 +361,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
361
361
  assert(this.messageBuffer.length === 0, 0x3cc /* reentrancy */);
362
362
  }
363
363
 
364
- public get connectionProps(): ITelemetryProperties {
364
+ public get connectionProps(): ITelemetryBaseProperties {
365
365
  return {
366
366
  sequenceNumber: this.lastSequenceNumber,
367
367
  opsSize: this.opsSize > 0 ? this.opsSize : undefined,
@@ -376,7 +376,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
376
376
  * we stop processing ops that results in no processing join op and thus moving to connected state)
377
377
  * @param event - Event to log.
378
378
  */
379
- public logConnectionIssue(event: ITelemetryErrorEvent) {
379
+ public logConnectionIssue(event: ITelemetryErrorEventExt) {
380
380
  assert(this.connectionManager.connected, 0x238 /* "called only in connected state" */);
381
381
 
382
382
  const pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);
@@ -797,7 +797,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
797
797
 
798
798
  private disconnectHandler(reason: IConnectionStateChangeReason) {
799
799
  this.messageBuffer.length = 0;
800
- this.emit("disconnect", reason);
800
+ this.emit("disconnect", reason.text, reason.error);
801
801
  }
802
802
 
803
803
  /**
package/src/error.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryProperties, IThrottlingWarning } from "@fluidframework/core-interfaces";
6
+ import { ITelemetryBaseProperties, IThrottlingWarning } from "@fluidframework/core-interfaces";
7
7
  import { ContainerErrorTypes } from "@fluidframework/container-definitions";
8
8
  import {
9
9
  IFluidErrorBase,
@@ -24,7 +24,7 @@ export class ThrottlingWarning extends LoggingError implements IThrottlingWarnin
24
24
  private constructor(
25
25
  message: string,
26
26
  readonly retryAfterSeconds: number,
27
- props?: ITelemetryProperties,
27
+ props?: ITelemetryBaseProperties,
28
28
  ) {
29
29
  super(message, props);
30
30
  }
package/src/index.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- export { ConnectionState } from "./connectionState";
7
- export { IContainerExperimental, waitContainerToCatchUp } from "./container";
6
+ export { ConnectionState } from "./connectionState.js";
7
+ export { IContainerExperimental, waitContainerToCatchUp } from "./container.js";
8
8
  export {
9
9
  ICodeDetailsLoader,
10
10
  IDetachedBlobStorage,
@@ -13,10 +13,10 @@ export {
13
13
  ILoaderProps,
14
14
  ILoaderServices,
15
15
  Loader,
16
- } from "./loader";
16
+ } from "./loader.js";
17
17
  export {
18
18
  isLocationRedirectionError,
19
19
  resolveWithLocationRedirectionHandling,
20
- } from "./location-redirection-utilities";
21
- export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol";
22
- export { tryParseCompatibleResolvedUrl, IParsedUrl } from "./utils";
20
+ } from "./location-redirection-utilities/index.js";
21
+ export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol.js";
22
+ export { tryParseCompatibleResolvedUrl, IParsedUrl } from "./utils.js";
package/src/loader.ts CHANGED
@@ -36,11 +36,11 @@ import {
36
36
  IUrlResolver,
37
37
  } from "@fluidframework/driver-definitions";
38
38
  import { IClientDetails } from "@fluidframework/protocol-definitions";
39
- import { Container, IPendingContainerState } from "./container";
40
- import { IParsedUrl, tryParseCompatibleResolvedUrl } from "./utils";
41
- import { pkgVersion } from "./packageVersion";
42
- import { ProtocolHandlerBuilder } from "./protocol";
43
- import { DebugLogger } from "./debugLogger";
39
+ import { Container, IPendingContainerState } from "./container.js";
40
+ import { tryParseCompatibleResolvedUrl } from "./utils.js";
41
+ import { pkgVersion } from "./packageVersion.js";
42
+ import { ProtocolHandlerBuilder } from "./protocol.js";
43
+ import { DebugLogger } from "./debugLogger.js";
44
44
 
45
45
  function ensureResolvedUrlDefined(
46
46
  resolved: IResolvedUrl | undefined,
@@ -332,18 +332,17 @@ export class Loader implements IHostLoader {
332
332
  public async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {
333
333
  const eventName = pendingLocalState === undefined ? "Resolve" : "ResolveWithPendingState";
334
334
  return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {
335
- const resolved = await this.resolveCore(
335
+ return this.resolveCore(
336
336
  request,
337
337
  pendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,
338
338
  );
339
- return resolved.container;
340
339
  });
341
340
  }
342
341
 
343
342
  private async resolveCore(
344
343
  request: IRequest,
345
344
  pendingLocalState?: IPendingContainerState,
346
- ): Promise<{ container: Container; parsed: IParsedUrl }> {
345
+ ): Promise<Container> {
347
346
  const resolvedAsFluid = await this.services.urlResolver.resolve(request);
348
347
  ensureResolvedUrlDefined(resolvedAsFluid);
349
348
 
@@ -387,10 +386,7 @@ export class Loader implements IHostLoader {
387
386
  throw new UsageError('opsBeforeReturn must be set to "sequenceNumber"');
388
387
  }
389
388
 
390
- return {
391
- container: await this.loadContainer(request, resolvedAsFluid, pendingLocalState),
392
- parsed,
393
- };
389
+ return this.loadContainer(request, resolvedAsFluid, pendingLocalState);
394
390
  }
395
391
 
396
392
  private async loadContainer(
@@ -6,4 +6,4 @@
6
6
  export {
7
7
  isLocationRedirectionError,
8
8
  resolveWithLocationRedirectionHandling,
9
- } from "./resolveWithLocationRedirection";
9
+ } from "./resolveWithLocationRedirection.js";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-loader";
9
- export const pkgVersion = "2.0.0-dev-rc.1.0.0.232845";
9
+ export const pkgVersion = "2.0.0-dev-rc.2.0.0.246488";
@@ -19,9 +19,6 @@ export class ProtocolTreeStorageService implements IDocumentStorageService, IDis
19
19
  public get policies() {
20
20
  return this.internalStorageService.policies;
21
21
  }
22
- public get repositoryUrl() {
23
- return this.internalStorageService.repositoryUrl;
24
- }
25
22
  public get disposed() {
26
23
  return this.internalStorageService.disposed;
27
24
  }
package/src/quorum.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+
5
6
  import { IFluidCodeDetails } from "@fluidframework/core-interfaces";
6
7
  import { ICommittedProposal } from "@fluidframework/protocol-definitions";
7
8
 
@@ -46,13 +46,6 @@ export class RetriableDocumentStorageService implements IDocumentStorageService,
46
46
  this._disposed = true;
47
47
  }
48
48
 
49
- public get repositoryUrl(): string {
50
- if (this.internalStorageService) {
51
- return this.internalStorageService.repositoryUrl;
52
- }
53
- throw new Error("storage service not yet instantiated");
54
- }
55
-
56
49
  public async getSnapshotTree(
57
50
  version?: IVersion,
58
51
  scenarioName?: string,
@@ -0,0 +1,217 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ ISequencedDocumentMessage,
8
+ ISnapshotTree,
9
+ IVersion,
10
+ } from "@fluidframework/protocol-definitions";
11
+ import { IGetPendingLocalStateProps, IRuntime } from "@fluidframework/container-definitions";
12
+ import {
13
+ ITelemetryLoggerExt,
14
+ MonitoringContext,
15
+ PerformanceEvent,
16
+ UsageError,
17
+ createChildMonitoringContext,
18
+ } from "@fluidframework/telemetry-utils";
19
+ import { assert } from "@fluidframework/core-utils";
20
+ import {
21
+ IDocumentStorageService,
22
+ IResolvedUrl,
23
+ ISnapshot,
24
+ } from "@fluidframework/driver-definitions";
25
+ import { isInstanceOfISnapshot } from "@fluidframework/driver-utils";
26
+ import { ISerializableBlobContents, getBlobContentsFromTree } from "./containerStorageAdapter.js";
27
+ import { IPendingContainerState } from "./container.js";
28
+
29
+ export class SerializedStateManager {
30
+ private readonly processedOps: ISequencedDocumentMessage[] = [];
31
+ private snapshot:
32
+ | {
33
+ tree: ISnapshotTree;
34
+ blobs: ISerializableBlobContents;
35
+ }
36
+ | undefined;
37
+ private readonly mc: MonitoringContext;
38
+
39
+ constructor(
40
+ private readonly pendingLocalState: IPendingContainerState | undefined,
41
+ subLogger: ITelemetryLoggerExt,
42
+ private readonly storageAdapter: Pick<
43
+ IDocumentStorageService,
44
+ "readBlob" | "getSnapshotTree" | "getSnapshot" | "getVersions"
45
+ >,
46
+ private readonly _offlineLoadEnabled: boolean,
47
+ ) {
48
+ this.mc = createChildMonitoringContext({
49
+ logger: subLogger,
50
+ namespace: "serializedStateManager",
51
+ });
52
+ }
53
+
54
+ public get offlineLoadEnabled(): boolean {
55
+ return this._offlineLoadEnabled;
56
+ }
57
+
58
+ public addProcessedOp(message: ISequencedDocumentMessage) {
59
+ if (this.offlineLoadEnabled) {
60
+ this.processedOps.push(message);
61
+ }
62
+ }
63
+
64
+ private async getVersion(version: string | null): Promise<IVersion | undefined> {
65
+ const versions = await this.storageAdapter.getVersions(version, 1);
66
+ return versions[0];
67
+ }
68
+
69
+ public async fetchSnapshot(
70
+ specifiedVersion: string | undefined,
71
+ supportGetSnapshotApi: boolean | undefined,
72
+ ) {
73
+ const { snapshot, version } =
74
+ this.pendingLocalState === undefined
75
+ ? await this.fetchSnapshotCore(specifiedVersion, supportGetSnapshotApi)
76
+ : { snapshot: this.pendingLocalState.baseSnapshot, version: undefined };
77
+ const snapshotTree: ISnapshotTree | undefined = isInstanceOfISnapshot(snapshot)
78
+ ? snapshot.snapshotTree
79
+ : snapshot;
80
+ if (this.pendingLocalState) {
81
+ this.snapshot = {
82
+ tree: this.pendingLocalState.baseSnapshot,
83
+ blobs: this.pendingLocalState.snapshotBlobs,
84
+ };
85
+ } else {
86
+ assert(snapshotTree !== undefined, 0x8e4 /* Snapshot should exist */);
87
+ // non-interactive clients will not have any pending state we want to save
88
+ if (this.offlineLoadEnabled) {
89
+ const blobs = await getBlobContentsFromTree(snapshotTree, this.storageAdapter);
90
+ this.snapshot = { tree: snapshotTree, blobs };
91
+ }
92
+ }
93
+ return { snapshotTree, version };
94
+ }
95
+
96
+ private async fetchSnapshotCore(
97
+ specifiedVersion: string | undefined,
98
+ supportGetSnapshotApi: boolean | undefined,
99
+ ): Promise<{ snapshot?: ISnapshot | ISnapshotTree; version?: IVersion }> {
100
+ if (
101
+ this.mc.config.getBoolean("Fluid.Container.UseLoadingGroupIdForSnapshotFetch") ===
102
+ true &&
103
+ supportGetSnapshotApi === true
104
+ ) {
105
+ const snapshot =
106
+ (await this.storageAdapter.getSnapshot?.({
107
+ versionId: specifiedVersion,
108
+ })) ?? undefined;
109
+ const version: IVersion | undefined =
110
+ snapshot?.snapshotTree.id === undefined
111
+ ? undefined
112
+ : {
113
+ id: snapshot.snapshotTree.id,
114
+ treeId: snapshot.snapshotTree.id,
115
+ };
116
+
117
+ if (snapshot === undefined && specifiedVersion !== undefined) {
118
+ this.mc.logger.sendErrorEvent({
119
+ eventName: "getSnapshotTreeFailed",
120
+ id: specifiedVersion,
121
+ });
122
+ // Not sure if this should be here actually
123
+ } else if (snapshot !== undefined && version?.id === undefined) {
124
+ this.mc.logger.sendErrorEvent({
125
+ eventName: "getSnapshotFetchedTreeWithoutVersionId",
126
+ hasVersion: version !== undefined, // if hasVersion is true, this means that the contract with the service was broken.
127
+ });
128
+ }
129
+ return { snapshot, version };
130
+ }
131
+ return this.fetchSnapshotTree(specifiedVersion);
132
+ }
133
+
134
+ /**
135
+ * Get the most recent snapshot, or a specific version.
136
+ * @param specifiedVersion - The specific version of the snapshot to retrieve
137
+ * @returns The snapshot requested, or the latest snapshot if no version was specified, plus version ID
138
+ */
139
+ private async fetchSnapshotTree(
140
+ specifiedVersion: string | undefined,
141
+ ): Promise<{ snapshot?: ISnapshotTree; version?: IVersion | undefined }> {
142
+ const version = await this.getVersion(specifiedVersion ?? null);
143
+
144
+ if (version === undefined && specifiedVersion !== undefined) {
145
+ // We should have a defined version to load from if specified version requested
146
+ this.mc.logger.sendErrorEvent({
147
+ eventName: "NoVersionFoundWhenSpecified",
148
+ id: specifiedVersion,
149
+ });
150
+ }
151
+ const snapshot = (await this.storageAdapter.getSnapshotTree(version)) ?? undefined;
152
+
153
+ if (snapshot === undefined && version !== undefined) {
154
+ this.mc.logger.sendErrorEvent({ eventName: "getSnapshotTreeFailed", id: version.id });
155
+ } else if (snapshot !== undefined && version?.id === undefined) {
156
+ this.mc.logger.sendErrorEvent({
157
+ eventName: "getSnapshotFetchedTreeWithoutVersionId",
158
+ hasVersion: version !== undefined, // if hasVersion is true, this means that the contract with the service was broken.
159
+ });
160
+ }
161
+ return { snapshot, version };
162
+ }
163
+
164
+ /**
165
+ * This method is only meant to be used by Container.attach() to set the initial
166
+ * base snapshot when attaching.
167
+ * @param snapshot - snapshot and blobs collected while attaching
168
+ */
169
+ public setSnapshot(
170
+ snapshot:
171
+ | {
172
+ tree: ISnapshotTree;
173
+ blobs: ISerializableBlobContents;
174
+ }
175
+ | undefined,
176
+ ) {
177
+ this.snapshot = snapshot;
178
+ }
179
+
180
+ public async getPendingLocalStateCore(
181
+ props: IGetPendingLocalStateProps,
182
+ clientId: string | undefined,
183
+ runtime: Pick<IRuntime, "getPendingLocalState">,
184
+ resolvedUrl: IResolvedUrl,
185
+ ) {
186
+ return PerformanceEvent.timedExecAsync(
187
+ this.mc.logger,
188
+ {
189
+ eventName: "getPendingLocalState",
190
+ notifyImminentClosure: props.notifyImminentClosure,
191
+ processedOpsSize: this.processedOps.length,
192
+ clientId,
193
+ },
194
+ async () => {
195
+ if (!this.offlineLoadEnabled) {
196
+ throw new UsageError(
197
+ "Can't get pending local state unless offline load is enabled",
198
+ );
199
+ }
200
+ assert(this.snapshot !== undefined, 0x8e5 /* no base data */);
201
+ const pendingRuntimeState = await runtime.getPendingLocalState(props);
202
+ const pendingState: IPendingContainerState = {
203
+ attached: true,
204
+ pendingRuntimeState,
205
+ baseSnapshot: this.snapshot.tree,
206
+ snapshotBlobs: this.snapshot.blobs,
207
+ savedOps: this.processedOps,
208
+ url: resolvedUrl.url,
209
+ // no need to save this if there is no pending runtime state
210
+ clientId: pendingRuntimeState !== undefined ? clientId : undefined,
211
+ };
212
+
213
+ return JSON.stringify(pendingState);
214
+ },
215
+ );
216
+ }
217
+ }
package/src/utils.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { parse } from "url";
7
6
  import { v4 as uuid } from "uuid";
8
7
  import { Uint8ArrayToString, stringToBuffer } from "@fluid-internal/client-utils";
9
8
  import { assert, compareArrays, unreachableCase } from "@fluidframework/core-utils";
@@ -15,8 +14,8 @@ import {
15
14
  isCombinedAppAndProtocolSummary,
16
15
  } from "@fluidframework/driver-utils";
17
16
  import { DriverErrorTypes } from "@fluidframework/driver-definitions";
18
- import { ISerializableBlobContents } from "./containerStorageAdapter";
19
- import { IPendingDetachedContainerState } from "./container";
17
+ import { ISerializableBlobContents } from "./containerStorageAdapter.js";
18
+ import { IPendingDetachedContainerState } from "./container.js";
20
19
 
21
20
  // This is used when we rehydrate a container from the snapshot. Here we put the blob contents
22
21
  // in separate property: blobContents.
@@ -45,11 +44,10 @@ export interface IParsedUrl {
45
44
  */
46
45
  query: string;
47
46
  /**
48
- * Null means do not use snapshots, undefined means load latest snapshot
49
- * otherwise it's version ID passed to IDocumentStorageService.getVersions() to figure out what snapshot to use.
50
- * If needed, can add undefined which is treated by Container.load() as load latest snapshot.
47
+ * Undefined means load latest snapshot, otherwise it's version ID passed to IDocumentStorageService.getVersions()
48
+ * to figure out what snapshot to use.
51
49
  */
52
- version: string | null | undefined;
50
+ version: string | undefined;
53
51
  }
54
52
 
55
53
  /**
@@ -62,7 +60,7 @@ export interface IParsedUrl {
62
60
  * @internal
63
61
  */
64
62
  export function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined {
65
- const parsed = parse(url, true);
63
+ const parsed = new URL(url);
66
64
  if (typeof parsed.pathname !== "string") {
67
65
  throw new LoggingError("Failed to parse pathname");
68
66
  }
@@ -70,7 +68,13 @@ export function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefin
70
68
  const regex = /^\/([^/]*\/[^/]*)(\/?.*)$/;
71
69
  const match = regex.exec(parsed.pathname);
72
70
  return match?.length === 3
73
- ? { id: match[1], path: match[2], query, version: parsed.query.version as string }
71
+ ? {
72
+ id: match[1],
73
+ path: match[2],
74
+ query,
75
+ // URLSearchParams returns null if the param is not provided.
76
+ version: parsed.searchParams.get("version") ?? undefined,
77
+ }
74
78
  : undefined;
75
79
  }
76
80
 
@@ -117,6 +121,7 @@ function convertSummaryToSnapshotAndBlobs(summary: ISummaryTree): {
117
121
  trees: {},
118
122
  id: uuid(),
119
123
  unreferenced: summary.unreferenced,
124
+ groupId: summary.groupId,
120
125
  };
121
126
  const keys = Object.keys(summary.tree);
122
127
  for (const key of keys) {
@@ -179,7 +184,7 @@ export const getSnapshotTreeAndBlobsFromSerializedContainer = (
179
184
  ): { tree: ISnapshotTree; blobs: ISerializableBlobContents } => {
180
185
  assert(
181
186
  isCombinedAppAndProtocolSummary(detachedContainerSnapshot),
182
- "Protocol and App summary trees should be present",
187
+ 0x8e6 /* Protocol and App summary trees should be present */,
183
188
  );
184
189
  const protocolSummaryTree = detachedContainerSnapshot.tree[".protocol"];
185
190
  const appSummaryTree = detachedContainerSnapshot.tree[".app"];
@@ -0,0 +1,7 @@
1
+ {
2
+ // This config must be used in a "type": "commonjs" environment. (Use fluid-tsc commonjs.)
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "./dist",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
- "extends": [
3
- "../../../common/build/build-common/tsconfig.base.json",
4
- "../../../common/build/build-common/tsconfig.cjs.json",
5
- ],
2
+ "extends": "../../../common/build/build-common/tsconfig.node16.json",
6
3
  "include": ["src/**/*"],
7
4
  "exclude": ["src/test/**/*"],
8
5
  "compilerOptions": {
9
6
  "rootDir": "./src",
10
- "outDir": "./dist",
7
+ "outDir": "./lib",
11
8
  },
12
9
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment.d.mts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"OAIO,EAAE,WAAW,EAAE,MAAM,uCAAuC;OAC5D,EAAE,6BAA6B,EAAE,MAAM,8BAA8B;OACrE,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sCAAsC;OAE3E,EAAE,uBAAuB,EAAE,MAAM,oCAAoC;OAErE,EAAE,yBAAyB,EAAE;OAC7B,EAAE,oBAAoB,EAAE,MAAM,GAAG;AAExC;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,WAAW,gCAAgC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC;IACrC,QAAQ,CAAC,KAAK,EAA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AC,CAAC;IAEvF,IAAI,WAAW,CAAC,KAAK,KAAK,MAAM,EAAE;QACjC,8CAA8C;QAC9C,kEAAkE;QAClE,2CAA2C;QAC3C,MAAM,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,OAAO,EAAE;YAC3D,uBAAuB,EAAE,CAAC;YAC1B,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,SAAS;SACzB,CAAC,CAAC;KACH;IAED,iBAAiB,CAChB,CAAC,WAAW,GAAG;QACd,KAAK,EAAE,WAAW,CAAC,QAAQ;QAC3B,QAAQ,EAAE,kBAAkB;YAC3B,CAAC,CAAC,8CAA8C,CAAC,WAAW,CAAC,OAAO,CAAC;YACrE,CAAC,CAAC,SAAS;KACZ,CAAC,CACF,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils\";\nimport { ISnapshotTree, ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { getSnapshotTreeAndBlobsFromSerializedContainer } from \"./utils\";\nimport { ISerializableBlobContents } from \"./containerStorageAdapter\";\nimport { IDetachedBlobStorage } from \".\";\n\n/**\n * The default state a newly created detached container will have.\n * All but the state are optional and undefined, they just exist\n * to make the union easy to deal with for both Detached types\n */\nexport interface DetachedDefaultData {\n\treadonly state: AttachState.Detached;\n\treadonly blobs?: undefined;\n\treadonly summary?: undefined;\n\treadonly redirectTable?: undefined;\n}\n\n/**\n * This always follows DetachedDefaultData when there are\n * outstanding blobs in the detached blob storage.\n * The redirect table will get filled up to include data\n * about the blobs as they are uploaded.\n */\nexport interface DetachedDataWithOutstandingBlobs {\n\treadonly state: AttachState.Detached;\n\treadonly blobs: \"outstanding\";\n\treadonly summary?: undefined;\n\treadonly redirectTable: Map<string, string>;\n}\n\n/**\n * This state always follows DetachedDataWithOutstandingBlobs.\n * It signals that all outstanding blobs are done being uploaded,\n * so the container can move to the attaching state.\n */\nexport interface AttachingDataWithBlobs {\n\treadonly state: AttachState.Attaching;\n\treadonly blobs: \"done\";\n\treadonly summary: CombinedAppAndProtocolSummary;\n}\n\n/**\n * This always follows DefaultDetachedState when there are\n * no blobs in the detached blob storage. Because there are\n * no blobs we can immediately get the summary and transition\n * to the attaching state.\n */\nexport interface AttachingDataWithoutBlobs {\n\treadonly state: AttachState.Attaching;\n\treadonly summary: CombinedAppAndProtocolSummary;\n\treadonly blobs: \"none\";\n}\n\n/**\n * The final attachment state which signals the container is fully attached.\n * The baseSnapshotAndBlobs will only be enabled when offline load is enabled.\n */\nexport interface AttachedData {\n\treadonly state: AttachState.Attached;\n\treadonly snapshot?: {\n\t\ttree: ISnapshotTree;\n\t\tblobs: ISerializableBlobContents;\n\t};\n}\n\n/**\n * A union of all the attachment data types for\n * tracking across all container attachment states\n */\nexport type AttachmentData =\n\t| DetachedDefaultData\n\t| DetachedDataWithOutstandingBlobs\n\t| AttachingDataWithoutBlobs\n\t| AttachingDataWithBlobs\n\t| AttachedData;\n\n/**\n * The data and services necessary for runRetriableAttachProcess.\n */\nexport interface AttachProcessProps {\n\t/**\n\t * The initial attachment data this call should start with\n\t */\n\treadonly initialAttachmentData: Exclude<AttachmentData, AttachedData>;\n\n\t/**\n\t * The caller should use this callback to keep track of the current\n\t * attachment data, and perform any other operations necessary\n\t * for dealing with attachment state changes, like emitting events\n\t *\n\t * @param attachmentData - the updated attachment data\t */\n\treadonly setAttachmentData: (attachmentData: AttachmentData) => void;\n\n\t/**\n\t * The caller should create and or get services based on the data, and its own information.\n\t * @param data - the data to create services from,\n\t * the summary property being the most relevant part of the data.\n\t * @returns A compatible storage service\n\t */\n\treadonly createOrGetStorageService: (\n\t\tdata: ISummaryTree | undefined,\n\t) => Promise<Pick<IDocumentStorageService, \"createBlob\" | \"uploadSummaryWithContext\">>;\n\n\t/**\n\t * The detached blob storage if it exists.\n\t */\n\treadonly detachedBlobStorage?: Pick<IDetachedBlobStorage, \"getBlobIds\" | \"readBlob\" | \"size\">;\n\n\t/**\n\t * The caller should create the attachment summary for the container.\n\t * @param redirectTable - Maps local blob ids to remote blobs ids.\n\t * @returns The attachment summary for the container.\n\t */\n\treadonly createAttachmentSummary: (\n\t\tredirectTable?: Map<string, string>,\n\t) => CombinedAppAndProtocolSummary;\n\n\t/**\n\t * Whether offline load is enabled or not.\n\t */\n\treadonly offlineLoadEnabled: boolean;\n}\n\n/**\n * Executes the attach process state machine based on the provided data and services.\n * This method is retriable on failure. Based on the provided initialAttachmentData\n * this method will resume the attachment process and attempt to complete it.\n *\n * @param props - The data and services necessary to run the attachment process\n */\nexport const runRetriableAttachProcess = async (props: AttachProcessProps): Promise<void> => {\n\tconst {\n\t\tdetachedBlobStorage,\n\t\tcreateOrGetStorageService,\n\t\tsetAttachmentData,\n\t\tcreateAttachmentSummary,\n\t\tofflineLoadEnabled,\n\t} = props;\n\tlet currentData: AttachmentData = props.initialAttachmentData;\n\n\tif (currentData.blobs === undefined) {\n\t\t// If attachment blobs were uploaded in detached state we will go through a different attach flow\n\t\tconst outstandingAttachmentBlobs =\n\t\t\tdetachedBlobStorage !== undefined && detachedBlobStorage.size > 0;\n\t\t// Determine the next phase of attaching which depends on if there are attachment blobs\n\t\t// if there are, we will stay detached, so an empty file can be created, and the blobs\n\t\t// uploaded, otherwise we will get the summary to create the file with and move to attaching\n\t\tcurrentData = outstandingAttachmentBlobs\n\t\t\t? {\n\t\t\t\t\tstate: AttachState.Detached,\n\t\t\t\t\tblobs: \"outstanding\",\n\t\t\t\t\tredirectTable: new Map<string, string>(),\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\t\tsummary: props.createAttachmentSummary(),\n\t\t\t\t\tblobs: \"none\",\n\t\t\t };\n\t\tsetAttachmentData(currentData);\n\t}\n\n\t// this has to run here, as it is what creates the file\n\t// and we need to file for all possible cases after this point\n\tconst storage = await createOrGetStorageService(currentData.summary);\n\n\tif (currentData.blobs === \"outstanding\") {\n\t\tconst { redirectTable } = currentData;\n\t\t// upload blobs to storage\n\t\tassert(!!detachedBlobStorage, 0x24e /* \"assertion for type narrowing\" */);\n\n\t\t// build a table mapping IDs assigned locally to IDs assigned by storage and pass it to runtime to\n\t\t// support blob handles that only know about the local IDs\n\t\twhile (redirectTable.size < detachedBlobStorage.size) {\n\t\t\tconst newIds = detachedBlobStorage.getBlobIds().filter((id) => !redirectTable.has(id));\n\t\t\tfor (const id of newIds) {\n\t\t\t\tconst blob = await detachedBlobStorage.readBlob(id);\n\t\t\t\tconst response = await storage.createBlob(blob);\n\t\t\t\tredirectTable.set(id, response.id);\n\t\t\t}\n\t\t}\n\t\tsetAttachmentData(\n\t\t\t(currentData = {\n\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\tsummary: createAttachmentSummary(redirectTable),\n\t\t\t\tblobs: \"done\",\n\t\t\t}),\n\t\t);\n\t}\n\n\tassert(currentData.state === AttachState.Attaching, \"must be attaching by this point\");\n\n\tif (currentData.blobs === \"done\") {\n\t\t// done means outstanding blobs were uploaded.\n\t\t// in that case an empty file was created, the blobs were uploaded\n\t\t// and now this finally uploads the summary\n\t\tawait storage.uploadSummaryWithContext(currentData.summary, {\n\t\t\treferenceSequenceNumber: 0,\n\t\t\tackHandle: undefined,\n\t\t\tproposalHandle: undefined,\n\t\t});\n\t}\n\n\tsetAttachmentData(\n\t\t(currentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t\tsnapshot: offlineLoadEnabled\n\t\t\t\t? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)\n\t\t\t\t: undefined,\n\t\t}),\n\t);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"audience.d.mts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";OAIO,EAAE,YAAY,EAAE,MAAM,QAAQ;OAE9B,EAAE,cAAc,EAAE,MAAM,uCAAuC;OAC/D,EAAE,OAAO,EAAE,MAAM,sCAAsC;AAE9D;;GAEG;AACH,qBAAa,QAAS,SAAQ,YAAa,YAAW,cAAc;IACnE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;;IAQ/C,EAAE,CACR,KAAK,EAAE,WAAW,GAAG,cAAc,EACnC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,GACnD,IAAI;IAKP;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAenD;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAW9C;;OAEG;IACI,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAIzC;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;CAGvD"}