@fluidframework/container-loader 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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 (168) hide show
  1. package/.eslintrc.js +18 -21
  2. package/.mocharc.js +2 -2
  3. package/README.md +65 -44
  4. package/api-extractor.json +2 -2
  5. package/closeAndGetPendingLocalState.md +51 -0
  6. package/dist/audience.d.ts +0 -1
  7. package/dist/audience.d.ts.map +1 -1
  8. package/dist/audience.js.map +1 -1
  9. package/dist/catchUpMonitor.d.ts.map +1 -1
  10. package/dist/catchUpMonitor.js.map +1 -1
  11. package/dist/collabWindowTracker.d.ts.map +1 -1
  12. package/dist/collabWindowTracker.js.map +1 -1
  13. package/dist/connectionManager.d.ts +5 -5
  14. package/dist/connectionManager.d.ts.map +1 -1
  15. package/dist/connectionManager.js +107 -44
  16. package/dist/connectionManager.js.map +1 -1
  17. package/dist/connectionState.d.ts.map +1 -1
  18. package/dist/connectionState.js.map +1 -1
  19. package/dist/connectionStateHandler.d.ts +7 -7
  20. package/dist/connectionStateHandler.d.ts.map +1 -1
  21. package/dist/connectionStateHandler.js +50 -21
  22. package/dist/connectionStateHandler.js.map +1 -1
  23. package/dist/container.d.ts +64 -5
  24. package/dist/container.d.ts.map +1 -1
  25. package/dist/container.js +329 -137
  26. package/dist/container.js.map +1 -1
  27. package/dist/containerContext.d.ts +19 -8
  28. package/dist/containerContext.d.ts.map +1 -1
  29. package/dist/containerContext.js +58 -14
  30. package/dist/containerContext.js.map +1 -1
  31. package/dist/containerStorageAdapter.d.ts +41 -2
  32. package/dist/containerStorageAdapter.d.ts.map +1 -1
  33. package/dist/containerStorageAdapter.js +88 -14
  34. package/dist/containerStorageAdapter.js.map +1 -1
  35. package/dist/contracts.d.ts +3 -3
  36. package/dist/contracts.d.ts.map +1 -1
  37. package/dist/contracts.js.map +1 -1
  38. package/dist/deltaManager.d.ts +21 -8
  39. package/dist/deltaManager.d.ts.map +1 -1
  40. package/dist/deltaManager.js +112 -37
  41. package/dist/deltaManager.js.map +1 -1
  42. package/dist/deltaManagerProxy.d.ts +10 -22
  43. package/dist/deltaManagerProxy.d.ts.map +1 -1
  44. package/dist/deltaManagerProxy.js +14 -50
  45. package/dist/deltaManagerProxy.js.map +1 -1
  46. package/dist/deltaQueue.d.ts.map +1 -1
  47. package/dist/deltaQueue.js +4 -2
  48. package/dist/deltaQueue.js.map +1 -1
  49. package/dist/index.d.ts +4 -3
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +1 -3
  52. package/dist/index.js.map +1 -1
  53. package/dist/loader.d.ts +13 -4
  54. package/dist/loader.d.ts.map +1 -1
  55. package/dist/loader.js +38 -24
  56. package/dist/loader.js.map +1 -1
  57. package/dist/packageVersion.d.ts +1 -1
  58. package/dist/packageVersion.js +1 -1
  59. package/dist/packageVersion.js.map +1 -1
  60. package/dist/protocol.d.ts.map +1 -1
  61. package/dist/protocol.js +2 -1
  62. package/dist/protocol.js.map +1 -1
  63. package/dist/protocolTreeDocumentStorageService.d.ts +6 -2
  64. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  65. package/dist/protocolTreeDocumentStorageService.js +7 -4
  66. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  67. package/dist/quorum.d.ts.map +1 -1
  68. package/dist/quorum.js.map +1 -1
  69. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  70. package/dist/retriableDocumentStorageService.js +6 -2
  71. package/dist/retriableDocumentStorageService.js.map +1 -1
  72. package/dist/utils.d.ts.map +1 -1
  73. package/dist/utils.js +8 -5
  74. package/dist/utils.js.map +1 -1
  75. package/lib/audience.d.ts +0 -1
  76. package/lib/audience.d.ts.map +1 -1
  77. package/lib/audience.js.map +1 -1
  78. package/lib/catchUpMonitor.d.ts.map +1 -1
  79. package/lib/catchUpMonitor.js.map +1 -1
  80. package/lib/collabWindowTracker.d.ts.map +1 -1
  81. package/lib/collabWindowTracker.js.map +1 -1
  82. package/lib/connectionManager.d.ts +5 -5
  83. package/lib/connectionManager.d.ts.map +1 -1
  84. package/lib/connectionManager.js +110 -47
  85. package/lib/connectionManager.js.map +1 -1
  86. package/lib/connectionState.d.ts.map +1 -1
  87. package/lib/connectionState.js.map +1 -1
  88. package/lib/connectionStateHandler.d.ts +7 -7
  89. package/lib/connectionStateHandler.d.ts.map +1 -1
  90. package/lib/connectionStateHandler.js +50 -21
  91. package/lib/connectionStateHandler.js.map +1 -1
  92. package/lib/container.d.ts +64 -5
  93. package/lib/container.d.ts.map +1 -1
  94. package/lib/container.js +336 -144
  95. package/lib/container.js.map +1 -1
  96. package/lib/containerContext.d.ts +19 -8
  97. package/lib/containerContext.d.ts.map +1 -1
  98. package/lib/containerContext.js +59 -15
  99. package/lib/containerContext.js.map +1 -1
  100. package/lib/containerStorageAdapter.d.ts +41 -2
  101. package/lib/containerStorageAdapter.d.ts.map +1 -1
  102. package/lib/containerStorageAdapter.js +86 -14
  103. package/lib/containerStorageAdapter.js.map +1 -1
  104. package/lib/contracts.d.ts +3 -3
  105. package/lib/contracts.d.ts.map +1 -1
  106. package/lib/contracts.js.map +1 -1
  107. package/lib/deltaManager.d.ts +21 -8
  108. package/lib/deltaManager.d.ts.map +1 -1
  109. package/lib/deltaManager.js +114 -39
  110. package/lib/deltaManager.js.map +1 -1
  111. package/lib/deltaManagerProxy.d.ts +10 -22
  112. package/lib/deltaManagerProxy.d.ts.map +1 -1
  113. package/lib/deltaManagerProxy.js +14 -50
  114. package/lib/deltaManagerProxy.js.map +1 -1
  115. package/lib/deltaQueue.d.ts.map +1 -1
  116. package/lib/deltaQueue.js +4 -2
  117. package/lib/deltaQueue.js.map +1 -1
  118. package/lib/index.d.ts +4 -3
  119. package/lib/index.d.ts.map +1 -1
  120. package/lib/index.js +2 -2
  121. package/lib/index.js.map +1 -1
  122. package/lib/loader.d.ts +13 -4
  123. package/lib/loader.d.ts.map +1 -1
  124. package/lib/loader.js +37 -24
  125. package/lib/loader.js.map +1 -1
  126. package/lib/packageVersion.d.ts +1 -1
  127. package/lib/packageVersion.js +1 -1
  128. package/lib/packageVersion.js.map +1 -1
  129. package/lib/protocol.d.ts.map +1 -1
  130. package/lib/protocol.js +2 -1
  131. package/lib/protocol.js.map +1 -1
  132. package/lib/protocolTreeDocumentStorageService.d.ts +6 -2
  133. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  134. package/lib/protocolTreeDocumentStorageService.js +7 -4
  135. package/lib/protocolTreeDocumentStorageService.js.map +1 -1
  136. package/lib/quorum.d.ts.map +1 -1
  137. package/lib/quorum.js.map +1 -1
  138. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  139. package/lib/retriableDocumentStorageService.js +6 -2
  140. package/lib/retriableDocumentStorageService.js.map +1 -1
  141. package/lib/utils.d.ts.map +1 -1
  142. package/lib/utils.js +8 -5
  143. package/lib/utils.js.map +1 -1
  144. package/package.json +67 -56
  145. package/prettier.config.cjs +1 -1
  146. package/src/audience.ts +51 -46
  147. package/src/catchUpMonitor.ts +39 -37
  148. package/src/collabWindowTracker.ts +75 -70
  149. package/src/connectionManager.ts +1040 -941
  150. package/src/connectionState.ts +19 -19
  151. package/src/connectionStateHandler.ts +557 -463
  152. package/src/container.ts +2147 -1784
  153. package/src/containerContext.ts +417 -345
  154. package/src/containerStorageAdapter.ts +268 -154
  155. package/src/contracts.ts +155 -153
  156. package/src/deltaManager.ts +1074 -945
  157. package/src/deltaManagerProxy.ts +88 -137
  158. package/src/deltaQueue.ts +155 -151
  159. package/src/index.ts +13 -17
  160. package/src/loader.ts +434 -427
  161. package/src/packageVersion.ts +1 -1
  162. package/src/protocol.ts +93 -87
  163. package/src/protocolTreeDocumentStorageService.ts +34 -34
  164. package/src/quorum.ts +34 -34
  165. package/src/retriableDocumentStorageService.ts +118 -102
  166. package/src/utils.ts +93 -83
  167. package/tsconfig.esnext.json +6 -6
  168. package/tsconfig.json +8 -12
