raiton 5.5.0-beta.3 → 5.6.0-beta.4

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.
@@ -4817,7 +4817,7 @@ var {
4817
4817
  Help
4818
4818
  } = import__.default;
4819
4819
  // package.json
4820
- var version = "5.5.0-beta.3";
4820
+ var version = "5.6.0-beta.4";
4821
4821
 
4822
4822
  // source/bin/cli.ts
4823
4823
  var CLI = new Command;
@@ -6257,6 +6257,7 @@ var METADATA_KEYS = {
6257
6257
  API_RESPONSES: Symbol("api:responses"),
6258
6258
  API_REQUEST_BODY: Symbol("api:requestBody"),
6259
6259
  API_PARAMETERS: Symbol("api:parameters"),
6260
+ API_ENUMS: Symbol("api:enums"),
6260
6261
  API_TAGS: Symbol("api:tags"),
6261
6262
  API_OPERATION: Symbol("api:operation"),
6262
6263
  API_SECURITY: Symbol("api:security")
@@ -6695,7 +6696,7 @@ class Injection {
6695
6696
  const name = metadata?.name || ("constructor" in construct ? construct.constructor.name || false : false) || construct.name;
6696
6697
  if (!metadata) {
6697
6698
  if (typeof name === "undefined")
6698
- Logger.debug("Cannot resolve", construct);
6699
+ Logger.debug("Cannot resolve", name, ":", construct);
6699
6700
  throw new Throwable(`Cannot resolve ${name} as dependency`);
6700
6701
  }
6701
6702
  return this.get(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raiton",
3
- "version": "5.5.0-beta.3",
3
+ "version": "5.6.0-beta.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Modular TypeScript Backend Framework with Dependency Injection, Plugins, Controllers, Middleware and Hot Reloading.",
@@ -214,7 +214,7 @@ export class Injection {
214
214
  const name = metadata?.name || ('constructor' in construct ? construct.constructor.name || false : false) || construct.name;
215
215
 
216
216
  if (!metadata) {
217
- if (typeof name === 'undefined') Logger.debug('Cannot resolve', construct);
217
+ if (typeof name === 'undefined') Logger.debug('Cannot resolve', name, ':', construct);
218
218
  throw new Throwable(`Cannot resolve ${name} as dependency`);
219
219
  }
220
220
 
@@ -11,6 +11,7 @@ export const METADATA_KEYS = {
11
11
  API_RESPONSES: Symbol('api:responses'),
12
12
  API_REQUEST_BODY: Symbol('api:requestBody'),
13
13
  API_PARAMETERS: Symbol('api:parameters'),
14
+ API_ENUMS: Symbol('api:enums'),
14
15
  API_TAGS: Symbol('api:tags'),
15
16
  API_OPERATION: Symbol('api:operation'),
16
17
  API_SECURITY: Symbol('api:security'),
@@ -34,7 +34,7 @@ export function ApiTags(...tags: (string | ApiTagOptions)[]) {
34
34
 
35
35
  // Convert string tags to objects
36
36
  const processedTags = tags.map(tag =>
37
- typeof tag === 'string' ? { name: tag } : tag
37
+ typeof tag === 'string' ? {name: tag} : tag
38
38
  );
39
39
 
40
40
  if (propertyKey) {
@@ -173,6 +173,11 @@ export function ApiParam(name: string, options: {
173
173
  * @deprecated
174
174
  */
175
175
  deprecated?: boolean;
176
+
177
+ /**
178
+ * enums values (optional)
179
+ */
180
+ enum?: any[]
176
181
  }) {
177
182
  return function (target: any, propertyKey: string | symbol) {
178
183
  const params = Reflect.getMetadata(METADATA_KEYS.API_PARAMETERS, target) || {};
@@ -180,9 +185,20 @@ export function ApiParam(name: string, options: {
180
185
  params[propertyKey] = [];
181
186
  }
182
187
  params[propertyKey].push({name, ...options});
188
+
189
+ if (options.enum) {
190
+ Reflect.defineMetadata(
191
+ METADATA_KEYS.API_ENUMS,
192
+ {
193
+ [propertyKey]: options.enum
194
+ },
195
+ target
196
+ );
197
+ }
183
198
  Reflect.defineMetadata(METADATA_KEYS.API_PARAMETERS, params, target, propertyKey);
184
199
  };
185
200
  }
201
+
186
202
  /**
187
203
  * Decorator to add query parameter metadata (shortcut for ApiParam with in: 'query')
188
204
  * @param name Parameter name
@@ -214,6 +230,11 @@ export function ApiQuery(name: string, options: {
214
230
  * @deprecated
215
231
  */
216
232
  deprecated?: boolean;
233
+
234
+ /**
235
+ * enums values (optional)
236
+ */
237
+ enum?: any[]
217
238
  }) {
218
239
  return ApiParam(name, {...options, in: 'query'});
219
240
  }