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 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 {Steps as Workflow, StepsConfig as WorkflowConfig} from './workflow/index.mjs';
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.register(this, name, description, steps, options);
122
- return Workflow;
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.7",
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
- export function agg(readable: any, spec: any): Promise<any>;
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
- export default function crudlify(app: any, schema?: {}, options?: {
2
- schema: string;
3
- query: string;
4
- prefix: string;
5
- }): Promise<EventHooks>;
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
@@ -53,3 +53,4 @@ export class EventHooks {
53
53
  */
54
54
  beforeDELETE(coll: any, func: any): this;
55
55
  }
56
+ //# sourceMappingURL=eventhooks.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
@@ -8,3 +8,4 @@ export default function _default(query: any, options: any): {
8
8
  };
9
9
  links: (url: any, totalCount: any) => {};
10
10
  };
11
+ //# sourceMappingURL=q2m.d.mts.map
@@ -1,3 +1,4 @@
1
1
  export function validate(schema: any, document: any, options: any): Promise<any>;
2
2
  export function cast(schema: any, document: any): any;
3
3
  export function prepare(schemas: any, options: any): any;
4
+ //# sourceMappingURL=index.d.mts.map
@@ -1,3 +1,4 @@
1
- export function validate(schema: any, document: any): Promise<any>;
1
+ export function validate(schema: any, document: any): any;
2
2
  export function cast(schema: any, document: any): any;
3
3
  export function prepare(schemas: any): any;
4
+ //# sourceMappingURL=index.d.mts.map
@@ -1,3 +1,4 @@
1
1
  export function validate(schema: any, document: any): Promise<any>;
2
2
  export function cast(schema: any, document: any): any;
3
3
  export function prepare(schemas: any): any;
4
+ //# sourceMappingURL=index.d.mts.map