@fluidframework/request-handler 2.0.0-dev-rc.1.0.0.228517 → 2.0.0-dev-rc.1.0.0.232845
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/{.eslintrc.js → .eslintrc.cjs} +1 -1
- package/api-report/request-handler.api.md +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/request-handler-untrimmed.d.ts +2 -0
- package/dist/requestHandlers.d.ts +3 -3
- package/dist/requestHandlers.d.ts.map +1 -1
- package/dist/requestHandlers.js.map +1 -1
- package/dist/runtimeRequestHandlerBuilder.d.ts +5 -3
- package/dist/runtimeRequestHandlerBuilder.d.ts.map +1 -1
- package/dist/runtimeRequestHandlerBuilder.js +4 -1
- package/dist/runtimeRequestHandlerBuilder.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.d.mts +1 -1
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/request-handler-untrimmed.d.mts +2 -0
- package/lib/requestHandlers.d.mts +3 -3
- package/lib/requestHandlers.d.mts.map +1 -1
- package/lib/requestHandlers.mjs.map +1 -1
- package/lib/runtimeRequestHandlerBuilder.d.mts +5 -3
- package/lib/runtimeRequestHandlerBuilder.d.mts.map +1 -1
- package/lib/runtimeRequestHandlerBuilder.mjs +4 -1
- package/lib/runtimeRequestHandlerBuilder.mjs.map +1 -1
- package/package.json +10 -10
- package/src/index.ts +1 -1
- package/src/requestHandlers.ts +3 -3
- package/src/runtimeRequestHandlerBuilder.ts +10 -6
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
extends: [require.resolve("@fluidframework/eslint-config-fluid/
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
|
|
8
8
|
parserOptions: {
|
|
9
9
|
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
10
|
},
|
|
@@ -9,7 +9,7 @@ import { IRequest } from '@fluidframework/core-interfaces';
|
|
|
9
9
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
10
10
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
11
11
|
|
|
12
|
-
// @internal @deprecated
|
|
12
|
+
// @internal @deprecated
|
|
13
13
|
export function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
14
14
|
|
|
15
15
|
// @alpha @deprecated
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { RuntimeRequestHandler } from "./requestHandlers";
|
|
5
|
+
export { type RuntimeRequestHandler } from "./requestHandlers";
|
|
6
6
|
export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+EAA4E;AAAnE,0IAAA,0BAA0B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { RuntimeRequestHandler } from \"./requestHandlers\";\nexport { buildRuntimeRequestHandler } from \"./runtimeRequestHandlerBuilder\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+EAA4E;AAAnE,0IAAA,0BAA0B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { type RuntimeRequestHandler } from \"./requestHandlers\";\nexport { buildRuntimeRequestHandler } from \"./runtimeRequestHandlerBuilder\";\n"]}
|
|
@@ -4,6 +4,8 @@ import { IResponse } from '@fluidframework/core-interfaces';
|
|
|
4
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* Deprecated.
|
|
8
|
+
*
|
|
7
9
|
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
8
10
|
*
|
|
9
11
|
* @internal
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
-
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
5
|
+
import { type IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
+
import { type RequestParser } from "@fluidframework/runtime-utils";
|
|
8
8
|
/**
|
|
9
9
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
10
10
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.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 { IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { 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 * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @alpha\n */\nexport type RuntimeRequestHandler = (\n\trequest: RequestParser,\n\truntime: IContainerRuntime,\n) => Promise<IResponse | undefined>;\n"]}
|
|
1
|
+
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.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 { type IResponse } from \"@fluidframework/core-interfaces\";\nimport { type IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { type 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 * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @alpha\n */\nexport type RuntimeRequestHandler = (\n\trequest: RequestParser,\n\truntime: IContainerRuntime,\n) => Promise<IResponse | undefined>;\n"]}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
-
import { RuntimeRequestHandler } from "./requestHandlers";
|
|
5
|
+
import { type IRequest, type IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
+
import { type RuntimeRequestHandler } from "./requestHandlers";
|
|
8
8
|
/**
|
|
9
|
+
* Deprecated.
|
|
10
|
+
*
|
|
9
11
|
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
10
12
|
*
|
|
11
13
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAGvF,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA6B/D;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAEzC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,GAClC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,SAAS,CAAC,CAKvE"}
|
|
@@ -33,12 +33,15 @@ class RuntimeRequestHandlerBuilder {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
+
* Deprecated.
|
|
37
|
+
*
|
|
36
38
|
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
37
39
|
*
|
|
38
40
|
* @internal
|
|
39
41
|
*/
|
|
42
|
+
function buildRuntimeRequestHandler(
|
|
40
43
|
// eslint-disable-next-line import/no-deprecated
|
|
41
|
-
|
|
44
|
+
...handlers) {
|
|
42
45
|
const builder = new RuntimeRequestHandlerBuilder();
|
|
43
46
|
builder.pushHandler(...handlers);
|
|
44
47
|
return async (request, runtime) => builder.handleRequest(request, runtime);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAAiF;AAIjF;;;GAGG;AACH,MAAM,4BAA4B;IAAlC;QACC,gDAAgD;QAC/B,aAAQ,GAA4B,EAAE,CAAC;IAmBzD,CAAC;IAjBA,gDAAgD;IACzC,WAAW,CAAC,GAAG,QAAiC;QACtD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SAChC;IACF,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACvE,MAAM,MAAM,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC3B,OAAO,QAAQ,CAAC;aAChB;SACD;QACD,OAAO,IAAA,iCAAiB,EAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACD;AAED
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAAiF;AAIjF;;;GAGG;AACH,MAAM,4BAA4B;IAAlC;QACC,gDAAgD;QAC/B,aAAQ,GAA4B,EAAE,CAAC;IAmBzD,CAAC;IAjBA,gDAAgD;IACzC,WAAW,CAAC,GAAG,QAAiC;QACtD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SAChC;IACF,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACvE,MAAM,MAAM,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC3B,OAAO,QAAQ,CAAC;aAChB;SACD;QACD,OAAO,IAAA,iCAAiB,EAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACD;AAED;;;;;;GAMG;AACH,SAAgB,0BAA0B;AACzC,gDAAgD;AAChD,GAAG,QAAiC;IAEpC,MAAM,OAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;IACnD,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE,CAC9D,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AARD,gEAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IRequest, type IResponse } from \"@fluidframework/core-interfaces\";\nimport { type IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\n// eslint-disable-next-line import/no-deprecated\nimport { type RuntimeRequestHandler } from \"./requestHandlers\";\n\n/**\n * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.\n * The provided handlers sequentially applied until one is able to satisfy the request.\n */\nclass RuntimeRequestHandlerBuilder {\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly handlers: RuntimeRequestHandler[] = [];\n\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic pushHandler(...handlers: RuntimeRequestHandler[]): void {\n\t\tif (handlers !== undefined) {\n\t\t\tthis.handlers.push(...handlers);\n\t\t}\n\t}\n\n\tpublic async handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse> {\n\t\tconst parser = RequestParser.create(request);\n\t\tfor (const handler of this.handlers) {\n\t\t\tconst response = await handler(parser, runtime);\n\t\t\tif (response !== undefined) {\n\t\t\t\treturn response;\n\t\t\t}\n\t\t}\n\t\treturn create404Response(request);\n\t}\n}\n\n/**\n * Deprecated.\n *\n * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @internal\n */\nexport function buildRuntimeRequestHandler(\n\t// eslint-disable-next-line import/no-deprecated\n\t...handlers: RuntimeRequestHandler[]\n): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse> {\n\tconst builder = new RuntimeRequestHandlerBuilder();\n\tbuilder.pushHandler(...handlers);\n\treturn async (request: IRequest, runtime: IContainerRuntime) =>\n\t\tbuilder.handleRequest(request, runtime);\n}\n"]}
|
package/dist/tsdoc-metadata.json
CHANGED
package/lib/index.d.mts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { RuntimeRequestHandler } from "./requestHandlers.mjs";
|
|
5
|
+
export { type RuntimeRequestHandler } from "./requestHandlers.mjs";
|
|
6
6
|
export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.mjs";
|
|
7
7
|
//# sourceMappingURL=index.d.mts.map
|
package/lib/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,qBAAqB,EAAE;
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,KAAK,qBAAqB,EAAE;OAC9B,EAAE,0BAA0B,EAAE"}
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,0BAA0B,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { RuntimeRequestHandler } from \"./requestHandlers\";\nexport { buildRuntimeRequestHandler } from \"./runtimeRequestHandlerBuilder\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,0BAA0B,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { type RuntimeRequestHandler } from \"./requestHandlers\";\nexport { buildRuntimeRequestHandler } from \"./runtimeRequestHandlerBuilder\";\n"]}
|
|
@@ -4,6 +4,8 @@ import { IResponse } from '@fluidframework/core-interfaces';
|
|
|
4
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* Deprecated.
|
|
8
|
+
*
|
|
7
9
|
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
8
10
|
*
|
|
9
11
|
* @internal
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
-
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
5
|
+
import { type IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
+
import { type RequestParser } from "@fluidframework/runtime-utils";
|
|
8
8
|
/**
|
|
9
9
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
10
10
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.d.mts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,SAAS,EAAE,MAAM,iCAAiC;
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.mts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,KAAK,SAAS,EAAE,MAAM,iCAAiC;OACzD,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C;OAC/E,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B;AAElE;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.mjs","sourceRoot":"","sources":["../src/requestHandlers.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 { IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { 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 * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @alpha\n */\nexport type RuntimeRequestHandler = (\n\trequest: RequestParser,\n\truntime: IContainerRuntime,\n) => Promise<IResponse | undefined>;\n"]}
|
|
1
|
+
{"version":3,"file":"requestHandlers.mjs","sourceRoot":"","sources":["../src/requestHandlers.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 { type IResponse } from \"@fluidframework/core-interfaces\";\nimport { type IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { type 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 * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @alpha\n */\nexport type RuntimeRequestHandler = (\n\trequest: RequestParser,\n\truntime: IContainerRuntime,\n) => Promise<IResponse | undefined>;\n"]}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
-
import { RuntimeRequestHandler } from "./requestHandlers.mjs";
|
|
5
|
+
import { type IRequest, type IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
+
import { type RuntimeRequestHandler } from "./requestHandlers.mjs";
|
|
8
8
|
/**
|
|
9
|
+
* Deprecated.
|
|
10
|
+
*
|
|
9
11
|
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
10
12
|
*
|
|
11
13
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.d.mts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC;
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.d.mts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,iCAAiC;OACxE,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C;OAG/E,EAAE,KAAK,qBAAqB,EAAE;AA6BrC;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAEzC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,GAClC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,SAAS,CAAC,CAKvE"}
|
|
@@ -30,12 +30,15 @@ class RuntimeRequestHandlerBuilder {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
+
* Deprecated.
|
|
34
|
+
*
|
|
33
35
|
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
34
36
|
*
|
|
35
37
|
* @internal
|
|
36
38
|
*/
|
|
39
|
+
export function buildRuntimeRequestHandler(
|
|
37
40
|
// eslint-disable-next-line import/no-deprecated
|
|
38
|
-
|
|
41
|
+
...handlers) {
|
|
39
42
|
const builder = new RuntimeRequestHandlerBuilder();
|
|
40
43
|
builder.pushHandler(...handlers);
|
|
41
44
|
return async (request, runtime) => builder.handleRequest(request, runtime);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.mjs","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B;AAIhF;;;GAGG;AACH,MAAM,4BAA4B;IAAlC;QACC,gDAAgD;QAC/B,aAAQ,GAA4B,EAAE,CAAC;IAmBzD,CAAC;IAjBA,gDAAgD;IACzC,WAAW,CAAC,GAAG,QAAiC;QACtD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SAChC;IACF,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACvE,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC3B,OAAO,QAAQ,CAAC;aAChB;SACD;QACD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACD;AAED
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.mjs","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B;AAIhF;;;GAGG;AACH,MAAM,4BAA4B;IAAlC;QACC,gDAAgD;QAC/B,aAAQ,GAA4B,EAAE,CAAC;IAmBzD,CAAC;IAjBA,gDAAgD;IACzC,WAAW,CAAC,GAAG,QAAiC;QACtD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SAChC;IACF,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACvE,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC3B,OAAO,QAAQ,CAAC;aAChB;SACD;QACD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACD;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B;AACzC,gDAAgD;AAChD,GAAG,QAAiC;IAEpC,MAAM,OAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;IACnD,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE,CAC9D,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IRequest, type IResponse } from \"@fluidframework/core-interfaces\";\nimport { type IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\n// eslint-disable-next-line import/no-deprecated\nimport { type RuntimeRequestHandler } from \"./requestHandlers\";\n\n/**\n * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.\n * The provided handlers sequentially applied until one is able to satisfy the request.\n */\nclass RuntimeRequestHandlerBuilder {\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly handlers: RuntimeRequestHandler[] = [];\n\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic pushHandler(...handlers: RuntimeRequestHandler[]): void {\n\t\tif (handlers !== undefined) {\n\t\t\tthis.handlers.push(...handlers);\n\t\t}\n\t}\n\n\tpublic async handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse> {\n\t\tconst parser = RequestParser.create(request);\n\t\tfor (const handler of this.handlers) {\n\t\t\tconst response = await handler(parser, runtime);\n\t\t\tif (response !== undefined) {\n\t\t\t\treturn response;\n\t\t\t}\n\t\t}\n\t\treturn create404Response(request);\n\t}\n}\n\n/**\n * Deprecated.\n *\n * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @internal\n */\nexport function buildRuntimeRequestHandler(\n\t// eslint-disable-next-line import/no-deprecated\n\t...handlers: RuntimeRequestHandler[]\n): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse> {\n\tconst builder = new RuntimeRequestHandlerBuilder();\n\tbuilder.pushHandler(...handlers);\n\treturn async (request: IRequest, runtime: IContainerRuntime) =>\n\t\tbuilder.handleRequest(request, runtime);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/request-handler",
|
|
3
|
-
"version": "2.0.0-dev-rc.1.0.0.
|
|
3
|
+
"version": "2.0.0-dev-rc.1.0.0.232845",
|
|
4
4
|
"description": "A simple request handling library for Fluid Framework",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -87,22 +87,22 @@
|
|
|
87
87
|
"temp-directory": "nyc/.nyc_output"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.1.0.0.
|
|
91
|
-
"@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.
|
|
92
|
-
"@fluidframework/core-utils": "2.0.0-dev-rc.1.0.0.
|
|
93
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.1.0.0.
|
|
94
|
-
"@fluidframework/runtime-utils": "2.0.0-dev-rc.1.0.0.
|
|
90
|
+
"@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.1.0.0.232845",
|
|
91
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.232845",
|
|
92
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.1.0.0.232845",
|
|
93
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.1.0.0.232845",
|
|
94
|
+
"@fluidframework/runtime-utils": "2.0.0-dev-rc.1.0.0.232845"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@arethetypeswrong/cli": "^0.13.3",
|
|
98
98
|
"@fluid-tools/build-cli": "^0.29.0",
|
|
99
99
|
"@fluidframework/build-common": "^2.0.3",
|
|
100
100
|
"@fluidframework/build-tools": "^0.29.0",
|
|
101
|
-
"@fluidframework/eslint-config-fluid": "^3.
|
|
102
|
-
"@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.
|
|
101
|
+
"@fluidframework/eslint-config-fluid": "^3.3.0",
|
|
102
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.232845",
|
|
103
103
|
"@fluidframework/request-handler-previous": "npm:@fluidframework/request-handler@2.0.0-internal.8.0.0",
|
|
104
|
-
"@fluidframework/test-runtime-utils": "2.0.0-dev-rc.1.0.0.
|
|
105
|
-
"@microsoft/api-extractor": "^7.
|
|
104
|
+
"@fluidframework/test-runtime-utils": "2.0.0-dev-rc.1.0.0.232845",
|
|
105
|
+
"@microsoft/api-extractor": "^7.39.1",
|
|
106
106
|
"@types/diff": "^3.5.1",
|
|
107
107
|
"@types/mocha": "^9.1.1",
|
|
108
108
|
"@types/node": "^18.19.0",
|
package/src/index.ts
CHANGED
package/src/requestHandlers.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
8
|
-
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
6
|
+
import { type IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
+
import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
8
|
+
import { type RequestParser } from "@fluidframework/runtime-utils";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
6
|
+
import { type IRequest, type IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
+
import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
8
8
|
import { RequestParser, create404Response } from "@fluidframework/runtime-utils";
|
|
9
9
|
// eslint-disable-next-line import/no-deprecated
|
|
10
|
-
import { RuntimeRequestHandler } from "./requestHandlers";
|
|
10
|
+
import { type RuntimeRequestHandler } from "./requestHandlers";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
@@ -18,7 +18,7 @@ class RuntimeRequestHandlerBuilder {
|
|
|
18
18
|
private readonly handlers: RuntimeRequestHandler[] = [];
|
|
19
19
|
|
|
20
20
|
// eslint-disable-next-line import/no-deprecated
|
|
21
|
-
public pushHandler(...handlers: RuntimeRequestHandler[]) {
|
|
21
|
+
public pushHandler(...handlers: RuntimeRequestHandler[]): void {
|
|
22
22
|
if (handlers !== undefined) {
|
|
23
23
|
this.handlers.push(...handlers);
|
|
24
24
|
}
|
|
@@ -37,12 +37,16 @@ class RuntimeRequestHandlerBuilder {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
+
* Deprecated.
|
|
41
|
+
*
|
|
40
42
|
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
41
43
|
*
|
|
42
44
|
* @internal
|
|
43
45
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
export function buildRuntimeRequestHandler(
|
|
47
|
+
// eslint-disable-next-line import/no-deprecated
|
|
48
|
+
...handlers: RuntimeRequestHandler[]
|
|
49
|
+
): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse> {
|
|
46
50
|
const builder = new RuntimeRequestHandlerBuilder();
|
|
47
51
|
builder.pushHandler(...handlers);
|
|
48
52
|
return async (request: IRequest, runtime: IContainerRuntime) =>
|