@fluidframework/container-loader 2.0.0-dev-rc.3.0.0.250606 → 2.0.0-dev-rc.3.0.0.254274
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/api-report/container-loader.api.md +11 -11
- package/dist/attachment.d.ts +2 -2
- package/dist/attachment.d.ts.map +1 -1
- package/dist/attachment.js +3 -3
- package/dist/attachment.js.map +1 -1
- package/dist/audience.d.ts +1 -1
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js +2 -2
- package/dist/audience.js.map +1 -1
- package/dist/catchUpMonitor.js +2 -2
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/connectionManager.d.ts +1 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +41 -41
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +27 -27
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container-loader-alpha.d.ts +11 -11
- package/dist/container-loader-beta.d.ts +11 -11
- package/dist/container-loader-public.d.ts +11 -11
- package/dist/container-loader-untrimmed.d.ts +11 -11
- package/dist/container.d.ts +5 -3
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +83 -81
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +5 -3
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +2 -2
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +6 -6
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +3 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +2 -2
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts +2 -1
- package/dist/debugLogger.d.ts.map +1 -1
- package/dist/debugLogger.js +4 -4
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts +7 -3
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +52 -49
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.js +5 -5
- package/dist/deltaQueue.js.map +1 -1
- package/dist/error.d.ts +3 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +5 -5
- package/dist/error.js.map +1 -1
- package/dist/loader.d.ts +2 -2
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +21 -21
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/dist/noopHeuristic.js +6 -6
- package/dist/noopHeuristic.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +2 -2
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +4 -4
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/quorum.d.ts +1 -1
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +1 -1
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +7 -7
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/serializedStateManager.d.ts +40 -9
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +133 -24
- package/dist/serializedStateManager.js.map +1 -1
- package/dist/utils.d.ts +19 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +57 -15
- package/dist/utils.js.map +1 -1
- package/lib/attachment.d.ts +2 -2
- package/lib/attachment.d.ts.map +1 -1
- package/lib/attachment.js +1 -1
- package/lib/attachment.js.map +1 -1
- package/lib/audience.d.ts +1 -1
- package/lib/audience.d.ts.map +1 -1
- package/lib/audience.js +1 -1
- package/lib/audience.js.map +1 -1
- package/lib/catchUpMonitor.js +1 -1
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/connectionManager.d.ts +1 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +4 -4
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +2 -2
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container-loader-alpha.d.ts +11 -11
- package/lib/container-loader-beta.d.ts +11 -11
- package/lib/container-loader-public.d.ts +11 -11
- package/lib/container-loader-untrimmed.d.ts +11 -11
- package/lib/container.d.ts +5 -3
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +14 -12
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +5 -3
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +2 -2
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +2 -2
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +3 -2
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts +2 -1
- package/lib/debugLogger.d.ts.map +1 -1
- package/lib/debugLogger.js +1 -1
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts +7 -3
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +12 -9
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.js +1 -1
- package/lib/deltaQueue.js.map +1 -1
- package/lib/error.d.ts +3 -2
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +2 -2
- package/lib/error.js.map +1 -1
- package/lib/loader.d.ts +2 -2
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +2 -2
- package/lib/loader.js.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/lib/noopHeuristic.js +2 -2
- package/lib/noopHeuristic.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol.d.ts +1 -1
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -1
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +4 -4
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/quorum.d.ts +1 -1
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +1 -1
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +3 -3
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/serializedStateManager.d.ts +40 -9
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +127 -19
- package/lib/serializedStateManager.js.map +1 -1
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/utils.d.ts +19 -3
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +44 -4
- package/lib/utils.js.map +1 -1
- package/package.json +19 -31
- package/src/attachment.ts +4 -3
- package/src/audience.ts +2 -2
- package/src/catchUpMonitor.ts +1 -1
- package/src/connectionManager.ts +7 -7
- package/src/connectionStateHandler.ts +4 -4
- package/src/container.ts +26 -22
- package/src/containerContext.ts +8 -5
- package/src/containerStorageAdapter.ts +5 -4
- package/src/contracts.ts +2 -3
- package/src/debugLogger.ts +2 -3
- package/src/deltaManager.ts +23 -13
- package/src/deltaQueue.ts +1 -1
- package/src/error.ts +5 -4
- package/src/loader.ts +5 -4
- package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +3 -3
- package/src/noopHeuristic.ts +2 -2
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +2 -2
- package/src/protocolTreeDocumentStorageService.ts +4 -1
- package/src/quorum.ts +1 -1
- package/src/retriableDocumentStorageService.ts +5 -4
- package/src/serializedStateManager.ts +188 -23
- package/src/utils.ts +56 -5
- package/lib/test/attachment.spec.js +0 -380
- package/lib/test/attachment.spec.js.map +0 -1
- package/lib/test/catchUpMonitor.spec.js +0 -88
- package/lib/test/catchUpMonitor.spec.js.map +0 -1
- package/lib/test/connectionManager.spec.js +0 -201
- package/lib/test/connectionManager.spec.js.map +0 -1
- package/lib/test/connectionStateHandler.spec.js +0 -555
- package/lib/test/connectionStateHandler.spec.js.map +0 -1
- package/lib/test/container.spec.js +0 -64
- package/lib/test/container.spec.js.map +0 -1
- package/lib/test/deltaManager.spec.js +0 -405
- package/lib/test/deltaManager.spec.js.map +0 -1
- package/lib/test/loader.spec.js +0 -212
- package/lib/test/loader.spec.js.map +0 -1
- package/lib/test/locationRedirectionTests.spec.js +0 -44
- package/lib/test/locationRedirectionTests.spec.js.map +0 -1
- package/lib/test/serializedStateManager.spec.js +0 -151
- package/lib/test/serializedStateManager.spec.js.map +0 -1
- package/lib/test/snapshotConversionTest.spec.js +0 -79
- package/lib/test/snapshotConversionTest.spec.js.map +0 -1
- package/lib/test/types/validateContainerLoaderPrevious.generated.js +0 -38
- package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +0 -1
- package/lib/test/utils.spec.js +0 -96
- package/lib/test/utils.spec.js.map +0 -1
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
7
|
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
8
|
-
import { IAudienceOwner } from '@fluidframework/container-definitions';
|
|
8
|
+
import { IAudienceOwner } from '@fluidframework/container-definitions/internal';
|
|
9
9
|
import { IClientDetails } from '@fluidframework/protocol-definitions';
|
|
10
10
|
import { IConfigProviderBase } from '@fluidframework/core-interfaces';
|
|
11
|
-
import { IContainer } from '@fluidframework/container-definitions';
|
|
11
|
+
import { IContainer } from '@fluidframework/container-definitions/internal';
|
|
12
12
|
import { IDocumentAttributes } from '@fluidframework/protocol-definitions';
|
|
13
|
-
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
|
|
14
|
-
import { IDocumentStorageService } from '@fluidframework/driver-definitions';
|
|
15
|
-
import { IFluidCodeDetails } from '@fluidframework/container-definitions';
|
|
16
|
-
import { IFluidModule } from '@fluidframework/container-definitions';
|
|
17
|
-
import { IHostLoader } from '@fluidframework/container-definitions';
|
|
18
|
-
import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions';
|
|
19
|
-
import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
|
|
13
|
+
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions/internal';
|
|
14
|
+
import { IDocumentStorageService } from '@fluidframework/driver-definitions/internal';
|
|
15
|
+
import { IFluidCodeDetails } from '@fluidframework/container-definitions/internal';
|
|
16
|
+
import { IFluidModule } from '@fluidframework/container-definitions/internal';
|
|
17
|
+
import { IHostLoader } from '@fluidframework/container-definitions/internal';
|
|
18
|
+
import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions/internal';
|
|
19
|
+
import { ILocationRedirectionError } from '@fluidframework/driver-definitions/internal';
|
|
20
20
|
import { IProtocolHandler as IProtocolHandler_2 } from '@fluidframework/protocol-base';
|
|
21
|
-
import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions';
|
|
21
|
+
import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions/internal';
|
|
22
22
|
import { IQuorumSnapshot } from '@fluidframework/protocol-base';
|
|
23
23
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
24
24
|
import { ISignalMessage } from '@fluidframework/protocol-definitions';
|
|
25
25
|
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
26
26
|
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
27
|
-
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
27
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions/internal';
|
|
28
28
|
|
|
29
29
|
// @public
|
|
30
30
|
export enum ConnectionState {
|
package/dist/attachment.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
6
|
-
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
7
|
-
import { CombinedAppAndProtocolSummary } from "@fluidframework/driver-utils";
|
|
6
|
+
import { IDocumentStorageService } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import { CombinedAppAndProtocolSummary } from "@fluidframework/driver-utils/internal";
|
|
8
8
|
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
9
9
|
import { IDetachedBlobStorage } from "./loader.js";
|
|
10
10
|
import type { SnapshotWithBlobs } from "./serializedStateManager.js";
|
package/dist/attachment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,EAAE,uBAA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C,QAAQ,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACvB,mBAAmB,GACnB,gCAAgC,GAChC,yBAAyB,GACzB,sBAAsB,GACtB,YAAY,CAAC;AAEhB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAEtE;;;;;8DAK0D;IAC1D,QAAQ,CAAC,iBAAiB,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC;IAErE;;;;;OAKG;IACH,QAAQ,CAAC,yBAAyB,EAAE,CACnC,IAAI,EAAE,YAAY,GAAG,SAAS,KAC1B,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,YAAY,GAAG,0BAA0B,CAAC,CAAC,CAAC;IAEvF;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;IAE9F;;;;OAIG;IACH,QAAQ,CAAC,uBAAuB,EAAE,CACjC,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAC/B,6BAA6B,CAAC;IAEnC;;OAEG;IACH,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACrC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,UAC9B,kBAAkB,KACvB,QAAQ,iBAAiB,GAAG,SAAS,CAqFvC,CAAC"}
|
package/dist/attachment.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.runRetriableAttachProcess = void 0;
|
|
8
8
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
10
10
|
const utils_js_1 = require("./utils.js");
|
|
11
11
|
/**
|
|
12
12
|
* Executes the attach process state machine based on the provided data and services.
|
|
@@ -43,7 +43,7 @@ const runRetriableAttachProcess = async (props) => {
|
|
|
43
43
|
if (currentData.blobs === "outstanding") {
|
|
44
44
|
const { redirectTable } = currentData;
|
|
45
45
|
// upload blobs to storage
|
|
46
|
-
(0,
|
|
46
|
+
(0, internal_1.assert)(!!detachedBlobStorage, 0x24e /* "assertion for type narrowing" */);
|
|
47
47
|
// build a table mapping IDs assigned locally to IDs assigned by storage and pass it to runtime to
|
|
48
48
|
// support blob handles that only know about the local IDs
|
|
49
49
|
while (redirectTable.size < detachedBlobStorage.size) {
|
|
@@ -60,7 +60,7 @@ const runRetriableAttachProcess = async (props) => {
|
|
|
60
60
|
blobs: "done",
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
|
-
(0,
|
|
63
|
+
(0, internal_1.assert)(currentData.state === container_definitions_1.AttachState.Attaching, 0x8e2 /* must be attaching by this point */);
|
|
64
64
|
if (currentData.blobs === "done") {
|
|
65
65
|
// done means outstanding blobs were uploaded.
|
|
66
66
|
// in that case an empty file was created, the blobs were uploaded
|
package/dist/attachment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.js","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AACpE,2DAAoD;AAMpD,yCAA4E;AAoH5E;;;;;;GAMG;AACI,MAAM,yBAAyB,GAAG,KAAK,EAC7C,KAAyB,EACgB,EAAE;IAC3C,MAAM,EACL,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,GAClB,GAAG,KAAK,CAAC;IACV,IAAI,WAAW,GAAmB,KAAK,CAAC,qBAAqB,CAAC;IAE9D,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,EAAE;QACpC,iGAAiG;QACjG,MAAM,0BAA0B,GAC/B,mBAAmB,KAAK,SAAS,IAAI,mBAAmB,CAAC,IAAI,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AAiB,CAChB,CAAC,WAAW,GAAG;YACd,KAAK,EAAE,mCAAW,CAAC,SAAS;YAC5B,OAAO,EAAE,uBAAuB,CAAC,aAAa,CAAC;YAC/C,KAAK,EAAE,MAAM;SACb,CAAC,CACF,CAAC;KACF;IAED,IAAA,mBAAM,EACL,WAAW,CAAC,KAAK,KAAK,mCAAW,CAAC,SAAS,EAC3C,KAAK,CAAC,qCAAqC,CAC3C,CAAC;IAEF,IAAI,WAAW,CAAC,KAAK,KAAK,MAAM,EAAE;QACjC,8CAA8C;QAC9C,kEAAkE;QAClE,2CAA2C;QAC3C,MAAM,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,OAAO,EAAE;YAC3D,uBAAuB,EAAE,CAAC;YAC1B,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,SAAS;SACzB,CAAC,CAAC;KACH;IAED,MAAM,QAAQ,GAAkC,kBAAkB;QACjE,CAAC,CAAC,IAAA,yDAA8C,EAAC,WAAW,CAAC,OAAO,CAAC;QACrE,CAAC,CAAC,SAAS,CAAC;IAEb,iBAAiB,CAChB,CAAC,WAAW,GAAG;QACd,KAAK,EAAE,mCAAW,CAAC,QAAQ;KAC3B,CAAC,CACF,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAvFW,QAAA,yBAAyB,6BAuFpC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { IDetachedBlobStorage } from \"./loader.js\";\nimport type { SnapshotWithBlobs } from \"./serializedStateManager.js\";\nimport { getSnapshotTreeAndBlobsFromSerializedContainer } from \"./utils.js\";\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}\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 (\n\tprops: AttachProcessProps,\n): Promise<SnapshotWithBlobs | undefined> => {\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(\n\t\tcurrentData.state === AttachState.Attaching,\n\t\t0x8e2 /* must be attaching by this point */,\n\t);\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\tconst snapshot: SnapshotWithBlobs | undefined = offlineLoadEnabled\n\t\t? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)\n\t\t: undefined;\n\n\tsetAttachmentData(\n\t\t(currentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t}),\n\t);\n\treturn snapshot;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"attachment.js","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AACpE,kEAA6D;AAO7D,yCAA4E;AAoH5E;;;;;;GAMG;AACI,MAAM,yBAAyB,GAAG,KAAK,EAC7C,KAAyB,EACgB,EAAE;IAC3C,MAAM,EACL,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,GAClB,GAAG,KAAK,CAAC;IACV,IAAI,WAAW,GAAmB,KAAK,CAAC,qBAAqB,CAAC;IAE9D,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,EAAE;QACpC,iGAAiG;QACjG,MAAM,0BAA0B,GAC/B,mBAAmB,KAAK,SAAS,IAAI,mBAAmB,CAAC,IAAI,GAAG,CAAC,CAAC;QACnE,uFAAuF;QACvF,sFAAsF;QACtF,4FAA4F;QAC5F,WAAW,GAAG,0BAA0B;YACvC,CAAC,CAAC;gBACA,KAAK,EAAE,mCAAW,CAAC,QAAQ;gBAC3B,KAAK,EAAE,aAAa;gBACpB,aAAa,EAAE,IAAI,GAAG,EAAkB;aACvC;YACH,CAAC,CAAC;gBACA,KAAK,EAAE,mCAAW,CAAC,SAAS;gBAC5B,OAAO,EAAE,KAAK,CAAC,uBAAuB,EAAE;gBACxC,KAAK,EAAE,MAAM;aACZ,CAAC;QACL,iBAAiB,CAAC,WAAW,CAAC,CAAC;KAC/B;IAED,uDAAuD;IACvD,8DAA8D;IAC9D,MAAM,OAAO,GAAG,MAAM,yBAAyB,CAAC,WAAW,CAAC,OA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AAc,EAAE,SAAS;SACzB,CAAC,CAAC;KACH;IAED,MAAM,QAAQ,GAAkC,kBAAkB;QACjE,CAAC,CAAC,IAAA,yDAA8C,EAAC,WAAW,CAAC,OAAO,CAAC;QACrE,CAAC,CAAC,SAAS,CAAC;IAEb,iBAAiB,CAChB,CAAC,WAAW,GAAG;QACd,KAAK,EAAE,mCAAW,CAAC,QAAQ;KAC3B,CAAC,CACF,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAvFW,QAAA,yBAAyB,6BAuFpC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions/internal\";\nimport { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils/internal\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\n\nimport { IDetachedBlobStorage } from \"./loader.js\";\nimport type { SnapshotWithBlobs } from \"./serializedStateManager.js\";\nimport { getSnapshotTreeAndBlobsFromSerializedContainer } from \"./utils.js\";\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}\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 (\n\tprops: AttachProcessProps,\n): Promise<SnapshotWithBlobs | undefined> => {\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(\n\t\tcurrentData.state === AttachState.Attaching,\n\t\t0x8e2 /* must be attaching by this point */,\n\t);\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\tconst snapshot: SnapshotWithBlobs | undefined = offlineLoadEnabled\n\t\t? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)\n\t\t: undefined;\n\n\tsetAttachmentData(\n\t\t(currentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t}),\n\t);\n\treturn snapshot;\n};\n"]}
|
package/dist/audience.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { EventEmitter } from "@fluid-internal/client-utils";
|
|
6
|
-
import { IAudienceOwner } from "@fluidframework/container-definitions";
|
|
6
|
+
import { IAudienceOwner } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import { IClient } from "@fluidframework/protocol-definitions";
|
|
8
8
|
/**
|
|
9
9
|
* Audience represents all clients connected to the op stream.
|
package/dist/audience.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D;;GAEG;AACH,qBAAa,QAAS,SAAQ,YAAa,YAAW,cAAc;IACnE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;;IAQ/C,EAAE,CACR,KAAK,EAAE,WAAW,GAAG,cAAc,EACnC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,GACnD,IAAI;IAKP;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAenD;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAW9C;;;;;OAKG;IACI,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAIzC;;;;;OAKG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;CAGvD"}
|
package/dist/audience.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.Audience = void 0;
|
|
8
8
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
10
10
|
/**
|
|
11
11
|
* Audience represents all clients connected to the op stream.
|
|
12
12
|
*/
|
|
@@ -28,7 +28,7 @@ class Audience extends client_utils_1.EventEmitter {
|
|
|
28
28
|
// In such case we should see exactly same payload (IClient), and should not raise event twice!
|
|
29
29
|
if (this.members.has(clientId)) {
|
|
30
30
|
const client = this.members.get(clientId);
|
|
31
|
-
(0,
|
|
31
|
+
(0, internal_1.assert)(JSON.stringify(client) === JSON.stringify(details), 0x4b2 /* new client has different payload from existing one */);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
34
|
this.members.set(clientId, details);
|
package/dist/audience.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA4D;AAE5D,
|
|
1
|
+
{"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA4D;AAE5D,kEAA6D;AAG7D;;GAEG;AACH,MAAa,QAAS,SAAQ,2BAAY;IAGzC;QACC,KAAK,EAAE,CAAC;QAHQ,YAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;QAIrD,kHAAkH;QAClH,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAMM,EAAE,CAAC,KAAa,EAAE,QAAkC;QAC1D,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB,EAAE,OAAgB;QAClD,mGAAmG;QACnG,+FAA+F;QAC/F,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC1C,IAAA,iBAAM,EACL,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;;;;;OAKG;IACI,UAAU;QAChB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACD;AArED,4BAqEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { EventEmitter } from \"@fluid-internal/client-utils\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\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\t * @remarks When the container is disconnected, this will keep returning the audience as it was last seen before the\n\t * container disconnected.\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\t * @remarks When the container is disconnected, this will keep returning members from the audience as it was last seen\n\t * before the container disconnected.\n\t */\n\tpublic getMember(clientId: string): IClient | undefined {\n\t\treturn this.members.get(clientId);\n\t}\n}\n"]}
|
package/dist/catchUpMonitor.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.CatchUpMonitor = void 0;
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
/**
|
|
10
10
|
* Monitors a Container's DeltaManager, notifying listeners when all ops have been processed
|
|
11
11
|
* that were known at the time the monitor was created.
|
|
@@ -26,7 +26,7 @@ class CatchUpMonitor {
|
|
|
26
26
|
};
|
|
27
27
|
this.disposed = false;
|
|
28
28
|
this.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;
|
|
29
|
-
(0,
|
|
29
|
+
(0, internal_1.assert)(this.targetSeqNumber >= this.deltaManager.lastSequenceNumber, 0x37c /* Cannot wait for seqNumber below last processed sequence number */);
|
|
30
30
|
this.deltaManager.on("op", this.opHandler);
|
|
31
31
|
// Simulate the last processed op to set caughtUp in case we already are
|
|
32
32
|
this.opHandler({ sequenceNumber: this.deltaManager.lastSequenceNumber });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catchUpMonitor.js","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,
|
|
1
|
+
{"version":3,"file":"catchUpMonitor.js","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,kEAA6D;AAS7D;;;GAGG;AACH,MAAa,cAAc;IAW1B;;OAEG;IACH,YACkB,YAAqC,EACrC,QAA0B;QAD1B,iBAAY,GAAZ,YAAY,CAAyB;QACrC,aAAQ,GAAR,QAAQ,CAAkB;QAdpC,aAAQ,GAAY,KAAK,CAAC;QAEjB,cAAS,GAAG,CAAC,OAA0D,EAAE,EAAE;YAC3F,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE;gBACrE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACrB,IAAI,CAAC,QAAQ,EAAE,CAAC;aAChB;QACF,CAAC,CAAC;QAsBK,aAAQ,GAAY,KAAK,CAAC;QAbhC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC;QAE5D,IAAA,iBAAM,EACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAC5D,KAAK,CAAC,oEAAoE,CAC1E,CAAC;QAEF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3C,wEAAwE;QACxE,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC1E,CAAC;IAGM,OAAO;QACb,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACP;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD;AAxCD,wCAwCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/** @see CatchUpMonitor for usage */\ntype CaughtUpListener = () => void;\n\n/** Monitor that emits an event when a Container has caught up to a given point in the op stream */\nexport type ICatchUpMonitor = IDisposable;\n\n/**\n * Monitors a Container's DeltaManager, notifying listeners when all ops have been processed\n * that were known at the time the monitor was created.\n */\nexport class CatchUpMonitor implements ICatchUpMonitor {\n\tprivate readonly targetSeqNumber: number;\n\tprivate caughtUp: boolean = false;\n\n\tprivate readonly opHandler = (message: Pick<ISequencedDocumentMessage, \"sequenceNumber\">) => {\n\t\tif (!this.caughtUp && message.sequenceNumber >= this.targetSeqNumber) {\n\t\t\tthis.caughtUp = true;\n\t\t\tthis.listener();\n\t\t}\n\t};\n\n\t/**\n\t * Create the CatchUpMonitor, setting the target sequence number to wait for based on DeltaManager's current state.\n\t */\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<any, any>,\n\t\tprivate readonly listener: CaughtUpListener,\n\t) {\n\t\tthis.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\n\t\tassert(\n\t\t\tthis.targetSeqNumber >= this.deltaManager.lastSequenceNumber,\n\t\t\t0x37c /* Cannot wait for seqNumber below last processed sequence number */,\n\t\t);\n\n\t\tthis.deltaManager.on(\"op\", this.opHandler);\n\n\t\t// Simulate the last processed op to set caughtUp in case we already are\n\t\tthis.opHandler({ sequenceNumber: this.deltaManager.lastSequenceNumber });\n\t}\n\n\tpublic disposed: boolean = false;\n\tpublic dispose() {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.disposed = true;\n\n\t\tthis.deltaManager.off(\"op\", this.opHandler);\n\t}\n}\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ICriticalContainerError, IDeltaQueue, ReadOnlyInfo } from "@fluidframework/container-definitions";
|
|
6
6
|
import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { IDocumentService } from "@fluidframework/driver-definitions";
|
|
7
|
+
import { IDocumentService } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
import { ConnectionMode, IClient, IClientConfiguration, IClientDetails, IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
9
9
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
10
10
|
import { IConnectionManager, IConnectionManagerFactoryArgs, IConnectionStateChangeReason, ReconnectMode } from "./contracts.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAe,wBAAwB,EAAY,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAe,wBAAwB,EAAY,MAAM,iCAAiC,CAAC;AAGlG,OAAO,EAGN,gBAAgB,EAChB,MAAM,6CAA6C,CAAC;AAUrD,OAAO,EACN,cAAc,EACd,OAAO,EACP,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAGhB,yBAAyB,EAOzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAStE,OAAO,EAEN,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,EAC5B,aAAa,EACb,MAAM,gBAAgB,CAAC;AAiIxB;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,kBAAkB;IAoL1D,OAAO,CAAC,QAAQ,CAAC,eAAe;aAChB,cAAc,EAAE,MAAM,OAAO;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAxLvB,qEAAqE;IACrE,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAiB;IAEzD;;;;OAIG;IACH,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,UAAU,CAAuC;IAEzD,kEAAkE;IAClE,OAAO,CAAC,o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
7
|
exports.ConnectionManager = void 0;
|
|
8
8
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
9
|
const core_interfaces_1 = require("@fluidframework/core-interfaces");
|
|
10
|
-
const
|
|
10
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
11
11
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
12
|
-
const
|
|
12
|
+
const internal_2 = require("@fluidframework/driver-utils/internal");
|
|
13
13
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
14
|
-
const
|
|
14
|
+
const internal_3 = require("@fluidframework/telemetry-utils/internal");
|
|
15
15
|
const contracts_js_1 = require("./contracts.js");
|
|
16
16
|
const deltaQueue_js_1 = require("./deltaQueue.js");
|
|
17
17
|
const protocol_js_1 = require("./protocol.js");
|
|
@@ -24,7 +24,7 @@ function getNackReconnectInfo(nackContent) {
|
|
|
24
24
|
const message = `Nack (${nackContent.type}): ${nackContent.message}`;
|
|
25
25
|
const canRetry = nackContent.code !== 403;
|
|
26
26
|
const retryAfterMs = nackContent.retryAfter !== undefined ? nackContent.retryAfter * 1000 : undefined;
|
|
27
|
-
return (0,
|
|
27
|
+
return (0, internal_2.createGenericNetworkError)(message, { canRetry, retryAfterMs }, { statusCode: nackContent.code, driverVersion: undefined });
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Implementation of IDocumentDeltaConnection that does not support submitting
|
|
@@ -253,7 +253,7 @@ class ConnectionManager {
|
|
|
253
253
|
this.nackHandler = (documentId, messages) => {
|
|
254
254
|
const message = messages[0];
|
|
255
255
|
if (this._readonlyPermissions === true) {
|
|
256
|
-
this.props.closeHandler((0,
|
|
256
|
+
this.props.closeHandler((0, internal_2.createWriteError)("writeOnReadOnlyDocument", { driverVersion: undefined }));
|
|
257
257
|
return;
|
|
258
258
|
}
|
|
259
259
|
const reconnectInfo = getNackReconnectInfo(message.content);
|
|
@@ -285,7 +285,7 @@ class ConnectionManager {
|
|
|
285
285
|
this.connection.submit(messages);
|
|
286
286
|
});
|
|
287
287
|
this._outbound.on("error", (error) => {
|
|
288
|
-
this.props.closeHandler((0,
|
|
288
|
+
this.props.closeHandler((0, internal_3.normalizeError)(error));
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
dispose(error, switchToReadonly = true) {
|
|
@@ -315,7 +315,7 @@ class ConnectionManager {
|
|
|
315
315
|
* Will throw an error if reconnectMode set to Never.
|
|
316
316
|
*/
|
|
317
317
|
setAutoReconnect(mode, reason) {
|
|
318
|
-
(0,
|
|
318
|
+
(0, internal_1.assert)(mode !== contracts_js_1.ReconnectMode.Never && this._reconnectMode !== contracts_js_1.ReconnectMode.Never, 0x278 /* "API is not supported for non-connecting or closed container" */);
|
|
319
319
|
this._reconnectMode = mode;
|
|
320
320
|
if (mode !== contracts_js_1.ReconnectMode.Enabled) {
|
|
321
321
|
// immediately disconnect - do not rely on service eventually dropping connection.
|
|
@@ -336,7 +336,7 @@ class ConnectionManager {
|
|
|
336
336
|
this._forceReadonly = readonly;
|
|
337
337
|
if (oldValue !== this.readonly) {
|
|
338
338
|
if (this._reconnectMode === contracts_js_1.ReconnectMode.Never) {
|
|
339
|
-
throw new
|
|
339
|
+
throw new internal_3.UsageError("API is not supported for non-connecting or closed container");
|
|
340
340
|
}
|
|
341
341
|
let reconnect = false;
|
|
342
342
|
if (this.readonly === true) {
|
|
@@ -365,12 +365,12 @@ class ConnectionManager {
|
|
|
365
365
|
}
|
|
366
366
|
connect(reason, connectionMode) {
|
|
367
367
|
this.connectCore(reason, connectionMode).catch((e) => {
|
|
368
|
-
const normalizedError = (0,
|
|
368
|
+
const normalizedError = (0, internal_3.normalizeError)(e, { props: fatalConnectErrorProp });
|
|
369
369
|
this.props.closeHandler(normalizedError);
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
async connectCore(reason, connectionMode) {
|
|
373
|
-
(0,
|
|
373
|
+
(0, internal_1.assert)(!this._disposed, 0x26a /* "not closed" */);
|
|
374
374
|
if (this.connection !== undefined) {
|
|
375
375
|
return; // Connection attempt already completed successfully
|
|
376
376
|
}
|
|
@@ -378,7 +378,7 @@ class ConnectionManager {
|
|
|
378
378
|
if (this.pendingConnection !== undefined) {
|
|
379
379
|
pendingConnectionMode = this.pendingConnection.connectionMode;
|
|
380
380
|
this.cancelConnection(reason); // Throw out in-progress connection attempt in favor of new attempt
|
|
381
|
-
(0,
|
|
381
|
+
(0, internal_1.assert)(this.pendingConnection === undefined, 0x344 /* this.pendingConnection should be undefined */);
|
|
382
382
|
}
|
|
383
383
|
// If there is no specified ConnectionMode, try the previous mode, if there is no previous mode use default
|
|
384
384
|
let requestedMode = connectionMode ?? pendingConnectionMode ?? this.defaultReconnectionMode;
|
|
@@ -391,12 +391,12 @@ class ConnectionManager {
|
|
|
391
391
|
requestedMode = "write";
|
|
392
392
|
}
|
|
393
393
|
const docService = this.serviceProvider();
|
|
394
|
-
(0,
|
|
394
|
+
(0, internal_1.assert)(docService !== undefined, 0x2a7 /* "Container is not attached" */);
|
|
395
395
|
let connection;
|
|
396
396
|
if (docService.policies?.storageOnly === true) {
|
|
397
397
|
connection = new NoDeltaStream();
|
|
398
398
|
this.setupNewSuccessfulConnection(connection, "read", reason);
|
|
399
|
-
(0,
|
|
399
|
+
(0, internal_1.assert)(this.pendingConnection === undefined, 0x2b3 /* "logic error" */);
|
|
400
400
|
return;
|
|
401
401
|
}
|
|
402
402
|
let delayMs = InitialReconnectDelayInMs;
|
|
@@ -421,7 +421,7 @@ class ConnectionManager {
|
|
|
421
421
|
this.logger.sendTelemetryEvent({
|
|
422
422
|
eventName: "ConnectionAttemptCancelled",
|
|
423
423
|
attempts: connectRepeatCount,
|
|
424
|
-
duration: (0,
|
|
424
|
+
duration: (0, internal_3.formatTick)(client_utils_1.performance.now() - connectStartTime),
|
|
425
425
|
connectionEstablished: false,
|
|
426
426
|
});
|
|
427
427
|
return;
|
|
@@ -456,7 +456,7 @@ class ConnectionManager {
|
|
|
456
456
|
requestedMode = "read";
|
|
457
457
|
break;
|
|
458
458
|
}
|
|
459
|
-
else if ((0,
|
|
459
|
+
else if ((0, internal_3.isFluidError)(origError) &&
|
|
460
460
|
origError.errorType === driver_definitions_1.DriverErrorTypes.outOfStorageError) {
|
|
461
461
|
// If we get out of storage error from calling joinsession, then use the NoDeltaStream object so
|
|
462
462
|
// that user can at least load the container.
|
|
@@ -468,28 +468,28 @@ class ConnectionManager {
|
|
|
468
468
|
break;
|
|
469
469
|
}
|
|
470
470
|
// Socket.io error when we connect to wrong socket, or hit some multiplexing bug
|
|
471
|
-
if (!(0,
|
|
472
|
-
const error = (0,
|
|
471
|
+
if (!(0, internal_2.canRetryOnError)(origError)) {
|
|
472
|
+
const error = (0, internal_3.normalizeError)(origError, { props: fatalConnectErrorProp });
|
|
473
473
|
this.props.closeHandler(error);
|
|
474
474
|
throw error;
|
|
475
475
|
}
|
|
476
476
|
// Since the error is retryable this will not log to the error table
|
|
477
|
-
(0,
|
|
477
|
+
(0, internal_2.logNetworkFailure)(this.logger, {
|
|
478
478
|
attempts: connectRepeatCount,
|
|
479
479
|
delay: delayMs,
|
|
480
480
|
eventName: "DeltaConnectionFailureToConnect",
|
|
481
|
-
duration: (0,
|
|
481
|
+
duration: (0, internal_3.formatTick)(client_utils_1.performance.now() - connectStartTime),
|
|
482
482
|
}, origError);
|
|
483
483
|
lastError = origError;
|
|
484
484
|
const waitStartTime = client_utils_1.performance.now();
|
|
485
|
-
const retryDelayFromError = (0,
|
|
485
|
+
const retryDelayFromError = (0, internal_2.getRetryDelayFromError)(origError);
|
|
486
486
|
// If the error told us to wait or browser signals us that we are offline, then calculate the time we
|
|
487
487
|
// want to wait for before retrying. then we wait for that time. If the error didn't tell us to wait,
|
|
488
488
|
// let's still wait a little bit before retrying. We can skip this delay if we're confident we're offline,
|
|
489
489
|
// because we probably just need to wait to come back online. But we never have strong signal of being
|
|
490
490
|
// offline, so we at least wait for sometime.
|
|
491
491
|
if (retryDelayFromError !== undefined || globalThis.navigator?.onLine !== false) {
|
|
492
|
-
delayMs = (0,
|
|
492
|
+
delayMs = (0, internal_2.calculateMaxWaitTime)(delayMs, origError);
|
|
493
493
|
}
|
|
494
494
|
// Raise event in case the delay was there from the error.
|
|
495
495
|
if (retryDelayFromError !== undefined) {
|
|
@@ -514,10 +514,10 @@ class ConnectionManager {
|
|
|
514
514
|
}
|
|
515
515
|
// If we retried more than once, log an event about how long it took (this will not log to error table)
|
|
516
516
|
if (connectRepeatCount > 1) {
|
|
517
|
-
(0,
|
|
517
|
+
(0, internal_2.logNetworkFailure)(this.logger, {
|
|
518
518
|
eventName: "MultipleDeltaConnectionFailures",
|
|
519
519
|
attempts: connectRepeatCount,
|
|
520
|
-
duration: (0,
|
|
520
|
+
duration: (0, internal_3.formatTick)(client_utils_1.performance.now() - connectStartTime),
|
|
521
521
|
}, lastError);
|
|
522
522
|
}
|
|
523
523
|
// Check for abort signal after while loop as well or we've been disposed
|
|
@@ -526,7 +526,7 @@ class ConnectionManager {
|
|
|
526
526
|
this.logger.sendTelemetryEvent({
|
|
527
527
|
eventName: "ConnectionAttemptCancelled",
|
|
528
528
|
attempts: connectRepeatCount,
|
|
529
|
-
duration: (0,
|
|
529
|
+
duration: (0, internal_3.formatTick)(client_utils_1.performance.now() - connectStartTime),
|
|
530
530
|
connectionEstablished: true,
|
|
531
531
|
});
|
|
532
532
|
return;
|
|
@@ -565,7 +565,7 @@ class ConnectionManager {
|
|
|
565
565
|
}
|
|
566
566
|
return false;
|
|
567
567
|
}
|
|
568
|
-
(0,
|
|
568
|
+
(0, internal_1.assert)(this.pendingConnection === undefined, 0x27b /* "reentrancy may result in incorrect behavior" */);
|
|
569
569
|
const connection = this.connection;
|
|
570
570
|
// Avoid any re-entrancy - clear object reference
|
|
571
571
|
this.connection = undefined;
|
|
@@ -588,7 +588,7 @@ class ConnectionManager {
|
|
|
588
588
|
* Cancel in-progress connection attempt.
|
|
589
589
|
*/
|
|
590
590
|
cancelConnection(reason) {
|
|
591
|
-
(0,
|
|
591
|
+
(0, internal_1.assert)(this.pendingConnection !== undefined, 0x345 /* this.pendingConnection is undefined when trying to cancel */);
|
|
592
592
|
this.pendingConnection.abort();
|
|
593
593
|
this.pendingConnection = undefined;
|
|
594
594
|
this.logger.sendTelemetryEvent({ eventName: "ConnectionCancelReceived" });
|
|
@@ -604,8 +604,8 @@ class ConnectionManager {
|
|
|
604
604
|
*/
|
|
605
605
|
setupNewSuccessfulConnection(connection, requestedMode, reason) {
|
|
606
606
|
// Old connection should have been cleaned up before establishing a new one
|
|
607
|
-
(0,
|
|
608
|
-
(0,
|
|
607
|
+
(0, internal_1.assert)(this.connection === undefined, 0x0e6 /* "old connection exists on new connection setup" */);
|
|
608
|
+
(0, internal_1.assert)(!connection.disposed, 0x28a /* "can't be disposed - Callers need to ensure that!" */);
|
|
609
609
|
this.pendingConnection = undefined;
|
|
610
610
|
const oldReadonlyValue = this.readonly;
|
|
611
611
|
this.connection = connection;
|
|
@@ -622,8 +622,8 @@ class ConnectionManager {
|
|
|
622
622
|
}
|
|
623
623
|
// This connection mode validation logic is moving to the driver layer in 0.44. These two asserts can be
|
|
624
624
|
// removed after those packages have released and become ubiquitous.
|
|
625
|
-
(0,
|
|
626
|
-
(0,
|
|
625
|
+
(0, internal_1.assert)(requestedMode === "read" || readonly === (this.connectionMode === "read"), 0x0e7 /* "claims/connectionMode mismatch" */);
|
|
626
|
+
(0, internal_1.assert)(!readonly || this.connectionMode === "read", 0x0e8 /* "readonly perf with write connection" */);
|
|
627
627
|
this.set_readonlyPermissions(readonly, oldReadonlyValue, isNoDeltaStreamConnection(connection) ? connection.readonlyConnectionReason : undefined);
|
|
628
628
|
if (this._disposed) {
|
|
629
629
|
// Raise proper events, Log telemetry event and close connection.
|
|
@@ -725,7 +725,7 @@ class ConnectionManager {
|
|
|
725
725
|
// We quite often get protocol errors before / after observing nack/disconnect
|
|
726
726
|
// we do not want to run through same sequence twice.
|
|
727
727
|
// If we're already disconnected/disconnecting it's not appropriate to call this again.
|
|
728
|
-
(0,
|
|
728
|
+
(0, internal_1.assert)(this.connection !== undefined, 0x0eb /* "Missing connection for reconnect" */);
|
|
729
729
|
this.disconnectFromDeltaStream(reason);
|
|
730
730
|
// We will always trigger reconnect, even if canRetry is false.
|
|
731
731
|
// Any truly fatal error state will result in container close upon attempted reconnect,
|
|
@@ -747,7 +747,7 @@ class ConnectionManager {
|
|
|
747
747
|
return;
|
|
748
748
|
}
|
|
749
749
|
// If the error tells us to wait before retrying, then do so.
|
|
750
|
-
const delayMs = (0,
|
|
750
|
+
const delayMs = (0, internal_2.getRetryDelayFromError)(reason.error);
|
|
751
751
|
if (reason.error !== undefined && delayMs !== undefined) {
|
|
752
752
|
this.props.reconnectionDelayHandler(delayMs, reason.error);
|
|
753
753
|
await new Promise((resolve) => {
|
|
@@ -767,8 +767,8 @@ class ConnectionManager {
|
|
|
767
767
|
}
|
|
768
768
|
prepareMessageToSend(message) {
|
|
769
769
|
if (this.readonly === true) {
|
|
770
|
-
(0,
|
|
771
|
-
const error = new
|
|
770
|
+
(0, internal_1.assert)(this.readOnlyInfo.readonly === true, 0x1f0 /* "Unexpected mismatch in readonly" */);
|
|
771
|
+
const error = new internal_3.GenericError("deltaManagerReadonlySubmit", undefined /* error */, {
|
|
772
772
|
readonly: this.readOnlyInfo.readonly,
|
|
773
773
|
forcedReadonly: this.readOnlyInfo.forced,
|
|
774
774
|
readonlyPermissions: this.readOnlyInfo.permissions,
|
|
@@ -781,13 +781,13 @@ class ConnectionManager {
|
|
|
781
781
|
// reset clientSequenceNumber if we are using new clientId.
|
|
782
782
|
// we keep info about old connection as long as possible to be able to account for all non-acked ops
|
|
783
783
|
// that we pick up on next connection.
|
|
784
|
-
(0,
|
|
784
|
+
(0, internal_1.assert)(!!this.connection, 0x0e4 /* "Lost old connection!" */);
|
|
785
785
|
if (this.lastSubmittedClientId !== this.connection?.clientId) {
|
|
786
786
|
this.lastSubmittedClientId = this.connection?.clientId;
|
|
787
787
|
this.clientSequenceNumber = 0;
|
|
788
788
|
this.clientSequenceNumberObserved = 0;
|
|
789
789
|
}
|
|
790
|
-
if (!(0,
|
|
790
|
+
if (!(0, internal_2.isRuntimeMessage)(message)) {
|
|
791
791
|
this.localOpsToIgnore++;
|
|
792
792
|
}
|
|
793
793
|
else {
|
|
@@ -807,7 +807,7 @@ class ConnectionManager {
|
|
|
807
807
|
}
|
|
808
808
|
}
|
|
809
809
|
sendMessages(messages) {
|
|
810
|
-
(0,
|
|
810
|
+
(0, internal_1.assert)(this.connected, 0x2b4 /* "not connected on sending ops!" */);
|
|
811
811
|
// If connection is "read" or implicit "read" (got leave op for "write" connection),
|
|
812
812
|
// then op can't make it through - we will get a nack if op is sent.
|
|
813
813
|
// We can short-circuit this process.
|
|
@@ -829,17 +829,17 @@ class ConnectionManager {
|
|
|
829
829
|
}
|
|
830
830
|
return;
|
|
831
831
|
}
|
|
832
|
-
(0,
|
|
832
|
+
(0, internal_1.assert)(!this.pendingReconnect, 0x2b5 /* "logic error" */);
|
|
833
833
|
this._outbound.push(messages);
|
|
834
834
|
}
|
|
835
835
|
beforeProcessingIncomingOp(message) {
|
|
836
836
|
// if we have connection, and message is local, then we better treat is as local!
|
|
837
|
-
(0,
|
|
837
|
+
(0, internal_1.assert)(this.clientId !== message.clientId || this.lastSubmittedClientId === message.clientId, 0x0ee /* "Not accounting local messages correctly" */);
|
|
838
838
|
if (this.lastSubmittedClientId !== undefined &&
|
|
839
839
|
this.lastSubmittedClientId === message.clientId) {
|
|
840
840
|
const clientSequenceNumber = message.clientSequenceNumber;
|
|
841
|
-
(0,
|
|
842
|
-
(0,
|
|
841
|
+
(0, internal_1.assert)(this.clientSequenceNumberObserved < clientSequenceNumber, 0x0ef /* "client seq# not growing" */);
|
|
842
|
+
(0, internal_1.assert)(clientSequenceNumber <= this.clientSequenceNumber, 0x0f0 /* "Incoming local client seq# > generated by this client" */);
|
|
843
843
|
this.clientSequenceNumberObserved = clientSequenceNumber;
|
|
844
844
|
}
|
|
845
845
|
if (message.type === protocol_definitions_1.MessageType.ClientLeave) {
|