@fluidframework/container-loader 2.0.2 → 2.1.0-276326
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 +2 -5
- package/api-extractor/api-extractor.legacy.json +4 -0
- package/api-report/container-loader.beta.api.md +0 -27
- package/api-report/{container-loader.alpha.api.md → container-loader.legacy.alpha.api.md} +0 -27
- package/api-report/container-loader.public.api.md +0 -27
- package/dist/attachment.d.ts +2 -1
- package/dist/attachment.d.ts.map +1 -1
- package/dist/attachment.js.map +1 -1
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js +4 -4
- package/dist/audience.js.map +1 -1
- package/dist/catchUpMonitor.d.ts +15 -4
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/catchUpMonitor.js +12 -3
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/connectionManager.d.ts +24 -8
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +36 -23
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +30 -20
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +15 -11
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +7 -2
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +45 -28
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +8 -4
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +3 -1
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +1 -1
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +12 -6
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +17 -8
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +4 -2
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.js +3 -3
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts +13 -9
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +32 -23
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.d.ts +1 -4
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +2 -2
- package/dist/deltaQueue.js.map +1 -1
- package/dist/disposal.d.ts +1 -1
- package/dist/disposal.d.ts.map +1 -1
- package/dist/disposal.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/loadPaused.d.ts +2 -2
- package/dist/loadPaused.d.ts.map +1 -1
- package/dist/loadPaused.js +7 -3
- package/dist/loadPaused.js.map +1 -1
- package/dist/loader.d.ts +10 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +11 -1
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +3 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/dist/memoryBlobStorage.d.ts.map +1 -1
- package/dist/memoryBlobStorage.js +4 -2
- package/dist/memoryBlobStorage.js.map +1 -1
- package/dist/noopHeuristic.js +1 -1
- package/dist/noopHeuristic.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol/protocol.d.ts +4 -3
- package/dist/protocol/protocol.d.ts.map +1 -1
- package/dist/protocol/protocol.js +6 -5
- package/dist/protocol/protocol.js.map +1 -1
- package/dist/protocol/quorum.d.ts +11 -8
- package/dist/protocol/quorum.d.ts.map +1 -1
- package/dist/protocol/quorum.js +8 -8
- package/dist/protocol/quorum.js.map +1 -1
- package/dist/protocol.d.ts +2 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +7 -2
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +2 -2
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +4 -1
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/serializedStateManager.d.ts +29 -12
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +55 -24
- package/dist/serializedStateManager.js.map +1 -1
- package/dist/utils.d.ts +4 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +15 -6
- package/dist/utils.js.map +1 -1
- package/lib/attachment.d.ts +2 -1
- package/lib/attachment.d.ts.map +1 -1
- package/lib/attachment.js.map +1 -1
- package/lib/audience.d.ts.map +1 -1
- package/lib/audience.js +4 -4
- package/lib/audience.js.map +1 -1
- package/lib/catchUpMonitor.d.ts +15 -4
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/catchUpMonitor.js +12 -3
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/connectionManager.d.ts +24 -8
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +36 -23
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts +30 -20
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +14 -12
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +7 -2
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +45 -28
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +8 -4
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +3 -1
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +12 -6
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +17 -8
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js +4 -2
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.js +3 -3
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts +13 -9
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +32 -23
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.d.ts +1 -4
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +2 -2
- package/lib/deltaQueue.js.map +1 -1
- package/lib/disposal.d.ts +1 -1
- package/lib/disposal.d.ts.map +1 -1
- package/lib/disposal.js.map +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/loadPaused.d.ts +2 -2
- package/lib/loadPaused.d.ts.map +1 -1
- package/lib/loadPaused.js +8 -4
- package/lib/loadPaused.js.map +1 -1
- package/lib/loader.d.ts +10 -1
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +11 -1
- package/lib/loader.js.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +3 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/lib/memoryBlobStorage.d.ts.map +1 -1
- package/lib/memoryBlobStorage.js +4 -2
- package/lib/memoryBlobStorage.js.map +1 -1
- package/lib/noopHeuristic.js +1 -1
- package/lib/noopHeuristic.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol/protocol.d.ts +4 -3
- package/lib/protocol/protocol.d.ts.map +1 -1
- package/lib/protocol/protocol.js +6 -5
- package/lib/protocol/protocol.js.map +1 -1
- package/lib/protocol/quorum.d.ts +11 -8
- package/lib/protocol/quorum.d.ts.map +1 -1
- package/lib/protocol/quorum.js +8 -8
- package/lib/protocol/quorum.js.map +1 -1
- package/lib/protocol.d.ts +2 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +7 -2
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +2 -2
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +4 -1
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/serializedStateManager.d.ts +29 -12
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +56 -25
- package/lib/serializedStateManager.js.map +1 -1
- package/lib/utils.d.ts +4 -2
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +16 -7
- package/lib/utils.js.map +1 -1
- package/package.json +21 -17
- package/src/attachment.ts +2 -1
- package/src/audience.ts +4 -4
- package/src/catchUpMonitor.ts +23 -8
- package/src/connectionManager.ts +85 -60
- package/src/connectionStateHandler.ts +85 -63
- package/src/container.ts +118 -84
- package/src/containerContext.ts +5 -3
- package/src/containerStorageAdapter.ts +20 -13
- package/src/contracts.ts +21 -9
- package/src/debugLogger.ts +4 -4
- package/src/deltaManager.ts +75 -56
- package/src/deltaQueue.ts +16 -10
- package/src/disposal.ts +3 -3
- package/src/error.ts +2 -1
- package/src/loadPaused.ts +16 -8
- package/src/loader.ts +20 -2
- package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +7 -3
- package/src/memoryBlobStorage.ts +5 -3
- package/src/noopHeuristic.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/protocol/protocol.ts +12 -11
- package/src/protocol/quorum.ts +49 -40
- package/src/protocol.ts +12 -4
- package/src/protocolTreeDocumentStorageService.ts +3 -2
- package/src/retriableDocumentStorageService.ts +6 -3
- package/src/serializedStateManager.ts +95 -39
- package/src/utils.ts +26 -10
package/.eslintrc.cjs
CHANGED
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
extends: [
|
|
8
|
-
require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"),
|
|
9
|
-
"prettier",
|
|
10
|
-
],
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"],
|
|
11
8
|
parserOptions: {
|
|
12
9
|
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
13
10
|
},
|
|
@@ -17,7 +14,7 @@ module.exports = {
|
|
|
17
14
|
files: ["*.spec.ts", "src/test/**"],
|
|
18
15
|
rules: {
|
|
19
16
|
// Test files are run in node only so additional node libraries can be used.
|
|
20
|
-
"import/no-nodejs-modules": ["error", { allow: ["assert"] }],
|
|
17
|
+
"import/no-nodejs-modules": ["error", { allow: ["node:assert"] }],
|
|
21
18
|
},
|
|
22
19
|
},
|
|
23
20
|
],
|
|
@@ -4,33 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
8
|
-
import { IAudienceOwner } from '@fluidframework/container-definitions/internal';
|
|
9
|
-
import { IClientDetails } from '@fluidframework/driver-definitions';
|
|
10
|
-
import { ICommittedProposal } from '@fluidframework/driver-definitions/internal';
|
|
11
|
-
import { IConfigProviderBase } from '@fluidframework/core-interfaces';
|
|
12
|
-
import { IContainer } from '@fluidframework/container-definitions/internal';
|
|
13
|
-
import { IDocumentAttributes } from '@fluidframework/driver-definitions/internal';
|
|
14
|
-
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions/internal';
|
|
15
|
-
import { IDocumentStorageService } from '@fluidframework/driver-definitions/internal';
|
|
16
|
-
import { IFluidCodeDetails } from '@fluidframework/container-definitions/internal';
|
|
17
|
-
import { IFluidModule } from '@fluidframework/container-definitions/internal';
|
|
18
|
-
import { IHostLoader } from '@fluidframework/container-definitions/internal';
|
|
19
|
-
import { ILoader } from '@fluidframework/container-definitions/internal';
|
|
20
|
-
import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions/internal';
|
|
21
|
-
import { ILocationRedirectionError } from '@fluidframework/driver-definitions/internal';
|
|
22
|
-
import { IProcessMessageResult } from '@fluidframework/driver-definitions/internal';
|
|
23
|
-
import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions/internal';
|
|
24
|
-
import { IQuorum } from '@fluidframework/driver-definitions/internal';
|
|
25
|
-
import { IRequest } from '@fluidframework/core-interfaces';
|
|
26
|
-
import { ISequencedClient } from '@fluidframework/driver-definitions';
|
|
27
|
-
import { ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
|
|
28
|
-
import { ISequencedProposal } from '@fluidframework/driver-definitions/internal';
|
|
29
|
-
import { ISignalMessage } from '@fluidframework/driver-definitions/internal';
|
|
30
|
-
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
31
|
-
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils/internal';
|
|
32
|
-
import { IUrlResolver } from '@fluidframework/driver-definitions/internal';
|
|
33
|
-
|
|
34
7
|
// @public
|
|
35
8
|
export enum ConnectionState {
|
|
36
9
|
CatchingUp = 1,
|
|
@@ -4,33 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
8
|
-
import { IAudienceOwner } from '@fluidframework/container-definitions/internal';
|
|
9
|
-
import { IClientDetails } from '@fluidframework/driver-definitions';
|
|
10
|
-
import { ICommittedProposal } from '@fluidframework/driver-definitions/internal';
|
|
11
|
-
import { IConfigProviderBase } from '@fluidframework/core-interfaces';
|
|
12
|
-
import { IContainer } from '@fluidframework/container-definitions/internal';
|
|
13
|
-
import { IDocumentAttributes } from '@fluidframework/driver-definitions/internal';
|
|
14
|
-
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions/internal';
|
|
15
|
-
import { IDocumentStorageService } from '@fluidframework/driver-definitions/internal';
|
|
16
|
-
import { IFluidCodeDetails } from '@fluidframework/container-definitions/internal';
|
|
17
|
-
import { IFluidModule } from '@fluidframework/container-definitions/internal';
|
|
18
|
-
import { IHostLoader } from '@fluidframework/container-definitions/internal';
|
|
19
|
-
import { ILoader } from '@fluidframework/container-definitions/internal';
|
|
20
|
-
import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions/internal';
|
|
21
|
-
import { ILocationRedirectionError } from '@fluidframework/driver-definitions/internal';
|
|
22
|
-
import { IProcessMessageResult } from '@fluidframework/driver-definitions/internal';
|
|
23
|
-
import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions/internal';
|
|
24
|
-
import { IQuorum } from '@fluidframework/driver-definitions/internal';
|
|
25
|
-
import { IRequest } from '@fluidframework/core-interfaces';
|
|
26
|
-
import { ISequencedClient } from '@fluidframework/driver-definitions';
|
|
27
|
-
import { ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
|
|
28
|
-
import { ISequencedProposal } from '@fluidframework/driver-definitions/internal';
|
|
29
|
-
import { ISignalMessage } from '@fluidframework/driver-definitions/internal';
|
|
30
|
-
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
31
|
-
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils/internal';
|
|
32
|
-
import { IUrlResolver } from '@fluidframework/driver-definitions/internal';
|
|
33
|
-
|
|
34
7
|
// @public
|
|
35
8
|
export enum ConnectionState {
|
|
36
9
|
CatchingUp = 1,
|
|
@@ -4,33 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
8
|
-
import { IAudienceOwner } from '@fluidframework/container-definitions/internal';
|
|
9
|
-
import { IClientDetails } from '@fluidframework/driver-definitions';
|
|
10
|
-
import { ICommittedProposal } from '@fluidframework/driver-definitions/internal';
|
|
11
|
-
import { IConfigProviderBase } from '@fluidframework/core-interfaces';
|
|
12
|
-
import { IContainer } from '@fluidframework/container-definitions/internal';
|
|
13
|
-
import { IDocumentAttributes } from '@fluidframework/driver-definitions/internal';
|
|
14
|
-
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions/internal';
|
|
15
|
-
import { IDocumentStorageService } from '@fluidframework/driver-definitions/internal';
|
|
16
|
-
import { IFluidCodeDetails } from '@fluidframework/container-definitions/internal';
|
|
17
|
-
import { IFluidModule } from '@fluidframework/container-definitions/internal';
|
|
18
|
-
import { IHostLoader } from '@fluidframework/container-definitions/internal';
|
|
19
|
-
import { ILoader } from '@fluidframework/container-definitions/internal';
|
|
20
|
-
import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions/internal';
|
|
21
|
-
import { ILocationRedirectionError } from '@fluidframework/driver-definitions/internal';
|
|
22
|
-
import { IProcessMessageResult } from '@fluidframework/driver-definitions/internal';
|
|
23
|
-
import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions/internal';
|
|
24
|
-
import { IQuorum } from '@fluidframework/driver-definitions/internal';
|
|
25
|
-
import { IRequest } from '@fluidframework/core-interfaces';
|
|
26
|
-
import { ISequencedClient } from '@fluidframework/driver-definitions';
|
|
27
|
-
import { ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
|
|
28
|
-
import { ISequencedProposal } from '@fluidframework/driver-definitions/internal';
|
|
29
|
-
import { ISignalMessage } from '@fluidframework/driver-definitions/internal';
|
|
30
|
-
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
31
|
-
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils/internal';
|
|
32
|
-
import { IUrlResolver } from '@fluidframework/driver-definitions/internal';
|
|
33
|
-
|
|
34
7
|
// @public
|
|
35
8
|
export enum ConnectionState {
|
|
36
9
|
CatchingUp = 1,
|
package/dist/attachment.d.ts
CHANGED
|
@@ -77,7 +77,8 @@ export interface AttachProcessProps {
|
|
|
77
77
|
* attachment data, and perform any other operations necessary
|
|
78
78
|
* for dealing with attachment state changes, like emitting events
|
|
79
79
|
*
|
|
80
|
-
* @param attachmentData - the updated attachment data
|
|
80
|
+
* @param attachmentData - the updated attachment data
|
|
81
|
+
*/
|
|
81
82
|
readonly setAttachmentData: (attachmentData: AttachmentData) => void;
|
|
82
83
|
/**
|
|
83
84
|
* The caller should create and or get services based on the data, and its own information.
|
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,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGrE;;;;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,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C;QACF,CAAC;QACD,iBAAiB,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;IACH,CAAC;IAED,IAAA,iBAAM,EACL,WAAW,CAAC,KAAK,KAAK,mCAAW,CAAC,SAAS,EAC3C,KAAK,CAAC,qCAAqC,CAC3C,CAAC;IAEF,IAAI,WAAW,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QAClC,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;IACJ,CAAC;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;AArFW,QAAA,yBAAyB,6BAqFpC","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 { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions/internal\";\nimport { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils/internal\";\n\n// eslint-disable-next-line import/no-deprecated\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<\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tIDetachedBlobStorage,\n\t\t\"getBlobIds\" | \"readBlob\" | \"size\"\n\t>;\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 AttachProcessProps - The data and services necessary to run the attachment process\n * @returns - The attach summary (only if offline load is enabled), or undefined\n */\nexport const runRetriableAttachProcess = async ({\n\tdetachedBlobStorage,\n\tcreateOrGetStorageService,\n\tsetAttachmentData,\n\tcreateAttachmentSummary,\n\tofflineLoadEnabled,\n\tinitialAttachmentData,\n}: AttachProcessProps): Promise<SnapshotWithBlobs | undefined> => {\n\tlet currentData: AttachmentData = 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\t}\n\t\t\t: {\n\t\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\t\tsummary: createAttachmentSummary(),\n\t\t\t\t\tblobs: \"none\",\n\t\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;AAQ7D,yCAA4E;AAyH5E;;;;;;;GAOG;AACI,MAAM,yBAAyB,GAAG,KAAK,EAAE,EAC/C,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,GACD,EAA0C,EAAE;IAChE,IAAI,WAAW,GAAmB,qBAAqB,CAAC;IAExD,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACrC,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;aACxC;YACF,CAAC,CAAC;gBACA,KAAK,EAAE,mCAAW,CAAC,SAAS;gBAC5B,OAAO,EAAE,uBAAuB,EAAE;gBAClC,KAAK,EAAE,MAAM;aACb,CAAC;QACJ,iBAAiB,CAAC,WAA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C;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;IACJ,CAAC;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;AArFW,QAAA,yBAAyB,6BAqFpC","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 { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions/internal\";\nimport { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils/internal\";\n\n// eslint-disable-next-line import/no-deprecated\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\n\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<\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tIDetachedBlobStorage,\n\t\t\"getBlobIds\" | \"readBlob\" | \"size\"\n\t>;\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 AttachProcessProps - The data and services necessary to run the attachment process\n * @returns - The attach summary (only if offline load is enabled), or undefined\n */\nexport const runRetriableAttachProcess = async ({\n\tdetachedBlobStorage,\n\tcreateOrGetStorageService,\n\tsetAttachmentData,\n\tcreateAttachmentSummary,\n\tofflineLoadEnabled,\n\tinitialAttachmentData,\n}: AttachProcessProps): Promise<SnapshotWithBlobs | undefined> => {\n\tlet currentData: AttachmentData = 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\t}\n\t\t\t: {\n\t\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\t\tsummary: createAttachmentSummary(),\n\t\t\t\t\tblobs: \"none\",\n\t\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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE7D;;GAEG;AACH,qBAAa,QAAS,SAAQ,iBAAiB,CAAC,eAAe,CAAE,YAAW,cAAc;IACzF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,OAAO,CAAC,gBAAgB,CAAqB;;IAQtC,OAAO,IAAI,KAAK,GAAG,SAAS;IAS5B,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAejD;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE7D;;GAEG;AACH,qBAAa,QAAS,SAAQ,iBAAiB,CAAC,eAAe,CAAE,YAAW,cAAc;IACzF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,OAAO,CAAC,gBAAgB,CAAqB;;IAQtC,OAAO,IAAI,KAAK,GAAG,SAAS;IAS5B,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAejD;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAe1D;;;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
|
@@ -56,14 +56,14 @@ class Audience extends client_utils_1.TypedEventEmitter {
|
|
|
56
56
|
*/
|
|
57
57
|
removeMember(clientId) {
|
|
58
58
|
const removedClient = this.members.get(clientId);
|
|
59
|
-
if (removedClient
|
|
59
|
+
if (removedClient === undefined) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
60
63
|
this.members.delete(clientId);
|
|
61
64
|
this.emit("removeMember", clientId, removedClient);
|
|
62
65
|
return true;
|
|
63
66
|
}
|
|
64
|
-
else {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Retrieves all the members in the audience.
|
package/dist/audience.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAGjE,kEAA6D;AAG7D;;GAEG;AACH,MAAa,QAAS,SAAQ,gCAAkC;IAI/D;QACC,KAAK,EAAE,CAAC;QAJQ,YAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;QAKrD,kHAAkH;QAClH,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAEM,OAAO;QACb,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAS;YACzC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC;g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QAAQ,CAAC,CAAC;IACnC,CAAC;CACD;AAtFD,4BAsFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IAudienceEvents, ISelf } from \"@fluidframework/container-definitions\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IClient } from \"@fluidframework/driver-definitions\";\n\n/**\n * Audience represents all clients connected to the op stream.\n */\nexport class Audience extends TypedEventEmitter<IAudienceEvents> implements IAudienceOwner {\n\tprivate readonly members = new Map<string, IClient>();\n\tprivate _currentClientId: string | undefined;\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 getSelf(): ISelf | undefined {\n\t\treturn this._currentClientId === undefined\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tclientId: this._currentClientId,\n\t\t\t\t\tclient: this.getMember(this._currentClientId),\n\t\t\t\t};\n\t}\n\n\tpublic setCurrentClientId(clientId: string): void {\n\t\tif (this._currentClientId !== clientId) {\n\t\t\tconst oldId = this._currentClientId;\n\t\t\tthis._currentClientId = clientId;\n\t\t\t// this.getMember(clientId) could resolve to undefined in these two cases:\n\t\t\t// 1) Feature gates controlling ConnectionStateHandler() behavior are off\n\t\t\t// 2) we are loading from stashed state and audience is empty, but we remember and set prior clientId\n\t\t\tthis.emit(\n\t\t\t\t\"selfChanged\",\n\t\t\t\toldId === undefined ? undefined : ({ clientId: oldId } satisfies ISelf),\n\t\t\t\t{ clientId, client: this.getMember(clientId) } satisfies ISelf,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Adds a new client to the audience\n\t */\n\tpublic addMember(clientId: string, details: IClient): void {\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\treturn false;\n\t\t} else {\n\t\t\tthis.members.delete(clientId);\n\t\t\tthis.emit(\"removeMember\", clientId, removedClient);\n\t\t\treturn true;\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.d.ts
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
6
6
|
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* @see {@link CatchUpMonitor} for usage.
|
|
9
|
+
*/
|
|
8
10
|
type CaughtUpListener = () => void;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Monitor that emits an event when a Container has caught up to a given point in the op stream
|
|
13
|
+
*/
|
|
10
14
|
export type ICatchUpMonitor = IDisposable;
|
|
11
15
|
/**
|
|
12
16
|
* Monitors a Container's DeltaManager, notifying listeners when all ops have been processed
|
|
@@ -21,8 +25,15 @@ export declare class CatchUpMonitor implements ICatchUpMonitor {
|
|
|
21
25
|
/**
|
|
22
26
|
* Create the CatchUpMonitor, setting the target sequence number to wait for based on DeltaManager's current state.
|
|
23
27
|
*/
|
|
24
|
-
constructor(deltaManager: IDeltaManager<
|
|
25
|
-
|
|
28
|
+
constructor(deltaManager: IDeltaManager<unknown, unknown>, listener: CaughtUpListener);
|
|
29
|
+
private _disposed;
|
|
30
|
+
/**
|
|
31
|
+
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}
|
|
32
|
+
*/
|
|
33
|
+
get disposed(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}
|
|
36
|
+
*/
|
|
26
37
|
dispose(): void;
|
|
27
38
|
}
|
|
28
39
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catchUpMonitor.d.ts","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAI9D
|
|
1
|
+
{"version":3,"file":"catchUpMonitor.d.ts","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAI9D;;GAEG;AACH,KAAK,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C;;;GAGG;AACH,qBAAa,cAAe,YAAW,eAAe;IAiBpD,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAjB1B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAkB;IAElC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAOxB;IAEF;;OAEG;gBAEe,YAAY,EAAE,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,EAC7C,QAAQ,EAAE,gBAAgB;IAe5C,OAAO,CAAC,SAAS,CAAkB;IAEnC;;OAEG;IACH,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED;;OAEG;IACI,OAAO,IAAI,IAAI;CAQtB"}
|
package/dist/catchUpMonitor.js
CHANGED
|
@@ -24,18 +24,27 @@ class CatchUpMonitor {
|
|
|
24
24
|
this.listener();
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
this.
|
|
27
|
+
this._disposed = false;
|
|
28
28
|
this.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;
|
|
29
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 });
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}
|
|
36
|
+
*/
|
|
37
|
+
get disposed() {
|
|
38
|
+
return this._disposed;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}
|
|
42
|
+
*/
|
|
34
43
|
dispose() {
|
|
35
|
-
if (this.
|
|
44
|
+
if (this._disposed) {
|
|
36
45
|
return;
|
|
37
46
|
}
|
|
38
|
-
this.
|
|
47
|
+
this._disposed = true;
|
|
39
48
|
this.deltaManager.off("op", this.opHandler);
|
|
40
49
|
}
|
|
41
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catchUpMonitor.js","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,kEAA6D;
|
|
1
|
+
{"version":3,"file":"catchUpMonitor.js","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,kEAA6D;AAa7D;;;GAGG;AACH,MAAa,cAAc;IAa1B;;OAEG;IACH,YACkB,YAA6C,EAC7C,QAA0B;QAD1B,iBAAY,GAAZ,YAAY,CAAiC;QAC7C,aAAQ,GAAR,QAAQ,CAAkB;QAhBpC,aAAQ,GAAY,KAAK,CAAC;QAEjB,cAAS,GAAG,CAC5B,OAA0D,EACnD,EAAE;YACT,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACtE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACrB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,CAAC;QACF,CAAC,CAAC;QAsBM,cAAS,GAAY,KAAK,CAAC;QAblC,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;IAID;;OAEG;IACH,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,OAAO;QACb,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO;QACR,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD;AArDD,wCAqDC","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/internal\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * @see {@link CatchUpMonitor} for usage.\n */\ntype CaughtUpListener = () => void;\n\n/**\n * Monitor that emits an event when a Container has caught up to a given point in the op stream\n */\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 = (\n\t\tmessage: Pick<ISequencedDocumentMessage, \"sequenceNumber\">,\n\t): void => {\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<unknown, unknown>,\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\tprivate _disposed: boolean = false;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}\n\t */\n\tpublic dispose(): void {\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"]}
|
|
@@ -20,7 +20,9 @@ export declare class ConnectionManager implements IConnectionManager {
|
|
|
20
20
|
private readonly client;
|
|
21
21
|
private readonly logger;
|
|
22
22
|
private readonly props;
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Connection mode used when reconnecting on error or disconnect.
|
|
25
|
+
*/
|
|
24
26
|
private readonly defaultReconnectionMode;
|
|
25
27
|
/**
|
|
26
28
|
* Tracks the current in-progress connection attempt. Undefined if there is none.
|
|
@@ -29,23 +31,35 @@ export declare class ConnectionManager implements IConnectionManager {
|
|
|
29
31
|
*/
|
|
30
32
|
private pendingConnection;
|
|
31
33
|
private connection;
|
|
32
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Details about connection. undefined if there is no active connection.
|
|
36
|
+
*/
|
|
33
37
|
private _connectionDetails?;
|
|
34
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* file ACL - whether user has only read-only access to a file
|
|
40
|
+
*/
|
|
35
41
|
private _readonlyPermissions;
|
|
36
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* tracks host requiring read-only mode.
|
|
44
|
+
*/
|
|
37
45
|
private _forceReadonly;
|
|
38
46
|
/**
|
|
39
47
|
* Controls whether the DeltaManager will automatically reconnect to the delta stream after receiving a disconnect.
|
|
40
48
|
*/
|
|
41
49
|
private _reconnectMode;
|
|
42
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* True if there is pending (async) reconnection from "read" to "write"
|
|
52
|
+
*/
|
|
43
53
|
private pendingReconnect;
|
|
44
54
|
private clientSequenceNumber;
|
|
45
55
|
private clientSequenceNumberObserved;
|
|
46
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Counts the number of non-runtime ops sent by the client which may not be acked.
|
|
58
|
+
*/
|
|
47
59
|
private localOpsToIgnore;
|
|
48
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* track clientId used last time when we sent any ops
|
|
62
|
+
*/
|
|
49
63
|
private lastSubmittedClientId;
|
|
50
64
|
private connectFirstConnection;
|
|
51
65
|
private _connectionVerboseProps;
|
|
@@ -60,7 +74,9 @@ export declare class ConnectionManager implements IConnectionManager {
|
|
|
60
74
|
get connectionMode(): ConnectionMode;
|
|
61
75
|
get connected(): boolean;
|
|
62
76
|
get clientId(): string | undefined;
|
|
63
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Details about connection. Returns undefined if there is no active connection.
|
|
79
|
+
*/
|
|
64
80
|
get connectionDetails(): IConnectionDetailsInternal | undefined;
|
|
65
81
|
/**
|
|
66
82
|
* Automatic reconnecting enabled or disabled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,EAEN,wBAAwB,EAExB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC7F,OAAO,EAGN,gBAAgB,EAGhB,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yB,CAIxC;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;CACF"}
|
|
@@ -22,7 +22,7 @@ const fatalConnectErrorProp = { fatalConnectError: true };
|
|
|
22
22
|
function getNackReconnectInfo(nackContent) {
|
|
23
23
|
const message = `Nack (${nackContent.type}): ${nackContent.message}`;
|
|
24
24
|
const canRetry = nackContent.code !== 403;
|
|
25
|
-
const retryAfterMs = nackContent.retryAfter
|
|
25
|
+
const retryAfterMs = nackContent.retryAfter === undefined ? undefined : nackContent.retryAfter * 1000;
|
|
26
26
|
return (0, internal_3.createGenericNetworkError)(message, { canRetry, retryAfterMs }, { statusCode: nackContent.code, driverVersion: undefined });
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -48,6 +48,7 @@ class NoDeltaStream extends client_utils_1.TypedEventEmitter {
|
|
|
48
48
|
this.storageOnlyReason = storageOnlyReason;
|
|
49
49
|
this.readonlyConnectionReason = readonlyConnectionReason;
|
|
50
50
|
this.clientId = clientIdNoDeltaStream;
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
51
52
|
this.claims = {
|
|
52
53
|
scopes: [internal_2.ScopeType.DocRead],
|
|
53
54
|
};
|
|
@@ -124,7 +125,9 @@ class ConnectionManager {
|
|
|
124
125
|
get clientId() {
|
|
125
126
|
return this.connection?.clientId;
|
|
126
127
|
}
|
|
127
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Details about connection. Returns undefined if there is no active connection.
|
|
130
|
+
*/
|
|
128
131
|
get connectionDetails() {
|
|
129
132
|
return this._connectionDetails;
|
|
130
133
|
}
|
|
@@ -158,13 +161,13 @@ class ConnectionManager {
|
|
|
158
161
|
* about current or last connection (if there is no connection at the moment)
|
|
159
162
|
*/
|
|
160
163
|
get connectionProps() {
|
|
161
|
-
return this.connection
|
|
162
|
-
?
|
|
163
|
-
: {
|
|
164
|
+
return this.connection === undefined
|
|
165
|
+
? {
|
|
164
166
|
...this._connectionProps,
|
|
165
167
|
// Report how many ops this client sent in last disconnected session
|
|
166
168
|
sentOps: this.clientSequenceNumber,
|
|
167
|
-
}
|
|
169
|
+
}
|
|
170
|
+
: this._connectionProps;
|
|
168
171
|
}
|
|
169
172
|
shouldJoinWrite() {
|
|
170
173
|
// We don't have to wait for ack for topmost NoOps. So subtract those.
|
|
@@ -232,13 +235,19 @@ class ConnectionManager {
|
|
|
232
235
|
this.client = client;
|
|
233
236
|
this.logger = logger;
|
|
234
237
|
this.props = props;
|
|
235
|
-
/**
|
|
238
|
+
/**
|
|
239
|
+
* tracks host requiring read-only mode.
|
|
240
|
+
*/
|
|
236
241
|
this._forceReadonly = false;
|
|
237
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* True if there is pending (async) reconnection from "read" to "write"
|
|
244
|
+
*/
|
|
238
245
|
this.pendingReconnect = false;
|
|
239
246
|
this.clientSequenceNumber = 0;
|
|
240
247
|
this.clientSequenceNumberObserved = 0;
|
|
241
|
-
/**
|
|
248
|
+
/**
|
|
249
|
+
* Counts the number of non-runtime ops sent by the client which may not be acked.
|
|
250
|
+
*/
|
|
242
251
|
this.localOpsToIgnore = 0;
|
|
243
252
|
this.connectFirstConnection = true;
|
|
244
253
|
this._connectionVerboseProps = {};
|
|
@@ -367,8 +376,8 @@ class ConnectionManager {
|
|
|
367
376
|
}
|
|
368
377
|
}
|
|
369
378
|
connect(reason, connectionMode) {
|
|
370
|
-
this.connectCore(reason, connectionMode).catch((
|
|
371
|
-
const normalizedError = (0, internal_4.normalizeError)(
|
|
379
|
+
this.connectCore(reason, connectionMode).catch((error) => {
|
|
380
|
+
const normalizedError = (0, internal_4.normalizeError)(error, { props: fatalConnectErrorProp });
|
|
372
381
|
this.props.closeHandler(normalizedError);
|
|
373
382
|
});
|
|
374
383
|
}
|
|
@@ -680,7 +689,7 @@ class ConnectionManager {
|
|
|
680
689
|
this._connectionProps.socketDocumentId = connection.claims.documentId;
|
|
681
690
|
this._connectionProps.connectionMode = connection.mode;
|
|
682
691
|
let last = -1;
|
|
683
|
-
if (initialMessages.length
|
|
692
|
+
if (initialMessages.length > 0) {
|
|
684
693
|
this._connectionVerboseProps.connectionInitialOpsFrom =
|
|
685
694
|
initialMessages[0].sequenceNumber;
|
|
686
695
|
last = initialMessages[initialMessages.length - 1].sequenceNumber;
|
|
@@ -701,6 +710,8 @@ class ConnectionManager {
|
|
|
701
710
|
// This allows us to have single way to process signals, and makes it simpler to initialize
|
|
702
711
|
// protocol in Container.
|
|
703
712
|
const clearSignal = {
|
|
713
|
+
// API uses null
|
|
714
|
+
// eslint-disable-next-line unicorn/no-null
|
|
704
715
|
clientId: null, // system message
|
|
705
716
|
content: JSON.stringify({
|
|
706
717
|
type: protocol_js_1.SignalType.Clear,
|
|
@@ -709,6 +720,8 @@ class ConnectionManager {
|
|
|
709
720
|
// list of signals to process due to this new connection
|
|
710
721
|
let signalsToProcess = [clearSignal];
|
|
711
722
|
const clientJoinSignals = (connection.initialClients ?? []).map((priorClient) => ({
|
|
723
|
+
// API uses null
|
|
724
|
+
// eslint-disable-next-line unicorn/no-null
|
|
712
725
|
clientId: null, // system signal
|
|
713
726
|
content: JSON.stringify({
|
|
714
727
|
type: protocol_js_1.SignalType.ClientJoin,
|
|
@@ -716,14 +729,14 @@ class ConnectionManager {
|
|
|
716
729
|
}),
|
|
717
730
|
}));
|
|
718
731
|
if (clientJoinSignals.length > 0) {
|
|
719
|
-
signalsToProcess = signalsToProcess
|
|
732
|
+
signalsToProcess = [...signalsToProcess, ...clientJoinSignals];
|
|
720
733
|
}
|
|
721
734
|
// Unfortunately, there is no defined order between initialSignals (including join & leave signals)
|
|
722
735
|
// and connection.initialClients. In practice, connection.initialSignals quite often contains join signal
|
|
723
736
|
// for "self" and connection.initialClients does not contain "self", so we have to process them after
|
|
724
737
|
// "clear" signal above.
|
|
725
738
|
if (connection.initialSignals !== undefined && connection.initialSignals.length > 0) {
|
|
726
|
-
signalsToProcess = signalsToProcess
|
|
739
|
+
signalsToProcess = [...signalsToProcess, ...connection.initialSignals];
|
|
727
740
|
}
|
|
728
741
|
this.props.signalHandler(signalsToProcess);
|
|
729
742
|
}
|
|
@@ -782,9 +795,9 @@ class ConnectionManager {
|
|
|
782
795
|
// should probably live in the driver.
|
|
783
796
|
await waitForOnline();
|
|
784
797
|
this.triggerConnect({
|
|
785
|
-
text: reason.error
|
|
786
|
-
?
|
|
787
|
-
:
|
|
798
|
+
text: reason.error === undefined
|
|
799
|
+
? `Reconnecting due to: ${reason.text}`
|
|
800
|
+
: "Reconnecting due to Error",
|
|
788
801
|
error: reason.error,
|
|
789
802
|
}, requestedMode);
|
|
790
803
|
}
|
|
@@ -810,11 +823,11 @@ class ConnectionManager {
|
|
|
810
823
|
this.clientSequenceNumber = 0;
|
|
811
824
|
this.clientSequenceNumberObserved = 0;
|
|
812
825
|
}
|
|
813
|
-
if (
|
|
814
|
-
this.localOpsToIgnore
|
|
826
|
+
if ((0, internal_3.isRuntimeMessage)(message)) {
|
|
827
|
+
this.localOpsToIgnore = 0;
|
|
815
828
|
}
|
|
816
829
|
else {
|
|
817
|
-
this.localOpsToIgnore
|
|
830
|
+
this.localOpsToIgnore++;
|
|
818
831
|
}
|
|
819
832
|
return {
|
|
820
833
|
...message,
|
|
@@ -822,11 +835,11 @@ class ConnectionManager {
|
|
|
822
835
|
};
|
|
823
836
|
}
|
|
824
837
|
submitSignal(content, targetClientId) {
|
|
825
|
-
if (this.connection
|
|
826
|
-
this.
|
|
838
|
+
if (this.connection === undefined) {
|
|
839
|
+
this.logger.sendErrorEvent({ eventName: "submitSignalDisconnected" });
|
|
827
840
|
}
|
|
828
841
|
else {
|
|
829
|
-
this.
|
|
842
|
+
this.connection.submitSignal(content, targetClientId);
|
|
830
843
|
}
|
|
831
844
|
}
|
|
832
845
|
sendMessages(messages) {
|