@fluidframework/request-handler 0.51.0 → 0.52.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/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/requestHandlers.d.ts +6 -6
- package/dist/requestHandlers.d.ts.map +1 -1
- package/dist/requestHandlers.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/requestHandlers.d.ts +6 -6
- package/lib/requestHandlers.d.ts.map +1 -1
- package/lib/requestHandlers.js.map +1 -1
- package/package.json +7 -7
- package/src/packageVersion.ts +1 -1
- package/src/requestHandlers.ts +5 -3
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/request-handler";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.52.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/request-handler";
|
|
11
|
-
exports.pkgVersion = "0.
|
|
11
|
+
exports.pkgVersion = "0.52.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/request-handler\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/request-handler\";\nexport const pkgVersion = \"0.52.0\";\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IFluidObject, IResponse, IRequest, IFluidHandle, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
5
|
+
import { IFluidObject, IResponse, IRequest, IFluidHandle, IFluidLoadable, FluidObject } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
7
|
import { IContainerRuntimeBase } from "@fluidframework/runtime-definitions";
|
|
8
8
|
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
@@ -31,10 +31,10 @@ export declare const innerRequestHandler: (request: IRequest, runtime: IContaine
|
|
|
31
31
|
* @returns the result of the request
|
|
32
32
|
*/
|
|
33
33
|
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
34
|
-
export declare const createFluidObjectResponse: (fluidObject:
|
|
35
|
-
status:
|
|
36
|
-
mimeType:
|
|
37
|
-
value:
|
|
34
|
+
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
35
|
+
status: 200;
|
|
36
|
+
mimeType: "fluid/object";
|
|
37
|
+
value: FluidObject;
|
|
38
38
|
};
|
|
39
|
-
export declare function handleFromLegacyUri<T = IFluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
39
|
+
export declare function handleFromLegacyUri<T = IFluidObject & FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
40
40
|
//# sourceMappingURL=requestHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAqB,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEjF;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,KAChF,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAEtC;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,YAAmB,QAAQ,WAAW,qBAAqB,uBACrC,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YAAmB,QAAQ,WAAW,iBAAiB,uBAW9F,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBAAiB,WAAW,KAC9D;IAAC,QAAQ,GAAG,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAE7D,CAAC;AA6BF,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,EAC/E,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC/B,YAAY,CAAC,CAAC,CAAC,CAEjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;
|
|
1
|
+
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAWtD,iEAAiF;AAWjF;;;;;;;;;GASG;AACI,MAAM,mBAAmB,GAAG,KAAK,EAAE,OAAiB,EAAE,OAA8B,EAAE,EAAE,CAC3F,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAD1C,QAAA,mBAAmB,uBACuB;AAEvD;;;;;GAKG;AACI,MAAM,2BAA2B,GAAG,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE;;IAC/F,MAAM,aAAa,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,cAAO,OAAO,CAAC,OAAO,0CAAE,IAAI,CAAA,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,IAAI;QACA,mEAAmE;QACnE,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,gBAAgB,C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AC;IACtD,CAAC;CACJ;AAED,+DAA+D;AAC/D,SAAgB,mBAAmB,CAC/B,GAAW,EACX,OAA8B;IAE9B,OAAO,IAAI,eAAe,CAAI,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AALD,kDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n IFluidObject,\n IResponse,\n IRequest,\n IFluidHandle,\n IFluidLoadable,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IContainerRuntimeBase } from \"@fluidframework/runtime-definitions\";\nimport { create404Response, RequestParser } from \"@fluidframework/runtime-utils\";\n\n/**\n * A request handler for the container runtime. Each handler should handle a specific request, and return undefined\n * if it does not apply. These handlers are called in series, so there may be other handlers before or after.\n * A handler should only return error if the request is for a route the handler owns, and there is a problem with\n * the route, or fulling the specific request.\n */\nexport type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime)\n => Promise<IResponse | undefined>;\n\n/**\n * @deprecated - please avoid adding new references to this API! Instead prefer rootDataObjectRequestHandler.\n * It exposes internal container guts to external world, which is not ideal.\n * It also relies heavily on internal routing schema (formation of handle URIs) which will change in future\n * And last, but not least, it does not allow any policy to be implemented around GC of data stores exposed\n * through internal URIs. I.e. if there are no other references to such objects, they will be GC'd and\n * external links would get broken. Maybe that's what is needed in some cases, but better, more centralized\n * handling of external URI to internal handle is required (in future, we will support weak handle references,\n * that will allow any GC policy to be implemented by container authors.)\n */\nexport const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n runtime.IFluidHandleContext.resolveHandle(request);\n\n/**\n * A request handler to expose access to all root data stores in the container by id.\n * @param request - the request for the root data store. The first path part must be the data store's ID.\n * @param runtime - the container runtime\n * @returns the result of the request\n */\nexport const rootDataStoreRequestHandler = async (request: IRequest, runtime: IContainerRuntime) => {\n const requestParser = RequestParser.create(request);\n const id = requestParser.pathParts[0];\n const wait = typeof request.headers?.wait === \"boolean\" ? request.headers.wait : undefined;\n try {\n // getRootDataStore currently throws if the data store is not found\n const rootDataStore = await runtime.getRootDataStore(id, wait);\n return rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));\n } catch (error) {\n return create404Response(request);\n }\n};\n\nexport const createFluidObjectResponse = (fluidObject: FluidObject):\n {status: 200, mimeType: \"fluid/object\", value: FluidObject} => {\n return { status: 200, mimeType: \"fluid/object\", value: fluidObject };\n};\n\nclass LegacyUriHandle<T = IFluidObject & FluidObject & IFluidLoadable> implements IFluidHandle<T> {\n public readonly isAttached = true;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public constructor(public readonly absolutePath, public readonly runtime: IContainerRuntimeBase) {\n }\n\n public attachGraph() {\n assert(false, 0x0ca /* \"Trying to use legacy graph attach!\" */);\n }\n\n public async get(): Promise<any> {\n const response = await this.runtime.IFluidHandleContext.resolveHandle({ url: this.absolutePath });\n if (response.status === 200 && response.mimeType === \"fluid/object\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return response.value;\n }\n throw new Error(`Failed to resolve container path ${this.absolutePath}`);\n }\n\n public bind(handle: IFluidHandle) {\n throw new Error(\"Cannot bind to LegacyUriHandle\");\n }\n}\n\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\nexport function handleFromLegacyUri<T = IFluidObject & FluidObject & IFluidLoadable>(\n uri: string,\n runtime: IContainerRuntimeBase,\n): IFluidHandle<T> {\n return new LegacyUriHandle<T>(uri, runtime);\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/request-handler";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.52.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/request-handler\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/request-handler\";\nexport const pkgVersion = \"0.52.0\";\n"]}
|
package/lib/requestHandlers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IFluidObject, IResponse, IRequest, IFluidHandle, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
5
|
+
import { IFluidObject, IResponse, IRequest, IFluidHandle, IFluidLoadable, FluidObject } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
7
|
import { IContainerRuntimeBase } from "@fluidframework/runtime-definitions";
|
|
8
8
|
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
@@ -31,10 +31,10 @@ export declare const innerRequestHandler: (request: IRequest, runtime: IContaine
|
|
|
31
31
|
* @returns the result of the request
|
|
32
32
|
*/
|
|
33
33
|
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
34
|
-
export declare const createFluidObjectResponse: (fluidObject:
|
|
35
|
-
status:
|
|
36
|
-
mimeType:
|
|
37
|
-
value:
|
|
34
|
+
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
35
|
+
status: 200;
|
|
36
|
+
mimeType: "fluid/object";
|
|
37
|
+
value: FluidObject;
|
|
38
38
|
};
|
|
39
|
-
export declare function handleFromLegacyUri<T = IFluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
39
|
+
export declare function handleFromLegacyUri<T = IFluidObject & FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
40
40
|
//# sourceMappingURL=requestHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAqB,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEjF;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,KAChF,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAEtC;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,YAAmB,QAAQ,WAAW,qBAAqB,uBACrC,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YAAmB,QAAQ,WAAW,iBAAiB,uBAW9F,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBAAiB,WAAW,KAC9D;IAAC,QAAQ,GAAG,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAE7D,CAAC;AA6BF,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,EAC/E,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC/B,YAAY,CAAC,CAAC,CAAC,CAEjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAWtD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAWjF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,OAAiB,EAAE,OAA8B,EAAE,EAAE,CAC3F,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAEvD;;;;;GAKG;AACH,MAA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AO,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAClG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;YACjE,+DAA+D;YAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;SACzB;QACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;CACJ;AAED,+DAA+D;AAC/D,MAAM,UAAU,mBAAmB,CAC/B,GAAW,EACX,OAA8B;IAE9B,OAAO,IAAI,eAAe,CAAI,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n IFluidObject,\n IResponse,\n IRequest,\n IFluidHandle,\n IFluidLoadable,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IContainerRuntimeBase } from \"@fluidframework/runtime-definitions\";\nimport { create404Response, RequestParser } from \"@fluidframework/runtime-utils\";\n\n/**\n * A request handler for the container runtime. Each handler should handle a specific request, and return undefined\n * if it does not apply. These handlers are called in series, so there may be other handlers before or after.\n * A handler should only return error if the request is for a route the handler owns, and there is a problem with\n * the route, or fulling the specific request.\n */\nexport type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime)\n => Promise<IResponse | undefined>;\n\n/**\n * @deprecated - please avoid adding new references to this API! Instead prefer rootDataObjectRequestHandler.\n * It exposes internal container guts to external world, which is not ideal.\n * It also relies heavily on internal routing schema (formation of handle URIs) which will change in future\n * And last, but not least, it does not allow any policy to be implemented around GC of data stores exposed\n * through internal URIs. I.e. if there are no other references to such objects, they will be GC'd and\n * external links would get broken. Maybe that's what is needed in some cases, but better, more centralized\n * handling of external URI to internal handle is required (in future, we will support weak handle references,\n * that will allow any GC policy to be implemented by container authors.)\n */\nexport const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n runtime.IFluidHandleContext.resolveHandle(request);\n\n/**\n * A request handler to expose access to all root data stores in the container by id.\n * @param request - the request for the root data store. The first path part must be the data store's ID.\n * @param runtime - the container runtime\n * @returns the result of the request\n */\nexport const rootDataStoreRequestHandler = async (request: IRequest, runtime: IContainerRuntime) => {\n const requestParser = RequestParser.create(request);\n const id = requestParser.pathParts[0];\n const wait = typeof request.headers?.wait === \"boolean\" ? request.headers.wait : undefined;\n try {\n // getRootDataStore currently throws if the data store is not found\n const rootDataStore = await runtime.getRootDataStore(id, wait);\n return rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));\n } catch (error) {\n return create404Response(request);\n }\n};\n\nexport const createFluidObjectResponse = (fluidObject: FluidObject):\n {status: 200, mimeType: \"fluid/object\", value: FluidObject} => {\n return { status: 200, mimeType: \"fluid/object\", value: fluidObject };\n};\n\nclass LegacyUriHandle<T = IFluidObject & FluidObject & IFluidLoadable> implements IFluidHandle<T> {\n public readonly isAttached = true;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public constructor(public readonly absolutePath, public readonly runtime: IContainerRuntimeBase) {\n }\n\n public attachGraph() {\n assert(false, 0x0ca /* \"Trying to use legacy graph attach!\" */);\n }\n\n public async get(): Promise<any> {\n const response = await this.runtime.IFluidHandleContext.resolveHandle({ url: this.absolutePath });\n if (response.status === 200 && response.mimeType === \"fluid/object\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return response.value;\n }\n throw new Error(`Failed to resolve container path ${this.absolutePath}`);\n }\n\n public bind(handle: IFluidHandle) {\n throw new Error(\"Cannot bind to LegacyUriHandle\");\n }\n}\n\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\nexport function handleFromLegacyUri<T = IFluidObject & FluidObject & IFluidLoadable>(\n uri: string,\n runtime: IContainerRuntimeBase,\n): IFluidHandle<T> {\n return new LegacyUriHandle<T>(uri, runtime);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/request-handler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"description": "A simple request handling library for Fluid Framework",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": "https://github.com/microsoft/FluidFramework",
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@fluidframework/common-utils": "^0.32.1",
|
|
59
|
-
"@fluidframework/container-runtime-definitions": "^0.
|
|
60
|
-
"@fluidframework/core-interfaces": "^0.
|
|
61
|
-
"@fluidframework/runtime-definitions": "^0.
|
|
62
|
-
"@fluidframework/runtime-utils": "^0.
|
|
59
|
+
"@fluidframework/container-runtime-definitions": "^0.52.0",
|
|
60
|
+
"@fluidframework/core-interfaces": "^0.41.0",
|
|
61
|
+
"@fluidframework/runtime-definitions": "^0.52.0",
|
|
62
|
+
"@fluidframework/runtime-utils": "^0.52.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@fluidframework/build-common": "^0.23.0",
|
|
66
66
|
"@fluidframework/eslint-config-fluid": "^0.24.0",
|
|
67
|
-
"@fluidframework/mocha-test-setup": "^0.
|
|
68
|
-
"@fluidframework/test-runtime-utils": "^0.
|
|
67
|
+
"@fluidframework/mocha-test-setup": "^0.52.0",
|
|
68
|
+
"@fluidframework/test-runtime-utils": "^0.52.0",
|
|
69
69
|
"@microsoft/api-extractor": "^7.16.1",
|
|
70
70
|
"@types/diff": "^3.5.1",
|
|
71
71
|
"@types/mocha": "^8.2.2",
|
package/src/packageVersion.ts
CHANGED
package/src/requestHandlers.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
IRequest,
|
|
11
11
|
IFluidHandle,
|
|
12
12
|
IFluidLoadable,
|
|
13
|
+
FluidObject,
|
|
13
14
|
} from "@fluidframework/core-interfaces";
|
|
14
15
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
15
16
|
import { IContainerRuntimeBase } from "@fluidframework/runtime-definitions";
|
|
@@ -56,11 +57,12 @@ export const rootDataStoreRequestHandler = async (request: IRequest, runtime: IC
|
|
|
56
57
|
}
|
|
57
58
|
};
|
|
58
59
|
|
|
59
|
-
export const createFluidObjectResponse = (fluidObject:
|
|
60
|
+
export const createFluidObjectResponse = (fluidObject: FluidObject):
|
|
61
|
+
{status: 200, mimeType: "fluid/object", value: FluidObject} => {
|
|
60
62
|
return { status: 200, mimeType: "fluid/object", value: fluidObject };
|
|
61
63
|
};
|
|
62
64
|
|
|
63
|
-
class LegacyUriHandle<T = IFluidObject & IFluidLoadable> implements IFluidHandle<T> {
|
|
65
|
+
class LegacyUriHandle<T = IFluidObject & FluidObject & IFluidLoadable> implements IFluidHandle<T> {
|
|
64
66
|
public readonly isAttached = true;
|
|
65
67
|
|
|
66
68
|
public get IFluidHandle(): IFluidHandle { return this; }
|
|
@@ -87,7 +89,7 @@ class LegacyUriHandle<T = IFluidObject & IFluidLoadable> implements IFluidHandle
|
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
|
90
|
-
export function handleFromLegacyUri<T = IFluidObject & IFluidLoadable>(
|
|
92
|
+
export function handleFromLegacyUri<T = IFluidObject & FluidObject & IFluidLoadable>(
|
|
91
93
|
uri: string,
|
|
92
94
|
runtime: IContainerRuntimeBase,
|
|
93
95
|
): IFluidHandle<T> {
|