@fluidframework/test-utils 2.118.0 → 3.0.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 +62 -4
- package/README.md +53 -50
- package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
- package/dist/TestConfigs.d.ts.map +1 -1
- package/dist/TestSummaryUtils.d.ts.map +1 -1
- package/dist/TestSummaryUtils.js +6 -5
- package/dist/TestSummaryUtils.js.map +1 -1
- package/dist/containerRuntimeFactories.d.ts.map +1 -1
- package/dist/containerRuntimeFactories.js +23 -2
- package/dist/containerRuntimeFactories.js.map +1 -1
- package/dist/containerUtils.js +5 -6
- package/dist/containerUtils.js.map +1 -1
- package/dist/eventAndErrorLogger.d.ts +1 -1
- package/dist/eventAndErrorLogger.d.ts.map +1 -1
- package/dist/eventAndErrorLogger.js +18 -17
- package/dist/eventAndErrorLogger.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/loaderContainerTracker.js +3 -2
- package/dist/loaderContainerTracker.js.map +1 -1
- package/dist/localCodeLoader.js +3 -3
- package/dist/localCodeLoader.js.map +1 -1
- package/dist/localLoader.js +4 -5
- package/dist/localLoader.js.map +1 -1
- package/dist/nonEmptyArrayType.js +1 -2
- package/dist/nonEmptyArrayType.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/retry.d.ts.map +1 -1
- package/dist/testCompatibility.d.ts +12 -0
- package/dist/testCompatibility.d.ts.map +1 -0
- package/dist/testCompatibility.js +16 -0
- package/dist/testCompatibility.js.map +1 -0
- package/dist/testContainerRuntimeFactory.d.ts +6 -6
- package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactory.js +7 -1
- package/dist/testContainerRuntimeFactory.js.map +1 -1
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +17 -4
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js +16 -6
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
- package/dist/testFluidObject.js +10 -0
- package/dist/testFluidObject.js.map +1 -1
- package/dist/testFluidObjectInternal.js +6 -0
- package/dist/testFluidObjectInternal.js.map +1 -1
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js +41 -21
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.js +7 -8
- package/dist/timeoutUtils.js.map +1 -1
- package/lib/TestConfigs.d.ts.map +1 -1
- package/lib/TestSummaryUtils.d.ts.map +1 -1
- package/lib/TestSummaryUtils.js +2 -0
- package/lib/TestSummaryUtils.js.map +1 -1
- package/lib/containerRuntimeFactories.d.ts.map +1 -1
- package/lib/containerRuntimeFactories.js +23 -2
- package/lib/containerRuntimeFactories.js.map +1 -1
- package/lib/eventAndErrorLogger.d.ts +1 -1
- package/lib/eventAndErrorLogger.d.ts.map +1 -1
- package/lib/eventAndErrorLogger.js +16 -15
- package/lib/eventAndErrorLogger.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/loaderContainerTracker.js +3 -2
- package/lib/loaderContainerTracker.js.map +1 -1
- package/lib/localCodeLoader.js +1 -1
- package/lib/localCodeLoader.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/public.d.ts +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/testCompatibility.d.ts +12 -0
- package/lib/testCompatibility.d.ts.map +1 -0
- package/lib/testCompatibility.js +13 -0
- package/lib/testCompatibility.js.map +1 -0
- package/lib/testContainerRuntimeFactory.d.ts +6 -6
- package/lib/testContainerRuntimeFactory.d.ts.map +1 -1
- package/lib/testContainerRuntimeFactory.js +7 -1
- package/lib/testContainerRuntimeFactory.js.map +1 -1
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +17 -4
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js +16 -6
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
- package/lib/testFluidObject.js +10 -0
- package/lib/testFluidObject.js.map +1 -1
- package/lib/testFluidObjectInternal.js +6 -0
- package/lib/testFluidObjectInternal.js.map +1 -1
- package/lib/testObjectProvider.d.ts.map +1 -1
- package/lib/testObjectProvider.js +41 -21
- package/lib/testObjectProvider.js.map +1 -1
- package/lib/timeoutUtils.js +5 -5
- package/lib/timeoutUtils.js.map +1 -1
- package/package.json +53 -58
- package/src/TestSummaryUtils.ts +2 -0
- package/src/containerRuntimeFactories.ts +4 -2
- package/src/eventAndErrorLogger.ts +1 -1
- package/src/index.ts +1 -0
- package/src/packageVersion.ts +1 -1
- package/src/testCompatibility.ts +16 -0
- package/src/testContainerRuntimeFactory.ts +3 -1
- package/src/testContainerRuntimeFactoryWithDefaultDataStore.ts +72 -11
- package/tsconfig.json +1 -1
- package/internal.d.ts +0 -11
- package/legacy.d.ts +0 -11
- /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
- /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/test-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Utilities for Fluid tests",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -14,38 +14,24 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"require": {
|
|
22
|
-
"types": "./dist/public.d.ts",
|
|
23
|
-
"default": "./dist/index.js"
|
|
17
|
+
"types": "./lib/public.d.ts",
|
|
18
|
+
"default": "./lib/index.js",
|
|
19
|
+
"internal-entrypoint-generation": {
|
|
20
|
+
"types": "./dist/public.d.ts"
|
|
24
21
|
}
|
|
25
22
|
},
|
|
26
23
|
"./legacy": {
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"require": {
|
|
32
|
-
"types": "./dist/legacy.d.ts",
|
|
33
|
-
"default": "./dist/index.js"
|
|
24
|
+
"types": "./lib/legacy.d.ts",
|
|
25
|
+
"default": "./lib/index.js",
|
|
26
|
+
"internal-entrypoint-generation": {
|
|
27
|
+
"types": "./dist/legacy.d.ts"
|
|
34
28
|
}
|
|
35
29
|
},
|
|
36
30
|
"./internal": {
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"default": "./lib/index.js"
|
|
40
|
-
},
|
|
41
|
-
"require": {
|
|
42
|
-
"types": "./dist/index.d.ts",
|
|
43
|
-
"default": "./dist/index.js"
|
|
44
|
-
}
|
|
31
|
+
"types": "./lib/index.d.ts",
|
|
32
|
+
"default": "./lib/index.js"
|
|
45
33
|
}
|
|
46
34
|
},
|
|
47
|
-
"main": "lib/index.js",
|
|
48
|
-
"types": "lib/public.d.ts",
|
|
49
35
|
"c8": {
|
|
50
36
|
"all": true,
|
|
51
37
|
"cache-dir": "nyc/.cache",
|
|
@@ -67,26 +53,26 @@
|
|
|
67
53
|
"temp-directory": "nyc/.nyc_output"
|
|
68
54
|
},
|
|
69
55
|
"dependencies": {
|
|
70
|
-
"@fluid-internal/test-driver-definitions": "~
|
|
71
|
-
"@fluidframework/container-definitions": "~
|
|
72
|
-
"@fluidframework/container-loader": "~
|
|
73
|
-
"@fluidframework/container-runtime": "~
|
|
74
|
-
"@fluidframework/container-runtime-definitions": "~
|
|
75
|
-
"@fluidframework/core-interfaces": "~
|
|
76
|
-
"@fluidframework/core-utils": "~
|
|
77
|
-
"@fluidframework/datastore": "~
|
|
78
|
-
"@fluidframework/datastore-definitions": "~
|
|
79
|
-
"@fluidframework/driver-definitions": "~
|
|
80
|
-
"@fluidframework/driver-utils": "~
|
|
81
|
-
"@fluidframework/local-driver": "~
|
|
82
|
-
"@fluidframework/map": "~
|
|
83
|
-
"@fluidframework/odsp-driver": "~
|
|
84
|
-
"@fluidframework/request-handler": "~
|
|
85
|
-
"@fluidframework/routerlicious-driver": "~
|
|
86
|
-
"@fluidframework/runtime-definitions": "~
|
|
87
|
-
"@fluidframework/runtime-utils": "~
|
|
88
|
-
"@fluidframework/shared-object-base": "~
|
|
89
|
-
"@fluidframework/telemetry-utils": "~
|
|
56
|
+
"@fluid-internal/test-driver-definitions": "~3.0.0",
|
|
57
|
+
"@fluidframework/container-definitions": "~3.0.0",
|
|
58
|
+
"@fluidframework/container-loader": "~3.0.0",
|
|
59
|
+
"@fluidframework/container-runtime": "~3.0.0",
|
|
60
|
+
"@fluidframework/container-runtime-definitions": "~3.0.0",
|
|
61
|
+
"@fluidframework/core-interfaces": "~3.0.0",
|
|
62
|
+
"@fluidframework/core-utils": "~3.0.0",
|
|
63
|
+
"@fluidframework/datastore": "~3.0.0",
|
|
64
|
+
"@fluidframework/datastore-definitions": "~3.0.0",
|
|
65
|
+
"@fluidframework/driver-definitions": "~3.0.0",
|
|
66
|
+
"@fluidframework/driver-utils": "~3.0.0",
|
|
67
|
+
"@fluidframework/local-driver": "~3.0.0",
|
|
68
|
+
"@fluidframework/map": "~3.0.0",
|
|
69
|
+
"@fluidframework/odsp-driver": "~3.0.0",
|
|
70
|
+
"@fluidframework/request-handler": "~3.0.0",
|
|
71
|
+
"@fluidframework/routerlicious-driver": "~3.0.0",
|
|
72
|
+
"@fluidframework/runtime-definitions": "~3.0.0",
|
|
73
|
+
"@fluidframework/runtime-utils": "~3.0.0",
|
|
74
|
+
"@fluidframework/shared-object-base": "~3.0.0",
|
|
75
|
+
"@fluidframework/telemetry-utils": "~3.0.0",
|
|
90
76
|
"best-random": "^1.0.0",
|
|
91
77
|
"debug": "^4.3.4",
|
|
92
78
|
"uuid": "^11.1.0"
|
|
@@ -94,7 +80,7 @@
|
|
|
94
80
|
"devDependencies": {
|
|
95
81
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
96
82
|
"@biomejs/biome": "~2.4.5",
|
|
97
|
-
"@fluid-internal/mocha-test-setup": "~
|
|
83
|
+
"@fluid-internal/mocha-test-setup": "~3.0.0",
|
|
98
84
|
"@fluid-tools/build-cli": "^0.67.0",
|
|
99
85
|
"@fluidframework/build-common": "^2.0.3",
|
|
100
86
|
"@fluidframework/build-tools": "^0.67.0",
|
|
@@ -115,29 +101,39 @@
|
|
|
115
101
|
"mocha": "^11.7.5",
|
|
116
102
|
"mocha-multi-reporters": "^1.5.1",
|
|
117
103
|
"rimraf": "^6.1.3",
|
|
118
|
-
"typescript": "~
|
|
104
|
+
"typescript": "~6.0.3"
|
|
119
105
|
},
|
|
120
106
|
"typeValidation": {
|
|
121
|
-
"broken": {
|
|
107
|
+
"broken": {
|
|
108
|
+
"Interface_IProvideTestFluidObject": {
|
|
109
|
+
"backCompat": false,
|
|
110
|
+
"forwardCompat": false
|
|
111
|
+
},
|
|
112
|
+
"Interface_ITestFluidObject": {
|
|
113
|
+
"backCompat": false,
|
|
114
|
+
"forwardCompat": false
|
|
115
|
+
}
|
|
116
|
+
},
|
|
122
117
|
"entrypoint": "legacy"
|
|
123
118
|
},
|
|
124
119
|
"scripts": {
|
|
125
120
|
"build": "fluid-build . --task build",
|
|
126
121
|
"build:api-reports": "concurrently \"npm:build:api-reports:*\"",
|
|
127
|
-
"build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
|
|
128
|
-
"build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
|
|
122
|
+
"build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor-report.current.json",
|
|
123
|
+
"build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor-report.legacy.json",
|
|
124
|
+
"build:cjs": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
|
|
129
125
|
"build:compile": "fluid-build . --task compile",
|
|
130
126
|
"build:compile:min": "npm run build:compile",
|
|
131
|
-
"build:docs": "api-extractor run --local",
|
|
127
|
+
"build:docs": "api-extractor run --local --config api-extractor/api-extractor-model.json",
|
|
132
128
|
"build:entrypoints": "fluid-build . --task build:entrypoints",
|
|
133
129
|
"build:entrypoints:cjs": "flub generate entrypoints --resolutionConditions require --outFileLegacyBeta legacy --outDir ./dist",
|
|
134
|
-
"build:entrypoints:esm": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib
|
|
135
|
-
"build:
|
|
130
|
+
"build:entrypoints:esm": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib",
|
|
131
|
+
"build:esm": "tsc --project ./tsconfig.json",
|
|
136
132
|
"build:genver": "gen-version",
|
|
137
133
|
"build:test": "concurrently npm:build:test:esm npm:build:test:cjs",
|
|
138
134
|
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
|
|
139
135
|
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
140
|
-
"check:are-the-types-wrong": "attw --pack .",
|
|
136
|
+
"check:are-the-types-wrong": "attw --pack . --profile esm-only",
|
|
141
137
|
"check:biome": "biome check .",
|
|
142
138
|
"check:exports": "concurrently \"npm:check:exports:*\"",
|
|
143
139
|
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
|
|
@@ -147,9 +143,9 @@
|
|
|
147
143
|
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
|
|
148
144
|
"check:format": "npm run check:biome",
|
|
149
145
|
"ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
|
|
150
|
-
"ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
|
|
151
|
-
"ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
|
|
152
|
-
"ci:build:docs": "api-extractor run",
|
|
146
|
+
"ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor-report.current.json",
|
|
147
|
+
"ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor-report.legacy.json",
|
|
148
|
+
"ci:build:docs": "api-extractor run --config api-extractor/api-extractor-model.json",
|
|
153
149
|
"clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
154
150
|
"eslint": "eslint --quiet --format stylish src",
|
|
155
151
|
"eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
@@ -162,7 +158,6 @@
|
|
|
162
158
|
"test:mocha:cjs": "cross-env FLUID_TEST_MODULE_SYSTEM=CJS mocha",
|
|
163
159
|
"test:mocha:esm": "mocha",
|
|
164
160
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
165
|
-
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
|
|
166
161
|
"typetests:gen": "flub generate typetests --dir . -v"
|
|
167
162
|
}
|
|
168
163
|
}
|
package/src/TestSummaryUtils.ts
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
type ContainerRuntimeFactoryWithDefaultDataStoreConstructor,
|
|
36
36
|
createContainerRuntimeFactoryWithDefaultDataStore,
|
|
37
37
|
} from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
|
|
38
|
+
import { defaultTestOldestSupportedClient } from "./testCompatibility.js";
|
|
38
39
|
import { ITestContainerConfig, ITestObjectProvider } from "./testObjectProvider.js";
|
|
39
40
|
import { timeoutAwait } from "./timeoutUtils.js";
|
|
40
41
|
|
|
@@ -136,6 +137,7 @@ export async function createSummarizerFromFactory(
|
|
|
136
137
|
containerRuntimeFactoryType ?? ContainerRuntimeFactoryWithDefaultDataStore,
|
|
137
138
|
{
|
|
138
139
|
defaultFactory: dataStoreFactory,
|
|
140
|
+
oldestSupportedClient: defaultTestOldestSupportedClient,
|
|
139
141
|
registryEntries: registryEntries ?? [
|
|
140
142
|
[dataStoreFactory.type, Promise.resolve(dataStoreFactory)],
|
|
141
143
|
],
|
|
@@ -33,6 +33,8 @@ import type {
|
|
|
33
33
|
} from "@fluidframework/runtime-definitions/internal";
|
|
34
34
|
import { RequestParser, RuntimeFactoryHelper } from "@fluidframework/runtime-utils/internal";
|
|
35
35
|
|
|
36
|
+
import { defaultTestOldestSupportedClient } from "./testCompatibility.js";
|
|
37
|
+
|
|
36
38
|
const defaultDataStoreId = "default";
|
|
37
39
|
|
|
38
40
|
async function getDefaultFluidObject(runtime: IContainerRuntime): Promise<FluidObject> {
|
|
@@ -126,7 +128,7 @@ export class ContainerRuntimeFactoryWithDefaultDataStore
|
|
|
126
128
|
/**
|
|
127
129
|
* {@inheritDoc ContainerRuntimeFactoryWithDefaultDataStoreProps.minVersionForCollab}
|
|
128
130
|
*/
|
|
129
|
-
private readonly minVersionForCollab: OldestSupportedClientVersion
|
|
131
|
+
private readonly minVersionForCollab: OldestSupportedClientVersion;
|
|
130
132
|
|
|
131
133
|
public constructor(props: ContainerRuntimeFactoryWithDefaultDataStoreProps) {
|
|
132
134
|
super();
|
|
@@ -153,7 +155,7 @@ export class ContainerRuntimeFactoryWithDefaultDataStore
|
|
|
153
155
|
this.provideEntryPoint = props.provideEntryPoint ?? getDefaultFluidObject;
|
|
154
156
|
this.requestHandlers = [getDefaultObject];
|
|
155
157
|
this.registry = new FluidDataStoreRegistry(this.registryEntries);
|
|
156
|
-
this.minVersionForCollab = props.minVersionForCollab;
|
|
158
|
+
this.minVersionForCollab = props.minVersionForCollab ?? defaultTestOldestSupportedClient;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
public async instantiateFirstTime(runtime: IContainerRuntime): Promise<void> {
|
|
@@ -64,7 +64,7 @@ export class EventAndErrorTrackingLogger
|
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
send(event: ITelemetryBaseEvent, logLevel
|
|
67
|
+
send(event: ITelemetryBaseEvent, logLevel: LogLevel): void {
|
|
68
68
|
if (isNonEmptyArray(this.expectedEvents)) {
|
|
69
69
|
const ee = this.expectedEvents[0].event;
|
|
70
70
|
if (ee.eventName === event.eventName) {
|
package/src/index.ts
CHANGED
|
@@ -83,5 +83,6 @@ export {
|
|
|
83
83
|
type ContainerRuntimeFactoryWithDefaultDataStoreProps,
|
|
84
84
|
createContainerRuntimeFactoryWithDefaultDataStore,
|
|
85
85
|
} from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
|
|
86
|
+
export { defaultTestOldestSupportedClient } from "./testCompatibility.js";
|
|
86
87
|
|
|
87
88
|
export { TestFluidObjectInternal } from "./testFluidObjectInternal.js";
|
package/src/packageVersion.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { OldestSupportedClientVersion } from "@fluidframework/runtime-definitions/internal";
|
|
7
|
+
import { defaultMinVersionForCollab } from "@fluidframework/runtime-utils/internal";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Canonical compatibility setting for generic runtime tests. Tests for a specific feature should
|
|
11
|
+
* instead use that feature's minimum supported client version.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export const defaultTestOldestSupportedClient =
|
|
16
|
+
defaultMinVersionForCollab satisfies OldestSupportedClientVersion;
|
|
@@ -33,6 +33,8 @@ import {
|
|
|
33
33
|
} from "@fluidframework/runtime-definitions/internal";
|
|
34
34
|
import { RequestParser, RuntimeFactoryHelper } from "@fluidframework/runtime-utils/internal";
|
|
35
35
|
|
|
36
|
+
import { defaultTestOldestSupportedClient } from "./testCompatibility.js";
|
|
37
|
+
|
|
36
38
|
interface backCompat_IFluidRouter {
|
|
37
39
|
IFluidRouter?: backCompat_IFluidRouter;
|
|
38
40
|
request(request: IRequest): Promise<IResponse>;
|
|
@@ -107,7 +109,7 @@ export const createTestContainerRuntimeFactory = (
|
|
|
107
109
|
},
|
|
108
110
|
},
|
|
109
111
|
},
|
|
110
|
-
public minVersionForCollab: OldestSupportedClientVersion
|
|
112
|
+
public minVersionForCollab: OldestSupportedClientVersion = defaultTestOldestSupportedClient,
|
|
111
113
|
// eslint-disable-next-line import-x/no-deprecated
|
|
112
114
|
public requestHandlers: RuntimeRequestHandler[] = [],
|
|
113
115
|
) {
|
|
@@ -9,11 +9,13 @@ import { IContainerRuntime } from "@fluidframework/container-runtime-definitions
|
|
|
9
9
|
import { FluidObject } from "@fluidframework/core-interfaces";
|
|
10
10
|
// eslint-disable-next-line import-x/no-deprecated
|
|
11
11
|
import { RuntimeRequestHandler } from "@fluidframework/request-handler/internal";
|
|
12
|
-
import {
|
|
12
|
+
import type {
|
|
13
13
|
IFluidDataStoreFactory,
|
|
14
14
|
NamedFluidDataStoreRegistryEntries,
|
|
15
15
|
} from "@fluidframework/runtime-definitions/internal";
|
|
16
16
|
|
|
17
|
+
import type { defaultTestOldestSupportedClient } from "./testCompatibility.js";
|
|
18
|
+
|
|
17
19
|
const getDefaultFluidObject = async (runtime: IContainerRuntime): Promise<FluidObject> => {
|
|
18
20
|
const entryPoint = await runtime.getAliasedDataStoreEntryPoint("default");
|
|
19
21
|
if (entryPoint === undefined) {
|
|
@@ -29,6 +31,16 @@ const getDefaultFluidObject = async (runtime: IContainerRuntime): Promise<FluidO
|
|
|
29
31
|
*/
|
|
30
32
|
export interface ContainerRuntimeFactoryWithDefaultDataStoreProps {
|
|
31
33
|
readonly defaultFactory: IFluidDataStoreFactory;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Compatibility setting used by all constructor shapes supported by this helper.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Object-shaped constructors receive this setting explicitly. Positional constructors predate
|
|
40
|
+
* the setting and continue to use the historical package's own implicit default.
|
|
41
|
+
*/
|
|
42
|
+
readonly oldestSupportedClient: typeof defaultTestOldestSupportedClient;
|
|
43
|
+
|
|
32
44
|
/**
|
|
33
45
|
* The data store registry for containers produced.
|
|
34
46
|
*/
|
|
@@ -63,16 +75,60 @@ export interface ContainerRuntimeFactoryWithDefaultDataStoreProps {
|
|
|
63
75
|
*
|
|
64
76
|
* @internal
|
|
65
77
|
*/
|
|
66
|
-
export type ContainerRuntimeFactoryWithDefaultDataStoreConstructor =
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
export type ContainerRuntimeFactoryWithDefaultDataStoreConstructor = (
|
|
79
|
+
| (new (
|
|
80
|
+
props: ContainerRuntimeFactoryWithDefaultDataStoreProps,
|
|
81
|
+
) => IRuntimeFactory)
|
|
82
|
+
| (new (
|
|
83
|
+
defaultFactory: IFluidDataStoreFactory,
|
|
84
|
+
registryEntries: NamedFluidDataStoreRegistryEntries,
|
|
85
|
+
dependencyContainer?: never,
|
|
86
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
87
|
+
requestHandlers?: RuntimeRequestHandler[],
|
|
88
|
+
runtimeOptions?: IContainerRuntimeOptions,
|
|
89
|
+
provideEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>,
|
|
90
|
+
) => IRuntimeFactory)
|
|
91
|
+
) & { readonly length: number };
|
|
92
|
+
|
|
93
|
+
type ObjectContainerRuntimeFactoryWithDefaultDataStoreConstructor = Extract<
|
|
94
|
+
ContainerRuntimeFactoryWithDefaultDataStoreConstructor,
|
|
95
|
+
new (
|
|
96
|
+
props: ContainerRuntimeFactoryWithDefaultDataStoreProps,
|
|
97
|
+
) => IRuntimeFactory
|
|
98
|
+
>;
|
|
99
|
+
|
|
100
|
+
type PositionalContainerRuntimeFactoryWithDefaultDataStoreConstructor = Exclude<
|
|
101
|
+
ContainerRuntimeFactoryWithDefaultDataStoreConstructor,
|
|
102
|
+
ObjectContainerRuntimeFactoryWithDefaultDataStoreConstructor
|
|
103
|
+
>;
|
|
104
|
+
|
|
105
|
+
const objectConstructorArity = 1;
|
|
106
|
+
const positionalConstructorArity = 3;
|
|
107
|
+
|
|
108
|
+
function isObjectConstructor(
|
|
109
|
+
ctor: ContainerRuntimeFactoryWithDefaultDataStoreConstructor,
|
|
110
|
+
): ctor is ObjectContainerRuntimeFactoryWithDefaultDataStoreConstructor & {
|
|
111
|
+
readonly length: typeof objectConstructorArity;
|
|
112
|
+
} {
|
|
113
|
+
return ctor.length === objectConstructorArity;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isPositionalConstructor(
|
|
117
|
+
ctor: ContainerRuntimeFactoryWithDefaultDataStoreConstructor,
|
|
118
|
+
): ctor is PositionalContainerRuntimeFactoryWithDefaultDataStoreConstructor & {
|
|
119
|
+
readonly length: typeof positionalConstructorArity;
|
|
120
|
+
} {
|
|
121
|
+
return ctor.length === positionalConstructorArity;
|
|
122
|
+
}
|
|
69
123
|
|
|
70
124
|
/**
|
|
71
125
|
* Creates a container runtime factory with default data store for backward compatibility.
|
|
72
126
|
*
|
|
73
127
|
* @remarks
|
|
74
|
-
*
|
|
75
|
-
* `
|
|
128
|
+
* Exact constructors loaded by compatibility tests use the positional shape through
|
|
129
|
+
* `2.0.0-internal.5.4.2` and the object shape beginning with `2.0.0-internal.7.0.0`.
|
|
130
|
+
* JavaScript constructor length counts parameters before the first default-valued parameter, so
|
|
131
|
+
* these shapes have arity 3 and 1 respectively. Unknown arities are rejected rather than guessed.
|
|
76
132
|
*
|
|
77
133
|
* @internal
|
|
78
134
|
*/
|
|
@@ -80,10 +136,12 @@ export const createContainerRuntimeFactoryWithDefaultDataStore = (
|
|
|
80
136
|
ctor: ContainerRuntimeFactoryWithDefaultDataStoreConstructor,
|
|
81
137
|
ctorProps: ContainerRuntimeFactoryWithDefaultDataStoreProps,
|
|
82
138
|
): IRuntimeFactory => {
|
|
83
|
-
|
|
139
|
+
const constructorArity = ctor.length;
|
|
140
|
+
if (isObjectConstructor(ctor)) {
|
|
84
141
|
return new ctor(ctorProps);
|
|
85
|
-
}
|
|
86
|
-
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (isPositionalConstructor(ctor)) {
|
|
87
145
|
const {
|
|
88
146
|
defaultFactory,
|
|
89
147
|
registryEntries,
|
|
@@ -92,8 +150,7 @@ export const createContainerRuntimeFactoryWithDefaultDataStore = (
|
|
|
92
150
|
runtimeOptions,
|
|
93
151
|
provideEntryPoint,
|
|
94
152
|
} = ctorProps;
|
|
95
|
-
|
|
96
|
-
return new (ctor as any)(
|
|
153
|
+
return new ctor(
|
|
97
154
|
defaultFactory,
|
|
98
155
|
registryEntries,
|
|
99
156
|
dependencyContainer,
|
|
@@ -102,4 +159,8 @@ export const createContainerRuntimeFactoryWithDefaultDataStore = (
|
|
|
102
159
|
provideEntryPoint ?? getDefaultFluidObject,
|
|
103
160
|
);
|
|
104
161
|
}
|
|
162
|
+
|
|
163
|
+
throw new Error(
|
|
164
|
+
`Unsupported ContainerRuntimeFactoryWithDefaultDataStore constructor arity: ${constructorArity}`,
|
|
165
|
+
);
|
|
105
166
|
};
|
package/tsconfig.json
CHANGED
package/internal.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export * from "./lib/index.js";
|
package/legacy.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export * from "./lib/legacy.js";
|
|
File without changes
|
|
File without changes
|