@fluidframework/aqueduct 0.52.0 → 0.54.0-47413
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/dist/data-object-factories/dataObjectFactory.d.ts +21 -4
- package/dist/data-object-factories/dataObjectFactory.d.ts.map +1 -1
- package/dist/data-object-factories/dataObjectFactory.js +18 -4
- package/dist/data-object-factories/dataObjectFactory.js.map +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.d.ts +30 -13
- package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.js +18 -4
- package/dist/data-object-factories/pureDataObjectFactory.js.map +1 -1
- package/dist/data-objects/dataObject.d.ts +25 -5
- package/dist/data-objects/dataObject.d.ts.map +1 -1
- package/dist/data-objects/dataObject.js +21 -5
- package/dist/data-objects/dataObject.js.map +1 -1
- package/dist/data-objects/index.d.ts +3 -2
- package/dist/data-objects/index.d.ts.map +1 -1
- package/dist/data-objects/index.js +3 -1
- package/dist/data-objects/index.js.map +1 -1
- package/dist/data-objects/pureDataObject.d.ts +26 -15
- package/dist/data-objects/pureDataObject.d.ts.map +1 -1
- package/dist/data-objects/pureDataObject.js +18 -5
- package/dist/data-objects/pureDataObject.js.map +1 -1
- package/dist/data-objects/types.d.ts +38 -0
- package/dist/data-objects/types.d.ts.map +1 -0
- package/dist/data-objects/types.js +7 -0
- package/dist/data-objects/types.js.map +1 -0
- package/dist/test/tsconfig.tsbuildinfo +270 -236
- package/lib/data-object-factories/dataObjectFactory.js +16 -3
- package/lib/data-object-factories/dataObjectFactory.js.map +1 -1
- package/lib/data-object-factories/pureDataObjectFactory.js +16 -3
- package/lib/data-object-factories/pureDataObjectFactory.js.map +1 -1
- package/lib/data-objects/dataObject.js +19 -4
- package/lib/data-objects/dataObject.js.map +1 -1
- package/lib/data-objects/index.js +2 -2
- package/lib/data-objects/index.js.map +1 -1
- package/lib/data-objects/pureDataObject.js +16 -4
- package/lib/data-objects/pureDataObject.js.map +1 -1
- package/lib/data-objects/types.js +6 -0
- package/lib/data-objects/types.js.map +1 -0
- package/package.json +15 -15
|
@@ -2,14 +2,28 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IEvent } from "@fluidframework/common-definitions";
|
|
6
5
|
import { NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions";
|
|
7
6
|
import { IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
8
7
|
import { FluidObjectSymbolProvider } from "@fluidframework/synthesize";
|
|
9
8
|
import { FluidDataStoreRuntime } from "@fluidframework/datastore";
|
|
10
|
-
import {
|
|
9
|
+
import { IEvent } from "@fluidframework/common-definitions";
|
|
10
|
+
import { DataObject, DataObjectTypes, DataObjectType, IDataObjectProps, LegacyDataObject } from "../data-objects";
|
|
11
11
|
import { PureDataObjectFactory } from "./pureDataObjectFactory";
|
|
12
12
|
/**
|
|
13
|
+
* DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
|
|
14
|
+
* It facilitates DataObject's features (such as its shared directory) by
|
|
15
|
+
* ensuring relevant shared objects etc are available to the factory.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam TObj - DataObject (concrete type)
|
|
18
|
+
* @typeParam I - The input types for the DataObject
|
|
19
|
+
*/
|
|
20
|
+
export declare class DataObjectFactory<TObj extends DataObject<I>, I extends DataObjectTypes = DataObjectTypes> extends PureDataObjectFactory<TObj, I> {
|
|
21
|
+
constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[] | undefined, optionalProviders: FluidObjectSymbolProvider<DataObjectType<I, "OptionalProviders">>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated - This type is meant to ease the transition from the old PureDataObjectFactory type to the new.
|
|
25
|
+
* please migrate to PureDataObjectFactory.
|
|
26
|
+
*
|
|
13
27
|
* DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
|
|
14
28
|
* It facilitates DataObject's features (such as its shared directory) by
|
|
15
29
|
* ensuring relevant shared objects etc are available to the factory.
|
|
@@ -19,7 +33,10 @@ import { PureDataObjectFactory } from "./pureDataObjectFactory";
|
|
|
19
33
|
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
20
34
|
* @typeParam E - represents events that will be available in the EventForwarder
|
|
21
35
|
*/
|
|
22
|
-
export declare class
|
|
23
|
-
|
|
36
|
+
export declare class LegacyDataObjectFactory<TObj extends LegacyDataObject<O, S, E>, O, S, E extends IEvent = IEvent> extends DataObjectFactory<TObj, {
|
|
37
|
+
OptionalProviders: O;
|
|
38
|
+
InitialState: S;
|
|
39
|
+
Events: E;
|
|
40
|
+
}> {
|
|
24
41
|
}
|
|
25
42
|
//# sourceMappingURL=dataObjectFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,
|
|
1
|
+
{"version":3,"file":"dataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EACH,kCAAkC,EACrC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAG,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;GAOG;AACH,qBAAa,iBAAiB,CAAC,IAAI,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,eAAe,GAAG,eAAe,CAClG,SAAQ,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;gBAGlC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,KAAK,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC9C,aAAa,wCAAiC,EAC9C,iBAAiB,EAAE,yBAAyB,CAAC,cAAc,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,EACpF,eAAe,CAAC,EAAE,kCAAkC,EACpD,cAAc,GAAE,OAAO,qBAA6C;CAwB3E;AAED;;;;;;;;;;;;GAYG;AACF,qBAAa,uBAAuB,CAAC,IAAI,SAAS,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,CAC5G,SAAQ,iBAAiB,CAAC,IAAI,EAAE;IAAC,iBAAiB,EAAE,CAAC,CAAC;IAAC,YAAY,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAC,CAAC;CAAG"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DataObjectFactory = void 0;
|
|
7
|
+
exports.LegacyDataObjectFactory = exports.DataObjectFactory = void 0;
|
|
8
8
|
const map_1 = require("@fluidframework/map");
|
|
9
9
|
const datastore_1 = require("@fluidframework/datastore");
|
|
10
10
|
const pureDataObjectFactory_1 = require("./pureDataObjectFactory");
|
|
@@ -14,9 +14,7 @@ const pureDataObjectFactory_1 = require("./pureDataObjectFactory");
|
|
|
14
14
|
* ensuring relevant shared objects etc are available to the factory.
|
|
15
15
|
*
|
|
16
16
|
* @typeParam TObj - DataObject (concrete type)
|
|
17
|
-
* @typeParam
|
|
18
|
-
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
19
|
-
* @typeParam E - represents events that will be available in the EventForwarder
|
|
17
|
+
* @typeParam I - The input types for the DataObject
|
|
20
18
|
*/
|
|
21
19
|
class DataObjectFactory extends pureDataObjectFactory_1.PureDataObjectFactory {
|
|
22
20
|
constructor(type, ctor, sharedObjects = [], optionalProviders, registryEntries, runtimeFactory = datastore_1.FluidDataStoreRuntime) {
|
|
@@ -34,4 +32,20 @@ class DataObjectFactory extends pureDataObjectFactory_1.PureDataObjectFactory {
|
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
exports.DataObjectFactory = DataObjectFactory;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated - This type is meant to ease the transition from the old PureDataObjectFactory type to the new.
|
|
37
|
+
* please migrate to PureDataObjectFactory.
|
|
38
|
+
*
|
|
39
|
+
* DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
|
|
40
|
+
* It facilitates DataObject's features (such as its shared directory) by
|
|
41
|
+
* ensuring relevant shared objects etc are available to the factory.
|
|
42
|
+
*
|
|
43
|
+
* @typeParam TObj - DataObject (concrete type)
|
|
44
|
+
* @typeParam O - represents a type that will define optional providers that will be injected
|
|
45
|
+
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
46
|
+
* @typeParam E - represents events that will be available in the EventForwarder
|
|
47
|
+
*/
|
|
48
|
+
class LegacyDataObjectFactory extends DataObjectFactory {
|
|
49
|
+
}
|
|
50
|
+
exports.LegacyDataObjectFactory = LegacyDataObjectFactory;
|
|
37
51
|
//# sourceMappingURL=dataObjectFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAK6B;
|
|
1
|
+
{"version":3,"file":"dataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAK6B;AAM7B,yDAAkE;AAIlE,mEAAgE;AAEhE;;;;;;;GAOG;AACH,MAAa,iBACT,SAAQ,6CAA8B;IAEtC,YACI,IAAY,EACZ,IAA8C,EAC9C,gBAA4C,EAAE,EAC9C,iBAAoF,EACpF,eAAoD,EACpD,iBAA+C,iCAAqB;QAEpE,MAAM,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,sBAAgB,CAAC,IAAI,CAAC,EAAE;YAC1E,sCAAsC;YACtC,aAAa,CAAC,IAAI,CAAC,qBAAe,CAAC,UAAU,EAAE,CAAC,CAAC;SACpD;QAED,0GAA0G;QAC1G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,gBAAU,CAAC,IAAI,CAAC,EAAE;YACpE,gCAAgC;YAChC,aAAa,CAAC,IAAI,CAAC,eAAS,CAAC,UAAU,EAAE,CAAC,CAAC;SAC9C;QAED,KAAK,CACD,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,cAAc,CACjB,CAAC;IACN,CAAC;CACJ;AAjCD,8CAiCC;AAED;;;;;;;;;;;;GAYG;AACF,MAAa,uBACb,SAAQ,iBAA2E;CAAG;AADtF,0DACsF","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n DirectoryFactory,\n MapFactory,\n SharedDirectory,\n SharedMap,\n} from \"@fluidframework/map\";\nimport {\n NamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { FluidObjectSymbolProvider } from \"@fluidframework/synthesize\";\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore\";\n\nimport { IEvent } from \"@fluidframework/common-definitions\";\nimport { DataObject, DataObjectTypes, DataObjectType, IDataObjectProps, LegacyDataObject } from \"../data-objects\";\nimport { PureDataObjectFactory } from \"./pureDataObjectFactory\";\n\n/**\n * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.\n * It facilitates DataObject's features (such as its shared directory) by\n * ensuring relevant shared objects etc are available to the factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n */\nexport class DataObjectFactory<TObj extends DataObject<I>, I extends DataObjectTypes = DataObjectTypes>\n extends PureDataObjectFactory<TObj, I>\n{\n constructor(\n type: string,\n ctor: new (props: IDataObjectProps<I>) => TObj,\n sharedObjects: readonly IChannelFactory[] = [],\n optionalProviders: FluidObjectSymbolProvider<DataObjectType<I, \"OptionalProviders\">>,\n registryEntries?: NamedFluidDataStoreRegistryEntries,\n runtimeFactory: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n ) {\n const mergedObjects = [...sharedObjects];\n\n if (!sharedObjects.find((factory) => factory.type === DirectoryFactory.Type)) {\n // User did not register for directory\n mergedObjects.push(SharedDirectory.getFactory());\n }\n\n // TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10\n if (!sharedObjects.find((factory) => factory.type === MapFactory.Type)) {\n // User did not register for map\n mergedObjects.push(SharedMap.getFactory());\n }\n\n super(\n type,\n ctor,\n mergedObjects,\n optionalProviders,\n registryEntries,\n runtimeFactory,\n );\n }\n}\n\n/**\n * @deprecated - This type is meant to ease the transition from the old PureDataObjectFactory type to the new.\n * please migrate to PureDataObjectFactory.\n *\n * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.\n * It facilitates DataObject's features (such as its shared directory) by\n * ensuring relevant shared objects etc are available to the factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam O - represents a type that will define optional providers that will be injected\n * @typeParam S - the initial state type that the produced data object may take during creation\n * @typeParam E - represents events that will be available in the EventForwarder\n */\n export class LegacyDataObjectFactory<TObj extends LegacyDataObject<O, S, E>, O, S, E extends IEvent = IEvent>\n extends DataObjectFactory<TObj, {OptionalProviders: O, InitialState: S, Events: E}> {}\n"]}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IFluidRouter } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { FluidDataStoreRuntime } from "@fluidframework/datastore";
|
|
7
|
-
import { IEvent } from "@fluidframework/common-definitions";
|
|
8
7
|
import { IFluidDataStoreContext, IContainerRuntimeBase, IFluidDataStoreFactory, IFluidDataStoreRegistry, IProvideFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries, NamedFluidDataStoreRegistryEntry, IFluidDataStoreContextDetached } from "@fluidframework/runtime-definitions";
|
|
9
8
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
10
9
|
import { IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
11
10
|
import { FluidObjectSymbolProvider } from "@fluidframework/synthesize";
|
|
12
|
-
import {
|
|
11
|
+
import { IEvent } from "@fluidframework/common-definitions";
|
|
12
|
+
import { IDataObjectProps, PureDataObject, DataObjectType, DataObjectTypes, LegacyPureDataObject } from "../data-objects";
|
|
13
13
|
export interface IRootDataObjectFactory extends IFluidDataStoreFactory {
|
|
14
14
|
createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime): Promise<IFluidRouter>;
|
|
15
15
|
}
|
|
@@ -19,18 +19,16 @@ export interface IRootDataObjectFactory extends IFluidDataStoreFactory {
|
|
|
19
19
|
* another base data store factory.
|
|
20
20
|
*
|
|
21
21
|
* @typeParam TObj - DataObject (concrete type)
|
|
22
|
-
* @typeParam
|
|
23
|
-
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
24
|
-
* @typeParam E - represents events that will be available in the EventForwarder
|
|
22
|
+
* @typeParam I - The input types for the DataObject
|
|
25
23
|
*/
|
|
26
|
-
export declare class PureDataObjectFactory<TObj extends PureDataObject<
|
|
24
|
+
export declare class PureDataObjectFactory<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>, IRootDataObjectFactory {
|
|
27
25
|
readonly type: string;
|
|
28
26
|
private readonly ctor;
|
|
29
27
|
private readonly optionalProviders;
|
|
30
28
|
private readonly runtimeClass;
|
|
31
29
|
private readonly sharedObjectRegistry;
|
|
32
30
|
private readonly registry;
|
|
33
|
-
constructor(type: string, ctor: new (props: IDataObjectProps<
|
|
31
|
+
constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[], optionalProviders: FluidObjectSymbolProvider<DataObjectType<I, "OptionalProviders">>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeClass?: typeof FluidDataStoreRuntime);
|
|
34
32
|
get IFluidDataStoreFactory(): this;
|
|
35
33
|
get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined;
|
|
36
34
|
/**
|
|
@@ -57,7 +55,7 @@ export declare class PureDataObjectFactory<TObj extends PureDataObject<O, S, E>,
|
|
|
57
55
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
58
56
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
59
57
|
*/
|
|
60
|
-
createChildInstance(parentContext: IFluidDataStoreContext, initialState?:
|
|
58
|
+
createChildInstance(parentContext: IFluidDataStoreContext, initialState?: DataObjectType<I, "InitialState">): Promise<TObj>;
|
|
61
59
|
/**
|
|
62
60
|
* Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.
|
|
63
61
|
* In other words, registry of context passed in has to have this factory.
|
|
@@ -68,7 +66,7 @@ export declare class PureDataObjectFactory<TObj extends PureDataObject<O, S, E>,
|
|
|
68
66
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
69
67
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
70
68
|
*/
|
|
71
|
-
createPeerInstance(peerContext: IFluidDataStoreContext, initialState?:
|
|
69
|
+
createPeerInstance(peerContext: IFluidDataStoreContext, initialState?: DataObjectType<I, "InitialState">): Promise<TObj>;
|
|
72
70
|
/**
|
|
73
71
|
* Creates a new instance of the object. Uses container's registry to find this factory.
|
|
74
72
|
* It's expected that only container owners would use this functionality, as only such developers
|
|
@@ -79,7 +77,7 @@ export declare class PureDataObjectFactory<TObj extends PureDataObject<O, S, E>,
|
|
|
79
77
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
80
78
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
81
79
|
*/
|
|
82
|
-
createInstance(runtime: IContainerRuntimeBase, initialState?:
|
|
80
|
+
createInstance(runtime: IContainerRuntimeBase, initialState?: DataObjectType<I, "InitialState">): Promise<TObj>;
|
|
83
81
|
/**
|
|
84
82
|
* Creates a new root instance of the object. Uses container's registry to find this factory.
|
|
85
83
|
* It's expected that only container owners would use this functionality, as only such developers
|
|
@@ -90,8 +88,27 @@ export declare class PureDataObjectFactory<TObj extends PureDataObject<O, S, E>,
|
|
|
90
88
|
* @returns an object created by this factory. Data store and objects created are not attached to container.
|
|
91
89
|
* They get attached only when a handle to one of them is attached to already attached objects.
|
|
92
90
|
*/
|
|
93
|
-
createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime, initialState?:
|
|
94
|
-
protected createNonRootInstanceCore(containerRuntime: IContainerRuntimeBase, packagePath: Readonly<string[]>, initialState?:
|
|
95
|
-
protected createInstanceCore(context: IFluidDataStoreContextDetached, initialState?:
|
|
91
|
+
createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime, initialState?: DataObjectType<I, "InitialState">): Promise<TObj>;
|
|
92
|
+
protected createNonRootInstanceCore(containerRuntime: IContainerRuntimeBase, packagePath: Readonly<string[]>, initialState?: DataObjectType<I, "InitialState">): Promise<TObj>;
|
|
93
|
+
protected createInstanceCore(context: IFluidDataStoreContextDetached, initialState?: DataObjectType<I, "InitialState">): Promise<TObj>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated - This type is meant to ease the transition from the old PureDataObjectFactory type to the new.
|
|
97
|
+
* please migrate to PureDataObjectFactory.
|
|
98
|
+
*
|
|
99
|
+
* PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
|
|
100
|
+
* Consumers should typically use DataObjectFactory instead unless creating
|
|
101
|
+
* another base data store factory.
|
|
102
|
+
*
|
|
103
|
+
* @typeParam TObj - DataObject (concrete type)
|
|
104
|
+
* @typeParam O - represents a type that will define optional providers that will be injected
|
|
105
|
+
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
106
|
+
* @typeParam E - represents events that will be available in the EventForwarder
|
|
107
|
+
*/
|
|
108
|
+
export declare class LegacyPureDataObjectFactory<TObj extends LegacyPureDataObject<O, S, E>, O, S, E extends IEvent = IEvent> extends PureDataObjectFactory<TObj, {
|
|
109
|
+
OptionalProviders: O;
|
|
110
|
+
InitialState: S;
|
|
111
|
+
Events: E;
|
|
112
|
+
}> {
|
|
96
113
|
}
|
|
97
114
|
//# sourceMappingURL=pureDataObjectFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pureDataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,YAAY,EAAe,MAAM,iCAAiC,CAAC;AACtF,OAAO,EACH,qBAAqB,EAGvB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"pureDataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,YAAY,EAAe,MAAM,iCAAiC,CAAC;AACtF,OAAO,EACH,qBAAqB,EAGvB,MAAM,2B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IAAI,CAAC;CAcnB;AAED;;;;;;;;;;;;GAYG;AACF,qBAAa,2BAA2B,CAAC,IAAI,SAAS,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,CACpH,SAAQ,qBAAqB,CAAC,IAAI,EAAC;IAAC,iBAAiB,EAAE,CAAC,CAAC;IAAC,YAAY,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAC,CAAC;CAAG"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.PureDataObjectFactory = void 0;
|
|
7
|
+
exports.LegacyPureDataObjectFactory = exports.PureDataObjectFactory = void 0;
|
|
8
8
|
const datastore_1 = require("@fluidframework/datastore");
|
|
9
9
|
const container_runtime_1 = require("@fluidframework/container-runtime");
|
|
10
10
|
const synthesize_1 = require("@fluidframework/synthesize");
|
|
@@ -50,9 +50,7 @@ async function createDataObject(ctor, context, sharedObjectRegistry, optionalPro
|
|
|
50
50
|
* another base data store factory.
|
|
51
51
|
*
|
|
52
52
|
* @typeParam TObj - DataObject (concrete type)
|
|
53
|
-
* @typeParam
|
|
54
|
-
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
55
|
-
* @typeParam E - represents events that will be available in the EventForwarder
|
|
53
|
+
* @typeParam I - The input types for the DataObject
|
|
56
54
|
*/
|
|
57
55
|
class PureDataObjectFactory {
|
|
58
56
|
constructor(type, ctor, sharedObjects, optionalProviders, registryEntries, runtimeClass = datastore_1.FluidDataStoreRuntime) {
|
|
@@ -156,4 +154,20 @@ class PureDataObjectFactory {
|
|
|
156
154
|
}
|
|
157
155
|
}
|
|
158
156
|
exports.PureDataObjectFactory = PureDataObjectFactory;
|
|
157
|
+
/**
|
|
158
|
+
* @deprecated - This type is meant to ease the transition from the old PureDataObjectFactory type to the new.
|
|
159
|
+
* please migrate to PureDataObjectFactory.
|
|
160
|
+
*
|
|
161
|
+
* PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
|
|
162
|
+
* Consumers should typically use DataObjectFactory instead unless creating
|
|
163
|
+
* another base data store factory.
|
|
164
|
+
*
|
|
165
|
+
* @typeParam TObj - DataObject (concrete type)
|
|
166
|
+
* @typeParam O - represents a type that will define optional providers that will be injected
|
|
167
|
+
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
168
|
+
* @typeParam E - represents events that will be available in the EventForwarder
|
|
169
|
+
*/
|
|
170
|
+
class LegacyPureDataObjectFactory extends PureDataObjectFactory {
|
|
171
|
+
}
|
|
172
|
+
exports.LegacyPureDataObjectFactory = LegacyPureDataObjectFactory;
|
|
159
173
|
//# sourceMappingURL=pureDataObjectFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yDAIoC;AAEpC,yEAA2E;AAa3E,2DAIoC;AAEpC,kDAGyB;AAWzB;;;EAGE;AACF,KAAK,UAAU,gBAAgB,CAC3B,IAAiD,EACjD,OAA+B,EAC/B,oBAA2C,EAC3C,iBAA+C,EAC/C,eAA6C,EAC7C,QAAiB,EACjB,SAAa;IAEb,OAAO;IACP,IAAI,YAAY,GAAG,eAAe,CAAC;IAEnC,mBAAmB;IACnB,YAAY,GAAG,+BAAmB,CAC9B,KAAK,EAAE,OAAiB,EAAE,UAAiC,EAAE,EAAE,CAC3D,CAAC,MAAM,6BAAc,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EACjE,YAAY,CAAC,CAAC;IAEtB,0CAA0C;IAC1C,6EAA6E;IAC7E,MAAM,OAAO,GAAG,IAAI,YAAY,CAC5B,OAAO,EACP,o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AAyB,CACjC,OAAO,EACP,CAAC,IAAI,CAAC,IAAI,CAAC,EACX,YAAY,CAAC,CAAC;IACtB,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,kBAAkB,CAC3B,eAAuB,EACvB,OAA0B,EAC1B,YAAgB;QAEhB,MAAM,OAAO,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC1D,CAAC;IAES,KAAK,CAAC,yBAAyB,CACrC,gBAAuC,EACvC,WAA+B,EAC/B,YAAgB;QAEhB,MAAM,OAAO,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC1D,CAAC;IAES,KAAK,CAAC,kBAAkB,CAC9B,OAAuC,EACvC,YAAgB;QAEhB,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CAChD,IAAI,CAAC,IAAI,EACT,OAAO,EACP,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,YAAY,EACjB,KAAK,EAAE,WAAW;QAClB,YAAY,CAAC,CAAC;QAElB,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAlKD,sDAkKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IFluidRouter, FluidObject } from \"@fluidframework/core-interfaces\";\nimport {\n FluidDataStoreRuntime,\n ISharedObjectRegistry,\n mixinRequestHandler,\n } from \"@fluidframework/datastore\";\nimport { IEvent } from \"@fluidframework/common-definitions\";\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime\";\nimport {\n IFluidDataStoreContext,\n IContainerRuntimeBase,\n IFluidDataStoreFactory,\n IFluidDataStoreRegistry,\n IProvideFluidDataStoreRegistry,\n NamedFluidDataStoreRegistryEntries,\n NamedFluidDataStoreRegistryEntry,\n IFluidDataStoreContextDetached,\n} from \"@fluidframework/runtime-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport {\n FluidObjectSymbolProvider,\n DependencyContainer,\n IFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize\";\n\nimport {\n IDataObjectProps,\n PureDataObject,\n} from \"../data-objects\";\n\n/*\n * Useful interface in places where it's useful to do type erasure for PureDataObject generic\n */\nexport interface IRootDataObjectFactory extends IFluidDataStoreFactory {\n createRootInstance(\n rootDataStoreId: string,\n runtime: IContainerRuntime): Promise<IFluidRouter>;\n}\n\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n*/\nasync function createDataObject<TObj extends PureDataObject<O, S, E>, O, S, E extends IEvent = IEvent>(\n ctor: new (props: IDataObjectProps<O, S>) => TObj,\n context: IFluidDataStoreContext,\n sharedObjectRegistry: ISharedObjectRegistry,\n optionalProviders: FluidObjectSymbolProvider<O>,\n runtimeClassArg: typeof FluidDataStoreRuntime,\n existing: boolean,\n initProps?: S)\n{\n // base\n let runtimeClass = runtimeClassArg;\n\n // request mixin in\n runtimeClass = mixinRequestHandler(\n async (request: IRequest, runtimeArg: FluidDataStoreRuntime) =>\n (await PureDataObject.getDataObject(runtimeArg)).request(request),\n runtimeClass);\n\n // Create a new runtime for our data store\n // The runtime is what Fluid uses to create DDS' and route to your data store\n const runtime = new runtimeClass(\n context,\n sharedObjectRegistry,\n existing,\n );\n\n // Create object right away.\n // This allows object to register various callbacks with runtime before runtime\n // becomes globally available. But it's not full initialization - constructor can't\n // access DDSs or other services of runtime as objects are not fully initialized.\n // In order to use object, we need to go through full initialization by calling finishInitialization().\n const scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n const dependencyContainer = new DependencyContainer(scope.IFluidDependencySynthesizer);\n const providers = dependencyContainer.synthesize<O>(optionalProviders, {});\n const instance = new ctor({ runtime, context, providers, initProps });\n\n // if it's a newly created object, we need to wait for it to finish initialization\n // as that results in creation of DDSs, before it gets attached, providing atomic\n // guarantee of creation.\n // WARNING: we can't do the same (yet) for already existing PureDataObject!\n // This will result in deadlock, as it tries to resolve internal handles, but any\n // handle resolution goes through root (container runtime), which can't route it back\n // to this data store, as it's still not initialized and not known to container runtime yet.\n // In the future, we should address it by using relative paths for handles and be able to resolve\n // local DDSs while data store is not fully initialized.\n if (!existing) {\n await instance.finishInitialization(existing);\n }\n\n return { instance, runtime };\n}\n\n/**\n * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam O - represents a type that will define optional providers that will be injected\n * @typeParam S - the initial state type that the produced data object may take during creation\n * @typeParam E - represents events that will be available in the EventForwarder\n */\nexport class PureDataObjectFactory<TObj extends PureDataObject<O, S, E>, O, S, E extends IEvent = IEvent>\n implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>, IRootDataObjectFactory\n{\n private readonly sharedObjectRegistry: ISharedObjectRegistry;\n private readonly registry: IFluidDataStoreRegistry | undefined;\n\n constructor(\n public readonly type: string,\n private readonly ctor: new (props: IDataObjectProps<O, S>) => TObj,\n sharedObjects: readonly IChannelFactory[],\n private readonly optionalProviders: FluidObjectSymbolProvider<O>,\n registryEntries?: NamedFluidDataStoreRegistryEntries,\n private readonly runtimeClass: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n ) {\n if (this.type === \"\") {\n throw new Error(\"undefined type member\");\n }\n if (registryEntries !== undefined) {\n this.registry = new FluidDataStoreRegistry(registryEntries);\n }\n this.sharedObjectRegistry = new Map(sharedObjects.map((ext) => [ext.type, ext]));\n }\n\n public get IFluidDataStoreFactory() { return this; }\n\n public get IFluidDataStoreRegistry() {\n return this.registry;\n }\n\n /**\n * Convenience helper to get the data store's/factory's data store registry entry.\n * The return type hides the factory's generics, easing grouping of registry\n * entries that differ only in this way into the same array.\n * @returns The NamedFluidDataStoreRegistryEntry\n */\n public get registryEntry(): NamedFluidDataStoreRegistryEntry {\n return [this.type, Promise.resolve(this)];\n }\n\n /**\n * This is where we do data store setup.\n *\n * @param context - data store context used to load a data store runtime\n */\n public async instantiateDataStore(context: IFluidDataStoreContext, existing: boolean) {\n const { runtime } = await createDataObject(\n this.ctor,\n context,\n this.sharedObjectRegistry,\n this.optionalProviders,\n this.runtimeClass,\n existing);\n\n return runtime;\n }\n\n /**\n * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n * In other words, registry of context passed in has to contain this factory, with the name that matches\n * this factory's type.\n * It is intended to be used by data store objects that create sub-objects.\n * @param context - The context being used to create the runtime\n * (the created object will have its own new context created as well)\n * @param initialState - The initial state to provide to the created data store.\n * @returns an object created by this factory. Data store and objects created are not attached to container.\n * They get attached only when a handle to one of them is attached to already attached objects.\n */\n public async createChildInstance(\n parentContext: IFluidDataStoreContext,\n initialState?: S,\n ): Promise<TObj> {\n return this.createNonRootInstanceCore(\n parentContext.containerRuntime,\n [...parentContext.packagePath, this.type],\n initialState);\n }\n\n /**\n * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n * In other words, registry of context passed in has to have this factory.\n * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n * @param context - The component context being used to create the object\n * (the created object will have its own new context created as well)\n * @param initialState - The initial state to provide to the created component.\n * @returns an object created by this factory. Data store and objects created are not attached to container.\n * They get attached only when a handle to one of them is attached to already attached objects.\n */\n public async createPeerInstance(\n peerContext: IFluidDataStoreContext,\n initialState?: S,\n ): Promise<TObj> {\n return this.createNonRootInstanceCore(\n peerContext.containerRuntime,\n peerContext.packagePath,\n initialState);\n }\n\n /**\n * Creates a new instance of the object. Uses container's registry to find this factory.\n * It's expected that only container owners would use this functionality, as only such developers\n * have knowledge of entries in container registry.\n * The name in this registry for such record should match type of this factory.\n * @param runtime - container runtime. It's registry is used to create an object.\n * @param initialState - The initial state to provide to the created component.\n * @returns an object created by this factory. Data store and objects created are not attached to container.\n * They get attached only when a handle to one of them is attached to already attached objects.\n */\n public async createInstance(\n runtime: IContainerRuntimeBase,\n initialState?: S,\n ): Promise<TObj> {\n return this.createNonRootInstanceCore(\n runtime,\n [this.type],\n initialState);\n }\n\n /**\n * Creates a new root instance of the object. Uses container's registry to find this factory.\n * It's expected that only container owners would use this functionality, as only such developers\n * have knowledge of entries in container registry.\n * The name in this registry for such record should match type of this factory.\n * @param runtime - container runtime. It's registry is used to create an object.\n * @param initialState - The initial state to provide to the created component.\n * @returns an object created by this factory. Data store and objects created are not attached to container.\n * They get attached only when a handle to one of them is attached to already attached objects.\n */\n public async createRootInstance(\n rootDataStoreId: string,\n runtime: IContainerRuntime,\n initialState?: S,\n ): Promise<TObj> {\n const context = runtime.createDetachedRootDataStore([this.type], rootDataStoreId);\n return this.createInstanceCore(context, initialState);\n }\n\n protected async createNonRootInstanceCore(\n containerRuntime: IContainerRuntimeBase,\n packagePath: Readonly<string[]>,\n initialState?: S,\n ): Promise<TObj> {\n const context = containerRuntime.createDetachedDataStore(packagePath);\n return this.createInstanceCore(context, initialState);\n }\n\n protected async createInstanceCore(\n context: IFluidDataStoreContextDetached,\n initialState?: S,\n ): Promise<TObj> {\n const { instance, runtime } = await createDataObject(\n this.ctor,\n context,\n this.sharedObjectRegistry,\n this.optionalProviders,\n this.runtimeClass,\n false, // existing\n initialState);\n\n await context.attachRuntime(this, runtime);\n\n return instance;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yDAIoC;AACpC,yEAA2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AI,CAAC,IAAI,EACT,OAAO,EACP,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,YAAY,EACjB,KAAK,EAAE,WAAW;QAClB,YAAY,CAAC,CAAC;QAElB,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAlKD,sDAkKC;AAED;;;;;;;;;;;;GAYG;AACF,MAAa,2BACb,SAAQ,qBAA8E;CAAG;AADzF,kEACyF","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IFluidRouter, FluidObject } from \"@fluidframework/core-interfaces\";\nimport {\n FluidDataStoreRuntime,\n ISharedObjectRegistry,\n mixinRequestHandler,\n } from \"@fluidframework/datastore\";\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime\";\nimport {\n IFluidDataStoreContext,\n IContainerRuntimeBase,\n IFluidDataStoreFactory,\n IFluidDataStoreRegistry,\n IProvideFluidDataStoreRegistry,\n NamedFluidDataStoreRegistryEntries,\n NamedFluidDataStoreRegistryEntry,\n IFluidDataStoreContextDetached,\n} from \"@fluidframework/runtime-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport {\n FluidObjectSymbolProvider,\n DependencyContainer,\n IFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize\";\n\nimport { IEvent } from \"@fluidframework/common-definitions\";\nimport {\n IDataObjectProps,\n PureDataObject,\n DataObjectType,\n DataObjectTypes,\n LegacyPureDataObject,\n} from \"../data-objects\";\n/*\n * Useful interface in places where it's useful to do type erasure for PureDataObject generic\n */\nexport interface IRootDataObjectFactory extends IFluidDataStoreFactory {\n createRootInstance(\n rootDataStoreId: string,\n runtime: IContainerRuntime): Promise<IFluidRouter>;\n}\n\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n*/\nasync function createDataObject<TObj extends PureDataObject,I extends DataObjectTypes = DataObjectTypes>(\n ctor: new (props: IDataObjectProps<I>) => TObj,\n context: IFluidDataStoreContext,\n sharedObjectRegistry: ISharedObjectRegistry,\n optionalProviders: FluidObjectSymbolProvider<DataObjectType<I, \"OptionalProviders\">>,\n runtimeClassArg: typeof FluidDataStoreRuntime,\n existing: boolean,\n initProps?: DataObjectType<I, \"InitialState\">)\n{\n // base\n let runtimeClass = runtimeClassArg;\n\n // request mixin in\n runtimeClass = mixinRequestHandler(\n async (request: IRequest, runtimeArg: FluidDataStoreRuntime) =>\n (await PureDataObject.getDataObject(runtimeArg)).request(request),\n runtimeClass);\n\n // Create a new runtime for our data store\n // The runtime is what Fluid uses to create DDS' and route to your data store\n const runtime = new runtimeClass(\n context,\n sharedObjectRegistry,\n existing,\n );\n\n // Create object right away.\n // This allows object to register various callbacks with runtime before runtime\n // becomes globally available. But it's not full initialization - constructor can't\n // access DDSs or other services of runtime as objects are not fully initialized.\n // In order to use object, we need to go through full initialization by calling finishInitialization().\n const scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n const dependencyContainer = new DependencyContainer(scope.IFluidDependencySynthesizer);\n const providers = dependencyContainer.synthesize<DataObjectType<I, \"OptionalProviders\">>(optionalProviders, {});\n const instance = new ctor({ runtime, context, providers, initProps });\n\n // if it's a newly created object, we need to wait for it to finish initialization\n // as that results in creation of DDSs, before it gets attached, providing atomic\n // guarantee of creation.\n // WARNING: we can't do the same (yet) for already existing PureDataObject!\n // This will result in deadlock, as it tries to resolve internal handles, but any\n // handle resolution goes through root (container runtime), which can't route it back\n // to this data store, as it's still not initialized and not known to container runtime yet.\n // In the future, we should address it by using relative paths for handles and be able to resolve\n // local DDSs while data store is not fully initialized.\n if (!existing) {\n await instance.finishInitialization(existing);\n }\n\n return { instance, runtime };\n}\n\n/**\n * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n */\nexport class PureDataObjectFactory<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes>\n implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>, IRootDataObjectFactory\n{\n private readonly sharedObjectRegistry: ISharedObjectRegistry;\n private readonly registry: IFluidDataStoreRegistry | undefined;\n\n constructor(\n public readonly type: string,\n private readonly ctor: new (props: IDataObjectProps<I>) => TObj,\n sharedObjects: readonly IChannelFactory[],\n private readonly optionalProviders: FluidObjectSymbolProvider<DataObjectType<I, \"OptionalProviders\">>,\n registryEntries?: NamedFluidDataStoreRegistryEntries,\n private readonly runtimeClass: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n ) {\n if (this.type === \"\") {\n throw new Error(\"undefined type member\");\n }\n if (registryEntries !== undefined) {\n this.registry = new FluidDataStoreRegistry(registryEntries);\n }\n this.sharedObjectRegistry = new Map(sharedObjects.map((ext) => [ext.type, ext]));\n }\n\n public get IFluidDataStoreFactory() { return this; }\n\n public get IFluidDataStoreRegistry() {\n return this.registry;\n }\n\n /**\n * Convenience helper to get the data store's/factory's data store registry entry.\n * The return type hides the factory's generics, easing grouping of registry\n * entries that differ only in this way into the same array.\n * @returns The NamedFluidDataStoreRegistryEntry\n */\n public get registryEntry(): NamedFluidDataStoreRegistryEntry {\n return [this.type, Promise.resolve(this)];\n }\n\n /**\n * This is where we do data store setup.\n *\n * @param context - data store context used to load a data store runtime\n */\n public async instantiateDataStore(context: IFluidDataStoreContext, existing: boolean) {\n const { runtime } = await createDataObject(\n this.ctor,\n context,\n this.sharedObjectRegistry,\n this.optionalProviders,\n this.runtimeClass,\n existing);\n\n return runtime;\n }\n\n /**\n * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n * In other words, registry of context passed in has to contain this factory, with the name that matches\n * this factory's type.\n * It is intended to be used by data store objects that create sub-objects.\n * @param context - The context being used to create the runtime\n * (the created object will have its own new context created as well)\n * @param initialState - The initial state to provide to the created data store.\n * @returns an object created by this factory. Data store and objects created are not attached to container.\n * They get attached only when a handle to one of them is attached to already attached objects.\n */\n public async createChildInstance(\n parentContext: IFluidDataStoreContext,\n initialState?: DataObjectType<I, \"InitialState\">,\n ): Promise<TObj> {\n return this.createNonRootInstanceCore(\n parentContext.containerRuntime,\n [...parentContext.packagePath, this.type],\n initialState);\n }\n\n /**\n * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n * In other words, registry of context passed in has to have this factory.\n * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n * @param context - The component context being used to create the object\n * (the created object will have its own new context created as well)\n * @param initialState - The initial state to provide to the created component.\n * @returns an object created by this factory. Data store and objects created are not attached to container.\n * They get attached only when a handle to one of them is attached to already attached objects.\n */\n public async createPeerInstance(\n peerContext: IFluidDataStoreContext,\n initialState?: DataObjectType<I, \"InitialState\">,\n ): Promise<TObj> {\n return this.createNonRootInstanceCore(\n peerContext.containerRuntime,\n peerContext.packagePath,\n initialState);\n }\n\n /**\n * Creates a new instance of the object. Uses container's registry to find this factory.\n * It's expected that only container owners would use this functionality, as only such developers\n * have knowledge of entries in container registry.\n * The name in this registry for such record should match type of this factory.\n * @param runtime - container runtime. It's registry is used to create an object.\n * @param initialState - The initial state to provide to the created component.\n * @returns an object created by this factory. Data store and objects created are not attached to container.\n * They get attached only when a handle to one of them is attached to already attached objects.\n */\n public async createInstance(\n runtime: IContainerRuntimeBase,\n initialState?: DataObjectType<I, \"InitialState\">,\n ): Promise<TObj> {\n return this.createNonRootInstanceCore(\n runtime,\n [this.type],\n initialState);\n }\n\n /**\n * Creates a new root instance of the object. Uses container's registry to find this factory.\n * It's expected that only container owners would use this functionality, as only such developers\n * have knowledge of entries in container registry.\n * The name in this registry for such record should match type of this factory.\n * @param runtime - container runtime. It's registry is used to create an object.\n * @param initialState - The initial state to provide to the created component.\n * @returns an object created by this factory. Data store and objects created are not attached to container.\n * They get attached only when a handle to one of them is attached to already attached objects.\n */\n public async createRootInstance(\n rootDataStoreId: string,\n runtime: IContainerRuntime,\n initialState?: DataObjectType<I, \"InitialState\">,\n ): Promise<TObj> {\n const context = runtime.createDetachedRootDataStore([this.type], rootDataStoreId);\n return this.createInstanceCore(context, initialState);\n }\n\n protected async createNonRootInstanceCore(\n containerRuntime: IContainerRuntimeBase,\n packagePath: Readonly<string[]>,\n initialState?: DataObjectType<I, \"InitialState\">,\n ): Promise<TObj> {\n const context = containerRuntime.createDetachedDataStore(packagePath);\n return this.createInstanceCore(context, initialState);\n }\n\n protected async createInstanceCore(\n context: IFluidDataStoreContextDetached,\n initialState?: DataObjectType<I, \"InitialState\">,\n ): Promise<TObj> {\n const { instance, runtime } = await createDataObject(\n this.ctor,\n context,\n this.sharedObjectRegistry,\n this.optionalProviders,\n this.runtimeClass,\n false, // existing\n initialState);\n\n await context.attachRuntime(this, runtime);\n\n return instance;\n }\n}\n\n/**\n * @deprecated - This type is meant to ease the transition from the old PureDataObjectFactory type to the new.\n * please migrate to PureDataObjectFactory.\n *\n * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam O - represents a type that will define optional providers that will be injected\n * @typeParam S - the initial state type that the produced data object may take during creation\n * @typeParam E - represents events that will be available in the EventForwarder\n */\n export class LegacyPureDataObjectFactory<TObj extends LegacyPureDataObject<O, S, E>, O, S, E extends IEvent = IEvent>\n extends PureDataObjectFactory<TObj,{OptionalProviders: O, InitialState: S, Events: E}> {}\n"]}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { IEvent } from "@fluidframework/common-definitions";
|
|
5
6
|
import { IFluidObject, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
6
7
|
import { ISharedDirectory } from "@fluidframework/map";
|
|
7
|
-
import { IEvent } from "@fluidframework/common-definitions";
|
|
8
8
|
import { PureDataObject } from "./pureDataObject";
|
|
9
|
+
import { DataObjectTypes } from "./types";
|
|
9
10
|
/**
|
|
10
11
|
* DataObject is a base data store that is primed with a root directory. It
|
|
11
12
|
* ensures that it is created and ready before you can access it.
|
|
@@ -14,11 +15,9 @@ import { PureDataObject } from "./pureDataObject";
|
|
|
14
15
|
* and registering channels with the runtime any new DDS that is set on the root
|
|
15
16
|
* will automatically be registered.
|
|
16
17
|
*
|
|
17
|
-
* @typeParam
|
|
18
|
-
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
19
|
-
* @typeParam E - represents events that will be available in the EventForwarder
|
|
18
|
+
* @typeParam I - The optional input types used to strongly type the data object
|
|
20
19
|
*/
|
|
21
|
-
export declare abstract class DataObject<
|
|
20
|
+
export declare abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> extends PureDataObject<I> {
|
|
22
21
|
private internalRoot;
|
|
23
22
|
private readonly rootDirectoryId;
|
|
24
23
|
request(request: IRequest): Promise<IResponse>;
|
|
@@ -34,4 +33,25 @@ export declare abstract class DataObject<O extends IFluidObject = object, S = un
|
|
|
34
33
|
initializeInternal(existing: boolean): Promise<void>;
|
|
35
34
|
protected getUninitializedErrorString(item: string): string;
|
|
36
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated - This type is meant to ease the transition from the old DataObject type to the new.
|
|
38
|
+
* please migrate to DataObject.
|
|
39
|
+
*
|
|
40
|
+
* DataObject is a base data store that is primed with a root directory. It
|
|
41
|
+
* ensures that it is created and ready before you can access it.
|
|
42
|
+
*
|
|
43
|
+
* Having a single root directory allows for easier development. Instead of creating
|
|
44
|
+
* and registering channels with the runtime any new DDS that is set on the root
|
|
45
|
+
* will automatically be registered.
|
|
46
|
+
*
|
|
47
|
+
* @typeParam O - represents a type that will define optional providers that will be injected
|
|
48
|
+
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
49
|
+
* @typeParam E - represents events that will be available in the EventForwarder
|
|
50
|
+
*/
|
|
51
|
+
export declare abstract class LegacyDataObject<O extends IFluidObject = object, S = undefined, E extends IEvent = IEvent> extends DataObject<{
|
|
52
|
+
OptionalProviders: O;
|
|
53
|
+
InitialState: S;
|
|
54
|
+
Events: E;
|
|
55
|
+
}> {
|
|
56
|
+
}
|
|
37
57
|
//# sourceMappingURL=dataObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataObject.d.ts","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,YAAY,EACZ,QAAQ,EACR,SAAS,EACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAA+B,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"dataObject.d.ts","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EACH,YAAY,EACZ,QAAQ,EACR,SAAS,EACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAA+B,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;GASG;AACH,8BAAsB,UAAU,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IAEnG,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAU;IAE7B,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAc3D;;;OAGG;IACH,SAAS,KAAK,IAAI,IAAI,gBAAgB,CAMrC;IAED;;;OAGG;IACU,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBjE,SAAS,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM;CAGrD;AAED;;;;;;;;;;;;;;GAcG;AAEH,8BAAsB,gBAAgB,CAAC,CAAC,SAAS,YAAY,GAAG,MAAM,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,CAC5G,SAAQ,UAAU,CAAC;IAAC,iBAAiB,EAAE,CAAC,CAAC;IAAC,YAAY,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAC,CAAC;CAErE"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DataObject = void 0;
|
|
7
|
+
exports.LegacyDataObject = exports.DataObject = void 0;
|
|
8
8
|
const map_1 = require("@fluidframework/map");
|
|
9
9
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
10
10
|
const pureDataObject_1 = require("./pureDataObject");
|
|
@@ -16,11 +16,8 @@ const pureDataObject_1 = require("./pureDataObject");
|
|
|
16
16
|
* and registering channels with the runtime any new DDS that is set on the root
|
|
17
17
|
* will automatically be registered.
|
|
18
18
|
*
|
|
19
|
-
* @typeParam
|
|
20
|
-
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
21
|
-
* @typeParam E - represents events that will be available in the EventForwarder
|
|
19
|
+
* @typeParam I - The optional input types used to strongly type the data object
|
|
22
20
|
*/
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
24
21
|
class DataObject extends pureDataObject_1.PureDataObject {
|
|
25
22
|
constructor() {
|
|
26
23
|
super(...arguments);
|
|
@@ -81,4 +78,23 @@ class DataObject extends pureDataObject_1.PureDataObject {
|
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
80
|
exports.DataObject = DataObject;
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated - This type is meant to ease the transition from the old DataObject type to the new.
|
|
83
|
+
* please migrate to DataObject.
|
|
84
|
+
*
|
|
85
|
+
* DataObject is a base data store that is primed with a root directory. It
|
|
86
|
+
* ensures that it is created and ready before you can access it.
|
|
87
|
+
*
|
|
88
|
+
* Having a single root directory allows for easier development. Instead of creating
|
|
89
|
+
* and registering channels with the runtime any new DDS that is set on the root
|
|
90
|
+
* will automatically be registered.
|
|
91
|
+
*
|
|
92
|
+
* @typeParam O - represents a type that will define optional providers that will be injected
|
|
93
|
+
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
94
|
+
* @typeParam E - represents events that will be available in the EventForwarder
|
|
95
|
+
*/
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
97
|
+
class LegacyDataObject extends DataObject {
|
|
98
|
+
}
|
|
99
|
+
exports.LegacyDataObject = LegacyDataObject;
|
|
84
100
|
//# sourceMappingURL=dataObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataObject.js","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"dataObject.js","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,6CAAoF;AACpF,iEAAiF;AACjF,qDAAkD;AAGlD;;;;;;;;;GASG;AACH,MAAsB,UAAwD,SAAQ,+BAAiB;IAAvG;;QAGqB,oBAAe,GAAG,MAAM,CAAC;IA2D9C,CAAC;IAzDU,KAAK,CAAC,OAAO,CAAC,OAAiB;QAClC,MAAM,aAAa,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QA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AE,eAAe;oBAC1B,OAAO,EAAE,6EAA6E;iBACzF,CAAC,CAAC;aACN;SACJ;QAED,MAAM,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAES,2BAA2B,CAAC,IAAY;QAC9C,OAAO,GAAG,IAAI,6CAA6C,CAAC;IAChE,CAAC;CACJ;AA9DD,gCA8DC;AAED;;;;;;;;;;;;;;GAcG;AACH,wDAAwD;AACxD,MAAsB,gBAClB,SAAQ,UAA8D;CAErE;AAHL,4CAGK","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent } from \"@fluidframework/common-definitions\";\nimport {\n IFluidObject,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { ISharedDirectory, MapFactory, SharedDirectory } from \"@fluidframework/map\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\nimport { PureDataObject } from \"./pureDataObject\";\nimport { DataObjectTypes } from \"./types\";\n\n/**\n * DataObject is a base data store that is primed with a root directory. It\n * ensures that it is created and ready before you can access it.\n *\n * Having a single root directory allows for easier development. Instead of creating\n * and registering channels with the runtime any new DDS that is set on the root\n * will automatically be registered.\n *\n * @typeParam I - The optional input types used to strongly type the data object\n */\nexport abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> extends PureDataObject<I>\n{\n private internalRoot: ISharedDirectory | undefined;\n private readonly rootDirectoryId = \"root\";\n\n public async request(request: IRequest): Promise<IResponse> {\n const requestParser = RequestParser.create(request);\n const itemId = requestParser.pathParts[0];\n if (itemId === \"bigBlobs\") {\n const value = this.root.get<string>(requestParser.pathParts.join(\"/\"));\n if (value === undefined) {\n return create404Response(requestParser);\n }\n return { mimeType: \"fluid/object\", status: 200, value };\n } else {\n return super.request(requestParser);\n }\n }\n\n /**\n * The root directory will either be ready or will return an error. If an error is thrown\n * the root has not been correctly created/set.\n */\n protected get root(): ISharedDirectory {\n if (!this.internalRoot) {\n throw new Error(this.getUninitializedErrorString(`root`));\n }\n\n return this.internalRoot;\n }\n\n /**\n * Initializes internal objects and calls initialization overrides.\n * Caller is responsible for ensuring this is only invoked once.\n */\n public async initializeInternal(existing: boolean): Promise<void> {\n if (!existing) {\n // Create a root directory and register it before calling initializingFirstTime\n this.internalRoot = SharedDirectory.create(this.runtime, this.rootDirectoryId);\n this.internalRoot.bindToContext();\n } else {\n // data store has a root directory so we just need to set it before calling initializingFromExisting\n this.internalRoot = await this.runtime.getChannel(this.rootDirectoryId) as ISharedDirectory;\n\n // This will actually be an ISharedMap if the channel was previously created by the older version of\n // DataObject which used a SharedMap. Since SharedMap and SharedDirectory are compatible unless\n // SharedDirectory-only commands are used on SharedMap, this will mostly just work for compatibility.\n if (this.internalRoot.attributes.type === MapFactory.Type) {\n this.runtime.logger.send({\n category: \"generic\",\n eventName: \"MapDataObject\",\n message: \"Legacy document, SharedMap is masquerading as SharedDirectory in DataObject\",\n });\n }\n }\n\n await super.initializeInternal(existing);\n }\n\n protected getUninitializedErrorString(item: string) {\n return `${item} must be initialized before being accessed.`;\n }\n}\n\n/**\n * @deprecated - This type is meant to ease the transition from the old DataObject type to the new.\n * please migrate to DataObject.\n *\n * DataObject is a base data store that is primed with a root directory. It\n * ensures that it is created and ready before you can access it.\n *\n * Having a single root directory allows for easier development. Instead of creating\n * and registering channels with the runtime any new DDS that is set on the root\n * will automatically be registered.\n *\n * @typeParam O - represents a type that will define optional providers that will be injected\n * @typeParam S - the initial state type that the produced data object may take during creation\n * @typeParam E - represents events that will be available in the EventForwarder\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport abstract class LegacyDataObject<O extends IFluidObject = object, S = undefined, E extends IEvent = IEvent>\n extends DataObject<{OptionalProviders: O, InitialState: S, Events: E}> {\n\n }\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { DataObject } from "./dataObject";
|
|
6
|
-
export {
|
|
5
|
+
export { DataObject, LegacyDataObject } from "./dataObject";
|
|
6
|
+
export { PureDataObject, LegacyPureDataObject } from "./pureDataObject";
|
|
7
|
+
export { DataObjectTypes, DataObjectType, IDataObjectProps } from "./types";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.PureDataObject = exports.DataObject = void 0;
|
|
7
|
+
exports.LegacyPureDataObject = exports.PureDataObject = exports.LegacyDataObject = exports.DataObject = void 0;
|
|
8
8
|
var dataObject_1 = require("./dataObject");
|
|
9
9
|
Object.defineProperty(exports, "DataObject", { enumerable: true, get: function () { return dataObject_1.DataObject; } });
|
|
10
|
+
Object.defineProperty(exports, "LegacyDataObject", { enumerable: true, get: function () { return dataObject_1.LegacyDataObject; } });
|
|
10
11
|
var pureDataObject_1 = require("./pureDataObject");
|
|
11
12
|
Object.defineProperty(exports, "PureDataObject", { enumerable: true, get: function () { return pureDataObject_1.PureDataObject; } });
|
|
13
|
+
Object.defineProperty(exports, "LegacyPureDataObject", { enumerable: true, get: function () { return pureDataObject_1.LegacyPureDataObject; } });
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAA4D;AAAnD,wGAAA,UAAU,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACrC,mDAAwE;AAA/D,gHAAA,cAAc,OAAA;AAAE,sHAAA,oBAAoB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObject, LegacyDataObject } from \"./dataObject\";\nexport { PureDataObject, LegacyPureDataObject } from \"./pureDataObject\";\nexport { DataObjectTypes, DataObjectType, IDataObjectProps } from \"./types\";\n"]}
|
|
@@ -9,22 +9,15 @@ import { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
|
9
9
|
import { IDirectory } from "@fluidframework/map";
|
|
10
10
|
import { EventForwarder } from "@fluidframework/common-utils";
|
|
11
11
|
import { IEvent } from "@fluidframework/common-definitions";
|
|
12
|
-
|
|
13
|
-
readonly runtime: IFluidDataStoreRuntime;
|
|
14
|
-
readonly context: IFluidDataStoreContext;
|
|
15
|
-
readonly providers: AsyncFluidObjectProvider<FluidObjectKey<O>, FluidObjectKey<object>>;
|
|
16
|
-
readonly initProps?: S;
|
|
17
|
-
}
|
|
12
|
+
import { DataObjectTypes, DataObjectType, IDataObjectProps } from "./types";
|
|
18
13
|
/**
|
|
19
14
|
* This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
|
|
20
15
|
* You probably don't want to inherit from this data store directly unless
|
|
21
16
|
* you are creating another base data store class
|
|
22
17
|
*
|
|
23
|
-
* @typeParam
|
|
24
|
-
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
25
|
-
* @typeParam E - represents events that will be available in the EventForwarder
|
|
18
|
+
* @typeParam I - The optional input types used to strongly type the data object
|
|
26
19
|
*/
|
|
27
|
-
export declare abstract class PureDataObject<
|
|
20
|
+
export declare abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes> extends EventForwarder<DataObjectType<I, "Events">> implements IFluidLoadable, IFluidRouter, IProvideFluidHandle, IFluidObject {
|
|
28
21
|
private readonly innerHandle;
|
|
29
22
|
private _disposed;
|
|
30
23
|
/**
|
|
@@ -42,8 +35,8 @@ export declare abstract class PureDataObject<O extends IFluidObject = object, S
|
|
|
42
35
|
*
|
|
43
36
|
* To define providers set IFluidObject interfaces in the generic O type for your data store
|
|
44
37
|
*/
|
|
45
|
-
protected readonly providers: AsyncFluidObjectProvider<FluidObjectKey<
|
|
46
|
-
protected initProps?:
|
|
38
|
+
protected readonly providers: AsyncFluidObjectProvider<FluidObjectKey<DataObjectType<I, "OptionalProviders">>, FluidObjectKey<object>>;
|
|
39
|
+
protected initProps?: DataObjectType<I, "InitialState">;
|
|
47
40
|
protected initializeP: Promise<void> | undefined;
|
|
48
41
|
get disposed(): boolean;
|
|
49
42
|
get id(): string;
|
|
@@ -54,8 +47,8 @@ export declare abstract class PureDataObject<O extends IFluidObject = object, S
|
|
|
54
47
|
* Handle to a data store
|
|
55
48
|
*/
|
|
56
49
|
get handle(): IFluidHandle<this>;
|
|
57
|
-
static getDataObject(runtime: IFluidDataStoreRuntime): Promise<PureDataObject<
|
|
58
|
-
constructor(props: IDataObjectProps<
|
|
50
|
+
static getDataObject(runtime: IFluidDataStoreRuntime): Promise<PureDataObject<DataObjectTypes>>;
|
|
51
|
+
constructor(props: IDataObjectProps<I>);
|
|
59
52
|
/**
|
|
60
53
|
* Return this object if someone requests it directly
|
|
61
54
|
* We will return this object in two scenarios:
|
|
@@ -110,7 +103,7 @@ export declare abstract class PureDataObject<O extends IFluidObject = object, S
|
|
|
110
103
|
*
|
|
111
104
|
* @param props - Optional props to be passed in on create
|
|
112
105
|
*/
|
|
113
|
-
protected initializingFirstTime(props?:
|
|
106
|
+
protected initializingFirstTime(props?: DataObjectType<I, "InitialState">): Promise<void>;
|
|
114
107
|
/**
|
|
115
108
|
* Called every time but the first time the data store is initialized (creations
|
|
116
109
|
* with an existing data store runtime)
|
|
@@ -125,4 +118,22 @@ export declare abstract class PureDataObject<O extends IFluidObject = object, S
|
|
|
125
118
|
*/
|
|
126
119
|
dispose(): void;
|
|
127
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated - This type is meant to ease the transition from the old PureDataObject type to the new.
|
|
123
|
+
* please migrate to PureDataObject.
|
|
124
|
+
*
|
|
125
|
+
* This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
|
|
126
|
+
* You probably don't want to inherit from this data store directly unless
|
|
127
|
+
* you are creating another base data store class
|
|
128
|
+
*
|
|
129
|
+
* @typeParam O - represents a type that will define optional providers that will be injected
|
|
130
|
+
* @typeParam S - the initial state type that the produced data object may take during creation
|
|
131
|
+
* @typeParam E - represents events that will be available in the EventForwarder
|
|
132
|
+
*/
|
|
133
|
+
export declare abstract class LegacyPureDataObject<O extends IFluidObject = object, S = undefined, E extends IEvent = IEvent> extends PureDataObject<{
|
|
134
|
+
OptionalProviders: O;
|
|
135
|
+
InitialState: S;
|
|
136
|
+
Events: E;
|
|
137
|
+
}> {
|
|
138
|
+
}
|
|
128
139
|
//# sourceMappingURL=pureDataObject.d.ts.map
|