@fluidframework/container-loader 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.224419

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 (333) hide show
  1. package/.eslintrc.js +18 -21
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +364 -0
  4. package/README.md +152 -56
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/container-loader.api.md +143 -0
  8. package/dist/{audience.js → audience.cjs} +15 -13
  9. package/dist/audience.cjs.map +1 -0
  10. package/dist/audience.d.ts +4 -6
  11. package/dist/audience.d.ts.map +1 -1
  12. package/dist/catchUpMonitor.cjs +43 -0
  13. package/dist/catchUpMonitor.cjs.map +1 -0
  14. package/dist/catchUpMonitor.d.ts +29 -0
  15. package/dist/catchUpMonitor.d.ts.map +1 -0
  16. package/dist/{connectionManager.js → connectionManager.cjs} +397 -240
  17. package/dist/connectionManager.cjs.map +1 -0
  18. package/dist/connectionManager.d.ts +23 -33
  19. package/dist/connectionManager.d.ts.map +1 -1
  20. package/dist/{connectionState.js → connectionState.cjs} +5 -7
  21. package/dist/connectionState.cjs.map +1 -0
  22. package/dist/connectionState.d.ts +3 -5
  23. package/dist/connectionState.d.ts.map +1 -1
  24. package/dist/connectionStateHandler.cjs +474 -0
  25. package/dist/connectionStateHandler.cjs.map +1 -0
  26. package/dist/connectionStateHandler.d.ts +127 -29
  27. package/dist/connectionStateHandler.d.ts.map +1 -1
  28. package/dist/container-loader-alpha.d.ts +274 -0
  29. package/dist/container-loader-beta.d.ts +75 -0
  30. package/dist/container-loader-public.d.ts +75 -0
  31. package/dist/container-loader-untrimmed.d.ts +331 -0
  32. package/dist/container.cjs +1585 -0
  33. package/dist/container.cjs.map +1 -0
  34. package/dist/container.d.ts +227 -83
  35. package/dist/container.d.ts.map +1 -1
  36. package/dist/containerContext.cjs +74 -0
  37. package/dist/containerContext.cjs.map +1 -0
  38. package/dist/containerContext.d.ts +33 -59
  39. package/dist/containerContext.d.ts.map +1 -1
  40. package/dist/containerStorageAdapter.cjs +234 -0
  41. package/dist/containerStorageAdapter.cjs.map +1 -0
  42. package/dist/containerStorageAdapter.d.ts +48 -23
  43. package/dist/containerStorageAdapter.d.ts.map +1 -1
  44. package/dist/{contracts.js → contracts.cjs} +5 -5
  45. package/dist/contracts.cjs.map +1 -0
  46. package/dist/contracts.d.ts +45 -17
  47. package/dist/contracts.d.ts.map +1 -1
  48. package/dist/debugLogger.cjs +101 -0
  49. package/dist/debugLogger.cjs.map +1 -0
  50. package/dist/debugLogger.d.ts +30 -0
  51. package/dist/debugLogger.d.ts.map +1 -0
  52. package/dist/{deltaManager.js → deltaManager.cjs} +379 -186
  53. package/dist/deltaManager.cjs.map +1 -0
  54. package/dist/deltaManager.d.ts +54 -18
  55. package/dist/deltaManager.d.ts.map +1 -1
  56. package/dist/{deltaQueue.js → deltaQueue.cjs} +29 -28
  57. package/dist/deltaQueue.cjs.map +1 -0
  58. package/dist/deltaQueue.d.ts +3 -4
  59. package/dist/deltaQueue.d.ts.map +1 -1
  60. package/dist/disposal.cjs +25 -0
  61. package/dist/disposal.cjs.map +1 -0
  62. package/dist/disposal.d.ts +13 -0
  63. package/dist/disposal.d.ts.map +1 -0
  64. package/dist/error.cjs +32 -0
  65. package/dist/error.cjs.map +1 -0
  66. package/dist/error.d.ts +23 -0
  67. package/dist/error.d.ts.map +1 -0
  68. package/dist/index.cjs +19 -0
  69. package/dist/index.cjs.map +1 -0
  70. package/dist/index.d.ts +5 -2
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/loader.cjs +148 -0
  73. package/dist/loader.cjs.map +1 -0
  74. package/dist/loader.d.ts +38 -19
  75. package/dist/loader.d.ts.map +1 -1
  76. package/dist/location-redirection-utilities/index.cjs +11 -0
  77. package/dist/location-redirection-utilities/index.cjs.map +1 -0
  78. package/dist/location-redirection-utilities/index.d.ts +6 -0
  79. package/dist/location-redirection-utilities/index.d.ts.map +1 -0
  80. package/dist/location-redirection-utilities/resolveWithLocationRedirection.cjs +53 -0
  81. package/dist/location-redirection-utilities/resolveWithLocationRedirection.cjs.map +1 -0
  82. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +24 -0
  83. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
  84. package/dist/{collabWindowTracker.js → noopHeuristic.cjs} +37 -39
  85. package/dist/noopHeuristic.cjs.map +1 -0
  86. package/dist/noopHeuristic.d.ts +23 -0
  87. package/dist/noopHeuristic.d.ts.map +1 -0
  88. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  89. package/dist/packageVersion.cjs.map +1 -0
  90. package/dist/packageVersion.d.ts +1 -1
  91. package/dist/packageVersion.d.ts.map +1 -1
  92. package/dist/protocol.cjs +99 -0
  93. package/dist/protocol.cjs.map +1 -0
  94. package/dist/protocol.d.ts +38 -0
  95. package/dist/protocol.d.ts.map +1 -0
  96. package/dist/{protocolTreeDocumentStorageService.js → protocolTreeDocumentStorageService.cjs} +8 -5
  97. package/dist/protocolTreeDocumentStorageService.cjs.map +1 -0
  98. package/dist/protocolTreeDocumentStorageService.d.ts +8 -4
  99. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  100. package/dist/quorum.cjs +16 -0
  101. package/dist/quorum.cjs.map +1 -0
  102. package/dist/quorum.d.ts +1 -14
  103. package/dist/quorum.d.ts.map +1 -1
  104. package/dist/{retriableDocumentStorageService.js → retriableDocumentStorageService.cjs} +36 -21
  105. package/dist/retriableDocumentStorageService.cjs.map +1 -0
  106. package/dist/retriableDocumentStorageService.d.ts +7 -5
  107. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  108. package/dist/tsdoc-metadata.json +11 -0
  109. package/dist/{utils.js → utils.cjs} +52 -14
  110. package/dist/utils.cjs.map +1 -0
  111. package/dist/utils.d.ts +34 -1
  112. package/dist/utils.d.ts.map +1 -1
  113. package/lib/{audience.d.ts → audience.d.mts} +4 -10
  114. package/lib/audience.d.mts.map +1 -0
  115. package/lib/{audience.js → audience.mjs} +15 -17
  116. package/lib/audience.mjs.map +1 -0
  117. package/lib/catchUpMonitor.d.mts +29 -0
  118. package/lib/catchUpMonitor.d.mts.map +1 -0
  119. package/lib/catchUpMonitor.mjs +39 -0
  120. package/lib/catchUpMonitor.mjs.map +1 -0
  121. package/lib/{connectionManager.d.ts → connectionManager.d.mts} +23 -33
  122. package/lib/connectionManager.d.mts.map +1 -0
  123. package/lib/{connectionManager.js → connectionManager.mjs} +378 -218
  124. package/lib/connectionManager.mjs.map +1 -0
  125. package/lib/{connectionState.d.ts → connectionState.d.mts} +3 -5
  126. package/lib/connectionState.d.mts.map +1 -0
  127. package/lib/{connectionState.js → connectionState.mjs} +4 -6
  128. package/lib/connectionState.mjs.map +1 -0
  129. package/lib/connectionStateHandler.d.mts +179 -0
  130. package/lib/connectionStateHandler.d.mts.map +1 -0
  131. package/lib/connectionStateHandler.mjs +469 -0
  132. package/lib/connectionStateHandler.mjs.map +1 -0
  133. package/lib/container-loader-alpha.d.mts +274 -0
  134. package/lib/container-loader-beta.d.mts +75 -0
  135. package/lib/container-loader-public.d.mts +75 -0
  136. package/lib/container-loader-untrimmed.d.mts +331 -0
  137. package/lib/container.d.mts +382 -0
  138. package/lib/container.d.mts.map +1 -0
  139. package/lib/container.mjs +1579 -0
  140. package/lib/container.mjs.map +1 -0
  141. package/lib/containerContext.d.mts +58 -0
  142. package/lib/containerContext.d.mts.map +1 -0
  143. package/lib/containerContext.mjs +70 -0
  144. package/lib/containerContext.mjs.map +1 -0
  145. package/lib/containerStorageAdapter.d.mts +73 -0
  146. package/lib/containerStorageAdapter.d.mts.map +1 -0
  147. package/lib/containerStorageAdapter.mjs +228 -0
  148. package/lib/containerStorageAdapter.mjs.map +1 -0
  149. package/lib/{contracts.d.ts → contracts.d.mts} +45 -17
  150. package/lib/contracts.d.mts.map +1 -0
  151. package/lib/{contracts.js → contracts.mjs} +4 -4
  152. package/lib/contracts.mjs.map +1 -0
  153. package/lib/debugLogger.d.mts +30 -0
  154. package/lib/debugLogger.d.mts.map +1 -0
  155. package/lib/debugLogger.mjs +93 -0
  156. package/lib/debugLogger.mjs.map +1 -0
  157. package/lib/{deltaManager.d.ts → deltaManager.d.mts} +54 -18
  158. package/lib/deltaManager.d.mts.map +1 -0
  159. package/lib/{deltaManager.js → deltaManager.mjs} +361 -165
  160. package/lib/deltaManager.mjs.map +1 -0
  161. package/lib/{deltaQueue.d.ts → deltaQueue.d.mts} +3 -4
  162. package/lib/deltaQueue.d.mts.map +1 -0
  163. package/lib/{deltaQueue.js → deltaQueue.mjs} +25 -24
  164. package/lib/deltaQueue.mjs.map +1 -0
  165. package/lib/disposal.d.mts +13 -0
  166. package/lib/disposal.d.mts.map +1 -0
  167. package/lib/disposal.mjs +21 -0
  168. package/lib/disposal.mjs.map +1 -0
  169. package/lib/error.d.mts +23 -0
  170. package/lib/error.d.mts.map +1 -0
  171. package/lib/error.mjs +28 -0
  172. package/lib/error.mjs.map +1 -0
  173. package/lib/index.d.mts +11 -0
  174. package/lib/index.d.mts.map +1 -0
  175. package/lib/index.mjs +10 -0
  176. package/lib/index.mjs.map +1 -0
  177. package/lib/{loader.d.ts → loader.d.mts} +39 -20
  178. package/lib/loader.d.mts.map +1 -0
  179. package/lib/loader.mjs +143 -0
  180. package/lib/loader.mjs.map +1 -0
  181. package/lib/location-redirection-utilities/index.d.mts +6 -0
  182. package/lib/location-redirection-utilities/index.d.mts.map +1 -0
  183. package/lib/location-redirection-utilities/index.mjs +6 -0
  184. package/lib/location-redirection-utilities/index.mjs.map +1 -0
  185. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts +24 -0
  186. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts.map +1 -0
  187. package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs +48 -0
  188. package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +1 -0
  189. package/lib/noopHeuristic.d.mts +23 -0
  190. package/lib/noopHeuristic.d.mts.map +1 -0
  191. package/lib/{collabWindowTracker.js → noopHeuristic.mjs} +33 -35
  192. package/lib/noopHeuristic.mjs.map +1 -0
  193. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
  194. package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
  195. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  196. package/lib/packageVersion.mjs.map +1 -0
  197. package/lib/protocol.d.mts +38 -0
  198. package/lib/protocol.d.mts.map +1 -0
  199. package/lib/protocol.mjs +94 -0
  200. package/lib/protocol.mjs.map +1 -0
  201. package/lib/{protocolTreeDocumentStorageService.d.ts → protocolTreeDocumentStorageService.d.mts} +8 -4
  202. package/lib/protocolTreeDocumentStorageService.d.mts.map +1 -0
  203. package/lib/{protocolTreeDocumentStorageService.js → protocolTreeDocumentStorageService.mjs} +8 -5
  204. package/lib/protocolTreeDocumentStorageService.mjs.map +1 -0
  205. package/lib/quorum.d.mts +4 -0
  206. package/lib/quorum.d.mts.map +1 -0
  207. package/lib/quorum.mjs +12 -0
  208. package/lib/quorum.mjs.map +1 -0
  209. package/lib/{retriableDocumentStorageService.d.ts → retriableDocumentStorageService.d.mts} +7 -5
  210. package/lib/retriableDocumentStorageService.d.mts.map +1 -0
  211. package/lib/{retriableDocumentStorageService.js → retriableDocumentStorageService.mjs} +35 -20
  212. package/lib/retriableDocumentStorageService.mjs.map +1 -0
  213. package/lib/utils.d.mts +67 -0
  214. package/lib/utils.d.mts.map +1 -0
  215. package/lib/{utils.js → utils.mjs} +47 -11
  216. package/lib/utils.mjs.map +1 -0
  217. package/package.json +163 -70
  218. package/prettier.config.cjs +8 -0
  219. package/src/audience.ts +59 -49
  220. package/src/catchUpMonitor.ts +61 -0
  221. package/src/connectionManager.ts +1154 -910
  222. package/src/connectionState.ts +22 -25
  223. package/src/connectionStateHandler.ts +689 -319
  224. package/src/container.ts +2476 -1792
  225. package/src/containerContext.ts +98 -330
  226. package/src/containerStorageAdapter.ts +301 -105
  227. package/src/contracts.ts +184 -146
  228. package/src/debugLogger.ts +123 -0
  229. package/src/deltaManager.ts +1165 -900
  230. package/src/deltaQueue.ts +156 -152
  231. package/src/disposal.ts +25 -0
  232. package/src/error.ts +44 -0
  233. package/src/index.ts +14 -15
  234. package/src/loader.ts +356 -427
  235. package/src/location-redirection-utilities/index.ts +9 -0
  236. package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +61 -0
  237. package/src/noopHeuristic.ts +107 -0
  238. package/src/packageVersion.ts +1 -1
  239. package/src/protocol.ts +150 -0
  240. package/src/protocolTreeDocumentStorageService.ts +35 -35
  241. package/src/quorum.ts +11 -50
  242. package/src/retriableDocumentStorageService.ts +135 -95
  243. package/src/utils.ts +159 -86
  244. package/tsc-multi.test.json +4 -0
  245. package/tsconfig.json +10 -12
  246. package/dist/audience.js.map +0 -1
  247. package/dist/collabWindowTracker.d.ts +0 -19
  248. package/dist/collabWindowTracker.d.ts.map +0 -1
  249. package/dist/collabWindowTracker.js.map +0 -1
  250. package/dist/connectionManager.js.map +0 -1
  251. package/dist/connectionState.js.map +0 -1
  252. package/dist/connectionStateHandler.js +0 -280
  253. package/dist/connectionStateHandler.js.map +0 -1
  254. package/dist/container.js +0 -1284
  255. package/dist/container.js.map +0 -1
  256. package/dist/containerContext.js +0 -217
  257. package/dist/containerContext.js.map +0 -1
  258. package/dist/containerStorageAdapter.js +0 -104
  259. package/dist/containerStorageAdapter.js.map +0 -1
  260. package/dist/contracts.js.map +0 -1
  261. package/dist/deltaManager.js.map +0 -1
  262. package/dist/deltaManagerProxy.d.ts +0 -54
  263. package/dist/deltaManagerProxy.d.ts.map +0 -1
  264. package/dist/deltaManagerProxy.js +0 -115
  265. package/dist/deltaManagerProxy.js.map +0 -1
  266. package/dist/deltaQueue.js.map +0 -1
  267. package/dist/index.js +0 -16
  268. package/dist/index.js.map +0 -1
  269. package/dist/loader.js +0 -241
  270. package/dist/loader.js.map +0 -1
  271. package/dist/packageVersion.js.map +0 -1
  272. package/dist/protocolTreeDocumentStorageService.js.map +0 -1
  273. package/dist/quorum.js +0 -44
  274. package/dist/quorum.js.map +0 -1
  275. package/dist/retriableDocumentStorageService.js.map +0 -1
  276. package/dist/utils.js.map +0 -1
  277. package/lib/audience.d.ts.map +0 -1
  278. package/lib/audience.js.map +0 -1
  279. package/lib/collabWindowTracker.d.ts +0 -19
  280. package/lib/collabWindowTracker.d.ts.map +0 -1
  281. package/lib/collabWindowTracker.js.map +0 -1
  282. package/lib/connectionManager.d.ts.map +0 -1
  283. package/lib/connectionManager.js.map +0 -1
  284. package/lib/connectionState.d.ts.map +0 -1
  285. package/lib/connectionState.js.map +0 -1
  286. package/lib/connectionStateHandler.d.ts +0 -81
  287. package/lib/connectionStateHandler.d.ts.map +0 -1
  288. package/lib/connectionStateHandler.js +0 -276
  289. package/lib/connectionStateHandler.js.map +0 -1
  290. package/lib/container.d.ts +0 -238
  291. package/lib/container.d.ts.map +0 -1
  292. package/lib/container.js +0 -1276
  293. package/lib/container.js.map +0 -1
  294. package/lib/containerContext.d.ts +0 -84
  295. package/lib/containerContext.d.ts.map +0 -1
  296. package/lib/containerContext.js +0 -213
  297. package/lib/containerContext.js.map +0 -1
  298. package/lib/containerStorageAdapter.d.ts +0 -48
  299. package/lib/containerStorageAdapter.d.ts.map +0 -1
  300. package/lib/containerStorageAdapter.js +0 -99
  301. package/lib/containerStorageAdapter.js.map +0 -1
  302. package/lib/contracts.d.ts.map +0 -1
  303. package/lib/contracts.js.map +0 -1
  304. package/lib/deltaManager.d.ts.map +0 -1
  305. package/lib/deltaManager.js.map +0 -1
  306. package/lib/deltaManagerProxy.d.ts +0 -54
  307. package/lib/deltaManagerProxy.d.ts.map +0 -1
  308. package/lib/deltaManagerProxy.js +0 -110
  309. package/lib/deltaManagerProxy.js.map +0 -1
  310. package/lib/deltaQueue.d.ts.map +0 -1
  311. package/lib/deltaQueue.js.map +0 -1
  312. package/lib/index.d.ts +0 -8
  313. package/lib/index.d.ts.map +0 -1
  314. package/lib/index.js +0 -8
  315. package/lib/index.js.map +0 -1
  316. package/lib/loader.d.ts.map +0 -1
  317. package/lib/loader.js +0 -236
  318. package/lib/loader.js.map +0 -1
  319. package/lib/packageVersion.js.map +0 -1
  320. package/lib/protocolTreeDocumentStorageService.d.ts.map +0 -1
  321. package/lib/protocolTreeDocumentStorageService.js.map +0 -1
  322. package/lib/quorum.d.ts +0 -21
  323. package/lib/quorum.d.ts.map +0 -1
  324. package/lib/quorum.js +0 -38
  325. package/lib/quorum.js.map +0 -1
  326. package/lib/retriableDocumentStorageService.d.ts.map +0 -1
  327. package/lib/retriableDocumentStorageService.js.map +0 -1
  328. package/lib/utils.d.ts +0 -34
  329. package/lib/utils.d.ts.map +0 -1
  330. package/lib/utils.js.map +0 -1
  331. package/src/collabWindowTracker.ts +0 -102
  332. package/src/deltaManagerProxy.ts +0 -158
  333. package/tsconfig.esnext.json +0 -7