package/dist/index.d.ts CHANGED
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { ConnectionState } from "./connectionState";
6
- export { Container, IContainerLoadOptions, IContainerConfig, IPendingContainerState, waitContainerToCatchUp, } from "./container";
7
- export { ICodeDetailsLoader, IDetachedBlobStorage, IFluidModuleWithDetails, ILoaderOptions, ILoaderProps, ILoaderServices, Loader, RelativeLoader, } from "./loader";
8
- export { IProtocolHandler, ProtocolHandlerBuilder, } from "./protocol";
6
+ export { IContainerConfig, IContainerLoadOptions, IPendingContainerState, waitContainerToCatchUp, } from "./container";
7
+ export { ISerializableBlobContents } from "./containerStorageAdapter";
8
+ export { ICodeDetailsLoader, IDetachedBlobStorage, IFluidModuleWithDetails, ILoaderOptions, ILoaderProps, ILoaderServices, Loader, } from "./loader";
9
+ export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACH,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,EACN,cAAc,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,gBAAgB,EAChB,sBAAsB,GACzB,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,mBAAmB,CAAC;AACpD,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,GACN,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -4,13 +4,11 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.RelativeLoader = exports.Loader = exports.waitContainerToCatchUp = exports.Container = exports.ConnectionState = void 0;
7
+ exports.Loader = exports.waitContainerToCatchUp = exports.ConnectionState = void 0;
8
8
  var connectionState_1 = require("./connectionState");
9
9
  Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return connectionState_1.ConnectionState; } });
10
10
  var container_1 = require("./container");
11
- Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return container_1.Container; } });
12
11
  Object.defineProperty(exports, "waitContainerToCatchUp", { enumerable: true, get: function () { return container_1.waitContainerToCatchUp; } });
13
12
  var loader_1 = require("./loader");
14
13
  Object.defineProperty(exports, "Loader", { enumerable: true, get: function () { return loader_1.Loader; } });
15
- Object.defineProperty(exports, "RelativeLoader", { enumerable: true, get: function () { return loader_1.RelativeLoader; } });
16
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,yCAMqB;AALjB,sGAAA,SAAS,OAAA;AAIT,mHAAA,sBAAsB,OAAA;AAE1B,mCASkB;AAFd,gGAAA,MAAM,OAAA;AACN,wGAAA,cAAc,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState\";\nexport {\n Container,\n IContainerLoadOptions,\n IContainerConfig,\n IPendingContainerState,\n waitContainerToCatchUp,\n} from \"./container\";\nexport {\n ICodeDetailsLoader,\n IDetachedBlobStorage,\n IFluidModuleWithDetails,\n ILoaderOptions,\n ILoaderProps,\n ILoaderServices,\n Loader,\n RelativeLoader,\n} from \"./loader\";\nexport {\n IProtocolHandler,\n ProtocolHandlerBuilder,\n} from \"./protocol\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,yCAKqB;AADpB,mHAAA,sBAAsB,OAAA;AAGvB,mCAQkB;AADjB,gGAAA,MAAM,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState\";\nexport {\n\tIContainerConfig,\n\tIContainerLoadOptions,\n\tIPendingContainerState,\n\twaitContainerToCatchUp,\n} from \"./container\";\nexport { ISerializableBlobContents } from \"./containerStorageAdapter\";\nexport {\n\tICodeDetailsLoader,\n\tIDetachedBlobStorage,\n\tIFluidModuleWithDetails,\n\tILoaderOptions,\n\tILoaderProps,\n\tILoaderServices,\n\tLoader,\n} from \"./loader\";\nexport { IProtocolHandler, ProtocolHandlerBuilder } from \"./protocol\";\n"]}
package/dist/loader.d.ts CHANGED
@@ -3,12 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ITelemetryBaseLogger, ITelemetryLogger } from "@fluidframework/common-definitions";
6
- import { FluidObject, IFluidRouter, IRequest, IResponse } from "@fluidframework/core-interfaces";
6
+ import { FluidObject, IFluidRouter, IRequest, IRequestHeader, IResponse } from "@fluidframework/core-interfaces";
7
7
  import { IContainer, IFluidModule, IHostLoader, ILoader, ILoaderOptions as ILoaderOptions1, IProvideFluidCodeDetailsComparer, IFluidCodeDetails } from "@fluidframework/container-definitions";
8
8
  import { IConfigProviderBase } from "@fluidframework/telemetry-utils";
9
9
  import { IDocumentServiceFactory, IDocumentStorageService, IUrlResolver } from "@fluidframework/driver-definitions";
10
10
  import { Container } from "./container";
11
11
  import { ProtocolHandlerBuilder } from "./protocol";
12
+ /**
13
+ * @deprecated - In the next release RelativeLoader will no longer be exported. It is an internal class that should not be used directly.
14
+ */
12
15
  export declare class RelativeLoader implements ILoader {
13
16
  private readonly container;
14
17
  private readonly loader;
@@ -95,9 +98,9 @@ export interface ILoaderProps {
95
98
  */
96
99
  readonly configProvider?: IConfigProviderBase;
97
100
  /**
98
- * Optional property for allowing the container to use a custom
99
- * protocol implementation for handling the quorum and/or the audience.
100
- */
101
+ * Optional property for allowing the container to use a custom
102
+ * protocol implementation for handling the quorum and/or the audience.
103
+ */
101
104
  readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;
102
105
  }
103
106
  /**
@@ -151,6 +154,12 @@ export declare type IDetachedBlobStorage = Pick<IDocumentStorageService, "create
151
154
  */
152
155
  getBlobIds(): string[];
153
156
  };
157
+ /**
158
+ * With an already-resolved container, we can request a component directly, without loading the container again
159
+ * @param container - a resolved container
160
+ * @returns component on the container
161
+ */
162
+ export declare function requestResolvedObjectFromContainer(container: IContainer, headers?: IRequestHeader): Promise<IResponse>;
154
163
  /**
155
164
  * Manages Fluid resource loading
156
165
  */
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EACH,WAAW,EACX,YAAY,EACZ,QAAQ,EAER,SAAS,EACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,UAAU,EACV,YAAY,EACZ,WAAW,EACX,OAAO,EACP,cAAc,IAAI,eAAe,EAEjC,gCAAgC,EAChC,iBAAiB,EACpB,MAAM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,sCAAsC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAI7E,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAW3E,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAc3D,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,mBAAmB;YAgBb,WAAW;IA0DzB,OAAO,KAAK,cAAc,GAEzB;IAED,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,WAAW;YAsBL,aAAa;CAkB3B"}
package/dist/loader.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.Loader = exports.RelativeLoader = void 0;
7
+ exports.Loader = exports.requestResolvedObjectFromContainer = exports.RelativeLoader = void 0;
8
8
  const uuid_1 = require("uuid");
9
9
  const container_definitions_1 = require("@fluidframework/container-definitions");
10
10
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
@@ -18,12 +18,17 @@ function canUseCache(request) {
18
18
  }
19
19
  return request.headers[container_definitions_1.LoaderHeader.cache] !== false;
20
20
  }
