@fluidframework/container-loader 2.0.2 → 2.1.0-276326

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 (227) hide show
  1. package/.eslintrc.cjs +2 -5
  2. package/api-extractor/api-extractor.legacy.json +4 -0
  3. package/api-report/container-loader.beta.api.md +0 -27
  4. package/api-report/{container-loader.alpha.api.md → container-loader.legacy.alpha.api.md} +0 -27
  5. package/api-report/container-loader.public.api.md +0 -27
  6. package/dist/attachment.d.ts +2 -1
  7. package/dist/attachment.d.ts.map +1 -1
  8. package/dist/attachment.js.map +1 -1
  9. package/dist/audience.d.ts.map +1 -1
  10. package/dist/audience.js +4 -4
  11. package/dist/audience.js.map +1 -1
  12. package/dist/catchUpMonitor.d.ts +15 -4
  13. package/dist/catchUpMonitor.d.ts.map +1 -1
  14. package/dist/catchUpMonitor.js +12 -3
  15. package/dist/catchUpMonitor.js.map +1 -1
  16. package/dist/connectionManager.d.ts +24 -8
  17. package/dist/connectionManager.d.ts.map +1 -1
  18. package/dist/connectionManager.js +36 -23
  19. package/dist/connectionManager.js.map +1 -1
  20. package/dist/connectionStateHandler.d.ts +30 -20
  21. package/dist/connectionStateHandler.d.ts.map +1 -1
  22. package/dist/connectionStateHandler.js +15 -11
  23. package/dist/connectionStateHandler.js.map +1 -1
  24. package/dist/container.d.ts +7 -2
  25. package/dist/container.d.ts.map +1 -1
  26. package/dist/container.js +45 -28
  27. package/dist/container.js.map +1 -1
  28. package/dist/containerContext.d.ts +8 -4
  29. package/dist/containerContext.d.ts.map +1 -1
  30. package/dist/containerContext.js +3 -1
  31. package/dist/containerContext.js.map +1 -1
  32. package/dist/containerStorageAdapter.d.ts +1 -1
  33. package/dist/containerStorageAdapter.d.ts.map +1 -1
  34. package/dist/containerStorageAdapter.js +12 -6
  35. package/dist/containerStorageAdapter.js.map +1 -1
  36. package/dist/contracts.d.ts +17 -8
  37. package/dist/contracts.d.ts.map +1 -1
  38. package/dist/contracts.js +4 -2
  39. package/dist/contracts.js.map +1 -1
  40. package/dist/debugLogger.js +3 -3
  41. package/dist/debugLogger.js.map +1 -1
  42. package/dist/deltaManager.d.ts +13 -9
  43. package/dist/deltaManager.d.ts.map +1 -1
  44. package/dist/deltaManager.js +32 -23
  45. package/dist/deltaManager.js.map +1 -1
  46. package/dist/deltaQueue.d.ts +1 -4
  47. package/dist/deltaQueue.d.ts.map +1 -1
  48. package/dist/deltaQueue.js +2 -2
  49. package/dist/deltaQueue.js.map +1 -1
  50. package/dist/disposal.d.ts +1 -1
  51. package/dist/disposal.d.ts.map +1 -1
  52. package/dist/disposal.js.map +1 -1
  53. package/dist/error.d.ts.map +1 -1
  54. package/dist/error.js.map +1 -1
  55. package/dist/legacy.d.ts +1 -1
  56. package/dist/loadPaused.d.ts +2 -2
  57. package/dist/loadPaused.d.ts.map +1 -1
  58. package/dist/loadPaused.js +7 -3
  59. package/dist/loadPaused.js.map +1 -1
  60. package/dist/loader.d.ts +10 -1
  61. package/dist/loader.d.ts.map +1 -1
  62. package/dist/loader.js +11 -1
  63. package/dist/loader.js.map +1 -1
  64. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -1
  65. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  66. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +3 -1
  67. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  68. package/dist/memoryBlobStorage.d.ts.map +1 -1
  69. package/dist/memoryBlobStorage.js +4 -2
  70. package/dist/memoryBlobStorage.js.map +1 -1
  71. package/dist/noopHeuristic.js +1 -1
  72. package/dist/noopHeuristic.js.map +1 -1
  73. package/dist/packageVersion.d.ts +1 -1
  74. package/dist/packageVersion.d.ts.map +1 -1
  75. package/dist/packageVersion.js +1 -1
  76. package/dist/packageVersion.js.map +1 -1
  77. package/dist/protocol/protocol.d.ts +4 -3
  78. package/dist/protocol/protocol.d.ts.map +1 -1
  79. package/dist/protocol/protocol.js +6 -5
  80. package/dist/protocol/protocol.js.map +1 -1
  81. package/dist/protocol/quorum.d.ts +11 -8
  82. package/dist/protocol/quorum.d.ts.map +1 -1
  83. package/dist/protocol/quorum.js +8 -8
  84. package/dist/protocol/quorum.js.map +1 -1
  85. package/dist/protocol.d.ts +2 -0
  86. package/dist/protocol.d.ts.map +1 -1
  87. package/dist/protocol.js +7 -2
  88. package/dist/protocol.js.map +1 -1
  89. package/dist/protocolTreeDocumentStorageService.d.ts +2 -2
  90. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  91. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  92. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  93. package/dist/retriableDocumentStorageService.js +4 -1
  94. package/dist/retriableDocumentStorageService.js.map +1 -1
  95. package/dist/serializedStateManager.d.ts +29 -12
  96. package/dist/serializedStateManager.d.ts.map +1 -1
  97. package/dist/serializedStateManager.js +55 -24
  98. package/dist/serializedStateManager.js.map +1 -1
  99. package/dist/utils.d.ts +4 -2
  100. package/dist/utils.d.ts.map +1 -1
  101. package/dist/utils.js +15 -6
  102. package/dist/utils.js.map +1 -1
  103. package/lib/attachment.d.ts +2 -1
  104. package/lib/attachment.d.ts.map +1 -1
  105. package/lib/attachment.js.map +1 -1
  106. package/lib/audience.d.ts.map +1 -1
  107. package/lib/audience.js +4 -4
  108. package/lib/audience.js.map +1 -1
  109. package/lib/catchUpMonitor.d.ts +15 -4
  110. package/lib/catchUpMonitor.d.ts.map +1 -1
  111. package/lib/catchUpMonitor.js +12 -3
  112. package/lib/catchUpMonitor.js.map +1 -1
  113. package/lib/connectionManager.d.ts +24 -8
  114. package/lib/connectionManager.d.ts.map +1 -1
  115. package/lib/connectionManager.js +36 -23
  116. package/lib/connectionManager.js.map +1 -1
  117. package/lib/connectionStateHandler.d.ts +30 -20
  118. package/lib/connectionStateHandler.d.ts.map +1 -1
  119. package/lib/connectionStateHandler.js +14 -12
  120. package/lib/connectionStateHandler.js.map +1 -1
  121. package/lib/container.d.ts +7 -2
  122. package/lib/container.d.ts.map +1 -1
  123. package/lib/container.js +45 -28
  124. package/lib/container.js.map +1 -1
  125. package/lib/containerContext.d.ts +8 -4
  126. package/lib/containerContext.d.ts.map +1 -1
  127. package/lib/containerContext.js +3 -1
  128. package/lib/containerContext.js.map +1 -1
  129. package/lib/containerStorageAdapter.d.ts +1 -1
  130. package/lib/containerStorageAdapter.d.ts.map +1 -1
  131. package/lib/containerStorageAdapter.js +12 -6
  132. package/lib/containerStorageAdapter.js.map +1 -1
  133. package/lib/contracts.d.ts +17 -8
  134. package/lib/contracts.d.ts.map +1 -1
  135. package/lib/contracts.js +4 -2
  136. package/lib/contracts.js.map +1 -1
  137. package/lib/debugLogger.js +3 -3
  138. package/lib/debugLogger.js.map +1 -1
  139. package/lib/deltaManager.d.ts +13 -9
  140. package/lib/deltaManager.d.ts.map +1 -1
  141. package/lib/deltaManager.js +32 -23
  142. package/lib/deltaManager.js.map +1 -1
  143. package/lib/deltaQueue.d.ts +1 -4
  144. package/lib/deltaQueue.d.ts.map +1 -1
  145. package/lib/deltaQueue.js +2 -2
  146. package/lib/deltaQueue.js.map +1 -1
  147. package/lib/disposal.d.ts +1 -1
  148. package/lib/disposal.d.ts.map +1 -1
  149. package/lib/disposal.js.map +1 -1
  150. package/lib/error.d.ts.map +1 -1
  151. package/lib/error.js.map +1 -1
  152. package/lib/legacy.d.ts +1 -1
  153. package/lib/loadPaused.d.ts +2 -2
  154. package/lib/loadPaused.d.ts.map +1 -1
  155. package/lib/loadPaused.js +8 -4
  156. package/lib/loadPaused.js.map +1 -1
  157. package/lib/loader.d.ts +10 -1
  158. package/lib/loader.d.ts.map +1 -1
  159. package/lib/loader.js +11 -1
  160. package/lib/loader.js.map +1 -1
  161. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -1
  162. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  163. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +3 -1
  164. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  165. package/lib/memoryBlobStorage.d.ts.map +1 -1
  166. package/lib/memoryBlobStorage.js +4 -2
  167. package/lib/memoryBlobStorage.js.map +1 -1
  168. package/lib/noopHeuristic.js +1 -1
  169. package/lib/noopHeuristic.js.map +1 -1
  170. package/lib/packageVersion.d.ts +1 -1
  171. package/lib/packageVersion.d.ts.map +1 -1
  172. package/lib/packageVersion.js +1 -1
  173. package/lib/packageVersion.js.map +1 -1
  174. package/lib/protocol/protocol.d.ts +4 -3
  175. package/lib/protocol/protocol.d.ts.map +1 -1
  176. package/lib/protocol/protocol.js +6 -5
  177. package/lib/protocol/protocol.js.map +1 -1
  178. package/lib/protocol/quorum.d.ts +11 -8
  179. package/lib/protocol/quorum.d.ts.map +1 -1
  180. package/lib/protocol/quorum.js +8 -8
  181. package/lib/protocol/quorum.js.map +1 -1
  182. package/lib/protocol.d.ts +2 -0
  183. package/lib/protocol.d.ts.map +1 -1
  184. package/lib/protocol.js +7 -2
  185. package/lib/protocol.js.map +1 -1
  186. package/lib/protocolTreeDocumentStorageService.d.ts +2 -2
  187. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  188. package/lib/protocolTreeDocumentStorageService.js.map +1 -1
  189. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  190. package/lib/retriableDocumentStorageService.js +4 -1
  191. package/lib/retriableDocumentStorageService.js.map +1 -1
  192. package/lib/serializedStateManager.d.ts +29 -12
  193. package/lib/serializedStateManager.d.ts.map +1 -1
  194. package/lib/serializedStateManager.js +56 -25
  195. package/lib/serializedStateManager.js.map +1 -1
  196. package/lib/utils.d.ts +4 -2
  197. package/lib/utils.d.ts.map +1 -1
  198. package/lib/utils.js +16 -7
  199. package/lib/utils.js.map +1 -1
  200. package/package.json +21 -17
  201. package/src/attachment.ts +2 -1
  202. package/src/audience.ts +4 -4
  203. package/src/catchUpMonitor.ts +23 -8
  204. package/src/connectionManager.ts +85 -60
  205. package/src/connectionStateHandler.ts +85 -63
  206. package/src/container.ts +118 -84
  207. package/src/containerContext.ts +5 -3
  208. package/src/containerStorageAdapter.ts +20 -13
  209. package/src/contracts.ts +21 -9
  210. package/src/debugLogger.ts +4 -4
  211. package/src/deltaManager.ts +75 -56
  212. package/src/deltaQueue.ts +16 -10
  213. package/src/disposal.ts +3 -3
  214. package/src/error.ts +2 -1
  215. package/src/loadPaused.ts +16 -8
  216. package/src/loader.ts +20 -2
  217. package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +7 -3
  218. package/src/memoryBlobStorage.ts +5 -3
  219. package/src/noopHeuristic.ts +1 -1
  220. package/src/packageVersion.ts +1 -1
  221. package/src/protocol/protocol.ts +12 -11
  222. package/src/protocol/quorum.ts +49 -40
  223. package/src/protocol.ts +12 -4
  224. package/src/protocolTreeDocumentStorageService.ts +3 -2
  225. package/src/retriableDocumentStorageService.ts +6 -3
  226. package/src/serializedStateManager.ts +95 -39
  227. package/src/utils.ts +26 -10
