@fluidframework/request-handler 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.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.
Files changed (53) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +1 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +4 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/request-handler.api.md +1 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +2 -2
  11. package/dist/index.js.map +1 -1
  12. package/dist/package.json +3 -0
  13. package/dist/request-handler-untrimmed.d.ts +2 -0
  14. package/dist/requestHandlers.d.ts +3 -3
  15. package/dist/requestHandlers.d.ts.map +1 -1
  16. package/dist/requestHandlers.js.map +1 -1
  17. package/dist/runtimeRequestHandlerBuilder.d.ts +5 -3
  18. package/dist/runtimeRequestHandlerBuilder.d.ts.map +1 -1
  19. package/dist/runtimeRequestHandlerBuilder.js +4 -1
  20. package/dist/runtimeRequestHandlerBuilder.js.map +1 -1
  21. package/dist/tsdoc-metadata.json +1 -1
  22. package/lib/{index.d.mts → index.d.ts} +3 -3
  23. package/lib/index.d.ts.map +1 -0
  24. package/lib/{index.mjs → index.js} +2 -2
  25. package/lib/index.js.map +1 -0
  26. package/lib/{request-handler-untrimmed.d.mts → request-handler-untrimmed.d.ts} +2 -0
  27. package/lib/{requestHandlers.d.mts → requestHandlers.d.ts} +4 -4
  28. package/lib/requestHandlers.d.ts.map +1 -0
  29. package/lib/{requestHandlers.mjs → requestHandlers.js} +1 -1
  30. package/lib/requestHandlers.js.map +1 -0
  31. package/lib/{runtimeRequestHandlerBuilder.d.mts → runtimeRequestHandlerBuilder.d.ts} +6 -4
  32. package/lib/runtimeRequestHandlerBuilder.d.ts.map +1 -0
  33. package/lib/{runtimeRequestHandlerBuilder.mjs → runtimeRequestHandlerBuilder.js} +5 -2
  34. package/lib/runtimeRequestHandlerBuilder.js.map +1 -0
  35. package/lib/test/requestHandler.spec.js +8 -0
  36. package/lib/test/requestHandler.spec.js.map +1 -0
  37. package/lib/test/types/validateRequestHandlerPrevious.generated.js +6 -0
  38. package/lib/test/types/validateRequestHandlerPrevious.generated.js.map +1 -0
  39. package/package.json +35 -43
  40. package/src/index.ts +2 -2
  41. package/src/requestHandlers.ts +3 -3
  42. package/src/runtimeRequestHandlerBuilder.ts +10 -6
  43. package/tsconfig.cjs.json +7 -0
  44. package/tsconfig.json +2 -5
  45. package/lib/index.d.mts.map +0 -1
  46. package/lib/index.mjs.map +0 -1
  47. package/lib/requestHandlers.d.mts.map +0 -1
  48. package/lib/requestHandlers.mjs.map +0 -1
  49. package/lib/runtimeRequestHandlerBuilder.d.mts.map +0 -1
  50. package/lib/runtimeRequestHandlerBuilder.mjs.map +0 -1
  51. /package/lib/{request-handler-alpha.d.mts → request-handler-alpha.d.ts} +0 -0
  52. /package/lib/{request-handler-beta.d.mts → request-handler-beta.d.ts} +0 -0
  53. /package/lib/{request-handler-public.d.mts → request-handler-public.d.ts} +0 -0
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
7
+ extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
8
8
  parserOptions: {
9
9
  project: ["./tsconfig.json", "./src/test/tsconfig.json"],
10
10
  },
@@ -5,7 +5,7 @@
5
5
 
6
6
  "use strict";
7
7
 
8
- const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
8
+ const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common");
9
9
 
10
10
  const packageDir = __dirname;
11
11
  const config = getFluidTestMochaConfig(packageDir);
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/request-handler
2
2
 
3
+ ## 2.0.0-rc.2.0.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-rc.1.0.0
4
8
 
5
9
  Dependency updates only.
@@ -1,4 +1,8 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base-esm.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
4
+ // CJS is actually secondary; so, no report.
5
+ "apiReport": {
6
+ "enabled": false
7
+ }
4
8
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-lint.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-lint.esm.primary.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-base.esm.primary.json"
4
4
  }
