@fluidframework/container-loader 2.0.0-rc.3.0.3 → 2.0.0-rc.4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/api-report/container-loader.api.md +5 -1
  3. package/dist/attachment.d.ts +3 -2
  4. package/dist/attachment.d.ts.map +1 -1
  5. package/dist/attachment.js +5 -5
  6. package/dist/attachment.js.map +1 -1
  7. package/dist/audience.d.ts +6 -4
  8. package/dist/audience.d.ts.map +1 -1
  9. package/dist/audience.js +18 -3
  10. package/dist/audience.js.map +1 -1
  11. package/dist/catchUpMonitor.d.ts +1 -1
  12. package/dist/catchUpMonitor.d.ts.map +1 -1
  13. package/dist/catchUpMonitor.js.map +1 -1
  14. package/dist/connectionManager.d.ts +7 -3
  15. package/dist/connectionManager.d.ts.map +1 -1
  16. package/dist/connectionManager.js +57 -38
  17. package/dist/connectionManager.js.map +1 -1
  18. package/dist/connectionStateHandler.d.ts +31 -10
  19. package/dist/connectionStateHandler.d.ts.map +1 -1
  20. package/dist/connectionStateHandler.js +49 -36
  21. package/dist/connectionStateHandler.js.map +1 -1
  22. package/dist/container.d.ts +22 -13
  23. package/dist/container.d.ts.map +1 -1
  24. package/dist/container.js +145 -117
  25. package/dist/container.js.map +1 -1
  26. package/dist/containerContext.d.ts +3 -3
  27. package/dist/containerContext.d.ts.map +1 -1
  28. package/dist/containerContext.js.map +1 -1
  29. package/dist/containerStorageAdapter.d.ts +12 -3
  30. package/dist/containerStorageAdapter.d.ts.map +1 -1
  31. package/dist/containerStorageAdapter.js +42 -4
  32. package/dist/containerStorageAdapter.js.map +1 -1
  33. package/dist/contracts.d.ts +2 -2
  34. package/dist/contracts.d.ts.map +1 -1
  35. package/dist/contracts.js.map +1 -1
  36. package/dist/debugLogger.d.ts +1 -2
  37. package/dist/debugLogger.d.ts.map +1 -1
  38. package/dist/debugLogger.js.map +1 -1
  39. package/dist/deltaManager.d.ts +5 -6
  40. package/dist/deltaManager.d.ts.map +1 -1
  41. package/dist/deltaManager.js +29 -24
  42. package/dist/deltaManager.js.map +1 -1
  43. package/dist/deltaQueue.d.ts +1 -1
  44. package/dist/deltaQueue.d.ts.map +1 -1
  45. package/dist/deltaQueue.js.map +1 -1
  46. package/dist/error.d.ts +1 -2
  47. package/dist/error.d.ts.map +1 -1
  48. package/dist/error.js.map +1 -1
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +3 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/legacy.d.ts +2 -2
  54. package/dist/loadPaused.d.ts +35 -0
  55. package/dist/loadPaused.d.ts.map +1 -0
  56. package/dist/loadPaused.js +115 -0
  57. package/dist/loadPaused.js.map +1 -0
  58. package/dist/loader.d.ts +1 -1
  59. package/dist/loader.d.ts.map +1 -1
  60. package/dist/loader.js +1 -14
  61. package/dist/loader.js.map +1 -1
  62. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  63. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +4 -4
  64. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  65. package/dist/packageVersion.d.ts +1 -1
  66. package/dist/packageVersion.js +1 -1
  67. package/dist/packageVersion.js.map +1 -1
  68. package/dist/protocol.d.ts.map +1 -1
  69. package/dist/protocol.js +3 -0
  70. package/dist/protocol.js.map +1 -1
  71. package/dist/public.d.ts +1 -1
  72. package/dist/retriableDocumentStorageService.d.ts +1 -1
  73. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  74. package/dist/retriableDocumentStorageService.js.map +1 -1
  75. package/dist/serializedStateManager.d.ts +89 -9
  76. package/dist/serializedStateManager.d.ts.map +1 -1
  77. package/dist/serializedStateManager.js +150 -34
  78. package/dist/serializedStateManager.js.map +1 -1
  79. package/dist/utils.d.ts +11 -1
  80. package/dist/utils.d.ts.map +1 -1
  81. package/dist/utils.js +29 -14
  82. package/dist/utils.js.map +1 -1
  83. package/lib/attachment.d.ts +3 -2
  84. package/lib/attachment.d.ts.map +1 -1
  85. package/lib/attachment.js +5 -5
  86. package/lib/attachment.js.map +1 -1
  87. package/lib/audience.d.ts +6 -4
  88. package/lib/audience.d.ts.map +1 -1
  89. package/lib/audience.js +19 -4
  90. package/lib/audience.js.map +1 -1
  91. package/lib/catchUpMonitor.d.ts +1 -1
  92. package/lib/catchUpMonitor.d.ts.map +1 -1
  93. package/lib/catchUpMonitor.js.map +1 -1
  94. package/lib/connectionManager.d.ts +7 -3
  95. package/lib/connectionManager.d.ts.map +1 -1
  96. package/lib/connectionManager.js +36 -17
  97. package/lib/connectionManager.js.map +1 -1
  98. package/lib/connectionStateHandler.d.ts +31 -10
  99. package/lib/connectionStateHandler.d.ts.map +1 -1
  100. package/lib/connectionStateHandler.js +49 -36
  101. package/lib/connectionStateHandler.js.map +1 -1
  102. package/lib/container.d.ts +22 -13
  103. package/lib/container.d.ts.map +1 -1
  104. package/lib/container.js +146 -118
  105. package/lib/container.js.map +1 -1
  106. package/lib/containerContext.d.ts +3 -3
  107. package/lib/containerContext.d.ts.map +1 -1
  108. package/lib/containerContext.js.map +1 -1
  109. package/lib/containerStorageAdapter.d.ts +12 -3
  110. package/lib/containerStorageAdapter.d.ts.map +1 -1
  111. package/lib/containerStorageAdapter.js +42 -4
  112. package/lib/containerStorageAdapter.js.map +1 -1
  113. package/lib/contracts.d.ts +2 -2
  114. package/lib/contracts.d.ts.map +1 -1
  115. package/lib/contracts.js +1 -1
  116. package/lib/contracts.js.map +1 -1
  117. package/lib/debugLogger.d.ts +1 -2
  118. package/lib/debugLogger.d.ts.map +1 -1
  119. package/lib/debugLogger.js.map +1 -1
  120. package/lib/deltaManager.d.ts +5 -6
  121. package/lib/deltaManager.d.ts.map +1 -1
  122. package/lib/deltaManager.js +10 -5
  123. package/lib/deltaManager.js.map +1 -1
  124. package/lib/deltaQueue.d.ts +1 -1
  125. package/lib/deltaQueue.d.ts.map +1 -1
  126. package/lib/deltaQueue.js.map +1 -1
  127. package/lib/error.d.ts +1 -2
  128. package/lib/error.d.ts.map +1 -1
  129. package/lib/error.js.map +1 -1
  130. package/lib/index.d.ts +1 -0
  131. package/lib/index.d.ts.map +1 -1
  132. package/lib/index.js +1 -0
  133. package/lib/index.js.map +1 -1
  134. package/lib/legacy.d.ts +2 -2
  135. package/lib/loadPaused.d.ts +35 -0
  136. package/lib/loadPaused.d.ts.map +1 -0
  137. package/lib/loadPaused.js +111 -0
  138. package/lib/loadPaused.js.map +1 -0
  139. package/lib/loader.d.ts +1 -1
  140. package/lib/loader.d.ts.map +1 -1
  141. package/lib/loader.js +3 -16
  142. package/lib/loader.js.map +1 -1
  143. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  144. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +1 -1
  145. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  146. package/lib/packageVersion.d.ts +1 -1
  147. package/lib/packageVersion.js +1 -1
  148. package/lib/packageVersion.js.map +1 -1
  149. package/lib/protocol.d.ts.map +1 -1
  150. package/lib/protocol.js +3 -0
  151. package/lib/protocol.js.map +1 -1
  152. package/lib/public.d.ts +1 -1
  153. package/lib/retriableDocumentStorageService.d.ts +1 -1
  154. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  155. package/lib/retriableDocumentStorageService.js +1 -1
  156. package/lib/retriableDocumentStorageService.js.map +1 -1
  157. package/lib/serializedStateManager.d.ts +89 -9
  158. package/lib/serializedStateManager.d.ts.map +1 -1
  159. package/lib/serializedStateManager.js +146 -30
  160. package/lib/serializedStateManager.js.map +1 -1
  161. package/lib/tsdoc-metadata.json +1 -1
  162. package/lib/utils.d.ts +11 -1
  163. package/lib/utils.d.ts.map +1 -1
  164. package/lib/utils.js +15 -1
  165. package/lib/utils.js.map +1 -1
  166. package/package.json +24 -21
  167. package/src/attachment.ts +12 -13
  168. package/src/audience.ts +30 -9
  169. package/src/catchUpMonitor.ts +1 -1
  170. package/src/connectionManager.ts +45 -22
  171. package/src/connectionStateHandler.ts +78 -45
  172. package/src/container.ts +181 -160
  173. package/src/containerContext.ts +2 -2
  174. package/src/containerStorageAdapter.ts +61 -6
  175. package/src/contracts.ts +5 -4
  176. package/src/debugLogger.ts +1 -1
  177. package/src/deltaManager.ts +15 -8
  178. package/src/deltaQueue.ts +1 -1
  179. package/src/error.ts +1 -1
  180. package/src/index.ts +1 -0
  181. package/src/loadPaused.ts +140 -0
  182. package/src/loader.ts +6 -23
  183. package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +1 -1
  184. package/src/packageVersion.ts +1 -1
  185. package/src/protocol.ts +4 -0
  186. package/src/retriableDocumentStorageService.ts +5 -2
  187. package/src/serializedStateManager.ts +215 -48
  188. package/src/utils.ts +19 -1
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAAqF;AAIrF,uEAIkD;AAElD;;GAEG;AACH,MAAa,iBAAkB,SAAQ,uBAAY;IAMlD,YACC,OAAe,EACN,iBAAyB,EAClC,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,sBAAiB,GAAjB,iBAAiB,CAAQ;QAPnC;;WAEG;QACa,cAAS,GAAG,8BAAmB,CAAC,eAAe,CAAC;IAQhE,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAI,CACjB,KAAc,EACd,iBAAyB,EACzB,MAA2B;QAE3B,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACxF,OAAO,IAAA,0BAAe,EAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACD;AA1BD,8CA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerErrorTypes } from \"@fluidframework/container-definitions/internal\";\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { IThrottlingWarning } from \"@fluidframework/core-interfaces/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIFluidErrorBase,\n\tLoggingError,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Warning emitted when requests to storage are being throttled.\n */\nexport class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\t/**\n\t * {@inheritDoc @fluidframework/telemetry-utils#IFluidErrorBase.errorType}\n\t */\n\tpublic readonly errorType = ContainerErrorTypes.throttlingError;\n\n\tprivate constructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops?: ITelemetryBaseProperties,\n\t) {\n\t\tsuper(message, props);\n\t}\n\n\t/**\n\t * Wrap the given error as a ThrottlingWarning\n\t * Only preserves the error message, and applies the given retry after to the new warning object\n\t */\n\tpublic static wrap(\n\t\terror: unknown,\n\t\tretryAfterSeconds: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): IThrottlingWarning {\n\t\tconst newErrorFn = (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds);\n\t\treturn wrapErrorAndLog(error, newErrorFn, logger);\n\t}\n}\n"]}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAAqF;AAGrF,uEAKkD;AAElD;;GAEG;AACH,MAAa,iBAAkB,SAAQ,uBAAY;IAMlD,YACC,OAAe,EACN,iBAAyB,EAClC,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,sBAAiB,GAAjB,iBAAiB,CAAQ;QAPnC;;WAEG;QACa,cAAS,GAAG,8BAAmB,CAAC,eAAe,CAAC;IAQhE,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAI,CACjB,KAAc,EACd,iBAAyB,EACzB,MAA2B;QAE3B,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACxF,OAAO,IAAA,0BAAe,EAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACD;AA1BD,8CA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerErrorTypes } from \"@fluidframework/container-definitions/internal\";\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { IThrottlingWarning } from \"@fluidframework/core-interfaces/internal\";\nimport {\n\tIFluidErrorBase,\n\tITelemetryLoggerExt,\n\tLoggingError,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Warning emitted when requests to storage are being throttled.\n */\nexport class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\t/**\n\t * {@inheritDoc @fluidframework/telemetry-utils#IFluidErrorBase.errorType}\n\t */\n\tpublic readonly errorType = ContainerErrorTypes.throttlingError;\n\n\tprivate constructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops?: ITelemetryBaseProperties,\n\t) {\n\t\tsuper(message, props);\n\t}\n\n\t/**\n\t * Wrap the given error as a ThrottlingWarning\n\t * Only preserves the error message, and applies the given retry after to the new warning object\n\t */\n\tpublic static wrap(\n\t\terror: unknown,\n\t\tretryAfterSeconds: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): IThrottlingWarning {\n\t\tconst newErrorFn = (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds);\n\t\treturn wrapErrorAndLog(error, newErrorFn, logger);\n\t}\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  export { ConnectionState } from "./connectionState.js";
6
6
  export { IContainerExperimental, waitContainerToCatchUp } from "./container.js";
