@fluidframework/container-loader 2.0.0-dev-rc.3.0.0.250606 → 2.0.0-dev-rc.3.0.0.253463

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 (220) hide show
  1. package/api-report/container-loader.api.md +11 -11
  2. package/dist/attachment.d.ts +2 -2
  3. package/dist/attachment.d.ts.map +1 -1
  4. package/dist/attachment.js +3 -3
  5. package/dist/attachment.js.map +1 -1
  6. package/dist/audience.d.ts +1 -1
  7. package/dist/audience.d.ts.map +1 -1
  8. package/dist/audience.js +2 -2
  9. package/dist/audience.js.map +1 -1
  10. package/dist/catchUpMonitor.js +2 -2
  11. package/dist/catchUpMonitor.js.map +1 -1
  12. package/dist/connectionManager.d.ts +1 -1
  13. package/dist/connectionManager.d.ts.map +1 -1
  14. package/dist/connectionManager.js +41 -41
  15. package/dist/connectionManager.js.map +1 -1
  16. package/dist/connectionStateHandler.d.ts.map +1 -1
  17. package/dist/connectionStateHandler.js +27 -27
  18. package/dist/connectionStateHandler.js.map +1 -1
  19. package/dist/container-loader-alpha.d.ts +11 -11
  20. package/dist/container-loader-beta.d.ts +11 -11
  21. package/dist/container-loader-public.d.ts +11 -11
  22. package/dist/container-loader-untrimmed.d.ts +11 -11
  23. package/dist/container.d.ts +5 -3
  24. package/dist/container.d.ts.map +1 -1
  25. package/dist/container.js +74 -73
  26. package/dist/container.js.map +1 -1
  27. package/dist/containerContext.d.ts +5 -3
  28. package/dist/containerContext.d.ts.map +1 -1
  29. package/dist/containerContext.js.map +1 -1
  30. package/dist/containerStorageAdapter.d.ts +2 -2
  31. package/dist/containerStorageAdapter.d.ts.map +1 -1
  32. package/dist/containerStorageAdapter.js +6 -6
  33. package/dist/containerStorageAdapter.js.map +1 -1
  34. package/dist/contracts.d.ts +3 -2
  35. package/dist/contracts.d.ts.map +1 -1
  36. package/dist/contracts.js +2 -2
  37. package/dist/contracts.js.map +1 -1
  38. package/dist/debugLogger.d.ts +2 -1
  39. package/dist/debugLogger.d.ts.map +1 -1
  40. package/dist/debugLogger.js +4 -4
  41. package/dist/debugLogger.js.map +1 -1
  42. package/dist/deltaManager.d.ts +3 -2
  43. package/dist/deltaManager.d.ts.map +1 -1
  44. package/dist/deltaManager.js +44 -44
  45. package/dist/deltaManager.js.map +1 -1
  46. package/dist/deltaQueue.js +5 -5
  47. package/dist/deltaQueue.js.map +1 -1
  48. package/dist/error.d.ts +3 -2
  49. package/dist/error.d.ts.map +1 -1
  50. package/dist/error.js +5 -5
  51. package/dist/error.js.map +1 -1
  52. package/dist/loader.d.ts +2 -2
  53. package/dist/loader.d.ts.map +1 -1
  54. package/dist/loader.js +21 -21
  55. package/dist/loader.js.map +1 -1
  56. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +1 -1
  57. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  58. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
  59. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  60. package/dist/noopHeuristic.js +6 -6
  61. package/dist/noopHeuristic.js.map +1 -1
  62. package/dist/packageVersion.d.ts +1 -1
  63. package/dist/packageVersion.js +1 -1
  64. package/dist/packageVersion.js.map +1 -1
  65. package/dist/protocol.d.ts +1 -1
  66. package/dist/protocol.d.ts.map +1 -1
  67. package/dist/protocol.js +2 -2
  68. package/dist/protocol.js.map +1 -1
  69. package/dist/protocolTreeDocumentStorageService.d.ts +4 -4
  70. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  71. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  72. package/dist/quorum.d.ts +1 -1
  73. package/dist/quorum.d.ts.map +1 -1
  74. package/dist/quorum.js.map +1 -1
  75. package/dist/retriableDocumentStorageService.d.ts +1 -1
  76. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  77. package/dist/retriableDocumentStorageService.js +7 -7
  78. package/dist/retriableDocumentStorageService.js.map +1 -1
  79. package/dist/serializedStateManager.d.ts +40 -8
  80. package/dist/serializedStateManager.d.ts.map +1 -1
  81. package/dist/serializedStateManager.js +113 -20
  82. package/dist/serializedStateManager.js.map +1 -1
  83. package/dist/utils.d.ts +2 -2
  84. package/dist/utils.d.ts.map +1 -1
  85. package/dist/utils.js +14 -14
  86. package/dist/utils.js.map +1 -1
  87. package/lib/attachment.d.ts +2 -2
  88. package/lib/attachment.d.ts.map +1 -1
  89. package/lib/attachment.js +1 -1
  90. package/lib/attachment.js.map +1 -1
  91. package/lib/audience.d.ts +1 -1
  92. package/lib/audience.d.ts.map +1 -1
  93. package/lib/audience.js +1 -1
  94. package/lib/audience.js.map +1 -1
  95. package/lib/catchUpMonitor.js +1 -1
  96. package/lib/catchUpMonitor.js.map +1 -1
  97. package/lib/connectionManager.d.ts +1 -1
  98. package/lib/connectionManager.d.ts.map +1 -1
  99. package/lib/connectionManager.js +4 -4
  100. package/lib/connectionManager.js.map +1 -1
  101. package/lib/connectionStateHandler.d.ts.map +1 -1
  102. package/lib/connectionStateHandler.js +2 -2
  103. package/lib/connectionStateHandler.js.map +1 -1
  104. package/lib/container-loader-alpha.d.ts +11 -11
  105. package/lib/container-loader-beta.d.ts +11 -11
  106. package/lib/container-loader-public.d.ts +11 -11
  107. package/lib/container-loader-untrimmed.d.ts +11 -11
  108. package/lib/container.d.ts +5 -3
  109. package/lib/container.d.ts.map +1 -1
  110. package/lib/container.js +5 -4
  111. package/lib/container.js.map +1 -1
  112. package/lib/containerContext.d.ts +5 -3
  113. package/lib/containerContext.d.ts.map +1 -1
  114. package/lib/containerContext.js.map +1 -1
  115. package/lib/containerStorageAdapter.d.ts +2 -2
  116. package/lib/containerStorageAdapter.d.ts.map +1 -1
  117. package/lib/containerStorageAdapter.js +2 -2
  118. package/lib/containerStorageAdapter.js.map +1 -1
  119. package/lib/contracts.d.ts +3 -2
  120. package/lib/contracts.d.ts.map +1 -1
  121. package/lib/contracts.js +1 -1
  122. package/lib/contracts.js.map +1 -1
  123. package/lib/debugLogger.d.ts +2 -1
  124. package/lib/debugLogger.d.ts.map +1 -1
  125. package/lib/debugLogger.js +1 -1
  126. package/lib/debugLogger.js.map +1 -1
  127. package/lib/deltaManager.d.ts +3 -2
  128. package/lib/deltaManager.d.ts.map +1 -1
  129. package/lib/deltaManager.js +4 -4
  130. package/lib/deltaManager.js.map +1 -1
  131. package/lib/deltaQueue.js +1 -1
  132. package/lib/deltaQueue.js.map +1 -1
  133. package/lib/error.d.ts +3 -2
  134. package/lib/error.d.ts.map +1 -1
  135. package/lib/error.js +2 -2
  136. package/lib/error.js.map +1 -1
  137. package/lib/loader.d.ts +2 -2
  138. package/lib/loader.d.ts.map +1 -1
  139. package/lib/loader.js +2 -2
  140. package/lib/loader.js.map +1 -1
  141. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +1 -1
  142. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  143. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
  144. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  145. package/lib/noopHeuristic.js +2 -2
  146. package/lib/noopHeuristic.js.map +1 -1
  147. package/lib/packageVersion.d.ts +1 -1
  148. package/lib/packageVersion.js +1 -1
  149. package/lib/packageVersion.js.map +1 -1
  150. package/lib/protocol.d.ts +1 -1
  151. package/lib/protocol.d.ts.map +1 -1
  152. package/lib/protocol.js +1 -1
  153. package/lib/protocol.js.map +1 -1
  154. package/lib/protocolTreeDocumentStorageService.d.ts +4 -4
  155. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  156. package/lib/protocolTreeDocumentStorageService.js.map +1 -1
  157. package/lib/quorum.d.ts +1 -1
  158. package/lib/quorum.d.ts.map +1 -1
  159. package/lib/quorum.js.map +1 -1
  160. package/lib/retriableDocumentStorageService.d.ts +1 -1
  161. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  162. package/lib/retriableDocumentStorageService.js +3 -3
  163. package/lib/retriableDocumentStorageService.js.map +1 -1
  164. package/lib/serializedStateManager.d.ts +40 -8
  165. package/lib/serializedStateManager.d.ts.map +1 -1
  166. package/lib/serializedStateManager.js +107 -15
  167. package/lib/serializedStateManager.js.map +1 -1
  168. package/lib/tsdoc-metadata.json +11 -0
  169. package/lib/utils.d.ts +2 -2
  170. package/lib/utils.d.ts.map +1 -1
  171. package/lib/utils.js +3 -3
  172. package/lib/utils.js.map +1 -1
  173. package/package.json +13 -25
  174. package/src/attachment.ts +4 -3
  175. package/src/audience.ts +2 -2
  176. package/src/catchUpMonitor.ts +1 -1
  177. package/src/connectionManager.ts +7 -7
  178. package/src/connectionStateHandler.ts +4 -4
  179. package/src/container.ts +14 -12
  180. package/src/containerContext.ts +8 -5
  181. package/src/containerStorageAdapter.ts +5 -4
  182. package/src/contracts.ts +2 -3
  183. package/src/debugLogger.ts +2 -3
  184. package/src/deltaManager.ts +14 -8
  185. package/src/deltaQueue.ts +1 -1
  186. package/src/error.ts +5 -4
  187. package/src/loader.ts +5 -4
  188. package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +3 -3
  189. package/src/noopHeuristic.ts +2 -2
  190. package/src/packageVersion.ts +1 -1
  191. package/src/protocol.ts +2 -2
  192. package/src/protocolTreeDocumentStorageService.ts +4 -1
  193. package/src/quorum.ts +1 -1
  194. package/src/retriableDocumentStorageService.ts +5 -4
  195. package/src/serializedStateManager.ts +167 -18
  196. package/src/utils.ts +6 -4
  197. package/lib/test/attachment.spec.js +0 -380
  198. package/lib/test/attachment.spec.js.map +0 -1
  199. package/lib/test/catchUpMonitor.spec.js +0 -88
  200. package/lib/test/catchUpMonitor.spec.js.map +0 -1
  201. package/lib/test/connectionManager.spec.js +0 -201
  202. package/lib/test/connectionManager.spec.js.map +0 -1
  203. package/lib/test/connectionStateHandler.spec.js +0 -555
  204. package/lib/test/connectionStateHandler.spec.js.map +0 -1
  205. package/lib/test/container.spec.js +0 -64
  206. package/lib/test/container.spec.js.map +0 -1
  207. package/lib/test/deltaManager.spec.js +0 -405
  208. package/lib/test/deltaManager.spec.js.map +0 -1
  209. package/lib/test/loader.spec.js +0 -212
  210. package/lib/test/loader.spec.js.map +0 -1
  211. package/lib/test/locationRedirectionTests.spec.js +0 -44
  212. package/lib/test/locationRedirectionTests.spec.js.map +0 -1
  213. package/lib/test/serializedStateManager.spec.js +0 -151
  214. package/lib/test/serializedStateManager.spec.js.map +0 -1
  215. package/lib/test/snapshotConversionTest.spec.js +0 -79
  216. package/lib/test/snapshotConversionTest.spec.js.map +0 -1
  217. package/lib/test/types/validateContainerLoaderPrevious.generated.js +0 -38
  218. package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +0 -1
  219. package/lib/test/utils.spec.js +0 -96
  220. package/lib/test/utils.spec.js.map +0 -1