package/dist/utils.js CHANGED
@@ -19,6 +19,7 @@ const uuid_1 = require("uuid");
19
19
  * with urls of type: protocol://<string>/.../..?<querystring>
20
20
  * @param url - This is the IResolvedUrl.url part of the resolved url.
21
21
  * @returns The IParsedUrl representing the input URL, or undefined if the format was not supported
22
+ * @legacy
22
23
  * @alpha
23
24
  */
24
25
  function tryParseCompatibleResolvedUrl(url) {
@@ -83,9 +84,10 @@ function convertSummaryToSnapshotAndBlobs(summary) {
83
84
  blobContents = { ...blobContents, ...innerSnapshot.snapshotBlobs };
84
85
  break;
85
86
  }
86
- case driver_definitions_1.SummaryType.Attachment:
87
+ case driver_definitions_1.SummaryType.Attachment: {
87
88
  treeNode.blobs[key] = summaryObject.id;
88
89
  break;
90
+ }
89
91
  case driver_definitions_1.SummaryType.Blob: {
90
92
  const blobId = (0, uuid_1.v4)();
91
93
  treeNode.blobs[key] = blobId;
@@ -95,9 +97,11 @@ function convertSummaryToSnapshotAndBlobs(summary) {
95
97
  blobContents[blobId] = contentString;
96
98
  break;
97
99
  }
98
- case driver_definitions_1.SummaryType.Handle:
100
+ case driver_definitions_1.SummaryType.Handle: {
99
101
  throw new internal_4.LoggingError("No handles should be there in summary in detached container!!");
102
+ }
100
103
  default: {
104
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
101
105
  (0, internal_1.unreachableCase)(summaryObject, `Unknown tree type ${summaryObject.type}`);
102
106
  }
103
107
  }
@@ -198,7 +202,8 @@ exports.combineSnapshotTreeAndSnapshotBlobs = combineSnapshotTreeAndSnapshotBlob
198
202
  function isDeltaStreamConnectionForbiddenError(error) {
199
203
  return (typeof error === "object" &&
200
204
  error !== null &&
201
- error?.errorType === internal_2.DriverErrorTypes.deltaStreamConnectionForbidden);
205
+ error?.errorType ===
206
+ internal_2.DriverErrorTypes.deltaStreamConnectionForbidden);
202
207
  }
203
208
  exports.isDeltaStreamConnectionForbiddenError = isDeltaStreamConnectionForbiddenError;
204
209
  /**
@@ -221,9 +226,12 @@ function isPendingDetachedContainerState(detachedContainerState) {
221
226
  */