@@ -2,25 +2,98 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryLogger, ITelemetryProperties } from "@fluidframework/common-definitions";
6
- import { IConnectionDetails } from "@fluidframework/container-definitions";
7
- import { IProtocolHandler } from "@fluidframework/protocol-base";
8
- import { ConnectionMode, IQuorumClients } from "@fluidframework/protocol-definitions";
5
+ import { ITelemetryProperties, TelemetryEventCategory } from "@fluidframework/core-interfaces";
6
+ import { IDeltaManager } from "@fluidframework/container-definitions";
7
+ import { ISequencedClient, IClient } from "@fluidframework/protocol-definitions";
8
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
9
+ import { IAnyDriverError } from "@fluidframework/driver-definitions";
9
10
  import { ConnectionState } from "./connectionState";
11
+ import { IConnectionDetailsInternal, IConnectionStateChangeReason } from "./contracts";
12
+ import { IProtocolHandler } from "./protocol";
10
13
  /** Constructor parameter type for passing in dependencies needed by the ConnectionStateHandler */
11
14
  export interface IConnectionStateHandlerInputs {
12
- /** Provides access to the clients currently in the quorum */
13
- quorumClients: () => IQuorumClients | undefined;
15
+ logger: ITelemetryLoggerExt;
14
16
  /** Log to telemetry any change in state, included to Connecting */
15
- logConnectionStateChangeTelemetry: (value: ConnectionState, oldState: ConnectionState, reason?: string | undefined) => void;
17
+ connectionStateChanged: (value: ConnectionState, oldState: ConnectionState, reason?: IConnectionStateChangeReason) => void;
16
18
  /** Whether to expect the client to join in write mode on next connection */
17
19
  shouldClientJoinWrite: () => boolean;
18
20
  /** (Optional) How long should we wait on our previous client's Leave op before transitioning to Connected again */
19
21
  maxClientLeaveWaitTime: number | undefined;
20
22
  /** Log an issue encountered while in the Connecting state. details will be logged as a JSON string */
21
- logConnectionIssue: (eventName: string, details?: ITelemetryProperties) => void;
22
- /** Callback whenever the ConnectionState changes between Disconnected and Connected */
23
- connectionStateChanged: () => void;
23
+ logConnectionIssue: (eventName: string, category: TelemetryEventCategory, details?: ITelemetryProperties) => void;
24
+ /** Callback to note that an old local client ID is still present in the Quorum that should have left and should now be considered invalid */
25
+ clientShouldHaveLeft: (clientId: string) => void;
26
+ }
27
+ /**
28
+ * interface that connection state handler implements
29
+ */
30
+ export interface IConnectionStateHandler {
31
+ readonly connectionState: ConnectionState;
32
+ readonly pendingClientId: string | undefined;
33
+ containerSaved(): void;
34
+ dispose(): void;
35
+ initProtocol(protocol: IProtocolHandler): void;
36
+ receivedConnectEvent(details: IConnectionDetailsInternal): void;
37
+ receivedDisconnectEvent(reason: IConnectionStateChangeReason): void;
38
+ establishingConnection(reason: IConnectionStateChangeReason): void;
39
+ /**
40
+ * Switches state to disconnected when we are still establishing connection during container.load(),
41
+ * container connect() or reconnect and the container gets closed or disposed or disconnect happens.
42
+ * @param reason - reason for cancelling the connection.
43
+ */
44
+ cancelEstablishingConnection(reason: IConnectionStateChangeReason): void;
45
+ }
46
+ export declare function createConnectionStateHandler(inputs: IConnectionStateHandlerInputs, deltaManager: IDeltaManager<any, any>, clientId?: string): ConnectionStateHandler | ConnectionStateCatchup;
47
+ export declare function createConnectionStateHandlerCore(connectedRaisedWhenCaughtUp: boolean, readClientsWaitForJoinSignal: boolean, inputs: IConnectionStateHandlerInputs, deltaManager: IDeltaManager<any, any>, clientId?: string): ConnectionStateHandler | ConnectionStateCatchup;
48
+ /**
49
+ * Helper internal interface to abstract away Audience & Quorum
50
+ */
51
+ interface IMembership {
52
+ on(eventName: "addMember" | "removeMember", listener: (clientId: string, details: IClient | ISequencedClient) => void): any;
53
+ getMember(clientId: string): undefined | unknown;
54
+ }
55
+ /**
56
+ * Class that can be used as a base class for building IConnectionStateHandler adapters / pipeline.
57
+ * It implements both ends of communication interfaces and passes data back and forward
58
+ */
59
+ declare class ConnectionStateHandlerPassThrough implements IConnectionStateHandler, IConnectionStateHandlerInputs {
60
+ protected readonly inputs: IConnectionStateHandlerInputs;
61
+ protected readonly pimpl: IConnectionStateHandler;
62
+ constructor(inputs: IConnectionStateHandlerInputs, pimplFactory: (handler: IConnectionStateHandlerInputs) => IConnectionStateHandler);
63
+ /**
64
+ * IConnectionStateHandler
65
+ */
66
+ get connectionState(): ConnectionState;
67
+ get pendingClientId(): string | undefined;
68
+ containerSaved(): void;
69
+ dispose(): void;
70
+ initProtocol(protocol: IProtocolHandler): void;
71
+ receivedDisconnectEvent(reason: IConnectionStateChangeReason<IAnyDriverError>): void;
72
+ establishingConnection(reason: IConnectionStateChangeReason): void;
73
+ cancelEstablishingConnection(reason: IConnectionStateChangeReason): void;
74
+ receivedConnectEvent(details: IConnectionDetailsInternal): void;
75
+ /**
76
+ * IConnectionStateHandlerInputs
77
+ */
78
+ get logger(): ITelemetryLoggerExt;
79
+ connectionStateChanged(value: ConnectionState, oldState: ConnectionState, reason?: IConnectionStateChangeReason): void;
80
+ shouldClientJoinWrite(): boolean;
81
+ get maxClientLeaveWaitTime(): number | undefined;
82
+ logConnectionIssue(eventName: string, category: TelemetryEventCategory, details?: ITelemetryProperties): void;
83
+ clientShouldHaveLeft(clientId: string): void;
84
+ }
85
+ /**
86
+ * Implementation of IConnectionStateHandler pass-through adapter that waits for specific sequence number
87
+ * before raising connected event
88
+ */
89
+ declare class ConnectionStateCatchup extends ConnectionStateHandlerPassThrough {
90
+ private readonly deltaManager;
91
+ private catchUpMonitor;
92
+ constructor(inputs: IConnectionStateHandlerInputs, pimplFactory: (handler: IConnectionStateHandlerInputs) => IConnectionStateHandler, deltaManager: IDeltaManager<any, any>);
93
+ private _connectionState;
94
+ get connectionState(): ConnectionState;
95
+ connectionStateChanged(value: ConnectionState, oldState: ConnectionState, reason?: IConnectionStateChangeReason<IAnyDriverError>): void;
96
+ private readonly transitionToConnectedState;
24
97
  }