package/src/container.ts CHANGED
@@ -6,15 +6,18 @@
6
6
  import { TypedEventEmitter, performance } from "@fluid-internal/client-utils";
7
7
  import {
8
8
  AttachState,
9
- ContainerWarning,
10
9
  IAudience,
10
+ ICriticalContainerError,
11
+ IDeltaManager,
12
+ ReadOnlyInfo,
13
+ } from "@fluidframework/container-definitions";
14
+ import {
15
+ ContainerWarning,
11
16
  IBatchMessage,
12
17
  ICodeDetailsLoader,
13
18
  IContainer,
14
19
  IContainerEvents,
15
20
  IContainerLoadMode,
16
- ICriticalContainerError,
17
- IDeltaManager,
18
21
  IFluidCodeDetails,
19
22
  IFluidCodeDetailsComparer,
20
23
  IFluidModuleWithDetails,
@@ -23,18 +26,17 @@ import {
23
26
  IProvideFluidCodeDetailsComparer,
24
27
  IProvideRuntimeFactory,
25
28
  IRuntime,
26
- ReadOnlyInfo,
27
29
  isFluidCodeDetails,
28
- } from "@fluidframework/container-definitions";
30
+ } from "@fluidframework/container-definitions/internal";
29
31
  import {
30
32
  FluidObject,
31
33
  IEvent,
32
34
  IRequest,
33
- type ISignalEnvelope,
34
35
  ITelemetryBaseProperties,
35
36
  LogLevel,
36
37
  } from "@fluidframework/core-interfaces";
