@fluidframework/container-loader 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.0
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/CHANGELOG.md +4 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +3 -3
- package/api-report/container-loader.api.md +18 -18
- package/dist/connectionState.cjs +3 -0
- package/dist/connectionState.cjs.map +1 -1
- package/dist/connectionState.d.ts +3 -0
- package/dist/connectionState.d.ts.map +1 -1
- package/dist/connectionStateHandler.cjs +3 -3
- package/dist/connectionStateHandler.cjs.map +1 -1
- package/dist/connectionStateHandler.d.ts +10 -0
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/container-loader-alpha.d.ts +240 -0
- package/dist/container-loader-beta.d.ts +96 -0
- package/dist/container-loader-public.d.ts +96 -0
- package/dist/container-loader-untrimmed.d.ts +351 -0
- package/dist/container.cjs +11 -9
- package/dist/container.cjs.map +1 -1
- package/dist/container.d.ts +4 -6
- package/dist/container.d.ts.map +1 -1
- package/dist/deltaManager.cjs +18 -1
- package/dist/deltaManager.cjs.map +1 -1
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/loader.cjs +2 -0
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.d.ts +12 -2
- package/dist/loader.d.ts.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.cjs +2 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.cjs.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/dist/packageVersion.cjs +1 -1
- package/dist/packageVersion.cjs.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.ts +4 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/utils.cjs +1 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -1
- package/lib/audience.d.ts +0 -4
- package/lib/audience.d.ts.map +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/connectionManager.d.ts +1 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionState.d.ts +3 -0
- package/lib/connectionState.d.ts.map +1 -1
- package/lib/connectionState.mjs +3 -0
- package/lib/connectionState.mjs.map +1 -1
- package/lib/connectionStateHandler.d.ts +13 -3
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.mjs +3 -3
- package/lib/connectionStateHandler.mjs.map +1 -1
- package/lib/container-loader-alpha.d.ts +240 -0
- package/lib/container-loader-beta.d.ts +96 -0
- package/lib/container-loader-public.d.ts +96 -0
- package/lib/container-loader-untrimmed.d.ts +351 -0
- package/lib/container.d.ts +8 -10
- package/lib/container.d.ts.map +1 -1
- package/lib/container.mjs +11 -9
- package/lib/container.mjs.map +1 -1
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerStorageAdapter.d.ts +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/debugLogger.d.ts.map +1 -1
- package/lib/deltaManager.d.ts +1 -1
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.mjs +18 -1
- package/lib/deltaManager.mjs.map +1 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/disposal.d.ts.map +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/loader.d.ts +14 -4
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.mjs +2 -0
- package/lib/loader.mjs.map +1 -1
- package/lib/location-redirection-utilities/index.d.ts +1 -1
- package/lib/location-redirection-utilities/index.d.ts.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs +2 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +1 -1
- package/lib/noopHeuristic.d.ts.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/protocol.d.ts +4 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.mjs.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/quorum.d.ts +0 -4
- package/lib/quorum.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/utils.d.ts +2 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.mjs +1 -0
- package/lib/utils.mjs.map +1 -1
- package/package.json +34 -15
- package/src/connectionState.ts +3 -0
- package/src/connectionStateHandler.ts +16 -3
- package/src/container.ts +24 -14
- package/src/deltaManager.ts +25 -1
- package/src/loader.ts +11 -1
- package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +2 -0
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +4 -0
- package/src/utils.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/container-loader",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.4.0",
|
|
4
4
|
"description": "Fluid container loader",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
42
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.
|
|
43
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
39
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
40
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
41
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
42
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
43
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
44
44
|
"@fluidframework/protocol-base": "^2.0.1",
|
|
45
45
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
46
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
46
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
47
47
|
"debug": "^4.3.4",
|
|
48
48
|
"double-ended-queue": "^2.1.0-0",
|
|
49
49
|
"events": "^3.1.0",
|
|
@@ -51,21 +51,23 @@
|
|
|
51
51
|
"uuid": "^9.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@
|
|
54
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
55
|
+
"@fluid-private/test-loader-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
55
56
|
"@fluid-tools/build-cli": "^0.28.0",
|
|
56
57
|
"@fluidframework/build-common": "^2.0.3",
|
|
57
58
|
"@fluidframework/build-tools": "^0.28.0",
|
|
58
59
|
"@fluidframework/container-loader-previous": "npm:@fluidframework/container-loader@2.0.0-internal.7.2.0",
|
|
59
60
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
60
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
61
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
61
62
|
"@microsoft/api-extractor": "^7.38.3",
|
|
62
63
|
"@types/debug": "^4.1.5",
|
|
63
64
|
"@types/double-ended-queue": "^2.1.0",
|
|
64
65
|
"@types/events": "^3.0.0",
|
|
65
66
|
"@types/mocha": "^9.1.1",
|
|
66
|
-
"@types/node": "^
|
|
67
|
+
"@types/node": "^18.19.0",
|
|
67
68
|
"@types/sinon": "^7.0.13",
|
|
68
69
|
"c8": "^7.7.1",
|
|
70
|
+
"copyfiles": "^2.4.1",
|
|
69
71
|
"cross-env": "^7.0.3",
|
|
70
72
|
"eslint": "~8.50.0",
|
|
71
73
|
"mocha": "^10.2.0",
|
|
@@ -78,26 +80,43 @@
|
|
|
78
80
|
"tsc-multi": "^1.1.0",
|
|
79
81
|
"typescript": "~5.1.6"
|
|
80
82
|
},
|
|
83
|
+
"fluidBuild": {
|
|
84
|
+
"tasks": {
|
|
85
|
+
"build:docs": {
|
|
86
|
+
"dependsOn": [
|
|
87
|
+
"...",
|
|
88
|
+
"api-extractor:commonjs",
|
|
89
|
+
"api-extractor:esnext"
|
|
90
|
+
],
|
|
91
|
+
"script": false
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
81
95
|
"typeValidation": {
|
|
82
96
|
"broken": {}
|
|
83
97
|
},
|
|
84
98
|
"scripts": {
|
|
99
|
+
"api": "fluid-build . --task api",
|
|
100
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
101
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
85
102
|
"build": "fluid-build . --task build",
|
|
86
103
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
87
104
|
"build:compile": "fluid-build . --task compile",
|
|
88
|
-
"build:docs": "
|
|
105
|
+
"build:docs": "fluid-build . --task api",
|
|
89
106
|
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
|
|
90
107
|
"build:genver": "gen-version",
|
|
91
108
|
"build:test": "tsc-multi --config tsc-multi.test.json",
|
|
109
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
110
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
92
111
|
"ci:build:docs": "api-extractor run",
|
|
93
112
|
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
94
113
|
"eslint": "eslint --format stylish src",
|
|
95
114
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
96
115
|
"format": "npm run prettier:fix",
|
|
97
|
-
"lint": "npm run prettier && npm run eslint",
|
|
116
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
98
117
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
99
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
100
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
118
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
119
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
101
120
|
"test": "npm run test:mocha",
|
|
102
121
|
"test:coverage": "c8 npm test",
|
|
103
122
|
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
package/src/connectionState.ts
CHANGED
|
@@ -312,12 +312,25 @@ class ConnectionStateCatchup extends ConnectionStateHandlerPassThrough {
|
|
|
312
312
|
class ConnectionStateHandler implements IConnectionStateHandler {
|
|
313
313
|
private _connectionState = ConnectionState.Disconnected;
|
|
314
314
|
private _pendingClientId: string | undefined;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Tracks that we observe the "leave" op within the timeout for our previous clientId (see comment on ConnectionStateHandler class)
|
|
318
|
+
* ! This ensures we do not switch to a new clientId until we process all potential messages from old clientId
|
|
319
|
+
* ! i.e. We will always see the "leave" op for a client after we have seen all the ops it has sent
|
|
320
|
+
* ! This check helps prevent the same op from being resubmitted by the PendingStateManager upon reconnecting
|
|
321
|
+
*/
|
|
315
322
|
private readonly prevClientLeftTimer: Timer;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Tracks that we observe our own "join" op within the timeout after receiving a "connected" event from the DeltaManager
|
|
326
|
+
*/
|
|
316
327
|
private readonly joinOpTimer: Timer;
|
|
328
|
+
|
|
317
329
|
private protocol?: IProtocolHandler;
|
|
318
330
|
private connection?: IConnectionDetailsInternal;
|
|
319
331
|
private _clientId?: string;
|
|
320
332
|
|
|
333
|
+
/** Track how long we waited to see "leave" op for previous clientId */
|
|
321
334
|
private waitEvent: PerformanceEvent | undefined;
|
|
322
335
|
|
|
323
336
|
public get connectionState(): ConnectionState {
|
|
@@ -453,9 +466,9 @@ class ConnectionStateHandler implements IConnectionStateHandler {
|
|
|
453
466
|
0x2e2 /* "Must only wait for leave message when clientId in quorum" */,
|
|
454
467
|
);
|
|
455
468
|
|
|
456
|
-
// Move to connected state only if
|
|
457
|
-
//
|
|
458
|
-
// or
|
|
469
|
+
// Move to connected state only if:
|
|
470
|
+
// 1. We have seen our own "join" op (i.e. for this.pendingClientId)
|
|
471
|
+
// 2. There is no "leave" timer running, meaning this is our first connection or the previous client has left (via this.prevClientLeftTimer)
|
|
459
472
|
if (
|
|
460
473
|
this.pendingClientId !== this.clientId &&
|
|
461
474
|
this.hasMember(this.pendingClientId) &&
|
package/src/container.ts
CHANGED
|
@@ -237,6 +237,7 @@ export interface IContainerCreateProps {
|
|
|
237
237
|
* but it maybe still behind.
|
|
238
238
|
*
|
|
239
239
|
* @throws an error beginning with `"Container closed"` if the container is closed before it catches up.
|
|
240
|
+
* @internal
|
|
240
241
|
*/
|
|
241
242
|
export async function waitContainerToCatchUp(container: IContainer) {
|
|
242
243
|
// Make sure we stop waiting if container is closed.
|
|
@@ -497,6 +498,7 @@ export class Container
|
|
|
497
498
|
private readonly subLogger: ITelemetryLoggerExt;
|
|
498
499
|
private readonly detachedBlobStorage: IDetachedBlobStorage | undefined;
|
|
499
500
|
private readonly protocolHandlerBuilder: ProtocolHandlerBuilder;
|
|
501
|
+
private readonly client: IClient;
|
|
500
502
|
|
|
501
503
|
private readonly mc: MonitoringContext;
|
|
502
504
|
|
|
@@ -814,6 +816,14 @@ export class Container
|
|
|
814
816
|
});
|
|
815
817
|
};
|
|
816
818
|
|
|
819
|
+
this._containerId = uuid();
|
|
820
|
+
|
|
821
|
+
this.client = Container.setupClient(
|
|
822
|
+
this._containerId,
|
|
823
|
+
this.options,
|
|
824
|
+
this.clientDetailsOverride,
|
|
825
|
+
);
|
|
826
|
+
|
|
817
827
|
// Create logger for data stores to use
|
|
818
828
|
const type = this.client.details.type;
|
|
819
829
|
const interactive = this.client.details.capabilities.interactive;
|
|
@@ -821,7 +831,6 @@ export class Container
|
|
|
821
831
|
type !== undefined && type !== "" ? `/${type}` : ""
|
|
822
832
|
}`;
|
|
823
833
|
|
|
824
|
-
this._containerId = uuid();
|
|
825
834
|
// Need to use the property getter for docId because for detached flow we don't have the docId initially.
|
|
826
835
|
// We assign the id later so property getter is used.
|
|
827
836
|
this.subLogger = createChildLogger({
|
|
@@ -1116,7 +1125,6 @@ export class Container
|
|
|
1116
1125
|
// runtime matches pending ops to successful ones by clientId and client seq num, so we need to close the
|
|
1117
1126
|
// container at the same time we get pending state, otherwise this container could reconnect and resubmit with
|
|
1118
1127
|
// a new clientId and a future container using stale pending state without the new clientId would resubmit them
|
|
1119
|
-
this.disconnectInternal({ text: "closeAndGetPendingLocalState" }); // TODO https://dev.azure.com/fluidframework/internal/_workitems/edit/5127
|
|
1120
1128
|
const pendingState = await this.getPendingLocalStateCore({
|
|
1121
1129
|
notifyImminentClosure: true,
|
|
1122
1130
|
stopBlobAttachingSignal,
|
|
@@ -1996,10 +2004,15 @@ export class Container
|
|
|
1996
2004
|
return pkg as IFluidCodeDetails;
|
|
1997
2005
|
}
|
|
1998
2006
|
|
|
1999
|
-
private
|
|
2007
|
+
private static setupClient(
|
|
2008
|
+
containerId: string,
|
|
2009
|
+
options?: ILoaderOptions,
|
|
2010
|
+
clientDetailsOverride?: IClientDetails,
|
|
2011
|
+
): IClient {
|
|
2012
|
+
const loaderOptionsClient = structuredClone(options?.client);
|
|
2000
2013
|
const client: IClient =
|
|
2001
|
-
|
|
2002
|
-
? (
|
|
2014
|
+
loaderOptionsClient !== undefined
|
|
2015
|
+
? (loaderOptionsClient as IClient)
|
|
2003
2016
|
: {
|
|
2004
2017
|
details: {
|
|
2005
2018
|
capabilities: { interactive: true },
|
|
@@ -2010,21 +2023,22 @@ export class Container
|
|
|
2010
2023
|
user: { id: "" },
|
|
2011
2024
|
};
|
|
2012
2025
|
|
|
2013
|
-
if (
|
|
2026
|
+
if (clientDetailsOverride !== undefined) {
|
|
2014
2027
|
client.details = {
|
|
2015
2028
|
...client.details,
|
|
2016
|
-
...
|
|
2029
|
+
...clientDetailsOverride,
|
|
2017
2030
|
capabilities: {
|
|
2018
2031
|
...client.details.capabilities,
|
|
2019
|
-
...
|
|
2032
|
+
...clientDetailsOverride?.capabilities,
|
|
2020
2033
|
},
|
|
2021
2034
|
};
|
|
2022
2035
|
}
|
|
2023
2036
|
client.details.environment = [
|
|
2024
2037
|
client.details.environment,
|
|
2025
2038
|
` loaderVersion:${pkgVersion}`,
|
|
2026
|
-
` containerId:${
|
|
2039
|
+
` containerId:${containerId}`,
|
|
2027
2040
|
].join(";");
|
|
2041
|
+
|
|
2028
2042
|
return client;
|
|
2029
2043
|
}
|
|
2030
2044
|
|
|
@@ -2530,7 +2544,7 @@ export class Container
|
|
|
2530
2544
|
|
|
2531
2545
|
/**
|
|
2532
2546
|
* IContainer interface that includes experimental features still under development.
|
|
2533
|
-
* @
|
|
2547
|
+
* @internal
|
|
2534
2548
|
*/
|
|
2535
2549
|
export interface IContainerExperimental extends IContainer {
|
|
2536
2550
|
/**
|
|
@@ -2538,16 +2552,12 @@ export interface IContainerExperimental extends IContainer {
|
|
|
2538
2552
|
* submission and potential document corruption. The blob returned MUST be deleted if and when this
|
|
2539
2553
|
* container emits a "connected" event.
|
|
2540
2554
|
* @returns serialized blob that can be passed to Loader.resolve()
|
|
2541
|
-
* @alpha misuse of this API can result in duplicate op submission and potential document corruption
|
|
2542
|
-
* {@link https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-loader/closeAndGetPendingLocalState.md}
|
|
2543
2555
|
*/
|
|
2544
2556
|
getPendingLocalState?(): Promise<string>;
|
|
2545
2557
|
|
|
2546
2558
|
/**
|
|
2547
2559
|
* Closes the container and returns serialized local state intended to be
|
|
2548
2560
|
* given to a newly loaded container.
|
|
2549
|
-
* @alpha
|
|
2550
|
-
* {@link https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-loader/closeAndGetPendingLocalState.md}
|
|
2551
2561
|
*/
|
|
2552
2562
|
closeAndGetPendingLocalState?(stopBlobAttachingSignal?: AbortSignal): Promise<string>;
|
|
2553
2563
|
}
|
package/src/deltaManager.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
IEventProvider,
|
|
10
10
|
ITelemetryProperties,
|
|
11
11
|
ITelemetryErrorEvent,
|
|
12
|
+
type ITelemetryBaseEvent,
|
|
12
13
|
} from "@fluidframework/core-interfaces";
|
|
13
14
|
import {
|
|
14
15
|
ICriticalContainerError,
|
|
@@ -22,12 +23,12 @@ import {
|
|
|
22
23
|
DataProcessingError,
|
|
23
24
|
extractSafePropertiesFromMessage,
|
|
24
25
|
normalizeError,
|
|
25
|
-
logIfFalse,
|
|
26
26
|
safeRaiseEvent,
|
|
27
27
|
isFluidError,
|
|
28
28
|
ITelemetryLoggerExt,
|
|
29
29
|
DataCorruptionError,
|
|
30
30
|
UsageError,
|
|
31
|
+
type ITelemetryGenericEventExt,
|
|
31
32
|
} from "@fluidframework/telemetry-utils";
|
|
32
33
|
import {
|
|
33
34
|
IDocumentDeltaStorageService,
|
|
@@ -114,6 +115,29 @@ function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage):
|
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Like assert, but logs only if the condition is false, rather than throwing
|
|
120
|
+
* @param condition - The condition to attest too
|
|
121
|
+
* @param logger - The logger to log with
|
|
122
|
+
* @param event - The string or event to log
|
|
123
|
+
* @returns The outcome of the condition
|
|
124
|
+
*/
|
|
125
|
+
function logIfFalse(
|
|
126
|
+
condition: boolean,
|
|
127
|
+
logger: ITelemetryLoggerExt,
|
|
128
|
+
event: string | ITelemetryGenericEventExt,
|
|
129
|
+
): condition is true {
|
|
130
|
+
if (condition) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
const newEvent: ITelemetryBaseEvent =
|
|
134
|
+
typeof event === "string"
|
|
135
|
+
? { eventName: event, category: "error" }
|
|
136
|
+
: { category: "error", ...event };
|
|
137
|
+
logger.send(newEvent);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
117
141
|
/**
|
|
118
142
|
* Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta
|
|
119
143
|
* messages in order regardless of possible network conditions or timings causing out of order delivery.
|
package/src/loader.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { v4 as uuid } from "uuid";
|
|
7
7
|
import {
|
|
8
8
|
ITelemetryLoggerExt,
|
|
9
|
-
IConfigProviderBase,
|
|
10
9
|
mixinMonitoringContext,
|
|
11
10
|
MonitoringContext,
|
|
12
11
|
PerformanceEvent,
|
|
@@ -22,6 +21,7 @@ import {
|
|
|
22
21
|
IRequest,
|
|
23
22
|
IRequestHeader,
|
|
24
23
|
IResponse,
|
|
24
|
+
IConfigProviderBase,
|
|
25
25
|
} from "@fluidframework/core-interfaces";
|
|
26
26
|
import {
|
|
27
27
|
IContainer,
|
|
@@ -113,6 +113,9 @@ export class RelativeLoader implements ILoader {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* @alpha
|
|
118
|
+
*/
|
|
116
119
|
export interface ILoaderOptions extends ILoaderOptions1 {
|
|
117
120
|
summarizeProtocolTree?: boolean;
|
|
118
121
|
}
|
|
@@ -122,6 +125,7 @@ export interface ILoaderOptions extends ILoaderOptions1 {
|
|
|
122
125
|
* {@link @fluidframework/container-definitions#IFluidModuleWithDetails}
|
|
123
126
|
* to have all the code loading modules in one package. #8193
|
|
124
127
|
* Encapsulates a module entry point with corresponding code details.
|
|
128
|
+
* @alpha
|
|
125
129
|
*/
|
|
126
130
|
export interface IFluidModuleWithDetails {
|
|
127
131
|
/** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
|
|
@@ -139,6 +143,7 @@ export interface IFluidModuleWithDetails {
|
|
|
139
143
|
* to have code loading modules in one package. #8193
|
|
140
144
|
* Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
|
|
141
145
|
* a package name and package version range.
|
|
146
|
+
* @alpha
|
|
142
147
|
*/
|
|
143
148
|
export interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {
|
|
144
149
|
/**
|
|
@@ -152,6 +157,7 @@ export interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComp
|
|
|
152
157
|
|
|
153
158
|
/**
|
|
154
159
|
* Services and properties necessary for creating a loader
|
|
160
|
+
* @alpha
|
|
155
161
|
*/
|
|
156
162
|
export interface ILoaderProps {
|
|
157
163
|
/**
|
|
@@ -208,6 +214,7 @@ export interface ILoaderProps {
|
|
|
208
214
|
|
|
209
215
|
/**
|
|
210
216
|
* Services and properties used by and exposed by the loader
|
|
217
|
+
* @alpha
|
|
211
218
|
*/
|
|
212
219
|
export interface ILoaderServices {
|
|
213
220
|
/**
|
|
@@ -260,6 +267,7 @@ export interface ILoaderServices {
|
|
|
260
267
|
/**
|
|
261
268
|
* Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support
|
|
262
269
|
* blobs in detached containers.
|
|
270
|
+
* @alpha
|
|
263
271
|
*/
|
|
264
272
|
export type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" | "readBlob"> & {
|
|
265
273
|
size: number;
|
|
@@ -274,6 +282,7 @@ export type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" |
|
|
|
274
282
|
* @param container - a resolved container
|
|
275
283
|
* @returns component on the container
|
|
276
284
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
285
|
+
* @internal
|
|
277
286
|
*/
|
|
278
287
|
export async function requestResolvedObjectFromContainer(
|
|
279
288
|
container: IContainer,
|
|
@@ -298,6 +307,7 @@ export async function requestResolvedObjectFromContainer(
|
|
|
298
307
|
|
|
299
308
|
/**
|
|
300
309
|
* Manages Fluid resource loading
|
|
310
|
+
* @alpha
|
|
301
311
|
*/
|
|
302
312
|
export class Loader implements IHostLoader {
|
|
303
313
|
public readonly services: ILoaderServices;
|
|
@@ -15,6 +15,7 @@ import { createChildLogger } from "@fluidframework/telemetry-utils";
|
|
|
15
15
|
* Checks if the error is location redirection error.
|
|
16
16
|
* @param error - error whose type is to be determined.
|
|
17
17
|
* @returns `true` is the error is location redirection error, otherwise `false`.
|
|
18
|
+
* @internal
|
|
18
19
|
*/
|
|
19
20
|
export function isLocationRedirectionError(error: any): error is ILocationRedirectionError {
|
|
20
21
|
return (
|
|
@@ -31,6 +32,7 @@ export function isLocationRedirectionError(error: any): error is ILocationRedire
|
|
|
31
32
|
* @param urlResolver - resolver used to resolve the url.
|
|
32
33
|
* @param logger - logger to send events.
|
|
33
34
|
* @returns Response from the API call.
|
|
35
|
+
* @internal
|
|
34
36
|
*/
|
|
35
37
|
export async function resolveWithLocationRedirectionHandling<T>(
|
|
36
38
|
api: (request: IRequest) => Promise<T>,
|
package/src/packageVersion.ts
CHANGED
package/src/protocol.ts
CHANGED
|
@@ -28,6 +28,7 @@ export enum SignalType {
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Function to be used for creating a protocol handler.
|
|
31
|
+
* @alpha
|
|
31
32
|
*/
|
|
32
33
|
export type ProtocolHandlerBuilder = (
|
|
33
34
|
attributes: IDocumentAttributes,
|
|
@@ -35,6 +36,9 @@ export type ProtocolHandlerBuilder = (
|
|
|
35
36
|
sendProposal: (key: string, value: any) => number,
|
|
36
37
|
) => IProtocolHandler;
|
|
37
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @alpha
|
|
41
|
+
*/
|
|
38
42
|
export interface IProtocolHandler extends IBaseProtocolHandler {
|
|
39
43
|
readonly audience: IAudienceOwner;
|
|
40
44
|
processSignal(message: ISignalMessage);
|
package/src/utils.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface ISnapshotTreeWithBlobContents extends ISnapshotTree {
|
|
|
27
27
|
* Interface to represent the parsed parts of IResolvedUrl.url to help
|
|
28
28
|
* in getting info about different parts of the url.
|
|
29
29
|
* May not be compatible or relevant for any Url Resolver
|
|
30
|
+
* @internal
|
|
30
31
|
*/
|
|
31
32
|
export interface IParsedUrl {
|
|
32
33
|
/**
|
|
@@ -56,6 +57,7 @@ export interface IParsedUrl {
|
|
|
56
57
|
* with urls of type: protocol://<string>/.../..?<querystring>
|
|
57
58
|
* @param url - This is the IResolvedUrl.url part of the resolved url.
|
|
58
59
|
* @returns The IParsedUrl representing the input URL, or undefined if the format was not supported
|
|
60
|
+
* @internal
|
|
59
61
|
*/
|
|
60
62
|
export function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined {
|
|
61
63
|
const parsed = parse(url, true);
|