@promind/honey 1.36.2 → 1.38.0
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +27 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -32
- package/dist/index.js.map +1 -1
- package/dist/module.js +79 -32
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @promind/honey
|
|
2
2
|
|
|
3
|
+
## 1.38.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a896341: add standalone delete route
|
|
8
|
+
|
|
9
|
+
## 1.37.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 660aadb: add support for filter param retrieval location and filter override value callback
|
|
14
|
+
|
|
3
15
|
## 1.36.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -48,13 +48,24 @@ interface Filter {
|
|
|
48
48
|
interface UpdateOpParam {
|
|
49
49
|
[key: string]: OperationParam<UpdateOp> | Record<string, OperationParam<UpdateOp>>;
|
|
50
50
|
}
|
|
51
|
+
type FilterOverrideValue = string | number | boolean | Date | Record<string, any>;
|
|
52
|
+
type FilterLocation = 'query' | 'body' | 'headers' | 'request' | 'params';
|
|
51
53
|
type GetFilterParam = {
|
|
52
54
|
value: 'string' | 'number' | 'boolean' | 'json';
|
|
53
|
-
overrideValue?: string | number | boolean | Date | Record<string, any>;
|
|
54
55
|
operator: FilterOps;
|
|
56
|
+
/**
|
|
57
|
+
* Force a value to be used as filter regardless of request value
|
|
58
|
+
*/
|
|
59
|
+
overrideValue?: FilterOverrideValue;
|
|
60
|
+
/**
|
|
61
|
+
* The location of the filter variable
|
|
62
|
+
*/
|
|
63
|
+
location?: FilterLocation;
|
|
55
64
|
};
|
|
56
65
|
type GetQueryFilter = {
|
|
57
|
-
[key: string]: GetFilterParam
|
|
66
|
+
[key: string]: GetFilterParam;
|
|
67
|
+
} & {
|
|
68
|
+
$or?: Record<string, GetFilterParam>;
|
|
58
69
|
};
|
|
59
70
|
export function runDbQuery(query: string, params?: QueryOptions): Promise<[unknown[], unknown]>;
|
|
60
71
|
export function createModel<TModelAttributes extends {} = any, TCreationAttributes extends {} = TModelAttributes>(modelName: string, attributes: _ModelAttributes1<_Model1<TModelAttributes, TCreationAttributes>>, options?: _ModelOptions1<_Model1<TModelAttributes, TCreationAttributes>> | undefined): ModelStatic<_Model1<TModelAttributes, TCreationAttributes>>;
|
|
@@ -93,6 +104,8 @@ interface CrudParams {
|
|
|
93
104
|
middleware?: Middleware[];
|
|
94
105
|
/** Middleware to run after CRUD controller returns response */
|
|
95
106
|
exitMiddleware?: ExitMiddleware[];
|
|
107
|
+
/** A function that is called to transform your error response data */
|
|
108
|
+
processErrorResponse?: (err: Error) => Error;
|
|
96
109
|
}
|
|
97
110
|
type ICreate = CrudParams & {
|
|
98
111
|
/** Parameters in request body */
|
|
@@ -101,7 +114,6 @@ type ICreate = CrudParams & {
|
|
|
101
114
|
message: string;
|
|
102
115
|
/** A function that is called to transform your response data */
|
|
103
116
|
processResponseData?: (data: any, req: _Request1) => any;
|
|
104
|
-
processErrorResponse?: (err: Error) => Error;
|
|
105
117
|
};
|
|
106
118
|
type IUpdateById = CrudParams & {
|
|
107
119
|
/** Parameters in request body */
|
|
@@ -149,7 +161,6 @@ type IGet = CrudParams & {
|
|
|
149
161
|
};
|
|
150
162
|
/** A function that is called to transform your response data */
|
|
151
163
|
processResponseData?: (data: any, req: _Request1) => any;
|
|
152
|
-
processErrorResponse?: (err: Error) => Error;
|
|
153
164
|
};
|
|
154
165
|
type IGetById = CrudParams & {
|
|
155
166
|
/** Fields to return in the response object */
|
|
@@ -160,7 +171,6 @@ type IGetById = CrudParams & {
|
|
|
160
171
|
filter?: GetQueryFilter;
|
|
161
172
|
/** A function that is called to transform your response data */
|
|
162
173
|
processResponseData?: (data: any, req: _Request1) => any;
|
|
163
|
-
processErrorResponse?: (err: Error) => Error;
|
|
164
174
|
};
|
|
165
175
|
type IDeleteById = CrudParams & {
|
|
166
176
|
/** Response message */
|
|
@@ -170,6 +180,12 @@ type IDeleteById = CrudParams & {
|
|
|
170
180
|
/** Filter builder for WHERE clause */
|
|
171
181
|
filter?: GetQueryFilter;
|
|
172
182
|
};
|
|
183
|
+
type IDelete = CrudParams & {
|
|
184
|
+
/** Response message */
|
|
185
|
+
message: string;
|
|
186
|
+
/** Filter builder for WHERE clause */
|
|
187
|
+
filter?: GetQueryFilter;
|
|
188
|
+
};
|
|
173
189
|
export class Honey {
|
|
174
190
|
express: ExpressApp;
|
|
175
191
|
constructor(express: ExpressApp, postgres: Postgres);
|
|
@@ -180,11 +196,12 @@ export class Honey {
|
|
|
180
196
|
create({ resource, params, message, middleware, pathOverride, exitMiddleware, processResponseData, processErrorResponse, table, methodOverride }: ICreate): void;
|
|
181
197
|
get({ resource, fields, filter, format, middleware, pathOverride, exitMiddleware, methodOverride, processResponseData, processErrorResponse, table }: IGet): void;
|
|
182
198
|
getById({ resource, fields, idField, middleware, pathOverride, exitMiddleware, methodOverride, processResponseData, processErrorResponse, table, filter }: IGetById): void;
|
|
183
|
-
updateById({ resource, params, idField, message, middleware, pathOverride, exitMiddleware, methodOverride, table, filter }: IUpdateById): void;
|
|
184
|
-
update({ resource, params, filter, message, middleware, pathOverride, exitMiddleware, methodOverride, table }: IUpdate): void;
|
|
185
|
-
upsertById({ resource, params, idField, message, middleware, pathOverride, exitMiddleware, methodOverride, table }: IUpsertById): void;
|
|
186
|
-
upsert({ resource, params, message, middleware, pathOverride, exitMiddleware, methodOverride, conflictTarget, table }: IUpsert): void;
|
|
187
|
-
deleteById({ resource, message, middleware, pathOverride, exitMiddleware, methodOverride, idField, filter, table }: IDeleteById): void;
|
|
199
|
+
updateById({ resource, params, idField, message, middleware, pathOverride, exitMiddleware, methodOverride, table, filter, processErrorResponse }: IUpdateById): void;
|
|
200
|
+
update({ resource, params, filter, message, middleware, pathOverride, exitMiddleware, methodOverride, table, processErrorResponse }: IUpdate): void;
|
|
201
|
+
upsertById({ resource, params, idField, message, middleware, pathOverride, exitMiddleware, methodOverride, table, processErrorResponse }: IUpsertById): void;
|
|
202
|
+
upsert({ resource, params, message, middleware, pathOverride, exitMiddleware, methodOverride, conflictTarget, table, processErrorResponse }: IUpsert): void;
|
|
203
|
+
deleteById({ resource, message, middleware, pathOverride, exitMiddleware, methodOverride, idField, filter, table, processErrorResponse }: IDeleteById): void;
|
|
204
|
+
delete({ resource, message, middleware, pathOverride, exitMiddleware, methodOverride, filter, table, processErrorResponse }: IDelete): void;
|
|
188
205
|
}
|
|
189
206
|
export const validateRequestData: (schema: ObjectSchema, location?: 'body' | 'params' | 'query' | 'headers' | 'cookies', options?: ValidationOptions) => Middleware;
|
|
190
207
|
export function createHoney(port: string, dbOptions: string | DBOptions, metadata?: Metadata): Honey;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAEA;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;ACKD;IACE,OAAc,EAAE,EAAE,SAAS,CAAC;IAE5B,OAAc,MAAM,QAAS,MAAM,wBAEjC;gBAEU,OAAO,EAAE,SAAS,GAAG,MAAM;IAIvC,MAAM,KAAK,MAAM,YAEhB;WAEa,WAAW,CACvB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,gBAAgB,MAAM,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EACjD,OAAO,CAAC,EAAE,aAAa,MAAM,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS;CAItD;ACjCD,sBAA+B,SA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AAM,EACN,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,KAAK,EACL,oBAAoB,EACrB,EAAE,OAAO;IAqBH,UAAU,CAAC,EAChB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,KAAK,EACL,oBAAoB,EACrB,EAAE,WAAW;IAqBP,MAAM,CAAC,EACZ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,KAAK,EACL,oBAAoB,EACrB,EAAE,OAAO;IAqBH,UAAU,CAAC,EAChB,QAAQ,EACR,OAAO,EACP,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,OAAO,EACP,MAAM,EACN,KAAK,EACL,oBAAoB,EACrB,EAAE,WAAW;IAqBP,MAAM,CAAC,EACZ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,MAAM,EACN,KAAK,EACL,oBAAoB,EACrB,EAAE,OAAO;CAmBX;AElXD,OAAO,MAAM,8BAED,YAAY,aACV,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,YACpD,iBAAiB,KACzB,UAaF,CAAC;ACLJ,4BACE,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,QAAQ,CAAC,EAAE,QAAQ,SAUpB;AAED,OAAO,MAAM,sCAA6C,CAAC;AAS3D,OAAA,MAAM;;;;;;;CAA4B,CAAC;AAYnC,cAAc,WAAW,CAAC","sources":["src/src/config/database.ts","src/src/config/index.ts","src/src/utils/error.ts","src/src/interfaces/express.ts","src/src/services/express.ts","src/src/controllers/interfaces.ts","src/src/shared/interface.ts","src/src/utils/helpers.ts","src/src/utils/db.ts","src/src/utils/postgres.ts","src/src/services/postgres.ts","src/src/interfaces/crud.ts","src/src/utils/formatter.ts","src/src/controllers/create.ts","src/src/controllers/read.ts","src/src/controllers/update.ts","src/src/controllers/upsert.ts","src/src/controllers/delete.ts","src/src/controllers/index.ts","src/src/services/honey.ts","src/src/utils/port.ts","src/src/utils/validation.ts","src/src/index.ts","src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"import { QueryTypes as QTypes } from 'sequelize';\n\nimport Config from './config';\nimport { DBOptions } from './config/database';\nimport ExpressApp from './services/express';\nimport Honey from './services/honey';\nimport Postgres from './services/postgres';\nimport { normalizePort } from './utils/port';\nimport { Metadata } from './interfaces/express';\n\nprocess.on('SIGINT', () => {\n // process reload ongoing\n // close connections, clear cache, etc\n // by default, you have 1600ms\n process.exit(0);\n});\n\nexport function createHoney(\n port: string,\n dbOptions: string | DBOptions,\n metadata?: Metadata\n) {\n new Config(dbOptions);\n\n const portVal = normalizePort(port || process.env.PORT || '3000');\n const express = new ExpressApp(portVal, metadata);\n const postgres = new Postgres();\n const honey = new Honey(express, postgres);\n\n return honey;\n}\n\nexport const defineModel = Config.defineModel.bind(Config);\n\nfunction getQueryTypes() {\n const { SELECT, INSERT, UPDATE, DELETE, RAW, UPSERT } = QTypes;\n\n const exposedTypes = { SELECT, INSERT, UPDATE, DELETE, RAW, UPSERT };\n return exposedTypes;\n}\n\nconst QueryTypes = getQueryTypes();\n\nexport { QueryTypes };\nexport { default as runDbQuery, createModel } from './utils/db';\nexport { default as HttpError, handleHttpError } from './utils/error';\nexport { default as Honey } from './services/honey';\nexport type {\n Middleware,\n ExitMiddleware,\n Request,\n Response\n} from './interfaces/express';\nexport * from 'sequelize';\nexport { validateRequestData } from './utils/validation';\n"],"names":[],"version":3,"file":"index.d.ts.map","sourceRoot":"../"}
|
package/dist/index.js
CHANGED
|
@@ -246,20 +246,25 @@ const $016b89c2f40cad11$export$3fde508750f4a353 = (body, params)=>{
|
|
|
246
246
|
}, {});
|
|
247
247
|
return result;
|
|
248
248
|
};
|
|
249
|
-
const $016b89c2f40cad11$
|
|
249
|
+
const $016b89c2f40cad11$var$retrieveParamFromLocation = (req, location, key)=>{
|
|
250
|
+
if (location === 'request') return req[key];
|
|
251
|
+
return req[location][key];
|
|
252
|
+
};
|
|
253
|
+
const $016b89c2f40cad11$export$390602d0ccf68ce6 = (filterParams, filter, req)=>{
|
|
250
254
|
const result = {};
|
|
251
255
|
Object.entries(filter).forEach(([key, param])=>{
|
|
252
256
|
if (key === '$or') {
|
|
253
|
-
const val = $016b89c2f40cad11$export$390602d0ccf68ce6(
|
|
254
|
-
// skip missing query params
|
|
255
|
-
if (!Object.keys(val).length) return;
|
|
257
|
+
const val = $016b89c2f40cad11$export$390602d0ccf68ce6(filterParams, param, req);
|
|
256
258
|
result[key] = val;
|
|
257
259
|
} else {
|
|
258
|
-
|
|
259
|
-
if (
|
|
260
|
+
let valueToUse;
|
|
261
|
+
if (param.overrideValue) {
|
|
262
|
+
if (typeof param.overrideValue === 'function') valueToUse = param.overrideValue(req);
|
|
263
|
+
else valueToUse = param.overrideValue;
|
|
264
|
+
} else if (!!param.location) valueToUse = $016b89c2f40cad11$var$retrieveParamFromLocation(req, param.location, key);
|
|
265
|
+
else valueToUse = filterParams[key];
|
|
266
|
+
if (!valueToUse) throw new (0, $2a1659c6c3bea4d7$export$2e2bcd8739ae039)('Missing filter parameter', 400);
|
|
260
267
|
const valueFormatter = $016b89c2f40cad11$var$formatters[param.value];
|
|
261
|
-
if (!valueFormatter) throw new (0, $2a1659c6c3bea4d7$export$2e2bcd8739ae039)('Invalid filter value type', 500);
|
|
262
|
-
const valueToUse = param.overrideValue !== undefined ? param.overrideValue : queryParams[key];
|
|
263
268
|
result[key] = {
|
|
264
269
|
operator: param.operator,
|
|
265
270
|
value: valueFormatter(valueToUse)
|
|
@@ -271,7 +276,7 @@ const $016b89c2f40cad11$export$390602d0ccf68ce6 = (queryParams, filter)=>{
|
|
|
271
276
|
|
|
272
277
|
|
|
273
278
|
function $e6033bad46ade8f8$export$2e2bcd8739ae039({ db: db, resource: resource, params: params, message: message, processResponseData: processResponseData, processErrorResponse: processErrorResponse }) {
|
|
274
|
-
return async (req, res, next)
|
|
279
|
+
return async function(req, res, next) {
|
|
275
280
|
try {
|
|
276
281
|
const body = (0, $016b89c2f40cad11$export$957212fbd899d523)(req.body, params);
|
|
277
282
|
const data = await db.create(resource, body);
|
|
@@ -305,10 +310,10 @@ function $e6033bad46ade8f8$export$2e2bcd8739ae039({ db: db, resource: resource,
|
|
|
305
310
|
|
|
306
311
|
|
|
307
312
|
function $b1328f4a111bb650$export$7b6dde2038c44e91({ db: db, resource: resource, fields: fields, idField: idField = 'id', processResponseData: processResponseData, processErrorResponse: processErrorResponse, filterQuery: filterQuery = {} }) {
|
|
308
|
-
return async (req, res, next)
|
|
313
|
+
return async function(req, res, next) {
|
|
309
314
|
try {
|
|
310
315
|
const id = req.params.id;
|
|
311
|
-
const filter =
|
|
316
|
+
const filter = (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.query, filterQuery, req);
|
|
312
317
|
const data = await db.read(resource, fields, {
|
|
313
318
|
[idField]: {
|
|
314
319
|
value: id,
|
|
@@ -334,7 +339,7 @@ function $b1328f4a111bb650$export$7b6dde2038c44e91({ db: db, resource: resource,
|
|
|
334
339
|
};
|
|
335
340
|
}
|
|
336
341
|
function $b1328f4a111bb650$export$7b48d281d65870ad({ db: db, resource: resource, fields: fields, filterQuery: filterQuery, format: format, processResponseData: processResponseData, processErrorResponse: processErrorResponse }) {
|
|
337
|
-
return async (req, res, next)
|
|
342
|
+
return async function(req, res, next) {
|
|
338
343
|
try {
|
|
339
344
|
const page = Number(req.query.page);
|
|
340
345
|
const limit = Number(req.query.limit);
|
|
@@ -342,7 +347,7 @@ function $b1328f4a111bb650$export$7b48d281d65870ad({ db: db, resource: resource,
|
|
|
342
347
|
page: page || 1,
|
|
343
348
|
limit: limit || 10
|
|
344
349
|
} : undefined;
|
|
345
|
-
const filter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.query, filterQuery);
|
|
350
|
+
const filter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.query, filterQuery, req);
|
|
346
351
|
let data = await db.read(resource, fields, filter, paginate, format);
|
|
347
352
|
let total = 0;
|
|
348
353
|
if (paginate) {
|
|
@@ -384,10 +389,10 @@ function $b1328f4a111bb650$export$7b48d281d65870ad({ db: db, resource: resource,
|
|
|
384
389
|
|
|
385
390
|
|
|
386
391
|
function $1d3f139d2d29337d$export$94bae363557b314a({ db: db, resource: resource, params: params, message: message, idField: idField = 'id', processErrorResponse: processErrorResponse, filterQuery: filterQuery = {} }) {
|
|
387
|
-
return async (req, res, next)
|
|
392
|
+
return async function(req, res, next) {
|
|
388
393
|
try {
|
|
389
394
|
const body = (0, $016b89c2f40cad11$export$3fde508750f4a353)(req.body, params);
|
|
390
|
-
const additionalFilter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.body, filterQuery);
|
|
395
|
+
const additionalFilter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.body, filterQuery, req);
|
|
391
396
|
const filter = {
|
|
392
397
|
[idField]: {
|
|
393
398
|
operator: '=',
|
|
@@ -413,10 +418,10 @@ function $1d3f139d2d29337d$export$94bae363557b314a({ db: db, resource: resource,
|
|
|
413
418
|
};
|
|
414
419
|
}
|
|
415
420
|
function $1d3f139d2d29337d$export$805408382b623838({ db: db, resource: resource, params: params, message: message, filterQuery: filterQuery, processErrorResponse: processErrorResponse }) {
|
|
416
|
-
return async (req, res, next)
|
|
421
|
+
return async function(req, res, next) {
|
|
417
422
|
try {
|
|
418
423
|
const body = (0, $016b89c2f40cad11$export$3fde508750f4a353)(req.body, params);
|
|
419
|
-
const filter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.body, filterQuery);
|
|
424
|
+
const filter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.body, filterQuery, req);
|
|
420
425
|
await db.update(resource, body, filter);
|
|
421
426
|
res.send({
|
|
422
427
|
message: message
|
|
@@ -439,7 +444,7 @@ function $1d3f139d2d29337d$export$805408382b623838({ db: db, resource: resource,
|
|
|
439
444
|
|
|
440
445
|
|
|
441
446
|
function $389a0330ed47be73$export$d5a9f256d3442907({ db: db, resource: resource, params: params, message: message, idField: idField = 'id', processErrorResponse: processErrorResponse }) {
|
|
442
|
-
return async (req, res, next)
|
|
447
|
+
return async function(req, res, next) {
|
|
443
448
|
try {
|
|
444
449
|
req.body[idField] = req.params.id;
|
|
445
450
|
params = {
|
|
@@ -467,7 +472,7 @@ function $389a0330ed47be73$export$d5a9f256d3442907({ db: db, resource: resource,
|
|
|
467
472
|
};
|
|
468
473
|
}
|
|
469
474
|
function $389a0330ed47be73$export$e94809b3c2751b8b({ db: db, resource: resource, params: params, message: message, conflictTarget: conflictTarget, processErrorResponse: processErrorResponse }) {
|
|
470
|
-
return async (req, res, next)
|
|
475
|
+
return async function(req, res, next) {
|
|
471
476
|
try {
|
|
472
477
|
const body = (0, $016b89c2f40cad11$export$3fde508750f4a353)(req.body, params);
|
|
473
478
|
await db.upsert(resource, body, conflictTarget);
|
|
@@ -495,7 +500,7 @@ function $877c51bd1d8c8e63$export$18d25c756727a4e9({ db: db, resource: resource,
|
|
|
495
500
|
return async (req, res, next)=>{
|
|
496
501
|
try {
|
|
497
502
|
const id = req.params[idField || 'id'];
|
|
498
|
-
const filter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.body, filterQuery);
|
|
503
|
+
const filter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.body, filterQuery, req);
|
|
499
504
|
await db.delete(resource, {
|
|
500
505
|
[idField]: {
|
|
501
506
|
value: id,
|
|
@@ -519,8 +524,27 @@ function $877c51bd1d8c8e63$export$18d25c756727a4e9({ db: db, resource: resource,
|
|
|
519
524
|
}
|
|
520
525
|
};
|
|
521
526
|
}
|
|
522
|
-
|
|
523
|
-
|
|
527
|
+
function $877c51bd1d8c8e63$export$4208857769c75f40({ db: db, resource: resource, message: message, processErrorResponse: processErrorResponse, filterQuery: filterQuery }) {
|
|
528
|
+
return async (req, res, next)=>{
|
|
529
|
+
try {
|
|
530
|
+
const filter = filterQuery && (0, $016b89c2f40cad11$export$390602d0ccf68ce6)(req.body, filterQuery, req);
|
|
531
|
+
await db.delete(resource, filter);
|
|
532
|
+
res.send({
|
|
533
|
+
message: message
|
|
534
|
+
});
|
|
535
|
+
next({
|
|
536
|
+
message: message
|
|
537
|
+
});
|
|
538
|
+
} catch (error) {
|
|
539
|
+
if (processErrorResponse) error = processErrorResponse(error);
|
|
540
|
+
(0, $2a1659c6c3bea4d7$export$cd2b46e1ebe8182d)(error, res);
|
|
541
|
+
next({
|
|
542
|
+
...error,
|
|
543
|
+
isError: true
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
}
|
|
524
548
|
|
|
525
549
|
|
|
526
550
|
|
|
@@ -616,7 +640,7 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
616
640
|
exitMiddleware: exitMiddleware
|
|
617
641
|
});
|
|
618
642
|
}
|
|
619
|
-
updateById({ resource: resource, params: params, idField: idField, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, table: table, filter: filter }) {
|
|
643
|
+
updateById({ resource: resource, params: params, idField: idField, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, table: table, filter: filter, processErrorResponse: processErrorResponse }) {
|
|
620
644
|
const path = pathOverride || `/${resource}/:id`;
|
|
621
645
|
resource = table || resource;
|
|
622
646
|
const controller = (0, $1d3f139d2d29337d$export$94bae363557b314a)({
|
|
@@ -625,7 +649,8 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
625
649
|
params: params,
|
|
626
650
|
message: message,
|
|
627
651
|
idField: idField,
|
|
628
|
-
filterQuery: filter
|
|
652
|
+
filterQuery: filter,
|
|
653
|
+
processErrorResponse: processErrorResponse
|
|
629
654
|
});
|
|
630
655
|
this.crud({
|
|
631
656
|
method: methodOverride || 'put',
|
|
@@ -635,7 +660,7 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
635
660
|
exitMiddleware: exitMiddleware
|
|
636
661
|
});
|
|
637
662
|
}
|
|
638
|
-
update({ resource: resource, params: params, filter: filter, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, table: table }) {
|
|
663
|
+
update({ resource: resource, params: params, filter: filter, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, table: table, processErrorResponse: processErrorResponse }) {
|
|
639
664
|
const path = pathOverride || `/${resource}`;
|
|
640
665
|
resource = table || resource;
|
|
641
666
|
const controller = (0, $1d3f139d2d29337d$export$805408382b623838)({
|
|
@@ -643,7 +668,8 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
643
668
|
resource: resource,
|
|
644
669
|
params: params,
|
|
645
670
|
message: message,
|
|
646
|
-
filterQuery: filter
|
|
671
|
+
filterQuery: filter,
|
|
672
|
+
processErrorResponse: processErrorResponse
|
|
647
673
|
});
|
|
648
674
|
this.crud({
|
|
649
675
|
method: methodOverride || 'put',
|
|
@@ -653,7 +679,7 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
653
679
|
exitMiddleware: exitMiddleware
|
|
654
680
|
});
|
|
655
681
|
}
|
|
656
|
-
upsertById({ resource: resource, params: params, idField: idField, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, table: table }) {
|
|
682
|
+
upsertById({ resource: resource, params: params, idField: idField, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, table: table, processErrorResponse: processErrorResponse }) {
|
|
657
683
|
const path = pathOverride || `/${resource}/:id/upsert`;
|
|
658
684
|
resource = table || resource;
|
|
659
685
|
const controller = (0, $389a0330ed47be73$export$d5a9f256d3442907)({
|
|
@@ -661,7 +687,8 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
661
687
|
resource: resource,
|
|
662
688
|
params: params,
|
|
663
689
|
message: message,
|
|
664
|
-
idField: idField
|
|
690
|
+
idField: idField,
|
|
691
|
+
processErrorResponse: processErrorResponse
|
|
665
692
|
});
|
|
666
693
|
this.crud({
|
|
667
694
|
method: methodOverride || 'put',
|
|
@@ -671,7 +698,7 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
671
698
|
exitMiddleware: exitMiddleware
|
|
672
699
|
});
|
|
673
700
|
}
|
|
674
|
-
upsert({ resource: resource, params: params, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, conflictTarget: conflictTarget, table: table }) {
|
|
701
|
+
upsert({ resource: resource, params: params, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, conflictTarget: conflictTarget, table: table, processErrorResponse: processErrorResponse }) {
|
|
675
702
|
const path = pathOverride || `/${resource}/:id/upsert`;
|
|
676
703
|
resource = table || resource;
|
|
677
704
|
const controller = (0, $389a0330ed47be73$export$e94809b3c2751b8b)({
|
|
@@ -679,7 +706,8 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
679
706
|
resource: resource,
|
|
680
707
|
params: params,
|
|
681
708
|
message: message,
|
|
682
|
-
conflictTarget: conflictTarget
|
|
709
|
+
conflictTarget: conflictTarget,
|
|
710
|
+
processErrorResponse: processErrorResponse
|
|
683
711
|
});
|
|
684
712
|
this.crud({
|
|
685
713
|
method: methodOverride || 'put',
|
|
@@ -689,7 +717,7 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
689
717
|
exitMiddleware: exitMiddleware
|
|
690
718
|
});
|
|
691
719
|
}
|
|
692
|
-
deleteById({ resource: resource, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, idField: idField, filter: filter, table: table }) {
|
|
720
|
+
deleteById({ resource: resource, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, idField: idField, filter: filter, table: table, processErrorResponse: processErrorResponse }) {
|
|
693
721
|
const path = pathOverride || `/${resource}/:id`;
|
|
694
722
|
resource = table || resource;
|
|
695
723
|
const controller = (0, $877c51bd1d8c8e63$export$18d25c756727a4e9)({
|
|
@@ -697,7 +725,26 @@ class $e551a6691d3acd09$export$2e2bcd8739ae039 {
|
|
|
697
725
|
resource: resource,
|
|
698
726
|
message: message,
|
|
699
727
|
idField: idField,
|
|
700
|
-
filterQuery: filter
|
|
728
|
+
filterQuery: filter,
|
|
729
|
+
processErrorResponse: processErrorResponse
|
|
730
|
+
});
|
|
731
|
+
this.crud({
|
|
732
|
+
method: methodOverride || 'delete',
|
|
733
|
+
path: path,
|
|
734
|
+
controller: controller,
|
|
735
|
+
middleware: middleware,
|
|
736
|
+
exitMiddleware: exitMiddleware
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
delete({ resource: resource, message: message, middleware: middleware, pathOverride: pathOverride, exitMiddleware: exitMiddleware, methodOverride: methodOverride, filter: filter, table: table, processErrorResponse: processErrorResponse }) {
|
|
740
|
+
const path = pathOverride || `/${resource}/:id`;
|
|
741
|
+
resource = table || resource;
|
|
742
|
+
const controller = (0, $877c51bd1d8c8e63$export$4208857769c75f40)({
|
|
743
|
+
db: this.postgres,
|
|
744
|
+
resource: resource,
|
|
745
|
+
message: message,
|
|
746
|
+
filterQuery: filter,
|
|
747
|
+
processErrorResponse: processErrorResponse
|
|
701
748
|
});
|
|
702
749
|
this.crud({
|
|
703
750
|
method: methodOverride || 'delete',
|