@nestjs/core 11.1.15 → 12.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/http-adapter.d.ts +5 -3
- package/adapters/http-adapter.js +8 -5
- package/adapters/index.d.ts +1 -1
- package/adapters/index.js +1 -4
- package/application-config.d.ts +7 -4
- package/application-config.js +20 -15
- package/constants.d.ts +1 -1
- package/constants.js +10 -13
- package/discovery/discoverable-meta-host-collection.d.ts +3 -3
- package/discovery/discoverable-meta-host-collection.js +15 -19
- package/discovery/discovery-module.js +9 -12
- package/discovery/discovery-service.d.ts +4 -4
- package/discovery/discovery-service.js +17 -19
- package/discovery/index.d.ts +2 -2
- package/discovery/index.js +2 -5
- package/errors/exception-handler.js +3 -7
- package/errors/exceptions/circular-dependency.exception.d.ts +1 -1
- package/errors/exceptions/circular-dependency.exception.js +2 -6
- package/errors/exceptions/index.d.ts +8 -8
- package/errors/exceptions/index.js +8 -11
- package/errors/exceptions/invalid-class-module.exception.d.ts +1 -1
- package/errors/exceptions/invalid-class-module.exception.js +4 -8
- package/errors/exceptions/invalid-class-scope.exception.d.ts +2 -2
- package/errors/exceptions/invalid-class-scope.exception.js +6 -10
- package/errors/exceptions/invalid-class.exception.d.ts +1 -1
- package/errors/exceptions/invalid-class.exception.js +4 -8
- package/errors/exceptions/invalid-exception-filter.exception.d.ts +1 -1
- package/errors/exceptions/invalid-exception-filter.exception.js +4 -8
- package/errors/exceptions/invalid-middleware-configuration.exception.d.ts +1 -1
- package/errors/exceptions/invalid-middleware-configuration.exception.js +4 -8
- package/errors/exceptions/invalid-middleware.exception.d.ts +1 -1
- package/errors/exceptions/invalid-middleware.exception.js +4 -8
- package/errors/exceptions/invalid-module.exception.d.ts +1 -1
- package/errors/exceptions/invalid-module.exception.js +4 -8
- package/errors/exceptions/runtime.exception.js +1 -5
- package/errors/exceptions/undefined-dependency.exception.d.ts +3 -3
- package/errors/exceptions/undefined-dependency.exception.js +4 -8
- package/errors/exceptions/undefined-forwardref.exception.d.ts +2 -2
- package/errors/exceptions/undefined-forwardref.exception.js +4 -8
- package/errors/exceptions/undefined-module.exception.d.ts +1 -1
- package/errors/exceptions/undefined-module.exception.js +4 -8
- package/errors/exceptions/unknown-dependencies.exception.d.ts +3 -3
- package/errors/exceptions/unknown-dependencies.exception.js +8 -8
- package/errors/exceptions/unknown-element.exception.d.ts +1 -1
- package/errors/exceptions/unknown-element.exception.js +2 -6
- package/errors/exceptions/unknown-export.exception.d.ts +1 -1
- package/errors/exceptions/unknown-export.exception.js +4 -8
- package/errors/exceptions/unknown-module.exception.d.ts +1 -1
- package/errors/exceptions/unknown-module.exception.js +2 -6
- package/errors/exceptions/unknown-request-mapping.exception.d.ts +1 -1
- package/errors/exceptions/unknown-request-mapping.exception.js +4 -8
- package/errors/exceptions-zone.js +6 -10
- package/errors/messages.d.ts +2 -2
- package/errors/messages.js +19 -32
- package/exceptions/base-exception-filter-context.d.ts +6 -7
- package/exceptions/base-exception-filter-context.js +13 -16
- package/exceptions/base-exception-filter.d.ts +4 -4
- package/exceptions/base-exception-filter.js +33 -23
- package/exceptions/exceptions-handler.d.ts +4 -4
- package/exceptions/exceptions-handler.js +8 -16
- package/exceptions/external-exception-filter-context.d.ts +8 -8
- package/exceptions/external-exception-filter-context.js +14 -18
- package/exceptions/external-exception-filter.d.ts +1 -1
- package/exceptions/external-exception-filter.js +4 -8
- package/exceptions/external-exceptions-handler.d.ts +3 -3
- package/exceptions/external-exceptions-handler.js +8 -16
- package/exceptions/index.d.ts +1 -1
- package/exceptions/index.js +1 -4
- package/guards/constants.js +1 -4
- package/guards/guards-consumer.d.ts +4 -3
- package/guards/guards-consumer.js +8 -12
- package/guards/guards-context-creator.d.ts +11 -10
- package/guards/guards-context-creator.js +18 -20
- package/guards/index.d.ts +3 -3
- package/guards/index.js +3 -6
- package/helpers/barrier.js +5 -5
- package/helpers/context-creator.d.ts +2 -2
- package/helpers/context-creator.js +3 -7
- package/helpers/context-id-factory.d.ts +1 -1
- package/helpers/context-id-factory.js +10 -14
- package/helpers/context-utils.d.ts +6 -3
- package/helpers/context-utils.js +7 -12
- package/helpers/execution-context-host.d.ts +3 -3
- package/helpers/execution-context-host.js +5 -6
- package/helpers/external-context-creator.d.ts +15 -18
- package/helpers/external-context-creator.js +54 -43
- package/helpers/external-proxy.d.ts +2 -2
- package/helpers/external-proxy.js +3 -7
- package/helpers/get-class-scope.d.ts +2 -2
- package/helpers/get-class-scope.js +3 -6
- package/helpers/handler-metadata-storage.d.ts +4 -4
- package/helpers/handler-metadata-storage.js +7 -15
- package/helpers/http-adapter-host.d.ts +1 -1
- package/helpers/http-adapter-host.js +6 -11
- package/helpers/index.d.ts +3 -3
- package/helpers/index.js +3 -6
- package/helpers/interfaces/external-handler-metadata.interface.d.ts +2 -2
- package/helpers/interfaces/external-handler-metadata.interface.js +1 -2
- package/helpers/interfaces/index.d.ts +2 -2
- package/helpers/interfaces/index.js +2 -5
- package/helpers/interfaces/params-metadata.interface.d.ts +1 -1
- package/helpers/interfaces/params-metadata.interface.js +1 -2
- package/helpers/is-durable.d.ts +1 -1
- package/helpers/is-durable.js +3 -6
- package/helpers/load-adapter.d.ts +1 -1
- package/helpers/load-adapter.js +4 -7
- package/helpers/messages.d.ts +1 -1
- package/helpers/messages.js +10 -20
- package/helpers/optional-require.d.ts +1 -1
- package/helpers/optional-require.js +2 -5
- package/helpers/rethrow.js +1 -5
- package/helpers/router-method-factory.d.ts +2 -2
- package/helpers/router-method-factory.js +20 -24
- package/hooks/before-app-shutdown.hook.d.ts +3 -3
- package/hooks/before-app-shutdown.hook.js +15 -22
- package/hooks/index.d.ts +5 -5
- package/hooks/index.js +5 -8
- package/hooks/on-app-bootstrap.hook.d.ts +3 -3
- package/hooks/on-app-bootstrap.hook.js +15 -22
- package/hooks/on-app-shutdown.hook.d.ts +3 -3
- package/hooks/on-app-shutdown.hook.js +15 -22
- package/hooks/on-module-destroy.hook.d.ts +3 -3
- package/hooks/on-module-destroy.hook.js +15 -22
- package/hooks/on-module-init.hook.d.ts +3 -3
- package/hooks/on-module-init.hook.js +15 -22
- package/hooks/utils/get-instances-grouped-by-hierarchy-level.d.ts +3 -0
- package/hooks/utils/get-instances-grouped-by-hierarchy-level.js +27 -0
- package/hooks/utils/get-sorted-hierarchy-levels.d.ts +1 -0
- package/hooks/utils/get-sorted-hierarchy-levels.js +7 -0
- package/index.d.ts +16 -16
- package/index.js +17 -26
- package/injector/abstract-instance-resolver.d.ts +6 -6
- package/injector/abstract-instance-resolver.js +7 -11
- package/injector/compiler.d.ts +2 -2
- package/injector/compiler.js +2 -5
- package/injector/constants.d.ts +1 -1
- package/injector/constants.js +2 -5
- package/injector/container.d.ts +13 -14
- package/injector/container.js +40 -40
- package/injector/helpers/provider-classifier.d.ts +1 -1
- package/injector/helpers/provider-classifier.js +5 -10
- package/injector/helpers/silent-logger.js +9 -16
- package/injector/index.d.ts +6 -6
- package/injector/index.js +5 -8
- package/injector/injector.d.ts +7 -6
- package/injector/injector.js +78 -78
- package/injector/inquirer/index.d.ts +1 -1
- package/injector/inquirer/index.js +1 -4
- package/injector/inquirer/inquirer-constants.js +1 -4
- package/injector/inquirer/inquirer-providers.d.ts +1 -1
- package/injector/inquirer/inquirer-providers.js +5 -8
- package/injector/instance-links-host.d.ts +3 -3
- package/injector/instance-links-host.js +8 -11
- package/injector/instance-loader.d.ts +5 -5
- package/injector/instance-loader.js +11 -11
- package/injector/instance-wrapper.d.ts +8 -5
- package/injector/instance-wrapper.js +93 -74
- package/injector/internal-core-module/index.d.ts +1 -1
- package/injector/internal-core-module/index.js +1 -4
- package/injector/internal-core-module/internal-core-module-factory.d.ts +6 -6
- package/injector/internal-core-module/internal-core-module-factory.js +23 -27
- package/injector/internal-core-module/internal-core-module.d.ts +2 -2
- package/injector/internal-core-module/internal-core-module.js +17 -20
- package/injector/internal-providers-storage.d.ts +2 -2
- package/injector/internal-providers-storage.js +4 -9
- package/injector/lazy-module-loader/lazy-module-loader-options.interface.js +1 -2
- package/injector/lazy-module-loader/lazy-module-loader.d.ts +8 -8
- package/injector/lazy-module-loader/lazy-module-loader.js +10 -9
- package/injector/module-ref.d.ts +7 -7
- package/injector/module-ref.js +19 -20
- package/injector/module.d.ts +5 -5
- package/injector/module.js +93 -79
- package/injector/modules-container.d.ts +1 -1
- package/injector/modules-container.js +5 -12
- package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.d.ts +2 -4
- package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.js +6 -9
- package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.d.ts +2 -3
- package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.js +17 -22
- package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.d.ts +1 -3
- package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.js +1 -2
- package/injector/settlement-signal.js +5 -7
- package/injector/topology-tree/topology-tree.d.ts +1 -1
- package/injector/topology-tree/topology-tree.js +6 -9
- package/injector/topology-tree/tree-node.js +4 -6
- package/inspector/deterministic-uuid-registry.js +2 -6
- package/inspector/graph-inspector.d.ts +7 -7
- package/inspector/graph-inspector.js +10 -12
- package/inspector/index.d.ts +4 -4
- package/inspector/index.js +4 -7
- package/inspector/initialize-on-preview.allowlist.d.ts +1 -1
- package/inspector/initialize-on-preview.allowlist.js +2 -6
- package/inspector/interfaces/edge.interface.d.ts +1 -1
- package/inspector/interfaces/edge.interface.js +1 -2
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +3 -3
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +1 -2
- package/inspector/interfaces/entrypoint.interface.d.ts +2 -2
- package/inspector/interfaces/entrypoint.interface.js +1 -2
- package/inspector/interfaces/extras.interface.d.ts +1 -1
- package/inspector/interfaces/extras.interface.js +1 -2
- package/inspector/interfaces/node.interface.d.ts +2 -2
- package/inspector/interfaces/node.interface.js +1 -2
- package/inspector/interfaces/serialized-graph-json.interface.d.ts +6 -6
- package/inspector/interfaces/serialized-graph-json.interface.js +1 -2
- package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +1 -1
- package/inspector/interfaces/serialized-graph-metadata.interface.js +1 -2
- package/inspector/noop-graph-inspector.d.ts +1 -1
- package/inspector/noop-graph-inspector.js +2 -5
- package/inspector/partial-graph.host.d.ts +2 -2
- package/inspector/partial-graph.host.js +2 -5
- package/inspector/serialized-graph.d.ts +7 -7
- package/inspector/serialized-graph.js +35 -40
- package/inspector/uuid-factory.js +8 -12
- package/interceptors/index.d.ts +2 -2
- package/interceptors/index.js +2 -5
- package/interceptors/interceptors-consumer.d.ts +4 -3
- package/interceptors/interceptors-consumer.js +13 -17
- package/interceptors/interceptors-context-creator.d.ts +10 -9
- package/interceptors/interceptors-context-creator.js +18 -20
- package/interfaces/index.d.ts +2 -0
- package/interfaces/index.js +2 -0
- package/interfaces/module-definition.interface.d.ts +2 -2
- package/interfaces/module-definition.interface.js +1 -2
- package/interfaces/module-override.interface.d.ts +1 -1
- package/interfaces/module-override.interface.js +1 -2
- package/internal.d.ts +38 -0
- package/internal.js +46 -0
- package/metadata-scanner.d.ts +1 -1
- package/metadata-scanner.js +8 -14
- package/middleware/builder.d.ts +4 -4
- package/middleware/builder.js +78 -76
- package/middleware/container.d.ts +4 -4
- package/middleware/container.js +10 -13
- package/middleware/index.d.ts +1 -1
- package/middleware/index.js +1 -4
- package/middleware/middleware-module.d.ts +8 -9
- package/middleware/middleware-module.js +47 -44
- package/middleware/resolver.d.ts +3 -3
- package/middleware/resolver.js +3 -5
- package/middleware/route-info-path-extractor.d.ts +2 -2
- package/middleware/route-info-path-extractor.js +26 -25
- package/middleware/routes-mapper.d.ts +4 -3
- package/middleware/routes-mapper.js +22 -24
- package/middleware/utils.d.ts +3 -2
- package/middleware/utils.js +34 -45
- package/nest-application-context.d.ts +10 -9
- package/nest-application-context.js +50 -47
- package/nest-application.d.ts +18 -10
- package/nest-application.js +87 -55
- package/nest-factory.d.ts +4 -5
- package/nest-factory.js +61 -68
- package/package.json +32 -3
- package/pipes/index.d.ts +3 -3
- package/pipes/index.js +3 -6
- package/pipes/params-token-factory.d.ts +2 -2
- package/pipes/params-token-factory.js +5 -9
- package/pipes/pipes-consumer.d.ts +3 -7
- package/pipes/pipes-consumer.js +17 -18
- package/pipes/pipes-context-creator.d.ts +10 -9
- package/pipes/pipes-context-creator.js +18 -20
- package/repl/assign-to-object.util.js +1 -4
- package/repl/constants.js +1 -4
- package/repl/index.d.ts +1 -1
- package/repl/index.js +1 -4
- package/repl/native-functions/debug-repl-fn.d.ts +2 -2
- package/repl/native-functions/debug-repl-fn.js +14 -21
- package/repl/native-functions/get-repl-fn.d.ts +2 -2
- package/repl/native-functions/get-repl-fn.js +8 -15
- package/repl/native-functions/help-repl-fn.d.ts +2 -2
- package/repl/native-functions/help-repl-fn.js +13 -20
- package/repl/native-functions/index.d.ts +6 -6
- package/repl/native-functions/index.js +6 -9
- package/repl/native-functions/methods-repl-fn.d.ts +2 -2
- package/repl/native-functions/methods-repl-fn.js +12 -19
- package/repl/native-functions/resolve-repl-fn.d.ts +2 -2
- package/repl/native-functions/resolve-repl-fn.js +7 -14
- package/repl/native-functions/select-relp-fn.d.ts +2 -2
- package/repl/native-functions/select-relp-fn.js +7 -14
- package/repl/repl-context.d.ts +3 -3
- package/repl/repl-context.js +21 -23
- package/repl/repl-function.d.ts +3 -3
- package/repl/repl-function.js +5 -7
- package/repl/repl-logger.js +10 -14
- package/repl/repl-native-commands.js +1 -4
- package/repl/repl.d.ts +1 -1
- package/repl/repl.interfaces.d.ts +2 -2
- package/repl/repl.interfaces.js +1 -2
- package/repl/repl.js +17 -20
- package/router/index.d.ts +3 -3
- package/router/index.js +3 -8
- package/router/interfaces/exceptions-filter.interface.d.ts +3 -3
- package/router/interfaces/exceptions-filter.interface.js +1 -2
- package/router/interfaces/exclude-route-metadata.interface.d.ts +1 -1
- package/router/interfaces/exclude-route-metadata.interface.js +1 -2
- package/router/interfaces/index.d.ts +1 -1
- package/router/interfaces/index.js +1 -4
- package/router/interfaces/resolver.interface.js +1 -2
- package/router/interfaces/route-params-factory.interface.d.ts +1 -1
- package/router/interfaces/route-params-factory.interface.js +1 -2
- package/router/interfaces/route-path-metadata.interface.d.ts +2 -2
- package/router/interfaces/route-path-metadata.interface.js +1 -2
- package/router/interfaces/routes.interface.d.ts +1 -1
- package/router/interfaces/routes.interface.js +1 -2
- package/router/legacy-route-converter.js +3 -7
- package/router/paths-explorer.d.ts +4 -5
- package/router/paths-explorer.js +11 -15
- package/router/request/index.d.ts +1 -1
- package/router/request/index.js +1 -5
- package/router/request/request-constants.js +2 -5
- package/router/request/request-providers.d.ts +1 -1
- package/router/request/request-providers.js +5 -8
- package/router/route-params-factory.d.ts +2 -2
- package/router/route-params-factory.js +15 -19
- package/router/route-path-factory.d.ts +4 -4
- package/router/route-path-factory.js +19 -22
- package/router/router-exception-filters.d.ts +9 -9
- package/router/router-exception-filters.js +15 -18
- package/router/router-execution-context.d.ts +17 -20
- package/router/router-execution-context.js +57 -49
- package/router/router-explorer.d.ts +14 -16
- package/router/router-explorer.js +55 -54
- package/router/router-module.d.ts +4 -4
- package/router/router-module.js +21 -23
- package/router/router-proxy.d.ts +1 -1
- package/router/router-proxy.js +4 -8
- package/router/router-response-controller.d.ts +2 -2
- package/router/router-response-controller.js +20 -23
- package/router/routes-resolver.d.ts +8 -9
- package/router/routes-resolver.js +36 -51
- package/router/sse-stream.d.ts +1 -1
- package/router/sse-stream.js +5 -9
- package/router/utils/exclude-route.util.d.ts +1 -1
- package/router/utils/exclude-route.util.js +7 -12
- package/router/utils/flatten-route-paths.util.d.ts +2 -2
- package/router/utils/flatten-route-paths.util.js +4 -7
- package/router/utils/index.d.ts +2 -2
- package/router/utils/index.js +2 -5
- package/scanner.d.ts +11 -11
- package/scanner.js +64 -65
- package/services/index.d.ts +1 -1
- package/services/index.js +1 -4
- package/services/reflector.service.d.ts +1 -1
- package/services/reflector.service.js +9 -13
- package/tsconfig.build.json +1 -9
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { VersionValue } from '@nestjs/common/
|
|
4
|
-
import {
|
|
5
|
-
import { RouterProxyCallback } from './router-proxy';
|
|
1
|
+
import { MetadataScanner } from '../metadata-scanner.js';
|
|
2
|
+
import { RouterProxyCallback } from './router-proxy.js';
|
|
3
|
+
import { type Controller, type VersionValue } from '@nestjs/common/internal';
|
|
4
|
+
import type { RequestMethod } from '@nestjs/common';
|
|
6
5
|
export interface RouteDefinition {
|
|
7
6
|
path: string[];
|
|
8
7
|
requestMethod: RequestMethod;
|
package/router/paths-explorer.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const constants_1 = require("@nestjs/common/constants");
|
|
5
|
-
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
6
|
-
class PathsExplorer {
|
|
1
|
+
import { METHOD_METADATA, PATH_METADATA, VERSION_METADATA, addLeadingSlash, isString, isUndefined, } from '@nestjs/common/internal';
|
|
2
|
+
export class PathsExplorer {
|
|
3
|
+
metadataScanner;
|
|
7
4
|
constructor(metadataScanner) {
|
|
8
5
|
this.metadataScanner = metadataScanner;
|
|
9
6
|
}
|
|
10
7
|
scanForPaths(instance, prototype) {
|
|
11
|
-
const instancePrototype =
|
|
8
|
+
const instancePrototype = isUndefined(prototype)
|
|
12
9
|
? Object.getPrototypeOf(instance)
|
|
13
10
|
: prototype;
|
|
14
11
|
return this.metadataScanner
|
|
@@ -24,15 +21,15 @@ class PathsExplorer {
|
|
|
24
21
|
exploreMethodMetadata(instance, prototype, methodName) {
|
|
25
22
|
const instanceCallback = instance[methodName];
|
|
26
23
|
const prototypeCallback = prototype[methodName];
|
|
27
|
-
const routePath = Reflect.getMetadata(
|
|
28
|
-
if (
|
|
24
|
+
const routePath = Reflect.getMetadata(PATH_METADATA, prototypeCallback);
|
|
25
|
+
if (isUndefined(routePath)) {
|
|
29
26
|
return null;
|
|
30
27
|
}
|
|
31
|
-
const requestMethod = Reflect.getMetadata(
|
|
32
|
-
const version = Reflect.getMetadata(
|
|
33
|
-
const path =
|
|
34
|
-
? [
|
|
35
|
-
: routePath.map((p) =>
|
|
28
|
+
const requestMethod = Reflect.getMetadata(METHOD_METADATA, prototypeCallback);
|
|
29
|
+
const version = Reflect.getMetadata(VERSION_METADATA, prototypeCallback);
|
|
30
|
+
const path = isString(routePath)
|
|
31
|
+
? [addLeadingSlash(routePath)]
|
|
32
|
+
: routePath.map((p) => addLeadingSlash(p));
|
|
36
33
|
return {
|
|
37
34
|
path,
|
|
38
35
|
requestMethod,
|
|
@@ -42,4 +39,3 @@ class PathsExplorer {
|
|
|
42
39
|
};
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
exports.PathsExplorer = PathsExplorer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { REQUEST } from './request-constants';
|
|
1
|
+
export { REQUEST } from './request-constants.js';
|
package/router/request/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REQUEST = void 0;
|
|
4
|
-
var request_constants_1 = require("./request-constants");
|
|
5
|
-
Object.defineProperty(exports, "REQUEST", { enumerable: true, get: function () { return request_constants_1.REQUEST; } });
|
|
1
|
+
export { REQUEST } from './request-constants.js';
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.REQUEST_CONTEXT_ID = exports.REQUEST = void 0;
|
|
4
|
-
exports.REQUEST = 'REQUEST';
|
|
5
|
-
exports.REQUEST_CONTEXT_ID = Symbol('REQUEST_CONTEXT_ID');
|
|
1
|
+
export const REQUEST = 'REQUEST';
|
|
2
|
+
export const REQUEST_CONTEXT_ID = Symbol('REQUEST_CONTEXT_ID');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Provider } from '@nestjs/common';
|
|
1
|
+
import { type Provider } from '@nestjs/common';
|
|
2
2
|
export declare const requestProvider: Provider;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.requestProvider = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const request_constants_1 = require("./request-constants");
|
|
1
|
+
import { Scope } from '@nestjs/common';
|
|
2
|
+
import { REQUEST } from './request-constants.js';
|
|
6
3
|
const noop = () => { };
|
|
7
|
-
|
|
8
|
-
provide:
|
|
9
|
-
scope:
|
|
4
|
+
export const requestProvider = {
|
|
5
|
+
provide: REQUEST,
|
|
6
|
+
scope: Scope.REQUEST,
|
|
10
7
|
useFactory: noop,
|
|
11
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IRouteParamsFactory } from './interfaces/route-params-factory.interface.js';
|
|
2
|
+
import { RouteParamtypes } from '@nestjs/common/internal';
|
|
3
3
|
export declare class RouteParamsFactory implements IRouteParamsFactory {
|
|
4
4
|
exchangeKeyForValue<TRequest extends Record<string, any> = any, TResponse = any, TResult = any>(key: RouteParamtypes | string, data: string, { req, res, next }: {
|
|
5
5
|
req: TRequest;
|
|
@@ -1,41 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.RouteParamsFactory = void 0;
|
|
4
|
-
const route_paramtypes_enum_1 = require("@nestjs/common/enums/route-paramtypes.enum");
|
|
5
|
-
class RouteParamsFactory {
|
|
1
|
+
import { RouteParamtypes } from '@nestjs/common/internal';
|
|
2
|
+
export class RouteParamsFactory {
|
|
6
3
|
exchangeKeyForValue(key, data, { req, res, next }) {
|
|
7
4
|
switch (key) {
|
|
8
|
-
case
|
|
5
|
+
case RouteParamtypes.NEXT:
|
|
9
6
|
return next;
|
|
10
|
-
case
|
|
7
|
+
case RouteParamtypes.REQUEST:
|
|
11
8
|
return req;
|
|
12
|
-
case
|
|
9
|
+
case RouteParamtypes.RESPONSE:
|
|
13
10
|
return res;
|
|
14
|
-
case
|
|
11
|
+
case RouteParamtypes.BODY:
|
|
15
12
|
return data && req.body ? req.body[data] : req.body;
|
|
16
|
-
case
|
|
13
|
+
case RouteParamtypes.RAW_BODY:
|
|
17
14
|
return req.rawBody;
|
|
18
|
-
case
|
|
15
|
+
case RouteParamtypes.PARAM:
|
|
19
16
|
return data ? req.params[data] : req.params;
|
|
20
|
-
case
|
|
17
|
+
case RouteParamtypes.HOST:
|
|
21
18
|
/* eslint-disable-next-line no-case-declarations */
|
|
22
19
|
const hosts = req.hosts || {};
|
|
23
20
|
return data ? hosts[data] : hosts;
|
|
24
|
-
case
|
|
21
|
+
case RouteParamtypes.QUERY:
|
|
25
22
|
return data ? req.query[data] : req.query;
|
|
26
|
-
case
|
|
23
|
+
case RouteParamtypes.HEADERS:
|
|
27
24
|
return data ? req.headers[data.toLowerCase()] : req.headers;
|
|
28
|
-
case
|
|
25
|
+
case RouteParamtypes.SESSION:
|
|
29
26
|
return req.session;
|
|
30
|
-
case
|
|
27
|
+
case RouteParamtypes.FILE:
|
|
31
28
|
return req[data || 'file'];
|
|
32
|
-
case
|
|
29
|
+
case RouteParamtypes.FILES:
|
|
33
30
|
return req.files;
|
|
34
|
-
case
|
|
31
|
+
case RouteParamtypes.IP:
|
|
35
32
|
return req.ip;
|
|
36
33
|
default:
|
|
37
34
|
return null;
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
exports.RouteParamsFactory = RouteParamsFactory;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RequestMethod, VersioningOptions } from '@nestjs/common';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { type RequestMethod, type VersioningOptions } from '@nestjs/common';
|
|
2
|
+
import { ApplicationConfig } from '../application-config.js';
|
|
3
|
+
import { RoutePathMetadata } from './interfaces/route-path-metadata.interface.js';
|
|
4
|
+
import { type VersionValue } from '@nestjs/common/internal';
|
|
5
5
|
export declare class RoutePathFactory {
|
|
6
6
|
private readonly applicationConfig;
|
|
7
7
|
constructor(applicationConfig: ApplicationConfig);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
class RoutePathFactory {
|
|
1
|
+
import { VERSION_NEUTRAL, VersioningType, flatten, } from '@nestjs/common';
|
|
2
|
+
import { isRouteExcluded } from './utils/index.js';
|
|
3
|
+
import { addLeadingSlash, isUndefined, stripEndSlash, } from '@nestjs/common/internal';
|
|
4
|
+
export class RoutePathFactory {
|
|
5
|
+
applicationConfig;
|
|
8
6
|
constructor(applicationConfig) {
|
|
9
7
|
this.applicationConfig = applicationConfig;
|
|
10
8
|
}
|
|
@@ -12,18 +10,18 @@ class RoutePathFactory {
|
|
|
12
10
|
let paths = [''];
|
|
13
11
|
const versionOrVersions = this.getVersion(metadata);
|
|
14
12
|
if (versionOrVersions &&
|
|
15
|
-
metadata.versioningOptions?.type ===
|
|
13
|
+
metadata.versioningOptions?.type === VersioningType.URI) {
|
|
16
14
|
const versionPrefix = this.getVersionPrefix(metadata.versioningOptions);
|
|
17
15
|
if (Array.isArray(versionOrVersions)) {
|
|
18
|
-
paths =
|
|
16
|
+
paths = flatten(paths.map(path => versionOrVersions.map(version =>
|
|
19
17
|
// Version Neutral - Do not include version in URL
|
|
20
|
-
version ===
|
|
18
|
+
version === VERSION_NEUTRAL
|
|
21
19
|
? path
|
|
22
20
|
: `${path}/${versionPrefix}${version}`)));
|
|
23
21
|
}
|
|
24
22
|
else {
|
|
25
23
|
// Version Neutral - Do not include version in URL
|
|
26
|
-
if (versionOrVersions !==
|
|
24
|
+
if (versionOrVersions !== VERSION_NEUTRAL) {
|
|
27
25
|
paths = paths.map(path => `${path}/${versionPrefix}${versionOrVersions}`);
|
|
28
26
|
}
|
|
29
27
|
}
|
|
@@ -36,12 +34,12 @@ class RoutePathFactory {
|
|
|
36
34
|
if (this.isExcludedFromGlobalPrefix(path, requestMethod, versionOrVersions, metadata.versioningOptions)) {
|
|
37
35
|
return path;
|
|
38
36
|
}
|
|
39
|
-
return
|
|
37
|
+
return stripEndSlash(metadata.globalPrefix || '') + path;
|
|
40
38
|
});
|
|
41
39
|
}
|
|
42
40
|
return paths
|
|
43
|
-
.map(path =>
|
|
44
|
-
.map(path => (path !== '/' ?
|
|
41
|
+
.map(path => addLeadingSlash(path || '/'))
|
|
42
|
+
.map(path => (path !== '/' ? stripEndSlash(path) : path));
|
|
45
43
|
}
|
|
46
44
|
getVersion(metadata) {
|
|
47
45
|
// The version will be either the path version or the controller version,
|
|
@@ -50,7 +48,7 @@ class RoutePathFactory {
|
|
|
50
48
|
}
|
|
51
49
|
getVersionPrefix(versioningOptions) {
|
|
52
50
|
const defaultPrefix = 'v';
|
|
53
|
-
if (versioningOptions.type ===
|
|
51
|
+
if (versioningOptions.type === VersioningType.URI) {
|
|
54
52
|
if (versioningOptions.prefix === false) {
|
|
55
53
|
return '';
|
|
56
54
|
}
|
|
@@ -64,26 +62,26 @@ class RoutePathFactory {
|
|
|
64
62
|
if (!fragmentToAppend) {
|
|
65
63
|
return paths;
|
|
66
64
|
}
|
|
67
|
-
const concatPaths = (a, b) =>
|
|
65
|
+
const concatPaths = (a, b) => stripEndSlash(a) + addLeadingSlash(b);
|
|
68
66
|
if (Array.isArray(fragmentToAppend)) {
|
|
69
67
|
const paths2dArray = paths.map(path => fragmentToAppend.map(fragment => concatPaths(path, fragment)));
|
|
70
|
-
return
|
|
68
|
+
return flatten(paths2dArray);
|
|
71
69
|
}
|
|
72
70
|
return paths.map(path => concatPaths(path, fragmentToAppend));
|
|
73
71
|
}
|
|
74
72
|
isExcludedFromGlobalPrefix(path, requestMethod, versionOrVersions, versioningOptions) {
|
|
75
|
-
if (
|
|
73
|
+
if (isUndefined(requestMethod)) {
|
|
76
74
|
return false;
|
|
77
75
|
}
|
|
78
76
|
const options = this.applicationConfig.getGlobalPrefixOptions();
|
|
79
77
|
const excludedRoutes = options.exclude;
|
|
80
78
|
if (versionOrVersions &&
|
|
81
|
-
versionOrVersions !==
|
|
82
|
-
versioningOptions?.type ===
|
|
79
|
+
versionOrVersions !== VERSION_NEUTRAL &&
|
|
80
|
+
versioningOptions?.type === VersioningType.URI) {
|
|
83
81
|
path = this.truncateVersionPrefixFromPath(path, versionOrVersions, versioningOptions);
|
|
84
82
|
}
|
|
85
83
|
return (Array.isArray(excludedRoutes) &&
|
|
86
|
-
|
|
84
|
+
isRouteExcluded(excludedRoutes, path, requestMethod));
|
|
87
85
|
}
|
|
88
86
|
truncateVersionPrefixFromPath(path, versionValue, versioningOptions) {
|
|
89
87
|
if (typeof versionValue !== 'string') {
|
|
@@ -98,4 +96,3 @@ class RoutePathFactory {
|
|
|
98
96
|
return path.startsWith(prefix) ? path.replace(prefix, '') : path;
|
|
99
97
|
}
|
|
100
98
|
}
|
|
101
|
-
exports.RoutePathFactory = RoutePathFactory;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { HttpServer } from '@nestjs/common';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import type { HttpServer } from '@nestjs/common';
|
|
2
|
+
import { ApplicationConfig } from '../application-config.js';
|
|
3
|
+
import { BaseExceptionFilterContext } from '../exceptions/base-exception-filter-context.js';
|
|
4
|
+
import { ExceptionsHandler } from '../exceptions/exceptions-handler.js';
|
|
5
|
+
import { NestContainer } from '../injector/container.js';
|
|
6
|
+
import { RouterProxyCallback } from './router-proxy.js';
|
|
7
|
+
import { type Controller } from '@nestjs/common/internal';
|
|
8
8
|
export declare class RouterExceptionFilters extends BaseExceptionFilterContext {
|
|
9
9
|
private readonly config;
|
|
10
10
|
private readonly applicationRef;
|
|
11
11
|
constructor(container: NestContainer, config: ApplicationConfig, applicationRef: HttpServer);
|
|
12
|
-
create(instance: Controller, callback: RouterProxyCallback, moduleKey: string | undefined, contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): ExceptionsHandler;
|
|
13
|
-
getGlobalMetadata<T extends unknown[]>(contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): T;
|
|
12
|
+
create(instance: Controller, callback: RouterProxyCallback, moduleKey: string | undefined, contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): ExceptionsHandler;
|
|
13
|
+
getGlobalMetadata<T extends unknown[]>(contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): T;
|
|
14
14
|
}
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const constants_2 = require("../injector/constants");
|
|
10
|
-
class RouterExceptionFilters extends base_exception_filter_context_1.BaseExceptionFilterContext {
|
|
1
|
+
import { iterate } from 'iterare';
|
|
2
|
+
import { BaseExceptionFilterContext } from '../exceptions/base-exception-filter-context.js';
|
|
3
|
+
import { ExceptionsHandler } from '../exceptions/exceptions-handler.js';
|
|
4
|
+
import { STATIC_CONTEXT } from '../injector/constants.js';
|
|
5
|
+
import { EXCEPTION_FILTERS_METADATA, isEmptyArray, } from '@nestjs/common/internal';
|
|
6
|
+
export class RouterExceptionFilters extends BaseExceptionFilterContext {
|
|
7
|
+
config;
|
|
8
|
+
applicationRef;
|
|
11
9
|
constructor(container, config, applicationRef) {
|
|
12
10
|
super(container);
|
|
13
11
|
this.config = config;
|
|
14
12
|
this.applicationRef = applicationRef;
|
|
15
13
|
}
|
|
16
|
-
create(instance, callback, moduleKey, contextId =
|
|
14
|
+
create(instance, callback, moduleKey, contextId = STATIC_CONTEXT, inquirerId) {
|
|
17
15
|
this.moduleContext = moduleKey;
|
|
18
|
-
const exceptionHandler = new
|
|
19
|
-
const filters = this.createContext(instance, callback,
|
|
20
|
-
if ((
|
|
16
|
+
const exceptionHandler = new ExceptionsHandler(this.applicationRef);
|
|
17
|
+
const filters = this.createContext(instance, callback, EXCEPTION_FILTERS_METADATA, contextId, inquirerId);
|
|
18
|
+
if (isEmptyArray(filters)) {
|
|
21
19
|
return exceptionHandler;
|
|
22
20
|
}
|
|
23
21
|
exceptionHandler.setCustomFilters(filters.reverse());
|
|
24
22
|
return exceptionHandler;
|
|
25
23
|
}
|
|
26
|
-
getGlobalMetadata(contextId =
|
|
24
|
+
getGlobalMetadata(contextId = STATIC_CONTEXT, inquirerId) {
|
|
27
25
|
const globalFilters = this.config.getGlobalFilters();
|
|
28
|
-
if (contextId ===
|
|
26
|
+
if (contextId === STATIC_CONTEXT && !inquirerId) {
|
|
29
27
|
return globalFilters;
|
|
30
28
|
}
|
|
31
29
|
const scopedFilterWrappers = this.config.getGlobalRequestFilters();
|
|
32
|
-
const scopedFilters =
|
|
30
|
+
const scopedFilters = iterate(scopedFilterWrappers)
|
|
33
31
|
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
|
|
34
32
|
.filter(host => !!host)
|
|
35
33
|
.map(host => host.instance)
|
|
@@ -37,4 +35,3 @@ class RouterExceptionFilters extends base_exception_filter_context_1.BaseExcepti
|
|
|
37
35
|
return globalFilters.concat(scopedFilters);
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
|
-
exports.RouterExceptionFilters = RouterExceptionFilters;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { RouteParamtypes } from '@nestjs/common/
|
|
4
|
-
import {
|
|
5
|
-
import { GuardsConsumer, GuardsContextCreator } from '../guards';
|
|
6
|
-
import { ExecutionContextHost } from '../helpers/execution-context-host';
|
|
7
|
-
import { HandleResponseFn, HandlerMetadata } from '../helpers/handler-metadata-storage';
|
|
8
|
-
import { InterceptorsConsumer } from '../interceptors/interceptors-consumer';
|
|
9
|
-
import { InterceptorsContextCreator } from '../interceptors/interceptors-context-creator';
|
|
10
|
-
import { PipesConsumer } from '../pipes/pipes-consumer';
|
|
11
|
-
import { PipesContextCreator } from '../pipes/pipes-context-creator';
|
|
12
|
-
import { IRouteParamsFactory } from './interfaces/route-params-factory.interface';
|
|
13
|
-
import { CustomHeader, RedirectResponse } from './router-response-controller';
|
|
1
|
+
import type { ArgumentMetadata, ContextType, RouteParamMetadata } from '@nestjs/common';
|
|
2
|
+
import { type CanActivate, type HttpServer, type ParamData, type PipeTransform, type RequestMethod } from '@nestjs/common';
|
|
3
|
+
import { type Controller, RouteParamtypes } from '@nestjs/common/internal';
|
|
4
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
5
|
+
import { GuardsConsumer, GuardsContextCreator } from '../guards/index.js';
|
|
6
|
+
import { ExecutionContextHost } from '../helpers/execution-context-host.js';
|
|
7
|
+
import { HandleResponseFn, HandlerMetadata } from '../helpers/handler-metadata-storage.js';
|
|
8
|
+
import { InterceptorsConsumer } from '../interceptors/interceptors-consumer.js';
|
|
9
|
+
import { InterceptorsContextCreator } from '../interceptors/interceptors-context-creator.js';
|
|
10
|
+
import { PipesConsumer } from '../pipes/pipes-consumer.js';
|
|
11
|
+
import { PipesContextCreator } from '../pipes/pipes-context-creator.js';
|
|
12
|
+
import { IRouteParamsFactory } from './interfaces/route-params-factory.interface.js';
|
|
13
|
+
import { CustomHeader, RedirectResponse } from './router-response-controller.js';
|
|
14
14
|
export interface ParamProperties {
|
|
15
15
|
index: number;
|
|
16
16
|
type: RouteParamtypes | string;
|
|
17
17
|
data: ParamData;
|
|
18
18
|
pipes: PipeTransform[];
|
|
19
19
|
extractValue: <TRequest, TResponse>(req: TRequest, res: TResponse, next: Function) => any;
|
|
20
|
+
schema?: StandardSchemaV1;
|
|
20
21
|
}
|
|
21
22
|
export declare class RouterExecutionContext {
|
|
22
23
|
private readonly paramsFactory;
|
|
@@ -31,19 +32,15 @@ export declare class RouterExecutionContext {
|
|
|
31
32
|
private readonly contextUtils;
|
|
32
33
|
private readonly responseController;
|
|
33
34
|
constructor(paramsFactory: IRouteParamsFactory, pipesContextCreator: PipesContextCreator, pipesConsumer: PipesConsumer, guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, applicationRef: HttpServer);
|
|
34
|
-
create(instance: Controller, callback: (...args: any[]) => unknown, methodName: string, moduleKey: string, requestMethod: RequestMethod, contextId?: import("
|
|
35
|
+
create(instance: Controller, callback: (...args: any[]) => unknown, methodName: string, moduleKey: string, requestMethod: RequestMethod, contextId?: import("../index.js").ContextId, inquirerId?: string): <TRequest, TResponse>(req: TRequest, res: TResponse, next: Function) => Promise<void>;
|
|
35
36
|
getMetadata<TContext extends ContextType = ContextType>(instance: Controller, callback: (...args: any[]) => any, methodName: string, moduleKey: string, requestMethod: RequestMethod, contextType: TContext): HandlerMetadata;
|
|
36
37
|
reflectRedirect(callback: (...args: unknown[]) => unknown): RedirectResponse;
|
|
37
38
|
reflectHttpStatusCode(callback: (...args: unknown[]) => unknown): number;
|
|
38
39
|
reflectRenderTemplate(callback: (...args: unknown[]) => unknown): string;
|
|
39
40
|
reflectResponseHeaders(callback: (...args: unknown[]) => unknown): CustomHeader[];
|
|
40
41
|
reflectSse(callback: (...args: unknown[]) => unknown): string;
|
|
41
|
-
exchangeKeysForValues(keys: string[], metadata: Record<number, RouteParamMetadata>, moduleContext: string, contextId?: import("
|
|
42
|
-
getParamValue<T>(value: T,
|
|
43
|
-
metatype: unknown;
|
|
44
|
-
type: RouteParamtypes;
|
|
45
|
-
data: unknown;
|
|
46
|
-
}, pipes: PipeTransform[]): Promise<unknown>;
|
|
42
|
+
exchangeKeysForValues(keys: string[], metadata: Record<number, RouteParamMetadata>, moduleContext: string, contextId?: import("../index.js").ContextId, inquirerId?: string, contextFactory?: (args: unknown[]) => ExecutionContextHost): ParamProperties[];
|
|
43
|
+
getParamValue<T>(value: T, metadata: ArgumentMetadata, pipes: PipeTransform[]): Promise<unknown>;
|
|
47
44
|
isPipeable(type: number | string): boolean;
|
|
48
45
|
createGuardsFn<TContext extends string = ContextType>(guards: CanActivate[], instance: Controller, callback: (...args: any[]) => any, contextType?: TContext): ((args: any[]) => Promise<void>) | null;
|
|
49
46
|
createPipesFn(pipes: PipeTransform[], paramsOptions: (ParamProperties & {
|