@tsed/schema 7.79.4 → 7.80.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.
Files changed (206) hide show
  1. package/lib/browser/schema.umd.min.js.map +1 -1
  2. package/lib/cjs/components/default/inlineEnumsMapper.js +2 -2
  3. package/lib/cjs/components/default/inlineEnumsMapper.js.map +1 -1
  4. package/lib/cjs/components/default/nullableMapper.js +4 -4
  5. package/lib/cjs/components/default/nullableMapper.js.map +1 -1
  6. package/lib/cjs/components/default/requiredMapper.js +4 -4
  7. package/lib/cjs/components/default/requiredMapper.js.map +1 -1
  8. package/lib/cjs/components/open-spec/nullableMapper.js +4 -4
  9. package/lib/cjs/components/open-spec/nullableMapper.js.map +1 -1
  10. package/lib/cjs/utils/generateSpec.js +1 -24
  11. package/lib/cjs/utils/generateSpec.js.map +1 -1
  12. package/lib/esm/components/default/inlineEnumsMapper.js.map +1 -1
  13. package/lib/esm/components/default/nullableMapper.js.map +1 -1
  14. package/lib/esm/components/default/requiredMapper.js.map +1 -1
  15. package/lib/esm/components/open-spec/nullableMapper.js.map +1 -1
  16. package/lib/esm/utils/getJsonSchema.js +1 -1
  17. package/lib/types/components/default/inlineEnumsMapper.d.ts +2 -2
  18. package/lib/types/components/default/nullableMapper.d.ts +1 -1
  19. package/lib/types/components/default/requiredMapper.d.ts +2 -2
  20. package/lib/types/components/open-spec/nullableMapper.d.ts +1 -1
  21. package/lib/types-esm/components/async-api/channelsMapper.d.ts +2 -0
  22. package/lib/types-esm/components/async-api/generate.d.ts +1 -0
  23. package/lib/types-esm/components/async-api/messageMapper.d.ts +6 -0
  24. package/lib/types-esm/components/async-api/payloadMapper.d.ts +4 -0
  25. package/lib/types-esm/components/async-api/responseMapper.d.ts +6 -0
  26. package/lib/types-esm/components/default/anyMapper.d.ts +2 -0
  27. package/lib/types-esm/components/default/classMapper.d.ts +3 -0
  28. package/lib/types-esm/components/default/genericsMapper.d.ts +5 -0
  29. package/lib/types-esm/components/default/inheritedClassMapper.d.ts +5 -0
  30. package/lib/types-esm/components/default/inlineEnumsMapper.d.ts +3 -0
  31. package/lib/types-esm/components/default/itemMapper.d.ts +2 -0
  32. package/lib/types-esm/components/default/lazyRefMapper.d.ts +3 -0
  33. package/lib/types-esm/components/default/mapMapper.d.ts +9 -0
  34. package/lib/types-esm/components/default/nullableMapper.d.ts +2 -0
  35. package/lib/types-esm/components/default/objectMapper.d.ts +8 -0
  36. package/lib/types-esm/components/default/ofMapper.d.ts +3 -0
  37. package/lib/types-esm/components/default/propertiesMapper.d.ts +3 -0
  38. package/lib/types-esm/components/default/requiredMapper.d.ts +3 -0
  39. package/lib/types-esm/components/default/schemaMapper.d.ts +3 -0
  40. package/lib/types-esm/components/index.d.ts +33 -0
  41. package/lib/types-esm/components/open-spec/generate.d.ts +1 -0
  42. package/lib/types-esm/components/open-spec/nullableMapper.d.ts +2 -0
  43. package/lib/types-esm/components/open-spec/operationInFilesMapper.d.ts +2 -0
  44. package/lib/types-esm/components/open-spec/operationInParameterMapper.d.ts +10 -0
  45. package/lib/types-esm/components/open-spec/operationInParametersMapper.d.ts +3 -0
  46. package/lib/types-esm/components/open-spec/operationInQueryMapper.d.ts +2 -0
  47. package/lib/types-esm/components/open-spec/operationMapper.d.ts +3 -0
  48. package/lib/types-esm/components/open-spec/operationMediaMapper.d.ts +3 -0
  49. package/lib/types-esm/components/open-spec/operationRequestBodyMapper.d.ts +3 -0
  50. package/lib/types-esm/components/open-spec/operationResponseMapper.d.ts +3 -0
  51. package/lib/types-esm/components/open-spec/pathsMapper.d.ts +2 -0
  52. package/lib/types-esm/constants/OperationVerbs.d.ts +20 -0
  53. package/lib/types-esm/constants/httpStatusMessages.d.ts +11 -0
  54. package/lib/types-esm/constants/jsonSchemaProperties.d.ts +7 -0
  55. package/lib/types-esm/decorators/class/children.d.ts +11 -0
  56. package/lib/types-esm/decorators/class/discriminatorValue.d.ts +42 -0
  57. package/lib/types-esm/decorators/collections/collectionContains.d.ts +21 -0
  58. package/lib/types-esm/decorators/collections/collectionOf.d.ts +101 -0
  59. package/lib/types-esm/decorators/collections/maxItems.d.ts +48 -0
  60. package/lib/types-esm/decorators/collections/maxProperties.d.ts +71 -0
  61. package/lib/types-esm/decorators/collections/minItems.d.ts +52 -0
  62. package/lib/types-esm/decorators/collections/minProperties.d.ts +70 -0
  63. package/lib/types-esm/decorators/collections/uniqueItems.d.ts +51 -0
  64. package/lib/types-esm/decorators/common/additionalProperties.d.ts +11 -0
  65. package/lib/types-esm/decorators/common/allOf.d.ts +13 -0
  66. package/lib/types-esm/decorators/common/allow.d.ts +28 -0
  67. package/lib/types-esm/decorators/common/any.d.ts +38 -0
  68. package/lib/types-esm/decorators/common/anyOf.d.ts +17 -0
  69. package/lib/types-esm/decorators/common/const.d.ts +61 -0
  70. package/lib/types-esm/decorators/common/customKey.d.ts +26 -0
  71. package/lib/types-esm/decorators/common/default.d.ts +41 -0
  72. package/lib/types-esm/decorators/common/defaultMsg.d.ts +32 -0
  73. package/lib/types-esm/decorators/common/description.d.ts +53 -0
  74. package/lib/types-esm/decorators/common/discriminatorKey.d.ts +1 -0
  75. package/lib/types-esm/decorators/common/enum.d.ts +101 -0
  76. package/lib/types-esm/decorators/common/errorMsg.d.ts +6 -0
  77. package/lib/types-esm/decorators/common/example.d.ts +11 -0
  78. package/lib/types-esm/decorators/common/examples.d.ts +12 -0
  79. package/lib/types-esm/decorators/common/exclusiveMaximum.d.ts +70 -0
  80. package/lib/types-esm/decorators/common/exclusiveMinimum.d.ts +70 -0
  81. package/lib/types-esm/decorators/common/format.d.ts +466 -0
  82. package/lib/types-esm/decorators/common/forwardGroups.d.ts +10 -0
  83. package/lib/types-esm/decorators/common/groups.d.ts +12 -0
  84. package/lib/types-esm/decorators/common/hidden.d.ts +32 -0
  85. package/lib/types-esm/decorators/common/ignore.d.ts +59 -0
  86. package/lib/types-esm/decorators/common/integer.d.ts +61 -0
  87. package/lib/types-esm/decorators/common/jsonEntityFn.d.ts +21 -0
  88. package/lib/types-esm/decorators/common/maxLength.d.ts +77 -0
  89. package/lib/types-esm/decorators/common/maximum.d.ts +139 -0
  90. package/lib/types-esm/decorators/common/minLength.d.ts +78 -0
  91. package/lib/types-esm/decorators/common/minimum.d.ts +137 -0
  92. package/lib/types-esm/decorators/common/multipleOf.d.ts +69 -0
  93. package/lib/types-esm/decorators/common/name.d.ts +32 -0
  94. package/lib/types-esm/decorators/common/nullable.d.ts +25 -0
  95. package/lib/types-esm/decorators/common/oneOf.d.ts +17 -0
  96. package/lib/types-esm/decorators/common/optional.d.ts +10 -0
  97. package/lib/types-esm/decorators/common/pattern.d.ts +94 -0
  98. package/lib/types-esm/decorators/common/property.d.ts +11 -0
  99. package/lib/types-esm/decorators/common/readOnly.d.ts +11 -0
  100. package/lib/types-esm/decorators/common/recordOf.d.ts +46 -0
  101. package/lib/types-esm/decorators/common/required.d.ts +44 -0
  102. package/lib/types-esm/decorators/common/requiredGroups.d.ts +10 -0
  103. package/lib/types-esm/decorators/common/schema.d.ts +53 -0
  104. package/lib/types-esm/decorators/common/title.d.ts +39 -0
  105. package/lib/types-esm/decorators/common/typeError.d.ts +8 -0
  106. package/lib/types-esm/decorators/common/writeOnly.d.ts +11 -0
  107. package/lib/types-esm/decorators/config/jsonEntityComponent.d.ts +10 -0
  108. package/lib/types-esm/decorators/generics/genericOf.d.ts +76 -0
  109. package/lib/types-esm/decorators/generics/generics.d.ts +14 -0
  110. package/lib/types-esm/decorators/operations/acceptMime.d.ts +19 -0
  111. package/lib/types-esm/decorators/operations/consumes.d.ts +19 -0
  112. package/lib/types-esm/decorators/operations/contentType.d.ts +20 -0
  113. package/lib/types-esm/decorators/operations/deprecated.d.ts +23 -0
  114. package/lib/types-esm/decorators/operations/header.d.ts +49 -0
  115. package/lib/types-esm/decorators/operations/in.d.ts +64 -0
  116. package/lib/types-esm/decorators/operations/inFile.d.ts +25 -0
  117. package/lib/types-esm/decorators/operations/location.d.ts +22 -0
  118. package/lib/types-esm/decorators/operations/operation.d.ts +60 -0
  119. package/lib/types-esm/decorators/operations/operationId.d.ts +10 -0
  120. package/lib/types-esm/decorators/operations/operationPath.d.ts +21 -0
  121. package/lib/types-esm/decorators/operations/partial.d.ts +10 -0
  122. package/lib/types-esm/decorators/operations/path.d.ts +15 -0
  123. package/lib/types-esm/decorators/operations/produces.d.ts +26 -0
  124. package/lib/types-esm/decorators/operations/publish.d.ts +1 -0
  125. package/lib/types-esm/decorators/operations/redirect.d.ts +52 -0
  126. package/lib/types-esm/decorators/operations/returns.d.ts +267 -0
  127. package/lib/types-esm/decorators/operations/route.d.ts +133 -0
  128. package/lib/types-esm/decorators/operations/security.d.ts +23 -0
  129. package/lib/types-esm/decorators/operations/status.d.ts +127 -0
  130. package/lib/types-esm/decorators/operations/subscribe.d.ts +1 -0
  131. package/lib/types-esm/decorators/operations/summary.d.ts +20 -0
  132. package/lib/types-esm/decorators/operations/tags.d.ts +23 -0
  133. package/lib/types-esm/decorators/operations/view.d.ts +23 -0
  134. package/lib/types-esm/domain/DecoratorContext.d.ts +28 -0
  135. package/lib/types-esm/domain/JsonAliasMap.d.ts +12 -0
  136. package/lib/types-esm/domain/JsonClassStore.d.ts +12 -0
  137. package/lib/types-esm/domain/JsonDiscriminator.d.ts +18 -0
  138. package/lib/types-esm/domain/JsonEntityStore.d.ts +110 -0
  139. package/lib/types-esm/domain/JsonFormatTypes.d.ts +17 -0
  140. package/lib/types-esm/domain/JsonLazyRef.d.ts +9 -0
  141. package/lib/types-esm/domain/JsonMap.d.ts +9 -0
  142. package/lib/types-esm/domain/JsonMedia.d.ts +11 -0
  143. package/lib/types-esm/domain/JsonMethodStore.d.ts +92 -0
  144. package/lib/types-esm/domain/JsonOperation.d.ts +51 -0
  145. package/lib/types-esm/domain/JsonOperationPathsMap.d.ts +7 -0
  146. package/lib/types-esm/domain/JsonOperationRoute.d.ts +25 -0
  147. package/lib/types-esm/domain/JsonParameter.d.ts +22 -0
  148. package/lib/types-esm/domain/JsonParameterStore.d.ts +52 -0
  149. package/lib/types-esm/domain/JsonParameterTypes.d.ts +16 -0
  150. package/lib/types-esm/domain/JsonPropertyStore.d.ts +32 -0
  151. package/lib/types-esm/domain/JsonRequestBody.d.ts +12 -0
  152. package/lib/types-esm/domain/JsonResponse.d.ts +18 -0
  153. package/lib/types-esm/domain/JsonSchema.d.ts +340 -0
  154. package/lib/types-esm/domain/SpecTypes.d.ts +6 -0
  155. package/lib/types-esm/hooks/alterIgnore.d.ts +10 -0
  156. package/lib/types-esm/hooks/alterOneOf.d.ts +3 -0
  157. package/lib/types-esm/hooks/alterRequiredGroups.d.ts +6 -0
  158. package/lib/types-esm/index.d.ts +182 -0
  159. package/lib/types-esm/interfaces/IgnoreCallback.d.ts +4 -0
  160. package/lib/types-esm/interfaces/JsonHookContext.d.ts +17 -0
  161. package/lib/types-esm/interfaces/JsonOpenSpec.d.ts +9 -0
  162. package/lib/types-esm/interfaces/JsonSchemaOptions.d.ts +30 -0
  163. package/lib/types-esm/registries/JsonSchemaMapperContainer.d.ts +21 -0
  164. package/lib/types-esm/registries/enumRegistries.d.ts +2 -0
  165. package/lib/types-esm/utils/buildPath.d.ts +6 -0
  166. package/lib/types-esm/utils/concatParameters.d.ts +4 -0
  167. package/lib/types-esm/utils/concatPath.d.ts +1 -0
  168. package/lib/types-esm/utils/defineStatusModel.d.ts +3 -0
  169. package/lib/types-esm/utils/from.d.ts +190 -0
  170. package/lib/types-esm/utils/generateSpec.d.ts +16 -0
  171. package/lib/types-esm/utils/generics.d.ts +50 -0
  172. package/lib/types-esm/utils/getComputedType.d.ts +5 -0
  173. package/lib/types-esm/utils/getInheritedStores.d.ts +8 -0
  174. package/lib/types-esm/utils/getJsonEntityStore.d.ts +15 -0
  175. package/lib/types-esm/utils/getJsonPathParameters.d.ts +7 -0
  176. package/lib/types-esm/utils/getJsonSchema.d.ts +4 -0
  177. package/lib/types-esm/utils/getJsonType.d.ts +5 -0
  178. package/lib/types-esm/utils/getOperationsRoutes.d.ts +10 -0
  179. package/lib/types-esm/utils/getOperationsStores.d.ts +6 -0
  180. package/lib/types-esm/utils/getPropertiesStores.d.ts +20 -0
  181. package/lib/types-esm/utils/getSpec.d.ts +34 -0
  182. package/lib/types-esm/utils/getSpecType.d.ts +12 -0
  183. package/lib/types-esm/utils/isSuccessStatus.d.ts +2 -0
  184. package/lib/types-esm/utils/mapHeaders.d.ts +9 -0
  185. package/lib/types-esm/utils/mapOpenSpec.d.ts +10 -0
  186. package/lib/types-esm/utils/mapOpenSpec2.d.ts +9 -0
  187. package/lib/types-esm/utils/mapOpenSpec3.d.ts +8 -0
  188. package/lib/types-esm/utils/mapOpenSpecInfo.d.ts +6 -0
  189. package/lib/types-esm/utils/mapOperationOptions.d.ts +5 -0
  190. package/lib/types-esm/utils/matchGroups.d.ts +4 -0
  191. package/lib/types-esm/utils/mergeSpec.d.ts +23 -0
  192. package/lib/types-esm/utils/operationIdFormatter.d.ts +6 -0
  193. package/lib/types-esm/utils/ref.d.ts +14 -0
  194. package/lib/types-esm/utils/removeHiddenOperation.d.ts +2 -0
  195. package/lib/types-esm/utils/serializeEnumValues.d.ts +5 -0
  196. package/lib/types-esm/utils/somethingOf.d.ts +1 -0
  197. package/lib/types-esm/utils/toJsonMapCollection.d.ts +7 -0
  198. package/lib/types-esm/utils/toJsonRegex.d.ts +5 -0
  199. package/lib/types-esm/utils/transformToOS2.d.ts +25 -0
  200. package/lib/types-esm/utils/withErrorMsg.d.ts +6 -0
  201. package/package.json +21 -17
  202. package/vitest.config.mts +21 -0
  203. package/jest.config.js +0 -21
  204. package/lib/cjs/package.json +0 -3
  205. package/lib/esm/package.json +0 -3
  206. package/tsconfig.esm.json +0 -36
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Use a view and sends the rendered HTML string to the client. Optional parameter:
3
+ *
4
+ * * viewOptions, an object whose properties define local variables for the view.
5
+ *
6
+ * The view argument is a string that is the file path of the view file to render.
7
+ * This can be an absolute path, or a path relative to the views setting.
8
+ * If the path does not contain a file extension, then the view engine setting determines the file extension.
9
+ * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
10
+ * and render it using the loaded module’s __express function.
11
+ *
12
+ * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
13
+ *
14
+ * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
15
+ * and as so for security reasons should not contain input from the end-user.
16
+ *
17
+ * @param path Relative path to the view file.
18
+ * @param options Additional options
19
+ * @decorator
20
+ * @operation
21
+ * @response
22
+ */
23
+ export declare function View(path: string, options?: Object): MethodDecorator;
@@ -0,0 +1,28 @@
1
+ import { DecoratorParameters, DecoratorTypes } from "@tsed/core";
2
+ import { JsonEntityStore } from "./JsonEntityStore.js";
3
+ /**
4
+ * @ignore
5
+ */
6
+ export interface DecoratorActionHandler {
7
+ (ctx: Map<string, any>): void;
8
+ }
9
+ /**
10
+ * @ignore
11
+ */
12
+ export declare abstract class DecoratorContext<T = any> extends Map<string, any> {
13
+ readonly methods: string[];
14
+ protected decoratorType: DecoratorTypes;
15
+ protected entity: JsonEntityStore;
16
+ protected actions: DecoratorActionHandler[];
17
+ constructor(opts?: any);
18
+ addAction(cb: DecoratorActionHandler): this;
19
+ build(): T;
20
+ toObject(): any;
21
+ getMergedKey(key: string, defaultValue: any): any;
22
+ protected bind(args: DecoratorParameters, decorator: any): void;
23
+ protected onInit(args: DecoratorParameters, decorator: any): void;
24
+ protected onMapKey(key: string, value: any): void;
25
+ protected runActions(): this;
26
+ protected beforeInit(): void;
27
+ protected afterInit(): void;
28
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @ignore
3
+ */
4
+ export type AliasType = string | number | symbol;
5
+ /**
6
+ * @ignore
7
+ */
8
+ export type AliasMap = Map<AliasType, AliasType>;
9
+ /**
10
+ * @ignore
11
+ */
12
+ export declare function mapAliasedProperties(value: any, alias: AliasMap): any;
@@ -0,0 +1,12 @@
1
+ import type { JsonMethodStore } from "./JsonMethodStore.js";
2
+ import type { JsonPropertyStore } from "./JsonPropertyStore.js";
3
+ import { JsonEntityStore } from "./JsonEntityStore.js";
4
+ export declare class JsonClassStore extends JsonEntityStore {
5
+ /**
6
+ * List of children JsonEntityStore (properties or methods or params)
7
+ */
8
+ readonly children: Map<string | number, JsonMethodStore | JsonPropertyStore>;
9
+ get path(): string;
10
+ set path(path: string);
11
+ protected build(): void;
12
+ }
@@ -0,0 +1,18 @@
1
+ import { Type } from "@tsed/core";
2
+ export declare class Discriminator {
3
+ propertyName: string;
4
+ base: Type<any>;
5
+ values: Map<string, Type>;
6
+ types: Map<Type, string[]>;
7
+ constructor({ base, propertyName, types, values }?: Partial<{
8
+ base: Type<any>;
9
+ propertyName: string;
10
+ values: Map<string, Type<any>>;
11
+ types: Map<Type, string[]>;
12
+ }>);
13
+ add(type: Type<string>, values: string[]): this;
14
+ getType(discriminatorValue: string): Type<any>;
15
+ getValues(type: Type): string[] | undefined;
16
+ getDefaultValue(type: Type<any>): string | undefined;
17
+ children(): Type<any>[];
18
+ }
@@ -0,0 +1,110 @@
1
+ import { DecoratorTypes, Store, Type } from "@tsed/core";
2
+ import type { JsonClassStore } from "./JsonClassStore.js";
3
+ import type { JsonMethodStore } from "./JsonMethodStore.js";
4
+ import type { JsonParameterStore } from "./JsonParameterStore.js";
5
+ import type { JsonPropertyStore } from "./JsonPropertyStore.js";
6
+ import type { JsonSchema } from "./JsonSchema.js";
7
+ /**
8
+ * @ignore
9
+ */
10
+ export declare const JsonEntitiesContainer: Map<DecoratorTypes, Type<JsonEntityStore>>;
11
+ export interface JsonEntityStoreOptions {
12
+ decoratorType: DecoratorTypes;
13
+ target: Type<any>;
14
+ propertyKey?: string | symbol;
15
+ index?: number;
16
+ descriptor?: any;
17
+ type?: Type<any>;
18
+ collectionType?: Type<any>;
19
+ beforeMiddlewares?: Function[];
20
+ middlewares?: Function[];
21
+ afterMiddlewares?: Function[];
22
+ [key: string]: any;
23
+ }
24
+ export declare abstract class JsonEntityStore implements JsonEntityStoreOptions {
25
+ /**
26
+ * Original property key decorated by the decorator
27
+ */
28
+ readonly propertyKey: string | symbol;
29
+ /**
30
+ * Alias of the property
31
+ */
32
+ readonly propertyName: string;
33
+ /**
34
+ * Parameter index
35
+ */
36
+ readonly index: number;
37
+ /**
38
+ * Method's descriptor
39
+ */
40
+ readonly descriptor: PropertyDescriptor;
41
+ /**
42
+ * Decorator type used to declare the JsonSchemaStore.
43
+ */
44
+ readonly decoratorType: DecoratorTypes;
45
+ /**
46
+ * Type of the collection (Array, Map, Set, etc...)
47
+ */
48
+ collectionType: Type<any>;
49
+ token: Type<any>;
50
+ readonly store: Store;
51
+ readonly isStore = true;
52
+ readonly parent: JsonEntityStore;
53
+ readonly target: Type<any>;
54
+ /**
55
+ *
56
+ */
57
+ protected _type: Type<any>;
58
+ /**
59
+ * Ref to JsonSchema
60
+ */
61
+ protected _schema: JsonSchema;
62
+ [key: string]: any;
63
+ constructor(options: JsonEntityStoreOptions);
64
+ /**
65
+ * Return the class name of the entity.
66
+ * @returns {string}
67
+ */
68
+ get targetName(): string;
69
+ get isCollection(): boolean;
70
+ get isArray(): boolean;
71
+ get discriminatorAncestor(): JsonEntityStore | undefined;
72
+ get isPrimitive(): boolean;
73
+ get isDate(): boolean;
74
+ get isObject(): boolean;
75
+ get isClass(): boolean;
76
+ /**
77
+ * Return the JsonSchema
78
+ */
79
+ get schema(): JsonSchema;
80
+ get nestedGenerics(): Type<any>[][];
81
+ set nestedGenerics(nestedGenerics: Type<any>[][]);
82
+ get type(): Type<any> | any;
83
+ /**
84
+ * Get original type without transformation
85
+ * @param value
86
+ */
87
+ set type(value: Type<any> | any);
88
+ /**
89
+ * Return the itemSchema computed type. if the type is a function used for recursive model, the function will be called to
90
+ * get the right type.
91
+ */
92
+ get computedType(): any;
93
+ get itemSchema(): JsonSchema;
94
+ get parentSchema(): JsonSchema;
95
+ get isDiscriminatorChild(): boolean;
96
+ static from<T extends JsonClassStore = JsonClassStore>(target: Type<any>): T;
97
+ static from<T extends JsonPropertyStore = JsonPropertyStore>(target: Type<any> | any, propertyKey: string | symbol): T;
98
+ static from<T extends JsonParameterStore = JsonParameterStore>(target: Type<any> | any, propertyKey: string | symbol, index: number): T;
99
+ static from<T extends JsonMethodStore = JsonMethodStore>(target: Type<any> | any, propertyKey: string | symbol, descriptor: PropertyDescriptor): T;
100
+ static from<T extends JsonEntityStore = JsonEntityStore>(...args: any[]): T;
101
+ static fromMethod<T extends JsonMethodStore = JsonMethodStore>(target: any, propertyKey: string | symbol): T;
102
+ static get(target: Type<any>, propertyKey: string | symbol, descriptor?: any): JsonEntityStore;
103
+ isGetterOnly(): boolean | undefined;
104
+ get<T = any>(key: string, defaultValue?: any): T;
105
+ set(key: string, value?: any): Store;
106
+ toString(): string;
107
+ protected abstract build(): void;
108
+ protected buildType(type: any): void;
109
+ getBestType(): any;
110
+ }
@@ -0,0 +1,17 @@
1
+ export declare enum JsonFormatTypes {
2
+ DATE_TIME = "date-time",
3
+ DATE = "date",
4
+ TIME = "time",
5
+ EMAIL = "email",
6
+ HOSTNAME = "hostname",
7
+ IPV4 = "ipv4",
8
+ IPV6 = "ipv6",
9
+ URI = "uri",
10
+ URL = "url",
11
+ URI_REF = "uri-reference",
12
+ URI_TEMPLATE = "uri-template",
13
+ JSON_POINTER = "json-pointer",
14
+ RELATIVE_JSON_POINTER = "relative-json-pointer",
15
+ UUID = "uuid",
16
+ REGEX = "regex"
17
+ }
@@ -0,0 +1,9 @@
1
+ import { Type } from "@tsed/core";
2
+ export declare class JsonLazyRef {
3
+ readonly getType: () => Type<any>;
4
+ readonly isLazyRef = true;
5
+ constructor(getType: () => Type<any>);
6
+ get target(): Type<any>;
7
+ get schema(): import("./JsonSchema.js").JsonSchema;
8
+ get name(): string;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions.js";
2
+ export declare class JsonMap<T> extends Map<string, any> {
3
+ [key: string]: any;
4
+ $kind: string;
5
+ readonly $isJsonDocument = true;
6
+ constructor(obj?: Partial<T>);
7
+ assign(obj?: Partial<T> & any): this;
8
+ toJSON(options?: JsonSchemaOptions): any;
9
+ }
@@ -0,0 +1,11 @@
1
+ import { OS3MediaType } from "@tsed/openspec";
2
+ import { JsonMap } from "./JsonMap.js";
3
+ import { JsonSchema } from "./JsonSchema.js";
4
+ export declare class JsonMedia extends JsonMap<OS3MediaType<JsonSchema>> {
5
+ $kind: string;
6
+ groups: string[];
7
+ groupsName: string;
8
+ allowedGroups?: Set<string>;
9
+ schema(schema: JsonSchema): this;
10
+ examples(examples: any): this;
11
+ }
@@ -0,0 +1,92 @@
1
+ import { Type } from "@tsed/core";
2
+ import type { JsonClassStore } from "./JsonClassStore.js";
3
+ import { JsonEntityStore, JsonEntityStoreOptions } from "./JsonEntityStore.js";
4
+ import { JsonOperation } from "./JsonOperation.js";
5
+ import type { JsonParameterStore } from "./JsonParameterStore.js";
6
+ export interface JsonViewOptions {
7
+ path: string;
8
+ options: any;
9
+ }
10
+ export interface JsonRedirectOptions {
11
+ status: number | undefined;
12
+ url: string;
13
+ }
14
+ export declare class JsonMethodStore extends JsonEntityStore {
15
+ readonly parent: JsonClassStore;
16
+ middlewares: any[];
17
+ beforeMiddlewares: any[];
18
+ afterMiddlewares: any[];
19
+ /**
20
+ * Ref to JsonOperation when the decorated object is a method.
21
+ */
22
+ readonly operation: JsonOperation;
23
+ /**
24
+ * List of children JsonEntityStore (properties or methods or params)
25
+ */
26
+ readonly children: Map<string | number, JsonParameterStore>;
27
+ constructor(options: JsonEntityStoreOptions);
28
+ get params(): JsonParameterStore[];
29
+ get view(): JsonViewOptions;
30
+ set view(view: JsonViewOptions);
31
+ get acceptMimes(): string[];
32
+ set acceptMimes(mimes: string[]);
33
+ get parameters(): JsonParameterStore[];
34
+ get operationPaths(): Map<string, import("./JsonOperation.js").JsonMethodPath>;
35
+ /**
36
+ * Get an endpoint.
37
+ * @param target
38
+ * @param propertyKey
39
+ * @param descriptor
40
+ */
41
+ static get(target: Type<any>, propertyKey: string | symbol, descriptor?: PropertyDescriptor): JsonMethodStore;
42
+ getResponseOptions(status: number, { contentType, includes }?: {
43
+ contentType?: string;
44
+ includes?: string[];
45
+ }): undefined | any;
46
+ /**
47
+ * Append middlewares to the beforeMiddlewares list.
48
+ * @param args
49
+ * @returns {EndpointMetadata}
50
+ */
51
+ before(args: Function[]): this;
52
+ /**
53
+ * Append middlewares to the afterMiddlewares list.
54
+ * @param args
55
+ * @returns {EndpointMetadata}
56
+ */
57
+ after(args: Function[]): this;
58
+ /**
59
+ * Store all arguments collected via Annotation.
60
+ * @param args
61
+ */
62
+ use(args: Function[]): this;
63
+ /**
64
+ * Find the value at the controller level. Let this value be extended or overridden by the endpoint itself.
65
+ *
66
+ * @param key
67
+ * @returns {any}
68
+ */
69
+ get<T = any>(key: any): T;
70
+ getParamTypes(): Record<string, boolean>;
71
+ protected build(): void;
72
+ }
73
+ /**
74
+ * EndpointMetadata contains metadata about a controller and his method.
75
+ * Each annotation (@Get, @Body...) attached to a method are stored into endpoint.
76
+ * EndpointMetadata convert this metadata to an array which contain arguments to call an Express method.
77
+ *
78
+ * Example :
79
+ *```typescript
80
+ * @Controller("/my-path")
81
+ * provide MyClass {
82
+ *
83
+ * @Get("/")
84
+ * @Authenticated()
85
+ * public myMethod(){}
86
+ * }
87
+ *```
88
+ *
89
+ * @alias JsonMethodStore
90
+ */
91
+ export type EndpointMetadata = JsonMethodStore;
92
+ export declare const EndpointMetadata: typeof JsonMethodStore;
@@ -0,0 +1,51 @@
1
+ import { OpenSpecSecurity, OpenSpecTag, OS3Operation } from "@tsed/openspec";
2
+ import { JsonHeader } from "../interfaces/JsonOpenSpec.js";
3
+ import { JsonMap } from "./JsonMap.js";
4
+ import { JsonParameter } from "./JsonParameter.js";
5
+ import { JsonResponse } from "./JsonResponse.js";
6
+ import { JsonSchema } from "./JsonSchema.js";
7
+ export interface JsonMethodPath {
8
+ path: string | RegExp;
9
+ method: string;
10
+ [key: string]: any;
11
+ }
12
+ export interface JsonOperationOptions extends OS3Operation<JsonSchema, JsonParameter, JsonMap<JsonResponse>> {
13
+ consumes: string[];
14
+ produces: string[];
15
+ }
16
+ export declare class JsonOperation extends JsonMap<JsonOperationOptions> {
17
+ #private;
18
+ $kind: string;
19
+ readonly operationPaths: Map<string, JsonMethodPath>;
20
+ constructor(obj?: Partial<JsonOperationOptions>);
21
+ get response(): JsonResponse | undefined;
22
+ get status(): number;
23
+ tags(tags: OpenSpecTag[]): this;
24
+ addTags(tags: OpenSpecTag[]): this;
25
+ summary(summary: string): this;
26
+ operationId(operationId: string): this;
27
+ responses(responses: JsonMap<any>): this;
28
+ defaultStatus(status: number): this;
29
+ getStatus(): number;
30
+ setRedirection(status?: number): this;
31
+ isRedirection(status?: number): boolean | 0;
32
+ addResponse(statusCode: string | number, response: JsonResponse): this;
33
+ getResponses(): JsonMap<JsonResponse>;
34
+ getResponseOf(status: number | string): JsonResponse;
35
+ ensureResponseOf(status: number | string): JsonResponse;
36
+ getHeadersOf(status: number): Record<string, JsonHeader & {
37
+ example: string;
38
+ }>;
39
+ getContentTypeOf(status: number): any;
40
+ security(security: OpenSpecSecurity): this;
41
+ addSecurityScopes(name: string, scopes: string[]): this;
42
+ description(description: string): this;
43
+ deprecated(deprecated: boolean): this;
44
+ parameters(parameters: JsonParameter[]): this;
45
+ addParameter(index: number, parameter: JsonParameter): void;
46
+ consumes(consumes: string[]): this;
47
+ produces(produces: string[]): this;
48
+ addProduce(produce: string): void;
49
+ addOperationPath(method: string, path: string | RegExp, options?: any): this;
50
+ getAllowedOperationPath(allowedVerbs?: string[]): JsonMethodPath[];
51
+ }
@@ -0,0 +1,7 @@
1
+ import { JsonMethodPath } from "./JsonOperation.js";
2
+ export declare class JsonOperationPathsMap extends Map<string, JsonMethodPath> {
3
+ $kind: string;
4
+ readonly $isJsonDocument = true;
5
+ setOperationPath(operationPath: JsonMethodPath): void;
6
+ protected getKey: (method: string, path: any) => string;
7
+ }
@@ -0,0 +1,25 @@
1
+ import { Type } from "@tsed/core";
2
+ import { JsonMethodStore } from "./JsonMethodStore.js";
3
+ import { JsonMethodPath, JsonOperation } from "./JsonOperation.js";
4
+ export declare class JsonOperationRoute<Entity extends JsonMethodStore = JsonMethodStore> {
5
+ readonly token: Type<any>;
6
+ readonly endpoint: Entity;
7
+ readonly operationPath?: JsonMethodPath;
8
+ readonly basePath?: string;
9
+ readonly paramsTypes: Record<string, boolean>;
10
+ constructor(options: Partial<JsonOperationRoute>);
11
+ get url(): any;
12
+ get path(): string | RegExp | undefined;
13
+ get fullPath(): any;
14
+ get method(): string;
15
+ get name(): string;
16
+ get className(): string;
17
+ get methodClassName(): string;
18
+ get parameters(): import("./JsonParameterStore.js").JsonParameterStore[];
19
+ get propertyKey(): string;
20
+ get propertyName(): string;
21
+ get store(): import("@tsed/core").Store;
22
+ get operation(): JsonOperation;
23
+ get operationId(): any;
24
+ has(key: string): boolean;
25
+ }
@@ -0,0 +1,22 @@
1
+ import { Type } from "@tsed/core";
2
+ import { OpenSpecHash, OpenSpecRef, OS3Example, OS3Parameter } from "@tsed/openspec";
3
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions.js";
4
+ import { NestedGenerics } from "../utils/generics.js";
5
+ import { JsonMap } from "./JsonMap.js";
6
+ import { JsonSchema } from "./JsonSchema.js";
7
+ export declare class JsonParameter extends JsonMap<OS3Parameter<JsonSchema>> implements NestedGenerics {
8
+ $kind: string;
9
+ nestedGenerics: Type<any>[][];
10
+ groups: string[];
11
+ groupsName: string;
12
+ $schema: JsonSchema;
13
+ expression: string;
14
+ getName(): any;
15
+ name(name: string): this;
16
+ examples(examples: OpenSpecHash<OS3Example | OpenSpecRef>): this;
17
+ description(description: string): this;
18
+ in(inType: string, expression?: string | any): this;
19
+ required(required: boolean): this;
20
+ schema(schema: JsonSchema): this;
21
+ toJSON(options?: JsonSchemaOptions): any;
22
+ }
@@ -0,0 +1,52 @@
1
+ import { Type } from "@tsed/core";
2
+ import { JsonEntityStore, JsonEntityStoreOptions } from "./JsonEntityStore.js";
3
+ import type { JsonMethodStore } from "./JsonMethodStore.js";
4
+ import { JsonParameter } from "./JsonParameter.js";
5
+ import { JsonSchema } from "./JsonSchema.js";
6
+ export interface JsonParameterStoreOptions extends JsonEntityStoreOptions {
7
+ dataPath?: string;
8
+ paramType?: string;
9
+ expression?: string;
10
+ }
11
+ export interface PipeMethods<T = any, R = any> {
12
+ transform(value: T, metadata: JsonParameterStore): R;
13
+ }
14
+ export declare class JsonParameterStore extends JsonEntityStore {
15
+ paramType: string;
16
+ expression: string;
17
+ dataPath: string;
18
+ /**
19
+ * Define pipes can be called by the framework to transform input parameter
20
+ */
21
+ pipes: Type<PipeMethods>[];
22
+ /**
23
+ * Ref to JsonParameter when the decorated object is a parameter.
24
+ */
25
+ readonly parameter: JsonParameter;
26
+ readonly parent: JsonMethodStore;
27
+ constructor(options: JsonParameterStoreOptions);
28
+ get nestedGenerics(): Type<any>[][];
29
+ set nestedGenerics(nestedGenerics: Type<any>[][]);
30
+ /**
31
+ * Return the required state.
32
+ * @returns {boolean}
33
+ */
34
+ get required(): boolean;
35
+ set required(value: boolean);
36
+ get allowedRequiredValues(): any[];
37
+ static getParams<T extends JsonParameterStore = JsonParameterStore>(target: Type<any>, propertyKey: string | symbol): T[];
38
+ static get(target: Type<any>, propertyKey: string | symbol, index: number): JsonParameterStore;
39
+ /**
40
+ * Check precondition between value, required and allowedRequiredValues to know if the entity is required.
41
+ * @param value
42
+ * @returns {boolean}
43
+ */
44
+ isRequired(value: any): boolean;
45
+ protected getSchema(type: any): JsonSchema;
46
+ protected build(): void;
47
+ }
48
+ /**
49
+ * @alias JsonParameterStore
50
+ */
51
+ export type ParamMetadata = JsonParameterStore;
52
+ export declare const ParamMetadata: typeof JsonParameterStore;
@@ -0,0 +1,16 @@
1
+ export declare enum JsonParameterTypes {
2
+ BODY = "body",
3
+ PATH = "path",
4
+ QUERY = "query",
5
+ HEADER = "header",
6
+ COOKIES = "cookie",
7
+ FILES = "files"
8
+ }
9
+ /**
10
+ * @ignore
11
+ */
12
+ export declare function formatParameterType(type: any): any;
13
+ /**
14
+ * @ignore
15
+ */
16
+ export declare function isParameterType(type: string): boolean;
@@ -0,0 +1,32 @@
1
+ import { Type } from "@tsed/core";
2
+ import { JsonEntityStore } from "./JsonEntityStore.js";
3
+ import type { JsonClassStore } from "./JsonClassStore.js";
4
+ export declare class JsonPropertyStore extends JsonEntityStore {
5
+ readonly parent: JsonClassStore;
6
+ /**
7
+ * Return the required state.
8
+ * @returns {boolean}
9
+ */
10
+ get required(): boolean;
11
+ /**
12
+ * Change the state of the required data.
13
+ * @param value
14
+ */
15
+ set required(value: boolean);
16
+ get allowedRequiredValues(): any[];
17
+ discriminatorKey(): this;
18
+ isDiscriminatorKey(): boolean;
19
+ /**
20
+ * Check precondition between value, required and allowedRequiredValues to know if the entity is required.
21
+ * @param value
22
+ * @returns {boolean}
23
+ */
24
+ isRequired(value: any): boolean;
25
+ protected build(): void;
26
+ static get(target: Type<any>, propertyKey: string | symbol): JsonPropertyStore;
27
+ }
28
+ /**
29
+ * @alias JsonPropertyStore
30
+ */
31
+ export type PropertyMetadata = JsonPropertyStore;
32
+ export declare const PropertyMetadata: typeof JsonPropertyStore;
@@ -0,0 +1,12 @@
1
+ import { OpenSpecHash, OS3MediaType, OS3RequestBody } from "@tsed/openspec";
2
+ import { JsonMap } from "./JsonMap.js";
3
+ import { JsonSchema } from "./JsonSchema.js";
4
+ export type JsonRequestBodyOptions = OS3RequestBody<JsonSchema>;
5
+ export declare class JsonRequestBody extends JsonMap<JsonRequestBodyOptions> {
6
+ $kind: string;
7
+ constructor(obj?: Partial<JsonRequestBodyOptions>);
8
+ description(description: string): this;
9
+ content(content: OpenSpecHash<OS3MediaType<JsonSchema>>): this;
10
+ addContent(mediaType: string, schema: JsonSchema, examples?: any): this;
11
+ required(required: boolean): this;
12
+ }
@@ -0,0 +1,18 @@
1
+ import { OS3MediaType, OS3Response } from "@tsed/openspec";
2
+ import { JsonHeader } from "../interfaces/JsonOpenSpec.js";
3
+ import { JsonMap } from "./JsonMap.js";
4
+ import { JsonMedia } from "./JsonMedia.js";
5
+ import { JsonSchema } from "./JsonSchema.js";
6
+ export type JsonResponseOptions = OS3Response<JsonSchema, string | JsonHeader>;
7
+ export declare class JsonResponse extends JsonMap<JsonResponseOptions> {
8
+ $kind: string;
9
+ status: number;
10
+ constructor(obj?: Partial<JsonResponseOptions>);
11
+ description(description: string): this;
12
+ headers(headers: Record<string, string | JsonHeader>): this;
13
+ content(content: Record<string, OS3MediaType<JsonSchema>>): this;
14
+ getContent(): JsonMap<JsonMedia>;
15
+ getMedia(mediaType: string, create?: boolean): JsonMedia;
16
+ addMedia(mediaType: string): this;
17
+ isBinary(): boolean;
18
+ }