codehooks-js 1.3.7 → 1.3.9
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/index.js +5 -6
- package/package.json +2 -4
- package/types/aggregation/index.d.mts +38 -1
- package/types/crudlify/index.d.mts +9 -5
- package/types/crudlify/lib/eventhooks.d.mts +1 -0
- package/types/crudlify/lib/query/q2m/index.d.mts +7 -0
- package/types/crudlify/lib/query/q2m/q2m.d.mts +1 -0
- package/types/crudlify/lib/schema/json-schema/index.d.mts +1 -0
- package/types/crudlify/lib/schema/yup/index.d.mts +2 -1
- package/types/crudlify/lib/schema/zod/index.d.mts +1 -0
- package/types/index.d.ts +1373 -126
- package/types/webserver.d.mts +2 -1
- package/types/workflow/engine.d.mts +5 -40
- package/types/workflow/index.d.mts +1 -5
- package/workflow/engine.mjs +362 -109
- package/workflow/index.mjs +2 -14
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {agg} from './aggregation/index.mjs';
|
|
2
2
|
import {crudlify as crud} from './crudlify/index.mjs';
|
|
3
3
|
import {serveStatic as ws, render as renderView} from './webserver.mjs';
|
|
4
|
-
import
|
|
4
|
+
import Workflow from './workflow/engine.mjs';
|
|
5
5
|
|
|
6
6
|
function createRoute(str) {
|
|
7
7
|
if(str instanceof RegExp) {
|
|
@@ -118,8 +118,9 @@ class Codehooks {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
createWorkflow = (name, description, steps, options={}) => {
|
|
121
|
-
Workflow
|
|
122
|
-
|
|
121
|
+
const wf = new Workflow(name, description, steps, options);
|
|
122
|
+
wf.register(this);
|
|
123
|
+
return wf;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
init = (hook) => {
|
|
@@ -193,10 +194,8 @@ export const aggregation = agg;
|
|
|
193
194
|
export const crudlify = crud;
|
|
194
195
|
export const coho = _coho;
|
|
195
196
|
export const app = _coho;
|
|
196
|
-
export const workflowconfig = WorkflowConfig;
|
|
197
197
|
export {
|
|
198
|
-
Workflow
|
|
199
|
-
WorkflowConfig
|
|
198
|
+
Workflow
|
|
200
199
|
};
|
|
201
200
|
export const realtime = {
|
|
202
201
|
createChannel: (path, ...hook) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codehooks-js",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Codehooks.io official library - provides express.JS like syntax",
|
|
6
6
|
"main": "index.js",
|
|
@@ -22,9 +22,7 @@
|
|
|
22
22
|
"tsconfig.json"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"test": "echo \"Warning: no tests specified\""
|
|
26
|
-
"build": "tsc",
|
|
27
|
-
"prepublishOnly": "npm run build"
|
|
25
|
+
"test": "echo \"Warning: no tests specified\""
|
|
28
26
|
},
|
|
29
27
|
"author": "Codehooks",
|
|
30
28
|
"license": "ISC",
|
|
@@ -1 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
import { httpResponse } from '..';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {DataStream} readable - JSON stream
|
|
6
|
+
* @param {Object} spec - JSON aggregation spec
|
|
7
|
+
* @returns {Promise} with aggregation result
|
|
8
|
+
* @example
|
|
9
|
+
* Spec JSON example:
|
|
10
|
+
* {
|
|
11
|
+
* "$max": {$field: "open", $label: "Open"},
|
|
12
|
+
"$group": {
|
|
13
|
+
"$field": "Ticker",
|
|
14
|
+
$label: "Symbol",
|
|
15
|
+
"$max": "high",
|
|
16
|
+
"$min": {$field: "close", $label: "Low"}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
*/
|
|
20
|
+
export function agg(readable: DataStream, spec: any): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Persistent NoSql and Kev-Value datastore
|
|
23
|
+
*/
|
|
24
|
+
export type DataStream = {
|
|
25
|
+
/**
|
|
26
|
+
* - Emits data, stream.on('data', (data) => //console.debug(data))
|
|
27
|
+
*/
|
|
28
|
+
on: (arg0: string, arg1: (arg0: any) => any) => void;
|
|
29
|
+
/**
|
|
30
|
+
* - Pipe datastream to JSON output
|
|
31
|
+
*/
|
|
32
|
+
json: (response: httpResponse) => void;
|
|
33
|
+
/**
|
|
34
|
+
* - Return an array of objects
|
|
35
|
+
*/
|
|
36
|
+
toArray: () => Promise<object[]>;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
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 {Promise} EventHooks for REST operations
|
|
7
|
+
*/
|
|
8
|
+
export default function crudlify(app: object, schema?: object, options?: object): Promise<EventHooks>;
|
|
6
9
|
import { EventHooks } from "./lib/eventhooks.mjs";
|
|
7
10
|
export function setDatastore(ds: any): void;
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert request query to mongoDB query by query-to-mongo lib
|
|
3
|
+
* @param {*} query
|
|
4
|
+
* @param {*} headers
|
|
5
|
+
* @returns Object
|
|
6
|
+
*/
|
|
1
7
|
export function getMongoQuery(query: any, headers: any): {
|
|
2
8
|
filter: any;
|
|
3
9
|
hints: any;
|
|
@@ -6,3 +12,4 @@ export function getMongoQuery(query: any, headers: any): {
|
|
|
6
12
|
offset: any;
|
|
7
13
|
fields: any;
|
|
8
14
|
};
|
|
15
|
+
//# sourceMappingURL=index.d.mts.map
|