25
98
  /**
26
99
  * In the lifetime of a container, the connection will likely disconnect and reconnect periodically.
@@ -28,36 +101,54 @@ export interface IConnectionStateHandlerInputs {
28
101
  * sequenced or blocked by the server before emitting the new "connected" event and allowing runtime to resubmit ops.
29
102
  *
30
103
  * Each connection is assigned a clientId by the service, and the connection is book-ended by a Join and a Leave op
31
- * generated by the service. Due to the distributed nature of the ordering service, in the case of reconnect we cannot
104
+ * generated by the service. Due to the distributed nature of the Relay Service, in the case of reconnect we cannot
32
105
  * make any assumptions about ordering of operations between the old and new connections - i.e. new Join op could
33
106
  * be sequenced before old Leave op (and some acks from pending ops that were in flight when we disconnected).
34
107
  *
35
108
  * The job of this class is to encapsulate the transition period during reconnect, which is identified by
36
109
  * ConnectionState.CatchingUp. Specifically, before moving to Connected state with the new clientId, it ensures that:
37
- * (A) We process the Leave op for the previous clientId. This allows us to properly handle any acks from in-flight ops
38
- * that got sequenced with the old clientId (we'll recognize them as local ops). After the Leave op, any other
39
- * pending ops can safely be submitted with the new clientId without fear of duplication in the sequenced op stream.
40
- * (B) We process the Join op for the new clientId (identified when the underlying connection was first established),
41
- * indicating the service is ready to sequence ops sent with the new clientId.
42
110
  *
43
- * For (A) we give up waiting after some time (same timeout as server uses), and go ahead and transition to Connected.
44
- * For (B) we log telemetry if it takes too long, but still only transition to Connected when the Join op is processed
45
- * and we are added to the Quorum.
111
+ * a. We process the Leave op for the previous clientId. This allows us to properly handle any acks from in-flight ops
112
+ * that got sequenced with the old clientId (we'll recognize them as local ops). After the Leave op, any other
113
+ * pending ops can safely be submitted with the new clientId without fear of duplication in the sequenced op stream.
114
+ *
115
+ * b. We process the Join op for the new clientId (identified when the underlying connection was first established),
116
+ * indicating the service is ready to sequence ops sent with the new clientId.
117
+ *
118
+ * c. We process all ops known at the time the underlying connection was established (so we are "caught up")
119
+ *
120
+ * For (a) we give up waiting after some time (same timeout as server uses), and go ahead and transition to Connected.
121
+ *
122
+ * For (b) we log telemetry if it takes too long, but still only transition to Connected when the Join op/signal is
123
+ * processed.
124
+ *
125
+ * For (c) this is optional behavior, controlled by the parameters of receivedConnectEvent
46
126
  */
