@vnodes/autowire 0.0.3
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/README.md +35 -0
- package/assets/favicon.png +0 -0
- package/dist/auto-controller-options.d.ts +9 -0
- package/dist/auto-controller-options.d.ts.map +1 -0
- package/dist/auto-controller-options.js +1 -0
- package/dist/auto-controller.d.ts +3 -0
- package/dist/auto-controller.d.ts.map +1 -0
- package/dist/auto-controller.js +37 -0
- package/dist/auto-delete.d.ts +9 -0
- package/dist/auto-delete.d.ts.map +1 -0
- package/dist/auto-delete.js +41 -0
- package/dist/auto-get.d.ts +11 -0
- package/dist/auto-get.d.ts.map +1 -0
- package/dist/auto-get.js +54 -0
- package/dist/auto-post.d.ts +7 -0
- package/dist/auto-post.d.ts.map +1 -0
- package/dist/auto-post.js +28 -0
- package/dist/auto-put.d.ts +9 -0
- package/dist/auto-put.d.ts.map +1 -0
- package/dist/auto-put.js +38 -0
- package/dist/helpers.d.ts +5 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +41 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://vnodes.github.io/vnodes/libs/autowire/assets/favicon.png" alt="Logo" width="200" height="200" style="border-radius: 100%"/>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
## @vnodes/autowire
|
|
12
|
+
|
|
13
|
+
Decorators that autowire resource controller and methods
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @vnodes/autowire
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 💖 Support My Work
|
|
22
|
+
|
|
23
|
+
If you find my open-source contributions or the **@vnodes/autowire** project helpful, consider supporting my work. Your sponsorship helps me maintain these projects and explore new enterprise patterns.
|
|
24
|
+
|
|
25
|
+
[](https://cash.app/$puqlib)
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🤝 Connect with Me
|
|
30
|
+
|
|
31
|
+
<p align="left">
|
|
32
|
+
<a href="mailto:robert.brightline+vnodes-autowire@gmail.com">
|
|
33
|
+
<img src="https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white" />
|
|
34
|
+
</a>
|
|
35
|
+
</p>
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-controller-options.d.ts","sourceRoot":"","sources":["../src/auto-controller-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,MAAM,qBAAqB,GAAG;IAChC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,IAAI,CAAC;IACf,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-controller.d.ts","sourceRoot":"","sources":["../src/auto-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAOrE,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CA4B7E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Controller } from '@nestjs/common';
|
|
2
|
+
import { names, pluralize } from '@vnodes/names';
|
|
3
|
+
import { AutoDelete } from './auto-delete.js';
|
|
4
|
+
import { AutoGet } from './auto-get.js';
|
|
5
|
+
import { AutoPost } from './auto-post.js';
|
|
6
|
+
import { AutoPut } from './auto-put.js';
|
|
7
|
+
import { getAllMethodNames, getInheritedPropertyDescriptor } from './helpers.js';
|
|
8
|
+
export function AutoController(options) {
|
|
9
|
+
return (target) => {
|
|
10
|
+
const className = target.name;
|
|
11
|
+
const { kebabCase } = names(className.replace('Controller', ''));
|
|
12
|
+
const pluralPath = pluralize(kebabCase);
|
|
13
|
+
Controller(pluralPath)(target);
|
|
14
|
+
const methodNames = getAllMethodNames(target).filter((e) => e !== 'constructor');
|
|
15
|
+
for (const methodName of methodNames) {
|
|
16
|
+
const descriptor = getInheritedPropertyDescriptor(target, methodName);
|
|
17
|
+
if (!descriptor)
|
|
18
|
+
throw new Error(`Descriptor not found for ${target.name}.${methodName}`);
|
|
19
|
+
const args = [target.prototype, methodName, descriptor];
|
|
20
|
+
if (methodName.startsWith('find')) {
|
|
21
|
+
AutoGet(options)(...args);
|
|
22
|
+
}
|
|
23
|
+
else if (methodName.startsWith('create')) {
|
|
24
|
+
AutoPost(options)(...args);
|
|
25
|
+
}
|
|
26
|
+
else if (methodName.startsWith('update')) {
|
|
27
|
+
AutoPut(options)(...args);
|
|
28
|
+
}
|
|
29
|
+
else if (methodName.startsWith('delete')) {
|
|
30
|
+
AutoDelete(options)(...args);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw new Error('Method is not supported');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AutoControllerOptions } from './auto-controller-options.js';
|
|
2
|
+
export declare enum DeleteMethodName {
|
|
3
|
+
deleteOneById = "deleteOneById",
|
|
4
|
+
deleteOneByUuid = "deleteOneByUuid"
|
|
5
|
+
}
|
|
6
|
+
export declare function __DeleteOneByIdMethod(): MethodDecorator;
|
|
7
|
+
export declare function __DeleteOneByUuid(): MethodDecorator;
|
|
8
|
+
export declare function AutoDelete(options: AutoControllerOptions): MethodDecorator;
|
|
9
|
+
//# sourceMappingURL=auto-delete.d.ts.map
|
|
@@ -0,0 +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,CAwB1E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Delete, Param } from '@nestjs/common';
|
|
2
|
+
import { ApiOkResponse } from '@nestjs/swagger';
|
|
3
|
+
export var DeleteMethodName;
|
|
4
|
+
(function (DeleteMethodName) {
|
|
5
|
+
DeleteMethodName["deleteOneById"] = "deleteOneById";
|
|
6
|
+
DeleteMethodName["deleteOneByUuid"] = "deleteOneByUuid";
|
|
7
|
+
})(DeleteMethodName || (DeleteMethodName = {}));
|
|
8
|
+
export function __DeleteOneByIdMethod() {
|
|
9
|
+
return (...args) => {
|
|
10
|
+
Delete(':id')(...args);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function __DeleteOneByUuid() {
|
|
14
|
+
return (...args) => {
|
|
15
|
+
Delete(':uuid')(...args);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function AutoDelete(options) {
|
|
19
|
+
return (...args) => {
|
|
20
|
+
const methodName = args[1].toString();
|
|
21
|
+
switch (methodName.toString()) {
|
|
22
|
+
case DeleteMethodName.deleteOneById: {
|
|
23
|
+
__DeleteOneByIdMethod()(...args);
|
|
24
|
+
ApiOkResponse({ type: options.readDto })(...args);
|
|
25
|
+
Param('id')(args[0], args[1], 0);
|
|
26
|
+
Reflect.defineMetadata('design:paramtypes', [Number], args[0], args[1]);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
case DeleteMethodName.deleteOneByUuid: {
|
|
30
|
+
__DeleteOneByUuid()(...args);
|
|
31
|
+
ApiOkResponse({ type: options.readDto })(...args);
|
|
32
|
+
Param('uuid')(args[0], args[1], 0);
|
|
33
|
+
Reflect.defineMetadata('design:paramtypes', [String], args[0], args[1]);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
default: {
|
|
37
|
+
throw new Error(`${methodName.toString()} is not supported`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AutoControllerOptions } from './auto-controller-options.js';
|
|
2
|
+
export declare enum FindMethodName {
|
|
3
|
+
findMany = "findMany",
|
|
4
|
+
findOneById = "findOneById",
|
|
5
|
+
findOneByUuid = "findOneByUuid"
|
|
6
|
+
}
|
|
7
|
+
export declare function __FindMethod(): MethodDecorator;
|
|
8
|
+
export declare function __FindOneByIdMethod(): MethodDecorator;
|
|
9
|
+
export declare function __FindOneByUuid(): MethodDecorator;
|
|
10
|
+
export declare function AutoGet(options: AutoControllerOptions): MethodDecorator;
|
|
11
|
+
//# sourceMappingURL=auto-get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-get.d.ts","sourceRoot":"","sources":["../src/auto-get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,oBAAY,cAAc;IACtB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;CAClC;AAED,wBAAgB,YAAY,IAAI,eAAe,CAI9C;AACD,wBAAgB,mBAAmB,IAAI,eAAe,CAIrD;AAED,wBAAgB,eAAe,IAAI,eAAe,CAIjD;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CA8BvE"}
|
package/dist/auto-get.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Get, Param, Query } from '@nestjs/common';
|
|
2
|
+
import { ApiOkResponse } from '@nestjs/swagger';
|
|
3
|
+
export var FindMethodName;
|
|
4
|
+
(function (FindMethodName) {
|
|
5
|
+
FindMethodName["findMany"] = "findMany";
|
|
6
|
+
FindMethodName["findOneById"] = "findOneById";
|
|
7
|
+
FindMethodName["findOneByUuid"] = "findOneByUuid";
|
|
8
|
+
})(FindMethodName || (FindMethodName = {}));
|
|
9
|
+
export function __FindMethod() {
|
|
10
|
+
return (...args) => {
|
|
11
|
+
Get()(...args);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function __FindOneByIdMethod() {
|
|
15
|
+
return (...args) => {
|
|
16
|
+
Get(':id')(...args);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function __FindOneByUuid() {
|
|
20
|
+
return (...args) => {
|
|
21
|
+
Get(':uuid')(...args);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function AutoGet(options) {
|
|
25
|
+
return (...args) => {
|
|
26
|
+
const methodName = args[1].toString();
|
|
27
|
+
switch (methodName.toString()) {
|
|
28
|
+
case FindMethodName.findMany: {
|
|
29
|
+
__FindMethod()(...args);
|
|
30
|
+
ApiOkResponse({ type: [options.readDto] })(...args);
|
|
31
|
+
Query()(args[0], args[1], 0);
|
|
32
|
+
Reflect.defineMetadata('design:paramtypes', [options.queryDto], args[0], args[1]);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case FindMethodName.findOneById: {
|
|
36
|
+
__FindOneByIdMethod()(...args);
|
|
37
|
+
ApiOkResponse({ type: options.readDto })(...args);
|
|
38
|
+
Param('id')(args[0], args[1], 0);
|
|
39
|
+
Reflect.defineMetadata('design:paramtypes', [Number], args[0], args[1]);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case FindMethodName.findOneByUuid: {
|
|
43
|
+
__FindOneByUuid()(...args);
|
|
44
|
+
ApiOkResponse({ type: options.readDto })(...args);
|
|
45
|
+
Param('uuid')(args[0], args[1], 0);
|
|
46
|
+
Reflect.defineMetadata('design:paramtypes', [String], args[0], args[1]);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
default: {
|
|
50
|
+
throw new Error(`${methodName.toString()} is not supported`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AutoControllerOptions } from './auto-controller-options.js';
|
|
2
|
+
export declare enum CreateMethodName {
|
|
3
|
+
createOne = "createOne"
|
|
4
|
+
}
|
|
5
|
+
export declare function __CreateOneMethod(): MethodDecorator;
|
|
6
|
+
export declare function AutoPost(options: AutoControllerOptions): MethodDecorator;
|
|
7
|
+
//# sourceMappingURL=auto-post.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-post.d.ts","sourceRoot":"","sources":["../src/auto-post.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,oBAAY,gBAAgB;IACxB,SAAS,cAAc;CAC1B;AAED,wBAAgB,iBAAiB,IAAI,eAAe,CAInD;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAgBxE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Body, Post } from '@nestjs/common';
|
|
2
|
+
import { ApiCreatedResponse } from '@nestjs/swagger';
|
|
3
|
+
export var CreateMethodName;
|
|
4
|
+
(function (CreateMethodName) {
|
|
5
|
+
CreateMethodName["createOne"] = "createOne";
|
|
6
|
+
})(CreateMethodName || (CreateMethodName = {}));
|
|
7
|
+
export function __CreateOneMethod() {
|
|
8
|
+
return (...args) => {
|
|
9
|
+
Post()(...args);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function AutoPost(options) {
|
|
13
|
+
return (...args) => {
|
|
14
|
+
const methodName = args[1].toString();
|
|
15
|
+
switch (methodName.toString()) {
|
|
16
|
+
case CreateMethodName.createOne: {
|
|
17
|
+
__CreateOneMethod()(...args);
|
|
18
|
+
ApiCreatedResponse({ type: options.readDto })(...args);
|
|
19
|
+
Body()(args[0], args[1], 0);
|
|
20
|
+
Reflect.defineMetadata('design:paramtypes', [options.createDto], args[0], args[1]);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
default: {
|
|
24
|
+
throw new Error(`${methodName.toString()} is not supported`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AutoControllerOptions } from './auto-controller-options.js';
|
|
2
|
+
export declare enum UpdateMethodName {
|
|
3
|
+
updateOneById = "updateOneById",
|
|
4
|
+
updateOneByUuid = "updateOneByUuid"
|
|
5
|
+
}
|
|
6
|
+
export declare function __UpdateOneByIdMethod(): MethodDecorator;
|
|
7
|
+
export declare function __UpdateOneByUuid(): MethodDecorator;
|
|
8
|
+
export declare function AutoPut(options: AutoControllerOptions): MethodDecorator;
|
|
9
|
+
//# sourceMappingURL=auto-put.d.ts.map
|
|
@@ -0,0 +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,CAsBvE"}
|
package/dist/auto-put.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Body, Put } from '@nestjs/common';
|
|
2
|
+
export var UpdateMethodName;
|
|
3
|
+
(function (UpdateMethodName) {
|
|
4
|
+
UpdateMethodName["updateOneById"] = "updateOneById";
|
|
5
|
+
UpdateMethodName["updateOneByUuid"] = "updateOneByUuid";
|
|
6
|
+
})(UpdateMethodName || (UpdateMethodName = {}));
|
|
7
|
+
export function __UpdateOneByIdMethod() {
|
|
8
|
+
return (...args) => {
|
|
9
|
+
Put(':id')(...args);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function __UpdateOneByUuid() {
|
|
13
|
+
return (...args) => {
|
|
14
|
+
Put(':uuid')(...args);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function AutoPut(options) {
|
|
18
|
+
return (...args) => {
|
|
19
|
+
const methodName = args[1].toString();
|
|
20
|
+
switch (methodName.toString()) {
|
|
21
|
+
case UpdateMethodName.updateOneById: {
|
|
22
|
+
__UpdateOneByIdMethod()(...args);
|
|
23
|
+
Body()(args[0], args[1], 1);
|
|
24
|
+
Reflect.defineMetadata('design:paramtypes', [Number, options.updateDto], args[0], args[1]);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case UpdateMethodName.updateOneByUuid: {
|
|
28
|
+
__UpdateOneByUuid()(...args);
|
|
29
|
+
Body()(args[0], args[1], 1);
|
|
30
|
+
Reflect.defineMetadata('design:paramtypes', [String, options.updateDto], args[0], args[1]);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
default: {
|
|
34
|
+
throw new Error(`${methodName.toString()} is not supported`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: Method decorato params */
|
|
2
|
+
export declare function methodParamNames(params: any[]): string[];
|
|
3
|
+
export declare function getAllMethodNames(target: any): string[];
|
|
4
|
+
export declare function getInheritedPropertyDescriptor(target: any, methodName: string): PropertyDescriptor | undefined;
|
|
5
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,YAY7C;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,EAAE,CAiBvD;AACD,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAiB9G"}
|
package/dist/helpers.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: Method decorato params */
|
|
2
|
+
export function methodParamNames(params) {
|
|
3
|
+
const [target, methodName] = params;
|
|
4
|
+
const functionDeclerations = target?.[methodName]?.toString();
|
|
5
|
+
if (!functionDeclerations) {
|
|
6
|
+
throw new Error('Could not get the function decleration string');
|
|
7
|
+
}
|
|
8
|
+
return functionDeclerations
|
|
9
|
+
.slice(functionDeclerations.indexOf('(') + 1, functionDeclerations.indexOf(')'))
|
|
10
|
+
.split(',');
|
|
11
|
+
}
|
|
12
|
+
export function getAllMethodNames(target) {
|
|
13
|
+
const methods = new Set();
|
|
14
|
+
let currentProto = target?.prototype;
|
|
15
|
+
// Stop when we hit the base Object prototype
|
|
16
|
+
while (currentProto && currentProto !== Object.prototype) {
|
|
17
|
+
Object.getOwnPropertyNames(currentProto).forEach((name) => {
|
|
18
|
+
// Filter for functions and exclude the constructor
|
|
19
|
+
if (name !== 'constructor' && typeof currentProto[name] === 'function') {
|
|
20
|
+
methods.add(name);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
// Move up to the parent class
|
|
24
|
+
currentProto = Object.getPrototypeOf(currentProto);
|
|
25
|
+
}
|
|
26
|
+
return Array.from(methods);
|
|
27
|
+
}
|
|
28
|
+
export function getInheritedPropertyDescriptor(target, methodName) {
|
|
29
|
+
// 1. Get the initial prototype if target is a constructor,
|
|
30
|
+
// or use target directly if we are already traversing the chain.
|
|
31
|
+
let current = typeof target === 'function' ? target.prototype : target;
|
|
32
|
+
while (current && current !== Object.prototype) {
|
|
33
|
+
const descriptor = Object.getOwnPropertyDescriptor(current, methodName);
|
|
34
|
+
if (descriptor) {
|
|
35
|
+
return descriptor;
|
|
36
|
+
}
|
|
37
|
+
// Move up to the next link in the prototype chain
|
|
38
|
+
current = Object.getPrototypeOf(current);
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @index(['./**/*.ts', '!./**/*.spec.ts', '!./**/{main,serve,index}.ts', '!./**/prisma', '!./**/generated'], f => `export * from '${f.path}.js'`)
|
|
2
|
+
export * from './auto-controller.js';
|
|
3
|
+
export * from './auto-delete.js';
|
|
4
|
+
export * from './auto-get.js';
|
|
5
|
+
export * from './auto-post.js';
|
|
6
|
+
export * from './auto-put.js';
|
|
7
|
+
export * from './helpers.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vnodes/autowire",
|
|
3
|
+
"description": "Decorators that autowire resource controller and methods",
|
|
4
|
+
"homepage": "https://vnodes.github.io/vnodes/libs/autowire",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public",
|
|
7
|
+
"tag": "latest"
|
|
8
|
+
},
|
|
9
|
+
"author": {
|
|
10
|
+
"email": "robert.brightline+vnodes-autowire@gmail.com",
|
|
11
|
+
"name": "Robert Brightline",
|
|
12
|
+
"url": "https://vnodes.github.io/vnodes/libs/autowire"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"icon": "https://vnodes.github.io/vnodes/libs/autowire/assets/favicon.png",
|
|
16
|
+
"funding": [
|
|
17
|
+
{
|
|
18
|
+
"type": "cashapp",
|
|
19
|
+
"url": "https://cash.app/$puqlib"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"version": "0.0.3",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
".": {
|
|
30
|
+
"@vnodes/source": "./src/index.ts",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"assets",
|
|
38
|
+
"dist",
|
|
39
|
+
"!**/*.tsbuildinfo"
|
|
40
|
+
],
|
|
41
|
+
"nx": {
|
|
42
|
+
"sourceRoot": "libs/autowire/src",
|
|
43
|
+
"targets": {
|
|
44
|
+
"build": {},
|
|
45
|
+
"lint": {},
|
|
46
|
+
"test": {},
|
|
47
|
+
"doc": {}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@swc/helpers": "~0.5.11"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@nestjs/testing": "^11.1.13"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@nestjs/common": "^11.1.14",
|
|
58
|
+
"@nestjs/core": "^11.1.14",
|
|
59
|
+
"@nestjs/swagger": "^11.2.6",
|
|
60
|
+
"@vnodes/names": "0.0.3",
|
|
61
|
+
"@vnodes/metadata": "0.0.3"
|
|
62
|
+
}
|
|
63
|
+
}
|