@mee4dy/crud-nestjs 1.0.13 → 1.0.14
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/crud.controller.d.ts +1 -1
- package/dist/crud.controller.js +5 -4
- package/dist/crud.controller.js.map +1 -1
- package/dist/crud.service.d.ts +1 -1
- package/dist/crud.service.js +5 -2
- package/dist/crud.service.js.map +1 -1
- package/package.json +1 -1
- package/dist/decorators/crud-ctx.decorator.d.ts +0 -1
- package/dist/decorators/crud-ctx.decorator.js +0 -11
- package/dist/decorators/crud-ctx.decorator.js.map +0 -1
- package/dist/decorators/use-crud-ctx.decorator.d.ts +0 -1
- package/dist/decorators/use-crud-ctx.decorator.js +0 -20
- package/dist/decorators/use-crud-ctx.decorator.js.map +0 -1
- package/dist/decorators/use-crud-scope.decorator.d.ts +0 -1
- package/dist/decorators/use-crud-scope.decorator.js +0 -20
- package/dist/decorators/use-crud-scope.decorator.js.map +0 -1
- package/dist/decorators/use-middleware.decorator.d.ts +0 -1
- package/dist/decorators/use-middleware.decorator.js +0 -23
- package/dist/decorators/use-middleware.decorator.js.map +0 -1
- package/dist/interfaces/crud-ctx.interface.d.ts +0 -3
- package/dist/interfaces/crud-ctx.interface.js +0 -3
- package/dist/interfaces/crud-ctx.interface.js.map +0 -1
- package/dist/interfaces/find-params.interface.d.ts +0 -13
- package/dist/interfaces/find-params.interface.js +0 -3
- package/dist/interfaces/find-params.interface.js.map +0 -1
- package/dist/pipes/query.parse.pipe.d.ts +0 -4
- package/dist/pipes/query.parse.pipe.js +0 -27
- package/dist/pipes/query.parse.pipe.js.map +0 -1
|
@@ -16,7 +16,7 @@ export declare class CrudController<T extends Model> {
|
|
|
16
16
|
item: T;
|
|
17
17
|
};
|
|
18
18
|
}>;
|
|
19
|
-
create(data: object): Promise<CrudResponse>;
|
|
19
|
+
create(params: CrudParams, data: object): Promise<CrudResponse>;
|
|
20
20
|
update(params: CrudParams, data: object): Promise<CrudResponse>;
|
|
21
21
|
delete(params: CrudParams): Promise<CrudResponse>;
|
|
22
22
|
}
|
package/dist/crud.controller.js
CHANGED
|
@@ -52,11 +52,11 @@ class CrudController {
|
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
async create(data) {
|
|
55
|
+
async create(params, data) {
|
|
56
56
|
if (!this.checkEndpoint('create')) {
|
|
57
57
|
throw new endpoint_disabled_exception_1.EndpointDisabledException('create');
|
|
58
58
|
}
|
|
59
|
-
const item = await this.service.create(data);
|
|
59
|
+
const item = await this.service.create(params, data);
|
|
60
60
|
return {
|
|
61
61
|
status: true,
|
|
62
62
|
data: {
|
|
@@ -109,9 +109,10 @@ __decorate([
|
|
|
109
109
|
__decorate([
|
|
110
110
|
(0, common_1.Post)('/'),
|
|
111
111
|
(0, common_1.UseFilters)(crud_exception_filter_1.CrudExceptionFilter),
|
|
112
|
-
__param(0, (0,
|
|
112
|
+
__param(0, (0, crud_params_decorator_1.CrudParamsDecorator)()),
|
|
113
|
+
__param(1, (0, common_1.Body)('data')),
|
|
113
114
|
__metadata("design:type", Function),
|
|
114
|
-
__metadata("design:paramtypes", [Object]),
|
|
115
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
115
116
|
__metadata("design:returntype", Promise)
|
|
116
117
|
], CrudController.prototype, "create", null);
|
|
117
118
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.controller.js","sourceRoot":"","sources":["../src/crud.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoG;AAEpG,iDAA6C;AAG7C,4BAA0B;AAC1B,8EAAyE;AAEzE,2EAAsE;AACtE,0FAAqF;AAErF,MAAa,cAAc;IACzB;QACE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAe,CAAC;QACjF,IAAI,CAAC,OAAO,GAAG,IAAI,0BAAW,CAAI,IAAI,CAAC,MAA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A,2CAAmB,GAAE,CAAA;;;;0CAahC;AAIK;IAFL,IAAA,aAAI,EAAC,GAAG,CAAC;IACT,IAAA,mBAAU,EAAC,2CAAmB,CAAC;IAClB,WAAA,IAAA,2CAAmB,GAAE,CAAA;IAAsB,WAAA,IAAA,aAAI,EAAC,MAAM,CAAC,CAAA;;;;4CAapE;AAIK;IAFL,IAAA,YAAG,EAAC,MAAM,CAAC;IACX,IAAA,mBAAU,EAAC,2CAAmB,CAAC;IAClB,WAAA,IAAA,2CAAmB,GAAE,CAAA;IAAsB,WAAA,IAAA,aAAI,EAAC,MAAM,CAAC,CAAA;;;;4CAapE;AAIK;IAFL,IAAA,eAAM,EAAC,MAAM,CAAC;IACd,IAAA,mBAAU,EAAC,2CAAmB,CAAC;IAClB,WAAA,IAAA,2CAAmB,GAAE,CAAA;;;;4CAalC"}
|
package/dist/crud.service.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class CrudService<T extends Model> {
|
|
|
9
9
|
private paramsProcessor;
|
|
10
10
|
getItems(params: CrudParams): Promise<T[]>;
|
|
11
11
|
getItem(params: CrudParams): Promise<T>;
|
|
12
|
-
create(data: object): Promise<T>;
|
|
12
|
+
create(params: CrudParams, data: object): Promise<T>;
|
|
13
13
|
update(params: CrudParams, data: object, returning?: boolean): Promise<any>;
|
|
14
14
|
delete(params: CrudParams): Promise<void>;
|
|
15
15
|
}
|
package/dist/crud.service.js
CHANGED
|
@@ -28,9 +28,12 @@ class CrudService {
|
|
|
28
28
|
const repository = this.getRepository(params);
|
|
29
29
|
return repository.findOne(processedParams);
|
|
30
30
|
}
|
|
31
|
-
create(data) {
|
|
32
|
-
|
|
31
|
+
create(params, data) {
|
|
32
|
+
const processedParams = this.paramsProcessor(params);
|
|
33
|
+
const repository = this.getRepository(params);
|
|
34
|
+
return repository.create(data, {
|
|
33
35
|
returning: true,
|
|
36
|
+
...processedParams,
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
async update(params, data, returning = true) {
|
package/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,CAAC;QACrD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO,UAAU,CAAC,MAAM,CAAC,IAAW,EAAE;YACpC,SAAS,EAAE,IAAI;YACf,GAAG,eAAe;SACnB,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,MAAkB,EAAE,IAAY,EAAE,YAAqB,IAAI;QAC7E,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAW,EAAE,EAAE;YAC5C,IAAI,SAAS,EAAE,CAAC;gBACd,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC9B,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,MAAkB;QACpC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACF;AApED,kCAoEC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const CrudCtx: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CrudCtx = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
exports.CrudCtx = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
6
|
-
const request = ctx.switchToHttp().getRequest();
|
|
7
|
-
return Object.assign({
|
|
8
|
-
params: {},
|
|
9
|
-
}, request.crudCtx);
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=crud-ctx.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crud-ctx.decorator.js","sourceRoot":"","sources":["../../src/decorators/crud-ctx.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAG3D,QAAA,OAAO,GAAG,IAAA,6BAAoB,EAAC,CAAC,IAAa,EAAE,GAAqB,EAAe,EAAE;IAChG,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAEhD,OAAO,MAAM,CAAC,MAAM,CAClB;QACE,MAAM,EAAE,EAAE;KACX,EACD,OAAO,CAAC,OAAO,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const UseCrudCtx: (callback: any) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UseCrudCtx = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const use_middleware_decorator_1 = require("./use-middleware.decorator");
|
|
6
|
-
const UseCrudCtx = (callback) => {
|
|
7
|
-
const middlewareDecorator = (0, use_middleware_decorator_1.UseMiddleware)((req) => {
|
|
8
|
-
const crudCtx = callback(req);
|
|
9
|
-
if (!req.crudCtx) {
|
|
10
|
-
req.crudCtx = {};
|
|
11
|
-
}
|
|
12
|
-
req.crudCtx = {
|
|
13
|
-
...req.crudCtx,
|
|
14
|
-
...crudCtx,
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
return (0, common_1.applyDecorators)(middlewareDecorator);
|
|
18
|
-
};
|
|
19
|
-
exports.UseCrudCtx = UseCrudCtx;
|
|
20
|
-
//# sourceMappingURL=use-crud-ctx.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-crud-ctx.decorator.js","sourceRoot":"","sources":["../../src/decorators/use-crud-ctx.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AACjD,yEAA2D;AAEpD,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,EAAE;IACrC,MAAM,mBAAmB,GAAG,IAAA,wCAAa,EAAC,CAAC,GAAG,EAAE,EAAE;QAChD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAE9B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC;QACnB,CAAC;QAED,GAAG,CAAC,OAAO,GAAG;YACZ,GAAG,GAAG,CAAC,OAAO;YACd,GAAG,OAAO;SACX,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,wBAAe,EAAC,mBAAmB,CAAC,CAAC;AAC9C,CAAC,CAAC;AAfW,QAAA,UAAU,cAerB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const UseCrudScope: (callback: any) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UseCrudScope = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const use_middleware_decorator_1 = require("./use-middleware.decorator");
|
|
6
|
-
const UseCrudScope = (callback) => {
|
|
7
|
-
const middlewareDecorator = (0, use_middleware_decorator_1.UseMiddleware)((req) => {
|
|
8
|
-
const crudScope = callback(req);
|
|
9
|
-
if (!req.crudCtx) {
|
|
10
|
-
req.crudCtx = {};
|
|
11
|
-
}
|
|
12
|
-
req.crudCtx.params = {
|
|
13
|
-
...req.crudCtx.params,
|
|
14
|
-
...crudScope,
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
return (0, common_1.applyDecorators)(middlewareDecorator);
|
|
18
|
-
};
|
|
19
|
-
exports.UseCrudScope = UseCrudScope;
|
|
20
|
-
//# sourceMappingURL=use-crud-scope.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-crud-scope.decorator.js","sourceRoot":"","sources":["../../src/decorators/use-crud-scope.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AACjD,yEAA2D;AAEpD,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,IAAA,wCAAa,EAAC,CAAC,GAAG,EAAE,EAAE;QAChD,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAEhC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC;QACnB,CAAC;QAED,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG;YACnB,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM;YACrB,GAAG,SAAS;SACb,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,wBAAe,EAAC,mBAAmB,CAAC,CAAC;AAC9C,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const UseMiddleware: (middleware: any) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UseMiddleware = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
class CrudInterceptor {
|
|
6
|
-
constructor(middleware) {
|
|
7
|
-
this.middleware = middleware;
|
|
8
|
-
}
|
|
9
|
-
intercept(context, next) {
|
|
10
|
-
const req = context.switchToHttp().getRequest();
|
|
11
|
-
if (this.middleware) {
|
|
12
|
-
this.middleware(req);
|
|
13
|
-
}
|
|
14
|
-
return next.handle();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
const UseMiddleware = (middleware) => {
|
|
18
|
-
const crudInterceptor = new CrudInterceptor(middleware);
|
|
19
|
-
const interceptorDecorator = (0, common_1.UseInterceptors)(crudInterceptor);
|
|
20
|
-
return (0, common_1.applyDecorators)(interceptorDecorator);
|
|
21
|
-
};
|
|
22
|
-
exports.UseMiddleware = UseMiddleware;
|
|
23
|
-
//# sourceMappingURL=use-middleware.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-middleware.decorator.js","sourceRoot":"","sources":["../../src/decorators/use-middleware.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAkH;AAGlH,MAAM,eAAe;IACnB,YAAY,UAAU;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAID,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAEhD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CACF;AAEM,MAAM,aAAa,GAAG,CAAC,UAAe,EAAE,EAAE;IAC/C,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,oBAAoB,GAAG,IAAA,wBAAe,EAAC,eAAe,CAAC,CAAC;IAE9D,OAAO,IAAA,wBAAe,EAAC,oBAAoB,CAAC,CAAC;AAC/C,CAAC,CAAC;AALW,QAAA,aAAa,iBAKxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crud-ctx.interface.js","sourceRoot":"","sources":["../../src/interfaces/crud-ctx.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-params.interface.js","sourceRoot":"","sources":["../../src/interfaces/find-params.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.QueryParsePipe = void 0;
|
|
13
|
-
const common_1 = require("@nestjs/common");
|
|
14
|
-
const qs_1 = __importDefault(require("qs"));
|
|
15
|
-
let QueryParsePipe = class QueryParsePipe {
|
|
16
|
-
transform(value, metadata) {
|
|
17
|
-
if (metadata.type === 'query') {
|
|
18
|
-
return qs_1.default.parse(value);
|
|
19
|
-
}
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
exports.QueryParsePipe = QueryParsePipe;
|
|
24
|
-
exports.QueryParsePipe = QueryParsePipe = __decorate([
|
|
25
|
-
(0, common_1.Injectable)()
|
|
26
|
-
], QueryParsePipe);
|
|
27
|
-
//# sourceMappingURL=query.parse.pipe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query.parse.pipe.js","sourceRoot":"","sources":["../../src/pipes/query.parse.pipe.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2D;AAC3D,4CAAoB;AAGb,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,SAAS,CAAC,KAAU,EAAE,QAAQ;QAC5B,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC9B,OAAO,YAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AARY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAQ1B"}
|