@tsed/schema 6.92.1 → 6.95.1
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/.mocharc.js +5 -0
- package/.nycrc +27 -0
- package/lib/cjs/components/anyMapper.js +0 -1
- package/lib/cjs/components/anyMapper.js.map +1 -1
- package/lib/cjs/components/classMapper.d.ts +1 -1
- package/lib/cjs/components/classMapper.js +1 -1
- package/lib/cjs/components/classMapper.js.map +1 -1
- package/lib/cjs/components/index.d.ts +2 -0
- package/lib/cjs/components/index.js +2 -0
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/inheritedClassMapper.d.ts +1 -1
- package/lib/cjs/components/inheritedClassMapper.js +1 -1
- package/lib/cjs/components/inheritedClassMapper.js.map +1 -1
- package/lib/cjs/components/mapMapper.d.ts +1 -1
- package/lib/cjs/components/mapMapper.js +1 -1
- package/lib/cjs/components/mapMapper.js.map +1 -1
- package/lib/cjs/components/objectMapper.js +4 -1
- package/lib/cjs/components/objectMapper.js.map +1 -1
- package/lib/cjs/components/ofMapper.d.ts +3 -0
- package/lib/cjs/components/ofMapper.js +17 -0
- package/lib/cjs/components/ofMapper.js.map +1 -0
- package/lib/cjs/components/propertiesMapper.d.ts +3 -0
- package/lib/cjs/components/propertiesMapper.js +25 -0
- package/lib/cjs/components/propertiesMapper.js.map +1 -0
- package/lib/cjs/components/schemaMapper.d.ts +1 -1
- package/lib/cjs/components/schemaMapper.js +31 -34
- package/lib/cjs/components/schemaMapper.js.map +1 -1
- package/lib/cjs/decorators/common/oneOf.js +1 -0
- package/lib/cjs/decorators/common/oneOf.js.map +1 -1
- package/lib/cjs/decorators/common/requiredGroups.d.ts +1 -1
- package/lib/cjs/decorators/common/requiredGroups.js +6 -9
- package/lib/cjs/decorators/common/requiredGroups.js.map +1 -1
- package/lib/cjs/decorators/index.d.ts +1 -0
- package/lib/cjs/decorators/index.js +1 -0
- package/lib/cjs/decorators/index.js.map +1 -1
- package/lib/cjs/decorators/operations/inFile.d.ts +25 -0
- package/lib/cjs/decorators/operations/inFile.js +45 -0
- package/lib/cjs/decorators/operations/inFile.js.map +1 -0
- package/lib/cjs/decorators/operations/returns.d.ts +16 -1
- package/lib/cjs/decorators/operations/returns.js +38 -1
- package/lib/cjs/decorators/operations/returns.js.map +1 -1
- package/lib/cjs/decorators/operations/route.d.ts +3 -0
- package/lib/cjs/decorators/operations/route.js +10 -8
- package/lib/cjs/decorators/operations/route.js.map +1 -1
- package/lib/cjs/domain/JsonEntityStore.d.ts +3 -0
- package/lib/cjs/domain/JsonEntityStore.js.map +1 -1
- package/lib/cjs/domain/JsonMethodStore.d.ts +22 -1
- package/lib/cjs/domain/JsonMethodStore.js +42 -5
- package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
- package/lib/cjs/hooks/alterOneOf.d.ts +3 -0
- package/lib/cjs/hooks/alterOneOf.js +14 -0
- package/lib/cjs/hooks/alterOneOf.js.map +1 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/registries/JsonSchemaMapperContainer.d.ts +3 -2
- package/lib/cjs/registries/JsonSchemaMapperContainer.js +7 -3
- package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -1
- package/lib/cjs/utils/getJsonEntityStore.d.ts +0 -4
- package/lib/cjs/utils/getJsonEntityStore.js +1 -8
- package/lib/cjs/utils/getJsonEntityStore.js.map +1 -1
- package/lib/cjs/utils/getRequiredProperties.js +1 -2
- package/lib/cjs/utils/getRequiredProperties.js.map +1 -1
- package/lib/cjs/utils/mapRouteOptions.d.ts +1 -1
- package/lib/cjs/utils/mapRouteOptions.js +1 -1
- package/lib/cjs/utils/mapRouteOptions.js.map +1 -1
- package/lib/esm/components/anyMapper.js +0 -1
- package/lib/esm/components/anyMapper.js.map +1 -1
- package/lib/esm/components/classMapper.js +1 -1
- package/lib/esm/components/classMapper.js.map +1 -1
- package/lib/esm/components/index.js +2 -0
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/inheritedClassMapper.js +1 -1
- package/lib/esm/components/inheritedClassMapper.js.map +1 -1
- package/lib/esm/components/mapMapper.js +1 -1
- package/lib/esm/components/mapMapper.js.map +1 -1
- package/lib/esm/components/objectMapper.js +4 -1
- package/lib/esm/components/objectMapper.js.map +1 -1
- package/lib/esm/components/ofMapper.js +13 -0
- package/lib/esm/components/ofMapper.js.map +1 -0
- package/lib/esm/components/propertiesMapper.js +21 -0
- package/lib/esm/components/propertiesMapper.js.map +1 -0
- package/lib/esm/components/schemaMapper.js +32 -35
- package/lib/esm/components/schemaMapper.js.map +1 -1
- package/lib/esm/decorators/common/oneOf.js +1 -0
- package/lib/esm/decorators/common/oneOf.js.map +1 -1
- package/lib/esm/decorators/common/requiredGroups.js +6 -9
- package/lib/esm/decorators/common/requiredGroups.js.map +1 -1
- package/lib/esm/decorators/index.js +1 -0
- package/lib/esm/decorators/index.js.map +1 -1
- package/lib/esm/decorators/operations/inFile.js +41 -0
- package/lib/esm/decorators/operations/inFile.js.map +1 -0
- package/lib/esm/decorators/operations/returns.js +39 -2
- package/lib/esm/decorators/operations/returns.js.map +1 -1
- package/lib/esm/decorators/operations/route.js +10 -8
- package/lib/esm/decorators/operations/route.js.map +1 -1
- package/lib/esm/domain/JsonEntityStore.js.map +1 -1
- package/lib/esm/domain/JsonMethodStore.js +44 -7
- package/lib/esm/domain/JsonMethodStore.js.map +1 -1
- package/lib/esm/hooks/alterOneOf.js +10 -0
- package/lib/esm/hooks/alterOneOf.js.map +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/registries/JsonSchemaMapperContainer.js +5 -2
- package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -1
- package/lib/esm/utils/getJsonEntityStore.js +0 -6
- package/lib/esm/utils/getJsonEntityStore.js.map +1 -1
- package/lib/esm/utils/getRequiredProperties.js +1 -2
- package/lib/esm/utils/getRequiredProperties.js.map +1 -1
- package/lib/esm/utils/mapRouteOptions.js +1 -1
- package/lib/esm/utils/mapRouteOptions.js.map +1 -1
- package/lib/types/components/classMapper.d.ts +1 -1
- package/lib/types/components/index.d.ts +2 -0
- package/lib/types/components/inheritedClassMapper.d.ts +1 -1
- package/lib/types/components/mapMapper.d.ts +1 -1
- package/lib/types/components/ofMapper.d.ts +3 -0
- package/lib/types/components/propertiesMapper.d.ts +3 -0
- package/lib/types/components/schemaMapper.d.ts +1 -1
- package/lib/types/decorators/common/requiredGroups.d.ts +1 -1
- package/lib/types/decorators/index.d.ts +1 -0
- package/lib/types/decorators/operations/inFile.d.ts +25 -0
- package/lib/types/decorators/operations/returns.d.ts +16 -1
- package/lib/types/decorators/operations/route.d.ts +3 -0
- package/lib/types/domain/JsonEntityStore.d.ts +3 -0
- package/lib/types/domain/JsonMethodStore.d.ts +22 -1
- package/lib/types/hooks/alterOneOf.d.ts +3 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/registries/JsonSchemaMapperContainer.d.ts +3 -2
- package/lib/types/utils/getJsonEntityStore.d.ts +0 -4
- package/lib/types/utils/mapRouteOptions.d.ts +1 -1
- package/package.json +7 -6
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JsonSchema } from "../domain/JsonSchema";
|
|
2
2
|
import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
|
|
3
|
-
export declare function classMapper(value: JsonSchema, options
|
|
3
|
+
export declare function classMapper(value: JsonSchema, options: JsonSchemaOptions): any;
|
|
@@ -2,4 +2,4 @@ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
|
|
|
2
2
|
/**
|
|
3
3
|
* @ignore
|
|
4
4
|
*/
|
|
5
|
-
export declare function inheritedClassMapper(obj: any, { target, ...options }
|
|
5
|
+
export declare function inheritedClassMapper(obj: any, { target, ...options }: JsonSchemaOptions): any;
|
|
@@ -6,4 +6,4 @@ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
|
|
|
6
6
|
* @param options
|
|
7
7
|
* @ignore
|
|
8
8
|
*/
|
|
9
|
-
export declare function mapMapper(input: Map<string, any>, { ignore, ...options }
|
|
9
|
+
export declare function mapMapper(input: Map<string, any>, { ignore, ...options }: JsonSchemaOptions): any;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JsonSchema } from "../domain/JsonSchema";
|
|
2
2
|
import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
|
|
3
|
-
export declare function schemaMapper(schema: JsonSchema, options
|
|
3
|
+
export declare function schemaMapper(schema: JsonSchema, options: JsonSchemaOptions): any;
|
|
@@ -12,6 +12,7 @@ export * from "./operations/deprecated";
|
|
|
12
12
|
export * from "./operations/consumes";
|
|
13
13
|
export * from "./operations/contentType";
|
|
14
14
|
export * from "./operations/in";
|
|
15
|
+
export * from "./operations/inFile";
|
|
15
16
|
export * from "./operations/operationId";
|
|
16
17
|
export * from "./operations/operationPath";
|
|
17
18
|
export * from "./operations/path";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add a input file parameter.
|
|
3
|
+
*
|
|
4
|
+
* ::: warning
|
|
5
|
+
* Don't use decorator with Ts.ED application to decorate parameters. Use @@BodyParams@@, @@PathParams@@, etc... instead.
|
|
6
|
+
* But you can use this decorator on Method, to add extra in parameters like Authorization header.
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* @Controller("/")
|
|
10
|
+
* class MyController {
|
|
11
|
+
* @Post("/")
|
|
12
|
+
* method(@InFile("file1") file: any) {
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
* :::
|
|
17
|
+
*
|
|
18
|
+
* @decorator
|
|
19
|
+
* @swagger
|
|
20
|
+
* @schema
|
|
21
|
+
* @input
|
|
22
|
+
* @operation
|
|
23
|
+
* @param name
|
|
24
|
+
*/
|
|
25
|
+
export declare function InFile(name: string): ParameterDecorator;
|
|
@@ -40,6 +40,21 @@ export interface ReturnsChainedDecorators {
|
|
|
40
40
|
* @param types
|
|
41
41
|
*/
|
|
42
42
|
Of(...types: GenericValue[]): this;
|
|
43
|
+
/**
|
|
44
|
+
* Add the nested types
|
|
45
|
+
* @param types
|
|
46
|
+
*/
|
|
47
|
+
OneOf(...types: GenericValue[]): this;
|
|
48
|
+
/**
|
|
49
|
+
* Add the nested types
|
|
50
|
+
* @param types
|
|
51
|
+
*/
|
|
52
|
+
AllOf(...types: GenericValue[]): this;
|
|
53
|
+
/**
|
|
54
|
+
* Add the nested types
|
|
55
|
+
* @param types
|
|
56
|
+
*/
|
|
57
|
+
AnyOf(...types: GenericValue[]): this;
|
|
43
58
|
/**
|
|
44
59
|
* Declare a nested generic models
|
|
45
60
|
* @param generics
|
|
@@ -235,4 +250,4 @@ export interface ReturnsChainedDecorators {
|
|
|
235
250
|
* @response
|
|
236
251
|
* @operation
|
|
237
252
|
*/
|
|
238
|
-
export declare function Returns(status?: string | number, model?: Type<any>): ReturnsChainedDecorators;
|
|
253
|
+
export declare function Returns(status?: string | number, model?: Type<any> | Type<any>[]): ReturnsChainedDecorators;
|
|
@@ -32,6 +32,9 @@ export interface RouteChainedDecorators {
|
|
|
32
32
|
* @param Summary
|
|
33
33
|
*/
|
|
34
34
|
Summary(Summary: string): this;
|
|
35
|
+
Use(...args: any[]): this;
|
|
36
|
+
UseAfter(...args: any[]): this;
|
|
37
|
+
UseBefore(...args: any[]): this;
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
37
40
|
* Describe a new route with a method and path.
|
|
@@ -16,6 +16,9 @@ export interface JsonEntityStoreOptions {
|
|
|
16
16
|
descriptor?: any;
|
|
17
17
|
type?: Type<any>;
|
|
18
18
|
collectionType?: Type<any>;
|
|
19
|
+
beforeMiddlewares?: Function[];
|
|
20
|
+
middlewares?: Function[];
|
|
21
|
+
afterMiddlewares?: Function[];
|
|
19
22
|
[key: string]: any;
|
|
20
23
|
}
|
|
21
24
|
export declare abstract class JsonEntityStore implements JsonEntityStoreOptions {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { JsonEntityStore } from "./JsonEntityStore";
|
|
1
|
+
import { JsonEntityStore, JsonEntityStoreOptions } from "./JsonEntityStore";
|
|
2
2
|
import { JsonOperation } from "./JsonOperation";
|
|
3
3
|
import type { JsonParameterStore } from "./JsonParameterStore";
|
|
4
4
|
import type { JsonClassStore } from "./JsonClassStore";
|
|
5
5
|
export declare class JsonMethodStore extends JsonEntityStore {
|
|
6
6
|
readonly parent: JsonClassStore;
|
|
7
|
+
middlewares: any[];
|
|
8
|
+
beforeMiddlewares: any[];
|
|
9
|
+
afterMiddlewares: any[];
|
|
10
|
+
constructor(options: JsonEntityStoreOptions);
|
|
7
11
|
/**
|
|
8
12
|
* Ref to JsonOperation when the decorated object is a method.
|
|
9
13
|
*/
|
|
@@ -16,4 +20,21 @@ export declare class JsonMethodStore extends JsonEntityStore {
|
|
|
16
20
|
get operationPaths(): Map<string, import("./JsonOperation").JsonMethodPath>;
|
|
17
21
|
getResponseOptions(status: number, contentType?: string): undefined | any;
|
|
18
22
|
protected build(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Append middlewares to the beforeMiddlewares list.
|
|
25
|
+
* @param args
|
|
26
|
+
* @returns {EndpointMetadata}
|
|
27
|
+
*/
|
|
28
|
+
before(args: Function[]): this;
|
|
29
|
+
/**
|
|
30
|
+
* Append middlewares to the afterMiddlewares list.
|
|
31
|
+
* @param args
|
|
32
|
+
* @returns {EndpointMetadata}
|
|
33
|
+
*/
|
|
34
|
+
after(args: Function[]): this;
|
|
35
|
+
/**
|
|
36
|
+
* Store all arguments collected via Annotation.
|
|
37
|
+
* @param args
|
|
38
|
+
*/
|
|
39
|
+
use(args: Function[]): this;
|
|
19
40
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./utils/getSpec";
|
|
|
9
9
|
export * from "./utils/mergeSpec";
|
|
10
10
|
export * from "./utils/generics";
|
|
11
11
|
export * from "./utils/mapHeaders";
|
|
12
|
+
export * from "./utils/matchGroups";
|
|
12
13
|
export * from "./utils/isSuccessStatus";
|
|
13
14
|
export * from "./utils/from";
|
|
14
15
|
export * from "./utils/concatPath";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @ignore
|
|
3
3
|
*/
|
|
4
4
|
export interface JsonSchemaMapper {
|
|
5
|
-
(schema: any, options: any): any;
|
|
5
|
+
(schema: any, options: any, parent?: any): any;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* @ignore
|
|
@@ -15,4 +15,5 @@ export declare function getJsonSchemaMapper(type: string): JsonSchemaMapper;
|
|
|
15
15
|
/**
|
|
16
16
|
* @ignore
|
|
17
17
|
*/
|
|
18
|
-
export declare function execMapper(type: string, schema: any, options: any): any;
|
|
18
|
+
export declare function execMapper(type: string, schema: any, options: any, parent?: any): any;
|
|
19
|
+
export declare function hasMapper(type: string): boolean;
|
|
@@ -4,10 +4,6 @@ import { JsonClassStore } from "../domain/JsonClassStore";
|
|
|
4
4
|
import { JsonPropertyStore } from "../domain/JsonPropertyStore";
|
|
5
5
|
import { JsonParameterStore } from "../domain/JsonParameterStore";
|
|
6
6
|
import { JsonMethodStore } from "../domain/JsonMethodStore";
|
|
7
|
-
/**
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
export declare function isJsonEntityStore(model: any): model is JsonEntityStore;
|
|
11
7
|
/**
|
|
12
8
|
* Get entity store from decorator args
|
|
13
9
|
* @param target
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/schema",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.95.1",
|
|
4
4
|
"description": "JsonSchema module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "yarn run build:esm && yarn run build:cjs",
|
|
17
17
|
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
18
|
-
"build:esm": "tsc --build tsconfig.compile.esm.json"
|
|
18
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
19
|
+
"test": "cross-env NODE_ENV=test nyc mocha"
|
|
19
20
|
},
|
|
20
21
|
"keywords": [
|
|
21
22
|
"TypeScript",
|
|
@@ -28,8 +29,8 @@
|
|
|
28
29
|
"tsed"
|
|
29
30
|
],
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@tsed/core": "6.
|
|
32
|
-
"@tsed/openspec": "6.
|
|
32
|
+
"@tsed/core": "6.95.1",
|
|
33
|
+
"@tsed/openspec": "6.95.1",
|
|
33
34
|
"camel-case": "4.1.2",
|
|
34
35
|
"json-schema": "0.4.0",
|
|
35
36
|
"micromatch": "4.0.2",
|
|
@@ -44,8 +45,8 @@
|
|
|
44
45
|
"fs-extra": "9.0.1"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
|
-
"@tsed/core": "^6.
|
|
48
|
-
"@tsed/openspec": "^6.
|
|
48
|
+
"@tsed/core": "^6.95.1",
|
|
49
|
+
"@tsed/openspec": "^6.95.1"
|
|
49
50
|
},
|
|
50
51
|
"repository": "https://github.com/tsedio/tsed",
|
|
51
52
|
"bugs": {
|