@aenode/nest-decorators 0.0.39 → 0.0.40
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/dist/lib/controller/common-method.d.ts +2 -1
- package/dist/lib/controller/common-method.d.ts.map +1 -1
- package/dist/lib/controller/common-method.js +15 -2
- package/dist/lib/controller/common-method.js.map +1 -1
- package/dist/lib/controller/create-one.d.ts +2 -2
- package/dist/lib/controller/create-one.d.ts.map +1 -1
- package/dist/lib/controller/create-one.js +4 -7
- package/dist/lib/controller/create-one.js.map +1 -1
- package/dist/lib/controller/delete-one-by-id.d.ts +2 -2
- package/dist/lib/controller/delete-one-by-id.d.ts.map +1 -1
- package/dist/lib/controller/delete-one-by-id.js +4 -7
- package/dist/lib/controller/delete-one-by-id.js.map +1 -1
- package/dist/lib/controller/find-many.d.ts +2 -2
- package/dist/lib/controller/find-many.d.ts.map +1 -1
- package/dist/lib/controller/find-many.js +4 -7
- package/dist/lib/controller/find-many.js.map +1 -1
- package/dist/lib/controller/find-one-by-id.d.ts +2 -2
- package/dist/lib/controller/find-one-by-id.d.ts.map +1 -1
- package/dist/lib/controller/find-one-by-id.js +4 -7
- package/dist/lib/controller/find-one-by-id.js.map +1 -1
- package/dist/lib/controller/method-options.d.ts +17 -0
- package/dist/lib/controller/method-options.d.ts.map +1 -0
- package/dist/lib/controller/method-options.js +3 -0
- package/dist/lib/controller/method-options.js.map +1 -0
- package/dist/lib/controller/operation-summary.d.ts +2 -0
- package/dist/lib/controller/operation-summary.d.ts.map +1 -0
- package/dist/lib/controller/operation-summary.js +8 -0
- package/dist/lib/controller/operation-summary.js.map +1 -0
- package/dist/lib/controller/update-one-by-id.d.ts +2 -2
- package/dist/lib/controller/update-one-by-id.d.ts.map +1 -1
- package/dist/lib/controller/update-one-by-id.js +4 -7
- package/dist/lib/controller/update-one-by-id.js.map +1 -1
- package/dist/lib/metadata/public.d.ts +2 -1
- package/dist/lib/metadata/public.d.ts.map +1 -1
- package/dist/lib/metadata/public.js +5 -6
- package/dist/lib/metadata/public.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-method.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/common-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common-method.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/common-method.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAsBpE"}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import { ApiInternalServerErrorResponse, ApiUnauthorizedResponse, ApiUnprocessableEntityResponse } from '@aenode/nest/swagger';
|
|
2
|
-
|
|
1
|
+
import { ApiInternalServerErrorResponse, ApiOperation, ApiUnauthorizedResponse, ApiUnprocessableEntityResponse } from '@aenode/nest/swagger';
|
|
2
|
+
import { Public } from '../metadata/public.js';
|
|
3
|
+
import { Emit } from './emit.js';
|
|
4
|
+
import { operationSummary } from './operation-summary.js';
|
|
5
|
+
export function CommonMethod(options) {
|
|
3
6
|
return (...args)=>{
|
|
7
|
+
options.summary ??= operationSummary(...args);
|
|
4
8
|
ApiInternalServerErrorResponse({
|
|
5
9
|
description: 'Internal error'
|
|
6
10
|
})(...args);
|
|
11
|
+
ApiOperation({
|
|
12
|
+
summary: options.summary
|
|
13
|
+
});
|
|
7
14
|
ApiUnauthorizedResponse({
|
|
8
15
|
description: 'User does not have sufficint permissions'
|
|
9
16
|
})(...args);
|
|
10
17
|
ApiUnprocessableEntityResponse({
|
|
11
18
|
description: 'Input validation error'
|
|
12
19
|
})(...args);
|
|
20
|
+
if (options.emit === true) {
|
|
21
|
+
Emit()(...args);
|
|
22
|
+
}
|
|
23
|
+
if (options.public === true) {
|
|
24
|
+
Public()(...args);
|
|
25
|
+
}
|
|
13
26
|
};
|
|
14
27
|
}
|
|
15
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/controller/common-method.ts"],"sourcesContent":["import {\n ApiInternalServerErrorResponse,\n ApiUnauthorizedResponse,\n ApiUnprocessableEntityResponse,\n} from '@aenode/nest/swagger';\n\nexport function CommonMethod(): MethodDecorator {\n return (...args) => {\n ApiInternalServerErrorResponse({ description: 'Internal error' })(...args);\n ApiUnauthorizedResponse({\n description: 'User does not have sufficint permissions',\n })(...args);\n ApiUnprocessableEntityResponse({ description: 'Input validation error' })(\n ...args,\n );\n };\n}\n"],"names":["ApiInternalServerErrorResponse","ApiUnauthorizedResponse","ApiUnprocessableEntityResponse","CommonMethod","args","description"],"mappings":"AAAA,SACEA,8BAA8B,EAC9BC,uBAAuB,EACvBC,8BAA8B,QACzB,uBAAuB;
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/controller/common-method.ts"],"sourcesContent":["import {\n ApiInternalServerErrorResponse,\n ApiOperation,\n ApiUnauthorizedResponse,\n ApiUnprocessableEntityResponse,\n} from '@aenode/nest/swagger';\nimport { Public } from '../metadata/public.js';\nimport { Emit } from './emit.js';\nimport type { MethodOptions } from './method-options.js';\nimport { operationSummary } from './operation-summary.js';\n\nexport function CommonMethod(options: MethodOptions): MethodDecorator {\n return (...args) => {\n options.summary ??= operationSummary(\n ...(args as Parameters<MethodDecorator>),\n );\n ApiInternalServerErrorResponse({ description: 'Internal error' })(...args);\n ApiOperation({ summary: options.summary });\n ApiUnauthorizedResponse({\n description: 'User does not have sufficint permissions',\n })(...args);\n ApiUnprocessableEntityResponse({ description: 'Input validation error' })(\n ...args,\n );\n\n if (options.emit === true) {\n Emit()(...args);\n }\n\n if (options.public === true) {\n Public()(...args);\n }\n };\n}\n"],"names":["ApiInternalServerErrorResponse","ApiOperation","ApiUnauthorizedResponse","ApiUnprocessableEntityResponse","Public","Emit","operationSummary","CommonMethod","options","args","summary","description","emit","public"],"mappings":"AAAA,SACEA,8BAA8B,EAC9BC,YAAY,EACZC,uBAAuB,EACvBC,8BAA8B,QACzB,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,IAAI,QAAQ,YAAY;AAEjC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,OAAO,SAASC,aAAaC,OAAsB;IACjD,OAAO,CAAC,GAAGC;QACTD,QAAQE,OAAO,KAAKJ,oBACdG;QAENT,+BAA+B;YAAEW,aAAa;QAAiB,MAAMF;QACrER,aAAa;YAAES,SAASF,QAAQE,OAAO;QAAC;QACxCR,wBAAwB;YACtBS,aAAa;QACf,MAAMF;QACNN,+BAA+B;YAAEQ,aAAa;QAAyB,MAClEF;QAGL,IAAID,QAAQI,IAAI,KAAK,MAAM;YACzBP,UAAUI;QACZ;QAEA,IAAID,QAAQK,MAAM,KAAK,MAAM;YAC3BT,YAAYK;QACd;IACF;AACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function CreateOne(
|
|
1
|
+
import type { MethodOptions } from './method-options.js';
|
|
2
|
+
export declare function CreateOne(options: MethodOptions): MethodDecorator;
|
|
3
3
|
//# sourceMappingURL=create-one.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-one.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/create-one.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-one.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/create-one.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAUjE"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Post } from '@aenode/nest/common';
|
|
2
|
-
import { ApiCreatedResponse
|
|
2
|
+
import { ApiCreatedResponse } from '@aenode/nest/swagger';
|
|
3
3
|
import { Operation } from '@aenode/types';
|
|
4
4
|
import { OperationName } from '../metadata/operation-name.js';
|
|
5
5
|
import { CommonMethod } from './common-method.js';
|
|
6
|
-
export function CreateOne(
|
|
6
|
+
export function CreateOne(options) {
|
|
7
7
|
return (...args)=>{
|
|
8
|
-
CommonMethod()(...args);
|
|
9
|
-
ApiOperation({
|
|
10
|
-
summary: 'Create one'
|
|
11
|
-
})(...args);
|
|
8
|
+
CommonMethod(options)(...args);
|
|
12
9
|
ApiCreatedResponse({
|
|
13
|
-
type: responseType,
|
|
10
|
+
type: options.responseType,
|
|
14
11
|
description: 'Successfull'
|
|
15
12
|
})(...args);
|
|
16
13
|
OperationName(Operation.WRITE)(...args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/controller/create-one.ts"],"sourcesContent":["import { Post
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/controller/create-one.ts"],"sourcesContent":["import { Post } from '@aenode/nest/common';\nimport { ApiCreatedResponse } from '@aenode/nest/swagger';\nimport { Operation } from '@aenode/types';\nimport { OperationName } from '../metadata/operation-name.js';\nimport { CommonMethod } from './common-method.js';\nimport type { MethodOptions } from './method-options.js';\n\nexport function CreateOne(options: MethodOptions): MethodDecorator {\n return (...args) => {\n CommonMethod(options)(...args);\n ApiCreatedResponse({\n type: options.responseType,\n description: 'Successfull',\n })(...args);\n OperationName(Operation.WRITE)(...args);\n Post()(...args);\n };\n}\n"],"names":["Post","ApiCreatedResponse","Operation","OperationName","CommonMethod","CreateOne","options","args","type","responseType","description","WRITE"],"mappings":"AAAA,SAASA,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,YAAY,QAAQ,qBAAqB;AAGlD,OAAO,SAASC,UAAUC,OAAsB;IAC9C,OAAO,CAAC,GAAGC;QACTH,aAAaE,YAAYC;QACzBN,mBAAmB;YACjBO,MAAMF,QAAQG,YAAY;YAC1BC,aAAa;QACf,MAAMH;QACNJ,cAAcD,UAAUS,KAAK,KAAKJ;QAClCP,UAAUO;IACZ;AACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function DeleteOneById(
|
|
1
|
+
import type { MethodOptions } from './method-options.js';
|
|
2
|
+
export declare function DeleteOneById(options: MethodOptions): MethodDecorator;
|
|
3
3
|
//# sourceMappingURL=delete-one-by-id.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-one-by-id.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/delete-one-by-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete-one-by-id.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/delete-one-by-id.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAWrE"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Delete } from '@aenode/nest/common';
|
|
2
|
-
import { ApiNotFoundResponse, ApiOkResponse
|
|
2
|
+
import { ApiNotFoundResponse, ApiOkResponse } from '@aenode/nest/swagger';
|
|
3
3
|
import { Operation } from '@aenode/types';
|
|
4
4
|
import { OperationName } from '../metadata/operation-name.js';
|
|
5
5
|
import { CommonMethod } from './common-method.js';
|
|
6
|
-
export function DeleteOneById(
|
|
6
|
+
export function DeleteOneById(options) {
|
|
7
7
|
return (...args)=>{
|
|
8
|
-
CommonMethod()(...args);
|
|
9
|
-
ApiOperation({
|
|
10
|
-
summary: 'Delete one by id'
|
|
11
|
-
})(...args);
|
|
8
|
+
CommonMethod(options)(...args);
|
|
12
9
|
ApiOkResponse({
|
|
13
|
-
type: responseType,
|
|
10
|
+
type: options.responseType,
|
|
14
11
|
description: 'Successfull'
|
|
15
12
|
})(...args);
|
|
16
13
|
ApiNotFoundResponse({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/controller/delete-one-by-id.ts"],"sourcesContent":["import { Delete
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/controller/delete-one-by-id.ts"],"sourcesContent":["import { Delete } from '@aenode/nest/common';\nimport { ApiNotFoundResponse, ApiOkResponse } from '@aenode/nest/swagger';\nimport { Operation } from '@aenode/types';\nimport { OperationName } from '../metadata/operation-name.js';\nimport { CommonMethod } from './common-method.js';\nimport type { MethodOptions } from './method-options.js';\n\nexport function DeleteOneById(options: MethodOptions): MethodDecorator {\n return (...args) => {\n CommonMethod(options)(...args);\n ApiOkResponse({\n type: options.responseType,\n description: 'Successfull',\n })(...args);\n ApiNotFoundResponse({ description: 'Not found' })(...args);\n OperationName(Operation.DELETE)(...args);\n Delete(':id')(...args);\n };\n}\n"],"names":["Delete","ApiNotFoundResponse","ApiOkResponse","Operation","OperationName","CommonMethod","DeleteOneById","options","args","type","responseType","description","DELETE"],"mappings":"AAAA,SAASA,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,uBAAuB;AAC1E,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,YAAY,QAAQ,qBAAqB;AAGlD,OAAO,SAASC,cAAcC,OAAsB;IAClD,OAAO,CAAC,GAAGC;QACTH,aAAaE,YAAYC;QACzBN,cAAc;YACZO,MAAMF,QAAQG,YAAY;YAC1BC,aAAa;QACf,MAAMH;QACNP,oBAAoB;YAAEU,aAAa;QAAY,MAAMH;QACrDJ,cAAcD,UAAUS,MAAM,KAAKJ;QACnCR,OAAO,UAAUQ;IACnB;AACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function FindMany(
|
|
1
|
+
import type { MethodOptions } from './method-options.js';
|
|
2
|
+
export declare function FindMany(options: MethodOptions): MethodDecorator;
|
|
3
3
|
//# sourceMappingURL=find-many.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-many.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/find-many.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-many.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/find-many.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAWhE"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Get } from '@aenode/nest/common';
|
|
2
|
-
import { ApiOkResponse
|
|
2
|
+
import { ApiOkResponse } from '@aenode/nest/swagger';
|
|
3
3
|
import { Operation } from '@aenode/types';
|
|
4
4
|
import { OperationName } from '../metadata/operation-name.js';
|
|
5
5
|
import { CommonMethod } from './common-method.js';
|
|
6
|
-
export function FindMany(
|
|
6
|
+
export function FindMany(options) {
|
|
7
7
|
return (...args)=>{
|
|
8
|
-
CommonMethod()(...args);
|
|
9
|
-
ApiOperation({
|
|
10
|
-
summary: 'Find many'
|
|
11
|
-
})(...args);
|
|
8
|
+
CommonMethod(options)(...args);
|
|
12
9
|
ApiOkResponse({
|
|
13
|
-
type: responseType,
|
|
10
|
+
type: options.responseType,
|
|
14
11
|
isArray: true,
|
|
15
12
|
description: 'Successfull'
|
|
16
13
|
})(...args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/controller/find-many.ts"],"sourcesContent":["import { Get
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/controller/find-many.ts"],"sourcesContent":["import { Get } from '@aenode/nest/common';\nimport { ApiOkResponse } from '@aenode/nest/swagger';\nimport { Operation } from '@aenode/types';\nimport { OperationName } from '../metadata/operation-name.js';\nimport { CommonMethod } from './common-method.js';\nimport type { MethodOptions } from './method-options.js';\n\nexport function FindMany(options: MethodOptions): MethodDecorator {\n return (...args) => {\n CommonMethod(options)(...args);\n ApiOkResponse({\n type: options.responseType,\n isArray: true,\n description: 'Successfull',\n })(...args);\n OperationName(Operation.READ_MANY)(...args);\n Get()(...args);\n };\n}\n"],"names":["Get","ApiOkResponse","Operation","OperationName","CommonMethod","FindMany","options","args","type","responseType","isArray","description","READ_MANY"],"mappings":"AAAA,SAASA,GAAG,QAAQ,sBAAsB;AAC1C,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,YAAY,QAAQ,qBAAqB;AAGlD,OAAO,SAASC,SAASC,OAAsB;IAC7C,OAAO,CAAC,GAAGC;QACTH,aAAaE,YAAYC;QACzBN,cAAc;YACZO,MAAMF,QAAQG,YAAY;YAC1BC,SAAS;YACTC,aAAa;QACf,MAAMJ;QACNJ,cAAcD,UAAUU,SAAS,KAAKL;QACtCP,SAASO;IACX;AACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function FindOneById(
|
|
1
|
+
import type { MethodOptions } from './method-options.js';
|
|
2
|
+
export declare function FindOneById(options: MethodOptions): MethodDecorator;
|
|
3
3
|
//# sourceMappingURL=find-one-by-id.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-one-by-id.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/find-one-by-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-one-by-id.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/find-one-by-id.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAWnE"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Get } from '@aenode/nest/common';
|
|
2
|
-
import { ApiNotFoundResponse, ApiOkResponse
|
|
2
|
+
import { ApiNotFoundResponse, ApiOkResponse } from '@aenode/nest/swagger';
|
|
3
3
|
import { Operation } from '@aenode/types';
|
|
4
4
|
import { OperationName } from '../metadata/operation-name.js';
|
|
5
5
|
import { CommonMethod } from './common-method.js';
|
|
6
|
-
export function FindOneById(
|
|
6
|
+
export function FindOneById(options) {
|
|
7
7
|
return (...args)=>{
|
|
8
|
-
CommonMethod()(...args);
|
|
9
|
-
ApiOperation({
|
|
10
|
-
summary: 'Find one by id'
|
|
11
|
-
})(...args);
|
|
8
|
+
CommonMethod(options)(...args);
|
|
12
9
|
ApiOkResponse({
|
|
13
|
-
type: responseType,
|
|
10
|
+
type: options.responseType,
|
|
14
11
|
description: 'Successfull'
|
|
15
12
|
})(...args);
|
|
16
13
|
ApiNotFoundResponse({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/controller/find-one-by-id.ts"],"sourcesContent":["import { Get
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/controller/find-one-by-id.ts"],"sourcesContent":["import { Get } from '@aenode/nest/common';\nimport { ApiNotFoundResponse, ApiOkResponse } from '@aenode/nest/swagger';\nimport { Operation } from '@aenode/types';\nimport { OperationName } from '../metadata/operation-name.js';\nimport { CommonMethod } from './common-method.js';\nimport type { MethodOptions } from './method-options.js';\n\nexport function FindOneById(options: MethodOptions): MethodDecorator {\n return (...args) => {\n CommonMethod(options)(...args);\n ApiOkResponse({\n type: options.responseType,\n description: 'Successfull',\n })(...args);\n ApiNotFoundResponse({ description: 'Not found' })(...args);\n OperationName(Operation.READ)(...args);\n Get(':id')(...args);\n };\n}\n"],"names":["Get","ApiNotFoundResponse","ApiOkResponse","Operation","OperationName","CommonMethod","FindOneById","options","args","type","responseType","description","READ"],"mappings":"AAAA,SAASA,GAAG,QAAQ,sBAAsB;AAC1C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,uBAAuB;AAC1E,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,YAAY,QAAQ,qBAAqB;AAGlD,OAAO,SAASC,YAAYC,OAAsB;IAChD,OAAO,CAAC,GAAGC;QACTH,aAAaE,YAAYC;QACzBN,cAAc;YACZO,MAAMF,QAAQG,YAAY;YAC1BC,aAAa;QACf,MAAMH;QACNP,oBAAoB;YAAEU,aAAa;QAAY,MAAMH;QACrDJ,cAAcD,UAAUS,IAAI,KAAKJ;QACjCR,IAAI,UAAUQ;IAChB;AACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Type } from '@aenode/nest/common';
|
|
2
|
+
export type MethodOptions = {
|
|
3
|
+
responseType?: Type;
|
|
4
|
+
/**
|
|
5
|
+
* Emit the response by <ResourceName>.<OperationName>
|
|
6
|
+
*/
|
|
7
|
+
emit?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Operation summary
|
|
10
|
+
*/
|
|
11
|
+
summary?: string;
|
|
12
|
+
/**
|
|
13
|
+
* By pass authentication
|
|
14
|
+
*/
|
|
15
|
+
public?: boolean;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=method-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method-options.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/method-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,CAAC,EAAE,IAAI,CAAC;IAEpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/controller/method-options.ts"],"sourcesContent":["import type { Type } from '@aenode/nest/common';\n\nexport type MethodOptions = {\n responseType?: Type;\n\n /**\n * Emit the response by <ResourceName>.<OperationName>\n */\n emit?: boolean;\n\n /**\n * Operation summary\n */\n summary?: string;\n\n /**\n * By pass authentication\n */\n public?: boolean;\n};\n"],"names":[],"mappings":"AAEA,WAiBE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-summary.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/operation-summary.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,MAAM,CAI7E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { extractResourceName, names } from '@aenode/names';
|
|
2
|
+
export function operationSummary(...args) {
|
|
3
|
+
const resourceName = extractResourceName(args[0].constructor.name);
|
|
4
|
+
const operationName = args[1].toString();
|
|
5
|
+
return `${names(operationName).sentence} ${names(resourceName).pascal}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=operation-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/controller/operation-summary.ts"],"sourcesContent":["import { extractResourceName, names } from '@aenode/names';\n\nexport function operationSummary(...args: Parameters<MethodDecorator>): string {\n const resourceName = extractResourceName(args[0].constructor.name);\n const operationName = args[1].toString();\n return `${names(operationName).sentence} ${names(resourceName).pascal}`;\n}\n"],"names":["extractResourceName","names","operationSummary","args","resourceName","name","operationName","toString","sentence","pascal"],"mappings":"AAAA,SAASA,mBAAmB,EAAEC,KAAK,QAAQ,gBAAgB;AAE3D,OAAO,SAASC,iBAAiB,GAAGC,IAAiC;IACnE,MAAMC,eAAeJ,oBAAoBG,IAAI,CAAC,EAAE,CAAC,WAAW,CAACE,IAAI;IACjE,MAAMC,gBAAgBH,IAAI,CAAC,EAAE,CAACI,QAAQ;IACtC,OAAO,GAAGN,MAAMK,eAAeE,QAAQ,CAAC,CAAC,EAAEP,MAAMG,cAAcK,MAAM,EAAE;AACzE"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function UpdateOneById(
|
|
1
|
+
import type { MethodOptions } from './method-options.js';
|
|
2
|
+
export declare function UpdateOneById(options: MethodOptions): MethodDecorator;
|
|
3
3
|
//# sourceMappingURL=update-one-by-id.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-one-by-id.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/update-one-by-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-one-by-id.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/update-one-by-id.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAWrE"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Patch } from '@aenode/nest/common';
|
|
2
|
-
import { ApiNotFoundResponse, ApiOkResponse
|
|
2
|
+
import { ApiNotFoundResponse, ApiOkResponse } from '@aenode/nest/swagger';
|
|
3
3
|
import { Operation } from '@aenode/types';
|
|
4
4
|
import { OperationName } from '../metadata/operation-name.js';
|
|
5
5
|
import { CommonMethod } from './common-method.js';
|
|
6
|
-
export function UpdateOneById(
|
|
6
|
+
export function UpdateOneById(options) {
|
|
7
7
|
return (...args)=>{
|
|
8
|
-
CommonMethod()(...args);
|
|
9
|
-
ApiOperation({
|
|
10
|
-
summary: 'Update one by id'
|
|
11
|
-
})(...args);
|
|
8
|
+
CommonMethod(options)(...args);
|
|
12
9
|
ApiOkResponse({
|
|
13
|
-
type: responseType,
|
|
10
|
+
type: options.responseType,
|
|
14
11
|
description: 'Successfull'
|
|
15
12
|
})(...args);
|
|
16
13
|
ApiNotFoundResponse({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/controller/update-one-by-id.ts"],"sourcesContent":["import { Patch
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/controller/update-one-by-id.ts"],"sourcesContent":["import { Patch } from '@aenode/nest/common';\nimport { ApiNotFoundResponse, ApiOkResponse } from '@aenode/nest/swagger';\nimport { Operation } from '@aenode/types';\nimport { OperationName } from '../metadata/operation-name.js';\nimport { CommonMethod } from './common-method.js';\nimport type { MethodOptions } from './method-options.js';\n\nexport function UpdateOneById(options: MethodOptions): MethodDecorator {\n return (...args) => {\n CommonMethod(options)(...args);\n ApiOkResponse({\n type: options.responseType,\n description: 'Successfull',\n })(...args);\n ApiNotFoundResponse({ description: 'Not found' })(...args);\n OperationName(Operation.UPDATE)(...args);\n Patch(':id')(...args);\n };\n}\n"],"names":["Patch","ApiNotFoundResponse","ApiOkResponse","Operation","OperationName","CommonMethod","UpdateOneById","options","args","type","responseType","description","UPDATE"],"mappings":"AAAA,SAASA,KAAK,QAAQ,sBAAsB;AAC5C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,uBAAuB;AAC1E,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,YAAY,QAAQ,qBAAqB;AAGlD,OAAO,SAASC,cAAcC,OAAsB;IAClD,OAAO,CAAC,GAAGC;QACTH,aAAaE,YAAYC;QACzBN,cAAc;YACZO,MAAMF,QAAQG,YAAY;YAC1BC,aAAa;QACf,MAAMH;QACNP,oBAAoB;YAAEU,aAAa;QAAY,MAAMH;QACrDJ,cAAcD,UAAUS,MAAM,KAAKJ;QACnCR,MAAM,UAAUQ;IAClB;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MetadataToken } from '@aenode/constants';
|
|
1
2
|
import { type ExecutionContext } from '@aenode/nest/common';
|
|
2
3
|
import type { Reflector } from '@aenode/nest/core';
|
|
3
4
|
/**
|
|
@@ -5,7 +6,7 @@ import type { Reflector } from '@aenode/nest/core';
|
|
|
5
6
|
*
|
|
6
7
|
* @returns Class decorator
|
|
7
8
|
*/
|
|
8
|
-
export declare
|
|
9
|
+
export declare const Public: () => import("@aenode/nest/common").CustomDecorator<MetadataToken>;
|
|
9
10
|
/**
|
|
10
11
|
* Check the resource is marked as public or not.
|
|
11
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/lib/metadata/public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/lib/metadata/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,MAAM,oEAAgD,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAE,SAAS,GACnB,OAAO,CAKT"}
|
|
@@ -4,11 +4,7 @@ import { SetMetadata } from '@aenode/nest/common';
|
|
|
4
4
|
* Mark the target resource as public which will bypass the authentication
|
|
5
5
|
*
|
|
6
6
|
* @returns Class decorator
|
|
7
|
-
*/ export
|
|
8
|
-
return (...args)=>{
|
|
9
|
-
SetMetadata(MetadataToken.PUBLIC, true)(...args);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
7
|
+
*/ export const Public = ()=>SetMetadata(MetadataToken.PUBLIC, true);
|
|
12
8
|
/**
|
|
13
9
|
* Check the resource is marked as public or not.
|
|
14
10
|
*
|
|
@@ -16,7 +12,10 @@ import { SetMetadata } from '@aenode/nest/common';
|
|
|
16
12
|
* @param reflector nestjs core Reflector
|
|
17
13
|
* @returns boolean
|
|
18
14
|
*/ export function isPublic(context, reflector) {
|
|
19
|
-
return !!reflector.
|
|
15
|
+
return !!reflector.getAllAndOverride(MetadataToken.PUBLIC, [
|
|
16
|
+
context.getClass(),
|
|
17
|
+
context.getHandler()
|
|
18
|
+
]);
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=public.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/metadata/public.ts"],"sourcesContent":["import { MetadataToken } from '@aenode/constants';\nimport { SetMetadata, type ExecutionContext } from '@aenode/nest/common';\nimport type { Reflector } from '@aenode/nest/core';\n\n/**\n * Mark the target resource as public which will bypass the authentication\n *\n * @returns Class decorator\n */\nexport
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/metadata/public.ts"],"sourcesContent":["import { MetadataToken } from '@aenode/constants';\nimport { SetMetadata, type ExecutionContext } from '@aenode/nest/common';\nimport type { Reflector } from '@aenode/nest/core';\n\n/**\n * Mark the target resource as public which will bypass the authentication\n *\n * @returns Class decorator\n */\nexport const Public = () => SetMetadata(MetadataToken.PUBLIC, true);\n\n/**\n * Check the resource is marked as public or not.\n *\n * @param context nestjs execution context\n * @param reflector nestjs core Reflector\n * @returns boolean\n */\nexport function isPublic(\n context: ExecutionContext,\n reflector: Reflector,\n): boolean {\n return !!reflector.getAllAndOverride<boolean | undefined>(\n MetadataToken.PUBLIC,\n [context.getClass(), context.getHandler()],\n );\n}\n"],"names":["MetadataToken","SetMetadata","Public","PUBLIC","isPublic","context","reflector","getAllAndOverride","getClass","getHandler"],"mappings":"AAAA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,WAAW,QAA+B,sBAAsB;AAGzE;;;;CAIC,GACD,OAAO,MAAMC,SAAS,IAAMD,YAAYD,cAAcG,MAAM,EAAE,MAAM;AAEpE;;;;;;CAMC,GACD,OAAO,SAASC,SACdC,OAAyB,EACzBC,SAAoB;IAEpB,OAAO,CAAC,CAACA,UAAUC,iBAAiB,CAClCP,cAAcG,MAAM,EACpB;QAACE,QAAQG,QAAQ;QAAIH,QAAQI,UAAU;KAAG;AAE9C"}
|