@tsed/platform-params 6.102.5 → 6.102.8-rc.2
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/lib/cjs/decorators/context.js.map +1 -1
- package/lib/cjs/exports.js +3 -0
- package/lib/cjs/exports.js.map +1 -0
- package/lib/cjs/index.js +24 -26
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/esm/builder/PlatformParams.js +2 -2
- package/lib/esm/decorators/bodyParams.js +3 -3
- package/lib/esm/decorators/context.js +3 -3
- package/lib/esm/decorators/context.js.map +1 -1
- package/lib/esm/decorators/cookies.js +3 -3
- package/lib/esm/decorators/headerParams.js +3 -3
- package/lib/esm/decorators/locals.js +3 -3
- package/lib/esm/decorators/pathParams.js +3 -3
- package/lib/esm/decorators/queryParams.js +3 -3
- package/lib/esm/decorators/session.js +3 -3
- package/lib/esm/decorators/useDeserialization.js +2 -2
- package/lib/esm/decorators/useParam.js +6 -6
- package/lib/esm/decorators/useParamExpression.js +1 -1
- package/lib/esm/decorators/useParamType.js +2 -2
- package/lib/esm/decorators/usePipe.js +1 -1
- package/lib/esm/decorators/useValidation.js +2 -2
- package/lib/esm/errors/ParamValidationError.js +1 -1
- package/lib/esm/errors/RequiredValidationError.js +1 -1
- package/lib/esm/exports.js +2 -0
- package/lib/esm/exports.js.map +1 -0
- package/lib/esm/index.js +31 -33
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/pipes/ParseExpressionPipe.js +1 -1
- package/lib/esm/pipes/ValidationPipe.js +2 -2
- package/lib/types/decorators/context.d.ts +0 -6
- package/lib/types/exports.d.ts +1 -0
- package/lib/types/index.d.ts +24 -22
- package/package.json +20 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/decorators/context.ts"],"names":[],"mappings":";;;AACA,qDAAgD;AAChD,gEAA2D;AAC3D,yCAAoC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/decorators/context.ts"],"names":[],"mappings":";;;AACA,qDAAgD;AAChD,gEAA2D;AAC3D,yCAAoC;AAqDpC,SAAgB,OAAO,CAAC,GAAG,IAAW;IACpC,MAAM,EAAC,UAAU,EAAE,OAAO,EAAE,YAAY,GAAG,KAAK,EAAE,aAAa,GAAG,KAAK,EAAC,GAAG,IAAA,mCAAgB,EAAC,IAAI,CAAC,CAAC;IAElG,OAAO,IAAA,mBAAQ,EAAC;QACd,SAAS,EAAE,uBAAU,CAAC,IAAI;QAC1B,QAAQ,EAAE,MAAM;QAChB,UAAU;QACV,OAAO;QACP,YAAY;QACZ,aAAa;KACd,CAAC,CAAC;AACL,CAAC;AAXD,0BAWC","sourcesContent":["import {BaseContext} from \"@tsed/di\";\nimport {ParamTypes} from \"../domain/ParamTypes\";\nimport {mapParamsOptions} from \"../utils/mapParamsOptions\";\nimport {UseParam} from \"./useParam\";\n\n/**\n * Context decorator return the @@PlatformContext@@ created by Ts.ED when request is handled by the server.\n *\n * It contains some information as following:\n *\n * - The request id,\n * - The request container used by the Ts.ED DI. It contain all services annotated with `@Scope(ProviderScope.REQUEST)`,\n * - The current @@EndpointMetadata@@ resolved by Ts.ED during the request,\n * - The data return by the previous endpoint if you use multiple handler on the same route. By default data is empty.\n *\n * ::: tip\n * The @@PlatformContext@@ inherit from Map class. So you can store any information with.\n * :::\n *\n * #### Example\n *\n * ```typescript\n * @Middleware()\n * class AuthTokenMiddleware {\n * use(@Req() request: Req, @Context() context: PlatformContext) {\n * if (!context.has(\"auth\")){\n * context.set('auth', new AuthToken(request))\n * }\n *\n * try {\n * context.get(\"auth\").claims() // check token\n * } catch(er){\n * throw new Forbidden(\"Access forbidden - Bad token\")\n * }\n * }\n * }\n *\n * @Controller('/')\n * @UseBefore(AuthTokenMiddleware) // protect all routes for this controller\n * class MyCtrl {\n * @Get('/')\n * get(@Context('auth') auth: AuthToken) {\n * console.log('auth', auth);\n * console.log('auth.accessToken', auth.accessToken);\n * console.log('auth.idToken', auth.idToken);\n * }\n * }\n * ```\n *\n * @param expression The path of the property to get.\n * @decorator\n * @operation\n * @input\n */\nexport function Context(expression: string): ParameterDecorator;\nexport function Context(): ParameterDecorator;\nexport function Context(...args: any[]): ParameterDecorator {\n const {expression, useType, useConverter = false, useValidation = false} = mapParamsOptions(args);\n\n return UseParam({\n paramType: ParamTypes.$CTX,\n dataPath: \"$ctx\",\n expression,\n useType,\n useConverter,\n useValidation\n });\n}\n\nexport type Context = BaseContext;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"","sourcesContent":["export {PipeMethods} from \"@tsed/schema\";\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Automatically generated by barrelsby.
|
|
4
|
+
*/
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./
|
|
5
|
-
// domain
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./domain/ParamMetadata"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./domain/ParamOptions"), exports);
|
|
8
|
-
(0, tslib_1.__exportStar)(require("./domain/ParamTypes"), exports);
|
|
9
|
-
// pipes
|
|
10
|
-
(0, tslib_1.__exportStar)(require("./pipes/ParseExpressionPipe"), exports);
|
|
11
|
-
(0, tslib_1.__exportStar)(require("./pipes/DeserializerPipe"), exports);
|
|
12
|
-
(0, tslib_1.__exportStar)(require("./pipes/ValidationPipe"), exports);
|
|
13
|
-
// builder
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./exports"), exports);
|
|
14
8
|
(0, tslib_1.__exportStar)(require("./builder/PlatformParams"), exports);
|
|
15
|
-
// errors
|
|
16
|
-
(0, tslib_1.__exportStar)(require("./errors/RequiredValidationError"), exports);
|
|
17
|
-
(0, tslib_1.__exportStar)(require("./errors/ValidationError"), exports);
|
|
18
|
-
(0, tslib_1.__exportStar)(require("./errors/ParamValidationError"), exports);
|
|
19
|
-
// decorators
|
|
20
|
-
(0, tslib_1.__exportStar)(require("./decorators/context"), exports);
|
|
21
9
|
(0, tslib_1.__exportStar)(require("./decorators/bodyParams"), exports);
|
|
22
|
-
(0, tslib_1.__exportStar)(require("./decorators/
|
|
23
|
-
(0, tslib_1.__exportStar)(require("./decorators/useParam"), exports);
|
|
24
|
-
(0, tslib_1.__exportStar)(require("./decorators/useParamType"), exports);
|
|
25
|
-
(0, tslib_1.__exportStar)(require("./decorators/useType"), exports);
|
|
26
|
-
(0, tslib_1.__exportStar)(require("./decorators/useValidation"), exports);
|
|
27
|
-
(0, tslib_1.__exportStar)(require("./decorators/useDeserialization"), exports);
|
|
28
|
-
(0, tslib_1.__exportStar)(require("./decorators/useParamExpression"), exports);
|
|
29
|
-
(0, tslib_1.__exportStar)(require("./decorators/useParamType"), exports);
|
|
30
|
-
(0, tslib_1.__exportStar)(require("./decorators/headerParams"), exports);
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./decorators/context"), exports);
|
|
31
11
|
(0, tslib_1.__exportStar)(require("./decorators/cookies"), exports);
|
|
12
|
+
(0, tslib_1.__exportStar)(require("./decorators/headerParams"), exports);
|
|
32
13
|
(0, tslib_1.__exportStar)(require("./decorators/locals"), exports);
|
|
14
|
+
(0, tslib_1.__exportStar)(require("./decorators/paramFn"), exports);
|
|
33
15
|
(0, tslib_1.__exportStar)(require("./decorators/pathParams"), exports);
|
|
34
16
|
(0, tslib_1.__exportStar)(require("./decorators/queryParams"), exports);
|
|
35
17
|
(0, tslib_1.__exportStar)(require("./decorators/session"), exports);
|
|
36
|
-
(0, tslib_1.__exportStar)(require("./decorators/
|
|
18
|
+
(0, tslib_1.__exportStar)(require("./decorators/useDeserialization"), exports);
|
|
19
|
+
(0, tslib_1.__exportStar)(require("./decorators/useParam"), exports);
|
|
20
|
+
(0, tslib_1.__exportStar)(require("./decorators/useParamExpression"), exports);
|
|
21
|
+
(0, tslib_1.__exportStar)(require("./decorators/useParamType"), exports);
|
|
22
|
+
(0, tslib_1.__exportStar)(require("./decorators/usePipe"), exports);
|
|
23
|
+
(0, tslib_1.__exportStar)(require("./decorators/useType"), exports);
|
|
24
|
+
(0, tslib_1.__exportStar)(require("./decorators/useValidation"), exports);
|
|
25
|
+
(0, tslib_1.__exportStar)(require("./domain/ParamMetadata"), exports);
|
|
26
|
+
(0, tslib_1.__exportStar)(require("./domain/ParamOptions"), exports);
|
|
27
|
+
(0, tslib_1.__exportStar)(require("./domain/ParamTypes"), exports);
|
|
28
|
+
(0, tslib_1.__exportStar)(require("./errors/ParamValidationError"), exports);
|
|
29
|
+
(0, tslib_1.__exportStar)(require("./errors/RequiredValidationError"), exports);
|
|
30
|
+
(0, tslib_1.__exportStar)(require("./errors/ValidationError"), exports);
|
|
31
|
+
(0, tslib_1.__exportStar)(require("./pipes/DeserializerPipe"), exports);
|
|
32
|
+
(0, tslib_1.__exportStar)(require("./pipes/ParseExpressionPipe"), exports);
|
|
33
|
+
(0, tslib_1.__exportStar)(require("./pipes/ValidationPipe"), exports);
|
|
34
|
+
(0, tslib_1.__exportStar)(require("./utils/mapParamsOptions"), exports);
|
|
37
35
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,yDAA0B;AAC1B,wEAAyC;AACzC,uEAAwC;AACxC,oEAAqC;AACrC,oEAAqC;AACrC,yEAA0C;AAC1C,mEAAoC;AACpC,oEAAqC;AACrC,uEAAwC;AACxC,wEAAyC;AACzC,oEAAqC;AACrC,+EAAgD;AAChD,qEAAsC;AACtC,+EAAgD;AAChD,yEAA0C;AAC1C,oEAAqC;AACrC,oEAAqC;AACrC,0EAA2C;AAC3C,sEAAuC;AACvC,qEAAsC;AACtC,mEAAoC;AACpC,6EAA8C;AAC9C,gFAAiD;AACjD,wEAAyC;AACzC,wEAAyC;AACzC,2EAA4C;AAC5C,sEAAuC;AACvC,wEAAyC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./exports\";\nexport * from \"./builder/PlatformParams\";\nexport * from \"./decorators/bodyParams\";\nexport * from \"./decorators/context\";\nexport * from \"./decorators/cookies\";\nexport * from \"./decorators/headerParams\";\nexport * from \"./decorators/locals\";\nexport * from \"./decorators/paramFn\";\nexport * from \"./decorators/pathParams\";\nexport * from \"./decorators/queryParams\";\nexport * from \"./decorators/session\";\nexport * from \"./decorators/useDeserialization\";\nexport * from \"./decorators/useParam\";\nexport * from \"./decorators/useParamExpression\";\nexport * from \"./decorators/useParamType\";\nexport * from \"./decorators/usePipe\";\nexport * from \"./decorators/useType\";\nexport * from \"./decorators/useValidation\";\nexport * from \"./domain/ParamMetadata\";\nexport * from \"./domain/ParamOptions\";\nexport * from \"./domain/ParamTypes\";\nexport * from \"./errors/ParamValidationError\";\nexport * from \"./errors/RequiredValidationError\";\nexport * from \"./errors/ValidationError\";\nexport * from \"./pipes/DeserializerPipe\";\nexport * from \"./pipes/ParseExpressionPipe\";\nexport * from \"./pipes/ValidationPipe\";\nexport * from \"./utils/mapParamsOptions\";\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Inject, Injectable, InjectorService, ProviderScope } from "@tsed/di";
|
|
3
3
|
import { JsonEntityStore, JsonParameterStore } from "@tsed/schema";
|
|
4
|
-
import { ParamValidationError } from "../errors/ParamValidationError";
|
|
5
|
-
import { ParseExpressionPipe } from "../pipes/ParseExpressionPipe";
|
|
4
|
+
import { ParamValidationError } from "../errors/ParamValidationError.js";
|
|
5
|
+
import { ParseExpressionPipe } from "../pipes/ParseExpressionPipe.js";
|
|
6
6
|
/**
|
|
7
7
|
* Platform Params abstraction layer.
|
|
8
8
|
* @platform
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useDecorators } from "@tsed/core";
|
|
2
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
3
|
-
import { UseParam } from "./useParam";
|
|
4
|
-
import { mapParamsOptions } from "../utils/mapParamsOptions";
|
|
2
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
3
|
+
import { UseParam } from "./useParam.js";
|
|
4
|
+
import { mapParamsOptions } from "../utils/mapParamsOptions.js";
|
|
5
5
|
import { JsonEntityFn } from "@tsed/schema";
|
|
6
6
|
export function BodyParams(...args) {
|
|
7
7
|
const { expression, useType, useConverter = true, useValidation = true } = mapParamsOptions(args);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
2
|
-
import { mapParamsOptions } from "../utils/mapParamsOptions";
|
|
3
|
-
import { UseParam } from "./useParam";
|
|
1
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
2
|
+
import { mapParamsOptions } from "../utils/mapParamsOptions.js";
|
|
3
|
+
import { UseParam } from "./useParam.js";
|
|
4
4
|
export function Context(...args) {
|
|
5
5
|
const { expression, useType, useConverter = false, useValidation = false } = mapParamsOptions(args);
|
|
6
6
|
return UseParam({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/decorators/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/decorators/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAqDpC,MAAM,UAAU,OAAO,CAAC,GAAG,IAAW;IACpC,MAAM,EAAC,UAAU,EAAE,OAAO,EAAE,YAAY,GAAG,KAAK,EAAE,aAAa,GAAG,KAAK,EAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAElG,OAAO,QAAQ,CAAC;QACd,SAAS,EAAE,UAAU,CAAC,IAAI;QAC1B,QAAQ,EAAE,MAAM;QAChB,UAAU;QACV,OAAO;QACP,YAAY;QACZ,aAAa;KACd,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {BaseContext} from \"@tsed/di\";\nimport {ParamTypes} from \"../domain/ParamTypes\";\nimport {mapParamsOptions} from \"../utils/mapParamsOptions\";\nimport {UseParam} from \"./useParam\";\n\n/**\n * Context decorator return the @@PlatformContext@@ created by Ts.ED when request is handled by the server.\n *\n * It contains some information as following:\n *\n * - The request id,\n * - The request container used by the Ts.ED DI. It contain all services annotated with `@Scope(ProviderScope.REQUEST)`,\n * - The current @@EndpointMetadata@@ resolved by Ts.ED during the request,\n * - The data return by the previous endpoint if you use multiple handler on the same route. By default data is empty.\n *\n * ::: tip\n * The @@PlatformContext@@ inherit from Map class. So you can store any information with.\n * :::\n *\n * #### Example\n *\n * ```typescript\n * @Middleware()\n * class AuthTokenMiddleware {\n * use(@Req() request: Req, @Context() context: PlatformContext) {\n * if (!context.has(\"auth\")){\n * context.set('auth', new AuthToken(request))\n * }\n *\n * try {\n * context.get(\"auth\").claims() // check token\n * } catch(er){\n * throw new Forbidden(\"Access forbidden - Bad token\")\n * }\n * }\n * }\n *\n * @Controller('/')\n * @UseBefore(AuthTokenMiddleware) // protect all routes for this controller\n * class MyCtrl {\n * @Get('/')\n * get(@Context('auth') auth: AuthToken) {\n * console.log('auth', auth);\n * console.log('auth.accessToken', auth.accessToken);\n * console.log('auth.idToken', auth.idToken);\n * }\n * }\n * ```\n *\n * @param expression The path of the property to get.\n * @decorator\n * @operation\n * @input\n */\nexport function Context(expression: string): ParameterDecorator;\nexport function Context(): ParameterDecorator;\nexport function Context(...args: any[]): ParameterDecorator {\n const {expression, useType, useConverter = false, useValidation = false} = mapParamsOptions(args);\n\n return UseParam({\n paramType: ParamTypes.$CTX,\n dataPath: \"$ctx\",\n expression,\n useType,\n useConverter,\n useValidation\n });\n}\n\nexport type Context = BaseContext;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
2
|
-
import { mapParamsOptions } from "../utils/mapParamsOptions";
|
|
3
|
-
import { UseParam } from "./useParam";
|
|
1
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
2
|
+
import { mapParamsOptions } from "../utils/mapParamsOptions.js";
|
|
3
|
+
import { UseParam } from "./useParam.js";
|
|
4
4
|
export function CookiesParams(...args) {
|
|
5
5
|
const { expression, useType, useConverter = false, useValidation = false } = mapParamsOptions(args);
|
|
6
6
|
return UseParam({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
2
|
-
import { UseParam } from "./useParam";
|
|
3
|
-
import { mapParamsOptions } from "../utils/mapParamsOptions";
|
|
1
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
2
|
+
import { UseParam } from "./useParam.js";
|
|
3
|
+
import { mapParamsOptions } from "../utils/mapParamsOptions.js";
|
|
4
4
|
export function HeaderParams(...args) {
|
|
5
5
|
const { expression, useType, useConverter = false, useValidation = false } = mapParamsOptions(args);
|
|
6
6
|
return UseParam({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
2
|
-
import { mapParamsOptions } from "../utils/mapParamsOptions";
|
|
3
|
-
import { UseParam } from "./useParam";
|
|
1
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
2
|
+
import { mapParamsOptions } from "../utils/mapParamsOptions.js";
|
|
3
|
+
import { UseParam } from "./useParam.js";
|
|
4
4
|
export function Locals(...args) {
|
|
5
5
|
const { expression, useType, useConverter = false, useValidation = false } = mapParamsOptions(args);
|
|
6
6
|
return UseParam({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
2
|
-
import { mapParamsOptions } from "../utils/mapParamsOptions";
|
|
3
|
-
import { UseParam } from "./useParam";
|
|
1
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
2
|
+
import { mapParamsOptions } from "../utils/mapParamsOptions.js";
|
|
3
|
+
import { UseParam } from "./useParam.js";
|
|
4
4
|
export function PathParams(...args) {
|
|
5
5
|
const { expression, useType, useConverter = true, useValidation = true } = mapParamsOptions(args);
|
|
6
6
|
return UseParam({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
2
|
-
import { mapParamsOptions } from "../utils/mapParamsOptions";
|
|
3
|
-
import { UseParam } from "./useParam";
|
|
1
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
2
|
+
import { mapParamsOptions } from "../utils/mapParamsOptions.js";
|
|
3
|
+
import { UseParam } from "./useParam.js";
|
|
4
4
|
export function QueryParams(...args) {
|
|
5
5
|
const { expression, useType, useConverter = true, useValidation = true } = mapParamsOptions(args);
|
|
6
6
|
return UseParam({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
2
|
-
import { mapParamsOptions } from "../utils/mapParamsOptions";
|
|
3
|
-
import { UseParam } from "./useParam";
|
|
1
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
2
|
+
import { mapParamsOptions } from "../utils/mapParamsOptions.js";
|
|
3
|
+
import { UseParam } from "./useParam.js";
|
|
4
4
|
export function Session(...args) {
|
|
5
5
|
const { expression, useType, useConverter = false, useValidation = false } = mapParamsOptions(args);
|
|
6
6
|
return UseParam({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isString, useDecorators } from "@tsed/core";
|
|
2
2
|
import { Any } from "@tsed/schema";
|
|
3
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
4
|
-
import { ParamFn } from "./paramFn";
|
|
5
|
-
import { UseDeserialization } from "./useDeserialization";
|
|
6
|
-
import { UseParamType } from "./useParamType";
|
|
7
|
-
import { UseType } from "./useType";
|
|
8
|
-
import { UseValidation } from "./useValidation";
|
|
3
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
4
|
+
import { ParamFn } from "./paramFn.js";
|
|
5
|
+
import { UseDeserialization } from "./useDeserialization.js";
|
|
6
|
+
import { UseParamType } from "./useParamType.js";
|
|
7
|
+
import { UseType } from "./useType.js";
|
|
8
|
+
import { UseValidation } from "./useValidation.js";
|
|
9
9
|
/**
|
|
10
10
|
* @ignore
|
|
11
11
|
* @param options
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useDecorators } from "@tsed/core";
|
|
2
2
|
import { isParameterType, Name } from "@tsed/schema";
|
|
3
|
-
import { ParamFn } from "./paramFn";
|
|
4
|
-
import { UseParamExpression } from "./useParamExpression";
|
|
3
|
+
import { ParamFn } from "./paramFn.js";
|
|
4
|
+
import { UseParamExpression } from "./useParamExpression.js";
|
|
5
5
|
/**
|
|
6
6
|
* Get the object from request (like body, params, query, etc...).
|
|
7
7
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { nameOf } from "@tsed/core";
|
|
2
2
|
import { BadRequest } from "@tsed/exceptions";
|
|
3
|
-
import { ValidationError } from "./ValidationError";
|
|
3
|
+
import { ValidationError } from "./ValidationError.js";
|
|
4
4
|
export class ParamValidationError extends BadRequest {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"","sourcesContent":["export {PipeMethods} from \"@tsed/schema\";\n"]}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
|
|
11
|
-
export * from "./
|
|
12
|
-
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
|
|
17
|
-
export * from "./decorators/
|
|
18
|
-
export * from "./decorators/
|
|
19
|
-
export * from "./decorators/usePipe";
|
|
20
|
-
export * from "./decorators/
|
|
21
|
-
export * from "./decorators/
|
|
22
|
-
export * from "./
|
|
23
|
-
export * from "./
|
|
24
|
-
export * from "./
|
|
25
|
-
export * from "./
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./
|
|
28
|
-
export * from "./
|
|
29
|
-
export * from "./
|
|
30
|
-
export * from "./
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./decorators/session";
|
|
33
|
-
export * from "./decorators/paramFn";
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./exports.js";
|
|
5
|
+
export * from "./builder/PlatformParams.js";
|
|
6
|
+
export * from "./decorators/bodyParams.js";
|
|
7
|
+
export * from "./decorators/context.js";
|
|
8
|
+
export * from "./decorators/cookies.js";
|
|
9
|
+
export * from "./decorators/headerParams.js";
|
|
10
|
+
export * from "./decorators/locals.js";
|
|
11
|
+
export * from "./decorators/paramFn.js";
|
|
12
|
+
export * from "./decorators/pathParams.js";
|
|
13
|
+
export * from "./decorators/queryParams.js";
|
|
14
|
+
export * from "./decorators/session.js";
|
|
15
|
+
export * from "./decorators/useDeserialization.js";
|
|
16
|
+
export * from "./decorators/useParam.js";
|
|
17
|
+
export * from "./decorators/useParamExpression.js";
|
|
18
|
+
export * from "./decorators/useParamType.js";
|
|
19
|
+
export * from "./decorators/usePipe.js";
|
|
20
|
+
export * from "./decorators/useType.js";
|
|
21
|
+
export * from "./decorators/useValidation.js";
|
|
22
|
+
export * from "./domain/ParamMetadata.js";
|
|
23
|
+
export * from "./domain/ParamOptions.js";
|
|
24
|
+
export * from "./domain/ParamTypes.js";
|
|
25
|
+
export * from "./errors/ParamValidationError.js";
|
|
26
|
+
export * from "./errors/RequiredValidationError.js";
|
|
27
|
+
export * from "./errors/ValidationError.js";
|
|
28
|
+
export * from "./pipes/DeserializerPipe.js";
|
|
29
|
+
export * from "./pipes/ParseExpressionPipe.js";
|
|
30
|
+
export * from "./pipes/ValidationPipe.js";
|
|
31
|
+
export * from "./utils/mapParamsOptions.js";
|
|
34
32
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./exports\";\nexport * from \"./builder/PlatformParams\";\nexport * from \"./decorators/bodyParams\";\nexport * from \"./decorators/context\";\nexport * from \"./decorators/cookies\";\nexport * from \"./decorators/headerParams\";\nexport * from \"./decorators/locals\";\nexport * from \"./decorators/paramFn\";\nexport * from \"./decorators/pathParams\";\nexport * from \"./decorators/queryParams\";\nexport * from \"./decorators/session\";\nexport * from \"./decorators/useDeserialization\";\nexport * from \"./decorators/useParam\";\nexport * from \"./decorators/useParamExpression\";\nexport * from \"./decorators/useParamType\";\nexport * from \"./decorators/usePipe\";\nexport * from \"./decorators/useType\";\nexport * from \"./decorators/useValidation\";\nexport * from \"./domain/ParamMetadata\";\nexport * from \"./domain/ParamOptions\";\nexport * from \"./domain/ParamTypes\";\nexport * from \"./errors/ParamValidationError\";\nexport * from \"./errors/RequiredValidationError\";\nexport * from \"./errors/ValidationError\";\nexport * from \"./pipes/DeserializerPipe\";\nexport * from \"./pipes/ParseExpressionPipe\";\nexport * from \"./pipes/ValidationPipe\";\nexport * from \"./utils/mapParamsOptions\";\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { getValue } from "@tsed/core";
|
|
3
3
|
import { Injectable } from "@tsed/di";
|
|
4
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
4
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
5
5
|
let ParseExpressionPipe = class ParseExpressionPipe {
|
|
6
6
|
transform(scope, param) {
|
|
7
7
|
const { paramType, type } = param;
|
|
@@ -3,8 +3,8 @@ import { nameOf } from "@tsed/core";
|
|
|
3
3
|
import { Injectable, InjectorService } from "@tsed/di";
|
|
4
4
|
import { deserialize } from "@tsed/json-mapper";
|
|
5
5
|
import { getJsonSchema } from "@tsed/schema";
|
|
6
|
-
import { RequiredValidationError } from "../errors/RequiredValidationError";
|
|
7
|
-
import { ParamTypes } from "../domain/ParamTypes";
|
|
6
|
+
import { RequiredValidationError } from "../errors/RequiredValidationError.js";
|
|
7
|
+
import { ParamTypes } from "../domain/ParamTypes.js";
|
|
8
8
|
function cast(value, metadata) {
|
|
9
9
|
try {
|
|
10
10
|
return deserialize(value, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PipeMethods } from "@tsed/schema";
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./domain/ParamTypes";
|
|
6
|
-
export * from "./pipes/ParseExpressionPipe";
|
|
7
|
-
export * from "./pipes/DeserializerPipe";
|
|
8
|
-
export * from "./pipes/ValidationPipe";
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./exports";
|
|
9
5
|
export * from "./builder/PlatformParams";
|
|
10
|
-
export * from "./errors/RequiredValidationError";
|
|
11
|
-
export * from "./errors/ValidationError";
|
|
12
|
-
export * from "./errors/ParamValidationError";
|
|
13
|
-
export * from "./decorators/context";
|
|
14
6
|
export * from "./decorators/bodyParams";
|
|
15
|
-
export * from "./decorators/
|
|
16
|
-
export * from "./decorators/useParam";
|
|
17
|
-
export * from "./decorators/useParamType";
|
|
18
|
-
export * from "./decorators/useType";
|
|
19
|
-
export * from "./decorators/useValidation";
|
|
20
|
-
export * from "./decorators/useDeserialization";
|
|
21
|
-
export * from "./decorators/useParamExpression";
|
|
22
|
-
export * from "./decorators/useParamType";
|
|
23
|
-
export * from "./decorators/headerParams";
|
|
7
|
+
export * from "./decorators/context";
|
|
24
8
|
export * from "./decorators/cookies";
|
|
9
|
+
export * from "./decorators/headerParams";
|
|
25
10
|
export * from "./decorators/locals";
|
|
11
|
+
export * from "./decorators/paramFn";
|
|
26
12
|
export * from "./decorators/pathParams";
|
|
27
13
|
export * from "./decorators/queryParams";
|
|
28
14
|
export * from "./decorators/session";
|
|
29
|
-
export * from "./decorators/
|
|
15
|
+
export * from "./decorators/useDeserialization";
|
|
16
|
+
export * from "./decorators/useParam";
|
|
17
|
+
export * from "./decorators/useParamExpression";
|
|
18
|
+
export * from "./decorators/useParamType";
|
|
19
|
+
export * from "./decorators/usePipe";
|
|
20
|
+
export * from "./decorators/useType";
|
|
21
|
+
export * from "./decorators/useValidation";
|
|
22
|
+
export * from "./domain/ParamMetadata";
|
|
23
|
+
export * from "./domain/ParamOptions";
|
|
24
|
+
export * from "./domain/ParamTypes";
|
|
25
|
+
export * from "./errors/ParamValidationError";
|
|
26
|
+
export * from "./errors/RequiredValidationError";
|
|
27
|
+
export * from "./errors/ValidationError";
|
|
28
|
+
export * from "./pipes/DeserializerPipe";
|
|
29
|
+
export * from "./pipes/ParseExpressionPipe";
|
|
30
|
+
export * from "./pipes/ValidationPipe";
|
|
31
|
+
export * from "./utils/mapParamsOptions";
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-params",
|
|
3
|
-
"version": "6.102.
|
|
3
|
+
"version": "6.102.8-rc.2",
|
|
4
4
|
"description": "Params module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/cjs/index.js",
|
|
8
|
+
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
11
|
"types": "./lib/types/index.d.ts",
|
|
@@ -13,32 +14,36 @@
|
|
|
13
14
|
"default": "./lib/esm/index.js"
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|
|
16
|
-
"build": "yarn run build:esm && yarn run build:cjs",
|
|
17
|
+
"build": "yarn barrels && yarn run build:esm && yarn run build:cjs",
|
|
17
18
|
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
18
|
-
"build:esm": "tsc --build tsconfig.compile.esm.json"
|
|
19
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
20
|
+
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\""
|
|
19
21
|
},
|
|
20
22
|
"dependencies": {
|
|
21
23
|
"tslib": "2.2.0"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
|
-
"@tsed/core": "6.102.
|
|
25
|
-
"@tsed/di": "6.102.
|
|
26
|
-
"@tsed/exceptions": "6.102.
|
|
27
|
-
"@tsed/json-mapper": "6.102.
|
|
28
|
-
"@tsed/schema": "6.102.
|
|
26
|
+
"@tsed/core": "6.102.8-rc.2",
|
|
27
|
+
"@tsed/di": "6.102.8-rc.2",
|
|
28
|
+
"@tsed/exceptions": "6.102.8-rc.2",
|
|
29
|
+
"@tsed/json-mapper": "6.102.8-rc.2",
|
|
30
|
+
"@tsed/schema": "6.102.8-rc.2"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
31
|
-
"@tsed/core": "^6.102.
|
|
32
|
-
"@tsed/di": "^6.102.
|
|
33
|
-
"@tsed/exceptions": "^6.102.
|
|
34
|
-
"@tsed/json-mapper": "^6.102.
|
|
35
|
-
"@tsed/schema": "^6.102.
|
|
33
|
+
"@tsed/core": "^6.102.8-rc.2",
|
|
34
|
+
"@tsed/di": "^6.102.8-rc.2",
|
|
35
|
+
"@tsed/exceptions": "^6.102.8-rc.2",
|
|
36
|
+
"@tsed/json-mapper": "^6.102.8-rc.2",
|
|
37
|
+
"@tsed/schema": "^6.102.8-rc.2"
|
|
36
38
|
},
|
|
37
39
|
"repository": "https://github.com/tsedio/tsed",
|
|
38
40
|
"bugs": {
|
|
39
41
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
40
42
|
},
|
|
41
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
43
|
+
"homepage": "https://github.com/tsedio/tsed/tree/rc/packages/platform/platform-params",
|
|
42
44
|
"author": "Romain Lenzotti",
|
|
43
|
-
"license": "MIT"
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"tag": "rc"
|
|
48
|
+
}
|
|
44
49
|
}
|