7
7
  export { ICodeDetailsLoader, IDetachedBlobStorage, IFluidModuleWithDetails, ILoaderOptions, ILoaderProps, ILoaderServices, Loader, } from "./loader.js";
8
+ export { loadContainerPaused } from "./loadPaused.js";
8
9
  export { isLocationRedirectionError, resolveWithLocationRedirectionHandling, } from "./location-redirection-utilities/index.js";
9
10
  export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol.js";
10
11
  export { tryParseCompatibleResolvedUrl, IParsedUrl } from "./utils.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,0BAA0B,EAC1B,sCAAsC,GACtC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,0BAA0B,EAC1B,sCAAsC,GACtC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -4,13 +4,15 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.tryParseCompatibleResolvedUrl = exports.resolveWithLocationRedirectionHandling = exports.isLocationRedirectionError = exports.Loader = exports.waitContainerToCatchUp = exports.ConnectionState = void 0;
7
+ exports.tryParseCompatibleResolvedUrl = exports.resolveWithLocationRedirectionHandling = exports.isLocationRedirectionError = exports.loadContainerPaused = exports.Loader = exports.waitContainerToCatchUp = exports.ConnectionState = void 0;
8
8
  var connectionState_js_1 = require("./connectionState.js");
9
9
  Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return connectionState_js_1.ConnectionState; } });
10
10
  var container_js_1 = require("./container.js");
11
11
  Object.defineProperty(exports, "waitContainerToCatchUp", { enumerable: true, get: function () { return container_js_1.waitContainerToCatchUp; } });
12
12
  var loader_js_1 = require("./loader.js");
13
13
  Object.defineProperty(exports, "Loader", { enumerable: true, get: function () { return loader_js_1.Loader; } });
14
+ var loadPaused_js_1 = require("./loadPaused.js");
15
+ Object.defineProperty(exports, "loadContainerPaused", { enumerable: true, get: function () { return loadPaused_js_1.loadContainerPaused; } });
14
16
  var index_js_1 = require("./location-redirection-utilities/index.js");
15
17
  Object.defineProperty(exports, "isLocationRedirectionError", { enumerable: true, get: function () { return index_js_1.isLocationRedirectionError; } });
