@fluidframework/request-handler 2.0.0-dev-rc.5.0.0.271262 → 2.0.0-dev-rc.5.0.0.272251
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/api-extractor/api-extractor-lint-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-public.esm.json +5 -0
- package/api-report/request-handler.alpha.api.md +4 -4
- package/api-report/request-handler.beta.api.md +4 -4
- package/api-report/request-handler.public.api.md +4 -4
- 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 +3 -3
- package/dist/runtimeRequestHandlerBuilder.d.ts.map +1 -1
- package/dist/runtimeRequestHandlerBuilder.js +4 -2
- package/dist/runtimeRequestHandlerBuilder.js.map +1 -1
- package/lib/requestHandlers.d.ts +3 -3
- package/lib/requestHandlers.d.ts.map +1 -1
- package/lib/requestHandlers.js.map +1 -1
- package/lib/runtimeRequestHandlerBuilder.d.ts +3 -3
- package/lib/runtimeRequestHandlerBuilder.d.ts.map +1 -1
- package/lib/runtimeRequestHandlerBuilder.js +4 -2
- package/lib/runtimeRequestHandlerBuilder.js.map +1 -1
- package/package.json +14 -8
- package/src/requestHandlers.ts +3 -3
- package/src/runtimeRequestHandlerBuilder.ts +3 -3
- package/tsdoc.json +4 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/legacy.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/legacy.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/public.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts"
|
|
5
|
+
}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions/internal';
|
|
8
|
-
import { IRequest } from '@fluidframework/core-interfaces';
|
|
9
|
-
import { IResponse } from '@fluidframework/core-interfaces';
|
|
10
|
-
import { RequestParser } from '@fluidframework/runtime-utils/internal';
|
|
7
|
+
import type { IContainerRuntime } from '@fluidframework/container-runtime-definitions/internal';
|
|
8
|
+
import type { IRequest } from '@fluidframework/core-interfaces';
|
|
9
|
+
import type { IResponse } from '@fluidframework/core-interfaces';
|
|
10
|
+
import type { RequestParser } from '@fluidframework/runtime-utils/internal';
|
|
11
11
|
|
|
12
12
|
// @alpha @deprecated
|
|
13
13
|
export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions/internal';
|
|
8
|
-
import { IRequest } from '@fluidframework/core-interfaces';
|
|
9
|
-
import { IResponse } from '@fluidframework/core-interfaces';
|
|
10
|
-
import { RequestParser } from '@fluidframework/runtime-utils/internal';
|
|
7
|
+
import type { IContainerRuntime } from '@fluidframework/container-runtime-definitions/internal';
|
|
8
|
+
import type { IRequest } from '@fluidframework/core-interfaces';
|
|
9
|
+
import type { IResponse } from '@fluidframework/core-interfaces';
|
|
10
|
+
import type { RequestParser } from '@fluidframework/runtime-utils/internal';
|
|
11
11
|
|
|
12
12
|
// (No @packageDocumentation comment for this package)
|
|
13
13
|
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions/internal';
|
|
8
|
-
import { IRequest } from '@fluidframework/core-interfaces';
|
|
9
|
-
import { IResponse } from '@fluidframework/core-interfaces';
|
|
10
|
-
import { RequestParser } from '@fluidframework/runtime-utils/internal';
|
|
7
|
+
import type { IContainerRuntime } from '@fluidframework/container-runtime-definitions/internal';
|
|
8
|
+
import type { IRequest } from '@fluidframework/core-interfaces';
|
|
9
|
+
import type { IResponse } from '@fluidframework/core-interfaces';
|
|
10
|
+
import type { RequestParser } from '@fluidframework/runtime-utils/internal';
|
|
11
11
|
|
|
12
12
|
// (No @packageDocumentation comment for this package)
|
|
13
13
|
|
|
@@ -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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
6
|
+
import type { IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
+
import type { RequestParser } from "@fluidframework/runtime-utils/internal";
|
|
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,
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAE5E;;;;;;;;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 {
|
|
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 { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IResponse } from \"@fluidframework/core-interfaces\";\nimport type { RequestParser } from \"@fluidframework/runtime-utils/internal\";\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,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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
6
|
+
import type { IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
+
import type { RuntimeRequestHandler } from "./requestHandlers.js";
|
|
8
8
|
/**
|
|
9
9
|
* Deprecated.
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAI3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AA6BlE;;;;;;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"}
|
|
@@ -11,8 +11,10 @@ const internal_1 = require("@fluidframework/runtime-utils/internal");
|
|
|
11
11
|
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
12
12
|
*/
|
|
13
13
|
class RuntimeRequestHandlerBuilder {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
constructor() {
|
|
15
|
+
// eslint-disable-next-line import/no-deprecated
|
|
16
|
+
this.handlers = [];
|
|
17
|
+
}
|
|
16
18
|
// eslint-disable-next-line import/no-deprecated
|
|
17
19
|
pushHandler(...handlers) {
|
|
18
20
|
if (handlers !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,qEAA0F;AAK1F;;;GAGG;AACH,MAAM,4BAA4B;
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,qEAA0F;AAK1F;;;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,CAAC;YAC5B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;QACjC,CAAC;IACF,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACvE,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC5B,OAAO,QAAQ,CAAC;YACjB,CAAC;QACF,CAAC;QACD,OAAO,IAAA,4BAAiB,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 { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport type { RuntimeRequestHandler } from \"./requestHandlers.js\";\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/lib/requestHandlers.d.ts
CHANGED
|
@@ -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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
6
|
+
import type { IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
+
import type { RequestParser } from "@fluidframework/runtime-utils/internal";
|
|
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,
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAE5E;;;;;;;;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 {
|
|
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 { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IResponse } from \"@fluidframework/core-interfaces\";\nimport type { RequestParser } from \"@fluidframework/runtime-utils/internal\";\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,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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
6
|
+
import type { IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
+
import type { RuntimeRequestHandler } from "./requestHandlers.js";
|
|
8
8
|
/**
|
|
9
9
|
* Deprecated.
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAI3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AA6BlE;;;;;;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"}
|
|
@@ -8,8 +8,10 @@ import { RequestParser, create404Response } from "@fluidframework/runtime-utils/
|
|
|
8
8
|
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
9
9
|
*/
|
|
10
10
|
class RuntimeRequestHandlerBuilder {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
constructor() {
|
|
12
|
+
// eslint-disable-next-line import/no-deprecated
|
|
13
|
+
this.handlers = [];
|
|
14
|
+
}
|
|
13
15
|
// eslint-disable-next-line import/no-deprecated
|
|
14
16
|
pushHandler(...handlers) {
|
|
15
17
|
if (handlers !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAK1F;;;GAGG;AACH,MAAM,4BAA4B;
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAK1F;;;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,CAAC;YAC5B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;QACjC,CAAC;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,CAAC;YACrC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC5B,OAAO,QAAQ,CAAC;YACjB,CAAC;QACF,CAAC;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 { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport type { RuntimeRequestHandler } from \"./requestHandlers.js\";\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.5.0.0.
|
|
3
|
+
"version": "2.0.0-dev-rc.5.0.0.272251",
|
|
4
4
|
"description": "A simple request handling library for Fluid Framework",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -67,16 +67,16 @@
|
|
|
67
67
|
"temp-directory": "nyc/.nyc_output"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.5.0.0.
|
|
71
|
-
"@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.
|
|
72
|
-
"@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.
|
|
73
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.5.0.0.
|
|
74
|
-
"@fluidframework/runtime-utils": "2.0.0-dev-rc.5.0.0.
|
|
70
|
+
"@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.5.0.0.272251",
|
|
71
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.272251",
|
|
72
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.272251",
|
|
73
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.5.0.0.272251",
|
|
74
|
+
"@fluidframework/runtime-utils": "2.0.0-dev-rc.5.0.0.272251"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
78
78
|
"@biomejs/biome": "^1.7.3",
|
|
79
|
-
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.
|
|
79
|
+
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.272251",
|
|
80
80
|
"@fluid-tools/build-cli": "^0.39.0",
|
|
81
81
|
"@fluidframework/build-common": "^2.0.3",
|
|
82
82
|
"@fluidframework/build-tools": "^0.39.0",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"@types/mocha": "^9.1.1",
|
|
88
88
|
"@types/node": "^18.19.0",
|
|
89
89
|
"c8": "^8.0.1",
|
|
90
|
+
"concurrently": "^8.2.1",
|
|
90
91
|
"copyfiles": "^2.4.1",
|
|
91
92
|
"cross-env": "^7.0.3",
|
|
92
93
|
"diff": "^3.5.0",
|
|
@@ -116,9 +117,14 @@
|
|
|
116
117
|
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
117
118
|
"check:are-the-types-wrong": "attw --pack .",
|
|
118
119
|
"check:biome": "biome check . --formatter-enabled=true",
|
|
120
|
+
"check:exports": "concurrently \"npm:check:exports:*\"",
|
|
121
|
+
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
|
|
122
|
+
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
|
|
123
|
+
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
|
|
124
|
+
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
|
|
125
|
+
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
|
|
119
126
|
"check:format": "npm run check:prettier",
|
|
120
127
|
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
121
|
-
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
122
128
|
"ci:build:docs": "api-extractor run",
|
|
123
129
|
"clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
124
130
|
"eslint": "eslint --format stylish src",
|
package/src/requestHandlers.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
7
|
+
import type { IResponse } from "@fluidframework/core-interfaces";
|
|
8
|
+
import type { RequestParser } from "@fluidframework/runtime-utils/internal";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
7
|
+
import type { IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
8
8
|
import { RequestParser, create404Response } from "@fluidframework/runtime-utils/internal";
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line import/no-deprecated
|
|
11
|
-
import {
|
|
11
|
+
import type { RuntimeRequestHandler } from "./requestHandlers.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
package/tsdoc.json
ADDED