codehooks-js 1.1.11 → 1.2.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/README.md +77 -7
- package/aggregation/index.mjs +9 -2
- package/index.js +129 -93
- package/package.json +5 -2
- package/tsconfig.json +22 -0
- package/types/aggregation/index.d.mts +43 -0
- package/types/aggregation/index.d.mts.map +1 -0
- package/types/coderunner.d.mts +2 -0
- package/types/coderunner.d.mts.map +1 -0
- package/types/cronjob.d.mts +2 -0
- package/types/cronjob.d.mts.map +1 -0
- package/types/crudlify/index.d.mts +11 -0
- package/types/crudlify/index.d.mts.map +1 -0
- package/types/crudlify/lib/eventhooks.d.mts +56 -0
- package/types/crudlify/lib/eventhooks.d.mts.map +1 -0
- package/types/crudlify/lib/query/q2m/index.d.mts +15 -0
- package/types/crudlify/lib/query/q2m/index.d.mts.map +1 -0
- package/types/crudlify/lib/query/q2m/q2m.d.mts +11 -0
- package/types/crudlify/lib/query/q2m/q2m.d.mts.map +1 -0
- package/types/crudlify/lib/schema/json-schema/index.d.mts +4 -0
- package/types/crudlify/lib/schema/json-schema/index.d.mts.map +1 -0
- package/types/crudlify/lib/schema/yup/index.d.mts +4 -0
- package/types/crudlify/lib/schema/yup/index.d.mts.map +1 -0
- package/types/crudlify/lib/schema/zod/index.d.mts +4 -0
- package/types/crudlify/lib/schema/zod/index.d.mts.map +1 -0
- package/types/index.d.ts +681 -0
- package/types/index.d.ts.map +1 -0
- package/types/webserver.d.mts +3 -0
- package/types/webserver.d.mts.map +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {object} app - Codehooks app ( npm package codehooks-js)
|
|
4
|
+
* @param {object} schema - Yup schema object
|
|
5
|
+
* @param {object} options - Options
|
|
6
|
+
* @returns {EventHooks} Hooks for REST operations
|
|
7
|
+
*/
|
|
8
|
+
export default function crudlify(app: object, schema?: object, options?: object): EventHooks;
|
|
9
|
+
import { EventHooks } from "./lib/eventhooks.mjs";
|
|
10
|
+
export function setDatastore(ds: any): void;
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../crudlify/index.mjs"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,sCALW,MAAM,WACN,MAAM,YACN,MAAM,GACJ,UAAU,CA0EtB;2BAhG0B,sBAAsB;AAoGjD,4CAEC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Middleware to add function hooks pre/post CRUD database operations
|
|
3
|
+
*/
|
|
4
|
+
export class EventHooks {
|
|
5
|
+
listeners: {};
|
|
6
|
+
/**
|
|
7
|
+
* Before hook
|
|
8
|
+
* @param {*} coll
|
|
9
|
+
* @param {*} verb
|
|
10
|
+
* @param {*} data
|
|
11
|
+
*/
|
|
12
|
+
fireBefore(coll: any, verb: any, data: any): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* After hook
|
|
15
|
+
* @param {*} coll
|
|
16
|
+
* @param {*} verb
|
|
17
|
+
* @param {*} data
|
|
18
|
+
*/
|
|
19
|
+
fireAfter(coll: any, verb: any, data: any): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Codehook called before data is updated in database
|
|
22
|
+
* @param {*} coll
|
|
23
|
+
* @param {*} func
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
beforePUT(coll: any, func: any): this;
|
|
27
|
+
/**
|
|
28
|
+
* Codehook called before data is inserted into database
|
|
29
|
+
* @param {*} coll
|
|
30
|
+
* @param {*} func
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
beforePOST(coll: any, func: any): this;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param {*} coll
|
|
37
|
+
* @param {*} func
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
afterPOST(coll: any, func: any): this;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param {*} coll
|
|
44
|
+
* @param {*} func
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
beforePATCH(coll: any, func: any): this;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param {*} coll
|
|
51
|
+
* @param {*} func
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
beforeDELETE(coll: any, func: any): this;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=eventhooks.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventhooks.d.mts","sourceRoot":"","sources":["../../../crudlify/lib/eventhooks.mjs"],"names":[],"mappings":"AACA;;GAEG;AACH;IAEQ,cAAmB;IAGvB;;;;;OAKG;IACH,2DAOC;IAED;;;;;OAKG;IACH,0DAQC;IACD;;;;;OAKG;IACH,sCAIC;IAED;;;;;OAKG;IACH,uCAIC;IACD;;;;;OAKG;IACH,sCAIC;IAED;;;;;OAKG;IACH,wCAIC;IACD;;;;;OAKG;IACH,yCAIC;CACJ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert request query to mongoDB query by query-to-mongo lib
|
|
3
|
+
* @param {*} query
|
|
4
|
+
* @param {*} headers
|
|
5
|
+
* @returns Object
|
|
6
|
+
*/
|
|
7
|
+
export function getMongoQuery(query: any, headers: any): {
|
|
8
|
+
filter: any;
|
|
9
|
+
hints: any;
|
|
10
|
+
aggregate: any;
|
|
11
|
+
limit: any;
|
|
12
|
+
offset: any;
|
|
13
|
+
fields: any;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../../crudlify/lib/query/q2m/index.mjs"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH;;;;;;;EAsCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"q2m.d.mts","sourceRoot":"","sources":["../../../../../crudlify/lib/query/q2m/q2m.mjs"],"names":[],"mappings":"AA+MA;;;;;;;;;EAyDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../../crudlify/lib/schema/json-schema/index.mjs"],"names":[],"mappings":"AAUO,iFAWN;AAUM,sDAGN;AAEM,yDAIN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../../crudlify/lib/schema/yup/index.mjs"],"names":[],"mappings":"AAQO,0DAIN;AAEM,sDAGN;AAEM,2CAGN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../../crudlify/lib/schema/zod/index.mjs"],"names":[],"mappings":"AAQO,mEASN;AAEM,sDAGN;AAEM,2CAGN"}
|