21
+ /**
22
+ * @deprecated - In the next release RelativeLoader will no longer be exported. It is an internal class that should not be used directly.
23
+ */
21
24
  class RelativeLoader {
22
25
  constructor(container, loader) {
23
26
  this.container = container;
24
27
  this.loader = loader;
25
28
  }
26
- get IFluidRouter() { return this; }
29
+ get IFluidRouter() {
30
+ return this;
31
+ }
27
32
  async resolve(request) {
28
33
  var _a, _b, _c, _d, _e;
29
34
  if (request.url.startsWith("/")) {
@@ -64,20 +69,23 @@ class RelativeLoader {
64
69
  }
65
70
  }
66
71
  exports.RelativeLoader = RelativeLoader;
67
- function createCachedResolver(resolver) {
68
- const cacheResolver = Object.create(resolver);
69
- const resolveCache = new Map();
70
- cacheResolver.resolve = async (request) => {
71
- if (!canUseCache(request)) {
72
- return resolver.resolve(request);
73
- }
74
- if (!resolveCache.has(request.url)) {
75
- resolveCache.set(request.url, resolver.resolve(request));
76
- }
77
- return resolveCache.get(request.url);
78
- };
79
- return cacheResolver;
72
+ /**
73
+ * With an already-resolved container, we can request a component directly, without loading the container again
74
+ * @param container - a resolved container
75
+ * @returns component on the container
76
+ */
77
+ async function requestResolvedObjectFromContainer(container, headers) {
78
+ (0, driver_utils_1.ensureFluidResolvedUrl)(container.resolvedUrl);
79
+ const parsedUrl = (0, utils_1.parseUrl)(container.resolvedUrl.url);
80
+ if (parsedUrl === undefined) {
81
+ throw new Error(`Invalid URL ${container.resolvedUrl.url}`);
82
+ }
83
+ return container.request({
84
+ url: `${parsedUrl.path}${parsedUrl.query}`,
85
+ headers,
86
+ });
80
87
  }
88
+ exports.requestResolvedObjectFromContainer = requestResolvedObjectFromContainer;
81
89
  /**
82
90
  * Manages Fluid resource loading
83
91
  */
@@ -93,10 +101,12 @@ class Loader {
93
101
  loaderId: (0, uuid_1.v4)(),
94
102
  loaderVersion: packageVersion_1.pkgVersion,
95
103
  };
96
- const subMc = (0, telemetry_utils_1.mixinMonitoringContext)(telemetry_utils_1.DebugLogger.mixinDebugLogger("fluid:telemetry", loaderProps.logger, { all: telemetryProps }), telemetry_utils_1.sessionStorageConfigProvider.value, loaderProps.configProvider);
104
+ const subMc = (0, telemetry_utils_1.mixinMonitoringContext)(telemetry_utils_1.DebugLogger.mixinDebugLogger("fluid:telemetry", loaderProps.logger, {
105
+ all: telemetryProps,
106
+ }), telemetry_utils_1.sessionStorageConfigProvider.value, loaderProps.configProvider);
97
107
  this.services = {
98
- urlResolver: createCachedResolver(driver_utils_1.MultiUrlResolver.create(loaderProps.urlResolver)),
99
- documentServiceFactory: driver_utils_1.MultiDocumentServiceFactory.create(loaderProps.documentServiceFactory),
108
+ urlResolver: loaderProps.urlResolver,
109
+ documentServiceFactory: loaderProps.documentServiceFactory,
100
110
  codeLoader: loaderProps.codeLoader,
101
111
  options: (_b = loaderProps.options) !== null && _b !== void 0 ? _b : {},
102
112
  scope,
@@ -106,7 +116,9 @@ class Loader {
106
116
  this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(this.services.subLogger, "Loader"));
107
117
  this.protocolHandlerBuilder = loaderProps.protocolHandlerBuilder;
108
118
  }
109
- get IFluidRouter() { return this; }
119
+ get IFluidRouter() {
120
+ return this;
121
+ }
110
122
  async createDetachedContainer(codeDetails) {
111
123
  const container = await container_1.Container.createDetached(this, codeDetails, this.protocolHandlerBuilder);
112
124
  if (this.cachingEnabled) {
@@ -145,7 +157,8 @@ class Loader {
145
157
  }
146
158
  addToContainerCache(key, containerP) {
147
159
  this.containers.set(key, containerP);
148
- containerP.then((container) => {
160
+ containerP
161
+ .then((container) => {
149
162
  // If the container is closed or becomes closed after we resolve it, remove it from the cache.
150
163
  if (container.closed) {
151
164
  this.containers.delete(key);
@@ -155,7 +168,8 @@ class Loader {
155
168
  this.containers.delete(key);
156
169
  });
157
170
  }
158
- }).catch((error) => { });
171
+ })
172
+ .catch((error) => { });
159
173
  }
160
174
  async resolveCore(request, pendingLocalState) {
161
175
  const resolvedAsFluid = await this.services.urlResolver.resolve(request);
@@ -189,8 +203,7 @@ class Loader {
189
203
  }
190
204
  }
191
205
  else {
192
- container =
193
- await this.loadContainer(request, resolvedAsFluid, pendingLocalState);
206
+ container = await this.loadContainer(request, resolvedAsFluid, pendingLocalState);
194
207
  }
195
208
  if (container.deltaManager.lastSequenceNumber <= fromSequenceNumber) {
196
209
  await new Promise((resolve, reject) => {
@@ -220,7 +233,8 @@ class Loader {
220
233
  fromSequenceNumber = headerSeqNum;
221
234
  }
222
235
  // If set in both query string and headers, use query string
223
- request.headers[container_definitions_1.LoaderHeader.version] = (_b = parsed.version) !== null && _b !== void 0 ? _b : request.headers[container_definitions_1.LoaderHeader.version];
236
+ request.headers[container_definitions_1.LoaderHeader.version] =
237
+ (_b = parsed.version) !== null && _b !== void 0 ? _b : request.headers[container_definitions_1.LoaderHeader.version];
224
238
  const canCache = this.canCacheForRequest(request.headers);
225
239
  return {
226
240
  canCache,
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AASlC,iFAS+C;AAC/C,qEASyC;AASzC,+DAIsC;AACtC,2CAAgE;AAChE,mCAA+C;AAC/C,qDAA8C;AAG9C,SAAS,WAAW,CAAC,OAAiB;IAClC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;QAC/B,OAAO,IAAI,CAAC;KACf;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,oCAAY,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AACzD,CAAC;AAED,MAAa,cAAc;IACvB,YACqB,SAAoB,EACpB,MAA2B;QAD3B,cAAS,GAAT,SAAS,CAAW;QACpB,WAAM,GAAN,MAAM,CAAqB;IAEhD,CAAC;IAED,IAAW,YAAY,KAAmB,OAAO,IAAI,CAAC,CAAC,CAAC;IAEjD,KAAK,CAAC,OAAO,CAAC,OAAiB;;QAClC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC7B,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE;gBACtB,OAAO,IAAI,CAAC,SAAS,CAAC;aACzB;iBAAM;gBACH,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBAC/C,IAAA,qCAAsB,EAAC,WAAW,CAAC,CAAC;gBACpC,MAAM,SAAS,GAAG,MAAM,qBAAS,CAAC,IAAI,CAClC,IAAI,CAAC,MAAgB,EACrB;oBACI,YAAY,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,SAAS,CAAC;oBACvD,qBAAqB,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,aAAa,CAAC;oBACpE,WAA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AS,CAAC;YACvD,qBAAqB,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,aAAa,CAAC;YACpE,WAAW,EAAE,QAAQ;YACrB,OAAO,EAAE,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,OAAO,CAAC,mCAAI,SAAS;YAC7D,QAAQ,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,QAAQ,CAAC;SACrD,EACD,iBAAiB,EACjB,IAAI,CAAC,sBAAsB,CAC9B,CAAC;IACN,CAAC;CACJ;AAtND,wBAsNC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { ITelemetryBaseLogger, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n FluidObject,\n IFluidRouter,\n IRequest,\n IRequestHeader,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IContainer,\n IFluidModule,\n IHostLoader,\n ILoader,\n ILoaderOptions as ILoaderOptions1,\n LoaderHeader,\n IProvideFluidCodeDetailsComparer,\n IFluidCodeDetails,\n} from \"@fluidframework/container-definitions\";\nimport {\n ChildLogger,\n DebugLogger,\n IConfigProviderBase,\n loggerToMonitoringContext,\n mixinMonitoringContext,\n MonitoringContext,\n PerformanceEvent,\n sessionStorageConfigProvider,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n IDocumentServiceFactory,\n IDocumentStorageService,\n IFluidResolvedUrl,\n IResolvedUrl,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n ensureFluidResolvedUrl,\n MultiUrlResolver,\n MultiDocumentServiceFactory,\n} from \"@fluidframework/driver-utils\";\nimport { Container, IPendingContainerState } from \"./container\";\nimport { IParsedUrl, parseUrl } from \"./utils\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { ProtocolHandlerBuilder } from \"./protocol\";\n\nfunction canUseCache(request: IRequest): boolean {\n if (request.headers === undefined) {\n return true;\n }\n\n return request.headers[LoaderHeader.cache] !== false;\n}\n\nexport class RelativeLoader implements ILoader {\n constructor(\n private readonly container: Container,\n private readonly loader: ILoader | undefined,\n ) {\n }\n\n public get IFluidRouter(): IFluidRouter { return this; }\n\n public async resolve(request: IRequest): Promise<IContainer> {\n if (request.url.startsWith(\"/\")) {\n if (canUseCache(request)) {\n return this.container;\n } else {\n const resolvedUrl = this.container.resolvedUrl;\n ensureFluidResolvedUrl(resolvedUrl);\n const container = await Container.load(\n this.loader as Loader,\n {\n canReconnect: request.headers?.[LoaderHeader.reconnect],\n clientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n resolvedUrl: { ...resolvedUrl },\n version: request.headers?.[LoaderHeader.version] ?? undefined,\n loadMode: request.headers?.[LoaderHeader.loadMode],\n },\n );\n return container;\n }\n }\n\n if (this.loader === undefined) {\n throw new Error(\"Cannot resolve external containers\");\n }\n return this.loader.resolve(request);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n if (request.url.startsWith(\"/\")) {\n const container = await this.resolve(request);\n return container.request(request);\n }\n\n if (this.loader === undefined) {\n return {\n status: 404,\n value: \"Cannot request external containers\",\n mimeType: \"plain/text\",\n };\n }\n return this.loader.request(request);\n }\n}\n\nfunction createCachedResolver(resolver: IUrlResolver) {\n const cacheResolver = Object.create(resolver) as IUrlResolver;\n const resolveCache = new Map<string, Promise<IResolvedUrl | undefined>>();\n cacheResolver.resolve = async (request: IRequest): Promise<IResolvedUrl | undefined> => {\n if (!canUseCache(request)) {\n return resolver.resolve(request);\n }\n if (!resolveCache.has(request.url)) {\n resolveCache.set(request.url, resolver.resolve(request));\n }\n\n return resolveCache.get(request.url);\n };\n return cacheResolver;\n}\n\nexport interface ILoaderOptions extends ILoaderOptions1 {\n summarizeProtocolTree?: 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 */\nexport interface IFluidModuleWithDetails {\n /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */\n module: IFluidModule;\n /**\n * Code details associated with the module. Represents a document schema this module supports.\n * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,\n * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.\n */\n details: IFluidCodeDetails;\n}\n\n/**\n * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definition#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 */\nexport interface ICodeDetailsLoader\n extends Partial<IProvideFluidCodeDetailsComparer> {\n /**\n * Load the code module (package) that is capable to interact with the document.\n *\n * @param source - Code proposal that articulates the current schema the document is written in.\n * @returns - Code module entry point along with the code details associated with it.\n */\n load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;\n}\n\n/**\n * Services and properties necessary for creating a loader\n */\nexport interface ILoaderProps {\n /**\n * The url resolver used by the loader for resolving external urls\n * into Fluid urls such that the container specified by the\n * external url can be loaded.\n */\n readonly urlResolver: IUrlResolver;\n /**\n * The document service factory take the Fluid url provided\n * by the resolved url and constructs all the necessary services\n * for communication with the container's server.\n */\n readonly documentServiceFactory: IDocumentServiceFactory;\n /**\n * The code loader handles loading the necessary code\n * for running a container once it is loaded.\n */\n readonly codeLoader: ICodeDetailsLoader;\n\n /**\n * A property bag of options used by various layers\n * to control features\n */\n readonly options?: ILoaderOptions;\n\n /**\n * Scope is provided to all container and is a set of shared\n * services for container's to integrate with their host environment.\n */\n readonly scope?: FluidObject;\n\n /**\n * The logger that all telemetry should be pushed to.\n */\n readonly logger?: ITelemetryBaseLogger;\n\n /**\n * Blobs storage for detached containers.\n */\n readonly detachedBlobStorage?: IDetachedBlobStorage;\n\n /**\n * The configuration provider which may be used to control features.\n */\n readonly configProvider?: IConfigProviderBase;\n\n /**\n * Optional property for allowing the container to use a custom\n * protocol implementation for handling the quorum and/or the audience.\n */\n readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Services and properties used by and exposed by the loader\n */\nexport interface ILoaderServices {\n /**\n * The url resolver used by the loader for resolving external urls\n * into Fluid urls such that the container specified by the\n * external url can be loaded.\n */\n readonly urlResolver: IUrlResolver;\n /**\n * The document service factory take the Fluid url provided\n * by the resolved url and constructs all the necessary services\n * for communication with the container's server.\n */\n readonly documentServiceFactory: IDocumentServiceFactory;\n /**\n * The code loader handles loading the necessary code\n * for running a container once it is loaded.\n */\n readonly codeLoader: ICodeDetailsLoader;\n\n /**\n * A property bag of options used by various layers\n * to control features\n */\n readonly options: ILoaderOptions;\n\n /**\n * Scope is provided to all container and is a set of shared\n * services for container's to integrate with their host environment.\n */\n readonly scope: FluidObject;\n\n /**\n * The logger downstream consumers should construct their loggers from\n */\n readonly subLogger: ITelemetryLogger;\n\n /**\n * Blobs storage for detached containers.\n */\n readonly detachedBlobStorage?: IDetachedBlobStorage;\n}\n\n/**\n * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support\n * blobs in detached containers.\n */\nexport type IDetachedBlobStorage = Pick<IDocumentStorageService, \"createBlob\" | \"readBlob\"> & {\n size: number;\n /**\n * Return an array of all blob IDs present in storage\n */\n getBlobIds(): string[];\n };\n\n/**\n * Manages Fluid resource loading\n */\nexport class Loader implements IHostLoader {\n private readonly containers = new Map<string, Promise<Container>>();\n public readonly services: ILoaderServices;\n private readonly mc: MonitoringContext;\n private readonly protocolHandlerBuilder: ProtocolHandlerBuilder | undefined;\n\n constructor(loaderProps: ILoaderProps) {\n const scope: FluidObject<ILoader> = { ...loaderProps.scope };\n if (loaderProps.options?.provideScopeLoader !== false) {\n scope.ILoader = this;\n }\n const telemetryProps = {\n loaderId: uuid(),\n loaderVersion: pkgVersion,\n };\n\n const subMc = mixinMonitoringContext(\n DebugLogger.mixinDebugLogger(\"fluid:telemetry\", loaderProps.logger, { all: telemetryProps }),\n sessionStorageConfigProvider.value,\n loaderProps.configProvider,\n );\n\n this.services = {\n urlResolver: createCachedResolver(MultiUrlResolver.create(loaderProps.urlResolver)),\n documentServiceFactory: MultiDocumentServiceFactory.create(loaderProps.documentServiceFactory),\n codeLoader: loaderProps.codeLoader,\n options: loaderProps.options ?? {},\n scope,\n subLogger: subMc.logger,\n detachedBlobStorage: loaderProps.detachedBlobStorage,\n };\n this.mc = loggerToMonitoringContext(\n ChildLogger.create(this.services.subLogger, \"Loader\"));\n this.protocolHandlerBuilder = loaderProps.protocolHandlerBuilder;\n }\n\n public get IFluidRouter(): IFluidRouter { return this; }\n\n public async createDetachedContainer(codeDetails: IFluidCodeDetails): Promise<IContainer> {\n const container = await Container.createDetached(\n this,\n codeDetails,\n this.protocolHandlerBuilder,\n );\n\n if (this.cachingEnabled) {\n container.once(\"attached\", () => {\n ensureFluidResolvedUrl(container.resolvedUrl);\n const parsedUrl = parseUrl(container.resolvedUrl.url);\n if (parsedUrl !== undefined) {\n this.addToContainerCache(parsedUrl.id, Promise.resolve(container));\n }\n });\n }\n\n return container;\n }\n\n public async rehydrateDetachedContainerFromSnapshot(snapshot: string): Promise<IContainer> {\n return Container.rehydrateDetachedFromSnapshot(this, snapshot, this.protocolHandlerBuilder);\n }\n\n public async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {\n const eventName = pendingLocalState === undefined ? \"Resolve\" : \"ResolveWithPendingState\";\n return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {\n const resolved = await this.resolveCore(\n request,\n pendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,\n );\n return resolved.container;\n });\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: \"Request\" }, async () => {\n const resolved = await this.resolveCore(request);\n return resolved.container.request({\n ...request,\n url: `${resolved.parsed.path}${resolved.parsed.query}`,\n });\n });\n }\n\n private getKeyForContainerCache(request: IRequest, parsedUrl: IParsedUrl): string {\n const key = request.headers?.[LoaderHeader.version] !== undefined\n ? `${parsedUrl.id}@${request.headers[LoaderHeader.version]}`\n : parsedUrl.id;\n return key;\n }\n\n private addToContainerCache(key: string, containerP: Promise<Container>) {\n this.containers.set(key, containerP);\n containerP.then((container) => {\n // If the container is closed or becomes closed after we resolve it, remove it from the cache.\n if (container.closed) {\n this.containers.delete(key);\n } else {\n container.once(\"closed\", () => {\n this.containers.delete(key);\n });\n }\n }).catch((error) => {});\n }\n\n private async resolveCore(\n request: IRequest,\n pendingLocalState?: IPendingContainerState,\n ): Promise<{ container: Container; parsed: IParsedUrl; }> {\n const resolvedAsFluid = await this.services.urlResolver.resolve(request);\n ensureFluidResolvedUrl(resolvedAsFluid);\n\n // Parse URL into data stores\n const parsed = parseUrl(resolvedAsFluid.url);\n if (parsed === undefined) {\n throw new Error(`Invalid URL ${resolvedAsFluid.url}`);\n }\n\n if (pendingLocalState !== undefined) {\n const parsedPendingUrl = parseUrl(pendingLocalState.url);\n if (parsedPendingUrl?.id !== parsed.id ||\n parsedPendingUrl?.path.replace(/\\/$/, \"\") !== parsed.path.replace(/\\/$/, \"\")) {\n const message = `URL ${resolvedAsFluid.url} does not match pending state URL ${pendingLocalState.url}`;\n throw new Error(message);\n }\n }\n\n const { canCache, fromSequenceNumber } = this.parseHeader(parsed, request);\n const shouldCache = pendingLocalState !== undefined ? false : canCache;\n\n let container: Container;\n if (shouldCache) {\n const key = this.getKeyForContainerCache(request, parsed);\n const maybeContainer = await this.containers.get(key);\n if (maybeContainer !== undefined) {\n container = maybeContainer;\n } else {\n const containerP =\n this.loadContainer(\n request,\n resolvedAsFluid);\n this.addToContainerCache(key, containerP);\n container = await containerP;\n }\n } else {\n container =\n await this.loadContainer(\n request,\n resolvedAsFluid,\n pendingLocalState);\n }\n\n if (container.deltaManager.lastSequenceNumber <= fromSequenceNumber) {\n await new Promise<void>((resolve, reject) => {\n function opHandler(message: ISequencedDocumentMessage) {\n if (message.sequenceNumber > fromSequenceNumber) {\n resolve();\n container.removeListener(\"op\", opHandler);\n }\n }\n\n container.on(\"op\", opHandler);\n });\n }\n\n return { container, parsed };\n }\n\n private get cachingEnabled() {\n return this.services.options.cache !== false;\n }\n\n private canCacheForRequest(headers: IRequestHeader): boolean {\n return this.cachingEnabled && headers[LoaderHeader.cache] !== false;\n }\n\n private parseHeader(parsed: IParsedUrl, request: IRequest) {\n let fromSequenceNumber = -1;\n\n request.headers = request.headers ?? {};\n\n const headerSeqNum = request.headers[LoaderHeader.sequenceNumber];\n if (headerSeqNum !== undefined) {\n fromSequenceNumber = headerSeqNum;\n }\n\n // If set in both query string and headers, use query string\n request.headers[LoaderHeader.version] = parsed.version ?? request.headers[LoaderHeader.version];\n\n const canCache = this.canCacheForRequest(request.headers);\n\n return {\n canCache,\n fromSequenceNumber,\n };\n }\n\n private async loadContainer(\n request: IRequest,\n resolved: IFluidResolvedUrl,\n pendingLocalState?: IPendingContainerState,\n ): Promise<Container> {\n return Container.load(\n this,\n {\n canReconnect: request.headers?.[LoaderHeader.reconnect],\n clientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n resolvedUrl: resolved,\n version: request.headers?.[LoaderHeader.version] ?? undefined,\n loadMode: request.headers?.[LoaderHeader.loadMode],\n },\n pendingLocalState,\n this.protocolHandlerBuilder,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AASlC,iFAS+C;AAC/C,qEASyC;AAQzC,+DAAsE;AACtE,2CAAgE;AAChE,mCAA+C;AAC/C,qDAA8C;AAG9C,SAAS,WAAW,CAAC,OAAiB;IACrC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;QAClC,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,oCAAY,CAAC,KAAK,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AI,YAAY,KAAK,SAAS,EAAE;YAC/B,kBAAkB,GAAG,YAAY,CAAC;SAClC;QAED,4DAA4D;QAC5D,OAAO,CAAC,OAAO,CAAC,oCAAY,CAAC,OAAO,CAAC;YACpC,MAAA,MAAM,CAAC,OAAO,mCAAI,OAAO,CAAC,OAAO,CAAC,oCAAY,CAAC,OAAO,CAAC,CAAC;QAEzD,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE1D,OAAO;YACN,QAAQ;YACR,kBAAkB;SAClB,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,aAAa,CAC1B,OAAiB,EACjB,QAA2B,EAC3B,iBAA0C;;QAE1C,OAAO,qBAAS,CAAC,IAAI,CACpB,IAAI,EACJ;YACC,YAAY,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,SAAS,CAAC;YACvD,qBAAqB,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,aAAa,CAAC;YACpE,WAAW,EAAE,QAAQ;YACrB,OAAO,EAAE,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,OAAO,CAAC,mCAAI,SAAS;YAC7D,QAAQ,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,oCAAY,CAAC,QAAQ,CAAC;SAClD,EACD,iBAAiB,EACjB,IAAI,CAAC,sBAAsB,CAC3B,CAAC;IACH,CAAC;CACD;AA5ND,wBA4NC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { ITelemetryBaseLogger, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n\tFluidObject,\n\tIFluidRouter,\n\tIRequest,\n\tIRequestHeader,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIContainer,\n\tIFluidModule,\n\tIHostLoader,\n\tILoader,\n\tILoaderOptions as ILoaderOptions1,\n\tLoaderHeader,\n\tIProvideFluidCodeDetailsComparer,\n\tIFluidCodeDetails,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tChildLogger,\n\tDebugLogger,\n\tIConfigProviderBase,\n\tloggerToMonitoringContext,\n\tmixinMonitoringContext,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tsessionStorageConfigProvider,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIFluidResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport { Container, IPendingContainerState } from \"./container\";\nimport { IParsedUrl, parseUrl } from \"./utils\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { ProtocolHandlerBuilder } from \"./protocol\";\n\nfunction canUseCache(request: IRequest): boolean {\n\tif (request.headers === undefined) {\n\t\treturn true;\n\t}\n\n\treturn request.headers[LoaderHeader.cache] !== false;\n}\n\n/**\n * @deprecated - In the next release RelativeLoader will no longer be exported. It is an internal class that should not be used directly.\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 get IFluidRouter(): IFluidRouter {\n\t\treturn this;\n\t}\n\n\tpublic async resolve(request: IRequest): Promise<IContainer> {\n\t\tif (request.url.startsWith(\"/\")) {\n\t\t\tif (canUseCache(request)) {\n\t\t\t\treturn this.container;\n\t\t\t} else {\n\t\t\t\tconst resolvedUrl = this.container.resolvedUrl;\n\t\t\t\tensureFluidResolvedUrl(resolvedUrl);\n\t\t\t\tconst container = await Container.load(this.loader as Loader, {\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\tresolvedUrl: { ...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\treturn container;\n\t\t\t}\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\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\tif (request.url.startsWith(\"/\")) {\n\t\t\tconst container = await this.resolve(request);\n\t\t\treturn container.request(request);\n\t\t}\n\n\t\tif (this.loader === undefined) {\n\t\t\treturn {\n\t\t\t\tstatus: 404,\n\t\t\t\tvalue: \"Cannot request external containers\",\n\t\t\t\tmimeType: \"plain/text\",\n\t\t\t};\n\t\t}\n\t\treturn this.loader.request(request);\n\t}\n}\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 */\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-definition#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 */\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 */\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 */\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: ITelemetryLogger;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\n}\n\n/**\n * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support\n * blobs in detached containers.\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 * With an already-resolved container, we can request a component directly, without loading the container again\n * @param container - a resolved container\n * @returns component on the container\n */\nexport async function requestResolvedObjectFromContainer(\n\tcontainer: IContainer,\n\theaders?: IRequestHeader,\n): Promise<IResponse> {\n\tensureFluidResolvedUrl(container.resolvedUrl);\n\tconst parsedUrl = parseUrl(container.resolvedUrl.url);\n\n\tif (parsedUrl === undefined) {\n\t\tthrow new Error(`Invalid URL ${container.resolvedUrl.url}`);\n\t}\n\n\treturn container.request({\n\t\turl: `${parsedUrl.path}${parsedUrl.query}`,\n\t\theaders,\n\t});\n}\n\n/**\n * Manages Fluid resource loading\n */\nexport class Loader implements IHostLoader {\n\tprivate readonly containers = new Map<string, Promise<Container>>();\n\tpublic readonly services: ILoaderServices;\n\tprivate readonly mc: MonitoringContext;\n\tprivate readonly protocolHandlerBuilder: ProtocolHandlerBuilder | undefined;\n\n\tconstructor(loaderProps: ILoaderProps) {\n\t\tconst scope: FluidObject<ILoader> = { ...loaderProps.scope };\n\t\tif (loaderProps.options?.provideScopeLoader !== false) {\n\t\t\tscope.ILoader = this;\n\t\t}\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\", loaderProps.logger, {\n\t\t\t\tall: telemetryProps,\n\t\t\t}),\n\t\t\tsessionStorageConfigProvider.value,\n\t\t\tloaderProps.configProvider,\n\t\t);\n\n\t\tthis.services = {\n\t\t\turlResolver: loaderProps.urlResolver,\n\t\t\tdocumentServiceFactory: loaderProps.documentServiceFactory,\n\t\t\tcodeLoader: loaderProps.codeLoader,\n\t\t\toptions: loaderProps.options ?? {},\n\t\t\tscope,\n\t\t\tsubLogger: subMc.logger,\n\t\t\tdetachedBlobStorage: loaderProps.detachedBlobStorage,\n\t\t};\n\t\tthis.mc = loggerToMonitoringContext(ChildLogger.create(this.services.subLogger, \"Loader\"));\n\t\tthis.protocolHandlerBuilder = loaderProps.protocolHandlerBuilder;\n\t}\n\n\tpublic get IFluidRouter(): IFluidRouter {\n\t\treturn this;\n\t}\n\n\tpublic async createDetachedContainer(codeDetails: IFluidCodeDetails): Promise<IContainer> {\n\t\tconst container = await Container.createDetached(\n\t\t\tthis,\n\t\t\tcodeDetails,\n\t\t\tthis.protocolHandlerBuilder,\n\t\t);\n\n\t\tif (this.cachingEnabled) {\n\t\t\tcontainer.once(\"attached\", () => {\n\t\t\t\tensureFluidResolvedUrl(container.resolvedUrl);\n\t\t\t\tconst parsedUrl = parseUrl(container.resolvedUrl.url);\n\t\t\t\tif (parsedUrl !== undefined) {\n\t\t\t\t\tthis.addToContainerCache(parsedUrl.id, Promise.resolve(container));\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn container;\n\t}\n\n\tpublic async rehydrateDetachedContainerFromSnapshot(snapshot: string): Promise<IContainer> {\n\t\treturn Container.rehydrateDetachedFromSnapshot(this, snapshot, this.protocolHandlerBuilder);\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\tconst resolved = await this.resolveCore(\n\t\t\t\trequest,\n\t\t\t\tpendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,\n\t\t\t);\n\t\t\treturn resolved.container;\n\t\t});\n\t}\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"Request\" },\n\t\t\tasync () => {\n\t\t\t\tconst resolved = await this.resolveCore(request);\n\t\t\t\treturn resolved.container.request({\n\t\t\t\t\t...request,\n\t\t\t\t\turl: `${resolved.parsed.path}${resolved.parsed.query}`,\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t}\n\n\tprivate getKeyForContainerCache(request: IRequest, parsedUrl: IParsedUrl): string {\n\t\tconst key =\n\t\t\trequest.headers?.[LoaderHeader.version] !== undefined\n\t\t\t\t? `${parsedUrl.id}@${request.headers[LoaderHeader.version]}`\n\t\t\t\t: parsedUrl.id;\n\t\treturn key;\n\t}\n\n\tprivate addToContainerCache(key: string, containerP: Promise<Container>) {\n\t\tthis.containers.set(key, containerP);\n\t\tcontainerP\n\t\t\t.then((container) => {\n\t\t\t\t// If the container is closed or becomes closed after we resolve it, remove it from the cache.\n\t\t\t\tif (container.closed) {\n\t\t\t\t\tthis.containers.delete(key);\n\t\t\t\t} else {\n\t\t\t\t\tcontainer.once(\"closed\", () => {\n\t\t\t\t\t\tthis.containers.delete(key);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch((error) => {});\n\t}\n\n\tprivate async resolveCore(\n\t\trequest: IRequest,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<{ container: Container; parsed: IParsedUrl }> {\n\t\tconst resolvedAsFluid = await this.services.urlResolver.resolve(request);\n\t\tensureFluidResolvedUrl(resolvedAsFluid);\n\n\t\t// Parse URL into data stores\n\t\tconst parsed = parseUrl(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 = parseUrl(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\tconst { canCache, fromSequenceNumber } = this.parseHeader(parsed, request);\n\t\tconst shouldCache = pendingLocalState !== undefined ? false : canCache;\n\n\t\tlet container: Container;\n\t\tif (shouldCache) {\n\t\t\tconst key = this.getKeyForContainerCache(request, parsed);\n\t\t\tconst maybeContainer = await this.containers.get(key);\n\t\t\tif (maybeContainer !== undefined) {\n\t\t\t\tcontainer = maybeContainer;\n\t\t\t} else {\n\t\t\t\tconst containerP = this.loadContainer(request, resolvedAsFluid);\n\t\t\t\tthis.addToContainerCache(key, containerP);\n\t\t\t\tcontainer = await containerP;\n\t\t\t}\n\t\t} else {\n\t\t\tcontainer = await this.loadContainer(request, resolvedAsFluid, pendingLocalState);\n\t\t}\n\n\t\tif (container.deltaManager.lastSequenceNumber <= fromSequenceNumber) {\n\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\tfunction opHandler(message: ISequencedDocumentMessage) {\n\t\t\t\t\tif (message.sequenceNumber > fromSequenceNumber) {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t\tcontainer.removeListener(\"op\", opHandler);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcontainer.on(\"op\", opHandler);\n\t\t\t});\n\t\t}\n\n\t\treturn { container, parsed };\n\t}\n\n\tprivate get cachingEnabled() {\n\t\treturn this.services.options.cache !== false;\n\t}\n\n\tprivate canCacheForRequest(headers: IRequestHeader): boolean {\n\t\treturn this.cachingEnabled && headers[LoaderHeader.cache] !== false;\n\t}\n\n\tprivate parseHeader(parsed: IParsedUrl, request: IRequest) {\n\t\tlet fromSequenceNumber = -1;\n\n\t\trequest.headers = request.headers ?? {};\n\n\t\tconst headerSeqNum = request.headers[LoaderHeader.sequenceNumber];\n\t\tif (headerSeqNum !== undefined) {\n\t\t\tfromSequenceNumber = headerSeqNum;\n\t\t}\n\n\t\t// If set in both query string and headers, use query string\n\t\trequest.headers[LoaderHeader.version] =\n\t\t\tparsed.version ?? request.headers[LoaderHeader.version];\n\n\t\tconst canCache = this.canCacheForRequest(request.headers);\n\n\t\treturn {\n\t\t\tcanCache,\n\t\t\tfromSequenceNumber,\n\t\t};\n\t}\n\n\tprivate async loadContainer(\n\t\trequest: IRequest,\n\t\tresolved: IFluidResolvedUrl,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\treturn Container.load(\n\t\t\tthis,\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\tresolvedUrl: resolved,\n\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t},\n\t\t\tpendingLocalState,\n\t\t\tthis.protocolHandlerBuilder,\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-dev.2.3.0.115467";
8
+ export declare const pkgVersion = "2.0.0-dev.4.1.0.148229";
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-dev.2.3.0.115467";
11
+ exports.pkgVersion = "2.0.0-dev.4.1.0.148229";
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,wBAAwB,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-dev.2.3.0.115467\";\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,wBAAwB,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-dev.4.1.0.148229\";\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,uCAAuC,CAAC;AACvE,OAAO,EAEH,gBAAgB,IAAI,oBAAoB,EACxC,eAAe,EACf,iBAAiB,EACpB,MAAM,+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AU;IACrB,UAAU,SAAS;IACnB,WAAW,UAAU;IACrB,KAAK,UAAU;CACf;AAED;;GAEG;AACH,oBAAY,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,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;IAKhF,QAAQ,CAAC,QAAQ,EAAE,cAAc;gBAHjC,UAAU,EAAE,mBAAmB,EAC/B,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,MAAM,EACxC,QAAQ,EAAE,cAAc;IAsB3B,cAAc,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,GACZ,qBAAqB;IAoBjB,aAAa,CAAC,OAAO,EAAE,cAAc;CAgC5C"}
package/dist/protocol.js CHANGED
@@ -71,7 +71,8 @@ class ProtocolHandler extends protocol_base_1.ProtocolOpHandler {
71
71
  }
72
72
  break;
73
73
  }
74
- default: break;
74
+ default:
75
+ break;
75
76
  }
76
77
  }
77
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iEAKuC;AACvC,+EAO8C;AAC9C,+DAAuE;AAEvE,mDAAmD;AACnD,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AACnB,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB;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,YAAY,CAAC,YAAY,CAAC,CAAC;iBAC5C;gBACD,MAAM;aACT;YACD,OAAO,CAAC,CAAC,MAAM;SAClB;IACL,CAAC;CACJ;AA5ED,0CA4EC","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\";\nimport {\n ILocalSequencedClient,\n IProtocolHandler as IBaseProtocolHandler,\n IQuorumSnapshot,\n ProtocolOpHandler,\n} from \"@fluidframework/protocol-base\";\nimport {\n IDocumentAttributes,\n IProcessMessageResult,\n ISequencedDocumentMessage,\n ISignalClient,\n ISignalMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\n\n// ADO: #1986: Start using enum from protocol-base.\nexport enum SignalType {\n ClientJoin = \"join\", // same value as MessageType.ClientJoin,\n ClientLeave = \"leave\", // same value as MessageType.ClientLeave,\n Clear = \"clear\", // used only by client for synthetic signals\n}\n\n/**\n * Function to be used for creating a protocol handler.\n */\nexport type ProtocolHandlerBuilder = (\n attributes: IDocumentAttributes,\n snapshot: IQuorumSnapshot,\n sendProposal: (key: string, value: any) => number,\n) => IProtocolHandler;\n\nexport interface IProtocolHandler extends IBaseProtocolHandler {\n readonly audience: IAudienceOwner;\n processSignal(message: ISignalMessage);\n}\n\nexport class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandler {\n constructor(\n attributes: IDocumentAttributes,\n quorumSnapshot: IQuorumSnapshot,\n sendProposal: (key: string, value: any) => number,\n readonly audience: IAudienceOwner,\n ) {\n super(\n attributes.minimumSequenceNumber,\n attributes.sequenceNumber,\n attributes.term,\n quorumSnapshot.members,\n quorumSnapshot.proposals,\n quorumSnapshot.values,\n sendProposal,\n );\n\n // Join / leave signals are ignored for \"write\" clients in favor of join / leave ops\n this.quorum.on(\"addMember\", (clientId, details) => audience.addMember(clientId, details.client));\n this.quorum.on(\"removeMember\", (clientId) => audience.removeMember(clientId));\n for (const [clientId, details] of this.quorum.getMembers()) {\n this.audience.addMember(clientId, details.client);\n }\n }\n\n public processMessage(message: ISequencedDocumentMessage, local: boolean): IProcessMessageResult {\n const client: ILocalSequencedClient | undefined = this.quorum.getMember(message.clientId);\n\n // Check and report if we're getting messages from a clientId that we previously\n // flagged as shouldHaveLeft, or from a client that's not in the quorum but should be\n if (message.clientId != null) {\n if (client === undefined && message.type !== MessageType.ClientJoin) {\n // pre-0.58 error message: messageClientIdMissingFromQuorum\n throw new Error(\"Remote message's clientId is missing from the quorum\");\n }\n\n if (client?.shouldHaveLeft === true && !canBeCoalescedByService(message)) {\n // pre-0.58 error message: messageClientIdShouldHaveLeft\n throw new Error(\"Remote message's clientId already should have left\");\n }\n }\n\n return super.processMessage(message, local);\n }\n\n public processSignal(message: ISignalMessage) {\n const innerContent = message.content as { content: any; type: string; };\n switch (innerContent.type) {\n case SignalType.Clear: {\n const members = this.audience.getMembers();\n for (const [clientId, client] of members) {\n if (client.mode === \"read\") {\n this.audience.removeMember(clientId);\n }\n }\n break;\n }\n case SignalType.ClientJoin: {\n const newClient = innerContent.content as ISignalClient;\n // Ignore write clients - quorum will control such clients.\n if (newClient.client.mode === \"read\") {\n this.audience.addMember(newClient.clientId, newClient.client);\n }\n break;\n }\n case SignalType.ClientLeave: {\n const leftClientId = innerContent.content as string;\n // Ignore write clients - quorum will control such clients.\n if (this.audience.getMember(leftClientId)?.mode === \"read\") {\n this.audience.removeMember(leftClientId);\n }\n break;\n }\n default: break;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iEAKuC;AACvC,+EAO8C;AAC9C,+DAAuE;AAEvE,mDAAmD;AACnD,IAAY,UAIX;AAJD,WAAY,UAAU;IACrB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AAChB,CAAC,EAJW,UAAU,G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AM,EAAE;oBAC3D,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;iBACzC;gBACD,MAAM;aACN;YACD;gBACC,MAAM;SACP;IACF,CAAC;CACD;AAlFD,0CAkFC","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\";\nimport {\n\tILocalSequencedClient,\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\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\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 */\nexport type ProtocolHandlerBuilder = (\n\tattributes: IDocumentAttributes,\n\tsnapshot: IQuorumSnapshot,\n\tsendProposal: (key: string, value: any) => number,\n) => IProtocolHandler;\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\treadonly audience: IAudienceOwner,\n\t) {\n\t\tsuper(\n\t\t\tattributes.minimumSequenceNumber,\n\t\t\tattributes.sequenceNumber,\n\t\t\tattributes.term,\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\tconst client: ILocalSequencedClient | undefined = this.quorum.getMember(message.clientId);\n\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\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\tif (client?.shouldHaveLeft === true && !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"]}
@@ -5,10 +5,14 @@
5
5
  import { IDisposable } from "@fluidframework/common-definitions";
6
6
  import { IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions";
7
7
  import { ISummaryTree } from "@fluidframework/protocol-definitions";
8
+ /**
9
+ * A storage service wrapper whose sole job is to intercept calls to uploadSummaryWithContext and ensure they include
10
+ * the protocol summary, using the provided callback to add it if necessary.
11
+ */
8
12
  export declare class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {
9
13
  private readonly internalStorageService;
10
- private readonly generateProtocolTree;
11
- constructor(internalStorageService: IDocumentStorageService & IDisposable, generateProtocolTree: () => ISummaryTree);
14
+ private readonly addProtocolSummaryIfMissing;
15
+ constructor(internalStorageService: IDocumentStorageService & IDisposable, addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree);
12
16
  get policies(): import("@fluidframework/driver-definitions").IDocumentStorageServicePolicies | undefined;
13
17
  get repositoryUrl(): string;
14
18
  get disposed(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"protocolTreeDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EACH,uBAAuB,EACvB,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAE5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AClF,eAAe,mGAAiF;IAChG,OAAO,sCAAyE;IAE1E,wBAAwB,CAC7B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;CAMlB"}
@@ -5,11 +5,14 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ProtocolTreeStorageService = void 0;
8
- const driver_utils_1 = require("@fluidframework/driver-utils");
8
+ /**
9
+ * A storage service wrapper whose sole job is to intercept calls to uploadSummaryWithContext and ensure they include
10
+ * the protocol summary, using the provided callback to add it if necessary.
11
+ */
9
12
  class ProtocolTreeStorageService {
10
- constructor(internalStorageService, generateProtocolTree) {
13
+ constructor(internalStorageService, addProtocolSummaryIfMissing) {
11
14
  this.internalStorageService = internalStorageService;
12
- this.generateProtocolTree = generateProtocolTree;
15
+ this.addProtocolSummaryIfMissing = addProtocolSummaryIfMissing;
13
16
  this.getSnapshotTree = this.internalStorageService.getSnapshotTree.bind(this.internalStorageService);
14
17
  this.getVersions = this.internalStorageService.getVersions.bind(this.internalStorageService);
15
18
  this.createBlob = this.internalStorageService.createBlob.bind(this.internalStorageService);
@@ -27,7 +30,7 @@ class ProtocolTreeStorageService {
27
30
  return this.internalStorageService.disposed;
28
31
  }
29
32
  async uploadSummaryWithContext(summary, context) {
30
- return this.internalStorageService.uploadSummaryWithContext((0, driver_utils_1.combineAppAndProtocolSummary)(summary, this.generateProtocolTree()), context);
33
+ return this.internalStorageService.uploadSummaryWithContext(this.addProtocolSummaryIfMissing(summary), context);
31
34
  }
32
35
  }
33
36
  exports.ProtocolTreeStorageService = ProtocolTreeStorageService;
@@ -1 +1 @@
1
- {"version":3,"file":"protocolTreeDocumentStorageService.js","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+DAA4E;AAK5E,MAAa,0BAA0B;IACnC,YACqB,sBAA6D,EAC7D,oBAAwC;QADxC,2BAAsB,GAAtB,sBAAsB,CAAuC;QAC7D,yBAAoB,GAApB,oBAAoB,CAAoB;QAa7D,oBAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChG,gBAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACxF,eAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACtF,aAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAClF,oBAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChG,YAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAhBhF,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAChD,CAAC;IACD,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;IACrD,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAChD,CAAC;IASD,KAAK,CAAC,wBAAwB,CAAC,OAAqB,EAAE,OAAwB;QAC1E,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CACvD,IAAA,2CAA4B,EAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAClE,OAAO,CACV,CAAC;IACN,CAAC;CACJ;AA7BD,gEA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/common-definitions\";\nimport {\n IDocumentStorageService,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport { combineAppAndProtocolSummary } from \"@fluidframework/driver-utils\";\nimport {\n ISummaryTree,\n} from \"@fluidframework/protocol-definitions\";\n\nexport class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {\n constructor(\n private readonly internalStorageService: IDocumentStorageService & IDisposable,\n private readonly generateProtocolTree: () => ISummaryTree,\n ) {\n }\n public get policies() {\n return this.internalStorageService.policies;\n }\n public get repositoryUrl() {\n return this.internalStorageService.repositoryUrl;\n }\n public get disposed() {\n return this.internalStorageService.disposed;\n }\n\n getSnapshotTree = this.internalStorageService.getSnapshotTree.bind(this.internalStorageService);\n getVersions = this.internalStorageService.getVersions.bind(this.internalStorageService);\n createBlob = this.internalStorageService.createBlob.bind(this.internalStorageService);\n readBlob = this.internalStorageService.readBlob.bind(this.internalStorageService);\n downloadSummary = this.internalStorageService.downloadSummary.bind(this.internalStorageService);\n dispose = this.internalStorageService.dispose.bind(this.internalStorageService);\n\n async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n return this.internalStorageService.uploadSummaryWithContext(\n combineAppAndProtocolSummary(summary, this.generateProtocolTree()),\n context,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"protocolTreeDocumentStorageService.js","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH;;;GAGG;AACH,MAAa,0BAA0B;IACtC,YACkB,sBAA6D,EAC7D,2BAAwE;QADxE,2BAAsB,GAAtB,sBAAsB,CAAuC;QAC7D,gCAA2B,GAA3B,2BAA2B,CAA6C;QAY1F,oBAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChG,gBAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACxF,eAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACtF,aAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAClF,oBAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChG,YAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAhB7E,CAAC;IACJ,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IACD,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;IAClD,CAAC;IACD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IASD,KAAK,CAAC,wBAAwB,CAC7B,OAAqB,EACrB,OAAwB;QAExB,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAC1D,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,EACzC,OAAO,CACP,CAAC;IACH,CAAC;CACD;AA/BD,gEA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/common-definitions\";\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * A storage service wrapper whose sole job is to intercept calls to uploadSummaryWithContext and ensure they include\n * the protocol summary, using the provided callback to add it if necessary.\n */\nexport class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService & IDisposable,\n\t\tprivate readonly addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree,\n\t) {}\n\tpublic get policies() {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get repositoryUrl() {\n\t\treturn this.internalStorageService.repositoryUrl;\n\t}\n\tpublic get disposed() {\n\t\treturn this.internalStorageService.disposed;\n\t}\n\n\tgetSnapshotTree = this.internalStorageService.getSnapshotTree.bind(this.internalStorageService);\n\tgetVersions = this.internalStorageService.getVersions.bind(this.internalStorageService);\n\tcreateBlob = this.internalStorageService.createBlob.bind(this.internalStorageService);\n\treadBlob = this.internalStorageService.readBlob.bind(this.internalStorageService);\n\tdownloadSummary = this.internalStorageService.downloadSummary.bind(this.internalStorageService);\n\tdispose = this.internalStorageService.dispose.bind(this.internalStorageService);\n\n\tasync uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\treturn this.internalStorageService.uploadSummaryWithContext(\n\t\t\tthis.addProtocolSummaryIfMissing(summary),\n\t\t\tcontext,\n\t\t);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"quorum.d.ts","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAU,cAAc,EAAmB,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACH,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,gBAAgB,EACnB,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,qBAAa,WAAY,SAAQ,cAAc,CAAC,aAAa,CAAE,YAAW,OAAO;IAC7E,SAAgB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,SAAgB,GAAG,EAAE,CAAC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AAM,UAAU,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,IAAA,qBAAM,EAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACxE,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAA0B,CAAC;AAChD,CAAC;AAPD,wEAOC;AAED,SAAgB,+BAA+B,CAC3C,MAAyB;IAEzB,kEAAkE;IAClE,MAAM,qBAAqB,GAAuB;QAC9C,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,MAAM;QACb,sBAAsB,EAAE,CAAC;QACzB,oBAAoB,EAAE,CAAC;QACvB,cAAc,EAAE,CAAC;KACpB,CAAC;IACF,OAAO,CAAC,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC7C,CAAC;AAZD,0EAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert, EventForwarder, doIfNotDisposed } from \"@fluidframework/common-utils\";\nimport { IFluidCodeDetails } from \"@fluidframework/core-interfaces\";\nimport {\n ICommittedProposal,\n IQuorum,\n IQuorumEvents,\n ISequencedClient,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Proxies Quorum events.\n */\nexport class QuorumProxy extends EventForwarder<IQuorumEvents> implements IQuorum {\n public readonly propose: (key: string, value: any) => Promise<void>;\n public readonly has: (key: string) => boolean;\n public readonly get: (key: string) => any;\n public readonly getMembers: () => Map<string, ISequencedClient>;\n public readonly getMember: (clientId: string) => ISequencedClient | undefined;\n\n constructor(quorum: IQuorum) {\n super(quorum);\n\n // This is heavily used object, increase limit at which Node prints warnings.\n super.setMaxListeners(50);\n\n this.propose = doIfNotDisposed(this, quorum.propose.bind(quorum));\n this.has = doIfNotDisposed(this, quorum.has.bind(quorum));\n this.get = doIfNotDisposed(this, quorum.get.bind(quorum));\n this.getMembers = doIfNotDisposed(this, quorum.getMembers.bind(quorum));\n this.getMember = doIfNotDisposed(this, quorum.getMember.bind(quorum));\n }\n}\n\nexport function getCodeDetailsFromQuorumValues(\n quorumValues: [string, ICommittedProposal][],\n): IFluidCodeDetails {\n const qValuesMap = new Map(quorumValues);\n const proposal = qValuesMap.get(\"code\");\n assert(proposal !== undefined, 0x2dc /* \"Cannot find code proposal\" */);\n return proposal?.value as IFluidCodeDetails;\n}\n\nexport function initQuorumValuesFromCodeDetails(\n source: IFluidCodeDetails,\n): [string, ICommittedProposal][] {\n // Seed the base quorum to be an empty list with a code quorum set\n const committedCodeProposal: ICommittedProposal = {\n key: \"code\",\n value: source,\n approvalSequenceNumber: 0,\n commitSequenceNumber: 0,\n sequenceNumber: 0,\n };\n return [[\"code\", committedCodeProposal]];\n}\n"]}
1
+ {"version":3,"file":"quorum.js","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAuF;AASvF;;GAEG;AACH,MAAa,WAAY,SAAQ,6BAA6B;IAO7D,YAAY,MAAe;QAC1B,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,6EAA6E;QAC7E,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAE1B,IAAI,CAAC,OAAO,GAAG,IAAA,8BAAe,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAClE,IAAI,CAAC,GAAG,GAAG,IAAA,8BAAe,EAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,GAAG,GAAG,IAAA,8BAAe,EAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,UAAU,GAAG,IAAA,8BAAe,EAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,SAAS,GAAG,IAAA,8BAAe,EAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;CACD;AAnBD,kCAmBC;AAED,SAAgB,8BAA8B,CAC7C,YAA4C;IAE5C,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,IAAA,qBAAM,EAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACxE,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAA0B,CAAC;AAC7C,CAAC;AAPD,wEAOC;AAED,SAAgB,+BAA+B,CAC9C,MAAyB;IAEzB,kEAAkE;IAClE,MAAM,qBAAqB,GAAuB;QACjD,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,MAAM;QACb,sBAAsB,EAAE,CAAC;QACzB,oBAAoB,EAAE,CAAC;QACvB,cAAc,EAAE,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC1C,CAAC;AAZD,0EAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert, EventForwarder, doIfNotDisposed } from \"@fluidframework/common-utils\";\nimport { IFluidCodeDetails } from \"@fluidframework/core-interfaces\";\nimport {\n\tICommittedProposal,\n\tIQuorum,\n\tIQuorumEvents,\n\tISequencedClient,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Proxies Quorum events.\n */\nexport class QuorumProxy extends EventForwarder<IQuorumEvents> implements IQuorum {\n\tpublic readonly propose: (key: string, value: any) => Promise<void>;\n\tpublic readonly has: (key: string) => boolean;\n\tpublic readonly get: (key: string) => any;\n\tpublic readonly getMembers: () => Map<string, ISequencedClient>;\n\tpublic readonly getMember: (clientId: string) => ISequencedClient | undefined;\n\n\tconstructor(quorum: IQuorum) {\n\t\tsuper(quorum);\n\n\t\t// This is heavily used object, increase limit at which Node prints warnings.\n\t\tsuper.setMaxListeners(50);\n\n\t\tthis.propose = doIfNotDisposed(this, quorum.propose.bind(quorum));\n\t\tthis.has = doIfNotDisposed(this, quorum.has.bind(quorum));\n\t\tthis.get = doIfNotDisposed(this, quorum.get.bind(quorum));\n\t\tthis.getMembers = doIfNotDisposed(this, quorum.getMembers.bind(quorum));\n\t\tthis.getMember = doIfNotDisposed(this, quorum.getMember.bind(quorum));\n\t}\n}\n\nexport function getCodeDetailsFromQuorumValues(\n\tquorumValues: [string, ICommittedProposal][],\n): IFluidCodeDetails {\n\tconst qValuesMap = new Map(quorumValues);\n\tconst proposal = qValuesMap.get(\"code\");\n\tassert(proposal !== undefined, 0x2dc /* \"Cannot find code proposal\" */);\n\treturn proposal?.value as IFluidCodeDetails;\n}\n\nexport function initQuorumValuesFromCodeDetails(\n\tsource: IFluidCodeDetails,\n): [string, ICommittedProposal][] {\n\t// Seed the base quorum to be an empty list with a code quorum set\n\tconst committedCodeProposal: ICommittedProposal = {\n\t\tkey: \"code\",\n\t\tvalue: source,\n\t\tapprovalSequenceNumber: 0,\n\t\tcommitSequenceNumber: 0,\n\t\tsequenceNumber: 0,\n\t};\n\treturn [[\"code\", committedCodeProposal]];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"retriableDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACH,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACX,MAAM,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;
19
19
  }
20
- get disposed() { return this._disposed; }
20
+ get disposed() {
21
+ return this._disposed;
22
+ }
21
23
  dispose() {
22
24
  this._disposed = true;
23
25
  }
@@ -63,7 +65,9 @@ class RetriableDocumentStorageService {
63
65
  fetchCallName: callName, // fetchCallName matches logs in runWithRetry.ts
64
66
  }, error);
65
67
  // pre-0.58 error message: storageServiceDisposedCannotRetry
66
- throw new container_utils_1.GenericError("Storage Service is disposed. Cannot retry", { canRetry: false });
68
+ throw new container_utils_1.GenericError("Storage Service is disposed. Cannot retry", {
69
+ canRetry: false,
70
+ });
67
71
  }
68
72
  return;
69
73
  }