16
18
  Object.defineProperty(exports, "resolveWithLocationRedirectionHandling", { enumerable: true, get: function () { return index_js_1.resolveWithLocationRedirectionHandling; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,+CAAgF;AAA/C,sHAAA,sBAAsB,OAAA;AACvD,yCAQqB;AADpB,mGAAA,MAAM,OAAA;AAEP,sEAGmD;AAFlD,sHAAA,0BAA0B,OAAA;AAC1B,kIAAA,sCAAsC,OAAA;AAGvC,uCAAuE;AAA9D,yHAAA,6BAA6B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState.js\";\nexport { IContainerExperimental, waitContainerToCatchUp } from \"./container.js\";\nexport {\n\tICodeDetailsLoader,\n\tIDetachedBlobStorage,\n\tIFluidModuleWithDetails,\n\tILoaderOptions,\n\tILoaderProps,\n\tILoaderServices,\n\tLoader,\n} from \"./loader.js\";\nexport {\n\tisLocationRedirectionError,\n\tresolveWithLocationRedirectionHandling,\n} from \"./location-redirection-utilities/index.js\";\nexport { IProtocolHandler, ProtocolHandlerBuilder } from \"./protocol.js\";\nexport { tryParseCompatibleResolvedUrl, IParsedUrl } from \"./utils.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,+CAAgF;AAA/C,sHAAA,sBAAsB,OAAA;AACvD,yCAQqB;AADpB,mGAAA,MAAM,OAAA;AAEP,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAC5B,sEAGmD;AAFlD,sHAAA,0BAA0B,OAAA;AAC1B,kIAAA,sCAAsC,OAAA;AAGvC,uCAAuE;AAA9D,yHAAA,6BAA6B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState.js\";\nexport { IContainerExperimental, waitContainerToCatchUp } from \"./container.js\";\nexport {\n\tICodeDetailsLoader,\n\tIDetachedBlobStorage,\n\tIFluidModuleWithDetails,\n\tILoaderOptions,\n\tILoaderProps,\n\tILoaderServices,\n\tLoader,\n} from \"./loader.js\";\nexport { loadContainerPaused } from \"./loadPaused.js\";\nexport {\n\tisLocationRedirectionError,\n\tresolveWithLocationRedirectionHandling,\n} from \"./location-redirection-utilities/index.js\";\nexport { IProtocolHandler, ProtocolHandlerBuilder } from \"./protocol.js\";\nexport { tryParseCompatibleResolvedUrl, IParsedUrl } from \"./utils.js\";\n"]}
package/dist/legacy.d.ts CHANGED
@@ -9,10 +9,10 @@
9
9
  */
10
10
 
11
11
  export {
12
- // public APIs
12
+ // @public APIs
13
13
  ConnectionState,
14
14
 
15
- // alpha APIs
15
+ // @alpha APIs
16
16
  ICodeDetailsLoader,
17
17
  IDetachedBlobStorage,
18
18
  IFluidModuleWithDetails,
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ILoader } from "@fluidframework/container-definitions/internal";
6
+ import { IRequest } from "@fluidframework/core-interfaces";
7
+ /**
8
+ * Loads container and leaves it in a state where it does not process any ops.
9
+ * Container instance returned by this function is in special mode where some functionality that is available in normal use will not work correctly
10
+ * with instance of container returned by this function. Some examples:
11
+ * 1. calling IContainer.connect() will have very little impact on this container as it will not process ops.
12
+ * 2. functionality like waitContainerToCatchUp() or waiting for ops in any other way would hand infinitely, as this container is not processing ops
13
+ * 3. No changes can be made to this container - they will be lost.
14
+ *
15
+ * If sequence number is provided, loads up to this sequence number and stops there, otherwise stops immediately after loading snapshot.
16
+ * In all cases, container is returned disconnected & paused, or an exception is thrown
17
+ * Notes:
18
+ * 1. Ignores LoaderHeader.loadMode headers. Container is always returned with ops applied upt to provided sequence number,
19
+ * or no ops applied at all (if sequence number is not provided)
20
+ * 2. This call can hang infinitately if disconnected from internet (or hit some other conditions, like 429 storm).
21
+ * Compare to Container.load() experience (with default settings) - it either returns failure right away, or succeeds, with
22
+ * ops fetching / delta connection happening in parallel / after container load flow, and thus providing an object (Container instance) to observe
23
+ * network connectivity issues / ability to cancel (IContainer.disconnect) or close container (IContainer.close)
24
+ * This flow needs to fetch ops (potentially connecting to delta connection), and any retriable errors on this path result in infinite retry.
25
+ * If you need to cancel that process, consider supplying AbortSignal parameter.
26
+ * @param loader - loader instance to use to load container
27
+ * @param request - request identifying container instance / load parameters. LoaderHeader.loadMode headers are ignored (see above)
28
+ * @param loadToSequenceNumber - optional sequence number. If provided, ops are processed up to this sequence number.
29
+ * @param signal - optional abort signal that can be used to cancel waiting for the ops.
30
+ * @returns IContainer instance
31
+ *
32
+ * @internal
33
+ */
34
+ export declare function loadContainerPaused(loader: ILoader, request: IRequest, loadToSequenceNumber?: number, signal?: AbortSignal): Promise<import("@fluidframework/container-definitions/internal").IContainer>;
35
+ //# sourceMappingURL=loadPaused.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadPaused.d.ts","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAgB,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAM3D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,mBAAmB,CACxC,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,MAAM,CAAC,EAAE,WAAW,gFA8FpB"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.loadContainerPaused = void 0;
8
+ const internal_1 = require("@fluidframework/container-definitions/internal");
9
+ const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
+ /* eslint-disable jsdoc/check-indentation */
11
+ /**
12
+ * Loads container and leaves it in a state where it does not process any ops.
13
+ * Container instance returned by this function is in special mode where some functionality that is available in normal use will not work correctly
14
+ * with instance of container returned by this function. Some examples:
15
+ * 1. calling IContainer.connect() will have very little impact on this container as it will not process ops.
16
+ * 2. functionality like waitContainerToCatchUp() or waiting for ops in any other way would hand infinitely, as this container is not processing ops
17
+ * 3. No changes can be made to this container - they will be lost.
18
+ *
19
+ * If sequence number is provided, loads up to this sequence number and stops there, otherwise stops immediately after loading snapshot.
20
+ * In all cases, container is returned disconnected & paused, or an exception is thrown
21
+ * Notes:
22
+ * 1. Ignores LoaderHeader.loadMode headers. Container is always returned with ops applied upt to provided sequence number,
23
+ * or no ops applied at all (if sequence number is not provided)
24
+ * 2. This call can hang infinitately if disconnected from internet (or hit some other conditions, like 429 storm).
25
+ * Compare to Container.load() experience (with default settings) - it either returns failure right away, or succeeds, with
26
+ * ops fetching / delta connection happening in parallel / after container load flow, and thus providing an object (Container instance) to observe
27
+ * network connectivity issues / ability to cancel (IContainer.disconnect) or close container (IContainer.close)
28
+ * This flow needs to fetch ops (potentially connecting to delta connection), and any retriable errors on this path result in infinite retry.
29
+ * If you need to cancel that process, consider supplying AbortSignal parameter.
30
+ * @param loader - loader instance to use to load container
31
+ * @param request - request identifying container instance / load parameters. LoaderHeader.loadMode headers are ignored (see above)
32
+ * @param loadToSequenceNumber - optional sequence number. If provided, ops are processed up to this sequence number.
33
+ * @param signal - optional abort signal that can be used to cancel waiting for the ops.
34
+ * @returns IContainer instance
35
+ *
36
+ * @internal
37
+ */
38
+ async function loadContainerPaused(loader, request, loadToSequenceNumber, signal) {
39
+ const container = await loader.resolve({
40
+ url: request.url,
41
+ headers: {
42
+ ...request.headers,
43
+ // ensure we do not process any ops, such that we can examine container before ops starts to flow.
44
+ [internal_1.LoaderHeader.loadMode]: { opsBeforeReturn: undefined, deltaConnection: "none" },
45
+ },
46
+ });
47
+ // Force readonly mode - this will ensure we don't receive an error for the lack of join op
48
+ container.forceReadonly?.(true);
49
+ const dm = container.deltaManager;
50
+ const lastProcessedSequenceNumber = dm.initialSequenceNumber;
51
+ const pauseContainer = () => {
52
+ void dm.inbound.pause();
53
+ void dm.outbound.pause();
54
+ };
55
+ // Happy path - we are already there.
56
+ if (loadToSequenceNumber === undefined ||
57
+ lastProcessedSequenceNumber === loadToSequenceNumber) {
58
+ // If we have already reached the desired sequence number, call pauseContainer() to pause immediately.
59
+ pauseContainer();
60
+ return container;
61
+ }
62
+ // If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.
63
+ if (lastProcessedSequenceNumber > loadToSequenceNumber) {
64
+ const error = new internal_2.GenericError("Cannot satisfy request to pause the container at the specified sequence number. Most recent snapshot is newer than the specified sequence number.");
65
+ container.close(error);
66
+ throw error;
67
+ }
68
+ let opHandler;
69
+ let onAbort;
70
+ let onClose;
71
+ const promise = new Promise((resolve, rejectArg) => {
72
+ onAbort = () => rejectArg(new internal_2.GenericError("Canceled due to cancellation request."));
73
+ onClose = (error) => rejectArg(error);
74
+ // We need to setup a listener to stop op processing once we reach the desired sequence number (if specified).
75
+ opHandler = () => {
76
+ // If there is a specified sequence number, keep processing until we reach it.
77
+ if (loadToSequenceNumber !== undefined &&
78
+ dm.lastSequenceNumber >= loadToSequenceNumber) {
79
+ // Pause op processing once we have processed the desired number of ops.
80
+ pauseContainer();
81
+ resolve();
82
+ }
83
+ };
84
+ // If we have not yet reached the desired sequence number, setup a listener to pause once we reach it.
85
+ signal?.addEventListener("abort", onAbort);
86
+ container.on("op", opHandler);
87
+ container.on("closed", onClose);
88
+ });
89
+ // There are no guarantees on when ops will land in storage.
90
+ // No guarantees that driver implements ops caching (i.e. ops observed in previous session can be served from cache)
91
+ // or that browser will provide caching capabilities / keep the data (localStorage).
92
+ // Thus, we have to ensure we connect to delta storage in order to make forward progress with ops.
93
+ // We also instructed not to fetch / apply any ops from storage above (to be able to install callback above before ops are processed),
94
+ // connect() call will fetch ops as needed.
95
+ container.connect();
96
+ // Wait for the ops to be processed.
97
+ await promise
98
+ .catch((error) => {
99
+ container.close(error);
100
+ throw error;
101
+ })
102
+ .finally(() => {
103
+ // There is not much value in leaving delta connection on. We are not processing ops, we also can't advance to "connected" state because of it.
104
+ // We are not sending ops (due to forceReadonly() call above). We are holding collab window and any consensus-based processes.
105
+ // It's better not to have connection in such case, as there are only nagatives, and no positives.
106
+ container.disconnect();
107
+ container.off("op", opHandler);
108
+ container.off("closed", onClose);
109
+ signal?.removeEventListener("abort", onAbort);
110
+ });
111
+ return container;
112
+ }
113
+ exports.loadContainerPaused = loadContainerPaused;
114
+ /* eslint-enable jsdoc/check-indentation */
115
+ //# sourceMappingURL=loadPaused.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadPaused.js","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAAuF;AAEvF,uEAAwE;AAGxE,4CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACI,KAAK,UAAU,mBAAmB,CACxC,MAAe,EACf,OAAiB,EACjB,oBAA6B,EAC7B,MAAoB;IAEpB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACtC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,OAAO,EAAE;YACR,GAAG,OAAO,CAAC,OAAO;YAClB,kGAAkG;YAClG,CAAC,uBAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE;SAChF;KACD,CAAC,CAAC;IAEH,2FAA2F;IAC3F,SAAS,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC;IAEhC,MAAM,EAAE,GAAG,SAAS,CAAC,YAAY,CAAC;IAClC,MAAM,2BAA2B,GAAG,EAAE,CAAC,qBAAqB,CAAC;IAE7D,MAAM,cAAc,GAAG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AAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,4DAA4D;IAC5D,oHAAoH;IACpH,oFAAoF;IACpF,kGAAkG;IAClG,sIAAsI;IACtI,2CAA2C;IAC3C,SAAS,CAAC,OAAO,EAAE,CAAC;IAEpB,oCAAoC;IACpC,MAAM,OAAO;SACX,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAChB,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,MAAM,KAAK,CAAC;IACb,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACb,+IAA+I;QAC/I,8HAA8H;QAC9H,kGAAkG;QAClG,SAAS,CAAC,UAAU,EAAE,CAAC;QAEvB,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/B,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEJ,OAAO,SAAS,CAAC;AAClB,CAAC;AAlGD,kDAkGC;AAED,2CAA2C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ILoader, LoaderHeader } from \"@fluidframework/container-definitions/internal\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { GenericError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { IErrorBase } from \"@fluidframework/core-interfaces\";\n\n/* eslint-disable jsdoc/check-indentation */\n\n/**\n * Loads container and leaves it in a state where it does not process any ops.\n * Container instance returned by this function is in special mode where some functionality that is available in normal use will not work correctly\n * with instance of container returned by this function. Some examples:\n * 1. calling IContainer.connect() will have very little impact on this container as it will not process ops.\n * 2. functionality like waitContainerToCatchUp() or waiting for ops in any other way would hand infinitely, as this container is not processing ops\n * 3. No changes can be made to this container - they will be lost.\n *\n * If sequence number is provided, loads up to this sequence number and stops there, otherwise stops immediately after loading snapshot.\n * In all cases, container is returned disconnected & paused, or an exception is thrown\n * Notes:\n * 1. Ignores LoaderHeader.loadMode headers. Container is always returned with ops applied upt to provided sequence number,\n * or no ops applied at all (if sequence number is not provided)\n * 2. This call can hang infinitately if disconnected from internet (or hit some other conditions, like 429 storm).\n * Compare to Container.load() experience (with default settings) - it either returns failure right away, or succeeds, with\n * ops fetching / delta connection happening in parallel / after container load flow, and thus providing an object (Container instance) to observe\n * network connectivity issues / ability to cancel (IContainer.disconnect) or close container (IContainer.close)\n * This flow needs to fetch ops (potentially connecting to delta connection), and any retriable errors on this path result in infinite retry.\n * If you need to cancel that process, consider supplying AbortSignal parameter.\n * @param loader - loader instance to use to load container\n * @param request - request identifying container instance / load parameters. LoaderHeader.loadMode headers are ignored (see above)\n * @param loadToSequenceNumber - optional sequence number. If provided, ops are processed up to this sequence number.\n * @param signal - optional abort signal that can be used to cancel waiting for the ops.\n * @returns IContainer instance\n *\n * @internal\n */\nexport async function loadContainerPaused(\n\tloader: ILoader,\n\trequest: IRequest,\n\tloadToSequenceNumber?: number,\n\tsignal?: AbortSignal,\n) {\n\tconst container = await loader.resolve({\n\t\turl: request.url,\n\t\theaders: {\n\t\t\t...request.headers,\n\t\t\t// ensure we do not process any ops, such that we can examine container before ops starts to flow.\n\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: undefined, deltaConnection: \"none\" },\n\t\t},\n\t});\n\n\t// Force readonly mode - this will ensure we don't receive an error for the lack of join op\n\tcontainer.forceReadonly?.(true);\n\n\tconst dm = container.deltaManager;\n\tconst lastProcessedSequenceNumber = dm.initialSequenceNumber;\n\n\tconst pauseContainer = () => {\n\t\tvoid dm.inbound.pause();\n\t\tvoid dm.outbound.pause();\n\t};\n\n\t// Happy path - we are already there.\n\tif (\n\t\tloadToSequenceNumber === undefined ||\n\t\tlastProcessedSequenceNumber === loadToSequenceNumber\n\t) {\n\t\t// If we have already reached the desired sequence number, call pauseContainer() to pause immediately.\n\t\tpauseContainer();\n\t\treturn container;\n\t}\n\n\t// If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.\n\tif (lastProcessedSequenceNumber > loadToSequenceNumber) {\n\t\tconst error = new GenericError(\n\t\t\t\"Cannot satisfy request to pause the container at the specified sequence number. Most recent snapshot is newer than the specified sequence number.\",\n\t\t);\n\t\tcontainer.close(error);\n\t\tthrow error;\n\t}\n\n\tlet opHandler: () => void;\n\tlet onAbort: () => void;\n\tlet onClose: (error?: IErrorBase) => void;\n\n\tconst promise = new Promise<void>((resolve, rejectArg) => {\n\t\tonAbort = () => rejectArg(new GenericError(\"Canceled due to cancellation request.\"));\n\t\tonClose = (error?: IErrorBase) => rejectArg(error);\n\n\t\t// We need to setup a listener to stop op processing once we reach the desired sequence number (if specified).\n\t\topHandler = () => {\n\t\t\t// If there is a specified sequence number, keep processing until we reach it.\n\t\t\tif (\n\t\t\t\tloadToSequenceNumber !== undefined &&\n\t\t\t\tdm.lastSequenceNumber >= loadToSequenceNumber\n\t\t\t) {\n\t\t\t\t// Pause op processing once we have processed the desired number of ops.\n\t\t\t\tpauseContainer();\n\t\t\t\tresolve();\n\t\t\t}\n\t\t};\n\n\t\t// If we have not yet reached the desired sequence number, setup a listener to pause once we reach it.\n\t\tsignal?.addEventListener(\"abort\", onAbort);\n\t\tcontainer.on(\"op\", opHandler);\n\t\tcontainer.on(\"closed\", onClose);\n\t});\n\n\t// There are no guarantees on when ops will land in storage.\n\t// No guarantees that driver implements ops caching (i.e. ops observed in previous session can be served from cache)\n\t// or that browser will provide caching capabilities / keep the data (localStorage).\n\t// Thus, we have to ensure we connect to delta storage in order to make forward progress with ops.\n\t// We also instructed not to fetch / apply any ops from storage above (to be able to install callback above before ops are processed),\n\t// connect() call will fetch ops as needed.\n\tcontainer.connect();\n\n\t// Wait for the ops to be processed.\n\tawait promise\n\t\t.catch((error) => {\n\t\t\tcontainer.close(error);\n\t\t\tthrow error;\n\t\t})\n\t\t.finally(() => {\n\t\t\t// There is not much value in leaving delta connection on. We are not processing ops, we also can't advance to \"connected\" state because of it.\n\t\t\t// We are not sending ops (due to forceReadonly() call above). We are holding collab window and any consensus-based processes.\n\t\t\t// It's better not to have connection in such case, as there are only nagatives, and no positives.\n\t\t\tcontainer.disconnect();\n\n\t\t\tcontainer.off(\"op\", opHandler);\n\t\t\tcontainer.off(\"closed\", onClose);\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t});\n\n\treturn container;\n}\n\n/* eslint-enable jsdoc/check-indentation */\n"]}
package/dist/loader.d.ts CHANGED
@@ -6,7 +6,7 @@ import { IContainer, IFluidCodeDetails, IFluidModule, IHostLoader, ILoader, ILoa
6
6
  import { FluidObject, IConfigProviderBase, IRequest, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
7
  import { IDocumentServiceFactory, IDocumentStorageService, IUrlResolver } from "@fluidframework/driver-definitions/internal";
8
8
  import { IClientDetails } from "@fluidframework/protocol-definitions";
9
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
9
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
10
10
  import { Container } from "./container.js";
11
11
  import { ProtocolHandlerBuilder } from "./protocol.js";
12
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,OAAO,EACP,cAAc,IAAI,eAAe,EACjC,gCAAgC,EAEhC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EAEvB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,mB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CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CACzD;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,uBAAuB,EAAE,YAAY,GAAG,UAAU,CAAC,GAAG;IAC7F,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,IAAI,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,qBAAa,MAAO,YAAW,WAAW;IACzC,SAAgB,QAAQ,EAAE,eAAe,CAAC;IAC1C,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;gBAE3B,WAAW,EAAE,YAAY;IA2CxB,uBAAuB,CACnC,WAAW,EAAE,iBAAiB,EAC9B,mBAAmB,CAAC,EAAE;QACrB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,qBAAqB,CAAC,EAAE,cAAc,CAAC;KACvC,GACC,OAAO,CAAC,UAAU,CAAC;IAUT,sCAAsC,CAClD,QAAQ,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE;QACrB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,qBAAqB,CAAC,EAAE,cAAc,CAAC;KACvC,GACC,OAAO,CAAC,UAAU,CAAC;IAUT,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;YAU1E,WAAW;YAgCX,aAAa;CAmB3B"}
package/dist/loader.js CHANGED
@@ -89,7 +89,7 @@ class Loader {
89
89
  async resolve(request, pendingLocalState) {
90
90
  const eventName = pendingLocalState === undefined ? "Resolve" : "ResolveWithPendingState";
91
91
  return internal_2.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {
92
- return this.resolveCore(request, pendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined);
92
+ return this.resolveCore(request, (0, utils_js_1.getAttachedContainerStateFromSerializedContainer)(pendingLocalState));
93
93
  });
94
94
  }
95
95
  async resolveCore(request, pendingLocalState) {
@@ -112,18 +112,6 @@ class Loader {
112
112
  // If set in both query string and headers, use query string. Also write the value from the query string into the header either way.
113
113
  request.headers[internal_1.LoaderHeader.version] =
114
114
  parsed.version ?? request.headers[internal_1.LoaderHeader.version];
115
- const fromSequenceNumber = request.headers[internal_1.LoaderHeader.sequenceNumber];
116
- const opsBeforeReturn = request.headers[internal_1.LoaderHeader.loadMode]?.opsBeforeReturn;
117
- if (opsBeforeReturn === "sequenceNumber" &&
118
- (fromSequenceNumber === undefined || fromSequenceNumber < 0)) {
119
- // If opsBeforeReturn is set to "sequenceNumber", then fromSequenceNumber should be set to a non-negative integer.
120
- throw new internal_2.UsageError("sequenceNumber must be set to a non-negative integer");
121
- }
122
- else if (opsBeforeReturn !== "sequenceNumber" && fromSequenceNumber !== undefined) {
123
- // If opsBeforeReturn is not set to "sequenceNumber", then fromSequenceNumber should be undefined (default value).
124
- // In this case, we should throw an error since opsBeforeReturn is not explicitly set to "sequenceNumber".
125
- throw new internal_2.UsageError('opsBeforeReturn must be set to "sequenceNumber"');
126
- }
127
115
  return this.loadContainer(request, resolvedAsFluid, pendingLocalState);
128
116
  }
129
117
  async loadContainer(request, resolvedUrl, pendingLocalState) {
@@ -132,7 +120,6 @@ class Loader {
132
120
  version: request.headers?.[internal_1.LoaderHeader.version] ?? undefined,
133
121
  loadMode: request.headers?.[internal_1.LoaderHeader.loadMode],
134
122
  pendingLocalState,
135
- loadToSequenceNumber: request.headers?.[internal_1.LoaderHeader.sequenceNumber],
136
123
  }, {
137
124
  canReconnect: request.headers?.[internal_1.LoaderHeader.reconnect],
138
125
  clientDetailsOverride: request.headers?.[internal_1.L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AAS,CAAC,IAAI,CACpB;YACC,WAAW;YACX,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,OAAO,CAAC,IAAI,SAAS;YAC7D,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,QAAQ,CAAC;YAClD,iBAAiB;YACjB,oBAAoB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,cAAc,CAAC;SACpE,EACD;YACC,YAAY,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,SAAS,CAAC;YACvD,qBAAqB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,aAAa,CAAC;YACpE,GAAG,IAAI,CAAC,QAAQ;SAChB,CACD,CAAC;IACH,CAAC;CACD;AA/JD,wBA+JC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIContainer,\n\tIFluidCodeDetails,\n\tIFluidModule,\n\tIHostLoader,\n\tILoader,\n\tILoaderOptions as ILoaderOptions1,\n\tIProvideFluidCodeDetailsComparer,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tFluidObject,\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { IClientDetails } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tMonitoringContext,\n\tPerformanceEvent,\n\tUsageError,\n\tcreateChildMonitoringContext,\n\tmixinMonitoringContext,\n\tsessionStorageConfigProvider,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { Container } from \"./container.js\";\nimport { DebugLogger } from \"./debugLogger.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport { ProtocolHandlerBuilder } from \"./protocol.js\";\nimport type { IPendingContainerState } from \"./serializedStateManager.js\";\nimport { tryParseCompatibleResolvedUrl } from \"./utils.js\";\n\nfunction ensureResolvedUrlDefined(\n\tresolved: IResolvedUrl | undefined,\n): asserts resolved is IResolvedUrl {\n\tif (resolved === undefined) {\n\t\tthrow new Error(`Object is not a IResolveUrl.`);\n\t}\n}\n/**\n * @internal\n */\nexport class RelativeLoader implements ILoader {\n\tconstructor(\n\t\tprivate readonly container: Container,\n\t\tprivate readonly loader: ILoader | undefined,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IContainer> {\n\t\tif (request.url.startsWith(\"/\")) {\n\t\t\tensureResolvedUrlDefined(this.container.resolvedUrl);\n\t\t\tconst container = await this.container.clone(\n\t\t\t\t{\n\t\t\t\t\tresolvedUrl: { ...this.container.resolvedUrl },\n\t\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn container;\n\t\t}\n\n\t\tif (this.loader === undefined) {\n\t\t\tthrow new Error(\"Cannot resolve external containers\");\n\t\t}\n\t\treturn this.loader.resolve(request);\n\t}\n}\n\n/**\n * @alpha\n */\nexport interface ILoaderOptions extends ILoaderOptions1 {\n\tsummarizeProtocolTree?: boolean;\n}\n\n/**\n * @deprecated IFluidModuleWithDetails interface is moved to\n * {@link @fluidframework/container-definitions#IFluidModuleWithDetails}\n * to have all the code loading modules in one package. #8193\n * Encapsulates a module entry point with corresponding code details.\n * @alpha\n */\nexport interface IFluidModuleWithDetails {\n\t/** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */\n\tmodule: IFluidModule;\n\t/**\n\t * Code details associated with the module. Represents a document schema this module supports.\n\t * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,\n\t * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.\n\t */\n\tdetails: IFluidCodeDetails;\n}\n\n/**\n * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definitions#ICodeDetailsLoader}\n * to have code loading modules in one package. #8193\n * Fluid code loader resolves a code module matching the document schema, i.e. code details, such as\n * a package name and package version range.\n * @alpha\n */\nexport interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {\n\t/**\n\t * Load the code module (package) that is capable to interact with the document.\n\t *\n\t * @param source - Code proposal that articulates the current schema the document is written in.\n\t * @returns Code module entry point along with the code details associated with it.\n\t */\n\tload(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;\n}\n\n/**\n * Services and properties necessary for creating a loader\n * @alpha\n */\nexport interface ILoaderProps {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options used by various layers\n\t * to control features\n\t */\n\treadonly options?: ILoaderOptions;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope?: FluidObject;\n\n\t/**\n\t * The logger that all telemetry should be pushed to.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\n\n\t/**\n\t * The configuration provider which may be used to control features.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Services and properties used by and exposed by the loader\n * @alpha\n */\nexport interface ILoaderServices {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options used by various layers\n\t * to control features\n\t */\n\treadonly options: ILoaderOptions;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope: FluidObject;\n\n\t/**\n\t * The logger downstream consumers should construct their loggers from\n\t */\n\treadonly subLogger: ITelemetryLoggerExt;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support\n * blobs in detached containers.\n * @alpha\n */\nexport type IDetachedBlobStorage = Pick<IDocumentStorageService, \"createBlob\" | \"readBlob\"> & {\n\tsize: number;\n\t/**\n\t * Return an array of all blob IDs present in storage\n\t */\n\tgetBlobIds(): string[];\n};\n\n/**\n * Manages Fluid resource loading\n * @alpha\n */\nexport class Loader implements IHostLoader {\n\tpublic readonly services: ILoaderServices;\n\tprivate readonly mc: MonitoringContext;\n\n\tconstructor(loaderProps: ILoaderProps) {\n\t\tconst {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions,\n\t\t\tscope,\n\t\t\tlogger,\n\t\t\tdetachedBlobStorage,\n\t\t\tconfigProvider,\n\t\t\tprotocolHandlerBuilder,\n\t\t} = loaderProps;\n\n\t\tconst telemetryProps = {\n\t\t\tloaderId: uuid(),\n\t\t\tloaderVersion: pkgVersion,\n\t\t};\n\n\t\tconst subMc = mixinMonitoringContext(\n\t\t\tDebugLogger.mixinDebugLogger(\"fluid:telemetry\", logger, {\n\t\t\t\tall: telemetryProps,\n\t\t\t}),\n\t\t\tsessionStorageConfigProvider.value,\n\t\t\tconfigProvider,\n\t\t);\n\n\t\tthis.services = {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions: options ?? {},\n\t\t\tscope:\n\t\t\t\toptions?.provideScopeLoader !== false ? { ...scope, ILoader: this } : { ...scope },\n\t\t\tdetachedBlobStorage,\n\t\t\tprotocolHandlerBuilder,\n\t\t\tsubLogger: subMc.logger,\n\t\t};\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.services.subLogger,\n\t\t\tnamespace: \"Loader\",\n\t\t});\n\t}\n\n\tpublic async createDetachedContainer(\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.createDetached(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tcodeDetails,\n\t\t);\n\t}\n\n\tpublic async rehydrateDetachedContainerFromSnapshot(\n\t\tsnapshot: string,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.rehydrateDetachedFromSnapshot(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tsnapshot,\n\t\t);\n\t}\n\n\tpublic async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {\n\t\tconst eventName = pendingLocalState === undefined ? \"Resolve\" : \"ResolveWithPendingState\";\n\t\treturn PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {\n\t\t\treturn this.resolveCore(\n\t\t\t\trequest,\n\t\t\t\tpendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate async resolveCore(\n\t\trequest: IRequest,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\tconst resolvedAsFluid = await this.services.urlResolver.resolve(request);\n\t\tensureResolvedUrlDefined(resolvedAsFluid);\n\n\t\t// Parse URL into data stores\n\t\tconst parsed = tryParseCompatibleResolvedUrl(resolvedAsFluid.url);\n\t\tif (parsed === undefined) {\n\t\t\tthrow new Error(`Invalid URL ${resolvedAsFluid.url}`);\n\t\t}\n\n\t\tif (pendingLocalState !== undefined) {\n\t\t\tconst parsedPendingUrl = tryParseCompatibleResolvedUrl(pendingLocalState.url);\n\t\t\tif (\n\t\t\t\tparsedPendingUrl?.id !== parsed.id ||\n\t\t\t\tparsedPendingUrl?.path.replace(/\\/$/, \"\") !== parsed.path.replace(/\\/$/, \"\")\n\t\t\t) {\n\t\t\t\tconst message = `URL ${resolvedAsFluid.url} does not match pending state URL ${pendingLocalState.url}`;\n\t\t\t\tthrow new Error(message);\n\t\t\t}\n\t\t}\n\n\t\trequest.headers ??= {};\n\t\t// If set in both query string and headers, use query string. Also write the value from the query string into the header either way.\n\t\trequest.headers[LoaderHeader.version] =\n\t\t\tparsed.version ?? request.headers[LoaderHeader.version];\n\t\tconst fromSequenceNumber = request.headers[LoaderHeader.sequenceNumber] as\n\t\t\t| number\n\t\t\t| undefined;\n\t\tconst opsBeforeReturn = request.headers[LoaderHeader.loadMode]?.opsBeforeReturn as\n\t\t\t| string\n\t\t\t| undefined;\n\n\t\tif (\n\t\t\topsBeforeReturn === \"sequenceNumber\" &&\n\t\t\t(fromSequenceNumber === undefined || fromSequenceNumber < 0)\n\t\t) {\n\t\t\t// If opsBeforeReturn is set to \"sequenceNumber\", then fromSequenceNumber should be set to a non-negative integer.\n\t\t\tthrow new UsageError(\"sequenceNumber must be set to a non-negative integer\");\n\t\t} else if (opsBeforeReturn !== \"sequenceNumber\" && fromSequenceNumber !== undefined) {\n\t\t\t// If opsBeforeReturn is not set to \"sequenceNumber\", then fromSequenceNumber should be undefined (default value).\n\t\t\t// In this case, we should throw an error since opsBeforeReturn is not explicitly set to \"sequenceNumber\".\n\t\t\tthrow new UsageError('opsBeforeReturn must be set to \"sequenceNumber\"');\n\t\t}\n\n\t\treturn this.loadContainer(request, resolvedAsFluid, pendingLocalState);\n\t}\n\n\tprivate async loadContainer(\n\t\trequest: IRequest,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\treturn Container.load(\n\t\t\t{\n\t\t\t\tresolvedUrl,\n\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\tpendingLocalState,\n\t\t\t\tloadToSequenceNumber: request.headers?.[LoaderHeader.sequenceNumber],\n\t\t\t},\n\t\t\t{\n\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EASwD;AAcxD,uEAOkD;AAClD,+BAAkC;AAElC,iDAA2C;AAC3C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,iBAAiB,CAAC,GAAG,EAAE,CAAC;gBACvG,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;aACzB;SACD;QAED,OAAO,CAAC,OAAO,KAAf,OAAO,CAAC,OAAO,GAAK,EAAE,EAAC;QACvB,qIAAqI;QACrI,OAAO,CAAC,OAAO,CAAC,uBAAY,CAAC,OAAO,CAAC;YACpC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,uBAAY,CAAC,OAAO,CAAC,CAAC;QAEzD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACxE,CAAC;IAEO,KAAK,CAAC,aAAa,CAC1B,OAAiB,EACjB,WAAyB,EACzB,iBAA0C;QAE1C,OAAO,wBAAS,CAAC,IAAI,CACpB;YACC,WAAW;YACX,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,OAAO,CAAC,IAAI,SAAS;YAC7D,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,QAAQ,CAAC;YAClD,iBAAiB;SACjB,EACD;YACC,YAAY,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,SAAS,CAAC;YACvD,qBAAqB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,aAAa,CAAC;YACpE,GAAG,IAAI,CAAC,QAAQ;SAChB,CACD,CAAC;IACH,CAAC;CACD;AA5ID,wBA4IC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIContainer,\n\tIFluidCodeDetails,\n\tIFluidModule,\n\tIHostLoader,\n\tILoader,\n\tILoaderOptions as ILoaderOptions1,\n\tIProvideFluidCodeDetailsComparer,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tFluidObject,\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { IClientDetails } from \"@fluidframework/protocol-definitions\";\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n\tmixinMonitoringContext,\n\tsessionStorageConfigProvider,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { Container } from \"./container.js\";\nimport { DebugLogger } from \"./debugLogger.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport { ProtocolHandlerBuilder } from \"./protocol.js\";\nimport type { IPendingContainerState } from \"./serializedStateManager.js\";\nimport {\n\tgetAttachedContainerStateFromSerializedContainer,\n\ttryParseCompatibleResolvedUrl,\n} from \"./utils.js\";\n\nfunction ensureResolvedUrlDefined(\n\tresolved: IResolvedUrl | undefined,\n): asserts resolved is IResolvedUrl {\n\tif (resolved === undefined) {\n\t\tthrow new Error(`Object is not a IResolveUrl.`);\n\t}\n}\n/**\n * @internal\n */\nexport class RelativeLoader implements ILoader {\n\tconstructor(\n\t\tprivate readonly container: Container,\n\t\tprivate readonly loader: ILoader | undefined,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IContainer> {\n\t\tif (request.url.startsWith(\"/\")) {\n\t\t\tensureResolvedUrlDefined(this.container.resolvedUrl);\n\t\t\tconst container = await this.container.clone(\n\t\t\t\t{\n\t\t\t\t\tresolvedUrl: { ...this.container.resolvedUrl },\n\t\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn container;\n\t\t}\n\n\t\tif (this.loader === undefined) {\n\t\t\tthrow new Error(\"Cannot resolve external containers\");\n\t\t}\n\t\treturn this.loader.resolve(request);\n\t}\n}\n\n/**\n * @alpha\n */\nexport interface ILoaderOptions extends ILoaderOptions1 {\n\tsummarizeProtocolTree?: boolean;\n}\n\n/**\n * @deprecated IFluidModuleWithDetails interface is moved to\n * {@link @fluidframework/container-definitions#IFluidModuleWithDetails}\n * to have all the code loading modules in one package. #8193\n * Encapsulates a module entry point with corresponding code details.\n * @alpha\n */\nexport interface IFluidModuleWithDetails {\n\t/** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */\n\tmodule: IFluidModule;\n\t/**\n\t * Code details associated with the module. Represents a document schema this module supports.\n\t * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,\n\t * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.\n\t */\n\tdetails: IFluidCodeDetails;\n}\n\n/**\n * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definitions#ICodeDetailsLoader}\n * to have code loading modules in one package. #8193\n * Fluid code loader resolves a code module matching the document schema, i.e. code details, such as\n * a package name and package version range.\n * @alpha\n */\nexport interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {\n\t/**\n\t * Load the code module (package) that is capable to interact with the document.\n\t *\n\t * @param source - Code proposal that articulates the current schema the document is written in.\n\t * @returns Code module entry point along with the code details associated with it.\n\t */\n\tload(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;\n}\n\n/**\n * Services and properties necessary for creating a loader\n * @alpha\n */\nexport interface ILoaderProps {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options used by various layers\n\t * to control features\n\t */\n\treadonly options?: ILoaderOptions;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope?: FluidObject;\n\n\t/**\n\t * The logger that all telemetry should be pushed to.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\n\n\t/**\n\t * The configuration provider which may be used to control features.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Services and properties used by and exposed by the loader\n * @alpha\n */\nexport interface ILoaderServices {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options used by various layers\n\t * to control features\n\t */\n\treadonly options: ILoaderOptions;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope: FluidObject;\n\n\t/**\n\t * The logger downstream consumers should construct their loggers from\n\t */\n\treadonly subLogger: ITelemetryLoggerExt;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support\n * blobs in detached containers.\n * @alpha\n */\nexport type IDetachedBlobStorage = Pick<IDocumentStorageService, \"createBlob\" | \"readBlob\"> & {\n\tsize: number;\n\t/**\n\t * Return an array of all blob IDs present in storage\n\t */\n\tgetBlobIds(): string[];\n};\n\n/**\n * Manages Fluid resource loading\n * @alpha\n */\nexport class Loader implements IHostLoader {\n\tpublic readonly services: ILoaderServices;\n\tprivate readonly mc: MonitoringContext;\n\n\tconstructor(loaderProps: ILoaderProps) {\n\t\tconst {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions,\n\t\t\tscope,\n\t\t\tlogger,\n\t\t\tdetachedBlobStorage,\n\t\t\tconfigProvider,\n\t\t\tprotocolHandlerBuilder,\n\t\t} = loaderProps;\n\n\t\tconst telemetryProps = {\n\t\t\tloaderId: uuid(),\n\t\t\tloaderVersion: pkgVersion,\n\t\t};\n\n\t\tconst subMc = mixinMonitoringContext(\n\t\t\tDebugLogger.mixinDebugLogger(\"fluid:telemetry\", logger, {\n\t\t\t\tall: telemetryProps,\n\t\t\t}),\n\t\t\tsessionStorageConfigProvider.value,\n\t\t\tconfigProvider,\n\t\t);\n\n\t\tthis.services = {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions: options ?? {},\n\t\t\tscope:\n\t\t\t\toptions?.provideScopeLoader !== false ? { ...scope, ILoader: this } : { ...scope },\n\t\t\tdetachedBlobStorage,\n\t\t\tprotocolHandlerBuilder,\n\t\t\tsubLogger: subMc.logger,\n\t\t};\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.services.subLogger,\n\t\t\tnamespace: \"Loader\",\n\t\t});\n\t}\n\n\tpublic async createDetachedContainer(\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.createDetached(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tcodeDetails,\n\t\t);\n\t}\n\n\tpublic async rehydrateDetachedContainerFromSnapshot(\n\t\tsnapshot: string,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.rehydrateDetachedFromSnapshot(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tsnapshot,\n\t\t);\n\t}\n\n\tpublic async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {\n\t\tconst eventName = pendingLocalState === undefined ? \"Resolve\" : \"ResolveWithPendingState\";\n\t\treturn PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {\n\t\t\treturn this.resolveCore(\n\t\t\t\trequest,\n\t\t\t\tgetAttachedContainerStateFromSerializedContainer(pendingLocalState),\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate async resolveCore(\n\t\trequest: IRequest,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\tconst resolvedAsFluid = await this.services.urlResolver.resolve(request);\n\t\tensureResolvedUrlDefined(resolvedAsFluid);\n\n\t\t// Parse URL into data stores\n\t\tconst parsed = tryParseCompatibleResolvedUrl(resolvedAsFluid.url);\n\t\tif (parsed === undefined) {\n\t\t\tthrow new Error(`Invalid URL ${resolvedAsFluid.url}`);\n\t\t}\n\n\t\tif (pendingLocalState !== undefined) {\n\t\t\tconst parsedPendingUrl = tryParseCompatibleResolvedUrl(pendingLocalState.url);\n\t\t\tif (\n\t\t\t\tparsedPendingUrl?.id !== parsed.id ||\n\t\t\t\tparsedPendingUrl?.path.replace(/\\/$/, \"\") !== parsed.path.replace(/\\/$/, \"\")\n\t\t\t) {\n\t\t\t\tconst message = `URL ${resolvedAsFluid.url} does not match pending state URL ${pendingLocalState.url}`;\n\t\t\t\tthrow new Error(message);\n\t\t\t}\n\t\t}\n\n\t\trequest.headers ??= {};\n\t\t// If set in both query string and headers, use query string. Also write the value from the query string into the header either way.\n\t\trequest.headers[LoaderHeader.version] =\n\t\t\tparsed.version ?? request.headers[LoaderHeader.version];\n\n\t\treturn this.loadContainer(request, resolvedAsFluid, pendingLocalState);\n\t}\n\n\tprivate async loadContainer(\n\t\trequest: IRequest,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\treturn Container.load(\n\t\t\t{\n\t\t\t\tresolvedUrl,\n\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\tpendingLocalState,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveWithLocationRedirection.d.ts","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EACN,yBAAyB,EACzB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAGrD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,yBAAyB,CAMzF;AAED;;;;;;;;GAQG;AACH,wBAAsB,sCAAsC,CAAC,CAAC,EAC7D,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,OAAO,EAAE,QAAQ,EACjB,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAmBZ"}
1
+ {"version":3,"file":"resolveWithLocationRedirection.d.ts","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EACN,yBAAyB,EACzB,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAGrD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,yBAAyB,CAMzF;AAED;;;;;;;;GAQG;AACH,wBAAsB,sCAAsC,CAAC,CAAC,EAC7D,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,OAAO,EAAE,QAAQ,EACjB,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAmBZ"}
@@ -5,8 +5,8 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.resolveWithLocationRedirectionHandling = exports.isLocationRedirectionError = void 0;
8
- const driver_definitions_1 = require("@fluidframework/driver-definitions");
9
- const internal_1 = require("@fluidframework/telemetry-utils/internal");
8
+ const internal_1 = require("@fluidframework/driver-definitions/internal");
9
+ const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  /**
11
11
  * Checks if the error is location redirection error.
12
12
  * @param error - error whose type is to be determined.
@@ -16,7 +16,7 @@ const internal_1 = require("@fluidframework/telemetry-utils/internal");
16
16
  function isLocationRedirectionError(error) {
17
17
  return (typeof error === "object" &&
18
18
  error !== null &&
19
- error.errorType === driver_definitions_1.DriverErrorTypes.locationRedirection);
19
+ error.errorType === internal_1.DriverErrorTypes.locationRedirection);
20
20
  }
21
21
  exports.isLocationRedirectionError = isLocationRedirectionError;
22
22
  /**
@@ -30,7 +30,7 @@ exports.isLocationRedirectionError = isLocationRedirectionError;
30
30
  */
31
31
  async function resolveWithLocationRedirectionHandling(api, request, urlResolver, logger) {
32
32
  let req = request;
33
- const childLogger = (0, internal_1.createChildLogger)({ logger, namespace: "LocationRedirection" });
33
+ const childLogger = (0, internal_2.createChildLogger)({ logger, namespace: "LocationRedirection" });
34
34
  for (;;) {
35
35
  try {
36
36
  return await api(req);
@@ -1 +1 @@
1
- {"version":3,"file":"resolveWithLocationRedirection.js","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAAsE;AAKtE,uEAA6E;AAE7E;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,KAAU;IACpD,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,CAAC,SAAS,KAAK,qCAAgB,CAAC,mBAAmB,CACxD,CAAC;AACH,CAAC;AAND,gEAMC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,sCAAsC,CAC3D,GAAsC,EACtC,OAAiB,EACjB,WAAyB,EACzB,MAA6B;IAE7B,IAAI,GAAG,GAAa,OAAO,CAAC;IAC5B,MAAM,WAAW,GAAG,IAAA,4BAAiB,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACpF,SAAS;QACR,IAAI;YACH,OAAO,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;SACtB;QAAC,OAAO,KAAU,EAAE;YACpB,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE;gBACvC,MAAM,KAAK,CAAC;aACZ;YACD,WAAW,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,CAAC;YAC1E,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;YACtC,yGAAyG;YACzG,kGAAkG;YAClG,oCAAoC;YACpC,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;YACjF,GAAG,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;SACjD;KACD;AACF,CAAC;AAxBD,wFAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions\";\nimport {\n\tILocationRedirectionError,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Checks if the error is location redirection error.\n * @param error - error whose type is to be determined.\n * @returns `true` is the error is location redirection error, otherwise `false`.\n * @internal\n */\nexport function isLocationRedirectionError(error: any): error is ILocationRedirectionError {\n\treturn (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\terror.errorType === DriverErrorTypes.locationRedirection\n\t);\n}\n\n/**\n * Handles location redirection while fulfilling the loader request.\n * @param api - Callback in which user can wrap the loader.resolve or loader.request call.\n * @param request - request to be resolved.\n * @param urlResolver - resolver used to resolve the url.\n * @param logger - logger to send events.\n * @returns Response from the API call.\n * @alpha\n */\nexport async function resolveWithLocationRedirectionHandling<T>(\n\tapi: (request: IRequest) => Promise<T>,\n\trequest: IRequest,\n\turlResolver: IUrlResolver,\n\tlogger?: ITelemetryBaseLogger,\n): Promise<T> {\n\tlet req: IRequest = request;\n\tconst childLogger = createChildLogger({ logger, namespace: \"LocationRedirection\" });\n\tfor (;;) {\n\t\ttry {\n\t\t\treturn await api(req);\n\t\t} catch (error: any) {\n\t\t\tif (!isLocationRedirectionError(error)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tchildLogger.sendTelemetryEvent({ eventName: \"LocationRedirectionError\" });\n\t\t\tconst resolvedUrl = error.redirectUrl;\n\t\t\t// Generate the new request with new location details from the resolved url. For datastore/relative path,\n\t\t\t// we don't need to pass \"/\" as host could have asked for a specific data store. So driver need to\n\t\t\t// extract it from the resolved url.\n\t\t\tconst absoluteUrl = await urlResolver.getAbsoluteUrl(resolvedUrl, \"\", undefined);\n\t\t\treq = { url: absoluteUrl, headers: req.headers };\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"resolveWithLocationRedirection.js","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAIqD;AACrD,uEAA6E;AAE7E;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,KAAU;IACpD,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,CAAC,SAAS,KAAK,2BAAgB,CAAC,mBAAmB,CACxD,CAAC;AACH,CAAC;AAND,gEAMC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,sCAAsC,CAC3D,GAAsC,EACtC,OAAiB,EACjB,WAAyB,EACzB,MAA6B;IAE7B,IAAI,GAAG,GAAa,OAAO,CAAC;IAC5B,MAAM,WAAW,GAAG,IAAA,4BAAiB,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACpF,SAAS;QACR,IAAI;YACH,OAAO,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;SACtB;QAAC,OAAO,KAAU,EAAE;YACpB,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE;gBACvC,MAAM,KAAK,CAAC;aACZ;YACD,WAAW,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,CAAC;YAC1E,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;YACtC,yGAAyG;YACzG,kGAAkG;YAClG,oCAAoC;YACpC,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;YACjF,GAAG,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;SACjD;KACD;AACF,CAAC;AAxBD,wFAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\tILocationRedirectionError,\n\tIUrlResolver,\n\tDriverErrorTypes,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Checks if the error is location redirection error.\n * @param error - error whose type is to be determined.\n * @returns `true` is the error is location redirection error, otherwise `false`.\n * @internal\n */\nexport function isLocationRedirectionError(error: any): error is ILocationRedirectionError {\n\treturn (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\terror.errorType === DriverErrorTypes.locationRedirection\n\t);\n}\n\n/**\n * Handles location redirection while fulfilling the loader request.\n * @param api - Callback in which user can wrap the loader.resolve or loader.request call.\n * @param request - request to be resolved.\n * @param urlResolver - resolver used to resolve the url.\n * @param logger - logger to send events.\n * @returns Response from the API call.\n * @alpha\n */\nexport async function resolveWithLocationRedirectionHandling<T>(\n\tapi: (request: IRequest) => Promise<T>,\n\trequest: IRequest,\n\turlResolver: IUrlResolver,\n\tlogger?: ITelemetryBaseLogger,\n): Promise<T> {\n\tlet req: IRequest = request;\n\tconst childLogger = createChildLogger({ logger, namespace: \"LocationRedirection\" });\n\tfor (;;) {\n\t\ttry {\n\t\t\treturn await api(req);\n\t\t} catch (error: any) {\n\t\t\tif (!isLocationRedirectionError(error)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tchildLogger.sendTelemetryEvent({ eventName: \"LocationRedirectionError\" });\n\t\t\tconst resolvedUrl = error.redirectUrl;\n\t\t\t// Generate the new request with new location details from the resolved url. For datastore/relative path,\n\t\t\t// we don't need to pass \"/\" as host could have asked for a specific data store. So driver need to\n\t\t\t// extract it from the resolved url.\n\t\t\tconst absoluteUrl = await urlResolver.getAbsoluteUrl(resolvedUrl, \"\", undefined);\n\t\t\treq = { url: absoluteUrl, headers: req.headers };\n\t\t}\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/container-loader";
8
- export declare const pkgVersion = "2.0.0-rc.3.0.3";
8
+ export declare const pkgVersion = "2.0.0-rc.4.0.1";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/container-loader";
11
- exports.pkgVersion = "2.0.0-rc.3.0.3";
11
+ exports.pkgVersion = "2.0.0-rc.4.0.1";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-loader\";\nexport const pkgVersion = \"2.0.0-rc.3.0.3\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-loader\";\nexport const pkgVersion = \"2.0.0-rc.4.0.1\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,EACN,gBAAgB,IAAI,oBAAoB,EACxC,eAAe,EACf,iBAAiB,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EAEzB,cAAc,EAEd,MAAM,sCAAsC,CAAC;AAG9C,oBAAY,UAAU;IACrB,UAAU,SAAS;IACnB,WAAW,UAAU;IACrB,KAAK,UAAU;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,CACpC,UAAU,EAAE,mBAAmB,EAC/B,QAAQ,EAAE,eAAe,EACzB,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,MAAM,KAC7C,gBAAgB,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC7D,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,aAAa,CAAC,OAAO,EAAE,cAAc,OAAE;CACvC;AAED,qBAAa,eAAgB,SAAQ,iBAAkB,YAAW,gBAAgB;aAKhE,QAAQ,EAAE,cAAc;IACxC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;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Ac;IACxC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAJrC,UAAU,EAAE,mBAAmB,EAC/B,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,MAAM,EACjC,QAAQ,EAAE,cAAc,EACvB,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO;IAyB9D,cAAc,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,GACZ,qBAAqB;IAuBjB,aAAa,CAAC,OAAO,EAAE,cAAc;CAgC5C;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,cAAc,WAWzE"}
package/dist/protocol.js CHANGED
@@ -20,6 +20,9 @@ class ProtocolHandler extends protocol_base_1.ProtocolOpHandler {
20
20
  super(attributes.minimumSequenceNumber, attributes.sequenceNumber, quorumSnapshot.members, quorumSnapshot.proposals, quorumSnapshot.values, sendProposal);
21
21
  this.audience = audience;
22
22
  this.shouldClientHaveLeft = shouldClientHaveLeft;
23
+ for (const [clientId, member] of this.quorum.getMembers()) {
24
+ audience.addMember(clientId, member.client);
25
+ }
23
26
  // Join / leave signals are ignored for "write" clients in favor of join / leave ops
24
27
  this.quorum.on("addMember", (clientId, details) => audience.addMember(clientId, details.client));
25
28
  this.quorum.on("removeMember", (clientId) => audience.removeMember(clientId));
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,oEAAgF;AAChF,iEAIuC;AACvC,+EAO8C;AAE9C,mDAAmD;AACnD,IAAY,UAIX;AAJD,WAAY,UAAU;IACrB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AAChB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAoBD,MAAa,eAAgB,SAAQ,iCAAiB;IACrD,YACC,UAA+B,EA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YAAY,CAAC,YAAY,CAAC,CAAC;iBACzC;gBACD,MAAM;aACN;YACD;gBACC,MAAM;SACP;IACF,CAAC;CACD;AArFD,0CAqFC;AAED;;;;GAIG;AACH,SAAgB,kCAAkC,CAAC,OAAuB;IACzE,gCAAgC;IAChC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE;QAC9B,MAAM,YAAY,GAAG,OAAO,CAAC,OAA6C,CAAC;QAC3E,OAAO,CACN,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,KAAK;YACtC,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,UAAU;YAC3C,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,CAC5C,CAAC;KACF;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAXD,gFAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IAudienceOwner } from \"@fluidframework/container-definitions/internal\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIProtocolHandler as IBaseProtocolHandler,\n\tIQuorumSnapshot,\n\tProtocolOpHandler,\n} from \"@fluidframework/protocol-base\";\nimport {\n\tIDocumentAttributes,\n\tIProcessMessageResult,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n// ADO: #1986: Start using enum from protocol-base.\nexport enum SignalType {\n\tClientJoin = \"join\", // same value as MessageType.ClientJoin,\n\tClientLeave = \"leave\", // same value as MessageType.ClientLeave,\n\tClear = \"clear\", // used only by client for synthetic signals\n}\n\n/**\n * Function to be used for creating a protocol handler.\n * @alpha\n */\nexport type ProtocolHandlerBuilder = (\n\tattributes: IDocumentAttributes,\n\tsnapshot: IQuorumSnapshot,\n\tsendProposal: (key: string, value: any) => number,\n) => IProtocolHandler;\n\n/**\n * @alpha\n */\nexport interface IProtocolHandler extends IBaseProtocolHandler {\n\treadonly audience: IAudienceOwner;\n\tprocessSignal(message: ISignalMessage);\n}\n\nexport class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandler {\n\tconstructor(\n\t\tattributes: IDocumentAttributes,\n\t\tquorumSnapshot: IQuorumSnapshot,\n\t\tsendProposal: (key: string, value: any) => number,\n\t\tpublic readonly audience: IAudienceOwner,\n\t\tprivate readonly shouldClientHaveLeft: (clientId: string) => boolean,\n\t) {\n\t\tsuper(\n\t\t\tattributes.minimumSequenceNumber,\n\t\t\tattributes.sequenceNumber,\n\t\t\tquorumSnapshot.members,\n\t\t\tquorumSnapshot.proposals,\n\t\t\tquorumSnapshot.values,\n\t\t\tsendProposal,\n\t\t);\n\n\t\t// Join / leave signals are ignored for \"write\" clients in favor of join / leave ops\n\t\tthis.quorum.on(\"addMember\", (clientId, details) =>\n\t\t\taudience.addMember(clientId, details.client),\n\t\t);\n\t\tthis.quorum.on(\"removeMember\", (clientId) => audience.removeMember(clientId));\n\t\tfor (const [clientId, details] of this.quorum.getMembers()) {\n\t\t\tthis.audience.addMember(clientId, details.client);\n\t\t}\n\t}\n\n\tpublic processMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t): IProcessMessageResult {\n\t\t// Check and report if we're getting messages from a clientId that we previously\n\t\t// flagged as shouldHaveLeft, or from a client that's not in the quorum but should be\n\t\tif (message.clientId != null) {\n\t\t\tconst client = this.quorum.getMember(message.clientId);\n\n\t\t\tif (client === undefined && message.type !== MessageType.ClientJoin) {\n\t\t\t\t// pre-0.58 error message: messageClientIdMissingFromQuorum\n\t\t\t\tthrow new Error(\"Remote message's clientId is missing from the quorum\");\n\t\t\t}\n\n\t\t\t// Here checking canBeCoalescedByService is used as an approximation of \"is benign to process despite being unexpected\".\n\t\t\t// It's still not good to see these messages from unexpected clientIds, but since they don't harm the integrity of the\n\t\t\t// document we don't need to blow up aggressively.\n\t\t\tif (this.shouldClientHaveLeft(message.clientId) && !canBeCoalescedByService(message)) {\n\t\t\t\t// pre-0.58 error message: messageClientIdShouldHaveLeft\n\t\t\t\tthrow new Error(\"Remote message's clientId already should have left\");\n\t\t\t}\n\t\t}\n\n\t\treturn super.processMessage(message, local);\n\t}\n\n\tpublic processSignal(message: ISignalMessage) {\n\t\tconst innerContent = message.content as { content: any; type: string };\n\t\tswitch (innerContent.type) {\n\t\t\tcase SignalType.Clear: {\n\t\t\t\tconst members = this.audience.getMembers();\n\t\t\t\tfor (const [clientId, client] of members) {\n\t\t\t\t\tif (client.mode === \"read\") {\n\t\t\t\t\t\tthis.audience.removeMember(clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientJoin: {\n\t\t\t\tconst newClient = innerContent.content as ISignalClient;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (newClient.client.mode === \"read\") {\n\t\t\t\t\tthis.audience.addMember(newClient.clientId, newClient.client);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientLeave: {\n\t\t\t\tconst leftClientId = innerContent.content as string;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (this.audience.getMember(leftClientId)?.mode === \"read\") {\n\t\t\t\t\tthis.audience.removeMember(leftClientId);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/**\n * Function to check whether the protocol handler should process the Signal.\n * The protocol handler should strictly handle only ClientJoin, ClientLeave\n * and Clear signal types.\n */\nexport function protocolHandlerShouldProcessSignal(message: ISignalMessage) {\n\t// Signal originates from server\n\tif (message.clientId === null) {\n\t\tconst innerContent = message.content as { content: unknown; type: string };\n\t\treturn (\n\t\t\tinnerContent.type === SignalType.Clear ||\n\t\t\tinnerContent.type === SignalType.ClientJoin ||\n\t\t\tinnerContent.type === SignalType.ClientLeave\n\t\t);\n\t}\n\treturn false;\n}\n"]}
1
+ {"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C,UAAU,CAAC,CAAC;gBAC3B,MAAM,SAAS,GAAG,YAAY,CAAC,OAAwB,CAAC;gBACxD,2DAA2D;gBAC3D,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE;oBACrC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;iBAC9D;gBACD,MAAM;aACN;YACD,KAAK,UAAU,CAAC,WAAW,CAAC,CAAC;gBAC5B,MAAM,YAAY,GAAG,YAAY,CAAC,OAAiB,CAAC;gBACpD,2DAA2D;gBAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,KAAK,MAAM,EAAE;oBAC3D,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;iBACzC;gBACD,MAAM;aACN;YACD;gBACC,MAAM;SACP;IACF,CAAC;CACD;AAzFD,0CAyFC;AAED;;;;GAIG;AACH,SAAgB,kCAAkC,CAAC,OAAuB;IACzE,gCAAgC;IAChC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE;QAC9B,MAAM,YAAY,GAAG,OAAO,CAAC,OAA6C,CAAC;QAC3E,OAAO,CACN,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,KAAK;YACtC,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,UAAU;YAC3C,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,CAC5C,CAAC;KACF;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAXD,gFAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IAudienceOwner } from \"@fluidframework/container-definitions/internal\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIProtocolHandler as IBaseProtocolHandler,\n\tIQuorumSnapshot,\n\tProtocolOpHandler,\n} from \"@fluidframework/protocol-base\";\nimport {\n\tIDocumentAttributes,\n\tIProcessMessageResult,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n// ADO: #1986: Start using enum from protocol-base.\nexport enum SignalType {\n\tClientJoin = \"join\", // same value as MessageType.ClientJoin,\n\tClientLeave = \"leave\", // same value as MessageType.ClientLeave,\n\tClear = \"clear\", // used only by client for synthetic signals\n}\n\n/**\n * Function to be used for creating a protocol handler.\n * @alpha\n */\nexport type ProtocolHandlerBuilder = (\n\tattributes: IDocumentAttributes,\n\tsnapshot: IQuorumSnapshot,\n\tsendProposal: (key: string, value: any) => number,\n) => IProtocolHandler;\n\n/**\n * @alpha\n */\nexport interface IProtocolHandler extends IBaseProtocolHandler {\n\treadonly audience: IAudienceOwner;\n\tprocessSignal(message: ISignalMessage);\n}\n\nexport class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandler {\n\tconstructor(\n\t\tattributes: IDocumentAttributes,\n\t\tquorumSnapshot: IQuorumSnapshot,\n\t\tsendProposal: (key: string, value: any) => number,\n\t\tpublic readonly audience: IAudienceOwner,\n\t\tprivate readonly shouldClientHaveLeft: (clientId: string) => boolean,\n\t) {\n\t\tsuper(\n\t\t\tattributes.minimumSequenceNumber,\n\t\t\tattributes.sequenceNumber,\n\t\t\tquorumSnapshot.members,\n\t\t\tquorumSnapshot.proposals,\n\t\t\tquorumSnapshot.values,\n\t\t\tsendProposal,\n\t\t);\n\n\t\tfor (const [clientId, member] of this.quorum.getMembers()) {\n\t\t\taudience.addMember(clientId, member.client);\n\t\t}\n\n\t\t// Join / leave signals are ignored for \"write\" clients in favor of join / leave ops\n\t\tthis.quorum.on(\"addMember\", (clientId, details) =>\n\t\t\taudience.addMember(clientId, details.client),\n\t\t);\n\t\tthis.quorum.on(\"removeMember\", (clientId) => audience.removeMember(clientId));\n\t\tfor (const [clientId, details] of this.quorum.getMembers()) {\n\t\t\tthis.audience.addMember(clientId, details.client);\n\t\t}\n\t}\n\n\tpublic processMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t): IProcessMessageResult {\n\t\t// Check and report if we're getting messages from a clientId that we previously\n\t\t// flagged as shouldHaveLeft, or from a client that's not in the quorum but should be\n\t\tif (message.clientId != null) {\n\t\t\tconst client = this.quorum.getMember(message.clientId);\n\n\t\t\tif (client === undefined && message.type !== MessageType.ClientJoin) {\n\t\t\t\t// pre-0.58 error message: messageClientIdMissingFromQuorum\n\t\t\t\tthrow new Error(\"Remote message's clientId is missing from the quorum\");\n\t\t\t}\n\n\t\t\t// Here checking canBeCoalescedByService is used as an approximation of \"is benign to process despite being unexpected\".\n\t\t\t// It's still not good to see these messages from unexpected clientIds, but since they don't harm the integrity of the\n\t\t\t// document we don't need to blow up aggressively.\n\t\t\tif (this.shouldClientHaveLeft(message.clientId) && !canBeCoalescedByService(message)) {\n\t\t\t\t// pre-0.58 error message: messageClientIdShouldHaveLeft\n\t\t\t\tthrow new Error(\"Remote message's clientId already should have left\");\n\t\t\t}\n\t\t}\n\n\t\treturn super.processMessage(message, local);\n\t}\n\n\tpublic processSignal(message: ISignalMessage) {\n\t\tconst innerContent = message.content as { content: any; type: string };\n\t\tswitch (innerContent.type) {\n\t\t\tcase SignalType.Clear: {\n\t\t\t\tconst members = this.audience.getMembers();\n\t\t\t\tfor (const [clientId, client] of members) {\n\t\t\t\t\tif (client.mode === \"read\") {\n\t\t\t\t\t\tthis.audience.removeMember(clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientJoin: {\n\t\t\t\tconst newClient = innerContent.content as ISignalClient;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (newClient.client.mode === \"read\") {\n\t\t\t\t\tthis.audience.addMember(newClient.clientId, newClient.client);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientLeave: {\n\t\t\t\tconst leftClientId = innerContent.content as string;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (this.audience.getMember(leftClientId)?.mode === \"read\") {\n\t\t\t\t\tthis.audience.removeMember(leftClientId);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/**\n * Function to check whether the protocol handler should process the Signal.\n * The protocol handler should strictly handle only ClientJoin, ClientLeave\n * and Clear signal types.\n */\nexport function protocolHandlerShouldProcessSignal(message: ISignalMessage) {\n\t// Signal originates from server\n\tif (message.clientId === null) {\n\t\tconst innerContent = message.content as { content: unknown; type: string };\n\t\treturn (\n\t\t\tinnerContent.type === SignalType.Clear ||\n\t\t\tinnerContent.type === SignalType.ClientJoin ||\n\t\t\tinnerContent.type === SignalType.ClientLeave\n\t\t);\n\t}\n\treturn false;\n}\n"]}
package/dist/public.d.ts CHANGED
@@ -9,6 +9,6 @@
9
9
  */
10
10
 
11
11
  export {
12
- // public APIs
12
+ // @public APIs
13
13
  ConnectionState
14
14
  } from "./index.js";
@@ -5,7 +5,7 @@
5
5
  import { IDisposable } from "@fluidframework/core-interfaces";
6
6
  import { FetchSource, IDocumentStorageService, IDocumentStorageServicePolicies, ISnapshot, ISnapshotFetchOptions, ISummaryContext } from "@fluidframework/driver-definitions/internal";
7
7
  import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
8
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
8
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
9
9
  export declare class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {
10
10
  private readonly internalStorageServiceP;
11
11
  private readonly logger;
@@ -1 +1 @@
1
- {"version":3,"file":"retriableDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;G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