222
227
  function getDetachedContainerStateFromSerializedContainer(serializedContainer) {
223
228
  const hasBlobsSummaryTree = ".hasAttachmentBlobs";
229
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
224
230
  const parsedContainerState = JSON.parse(serializedContainer);
231
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
225
232
  if (isPendingDetachedContainerState(parsedContainerState)) {
226
233
  return parsedContainerState;
234
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
227
235
  }
228
236
  else if ((0, internal_3.isCombinedAppAndProtocolSummary)(parsedContainerState)) {
229
237
  const { baseSnapshot, snapshotBlobs } = (0, exports.getSnapshotTreeAndBlobsFromSerializedContainer)(parsedContainerState);
@@ -245,15 +253,16 @@ exports.getDetachedContainerStateFromSerializedContainer = getDetachedContainerS
245
253
  * This is the inverse of the JSON.stringify call in {@link SerializedStateManager.getPendingLocalState}
246
254
  */
247
255
  function getAttachedContainerStateFromSerializedContainer(serializedContainer) {
248
- return serializedContainer !== undefined
249
- ? JSON.parse(serializedContainer)
250
- : undefined;
256
+ return serializedContainer === undefined
257
+ ? undefined
258
+ : JSON.parse(serializedContainer);
251
259
  }
252
260
  exports.getAttachedContainerStateFromSerializedContainer = getAttachedContainerStateFromSerializedContainer;
253
261
  /**
254
262
  * Ensures only a single instance of the provided async function is running.
255
263
  * If there are multiple calls they will all get the same promise to wait on.
256
264
  */
265
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
257
266
  const runSingle = (func) => {
258
267
  let running;
259
268
  // don't mark this function async, so we return the same promise,
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAIsC;AACtC,kEAA6F;AAC7F,2EAA+E;AAC/E,0EAIqD;AAKrD,oEAK+C;AAC/C,uEAAoF;AACpF,+BAAkC;AA2ClC;;;;;;;;GAQG;AACH,SAAgB,6BAA6B,CAAC,GAAW;IACxD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,IAAI,uBAAY,CAAC,0BAA0B,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,2BAA2B,CAAC;IAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,KAAK,EAAE,MAAM,KAAK,CAAC;QACzB,CAAC,CAAC;YACA,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YACZ,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YACd,KAAK;YACL,6DAA6D;YAC7D,OAAO,EA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H,CAAC;IAED,oFAAoF;IACpF,MAAM,cAAc,GACnB,WAAW,IAAI,IAAI,CAAC,KAAK;QACxB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,UAAU;QAC1C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAE9B,MAAM,UAAU,GAAG,MAAM,IAAA,uBAAY,EAAsB,OAAO,EAAE,cAAc,CAAC,CAAC;IAEpF,OAAO,UAAU,CAAC;AACnB,CAAC;AApBD,sDAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tUint8ArrayToString,\n\tbufferToString,\n\tstringToBuffer,\n} from \"@fluid-internal/client-utils\";\nimport { assert, compareArrays, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryTree, SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tDriverErrorTypes,\n\tIDocumentAttributes,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\ttype ISnapshot,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tCombinedAppAndProtocolSummary,\n\tDeltaStreamConnectionForbiddenError,\n\tisCombinedAppAndProtocolSummary,\n\treadAndParse,\n} from \"@fluidframework/driver-utils/internal\";\nimport { LoggingError, UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { ISerializableBlobContents } from \"./containerStorageAdapter.js\";\nimport type {\n\tIPendingContainerState,\n\tIPendingDetachedContainerState,\n\tISnapshotInfo,\n\tSnapshotWithBlobs,\n} from \"./serializedStateManager.js\";\n\n// This is used when we rehydrate a container from the snapshot. Here we put the blob contents\n// in separate property: blobContents.\nexport interface ISnapshotTreeWithBlobContents extends ISnapshotTree {\n\tblobsContents: { [path: string]: ArrayBufferLike };\n\ttrees: { [path: string]: ISnapshotTreeWithBlobContents };\n}\n\n/**\n * Interface to represent the parsed parts of IResolvedUrl.url to help\n * in getting info about different parts of the url.\n * May not be compatible or relevant for any Url Resolver\n * @alpha\n */\nexport interface IParsedUrl {\n\t/**\n\t * It is combination of tenantid/docId part of the url.\n\t */\n\tid: string;\n\t/**\n\t * It is the deep link path in the url.\n\t */\n\tpath: string;\n\t/**\n\t * Query string part of the url.\n\t */\n\tquery: string;\n\t/**\n\t * Undefined means load latest snapshot, otherwise it's version ID passed to IDocumentStorageService.getVersions()\n\t * to figure out what snapshot to use.\n\t */\n\tversion: string | undefined;\n}\n\n/**\n * Utility api to parse the IResolvedUrl.url into specific parts like querystring, path to get\n * deep link info etc.\n * Warning - This function may not be compatible with any Url Resolver's resolved url. It works\n * with urls of type: protocol://<string>/.../..?<querystring>\n * @param url - This is the IResolvedUrl.url part of the resolved url.\n * @returns The IParsedUrl representing the input URL, or undefined if the format was not supported\n * @alpha\n */\nexport function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined {\n\tconst parsed = new URL(url);\n\tif (typeof parsed.pathname !== \"string\") {\n\t\tthrow new LoggingError(\"Failed to parse pathname\");\n\t}\n\tconst query = parsed.search ?? \"\";\n\tconst regex = /^\\/([^/]*\\/[^/]*)(\\/?.*)$/;\n\tconst match = regex.exec(parsed.pathname);\n\treturn match?.length === 3\n\t\t? {\n\t\t\t\tid: match[1],\n\t\t\t\tpath: match[2],\n\t\t\t\tquery,\n\t\t\t\t// URLSearchParams returns null if the param is not provided.\n\t\t\t\tversion: parsed.searchParams.get(\"version\") ?? undefined,\n\t\t\t}\n\t\t: undefined;\n}\n\n/**\n * Combine the app summary and protocol summary in 1 tree.\n * @param appSummary - Summary of the app.\n * @param protocolSummary - Summary of the protocol.\n * @internal\n */\nexport function combineAppAndProtocolSummary(\n\tappSummary: ISummaryTree,\n\tprotocolSummary: ISummaryTree,\n): CombinedAppAndProtocolSummary {\n\tassert(\n\t\t!isCombinedAppAndProtocolSummary(appSummary),\n\t\t0x5a8 /* app summary is already a combined tree! */,\n\t);\n\tassert(\n\t\t!isCombinedAppAndProtocolSummary(protocolSummary),\n\t\t0x5a9 /* protocol summary is already a combined tree! */,\n\t);\n\tconst createNewSummary: CombinedAppAndProtocolSummary = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: {\n\t\t\t\".protocol\": protocolSummary,\n\t\t\t\".app\": appSummary,\n\t\t},\n\t};\n\treturn createNewSummary;\n}\n\n/**\n * Converts a summary to snapshot tree and separate its blob contents\n * to align detached container format with IPendingContainerState\n * @param summary - ISummaryTree\n */\nfunction convertSummaryToSnapshotAndBlobs(summary: ISummaryTree): SnapshotWithBlobs {\n\tlet blobContents: ISerializableBlobContents = {};\n\tconst treeNode: ISnapshotTree = {\n\t\tblobs: {},\n\t\ttrees: {},\n\t\tid: uuid(),\n\t\tunreferenced: summary.unreferenced,\n\t\tgroupId: summary.groupId,\n\t};\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tconst innerSnapshot = convertSummaryToSnapshotAndBlobs(summaryObject);\n\t\t\t\ttreeNode.trees[key] = innerSnapshot.baseSnapshot;\n\t\t\t\tblobContents = { ...blobContents, ...innerSnapshot.snapshotBlobs };\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Attachment:\n\t\t\t\ttreeNode.blobs[key] = summaryObject.id;\n\t\t\t\tbreak;\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst blobId = uuid();\n\t\t\t\ttreeNode.blobs[key] = blobId;\n\t\t\t\tconst contentString: string =\n\t\t\t\t\tsummaryObject.content instanceof Uint8Array\n\t\t\t\t\t\t? Uint8ArrayToString(summaryObject.content)\n\t\t\t\t\t\t: summaryObject.content;\n\t\t\t\tblobContents[blobId] = contentString;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle:\n\t\t\t\tthrow new LoggingError(\n\t\t\t\t\t\"No handles should be there in summary in detached container!!\",\n\t\t\t\t);\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(summaryObject, `Unknown tree type ${(summaryObject as any).type}`);\n\t\t\t}\n\t\t}\n\t}\n\tconst pendingSnapshot = { baseSnapshot: treeNode, snapshotBlobs: blobContents };\n\treturn pendingSnapshot;\n}\n\n/**\n * Converts a snapshot to snapshotInfo with its blob contents\n * to align detached container format with IPendingContainerState\n *\n * Note, this assumes the ISnapshot sequence number is defined. Otherwise an assert will be thrown\n * @param snapshot - ISnapshot\n */\nexport function convertSnapshotToSnapshotInfo(snapshot: ISnapshot): ISnapshotInfo {\n\tassert(\n\t\tsnapshot.sequenceNumber !== undefined,\n\t\t0x93a /* Snapshot sequence number is missing */,\n\t);\n\tconst snapshotBlobs: ISerializableBlobContents = {};\n\tfor (const [blobId, arrayBufferLike] of snapshot.blobContents.entries()) {\n\t\tsnapshotBlobs[blobId] = bufferToString(arrayBufferLike, \"utf8\");\n\t}\n\treturn {\n\t\tbaseSnapshot: snapshot.snapshotTree,\n\t\tsnapshotBlobs,\n\t\tsnapshotSequenceNumber: snapshot.sequenceNumber,\n\t};\n}\n\n/**\n * Converts a snapshot to snapshotInfo with its blob contents\n * to align detached container format with IPendingContainerState\n *\n * Note, this assumes the ISnapshot sequence number is defined. Otherwise an assert will be thrown\n * @param snapshot - ISnapshot\n */\nexport function convertSnapshotInfoToSnapshot(\n\tsnapshotInfo: ISnapshotInfo,\n\tsnapshotSequenceNumber: number,\n): ISnapshot {\n\tconst blobContents = new Map<string, ArrayBufferLike>();\n\tfor (const [blobId, serializedContent] of Object.entries(snapshotInfo.snapshotBlobs)) {\n\t\tblobContents.set(blobId, stringToBuffer(serializedContent, \"utf8\"));\n\t}\n\treturn {\n\t\tsnapshotTree: snapshotInfo.baseSnapshot,\n\t\tblobContents,\n\t\tops: [],\n\t\tsequenceNumber: snapshotSequenceNumber,\n\t\tlatestSequenceNumber: undefined,\n\t\tsnapshotFormatV: 1,\n\t};\n}\n\n/**\n * Converts summary parts into a SnapshotTree and its blob contents.\n * @param protocolSummaryTree - Protocol Summary Tree\n * @param appSummaryTree - App Summary Tree\n */\nfunction convertProtocolAndAppSummaryToSnapshotAndBlobs(\n\tprotocolSummaryTree: ISummaryTree,\n\tappSummaryTree: ISummaryTree,\n): SnapshotWithBlobs {\n\tconst combinedSummary: ISummaryTree = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: { ...appSummaryTree.tree },\n\t};\n\n\tcombinedSummary.tree[\".protocol\"] = protocolSummaryTree;\n\tconst snapshotTreeWithBlobContents = convertSummaryToSnapshotAndBlobs(combinedSummary);\n\treturn snapshotTreeWithBlobContents;\n}\n\nexport const getSnapshotTreeAndBlobsFromSerializedContainer = (\n\tdetachedContainerSnapshot: ISummaryTree,\n): SnapshotWithBlobs => {\n\tassert(\n\t\tisCombinedAppAndProtocolSummary(detachedContainerSnapshot),\n\t\t0x8e6 /* Protocol and App summary trees should be present */,\n\t);\n\tconst protocolSummaryTree = detachedContainerSnapshot.tree[\".protocol\"];\n\tconst appSummaryTree = detachedContainerSnapshot.tree[\".app\"];\n\tconst snapshotTreeWithBlobContents = convertProtocolAndAppSummaryToSnapshotAndBlobs(\n\t\tprotocolSummaryTree,\n\t\tappSummaryTree,\n\t);\n\treturn snapshotTreeWithBlobContents;\n};\n\nexport function getProtocolSnapshotTree(snapshot: ISnapshotTree): ISnapshotTree {\n\treturn \".protocol\" in snapshot.trees ? snapshot.trees[\".protocol\"] : snapshot;\n}\n\nexport const combineSnapshotTreeAndSnapshotBlobs = (\n\tbaseSnapshot: ISnapshotTree,\n\tsnapshotBlobs: ISerializableBlobContents,\n): ISnapshotTreeWithBlobContents => {\n\tconst blobsContents: { [path: string]: ArrayBufferLike } = {};\n\n\t// Process blobs in the current level\n\tfor (const [, id] of Object.entries(baseSnapshot.blobs)) {\n\t\tif (snapshotBlobs[id]) {\n\t\t\tblobsContents[id] = stringToBuffer(snapshotBlobs[id], \"utf8\");\n\t\t}\n\t}\n\n\t// Recursively process trees in the current level\n\tconst trees: { [path: string]: ISnapshotTreeWithBlobContents } = {};\n\tfor (const [path, tree] of Object.entries(baseSnapshot.trees)) {\n\t\ttrees[path] = combineSnapshotTreeAndSnapshotBlobs(tree, snapshotBlobs);\n\t}\n\n\t// Create a new snapshot tree with blob contents and processed trees\n\tconst snapshotTreeWithBlobContents: ISnapshotTreeWithBlobContents = {\n\t\t...baseSnapshot,\n\t\tblobsContents,\n\t\ttrees,\n\t};\n\n\treturn snapshotTreeWithBlobContents;\n};\n\nexport function isDeltaStreamConnectionForbiddenError(\n\terror: any,\n): error is DeltaStreamConnectionForbiddenError {\n\treturn (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\terror?.errorType === DriverErrorTypes.deltaStreamConnectionForbidden\n\t);\n}\n\n/**\n * Validates format in parsed string get from detached container\n * serialization using IPendingDetachedContainerState format.\n */\nfunction isPendingDetachedContainerState(\n\tdetachedContainerState: IPendingDetachedContainerState,\n): detachedContainerState is IPendingDetachedContainerState {\n\tif (\n\t\tdetachedContainerState?.attached === undefined ||\n\t\tdetachedContainerState?.baseSnapshot === undefined ||\n\t\tdetachedContainerState?.snapshotBlobs === undefined ||\n\t\tdetachedContainerState?.hasAttachmentBlobs === undefined\n\t) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/**\n * Parses the given string into {@link IPendingDetachedContainerState} format,\n * with validation (if invalid, throws a UsageError).\n * This is the inverse of the JSON.stringify call in {@link Container.serialize}\n */\nexport function getDetachedContainerStateFromSerializedContainer(\n\tserializedContainer: string,\n): IPendingDetachedContainerState {\n\tconst hasBlobsSummaryTree = \".hasAttachmentBlobs\";\n\tconst parsedContainerState = JSON.parse(serializedContainer);\n\tif (isPendingDetachedContainerState(parsedContainerState)) {\n\t\treturn parsedContainerState;\n\t} else if (isCombinedAppAndProtocolSummary(parsedContainerState)) {\n\t\tconst { baseSnapshot, snapshotBlobs } =\n\t\t\tgetSnapshotTreeAndBlobsFromSerializedContainer(parsedContainerState);\n\t\tconst detachedContainerState: IPendingDetachedContainerState = {\n\t\t\tattached: false,\n\t\t\tbaseSnapshot,\n\t\t\tsnapshotBlobs,\n\t\t\thasAttachmentBlobs: parsedContainerState.tree[hasBlobsSummaryTree] !== undefined,\n\t\t};\n\t\treturn detachedContainerState;\n\t} else {\n\t\tthrow new UsageError(\"Cannot rehydrate detached container. Incorrect format\");\n\t}\n}\n\n/**\n * Blindly parses the given string into {@link IPendingContainerState} format.\n * This is the inverse of the JSON.stringify call in {@link SerializedStateManager.getPendingLocalState}\n */\nexport function getAttachedContainerStateFromSerializedContainer(\n\tserializedContainer: string | undefined,\n): IPendingContainerState | undefined {\n\treturn serializedContainer !== undefined\n\t\t? (JSON.parse(serializedContainer) as IPendingContainerState)\n\t\t: undefined;\n}\n\n/**\n * Ensures only a single instance of the provided async function is running.\n * If there are multiple calls they will all get the same promise to wait on.\n */\nexport const runSingle = <A extends any[], R>(func: (...args: A) => Promise<R>) => {\n\tlet running:\n\t\t| {\n\t\t\t\targs: A;\n\t\t\t\tresult: Promise<R>;\n\t\t }\n\t\t| undefined;\n\t// don't mark this function async, so we return the same promise,\n\t// rather than one that is wrapped due to async\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\treturn (...args: A) => {\n\t\tif (running !== undefined) {\n\t\t\tif (!compareArrays(running.args, args)) {\n\t\t\t\treturn Promise.reject(\n\t\t\t\t\tnew UsageError(\"Subsequent calls cannot use different arguments.\"),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn running.result;\n\t\t}\n\t\trunning = { args, result: func(...args).finally(() => (running = undefined)) };\n\t\treturn running.result;\n\t};\n};\n\nexport async function getDocumentAttributes(\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n\ttree: ISnapshotTree | undefined,\n): Promise<IDocumentAttributes> {\n\tif (tree === undefined) {\n\t\treturn {\n\t\t\tminimumSequenceNumber: 0,\n\t\t\tsequenceNumber: 0,\n\t\t};\n\t}\n\n\t// Backward compatibility: old docs would have \".attributes\" instead of \"attributes\"\n\tconst attributesHash =\n\t\t\".protocol\" in tree.trees\n\t\t\t? tree.trees[\".protocol\"].blobs.attributes\n\t\t\t: tree.blobs[\".attributes\"];\n\n\tconst attributes = await readAndParse<IDocumentAttributes>(storage, attributesHash);\n\n\treturn attributes;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAIsC;AACtC,kEAA6F;AAC7F,2EAA+E;AAC/E,0EAIqD;AAKrD,oEAK+C;AAC/C,uEAIkD;AAClD,+BAAkC;AA4ClC;;;;;;;;;GASG;AACH,SAAgB,6BAA6B,CAAC,GAAW;IACxD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,IAAI,uBAAY,CAAC,0BAA0B,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,2BAA2B,CAAC;IAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,KAAK,EAAE,MAAM,KAAK,CAAC;QACzB,CAAC,CAAC;YACA,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YACZ,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YACd,KAAK;YACL,6DAA6D;YAC7D,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,SAAS;SACxD;QACF,CAAC,CAAC,SAAS,CAAC;AACd,CAAC;AAjBD,sEAiBC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAC3C,UAAwB,EACxB,eAA6B;IAE7B,IAAA,iBAAM,EACL,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AAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,UAAU;QAC1C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAE9B,MAAM,UAAU,GAAG,MAAM,IAAA,uBAAY,EAAsB,OAAO,EAAE,cAAc,CAAC,CAAC;IAEpF,OAAO,UAAU,CAAC;AACnB,CAAC;AApBD,sDAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tUint8ArrayToString,\n\tbufferToString,\n\tstringToBuffer,\n} from \"@fluid-internal/client-utils\";\nimport { assert, compareArrays, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryTree, SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tDriverErrorTypes,\n\tIDocumentAttributes,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\ttype ISnapshot,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tCombinedAppAndProtocolSummary,\n\tDeltaStreamConnectionForbiddenError,\n\tisCombinedAppAndProtocolSummary,\n\treadAndParse,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tLoggingError,\n\tUsageError,\n\ttype IFluidErrorBase,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { ISerializableBlobContents } from \"./containerStorageAdapter.js\";\nimport type {\n\tIPendingContainerState,\n\tIPendingDetachedContainerState,\n\tISnapshotInfo,\n\tSnapshotWithBlobs,\n} from \"./serializedStateManager.js\";\n\n// This is used when we rehydrate a container from the snapshot. Here we put the blob contents\n// in separate property: blobContents.\nexport interface ISnapshotTreeWithBlobContents extends ISnapshotTree {\n\tblobsContents: { [path: string]: ArrayBufferLike };\n\ttrees: { [path: string]: ISnapshotTreeWithBlobContents };\n}\n\n/**\n * Interface to represent the parsed parts of IResolvedUrl.url to help\n * in getting info about different parts of the url.\n * May not be compatible or relevant for any Url Resolver\n * @legacy\n * @alpha\n */\nexport interface IParsedUrl {\n\t/**\n\t * It is combination of tenantid/docId part of the url.\n\t */\n\tid: string;\n\t/**\n\t * It is the deep link path in the url.\n\t */\n\tpath: string;\n\t/**\n\t * Query string part of the url.\n\t */\n\tquery: string;\n\t/**\n\t * Undefined means load latest snapshot, otherwise it's version ID passed to IDocumentStorageService.getVersions()\n\t * to figure out what snapshot to use.\n\t */\n\tversion: string | undefined;\n}\n\n/**\n * Utility api to parse the IResolvedUrl.url into specific parts like querystring, path to get\n * deep link info etc.\n * Warning - This function may not be compatible with any Url Resolver's resolved url. It works\n * with urls of type: protocol://<string>/.../..?<querystring>\n * @param url - This is the IResolvedUrl.url part of the resolved url.\n * @returns The IParsedUrl representing the input URL, or undefined if the format was not supported\n * @legacy\n * @alpha\n */\nexport function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined {\n\tconst parsed = new URL(url);\n\tif (typeof parsed.pathname !== \"string\") {\n\t\tthrow new LoggingError(\"Failed to parse pathname\");\n\t}\n\tconst query = parsed.search ?? \"\";\n\tconst regex = /^\\/([^/]*\\/[^/]*)(\\/?.*)$/;\n\tconst match = regex.exec(parsed.pathname);\n\treturn match?.length === 3\n\t\t? {\n\t\t\t\tid: match[1],\n\t\t\t\tpath: match[2],\n\t\t\t\tquery,\n\t\t\t\t// URLSearchParams returns null if the param is not provided.\n\t\t\t\tversion: parsed.searchParams.get(\"version\") ?? undefined,\n\t\t\t}\n\t\t: undefined;\n}\n\n/**\n * Combine the app summary and protocol summary in 1 tree.\n * @param appSummary - Summary of the app.\n * @param protocolSummary - Summary of the protocol.\n * @internal\n */\nexport function combineAppAndProtocolSummary(\n\tappSummary: ISummaryTree,\n\tprotocolSummary: ISummaryTree,\n): CombinedAppAndProtocolSummary {\n\tassert(\n\t\t!isCombinedAppAndProtocolSummary(appSummary),\n\t\t0x5a8 /* app summary is already a combined tree! */,\n\t);\n\tassert(\n\t\t!isCombinedAppAndProtocolSummary(protocolSummary),\n\t\t0x5a9 /* protocol summary is already a combined tree! */,\n\t);\n\tconst createNewSummary: CombinedAppAndProtocolSummary = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: {\n\t\t\t\".protocol\": protocolSummary,\n\t\t\t\".app\": appSummary,\n\t\t},\n\t};\n\treturn createNewSummary;\n}\n\n/**\n * Converts a summary to snapshot tree and separate its blob contents\n * to align detached container format with IPendingContainerState\n * @param summary - ISummaryTree\n */\nfunction convertSummaryToSnapshotAndBlobs(summary: ISummaryTree): SnapshotWithBlobs {\n\tlet blobContents: ISerializableBlobContents = {};\n\tconst treeNode: ISnapshotTree = {\n\t\tblobs: {},\n\t\ttrees: {},\n\t\tid: uuid(),\n\t\tunreferenced: summary.unreferenced,\n\t\tgroupId: summary.groupId,\n\t};\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tconst innerSnapshot = convertSummaryToSnapshotAndBlobs(summaryObject);\n\t\t\t\ttreeNode.trees[key] = innerSnapshot.baseSnapshot;\n\t\t\t\tblobContents = { ...blobContents, ...innerSnapshot.snapshotBlobs };\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Attachment: {\n\t\t\t\ttreeNode.blobs[key] = summaryObject.id;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst blobId = uuid();\n\t\t\t\ttreeNode.blobs[key] = blobId;\n\t\t\t\tconst contentString: string =\n\t\t\t\t\tsummaryObject.content instanceof Uint8Array\n\t\t\t\t\t\t? Uint8ArrayToString(summaryObject.content)\n\t\t\t\t\t\t: summaryObject.content;\n\t\t\t\tblobContents[blobId] = contentString;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tthrow new LoggingError(\n\t\t\t\t\t\"No handles should be there in summary in detached container!!\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t\tunreachableCase(summaryObject, `Unknown tree type ${(summaryObject as any).type}`);\n\t\t\t}\n\t\t}\n\t}\n\tconst pendingSnapshot = { baseSnapshot: treeNode, snapshotBlobs: blobContents };\n\treturn pendingSnapshot;\n}\n\n/**\n * Converts a snapshot to snapshotInfo with its blob contents\n * to align detached container format with IPendingContainerState\n *\n * Note, this assumes the ISnapshot sequence number is defined. Otherwise an assert will be thrown\n * @param snapshot - ISnapshot\n */\nexport function convertSnapshotToSnapshotInfo(snapshot: ISnapshot): ISnapshotInfo {\n\tassert(\n\t\tsnapshot.sequenceNumber !== undefined,\n\t\t0x93a /* Snapshot sequence number is missing */,\n\t);\n\tconst snapshotBlobs: ISerializableBlobContents = {};\n\tfor (const [blobId, arrayBufferLike] of snapshot.blobContents.entries()) {\n\t\tsnapshotBlobs[blobId] = bufferToString(arrayBufferLike, \"utf8\");\n\t}\n\treturn {\n\t\tbaseSnapshot: snapshot.snapshotTree,\n\t\tsnapshotBlobs,\n\t\tsnapshotSequenceNumber: snapshot.sequenceNumber,\n\t};\n}\n\n/**\n * Converts a snapshot to snapshotInfo with its blob contents\n * to align detached container format with IPendingContainerState\n *\n * Note, this assumes the ISnapshot sequence number is defined. Otherwise an assert will be thrown\n * @param snapshot - ISnapshot\n */\nexport function convertSnapshotInfoToSnapshot(\n\tsnapshotInfo: ISnapshotInfo,\n\tsnapshotSequenceNumber: number,\n): ISnapshot {\n\tconst blobContents = new Map<string, ArrayBufferLike>();\n\tfor (const [blobId, serializedContent] of Object.entries(snapshotInfo.snapshotBlobs)) {\n\t\tblobContents.set(blobId, stringToBuffer(serializedContent, \"utf8\"));\n\t}\n\treturn {\n\t\tsnapshotTree: snapshotInfo.baseSnapshot,\n\t\tblobContents,\n\t\tops: [],\n\t\tsequenceNumber: snapshotSequenceNumber,\n\t\tlatestSequenceNumber: undefined,\n\t\tsnapshotFormatV: 1,\n\t};\n}\n\n/**\n * Converts summary parts into a SnapshotTree and its blob contents.\n * @param protocolSummaryTree - Protocol Summary Tree\n * @param appSummaryTree - App Summary Tree\n */\nfunction convertProtocolAndAppSummaryToSnapshotAndBlobs(\n\tprotocolSummaryTree: ISummaryTree,\n\tappSummaryTree: ISummaryTree,\n): SnapshotWithBlobs {\n\tconst combinedSummary: ISummaryTree = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: { ...appSummaryTree.tree },\n\t};\n\n\tcombinedSummary.tree[\".protocol\"] = protocolSummaryTree;\n\tconst snapshotTreeWithBlobContents = convertSummaryToSnapshotAndBlobs(combinedSummary);\n\treturn snapshotTreeWithBlobContents;\n}\n\nexport const getSnapshotTreeAndBlobsFromSerializedContainer = (\n\tdetachedContainerSnapshot: ISummaryTree,\n): SnapshotWithBlobs => {\n\tassert(\n\t\tisCombinedAppAndProtocolSummary(detachedContainerSnapshot),\n\t\t0x8e6 /* Protocol and App summary trees should be present */,\n\t);\n\tconst protocolSummaryTree = detachedContainerSnapshot.tree[\".protocol\"];\n\tconst appSummaryTree = detachedContainerSnapshot.tree[\".app\"];\n\tconst snapshotTreeWithBlobContents = convertProtocolAndAppSummaryToSnapshotAndBlobs(\n\t\tprotocolSummaryTree,\n\t\tappSummaryTree,\n\t);\n\treturn snapshotTreeWithBlobContents;\n};\n\nexport function getProtocolSnapshotTree(snapshot: ISnapshotTree): ISnapshotTree {\n\treturn \".protocol\" in snapshot.trees ? snapshot.trees[\".protocol\"] : snapshot;\n}\n\nexport const combineSnapshotTreeAndSnapshotBlobs = (\n\tbaseSnapshot: ISnapshotTree,\n\tsnapshotBlobs: ISerializableBlobContents,\n): ISnapshotTreeWithBlobContents => {\n\tconst blobsContents: { [path: string]: ArrayBufferLike } = {};\n\n\t// Process blobs in the current level\n\tfor (const [, id] of Object.entries(baseSnapshot.blobs)) {\n\t\tif (snapshotBlobs[id]) {\n\t\t\tblobsContents[id] = stringToBuffer(snapshotBlobs[id], \"utf8\");\n\t\t}\n\t}\n\n\t// Recursively process trees in the current level\n\tconst trees: { [path: string]: ISnapshotTreeWithBlobContents } = {};\n\tfor (const [path, tree] of Object.entries(baseSnapshot.trees)) {\n\t\ttrees[path] = combineSnapshotTreeAndSnapshotBlobs(tree, snapshotBlobs);\n\t}\n\n\t// Create a new snapshot tree with blob contents and processed trees\n\tconst snapshotTreeWithBlobContents: ISnapshotTreeWithBlobContents = {\n\t\t...baseSnapshot,\n\t\tblobsContents,\n\t\ttrees,\n\t};\n\n\treturn snapshotTreeWithBlobContents;\n};\n\nexport function isDeltaStreamConnectionForbiddenError(\n\terror: unknown,\n): error is DeltaStreamConnectionForbiddenError {\n\treturn (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\t(error as Partial<IFluidErrorBase>)?.errorType ===\n\t\t\tDriverErrorTypes.deltaStreamConnectionForbidden\n\t);\n}\n\n/**\n * Validates format in parsed string get from detached container\n * serialization using IPendingDetachedContainerState format.\n */\nfunction isPendingDetachedContainerState(\n\tdetachedContainerState: IPendingDetachedContainerState,\n): detachedContainerState is IPendingDetachedContainerState {\n\tif (\n\t\tdetachedContainerState?.attached === undefined ||\n\t\tdetachedContainerState?.baseSnapshot === undefined ||\n\t\tdetachedContainerState?.snapshotBlobs === undefined ||\n\t\tdetachedContainerState?.hasAttachmentBlobs === undefined\n\t) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/**\n * Parses the given string into {@link IPendingDetachedContainerState} format,\n * with validation (if invalid, throws a UsageError).\n * This is the inverse of the JSON.stringify call in {@link Container.serialize}\n */\nexport function getDetachedContainerStateFromSerializedContainer(\n\tserializedContainer: string,\n): IPendingDetachedContainerState {\n\tconst hasBlobsSummaryTree = \".hasAttachmentBlobs\";\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\tconst parsedContainerState = JSON.parse(serializedContainer);\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\tif (isPendingDetachedContainerState(parsedContainerState)) {\n\t\treturn parsedContainerState;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t} else if (isCombinedAppAndProtocolSummary(parsedContainerState)) {\n\t\tconst { baseSnapshot, snapshotBlobs } =\n\t\t\tgetSnapshotTreeAndBlobsFromSerializedContainer(parsedContainerState);\n\t\tconst detachedContainerState: IPendingDetachedContainerState = {\n\t\t\tattached: false,\n\t\t\tbaseSnapshot,\n\t\t\tsnapshotBlobs,\n\t\t\thasAttachmentBlobs: parsedContainerState.tree[hasBlobsSummaryTree] !== undefined,\n\t\t};\n\t\treturn detachedContainerState;\n\t} else {\n\t\tthrow new UsageError(\"Cannot rehydrate detached container. Incorrect format\");\n\t}\n}\n\n/**\n * Blindly parses the given string into {@link IPendingContainerState} format.\n * This is the inverse of the JSON.stringify call in {@link SerializedStateManager.getPendingLocalState}\n */\nexport function getAttachedContainerStateFromSerializedContainer(\n\tserializedContainer: string | undefined,\n): IPendingContainerState | undefined {\n\treturn serializedContainer === undefined\n\t\t? undefined\n\t\t: (JSON.parse(serializedContainer) as IPendingContainerState);\n}\n\n/**\n * Ensures only a single instance of the provided async function is running.\n * If there are multiple calls they will all get the same promise to wait on.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const runSingle = <A extends any[], R>(\n\tfunc: (...args: A) => Promise<R>,\n): ((...args: A) => Promise<R>) => {\n\tlet running:\n\t\t| {\n\t\t\t\targs: A;\n\t\t\t\tresult: Promise<R>;\n\t\t }\n\t\t| undefined;\n\t// don't mark this function async, so we return the same promise,\n\t// rather than one that is wrapped due to async\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\treturn (...args: A): Promise<R> => {\n\t\tif (running !== undefined) {\n\t\t\tif (!compareArrays(running.args, args)) {\n\t\t\t\treturn Promise.reject(\n\t\t\t\t\tnew UsageError(\"Subsequent calls cannot use different arguments.\"),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn running.result;\n\t\t}\n\t\trunning = { args, result: func(...args).finally(() => (running = undefined)) };\n\t\treturn running.result;\n\t};\n};\n\nexport async function getDocumentAttributes(\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n\ttree: ISnapshotTree | undefined,\n): Promise<IDocumentAttributes> {\n\tif (tree === undefined) {\n\t\treturn {\n\t\t\tminimumSequenceNumber: 0,\n\t\t\tsequenceNumber: 0,\n\t\t};\n\t}\n\n\t// Backward compatibility: old docs would have \".attributes\" instead of \"attributes\"\n\tconst attributesHash =\n\t\t\".protocol\" in tree.trees\n\t\t\t? tree.trees[\".protocol\"].blobs.attributes\n\t\t\t: tree.blobs[\".attributes\"];\n\n\tconst attributes = await readAndParse<IDocumentAttributes>(storage, attributesHash);\n\n\treturn attributes;\n}\n"]}
@@ -77,7 +77,8 @@ export interface AttachProcessProps {
77
77
  * attachment data, and perform any other operations necessary
78
78
  * for dealing with attachment state changes, like emitting events
79
79
  *
80
- * @param attachmentData - the updated attachment data */
80
+ * @param attachmentData - the updated attachment data
81
+ */
81
82
  readonly setAttachmentData: (attachmentData: AttachmentData) => void;
82
83
  /**
83
84
  * The caller should create and or get services based on the data, and its own information.
@@ -1 +1 @@
1
- {"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGrE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,KAAK,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uB,CAAC,aAAa,CAAC;YAC/C,KAAK,EAAE,MAAM;SACb,CAAC,CACF,CAAC;IACH,CAAC;IAED,MAAM,CACL,WAAW,CAAC,KAAK,KAAK,WAAW,CAAC,SAAS,EAC3C,KAAK,CAAC,qCAAqC,CAC3C,CAAC;IAEF,IAAI,WAAW,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QAClC,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;IACJ,CAAC;IAED,MAAM,QAAQ,GAAkC,kBAAkB;QACjE,CAAC,CAAC,8CAA8C,CAAC,WAAW,CAAC,OAAO,CAAC;QACrE,CAAC,CAAC,SAAS,CAAC;IAEb,iBAAiB,CAChB,CAAC,WAAW,GAAG;QACd,KAAK,EAAE,WAAW,CAAC,QAAQ;KAC3B,CAAC,CACF,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions/internal\";\nimport { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport { IDetachedBlobStorage } from \"./loader.js\";\nimport type { SnapshotWithBlobs } from \"./serializedStateManager.js\";\nimport { getSnapshotTreeAndBlobsFromSerializedContainer } from \"./utils.js\";\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}\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<\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tIDetachedBlobStorage,\n\t\t\"getBlobIds\" | \"readBlob\" | \"size\"\n\t>;\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 AttachProcessProps - The data and services necessary to run the attachment process\n * @returns - The attach summary (only if offline load is enabled), or undefined\n */\nexport const runRetriableAttachProcess = async ({\n\tdetachedBlobStorage,\n\tcreateOrGetStorageService,\n\tsetAttachmentData,\n\tcreateAttachmentSummary,\n\tofflineLoadEnabled,\n\tinitialAttachmentData,\n}: AttachProcessProps): Promise<SnapshotWithBlobs | undefined> => {\n\tlet currentData: AttachmentData = 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\t}\n\t\t\t: {\n\t\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\t\tsummary: createAttachmentSummary(),\n\t\t\t\t\tblobs: \"none\",\n\t\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(\n\t\tcurrentData.state === AttachState.Attaching,\n\t\t0x8e2 /* must be attaching by this point */,\n\t);\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\tconst snapshot: SnapshotWithBlobs | undefined = offlineLoadEnabled\n\t\t? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)\n\t\t: undefined;\n\n\tsetAttachmentData(\n\t\t(currentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t}),\n\t);\n\treturn snapshot;\n};\n"]}
1
+ {"version":3,"file":"attachment.js","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAQ7D,OAAO,EAAE,8CAA8C,EAAE,MAAM,YAAY,CAAC;AAyH5E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,EAAE,EAC/C,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,GACD,EAA0C,EAAE;IAChE,IAAI,WAAW,GAAmB,qBAAqB,CAAC;IAExD,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACrC,iGAAiG;QACjG,MAAM,0BAA0B,GAC/B,mBAAmB,KAAK,SAAS,IAAI,mBAAmB,CAAC,IAAI,GAAG,CAAC,CAAC;QACnE,uFAAuF;QACvF,sFAAsF;QACtF,4FAA4F;QAC5F,WAAW,GAAG,0BAA0B;YACvC,CAAC,CAAC;gBACA,KAAK,EAAE,WAAW,CAAC,QAAQ;gBAC3B,KAAK,EAAE,aAAa;gBACpB,aAAa,EAAE,IAAI,GAAG,EAAkB;aACxC;YACF,CAAC,CAAC;gBACA,KAAK,EAAE,WAAW,CAAC,SAAS;gBAC5B,OAAO,EAAE,uBAAuB,EAAE;gBAClC,KAAK,EAAE,MAAM;aACb,CAAC;QACJ,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IAED,uDAAuD;IACvD,8D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,CAAC,WAAW,CAAC,OAAO,EAAE;YAC3D,uBAAuB,EAAE,CAAC;YAC1B,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,SAAS;SACzB,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAkC,kBAAkB;QACjE,CAAC,CAAC,8CAA8C,CAAC,WAAW,CAAC,OAAO,CAAC;QACrE,CAAC,CAAC,SAAS,CAAC;IAEb,iBAAiB,CAChB,CAAC,WAAW,GAAG;QACd,KAAK,EAAE,WAAW,CAAC,QAAQ;KAC3B,CAAC,CACF,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions/internal\";\nimport { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport { IDetachedBlobStorage } from \"./loader.js\";\nimport type { SnapshotWithBlobs } from \"./serializedStateManager.js\";\nimport { getSnapshotTreeAndBlobsFromSerializedContainer } from \"./utils.js\";\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}\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\n\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<\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tIDetachedBlobStorage,\n\t\t\"getBlobIds\" | \"readBlob\" | \"size\"\n\t>;\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 AttachProcessProps - The data and services necessary to run the attachment process\n * @returns - The attach summary (only if offline load is enabled), or undefined\n */\nexport const runRetriableAttachProcess = async ({\n\tdetachedBlobStorage,\n\tcreateOrGetStorageService,\n\tsetAttachmentData,\n\tcreateAttachmentSummary,\n\tofflineLoadEnabled,\n\tinitialAttachmentData,\n}: AttachProcessProps): Promise<SnapshotWithBlobs | undefined> => {\n\tlet currentData: AttachmentData = 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\t}\n\t\t\t: {\n\t\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\t\tsummary: createAttachmentSummary(),\n\t\t\t\t\tblobs: \"none\",\n\t\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(\n\t\tcurrentData.state === AttachState.Attaching,\n\t\t0x8e2 /* must be attaching by this point */,\n\t);\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\tconst snapshot: SnapshotWithBlobs | undefined = offlineLoadEnabled\n\t\t? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)\n\t\t: undefined;\n\n\tsetAttachmentData(\n\t\t(currentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t}),\n\t);\n\treturn snapshot;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"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;;IAQtC,OAAO,IAAI,KAAK,GAAG,SAAS;IAS5B,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAejD;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAe1D;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAW9C;;;;;OAKG;IACI,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAIzC;;;;;OAKG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;CAGvD"}
package/lib/audience.js CHANGED
@@ -53,14 +53,14 @@ export class Audience extends TypedEventEmitter {
53
53
  */
54
54
  removeMember(clientId) {
55
55
  const removedClient = this.members.get(clientId);
56
- if (removedClient !== undefined) {
56
+ if (removedClient === undefined) {
57
+ return false;
58
+ }
59
+ else {
57
60
  this.members.delete(clientId);
58
61
  this.emit("removeMember", clientId, removedClient);
59
62
  return true;
60
63
  }
61
- else {
62
- return false;
63
- }
64
64
  }
65
65
  /**
66
66
  * Retrieves all the members in the audience.
@@ -1 +1 @@
1
- {"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAG7D;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,iBAAkC;IAI/D;QACC,KAAK,EAAE,CAAC;QAJQ,YAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;QAKrD,kHAAkH;QAClH,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAEM,OAAO;QACb,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAS;YACzC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC;gBACA,QAAQ,EAAE,IA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C,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC;QACb,CAAC;aAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACI,UAAU;QAChB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IAudienceEvents, ISelf } from \"@fluidframework/container-definitions\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IClient } from \"@fluidframework/driver-definitions\";\n\n/**\n * Audience represents all clients connected to the op stream.\n */\nexport class Audience extends TypedEventEmitter<IAudienceEvents> implements IAudienceOwner {\n\tprivate readonly members = new Map<string, IClient>();\n\tprivate _currentClientId: string | undefined;\n\n\tconstructor() {\n\t\tsuper();\n\t\t// We are expecting this class to have many listeners, so we suppress noisy \"MaxListenersExceededWarning\" logging.\n\t\tsuper.setMaxListeners(0);\n\t}\n\n\tpublic getSelf(): ISelf | undefined {\n\t\treturn this._currentClientId === undefined\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tclientId: this._currentClientId,\n\t\t\t\t\tclient: this.getMember(this._currentClientId),\n\t\t\t\t};\n\t}\n\n\tpublic setCurrentClientId(clientId: string): void {\n\t\tif (this._currentClientId !== clientId) {\n\t\t\tconst oldId = this._currentClientId;\n\t\t\tthis._currentClientId = clientId;\n\t\t\t// this.getMember(clientId) could resolve to undefined in these two cases:\n\t\t\t// 1) Feature gates controlling ConnectionStateHandler() behavior are off\n\t\t\t// 2) we are loading from stashed state and audience is empty, but we remember and set prior clientId\n\t\t\tthis.emit(\n\t\t\t\t\"selfChanged\",\n\t\t\t\toldId === undefined ? undefined : ({ clientId: oldId } satisfies ISelf),\n\t\t\t\t{ clientId, client: this.getMember(clientId) } satisfies ISelf,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Adds a new client to the audience\n\t */\n\tpublic addMember(clientId: string, details: IClient) {\n\t\t// Given that signal delivery is unreliable process, we might observe same client being added twice\n\t\t// In such case we should see exactly same payload (IClient), and should not raise event twice!\n\t\tif (this.members.has(clientId)) {\n\t\t\tconst client = this.members.get(clientId);\n\t\t\tassert(\n\t\t\t\tJSON.stringify(client) === JSON.stringify(details),\n\t\t\t\t0x4b2 /* new client has different payload from existing one */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.members.set(clientId, details);\n\t\t\tthis.emit(\"addMember\", clientId, details);\n\t\t}\n\t}\n\n\t/**\n\t * Removes a client from the audience. Only emits an event if a client is actually removed\n\t * @returns if a client was removed from the audience\n\t */\n\tpublic removeMember(clientId: string): boolean {\n\t\tconst removedClient = this.members.get(clientId);\n\t\tif (removedClient !== undefined) {\n\t\t\tthis.members.delete(clientId);\n\t\t\tthis.emit(\"removeMember\", clientId, removedClient);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all the members in the audience.\n\t *\n\t * @remarks When the container is disconnected, this will keep returning the audience as it was last seen before the\n\t * container disconnected.\n\t */\n\tpublic getMembers(): Map<string, IClient> {\n\t\treturn new Map(this.members);\n\t}\n\n\t/**\n\t * Retrieves a specific member of the audience.\n\t *\n\t * @remarks When the container is disconnected, this will keep returning members from the audience as it was last seen\n\t * before the container disconnected.\n\t */\n\tpublic getMember(clientId: string): IClient | undefined {\n\t\treturn this.members.get(clientId);\n\t}\n}\n"]}
1
+ {"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAG7D;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,iBAAkC;IAI/D;QACC,KAAK,EAAE,CAAC;QAJQ,YAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;QAKrD,kHAAkH;QAClH,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAEM,OAAO;QACb,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAS;YACzC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC;gBACA,QAAQ,EAAE,IAAI,CAAC,gBAAgB;gBAC/B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC;aAC7C,CAAC;IACL,CAAC;IAEM,kBAAkB,CAAC,QAAgB;QACzC,IAAI,IAAI,CAAC,gBAAgB,KAAK,QAAQ,EAAE,CAAC;YACxC,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC;YACpC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;YACjC,0EAA0E;YAC1E,yEAAyE;YACzE,qGAAqG;YACrG,IAAI,CAAC,IAAI,CACR,aAAa,EACb,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAkB,CAAC,EACvE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAkB,CAC9D,CAAC;QACH,CAAC;IACF,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB,EAAE,OAAgB;QAClD,mGAAmG;QACnG,+FAA+F;QAC/F,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC1C,MAAM,CACL,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAClD,KAAK,CAAC,wDAAwD,CAC9D,CAAC;QACH,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,QAAgB;QACnC,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC;QACd,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACI,UAAU;QAChB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IAudienceEvents, ISelf } from \"@fluidframework/container-definitions\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IClient } from \"@fluidframework/driver-definitions\";\n\n/**\n * Audience represents all clients connected to the op stream.\n */\nexport class Audience extends TypedEventEmitter<IAudienceEvents> implements IAudienceOwner {\n\tprivate readonly members = new Map<string, IClient>();\n\tprivate _currentClientId: string | undefined;\n\n\tconstructor() {\n\t\tsuper();\n\t\t// We are expecting this class to have many listeners, so we suppress noisy \"MaxListenersExceededWarning\" logging.\n\t\tsuper.setMaxListeners(0);\n\t}\n\n\tpublic getSelf(): ISelf | undefined {\n\t\treturn this._currentClientId === undefined\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tclientId: this._currentClientId,\n\t\t\t\t\tclient: this.getMember(this._currentClientId),\n\t\t\t\t};\n\t}\n\n\tpublic setCurrentClientId(clientId: string): void {\n\t\tif (this._currentClientId !== clientId) {\n\t\t\tconst oldId = this._currentClientId;\n\t\t\tthis._currentClientId = clientId;\n\t\t\t// this.getMember(clientId) could resolve to undefined in these two cases:\n\t\t\t// 1) Feature gates controlling ConnectionStateHandler() behavior are off\n\t\t\t// 2) we are loading from stashed state and audience is empty, but we remember and set prior clientId\n\t\t\tthis.emit(\n\t\t\t\t\"selfChanged\",\n\t\t\t\toldId === undefined ? undefined : ({ clientId: oldId } satisfies ISelf),\n\t\t\t\t{ clientId, client: this.getMember(clientId) } satisfies ISelf,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Adds a new client to the audience\n\t */\n\tpublic addMember(clientId: string, details: IClient): void {\n\t\t// Given that signal delivery is unreliable process, we might observe same client being added twice\n\t\t// In such case we should see exactly same payload (IClient), and should not raise event twice!\n\t\tif (this.members.has(clientId)) {\n\t\t\tconst client = this.members.get(clientId);\n\t\t\tassert(\n\t\t\t\tJSON.stringify(client) === JSON.stringify(details),\n\t\t\t\t0x4b2 /* new client has different payload from existing one */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.members.set(clientId, details);\n\t\t\tthis.emit(\"addMember\", clientId, details);\n\t\t}\n\t}\n\n\t/**\n\t * Removes a client from the audience. Only emits an event if a client is actually removed\n\t * @returns if a client was removed from the audience\n\t */\n\tpublic removeMember(clientId: string): boolean {\n\t\tconst removedClient = this.members.get(clientId);\n\t\tif (removedClient === undefined) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tthis.members.delete(clientId);\n\t\t\tthis.emit(\"removeMember\", clientId, removedClient);\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all the members in the audience.\n\t *\n\t * @remarks When the container is disconnected, this will keep returning the audience as it was last seen before the\n\t * container disconnected.\n\t */\n\tpublic getMembers(): Map<string, IClient> {\n\t\treturn new Map(this.members);\n\t}\n\n\t/**\n\t * Retrieves a specific member of the audience.\n\t *\n\t * @remarks When the container is disconnected, this will keep returning members from the audience as it was last seen\n\t * before the container disconnected.\n\t */\n\tpublic getMember(clientId: string): IClient | undefined {\n\t\treturn this.members.get(clientId);\n\t}\n}\n"]}
@@ -4,9 +4,13 @@
4
4
  */
5
5
  import { IDeltaManager } from "@fluidframework/container-definitions/internal";
6
6
  import { IDisposable } from "@fluidframework/core-interfaces";
7
- /** @see CatchUpMonitor for usage */
7
+ /**
8
+ * @see {@link CatchUpMonitor} for usage.
9
+ */
8
10
  type CaughtUpListener = () => void;
9
- /** Monitor that emits an event when a Container has caught up to a given point in the op stream */
11
+ /**
12
+ * Monitor that emits an event when a Container has caught up to a given point in the op stream
13
+ */
10
14
  export type ICatchUpMonitor = IDisposable;
11
15
  /**
12
16
  * Monitors a Container's DeltaManager, notifying listeners when all ops have been processed
@@ -21,8 +25,15 @@ export declare class CatchUpMonitor implements ICatchUpMonitor {
21
25
  /**
22
26
  * Create the CatchUpMonitor, setting the target sequence number to wait for based on DeltaManager's current state.
23
27
  */
24
- constructor(deltaManager: IDeltaManager<any, any>, listener: CaughtUpListener);
25
- disposed: boolean;
28
+ constructor(deltaManager: IDeltaManager<unknown, unknown>, listener: CaughtUpListener);
29
+ private _disposed;
30
+ /**
31
+ * {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}
32
+ */
33
+ get disposed(): boolean;
34
+ /**
35
+ * {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}
36
+ */
26
37
  dispose(): void;
27
38
  }
28
39
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"catchUpMonitor.d.ts","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAI9D,oCAAoC;AACpC,KAAK,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAEnC,mGAAmG;AACnG,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C;;;GAGG;AACH,qBAAa,cAAe,YAAW,eAAe;IAiBpD,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAjB1B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAkB;IAElC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAOxB;IAEF;;OAEG;gBAEe,YAAY,EAAE,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EACrC,QAAQ,EAAE,gBAAgB;IAerC,QAAQ,EAAE,OAAO,CAAS;IAC1B,OAAO;CAQd"}
1
+ {"version":3,"file":"catchUpMonitor.d.ts","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAI9D;;GAEG;AACH,KAAK,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C;;;GAGG;AACH,qBAAa,cAAe,YAAW,eAAe;IAiBpD,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAjB1B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAkB;IAElC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAOxB;IAEF;;OAEG;gBAEe,YAAY,EAAE,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,EAC7C,QAAQ,EAAE,gBAAgB;IAe5C,OAAO,CAAC,SAAS,CAAkB;IAEnC;;OAEG;IACH,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED;;OAEG;IACI,OAAO,IAAI,IAAI;CAQtB"}
@@ -21,18 +21,27 @@ export class CatchUpMonitor {
21
21
  this.listener();
22
22
  }
23
23
  };
24
- this.disposed = false;
24
+ this._disposed = false;
25
25
  this.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;
26
26
  assert(this.targetSeqNumber >= this.deltaManager.lastSequenceNumber, 0x37c /* Cannot wait for seqNumber below last processed sequence number */);
27
27
  this.deltaManager.on("op", this.opHandler);
28
28
  // Simulate the last processed op to set caughtUp in case we already are
29
29
  this.opHandler({ sequenceNumber: this.deltaManager.lastSequenceNumber });
30
30
  }
