@onify/flow-extensions 0.0.2 → 0.1.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/CHANGELOG.md +13 -0
- package/dist/src/Connector.js +2 -11
- package/dist/src/Errors.js +19 -0
- package/dist/src/IO.js +1 -3
- package/dist/src/ServiceExpression.js +10 -1
- package/package.json +5 -5
- package/src/Connector.js +1 -7
- package/src/Errors.js +11 -0
- package/src/IO.js +1 -1
- package/src/ServiceExpression.js +10 -1
package/CHANGELOG.md
ADDED
package/dist/src/Connector.js
CHANGED
|
@@ -5,16 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = Connector;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
constructor(serviceId) {
|
|
10
|
-
super(`${serviceId} service function not found`);
|
|
11
|
-
this.code = 'EFLOW_NOT_IMPLEMENTED';
|
|
12
|
-
this.output = {
|
|
13
|
-
statusCode: 501
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}
|
|
8
|
+
var _Errors = require("./Errors");
|
|
18
9
|
|
|
19
10
|
function Connector(connectorId, io, activity, executionMessage) {
|
|
20
11
|
if (!(this instanceof Connector)) return new Connector(connectorId, io, activity, executionMessage);
|
|
@@ -33,7 +24,7 @@ Connector.prototype.execute = async function execute(...args) {
|
|
|
33
24
|
const connectorId = this.connectorId;
|
|
34
25
|
const executionMessage = this.executionMessage;
|
|
35
26
|
const serviceFunction = environment.services[connectorId];
|
|
36
|
-
if (!serviceFunction) return callback(new NotImplemented(connectorId));
|
|
27
|
+
if (!serviceFunction) return callback(new _Errors.NotImplemented(connectorId));
|
|
37
28
|
|
|
38
29
|
try {
|
|
39
30
|
const input = io && (await io.getInput(activity, executionMessage));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NotImplemented = void 0;
|
|
7
|
+
|
|
8
|
+
class NotImplemented extends Error {
|
|
9
|
+
constructor(serviceId) {
|
|
10
|
+
super(`${serviceId} service function not found`);
|
|
11
|
+
this.code = 'EFLOW_NOT_IMPLEMENTED';
|
|
12
|
+
this.output = {
|
|
13
|
+
statusCode: 501
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.NotImplemented = NotImplemented;
|
package/dist/src/IO.js
CHANGED
|
@@ -159,10 +159,8 @@ class IOList extends IOBase {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
getValue(activity, executionMessage) {
|
|
162
|
-
var _this$behaviour$defin;
|
|
163
|
-
|
|
164
162
|
const name = this.name;
|
|
165
|
-
const items =
|
|
163
|
+
const items = this.behaviour.definition.items;
|
|
166
164
|
const result = [];
|
|
167
165
|
if (!Array.isArray(items)) return {
|
|
168
166
|
[name]: result
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = ServiceExpression;
|
|
7
7
|
|
|
8
|
+
var _Errors = require("./Errors");
|
|
9
|
+
|
|
8
10
|
function ServiceExpression(activity) {
|
|
9
11
|
if (!(this instanceof ServiceExpression)) return new ServiceExpression(activity);
|
|
10
12
|
this.activity = activity;
|
|
@@ -13,7 +15,14 @@ function ServiceExpression(activity) {
|
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
ServiceExpression.prototype.execute = function execute(executionMessage, callback) {
|
|
16
|
-
|
|
18
|
+
try {
|
|
19
|
+
const expression = this.expression;
|
|
20
|
+
var serviceFn = this.activity.environment.resolveExpression(expression, executionMessage);
|
|
21
|
+
if (typeof serviceFn !== 'function') throw new _Errors.NotImplemented(`expression "${expression}"`);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
return callback(err);
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
serviceFn.call(this.activity, executionMessage, (err, result) => {
|
|
18
27
|
callback(err, result);
|
|
19
28
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onify/flow-extensions",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Onify Flow extensions",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
"@babel/core": "^7.17.8",
|
|
40
40
|
"@babel/preset-env": "^7.16.11",
|
|
41
41
|
"@babel/register": "^7.17.7",
|
|
42
|
-
"bpmn-elements": "^
|
|
43
|
-
"bpmn-engine": "^
|
|
42
|
+
"bpmn-elements": "^8.0.0",
|
|
43
|
+
"bpmn-engine": "^14.0.0",
|
|
44
44
|
"bpmn-moddle": "^7.1.2",
|
|
45
45
|
"c8": "^7.11.0",
|
|
46
46
|
"camunda-bpmn-moddle": "^6.1.2",
|
|
47
47
|
"chai": "^4.3.6",
|
|
48
48
|
"chronokinesis": "^3.1.2",
|
|
49
49
|
"debug": "^4.3.4",
|
|
50
|
-
"eslint": "^8.
|
|
50
|
+
"eslint": "^8.12.0",
|
|
51
51
|
"mocha": "^9.2.2",
|
|
52
52
|
"mocha-cakes-2": "^3.3.0",
|
|
53
53
|
"moddle-context-serializer": "^2.1.0",
|
|
54
54
|
"nock": "^13.2.4"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"cron-parser": "^4.
|
|
57
|
+
"cron-parser": "^4.3.0"
|
|
58
58
|
},
|
|
59
59
|
"files": [
|
|
60
60
|
"src",
|
package/src/Connector.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
constructor(serviceId) {
|
|
3
|
-
super(`${serviceId} service function not found`);
|
|
4
|
-
this.code = 'EFLOW_NOT_IMPLEMENTED';
|
|
5
|
-
this.output = {statusCode: 501};
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
import {NotImplemented} from './Errors';
|
|
8
2
|
|
|
9
3
|
export default function Connector(connectorId, io, activity, executionMessage) {
|
|
10
4
|
if (!(this instanceof Connector)) return new Connector(connectorId, io, activity, executionMessage);
|
package/src/Errors.js
ADDED
package/src/IO.js
CHANGED
|
@@ -123,7 +123,7 @@ class IOList extends IOBase {
|
|
|
123
123
|
}
|
|
124
124
|
getValue(activity, executionMessage) {
|
|
125
125
|
const name = this.name;
|
|
126
|
-
const items = this.behaviour.definition
|
|
126
|
+
const items = this.behaviour.definition.items;
|
|
127
127
|
|
|
128
128
|
const result = [];
|
|
129
129
|
if (!Array.isArray(items)) return {[name]: result};
|
package/src/ServiceExpression.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {NotImplemented} from './Errors';
|
|
2
|
+
|
|
1
3
|
export default function ServiceExpression(activity) {
|
|
2
4
|
if (!(this instanceof ServiceExpression)) return new ServiceExpression(activity);
|
|
3
5
|
this.activity = activity;
|
|
@@ -6,7 +8,14 @@ export default function ServiceExpression(activity) {
|
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
ServiceExpression.prototype.execute = function execute(executionMessage, callback) {
|
|
9
|
-
|
|
11
|
+
try {
|
|
12
|
+
const expression = this.expression;
|
|
13
|
+
var serviceFn = this.activity.environment.resolveExpression(expression, executionMessage);
|
|
14
|
+
if (typeof serviceFn !== 'function') throw new NotImplemented(`expression "${expression}"`);
|
|
15
|
+
} catch (err) {
|
|
16
|
+
return callback(err);
|
|
17
|
+
}
|
|
18
|
+
|
|
10
19
|
serviceFn.call(this.activity, executionMessage, (err, result) => {
|
|
11
20
|
callback(err, result);
|
|
12
21
|
});
|