@@ -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 (undocumented)
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";
6
- export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder";
5
+ export { type RuntimeRequestHandler } from "./requestHandlers.js";
6
+ export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.js";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC"}
package/dist/index.js CHANGED
@@ -5,6 +5,6 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.buildRuntimeRequestHandler = void 0;
8
- var runtimeRequestHandlerBuilder_1 = require("./runtimeRequestHandlerBuilder");
9
- Object.defineProperty(exports, "buildRuntimeRequestHandler", { enumerable: true, get: function () { return runtimeRequestHandlerBuilder_1.buildRuntimeRequestHandler; } });
8
+ var runtimeRequestHandlerBuilder_js_1 = require("./runtimeRequestHandlerBuilder.js");
9
+ Object.defineProperty(exports, "buildRuntimeRequestHandler", { enumerable: true, get: function () { return runtimeRequestHandlerBuilder_js_1.buildRuntimeRequestHandler; } });
10
10
  //# 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;;;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,qFAA+E;AAAtE,6IAAA,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.js\";\nexport { buildRuntimeRequestHandler } from \"./runtimeRequestHandlerBuilder.js\";\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -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;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,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.js";
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;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAGlF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA6B1D;;;;GAIG;AAEH,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGvD,QAAQ,WAAW,iBAAiB,wBAE3D"}
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,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"}
@@ -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
- function buildRuntimeRequestHandler(...handlers) {
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;;;;GAIG;AACH,gDAAgD;AAChD,SAAgB,0BAA0B,CAAC,GAAG,QAAiC;IAC9E,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;AALD,gEAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\n// eslint-disable-next-line import/no-deprecated\nimport { 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[]) {\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 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 */\n// eslint-disable-next-line import/no-deprecated\nexport function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {\n\tconst builder = new RuntimeRequestHandlerBuilder();\n\tbuilder.pushHandler(...handlers);\n\treturn async (request: IRequest, runtime: IContainerRuntime) =>\n\t\tbuilder.handleRequest(request, runtime);\n}\n"]}
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.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"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.38.3"
8
+ "packageVersion": "7.42.3"
9
9
  }
10
10
  ]
11
11
  }
@@ -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";
6
- export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.mjs";
7
- //# sourceMappingURL=index.d.mts.map
5
+ export { type RuntimeRequestHandler } from "./requestHandlers.js";
6
+ export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC"}
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.mjs";
6
- //# sourceMappingURL=index.mjs.map
5
+ export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { type RuntimeRequestHandler } from \"./requestHandlers.js\";\nexport { buildRuntimeRequestHandler } from \"./runtimeRequestHandlerBuilder.js\";\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.
@@ -15,4 +15,4 @@ import { RequestParser } from "@fluidframework/runtime-utils";
15
15
  * @alpha
16
16
  */
17
17
  export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
