ts-deco 1.0.36 → 1.0.38
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 +6 -3
- package/dist/src/decorators/controllers/index.d.ts +1 -1
- package/dist/src/decorators/controllers/index.d.ts.map +1 -1
- package/dist/src/decorators/controllers/index.js +2 -1
- package/dist/src/decorators/controllers/index.js.map +1 -1
- package/dist/src/decorators/controllers/lib/resource.decorator.d.ts +11 -3
- package/dist/src/decorators/controllers/lib/resource.decorator.d.ts.map +1 -1
- package/dist/src/decorators/controllers/lib/resource.decorator.js +42 -28
- package/dist/src/decorators/controllers/lib/resource.decorator.js.map +1 -1
- package/dist/src/decorators/controllers/utils/parse-resource-args.d.ts +1 -1
- package/dist/src/decorators/controllers/utils/parse-resource-args.d.ts.map +1 -1
- package/dist/src/decorators/controllers/utils/parse-resource-args.js +10 -6
- package/dist/src/decorators/controllers/utils/parse-resource-args.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,12 +42,12 @@ class CreateUserDto {
|
|
|
42
42
|
|
|
43
43
|
### Controller Swagger 문서화
|
|
44
44
|
|
|
45
|
-
`Resource
|
|
45
|
+
`Resource`, `ResourceMgmt`, `Endpoint`로 Controller 문서화를 한 번에 처리할 수 있습니다:
|
|
46
46
|
|
|
47
47
|
```typescript
|
|
48
|
-
import { Resource, Endpoint } from "ts-deco";
|
|
48
|
+
import { Resource, ResourceMgmt, Endpoint } from "ts-deco";
|
|
49
49
|
|
|
50
|
-
@Resource("Users", "/api/users")
|
|
50
|
+
@Resource({ tag: "Users", path: "/api/users" })
|
|
51
51
|
export class UserController {
|
|
52
52
|
@Endpoint({
|
|
53
53
|
method: "POST",
|
|
@@ -62,6 +62,9 @@ export class UserController {
|
|
|
62
62
|
@Post()
|
|
63
63
|
create(@Body() dto: CreateUserDto) {}
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
@ResourceMgmt("Users")
|
|
67
|
+
export class AdminUserController {}
|
|
65
68
|
```
|
|
66
69
|
|
|
67
70
|
---
|
|
@@ -7,7 +7,7 @@ export { DocQuery } from "./lib/doc-query.decorator";
|
|
|
7
7
|
export { DocBody } from "./lib/doc-body.decorator";
|
|
8
8
|
export { Operation } from "./lib/operation.decorator";
|
|
9
9
|
export { Controller } from "./lib/controller.decorator";
|
|
10
|
-
export { Resource } from "./lib/resource.decorator";
|
|
10
|
+
export { Resource, ResourceMgmt } from "./lib/resource.decorator";
|
|
11
11
|
export { Endpoint } from "./lib/endpoint.decorator";
|
|
12
12
|
export type { ControllerOptions, DocTagsOptions, DocOperationOptions, DocResponseOptions, DocParamOptions, DocQueryOptions, DocBodyOptions, ResourceOptions, OperationOptions, EndpointOptions, EndpointResponseOption, HttpMethod, } from "./types/controller.types";
|
|
13
13
|
export { CONTROLLER_METADATA } from "./lib/controller-metadata";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/decorators/controllers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/decorators/controllers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONTROLLER_METADATA = exports.Endpoint = exports.Resource = exports.Controller = exports.Operation = exports.DocBody = exports.DocQuery = exports.DocParam = exports.DocResponse = exports.DocOperation = exports.DocAuth = exports.DocTags = void 0;
|
|
3
|
+
exports.CONTROLLER_METADATA = exports.Endpoint = exports.ResourceMgmt = exports.Resource = exports.Controller = exports.Operation = exports.DocBody = exports.DocQuery = exports.DocParam = exports.DocResponse = exports.DocOperation = exports.DocAuth = exports.DocTags = void 0;
|
|
4
4
|
// Controller Decorators
|
|
5
5
|
var doc_tags_decorator_1 = require("./lib/doc-tags.decorator");
|
|
6
6
|
Object.defineProperty(exports, "DocTags", { enumerable: true, get: function () { return doc_tags_decorator_1.DocTags; } });
|
|
@@ -22,6 +22,7 @@ var controller_decorator_1 = require("./lib/controller.decorator");
|
|
|
22
22
|
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return controller_decorator_1.Controller; } });
|
|
23
23
|
var resource_decorator_1 = require("./lib/resource.decorator");
|
|
24
24
|
Object.defineProperty(exports, "Resource", { enumerable: true, get: function () { return resource_decorator_1.Resource; } });
|
|
25
|
+
Object.defineProperty(exports, "ResourceMgmt", { enumerable: true, get: function () { return resource_decorator_1.ResourceMgmt; } });
|
|
25
26
|
var endpoint_decorator_1 = require("./lib/endpoint.decorator");
|
|
26
27
|
Object.defineProperty(exports, "Endpoint", { enumerable: true, get: function () { return endpoint_decorator_1.Endpoint; } });
|
|
27
28
|
// Metadata Keys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/controllers/index.ts"],"names":[],"mappings":";;;AAAA,wBAAwB;AACxB,+DAAmD;AAA1C,6GAAA,OAAO,OAAA;AAChB,+DAAmD;AAA1C,6GAAA,OAAO,OAAA;AAChB,yEAA6D;AAApD,uHAAA,YAAY,OAAA;AACrB,uEAA2D;AAAlD,qHAAA,WAAW,OAAA;AACpB,iEAAqD;AAA5C,+GAAA,QAAQ,OAAA;AACjB,iEAAqD;AAA5C,+GAAA,QAAQ,OAAA;AACjB,+DAAmD;AAA1C,6GAAA,OAAO,OAAA;AAChB,iEAAsD;AAA7C,gHAAA,SAAS,OAAA;AAClB,mEAAwD;AAA/C,kHAAA,UAAU,OAAA;AACnB,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/controllers/index.ts"],"names":[],"mappings":";;;AAAA,wBAAwB;AACxB,+DAAmD;AAA1C,6GAAA,OAAO,OAAA;AAChB,+DAAmD;AAA1C,6GAAA,OAAO,OAAA;AAChB,yEAA6D;AAApD,uHAAA,YAAY,OAAA;AACrB,uEAA2D;AAAlD,qHAAA,WAAW,OAAA;AACpB,iEAAqD;AAA5C,+GAAA,QAAQ,OAAA;AACjB,iEAAqD;AAA5C,+GAAA,QAAQ,OAAA;AACjB,+DAAmD;AAA1C,6GAAA,OAAO,OAAA;AAChB,iEAAsD;AAA7C,gHAAA,SAAS,OAAA;AAClB,mEAAwD;AAA/C,kHAAA,UAAU,OAAA;AACnB,+DAAkE;AAAzD,8GAAA,QAAQ,OAAA;AAAE,kHAAA,YAAY,OAAA;AAC/B,+DAAoD;AAA3C,8GAAA,QAAQ,OAAA;AAkBjB,gBAAgB;AAChB,iEAAgE;AAAvD,0HAAA,mBAAmB,OAAA"}
|
|
@@ -11,9 +11,12 @@ export type { ResourceOptions } from "../types/controller.types";
|
|
|
11
11
|
* class UserController {}
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* @example
|
|
14
|
+
* @example 옵션 객체로 경로 지정
|
|
15
15
|
* ```ts
|
|
16
|
-
* @Resource(
|
|
16
|
+
* @Resource({
|
|
17
|
+
* tag: 'Users',
|
|
18
|
+
* path: '/api/users',
|
|
19
|
+
* })
|
|
17
20
|
* class UserController {}
|
|
18
21
|
* ```
|
|
19
22
|
*
|
|
@@ -27,5 +30,10 @@ export type { ResourceOptions } from "../types/controller.types";
|
|
|
27
30
|
* class UserController {}
|
|
28
31
|
* ```
|
|
29
32
|
*/
|
|
30
|
-
export declare function Resource(tagOrOptions: string | ResourceOptions
|
|
33
|
+
export declare function Resource(tagOrOptions: string | ResourceOptions): ClassDecorator;
|
|
34
|
+
/**
|
|
35
|
+
* ResourceMgmt 데코레이터 - 관리용 Controller 관련 클래스 데코레이터를 통합
|
|
36
|
+
* 문자열 태그만 전달하면 기본 경로는 `/mgmt/{tag}` 형태로 생성
|
|
37
|
+
*/
|
|
38
|
+
export declare function ResourceMgmt(tagOrOptions: string | ResourceOptions): ClassDecorator;
|
|
31
39
|
//# sourceMappingURL=resource.decorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.decorator.d.ts","sourceRoot":"","sources":["../../../../../src/decorators/controllers/lib/resource.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAK1B,OAAO,KAAK,EAEV,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAGnC,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"resource.decorator.d.ts","sourceRoot":"","sources":["../../../../../src/decorators/controllers/lib/resource.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAK1B,OAAO,KAAK,EAEV,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAGnC,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AA6CjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,QAAQ,CACtB,YAAY,EAAE,MAAM,GAAG,eAAe,GACrC,cAAc,CAEhB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,YAAY,EAAE,MAAM,GAAG,eAAe,GACrC,cAAc,CAEhB"}
|
|
@@ -1,41 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Resource = Resource;
|
|
4
|
+
exports.ResourceMgmt = ResourceMgmt;
|
|
4
5
|
require("reflect-metadata");
|
|
5
6
|
const apply_decorators_1 = require("../../utils/apply-decorators");
|
|
6
7
|
const controller_decorator_1 = require("./controller.decorator");
|
|
7
8
|
const doc_tags_decorator_1 = require("./doc-tags.decorator");
|
|
8
9
|
const nest_utils_1 = require("../utils/nest.utils");
|
|
9
10
|
const parse_resource_args_1 = require("../utils/parse-resource-args");
|
|
10
|
-
|
|
11
|
-
* Resource 데코레이터 - Controller 관련 클래스 데코레이터를 통합
|
|
12
|
-
* NestJS `@Controller()` + ts-deco Controller(메타데이터) + DocTags를 한 번에 적용
|
|
13
|
-
*
|
|
14
|
-
* @example 태그만
|
|
15
|
-
* ```ts
|
|
16
|
-
* @Resource('Users')
|
|
17
|
-
* class UserController {}
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @example 태그 + 경로
|
|
21
|
-
* ```ts
|
|
22
|
-
* @Resource('Users', '/api/users')
|
|
23
|
-
* class UserController {}
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @example 옵션 객체 (추가 태그 포함)
|
|
27
|
-
* ```ts
|
|
28
|
-
* @Resource({
|
|
29
|
-
* tag: 'Users',
|
|
30
|
-
* path: '/api/users',
|
|
31
|
-
* extraTags: ['Admin', 'Auth'],
|
|
32
|
-
* })
|
|
33
|
-
* class UserController {}
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
function Resource(tagOrOptions, path) {
|
|
11
|
+
function createResourceDecorator(tagOrOptions, defaultPrefix) {
|
|
37
12
|
const decorators = [];
|
|
38
|
-
const { tag, path: controllerPath, extraTags, } = (0, parse_resource_args_1.parseResourceArgs)(tagOrOptions,
|
|
13
|
+
const { tag, path: controllerPath, extraTags, } = (0, parse_resource_args_1.parseResourceArgs)(tagOrOptions, defaultPrefix);
|
|
39
14
|
const allTags = [
|
|
40
15
|
...(tag ? [tag] : []),
|
|
41
16
|
...(extraTags ?? []),
|
|
@@ -66,4 +41,43 @@ function Resource(tagOrOptions, path) {
|
|
|
66
41
|
}
|
|
67
42
|
return (0, apply_decorators_1.applyDecorators)(...decorators);
|
|
68
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Resource 데코레이터 - Controller 관련 클래스 데코레이터를 통합
|
|
46
|
+
* NestJS `@Controller()` + ts-deco Controller(메타데이터) + DocTags를 한 번에 적용
|
|
47
|
+
*
|
|
48
|
+
* @example 태그만
|
|
49
|
+
* ```ts
|
|
50
|
+
* @Resource('Users')
|
|
51
|
+
* class UserController {}
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example 옵션 객체로 경로 지정
|
|
55
|
+
* ```ts
|
|
56
|
+
* @Resource({
|
|
57
|
+
* tag: 'Users',
|
|
58
|
+
* path: '/api/users',
|
|
59
|
+
* })
|
|
60
|
+
* class UserController {}
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example 옵션 객체 (추가 태그 포함)
|
|
64
|
+
* ```ts
|
|
65
|
+
* @Resource({
|
|
66
|
+
* tag: 'Users',
|
|
67
|
+
* path: '/api/users',
|
|
68
|
+
* extraTags: ['Admin', 'Auth'],
|
|
69
|
+
* })
|
|
70
|
+
* class UserController {}
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
function Resource(tagOrOptions) {
|
|
74
|
+
return createResourceDecorator(tagOrOptions);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* ResourceMgmt 데코레이터 - 관리용 Controller 관련 클래스 데코레이터를 통합
|
|
78
|
+
* 문자열 태그만 전달하면 기본 경로는 `/mgmt/{tag}` 형태로 생성
|
|
79
|
+
*/
|
|
80
|
+
function ResourceMgmt(tagOrOptions) {
|
|
81
|
+
return createResourceDecorator(tagOrOptions, "mgmt");
|
|
82
|
+
}
|
|
69
83
|
//# sourceMappingURL=resource.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.decorator.js","sourceRoot":"","sources":["../../../../../src/decorators/controllers/lib/resource.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"resource.decorator.js","sourceRoot":"","sources":["../../../../../src/decorators/controllers/lib/resource.decorator.ts"],"names":[],"mappings":";;AAqFA,4BAIC;AAMD,oCAIC;AAnGD,4BAA0B;AAC1B,mEAA+D;AAC/D,iEAAoD;AACpD,6DAA+C;AAC/C,oDAAwD;AAKxD,sEAAiE;AAIjE,SAAS,uBAAuB,CAC9B,YAAsC,EACtC,aAAsB;IAEtB,MAAM,UAAU,GAAqB,EAAE,CAAC;IACxC,MAAM,EACJ,GAAG,EACH,IAAI,EAAE,cAAc,EACpB,SAAS,GACV,GAAG,IAAA,uCAAiB,EAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAEnD,MAAM,OAAO,GAAG;QACd,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrB,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;KACrB,CAAC;IACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,wCAAwC;QACxC,UAAU,CAAC,IAAI,CAAC,IAAA,4BAAO,EAAC,GAAG,OAAO,CAAmB,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;QAC1B,MAAM,iBAAiB,GAAsB,EAAE,CAAC;QAChD,IAAI,GAAG;YAAE,iBAAiB,CAAC,GAAG,GAAG,GAAG,CAAC;QACrC,IAAI,cAAc;YAAE,iBAAiB,CAAC,IAAI,GAAG,cAAc,CAAC;QAC5D,MAAM,YAAY,GAAG,cAAc,IAAI,EAAE,CAAC;QAC1C,yDAAyD;QACzD,MAAM,cAAc,GAAG,IAAA,8BAAiB,GAAE,CAAC;QAC3C,IAAI,cAAc,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAmB,CAAC,CAAC;QAClE,CAAC;QACD,oEAAoE;QACpE,UAAU,CAAC,IAAI,CAAC,IAAA,iCAAU,EAAC,iBAAiB,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,UAAU,MAAW;YAC1B,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,IAAA,kCAAe,EAAC,GAAG,UAAU,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,QAAQ,CACtB,YAAsC;IAEtC,OAAO,uBAAuB,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAC1B,YAAsC;IAEtC,OAAO,uBAAuB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -4,5 +4,5 @@ export interface ParseResourceArgsResult {
|
|
|
4
4
|
path?: string;
|
|
5
5
|
extraTags?: string[];
|
|
6
6
|
}
|
|
7
|
-
export declare function parseResourceArgs(tagOrOptions: string | ResourceOptions,
|
|
7
|
+
export declare function parseResourceArgs(tagOrOptions: string | ResourceOptions, defaultPrefix?: string): ParseResourceArgsResult;
|
|
8
8
|
//# sourceMappingURL=parse-resource-args.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-resource-args.d.ts","sourceRoot":"","sources":["../../../../../src/decorators/controllers/utils/parse-resource-args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"parse-resource-args.d.ts","sourceRoot":"","sources":["../../../../../src/decorators/controllers/utils/parse-resource-args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAaD,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GAAG,eAAe,EACtC,aAAa,CAAC,EAAE,MAAM,GACrB,uBAAuB,CAgBzB"}
|
|
@@ -3,22 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseResourceArgs = parseResourceArgs;
|
|
4
4
|
/**
|
|
5
5
|
* Resource 데코레이터 인자 파싱
|
|
6
|
-
* (tagOrOptions: string | ResourceOptions,
|
|
6
|
+
* (tagOrOptions: string | ResourceOptions, defaultPrefix?) => { tag?, path?, extraTags? }
|
|
7
7
|
*/
|
|
8
|
-
function toPathFromTag(tag) {
|
|
9
|
-
|
|
8
|
+
function toPathFromTag(tag, defaultPrefix) {
|
|
9
|
+
const slug = tag.toLowerCase().replace(/\s+/g, "-");
|
|
10
|
+
const prefix = defaultPrefix?.replace(/^\/+|\/+$/g, "");
|
|
11
|
+
return prefix ? `/${prefix}/${slug}` : `/${slug}`;
|
|
10
12
|
}
|
|
11
|
-
function parseResourceArgs(tagOrOptions,
|
|
13
|
+
function parseResourceArgs(tagOrOptions, defaultPrefix) {
|
|
12
14
|
if (typeof tagOrOptions === "string") {
|
|
13
15
|
return {
|
|
14
16
|
tag: tagOrOptions,
|
|
15
|
-
path:
|
|
17
|
+
path: toPathFromTag(tagOrOptions, defaultPrefix),
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
return {
|
|
19
21
|
tag: tagOrOptions.tag,
|
|
20
22
|
path: tagOrOptions.path ??
|
|
21
|
-
(tagOrOptions.tag
|
|
23
|
+
(tagOrOptions.tag
|
|
24
|
+
? toPathFromTag(tagOrOptions.tag, defaultPrefix)
|
|
25
|
+
: undefined),
|
|
22
26
|
extraTags: tagOrOptions.extraTags,
|
|
23
27
|
};
|
|
24
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-resource-args.js","sourceRoot":"","sources":["../../../../../src/decorators/controllers/utils/parse-resource-args.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"parse-resource-args.js","sourceRoot":"","sources":["../../../../../src/decorators/controllers/utils/parse-resource-args.ts"],"names":[],"mappings":";;AAmBA,8CAmBC;AA9BD;;;GAGG;AACH,SAAS,aAAa,CAAC,GAAW,EAAE,aAAsB;IACxD,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,aAAa,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAExD,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;AACpD,CAAC;AAED,SAAgB,iBAAiB,CAC/B,YAAsC,EACtC,aAAsB;IAEtB,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO;YACL,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC;SACjD,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,EAAE,YAAY,CAAC,GAAG;QACrB,IAAI,EACF,YAAY,CAAC,IAAI;YACjB,CAAC,YAAY,CAAC,GAAG;gBACf,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,aAAa,CAAC;gBAChD,CAAC,CAAC,SAAS,CAAC;QAChB,SAAS,EAAE,YAAY,CAAC,SAAS;KAClC,CAAC;AACJ,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DtoString, DtoNumber, DtoDate, DtoBoolean, DtoEnum, Property, getApiPropertyDecorator, getRequiredValidator, getIsArrayDecorator, createCommonDecorators, extractCommonOptions, getValidatorOptions, } from "./decorators/validators";
|
|
2
2
|
export type { DtoValidatorOptions, DtoNumberValidatorOptions, DtoEnumValidatorOptions, } from "./decorators/validators";
|
|
3
3
|
export { applyDecorators } from "./decorators/utils/apply-decorators";
|
|
4
|
-
export { DocTags, DocOperation, DocResponse, DocParam, DocQuery, DocBody, Endpoint, Resource, CONTROLLER_METADATA, } from "./decorators/controllers";
|
|
4
|
+
export { DocTags, DocOperation, DocResponse, DocParam, DocQuery, DocBody, Endpoint, Resource, ResourceMgmt, CONTROLLER_METADATA, } from "./decorators/controllers";
|
|
5
5
|
export type { DocTagsOptions, DocOperationOptions, DocResponseOptions, DocParamOptions, DocQueryOptions, DocBodyOptions, EndpointOptions, EndpointResponseOption, } from "./decorators/controllers";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,SAAS,EACT,OAAO,EACP,UAAU,EACV,OAAO,EACP,QAAQ,EACR,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAGtE,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,sBAAsB,GACvB,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,SAAS,EACT,OAAO,EACP,UAAU,EACV,OAAO,EACP,QAAQ,EACR,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAGtE,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,sBAAsB,GACvB,MAAM,0BAA0B,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONTROLLER_METADATA = exports.Resource = exports.Endpoint = exports.DocBody = exports.DocQuery = exports.DocParam = exports.DocResponse = exports.DocOperation = exports.DocTags = exports.applyDecorators = exports.getValidatorOptions = exports.extractCommonOptions = exports.createCommonDecorators = exports.getIsArrayDecorator = exports.getRequiredValidator = exports.getApiPropertyDecorator = exports.Property = exports.DtoEnum = exports.DtoBoolean = exports.DtoDate = exports.DtoNumber = exports.DtoString = void 0;
|
|
3
|
+
exports.CONTROLLER_METADATA = exports.ResourceMgmt = exports.Resource = exports.Endpoint = exports.DocBody = exports.DocQuery = exports.DocParam = exports.DocResponse = exports.DocOperation = exports.DocTags = exports.applyDecorators = exports.getValidatorOptions = exports.extractCommonOptions = exports.createCommonDecorators = exports.getIsArrayDecorator = exports.getRequiredValidator = exports.getApiPropertyDecorator = exports.Property = exports.DtoEnum = exports.DtoBoolean = exports.DtoDate = exports.DtoNumber = exports.DtoString = void 0;
|
|
4
4
|
// Validators (한 곳에서 import)
|
|
5
5
|
var validators_1 = require("./decorators/validators");
|
|
6
6
|
Object.defineProperty(exports, "DtoString", { enumerable: true, get: function () { return validators_1.DtoString; } });
|
|
@@ -27,5 +27,6 @@ Object.defineProperty(exports, "DocQuery", { enumerable: true, get: function ()
|
|
|
27
27
|
Object.defineProperty(exports, "DocBody", { enumerable: true, get: function () { return controllers_1.DocBody; } });
|
|
28
28
|
Object.defineProperty(exports, "Endpoint", { enumerable: true, get: function () { return controllers_1.Endpoint; } });
|
|
29
29
|
Object.defineProperty(exports, "Resource", { enumerable: true, get: function () { return controllers_1.Resource; } });
|
|
30
|
+
Object.defineProperty(exports, "ResourceMgmt", { enumerable: true, get: function () { return controllers_1.ResourceMgmt; } });
|
|
30
31
|
Object.defineProperty(exports, "CONTROLLER_METADATA", { enumerable: true, get: function () { return controllers_1.CONTROLLER_METADATA; } });
|
|
31
32
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,sDAaiC;AAZ/B,uGAAA,SAAS,OAAA;AACT,uGAAA,SAAS,OAAA;AACT,qGAAA,OAAO,OAAA;AACP,wGAAA,UAAU,OAAA;AACV,qGAAA,OAAO,OAAA;AACP,sGAAA,QAAQ,OAAA;AACR,qHAAA,uBAAuB,OAAA;AACvB,kHAAA,oBAAoB,OAAA;AACpB,iHAAA,mBAAmB,OAAA;AACnB,oHAAA,sBAAsB,OAAA;AACtB,kHAAA,oBAAoB,OAAA;AACpB,iHAAA,mBAAmB,OAAA;AAOrB,wEAAsE;AAA7D,mHAAA,eAAe,OAAA;AAExB,6BAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,sDAaiC;AAZ/B,uGAAA,SAAS,OAAA;AACT,uGAAA,SAAS,OAAA;AACT,qGAAA,OAAO,OAAA;AACP,wGAAA,UAAU,OAAA;AACV,qGAAA,OAAO,OAAA;AACP,sGAAA,QAAQ,OAAA;AACR,qHAAA,uBAAuB,OAAA;AACvB,kHAAA,oBAAoB,OAAA;AACpB,iHAAA,mBAAmB,OAAA;AACnB,oHAAA,sBAAsB,OAAA;AACtB,kHAAA,oBAAoB,OAAA;AACpB,iHAAA,mBAAmB,OAAA;AAOrB,wEAAsE;AAA7D,mHAAA,eAAe,OAAA;AAExB,6BAA6B;AAC7B,wDAWkC;AAVhC,sGAAA,OAAO,OAAA;AACP,2GAAA,YAAY,OAAA;AACZ,0GAAA,WAAW,OAAA;AACX,uGAAA,QAAQ,OAAA;AACR,uGAAA,QAAQ,OAAA;AACR,sGAAA,OAAO,OAAA;AACP,uGAAA,QAAQ,OAAA;AACR,uGAAA,QAAQ,OAAA;AACR,2GAAA,YAAY,OAAA;AACZ,kHAAA,mBAAmB,OAAA"}
|