@vnodes/autowire 0.0.5 → 0.0.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-controller.d.ts","sourceRoot":"","sources":["../src/auto-controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auto-controller.d.ts","sourceRoot":"","sources":["../src/auto-controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAOrE,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CA4B7E"}
|
package/dist/auto-controller.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Controller } from '@nestjs/common';
|
|
2
|
+
import { ResourceName } from '@vnodes/metadata';
|
|
2
3
|
import { names, pluralize } from '@vnodes/names';
|
|
3
4
|
import { AutoDelete } from './auto-delete.js';
|
|
4
5
|
import { AutoGet } from './auto-get.js';
|
|
@@ -8,9 +9,10 @@ import { getAllMethodNames, getInheritedPropertyDescriptor } from './helpers.js'
|
|
|
8
9
|
export function AutoController(options) {
|
|
9
10
|
return (target) => {
|
|
10
11
|
const className = target.name;
|
|
11
|
-
const { kebabCase } = names(className.replace('Controller', ''));
|
|
12
|
+
const { pascalCase, kebabCase } = names(className.replace('Controller', ''));
|
|
12
13
|
const pluralPath = pluralize(kebabCase);
|
|
13
14
|
Controller(pluralPath)(target);
|
|
15
|
+
ResourceName(pascalCase)(target);
|
|
14
16
|
const methodNames = getAllMethodNames(target).filter((e) => e !== 'constructor');
|
|
15
17
|
for (const methodName of methodNames) {
|
|
16
18
|
const descriptor = getInheritedPropertyDescriptor(target, methodName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-delete.d.ts","sourceRoot":"","sources":["../src/auto-delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,oBAAY,gBAAgB;IACxB,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;CACtC;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAIvD;AAED,wBAAgB,iBAAiB,IAAI,eAAe,CAInD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"auto-delete.d.ts","sourceRoot":"","sources":["../src/auto-delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,oBAAY,gBAAgB;IACxB,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;CACtC;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAIvD;AAED,wBAAgB,iBAAiB,IAAI,eAAe,CAInD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAyB1E"}
|
package/dist/auto-delete.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Delete, Param } from '@nestjs/common';
|
|
1
|
+
import { Delete, Param, ParseIntPipe } from '@nestjs/common';
|
|
2
2
|
import { ApiOkResponse } from '@nestjs/swagger';
|
|
3
3
|
export var DeleteMethodName;
|
|
4
4
|
(function (DeleteMethodName) {
|
|
@@ -22,7 +22,7 @@ export function AutoDelete(options) {
|
|
|
22
22
|
case DeleteMethodName.deleteOneById: {
|
|
23
23
|
__DeleteOneByIdMethod()(...args);
|
|
24
24
|
ApiOkResponse({ type: options.readDto })(...args);
|
|
25
|
-
Param('id')(args[0], args[1], 0);
|
|
25
|
+
Param('id', ParseIntPipe)(args[0], args[1], 0);
|
|
26
26
|
Reflect.defineMetadata('design:paramtypes', [Number], args[0], args[1]);
|
|
27
27
|
break;
|
|
28
28
|
}
|
package/dist/auto-get.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Get, Param, Query } from '@nestjs/common';
|
|
1
|
+
import { Get, Param, ParseIntPipe, Query } from '@nestjs/common';
|
|
2
2
|
import { ApiOkResponse } from '@nestjs/swagger';
|
|
3
3
|
export var FindMethodName;
|
|
4
4
|
(function (FindMethodName) {
|
|
@@ -35,7 +35,7 @@ export function AutoGet(options) {
|
|
|
35
35
|
case FindMethodName.findOneById: {
|
|
36
36
|
__FindOneByIdMethod()(...args);
|
|
37
37
|
ApiOkResponse({ type: options.readDto })(...args);
|
|
38
|
-
Param('id')(args[0], args[1], 0);
|
|
38
|
+
Param('id', ParseIntPipe)(args[0], args[1], 0);
|
|
39
39
|
Reflect.defineMetadata('design:paramtypes', [Number], args[0], args[1]);
|
|
40
40
|
break;
|
|
41
41
|
}
|
package/dist/auto-put.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-put.d.ts","sourceRoot":"","sources":["../src/auto-put.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,oBAAY,gBAAgB;IACxB,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;CACtC;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAIvD;AAED,wBAAgB,iBAAiB,IAAI,eAAe,CAInD;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"auto-put.d.ts","sourceRoot":"","sources":["../src/auto-put.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,oBAAY,gBAAgB;IACxB,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;CACtC;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAIvD;AAED,wBAAgB,iBAAiB,IAAI,eAAe,CAInD;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAwBvE"}
|
package/dist/auto-put.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Body, Put } from '@nestjs/common';
|
|
1
|
+
import { Body, Param, ParseIntPipe, Put } from '@nestjs/common';
|
|
2
2
|
export var UpdateMethodName;
|
|
3
3
|
(function (UpdateMethodName) {
|
|
4
4
|
UpdateMethodName["updateOneById"] = "updateOneById";
|
|
@@ -20,12 +20,14 @@ export function AutoPut(options) {
|
|
|
20
20
|
switch (methodName.toString()) {
|
|
21
21
|
case UpdateMethodName.updateOneById: {
|
|
22
22
|
__UpdateOneByIdMethod()(...args);
|
|
23
|
+
Param('id', ParseIntPipe)(args[0], args[1], 0);
|
|
23
24
|
Body()(args[0], args[1], 1);
|
|
24
25
|
Reflect.defineMetadata('design:paramtypes', [Number, options.updateDto], args[0], args[1]);
|
|
25
26
|
break;
|
|
26
27
|
}
|
|
27
28
|
case UpdateMethodName.updateOneByUuid: {
|
|
28
29
|
__UpdateOneByUuid()(...args);
|
|
30
|
+
Param('uuid')(args[0], args[1], 0);
|
|
29
31
|
Body()(args[0], args[1], 1);
|
|
30
32
|
Reflect.defineMetadata('design:paramtypes', [String, options.updateDto], args[0], args[1]);
|
|
31
33
|
break;
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "https://cash.app/$puqlib"
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
|
-
"version": "0.0.
|
|
22
|
+
"version": "0.0.8",
|
|
23
23
|
"type": "module",
|
|
24
24
|
"main": "./dist/index.js",
|
|
25
25
|
"module": "./dist/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@nestjs/common": "^11.1.14",
|
|
58
58
|
"@nestjs/core": "^11.1.14",
|
|
59
59
|
"@nestjs/swagger": "^11.2.6",
|
|
60
|
-
"@vnodes/
|
|
61
|
-
"@vnodes/
|
|
60
|
+
"@vnodes/names": "0.0.8",
|
|
61
|
+
"@vnodes/metadata": "0.0.8"
|
|
62
62
|
}
|
|
63
63
|
}
|