18
- //# sourceMappingURL=requestHandlers.d.mts.map
18
+ //# sourceMappingURL=requestHandlers.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -3,4 +3,4 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=requestHandlers.mjs.map
6
+ //# sourceMappingURL=requestHandlers.js.map
@@ -0,0 +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 { 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,13 +2,15 @@
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.js";
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
12
14
  */
13
15
  export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
14
- //# sourceMappingURL=runtimeRequestHandlerBuilder.d.mts.map
16
+ //# sourceMappingURL=runtimeRequestHandlerBuilder.d.ts.map
@@ -0,0 +1 @@
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,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"}
@@ -30,14 +30,17 @@ 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
- export function buildRuntimeRequestHandler(...handlers) {
41
+ ...handlers) {
39
42
  const builder = new RuntimeRequestHandlerBuilder();
40
43
  builder.pushHandler(...handlers);
41
44
  return async (request, runtime) => builder.handleRequest(request, runtime);
42
45
  }
43
- //# sourceMappingURL=runtimeRequestHandlerBuilder.mjs.map
46
+ //# sourceMappingURL=runtimeRequestHandlerBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;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,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.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"]}
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ // Build pipeline breaks without this file ("No test files found")
6
+ describe("requestHandler-placeholder", () => { });
7
+ export {};
8
+ //# sourceMappingURL=requestHandler.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestHandler.spec.js","sourceRoot":"","sources":["../../src/test/requestHandler.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kEAAkE;AAClE,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Build pipeline breaks without this file (\"No test files found\")\ndescribe(\"requestHandler-placeholder\", () => {});\n"]}
@@ -0,0 +1,6 @@
1
+ use_current_TypeAliasDeclaration_RuntimeRequestHandler(get_old_TypeAliasDeclaration_RuntimeRequestHandler());
2
+ use_old_TypeAliasDeclaration_RuntimeRequestHandler(get_current_TypeAliasDeclaration_RuntimeRequestHandler());
3
+ use_current_FunctionDeclaration_buildRuntimeRequestHandler(get_old_FunctionDeclaration_buildRuntimeRequestHandler());
4
+ use_old_FunctionDeclaration_buildRuntimeRequestHandler(get_current_FunctionDeclaration_buildRuntimeRequestHandler());
5
+ export {};
6
+ //# sourceMappingURL=validateRequestHandlerPrevious.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateRequestHandlerPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateRequestHandlerPrevious.generated.ts"],"names":[],"mappings":"AAgCA,sDAAsD,CAClD,kDAAkD,EAAE,CAAC,CAAC;AAW1D,kDAAkD,CAC9C,sDAAsD,EAAE,CAAC,CAAC;AAW9D,0DAA0D,CACtD,sDAAsD,EAAE,CAAC,CAAC;AAW9D,sDAAsD,CAClD,0DAA0D,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/request-handler-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_RuntimeRequestHandler\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_RuntimeRequestHandler():\n TypeOnly<old.RuntimeRequestHandler>;\ndeclare function use_current_TypeAliasDeclaration_RuntimeRequestHandler(\n use: TypeOnly<current.RuntimeRequestHandler>): void;\nuse_current_TypeAliasDeclaration_RuntimeRequestHandler(\n get_old_TypeAliasDeclaration_RuntimeRequestHandler());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_RuntimeRequestHandler\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_RuntimeRequestHandler():\n TypeOnly<current.RuntimeRequestHandler>;\ndeclare function use_old_TypeAliasDeclaration_RuntimeRequestHandler(\n use: TypeOnly<old.RuntimeRequestHandler>): void;\nuse_old_TypeAliasDeclaration_RuntimeRequestHandler(\n get_current_TypeAliasDeclaration_RuntimeRequestHandler());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_buildRuntimeRequestHandler\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_buildRuntimeRequestHandler():\n TypeOnly<typeof old.buildRuntimeRequestHandler>;\ndeclare function use_current_FunctionDeclaration_buildRuntimeRequestHandler(\n use: TypeOnly<typeof current.buildRuntimeRequestHandler>): void;\nuse_current_FunctionDeclaration_buildRuntimeRequestHandler(\n get_old_FunctionDeclaration_buildRuntimeRequestHandler());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_buildRuntimeRequestHandler\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_buildRuntimeRequestHandler():\n TypeOnly<typeof current.buildRuntimeRequestHandler>;\ndeclare function use_old_FunctionDeclaration_buildRuntimeRequestHandler(\n use: TypeOnly<typeof old.buildRuntimeRequestHandler>): void;\nuse_old_FunctionDeclaration_buildRuntimeRequestHandler(\n get_current_FunctionDeclaration_buildRuntimeRequestHandler());\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/request-handler",
3
- "version": "2.0.0-rc.1.0.4",
3
+ "version": "2.0.0-rc.2.0.0",
4
4
  "description": "A simple request handling library for Fluid Framework",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,60 +11,50 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
+ "type": "module",
14
15
  "exports": {
15
16
  ".": {
16
17
  "import": {
17
- "types": "./lib/index.d.mts",
18
- "default": "./lib/index.mjs"
18
+ "types": "./lib/index.d.ts",
19
+ "default": "./lib/index.js"
19
20
  },
20
21
  "require": {
21
22
  "types": "./dist/index.d.ts",
22
23
  "default": "./dist/index.js"
23
24
  }
24
25
  },
25
- "./alpha": {
26
+ "./public": {
26
27
  "import": {
27
- "types": "./lib/request-handler-alpha.d.mts",
28
- "default": "./lib/index.mjs"
28
+ "types": "./lib/request-handler-public.d.ts",
29
+ "default": "./lib/index.js"
29
30
  },
30
31
  "require": {
31
- "types": "./dist/request-handler-alpha.d.ts",
32
+ "types": "./dist/request-handler-public.d.ts",
32
33
  "default": "./dist/index.js"
33
34
  }
34
35
  },
35
- "./beta": {
36
+ "./alpha": {
36
37
  "import": {
37
- "types": "./lib/request-handler-beta.d.mts",
38
- "default": "./lib/index.mjs"
38
+ "types": "./lib/request-handler-alpha.d.ts",
39
+ "default": "./lib/index.js"
39
40
  },
40
41
  "require": {
41
- "types": "./dist/request-handler-beta.d.ts",
42
+ "types": "./dist/request-handler-alpha.d.ts",
42
43
  "default": "./dist/index.js"
43
44
  }
44
45
  },
45
46
  "./internal": {
46
47
  "import": {
47
- "types": "./lib/index.d.mts",
48
- "default": "./lib/index.mjs"
48
+ "types": "./lib/index.d.ts",
49
+ "default": "./lib/index.js"
49
50
  },
50
51
  "require": {
51
52
  "types": "./dist/index.d.ts",
52
53
  "default": "./dist/index.js"
53
54
  }
54
- },
55
- "./public": {
56
- "import": {
57
- "types": "./lib/request-handler-public.d.mts",
58
- "default": "./lib/index.mjs"
59
- },
60
- "require": {
61
- "types": "./dist/request-handler-public.d.ts",
62
- "default": "./dist/index.js"
63
- }
64
55
  }
65
56
  },
66
57
  "main": "dist/index.js",
67
- "module": "lib/index.mjs",
68
58
  "types": "dist/index.d.ts",
69
59
  "c8": {
70
60
  "all": true,
@@ -87,22 +77,21 @@
87
77
  "temp-directory": "nyc/.nyc_output"
88
78
  },
89
79
  "dependencies": {
90
- "@fluidframework/container-runtime-definitions": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
91
- "@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
92
- "@fluidframework/core-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
93
- "@fluidframework/runtime-definitions": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
94
- "@fluidframework/runtime-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0"
80
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
81
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
82
+ "@fluidframework/core-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
83
+ "@fluidframework/runtime-definitions": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
84
+ "@fluidframework/runtime-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0"
95
85
  },
96
86
  "devDependencies": {
97
87
  "@arethetypeswrong/cli": "^0.13.3",
98
- "@fluid-tools/build-cli": "^0.29.0",
88
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
89
+ "@fluid-tools/build-cli": "^0.34.0",
99
90
  "@fluidframework/build-common": "^2.0.3",
100
- "@fluidframework/build-tools": "^0.29.0",
101
- "@fluidframework/eslint-config-fluid": "^3.2.0",
102
- "@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
91
+ "@fluidframework/build-tools": "^0.34.0",
92
+ "@fluidframework/eslint-config-fluid": "^4.0.0",
103
93
  "@fluidframework/request-handler-previous": "npm:@fluidframework/request-handler@2.0.0-internal.8.0.0",
104
- "@fluidframework/test-runtime-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
105
- "@microsoft/api-extractor": "^7.38.3",
94
+ "@microsoft/api-extractor": "^7.42.3",
106
95
  "@types/diff": "^3.5.1",
107
96
  "@types/mocha": "^9.1.1",
108
97
  "@types/node": "^18.19.0",
@@ -110,14 +99,13 @@
110
99
  "copyfiles": "^2.4.1",
111
100
  "cross-env": "^7.0.3",
112
101
  "diff": "^3.5.0",
113
- "eslint": "~8.50.0",
102
+ "eslint": "~8.55.0",
114
103
  "mocha": "^10.2.0",
115
104
  "mocha-json-output-reporter": "^2.0.1",
116
105
  "mocha-multi-reporters": "^1.5.1",
117
106
  "moment": "^2.21.0",
118
107
  "prettier": "~3.0.3",
119
108
  "rimraf": "^4.4.0",
120
- "tsc-multi": "^1.1.0",
121
109
  "typescript": "~5.1.6"
122
110
  },
123
111
  "fluidBuild": {
@@ -137,14 +125,16 @@
137
125
  },
138
126
  "scripts": {
139
127
  "api": "fluid-build . --task api",
140
- "api-extractor:commonjs": "api-extractor run --local",
141
- "api-extractor:esnext": "api-extractor run --config ./api-extractor-esm.json",
128
+ "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
129
+ "api-extractor:esnext": "api-extractor run --local",
142
130
  "build": "fluid-build . --task build",
143
131
  "build:commonjs": "fluid-build . --task commonjs",
144
132
  "build:compile": "fluid-build . --task compile",
145
133
  "build:docs": "fluid-build . --task api",
146
- "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
147
- "build:test": "tsc --project ./src/test/tsconfig.json",
134
+ "build:esnext": "tsc --project ./tsconfig.json",
135
+ "build:test": "npm run build:test:esm && npm run build:test:cjs",
136
+ "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
137
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
148
138
  "check:are-the-types-wrong": "attw --pack . --entrypoints .",
149
139
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
150
140
  "ci:build:docs": "api-extractor run",
@@ -158,9 +148,11 @@
158
148
  "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
159
149
  "test": "npm run test:mocha",
160
150
  "test:coverage": "c8 npm test",
161
- "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup",
151
+ "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
152
+ "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
153
+ "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
162
154
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
163
- "tsc": "tsc",
155
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
164
156
  "typetests:gen": "fluid-type-test-generator",
165
157
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
166
158
  }
package/src/index.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- export { RuntimeRequestHandler } from "./requestHandlers";
7
- export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder";
6
+ export { type RuntimeRequestHandler } from "./requestHandlers.js";
7
+ export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.js";
@@ -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.js";
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
- // eslint-disable-next-line import/no-deprecated
45
- export function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {
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) =>
@@ -0,0 +1,7 @@
1
+ {
2
+ // This config must be used in a "type": "commonjs" environment. (Use fluid-tsc commonjs.)
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "./dist",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
- "extends": [
3
- "../../../common/build/build-common/tsconfig.base.json",
4
- "../../../common/build/build-common/tsconfig.cjs.json",
5
- ],
2
+ "extends": "../../../common/build/build-common/tsconfig.node16.json",
6
3
  "include": ["src/**/*"],
7
4
  "exclude": ["src/test/**/*"],
8
5
  "compilerOptions": {
9
6
  "rootDir": "./src",
10
- "outDir": "./dist",
7
+ "outDir": "./lib",
11
8
  },
12
9
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,qBAAqB,EAAE;OACzB,EAAE,0BAA0B,EAAE"}
package/lib/index.mjs.map DELETED
@@ -1 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"requestHandlers.d.mts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,SAAS,EAAE,MAAM,iCAAiC;OACpD,EAAE,iBAAiB,EAAE,MAAM,+CAA+C;OAC1E,EAAE,aAAa,EAAE,MAAM,+BAA+B;AAE7D;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC"}
@@ -1 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"runtimeRequestHandlerBuilder.d.mts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC;OAC9D,EAAE,iBAAiB,EAAE,MAAM,+CAA+C;OAG1E,EAAE,qBAAqB,EAAE;AA6BhC;;;;GAIG;AAEH,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGvD,QAAQ,WAAW,iBAAiB,wBAE3D"}
@@ -1 +0,0 @@
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;;;;GAIG;AACH,gDAAgD;AAChD,MAAM,UAAU,0BAA0B,CAAC,GAAG,QAAiC;IAC9E,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 { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\n// eslint-disable-next-line import/no-deprecated\nimport { 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[]) {\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 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 */\n// eslint-disable-next-line import/no-deprecated\nexport function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {\n\tconst builder = new RuntimeRequestHandlerBuilder();\n\tbuilder.pushHandler(...handlers);\n\treturn async (request: IRequest, runtime: IContainerRuntime) =>\n\t\tbuilder.handleRequest(request, runtime);\n}\n"]}