31
+ /**
32
+ * {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}
33
+ */
34
+ get disposed() {
35
+ return this._disposed;
36
+ }
37
+ /**
38
+ * {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}
39
+ */
31
40
  dispose() {
32
- if (this.disposed) {
41
+ if (this._disposed) {
33
42
  return;
34
43
  }
35
- this.disposed = true;
44
+ this._disposed = true;
36
45
  this.deltaManager.off("op", this.opHandler);
37
46
  }
38
47
  }
@@ -1 +1 @@
1
- {"version":3,"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*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\n/** @see CatchUpMonitor for usage */\ntype CaughtUpListener = () => void;\n\n/** Monitor that emits an event when a Container has caught up to a given point in the op stream */\nexport type ICatchUpMonitor = IDisposable;\n\n/**\n * Monitors a Container's DeltaManager, notifying listeners when all ops have been processed\n * that were known at the time the monitor was created.\n */\nexport class CatchUpMonitor implements ICatchUpMonitor {\n\tprivate readonly targetSeqNumber: number;\n\tprivate caughtUp: boolean = false;\n\n\tprivate readonly opHandler = (\n\t\tmessage: Pick<ISequencedDocumentMessage, \"sequenceNumber\">,\n\t) => {\n\t\tif (!this.caughtUp && message.sequenceNumber >= this.targetSeqNumber) {\n\t\t\tthis.caughtUp = true;\n\t\t\tthis.listener();\n\t\t}\n\t};\n\n\t/**\n\t * Create the CatchUpMonitor, setting the target sequence number to wait for based on DeltaManager's current state.\n\t */\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<any, any>,\n\t\tprivate readonly listener: CaughtUpListener,\n\t) {\n\t\tthis.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\n\t\tassert(\n\t\t\tthis.targetSeqNumber >= this.deltaManager.lastSequenceNumber,\n\t\t\t0x37c /* Cannot wait for seqNumber below last processed sequence number */,\n\t\t);\n\n\t\tthis.deltaManager.on(\"op\", this.opHandler);\n\n\t\t// Simulate the last processed op to set caughtUp in case we already are\n\t\tthis.opHandler({ sequenceNumber: this.deltaManager.lastSequenceNumber });\n\t}\n\n\tpublic disposed: boolean = false;\n\tpublic dispose() {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.disposed = true;\n\n\t\tthis.deltaManager.off(\"op\", this.opHandler);\n\t}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EtB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * @see {@link CatchUpMonitor} for usage.\n */\ntype CaughtUpListener = () => void;\n\n/**\n * Monitor that emits an event when a Container has caught up to a given point in the op stream\n */\nexport type ICatchUpMonitor = IDisposable;\n\n/**\n * Monitors a Container's DeltaManager, notifying listeners when all ops have been processed\n * that were known at the time the monitor was created.\n */\nexport class CatchUpMonitor implements ICatchUpMonitor {\n\tprivate readonly targetSeqNumber: number;\n\tprivate caughtUp: boolean = false;\n\n\tprivate readonly opHandler = (\n\t\tmessage: Pick<ISequencedDocumentMessage, \"sequenceNumber\">,\n\t): void => {\n\t\tif (!this.caughtUp && message.sequenceNumber >= this.targetSeqNumber) {\n\t\t\tthis.caughtUp = true;\n\t\t\tthis.listener();\n\t\t}\n\t};\n\n\t/**\n\t * Create the CatchUpMonitor, setting the target sequence number to wait for based on DeltaManager's current state.\n\t */\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<unknown, unknown>,\n\t\tprivate readonly listener: CaughtUpListener,\n\t) {\n\t\tthis.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\n\t\tassert(\n\t\t\tthis.targetSeqNumber >= this.deltaManager.lastSequenceNumber,\n\t\t\t0x37c /* Cannot wait for seqNumber below last processed sequence number */,\n\t\t);\n\n\t\tthis.deltaManager.on(\"op\", this.opHandler);\n\n\t\t// Simulate the last processed op to set caughtUp in case we already are\n\t\tthis.opHandler({ sequenceNumber: this.deltaManager.lastSequenceNumber });\n\t}\n\n\tprivate _disposed: boolean = false;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}\n\t */\n\tpublic dispose(): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\tthis.deltaManager.off(\"op\", this.opHandler);\n\t}\n}\n"]}
@@ -20,7 +20,9 @@ export declare class ConnectionManager implements IConnectionManager {
20
20
  private readonly client;
21
21
  private readonly logger;
22
22
  private readonly props;
23
- /** Connection mode used when reconnecting on error or disconnect. */
23
+ /**
24
+ * Connection mode used when reconnecting on error or disconnect.
25
+ */
24
26
  private readonly defaultReconnectionMode;
25
27
  /**
26
28
  * Tracks the current in-progress connection attempt. Undefined if there is none.
@@ -29,23 +31,35 @@ export declare class ConnectionManager implements IConnectionManager {
29
31
  */
30
32
  private pendingConnection;
31
33
  private connection;
32
- /** Details about connection. undefined if there is no active connection. */
34
+ /**
35
+ * Details about connection. undefined if there is no active connection.
36
+ */
33
37
  private _connectionDetails?;
34
- /** file ACL - whether user has only read-only access to a file */
38
+ /**
39
+ * file ACL - whether user has only read-only access to a file
40
+ */
35
41
  private _readonlyPermissions;
36
- /** tracks host requiring read-only mode. */
42
+ /**
43
+ * tracks host requiring read-only mode.
44
+ */
37
45
  private _forceReadonly;
38
46
  /**
39
47
  * Controls whether the DeltaManager will automatically reconnect to the delta stream after receiving a disconnect.
40
48
  */
41
49
  private _reconnectMode;
42
- /** True if there is pending (async) reconnection from "read" to "write" */
50
+ /**
51
+ * True if there is pending (async) reconnection from "read" to "write"
52
+ */
43
53
  private pendingReconnect;
44
54
  private clientSequenceNumber;
45
55
  private clientSequenceNumberObserved;
46
- /** Counts the number of non-runtime ops sent by the client which may not be acked. */
56
+ /**
57
+ * Counts the number of non-runtime ops sent by the client which may not be acked.
58
+ */
47
59
  private localOpsToIgnore;
48
- /** track clientId used last time when we sent any ops */
60
+ /**
61
+ * track clientId used last time when we sent any ops
62
+ */
49
63
  private lastSubmittedClientId;
50
64
  private connectFirstConnection;
51
65
  private _connectionVerboseProps;
@@ -60,7 +74,9 @@ export declare class ConnectionManager implements IConnectionManager {
60
74
  get connectionMode(): ConnectionMode;
61
75
  get connected(): boolean;
62
76
  get clientId(): string | undefined;
63
- /** Details about connection. undefined if there is no active connection. */
77
+ /**
78
+ * Details about connection. Returns undefined if there is no active connection.
79
+ */
64
80
  get connectionDetails(): IConnectionDetailsInternal | undefined;
65
81
  /**
66
82
  * Automatic reconnecting enabled or disabled.
@@ -1 +1 @@
1
- {"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,EAEN,wBAAwB,EAExB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC7F,OAAO,EAGN,gBAAgB,EAGhB,oBAAoB,EACpB,gBAAgB,EAQhB,yBAAyB,EAEzB,MAAM,6CAA6C,CAAC;AAUrD,OAAO,EACN,mBAAmB,EAOnB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,0BAA0B,EAC1B,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,EAC5B,aAAa,EACb,MAAM,gBAAgB,CAAC;AAiIxB;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,kBAAkB;IA6L1D,OAAO,CAAC,QAAQ,CAAC,eAAe;aAChB,cAAc,EAAE,MAAM,OAAO;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO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