codehooks-js 1.2.20 → 1.3.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/index.js +11 -1
- package/package.json +11 -3
- package/tsconfig.json +34 -21
- package/types/aggregation/index.d.mts +1 -38
- package/types/crudlify/index.d.mts +5 -9
- package/types/crudlify/lib/eventhooks.d.mts +0 -1
- package/types/crudlify/lib/query/q2m/index.d.mts +0 -7
- package/types/crudlify/lib/query/q2m/q2m.d.mts +0 -1
- package/types/crudlify/lib/schema/json-schema/index.d.mts +0 -1
- package/types/crudlify/lib/schema/yup/index.d.mts +1 -2
- package/types/crudlify/lib/schema/zod/index.d.mts +0 -1
- package/types/index.d.ts +117 -1023
- package/types/webserver.d.mts +1 -2
- package/types/workflow/engine.d.mts +123 -0
- package/types/workflow/engine.d.mts.map +1 -0
- package/types/workflow/index.d.mts +10 -0
- package/types/workflow/index.d.mts.map +1 -0
- package/webserver.mjs +42 -15
- package/workflow/engine.mjs +384 -0
- package/workflow/index.mjs +13 -0
package/index.js
CHANGED
|
@@ -1,6 +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 {Steps, StepsConfig} from './workflow/index.mjs';
|
|
4
5
|
|
|
5
6
|
function createRoute(str) {
|
|
6
7
|
if(str instanceof RegExp) {
|
|
@@ -115,6 +116,11 @@ class Codehooks {
|
|
|
115
116
|
res.status(200).json({...data});
|
|
116
117
|
})
|
|
117
118
|
}
|
|
119
|
+
|
|
120
|
+
createSteps = (name, description, steps, options={}) => {
|
|
121
|
+
Steps.register(this, name, description, steps, options);
|
|
122
|
+
return Steps;
|
|
123
|
+
}
|
|
118
124
|
|
|
119
125
|
init = (hook) => {
|
|
120
126
|
const manifest = {
|
|
@@ -187,7 +193,11 @@ export const aggregation = agg;
|
|
|
187
193
|
export const crudlify = crud;
|
|
188
194
|
export const coho = _coho;
|
|
189
195
|
export const app = _coho;
|
|
190
|
-
|
|
196
|
+
export const stepsconfig = StepsConfig;
|
|
197
|
+
export {
|
|
198
|
+
Steps,
|
|
199
|
+
StepsConfig
|
|
200
|
+
};
|
|
191
201
|
export const realtime = {
|
|
192
202
|
createChannel: (path, ...hook) => {
|
|
193
203
|
Codehooks.getInstance().realtime(path, ...hook);
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codehooks-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Codehooks.io official library - provides express.JS like syntax",
|
|
6
6
|
"main": "index.js",
|
|
7
|
-
"types": "./types",
|
|
7
|
+
"types": "./types/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"index.js",
|
|
10
10
|
"./aggregation/index.mjs",
|
|
@@ -16,11 +16,15 @@
|
|
|
16
16
|
"./crudlify/lib/schema/yup/index.mjs",
|
|
17
17
|
"./crudlify/lib/schema/json-schema/index.mjs",
|
|
18
18
|
"./crudlify/lib/schema/zod/index.mjs",
|
|
19
|
+
"./workflow/index.mjs",
|
|
20
|
+
"./workflow/engine.mjs",
|
|
19
21
|
"./types",
|
|
20
22
|
"tsconfig.json"
|
|
21
23
|
],
|
|
22
24
|
"scripts": {
|
|
23
|
-
"test": "echo \"Warning: no tests specified\""
|
|
25
|
+
"test": "echo \"Warning: no tests specified\"",
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
24
28
|
},
|
|
25
29
|
"author": "Codehooks",
|
|
26
30
|
"license": "ISC",
|
|
@@ -45,5 +49,9 @@
|
|
|
45
49
|
"lodash": "^4.17.21",
|
|
46
50
|
"mime": "^3.0.0",
|
|
47
51
|
"node-cron": "^3.0.2"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/mime": "^3.0.4",
|
|
55
|
+
"@types/node": "^22.15.19"
|
|
48
56
|
}
|
|
49
57
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ES2020",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"checkJs": false,
|
|
10
|
+
"outDir": "./types",
|
|
11
|
+
"rootDir": ".",
|
|
12
|
+
"strict": false,
|
|
13
|
+
"noImplicitAny": false,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"allowSyntheticDefaultImports": true
|
|
20
|
+
},
|
|
21
|
+
"include": [
|
|
22
|
+
"*.js",
|
|
23
|
+
"*.mjs",
|
|
24
|
+
"aggregation/**/*.js",
|
|
25
|
+
"aggregation/**/*.mjs",
|
|
26
|
+
"crudlify/**/*.js",
|
|
27
|
+
"crudlify/**/*.mjs",
|
|
28
|
+
"workflow/**/*.js",
|
|
29
|
+
"workflow/**/*.mjs"
|
|
30
|
+
],
|
|
31
|
+
"exclude": [
|
|
32
|
+
"node_modules",
|
|
33
|
+
"dist"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
|
|
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
|
+
export function agg(readable: any, spec: any): Promise<any>;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @returns {Promise} EventHooks for REST operations
|
|
7
|
-
*/
|
|
8
|
-
export default function crudlify(app: object, schema?: object, options?: object): Promise<EventHooks>;
|
|
1
|
+
export default function crudlify(app: any, schema?: {}, options?: {
|
|
2
|
+
schema: string;
|
|
3
|
+
query: string;
|
|
4
|
+
prefix: string;
|
|
5
|
+
}): Promise<EventHooks>;
|
|
9
6
|
import { EventHooks } from "./lib/eventhooks.mjs";
|
|
10
7
|
export function setDatastore(ds: any): void;
|
|
11
|
-
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert request query to mongoDB query by query-to-mongo lib
|
|
3
|
-
* @param {*} query
|
|
4
|
-
* @param {*} headers
|
|
5
|
-
* @returns Object
|
|
6
|
-
*/
|
|
7
1
|
export function getMongoQuery(query: any, headers: any): {
|
|
8
2
|
filter: any;
|
|
9
3
|
hints: any;
|
|
@@ -12,4 +6,3 @@ export function getMongoQuery(query: any, headers: any): {
|
|
|
12
6
|
offset: any;
|
|
13
7
|
fields: any;
|
|
14
8
|
};
|
|
15
|
-
//# sourceMappingURL=index.d.mts.map
|