@fluidframework/aqueduct 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/aqueduct-alpha.d.ts +396 -0
- package/dist/aqueduct-beta.d.ts +146 -0
- package/dist/aqueduct-public.d.ts +146 -0
- package/dist/aqueduct-untrimmed.d.ts +459 -0
- package/dist/container-runtime-factories/{baseContainerRuntimeFactory.js → baseContainerRuntimeFactory.cjs} +2 -2
- package/dist/container-runtime-factories/{baseContainerRuntimeFactory.js.map → baseContainerRuntimeFactory.cjs.map} +1 -1
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +1 -1
- package/dist/container-runtime-factories/{containerRuntimeFactoryWithDefaultDataStore.js → containerRuntimeFactoryWithDefaultDataStore.cjs} +4 -4
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs.map +1 -0
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +1 -1
- package/dist/container-runtime-factories/{index.js → index.cjs} +3 -3
- package/dist/container-runtime-factories/index.cjs.map +1 -0
- package/dist/data-object-factories/{dataObjectFactory.js → dataObjectFactory.cjs} +3 -3
- package/dist/data-object-factories/dataObjectFactory.cjs.map +1 -0
- package/dist/data-object-factories/dataObjectFactory.d.ts +1 -1
- package/dist/data-object-factories/{index.js → index.cjs} +3 -3
- package/dist/data-object-factories/index.cjs.map +1 -0
- package/dist/data-object-factories/{pureDataObjectFactory.js → pureDataObjectFactory.cjs} +2 -2
- package/dist/data-object-factories/pureDataObjectFactory.cjs.map +1 -0
- package/dist/data-object-factories/pureDataObjectFactory.d.ts +3 -2
- package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
- package/dist/data-objects/{dataObject.js → dataObject.cjs} +3 -3
- package/dist/data-objects/{dataObject.js.map → dataObject.cjs.map} +1 -1
- package/dist/data-objects/dataObject.d.ts +1 -1
- package/dist/data-objects/{index.js → index.cjs} +3 -3
- package/dist/data-objects/index.cjs.map +1 -0
- package/dist/data-objects/{pureDataObject.js → pureDataObject.cjs} +2 -2
- package/dist/data-objects/{pureDataObject.js.map → pureDataObject.cjs.map} +1 -1
- package/dist/data-objects/pureDataObject.d.ts +1 -1
- package/dist/data-objects/{types.js → types.cjs} +1 -1
- package/dist/data-objects/types.cjs.map +1 -0
- package/dist/data-objects/types.d.ts +2 -2
- package/dist/{index.js → index.cjs} +6 -6
- package/dist/index.cjs.map +1 -0
- package/dist/request-handlers/{index.js → index.cjs} +2 -2
- package/dist/request-handlers/index.cjs.map +1 -0
- package/dist/request-handlers/{requestHandlers.js → requestHandlers.cjs} +4 -4
- package/dist/request-handlers/requestHandlers.cjs.map +1 -0
- package/dist/request-handlers/requestHandlers.d.ts +3 -3
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/utils/{containerInteractions.js → containerInteractions.cjs} +4 -4
- package/dist/utils/containerInteractions.cjs.map +1 -0
- package/dist/utils/containerInteractions.d.ts +3 -3
- package/dist/utils/{index.js → index.cjs} +2 -2
- package/dist/utils/index.cjs.map +1 -0
- package/lib/aqueduct-alpha.d.ts +396 -0
- package/lib/aqueduct-beta.d.ts +146 -0
- package/lib/aqueduct-public.d.ts +146 -0
- package/lib/aqueduct-untrimmed.d.ts +459 -0
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts +59 -0
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -0
- package/lib/container-runtime-factories/{baseContainerRuntimeFactory.js → baseContainerRuntimeFactory.mjs} +2 -3
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.mjs.map +1 -0
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +45 -0
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -0
- package/lib/container-runtime-factories/{containerRuntimeFactoryWithDefaultDataStore.js → containerRuntimeFactoryWithDefaultDataStore.mjs} +4 -5
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs.map +1 -0
- package/lib/container-runtime-factories/index.d.ts +7 -0
- package/lib/container-runtime-factories/index.d.ts.map +1 -0
- package/lib/container-runtime-factories/{index.js → index.mjs} +3 -3
- package/lib/container-runtime-factories/index.mjs.map +1 -0
- package/lib/data-object-factories/dataObjectFactory.d.ts +23 -0
- package/lib/data-object-factories/dataObjectFactory.d.ts.map +1 -0
- package/lib/data-object-factories/{dataObjectFactory.js → dataObjectFactory.mjs} +3 -3
- package/lib/data-object-factories/dataObjectFactory.mjs.map +1 -0
- package/lib/data-object-factories/index.d.ts +7 -0
- package/lib/data-object-factories/index.d.ts.map +1 -0
- package/lib/data-object-factories/index.mjs +7 -0
- package/lib/data-object-factories/index.mjs.map +1 -0
- package/lib/data-object-factories/pureDataObjectFactory.d.ts +100 -0
- package/lib/data-object-factories/pureDataObjectFactory.d.ts.map +1 -0
- package/lib/data-object-factories/{pureDataObjectFactory.js → pureDataObjectFactory.mjs} +2 -2
- package/lib/data-object-factories/pureDataObjectFactory.mjs.map +1 -0
- package/lib/data-objects/dataObject.d.ts +38 -0
- package/lib/data-objects/dataObject.d.ts.map +1 -0
- package/lib/data-objects/{dataObject.js → dataObject.mjs} +3 -3
- package/lib/data-objects/dataObject.mjs.map +1 -0
- package/lib/data-objects/index.d.ts +8 -0
- package/lib/data-objects/index.d.ts.map +1 -0
- package/lib/data-objects/index.mjs +7 -0
- package/lib/data-objects/index.mjs.map +1 -0
- package/lib/data-objects/pureDataObject.d.ts +98 -0
- package/lib/data-objects/pureDataObject.d.ts.map +1 -0
- package/lib/data-objects/{pureDataObject.js → pureDataObject.mjs} +2 -2
- package/lib/data-objects/pureDataObject.mjs.map +1 -0
- package/lib/data-objects/types.d.ts +36 -0
- package/lib/data-objects/types.d.ts.map +1 -0
- package/lib/data-objects/{types.js → types.mjs} +1 -1
- package/lib/data-objects/types.mjs.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.mjs +10 -0
- package/lib/index.mjs.map +1 -0
- package/lib/request-handlers/index.d.ts +6 -0
- package/lib/request-handlers/index.d.ts.map +1 -0
- package/lib/request-handlers/{index.js → index.mjs} +2 -2
- package/lib/request-handlers/index.mjs.map +1 -0
- package/lib/request-handlers/requestHandlers.d.ts +46 -0
- package/lib/request-handlers/requestHandlers.d.ts.map +1 -0
- package/lib/request-handlers/{requestHandlers.js → requestHandlers.mjs} +4 -5
- package/lib/request-handlers/requestHandlers.mjs.map +1 -0
- package/lib/utils/containerInteractions.d.ts +38 -0
- package/lib/utils/containerInteractions.d.ts.map +1 -0
- package/lib/utils/{containerInteractions.js → containerInteractions.mjs} +4 -4
- package/lib/utils/containerInteractions.mjs.map +1 -0
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/{index.js → index.mjs} +2 -2
- package/lib/utils/index.mjs.map +1 -0
- package/package.json +55 -36
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +0 -1
- package/dist/container-runtime-factories/index.js.map +0 -1
- package/dist/data-object-factories/dataObjectFactory.js.map +0 -1
- package/dist/data-object-factories/index.js.map +0 -1
- package/dist/data-object-factories/pureDataObjectFactory.js.map +0 -1
- package/dist/data-objects/index.js.map +0 -1
- package/dist/data-objects/types.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/request-handlers/index.js.map +0 -1
- package/dist/request-handlers/requestHandlers.js.map +0 -1
- package/dist/utils/containerInteractions.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.js.map +0 -1
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +0 -1
- package/lib/container-runtime-factories/index.js.map +0 -1
- package/lib/data-object-factories/dataObjectFactory.js.map +0 -1
- package/lib/data-object-factories/index.js +0 -7
- package/lib/data-object-factories/index.js.map +0 -1
- package/lib/data-object-factories/pureDataObjectFactory.js.map +0 -1
- package/lib/data-objects/dataObject.js.map +0 -1
- package/lib/data-objects/index.js +0 -7
- package/lib/data-objects/index.js.map +0 -1
- package/lib/data-objects/pureDataObject.js.map +0 -1
- package/lib/data-objects/types.js.map +0 -1
- package/lib/index.js +0 -24
- package/lib/index.js.map +0 -1
- package/lib/request-handlers/index.js.map +0 -1
- package/lib/request-handlers/requestHandlers.js.map +0 -1
- package/lib/utils/containerInteractions.js.map +0 -1
- package/lib/utils/index.js.map +0 -1
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ContainerRuntimeFactoryWithDefaultDataStore = void 0;
|
|
8
8
|
// eslint-disable-next-line import/no-deprecated
|
|
9
|
-
const request_handlers_1 = require("../request-handlers");
|
|
10
|
-
const baseContainerRuntimeFactory_1 = require("./baseContainerRuntimeFactory");
|
|
9
|
+
const request_handlers_1 = require("../request-handlers/index.cjs");
|
|
10
|
+
const baseContainerRuntimeFactory_1 = require("./baseContainerRuntimeFactory.cjs");
|
|
11
11
|
const defaultDataStoreId = "default";
|
|
12
12
|
const getDefaultFluidObject = async (runtime) => {
|
|
13
13
|
const entryPoint = await runtime.getAliasedDataStoreEntryPoint("default");
|
|
@@ -21,7 +21,7 @@ const getDefaultFluidObject = async (runtime) => {
|
|
|
21
21
|
* the container with an empty URL.
|
|
22
22
|
*
|
|
23
23
|
* This factory should be exposed as fluidExport off the entry point to your module.
|
|
24
|
-
* @
|
|
24
|
+
* @alpha
|
|
25
25
|
*/
|
|
26
26
|
class ContainerRuntimeFactoryWithDefaultDataStore extends baseContainerRuntimeFactory_1.BaseContainerRuntimeFactory {
|
|
27
27
|
/**
|
|
@@ -54,4 +54,4 @@ class ContainerRuntimeFactoryWithDefaultDataStore extends baseContainerRuntimeFa
|
|
|
54
54
|
}
|
|
55
55
|
exports.ContainerRuntimeFactoryWithDefaultDataStore = ContainerRuntimeFactoryWithDefaultDataStore;
|
|
56
56
|
ContainerRuntimeFactoryWithDefaultDataStore.defaultDataStoreId = defaultDataStoreId;
|
|
57
|
-
//# sourceMappingURL=containerRuntimeFactoryWithDefaultDataStore.
|
|
57
|
+
//# sourceMappingURL=containerRuntimeFactoryWithDefaultDataStore.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerRuntimeFactoryWithDefaultDataStore.cjs","sourceRoot":"","sources":["../../src/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,gDAAgD;AAChD,oEAAiE;AACjE,mFAA4E;AAE5E,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAErC,MAAM,qBAAqB,GAAG,KAAK,EAAE,OAA0B,EAAE,EAAE;IAClE,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC;IAC1E,IAAI,UAAU,KAAK,SAAS,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;KAChD;IACD,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAa,2CAA4C,SAAQ,yDAA2B;IAK3F;;;;;;;;OAQG;IACH,YAAY,KAQX;QACA,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC;QACpD,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,IAAI,qBAAqB,CAAC;QAE3E,KAAK,CAAC;YACL,GAAG,KAAK;YACR,gDAAgD;YAChD,eAAe,EAAE,CAAC,IAAA,6CAA0B,EAAC,kBAAkB,CAAC,EAAE,GAAG,eAAe,CAAC;YACrF,iBAAiB;SACjB,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;IAC5C,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1E,MAAM,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACjD,CAAC;;AA1CF,kGA2CC;AA1CuB,8DAAkB,GAAG,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport {\n\tIFluidDataStoreFactory,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IFluidDependencySynthesizer } from \"@fluidframework/synthesize\";\nimport { RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\n// eslint-disable-next-line import/no-deprecated\nimport { defaultRouteRequestHandler } from \"../request-handlers\";\nimport { BaseContainerRuntimeFactory } from \"./baseContainerRuntimeFactory\";\n\nconst defaultDataStoreId = \"default\";\n\nconst getDefaultFluidObject = async (runtime: IContainerRuntime) => {\n\tconst entryPoint = await runtime.getAliasedDataStoreEntryPoint(\"default\");\n\tif (entryPoint === undefined) {\n\t\tthrow new Error(\"default dataStore must exist\");\n\t}\n\treturn entryPoint.get();\n};\n\n/**\n * A ContainerRuntimeFactory that initializes Containers with a single default data store, which can be requested from\n * the container with an empty URL.\n *\n * This factory should be exposed as fluidExport off the entry point to your module.\n * @alpha\n */\nexport class ContainerRuntimeFactoryWithDefaultDataStore extends BaseContainerRuntimeFactory {\n\tpublic static readonly defaultDataStoreId = defaultDataStoreId;\n\n\tprotected readonly defaultFactory: IFluidDataStoreFactory;\n\n\t/**\n\t * Constructor\n\t * @param defaultFactory -\n\t * @param registryEntries -\n\t * @param dependencyContainer - deprecated, will be removed in a future release\n\t * @param requestHandlers -\n\t * @param runtimeOptions -\n\t * @param provideEntryPoint -\n\t */\n\tconstructor(props: {\n\t\tdefaultFactory: IFluidDataStoreFactory;\n\t\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t\tdependencyContainer?: IFluidDependencySynthesizer;\n\t\t/** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md */\n\t\trequestHandlers?: RuntimeRequestHandler[];\n\t\truntimeOptions?: IContainerRuntimeOptions;\n\t\tprovideEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\t}) {\n\t\tconst requestHandlers = props.requestHandlers ?? [];\n\t\tconst provideEntryPoint = props.provideEntryPoint ?? getDefaultFluidObject;\n\n\t\tsuper({\n\t\t\t...props,\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\trequestHandlers: [defaultRouteRequestHandler(defaultDataStoreId), ...requestHandlers],\n\t\t\tprovideEntryPoint,\n\t\t});\n\n\t\tthis.defaultFactory = props.defaultFactory;\n\t}\n\n\t/**\n\t * {@inheritDoc BaseContainerRuntimeFactory.containerInitializingFirstTime}\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime) {\n\t\tconst dataStore = await runtime.createDataStore(this.defaultFactory.type);\n\t\tawait dataStore.trySetAlias(defaultDataStoreId);\n\t}\n}\n"]}
|
|
@@ -14,7 +14,7 @@ import { BaseContainerRuntimeFactory } from "./baseContainerRuntimeFactory";
|
|
|
14
14
|
* the container with an empty URL.
|
|
15
15
|
*
|
|
16
16
|
* This factory should be exposed as fluidExport off the entry point to your module.
|
|
17
|
-
* @
|
|
17
|
+
* @alpha
|
|
18
18
|
*/
|
|
19
19
|
export declare class ContainerRuntimeFactoryWithDefaultDataStore extends BaseContainerRuntimeFactory {
|
|
20
20
|
static readonly defaultDataStoreId = "default";
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ContainerRuntimeFactoryWithDefaultDataStore = exports.BaseContainerRuntimeFactory = void 0;
|
|
8
|
-
var baseContainerRuntimeFactory_1 = require("./baseContainerRuntimeFactory");
|
|
8
|
+
var baseContainerRuntimeFactory_1 = require("./baseContainerRuntimeFactory.cjs");
|
|
9
9
|
Object.defineProperty(exports, "BaseContainerRuntimeFactory", { enumerable: true, get: function () { return baseContainerRuntimeFactory_1.BaseContainerRuntimeFactory; } });
|
|
10
|
-
var containerRuntimeFactoryWithDefaultDataStore_1 = require("./containerRuntimeFactoryWithDefaultDataStore");
|
|
10
|
+
var containerRuntimeFactoryWithDefaultDataStore_1 = require("./containerRuntimeFactoryWithDefaultDataStore.cjs");
|
|
11
11
|
Object.defineProperty(exports, "ContainerRuntimeFactoryWithDefaultDataStore", { enumerable: true, get: function () { return containerRuntimeFactoryWithDefaultDataStore_1.ContainerRuntimeFactoryWithDefaultDataStore; } });
|
|
12
|
-
//# sourceMappingURL=index.
|
|
12
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/container-runtime-factories/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AACpC,iHAA4G;AAAnG,0KAAA,2CAA2C,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { BaseContainerRuntimeFactory } from \"./baseContainerRuntimeFactory\";\nexport { ContainerRuntimeFactoryWithDefaultDataStore } from \"./containerRuntimeFactoryWithDefaultDataStore\";\n"]}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.DataObjectFactory = void 0;
|
|
8
8
|
const map_1 = require("@fluidframework/map");
|
|
9
9
|
const datastore_1 = require("@fluidframework/datastore");
|
|
10
|
-
const pureDataObjectFactory_1 = require("./pureDataObjectFactory");
|
|
10
|
+
const pureDataObjectFactory_1 = require("./pureDataObjectFactory.cjs");
|
|
11
11
|
/**
|
|
12
12
|
* DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
|
|
13
13
|
* It facilitates DataObject's features (such as its shared directory) by
|
|
@@ -15,7 +15,7 @@ const pureDataObjectFactory_1 = require("./pureDataObjectFactory");
|
|
|
15
15
|
*
|
|
16
16
|
* @typeParam TObj - DataObject (concrete type)
|
|
17
17
|
* @typeParam I - The input types for the DataObject
|
|
18
|
-
* @
|
|
18
|
+
* @alpha
|
|
19
19
|
*/
|
|
20
20
|
class DataObjectFactory extends pureDataObjectFactory_1.PureDataObjectFactory {
|
|
21
21
|
constructor(type, ctor, sharedObjects = [], optionalProviders, registryEntries, runtimeFactory = datastore_1.FluidDataStoreRuntime) {
|
|
@@ -33,4 +33,4 @@ class DataObjectFactory extends pureDataObjectFactory_1.PureDataObjectFactory {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.DataObjectFactory = DataObjectFactory;
|
|
36
|
-
//# sourceMappingURL=dataObjectFactory.
|
|
36
|
+
//# sourceMappingURL=dataObjectFactory.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataObjectFactory.cjs","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAA+F;AAI/F,yDAAkE;AAGlE,uEAAgE;AAEhE;;;;;;;;GAQG;AACH,MAAa,iBAGX,SAAQ,6CAA8B;IACvC,YACC,IAAY,EACZ,IAA8C,EAC9C,gBAA4C,EAAE,EAC9C,iBAAoE,EACpE,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;YAC7E,sCAAsC;YACtC,aAAa,CAAC,IAAI,CAAC,qBAAe,CAAC,UAAU,EAAE,CAAC,CAAC;SACjD;QAED,0GAA0G;QAC1G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,gBAAU,CAAC,IAAI,CAAC,EAAE;YACvE,gCAAgC;YAChC,aAAa,CAAC,IAAI,CAAC,eAAS,CAAC,UAAU,EAAE,CAAC,CAAC;SAC3C;QAED,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;IACtF,CAAC;CACD;AA3BD,8CA2BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DirectoryFactory, MapFactory, SharedDirectory, SharedMap } from \"@fluidframework/map\";\nimport { NamedFluidDataStoreRegistryEntries } from \"@fluidframework/runtime-definitions\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { FluidObjectSymbolProvider } from \"@fluidframework/synthesize\";\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore\";\n\nimport { DataObject, DataObjectTypes, IDataObjectProps } 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 * @alpha\n */\nexport class DataObjectFactory<\n\tTObj extends DataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObjectFactory<TObj, I> {\n\tconstructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeFactory: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tconst mergedObjects = [...sharedObjects];\n\n\t\tif (!sharedObjects.find((factory) => factory.type === DirectoryFactory.Type)) {\n\t\t\t// User did not register for directory\n\t\t\tmergedObjects.push(SharedDirectory.getFactory());\n\t\t}\n\n\t\t// TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10\n\t\tif (!sharedObjects.find((factory) => factory.type === MapFactory.Type)) {\n\t\t\t// User did not register for map\n\t\t\tmergedObjects.push(SharedMap.getFactory());\n\t\t}\n\n\t\tsuper(type, ctor, mergedObjects, optionalProviders, registryEntries, runtimeFactory);\n\t}\n}\n"]}
|
|
@@ -15,7 +15,7 @@ import { PureDataObjectFactory } from "./pureDataObjectFactory";
|
|
|
15
15
|
*
|
|
16
16
|
* @typeParam TObj - DataObject (concrete type)
|
|
17
17
|
* @typeParam I - The input types for the DataObject
|
|
18
|
-
* @
|
|
18
|
+
* @alpha
|
|
19
19
|
*/
|
|
20
20
|
export declare class DataObjectFactory<TObj extends DataObject<I>, I extends DataObjectTypes = DataObjectTypes> extends PureDataObjectFactory<TObj, I> {
|
|
21
21
|
constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[] | undefined, optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.PureDataObjectFactory = exports.DataObjectFactory = void 0;
|
|
8
|
-
var dataObjectFactory_1 = require("./dataObjectFactory");
|
|
8
|
+
var dataObjectFactory_1 = require("./dataObjectFactory.cjs");
|
|
9
9
|
Object.defineProperty(exports, "DataObjectFactory", { enumerable: true, get: function () { return dataObjectFactory_1.DataObjectFactory; } });
|
|
10
|
-
var pureDataObjectFactory_1 = require("./pureDataObjectFactory");
|
|
10
|
+
var pureDataObjectFactory_1 = require("./pureDataObjectFactory.cjs");
|
|
11
11
|
Object.defineProperty(exports, "PureDataObjectFactory", { enumerable: true, get: function () { return pureDataObjectFactory_1.PureDataObjectFactory; } });
|
|
12
|
-
//# sourceMappingURL=index.
|
|
12
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/data-object-factories/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAC1B,qEAAwF;AAAvD,8HAAA,qBAAqB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObjectFactory } from \"./dataObjectFactory\";\nexport { IRootDataObjectFactory, PureDataObjectFactory } from \"./pureDataObjectFactory\";\n"]}
|
|
@@ -65,7 +65,7 @@ async function createDataObject(ctor, context, sharedObjectRegistry, optionalPro
|
|
|
65
65
|
*
|
|
66
66
|
* @typeParam TObj - DataObject (concrete type)
|
|
67
67
|
* @typeParam I - The input types for the DataObject
|
|
68
|
-
* @
|
|
68
|
+
* @alpha
|
|
69
69
|
*/
|
|
70
70
|
class PureDataObjectFactory {
|
|
71
71
|
constructor(type, ctor, sharedObjects, optionalProviders, registryEntries, runtimeClass = datastore_1.FluidDataStoreRuntime) {
|
|
@@ -171,4 +171,4 @@ class PureDataObjectFactory {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
exports.PureDataObjectFactory = PureDataObjectFactory;
|
|
174
|
-
//# sourceMappingURL=pureDataObjectFactory.
|
|
174
|
+
//# sourceMappingURL=pureDataObjectFactory.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pureDataObjectFactory.cjs","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,yDAImC;AACnC,yEAA2E;AAmB3E,2DAAoD;AAYpD;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAI9B,IAA8C,EAC9C,OAA+B,EAC/B,oBAA2C,EAC3C,iBAAoE,EACpE,eAA6C,EAC7C,QAAiB,EACjB,SAA6B;IAE7B,OAAO;IACP,IAAI,YAAY,GAAG,eAAe,CAAC;IAEnC,mBAAmB;IACnB,YAAY,GAAG,IAAA,+BAAmB,EACjC,KAAK,EAAE,OAAiB,EAAE,UAAiC,EAAE,EAAE;QAC9D,iFAAiF;QACjF,MAAM,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,CAAS,CAAC;QAC/D,IAAA,mBAAM,EACL,UAAU,CAAC,OAAO,KAAK,SAAS,EAChC,KAAK,CAAC,yDAAyD,CAC/D,CAAC;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,EACD,YAAY,CACZ,CAAC;IAEF,gFAAgF;IAChF,+DAA+D;IAC/D,6EAA6E;IAC7E,MAAM,OAAO,GAA0B,IAAI,YAAY,CAAE,uCAAuC;IAC/F,OAAO,EACP,oBAAoB,EACpB,QAAQ,EACR,KAAK,EAAE,EAA0B,EAAE,EAAE;QACpC,IAAA,mBAAM,EAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACpE,sGAAsG;QACtG,yGAAyG;QACzG,oFAAoF;QACpF,MAAM,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC,uBAAuB,CACzB,CAAC;IAEF,4BAA4B;IAC5B,+EAA+E;IAC/E,mFAAmF;IACnF,kFAAkF;IAClF,uGAAuG;IACvG,MAAM,K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1B,YAAgC;QAEhC,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;IACvD,CAAC;IAES,KAAK,CAAC,yBAAyB,CACxC,gBAAuC,EACvC,WAA+B,EAC/B,YAAgC;QAEhC,MAAM,OAAO,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,kBAAkB,CACjC,OAAuC,EACvC,YAAgC;QAEhC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CACnD,IAAI,CAAC,IAAI,EACT,OAAO,EACP,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,YAAY,EACjB,KAAK,EAAE,WAAW;QAClB,YAAY,CACZ,CAAC;QAEF,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AA3KD,sDA2KC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-deprecated\nimport { IRequest, IFluidRouter, FluidObject } from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidDataStoreRuntime,\n\tISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore\";\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime\";\nimport {\n\tIFluidDataStoreContext,\n\tIContainerRuntimeBase,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n\tIFluidDataStoreContextDetached,\n} from \"@fluidframework/runtime-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IChannelFactory, IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize\";\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDataObjectProps, PureDataObject, DataObjectTypes } from \"../data-objects\";\n/**\n * Useful interface in places where it's useful to do type erasure for PureDataObject generic\n * @deprecated Will be removed in future major release. Please remove all usage of it.\n * @alpha\n */\nexport interface IRootDataObjectFactory extends IFluidDataStoreFactory {\n\t// eslint-disable-next-line import/no-deprecated\n\tcreateRootInstance(rootDataStoreId: string, runtime: IContainerRuntime): Promise<IFluidRouter>;\n}\n\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>(\n\tctor: new (props: IDataObjectProps<I>) => TObj,\n\tcontext: IFluidDataStoreContext,\n\tsharedObjectRegistry: ISharedObjectRegistry,\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\truntimeClassArg: typeof FluidDataStoreRuntime,\n\texisting: boolean,\n\tinitProps?: I[\"InitialState\"],\n) {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass( // calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { 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 * @alpha\n */\nexport class PureDataObjectFactory<\n\t\tTObj extends PureDataObject<I>,\n\t\tI extends DataObjectTypes = DataObjectTypes,\n\t>\n\timplements\n\t\tIFluidDataStoreFactory,\n\t\tPartial<IProvideFluidDataStoreRegistry>,\n\t\tIRootDataObjectFactory\n{\n\tprivate readonly sharedObjectRegistry: ISharedObjectRegistry;\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\n\tconstructor(\n\t\tpublic readonly type: string,\n\t\tprivate readonly ctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[],\n\t\tprivate readonly optionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tprivate readonly runtimeClass: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tif (this.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tif (registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(registryEntries);\n\t\t}\n\t\tthis.sharedObjectRegistry = new Map(sharedObjects.map((ext) => [ext.type, ext]));\n\t}\n\n\tpublic get IFluidDataStoreFactory() {\n\t\treturn this;\n\t}\n\n\tpublic get IFluidDataStoreRegistry() {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * This is where we do data store setup.\n\t *\n\t * @param context - data store context used to load a data store runtime\n\t */\n\tpublic async instantiateDataStore(context: IFluidDataStoreContext, existing: boolean) {\n\t\tconst { runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\texisting,\n\t\t);\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState);\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedRootDataStore([this.type], rootDataStoreId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: Readonly<string[]>,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
|
|
@@ -11,7 +11,8 @@ import { FluidObjectSymbolProvider } from "@fluidframework/synthesize";
|
|
|
11
11
|
import { IDataObjectProps, PureDataObject, DataObjectTypes } from "../data-objects";
|
|
12
12
|
/**
|
|
13
13
|
* Useful interface in places where it's useful to do type erasure for PureDataObject generic
|
|
14
|
-
* @
|
|
14
|
+
* @deprecated Will be removed in future major release. Please remove all usage of it.
|
|
15
|
+
* @alpha
|
|
15
16
|
*/
|
|
16
17
|
export interface IRootDataObjectFactory extends IFluidDataStoreFactory {
|
|
17
18
|
createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime): Promise<IFluidRouter>;
|
|
@@ -23,7 +24,7 @@ export interface IRootDataObjectFactory extends IFluidDataStoreFactory {
|
|
|
23
24
|
*
|
|
24
25
|
* @typeParam TObj - DataObject (concrete type)
|
|
25
26
|
* @typeParam I - The input types for the DataObject
|
|
26
|
-
* @
|
|
27
|
+
* @alpha
|
|
27
28
|
*/
|
|
28
29
|
export declare class PureDataObjectFactory<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>, IRootDataObjectFactory {
|
|
29
30
|
readonly type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pureDataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAY,YAAY,EAAe,MAAM,iCAAiC,CAAC;AACtF,OAAO,EACN,qBAAqB,EAGrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,kCAAkC,EAClC,gCAAgC,EAChC,8BAA8B,EAC9B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,eAAe,EAA0B,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAEN,yBAAyB,EAEzB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpF
|
|
1
|
+
{"version":3,"file":"pureDataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAY,YAAY,EAAe,MAAM,iCAAiC,CAAC;AACtF,OAAO,EACN,qBAAqB,EAGrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,kCAAkC,EAClC,gCAAgC,EAChC,8BAA8B,EAC9B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,eAAe,EAA0B,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAEN,yBAAyB,EAEzB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpF;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IAErE,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC/F;AAoFD;;;;;;;;GAQG;AACH,qBAAa,qBAAqB,CAChC,IAAI,SAAS,cAAc,CAAC,CAAC,CAAC,EAC9B,CAAC,SAAS,eAAe,GAAG,eAAe,CAE5C,YACC,sBAAsB,EACtB,OAAO,CAAC,8BA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EAC1B,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;cAKA,yBAAyB,CACxC,gBAAgB,EAAE,qBAAqB,EACvC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EAC/B,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;cAKA,kBAAkB,CACjC,OAAO,EAAE,8BAA8B,EACvC,YAAY,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;CAehB"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.DataObject = void 0;
|
|
8
8
|
const map_1 = require("@fluidframework/map");
|
|
9
|
-
const pureDataObject_1 = require("./pureDataObject");
|
|
9
|
+
const pureDataObject_1 = require("./pureDataObject.cjs");
|
|
10
10
|
/**
|
|
11
11
|
* DataObject is a base data store that is primed with a root directory. It
|
|
12
12
|
* ensures that it is created and ready before you can access it.
|
|
@@ -16,7 +16,7 @@ const pureDataObject_1 = require("./pureDataObject");
|
|
|
16
16
|
* will automatically be registered.
|
|
17
17
|
*
|
|
18
18
|
* @typeParam I - The optional input types used to strongly type the data object
|
|
19
|
-
* @
|
|
19
|
+
* @alpha
|
|
20
20
|
*/
|
|
21
21
|
class DataObject extends pureDataObject_1.PureDataObject {
|
|
22
22
|
constructor() {
|
|
@@ -68,4 +68,4 @@ class DataObject extends pureDataObject_1.PureDataObject {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
exports.DataObject = DataObject;
|
|
71
|
-
//# sourceMappingURL=dataObject.
|
|
71
|
+
//# sourceMappingURL=dataObject.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataObject.
|
|
1
|
+
{"version":3,"file":"dataObject.cjs","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],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AAC;CACD;AAxDD,gCAwDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISharedDirectory, MapFactory, SharedDirectory } from \"@fluidframework/map\";\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 * @alpha\n */\nexport abstract class DataObject<\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObject<I> {\n\tprivate internalRoot: ISharedDirectory | undefined;\n\tprivate readonly rootDirectoryId = \"root\";\n\n\t/**\n\t * The root directory will either be ready or will return an error. If an error is thrown\n\t * the root has not been correctly created/set.\n\t */\n\tprotected get root(): ISharedDirectory {\n\t\tif (!this.internalRoot) {\n\t\t\tthrow new Error(this.getUninitializedErrorString(`root`));\n\t\t}\n\n\t\treturn this.internalRoot;\n\t}\n\n\t/**\n\t * Initializes internal objects and calls initialization overrides.\n\t * Caller is responsible for ensuring this is only invoked once.\n\t */\n\tpublic async initializeInternal(existing: boolean): Promise<void> {\n\t\tif (!existing) {\n\t\t\t// Create a root directory and register it before calling initializingFirstTime\n\t\t\tthis.internalRoot = SharedDirectory.create(this.runtime, this.rootDirectoryId);\n\t\t\tthis.internalRoot.bindToContext();\n\t\t} else {\n\t\t\t// data store has a root directory so we just need to set it before calling initializingFromExisting\n\t\t\tthis.internalRoot = (await this.runtime.getChannel(\n\t\t\t\tthis.rootDirectoryId,\n\t\t\t)) as ISharedDirectory;\n\n\t\t\t// This will actually be an ISharedMap if the channel was previously created by the older version of\n\t\t\t// DataObject which used a SharedMap. Since SharedMap and SharedDirectory are compatible unless\n\t\t\t// SharedDirectory-only commands are used on SharedMap, this will mostly just work for compatibility.\n\t\t\tif (this.internalRoot.attributes.type === MapFactory.Type) {\n\t\t\t\tthis.runtime.logger.send({\n\t\t\t\t\tcategory: \"generic\",\n\t\t\t\t\teventName: \"MapDataObject\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Legacy document, SharedMap is masquerading as SharedDirectory in DataObject\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tawait super.initializeInternal(existing);\n\t}\n\n\t/**\n\t * Generates an error string indicating an item is uninitialized.\n\t * @param item - The name of the item that was uninitialized.\n\t */\n\tprotected getUninitializedErrorString(item: string): string {\n\t\treturn `${item} must be initialized before being accessed.`;\n\t}\n}\n"]}
|
|
@@ -14,7 +14,7 @@ import { DataObjectTypes } from "./types";
|
|
|
14
14
|
* will automatically be registered.
|
|
15
15
|
*
|
|
16
16
|
* @typeParam I - The optional input types used to strongly type the data object
|
|
17
|
-
* @
|
|
17
|
+
* @alpha
|
|
18
18
|
*/
|
|
19
19
|
export declare abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> extends PureDataObject<I> {
|
|
20
20
|
private internalRoot;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.PureDataObject = exports.DataObject = void 0;
|
|
8
|
-
var dataObject_1 = require("./dataObject");
|
|
8
|
+
var dataObject_1 = require("./dataObject.cjs");
|
|
9
9
|
Object.defineProperty(exports, "DataObject", { enumerable: true, get: function () { return dataObject_1.DataObject; } });
|
|
10
|
-
var pureDataObject_1 = require("./pureDataObject");
|
|
10
|
+
var pureDataObject_1 = require("./pureDataObject.cjs");
|
|
11
11
|
Object.defineProperty(exports, "PureDataObject", { enumerable: true, get: function () { return pureDataObject_1.PureDataObject; } });
|
|
12
|
-
//# sourceMappingURL=index.
|
|
12
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uDAAkD;AAAzC,gHAAA,cAAc,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObject } from \"./dataObject\";\nexport { PureDataObject } from \"./pureDataObject\";\nexport { DataObjectTypes, IDataObjectProps } from \"./types\";\n"]}
|
|
@@ -14,7 +14,7 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
|
14
14
|
* you are creating another base data store class
|
|
15
15
|
*
|
|
16
16
|
* @typeParam I - The optional input types used to strongly type the data object
|
|
17
|
-
* @
|
|
17
|
+
* @alpha
|
|
18
18
|
*/
|
|
19
19
|
class PureDataObject extends client_utils_1.TypedEventEmitter {
|
|
20
20
|
get id() {
|
|
@@ -124,4 +124,4 @@ class PureDataObject extends client_utils_1.TypedEventEmitter {
|
|
|
124
124
|
async hasInitialized() { }
|
|
125
125
|
}
|
|
126
126
|
exports.PureDataObject = PureDataObject;
|
|
127
|
-
//# sourceMappingURL=pureDataObject.
|
|
127
|
+
//# sourceMappingURL=pureDataObject.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pureDataObject.
|
|
1
|
+
{"version":3,"file":"pureDataObject.cjs","sourceRoot":"","sources":["../../src/data-objects/pureDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AACjE,2DAAoD;AAcpD,iEAAkE;AAGlE;;;;;;;GAOG;AACH,MAAsB,cACrB,SAAQ,gCAAuC;IA2B/C,IAAW,EAAE;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;IACxB,CAAC;IACD;;OAEG;IACH,gDAAgD;IAChD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAW,YAAY;QAC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AAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,oBAAoB,CAAC,QAAiB;QAClD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE;YACnC,OAAO,IAAI,CAAC,WAAW,CAAC;SACxB;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,kBAAkB,CAAC,QAAiB;QAChD,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC3B,IAAI,QAAQ,EAAE;YACb,IAAA,mBAAM,EACL,IAAI,CAAC,SAAS,KAAK,SAAS,EAC5B,KAAK,CAAC,kEAAkE,CACxE,CAAC;YACF,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;SACtC;aAAM;YACN,MAAM,IAAI,CAAC,qBAAqB,CAC9B,IAAI,CAAC,OAAO,CAAC,WAAiC,IAAI,IAAI,CAAC,SAAS,CACjE,CAAC;SACF;QACD,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,KAAmB,CAAC;IAEjD;;;;;OAKG;IACO,KAAK,CAAC,qBAAqB,CAAC,KAAyB,IAAkB,CAAC;IAElF;;;OAGG;IACO,KAAK,CAAC,wBAAwB,KAAmB,CAAC;IAE5D;;OAEG;IACO,KAAK,CAAC,cAAc,KAAmB,CAAC;CAClD;AAvJD,wCAuJC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tIEvent,\n\tIFluidHandle,\n\tIFluidLoadable,\n\t// eslint-disable-next-line import/no-deprecated\n\tIFluidRouter,\n\tIProvideFluidHandle,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { create404Response } from \"@fluidframework/runtime-utils\";\nimport { DataObjectTypes, IDataObjectProps } from \"./types\";\n\n/**\n * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.\n * You probably don't want to inherit from this data store directly unless\n * you are creating another base data store class\n *\n * @typeParam I - The optional input types used to strongly type the data object\n * @alpha\n */\nexport abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes>\n\textends TypedEventEmitter<I[\"Events\"] & IEvent>\n\t// eslint-disable-next-line import/no-deprecated\n\timplements IFluidLoadable, IFluidRouter, IProvideFluidHandle\n{\n\t/**\n\t * This is your FluidDataStoreRuntime object\n\t */\n\tprotected readonly runtime: IFluidDataStoreRuntime;\n\n\t/**\n\t * This context is used to talk up to the ContainerRuntime\n\t */\n\tprotected readonly context: IFluidDataStoreContext;\n\n\t/**\n\t * Providers are FluidObject keyed objects that provide back\n\t * a promise to the corresponding FluidObject or undefined.\n\t * Providers injected/provided by the Container and/or HostingApplication\n\t *\n\t * To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store\n\t */\n\tprotected readonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\n\tprotected initProps?: I[\"InitialState\"];\n\n\tprotected initializeP: Promise<void> | undefined;\n\n\tpublic get id() {\n\t\treturn this.runtime.id;\n\t}\n\t/**\n\t * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\tpublic get IFluidHandle() {\n\t\treturn this.handle;\n\t}\n\n\t/**\n\t * Handle to a data store\n\t */\n\tpublic get handle(): IFluidHandle<this> {\n\t\t// PureDataObjectFactory already provides an entryPoint initialization function to the data store runtime,\n\t\t// so this object should always have access to a non-null entryPoint. Need to cast because PureDataObject\n\t\t// tried to be too smart with its typing for handles :).\n\t\tassert(this.runtime.entryPoint !== undefined, 0x46b /* EntryPoint was undefined */);\n\t\treturn this.runtime.entryPoint as IFluidHandle<this>;\n\t}\n\n\tpublic static async getDataObject(runtime: IFluidDataStoreRuntime) {\n\t\tconst obj = await runtime.entryPoint.get();\n\t\treturn obj as PureDataObject;\n\t}\n\n\tpublic constructor(props: IDataObjectProps<I>) {\n\t\tsuper();\n\t\tthis.runtime = props.runtime;\n\t\tthis.context = props.context;\n\t\tthis.providers = props.providers;\n\t\tthis.initProps = props.initProps;\n\n\t\tassert(\n\t\t\t(this.runtime as any)._dataObject === undefined,\n\t\t\t0x0bd /* \"Object runtime already has DataObject!\" */,\n\t\t);\n\t\t(this.runtime as any)._dataObject = this;\n\t}\n\n\t/**\n\t * Return this object if someone requests it directly\n\t * We will return this object in two scenarios:\n\t *\n\t * 1. the request url is a \"/\"\n\t *\n\t * 2. the request url is empty\n\t */\n\tpublic async request(req: IRequest): Promise<IResponse> {\n\t\treturn req.url === \"\" || req.url === \"/\" || req.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(req);\n\t}\n\n\t/**\n\t * Call this API to ensure PureDataObject is fully initialized.\n\t * Initialization happens on demand, only on as-needed bases.\n\t * In most cases you should allow factory/object to decide when to finish initialization.\n\t * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods\n\t * and need a fully initialized object, then you can call this API to ensure object is fully initialized.\n\t */\n\tpublic async finishInitialization(existing: boolean): Promise<void> {\n\t\tif (this.initializeP !== undefined) {\n\t\t\treturn this.initializeP;\n\t\t}\n\t\tthis.initializeP = this.initializeInternal(existing);\n\t\treturn this.initializeP;\n\t}\n\n\t/**\n\t * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should\n\t * generally not be done.\n\t *\n\t * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is\n\t * responsible for ensuring this is only invoked once.\n\t */\n\tpublic async initializeInternal(existing: boolean): Promise<void> {\n\t\tawait this.preInitialize();\n\t\tif (existing) {\n\t\t\tassert(\n\t\t\t\tthis.initProps === undefined,\n\t\t\t\t0x0be /* \"Trying to initialize from existing while initProps is set!\" */,\n\t\t\t);\n\t\t\tawait this.initializingFromExisting();\n\t\t} else {\n\t\t\tawait this.initializingFirstTime(\n\t\t\t\t(this.context.createProps as I[\"InitialState\"]) ?? this.initProps,\n\t\t\t);\n\t\t}\n\t\tawait this.hasInitialized();\n\t}\n\n\t/**\n\t * Called every time the data store is initialized, before initializingFirstTime or\n\t * initializingFromExisting is called.\n\t */\n\tprotected async preInitialize(): Promise<void> {}\n\n\t/**\n\t * Called the first time the data store is initialized (new creations with a new\n\t * data store runtime)\n\t *\n\t * @param props - Optional props to be passed in on create\n\t */\n\tprotected async initializingFirstTime(props?: I[\"InitialState\"]): Promise<void> {}\n\n\t/**\n\t * Called every time but the first time the data store is initialized (creations\n\t * with an existing data store runtime)\n\t */\n\tprotected async initializingFromExisting(): Promise<void> {}\n\n\t/**\n\t * Called every time the data store is initialized after create or existing.\n\t */\n\tprotected async hasInitialized(): Promise<void> {}\n}\n"]}
|
|
@@ -14,7 +14,7 @@ import { DataObjectTypes, IDataObjectProps } from "./types";
|
|
|
14
14
|
* you are creating another base data store class
|
|
15
15
|
*
|
|
16
16
|
* @typeParam I - The optional input types used to strongly type the data object
|
|
17
|
-
* @
|
|
17
|
+
* @alpha
|
|
18
18
|
*/
|
|
19
19
|
export declare abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes> extends TypedEventEmitter<I["Events"] & IEvent> implements IFluidLoadable, IFluidRouter, IProvideFluidHandle {
|
|
20
20
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, FluidObject } from \"@fluidframework/core-interfaces\";\nimport { AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\n\n/**\n * This type is used as the base generic input to DataObject and PureDataObject.\n * @alpha\n */\nexport interface DataObjectTypes {\n\t/**\n\t * represents a type that will define optional providers that will be injected\n\t */\n\tOptionalProviders?: FluidObject;\n\t/**\n\t * the initial state type that the produced data object may take during creation\n\t */\n\tInitialState?: any;\n\t/**\n\t * represents events that will be available in the EventForwarder\n\t */\n\tEvents?: IEvent;\n}\n\n/**\n * @alpha\n */\nexport interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {\n\treadonly runtime: IFluidDataStoreRuntime;\n\treadonly context: IFluidDataStoreContext;\n\treadonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\treadonly initProps?: I[\"InitialState\"];\n}\n"]}
|
|
@@ -8,7 +8,7 @@ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
|
|
|
8
8
|
import { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
9
9
|
/**
|
|
10
10
|
* This type is used as the base generic input to DataObject and PureDataObject.
|
|
11
|
-
* @
|
|
11
|
+
* @alpha
|
|
12
12
|
*/
|
|
13
13
|
export interface DataObjectTypes {
|
|
14
14
|
/**
|
|
@@ -25,7 +25,7 @@ export interface DataObjectTypes {
|
|
|
25
25
|
Events?: IEvent;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* @
|
|
28
|
+
* @alpha
|
|
29
29
|
*/
|
|
30
30
|
export interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {
|
|
31
31
|
readonly runtime: IFluidDataStoreRuntime;
|
|
@@ -19,21 +19,21 @@ exports.getObjectWithIdFromContainer = exports.getObjectFromContainer = exports.
|
|
|
19
19
|
*
|
|
20
20
|
* @packageDocumentation
|
|
21
21
|
*/
|
|
22
|
-
var data_object_factories_1 = require("./data-object-factories");
|
|
22
|
+
var data_object_factories_1 = require("./data-object-factories/index.cjs");
|
|
23
23
|
Object.defineProperty(exports, "DataObjectFactory", { enumerable: true, get: function () { return data_object_factories_1.DataObjectFactory; } });
|
|
24
24
|
Object.defineProperty(exports, "PureDataObjectFactory", { enumerable: true, get: function () { return data_object_factories_1.PureDataObjectFactory; } });
|
|
25
|
-
var data_objects_1 = require("./data-objects");
|
|
25
|
+
var data_objects_1 = require("./data-objects/index.cjs");
|
|
26
26
|
Object.defineProperty(exports, "DataObject", { enumerable: true, get: function () { return data_objects_1.DataObject; } });
|
|
27
27
|
Object.defineProperty(exports, "PureDataObject", { enumerable: true, get: function () { return data_objects_1.PureDataObject; } });
|
|
28
|
-
var container_runtime_factories_1 = require("./container-runtime-factories");
|
|
28
|
+
var container_runtime_factories_1 = require("./container-runtime-factories/index.cjs");
|
|
29
29
|
Object.defineProperty(exports, "BaseContainerRuntimeFactory", { enumerable: true, get: function () { return container_runtime_factories_1.BaseContainerRuntimeFactory; } });
|
|
30
30
|
Object.defineProperty(exports, "ContainerRuntimeFactoryWithDefaultDataStore", { enumerable: true, get: function () { return container_runtime_factories_1.ContainerRuntimeFactoryWithDefaultDataStore; } });
|
|
31
|
-
var request_handlers_1 = require("./request-handlers");
|
|
31
|
+
var request_handlers_1 = require("./request-handlers/index.cjs");
|
|
32
32
|
Object.defineProperty(exports, "defaultFluidObjectRequestHandler", { enumerable: true, get: function () { return request_handlers_1.defaultFluidObjectRequestHandler; } });
|
|
33
33
|
Object.defineProperty(exports, "defaultRouteRequestHandler", { enumerable: true, get: function () { return request_handlers_1.defaultRouteRequestHandler; } });
|
|
34
34
|
Object.defineProperty(exports, "mountableViewRequestHandler", { enumerable: true, get: function () { return request_handlers_1.mountableViewRequestHandler; } });
|
|
35
|
-
var utils_1 = require("./utils");
|
|
35
|
+
var utils_1 = require("./utils/index.cjs");
|
|
36
36
|
Object.defineProperty(exports, "getDefaultObjectFromContainer", { enumerable: true, get: function () { return utils_1.getDefaultObjectFromContainer; } });
|
|
37
37
|
Object.defineProperty(exports, "getObjectFromContainer", { enumerable: true, get: function () { return utils_1.getObjectFromContainer; } });
|
|
38
38
|
Object.defineProperty(exports, "getObjectWithIdFromContainer", { enumerable: true, get: function () { return utils_1.getObjectWithIdFromContainer; } });
|
|
39
|
-
//# sourceMappingURL=index.
|
|
39
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;;;;GAaG;AAEH,2EAIiC;AAHhC,0HAAA,iBAAiB,OAAA;AAEjB,8HAAA,qBAAqB,OAAA;AAEtB,yDAA+F;AAAtF,0GAAA,UAAU,OAAA;AAAqC,8GAAA,cAAc,OAAA;AACtE,uFAGuC;AAFtC,0IAAA,2BAA2B,OAAA;AAC3B,0JAAA,2CAA2C,OAAA;AAE5C,iEAI4B;AAH3B,oIAAA,gCAAgC,OAAA;AAChC,8HAAA,0BAA0B,OAAA;AAC1B,+HAAA,2BAA2B,OAAA;AAE5B,2CAIiB;AAHhB,sHAAA,6BAA6B,OAAA;AAC7B,+GAAA,sBAAsB,OAAA;AACtB,qHAAA,4BAA4B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `aqueduct` package is a library for building Fluid objects and Fluid\n * containers within the Fluid Framework. Its goal is to provide a thin base\n * layer over the existing Fluid Framework interfaces that allows developers to\n * get started quickly.\n *\n * @remarks\n * About the library name: An \"aqueduct\" is a way to transport water from a source\n * to another location. The library name was chosen because its purpose is to\n * facilitate using lower level constructs and therefore handle 'fluid' items\n * same as an aqueduct.\n *\n * @packageDocumentation\n */\n\nexport {\n\tDataObjectFactory,\n\tIRootDataObjectFactory,\n\tPureDataObjectFactory,\n} from \"./data-object-factories\";\nexport { DataObject, DataObjectTypes, IDataObjectProps, PureDataObject } from \"./data-objects\";\nexport {\n\tBaseContainerRuntimeFactory,\n\tContainerRuntimeFactoryWithDefaultDataStore,\n} from \"./container-runtime-factories\";\nexport {\n\tdefaultFluidObjectRequestHandler,\n\tdefaultRouteRequestHandler,\n\tmountableViewRequestHandler,\n} from \"./request-handlers\";\nexport {\n\tgetDefaultObjectFromContainer,\n\tgetObjectFromContainer,\n\tgetObjectWithIdFromContainer,\n} from \"./utils\";\n"]}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.mountableViewRequestHandler = exports.defaultRouteRequestHandler = exports.defaultFluidObjectRequestHandler = void 0;
|
|
8
|
-
var requestHandlers_1 = require("./requestHandlers");
|
|
8
|
+
var requestHandlers_1 = require("./requestHandlers.cjs");
|
|
9
9
|
Object.defineProperty(exports, "defaultFluidObjectRequestHandler", { enumerable: true, get: function () { return requestHandlers_1.defaultFluidObjectRequestHandler; } });
|
|
10
10
|
Object.defineProperty(exports, "defaultRouteRequestHandler", { enumerable: true, get: function () { return requestHandlers_1.defaultRouteRequestHandler; } });
|
|
11
11
|
Object.defineProperty(exports, "mountableViewRequestHandler", { enumerable: true, get: function () { return requestHandlers_1.mountableViewRequestHandler; } });
|
|
12
|
-
//# sourceMappingURL=index.
|
|
12
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/request-handlers/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAI2B;AAH1B,mIAAA,gCAAgC,OAAA;AAChC,6HAAA,0BAA0B,OAAA;AAC1B,8HAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tdefaultFluidObjectRequestHandler,\n\tdefaultRouteRequestHandler,\n\tmountableViewRequestHandler,\n} from \"./requestHandlers\";\n"]}
|
|
@@ -19,7 +19,7 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
|
19
19
|
* without the header, and respond with a mountable view of the given class using the response.
|
|
20
20
|
* @param MountableViewClass - The type of mountable view to use when responding
|
|
21
21
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
22
|
-
* @
|
|
22
|
+
* @internal
|
|
23
23
|
*/
|
|
24
24
|
const mountableViewRequestHandler = (MountableViewClass, handlers) => {
|
|
25
25
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -56,7 +56,7 @@ exports.mountableViewRequestHandler = mountableViewRequestHandler;
|
|
|
56
56
|
* If request is empty and default url is provided, redirect request to such default url.
|
|
57
57
|
* @param defaultRootId - optional default root data store ID to pass request in case request is empty.
|
|
58
58
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
59
|
-
* @
|
|
59
|
+
* @internal
|
|
60
60
|
*/
|
|
61
61
|
const defaultRouteRequestHandler = (defaultRootId) => {
|
|
62
62
|
return async (request, runtime) => {
|
|
@@ -82,7 +82,7 @@ exports.defaultRouteRequestHandler = defaultRouteRequestHandler;
|
|
|
82
82
|
*
|
|
83
83
|
* Returns a 404 error for any other url.
|
|
84
84
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
85
|
-
* @
|
|
85
|
+
* @internal
|
|
86
86
|
*/
|
|
87
87
|
function defaultFluidObjectRequestHandler(fluidObject, request) {
|
|
88
88
|
return request.url === "" || request.url === "/" || request.url.startsWith("/?")
|
|
@@ -90,4 +90,4 @@ function defaultFluidObjectRequestHandler(fluidObject, request) {
|
|
|
90
90
|
: (0, runtime_utils_1.create404Response)(request);
|
|
91
91
|
}
|
|
92
92
|
exports.defaultFluidObjectRequestHandler = defaultFluidObjectRequestHandler;
|
|
93
|
-
//# sourceMappingURL=requestHandlers.
|
|
93
|
+
//# sourceMappingURL=requestHandlers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestHandlers.cjs","sourceRoot":"","sources":["../../src/request-handlers/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,gDAAgD;AAChD,qEAAoG;AACpG,iEAAiF;AAEjF;;;;;;;;;;;;GAYG;AACI,MAAM,2BAA2B,GAAG,CAC1C,kBAA4C,EAC5C,QAAiC,EAChC,EAAE;IACH,gDAAgD;IAChD,MAAM,aAAa,GAAG,IAAA,4CAA0B,EAAC,GAAG,QAAQ,CAAC,CAAC;IAC9D,OAAO,KAAK,EAAE,OAAsB,EAAE,OAA0B,EAAE,EAAE;QACnE,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;QAC9D,IAAI,UAAU,GAAa,OAAO,CAAC;QACnC,IAAI,aAAa,EAAE;YAClB,wDAAwD;YACxD,mDAAmD;YACnD,MAAM,OAAO,GAAmB,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;YACvD,OAAQ,OAAe,CAAC,aAAa,CAAC;YACtC,UAAU,GAAG;gBACZ,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,OAAO;aACP,CAAC;SACF;QACD,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAE1D,IACC,aAAa;YACb,QAAQ,CAAC,MAAM,KAAK,GAAG;YACvB,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC1C;YACD,OAAO;gBACN,MAAM,EAAE,GAAG;gBACX,QAAQ,EAAE,cAAc;gBACxB,KAAK,EAAE,IAAI,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC;aAC7C,CAAC;SACF;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC;AACH,CAAC,CAAC;AAlCW,QAAA,2BAA2B,+BAkCtC;AAEF;;;;;;GAMG;AACI,MAAM,0BAA0B,GAAG,CAAC,aAAqB,EAAE,EAAE;IACnE,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE;QAC9D,MAAM,MAAM,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC;gBAChD,GAAG,EAAE,IAAI,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE;gBACvC,OAAO,EAAE,OAAO,CAAC,OAAO;aACxB,CAAC,CAAC;SACH;QACD,OAAO,SAAS,CAAC,CAAC,kBAAkB;IACrC,CAAC,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC;AAEF;;;;;;;;;;;;GAYG;AACH,SAAgB,gCAAgC,CAC/C,WAAwB,EACxB,OAAiB;IAEjB,OAAO,OAAO,CAAC,GAAG,KAAK,EAAE,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAC/E,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAC/D,CAAC,CAAC,IAAA,iCAAiB,EAAC,OAAO,CAAC,CAAC;AAC/B,CAAC;AAPD,4EAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidObject, IRequest, IRequestHeader, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport type { IFluidMountableViewClass } from \"@fluidframework/view-interfaces\";\n// eslint-disable-next-line import/no-deprecated\nimport { RuntimeRequestHandler, buildRuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\n\n/**\n * A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across\n * bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within\n * the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will\n * be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable\n * view isn't necessary.\n *\n * When a request is received with a mountableView: true header, this request handler will reissue the request\n * without the header, and respond with a mountable view of the given class using the response.\n * @param MountableViewClass - The type of mountable view to use when responding\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @internal\n */\nexport const mountableViewRequestHandler = (\n\tMountableViewClass: IFluidMountableViewClass,\n\thandlers: RuntimeRequestHandler[],\n) => {\n\t// eslint-disable-next-line import/no-deprecated\n\tconst nestedHandler = buildRuntimeRequestHandler(...handlers);\n\treturn async (request: RequestParser, runtime: IContainerRuntime) => {\n\t\tconst mountableView = request.headers?.mountableView === true;\n\t\tlet newRequest: IRequest = request;\n\t\tif (mountableView) {\n\t\t\t// Reissue the request without the mountableView header.\n\t\t\t// We'll repack whatever the response is if we can.\n\t\t\tconst headers: IRequestHeader = { ...request.headers };\n\t\t\tdelete (headers as any).mountableView;\n\t\t\tnewRequest = {\n\t\t\t\turl: request.url,\n\t\t\t\theaders,\n\t\t\t};\n\t\t}\n\t\tconst response = await nestedHandler(newRequest, runtime);\n\n\t\tif (\n\t\t\tmountableView &&\n\t\t\tresponse.status === 200 &&\n\t\t\tMountableViewClass.canMount(response.value)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tstatus: 200,\n\t\t\t\tmimeType: \"fluid/object\",\n\t\t\t\tvalue: new MountableViewClass(response.value),\n\t\t\t};\n\t\t}\n\t\treturn response;\n\t};\n};\n\n/**\n * Pipe through container request into internal request.\n * If request is empty and default url is provided, redirect request to such default url.\n * @param defaultRootId - optional default root data store ID to pass request in case request is empty.\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @internal\n */\nexport const defaultRouteRequestHandler = (defaultRootId: string) => {\n\treturn async (request: IRequest, runtime: IContainerRuntime) => {\n\t\tconst parser = RequestParser.create(request);\n\t\tif (parser.pathParts.length === 0) {\n\t\t\treturn runtime.IFluidHandleContext.resolveHandle({\n\t\t\t\turl: `/${defaultRootId}${parser.query}`,\n\t\t\t\theaders: request.headers,\n\t\t\t});\n\t\t}\n\t\treturn undefined; // continue search\n\t};\n};\n\n/**\n * Default request handler for a Fluid object that returns the object itself if:\n *\n * 1. the request url is empty\n *\n * 2. the request url is \"/\"\n *\n * 3. the request url starts with \"/\" and is followed by a query param, such as /?key=value\n *\n * Returns a 404 error for any other url.\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @internal\n */\nexport function defaultFluidObjectRequestHandler(\n\tfluidObject: FluidObject,\n\trequest: IRequest,\n): IResponse {\n\treturn request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")\n\t\t? { mimeType: \"fluid/object\", status: 200, value: fluidObject }\n\t\t: create404Response(request);\n}\n"]}
|
|
@@ -18,7 +18,7 @@ import { RequestParser } from "@fluidframework/runtime-utils";
|
|
|
18
18
|
* without the header, and respond with a mountable view of the given class using the response.
|
|
19
19
|
* @param MountableViewClass - The type of mountable view to use when responding
|
|
20
20
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
21
|
-
* @
|
|
21
|
+
* @internal
|
|
22
22
|
*/
|
|
23
23
|
export declare const mountableViewRequestHandler: (MountableViewClass: IFluidMountableViewClass, handlers: RuntimeRequestHandler[]) => (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
24
24
|
/**
|
|
@@ -26,7 +26,7 @@ export declare const mountableViewRequestHandler: (MountableViewClass: IFluidMou
|
|
|
26
26
|
* If request is empty and default url is provided, redirect request to such default url.
|
|
27
27
|
* @param defaultRootId - optional default root data store ID to pass request in case request is empty.
|
|
28
28
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
29
|
-
* @
|
|
29
|
+
* @internal
|
|
30
30
|
*/
|
|
31
31
|
export declare const defaultRouteRequestHandler: (defaultRootId: string) => (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
32
32
|
/**
|
|
@@ -40,7 +40,7 @@ export declare const defaultRouteRequestHandler: (defaultRootId: string) => (req
|
|
|
40
40
|
*
|
|
41
41
|
* Returns a 404 error for any other url.
|
|
42
42
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
43
|
-
* @
|
|
43
|
+
* @internal
|
|
44
44
|
*/
|
|
45
45
|
export declare function defaultFluidObjectRequestHandler(fluidObject: FluidObject, request: IRequest): IResponse;
|
|
46
46
|
//# sourceMappingURL=requestHandlers.d.ts.map
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -9,7 +9,7 @@ exports.getObjectFromContainer = exports.getObjectWithIdFromContainer = exports.
|
|
|
9
9
|
* @typeParam T - Defines the type you expect to be returned.
|
|
10
10
|
*
|
|
11
11
|
* @param container - Container you're attempting to get the object from
|
|
12
|
-
* @
|
|
12
|
+
* @internal
|
|
13
13
|
*/
|
|
14
14
|
async function getDefaultObjectFromContainer(container) {
|
|
15
15
|
const url = "/";
|
|
@@ -34,7 +34,7 @@ exports.getDefaultObjectFromContainer = getDefaultObjectFromContainer;
|
|
|
34
34
|
*
|
|
35
35
|
* @param id - Unique id of the FluidObject
|
|
36
36
|
* @param container - Container you're attempting to get the object from
|
|
37
|
-
* @
|
|
37
|
+
* @internal
|
|
38
38
|
*/
|
|
39
39
|
async function getObjectWithIdFromContainer(id, container) {
|
|
40
40
|
const url = `/${id}`;
|
|
@@ -59,7 +59,7 @@ exports.getObjectWithIdFromContainer = getObjectWithIdFromContainer;
|
|
|
59
59
|
*
|
|
60
60
|
* @param path - Unique path/url of the FluidObject
|
|
61
61
|
* @param container - Container you're attempting to get the object from
|
|
62
|
-
* @
|
|
62
|
+
* @internal
|
|
63
63
|
*/
|
|
64
64
|
async function getObjectFromContainer(path, container) {
|
|
65
65
|
const response = await container.request({ url: path });
|
|
@@ -73,4 +73,4 @@ async function getObjectFromContainer(path, container) {
|
|
|
73
73
|
return response.value;
|
|
74
74
|
}
|
|
75
75
|
exports.getObjectFromContainer = getObjectFromContainer;
|
|
76
|
-
//# sourceMappingURL=containerInteractions.
|
|
76
|
+
//# sourceMappingURL=containerInteractions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerInteractions.cjs","sourceRoot":"","sources":["../../src/utils/containerInteractions.ts"],"names":[],"mappings":";;;AAOA;;;;;;;;;GASG;AACI,KAAK,UAAU,6BAA6B,CAClD,SAAqB;IAErB,MAAM,GAAG,GAAG,GAAG,CAAC;IAChB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAElD,sBAAsB;IACtB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;QACpE,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,GAAG,CAAC,CAAC;KACpE;SAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,GAAG,CAAC,CAAC;KACrD;IAED,+DAA+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ors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { IContainer } from \"@fluidframework/container-definitions\";\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting the default Fluid Object from a Container. This function only works for\n * Containers that support \"/\" request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param container - Container you're attempting to get the object from\n * @internal\n */\nexport async function getDefaultObjectFromContainer<T = FluidObject>(\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst url = \"/\";\n\tconst response = await container.request({ url });\n\n\t// Verify the response\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object at URL: \"${url}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response from URL: \"${url}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for\n * Containers that support getting FluidObjects via request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param id - Unique id of the FluidObject\n * @param container - Container you're attempting to get the object from\n * @internal\n */\nexport async function getObjectWithIdFromContainer<T = FluidObject>(\n\tid: string,\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst url = `/${id}`;\n\tconst response = await container.request({ url });\n\n\t// Verify the response\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object with ID: \"${id}\" from URL: \"${url}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response for ID: \"${id}\" from URL: \"${url}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting a Fluid Object from a Container given a path/url. This function only works for\n * Containers that support getting FluidObjects via request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param path - Unique path/url of the FluidObject\n * @param container - Container you're attempting to get the object from\n * @internal\n */\nexport async function getObjectFromContainer<T = FluidObject>(\n\tpath: string,\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst response = await container.request({ url: path });\n\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object with from URL: \"${path}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response for from URL: \"${path}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n"]}
|