47
- export declare class ConnectionStateHandler {
127
+ declare class ConnectionStateHandler implements IConnectionStateHandler {
48
128
  private readonly handler;
49
- private readonly logger;
50
- private _clientId?;
129
+ private readonly readClientsWaitForJoinSignal;
51
130
  private _connectionState;
52
131
  private _pendingClientId;
132
+ /**
133
+ * Tracks that we observe the "leave" op within the timeout for our previous clientId (see comment on ConnectionStateHandler class)
134
+ * ! This ensures we do not switch to a new clientId until we process all potential messages from old clientId
135
+ * ! i.e. We will always see the "leave" op for a client after we have seen all the ops it has sent
136
+ * ! This check helps prevent the same op from being resubmitted by the PendingStateManager upon reconnecting
137
+ */
53
138
  private readonly prevClientLeftTimer;
139
+ /**
140
+ * Tracks that we observe our own "join" op within the timeout after receiving a "connected" event from the DeltaManager
141
+ */
54
142
  private readonly joinOpTimer;
143
+ private protocol?;
144
+ private connection?;
145
+ private _clientId?;
146
+ /** Track how long we waited to see "leave" op for previous clientId */
55
147
  private waitEvent;
56
148
  get connectionState(): ConnectionState;
57
- get connected(): boolean;
58
- get clientId(): string | undefined;
149
+ private get clientId();
59
150
  get pendingClientId(): string | undefined;
60
- constructor(handler: IConnectionStateHandlerInputs, logger: ITelemetryLogger, _clientId?: string | undefined);
151
+ constructor(handler: IConnectionStateHandlerInputs, readClientsWaitForJoinSignal: boolean, clientIdFromPausedSession?: string);
61
152
  private startJoinOpTimer;
62
153
  private stopJoinOpTimer;
63
154
  private get waitingForLeaveOp();
@@ -66,16 +157,23 @@ export declare class ConnectionStateHandler {
66
157
  private receivedAddMemberEvent;
67
158
  private applyForConnectedState;
68
159
  private receivedRemoveMemberEvent;
69
- receivedDisconnectEvent(reason: string): void;
160
+ receivedDisconnectEvent(reason: IConnectionStateChangeReason<IAnyDriverError>): void;
161
+ cancelEstablishingConnection(reason: IConnectionStateChangeReason): void;
162
+ establishingConnection(reason: IConnectionStateChangeReason): void;
163
+ private shouldWaitForJoinSignal;
70
164
  /**
71
165
  * The "connect" event indicates the connection to the Relay Service is live.
72
166
  * However, some additional conditions must be met before we can fully transition to
73
167
  * "Connected" state. This function handles that interim period, known as "Connecting" state.
74
- * @param connectionMode - Read or Write connection
75
- * @param details - Connection details returned from the ordering service
168
+ * @param details - Connection details returned from the Relay Service
169
+ * @param deltaManager - DeltaManager to be used for delaying Connected transition until caught up.
170
+ * If it's undefined, then don't delay and transition to Connected as soon as Leave/Join op are accounted for
76
171
  */
77
- receivedConnectEvent(connectionMode: ConnectionMode, details: IConnectionDetails): void;
172
+ receivedConnectEvent(details: IConnectionDetailsInternal): void;
78
173
  private setConnectionState;
174
+ protected get membership(): IMembership | undefined;
79
175
  initProtocol(protocol: IProtocolHandler): void;
176
+ protected hasMember(clientId?: string): boolean;
80
177
  }
178
+ export {};
81
179
  //# sourceMappingURL=connectionStateHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStateHandler.d.ts","sourceRoot":"","sources":["../src/connectionStateHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAyB,gBAAgB,EAAE,MAAM,+BAA+B,CAA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AAC,yBAAyB;IAQ1B,uBAAuB,CAAC,MAAM,EAAE,4BAA4B,CAAC,eAAe,CAAC;IAK7E,4BAA4B,CAAC,MAAM,EAAE,4BAA4B;IAWjE,sBAAsB,CAAC,MAAM,EAAE,4BAA4B;IASlE,OAAO,CAAC,uBAAuB;IAQ/B;;;;;;;OAOG;IACI,oBAAoB,CAAC,OAAO,EAAE,0BAA0B;IA4C/D,OAAO,CAAC,kBAAkB;IA0E1B,SAAS,KAAK,UAAU,IAAI,WAAW,GAAG,SAAS,CAOlD;IAEM,YAAY,CAAC,QAAQ,EAAE,gBAAgB;IAsC9C,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM;CAGrC"}
@@ -0,0 +1,274 @@
1
+ import { FluidObject } from '@fluidframework/core-interfaces';
2
+ import { IAudienceOwner } from '@fluidframework/container-definitions';
3
+ import { IClientDetails } from '@fluidframework/protocol-definitions';
4
+ import { IConfigProviderBase } from '@fluidframework/core-interfaces';
5
+ import { IContainer } from '@fluidframework/container-definitions';
6
+ import { IDocumentAttributes } from '@fluidframework/protocol-definitions';
7
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
8
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
9
+ import { IFluidCodeDetails } from '@fluidframework/container-definitions';
10
+ import { IFluidModule } from '@fluidframework/container-definitions';
11
+ import { IHostLoader } from '@fluidframework/container-definitions';
12
+ import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions';
13
+ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
14
+ import { IProtocolHandler as IProtocolHandler_2 } from '@fluidframework/protocol-base';
15
+ import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions';
16
+ import { IQuorumSnapshot } from '@fluidframework/protocol-base';
17
+ import { IRequest } from '@fluidframework/core-interfaces';
18
+ import { ISignalMessage } from '@fluidframework/protocol-definitions';
19
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
20
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
21
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
22
+
23
+ /**
24
+ * @alpha
25
+ */
26
+ export declare enum ConnectionState {
27
+ /**
28
+ * The container is not connected to the ordering service
29
+ * Note - When in this state the container may be about to reconnect,
30
+ * or may remain disconnected until explicitly told to connect.
31
+ */
32
+ Disconnected = 0,
33
+ /**
34
+ * The container is disconnected but actively trying to establish a new connection
35
+ * PLEASE NOTE that this numerical value falls out of the order you may expect for this state
36
+ */
37
+ EstablishingConnection = 3,
38
+ /**
39
+ * The container has an inbound connection only, and is catching up to the latest known state from the service.
40
+ */
41
+ CatchingUp = 1,
42
+ /**
43
+ * The container is fully connected and syncing
44
+ */
45
+ Connected = 2
46
+ }
47
+
48
+ /**
49
+ * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definition#ICodeDetailsLoader}
50
+ * to have code loading modules in one package. #8193
51
+ * Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
52
+ * a package name and package version range.
53
+ * @alpha
54
+ */
55
+ export declare interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {
56
+ /**
57
+ * Load the code module (package) that is capable to interact with the document.
58
+ *
59
+ * @param source - Code proposal that articulates the current schema the document is written in.
60
+ * @returns Code module entry point along with the code details associated with it.
61
+ */
62
+ load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
63
+ }
64
+
65
+ /* Excluded from this release type: IContainerExperimental */
66
+
67
+ /**
68
+ * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support
69
+ * blobs in detached containers.
70
+ * @alpha
71
+ */
72
+ export declare type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" | "readBlob"> & {
73
+ size: number;
74
+ /**
75
+ * Return an array of all blob IDs present in storage
76
+ */
77
+ getBlobIds(): string[];
78
+ };
79
+
80
+ /**
81
+ * @deprecated IFluidModuleWithDetails interface is moved to
82
+ * {@link @fluidframework/container-definitions#IFluidModuleWithDetails}
83
+ * to have all the code loading modules in one package. #8193
84
+ * Encapsulates a module entry point with corresponding code details.
85
+ * @alpha
86
+ */
87
+ export declare interface IFluidModuleWithDetails {
88
+ /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
89
+ module: IFluidModule;
90
+ /**
91
+ * Code details associated with the module. Represents a document schema this module supports.
92
+ * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
93
+ * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
94
+ */
95
+ details: IFluidCodeDetails;
96
+ }
97
+
98
+ /**
99
+ * @alpha
100
+ */
101
+ export declare interface ILoaderOptions extends ILoaderOptions_2 {
102
+ summarizeProtocolTree?: boolean;
103
+ }
104
+
105
+ /**
106
+ * Services and properties necessary for creating a loader
107
+ * @alpha
108
+ */
109
+ export declare interface ILoaderProps {
110
+ /**
111
+ * The url resolver used by the loader for resolving external urls
112
+ * into Fluid urls such that the container specified by the
113
+ * external url can be loaded.
114
+ */
115
+ readonly urlResolver: IUrlResolver;
116
+ /**
117
+ * The document service factory take the Fluid url provided
118
+ * by the resolved url and constructs all the necessary services
119
+ * for communication with the container's server.
120
+ */
121
+ readonly documentServiceFactory: IDocumentServiceFactory;
122
+ /**
123
+ * The code loader handles loading the necessary code
124
+ * for running a container once it is loaded.
125
+ */
126
+ readonly codeLoader: ICodeDetailsLoader;
127
+ /**
128
+ * A property bag of options used by various layers
129
+ * to control features
130
+ */
131
+ readonly options?: ILoaderOptions;
132
+ /**
133
+ * Scope is provided to all container and is a set of shared
134
+ * services for container's to integrate with their host environment.
135
+ */
136
+ readonly scope?: FluidObject;
137
+ /**
138
+ * The logger that all telemetry should be pushed to.
139
+ */
140
+ readonly logger?: ITelemetryBaseLogger;
141
+ /**
142
+ * Blobs storage for detached containers.
143
+ */
144
+ readonly detachedBlobStorage?: IDetachedBlobStorage;
145
+ /**
146
+ * The configuration provider which may be used to control features.
147
+ */
148
+ readonly configProvider?: IConfigProviderBase;
149
+ /**
150
+ * Optional property for allowing the container to use a custom
151
+ * protocol implementation for handling the quorum and/or the audience.
152
+ */
153
+ readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;
154
+ }
155
+
156
+ /**
157
+ * Services and properties used by and exposed by the loader
158
+ * @alpha
159
+ */
160
+ export declare interface ILoaderServices {
161
+ /**
162
+ * The url resolver used by the loader for resolving external urls
163
+ * into Fluid urls such that the container specified by the
164
+ * external url can be loaded.
165
+ */
166
+ readonly urlResolver: IUrlResolver;
167
+ /**
168
+ * The document service factory take the Fluid url provided
169
+ * by the resolved url and constructs all the necessary services
170
+ * for communication with the container's server.
171
+ */
172
+ readonly documentServiceFactory: IDocumentServiceFactory;
173
+ /**
174
+ * The code loader handles loading the necessary code
175
+ * for running a container once it is loaded.
176
+ */
177
+ readonly codeLoader: ICodeDetailsLoader;
178
+ /**
179
+ * A property bag of options used by various layers
180
+ * to control features
181
+ */
182
+ readonly options: ILoaderOptions;
183
+ /**
184
+ * Scope is provided to all container and is a set of shared
185
+ * services for container's to integrate with their host environment.
186
+ */
187
+ readonly scope: FluidObject;
188
+ /**
189
+ * The logger downstream consumers should construct their loggers from
190
+ */
191
+ readonly subLogger: ITelemetryLoggerExt;
192
+ /**
193
+ * Blobs storage for detached containers.
194
+ */
195
+ readonly detachedBlobStorage?: IDetachedBlobStorage;
196
+ /**
197
+ * Optional property for allowing the container to use a custom
198
+ * protocol implementation for handling the quorum and/or the audience.
199
+ */
200
+ readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;
201
+ }
202
+
203
+ /* Excluded from this release type: IParsedUrl */
204
+
205
+ /**
206
+ * @alpha
207
+ */
208
+ export declare interface IProtocolHandler extends IProtocolHandler_2 {
209
+ readonly audience: IAudienceOwner;
210
+ processSignal(message: ISignalMessage): any;
211
+ }
212
+
213
+ /* Excluded from this release type: isLocationRedirectionError */
214
+
215
+ /**
216
+ * Manages Fluid resource loading
217
+ * @alpha
218
+ */
219
+ export declare class Loader implements IHostLoader {
220
+ readonly services: ILoaderServices;
221
+ private readonly mc;
222
+ constructor(loaderProps: ILoaderProps);
223
+ createDetachedContainer(codeDetails: IFluidCodeDetails, createDetachedProps?: {
224
+ canReconnect?: boolean;
225
+ clientDetailsOverride?: IClientDetails;
226
+ }): Promise<IContainer>;
227
+ rehydrateDetachedContainerFromSnapshot(snapshot: string, createDetachedProps?: {
228
+ canReconnect?: boolean;
229
+ clientDetailsOverride?: IClientDetails;
230
+ }): Promise<IContainer>;
231
+ resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer>;
232
+ private resolveCore;
233
+ private loadContainer;
234
+ }
235
+
236
+ /**
237
+ * Function to be used for creating a protocol handler.
238
+ * @alpha
239
+ */
240
+ export declare type ProtocolHandlerBuilder = (attributes: IDocumentAttributes, snapshot: IQuorumSnapshot, sendProposal: (key: string, value: any) => number) => IProtocolHandler;
241
+
242
+ /**
243
+ * Handles location redirection while fulfilling the loader request.
244
+ * @param api - Callback in which user can wrap the loader.resolve or loader.request call.
245
+ * @param request - request to be resolved.
246
+ * @param urlResolver - resolver used to resolve the url.
247
+ * @param logger - logger to send events.
248
+ * @returns Response from the API call.
249
+ * @alpha
250
+ */
251
+ export declare function resolveWithLocationRedirectionHandling<T>(api: (request: IRequest) => Promise<T>, request: IRequest, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger): Promise<T>;
252
+
253
+ /* Excluded from this release type: tryParseCompatibleResolvedUrl */
254
+
255
+ /**
256
+ * Waits until container connects to delta storage and gets up-to-date.
257
+ *
258
+ * Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being
259
+ * up to date. Host may chose to wait in such case and retry resolving URI.
260
+ *
261
+ * Warning: Will wait infinitely for connection to establish if there is no connection.
262
+ * May result in deadlock if Container.disconnect() is called and never followed by a call to Container.connect().
263
+ *
264
+ * @returns `true`: container is up to date, it processed all the ops that were know at the time of first connection.
265
+ *
266
+ * `false`: storage does not provide indication of how far the client is. Container processed all the ops known to it,
267
+ * but it maybe still behind.
268
+ *
269
+ * @throws an error beginning with `"Container closed"` if the container is closed before it catches up.
270
+ * @alpha
271
+ */
272
+ export declare function waitContainerToCatchUp(container: IContainer): Promise<boolean>;
273
+
274
+ export { }
@@ -0,0 +1,75 @@
1
+ import { FluidObject } from '@fluidframework/core-interfaces';
2
+ import { IAudienceOwner } from '@fluidframework/container-definitions';
3
+ import { IClientDetails } from '@fluidframework/protocol-definitions';
4
+ import { IConfigProviderBase } from '@fluidframework/core-interfaces';
5
+ import { IContainer } from '@fluidframework/container-definitions';
6
+ import { IDocumentAttributes } from '@fluidframework/protocol-definitions';
7
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
8
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
9
+ import { IFluidCodeDetails } from '@fluidframework/container-definitions';
10
+ import { IFluidModule } from '@fluidframework/container-definitions';
11
+ import { IHostLoader } from '@fluidframework/container-definitions';
12
+ import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions';
13
+ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
14
+ import { IProtocolHandler as IProtocolHandler_2 } from '@fluidframework/protocol-base';
15
+ import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions';
16
+ import { IQuorumSnapshot } from '@fluidframework/protocol-base';
17
+ import { IRequest } from '@fluidframework/core-interfaces';
18
+ import { ISignalMessage } from '@fluidframework/protocol-definitions';
19
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
20
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
21
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
22
+
23
+ /* Excluded from this release type: ConnectionState */
24
+
25
+ /* Excluded from this release type: IAudienceOwner */
26
+
27
+ /* Excluded from this release type: ICodeDetailsLoader */
28
+
29
+ /* Excluded from this release type: IContainer */
30
+
31
+ /* Excluded from this release type: IContainerExperimental */
32
+
33
+ /* Excluded from this release type: IDetachedBlobStorage */
34
+
35
+ /* Excluded from this release type: IDocumentServiceFactory */
36
+
37
+ /* Excluded from this release type: IDocumentStorageService */
38
+
39
+ /* Excluded from this release type: IFluidCodeDetails */
40
+
41
+ /* Excluded from this release type: IFluidModule */
42
+
43
+ /* Excluded from this release type: IFluidModuleWithDetails */
44
+
45
+ /* Excluded from this release type: IHostLoader */
46
+
47
+ /* Excluded from this release type: ILoaderOptions */
48
+
49
+ /* Excluded from this release type: ILoaderProps */
50
+
51
+ /* Excluded from this release type: ILoaderServices */
52
+
53
+ /* Excluded from this release type: ILocationRedirectionError */
54
+
55
+ /* Excluded from this release type: IParsedUrl */
56
+
57
+ /* Excluded from this release type: IProtocolHandler */
58
+
59
+ /* Excluded from this release type: IProvideFluidCodeDetailsComparer */
60
+
61
+ /* Excluded from this release type: isLocationRedirectionError */
62
+
63
+ /* Excluded from this release type: IUrlResolver */
64
+
65
+ /* Excluded from this release type: Loader */
66
+
67
+ /* Excluded from this release type: ProtocolHandlerBuilder */
68
+
69
+ /* Excluded from this release type: resolveWithLocationRedirectionHandling */
70
+
71
+ /* Excluded from this release type: tryParseCompatibleResolvedUrl */
72
+
73
+ /* Excluded from this release type: waitContainerToCatchUp */
74
+
75
+ export { }
@@ -0,0 +1,75 @@
1
+ import { FluidObject } from '@fluidframework/core-interfaces';
2
+ import { IAudienceOwner } from '@fluidframework/container-definitions';
3
+ import { IClientDetails } from '@fluidframework/protocol-definitions';
4
+ import { IConfigProviderBase } from '@fluidframework/core-interfaces';
5
+ import { IContainer } from '@fluidframework/container-definitions';
6
+ import { IDocumentAttributes } from '@fluidframework/protocol-definitions';
7
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
8
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
9
+ import { IFluidCodeDetails } from '@fluidframework/container-definitions';
10
+ import { IFluidModule } from '@fluidframework/container-definitions';
11
+ import { IHostLoader } from '@fluidframework/container-definitions';
12
+ import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions';
13
+ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
14
+ import { IProtocolHandler as IProtocolHandler_2 } from '@fluidframework/protocol-base';
15
+ import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions';
16
+ import { IQuorumSnapshot } from '@fluidframework/protocol-base';
17
+ import { IRequest } from '@fluidframework/core-interfaces';
18
+ import { ISignalMessage } from '@fluidframework/protocol-definitions';
19
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
20
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
21
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
22
+
23
+ /* Excluded from this release type: ConnectionState */
24
+
25
+ /* Excluded from this release type: IAudienceOwner */
26
+
27
+ /* Excluded from this release type: ICodeDetailsLoader */
28
+
29
+ /* Excluded from this release type: IContainer */
30
+
31
+ /* Excluded from this release type: IContainerExperimental */
32
+
33
+ /* Excluded from this release type: IDetachedBlobStorage */
34
+
35
+ /* Excluded from this release type: IDocumentServiceFactory */
36
+
37
+ /* Excluded from this release type: IDocumentStorageService */
38
+
39
+ /* Excluded from this release type: IFluidCodeDetails */
40
+
41
+ /* Excluded from this release type: IFluidModule */
42
+
43
+ /* Excluded from this release type: IFluidModuleWithDetails */
44
+
45
+ /* Excluded from this release type: IHostLoader */
46
+
47
+ /* Excluded from this release type: ILoaderOptions */
48
+
49
+ /* Excluded from this release type: ILoaderProps */
50
+
51
+ /* Excluded from this release type: ILoaderServices */
52
+
53
+ /* Excluded from this release type: ILocationRedirectionError */
54
+
55
+ /* Excluded from this release type: IParsedUrl */
56
+
57
+ /* Excluded from this release type: IProtocolHandler */
58
+
59
+ /* Excluded from this release type: IProvideFluidCodeDetailsComparer */
60
+
61
+ /* Excluded from this release type: isLocationRedirectionError */
62
+
63
+ /* Excluded from this release type: IUrlResolver */
64
+
65
+ /* Excluded from this release type: Loader */
66
+
67
+ /* Excluded from this release type: ProtocolHandlerBuilder */
68
+
69
+ /* Excluded from this release type: resolveWithLocationRedirectionHandling */
70
+
71
+ /* Excluded from this release type: tryParseCompatibleResolvedUrl */
72
+
73
+ /* Excluded from this release type: waitContainerToCatchUp */
74
+
75
+ export { }