codehooks-js 1.1.10 → 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.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Persistent NoSql and Kev-Value datastore
3
+ * @typedef {Object} DataStream
4
+ * @property {function(string, function(*)):void} on - Emits data, stream.on('data', (data) => //console.debug(data))
5
+ * @property {function(httpResponse):void} json - Pipe datastream to JSON output
6
+ * @property {function():Promise.<object[]>} toArray - Return an array of objects
7
+ */
8
+ /**
9
+ *
10
+ * @param {DataStream} readable - JSON stream
11
+ * @param {Object} spec - JSON aggregation spec
12
+ * @returns {Promise} with aggregation result
13
+ * @example
14
+ * Spec JSON example:
15
+ * {
16
+ * "$max": {$field: "open", $label: "Open"},
17
+ "$group": {
18
+ "$field": "Ticker",
19
+ $label: "Symbol",
20
+ "$max": "high",
21
+ "$min": {$field: "close", $label: "Low"}
22
+ }
23
+ }
24
+ */
25
+ export function agg(readable: DataStream, spec: any): Promise<any>;
26
+ /**
27
+ * Persistent NoSql and Kev-Value datastore
28
+ */
29
+ export type DataStream = {
30
+ /**
31
+ * - Emits data, stream.on('data', (data) => //console.debug(data))
32
+ */
33
+ on: (arg0: string, arg1: (arg0: any) => any) => void;
34
+ /**
35
+ * - Pipe datastream to JSON output
36
+ */
37
+ json: (arg0: httpResponse) => void;
38
+ /**
39
+ * - Return an array of objects
40
+ */
41
+ toArray: () => Promise<object[]>;
42
+ };
43
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../aggregation/index.mjs"],"names":[],"mappings":"AACA;;;;;;EAME;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,8BAfW,UAAU,2BAsCpB;;;;;;;;eA7CqB,MAAM,+BAAe,IAAI;;;;kCACX,IAAI;;;;mBAChB,QAAS,MAAM,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function execAll(funcarr: any, context: any, callfuncs: any, nextfunc: any): void;
2
+ //# sourceMappingURL=coderunner.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coderunner.d.mts","sourceRoot":"","sources":["../coderunner.mjs"],"names":[],"mappings":"AAAA,iGAqBC"}
@@ -0,0 +1,2 @@
1
+ export default function run(cronexpr: any, theFunc: any): void;
2
+ //# sourceMappingURL=cronjob.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cronjob.d.mts","sourceRoot":"","sources":["../cronjob.mjs"],"names":[],"mappings":"AAMA,+DA6BC"}
@@ -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,11 @@
1
+ export default function _default(query: any, options: any): {
2
+ criteria: {};
3
+ options: {
4
+ fields: {} | {};
5
+ sort: {};
6
+ skip: number;
7
+ limit: any;
8
+ };
9
+ links: (url: any, totalCount: any) => {};
10
+ };
11
+ //# sourceMappingURL=q2m.d.mts.map
@@ -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,4 @@
1
+ export function validate(schema: any, document: any, options: any): Promise<any>;
2
+ export function cast(schema: any, document: any): any;
3
+ export function prepare(schemas: any, options: any): any;
4
+ //# sourceMappingURL=index.d.mts.map
@@ -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,4 @@
1
+ export function validate(schema: any, document: any): any;
2
+ export function cast(schema: any, document: any): any;
3
+ export function prepare(schemas: any): any;
4
+ //# sourceMappingURL=index.d.mts.map
@@ -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,4 @@
1
+ export function validate(schema: any, document: any): Promise<any>;
2
+ export function cast(schema: any, document: any): any;
3
+ export function prepare(schemas: any): any;
4
+ //# sourceMappingURL=index.d.mts.map
@@ -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"}