@fluidframework/aqueduct 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229
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 +29 -29
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +9 -5
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.js +20 -7
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +2 -1
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +2 -5
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
- package/dist/data-object-factories/dataObjectFactory.d.ts.map +1 -1
- package/dist/data-object-factories/dataObjectFactory.js.map +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.js +4 -2
- package/dist/data-object-factories/pureDataObjectFactory.js.map +1 -1
- package/dist/data-objects/dataObject.d.ts.map +1 -1
- package/dist/data-objects/dataObject.js +1 -1
- package/dist/data-objects/dataObject.js.map +1 -1
- package/dist/data-objects/pureDataObject.d.ts +1 -6
- package/dist/data-objects/pureDataObject.d.ts.map +1 -1
- package/dist/data-objects/pureDataObject.js +15 -14
- package/dist/data-objects/pureDataObject.js.map +1 -1
- package/dist/data-objects/types.d.ts.map +1 -1
- package/dist/data-objects/types.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/request-handlers/requestHandlers.d.ts +1 -1
- package/dist/request-handlers/requestHandlers.d.ts.map +1 -1
- package/dist/request-handlers/requestHandlers.js +4 -2
- package/dist/request-handlers/requestHandlers.js.map +1 -1
- package/dist/test/defaultRoute.spec.js +3 -1
- package/dist/test/defaultRoute.spec.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/types/validateAqueductPrevious.generated.js +8 -18
- package/dist/test/types/validateAqueductPrevious.generated.js.map +1 -1
- package/dist/utils/containerInteractions.d.ts.map +1 -1
- package/dist/utils/containerInteractions.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/dist/utils/index.js.map +1 -1
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.js +22 -9
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +2 -5
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
- package/lib/data-object-factories/dataObjectFactory.js +1 -1
- package/lib/data-object-factories/dataObjectFactory.js.map +1 -1
- package/lib/data-object-factories/pureDataObjectFactory.js +4 -2
- package/lib/data-object-factories/pureDataObjectFactory.js.map +1 -1
- package/lib/data-objects/dataObject.js +1 -1
- package/lib/data-objects/dataObject.js.map +1 -1
- package/lib/data-objects/pureDataObject.js +15 -14
- package/lib/data-objects/pureDataObject.js.map +1 -1
- package/lib/data-objects/types.js.map +1 -1
- package/lib/index.js +2 -3
- package/lib/index.js.map +1 -1
- package/lib/request-handlers/requestHandlers.js +4 -2
- package/lib/request-handlers/requestHandlers.js.map +1 -1
- package/lib/utils/containerInteractions.js.map +1 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +58 -58
- package/dist/container-services/containerServices.d.ts +0 -27
- package/dist/container-services/containerServices.d.ts.map +0 -1
- package/dist/container-services/containerServices.js +0 -84
- package/dist/container-services/containerServices.js.map +0 -1
- package/dist/container-services/index.d.ts +0 -6
- package/dist/container-services/index.d.ts.map +0 -1
- package/dist/container-services/index.js +0 -12
- package/dist/container-services/index.js.map +0 -1
- package/dist/test/containerServices.spec.js +0 -121
- package/dist/test/containerServices.spec.js.map +0 -1
- package/dist/utils/attachUtils.d.ts +0 -7
- package/dist/utils/attachUtils.d.ts.map +0 -1
- package/dist/utils/attachUtils.js +0 -20
- package/dist/utils/attachUtils.js.map +0 -1
- package/lib/container-services/containerServices.js +0 -79
- package/lib/container-services/containerServices.js.map +0 -1
- package/lib/container-services/index.js +0 -6
- package/lib/container-services/index.js.map +0 -1
- package/lib/utils/attachUtils.js +0 -16
- package/lib/utils/attachUtils.js.map +0 -1
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.PureDataObject = void 0;
|
|
8
8
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
9
|
-
const request_handler_1 = require("@fluidframework/request-handler");
|
|
10
|
-
const container_services_1 = require("../container-services");
|
|
11
9
|
const request_handlers_1 = require("../request-handlers");
|
|
12
10
|
/**
|
|
13
11
|
* This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
|
|
@@ -32,10 +30,18 @@ class PureDataObject extends common_utils_1.EventForwarder {
|
|
|
32
30
|
this.dispose();
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
|
-
get disposed() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
get
|
|
33
|
+
get disposed() {
|
|
34
|
+
return this._disposed;
|
|
35
|
+
}
|
|
36
|
+
get id() {
|
|
37
|
+
return this.runtime.id;
|
|
38
|
+
}
|
|
39
|
+
get IFluidRouter() {
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
get IFluidLoadable() {
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
39
45
|
get IFluidHandle() {
|
|
40
46
|
return this.handle;
|
|
41
47
|
}
|
|
@@ -110,20 +116,15 @@ class PureDataObject extends common_utils_1.EventForwarder {
|
|
|
110
116
|
* define custom types/getters for object retrieval
|
|
111
117
|
*/
|
|
112
118
|
async getFluidObjectFromDirectory(key, directory, getObjectFromDirectory) {
|
|
113
|
-
const handleMaybe = getObjectFromDirectory
|
|
119
|
+
const handleMaybe = getObjectFromDirectory
|
|
120
|
+
? getObjectFromDirectory(key, directory)
|
|
121
|
+
: directory.get(key);
|
|
114
122
|
const handle = handleMaybe === null || handleMaybe === void 0 ? void 0 : handleMaybe.IFluidHandle;
|
|
115
123
|
if (handle) {
|
|
116
124
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
117
125
|
return handle.get();
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Gets the service at a given id.
|
|
122
|
-
* @param id - service id
|
|
123
|
-
*/
|
|
124
|
-
async getService(id) {
|
|
125
|
-
return (0, request_handler_1.handleFromLegacyUri)(`/${container_services_1.serviceRoutePathRoot}/${id}`, this.context.containerRuntime).get();
|
|
126
|
-
}
|
|
127
128
|
/**
|
|
128
129
|
* Called every time the data store is initialized, before initializingFirstTime or
|
|
129
130
|
* initializingFromExisting is called.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pureDataObject.js","sourceRoot":"","sources":["../../src/data-objects/pureDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAsE;AAYtE,qEAAsE;AAGtE,8DAA6D;AAC7D,0DAAuE;AAGvE;;;;;;GAMG;AACH,MAAsB,cAClB,SAAQ,6BAAoC;IAsD5C,YAAmB,KAA0B;QACzC,KAAK,EAAE,CAAC;QApDJ,cAAS,GAAG,KAAK,CAAC;QAqDtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QAEjC,IAAA,qBAAM,EAAE,I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,KAAK,CAAC,UAAU,CAAwB,EAAU;QACxD,OAAO,IAAA,qCAAmB,EAAI,IAAI,yCAAoB,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,EAAE,CAAC;IACzG,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,KAAoB,CAAC;IAElD;;;;;OAKG;IACO,KAAK,CAAC,qBAAqB,CAAC,KAAyB,IAAmB,CAAC;IAEnF;;;OAGG;IACO,KAAK,CAAC,wBAAwB,KAAoB,CAAC;IAE7D;;OAEG;IACO,KAAK,CAAC,cAAc,KAAoB,CAAC;IAEnD;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAvLD,wCAuLC","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 { assert, EventForwarder } from \"@fluidframework/common-utils\";\nimport {\n IFluidHandle,\n IFluidLoadable,\n IFluidRouter,\n IProvideFluidHandle,\n IRequest,\n IResponse,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { IDirectory } from \"@fluidframework/map\";\nimport { handleFromLegacyUri } from \"@fluidframework/request-handler\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { serviceRoutePathRoot } from \"../container-services\";\nimport { defaultFluidObjectRequestHandler } from \"../request-handlers\";\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 */\nexport abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes>\n extends EventForwarder<I[\"Events\"] & IEvent>\n implements IFluidLoadable, IFluidRouter, IProvideFluidHandle {\n\n private _disposed = false;\n\n /**\n * This is your FluidDataStoreRuntime object\n */\n protected readonly runtime: IFluidDataStoreRuntime;\n\n /**\n * This context is used to talk up to the ContainerRuntime\n */\n protected readonly context: IFluidDataStoreContext;\n\n /**\n * Providers are FluidObject keyed objects that provide back\n * a promise to the corresponding FluidObject or undefined.\n * Providers injected/provided by the Container and/or HostingApplication\n *\n * To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store\n */\n protected readonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\n protected initProps?: I[\"InitialState\"];\n\n protected initializeP: Promise<void> | undefined;\n\n public get disposed() { return this._disposed; }\n\n public get id() { return this.runtime.id; }\n public get IFluidRouter() { return this; }\n public get IFluidLoadable() { return this; }\n public get IFluidHandle() {\n return this.handle;\n }\n\n /**\n * Handle to a data store\n */\n public get handle(): IFluidHandle<this> {\n // PureDataObjectFactory already provides an entryPoint initialization function to the data store runtime,\n // so this object should always have access to a non-null entryPoint. Need to cast because PureDataObject\n // tried to be too smart with its typing for handles :).\n assert(this.runtime.entryPoint !== undefined, 0x46b /* EntryPoint was undefined */);\n return this.runtime.entryPoint as IFluidHandle<this>;\n }\n\n public static async getDataObject(runtime: IFluidDataStoreRuntime) {\n const obj = await runtime.entryPoint?.get();\n assert(obj !== undefined, 0x0bc /* \"The runtime's handle is not initialized yet!\" */);\n return obj as PureDataObject;\n }\n\n public constructor(props: IDataObjectProps<I>) {\n super();\n this.runtime = props.runtime;\n this.context = props.context;\n this.providers = props.providers;\n this.initProps = props.initProps;\n\n assert((this.runtime as any)._dataObject === undefined, 0x0bd /* \"Object runtime already has DataObject!\" */);\n (this.runtime as any)._dataObject = this;\n\n // Container event handlers\n this.runtime.once(\"dispose\", () => {\n this._disposed = true;\n this.dispose();\n });\n }\n\n // #region IFluidRouter\n\n /**\n * Return this object if someone requests it directly\n * We will return this object in two scenarios:\n *\n * 1. the request url is a \"/\"\n *\n * 2. the request url is empty\n */\n public async request(req: IRequest): Promise<IResponse> {\n return defaultFluidObjectRequestHandler(this, req);\n }\n\n // #endregion IFluidRouter\n\n /**\n * Call this API to ensure PureDataObject is fully initialized.\n * Initialization happens on demand, only on as-needed bases.\n * In most cases you should allow factory/object to decide when to finish initialization.\n * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods\n * and need a fully initialized object, then you can call this API to ensure object is fully initialized.\n */\n public async finishInitialization(existing: boolean): Promise<void> {\n if (this.initializeP !== undefined) {\n return this.initializeP;\n }\n this.initializeP = this.initializeInternal(existing);\n return this.initializeP;\n }\n\n /**\n * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should\n * generally not be done.\n *\n * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is\n * responsible for ensuring this is only invoked once.\n */\n public async initializeInternal(existing: boolean): Promise<void> {\n await this.preInitialize();\n if (existing) {\n assert(this.initProps === undefined,\n 0x0be /* \"Trying to initialize from existing while initProps is set!\" */);\n await this.initializingFromExisting();\n } else {\n await this.initializingFirstTime(\n this.context.createProps as I[\"InitialState\"] ?? this.initProps);\n }\n await this.hasInitialized();\n }\n\n /**\n * Retrieve Fluid object using the handle get\n *\n * @param key - key that object (handle/id) is stored with in the directory\n * @param directory - directory containing the object\n * @param getObjectFromDirectory - optional callback for fetching object from the directory, allows users to\n * define custom types/getters for object retrieval\n */\n public async getFluidObjectFromDirectory<T extends IFluidLoadable>(\n key: string,\n directory: IDirectory,\n getObjectFromDirectory?: (id: string, directory: IDirectory) => IFluidHandle | undefined):\n Promise<T | undefined> {\n const handleMaybe = getObjectFromDirectory ? getObjectFromDirectory(key, directory) : directory.get(key);\n const handle = handleMaybe?.IFluidHandle;\n if (handle) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return handle.get();\n }\n }\n\n /**\n * Gets the service at a given id.\n * @param id - service id\n */\n protected async getService<T extends FluidObject>(id: string): Promise<T> {\n return handleFromLegacyUri<T>(`/${serviceRoutePathRoot}/${id}`, this.context.containerRuntime).get();\n }\n\n /**\n * Called every time the data store is initialized, before initializingFirstTime or\n * initializingFromExisting is called.\n */\n protected async preInitialize(): Promise<void> { }\n\n /**\n * Called the first time the data store is initialized (new creations with a new\n * data store runtime)\n *\n * @param props - Optional props to be passed in on create\n */\n protected async initializingFirstTime(props?: I[\"InitialState\"]): Promise<void> { }\n\n /**\n * Called every time but the first time the data store is initialized (creations\n * with an existing data store runtime)\n */\n protected async initializingFromExisting(): Promise<void> { }\n\n /**\n * Called every time the data store is initialized after create or existing.\n */\n protected async hasInitialized(): Promise<void> { }\n\n /**\n * Called when the host container closes and disposes itself\n */\n public dispose(): void {\n super.dispose();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pureDataObject.js","sourceRoot":"","sources":["../../src/data-objects/pureDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAsE;AAatE,0DAAuE;AAGvE;;;;;;GAMG;AACH,MAAsB,cACrB,SAAQ,6BAAoC;IA8D5C,YAAmB,KAA0B;QAC5C,KAAK,EAAE,CAAC;QA5DD,cAAS,GAAG,KAAK,CAAC;QA6DzB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QAEjC,IAAA,qBAAM,EACJ,IAAI,CAAC,OAAe,CAAC,WAAW,KAAK,SAAS,EAC/C,KAAK,CAAC,8CAA8C,CACpD,CAAC;QACD,IAAI,CAAC,OAAe,CAAC,WAAW,GAAG,IAAI,CAAC;QAEzC,2BAA2B;QAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;YACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,I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wCA+LC","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 { assert, EventForwarder } from \"@fluidframework/common-utils\";\nimport {\n\tIFluidHandle,\n\tIFluidLoadable,\n\tIFluidRouter,\n\tIProvideFluidHandle,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { IDirectory } from \"@fluidframework/map\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { defaultFluidObjectRequestHandler } from \"../request-handlers\";\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 */\nexport abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes>\n\textends EventForwarder<I[\"Events\"] & IEvent>\n\timplements IFluidLoadable, IFluidRouter, IProvideFluidHandle\n{\n\tprivate _disposed = false;\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 disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tpublic get id() {\n\t\treturn this.runtime.id;\n\t}\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\tassert(obj !== undefined, 0x0bc /* \"The runtime's handle is not initialized yet!\" */);\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\n\t\t// Container event handlers\n\t\tthis.runtime.once(\"dispose\", () => {\n\t\t\tthis._disposed = true;\n\t\t\tthis.dispose();\n\t\t});\n\t}\n\n\t// #region IFluidRouter\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 defaultFluidObjectRequestHandler(this, req);\n\t}\n\n\t// #endregion IFluidRouter\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 * Retrieve Fluid object using the handle get\n\t *\n\t * @param key - key that object (handle/id) is stored with in the directory\n\t * @param directory - directory containing the object\n\t * @param getObjectFromDirectory - optional callback for fetching object from the directory, allows users to\n\t * define custom types/getters for object retrieval\n\t */\n\tpublic async getFluidObjectFromDirectory<T extends IFluidLoadable>(\n\t\tkey: string,\n\t\tdirectory: IDirectory,\n\t\tgetObjectFromDirectory?: (id: string, directory: IDirectory) => IFluidHandle | undefined,\n\t): Promise<T | undefined> {\n\t\tconst handleMaybe = getObjectFromDirectory\n\t\t\t? getObjectFromDirectory(key, directory)\n\t\t\t: directory.get(key);\n\t\tconst handle = handleMaybe?.IFluidHandle;\n\t\tif (handle) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn handle.get();\n\t\t}\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\t/**\n\t * Called when the host container closes and disposes itself\n\t */\n\tpublic dispose(): void {\n\t\tsuper.dispose();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC5E,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;CACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","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 {
|
|
1
|
+
{"version":3,"file":"types.js","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 { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { IEvent } from \"@fluidframework/common-definitions\";\n\n/**\n * This type is used as the base generic input to DataObject and PureDataObject.\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\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"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @packageDocumentation
|
|
18
18
|
*/
|
|
19
|
-
export { DataObjectFactory, IRootDataObjectFactory, PureDataObjectFactory } from "./data-object-factories";
|
|
19
|
+
export { DataObjectFactory, IRootDataObjectFactory, PureDataObjectFactory, } from "./data-object-factories";
|
|
20
20
|
export { DataObject, DataObjectTypes, IDataObjectProps, PureDataObject } from "./data-objects";
|
|
21
21
|
export { BaseContainerRuntimeFactory, ContainerRuntimeFactoryWithDefaultDataStore, } from "./container-runtime-factories";
|
|
22
|
-
export { BaseContainerService, ContainerServiceRegistryEntries, generateContainerServicesRequestHandler, serviceRoutePathRoot, } from "./container-services";
|
|
23
22
|
export { defaultFluidObjectRequestHandler, defaultRouteRequestHandler, mountableViewRequestHandler, } from "./request-handlers";
|
|
24
|
-
export { getDefaultObjectFromContainer, getObjectFromContainer, getObjectWithIdFromContainer,
|
|
23
|
+
export { getDefaultObjectFromContainer, getObjectFromContainer, getObjectWithIdFromContainer, } from "./utils";
|
|
25
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EACN,2BAA2B,EAC3B,2CAA2C,GAC3C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,GAC5B,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.getObjectWithIdFromContainer = exports.getObjectFromContainer = exports.getDefaultObjectFromContainer = exports.mountableViewRequestHandler = exports.defaultRouteRequestHandler = exports.defaultFluidObjectRequestHandler = exports.ContainerRuntimeFactoryWithDefaultDataStore = exports.BaseContainerRuntimeFactory = exports.PureDataObject = exports.DataObject = exports.PureDataObjectFactory = exports.DataObjectFactory = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* The `aqueduct` package is a library for building Fluid objects and Fluid
|
|
10
10
|
* containers within the Fluid Framework. Its goal is to provide a thin base
|
|
@@ -28,10 +28,6 @@ Object.defineProperty(exports, "PureDataObject", { enumerable: true, get: functi
|
|
|
28
28
|
var container_runtime_factories_1 = require("./container-runtime-factories");
|
|
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 container_services_1 = require("./container-services");
|
|
32
|
-
Object.defineProperty(exports, "BaseContainerService", { enumerable: true, get: function () { return container_services_1.BaseContainerService; } });
|
|
33
|
-
Object.defineProperty(exports, "generateContainerServicesRequestHandler", { enumerable: true, get: function () { return container_services_1.generateContainerServicesRequestHandler; } });
|
|
34
|
-
Object.defineProperty(exports, "serviceRoutePathRoot", { enumerable: true, get: function () { return container_services_1.serviceRoutePathRoot; } });
|
|
35
31
|
var request_handlers_1 = require("./request-handlers");
|
|
36
32
|
Object.defineProperty(exports, "defaultFluidObjectRequestHandler", { enumerable: true, get: function () { return request_handlers_1.defaultFluidObjectRequestHandler; } });
|
|
37
33
|
Object.defineProperty(exports, "defaultRouteRequestHandler", { enumerable: true, get: function () { return request_handlers_1.defaultRouteRequestHandler; } });
|
|
@@ -40,5 +36,4 @@ var utils_1 = require("./utils");
|
|
|
40
36
|
Object.defineProperty(exports, "getDefaultObjectFromContainer", { enumerable: true, get: function () { return utils_1.getDefaultObjectFromContainer; } });
|
|
41
37
|
Object.defineProperty(exports, "getObjectFromContainer", { enumerable: true, get: function () { return utils_1.getObjectFromContainer; } });
|
|
42
38
|
Object.defineProperty(exports, "getObjectWithIdFromContainer", { enumerable: true, get: function () { return utils_1.getObjectWithIdFromContainer; } });
|
|
43
|
-
Object.defineProperty(exports, "waitForAttach", { enumerable: true, get: function () { return utils_1.waitForAttach; } });
|
|
44
39
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;;;;GAaG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;;;;GAaG;AAEH,iEAIiC;AAHhC,0HAAA,iBAAiB,OAAA;AAEjB,8HAAA,qBAAqB,OAAA;AAEtB,+CAA+F;AAAtF,0GAAA,UAAU,OAAA;AAAqC,8GAAA,cAAc,OAAA;AACtE,6EAGuC;AAFtC,0IAAA,2BAA2B,OAAA;AAC3B,0JAAA,2CAA2C,OAAA;AAE5C,uDAI4B;AAH3B,oIAAA,gCAAgC,OAAA;AAChC,8HAAA,0BAA0B,OAAA;AAC1B,+HAAA,2BAA2B,OAAA;AAE5B,iCAIiB;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"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { FluidObject, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
-
import { IFluidMountableViewClass } from "@fluidframework/view-interfaces";
|
|
7
|
+
import type { IFluidMountableViewClass } from "@fluidframework/view-interfaces";
|
|
8
8
|
import { RuntimeRequestHandler } from "@fluidframework/request-handler";
|
|
9
9
|
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../../src/request-handlers/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../../src/request-handlers/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAA8B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,aAAa,EAAqB,MAAM,+BAA+B,CAAC;AAEjF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,uBACnB,wBAAwB,YAClC,qBAAqB,EAAE,eAGV,aAAa,WAAW,iBAAiB,uBA4BhE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,kBAAmB,MAAM,eACxC,QAAQ,WAAW,iBAAiB,mCAU3D,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,gCAAgC,CAC/C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,QAAQ,GACf,SAAS,CAIX"}
|
|
@@ -35,7 +35,9 @@ const mountableViewRequestHandler = (MountableViewClass, handlers) => {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
const response = await nestedHandler(newRequest, runtime);
|
|
38
|
-
if (mountableView &&
|
|
38
|
+
if (mountableView &&
|
|
39
|
+
response.status === 200 &&
|
|
40
|
+
MountableViewClass.canMount(response.value)) {
|
|
39
41
|
return {
|
|
40
42
|
status: 200,
|
|
41
43
|
mimeType: "fluid/object",
|
|
@@ -57,7 +59,7 @@ const defaultRouteRequestHandler = (defaultRootId) => {
|
|
|
57
59
|
if (parser.pathParts.length === 0) {
|
|
58
60
|
return runtime.IFluidHandleContext.resolveHandle({
|
|
59
61
|
url: `/${defaultRootId}${parser.query}`,
|
|
60
|
-
headers: request.headers
|
|
62
|
+
headers: request.headers,
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
return undefined; // continue search
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../../src/request-handlers/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,qEAAoG;AACpG,iEAAiF;AAEjF;;;;;;;;;;GAUG;AACI,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../../src/request-handlers/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,qEAAoG;AACpG,iEAAiF;AAEjF;;;;;;;;;;GAUG;AACI,MAAM,2BAA2B,GAAG,CAC1C,kBAA4C,EAC5C,QAAiC,EAChC,EAAE;IACH,MAAM,aAAa,GAAG,IAAA,4CAA0B,EAAC,GAAG,QAAQ,CAAC,CAAC;IAC9D,OAAO,KAAK,EAAE,OAAsB,EAAE,OAA0B,EAAE,EAAE;;QACnE,MAAM,aAAa,GAAG,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,aAAa,MAAK,IAAI,CAAC;QAC9D,IAAI,UAAU,GAAa,OAAO,CAAC;QACnC,IAAI,aAAa,EAAE;YAClB,wDAAwD;YACxD,mDAAmD;YACnD,MAAM,OAAO,qBAAwB,OAAO,CAAC,OAAO,CAAE,CAAC;YACvD,OAAQ,OAAe,CAAC,aAAa,CAAC;YACtC,UAAU,GAAG;gBACZ,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,OAAO;aACP,CAAC;SACF;QACD,MAAM,Q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AAW,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\";\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 */\nexport const mountableViewRequestHandler = (\n\tMountableViewClass: IFluidMountableViewClass,\n\thandlers: RuntimeRequestHandler[],\n) => {\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 */\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 */\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"]}
|
|
@@ -10,7 +10,9 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
|
10
10
|
const request_handler_1 = require("@fluidframework/request-handler");
|
|
11
11
|
const request_handlers_1 = require("../request-handlers");
|
|
12
12
|
class MockRuntime {
|
|
13
|
-
get IFluidHandleContext() {
|
|
13
|
+
get IFluidHandleContext() {
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
14
16
|
async getRootDataStore(id, wait) {
|
|
15
17
|
if (id === "objectId") {
|
|
16
18
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultRoute.spec.js","sourceRoot":"","sources":["../../src/test/defaultRoute.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,kEAAkE;;AAElE,mCAA0C;AAC1C,iEAAiF;
|
|
1
|
+
{"version":3,"file":"defaultRoute.spec.js","sourceRoot":"","sources":["../../src/test/defaultRoute.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,kEAAkE;;AAElE,mCAA0C;AAC1C,iEAAiF;AAIjF,qEAA4E;AAC5E,0DAAiE;AAEjE,MAAM,WAAW;IAChB,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI;QACrC,IAAI,EAAE,KAAK,UAAU,EAAE;YACtB,OAAO;gBACN,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;oBACpB,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE;wBACxC,OAAO,IAAA,2CAAyB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;qBACnD;oBACD,OAAO,IAAA,iCAAiB,EAAC,CAAC,CAAC,CAAC;gBAC7B,CAAC;aACyB,CAAC;SAC5B;QAED,IAAA,eAAM,EAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IAClC,CAAC;IAES,KAAK,CAAC,aAAa,CAAC,OAAiB;;QAC9C,MAAM,aAAa,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEpD,IAAI,aAAa,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACvC,MAAM,IAAI,GACT,OAAO,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,CAAA,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;YAE/E,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,EAAE,EAAE,EAAE,CAAC,CAAC;QACvE,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACzD,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC;QAClB,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACpC,eAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAChE,MAAM,OAAO,GAAG,IAAA,6CAA0B,EAAC,QAAQ,CAAC,CAAC;QAErD,MAAM,aAAa,GAAG,6BAAa,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACjF,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,cAAc,CAAC,SAAS,CAAC,CAAC;QAEhC,MAAM,cAAc,GAAG,6BAAa,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACnF,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable @typescript-eslint/consistent-type-assertions */\n\nimport { strict as assert } from \"assert\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IFluidDataStoreChannel } from \"@fluidframework/runtime-definitions\";\nimport { IRequest, IResponse, IFluidRouter } from \"@fluidframework/core-interfaces\";\nimport { createFluidObjectResponse } from \"@fluidframework/request-handler\";\nimport { defaultRouteRequestHandler } from \"../request-handlers\";\n\nclass MockRuntime {\n\tpublic get IFluidHandleContext() {\n\t\treturn this;\n\t}\n\n\tpublic async getRootDataStore(id, wait): Promise<IFluidRouter> {\n\t\tif (id === \"objectId\") {\n\t\t\treturn {\n\t\t\t\trequest: async (r) => {\n\t\t\t\t\tif (r.url === \"/\" || r.url === \"/route\") {\n\t\t\t\t\t\treturn createFluidObjectResponse({ route: r.url });\n\t\t\t\t\t}\n\t\t\t\t\treturn create404Response(r);\n\t\t\t\t},\n\t\t\t} as IFluidDataStoreChannel;\n\t\t}\n\n\t\tassert(wait !== true);\n\t\tthrow new Error(\"No data store\");\n\t}\n\n\tprotected async resolveHandle(request: IRequest) {\n\t\tconst requestParser = RequestParser.create(request);\n\n\t\tif (requestParser.pathParts.length > 0) {\n\t\t\tconst wait =\n\t\t\t\ttypeof request.headers?.wait === \"boolean\" ? request.headers.wait : undefined;\n\n\t\t\tconst dataStore = await this.getRootDataStore(requestParser.pathParts[0], wait);\n\t\t\tconst subRequest = requestParser.createSubRequest(1);\n\t\t\treturn dataStore.request(subRequest);\n\t\t}\n\t\treturn create404Response(request);\n\t}\n}\n\nasync function assertRejected(p: Promise<IResponse | undefined>) {\n\ttry {\n\t\tconst res = await p;\n\t\tassert(res === undefined || res.status === 404, \"not rejected\");\n\t} catch (err) {}\n}\n\ndescribe(\"defaultRouteRequestHandler\", () => {\n\tconst runtime = new MockRuntime() as any as IContainerRuntime;\n\n\tit(\"Data store request with default ID\", async () => {\n\t\tconst handler = defaultRouteRequestHandler(\"objectId\");\n\n\t\tconst requestParser = RequestParser.create({ url: \"\", headers: {} });\n\t\tconst response = await handler(requestParser, runtime);\n\t\tassert(response);\n\t\tassert.equal(response.status, 200);\n\t\tassert.equal(response.value.route, \"/\");\n\n\t\tconst requestParser2 = RequestParser.create({ url: \"/\", headers: {} });\n\t\tconst response2 = await handler(requestParser2, runtime);\n\t\tassert(response2);\n\t\tassert.equal(response2.status, 200);\n\t\tassert.equal(response.value.route, \"/\");\n\t});\n\n\tit(\"Data store request with non-existing default ID\", async () => {\n\t\tconst handler = defaultRouteRequestHandler(\"foobar\");\n\n\t\tconst requestParser = RequestParser.create({ url: \"\", headers: { wait: true } });\n\t\tconst responseP = handler(requestParser, runtime);\n\t\tawait assertRejected(responseP);\n\n\t\tconst requestParser2 = RequestParser.create({ url: \"/\", headers: { wait: true } });\n\t\tconst responseP2 = handler(requestParser2, runtime);\n\t\tawait assertRejected(responseP2);\n\t});\n});\n"]}
|