@fluidframework/test-utils 2.31.1 → 2.33.0-333010
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/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.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/testFluidObject.d.ts +23 -10
- package/dist/testFluidObject.d.ts.map +1 -1
- package/dist/testFluidObject.js +22 -19
- package/dist/testFluidObject.js.map +1 -1
- package/dist/testFluidObjectInternal.d.ts +50 -0
- package/dist/testFluidObjectInternal.d.ts.map +1 -0
- package/dist/testFluidObjectInternal.js +78 -0
- package/dist/testFluidObjectInternal.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.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/testFluidObject.d.ts +23 -10
- package/lib/testFluidObject.d.ts.map +1 -1
- package/lib/testFluidObject.js +22 -19
- package/lib/testFluidObject.js.map +1 -1
- package/lib/testFluidObjectInternal.d.ts +50 -0
- package/lib/testFluidObjectInternal.d.ts.map +1 -0
- package/lib/testFluidObjectInternal.js +74 -0
- package/lib/testFluidObjectInternal.js.map +1 -0
- package/package.json +24 -23
- package/src/index.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/testFluidObject.ts +61 -28
- package/src/testFluidObjectInternal.ts +110 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,11 @@ export { createAndAttachContainer, createLoader, createLoaderProps, createAndAtt
|
|
|
9
9
|
export { retryWithEventualValue } from "./retry.js";
|
|
10
10
|
export { createTestConfigProvider, ITestConfigProvider } from "./TestConfigs.js";
|
|
11
11
|
export { createTestContainerRuntimeFactory, TestContainerRuntimeFactory, } from "./testContainerRuntimeFactory.js";
|
|
12
|
-
export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory, } from "./testFluidObject.js";
|
|
12
|
+
export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory, TestDataObjectKind, } from "./testFluidObject.js";
|
|
13
13
|
export { createDocumentId, DataObjectFactoryType, EventAndErrorTrackingLogger, type IEventAndErrorTrackingLogger, getUnexpectedLogErrorException, IDocumentIdStrategy, IOpProcessingController, ITestContainerConfig, ITestObjectProvider, TestObjectProvider, TestObjectProviderWithVersionedLoad, } from "./testObjectProvider.js";
|
|
14
14
|
export { createSummarizer, createSummarizerCore, createSummarizerFromFactory, summarizeNow, SummaryInfo, } from "./TestSummaryUtils.js";
|
|
15
15
|
export { timeoutAwait, timeoutPromise, type TimeoutDurationOption, type TimeoutWithError, type TimeoutWithValue, } from "./timeoutUtils.js";
|
|
16
16
|
export { toIDeltaManagerFull, waitForContainerConnection, getContainerEntryPointBackCompat, getDataStoreEntryPointBackCompat, } from "./containerUtils.js";
|
|
17
17
|
export { type ContainerRuntimeFactoryWithDefaultDataStoreConstructor, type ContainerRuntimeFactoryWithDefaultDataStoreProps, createContainerRuntimeFactoryWithDefaultDataStore, } from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
|
|
18
|
+
export { TestFluidObjectInternal } from "./testFluidObjectInternal.js";
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA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kB,EAClB,mCAAmC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,YAAY,EACZ,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,sDAAsD,EAC3D,KAAK,gDAAgD,EACrD,iDAAiD,GACjD,MAAM,sDAAsD,CAAC;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.toIDeltaManagerFull = exports.timeoutPromise = exports.timeoutAwait = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizerCore = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = exports.DataObjectFactoryType = exports.createDocumentId = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.createTestConfigProvider = exports.retryWithEventualValue = exports.createAndAttachContainerUsingProps = exports.createLoaderProps = exports.createLoader = exports.createAndAttachContainer = exports.LocalCodeLoader = exports.LoaderContainerTracker = void 0;
|
|
7
|
+
exports.TestFluidObjectInternal = exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.toIDeltaManagerFull = exports.timeoutPromise = exports.timeoutAwait = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizerCore = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = exports.DataObjectFactoryType = exports.createDocumentId = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.createTestConfigProvider = exports.retryWithEventualValue = exports.createAndAttachContainerUsingProps = exports.createLoaderProps = exports.createLoader = exports.createAndAttachContainer = exports.LocalCodeLoader = exports.LoaderContainerTracker = void 0;
|
|
8
8
|
var loaderContainerTracker_js_1 = require("./loaderContainerTracker.js");
|
|
9
9
|
Object.defineProperty(exports, "LoaderContainerTracker", { enumerable: true, get: function () { return loaderContainerTracker_js_1.LoaderContainerTracker; } });
|
|
10
10
|
var localCodeLoader_js_1 = require("./localCodeLoader.js");
|
|
@@ -46,4 +46,6 @@ Object.defineProperty(exports, "getContainerEntryPointBackCompat", { enumerable:
|
|
|
46
46
|
Object.defineProperty(exports, "getDataStoreEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_js_1.getDataStoreEntryPointBackCompat; } });
|
|
47
47
|
var testContainerRuntimeFactoryWithDefaultDataStore_js_1 = require("./testContainerRuntimeFactoryWithDefaultDataStore.js");
|
|
48
48
|
Object.defineProperty(exports, "createContainerRuntimeFactoryWithDefaultDataStore", { enumerable: true, get: function () { return testContainerRuntimeFactoryWithDefaultDataStore_js_1.createContainerRuntimeFactoryWithDefaultDataStore; } });
|
|
49
|
+
var testFluidObjectInternal_js_1 = require("./testFluidObjectInternal.js");
|
|
50
|
+
Object.defineProperty(exports, "TestFluidObjectInternal", { enumerable: true, get: function () { return testFluidObjectInternal_js_1.TestFluidObjectInternal; } });
|
|
49
51
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,2DAI8B;AAF7B,qHAAA,eAAe,OAAA;AAGhB,mDAK0B;AAJzB,0HAAA,wBAAwB,OAAA;AACxB,8GAAA,YAAY,OAAA;AACZ,mHAAA,iBAAiB,OAAA;AACjB,oIAAA,kCAAkC,OAAA;AAEnC,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAC/B,mDAAiF;AAAxE,0HAAA,wBAAwB,OAAA;AACjC,mFAG0C;AAFzC,mJAAA,iCAAiC,OAAA;AACjC,6IAAA,2BAA2B,OAAA;AAE5B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,2DAI8B;AAF7B,qHAAA,eAAe,OAAA;AAGhB,mDAK0B;AAJzB,0HAAA,wBAAwB,OAAA;AACxB,8GAAA,YAAY,OAAA;AACZ,mHAAA,iBAAiB,OAAA;AACjB,oIAAA,kCAAkC,OAAA;AAEnC,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAC/B,mDAAiF;AAAxE,0HAAA,wBAAwB,OAAA;AACjC,mFAG0C;AAFzC,mJAAA,iCAAiC,OAAA;AACjC,6IAAA,2BAA2B,OAAA;AAE5B,2DAK8B;AAH7B,qHAAA,eAAe,OAAA;AACf,4HAAA,sBAAsB,OAAA;AAGvB,iEAYiC;AAXhC,yHAAA,gBAAgB,OAAA;AAChB,8HAAA,qBAAqB,OAAA;AACrB,oIAAA,2BAA2B,OAAA;AAE3B,uIAAA,8BAA8B,OAAA;AAK9B,2HAAA,kBAAkB,OAAA;AAClB,4IAAA,mCAAmC,OAAA;AAEpC,6DAM+B;AAL9B,uHAAA,gBAAgB,OAAA;AAChB,2HAAA,oBAAoB,OAAA;AACpB,kIAAA,2BAA2B,OAAA;AAC3B,mHAAA,YAAY,OAAA;AAGb,qDAM2B;AAL1B,+GAAA,YAAY,OAAA;AACZ,iHAAA,cAAc,OAAA;AAKf,yDAK6B;AAJ5B,wHAAA,mBAAmB,OAAA;AACnB,+HAAA,0BAA0B,OAAA;AAC1B,qIAAA,gCAAgC,OAAA;AAChC,qIAAA,gCAAgC,OAAA;AAEjC,2HAI8D;AAD7D,uLAAA,iDAAiD,OAAA;AAGlD,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces.js\";\nexport { LoaderContainerTracker } from \"./loaderContainerTracker.js\";\nexport {\n\tfluidEntryPoint,\n\tLocalCodeLoader,\n\tSupportedExportInterfaces,\n} from \"./localCodeLoader.js\";\nexport {\n\tcreateAndAttachContainer,\n\tcreateLoader,\n\tcreateLoaderProps,\n\tcreateAndAttachContainerUsingProps,\n} from \"./localLoader.js\";\nexport { retryWithEventualValue } from \"./retry.js\";\nexport { createTestConfigProvider, ITestConfigProvider } from \"./TestConfigs.js\";\nexport {\n\tcreateTestContainerRuntimeFactory,\n\tTestContainerRuntimeFactory,\n} from \"./testContainerRuntimeFactory.js\";\nexport {\n\tChannelFactoryRegistry,\n\tTestFluidObject,\n\tTestFluidObjectFactory,\n\tTestDataObjectKind,\n} from \"./testFluidObject.js\";\nexport {\n\tcreateDocumentId,\n\tDataObjectFactoryType,\n\tEventAndErrorTrackingLogger,\n\ttype IEventAndErrorTrackingLogger,\n\tgetUnexpectedLogErrorException,\n\tIDocumentIdStrategy,\n\tIOpProcessingController,\n\tITestContainerConfig,\n\tITestObjectProvider,\n\tTestObjectProvider,\n\tTestObjectProviderWithVersionedLoad,\n} from \"./testObjectProvider.js\";\nexport {\n\tcreateSummarizer,\n\tcreateSummarizerCore,\n\tcreateSummarizerFromFactory,\n\tsummarizeNow,\n\tSummaryInfo,\n} from \"./TestSummaryUtils.js\";\nexport {\n\ttimeoutAwait,\n\ttimeoutPromise,\n\ttype TimeoutDurationOption,\n\ttype TimeoutWithError,\n\ttype TimeoutWithValue,\n} from \"./timeoutUtils.js\";\nexport {\n\ttoIDeltaManagerFull,\n\twaitForContainerConnection,\n\tgetContainerEntryPointBackCompat,\n\tgetDataStoreEntryPointBackCompat,\n} from \"./containerUtils.js\";\nexport {\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreConstructor,\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreProps,\n\tcreateContainerRuntimeFactoryWithDefaultDataStore,\n} from \"./testContainerRuntimeFactoryWithDefaultDataStore.js\";\n\nexport { TestFluidObjectInternal } from \"./testFluidObjectInternal.js\";\n"]}
|
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.
|
|
8
|
+
export declare const pkgVersion = "2.33.0-333010";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
|
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.
|
|
11
|
+
exports.pkgVersion = "2.33.0-333010";
|
|
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,
|
|
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,eAAe,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.33.0-333010\";\n"]}
|
|
@@ -2,37 +2,41 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IFluidHandle, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
5
|
+
import { IFluidHandle, IRequest, IResponse, type IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
|
|
7
7
|
import { IChannelFactory, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
|
|
8
8
|
import { ISharedMap } from "@fluidframework/map/internal";
|
|
9
9
|
import { IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreFactory } from "@fluidframework/runtime-definitions/internal";
|
|
10
|
+
import type { ISharedObject } from "@fluidframework/shared-object-base/internal";
|
|
10
11
|
import { ITestFluidObject } from "./interfaces.js";
|
|
11
12
|
/**
|
|
12
|
-
* A test Fluid object that will create a shared object for each key-value pair in the
|
|
13
|
+
* A test Fluid object that will create a shared object for each key-value pair in the initialSharedObjectsFactories passed to load.
|
|
13
14
|
* The shared objects can be retrieved by passing the key of the entry to getSharedObject.
|
|
14
15
|
* It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
|
|
16
|
+
* @privateRemarks
|
|
17
|
+
* TODO:
|
|
18
|
+
* Usage of this outside this repo (via ITestFluidObject) should probably be phased out.
|
|
19
|
+
* Once thats done, ITestFluidObject can be made internal and this class can be replaced with the simplified TestFluidObjectInternal.
|
|
15
20
|
* @internal
|
|
16
21
|
*/
|
|
17
22
|
export declare class TestFluidObject implements ITestFluidObject {
|
|
18
23
|
readonly runtime: IFluidDataStoreRuntime;
|
|
19
24
|
readonly channel: IFluidDataStoreChannel;
|
|
20
25
|
readonly context: IFluidDataStoreContext;
|
|
21
|
-
private readonly
|
|
26
|
+
private readonly initialSharedObjectsFactories;
|
|
22
27
|
get ITestFluidObject(): this;
|
|
23
28
|
get IFluidLoadable(): this;
|
|
24
|
-
|
|
29
|
+
readonly handle: IFluidHandle<this>;
|
|
25
30
|
root: ISharedMap;
|
|
26
|
-
private readonly innerHandle;
|
|
27
31
|
private initializationPromise;
|
|
28
32
|
/**
|
|
29
33
|
* Creates a new TestFluidObject.
|
|
30
34
|
* @param runtime - The data store runtime.
|
|
31
35
|
* @param context - The data store context.
|
|
32
|
-
* @param
|
|
36
|
+
* @param initialSharedObjectsFactories - A list of id to IChannelFactory mapping. For each item in the list,
|
|
33
37
|
* a shared object is created which can be retrieved by calling getSharedObject() with the id;
|
|
34
38
|
*/
|
|
35
|
-
constructor(runtime: IFluidDataStoreRuntime, channel: IFluidDataStoreChannel, context: IFluidDataStoreContext,
|
|
39
|
+
constructor(runtime: IFluidDataStoreRuntime, channel: IFluidDataStoreChannel, context: IFluidDataStoreContext, initialSharedObjectsFactories: ReadonlyMap<string, IChannelFactory<ISharedObject>>);
|
|
36
40
|
/**
|
|
37
41
|
* Retrieves a shared object with the given id.
|
|
38
42
|
* @param id - The id of the shared object to retrieve.
|
|
@@ -46,6 +50,14 @@ export declare class TestFluidObject implements ITestFluidObject {
|
|
|
46
50
|
* @internal
|
|
47
51
|
*/
|
|
48
52
|
export type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;
|
|
53
|
+
/**
|
|
54
|
+
* Kind of test data object which {@link TestFluidObjectFactory} can create.
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export type TestDataObjectKind = new (runtime: IFluidDataStoreRuntime, channel: IFluidDataStoreChannel, context: IFluidDataStoreContext, initialSharedObjectsFactories: ReadonlyMap<string, IChannelFactory<ISharedObject>>) => IFluidLoadable & {
|
|
58
|
+
request(request: IRequest): Promise<IResponse>;
|
|
59
|
+
initialize(existing: boolean): Promise<void>;
|
|
60
|
+
};
|
|
49
61
|
/**
|
|
50
62
|
* Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime
|
|
51
63
|
* with the object factories in the entry list. All the entries with an id other than undefined are passed to the
|
|
@@ -78,16 +90,17 @@ export type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFacto
|
|
|
78
90
|
* @internal
|
|
79
91
|
*/
|
|
80
92
|
export declare class TestFluidObjectFactory implements IFluidDataStoreFactory {
|
|
81
|
-
private readonly
|
|
93
|
+
private readonly initialSharedObjectsFactories;
|
|
82
94
|
readonly type: string;
|
|
95
|
+
private readonly dataObjectKind;
|
|
83
96
|
get IFluidDataStoreFactory(): this;
|
|
84
97
|
/**
|
|
85
98
|
* Creates a new TestFluidObjectFactory.
|
|
86
|
-
* @param
|
|
99
|
+
* @param initialSharedObjectsFactories - A list of id to IChannelFactory mapping. It creates a data store runtime with each
|
|
87
100
|
* IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object
|
|
88
101
|
* for it.
|
|
89
102
|
*/
|
|
90
|
-
constructor(
|
|
103
|
+
constructor(initialSharedObjectsFactories: ChannelFactoryRegistry, type?: string, dataObjectKind?: TestDataObjectKind);
|
|
91
104
|
instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
|
|
92
105
|
}
|
|
93
106
|
//# sourceMappingURL=testFluidObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testFluidObject.d.ts","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"testFluidObject.d.ts","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,KAAK,cAAc,EACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACN,qBAAqB,EAGrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,UAAU,EAAa,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;;;;GASG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;aAsBtC,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,6BAA6B;IAxB/C,IAAW,gBAAgB,SAE1B;IAED,IAAW,cAAc,SAExB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G;gBAEe,6BAA6B,EAAE,sBAAsB,EACtD,IAAI,SAA2B,EAC9B,cAAc,GAAE,kBAAoC;IAGzD,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC;CAyDjC"}
|
package/dist/testFluidObject.js
CHANGED
|
@@ -10,9 +10,13 @@ const internal_2 = require("@fluidframework/datastore/internal");
|
|
|
10
10
|
const internal_3 = require("@fluidframework/map/internal");
|
|
11
11
|
const internal_4 = require("@fluidframework/runtime-utils/internal");
|
|
12
12
|
/**
|
|
13
|
-
* A test Fluid object that will create a shared object for each key-value pair in the
|
|
13
|
+
* A test Fluid object that will create a shared object for each key-value pair in the initialSharedObjectsFactories passed to load.
|
|
14
14
|
* The shared objects can be retrieved by passing the key of the entry to getSharedObject.
|
|
15
15
|
* It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
|
|
16
|
+
* @privateRemarks
|
|
17
|
+
* TODO:
|
|
18
|
+
* Usage of this outside this repo (via ITestFluidObject) should probably be phased out.
|
|
19
|
+
* Once thats done, ITestFluidObject can be made internal and this class can be replaced with the simplified TestFluidObjectInternal.
|
|
16
20
|
* @internal
|
|
17
21
|
*/
|
|
18
22
|
class TestFluidObject {
|
|
@@ -22,35 +26,32 @@ class TestFluidObject {
|
|
|
22
26
|
get IFluidLoadable() {
|
|
23
27
|
return this;
|
|
24
28
|
}
|
|
25
|
-
get handle() {
|
|
26
|
-
return this.innerHandle;
|
|
27
|
-
}
|
|
28
29
|
/**
|
|
29
30
|
* Creates a new TestFluidObject.
|
|
30
31
|
* @param runtime - The data store runtime.
|
|
31
32
|
* @param context - The data store context.
|
|
32
|
-
* @param
|
|
33
|
+
* @param initialSharedObjectsFactories - A list of id to IChannelFactory mapping. For each item in the list,
|
|
33
34
|
* a shared object is created which can be retrieved by calling getSharedObject() with the id;
|
|
34
35
|
*/
|
|
35
|
-
constructor(runtime, channel, context,
|
|
36
|
+
constructor(runtime, channel, context, initialSharedObjectsFactories) {
|
|
36
37
|
this.runtime = runtime;
|
|
37
38
|
this.channel = channel;
|
|
38
39
|
this.context = context;
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
40
|
+
this.initialSharedObjectsFactories = initialSharedObjectsFactories;
|
|
41
|
+
this.handle = new internal_2.FluidObjectHandle(this, "", runtime.objectsRoutingContext);
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
43
44
|
* Retrieves a shared object with the given id.
|
|
44
45
|
* @param id - The id of the shared object to retrieve.
|
|
45
46
|
*/
|
|
46
47
|
async getSharedObject(id) {
|
|
47
|
-
if (this.
|
|
48
|
+
if (this.initialSharedObjectsFactories === undefined) {
|
|
48
49
|
throw new Error("Shared objects were not provided during creation.");
|
|
49
50
|
}
|
|
50
|
-
if (this.
|
|
51
|
+
if (this.initialSharedObjectsFactories.has(id)) {
|
|
51
52
|
const handle = this.root.get(id);
|
|
52
53
|
if (handle === undefined) {
|
|
53
|
-
throw new Error(`Shared object with id '${id}' is in
|
|
54
|
+
throw new Error(`Shared object with id '${id}' is in initialSharedObjectsFactories but not found under root.`);
|
|
54
55
|
}
|
|
55
56
|
return handle.get();
|
|
56
57
|
}
|
|
@@ -65,7 +66,7 @@ class TestFluidObject {
|
|
|
65
66
|
const doInitialization = async () => {
|
|
66
67
|
if (!existing) {
|
|
67
68
|
this.root = internal_3.SharedMap.create(this.runtime, "root");
|
|
68
|
-
this.
|
|
69
|
+
this.initialSharedObjectsFactories.forEach((sharedObjectFactory, key) => {
|
|
69
70
|
const sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);
|
|
70
71
|
this.root.set(key, sharedObject.handle);
|
|
71
72
|
});
|
|
@@ -115,13 +116,14 @@ class TestFluidObjectFactory {
|
|
|
115
116
|
}
|
|
116
117
|
/**
|
|
117
118
|
* Creates a new TestFluidObjectFactory.
|
|
118
|
-
* @param
|
|
119
|
+
* @param initialSharedObjectsFactories - A list of id to IChannelFactory mapping. It creates a data store runtime with each
|
|
119
120
|
* IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object
|
|
120
121
|
* for it.
|
|
121
122
|
*/
|
|
122
|
-
constructor(
|
|
123
|
-
this.
|
|
123
|
+
constructor(initialSharedObjectsFactories, type = "TestFluidObjectFactory", dataObjectKind = TestFluidObject) {
|
|
124
|
+
this.initialSharedObjectsFactories = initialSharedObjectsFactories;
|
|
124
125
|
this.type = type;
|
|
126
|
+
this.dataObjectKind = dataObjectKind;
|
|
125
127
|
}
|
|
126
128
|
async instantiateDataStore(context, existing) {
|
|
127
129
|
const dataTypes = new Map();
|
|
@@ -129,28 +131,29 @@ class TestFluidObjectFactory {
|
|
|
129
131
|
const sharedMapFactory = internal_3.SharedMap.getFactory();
|
|
130
132
|
dataTypes.set(sharedMapFactory.type, sharedMapFactory);
|
|
131
133
|
// Add the object factories to the list to be sent to data store runtime.
|
|
132
|
-
for (const [, factory] of this.
|
|
134
|
+
for (const [, factory] of this.initialSharedObjectsFactories) {
|
|
133
135
|
dataTypes.set(factory.type, factory);
|
|
134
136
|
}
|
|
135
137
|
// Create a map from the factory entries with entries that don't have the id as undefined. This will be
|
|
136
138
|
// passed to the Fluid object.
|
|
137
139
|
const factoryEntriesMapForObject = new Map();
|
|
138
|
-
for (const [id, factory] of this.
|
|
140
|
+
for (const [id, factory] of this.initialSharedObjectsFactories) {
|
|
139
141
|
if (id !== undefined) {
|
|
142
|
+
// Here we assume the factory produces an ISharedObject.
|
|
140
143
|
factoryEntriesMapForObject.set(id, factory);
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
146
|
const runtimeClass = (0, internal_2.mixinRequestHandler)(async (request, rt) => {
|
|
144
147
|
// The provideEntryPoint callback below always returns TestFluidObject.
|
|
145
148
|
const dataObject = await rt.entryPoint.get();
|
|
146
|
-
(0, internal_1.assert)(dataObject instanceof
|
|
149
|
+
(0, internal_1.assert)(dataObject instanceof this.dataObjectKind, "entryPoint should have been initialized by now");
|
|
147
150
|
return dataObject.request(request);
|
|
148
151
|
});
|
|
149
152
|
const runtime = new runtimeClass(context, dataTypes, existing, async () => {
|
|
150
153
|
await instance.initialize(true);
|
|
151
154
|
return instance;
|
|
152
155
|
});
|
|
153
|
-
const instance = new
|
|
156
|
+
const instance = new this.dataObjectKind(runtime, // runtime
|
|
154
157
|
runtime, // channel
|
|
155
158
|
context, factoryEntriesMapForObject);
|
|
156
159
|
if (!existing) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,iEAI4C;AAK5C,2DAAqE;AAMrE,qEAA2E;AAI3E;;;;;GAKG;AACH,MAAa,eAAe;IAC3B,IAAW,gBAAgB;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAMD;;;;;;OAMG;IACH,YACiB,OAA+B,EAC/B,OAA+B,EAC/B,OAA+B,EAC9B,iBAA+C;QAHhD,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC9B,sBAAiB,GAAjB,iBAAiB,CAA8B;QAEhE,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnF,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAU,EAAU;QAC/C,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACpC,MAA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QAED,MAAM,YAAY,GAAG,IAAA,8BAAmB,EACvC,KAAK,EAAE,OAAiB,EAAE,EAAyB,EAAE,EAAE;YACtD,uEAAuE;YACvE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YAC7C,IAAA,iBAAM,EACL,UAAU,YAAY,eAAe,EACrC,gDAAgD,CAChD,CAAC;YACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,CACD,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;YACzE,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAoB,IAAI,eAAe,CACpD,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU;QACnB,OAAO,EACP,0BAA0B,CAC1B,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;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 { IFluidHandle, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\tFluidObjectHandle,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISharedMap, SharedMap } from \"@fluidframework/map/internal\";\nimport {\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\n\nimport { ITestFluidObject } from \"./interfaces.js\";\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 * @internal\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\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 initializationPromise: 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\tif (this.factoryEntriesMap.has(id)) {\n\t\t\tconst handle = this.root.get<IFluidHandle<T>>(id);\n\t\t\tif (handle === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Shared object with id '${id}' is in factoryEntriesMap but not found under root.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn handle.get();\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 request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(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((sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\t\tconst sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\n\t\t\t\t\tthis.root.set(key, sharedObject.handle);\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\tthis.initializationPromise ??= doInitialization();\n\t\treturn this.initializationPromise;\n\t}\n}\n\n/**\n * Iterable\\<[ChannelId, IChannelFactory]\\>.\n * @internal\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 *\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 * @internal\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\t// The provideEntryPoint callback below always returns TestFluidObject.\n\t\t\t\tconst dataObject = await rt.entryPoint.get();\n\t\t\t\tassert(\n\t\t\t\t\tdataObject instanceof TestFluidObject,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn dataObject.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"]}
|
|
1
|
+
{"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,kEAA6D;AAC7D,iEAI4C;AAK5C,2DAAqE;AAMrE,qEAA2E;AAK3E;;;;;;;;;GASG;AACH,MAAa,eAAe;IAC3B,IAAW,gBAAgB;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAOD;;;;;;OAMG;IACH,YACiB,OAA+B,EAC/B,OAA+B,EAC/B,OAA+B,EAC9B,6BAGhB;QANe,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC9B,kCAA6B,GAA7B,6BAA6B,CAG7C;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,4BAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC9E,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAU,EAAU;QAC/C,IAAI,IAAI,CAAC,6BAA6B,KAAK,SAAS,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,IAAI,CAAC,6BA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AAI,EAAE,KAAK,SAAS,EAAE,CAAC;gBACtB,wDAAwD;gBACxD,0BAA0B,CAAC,GAAG,CAAC,EAAE,EAAE,OAAyC,CAAC,CAAC;YAC/E,CAAC;QACF,CAAC;QAED,MAAM,YAAY,GAAG,IAAA,8BAAmB,EACvC,KAAK,EAAE,OAAiB,EAAE,EAAyB,EAAE,EAAE;YACtD,uEAAuE;YACvE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YAC7C,IAAA,iBAAM,EACL,UAAU,YAAY,IAAI,CAAC,cAAc,EACzC,gDAAgD,CAChD,CAAC;YACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,CACD,CAAC;QAEF,MAAM,OAAO,GAA0B,IAAI,YAAY,CACtD,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAK,IAAI,EAAE;YACV,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC;QACjB,CAAC,CACD,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,cAAc,CACvC,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU;QACnB,OAAO,EACP,0BAA0B,CAC1B,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AA7ED,wDA6EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIFluidHandle,\n\tIRequest,\n\tIResponse,\n\ttype IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\tFluidObjectHandle,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISharedMap, SharedMap } from \"@fluidframework/map/internal\";\nimport {\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\nimport type { ISharedObject } from \"@fluidframework/shared-object-base/internal\";\n\nimport { ITestFluidObject } from \"./interfaces.js\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the initialSharedObjectsFactories 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 * @privateRemarks\n * TODO:\n * Usage of this outside this repo (via ITestFluidObject) should probably be phased out.\n * Once thats done, ITestFluidObject can be made internal and this class can be replaced with the simplified TestFluidObjectInternal.\n * @internal\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\tpublic readonly handle: IFluidHandle<this>;\n\n\tpublic root!: ISharedMap;\n\tprivate initializationPromise: 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 initialSharedObjectsFactories - 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 initialSharedObjectsFactories: ReadonlyMap<\n\t\t\tstring,\n\t\t\tIChannelFactory<ISharedObject>\n\t\t>,\n\t) {\n\t\tthis.handle = 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.initialSharedObjectsFactories === undefined) {\n\t\t\tthrow new Error(\"Shared objects were not provided during creation.\");\n\t\t}\n\n\t\tif (this.initialSharedObjectsFactories.has(id)) {\n\t\t\tconst handle = this.root.get<IFluidHandle<T>>(id);\n\t\t\tif (handle === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Shared object with id '${id}' is in initialSharedObjectsFactories but not found under root.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn handle.get();\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 request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(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.initialSharedObjectsFactories.forEach(\n\t\t\t\t\t(sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\t\t\tconst sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\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\tthis.initializationPromise ??= doInitialization();\n\t\treturn this.initializationPromise;\n\t}\n}\n\n/**\n * Iterable\\<[ChannelId, IChannelFactory]\\>.\n * @internal\n */\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Kind of test data object which {@link TestFluidObjectFactory} can create.\n * @internal\n */\nexport type TestDataObjectKind = new (\n\truntime: IFluidDataStoreRuntime,\n\tchannel: IFluidDataStoreChannel,\n\tcontext: IFluidDataStoreContext,\n\tinitialSharedObjectsFactories: ReadonlyMap<string, IChannelFactory<ISharedObject>>,\n) => IFluidLoadable & {\n\trequest(request: IRequest): Promise<IResponse>;\n\tinitialize(existing: boolean): Promise<void>;\n};\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 *\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 * @internal\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 initialSharedObjectsFactories - 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 initialSharedObjectsFactories: ChannelFactoryRegistry,\n\t\tpublic readonly type = \"TestFluidObjectFactory\",\n\t\tprivate readonly dataObjectKind: TestDataObjectKind = TestFluidObject,\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.initialSharedObjectsFactories) {\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<ISharedObject>>();\n\t\tfor (const [id, factory] of this.initialSharedObjectsFactories) {\n\t\t\tif (id !== undefined) {\n\t\t\t\t// Here we assume the factory produces an ISharedObject.\n\t\t\t\tfactoryEntriesMapForObject.set(id, factory as IChannelFactory<ISharedObject>);\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\t// The provideEntryPoint callback below always returns TestFluidObject.\n\t\t\t\tconst dataObject = await rt.entryPoint.get();\n\t\t\t\tassert(\n\t\t\t\t\tdataObject instanceof this.dataObjectKind,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn dataObject.request(request);\n\t\t\t},\n\t\t);\n\n\t\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t\tcontext,\n\t\t\tdataTypes,\n\t\t\texisting,\n\t\t\tasync () => {\n\t\t\t\tawait instance.initialize(true);\n\t\t\t\treturn instance;\n\t\t\t},\n\t\t);\n\n\t\tconst instance = new this.dataObjectKind(\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"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IFluidHandle, IRequest, IResponse, type IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { IChannelFactory, IFluidDataStoreRuntime, type IChannel } from "@fluidframework/datastore-definitions/internal";
|
|
7
|
+
import { IFluidDataStoreChannel, IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
+
import type { ISharedObject, SharedObjectKind } from "@fluidframework/shared-object-base/internal";
|
|
9
|
+
/**
|
|
10
|
+
* A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.
|
|
11
|
+
* The shared objects can be retrieved by passing the key of the entry to {@link TestFluidObjectInternal.getInitialSharedObject}.
|
|
12
|
+
* It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
|
|
13
|
+
* @remarks
|
|
14
|
+
* This is a simplified (does not use SharedMap) alternative to {@link TestFluidObject} which does not implement the external facing {@link ITestFluidObject} interface.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare class TestFluidObjectInternal implements IFluidLoadable {
|
|
18
|
+
readonly runtime: IFluidDataStoreRuntime;
|
|
19
|
+
readonly channel: IFluidDataStoreChannel;
|
|
20
|
+
readonly context: IFluidDataStoreContext;
|
|
21
|
+
private readonly initialSharedObjectsFactories;
|
|
22
|
+
get IFluidLoadable(): this;
|
|
23
|
+
readonly handle: IFluidHandle<this>;
|
|
24
|
+
private initializationPromise;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new TestFluidObjectInternal.
|
|
27
|
+
* @param runtime - The data store runtime.
|
|
28
|
+
* @param context - The data store context.
|
|
29
|
+
* @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,
|
|
30
|
+
* a shared object is created which can be retrieved by calling {@link TestFluidObjectInternal.getInitialSharedObject} with the id;
|
|
31
|
+
* @param initialSharedObjectsFactories - A collection of ids (which can be passed to {@link TestFluidObjectInternal.getInitialSharedObject})
|
|
32
|
+
* and the corresponding factories to use to create the shared objects during initialization.
|
|
33
|
+
*/
|
|
34
|
+
constructor(runtime: IFluidDataStoreRuntime, channel: IFluidDataStoreChannel, context: IFluidDataStoreContext, initialSharedObjectsFactories: ReadonlyMap<string, IChannelFactory<ISharedObject>>);
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves the shared object with the given id:
|
|
37
|
+
* this id must have been a key included in the initialSharedObjectsFactories map passed to the constructor.
|
|
38
|
+
* @param id - The id of the shared object to retrieve.
|
|
39
|
+
*/
|
|
40
|
+
getInitialSharedObject(id: string): Promise<IChannel>;
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves a shared object with the given id.
|
|
43
|
+
* @param kind - The kind of object to retrieve.
|
|
44
|
+
* @param id - The id of the shared object to retrieve.
|
|
45
|
+
*/
|
|
46
|
+
getInitialSharedObjectTyped<T>(kind: SharedObjectKind<T>, id: string): Promise<IChannel & T>;
|
|
47
|
+
request(request: IRequest): Promise<IResponse>;
|
|
48
|
+
initialize(existing: boolean): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=testFluidObjectInternal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testFluidObjectInternal.d.ts","sourceRoot":"","sources":["../src/testFluidObjectInternal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,KAAK,cAAc,EACnB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,KAAK,QAAQ,EACb,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EACX,aAAa,EACb,gBAAgB,EAChB,MAAM,6CAA6C,CAAC;AAErD;;;;;;;GAOG;AACH,qBAAa,uBAAwB,YAAW,cAAc;aAkB5C,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,6BAA6B;IApB/C,IAAW,cAAc,SAExB;IAED,SAAgB,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,CAAC,qBAAqB,CAA4B;IAEzD;;;;;;;;OAQG;gBAEc,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,sBAAsB,EAC9B,6BAA6B,EAAE,WAAW,CAC1D,MAAM,EACN,eAAe,CAAC,aAAa,CAAC,CAC9B;IAKF;;;;OAIG;IACU,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIlE;;;;OAIG;IACU,2BAA2B,CAAC,CAAC,EACzC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,EAAE,EAAE,MAAM,GACR,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IAQX,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAM9C,UAAU,CAAC,QAAQ,EAAE,OAAO;CAazC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TestFluidObjectInternal = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
+
const internal_2 = require("@fluidframework/datastore/internal");
|
|
10
|
+
const internal_3 = require("@fluidframework/runtime-utils/internal");
|
|
11
|
+
/**
|
|
12
|
+
* A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.
|
|
13
|
+
* The shared objects can be retrieved by passing the key of the entry to {@link TestFluidObjectInternal.getInitialSharedObject}.
|
|
14
|
+
* It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
|
|
15
|
+
* @remarks
|
|
16
|
+
* This is a simplified (does not use SharedMap) alternative to {@link TestFluidObject} which does not implement the external facing {@link ITestFluidObject} interface.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
class TestFluidObjectInternal {
|
|
20
|
+
get IFluidLoadable() {
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new TestFluidObjectInternal.
|
|
25
|
+
* @param runtime - The data store runtime.
|
|
26
|
+
* @param context - The data store context.
|
|
27
|
+
* @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,
|
|
28
|
+
* a shared object is created which can be retrieved by calling {@link TestFluidObjectInternal.getInitialSharedObject} with the id;
|
|
29
|
+
* @param initialSharedObjectsFactories - A collection of ids (which can be passed to {@link TestFluidObjectInternal.getInitialSharedObject})
|
|
30
|
+
* and the corresponding factories to use to create the shared objects during initialization.
|
|
31
|
+
*/
|
|
32
|
+
constructor(runtime, channel, context, initialSharedObjectsFactories) {
|
|
33
|
+
this.runtime = runtime;
|
|
34
|
+
this.channel = channel;
|
|
35
|
+
this.context = context;
|
|
36
|
+
this.initialSharedObjectsFactories = initialSharedObjectsFactories;
|
|
37
|
+
this.handle = new internal_2.FluidObjectHandle(this, "", runtime.objectsRoutingContext);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves the shared object with the given id:
|
|
41
|
+
* this id must have been a key included in the initialSharedObjectsFactories map passed to the constructor.
|
|
42
|
+
* @param id - The id of the shared object to retrieve.
|
|
43
|
+
*/
|
|
44
|
+
async getInitialSharedObject(id) {
|
|
45
|
+
return (await this.runtime.getChannel(id)) ?? (0, internal_1.fail)("Shared object not found");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves a shared object with the given id.
|
|
49
|
+
* @param kind - The kind of object to retrieve.
|
|
50
|
+
* @param id - The id of the shared object to retrieve.
|
|
51
|
+
*/
|
|
52
|
+
async getInitialSharedObjectTyped(kind, id) {
|
|
53
|
+
const result = (await this.runtime.getChannel(id)) ?? (0, internal_1.fail)("Shared object not found");
|
|
54
|
+
if (kind.is(result)) {
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
return (0, internal_1.fail)("Wrong kind of shared object");
|
|
58
|
+
}
|
|
59
|
+
async request(request) {
|
|
60
|
+
return request.url === "" || request.url === "/" || request.url.startsWith("/?")
|
|
61
|
+
? { mimeType: "fluid/object", status: 200, value: this }
|
|
62
|
+
: (0, internal_3.create404Response)(request);
|
|
63
|
+
}
|
|
64
|
+
async initialize(existing) {
|
|
65
|
+
const doInitialization = async () => {
|
|
66
|
+
if (!existing) {
|
|
67
|
+
for (const [key, sharedObjectFactory] of this.initialSharedObjectsFactories) {
|
|
68
|
+
const channel = this.runtime.createChannel(key, sharedObjectFactory.type);
|
|
69
|
+
channel.bindToContext();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
this.initializationPromise ??= doInitialization();
|
|
74
|
+
return this.initializationPromise;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.TestFluidObjectInternal = TestFluidObjectInternal;
|
|
78
|
+
//# sourceMappingURL=testFluidObjectInternal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testFluidObjectInternal.js","sourceRoot":"","sources":["../src/testFluidObjectInternal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,kEAA2D;AAC3D,iEAAuE;AAUvE,qEAA2E;AAM3E;;;;;;;GAOG;AACH,MAAa,uBAAuB;IACnC,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAKD;;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AAU,CAAC,QAAiB;QACxC,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;YACnC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,KAAK,MAAM,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,IAAI,CAAC,6BAA6B,EAAE,CAAC;oBAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;oBACzE,OAAyB,CAAC,aAAa,EAAE,CAAC;gBAC5C,CAAC;YACF,CAAC;QACF,CAAC,CAAC;QAEF,IAAI,CAAC,qBAAqB,KAAK,gBAAgB,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACnC,CAAC;CACD;AAzED,0DAyEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIFluidHandle,\n\tIRequest,\n\tIResponse,\n\ttype IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore/internal\";\nimport {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\ttype IChannel,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tISharedObject,\n\tSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\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 {@link TestFluidObjectInternal.getInitialSharedObject}.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n * @remarks\n * This is a simplified (does not use SharedMap) alternative to {@link TestFluidObject} which does not implement the external facing {@link ITestFluidObject} interface.\n * @internal\n */\nexport class TestFluidObjectInternal implements IFluidLoadable {\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\tpublic readonly handle: IFluidHandle<this>;\n\tprivate initializationPromise: Promise<void> | undefined;\n\n\t/**\n\t * Creates a new TestFluidObjectInternal.\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 {@link TestFluidObjectInternal.getInitialSharedObject} with the id;\n\t * @param initialSharedObjectsFactories - A collection of ids (which can be passed to {@link TestFluidObjectInternal.getInitialSharedObject})\n\t * and the corresponding factories to use to create the shared objects during initialization.\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 initialSharedObjectsFactories: ReadonlyMap<\n\t\t\tstring,\n\t\t\tIChannelFactory<ISharedObject>\n\t\t>,\n\t) {\n\t\tthis.handle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n\t}\n\n\t/**\n\t * Retrieves the shared object with the given id:\n\t * this id must have been a key included in the initialSharedObjectsFactories map passed to the constructor.\n\t * @param id - The id of the shared object to retrieve.\n\t */\n\tpublic async getInitialSharedObject(id: string): Promise<IChannel> {\n\t\treturn (await this.runtime.getChannel(id)) ?? fail(\"Shared object not found\");\n\t}\n\n\t/**\n\t * Retrieves a shared object with the given id.\n\t * @param kind - The kind of object to retrieve.\n\t * @param id - The id of the shared object to retrieve.\n\t */\n\tpublic async getInitialSharedObjectTyped<T>(\n\t\tkind: SharedObjectKind<T>,\n\t\tid: string,\n\t): Promise<IChannel & T> {\n\t\tconst result = (await this.runtime.getChannel(id)) ?? fail(\"Shared object not found\");\n\t\tif (kind.is(result)) {\n\t\t\treturn result;\n\t\t}\n\t\treturn fail(\"Wrong kind of shared object\");\n\t}\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(request);\n\t}\n\n\tpublic async initialize(existing: boolean) {\n\t\tconst doInitialization = async () => {\n\t\t\tif (!existing) {\n\t\t\t\tfor (const [key, sharedObjectFactory] of this.initialSharedObjectsFactories) {\n\t\t\t\t\tconst channel = this.runtime.createChannel(key, sharedObjectFactory.type);\n\t\t\t\t\t(channel as ISharedObject).bindToContext();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.initializationPromise ??= doInitialization();\n\t\treturn this.initializationPromise;\n\t}\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -9,10 +9,11 @@ export { createAndAttachContainer, createLoader, createLoaderProps, createAndAtt
|
|
|
9
9
|
export { retryWithEventualValue } from "./retry.js";
|
|
10
10
|
export { createTestConfigProvider, ITestConfigProvider } from "./TestConfigs.js";
|
|
11
11
|
export { createTestContainerRuntimeFactory, TestContainerRuntimeFactory, } from "./testContainerRuntimeFactory.js";
|
|
12
|
-
export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory, } from "./testFluidObject.js";
|
|
12
|
+
export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory, TestDataObjectKind, } from "./testFluidObject.js";
|
|
13
13
|
export { createDocumentId, DataObjectFactoryType, EventAndErrorTrackingLogger, type IEventAndErrorTrackingLogger, getUnexpectedLogErrorException, IDocumentIdStrategy, IOpProcessingController, ITestContainerConfig, ITestObjectProvider, TestObjectProvider, TestObjectProviderWithVersionedLoad, } from "./testObjectProvider.js";
|
|
14
14
|
export { createSummarizer, createSummarizerCore, createSummarizerFromFactory, summarizeNow, SummaryInfo, } from "./TestSummaryUtils.js";
|
|
15
15
|
export { timeoutAwait, timeoutPromise, type TimeoutDurationOption, type TimeoutWithError, type TimeoutWithValue, } from "./timeoutUtils.js";
|
|
16
16
|
export { toIDeltaManagerFull, waitForContainerConnection, getContainerEntryPointBackCompat, getDataStoreEntryPointBackCompat, } from "./containerUtils.js";
|
|
17
17
|
export { type ContainerRuntimeFactoryWithDefaultDataStoreConstructor, type ContainerRuntimeFactoryWithDefaultDataStoreProps, createContainerRuntimeFactoryWithDefaultDataStore, } from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
|
|
18
|
+
export { TestFluidObjectInternal } from "./testFluidObjectInternal.js";
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,eAAe,EACf,eAAe,EACf,yBAAyB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,kCAAkC,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACN,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,sBAAsB,EACtB,eAAe,EACf,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,eAAe,EACf,eAAe,EACf,yBAAyB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,kCAAkC,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACN,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,KAAK,4BAA4B,EACjC,8BAA8B,EAC9B,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mCAAmC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,YAAY,EACZ,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,sDAAsD,EAC3D,KAAK,gDAAgD,EACrD,iDAAiD,GACjD,MAAM,sDAAsD,CAAC;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -14,4 +14,5 @@ export { createSummarizer, createSummarizerCore, createSummarizerFromFactory, su
|
|
|
14
14
|
export { timeoutAwait, timeoutPromise, } from "./timeoutUtils.js";
|
|
15
15
|
export { toIDeltaManagerFull, waitForContainerConnection, getContainerEntryPointBackCompat, getDataStoreEntryPointBackCompat, } from "./containerUtils.js";
|
|
16
16
|
export { createContainerRuntimeFactoryWithDefaultDataStore, } from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
|
|
17
|
+
export { TestFluidObjectInternal } from "./testFluidObjectInternal.js";
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAEN,eAAe,GAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,kCAAkC,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAuB,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACN,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEN,eAAe,EACf,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAEN,eAAe,GAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,kCAAkC,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAuB,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACN,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEN,eAAe,EACf,sBAAsB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAE3B,8BAA8B,EAK9B,kBAAkB,EAClB,mCAAmC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,GAEZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,YAAY,EACZ,cAAc,GAId,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGN,iDAAiD,GACjD,MAAM,sDAAsD,CAAC;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces.js\";\nexport { LoaderContainerTracker } from \"./loaderContainerTracker.js\";\nexport {\n\tfluidEntryPoint,\n\tLocalCodeLoader,\n\tSupportedExportInterfaces,\n} from \"./localCodeLoader.js\";\nexport {\n\tcreateAndAttachContainer,\n\tcreateLoader,\n\tcreateLoaderProps,\n\tcreateAndAttachContainerUsingProps,\n} from \"./localLoader.js\";\nexport { retryWithEventualValue } from \"./retry.js\";\nexport { createTestConfigProvider, ITestConfigProvider } from \"./TestConfigs.js\";\nexport {\n\tcreateTestContainerRuntimeFactory,\n\tTestContainerRuntimeFactory,\n} from \"./testContainerRuntimeFactory.js\";\nexport {\n\tChannelFactoryRegistry,\n\tTestFluidObject,\n\tTestFluidObjectFactory,\n\tTestDataObjectKind,\n} from \"./testFluidObject.js\";\nexport {\n\tcreateDocumentId,\n\tDataObjectFactoryType,\n\tEventAndErrorTrackingLogger,\n\ttype IEventAndErrorTrackingLogger,\n\tgetUnexpectedLogErrorException,\n\tIDocumentIdStrategy,\n\tIOpProcessingController,\n\tITestContainerConfig,\n\tITestObjectProvider,\n\tTestObjectProvider,\n\tTestObjectProviderWithVersionedLoad,\n} from \"./testObjectProvider.js\";\nexport {\n\tcreateSummarizer,\n\tcreateSummarizerCore,\n\tcreateSummarizerFromFactory,\n\tsummarizeNow,\n\tSummaryInfo,\n} from \"./TestSummaryUtils.js\";\nexport {\n\ttimeoutAwait,\n\ttimeoutPromise,\n\ttype TimeoutDurationOption,\n\ttype TimeoutWithError,\n\ttype TimeoutWithValue,\n} from \"./timeoutUtils.js\";\nexport {\n\ttoIDeltaManagerFull,\n\twaitForContainerConnection,\n\tgetContainerEntryPointBackCompat,\n\tgetDataStoreEntryPointBackCompat,\n} from \"./containerUtils.js\";\nexport {\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreConstructor,\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreProps,\n\tcreateContainerRuntimeFactoryWithDefaultDataStore,\n} from \"./testContainerRuntimeFactoryWithDefaultDataStore.js\";\n\nexport { TestFluidObjectInternal } from \"./testFluidObjectInternal.js\";\n"]}
|
package/lib/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.
|
|
8
|
+
export declare const pkgVersion = "2.33.0-333010";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,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.33.0-333010\";\n"]}
|