@fluidframework/test-utils 2.22.1 → 2.23.0-325054
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/dist/TestSummaryUtils.d.ts +2 -2
- package/dist/TestSummaryUtils.d.ts.map +1 -1
- package/dist/TestSummaryUtils.js +17 -17
- package/dist/TestSummaryUtils.js.map +1 -1
- package/dist/containerRuntimeFactories.d.ts +80 -0
- package/dist/containerRuntimeFactories.d.ts.map +1 -0
- package/dist/containerRuntimeFactories.js +94 -0
- package/dist/containerRuntimeFactories.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/localCodeLoader.d.ts.map +1 -1
- package/dist/localCodeLoader.js +6 -4
- package/dist/localCodeLoader.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/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +42 -10
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js +9 -7
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
- package/dist/testFluidObject.d.ts +1 -0
- package/dist/testFluidObject.d.ts.map +1 -1
- package/dist/testFluidObject.js +5 -4
- package/dist/testFluidObject.js.map +1 -1
- package/lib/TestSummaryUtils.d.ts +2 -2
- package/lib/TestSummaryUtils.d.ts.map +1 -1
- package/lib/TestSummaryUtils.js +8 -8
- package/lib/TestSummaryUtils.js.map +1 -1
- package/lib/containerRuntimeFactories.d.ts +80 -0
- package/lib/containerRuntimeFactories.d.ts.map +1 -0
- package/lib/containerRuntimeFactories.js +92 -0
- package/lib/containerRuntimeFactories.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/localCodeLoader.d.ts.map +1 -1
- package/lib/localCodeLoader.js +3 -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/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +42 -10
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js +9 -7
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
- package/lib/testFluidObject.d.ts +1 -0
- package/lib/testFluidObject.d.ts.map +1 -1
- package/lib/testFluidObject.js +5 -4
- package/lib/testFluidObject.js.map +1 -1
- package/package.json +23 -24
- package/src/TestSummaryUtils.ts +9 -6
- package/src/containerRuntimeFactories.ts +183 -0
- package/src/index.ts +5 -1
- package/src/localCodeLoader.ts +4 -1
- package/src/packageVersion.ts +1 -1
- package/src/testContainerRuntimeFactoryWithDefaultDataStore.ts +57 -17
- package/src/testFluidObject.ts +8 -4
package/src/packageVersion.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import type { IRuntimeFactory } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import { IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
|
|
8
8
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
9
9
|
import { FluidObject } from "@fluidframework/core-interfaces";
|
|
@@ -23,25 +23,65 @@ const getDefaultFluidObject = async (runtime: IContainerRuntime) => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* {@link ContainerRuntimeFactoryWithDefaultDataStoreConstructor} input properties.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export interface ContainerRuntimeFactoryWithDefaultDataStoreProps {
|
|
31
|
+
readonly defaultFactory: IFluidDataStoreFactory;
|
|
32
|
+
/**
|
|
33
|
+
* The data store registry for containers produced.
|
|
34
|
+
*/
|
|
35
|
+
readonly registryEntries: NamedFluidDataStoreRegistryEntries;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Do not use. This strictly exists for backwards compatibility.
|
|
39
|
+
*/
|
|
40
|
+
readonly dependencyContainer?: never;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Request handlers for containers produced.
|
|
44
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
45
|
+
*/
|
|
46
|
+
// eslint-disable-next-line import/no-deprecated
|
|
47
|
+
readonly requestHandlers?: RuntimeRequestHandler[];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The runtime options passed to the IContainerRuntime when instantiating it
|
|
51
|
+
*/
|
|
52
|
+
readonly runtimeOptions?: IContainerRuntimeOptions;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Function that will initialize the entryPoint of the IContainerRuntime instances
|
|
56
|
+
* created with this factory
|
|
57
|
+
*/
|
|
58
|
+
readonly provideEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* {@link @fluidframework/container-definitions#IRuntimeFactory} construct signature.
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export type ContainerRuntimeFactoryWithDefaultDataStoreConstructor = new (
|
|
67
|
+
props: ContainerRuntimeFactoryWithDefaultDataStoreProps,
|
|
68
|
+
) => IRuntimeFactory;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @remarks
|
|
72
|
+
* This function is purely needed for back-compat as the constructor argument structure of
|
|
73
|
+
* `ContainerRuntimeFactoryWithDefaultDataStore` was changed.
|
|
74
|
+
*
|
|
27
75
|
* @internal
|
|
28
76
|
*/
|
|
29
77
|
export const createContainerRuntimeFactoryWithDefaultDataStore = (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
registryEntries: NamedFluidDataStoreRegistryEntries;
|
|
34
|
-
dependencyContainer?: any;
|
|
35
|
-
// eslint-disable-next-line import/no-deprecated
|
|
36
|
-
requestHandlers?: RuntimeRequestHandler[];
|
|
37
|
-
runtimeOptions?: IContainerRuntimeOptions;
|
|
38
|
-
provideEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>;
|
|
39
|
-
},
|
|
40
|
-
): ContainerRuntimeFactoryWithDefaultDataStore => {
|
|
78
|
+
ctor: ContainerRuntimeFactoryWithDefaultDataStoreConstructor,
|
|
79
|
+
ctorProps: ContainerRuntimeFactoryWithDefaultDataStoreProps,
|
|
80
|
+
): IRuntimeFactory => {
|
|
41
81
|
try {
|
|
42
|
-
return new
|
|
82
|
+
return new ctor(ctorProps);
|
|
43
83
|
} catch (err) {
|
|
44
|
-
// IMPORTANT: The constructor argument structure changed, so this is needed for dynamically using older ContainerRuntimeFactoryWithDefaultDataStore
|
|
84
|
+
// IMPORTANT: The constructor argument structure changed, so this is needed for dynamically using older `ContainerRuntimeFactoryWithDefaultDataStore`s
|
|
45
85
|
const {
|
|
46
86
|
defaultFactory,
|
|
47
87
|
registryEntries,
|
|
@@ -49,9 +89,9 @@ export const createContainerRuntimeFactoryWithDefaultDataStore = (
|
|
|
49
89
|
requestHandlers,
|
|
50
90
|
runtimeOptions,
|
|
51
91
|
provideEntryPoint,
|
|
52
|
-
} =
|
|
92
|
+
} = ctorProps;
|
|
53
93
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
54
|
-
return new (
|
|
94
|
+
return new (ctor as any)(
|
|
55
95
|
defaultFactory,
|
|
56
96
|
registryEntries,
|
|
57
97
|
dependencyContainer,
|
package/src/testFluidObject.ts
CHANGED
|
@@ -72,11 +72,14 @@ export class TestFluidObject implements ITestFluidObject {
|
|
|
72
72
|
throw new Error("Shared objects were not provided during creation.");
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
if (this.factoryEntriesMap.has(id)) {
|
|
76
|
+
const handle = this.root.get<IFluidHandle<T>>(id);
|
|
77
|
+
if (handle === undefined) {
|
|
78
|
+
throw new Error(
|
|
79
|
+
`Shared object with id '${id}' is in factoryEntriesMap but not found under root.`,
|
|
80
|
+
);
|
|
79
81
|
}
|
|
82
|
+
return handle.get();
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
throw new Error(`Shared object with id ${id} not found.`);
|
|
@@ -110,6 +113,7 @@ export class TestFluidObject implements ITestFluidObject {
|
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
/**
|
|
116
|
+
* Iterable\<[ChannelId, IChannelFactory]\>.
|
|
113
117
|
* @internal
|
|
114
118
|
*/
|
|
115
119
|
export type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;
|