@fluidframework/container-loader 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.245554
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.
- package/.eslintrc.cjs +5 -6
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +48 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/container-loader.api.md +2 -2
- package/dist/attachment.d.ts +6 -7
- package/dist/attachment.d.ts.map +1 -1
- package/dist/attachment.js +6 -5
- package/dist/attachment.js.map +1 -1
- package/dist/audience.d.ts +9 -4
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js +10 -4
- package/dist/audience.js.map +1 -1
- package/dist/connectionManager.d.ts +3 -3
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +20 -18
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionState.d.ts +1 -0
- package/dist/connectionState.d.ts.map +1 -1
- package/dist/connectionState.js +1 -0
- package/dist/connectionState.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +7 -7
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +32 -32
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container-loader-alpha.d.ts +1 -0
- package/dist/container-loader-beta.d.ts +3 -0
- package/dist/container-loader-public.d.ts +3 -0
- package/dist/container-loader-untrimmed.d.ts +4 -4
- package/dist/container.d.ts +11 -22
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +101 -194
- package/dist/container.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +2 -3
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +4 -10
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts +5 -5
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +6 -6
- package/dist/deltaManager.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +2 -2
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +13 -17
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/index.d.ts +1 -1
- package/dist/location-redirection-utilities/index.d.ts.map +1 -1
- package/dist/location-redirection-utilities/index.js +3 -3
- package/dist/location-redirection-utilities/index.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +0 -1
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js +0 -3
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +0 -1
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +0 -6
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/serializedStateManager.d.ts +44 -0
- package/dist/serializedStateManager.d.ts.map +1 -0
- package/dist/serializedStateManager.js +149 -0
- package/dist/serializedStateManager.js.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/utils.d.ts +5 -6
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +10 -4
- package/dist/utils.js.map +1 -1
- package/lib/{attachment.d.mts → attachment.d.ts} +11 -8
- package/lib/attachment.d.ts.map +1 -0
- package/lib/{attachment.mjs → attachment.js} +11 -6
- package/lib/attachment.js.map +1 -0
- package/lib/{audience.d.mts → audience.d.ts} +14 -5
- package/lib/audience.d.ts.map +1 -0
- package/lib/{audience.mjs → audience.js} +14 -4
- package/lib/audience.js.map +1 -0
- package/lib/{catchUpMonitor.d.mts → catchUpMonitor.d.ts} +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -0
- package/lib/{catchUpMonitor.mjs → catchUpMonitor.js} +1 -1
- package/lib/catchUpMonitor.js.map +1 -0
- package/lib/{connectionManager.d.mts → connectionManager.d.ts} +4 -4
- package/lib/connectionManager.d.ts.map +1 -0
- package/lib/{connectionManager.mjs → connectionManager.js} +9 -7
- package/lib/connectionManager.js.map +1 -0
- package/lib/{connectionState.d.mts → connectionState.d.ts} +2 -1
- package/lib/connectionState.d.ts.map +1 -0
- package/lib/{connectionState.mjs → connectionState.js} +2 -1
- package/lib/connectionState.js.map +1 -0
- package/lib/{connectionStateHandler.d.mts → connectionStateHandler.d.ts} +8 -8
- package/lib/connectionStateHandler.d.ts.map +1 -0
- package/lib/{connectionStateHandler.mjs → connectionStateHandler.js} +3 -3
- package/lib/connectionStateHandler.js.map +1 -0
- package/lib/{container-loader-alpha.d.mts → container-loader-alpha.d.ts} +1 -0
- package/lib/{container-loader-beta.d.mts → container-loader-beta.d.ts} +3 -0
- package/lib/{container-loader-public.d.mts → container-loader-public.d.ts} +3 -0
- package/lib/{container-loader-untrimmed.d.mts → container-loader-untrimmed.d.ts} +4 -4
- package/lib/{container.d.mts → container.d.ts} +12 -23
- package/lib/container.d.ts.map +1 -0
- package/lib/{container.mjs → container.js} +55 -148
- package/lib/container.js.map +1 -0
- package/lib/{containerContext.d.mts → containerContext.d.ts} +1 -1
- package/lib/containerContext.d.ts.map +1 -0
- package/lib/{containerContext.mjs → containerContext.js} +1 -1
- package/lib/containerContext.js.map +1 -0
- package/lib/{containerStorageAdapter.d.mts → containerStorageAdapter.d.ts} +3 -4
- package/lib/containerStorageAdapter.d.ts.map +1 -0
- package/lib/{containerStorageAdapter.mjs → containerStorageAdapter.js} +3 -9
- package/lib/containerStorageAdapter.js.map +1 -0
- package/lib/{contracts.d.mts → contracts.d.ts} +4 -4
- package/lib/contracts.d.ts.map +1 -0
- package/lib/{contracts.mjs → contracts.js} +1 -1
- package/lib/contracts.js.map +1 -0
- package/lib/{debugLogger.d.mts → debugLogger.d.ts} +1 -1
- package/lib/debugLogger.d.ts.map +1 -0
- package/lib/{debugLogger.mjs → debugLogger.js} +2 -1
- package/lib/debugLogger.js.map +1 -0
- package/lib/{deltaManager.d.mts → deltaManager.d.ts} +6 -6
- package/lib/deltaManager.d.ts.map +1 -0
- package/lib/{deltaManager.mjs → deltaManager.js} +4 -4
- package/lib/deltaManager.js.map +1 -0
- package/lib/{deltaQueue.d.mts → deltaQueue.d.ts} +1 -1
- package/lib/deltaQueue.d.ts.map +1 -0
- package/lib/{deltaQueue.mjs → deltaQueue.js} +1 -1
- package/lib/deltaQueue.js.map +1 -0
- package/lib/{disposal.d.mts → disposal.d.ts} +1 -1
- package/lib/disposal.d.ts.map +1 -0
- package/lib/{disposal.mjs → disposal.js} +1 -1
- package/lib/disposal.js.map +1 -0
- package/lib/{error.d.mts → error.d.ts} +1 -1
- package/lib/error.d.ts.map +1 -0
- package/lib/{error.mjs → error.js} +1 -1
- package/lib/error.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +7 -7
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/{loader.d.mts → loader.d.ts} +3 -3
- package/lib/loader.d.ts.map +1 -0
- package/lib/{loader.mjs → loader.js} +7 -11
- package/lib/loader.js.map +1 -0
- package/lib/location-redirection-utilities/{index.mjs → index.d.ts} +2 -2
- package/lib/location-redirection-utilities/index.d.ts.map +1 -0
- package/lib/location-redirection-utilities/{index.d.mts → index.js} +2 -2
- package/lib/location-redirection-utilities/index.js.map +1 -0
- package/lib/location-redirection-utilities/{resolveWithLocationRedirection.d.mts → resolveWithLocationRedirection.d.ts} +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
- package/lib/location-redirection-utilities/{resolveWithLocationRedirection.mjs → resolveWithLocationRedirection.js} +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
- package/lib/{noopHeuristic.d.mts → noopHeuristic.d.ts} +1 -1
- package/lib/noopHeuristic.d.ts.map +1 -0
- package/lib/{noopHeuristic.mjs → noopHeuristic.js} +1 -1
- package/lib/noopHeuristic.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{protocol.d.mts → protocol.d.ts} +1 -1
- package/lib/protocol.d.ts.map +1 -0
- package/lib/{protocol.mjs → protocol.js} +1 -1
- package/lib/protocol.js.map +1 -0
- package/lib/{protocolTreeDocumentStorageService.d.mts → protocolTreeDocumentStorageService.d.ts} +1 -2
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -0
- package/lib/{protocolTreeDocumentStorageService.mjs → protocolTreeDocumentStorageService.js} +1 -4
- package/lib/protocolTreeDocumentStorageService.js.map +1 -0
- package/lib/{quorum.d.mts → quorum.d.ts} +5 -1
- package/lib/quorum.d.ts.map +1 -0
- package/lib/{quorum.mjs → quorum.js} +1 -1
- package/lib/quorum.js.map +1 -0
- package/lib/{retriableDocumentStorageService.d.mts → retriableDocumentStorageService.d.ts} +1 -2
- package/lib/retriableDocumentStorageService.d.ts.map +1 -0
- package/lib/{retriableDocumentStorageService.mjs → retriableDocumentStorageService.js} +1 -7
- package/lib/retriableDocumentStorageService.js.map +1 -0
- package/lib/serializedStateManager.d.ts +44 -0
- package/lib/serializedStateManager.d.ts.map +1 -0
- package/lib/serializedStateManager.js +145 -0
- package/lib/serializedStateManager.js.map +1 -0
- package/lib/test/attachment.spec.js +380 -0
- package/lib/test/attachment.spec.js.map +1 -0
- package/lib/test/catchUpMonitor.spec.js +88 -0
- package/lib/test/catchUpMonitor.spec.js.map +1 -0
- package/lib/test/connectionManager.spec.js +201 -0
- package/lib/test/connectionManager.spec.js.map +1 -0
- package/lib/test/connectionStateHandler.spec.js +555 -0
- package/lib/test/connectionStateHandler.spec.js.map +1 -0
- package/lib/test/container.spec.js +64 -0
- package/lib/test/container.spec.js.map +1 -0
- package/lib/test/deltaManager.spec.js +405 -0
- package/lib/test/deltaManager.spec.js.map +1 -0
- package/lib/test/loader.spec.js +212 -0
- package/lib/test/loader.spec.js.map +1 -0
- package/lib/test/locationRedirectionTests.spec.js +44 -0
- package/lib/test/locationRedirectionTests.spec.js.map +1 -0
- package/lib/test/serializedStateManager.spec.js +148 -0
- package/lib/test/serializedStateManager.spec.js.map +1 -0
- package/lib/test/snapshotConversionTest.spec.js +79 -0
- package/lib/test/snapshotConversionTest.spec.js.map +1 -0
- package/lib/test/types/validateContainerLoaderPrevious.generated.js +38 -0
- package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +1 -0
- package/lib/test/utils.spec.js +31 -0
- package/lib/test/utils.spec.js.map +1 -0
- package/lib/{utils.d.mts → utils.d.ts} +6 -7
- package/lib/utils.d.ts.map +1 -0
- package/lib/{utils.mjs → utils.js} +11 -5
- package/lib/utils.js.map +1 -0
- package/package.json +56 -62
- package/src/attachment.ts +15 -12
- package/src/audience.ts +9 -3
- package/src/connectionManager.ts +13 -9
- package/src/connectionState.ts +1 -0
- package/src/connectionStateHandler.ts +8 -7
- package/src/container.ts +96 -191
- package/src/containerStorageAdapter.ts +6 -14
- package/src/contracts.ts +3 -3
- package/src/debugLogger.ts +2 -2
- package/src/deltaManager.ts +8 -8
- package/src/error.ts +2 -2
- package/src/index.ts +6 -6
- package/src/loader.ts +8 -12
- package/src/location-redirection-utilities/index.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/protocolTreeDocumentStorageService.ts +0 -3
- package/src/retriableDocumentStorageService.ts +0 -7
- package/src/serializedStateManager.ts +217 -0
- package/src/utils.ts +15 -10
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/lib/attachment.d.mts.map +0 -1
- package/lib/attachment.mjs.map +0 -1
- package/lib/audience.d.mts.map +0 -1
- package/lib/audience.mjs.map +0 -1
- package/lib/catchUpMonitor.d.mts.map +0 -1
- package/lib/catchUpMonitor.mjs.map +0 -1
- package/lib/connectionManager.d.mts.map +0 -1
- package/lib/connectionManager.mjs.map +0 -1
- package/lib/connectionState.d.mts.map +0 -1
- package/lib/connectionState.mjs.map +0 -1
- package/lib/connectionStateHandler.d.mts.map +0 -1
- package/lib/connectionStateHandler.mjs.map +0 -1
- package/lib/container.d.mts.map +0 -1
- package/lib/container.mjs.map +0 -1
- package/lib/containerContext.d.mts.map +0 -1
- package/lib/containerContext.mjs.map +0 -1
- package/lib/containerStorageAdapter.d.mts.map +0 -1
- package/lib/containerStorageAdapter.mjs.map +0 -1
- package/lib/contracts.d.mts.map +0 -1
- package/lib/contracts.mjs.map +0 -1
- package/lib/debugLogger.d.mts.map +0 -1
- package/lib/debugLogger.mjs.map +0 -1
- package/lib/deltaManager.d.mts.map +0 -1
- package/lib/deltaManager.mjs.map +0 -1
- package/lib/deltaQueue.d.mts.map +0 -1
- package/lib/deltaQueue.mjs.map +0 -1
- package/lib/disposal.d.mts.map +0 -1
- package/lib/disposal.mjs.map +0 -1
- package/lib/error.d.mts.map +0 -1
- package/lib/error.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -10
- package/lib/index.mjs.map +0 -1
- package/lib/loader.d.mts.map +0 -1
- package/lib/loader.mjs.map +0 -1
- package/lib/location-redirection-utilities/index.d.mts.map +0 -1
- package/lib/location-redirection-utilities/index.mjs.map +0 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts.map +0 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +0 -1
- package/lib/noopHeuristic.d.mts.map +0 -1
- package/lib/noopHeuristic.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/protocol.d.mts.map +0 -1
- package/lib/protocol.mjs.map +0 -1
- package/lib/protocolTreeDocumentStorageService.d.mts.map +0 -1
- package/lib/protocolTreeDocumentStorageService.mjs.map +0 -1
- package/lib/quorum.d.mts.map +0 -1
- package/lib/quorum.mjs.map +0 -1
- package/lib/retriableDocumentStorageService.d.mts.map +0 -1
- package/lib/retriableDocumentStorageService.mjs.map +0 -1
- package/lib/utils.d.mts.map +0 -1
- package/lib/utils.mjs.map +0 -1
|
@@ -25,9 +25,9 @@ import {
|
|
|
25
25
|
ISummaryTree,
|
|
26
26
|
IVersion,
|
|
27
27
|
} from "@fluidframework/protocol-definitions";
|
|
28
|
-
import { IDetachedBlobStorage } from "./loader";
|
|
29
|
-
import { ProtocolTreeStorageService } from "./protocolTreeDocumentStorageService";
|
|
30
|
-
import { RetriableDocumentStorageService } from "./retriableDocumentStorageService";
|
|
28
|
+
import { IDetachedBlobStorage } from "./loader.js";
|
|
29
|
+
import { ProtocolTreeStorageService } from "./protocolTreeDocumentStorageService.js";
|
|
30
|
+
import { RetriableDocumentStorageService } from "./retriableDocumentStorageService.js";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Stringified blobs from a summary/snapshot tree.
|
|
@@ -118,10 +118,6 @@ export class ContainerStorageAdapter implements IDocumentStorageService, IDispos
|
|
|
118
118
|
return undefined;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
public get repositoryUrl(): string {
|
|
122
|
-
return this._storageService.repositoryUrl;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
121
|
public async getSnapshotTree(
|
|
126
122
|
version?: IVersion,
|
|
127
123
|
scenarioName?: string,
|
|
@@ -204,10 +200,6 @@ class BlobOnlyStorage implements IDocumentStorageService {
|
|
|
204
200
|
return this.notCalled();
|
|
205
201
|
}
|
|
206
202
|
|
|
207
|
-
public get repositoryUrl(): string {
|
|
208
|
-
return this.notCalled();
|
|
209
|
-
}
|
|
210
|
-
|
|
211
203
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
212
204
|
public getSnapshotTree: () => Promise<ISnapshotTree | null> = this.notCalled;
|
|
213
205
|
public getSnapshot: () => Promise<ISnapshot> = this.notCalled;
|
|
@@ -242,7 +234,7 @@ const redirectTableBlobName = ".redirectTable";
|
|
|
242
234
|
*/
|
|
243
235
|
export async function getBlobContentsFromTree(
|
|
244
236
|
snapshot: ISnapshotTree,
|
|
245
|
-
storage: IDocumentStorageService,
|
|
237
|
+
storage: Pick<IDocumentStorageService, "readBlob">,
|
|
246
238
|
): Promise<ISerializableBlobContents> {
|
|
247
239
|
const blobs = {};
|
|
248
240
|
await getBlobContentsFromTreeCore(snapshot, blobs, storage);
|
|
@@ -252,7 +244,7 @@ export async function getBlobContentsFromTree(
|
|
|
252
244
|
async function getBlobContentsFromTreeCore(
|
|
253
245
|
tree: ISnapshotTree,
|
|
254
246
|
blobs: ISerializableBlobContents,
|
|
255
|
-
storage: IDocumentStorageService,
|
|
247
|
+
storage: Pick<IDocumentStorageService, "readBlob">,
|
|
256
248
|
root = true,
|
|
257
249
|
) {
|
|
258
250
|
const treePs: Promise<any>[] = [];
|
|
@@ -275,7 +267,7 @@ async function getBlobContentsFromTreeCore(
|
|
|
275
267
|
async function getBlobManagerTreeFromTree(
|
|
276
268
|
tree: ISnapshotTree,
|
|
277
269
|
blobs: ISerializableBlobContents,
|
|
278
|
-
storage: IDocumentStorageService,
|
|
270
|
+
storage: Pick<IDocumentStorageService, "readBlob">,
|
|
279
271
|
) {
|
|
280
272
|
const id = tree.blobs[redirectTableBlobName];
|
|
281
273
|
const blob = await storage.readBlob(id);
|
package/src/contracts.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IErrorBase,
|
|
6
|
+
import { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import {
|
|
8
8
|
IConnectionDetails,
|
|
9
9
|
ICriticalContainerError,
|
|
@@ -73,12 +73,12 @@ export interface IConnectionManager {
|
|
|
73
73
|
// Various connectivity properties for telemetry describing type of current connection
|
|
74
74
|
// Things like connection mode, service info, etc.
|
|
75
75
|
// Called when connection state changes (connect / disconnect)
|
|
76
|
-
readonly connectionProps:
|
|
76
|
+
readonly connectionProps: ITelemetryBaseProperties;
|
|
77
77
|
|
|
78
78
|
// Verbose information about connection logged to telemetry in case of issues with
|
|
79
79
|
// maintaining healthy connection, including op gaps, not receiving join op in time, etc.
|
|
80
80
|
// Contains details information, like sequence numbers at connection time, initial ops info, etc.
|
|
81
|
-
readonly connectionVerboseProps:
|
|
81
|
+
readonly connectionVerboseProps: ITelemetryBaseProperties;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Prepares message to be sent. Fills in clientSequenceNumber.
|
package/src/debugLogger.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import {
|
|
7
7
|
ITelemetryBaseEvent,
|
|
8
8
|
ITelemetryBaseLogger,
|
|
9
|
-
|
|
9
|
+
ITelemetryBaseProperties,
|
|
10
10
|
} from "@fluidframework/core-interfaces";
|
|
11
11
|
import { performance } from "@fluid-internal/client-utils";
|
|
12
12
|
|
|
@@ -77,7 +77,7 @@ export class DebugLogger implements ITelemetryBaseLogger {
|
|
|
77
77
|
* @param event - the event to send
|
|
78
78
|
*/
|
|
79
79
|
public send(event: ITelemetryBaseEvent): void {
|
|
80
|
-
const newEvent:
|
|
80
|
+
const newEvent: ITelemetryBaseProperties = { ...event };
|
|
81
81
|
const isError = newEvent.category === "error";
|
|
82
82
|
let logger = isError ? this.debugErr : this.debug;
|
|
83
83
|
|
package/src/deltaManager.ts
CHANGED
|
@@ -7,8 +7,7 @@ import { v4 as uuid } from "uuid";
|
|
|
7
7
|
import {
|
|
8
8
|
IThrottlingWarning,
|
|
9
9
|
IEventProvider,
|
|
10
|
-
|
|
11
|
-
ITelemetryErrorEvent,
|
|
10
|
+
ITelemetryBaseProperties,
|
|
12
11
|
type ITelemetryBaseEvent,
|
|
13
12
|
} from "@fluidframework/core-interfaces";
|
|
14
13
|
import {
|
|
@@ -29,6 +28,7 @@ import {
|
|
|
29
28
|
DataCorruptionError,
|
|
30
29
|
UsageError,
|
|
31
30
|
type ITelemetryGenericEventExt,
|
|
31
|
+
type ITelemetryErrorEventExt,
|
|
32
32
|
} from "@fluidframework/telemetry-utils";
|
|
33
33
|
import {
|
|
34
34
|
IDocumentDeltaStorageService,
|
|
@@ -49,9 +49,9 @@ import {
|
|
|
49
49
|
IConnectionManager,
|
|
50
50
|
IConnectionManagerFactoryArgs,
|
|
51
51
|
IConnectionStateChangeReason,
|
|
52
|
-
} from "./contracts";
|
|
53
|
-
import { DeltaQueue } from "./deltaQueue";
|
|
54
|
-
import { ThrottlingWarning } from "./error";
|
|
52
|
+
} from "./contracts.js";
|
|
53
|
+
import { DeltaQueue } from "./deltaQueue.js";
|
|
54
|
+
import { ThrottlingWarning } from "./error.js";
|
|
55
55
|
|
|
56
56
|
export interface IConnectionArgs {
|
|
57
57
|
mode?: ConnectionMode;
|
|
@@ -361,7 +361,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
361
361
|
assert(this.messageBuffer.length === 0, 0x3cc /* reentrancy */);
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
-
public get connectionProps():
|
|
364
|
+
public get connectionProps(): ITelemetryBaseProperties {
|
|
365
365
|
return {
|
|
366
366
|
sequenceNumber: this.lastSequenceNumber,
|
|
367
367
|
opsSize: this.opsSize > 0 ? this.opsSize : undefined,
|
|
@@ -376,7 +376,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
376
376
|
* we stop processing ops that results in no processing join op and thus moving to connected state)
|
|
377
377
|
* @param event - Event to log.
|
|
378
378
|
*/
|
|
379
|
-
public logConnectionIssue(event:
|
|
379
|
+
public logConnectionIssue(event: ITelemetryErrorEventExt) {
|
|
380
380
|
assert(this.connectionManager.connected, 0x238 /* "called only in connected state" */);
|
|
381
381
|
|
|
382
382
|
const pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);
|
|
@@ -797,7 +797,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
797
797
|
|
|
798
798
|
private disconnectHandler(reason: IConnectionStateChangeReason) {
|
|
799
799
|
this.messageBuffer.length = 0;
|
|
800
|
-
this.emit("disconnect", reason);
|
|
800
|
+
this.emit("disconnect", reason.text, reason.error);
|
|
801
801
|
}
|
|
802
802
|
|
|
803
803
|
/**
|
package/src/error.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryBaseProperties, IThrottlingWarning } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { ContainerErrorTypes } from "@fluidframework/container-definitions";
|
|
8
8
|
import {
|
|
9
9
|
IFluidErrorBase,
|
|
@@ -24,7 +24,7 @@ export class ThrottlingWarning extends LoggingError implements IThrottlingWarnin
|
|
|
24
24
|
private constructor(
|
|
25
25
|
message: string,
|
|
26
26
|
readonly retryAfterSeconds: number,
|
|
27
|
-
props?:
|
|
27
|
+
props?: ITelemetryBaseProperties,
|
|
28
28
|
) {
|
|
29
29
|
super(message, props);
|
|
30
30
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export { ConnectionState } from "./connectionState";
|
|
7
|
-
export { IContainerExperimental, waitContainerToCatchUp } from "./container";
|
|
6
|
+
export { ConnectionState } from "./connectionState.js";
|
|
7
|
+
export { IContainerExperimental, waitContainerToCatchUp } from "./container.js";
|
|
8
8
|
export {
|
|
9
9
|
ICodeDetailsLoader,
|
|
10
10
|
IDetachedBlobStorage,
|
|
@@ -13,10 +13,10 @@ export {
|
|
|
13
13
|
ILoaderProps,
|
|
14
14
|
ILoaderServices,
|
|
15
15
|
Loader,
|
|
16
|
-
} from "./loader";
|
|
16
|
+
} from "./loader.js";
|
|
17
17
|
export {
|
|
18
18
|
isLocationRedirectionError,
|
|
19
19
|
resolveWithLocationRedirectionHandling,
|
|
20
|
-
} from "./location-redirection-utilities";
|
|
21
|
-
export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol";
|
|
22
|
-
export { tryParseCompatibleResolvedUrl, IParsedUrl } from "./utils";
|
|
20
|
+
} from "./location-redirection-utilities/index.js";
|
|
21
|
+
export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol.js";
|
|
22
|
+
export { tryParseCompatibleResolvedUrl, IParsedUrl } from "./utils.js";
|
package/src/loader.ts
CHANGED
|
@@ -36,11 +36,11 @@ import {
|
|
|
36
36
|
IUrlResolver,
|
|
37
37
|
} from "@fluidframework/driver-definitions";
|
|
38
38
|
import { IClientDetails } from "@fluidframework/protocol-definitions";
|
|
39
|
-
import { Container, IPendingContainerState } from "./container";
|
|
40
|
-
import {
|
|
41
|
-
import { pkgVersion } from "./packageVersion";
|
|
42
|
-
import { ProtocolHandlerBuilder } from "./protocol";
|
|
43
|
-
import { DebugLogger } from "./debugLogger";
|
|
39
|
+
import { Container, IPendingContainerState } from "./container.js";
|
|
40
|
+
import { tryParseCompatibleResolvedUrl } from "./utils.js";
|
|
41
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
42
|
+
import { ProtocolHandlerBuilder } from "./protocol.js";
|
|
43
|
+
import { DebugLogger } from "./debugLogger.js";
|
|
44
44
|
|
|
45
45
|
function ensureResolvedUrlDefined(
|
|
46
46
|
resolved: IResolvedUrl | undefined,
|
|
@@ -332,18 +332,17 @@ export class Loader implements IHostLoader {
|
|
|
332
332
|
public async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {
|
|
333
333
|
const eventName = pendingLocalState === undefined ? "Resolve" : "ResolveWithPendingState";
|
|
334
334
|
return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {
|
|
335
|
-
|
|
335
|
+
return this.resolveCore(
|
|
336
336
|
request,
|
|
337
337
|
pendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,
|
|
338
338
|
);
|
|
339
|
-
return resolved.container;
|
|
340
339
|
});
|
|
341
340
|
}
|
|
342
341
|
|
|
343
342
|
private async resolveCore(
|
|
344
343
|
request: IRequest,
|
|
345
344
|
pendingLocalState?: IPendingContainerState,
|
|
346
|
-
): Promise<
|
|
345
|
+
): Promise<Container> {
|
|
347
346
|
const resolvedAsFluid = await this.services.urlResolver.resolve(request);
|
|
348
347
|
ensureResolvedUrlDefined(resolvedAsFluid);
|
|
349
348
|
|
|
@@ -387,10 +386,7 @@ export class Loader implements IHostLoader {
|
|
|
387
386
|
throw new UsageError('opsBeforeReturn must be set to "sequenceNumber"');
|
|
388
387
|
}
|
|
389
388
|
|
|
390
|
-
return
|
|
391
|
-
container: await this.loadContainer(request, resolvedAsFluid, pendingLocalState),
|
|
392
|
-
parsed,
|
|
393
|
-
};
|
|
389
|
+
return this.loadContainer(request, resolvedAsFluid, pendingLocalState);
|
|
394
390
|
}
|
|
395
391
|
|
|
396
392
|
private async loadContainer(
|
package/src/packageVersion.ts
CHANGED
|
@@ -19,9 +19,6 @@ export class ProtocolTreeStorageService implements IDocumentStorageService, IDis
|
|
|
19
19
|
public get policies() {
|
|
20
20
|
return this.internalStorageService.policies;
|
|
21
21
|
}
|
|
22
|
-
public get repositoryUrl() {
|
|
23
|
-
return this.internalStorageService.repositoryUrl;
|
|
24
|
-
}
|
|
25
22
|
public get disposed() {
|
|
26
23
|
return this.internalStorageService.disposed;
|
|
27
24
|
}
|
|
@@ -46,13 +46,6 @@ export class RetriableDocumentStorageService implements IDocumentStorageService,
|
|
|
46
46
|
this._disposed = true;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
public get repositoryUrl(): string {
|
|
50
|
-
if (this.internalStorageService) {
|
|
51
|
-
return this.internalStorageService.repositoryUrl;
|
|
52
|
-
}
|
|
53
|
-
throw new Error("storage service not yet instantiated");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
49
|
public async getSnapshotTree(
|
|
57
50
|
version?: IVersion,
|
|
58
51
|
scenarioName?: string,
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ISequencedDocumentMessage,
|
|
8
|
+
ISnapshotTree,
|
|
9
|
+
IVersion,
|
|
10
|
+
} from "@fluidframework/protocol-definitions";
|
|
11
|
+
import { IGetPendingLocalStateProps, IRuntime } from "@fluidframework/container-definitions";
|
|
12
|
+
import {
|
|
13
|
+
ITelemetryLoggerExt,
|
|
14
|
+
MonitoringContext,
|
|
15
|
+
PerformanceEvent,
|
|
16
|
+
UsageError,
|
|
17
|
+
createChildMonitoringContext,
|
|
18
|
+
} from "@fluidframework/telemetry-utils";
|
|
19
|
+
import { assert } from "@fluidframework/core-utils";
|
|
20
|
+
import {
|
|
21
|
+
IDocumentStorageService,
|
|
22
|
+
IResolvedUrl,
|
|
23
|
+
ISnapshot,
|
|
24
|
+
} from "@fluidframework/driver-definitions";
|
|
25
|
+
import { isInstanceOfISnapshot } from "@fluidframework/driver-utils";
|
|
26
|
+
import { ISerializableBlobContents, getBlobContentsFromTree } from "./containerStorageAdapter.js";
|
|
27
|
+
import { IPendingContainerState } from "./container.js";
|
|
28
|
+
|
|
29
|
+
export class SerializedStateManager {
|
|
30
|
+
private readonly processedOps: ISequencedDocumentMessage[] = [];
|
|
31
|
+
private snapshot:
|
|
32
|
+
| {
|
|
33
|
+
tree: ISnapshotTree;
|
|
34
|
+
blobs: ISerializableBlobContents;
|
|
35
|
+
}
|
|
36
|
+
| undefined;
|
|
37
|
+
private readonly mc: MonitoringContext;
|
|
38
|
+
|
|
39
|
+
constructor(
|
|
40
|
+
private readonly pendingLocalState: IPendingContainerState | undefined,
|
|
41
|
+
subLogger: ITelemetryLoggerExt,
|
|
42
|
+
private readonly storageAdapter: Pick<
|
|
43
|
+
IDocumentStorageService,
|
|
44
|
+
"readBlob" | "getSnapshotTree" | "getSnapshot" | "getVersions"
|
|
45
|
+
>,
|
|
46
|
+
private readonly _offlineLoadEnabled: boolean,
|
|
47
|
+
) {
|
|
48
|
+
this.mc = createChildMonitoringContext({
|
|
49
|
+
logger: subLogger,
|
|
50
|
+
namespace: "serializedStateManager",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public get offlineLoadEnabled(): boolean {
|
|
55
|
+
return this._offlineLoadEnabled;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public addProcessedOp(message: ISequencedDocumentMessage) {
|
|
59
|
+
if (this.offlineLoadEnabled) {
|
|
60
|
+
this.processedOps.push(message);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private async getVersion(version: string | null): Promise<IVersion | undefined> {
|
|
65
|
+
const versions = await this.storageAdapter.getVersions(version, 1);
|
|
66
|
+
return versions[0];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public async fetchSnapshot(
|
|
70
|
+
specifiedVersion: string | undefined,
|
|
71
|
+
supportGetSnapshotApi: boolean | undefined,
|
|
72
|
+
) {
|
|
73
|
+
const { snapshot, version } =
|
|
74
|
+
this.pendingLocalState === undefined
|
|
75
|
+
? await this.fetchSnapshotCore(specifiedVersion, supportGetSnapshotApi)
|
|
76
|
+
: { snapshot: this.pendingLocalState.baseSnapshot, version: undefined };
|
|
77
|
+
const snapshotTree: ISnapshotTree | undefined = isInstanceOfISnapshot(snapshot)
|
|
78
|
+
? snapshot.snapshotTree
|
|
79
|
+
: snapshot;
|
|
80
|
+
if (this.pendingLocalState) {
|
|
81
|
+
this.snapshot = {
|
|
82
|
+
tree: this.pendingLocalState.baseSnapshot,
|
|
83
|
+
blobs: this.pendingLocalState.snapshotBlobs,
|
|
84
|
+
};
|
|
85
|
+
} else {
|
|
86
|
+
assert(snapshotTree !== undefined, 0x8e4 /* Snapshot should exist */);
|
|
87
|
+
// non-interactive clients will not have any pending state we want to save
|
|
88
|
+
if (this.offlineLoadEnabled) {
|
|
89
|
+
const blobs = await getBlobContentsFromTree(snapshotTree, this.storageAdapter);
|
|
90
|
+
this.snapshot = { tree: snapshotTree, blobs };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { snapshotTree, version };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private async fetchSnapshotCore(
|
|
97
|
+
specifiedVersion: string | undefined,
|
|
98
|
+
supportGetSnapshotApi: boolean | undefined,
|
|
99
|
+
): Promise<{ snapshot?: ISnapshot | ISnapshotTree; version?: IVersion }> {
|
|
100
|
+
if (
|
|
101
|
+
this.mc.config.getBoolean("Fluid.Container.UseLoadingGroupIdForSnapshotFetch") ===
|
|
102
|
+
true &&
|
|
103
|
+
supportGetSnapshotApi === true
|
|
104
|
+
) {
|
|
105
|
+
const snapshot =
|
|
106
|
+
(await this.storageAdapter.getSnapshot?.({
|
|
107
|
+
versionId: specifiedVersion,
|
|
108
|
+
})) ?? undefined;
|
|
109
|
+
const version: IVersion | undefined =
|
|
110
|
+
snapshot?.snapshotTree.id === undefined
|
|
111
|
+
? undefined
|
|
112
|
+
: {
|
|
113
|
+
id: snapshot.snapshotTree.id,
|
|
114
|
+
treeId: snapshot.snapshotTree.id,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
if (snapshot === undefined && specifiedVersion !== undefined) {
|
|
118
|
+
this.mc.logger.sendErrorEvent({
|
|
119
|
+
eventName: "getSnapshotTreeFailed",
|
|
120
|
+
id: specifiedVersion,
|
|
121
|
+
});
|
|
122
|
+
// Not sure if this should be here actually
|
|
123
|
+
} else if (snapshot !== undefined && version?.id === undefined) {
|
|
124
|
+
this.mc.logger.sendErrorEvent({
|
|
125
|
+
eventName: "getSnapshotFetchedTreeWithoutVersionId",
|
|
126
|
+
hasVersion: version !== undefined, // if hasVersion is true, this means that the contract with the service was broken.
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return { snapshot, version };
|
|
130
|
+
}
|
|
131
|
+
return this.fetchSnapshotTree(specifiedVersion);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get the most recent snapshot, or a specific version.
|
|
136
|
+
* @param specifiedVersion - The specific version of the snapshot to retrieve
|
|
137
|
+
* @returns The snapshot requested, or the latest snapshot if no version was specified, plus version ID
|
|
138
|
+
*/
|
|
139
|
+
private async fetchSnapshotTree(
|
|
140
|
+
specifiedVersion: string | undefined,
|
|
141
|
+
): Promise<{ snapshot?: ISnapshotTree; version?: IVersion | undefined }> {
|
|
142
|
+
const version = await this.getVersion(specifiedVersion ?? null);
|
|
143
|
+
|
|
144
|
+
if (version === undefined && specifiedVersion !== undefined) {
|
|
145
|
+
// We should have a defined version to load from if specified version requested
|
|
146
|
+
this.mc.logger.sendErrorEvent({
|
|
147
|
+
eventName: "NoVersionFoundWhenSpecified",
|
|
148
|
+
id: specifiedVersion,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
const snapshot = (await this.storageAdapter.getSnapshotTree(version)) ?? undefined;
|
|
152
|
+
|
|
153
|
+
if (snapshot === undefined && version !== undefined) {
|
|
154
|
+
this.mc.logger.sendErrorEvent({ eventName: "getSnapshotTreeFailed", id: version.id });
|
|
155
|
+
} else if (snapshot !== undefined && version?.id === undefined) {
|
|
156
|
+
this.mc.logger.sendErrorEvent({
|
|
157
|
+
eventName: "getSnapshotFetchedTreeWithoutVersionId",
|
|
158
|
+
hasVersion: version !== undefined, // if hasVersion is true, this means that the contract with the service was broken.
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return { snapshot, version };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* This method is only meant to be used by Container.attach() to set the initial
|
|
166
|
+
* base snapshot when attaching.
|
|
167
|
+
* @param snapshot - snapshot and blobs collected while attaching
|
|
168
|
+
*/
|
|
169
|
+
public setSnapshot(
|
|
170
|
+
snapshot:
|
|
171
|
+
| {
|
|
172
|
+
tree: ISnapshotTree;
|
|
173
|
+
blobs: ISerializableBlobContents;
|
|
174
|
+
}
|
|
175
|
+
| undefined,
|
|
176
|
+
) {
|
|
177
|
+
this.snapshot = snapshot;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public async getPendingLocalStateCore(
|
|
181
|
+
props: IGetPendingLocalStateProps,
|
|
182
|
+
clientId: string | undefined,
|
|
183
|
+
runtime: Pick<IRuntime, "getPendingLocalState">,
|
|
184
|
+
resolvedUrl: IResolvedUrl,
|
|
185
|
+
) {
|
|
186
|
+
return PerformanceEvent.timedExecAsync(
|
|
187
|
+
this.mc.logger,
|
|
188
|
+
{
|
|
189
|
+
eventName: "getPendingLocalState",
|
|
190
|
+
notifyImminentClosure: props.notifyImminentClosure,
|
|
191
|
+
processedOpsSize: this.processedOps.length,
|
|
192
|
+
clientId,
|
|
193
|
+
},
|
|
194
|
+
async () => {
|
|
195
|
+
if (!this.offlineLoadEnabled) {
|
|
196
|
+
throw new UsageError(
|
|
197
|
+
"Can't get pending local state unless offline load is enabled",
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
assert(this.snapshot !== undefined, 0x8e5 /* no base data */);
|
|
201
|
+
const pendingRuntimeState = await runtime.getPendingLocalState(props);
|
|
202
|
+
const pendingState: IPendingContainerState = {
|
|
203
|
+
attached: true,
|
|
204
|
+
pendingRuntimeState,
|
|
205
|
+
baseSnapshot: this.snapshot.tree,
|
|
206
|
+
snapshotBlobs: this.snapshot.blobs,
|
|
207
|
+
savedOps: this.processedOps,
|
|
208
|
+
url: resolvedUrl.url,
|
|
209
|
+
// no need to save this if there is no pending runtime state
|
|
210
|
+
clientId: pendingRuntimeState !== undefined ? clientId : undefined,
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
return JSON.stringify(pendingState);
|
|
214
|
+
},
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
}
|
package/src/utils.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { parse } from "url";
|
|
7
6
|
import { v4 as uuid } from "uuid";
|
|
8
7
|
import { Uint8ArrayToString, stringToBuffer } from "@fluid-internal/client-utils";
|
|
9
8
|
import { assert, compareArrays, unreachableCase } from "@fluidframework/core-utils";
|
|
@@ -15,8 +14,8 @@ import {
|
|
|
15
14
|
isCombinedAppAndProtocolSummary,
|
|
16
15
|
} from "@fluidframework/driver-utils";
|
|
17
16
|
import { DriverErrorTypes } from "@fluidframework/driver-definitions";
|
|
18
|
-
import { ISerializableBlobContents } from "./containerStorageAdapter";
|
|
19
|
-
import { IPendingDetachedContainerState } from "./container";
|
|
17
|
+
import { ISerializableBlobContents } from "./containerStorageAdapter.js";
|
|
18
|
+
import { IPendingDetachedContainerState } from "./container.js";
|
|
20
19
|
|
|
21
20
|
// This is used when we rehydrate a container from the snapshot. Here we put the blob contents
|
|
22
21
|
// in separate property: blobContents.
|
|
@@ -45,11 +44,10 @@ export interface IParsedUrl {
|
|
|
45
44
|
*/
|
|
46
45
|
query: string;
|
|
47
46
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* If needed, can add undefined which is treated by Container.load() as load latest snapshot.
|
|
47
|
+
* Undefined means load latest snapshot, otherwise it's version ID passed to IDocumentStorageService.getVersions()
|
|
48
|
+
* to figure out what snapshot to use.
|
|
51
49
|
*/
|
|
52
|
-
version: string |
|
|
50
|
+
version: string | undefined;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
/**
|
|
@@ -62,7 +60,7 @@ export interface IParsedUrl {
|
|
|
62
60
|
* @internal
|
|
63
61
|
*/
|
|
64
62
|
export function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined {
|
|
65
|
-
const parsed =
|
|
63
|
+
const parsed = new URL(url);
|
|
66
64
|
if (typeof parsed.pathname !== "string") {
|
|
67
65
|
throw new LoggingError("Failed to parse pathname");
|
|
68
66
|
}
|
|
@@ -70,7 +68,13 @@ export function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefin
|
|
|
70
68
|
const regex = /^\/([^/]*\/[^/]*)(\/?.*)$/;
|
|
71
69
|
const match = regex.exec(parsed.pathname);
|
|
72
70
|
return match?.length === 3
|
|
73
|
-
? {
|
|
71
|
+
? {
|
|
72
|
+
id: match[1],
|
|
73
|
+
path: match[2],
|
|
74
|
+
query,
|
|
75
|
+
// URLSearchParams returns null if the param is not provided.
|
|
76
|
+
version: parsed.searchParams.get("version") ?? undefined,
|
|
77
|
+
}
|
|
74
78
|
: undefined;
|
|
75
79
|
}
|
|
76
80
|
|
|
@@ -117,6 +121,7 @@ function convertSummaryToSnapshotAndBlobs(summary: ISummaryTree): {
|
|
|
117
121
|
trees: {},
|
|
118
122
|
id: uuid(),
|
|
119
123
|
unreferenced: summary.unreferenced,
|
|
124
|
+
groupId: summary.groupId,
|
|
120
125
|
};
|
|
121
126
|
const keys = Object.keys(summary.tree);
|
|
122
127
|
for (const key of keys) {
|
|
@@ -179,7 +184,7 @@ export const getSnapshotTreeAndBlobsFromSerializedContainer = (
|
|
|
179
184
|
): { tree: ISnapshotTree; blobs: ISerializableBlobContents } => {
|
|
180
185
|
assert(
|
|
181
186
|
isCombinedAppAndProtocolSummary(detachedContainerSnapshot),
|
|
182
|
-
|
|
187
|
+
0x8e6 /* Protocol and App summary trees should be present */,
|
|
183
188
|
);
|
|
184
189
|
const protocolSummaryTree = detachedContainerSnapshot.tree[".protocol"];
|
|
185
190
|
const appSummaryTree = detachedContainerSnapshot.tree[".app"];
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends":
|
|
3
|
-
"../../../common/build/build-common/tsconfig.base.json",
|
|
4
|
-
"../../../common/build/build-common/tsconfig.cjs.json",
|
|
5
|
-
],
|
|
2
|
+
"extends": "../../../common/build/build-common/tsconfig.node16.json",
|
|
6
3
|
"include": ["src/**/*"],
|
|
7
4
|
"exclude": ["src/test/**/*"],
|
|
8
5
|
"compilerOptions": {
|
|
9
6
|
"rootDir": "./src",
|
|
10
|
-
"outDir": "./
|
|
7
|
+
"outDir": "./lib",
|
|
11
8
|
},
|
|
12
9
|
}
|
package/lib/attachment.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.mts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"OAIO,EAAE,WAAW,EAAE,MAAM,uCAAuC;OAC5D,EAAE,6BAA6B,EAAE,MAAM,8BAA8B;OACrE,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sCAAsC;OAE3E,EAAE,uBAAuB,EAAE,MAAM,oCAAoC;OAErE,EAAE,yBAAyB,EAAE;OAC7B,EAAE,oBAAoB,EAAE,MAAM,GAAG;AAExC;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,WAAW,gCAAgC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAs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AAW,CAAC,OAAO,EAAE;YAC3D,uBAAuB,EAAE,CAAC;YAC1B,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,SAAS;SACzB,CAAC,CAAC;KACH;IAED,iBAAiB,CAChB,CAAC,WAAW,GAAG;QACd,KAAK,EAAE,WAAW,CAAC,QAAQ;QAC3B,QAAQ,EAAE,kBAAkB;YAC3B,CAAC,CAAC,8CAA8C,CAAC,WAAW,CAAC,OAAO,CAAC;YACrE,CAAC,CAAC,SAAS;KACZ,CAAC,CACF,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils\";\nimport { ISnapshotTree, ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { getSnapshotTreeAndBlobsFromSerializedContainer } from \"./utils\";\nimport { ISerializableBlobContents } from \"./containerStorageAdapter\";\nimport { IDetachedBlobStorage } from \".\";\n\n/**\n * The default state a newly created detached container will have.\n * All but the state are optional and undefined, they just exist\n * to make the union easy to deal with for both Detached types\n */\nexport interface DetachedDefaultData {\n\treadonly state: AttachState.Detached;\n\treadonly blobs?: undefined;\n\treadonly summary?: undefined;\n\treadonly redirectTable?: undefined;\n}\n\n/**\n * This always follows DetachedDefaultData when there are\n * outstanding blobs in the detached blob storage.\n * The redirect table will get filled up to include data\n * about the blobs as they are uploaded.\n */\nexport interface DetachedDataWithOutstandingBlobs {\n\treadonly state: AttachState.Detached;\n\treadonly blobs: \"outstanding\";\n\treadonly summary?: undefined;\n\treadonly redirectTable: Map<string, string>;\n}\n\n/**\n * This state always follows DetachedDataWithOutstandingBlobs.\n * It signals that all outstanding blobs are done being uploaded,\n * so the container can move to the attaching state.\n */\nexport interface AttachingDataWithBlobs {\n\treadonly state: AttachState.Attaching;\n\treadonly blobs: \"done\";\n\treadonly summary: CombinedAppAndProtocolSummary;\n}\n\n/**\n * This always follows DefaultDetachedState when there are\n * no blobs in the detached blob storage. Because there are\n * no blobs we can immediately get the summary and transition\n * to the attaching state.\n */\nexport interface AttachingDataWithoutBlobs {\n\treadonly state: AttachState.Attaching;\n\treadonly summary: CombinedAppAndProtocolSummary;\n\treadonly blobs: \"none\";\n}\n\n/**\n * The final attachment state which signals the container is fully attached.\n * The baseSnapshotAndBlobs will only be enabled when offline load is enabled.\n */\nexport interface AttachedData {\n\treadonly state: AttachState.Attached;\n\treadonly snapshot?: {\n\t\ttree: ISnapshotTree;\n\t\tblobs: ISerializableBlobContents;\n\t};\n}\n\n/**\n * A union of all the attachment data types for\n * tracking across all container attachment states\n */\nexport type AttachmentData =\n\t| DetachedDefaultData\n\t| DetachedDataWithOutstandingBlobs\n\t| AttachingDataWithoutBlobs\n\t| AttachingDataWithBlobs\n\t| AttachedData;\n\n/**\n * The data and services necessary for runRetriableAttachProcess.\n */\nexport interface AttachProcessProps {\n\t/**\n\t * The initial attachment data this call should start with\n\t */\n\treadonly initialAttachmentData: Exclude<AttachmentData, AttachedData>;\n\n\t/**\n\t * The caller should use this callback to keep track of the current\n\t * attachment data, and perform any other operations necessary\n\t * for dealing with attachment state changes, like emitting events\n\t *\n\t * @param attachmentData - the updated attachment data\t */\n\treadonly setAttachmentData: (attachmentData: AttachmentData) => void;\n\n\t/**\n\t * The caller should create and or get services based on the data, and its own information.\n\t * @param data - the data to create services from,\n\t * the summary property being the most relevant part of the data.\n\t * @returns A compatible storage service\n\t */\n\treadonly createOrGetStorageService: (\n\t\tdata: ISummaryTree | undefined,\n\t) => Promise<Pick<IDocumentStorageService, \"createBlob\" | \"uploadSummaryWithContext\">>;\n\n\t/**\n\t * The detached blob storage if it exists.\n\t */\n\treadonly detachedBlobStorage?: Pick<IDetachedBlobStorage, \"getBlobIds\" | \"readBlob\" | \"size\">;\n\n\t/**\n\t * The caller should create the attachment summary for the container.\n\t * @param redirectTable - Maps local blob ids to remote blobs ids.\n\t * @returns The attachment summary for the container.\n\t */\n\treadonly createAttachmentSummary: (\n\t\tredirectTable?: Map<string, string>,\n\t) => CombinedAppAndProtocolSummary;\n\n\t/**\n\t * Whether offline load is enabled or not.\n\t */\n\treadonly offlineLoadEnabled: boolean;\n}\n\n/**\n * Executes the attach process state machine based on the provided data and services.\n * This method is retriable on failure. Based on the provided initialAttachmentData\n * this method will resume the attachment process and attempt to complete it.\n *\n * @param props - The data and services necessary to run the attachment process\n */\nexport const runRetriableAttachProcess = async (props: AttachProcessProps): Promise<void> => {\n\tconst {\n\t\tdetachedBlobStorage,\n\t\tcreateOrGetStorageService,\n\t\tsetAttachmentData,\n\t\tcreateAttachmentSummary,\n\t\tofflineLoadEnabled,\n\t} = props;\n\tlet currentData: AttachmentData = props.initialAttachmentData;\n\n\tif (currentData.blobs === undefined) {\n\t\t// If attachment blobs were uploaded in detached state we will go through a different attach flow\n\t\tconst outstandingAttachmentBlobs =\n\t\t\tdetachedBlobStorage !== undefined && detachedBlobStorage.size > 0;\n\t\t// Determine the next phase of attaching which depends on if there are attachment blobs\n\t\t// if there are, we will stay detached, so an empty file can be created, and the blobs\n\t\t// uploaded, otherwise we will get the summary to create the file with and move to attaching\n\t\tcurrentData = outstandingAttachmentBlobs\n\t\t\t? {\n\t\t\t\t\tstate: AttachState.Detached,\n\t\t\t\t\tblobs: \"outstanding\",\n\t\t\t\t\tredirectTable: new Map<string, string>(),\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\t\tsummary: props.createAttachmentSummary(),\n\t\t\t\t\tblobs: \"none\",\n\t\t\t };\n\t\tsetAttachmentData(currentData);\n\t}\n\n\t// this has to run here, as it is what creates the file\n\t// and we need to file for all possible cases after this point\n\tconst storage = await createOrGetStorageService(currentData.summary);\n\n\tif (currentData.blobs === \"outstanding\") {\n\t\tconst { redirectTable } = currentData;\n\t\t// upload blobs to storage\n\t\tassert(!!detachedBlobStorage, 0x24e /* \"assertion for type narrowing\" */);\n\n\t\t// build a table mapping IDs assigned locally to IDs assigned by storage and pass it to runtime to\n\t\t// support blob handles that only know about the local IDs\n\t\twhile (redirectTable.size < detachedBlobStorage.size) {\n\t\t\tconst newIds = detachedBlobStorage.getBlobIds().filter((id) => !redirectTable.has(id));\n\t\t\tfor (const id of newIds) {\n\t\t\t\tconst blob = await detachedBlobStorage.readBlob(id);\n\t\t\t\tconst response = await storage.createBlob(blob);\n\t\t\t\tredirectTable.set(id, response.id);\n\t\t\t}\n\t\t}\n\t\tsetAttachmentData(\n\t\t\t(currentData = {\n\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\tsummary: createAttachmentSummary(redirectTable),\n\t\t\t\tblobs: \"done\",\n\t\t\t}),\n\t\t);\n\t}\n\n\tassert(currentData.state === AttachState.Attaching, \"must be attaching by this point\");\n\n\tif (currentData.blobs === \"done\") {\n\t\t// done means outstanding blobs were uploaded.\n\t\t// in that case an empty file was created, the blobs were uploaded\n\t\t// and now this finally uploads the summary\n\t\tawait storage.uploadSummaryWithContext(currentData.summary, {\n\t\t\treferenceSequenceNumber: 0,\n\t\t\tackHandle: undefined,\n\t\t\tproposalHandle: undefined,\n\t\t});\n\t}\n\n\tsetAttachmentData(\n\t\t(currentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t\tsnapshot: offlineLoadEnabled\n\t\t\t\t? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)\n\t\t\t\t: undefined,\n\t\t}),\n\t);\n};\n"]}
|
package/lib/audience.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audience.d.mts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";OAIO,EAAE,YAAY,EAAE,MAAM,QAAQ;OAE9B,EAAE,cAAc,EAAE,MAAM,uCAAuC;OAC/D,EAAE,OAAO,EAAE,MAAM,sCAAsC;AAE9D;;GAEG;AAC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G,CAAC,QAAQ,CAAC,CAAC;YAC1C,MAAM,CACL,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAClD,KAAK,CAAC,wDAAwD,CAC9D,CAAC;SACF;aAAM;YACN,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC1C;IACF,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,QAAgB;QACnC,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,aAAa,KAAK,SAAS,EAAE;YAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC;SACZ;aAAM;YACN,OAAO,KAAK,CAAC;SACb;IACF,CAAC;IAED;;OAEG;IACI,UAAU;QAChB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { EventEmitter } from \"events\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Audience represents all clients connected to the op stream.\n */\nexport class Audience extends EventEmitter implements IAudienceOwner {\n\tprivate readonly members = new Map<string, IClient>();\n\n\tconstructor() {\n\t\tsuper();\n\t\t// We are expecting this class to have many listeners, so we suppress noisy \"MaxListenersExceededWarning\" logging.\n\t\tsuper.setMaxListeners(0);\n\t}\n\n\tpublic on(\n\t\tevent: \"addMember\" | \"removeMember\",\n\t\tlistener: (clientId: string, client: IClient) => void,\n\t): this;\n\tpublic on(event: string, listener: (...args: any[]) => void): this {\n\t\treturn super.on(event, listener);\n\t}\n\n\t/**\n\t * Adds a new client to the audience\n\t */\n\tpublic addMember(clientId: string, details: IClient) {\n\t\t// Given that signal delivery is unreliable process, we might observe same client being added twice\n\t\t// In such case we should see exactly same payload (IClient), and should not raise event twice!\n\t\tif (this.members.has(clientId)) {\n\t\t\tconst client = this.members.get(clientId);\n\t\t\tassert(\n\t\t\t\tJSON.stringify(client) === JSON.stringify(details),\n\t\t\t\t0x4b2 /* new client has different payload from existing one */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.members.set(clientId, details);\n\t\t\tthis.emit(\"addMember\", clientId, details);\n\t\t}\n\t}\n\n\t/**\n\t * Removes a client from the audience. Only emits an event if a client is actually removed\n\t * @returns if a client was removed from the audience\n\t */\n\tpublic removeMember(clientId: string): boolean {\n\t\tconst removedClient = this.members.get(clientId);\n\t\tif (removedClient !== undefined) {\n\t\t\tthis.members.delete(clientId);\n\t\t\tthis.emit(\"removeMember\", clientId, removedClient);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all the members in the audience\n\t */\n\tpublic getMembers(): Map<string, IClient> {\n\t\treturn new Map(this.members);\n\t}\n\n\t/**\n\t * Retrieves a specific member of the audience\n\t */\n\tpublic getMember(clientId: string): IClient | undefined {\n\t\treturn this.members.get(clientId);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catchUpMonitor.d.mts","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,MAAM,iCAAiC;OAEtD,EAAE,aAAa,EAAE,MAAM,uCAAuC;AAGrE,oCAAoC;AACpC,KAAK,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAEnC,mGAAmG;AACnG,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C;;;GAGG;AACH,qBAAa,cAAe,YAAW,eAAe;IAepD,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAf1B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAkB;IAElC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAKxB;IAEF;;OAEG;gBAEe,YAAY,EAAE,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EACrC,QAAQ,EAAE,gBAAgB;IAerC,QAAQ,EAAE,OAAO,CAAS;IAC1B,OAAO;CAQd"}
|