@fluidframework/test-utils 2.0.0-internal.5.3.2 → 2.0.0-internal.6.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 +36 -0
- package/dist/TestSummaryUtils.d.ts +2 -10
- package/dist/TestSummaryUtils.d.ts.map +1 -1
- package/dist/TestSummaryUtils.js +15 -22
- package/dist/TestSummaryUtils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/loaderContainerTracker.js +4 -5
- package/dist/loaderContainerTracker.js.map +1 -1
- package/dist/localCodeLoader.js +5 -2
- package/dist/localCodeLoader.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactory.js +8 -4
- package/dist/testContainerRuntimeFactory.js.map +1 -1
- package/dist/testFluidObject.d.ts +10 -4
- package/dist/testFluidObject.d.ts.map +1 -1
- package/dist/testFluidObject.js +37 -26
- package/dist/testFluidObject.js.map +1 -1
- package/dist/testObjectProvider.d.ts +1 -2
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js +32 -25
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.js +3 -6
- package/dist/timeoutUtils.js.map +1 -1
- package/package.json +39 -25
- package/src/TestSummaryUtils.ts +8 -35
- package/src/index.ts +1 -6
- package/src/packageVersion.ts +1 -1
- package/src/testContainerRuntimeFactory.ts +2 -1
- package/src/testFluidObject.ts +48 -42
- package/src/testObjectProvider.ts +16 -17
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/test-utils";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.6.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/test-utils";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.6.0.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"2.0.0-internal.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"2.0.0-internal.6.0.0\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EAExB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAA8B,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAG7E;;GAEG;AACH,eAAO,MAAM,iCAAiC,yBACvB,uBAAuB;eAI9B,MAAM,oBACM,sBAAsB,mBACxB,wBAAwB,oBAUvB,qBAAqB,EAAE;cAZlC,MAAM;0BACM,sBAAsB;wBACxB,wBAAwB;yBAUvB,qBAAqB,EAAE;sCAKL,gBAAgB,GAAG,QAAQ,IAAI,CAAC;yCAS7B,gBAAgB,GAAG,QAAQ,IAAI,CAAC;+
|
|
1
|
+
{"version":3,"file":"testContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EAExB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAA8B,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAG7E;;GAEG;AACH,eAAO,MAAM,iCAAiC,yBACvB,uBAAuB;eAI9B,MAAM,oBACM,sBAAsB,mBACxB,wBAAwB,oBAUvB,qBAAqB,EAAE;cAZlC,MAAM;0BACM,sBAAsB;wBACxB,wBAAwB;yBAUvB,qBAAqB,EAAE;sCAKL,gBAAgB,GAAG,QAAQ,IAAI,CAAC;yCAS7B,gBAAgB,GAAG,QAAQ,IAAI,CAAC;+BAQpE,iBAAiB,YAChB,OAAO,GACf,QAAQ,QAAQ,GAAG,iBAAiB,CAAC;;;;;CAmBzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B;eA5DxB,MAAM,oBACM,sBAAsB,mBACxB,wBAAwB,oBAUvB,qBAAqB,EAAE;cAZlC,MAAM;0BACM,sBAAsB;wBACxB,wBAAwB;yBAUvB,qBAAqB,EAAE;sCAKL,gBAAgB,GAAG,QAAQ,IAAI,CAAC;yCAS7B,gBAAgB,GAAG,QAAQ,IAAI,CAAC;+BAQpE,iBAAiB,YAChB,OAAO,GACf,QAAQ,QAAQ,GAAG,iBAAiB,CAAC;;;;;CAwBoD,CAAC"}
|
|
@@ -16,9 +16,12 @@ const createTestContainerRuntimeFactory = (containerRuntimeCtor) => {
|
|
|
16
16
|
return class extends runtime_utils_1.RuntimeFactoryHelper {
|
|
17
17
|
constructor(type, dataStoreFactory, runtimeOptions = {
|
|
18
18
|
summaryOptions: {
|
|
19
|
-
summaryConfigOverrides:
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
summaryConfigOverrides: {
|
|
20
|
+
...container_runtime_1.DefaultSummaryConfiguration,
|
|
21
|
+
...{
|
|
22
|
+
initialSummarizerDelayMs: 0,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
22
25
|
},
|
|
23
26
|
}, requestHandlers = []) {
|
|
24
27
|
super();
|
|
@@ -36,7 +39,8 @@ const createTestContainerRuntimeFactory = (containerRuntimeCtor) => {
|
|
|
36
39
|
async instantiateFromExisting(runtime) {
|
|
37
40
|
// Validate we can load root data stores.
|
|
38
41
|
// We should be able to load any data store that was created in initializeFirstTime!
|
|
39
|
-
await runtime.
|
|
42
|
+
await (runtime.getAliasedDataStoreEntryPoint?.("default") ??
|
|
43
|
+
runtime.getRootDataStore("default"));
|
|
40
44
|
}
|
|
41
45
|
async preInitialize(context, existing) {
|
|
42
46
|
const runtime = await containerRuntimeCtor.load(context, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAI2C;AAE3C,qEAAoG;AAEpG,iEAAqE;AAErE;;GAEG;AACI,MAAM,iCAAiC,GAAG,CAChD,oBAA6C,EAC5C,EAAE;IACH,OAAO,KAAM,SAAQ,oCAAoB;QACxC,YACQ,IAAY,EACZ,gBAAwC,EACxC,iBAA2C;YACjD,cAAc,EAAE;gBACf,sBAAsB,
|
|
1
|
+
{"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAI2C;AAE3C,qEAAoG;AAEpG,iEAAqE;AAErE;;GAEG;AACI,MAAM,iCAAiC,GAAG,CAChD,oBAA6C,EAC5C,EAAE;IACH,OAAO,KAAM,SAAQ,oCAAoB;QACxC,YACQ,IAAY,EACZ,gBAAwC,EACxC,iBAA2C;YACjD,cAAc,EAAE;gBACf,sBAAsB,EAAE;oBACvB,GAAG,+CAA2B;oBAC9B,GAAG;wBACF,wBAAwB,EAAE,CAAC;qBAC3B;iBACD;aACD;SACD,EACM,kBAA2C,EAAE;YAEpD,KAAK,EAAE,CAAC;YAdD,SAAI,GAAJ,IAAI,CAAQ;YACZ,qBAAgB,GAAhB,gBAAgB,CAAwB;YACxC,mBAAc,GAAd,cAAc,CASpB;YACM,oBAAe,GAAf,eAAe,CAA8B;QAGrD,CAAC;QAEM,KAAK,CAAC,oBAAoB,CAAC,OAAyB;YAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;YAChF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CACnE,WAAW;YACX,cAAc,CAAC,KAAK,CACpB,CAAC;YACF,MAAM,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QACrE,CAAC;QAEM,KAAK,CAAC,uBAAuB,CAAC,OAAyB;YAC7D,yCAAyC;YACzC,oFAAoF;YACpF,MAAM,CAAC,OAAO,CAAC,6BAA6B,EAAE,CAAC,SAAS,CAAC;gBACxD,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;QACvC,CAAC;QAED,KAAK,CAAC,aAAa,CAClB,OAA0B,EAC1B,QAAiB;YAEjB,MAAM,OAAO,GAAqB,MAAM,oBAAoB,CAAC,IAAI,CAChE,OAAO,EACP;gBACC,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBACnD,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACnD,EACD,IAAA,4CAA0B,EACzB,IAAA,qCAA0B,EAAC,SAAS,CAAC,EACrC,GAAG,IAAI,CAAC,eAAe,CACvB,EACD,IAAI,CAAC,cAAc,EACnB,OAAO,CAAC,KAAK,EACb,QAAQ,CACR,CAAC;YAEF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC,CAAC;AA5DW,QAAA,iCAAiC,qCA4D5C;AAEF;;GAEG;AACU,QAAA,2BAA2B,GAAG,IAAA,yCAAiC,EAAC,oCAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultRouteRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions\";\nimport {\n\tContainerRuntime,\n\tIContainerRuntimeOptions,\n\tDefaultSummaryConfiguration,\n} from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { buildRuntimeRequestHandler, RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\n */\nexport const createTestContainerRuntimeFactory = (\n\tcontainerRuntimeCtor: typeof ContainerRuntime,\n) => {\n\treturn class extends RuntimeFactoryHelper {\n\t\tconstructor(\n\t\t\tpublic type: string,\n\t\t\tpublic dataStoreFactory: IFluidDataStoreFactory,\n\t\t\tpublic runtimeOptions: IContainerRuntimeOptions = {\n\t\t\t\tsummaryOptions: {\n\t\t\t\t\tsummaryConfigOverrides: {\n\t\t\t\t\t\t...DefaultSummaryConfiguration,\n\t\t\t\t\t\t...{\n\t\t\t\t\t\t\tinitialSummarizerDelayMs: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tpublic requestHandlers: RuntimeRequestHandler[] = [],\n\t\t) {\n\t\t\tsuper();\n\t\t}\n\n\t\tpublic async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n\t\t\tconst rootContext = runtime.createDetachedRootDataStore([this.type], \"default\");\n\t\t\tconst rootRuntime = await this.dataStoreFactory.instantiateDataStore(\n\t\t\t\trootContext,\n\t\t\t\t/* existing */ false,\n\t\t\t);\n\t\t\tawait rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);\n\t\t}\n\n\t\tpublic async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n\t\t\t// Validate we can load root data stores.\n\t\t\t// We should be able to load any data store that was created in initializeFirstTime!\n\t\t\tawait (runtime.getAliasedDataStoreEntryPoint?.(\"default\") ??\n\t\t\t\truntime.getRootDataStore(\"default\"));\n\t\t}\n\n\t\tasync preInitialize(\n\t\t\tcontext: IContainerContext,\n\t\t\texisting: boolean,\n\t\t): Promise<IRuntime & IContainerRuntime> {\n\t\t\tconst runtime: ContainerRuntime = await containerRuntimeCtor.load(\n\t\t\t\tcontext,\n\t\t\t\t[\n\t\t\t\t\t[\"default\", Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t\t[this.type, Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t],\n\t\t\t\tbuildRuntimeRequestHandler(\n\t\t\t\t\tdefaultRouteRequestHandler(\"default\"),\n\t\t\t\t\t...this.requestHandlers,\n\t\t\t\t),\n\t\t\t\tthis.runtimeOptions,\n\t\t\t\tcontext.scope,\n\t\t\t\texisting,\n\t\t\t);\n\n\t\t\treturn runtime;\n\t\t}\n\t};\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n */\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IRequest, IResponse, IFluidHandle
|
|
5
|
+
import { IRequest, IResponse, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { FluidDataStoreRuntime } from "@fluidframework/datastore";
|
|
7
7
|
import { ISharedMap } from "@fluidframework/map";
|
|
8
8
|
import { IFluidDataStoreContext, IFluidDataStoreFactory, IFluidDataStoreChannel } from "@fluidframework/runtime-definitions";
|
|
@@ -13,18 +13,21 @@ import { ITestFluidObject } from "./interfaces";
|
|
|
13
13
|
* The shared objects can be retrieved by passing the key of the entry to getSharedObject.
|
|
14
14
|
* It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
|
|
15
15
|
*/
|
|
16
|
-
export declare class TestFluidObject implements ITestFluidObject
|
|
16
|
+
export declare class TestFluidObject implements ITestFluidObject {
|
|
17
17
|
readonly runtime: IFluidDataStoreRuntime;
|
|
18
18
|
readonly channel: IFluidDataStoreChannel;
|
|
19
19
|
readonly context: IFluidDataStoreContext;
|
|
20
20
|
private readonly factoryEntriesMap;
|
|
21
|
-
static load(runtime: IFluidDataStoreRuntime, channel: IFluidDataStoreChannel, context: IFluidDataStoreContext, factoryEntries: Map<string, IChannelFactory>, existing: boolean): Promise<TestFluidObject>;
|
|
22
21
|
get ITestFluidObject(): this;
|
|
23
22
|
get IFluidLoadable(): this;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
25
|
+
*/
|
|
24
26
|
get IFluidRouter(): this;
|
|
25
27
|
get handle(): IFluidHandle<this>;
|
|
26
28
|
root: ISharedMap;
|
|
27
29
|
private readonly innerHandle;
|
|
30
|
+
private initializeP;
|
|
28
31
|
/**
|
|
29
32
|
* Creates a new TestFluidObject.
|
|
30
33
|
* @param runtime - The data store runtime.
|
|
@@ -38,8 +41,11 @@ export declare class TestFluidObject implements ITestFluidObject, IFluidRouter {
|
|
|
38
41
|
* @param id - The id of the shared object to retrieve.
|
|
39
42
|
*/
|
|
40
43
|
getSharedObject<T = any>(id: string): Promise<T>;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
46
|
+
*/
|
|
41
47
|
request(request: IRequest): Promise<IResponse>;
|
|
42
|
-
|
|
48
|
+
initialize(existing: boolean): Promise<void>;
|
|
43
49
|
}
|
|
44
50
|
export declare type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;
|
|
45
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testFluidObject.d.ts","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,QAAQ,EACR,SAAS,EACT,YAAY,
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,SAAS,CAAC;IAI9C,UAAU,CAAC,QAAQ,EAAE,OAAO;CA2BzC;AAED,oBAAY,sBAAsB,GAAG,QAAQ,CAAC,CAAC,MAAM,GAAG,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,sBAAuB,YAAW,sBAAsB;IAYnE,OAAO,CAAC,QAAQ,CAAC,cAAc;aACf,IAAI;IAZrB,IAAW,sBAAsB,SAEhC;IAED;;;;;OAKG;gBAEe,cAAc,EAAE,sBAAsB,EACvC,IAAI,SAA2B;IAGnC,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC;CAmDjC"}
|
package/dist/testFluidObject.js
CHANGED
|
@@ -29,17 +29,15 @@ class TestFluidObject {
|
|
|
29
29
|
this.factoryEntriesMap = factoryEntriesMap;
|
|
30
30
|
this.innerHandle = new datastore_1.FluidObjectHandle(this, "", runtime.objectsRoutingContext);
|
|
31
31
|
}
|
|
32
|
-
static async load(runtime, channel, context, factoryEntries, existing) {
|
|
33
|
-
const fluidObject = new TestFluidObject(runtime, channel, context, factoryEntries);
|
|
34
|
-
await fluidObject.initialize(existing);
|
|
35
|
-
return fluidObject;
|
|
36
|
-
}
|
|
37
32
|
get ITestFluidObject() {
|
|
38
33
|
return this;
|
|
39
34
|
}
|
|
40
35
|
get IFluidLoadable() {
|
|
41
36
|
return this;
|
|
42
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
40
|
+
*/
|
|
43
41
|
get IFluidRouter() {
|
|
44
42
|
return this;
|
|
45
43
|
}
|
|
@@ -57,24 +55,33 @@ class TestFluidObject {
|
|
|
57
55
|
for (const key of this.factoryEntriesMap.keys()) {
|
|
58
56
|
if (key === id) {
|
|
59
57
|
const handle = this.root.get(id);
|
|
60
|
-
return handle
|
|
58
|
+
return handle?.get();
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
61
|
throw new Error(`Shared object with id ${id} not found.`);
|
|
64
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
65
|
+
*/
|
|
65
66
|
async request(request) {
|
|
66
67
|
return (0, aqueduct_1.defaultFluidObjectRequestHandler)(this, request);
|
|
67
68
|
}
|
|
68
69
|
async initialize(existing) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
const doInitialization = async () => {
|
|
71
|
+
if (!existing) {
|
|
72
|
+
this.root = map_1.SharedMap.create(this.runtime, "root");
|
|
73
|
+
this.factoryEntriesMap.forEach((sharedObjectFactory, key) => {
|
|
74
|
+
const sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);
|
|
75
|
+
this.root.set(key, sharedObject.handle);
|
|
76
|
+
});
|
|
77
|
+
this.root.bindToContext();
|
|
78
|
+
}
|
|
79
|
+
this.root = (await this.runtime.getChannel("root"));
|
|
80
|
+
};
|
|
81
|
+
if (this.initializeP === undefined) {
|
|
82
|
+
this.initializeP = doInitialization();
|
|
76
83
|
}
|
|
77
|
-
|
|
84
|
+
return this.initializeP;
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
exports.TestFluidObject = TestFluidObject;
|
|
@@ -127,29 +134,33 @@ class TestFluidObjectFactory {
|
|
|
127
134
|
const sharedMapFactory = map_1.SharedMap.getFactory();
|
|
128
135
|
dataTypes.set(sharedMapFactory.type, sharedMapFactory);
|
|
129
136
|
// Add the object factories to the list to be sent to data store runtime.
|
|
130
|
-
for (const
|
|
131
|
-
const factory = entry[1];
|
|
137
|
+
for (const [, factory] of this.factoryEntries) {
|
|
132
138
|
dataTypes.set(factory.type, factory);
|
|
133
139
|
}
|
|
134
140
|
// Create a map from the factory entries with entries that don't have the id as undefined. This will be
|
|
135
141
|
// passed to the Fluid object.
|
|
136
142
|
const factoryEntriesMapForObject = new Map();
|
|
137
|
-
for (const
|
|
138
|
-
const id = entry[0];
|
|
143
|
+
for (const [id, factory] of this.factoryEntries) {
|
|
139
144
|
if (id !== undefined) {
|
|
140
|
-
factoryEntriesMapForObject.set(id,
|
|
145
|
+
factoryEntriesMapForObject.set(id, factory);
|
|
141
146
|
}
|
|
142
147
|
}
|
|
143
148
|
const runtimeClass = (0, datastore_1.mixinRequestHandler)(async (request, rt) => {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
(0, common_utils_1.assert)((maybeRouter === null || maybeRouter === void 0 ? void 0 : maybeRouter.IFluidRouter) !== undefined, "entryPoint should have been initialized by now");
|
|
149
|
+
const maybeRouter = await rt.entryPoint?.get();
|
|
150
|
+
(0, common_utils_1.assert)(maybeRouter?.IFluidRouter !== undefined, "entryPoint should have been initialized by now");
|
|
147
151
|
return maybeRouter.IFluidRouter.request(request);
|
|
148
152
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
const runtime = new runtimeClass(context, dataTypes, existing, async () => {
|
|
154
|
+
await instance.initialize(true);
|
|
155
|
+
return instance;
|
|
156
|
+
});
|
|
157
|
+
const instance = new TestFluidObject(runtime, // runtime
|
|
158
|
+
runtime, // channel
|
|
159
|
+
context, factoryEntriesMapForObject);
|
|
160
|
+
if (!existing) {
|
|
161
|
+
await instance.initialize(false);
|
|
162
|
+
}
|
|
163
|
+
return runtime;
|
|
153
164
|
}
|
|
154
165
|
}
|
|
155
166
|
exports.TestFluidObjectFactory = TestFluidObjectFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAA4E;AAS5E,yDAImC;AAC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E,CAClD,eAAe,CAAC,IAAI,CACnB,gBAAgB;QAChB,oGAAoG;QACpG,iGAAiG;QACjG,gBAAyC,EACzC,OAAO,EACP,0BAA0B,EAC1B,QAAQ,CACR,CACF,CAAC;IACH,CAAC;CACD;AAtED,wDAsEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultFluidObjectRequestHandler } from \"@fluidframework/aqueduct\";\nimport {\n\tIRequest,\n\tIResponse,\n\tIFluidHandle,\n\tIFluidRouter,\n\tFluidObject,\n\tIProvideFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidObjectHandle,\n\tFluidDataStoreRuntime,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore\";\nimport { SharedMap, ISharedMap } from \"@fluidframework/map\";\nimport {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime, IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ITestFluidObject } from \"./interfaces\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.\n * The shared objects can be retrieved by passing the key of the entry to getSharedObject.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n */\nexport class TestFluidObject implements ITestFluidObject, IFluidRouter {\n\tpublic static async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tchannel: IFluidDataStoreChannel,\n\t\tcontext: IFluidDataStoreContext,\n\t\tfactoryEntries: Map<string, IChannelFactory>,\n\t\texisting: boolean,\n\t) {\n\t\tconst fluidObject = new TestFluidObject(runtime, channel, context, factoryEntries);\n\t\tawait fluidObject.initialize(existing);\n\n\t\treturn fluidObject;\n\t}\n\n\tpublic get ITestFluidObject() {\n\t\treturn this;\n\t}\n\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\n\tpublic get handle(): IFluidHandle<this> {\n\t\treturn this.innerHandle;\n\t}\n\n\tpublic root!: ISharedMap;\n\tprivate readonly innerHandle: IFluidHandle<this>;\n\n\t/**\n\t * Creates a new TestFluidObject.\n\t * @param runtime - The data store runtime.\n\t * @param context - The data store context.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n\t * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n\t */\n\tconstructor(\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly channel: IFluidDataStoreChannel,\n\t\tpublic readonly context: IFluidDataStoreContext,\n\t\tprivate readonly factoryEntriesMap: Map<string, IChannelFactory>,\n\t) {\n\t\tthis.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n\t}\n\n\t/**\n\t * Retrieves a shared object with the given id.\n\t * @param id - The id of the shared object to retrieve.\n\t */\n\tpublic async getSharedObject<T = any>(id: string): Promise<T> {\n\t\tif (this.factoryEntriesMap === undefined) {\n\t\t\tthrow new Error(\"Shared objects were not provided during creation.\");\n\t\t}\n\n\t\tfor (const key of this.factoryEntriesMap.keys()) {\n\t\t\tif (key === id) {\n\t\t\t\tconst handle = this.root.get<IFluidHandle>(id);\n\t\t\t\treturn handle?.get() as unknown as T;\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(`Shared object with id ${id} not found.`);\n\t}\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn defaultFluidObjectRequestHandler(this, request);\n\t}\n\n\tprivate async initialize(existing: boolean) {\n\t\tif (!existing) {\n\t\t\tthis.root = SharedMap.create(this.runtime, \"root\");\n\n\t\t\tthis.factoryEntriesMap.forEach((sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\tconst sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\n\t\t\t\tthis.root.set(key, sharedObject.handle);\n\t\t\t});\n\n\t\t\tthis.root.bindToContext();\n\t\t}\n\n\t\tthis.root = (await this.runtime.getChannel(\"root\")) as ISharedMap;\n\t}\n}\n\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime\n * with the object factories in the entry list. All the entries with an id other than undefined are passed to the\n * Fluid object so that it can create a shared object for each.\n *\n * @example\n * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.\n * It will add SparseMatrix to the data store's factory so that it can be created later.\n *\n * ```typescript\n * new TestFluidObjectFactory([\n * [ \"sharedString\", SharedString.getFactory() ],\n * [ \"sharedDirectory\", SharedDirectory.getFactory() ],\n * [ undefined, SparseMatrix.getFactory() ],\n * ]);\n * ```\n *\n * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:\n *\n * ```typescript\n * sharedString = testFluidObject.getSharedObject<SharedString>(\"sharedString\");\n * sharedDir = testFluidObject.getSharedObject<SharedDirectory>(\"sharedDirectory\");\n * ```\n *\n * @privateRemarks - Beware that using this class generally forfeits some compatibility coverage\n * `describeCompat` aims to provide:\n * `SharedMap`s always reference the current version of SharedMap.\n * AB#4670 tracks improving this situation.\n */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates a new TestFluidObjectFactory.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n\t * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n\t * for it.\n\t */\n\tconstructor(\n\t\tprivate readonly factoryEntries: ChannelFactoryRegistry,\n\t\tpublic readonly type = \"TestFluidObjectFactory\",\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\tconst dataTypes = new Map<string, IChannelFactory>();\n\n\t\t// Add SharedMap's factory which will be used to create the root map.\n\t\tconst sharedMapFactory = SharedMap.getFactory();\n\t\tdataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n\t\t// Add the object factories to the list to be sent to data store runtime.\n\t\tfor (const entry of this.factoryEntries) {\n\t\t\tconst factory = entry[1];\n\t\t\tdataTypes.set(factory.type, factory);\n\t\t}\n\n\t\t// Create a map from the factory entries with entries that don't have the id as undefined. This will be\n\t\t// passed to the Fluid object.\n\t\tconst factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n\t\tfor (const entry of this.factoryEntries) {\n\t\t\tconst id = entry[0];\n\t\t\tif (id !== undefined) {\n\t\t\t\tfactoryEntriesMapForObject.set(id, entry[1]);\n\t\t\t}\n\t\t}\n\n\t\tconst runtimeClass = mixinRequestHandler(\n\t\t\tasync (request: IRequest, rt: FluidDataStoreRuntime) => {\n\t\t\t\tconst maybeRouter: FluidObject<IProvideFluidRouter> | undefined =\n\t\t\t\t\tawait rt.entryPoint?.get();\n\t\t\t\tassert(\n\t\t\t\t\tmaybeRouter?.IFluidRouter !== undefined,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn maybeRouter.IFluidRouter.request(request);\n\t\t\t},\n\t\t);\n\n\t\treturn new runtimeClass(\n\t\t\tcontext,\n\t\t\tdataTypes,\n\t\t\texisting,\n\t\t\tasync (dataStoreRuntime: IFluidDataStoreRuntime) =>\n\t\t\t\tTestFluidObject.load(\n\t\t\t\t\tdataStoreRuntime,\n\t\t\t\t\t// This works because 'runtime' is an instance of runtimeClass (which is a FluidDataStoreRuntime and\n\t\t\t\t\t// thus implements IFluidDataStoreChannel) which passes itself as the parameter to this function.\n\t\t\t\t\tdataStoreRuntime as FluidDataStoreRuntime,\n\t\t\t\t\tcontext,\n\t\t\t\t\tfactoryEntriesMapForObject,\n\t\t\t\t\texisting,\n\t\t\t\t),\n\t\t);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.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E,UAAU;QACnB,OAAO,EAAE,UAAU;QACnB,OAAO,EACP,0BAA0B,CAC1B,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE;YACd,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SACjC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAtED,wDAsEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultFluidObjectRequestHandler } from \"@fluidframework/aqueduct\";\nimport {\n\tIRequest,\n\tIResponse,\n\tIFluidHandle,\n\tFluidObject,\n\tIProvideFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidObjectHandle,\n\tFluidDataStoreRuntime,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore\";\nimport { SharedMap, ISharedMap } from \"@fluidframework/map\";\nimport {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime, IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ITestFluidObject } from \"./interfaces\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.\n * The shared objects can be retrieved by passing the key of the entry to getSharedObject.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n */\nexport class TestFluidObject implements ITestFluidObject {\n\tpublic get ITestFluidObject() {\n\t\treturn this;\n\t}\n\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\n\tpublic get handle(): IFluidHandle<this> {\n\t\treturn this.innerHandle;\n\t}\n\n\tpublic root!: ISharedMap;\n\tprivate readonly innerHandle: IFluidHandle<this>;\n\tprivate initializeP: Promise<void> | undefined;\n\n\t/**\n\t * Creates a new TestFluidObject.\n\t * @param runtime - The data store runtime.\n\t * @param context - The data store context.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n\t * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n\t */\n\tconstructor(\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly channel: IFluidDataStoreChannel,\n\t\tpublic readonly context: IFluidDataStoreContext,\n\t\tprivate readonly factoryEntriesMap: Map<string, IChannelFactory>,\n\t) {\n\t\tthis.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n\t}\n\n\t/**\n\t * Retrieves a shared object with the given id.\n\t * @param id - The id of the shared object to retrieve.\n\t */\n\tpublic async getSharedObject<T = any>(id: string): Promise<T> {\n\t\tif (this.factoryEntriesMap === undefined) {\n\t\t\tthrow new Error(\"Shared objects were not provided during creation.\");\n\t\t}\n\n\t\tfor (const key of this.factoryEntriesMap.keys()) {\n\t\t\tif (key === id) {\n\t\t\t\tconst handle = this.root.get<IFluidHandle>(id);\n\t\t\t\treturn handle?.get() as unknown as T;\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(`Shared object with id ${id} not found.`);\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn defaultFluidObjectRequestHandler(this, request);\n\t}\n\n\tpublic async initialize(existing: boolean) {\n\t\tconst doInitialization = async () => {\n\t\t\tif (!existing) {\n\t\t\t\tthis.root = SharedMap.create(this.runtime, \"root\");\n\n\t\t\t\tthis.factoryEntriesMap.forEach(\n\t\t\t\t\t(sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\t\t\tconst sharedObject = this.runtime.createChannel(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tsharedObjectFactory.type,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.root.set(key, sharedObject.handle);\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tthis.root.bindToContext();\n\t\t\t}\n\n\t\t\tthis.root = (await this.runtime.getChannel(\"root\")) as ISharedMap;\n\t\t};\n\n\t\tif (this.initializeP === undefined) {\n\t\t\tthis.initializeP = doInitialization();\n\t\t}\n\n\t\treturn this.initializeP;\n\t}\n}\n\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime\n * with the object factories in the entry list. All the entries with an id other than undefined are passed to the\n * Fluid object so that it can create a shared object for each.\n *\n * @example\n * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.\n * It will add SparseMatrix to the data store's factory so that it can be created later.\n *\n * ```typescript\n * new TestFluidObjectFactory([\n * [ \"sharedString\", SharedString.getFactory() ],\n * [ \"sharedDirectory\", SharedDirectory.getFactory() ],\n * [ undefined, SparseMatrix.getFactory() ],\n * ]);\n * ```\n *\n * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:\n *\n * ```typescript\n * sharedString = testFluidObject.getSharedObject<SharedString>(\"sharedString\");\n * sharedDir = testFluidObject.getSharedObject<SharedDirectory>(\"sharedDirectory\");\n * ```\n *\n * @privateRemarks - Beware that using this class generally forfeits some compatibility coverage\n * `describeCompat` aims to provide:\n * `SharedMap`s always reference the current version of SharedMap.\n * AB#4670 tracks improving this situation.\n */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates a new TestFluidObjectFactory.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n\t * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n\t * for it.\n\t */\n\tconstructor(\n\t\tprivate readonly factoryEntries: ChannelFactoryRegistry,\n\t\tpublic readonly type = \"TestFluidObjectFactory\",\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\tconst dataTypes = new Map<string, IChannelFactory>();\n\n\t\t// Add SharedMap's factory which will be used to create the root map.\n\t\tconst sharedMapFactory = SharedMap.getFactory();\n\t\tdataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n\t\t// Add the object factories to the list to be sent to data store runtime.\n\t\tfor (const [, factory] of this.factoryEntries) {\n\t\t\tdataTypes.set(factory.type, factory);\n\t\t}\n\n\t\t// Create a map from the factory entries with entries that don't have the id as undefined. This will be\n\t\t// passed to the Fluid object.\n\t\tconst factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n\t\tfor (const [id, factory] of this.factoryEntries) {\n\t\t\tif (id !== undefined) {\n\t\t\t\tfactoryEntriesMapForObject.set(id, factory);\n\t\t\t}\n\t\t}\n\n\t\tconst runtimeClass = mixinRequestHandler(\n\t\t\tasync (request: IRequest, rt: FluidDataStoreRuntime) => {\n\t\t\t\tconst maybeRouter: FluidObject<IProvideFluidRouter> | undefined =\n\t\t\t\t\tawait rt.entryPoint?.get();\n\t\t\t\tassert(\n\t\t\t\t\tmaybeRouter?.IFluidRouter !== undefined,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn maybeRouter.IFluidRouter.request(request);\n\t\t\t},\n\t\t);\n\n\t\tconst runtime = new runtimeClass(context, dataTypes, existing, async () => {\n\t\t\tawait instance.initialize(true);\n\t\t\treturn instance;\n\t\t});\n\n\t\tconst instance: TestFluidObject = new TestFluidObject(\n\t\t\truntime, // runtime\n\t\t\truntime, // channel\n\t\t\tcontext,\n\t\t\tfactoryEntriesMapForObject,\n\t\t);\n\n\t\tif (!existing) {\n\t\t\tawait instance.initialize(false);\n\t\t}\n\n\t\treturn runtime;\n\t}\n}\n"]}
|
|
@@ -8,7 +8,6 @@ import { IContainerRuntimeOptions } from "@fluidframework/container-runtime";
|
|
|
8
8
|
import { ITelemetryGenericEvent, ITelemetryBaseLogger, ITelemetryBaseEvent, IRequestHeader } from "@fluidframework/core-interfaces";
|
|
9
9
|
import { IDocumentServiceFactory, IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
10
10
|
import { ITestDriver } from "@fluidframework/test-driver-definitions";
|
|
11
|
-
import { TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
12
11
|
import { fluidEntryPoint } from "./localCodeLoader";
|
|
13
12
|
import { ChannelFactoryRegistry } from "./testFluidObject";
|
|
14
13
|
export interface IOpProcessingController {
|
|
@@ -69,7 +68,7 @@ export declare const createDocumentId: () => string;
|
|
|
69
68
|
* At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
|
|
70
69
|
* any expected events that have not occurred.
|
|
71
70
|
*/
|
|
72
|
-
export declare class EventAndErrorTrackingLogger
|
|
71
|
+
export declare class EventAndErrorTrackingLogger implements ITelemetryBaseLogger {
|
|
73
72
|
private readonly baseLogger;
|
|
74
73
|
/**
|
|
75
74
|
* Even if these error events are logged, tests should still be allowed to pass
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testObjectProvider.d.ts","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,WAAW,EACX,iBAAiB,EAGjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,YAAY,EACZ,MAAM,EAEN,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EACN,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAA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8 @@ function getDocumentIdStrategy(type) {
|
|
|
42
42
|
return {
|
|
43
43
|
get: () => documentId,
|
|
44
44
|
update: (resolvedUrl) => {
|
|
45
|
-
var _a;
|
|
46
45
|
// Extract the document ID from the resolved container's URL and reset the ID property
|
|
47
|
-
documentId =
|
|
46
|
+
documentId = resolvedUrl?.id ?? documentId;
|
|
48
47
|
},
|
|
49
48
|
reset: () => {
|
|
50
49
|
documentId = (0, exports.createDocumentId)();
|
|
@@ -58,9 +57,8 @@ function getDocumentIdStrategy(type) {
|
|
|
58
57
|
* At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
|
|
59
58
|
* any expected events that have not occurred.
|
|
60
59
|
*/
|
|
61
|
-
class EventAndErrorTrackingLogger
|
|
60
|
+
class EventAndErrorTrackingLogger {
|
|
62
61
|
constructor(baseLogger) {
|
|
63
|
-
super();
|
|
64
62
|
this.baseLogger = baseLogger;
|
|
65
63
|
/**
|
|
66
64
|
* Even if these error events are logged, tests should still be allowed to pass
|
|
@@ -88,9 +86,8 @@ class EventAndErrorTrackingLogger extends telemetry_utils_1.TelemetryLogger {
|
|
|
88
86
|
this.expectedEvents.push(...orderedExpectedEvents.map((event, index) => ({ index, event })));
|
|
89
87
|
}
|
|
90
88
|
send(event) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if ((ee === null || ee === void 0 ? void 0 : ee.eventName) === event.eventName) {
|
|
89
|
+
const ee = this.expectedEvents[0]?.event;
|
|
90
|
+
if (ee?.eventName === event.eventName) {
|
|
94
91
|
let matches = true;
|
|
95
92
|
for (const key of Object.keys(ee)) {
|
|
96
93
|
if (ee[key] !== event[key]) {
|
|
@@ -152,12 +149,15 @@ class TestObjectProvider {
|
|
|
152
149
|
}
|
|
153
150
|
get logger() {
|
|
154
151
|
if (this._logger === undefined) {
|
|
155
|
-
this._logger = new EventAndErrorTrackingLogger(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
this._logger = new EventAndErrorTrackingLogger((0, telemetry_utils_1.createChildLogger)({
|
|
153
|
+
logger: getTestLogger?.(),
|
|
154
|
+
properties: {
|
|
155
|
+
all: {
|
|
156
|
+
driverType: this.driver.type,
|
|
157
|
+
driverEndpointName: this.driver.endpointName,
|
|
158
|
+
driverTenantName: this.driver.tenantName,
|
|
159
|
+
driverUserIndex: this.driver.userIndex,
|
|
160
|
+
},
|
|
161
161
|
},
|
|
162
162
|
}));
|
|
163
163
|
}
|
|
@@ -196,13 +196,16 @@ class TestObjectProvider {
|
|
|
196
196
|
* @param packageEntries - list of code details and fluidEntryPoint pairs.
|
|
197
197
|
*/
|
|
198
198
|
createLoader(packageEntries, loaderProps) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
199
|
+
const logger = (0, telemetry_utils_1.createMultiSinkLogger)({
|
|
200
|
+
loggers: [this.logger, loaderProps?.logger],
|
|
201
|
+
});
|
|
202
|
+
const loader = new this.LoaderConstructor({
|
|
203
|
+
...loaderProps,
|
|
204
|
+
logger,
|
|
205
|
+
codeLoader: loaderProps?.codeLoader ?? new localCodeLoader_1.LocalCodeLoader(packageEntries),
|
|
206
|
+
urlResolver: loaderProps?.urlResolver ?? this.urlResolver,
|
|
207
|
+
documentServiceFactory: loaderProps?.documentServiceFactory ?? this.documentServiceFactory,
|
|
208
|
+
});
|
|
206
209
|
this._loaderContainerTracker.add(loader);
|
|
207
210
|
return loader;
|
|
208
211
|
}
|
|
@@ -237,7 +240,11 @@ class TestObjectProvider {
|
|
|
237
240
|
const delayConnection = delay &&
|
|
238
241
|
(requestHeader === undefined || requestHeader[container_definitions_1.LoaderHeader.reconnect] !== false);
|
|
239
242
|
const headers = delayConnection
|
|
240
|
-
?
|
|
243
|
+
? {
|
|
244
|
+
[container_definitions_1.LoaderHeader.loadMode]: { deltaConnection: "delayed" },
|
|
245
|
+
...requestHeader,
|
|
246
|
+
}
|
|
247
|
+
: requestHeader;
|
|
241
248
|
const container = await loader.resolve({
|
|
242
249
|
url: await this.driver.createContainerUrl(this.documentId),
|
|
243
250
|
headers,
|
|
@@ -263,7 +270,7 @@ class TestObjectProvider {
|
|
|
263
270
|
* @param testContainerConfig - optional configuring the test Container
|
|
264
271
|
*/
|
|
265
272
|
makeTestLoader(testContainerConfig) {
|
|
266
|
-
return this.createLoader([[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]], testContainerConfig
|
|
273
|
+
return this.createLoader([[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]], testContainerConfig?.loaderProps);
|
|
267
274
|
}
|
|
268
275
|
/**
|
|
269
276
|
* Make a container using a default document id and code details
|
|
@@ -290,7 +297,7 @@ class TestObjectProvider {
|
|
|
290
297
|
*/
|
|
291
298
|
async loadTestContainer(testContainerConfig, requestHeader) {
|
|
292
299
|
const loader = this.makeTestLoader(testContainerConfig);
|
|
293
|
-
const container = await this.resolveContainer(loader, requestHeader, testContainerConfig
|
|
300
|
+
const container = await this.resolveContainer(loader, requestHeader, testContainerConfig?.simulateReadConnectionUsingDelay);
|
|
294
301
|
await this.waitContainerToCatchUp(container);
|
|
295
302
|
return container;
|
|
296
303
|
}
|
|
@@ -334,10 +341,10 @@ function getUnexpectedLogErrorException(logger, prefix) {
|
|
|
334
341
|
}
|
|
335
342
|
const results = logger.reportAndClearTrackedEvents();
|
|
336
343
|
if (results.unexpectedErrors.length > 0) {
|
|
337
|
-
return new Error(`${prefix
|
|
344
|
+
return new Error(`${prefix ?? ""}Unexpected Errors in Logs:\n${JSON.stringify(results.unexpectedErrors, undefined, 2)}`);
|
|
338
345
|
}
|
|
339
346
|
if (results.expectedNotFound.length > 0) {
|
|
340
|
-
return new Error(`${prefix
|
|
347
|
+
return new Error(`${prefix ?? ""}Expected Events not found:\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);
|
|
341
348
|
}
|
|
342
349
|
}
|
|
343
350
|
exports.getUnexpectedLogErrorException = getUnexpectedLogErrorException;
|