@zola_do/crud 0.2.2 → 0.2.4
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 +130 -1
- package/dist/controller/entity-crud.controller.d.ts +3 -3
- package/dist/controller/entity-crud.controller.js +154 -38
- package/dist/controller/entity-crud.controller.js.map +1 -1
- package/dist/controller/extra-crud.controller.d.ts +3 -3
- package/dist/controller/extra-crud.controller.js +152 -37
- package/dist/controller/extra-crud.controller.js.map +1 -1
- package/dist/controller/relation-crud.controller.d.ts +2 -2
- package/dist/controller/relation-crud.controller.js +126 -28
- package/dist/controller/relation-crud.controller.js.map +1 -1
- package/dist/crud-operation/repository/entity-crud.repository.js +16 -4
- package/dist/crud-operation/repository/entity-crud.repository.js.map +1 -1
- package/dist/crud-operation/repository/extra-crud.repository.js +16 -4
- package/dist/crud-operation/repository/extra-crud.repository.js.map +1 -1
- package/dist/optional/rpc.d.ts +1 -0
- package/dist/optional/rpc.js +18 -0
- package/dist/optional/rpc.js.map +1 -0
- package/dist/repository/index.d.ts +1 -0
- package/dist/repository/index.js +18 -0
- package/dist/repository/index.js.map +1 -0
- package/dist/request-context/index.d.ts +1 -0
- package/dist/request-context/index.js +18 -0
- package/dist/request-context/index.js.map +1 -0
- package/dist/service/entity-crud.service.d.ts +3 -3
- package/dist/service/entity-crud.service.js +126 -35
- package/dist/service/entity-crud.service.js.map +1 -1
- package/dist/service/extra-crud.service.d.ts +2 -2
- package/dist/service/extra-crud.service.js +126 -40
- package/dist/service/extra-crud.service.js.map +1 -1
- package/dist/service/relation-crud.service.js +15 -1
- package/dist/service/relation-crud.service.js.map +1 -1
- package/dist/shared/api-data/api-paginated-response.js +24 -0
- package/dist/shared/api-data/api-paginated-response.js.map +1 -1
- package/dist/shared/api-data/data-response-format.d.ts +6 -0
- package/dist/shared/api-data/data-response-format.js +24 -0
- package/dist/shared/api-data/data-response-format.js.map +1 -1
- package/dist/shared/exceptions/index.d.ts +0 -1
- package/dist/shared/exceptions/index.js +0 -1
- package/dist/shared/exceptions/index.js.map +1 -1
- package/dist/shared/guards/crud-operation-disabled.guard.d.ts +7 -0
- package/dist/shared/guards/crud-operation-disabled.guard.js +16 -0
- package/dist/shared/guards/crud-operation-disabled.guard.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/request-context/apply-create-context.helper.js +17 -4
- package/dist/shared/request-context/apply-create-context.helper.js.map +1 -1
- package/dist/shared/types/crud-option.type.d.ts +83 -12
- package/dist/shared/utils/crud-hooks.helper.d.ts +31 -2
- package/dist/shared/utils/crud-hooks.helper.js +172 -1
- package/dist/shared/utils/crud-hooks.helper.js.map +1 -1
- package/dist/shared/utils/cursor-query.helper.d.ts +6 -0
- package/dist/shared/utils/cursor-query.helper.js +49 -0
- package/dist/shared/utils/cursor-query.helper.js.map +1 -0
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/index.js +1 -0
- package/dist/shared/utils/index.js.map +1 -1
- package/package.json +30 -1
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
export type CrudContextPayload = Record<string, any>;
|
|
2
|
+
export type CrudWherePayload = Record<string, any>;
|
|
3
|
+
export type CrudEntityOperationHookName = 'create' | 'findAll' | 'findOne' | 'update' | 'delete' | 'restore';
|
|
4
|
+
export type CrudAuthorizeResult = boolean | void | Promise<boolean | void>;
|
|
5
|
+
export type CrudHookContext = {
|
|
6
|
+
req?: any;
|
|
7
|
+
params?: Record<string, any>;
|
|
8
|
+
query?: Record<string, any>;
|
|
9
|
+
id?: string;
|
|
10
|
+
itemData?: CrudContextPayload;
|
|
11
|
+
where?: CrudWherePayload;
|
|
12
|
+
entity?: CrudContextPayload;
|
|
13
|
+
result?: any;
|
|
14
|
+
operation: CrudEntityOperationHookName;
|
|
15
|
+
service?: any;
|
|
16
|
+
repository?: any;
|
|
17
|
+
setMeta?: (key: string, value: any) => void;
|
|
18
|
+
getMeta?: <T = any>(key: string) => T | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type CrudOperationHook = (context: CrudHookContext) => void | Partial<CrudContextPayload> | {
|
|
21
|
+
itemData?: Partial<CrudContextPayload>;
|
|
22
|
+
where?: Partial<CrudWherePayload>;
|
|
23
|
+
result?: any;
|
|
24
|
+
entity?: Partial<CrudContextPayload>;
|
|
25
|
+
} | Promise<void | Partial<CrudContextPayload> | {
|
|
26
|
+
itemData?: Partial<CrudContextPayload>;
|
|
27
|
+
where?: Partial<CrudWherePayload>;
|
|
28
|
+
result?: any;
|
|
29
|
+
entity?: Partial<CrudContextPayload>;
|
|
30
|
+
}>;
|
|
31
|
+
export type CrudAuthorizeHook = (context: CrudHookContext) => CrudAuthorizeResult;
|
|
32
|
+
export type CrudOperationAuthorizeHook = (context: CrudHookContext) => CrudAuthorizeResult;
|
|
2
33
|
export type CrudCreateContextHook = (params: {
|
|
3
34
|
itemData: CrudContextPayload;
|
|
4
35
|
req?: any;
|
|
@@ -17,6 +48,15 @@ export type CrudWriteFilterOptions = {
|
|
|
17
48
|
allowedWriteFields?: string[];
|
|
18
49
|
blockedWriteFields?: string[];
|
|
19
50
|
};
|
|
51
|
+
export type CrudDeleteMode = 'auto' | 'soft' | 'hard';
|
|
52
|
+
export type CrudEndpointDisableMode = 'hide' | 'block';
|
|
53
|
+
export type CrudEndpointDisableConfig = CrudEndpointDisableMode | {
|
|
54
|
+
mode: CrudEndpointDisableMode;
|
|
55
|
+
reason?: string;
|
|
56
|
+
};
|
|
57
|
+
export type CrudEntityOperationName = 'create' | 'findAll' | 'findOne' | 'update' | 'delete' | 'restore' | 'findAllArchived';
|
|
58
|
+
export type CrudExtraOperationName = CrudEntityOperationName;
|
|
59
|
+
export type CrudRelationOperationName = 'bulkSaveFirst' | 'bulkSaveSecond' | 'findAllFirst' | 'findAllSecond';
|
|
20
60
|
export type EntityCrudOptions = {
|
|
21
61
|
createDto?: {
|
|
22
62
|
new (): NonNullable<unknown>;
|
|
@@ -34,14 +74,29 @@ export type EntityCrudOptions = {
|
|
|
34
74
|
mapUpdateContext?: CrudUpdateContextHook;
|
|
35
75
|
allowedWriteFields?: string[];
|
|
36
76
|
blockedWriteFields?: string[];
|
|
37
|
-
beforeCreate?: CrudMutationHook;
|
|
38
|
-
afterCreate?: CrudMutationHook;
|
|
39
|
-
|
|
40
|
-
|
|
77
|
+
beforeCreate?: CrudMutationHook | CrudOperationHook;
|
|
78
|
+
afterCreate?: CrudMutationHook | CrudOperationHook;
|
|
79
|
+
beforeFindAll?: CrudOperationHook;
|
|
80
|
+
afterFindAll?: CrudOperationHook;
|
|
81
|
+
beforeFindOne?: CrudOperationHook;
|
|
82
|
+
afterFindOne?: CrudOperationHook;
|
|
83
|
+
beforeUpdate?: CrudMutationHook | CrudOperationHook;
|
|
84
|
+
afterUpdate?: CrudMutationHook | CrudOperationHook;
|
|
85
|
+
beforeDelete?: CrudOperationHook;
|
|
86
|
+
afterDelete?: CrudOperationHook;
|
|
41
87
|
beforeSoftDelete?: CrudMutationHook;
|
|
42
88
|
afterSoftDelete?: CrudMutationHook;
|
|
43
|
-
|
|
44
|
-
|
|
89
|
+
deleteMode?: CrudDeleteMode;
|
|
90
|
+
beforeRestore?: CrudMutationHook | CrudOperationHook;
|
|
91
|
+
afterRestore?: CrudMutationHook | CrudOperationHook;
|
|
92
|
+
authorize?: CrudAuthorizeHook;
|
|
93
|
+
canCreate?: CrudOperationAuthorizeHook;
|
|
94
|
+
canFindAll?: CrudOperationAuthorizeHook;
|
|
95
|
+
canFindOne?: CrudOperationAuthorizeHook;
|
|
96
|
+
canUpdate?: CrudOperationAuthorizeHook;
|
|
97
|
+
canDelete?: CrudOperationAuthorizeHook;
|
|
98
|
+
canRestore?: CrudOperationAuthorizeHook;
|
|
99
|
+
operations?: Partial<Record<CrudEntityOperationName, CrudEndpointDisableConfig>>;
|
|
45
100
|
};
|
|
46
101
|
export type ExtraCrudOptions = {
|
|
47
102
|
entityIdName: string;
|
|
@@ -61,14 +116,29 @@ export type ExtraCrudOptions = {
|
|
|
61
116
|
mapUpdateContext?: CrudUpdateContextHook;
|
|
62
117
|
allowedWriteFields?: string[];
|
|
63
118
|
blockedWriteFields?: string[];
|
|
64
|
-
beforeCreate?: CrudMutationHook;
|
|
65
|
-
afterCreate?: CrudMutationHook;
|
|
66
|
-
|
|
67
|
-
|
|
119
|
+
beforeCreate?: CrudMutationHook | CrudOperationHook;
|
|
120
|
+
afterCreate?: CrudMutationHook | CrudOperationHook;
|
|
121
|
+
beforeFindAll?: CrudOperationHook;
|
|
122
|
+
afterFindAll?: CrudOperationHook;
|
|
123
|
+
beforeFindOne?: CrudOperationHook;
|
|
124
|
+
afterFindOne?: CrudOperationHook;
|
|
125
|
+
beforeUpdate?: CrudMutationHook | CrudOperationHook;
|
|
126
|
+
afterUpdate?: CrudMutationHook | CrudOperationHook;
|
|
127
|
+
beforeDelete?: CrudOperationHook;
|
|
128
|
+
afterDelete?: CrudOperationHook;
|
|
68
129
|
beforeSoftDelete?: CrudMutationHook;
|
|
69
130
|
afterSoftDelete?: CrudMutationHook;
|
|
70
|
-
|
|
71
|
-
|
|
131
|
+
deleteMode?: CrudDeleteMode;
|
|
132
|
+
beforeRestore?: CrudMutationHook | CrudOperationHook;
|
|
133
|
+
afterRestore?: CrudMutationHook | CrudOperationHook;
|
|
134
|
+
authorize?: CrudAuthorizeHook;
|
|
135
|
+
canCreate?: CrudOperationAuthorizeHook;
|
|
136
|
+
canFindAll?: CrudOperationAuthorizeHook;
|
|
137
|
+
canFindOne?: CrudOperationAuthorizeHook;
|
|
138
|
+
canUpdate?: CrudOperationAuthorizeHook;
|
|
139
|
+
canDelete?: CrudOperationAuthorizeHook;
|
|
140
|
+
canRestore?: CrudOperationAuthorizeHook;
|
|
141
|
+
operations?: Partial<Record<CrudExtraOperationName, CrudEndpointDisableConfig>>;
|
|
72
142
|
};
|
|
73
143
|
export interface RelationCrudOptions {
|
|
74
144
|
firstEntityIdName: string;
|
|
@@ -87,4 +157,5 @@ export interface RelationCrudOptions {
|
|
|
87
157
|
afterAssignFirst?: CrudMutationHook;
|
|
88
158
|
beforeAssignSecond?: CrudMutationHook;
|
|
89
159
|
afterAssignSecond?: CrudMutationHook;
|
|
160
|
+
operations?: Partial<Record<CrudRelationOperationName, CrudEndpointDisableConfig>>;
|
|
90
161
|
}
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CollectionQuery } from '@zola_do/collection-query';
|
|
2
|
+
import { CrudContextPayload, CrudEntityOperationHookName, CrudHookContext, CrudWherePayload, CrudWriteFilterOptions, EntityCrudOptions, ExtraCrudOptions } from '../types';
|
|
3
|
+
import { CrudRequestContextResolver } from '../request-context';
|
|
4
|
+
type HookName = 'beforeCreate' | 'afterCreate' | 'beforeFindAll' | 'afterFindAll' | 'beforeFindOne' | 'afterFindOne' | 'beforeUpdate' | 'afterUpdate' | 'beforeDelete' | 'afterDelete' | 'beforeSoftDelete' | 'afterSoftDelete' | 'beforeRestore' | 'afterRestore' | 'beforeAssignFirst' | 'afterAssignFirst' | 'beforeAssignSecond' | 'afterAssignSecond';
|
|
3
5
|
export declare const runCrudHook: (options: Record<string, any> | undefined, hookName: HookName, params: {
|
|
4
6
|
id?: string;
|
|
5
7
|
itemData?: CrudContextPayload;
|
|
6
8
|
entity?: CrudContextPayload;
|
|
7
9
|
req?: any;
|
|
8
10
|
}) => Promise<void>;
|
|
11
|
+
type CreateOptions = EntityCrudOptions | ExtraCrudOptions | undefined;
|
|
12
|
+
type EntityOptions = EntityCrudOptions | ExtraCrudOptions | undefined;
|
|
13
|
+
export declare const createCrudHookContext: (params: {
|
|
14
|
+
operation: CrudEntityOperationHookName;
|
|
15
|
+
req?: any;
|
|
16
|
+
params?: Record<string, any>;
|
|
17
|
+
query?: Record<string, any>;
|
|
18
|
+
id?: string;
|
|
19
|
+
itemData?: CrudContextPayload;
|
|
20
|
+
where?: CrudWherePayload;
|
|
21
|
+
entity?: CrudContextPayload;
|
|
22
|
+
result?: any;
|
|
23
|
+
service?: any;
|
|
24
|
+
repository?: any;
|
|
25
|
+
}) => CrudHookContext;
|
|
26
|
+
export declare const runBeforeOperationHooks: (options: EntityOptions, context: CrudHookContext) => Promise<void>;
|
|
27
|
+
export declare const runAfterOperationHooks: (options: EntityOptions, context: CrudHookContext) => Promise<void>;
|
|
28
|
+
export declare const runOperationAuthorization: (options: EntityOptions, context: CrudHookContext) => Promise<void>;
|
|
29
|
+
export declare const applyWhereToCollectionQuery: (query: CollectionQuery, where?: CrudWherePayload) => void;
|
|
30
|
+
export declare const runBeforeCreatePipeline: (params: {
|
|
31
|
+
itemData: CrudContextPayload;
|
|
32
|
+
req?: any;
|
|
33
|
+
options?: CreateOptions;
|
|
34
|
+
resolver?: CrudRequestContextResolver;
|
|
35
|
+
service?: any;
|
|
36
|
+
repository?: any;
|
|
37
|
+
}) => Promise<void>;
|
|
9
38
|
export declare const sanitizeWritePayload: (itemData: CrudContextPayload, options?: CrudWriteFilterOptions) => CrudContextPayload;
|
|
10
39
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sanitizeWritePayload = exports.runCrudHook = void 0;
|
|
3
|
+
exports.sanitizeWritePayload = exports.runBeforeCreatePipeline = exports.applyWhereToCollectionQuery = exports.runOperationAuthorization = exports.runAfterOperationHooks = exports.runBeforeOperationHooks = exports.createCrudHookContext = exports.runCrudHook = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
|
+
const collection_query_1 = require("@zola_do/collection-query");
|
|
6
|
+
const request_context_1 = require("../request-context");
|
|
5
7
|
const mergeHookResult = (payload, hookResult) => {
|
|
6
8
|
if (!payload || !hookResult || typeof hookResult !== 'object') {
|
|
7
9
|
return;
|
|
@@ -17,6 +19,175 @@ const runCrudHook = async (options, hookName, params) => {
|
|
|
17
19
|
mergeHookResult(params.itemData, hookResult);
|
|
18
20
|
};
|
|
19
21
|
exports.runCrudHook = runCrudHook;
|
|
22
|
+
const OPERATION_HOOK_NAMES = {
|
|
23
|
+
create: {
|
|
24
|
+
before: ['beforeCreate'],
|
|
25
|
+
after: ['afterCreate'],
|
|
26
|
+
can: 'canCreate',
|
|
27
|
+
},
|
|
28
|
+
findAll: {
|
|
29
|
+
before: ['beforeFindAll'],
|
|
30
|
+
after: ['afterFindAll'],
|
|
31
|
+
can: 'canFindAll',
|
|
32
|
+
},
|
|
33
|
+
findOne: {
|
|
34
|
+
before: ['beforeFindOne'],
|
|
35
|
+
after: ['afterFindOne'],
|
|
36
|
+
can: 'canFindOne',
|
|
37
|
+
},
|
|
38
|
+
update: {
|
|
39
|
+
before: ['beforeUpdate'],
|
|
40
|
+
after: ['afterUpdate'],
|
|
41
|
+
can: 'canUpdate',
|
|
42
|
+
},
|
|
43
|
+
delete: {
|
|
44
|
+
before: ['beforeSoftDelete', 'beforeDelete'],
|
|
45
|
+
after: ['afterSoftDelete', 'afterDelete'],
|
|
46
|
+
can: 'canDelete',
|
|
47
|
+
},
|
|
48
|
+
restore: {
|
|
49
|
+
before: ['beforeRestore'],
|
|
50
|
+
after: ['afterRestore'],
|
|
51
|
+
can: 'canRestore',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
const hasOperationHookResultKeys = (value) => 'itemData' in value ||
|
|
55
|
+
'where' in value ||
|
|
56
|
+
'entity' in value ||
|
|
57
|
+
'result' in value;
|
|
58
|
+
const mergeOperationHookResult = (context, hookResult) => {
|
|
59
|
+
if (!hookResult || typeof hookResult !== 'object') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const isOperationShape = hasOperationHookResultKeys(hookResult);
|
|
63
|
+
if (hookResult.itemData && context.itemData) {
|
|
64
|
+
Object.assign(context.itemData, hookResult.itemData);
|
|
65
|
+
}
|
|
66
|
+
if (hookResult.where) {
|
|
67
|
+
context.where = context.where || {};
|
|
68
|
+
Object.assign(context.where, hookResult.where);
|
|
69
|
+
}
|
|
70
|
+
if (hookResult.entity && context.entity) {
|
|
71
|
+
Object.assign(context.entity, hookResult.entity);
|
|
72
|
+
}
|
|
73
|
+
if ('result' in hookResult) {
|
|
74
|
+
context.result = hookResult.result;
|
|
75
|
+
}
|
|
76
|
+
if (isOperationShape) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (context.itemData) {
|
|
80
|
+
Object.assign(context.itemData, hookResult);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (context.where) {
|
|
84
|
+
Object.assign(context.where, hookResult);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (context.entity) {
|
|
88
|
+
Object.assign(context.entity, hookResult);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const createCrudHookContext = (params) => {
|
|
92
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
93
|
+
const meta = new Map();
|
|
94
|
+
return {
|
|
95
|
+
operation: params.operation,
|
|
96
|
+
req: params.req,
|
|
97
|
+
params: (_c = (_a = params.params) !== null && _a !== void 0 ? _a : (_b = params.req) === null || _b === void 0 ? void 0 : _b.params) !== null && _c !== void 0 ? _c : {},
|
|
98
|
+
query: (_f = (_d = params.query) !== null && _d !== void 0 ? _d : (_e = params.req) === null || _e === void 0 ? void 0 : _e.query) !== null && _f !== void 0 ? _f : {},
|
|
99
|
+
id: params.id,
|
|
100
|
+
itemData: params.itemData,
|
|
101
|
+
where: (_g = params.where) !== null && _g !== void 0 ? _g : {},
|
|
102
|
+
entity: params.entity,
|
|
103
|
+
result: params.result,
|
|
104
|
+
service: params.service,
|
|
105
|
+
repository: params.repository,
|
|
106
|
+
setMeta: (key, value) => {
|
|
107
|
+
meta.set(key, value);
|
|
108
|
+
},
|
|
109
|
+
getMeta: (key) => meta.get(key),
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
exports.createCrudHookContext = createCrudHookContext;
|
|
113
|
+
const runOperationHook = async (options, hookName, context) => {
|
|
114
|
+
const hook = options === null || options === void 0 ? void 0 : options[hookName];
|
|
115
|
+
if (!hook) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const hookResult = await hook(context);
|
|
119
|
+
mergeOperationHookResult(context, hookResult);
|
|
120
|
+
};
|
|
121
|
+
const runBeforeOperationHooks = async (options, context) => {
|
|
122
|
+
const hookNames = OPERATION_HOOK_NAMES[context.operation].before;
|
|
123
|
+
for (const hookName of hookNames) {
|
|
124
|
+
await runOperationHook(options, hookName, context);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
exports.runBeforeOperationHooks = runBeforeOperationHooks;
|
|
128
|
+
const runAfterOperationHooks = async (options, context) => {
|
|
129
|
+
const hookNames = OPERATION_HOOK_NAMES[context.operation].after;
|
|
130
|
+
for (const hookName of hookNames) {
|
|
131
|
+
await runOperationHook(options, hookName, context);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
exports.runAfterOperationHooks = runAfterOperationHooks;
|
|
135
|
+
const assertAuthorized = (allowed) => {
|
|
136
|
+
if (allowed === false) {
|
|
137
|
+
throw new common_1.ForbiddenException('crud_operation_forbidden');
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const runOperationAuthorization = async (options, context) => {
|
|
141
|
+
const authorize = options === null || options === void 0 ? void 0 : options.authorize;
|
|
142
|
+
if (authorize) {
|
|
143
|
+
const allowed = await authorize(context);
|
|
144
|
+
assertAuthorized(allowed);
|
|
145
|
+
}
|
|
146
|
+
const canKey = OPERATION_HOOK_NAMES[context.operation].can;
|
|
147
|
+
const canHook = canKey
|
|
148
|
+
? options === null || options === void 0 ? void 0 : options[canKey]
|
|
149
|
+
: undefined;
|
|
150
|
+
if (!canHook) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const allowed = await canHook(context);
|
|
154
|
+
assertAuthorized(allowed);
|
|
155
|
+
};
|
|
156
|
+
exports.runOperationAuthorization = runOperationAuthorization;
|
|
157
|
+
const applyWhereToCollectionQuery = (query, where) => {
|
|
158
|
+
if (!where || typeof where !== 'object') {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const whereEntries = Object.entries(where).filter(([, value]) => value !== undefined);
|
|
162
|
+
if (whereEntries.length === 0) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
query.where = query.where || [];
|
|
166
|
+
query.where.push(whereEntries.map(([column, value]) => ({
|
|
167
|
+
column,
|
|
168
|
+
value,
|
|
169
|
+
operator: collection_query_1.FilterOperators.EqualTo,
|
|
170
|
+
})));
|
|
171
|
+
};
|
|
172
|
+
exports.applyWhereToCollectionQuery = applyWhereToCollectionQuery;
|
|
173
|
+
const runBeforeCreatePipeline = async (params) => {
|
|
174
|
+
const { itemData, req, options, resolver, service, repository } = params;
|
|
175
|
+
await (0, request_context_1.applyCreateContext)({
|
|
176
|
+
itemData,
|
|
177
|
+
req,
|
|
178
|
+
options,
|
|
179
|
+
resolver,
|
|
180
|
+
});
|
|
181
|
+
const context = (0, exports.createCrudHookContext)({
|
|
182
|
+
operation: 'create',
|
|
183
|
+
req,
|
|
184
|
+
itemData,
|
|
185
|
+
service,
|
|
186
|
+
repository,
|
|
187
|
+
});
|
|
188
|
+
await (0, exports.runBeforeOperationHooks)(options, context);
|
|
189
|
+
};
|
|
190
|
+
exports.runBeforeCreatePipeline = runBeforeCreatePipeline;
|
|
20
191
|
const hasAllowedFields = (allowedWriteFields) => Array.isArray(allowedWriteFields) && allowedWriteFields.length > 0;
|
|
21
192
|
const sanitizeWritePayload = (itemData, options) => {
|
|
22
193
|
if (!itemData || typeof itemData !== 'object') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud-hooks.helper.js","sourceRoot":"","sources":["../../../src/shared/utils/crud-hooks.helper.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"crud-hooks.helper.js","sourceRoot":"","sources":["../../../src/shared/utils/crud-hooks.helper.ts"],"names":[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IAC1D,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kBAAkB,KAAI,EAAE,CAAC,CAAC;IAEtE,KAAK,MAAM,YAAY,IAAI,kBAAkB,EAAE,CAAC;QAC9C,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,CAAC,gBAAgB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kBAAkB,CAAC,EAAE,CAAC;QACnD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kBAAkB,KAAI,EAAE,CAAC,CAAC;IAEjE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AA5BW,QAAA,oBAAoB,wBA4B/B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeCursorQueryParams = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const parseLimit = (limit) => {
|
|
6
|
+
if (limit === undefined || limit === null || limit === '') {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const parsed = parseInt(limit, 10);
|
|
10
|
+
if (Number.isNaN(parsed) || parsed < 1) {
|
|
11
|
+
throw new common_1.BadRequestException('limit must be a positive integer');
|
|
12
|
+
}
|
|
13
|
+
return parsed;
|
|
14
|
+
};
|
|
15
|
+
const parseDirection = (direction) => {
|
|
16
|
+
if (!direction) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
if (direction === 'next' || direction === 'n') {
|
|
20
|
+
return 'n';
|
|
21
|
+
}
|
|
22
|
+
if (direction === 'prev' || direction === 'p') {
|
|
23
|
+
return 'p';
|
|
24
|
+
}
|
|
25
|
+
throw new common_1.BadRequestException('direction must be one of n, p, next, prev');
|
|
26
|
+
};
|
|
27
|
+
const mergeCursorQueryParams = (query, params) => {
|
|
28
|
+
const merged = Object.assign({}, query);
|
|
29
|
+
const hasPlainParams = params.cursor !== undefined ||
|
|
30
|
+
params.limit !== undefined ||
|
|
31
|
+
params.direction !== undefined;
|
|
32
|
+
if (params.cursor !== undefined) {
|
|
33
|
+
merged.cursor = params.cursor || undefined;
|
|
34
|
+
}
|
|
35
|
+
const parsedLimit = parseLimit(params.limit);
|
|
36
|
+
if (parsedLimit !== undefined) {
|
|
37
|
+
merged.take = parsedLimit;
|
|
38
|
+
}
|
|
39
|
+
const parsedDirection = parseDirection(params.direction);
|
|
40
|
+
if (parsedDirection !== undefined) {
|
|
41
|
+
merged.cursorDirection = parsedDirection;
|
|
42
|
+
}
|
|
43
|
+
if (hasPlainParams && !merged.cursorDirection) {
|
|
44
|
+
merged.cursorDirection = 'n';
|
|
45
|
+
}
|
|
46
|
+
return merged;
|
|
47
|
+
};
|
|
48
|
+
exports.mergeCursorQueryParams = mergeCursorQueryParams;
|
|
49
|
+
//# sourceMappingURL=cursor-query.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-query.helper.js","sourceRoot":"","sources":["../../../src/shared/utils/cursor-query.helper.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AAQrD,MAAM,UAAU,GAAG,CAAC,KAAc,EAAsB,EAAE;IACxD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,SAAS,CAAC;IACnB,CAA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AAC,SAAS,CAAC,CAAC;IACzD,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IAED,IAAI,cAAc,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;QAC9C,MAAM,CAAC,eAAe,GAAG,GAAG,CAAC;IAC/B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AApCW,QAAA,sBAAsB,0BAoCjC"}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./numeric.transformer"), exports);
|
|
18
18
|
__exportStar(require("./validate-dto"), exports);
|
|
19
19
|
__exportStar(require("./crud-hooks.helper"), exports);
|
|
20
|
+
__exportStar(require("./cursor-query.helper"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,iDAA+B;AAC/B,sDAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,iDAA+B;AAC/B,sDAAoC;AACpC,wDAAsC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zola_do/crud",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Generic CRUD controllers and services for NestJS",
|
|
5
5
|
"author": "zolaDO",
|
|
6
6
|
"license": "ISC",
|
|
@@ -18,6 +18,31 @@
|
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"require": "./dist/index.js",
|
|
20
20
|
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./controller": {
|
|
23
|
+
"types": "./dist/controller/index.d.ts",
|
|
24
|
+
"require": "./dist/controller/index.js",
|
|
25
|
+
"default": "./dist/controller/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./service": {
|
|
28
|
+
"types": "./dist/service/index.d.ts",
|
|
29
|
+
"require": "./dist/service/index.js",
|
|
30
|
+
"default": "./dist/service/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./repository": {
|
|
33
|
+
"types": "./dist/repository/index.d.ts",
|
|
34
|
+
"require": "./dist/repository/index.js",
|
|
35
|
+
"default": "./dist/repository/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./request-context": {
|
|
38
|
+
"types": "./dist/request-context/index.d.ts",
|
|
39
|
+
"require": "./dist/request-context/index.js",
|
|
40
|
+
"default": "./dist/request-context/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./optional/rpc": {
|
|
43
|
+
"types": "./dist/optional/rpc.d.ts",
|
|
44
|
+
"require": "./dist/optional/rpc.js",
|
|
45
|
+
"default": "./dist/optional/rpc.js"
|
|
21
46
|
}
|
|
22
47
|
},
|
|
23
48
|
"files": [
|
|
@@ -32,6 +57,7 @@
|
|
|
32
57
|
},
|
|
33
58
|
"peerDependencies": {
|
|
34
59
|
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
60
|
+
"@nestjs/microservices": "^10.0.0 || ^11.0.0",
|
|
35
61
|
"@nestjs/swagger": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
36
62
|
"@nestjs/typeorm": "^10.0.0 || ^11.0.0",
|
|
37
63
|
"class-validator": "^0.14.2 || ^0.15.1",
|
|
@@ -41,6 +67,9 @@
|
|
|
41
67
|
"typeorm-extension": "^3.7.1"
|
|
42
68
|
},
|
|
43
69
|
"peerDependenciesMeta": {
|
|
70
|
+
"@nestjs/microservices": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
44
73
|
"@nestjs/swagger": {
|
|
45
74
|
"optional": true
|
|
46
75
|
}
|