37
- import { assert, isPromiseLike, unreachableCase } from "@fluidframework/core-utils";
38
+ import { type ISignalEnvelope } from "@fluidframework/core-interfaces/internal";
39
+ import { assert, isPromiseLike, unreachableCase } from "@fluidframework/core-utils/internal";
38
40
  import {
39
41
  IDocumentService,
40
42
  IDocumentServiceFactory,
@@ -43,7 +45,7 @@ import {
43
45
  ISnapshot,
44
46
  IThrottlingWarning,
45
47
  IUrlResolver,
46
- } from "@fluidframework/driver-definitions";
48
+ } from "@fluidframework/driver-definitions/internal";
47
49
  import {
48
50
  MessageType2,
49
51
  OnlineStatus,
@@ -52,7 +54,7 @@ import {
52
54
  isOnline,
53
55
  readAndParse,
54
56
  runWithRetry,
55
- } from "@fluidframework/driver-utils";
57
+ } from "@fluidframework/driver-utils/internal";
56
58
  import { IQuorumSnapshot } from "@fluidframework/protocol-base";
57
59
  import {
58
60
  IClient,
@@ -73,14 +75,13 @@ import {
73
75
  MessageType,
74
76
  SummaryType,
75
77
  } from "@fluidframework/protocol-definitions";
78
+ import { ITelemetryLoggerExt, type TelemetryEventCategory } from "@fluidframework/telemetry-utils";
76
79
  import {
77
80
  EventEmitterWithErrorHandling,
78
81
  GenericError,
79
82
  IFluidErrorBase,
80
- ITelemetryLoggerExt,
81
83
  MonitoringContext,
82
84
  PerformanceEvent,
83
- type TelemetryEventCategory,
84
85
  UsageError,
85
86
  connectedEventName,
86
87
  createChildLogger,
@@ -89,9 +90,10 @@ import {
89
90
  normalizeError,
90
91
  raiseConnectedEvent,
91
92
  wrapError,
92
- } from "@fluidframework/telemetry-utils";
93
+ } from "@fluidframework/telemetry-utils/internal";
93
94
  import structuredClone from "@ungap/structured-clone";
94
95
  import { v4 as uuid } from "uuid";
96
+
95
97
  import { AttachProcessProps, AttachmentData, runRetriableAttachProcess } from "./attachment.js";
96
98
  import { Audience } from "./audience.js";
97
99
  import { ConnectionManager } from "./connectionManager.js";
@@ -6,15 +6,18 @@
6
6
  import {
7
7
  AttachState,
8
8
  IAudience,
9
- IBatchMessage,
10
- IContainerContext,
11
9
  ICriticalContainerError,
12
10
  IDeltaManager,
11
+ } from "@fluidframework/container-definitions";
12
+ import {
13
+ IBatchMessage,
14
+ IContainerContext,
13
15
  ILoader,
14
16
  ILoaderOptions,
15
- } from "@fluidframework/container-definitions";
16
- import { type FluidObject, type ISignalEnvelope } from "@fluidframework/core-interfaces";
17
- import { IDocumentStorageService, ISnapshot } from "@fluidframework/driver-definitions";
17
+ } from "@fluidframework/container-definitions/internal";
18
+ import { type FluidObject } from "@fluidframework/core-interfaces";
19
+ import { type ISignalEnvelope } from "@fluidframework/core-interfaces/internal";
20
+ import { IDocumentStorageService, ISnapshot } from "@fluidframework/driver-definitions/internal";
18
21
  import {
19
22
  IClientDetails,
20
23
  IDocumentMessage,
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
7
- import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions";
7
+ import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions/internal";
8
8
  import { IDisposable } from "@fluidframework/core-interfaces";
9
- import { assert } from "@fluidframework/core-utils";
9
+ import { assert } from "@fluidframework/core-utils/internal";
10
10
  import {
11
11
  FetchSource,
12
12
  IDocumentService,
@@ -15,8 +15,8 @@ import {
15
15
  ISnapshot,
16
16
  ISnapshotFetchOptions,
17
17
  ISummaryContext,
18
- } from "@fluidframework/driver-definitions";
19
- import { UsageError } from "@fluidframework/driver-utils";
18
+ } from "@fluidframework/driver-definitions/internal";
19
+ import { UsageError } from "@fluidframework/driver-utils/internal";
20
20
  import {
21
21
  ICreateBlobResponse,
22
22
  ISnapshotTree,
@@ -25,6 +25,7 @@ import {
25
25
  IVersion,
26
26
  } from "@fluidframework/protocol-definitions";
27
27
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
28
+
28
29
  import { IDetachedBlobStorage } from "./loader.js";
29
30
  import { ProtocolTreeStorageService } from "./protocolTreeDocumentStorageService.js";
30
31
  import { RetriableDocumentStorageService } from "./retriableDocumentStorageService.js";
package/src/contracts.ts CHANGED
@@ -7,12 +7,11 @@ import {
7
7
  IConnectionDetails,
8
8
  ICriticalContainerError,
9
9
  IDeltaQueue,
10
- IFluidCodeDetails,
11
10
  ReadOnlyInfo,
12
- isFluidPackage,
13
11
  } from "@fluidframework/container-definitions";
12
+ import { IFluidCodeDetails, isFluidPackage } from "@fluidframework/container-definitions/internal";
14
13
  import { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
15
- import { IContainerPackageInfo } from "@fluidframework/driver-definitions";
14
+ import { IContainerPackageInfo } from "@fluidframework/driver-definitions/internal";
16
15
  import {
17
16
  ConnectionMode,
18
17
  IClientConfiguration,
@@ -9,14 +9,13 @@ import {
9
9
  ITelemetryBaseLogger,
10
10
  ITelemetryBaseProperties,
11
11
  } from "@fluidframework/core-interfaces";
12
-
12
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
13
13
  import {
14
- ITelemetryLoggerExt,
15
14
  ITelemetryLoggerPropertyBags,
16
15
  createMultiSinkLogger,
17
16
  eventNamespaceSeparator,
18
17
  formatTick,
19
- } from "@fluidframework/telemetry-utils";
18
+ } from "@fluidframework/telemetry-utils/internal";
20
19
 
21
20
  // This import style is necessary to ensure the emitted JS code works in both CJS and ESM.
22
21
  import debugPkg from "debug";
@@ -14,15 +14,19 @@ import {
14
14
  IEventProvider,
15
15
  type ITelemetryBaseEvent,
16
16
  ITelemetryBaseProperties,
17
- IThrottlingWarning,
18
17
  } from "@fluidframework/core-interfaces";
19
- import { assert } from "@fluidframework/core-utils";
18
+ import { IThrottlingWarning } from "@fluidframework/core-interfaces/internal";
19
+ import { assert } from "@fluidframework/core-utils/internal";
20
+ import { DriverErrorTypes } from "@fluidframework/driver-definitions";
20
21
  import {
21
- DriverErrorTypes,
22
22
  IDocumentDeltaStorageService,
23
23
  IDocumentService,
24
- } from "@fluidframework/driver-definitions";
25
- import { MessageType2, NonRetryableError, isRuntimeMessage } from "@fluidframework/driver-utils";
24
+ } from "@fluidframework/driver-definitions/internal";
25
+ import {
26
+ MessageType2,
27
+ NonRetryableError,
28
+ isRuntimeMessage,
29
+ } from "@fluidframework/driver-utils/internal";
26
30
  import {
27
31
  ConnectionMode,
28
32
  IDocumentMessage,
@@ -31,17 +35,19 @@ import {
31
35
  MessageType,
32
36
  } from "@fluidframework/protocol-definitions";
33
37
  import {
34
- DataCorruptionError,
35
- DataProcessingError,
36
38
  type ITelemetryErrorEventExt,
37
39
  type ITelemetryGenericEventExt,
38
40
  ITelemetryLoggerExt,
41
+ } from "@fluidframework/telemetry-utils";
42
+ import {
43
+ DataCorruptionError,
44
+ DataProcessingError,
39
45
  UsageError,
40
46
  extractSafePropertiesFromMessage,
41
47
  isFluidError,
42
48
  normalizeError,
43
49
  safeRaiseEvent,
44
- } from "@fluidframework/telemetry-utils";
50
+ } from "@fluidframework/telemetry-utils/internal";
45
51
  import { v4 as uuid } from "uuid";
46
52
 
47
53
  import {
package/src/deltaQueue.ts CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { TypedEventEmitter, performance } from "@fluid-internal/client-utils";
7
7
  import { IDeltaQueue, IDeltaQueueEvents } from "@fluidframework/container-definitions";
8
- import { assert } from "@fluidframework/core-utils";
8
+ import { assert } from "@fluidframework/core-utils/internal";
9
9
  import Deque from "double-ended-queue";
10
10
 
11
11
  export interface IDeltaQueueWriter<T> {
package/src/error.ts CHANGED
@@ -3,14 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ContainerErrorTypes } from "@fluidframework/container-definitions";
7
- import { ITelemetryBaseProperties, IThrottlingWarning } from "@fluidframework/core-interfaces";
6
+ import { ContainerErrorTypes } from "@fluidframework/container-definitions/internal";
7
+ import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
8
+ import { IThrottlingWarning } from "@fluidframework/core-interfaces/internal";
9
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
8
10
  import {
9
11
  IFluidErrorBase,
10
- ITelemetryLoggerExt,
11
12
  LoggingError,
12
13
  wrapErrorAndLog,
13
- } from "@fluidframework/telemetry-utils";
14
+ } from "@fluidframework/telemetry-utils/internal";
14
15
 
15
16
  /**
16
17
  * Warning emitted when requests to storage are being throttled.
package/src/loader.ts CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  ILoaderOptions as ILoaderOptions1,
13
13
  IProvideFluidCodeDetailsComparer,
14
14
  LoaderHeader,
15
- } from "@fluidframework/container-definitions";
15
+ } from "@fluidframework/container-definitions/internal";
16
16
  import {
17
17
  FluidObject,
18
18
  IConfigProviderBase,
@@ -24,18 +24,19 @@ import {
24
24
  IDocumentStorageService,
25
25
  IResolvedUrl,
26
26
  IUrlResolver,
27
- } from "@fluidframework/driver-definitions";
27
+ } from "@fluidframework/driver-definitions/internal";
28
28
  import { IClientDetails } from "@fluidframework/protocol-definitions";
29
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
29
30
  import {
30
- ITelemetryLoggerExt,
31
31
  MonitoringContext,
32
32
  PerformanceEvent,
33
33
  UsageError,
34
34
  createChildMonitoringContext,
35
35
  mixinMonitoringContext,
36
36
  sessionStorageConfigProvider,
37
- } from "@fluidframework/telemetry-utils";
37
+ } from "@fluidframework/telemetry-utils/internal";
38
38
  import { v4 as uuid } from "uuid";
39
+
39
40
  import { Container } from "./container.js";
40
41
  import { DebugLogger } from "./debugLogger.js";
41
42
  import { pkgVersion } from "./packageVersion.js";
@@ -4,12 +4,12 @@
4
4
  */
5
5
 
6
6
  import { IRequest, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
+ import { DriverErrorTypes } from "@fluidframework/driver-definitions";
7
8
  import {
8
- DriverErrorTypes,
9
9
  ILocationRedirectionError,
10
10
  IUrlResolver,
11
- } from "@fluidframework/driver-definitions";
12
- import { createChildLogger } from "@fluidframework/telemetry-utils";
11
+ } from "@fluidframework/driver-definitions/internal";
12
+ import { createChildLogger } from "@fluidframework/telemetry-utils/internal";
13
13
 
14
14
  /**
15
15
  * Checks if the error is location redirection error.
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
7
7
  import { IEvent } from "@fluidframework/core-interfaces";
8
- import { assert, Timer } from "@fluidframework/core-utils";
9
- import { isRuntimeMessage } from "@fluidframework/driver-utils";
8
+ import { assert, Timer } from "@fluidframework/core-utils/internal";
9
+ import { isRuntimeMessage } from "@fluidframework/driver-utils/internal";
10
10
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
11
11
 
12
12
  const defaultNoopTimeFrequency = 2000;
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-loader";
9
- export const pkgVersion = "2.0.0-dev-rc.3.0.0.250606";
9
+ export const pkgVersion = "2.0.0-dev-rc.3.0.0.253463";
package/src/protocol.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IAudienceOwner } from "@fluidframework/container-definitions";
7
- import { canBeCoalescedByService } from "@fluidframework/driver-utils";
6
+ import { IAudienceOwner } from "@fluidframework/container-definitions/internal";
7
+ import { canBeCoalescedByService } from "@fluidframework/driver-utils/internal";
8
8
  import {
9
9
  IProtocolHandler as IBaseProtocolHandler,
10
10
  IQuorumSnapshot,
@@ -4,7 +4,10 @@
4
4
  */
5
5
 
6
6
  import { IDisposable } from "@fluidframework/core-interfaces";
7
- import { IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions";
7
+ import {
8
+ IDocumentStorageService,
9
+ ISummaryContext,
10
+ } from "@fluidframework/driver-definitions/internal";
8
11
  import { ISummaryTree } from "@fluidframework/protocol-definitions";
9
12
 
10
13
  /**
package/src/quorum.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IFluidCodeDetails } from "@fluidframework/container-definitions";
6
+ import { IFluidCodeDetails } from "@fluidframework/container-definitions/internal";
7
7
  import { ICommittedProposal } from "@fluidframework/protocol-definitions";
8
8
 
9
9
  export function initQuorumValuesFromCodeDetails(
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { IDisposable } from "@fluidframework/core-interfaces";
7
- import { assert } from "@fluidframework/core-utils";
7
+ import { assert } from "@fluidframework/core-utils/internal";
8
8
  import {
9
9
  FetchSource,
10
10
  IDocumentStorageService,
@@ -12,8 +12,8 @@ import {
12
12
  ISnapshot,
13
13
  ISnapshotFetchOptions,
14
14
  ISummaryContext,
15
- } from "@fluidframework/driver-definitions";
16
- import { runWithRetry } from "@fluidframework/driver-utils";
15
+ } from "@fluidframework/driver-definitions/internal";
16
+ import { runWithRetry } from "@fluidframework/driver-utils/internal";
17
17
  import {
18
18
  ICreateBlobResponse,
19
19
  ISnapshotTree,
@@ -21,7 +21,8 @@ import {
21
21
  ISummaryTree,
22
22
  IVersion,
23
23
  } from "@fluidframework/protocol-definitions";
24
- import { GenericError, ITelemetryLoggerExt, UsageError } from "@fluidframework/telemetry-utils";
24
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
25
+ import { GenericError, UsageError } from "@fluidframework/telemetry-utils/internal";
25
26
 
26
27
  export class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {
27
28
  private _disposed = false;
@@ -3,27 +3,33 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IGetPendingLocalStateProps, IRuntime } from "@fluidframework/container-definitions";
7
- import { assert } from "@fluidframework/core-utils";
6
+ import {
7
+ IGetPendingLocalStateProps,
8
+ IRuntime,
9
+ } from "@fluidframework/container-definitions/internal";
10
+ import { assert } from "@fluidframework/core-utils/internal";
8
11
  import {
9
12
  IDocumentStorageService,
10
13
  IResolvedUrl,
11
14
  ISnapshot,
12
- } from "@fluidframework/driver-definitions";
13
- import { isInstanceOfISnapshot } from "@fluidframework/driver-utils";
15
+ } from "@fluidframework/driver-definitions/internal";
16
+ import { isInstanceOfISnapshot } from "@fluidframework/driver-utils/internal";
14
17
  import {
18
+ type IDocumentAttributes,
15
19
  ISequencedDocumentMessage,
16
20
  ISnapshotTree,
17
21
  IVersion,
18
22
  } from "@fluidframework/protocol-definitions";
23
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
19
24
  import {
20
- ITelemetryLoggerExt,
21
25
  MonitoringContext,
22
26
  PerformanceEvent,
23
27
  UsageError,
24
28
  createChildMonitoringContext,
25
- } from "@fluidframework/telemetry-utils";
29
+ } from "@fluidframework/telemetry-utils/internal";
30
+
26
31
  import { ISerializableBlobContents, getBlobContentsFromTree } from "./containerStorageAdapter.js";
32
+ import { getDocumentAttributes } from "./utils.js";
27
33
 
28
34
  export interface SnapshotWithBlobs {
29
35
  /**
@@ -65,10 +71,16 @@ export interface IPendingDetachedContainerState extends SnapshotWithBlobs {
65
71
  pendingRuntimeState?: unknown;
66
72
  }
67
73
 
74
+ interface SnapshotInfo extends SnapshotWithBlobs {
75
+ snapshotSequenceNumber: number;
76
+ }
77
+
68
78
  export class SerializedStateManager {
69
79
  private readonly processedOps: ISequencedDocumentMessage[] = [];
70
80
  private snapshot: SnapshotWithBlobs | undefined;
71
81
  private readonly mc: MonitoringContext;
82
+ private latestSnapshot: SnapshotInfo | undefined;
83
+ private refreshSnapshot: Promise<void> | undefined;
72
84
 
73
85
  constructor(
74
86
  private readonly pendingLocalState: IPendingContainerState | undefined,
@@ -78,6 +90,7 @@ export class SerializedStateManager {
78
90
  "readBlob" | "getSnapshotTree" | "getSnapshot" | "getVersions"
79
91
  >,
80
92
  private readonly _offlineLoadEnabled: boolean,
93
+ private readonly newSnapshotFetched?: () => void,
81
94
  ) {
82
95
  this.mc = createChildMonitoringContext({
83
96
  logger: subLogger,
@@ -92,6 +105,7 @@ export class SerializedStateManager {
92
105
  public addProcessedOp(message: ISequencedDocumentMessage) {
93
106
  if (this.offlineLoadEnabled) {
94
107
  this.processedOps.push(message);
108
+ this.updateSnapshotAndProcessedOpsMaybe();
95
109
  }
96
110
  }
97
111
 
@@ -100,13 +114,12 @@ export class SerializedStateManager {
100
114
  supportGetSnapshotApi: boolean,
101
115
  ) {
102
116
  if (this.pendingLocalState === undefined) {
103
- const { snapshot, version } = supportGetSnapshotApi
104
- ? await fetchISnapshot(this.mc, this.storageAdapter, specifiedVersion)
105
- : await fetchISnapshotTree(this.mc, this.storageAdapter, specifiedVersion);
106
- const baseSnapshot: ISnapshotTree | undefined = isInstanceOfISnapshot(snapshot)
107
- ? snapshot.snapshotTree
108
- : snapshot;
109
- assert(baseSnapshot !== undefined, 0x8e4 /* Snapshot should exist */);
117
+ const { baseSnapshot, version } = await getSnapshotTree(
118
+ this.mc,
119
+ this.storageAdapter,
120
+ supportGetSnapshotApi,
121
+ specifiedVersion,
122
+ );
110
123
  // non-interactive clients will not have any pending state we want to save
111
124
  if (this.offlineLoadEnabled) {
112
125
  const snapshotBlobs = await getBlobContentsFromTree(
@@ -119,10 +132,71 @@ export class SerializedStateManager {
119
132
  } else {
120
133
  const { baseSnapshot, snapshotBlobs } = this.pendingLocalState;
121
134
  this.snapshot = { baseSnapshot, snapshotBlobs };
135
+ this.refreshSnapshot ??= (async () => {
136
+ this.latestSnapshot = await getLatestSnapshotInfo(
137
+ this.mc,
138
+ this.storageAdapter,
139
+ supportGetSnapshotApi,
140
+ );
141
+ this.newSnapshotFetched?.();
142
+ this.updateSnapshotAndProcessedOpsMaybe();
143
+ })();
144
+
122
145
  return { baseSnapshot, version: undefined };
123
146
  }
124
147
  }
125
148
 
149
+ /**
150
+ * Updates class snapshot and processedOps if we have a new snapshot and it's among processedOps range.
151
+ */
152
+ private updateSnapshotAndProcessedOpsMaybe() {
153
+ if (this.latestSnapshot === undefined) {
154
+ return;
155
+ }
156
+ const snapshotSequenceNumber = this.latestSnapshot?.snapshotSequenceNumber;
157
+ if (this.processedOps.length === 0) {
158
+ // can't refresh latest snapshot until we have processed the ops up to it.
159
+ // Pending state would be behind the latest snapshot.
160
+ return;
161
+ }
162
+ const firstProcessedOpSequenceNumber = this.processedOps[0].sequenceNumber;
163
+ const lastProcessedOpSequenceNumber =
164
+ this.processedOps[this.processedOps.length - 1].sequenceNumber;
165
+
166
+ if (snapshotSequenceNumber < firstProcessedOpSequenceNumber) {
167
+ // Snapshot seq number is older than our first processed op, which could mean we're fetching
168
+ // the same snapshot that we already have or snapshot is too old, implicating an unexpected behavior.
169
+ this.mc.logger.sendTelemetryEvent({
170
+ category:
171
+ snapshotSequenceNumber < firstProcessedOpSequenceNumber - 1
172
+ ? "error"
173
+ : "generic",
174
+ eventName: "OldSnapshotFetchWhileRefreshing",
175
+ snapshotSequenceNumber,
176
+ firstProcessedOpSequenceNumber,
177
+ });
178
+ this.latestSnapshot = undefined;
179
+ } else if (snapshotSequenceNumber <= lastProcessedOpSequenceNumber) {
180
+ // Snapshot seq num is between the first and last processed op.
181
+ // Remove the ops that are already part of the snapshot
182
+ this.processedOps.splice(
183
+ 0,
184
+ snapshotSequenceNumber - firstProcessedOpSequenceNumber + 1,
185
+ );
186
+ this.snapshot = this.latestSnapshot;
187
+ this.latestSnapshot = undefined;
188
+ this.mc.logger.sendTelemetryEvent({
189
+ eventName: "SnapshotRefreshed",
190
+ snapshotSequenceNumber,
191
+ firstProcessedOpSequenceNumber,
192
+ newFirstProcessedOpSequenceNumber:
193
+ this.processedOps.length === 0
194
+ ? undefined
195
+ : this.processedOps[0].sequenceNumber,
196
+ });
197
+ }
198
+ }
199
+
126
200
  /**
127
201
  * This method is only meant to be used by Container.attach() to set the initial
128
202
  * base snapshot when attaching.
@@ -171,11 +245,84 @@ export class SerializedStateManager {
171
245
  }
172
246
  }
173
247
 
248
+ /**
249
+ * Retrieves the most recent snapshot and returns its info.
250
+ *
251
+ * @param mc - The monitoring context.
252
+ * @param storageAdapter - The storage adapter providing methods to retrieve the snapshot.
253
+ * @param supportGetSnapshotApi - a boolean indicating whether to use the fetchISnapshot or fetchISnapshotTree.
254
+ * @returns a SnapshotInfo object containing the snapshot tree, snapshot blobs and its sequence number.
255
+ */
256
+ export async function getLatestSnapshotInfo(
257
+ mc: MonitoringContext,
258
+ storageAdapter: Pick<
259
+ IDocumentStorageService,
260
+ "getSnapshot" | "getSnapshotTree" | "getVersions" | "readBlob"
261
+ >,
262
+ supportGetSnapshotApi: boolean,
263
+ ): Promise<SnapshotInfo | undefined> {
264
+ return PerformanceEvent.timedExecAsync(
265
+ mc.logger,
266
+ { eventName: "GetLatestSnapshotInfo" },
267
+ async () => {
268
+ const { baseSnapshot } = await getSnapshotTree(
269
+ mc,
270
+ storageAdapter,
271
+ supportGetSnapshotApi,
272
+ undefined,
273
+ );
274
+ const snapshotBlobs = await getBlobContentsFromTree(baseSnapshot, storageAdapter);
275
+ const attributes: IDocumentAttributes = await getDocumentAttributes(
276
+ storageAdapter,
277
+ baseSnapshot,
278
+ );
279
+ const snapshotSequenceNumber = attributes.sequenceNumber;
280
+ return { baseSnapshot, snapshotBlobs, snapshotSequenceNumber };
281
+ },
282
+ ).catch(() => undefined);
283
+ }
284
+
285
+ /**
286
+ * Retrieves a snapshot from the storage adapter and transforms it into an ISnapshotTree object.
287
+ *
288
+ * @param mc - The monitoring context.
289
+ * @param storageAdapter - The storage adapter providing methods to retrieve the snapshot.
290
+ * @param supportGetSnapshotApi - a boolean indicating whether to use the fetchISnapshot or fetchISnapshotTree.
291
+ * @param specifiedVersion - An optional version string specifying the version of the snapshot tree to fetch.
292
+ * @returns - An ISnapshotTree and its version.
293
+ */
294
+ async function getSnapshotTree(
295
+ mc: MonitoringContext,
296
+ storageAdapter: Pick<
297
+ IDocumentStorageService,
298
+ "getSnapshot" | "getSnapshotTree" | "getVersions"
299
+ >,
300
+ supportGetSnapshotApi: boolean,
301
+ specifiedVersion: string | undefined,
302
+ ): Promise<{ baseSnapshot: ISnapshotTree; version?: IVersion }> {
303
+ const { snapshot, version } = supportGetSnapshotApi
304
+ ? await fetchISnapshot(mc, storageAdapter, specifiedVersion)
305
+ : await fetchISnapshotTree(mc, storageAdapter, specifiedVersion);
306
+ const baseSnapshot: ISnapshotTree | undefined = isInstanceOfISnapshot(snapshot)
307
+ ? snapshot.snapshotTree
308
+ : snapshot;
309
+ assert(baseSnapshot !== undefined, 0x8e4 /* Snapshot should exist */);
310
+ return { baseSnapshot, version };
311
+ }
312
+
313
+ /**
314
+ * Fetches an ISnapshot from a storage adapter based on the specified version.
315
+ *
316
+ * @param mc - The monitoring context.
317
+ * @param storageAdapter - The storage adapter providing a getSnapshot method to retrieve the ISnapshot and version.
318
+ * @param specifiedVersion - An optional version string specifying the version of the snapshot tree to fetch.
319
+ * @returns - The fetched snapshot tree and its version.
320
+ */
174
321
  export async function fetchISnapshot(
175
322
  mc: MonitoringContext,
176
323
  storageAdapter: Pick<IDocumentStorageService, "getSnapshot">,
177
324
  specifiedVersion: string | undefined,
178
- ): Promise<{ snapshot?: ISnapshot | ISnapshotTree; version?: IVersion }> {
325
+ ): Promise<{ snapshot?: ISnapshot; version?: IVersion }> {
179
326
  const snapshot = await storageAdapter.getSnapshot?.({ versionId: specifiedVersion });
180
327
  const version: IVersion | undefined =
181
328
  snapshot?.snapshotTree.id === undefined
@@ -190,7 +337,6 @@ export async function fetchISnapshot(
190
337
  eventName: "getSnapshotTreeFailed",
191
338
  id: specifiedVersion,
192
339
  });
193
- // Not sure if this should be here actually
194
340
  } else if (snapshot !== undefined && version?.id === undefined) {
195
341
  mc.logger.sendErrorEvent({
196
342
  eventName: "getSnapshotFetchedTreeWithoutVersionId",
@@ -201,9 +347,12 @@ export async function fetchISnapshot(
201
347
  }
202
348
 
203
349
  /**
204
- * Get the most recent snapshot, or a specific version.
205
- * @param specifiedVersion - The specific version of the snapshot to retrieve
206
- * @returns The snapshot requested, or the latest snapshot if no version was specified, plus version ID
350
+ * Fetches an ISnapshotTree from a storage adapter based on the specified version.
351
+ *
352
+ * @param mc - The monitoring context.
353
+ * @param storageAdapter - The storage adapter providing methods to retrieve the ISnapshotTree and version.
354
+ * @param specifiedVersion - An optional version string specifying the version of the snapshot tree to fetch.
355
+ * @returns - The fetched snapshot tree and its version.
207
356
  */
208
357
  export async function fetchISnapshotTree(
209
358
  mc: MonitoringContext,