@kronos-integration/service 13.2.3 → 13.2.5
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/package.json +2 -2
- package/src/endpoints-mixin.mjs +20 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@kronos-integration/endpoint": "^10.1.6",
|
|
40
|
-
"@kronos-integration/interceptor": "^12.1.
|
|
40
|
+
"@kronos-integration/interceptor": "^12.1.6",
|
|
41
41
|
"loglevel-mixin": "^7.2.5",
|
|
42
42
|
"pacc": "^4.5.3",
|
|
43
43
|
"statetransition-mixin": "^8.1.3"
|
package/src/endpoints-mixin.mjs
CHANGED
|
@@ -54,17 +54,17 @@ export function EndpointsMixin(superclass) {
|
|
|
54
54
|
const receive = definition.receive;
|
|
55
55
|
|
|
56
56
|
if (typeof receive === "string") {
|
|
57
|
-
switch(typeof this[receive]) {
|
|
57
|
+
switch (typeof this[receive]) {
|
|
58
58
|
case "function":
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
definition.receive = (...args) => this[receive](...args);
|
|
60
|
+
break;
|
|
61
61
|
default:
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
definition.receive = () => this[receive];
|
|
63
|
+
break;
|
|
64
64
|
case "undefined":
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
throw new Error(
|
|
66
|
+
`No sucht method or property ${this.name}.${receive}`
|
|
67
|
+
);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -189,10 +189,18 @@ export function EndpointsMixin(superclass) {
|
|
|
189
189
|
if (typeof expression === "string") {
|
|
190
190
|
const endpoint = this.endpoints[expression];
|
|
191
191
|
if (endpoint === undefined) {
|
|
192
|
-
const m = expression.match(
|
|
192
|
+
const m = expression.match(
|
|
193
|
+
/^(?<fn>[a-z]+)\((?<arg>[^\)]*)\).(?<suffix>[^\[]*)/
|
|
194
|
+
);
|
|
193
195
|
if (m) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
switch (m.groups.fn) {
|
|
197
|
+
case "service":
|
|
198
|
+
const service =
|
|
199
|
+
m.groups.arg.length === 0
|
|
200
|
+
? this.owner
|
|
201
|
+
: this.owner.getService(m.groups.arg);
|
|
202
|
+
return service?.endpointForExpression(m.groups.suffix);
|
|
203
|
+
}
|
|
196
204
|
}
|
|
197
205
|
|
|
198
206
|
if (from !== undefined) {
|
|
@@ -215,7 +223,6 @@ export function EndpointsMixin(superclass) {
|
|
|
215
223
|
* @param {Endpoint} from to identify endpoint
|
|
216
224
|
* @return {Endpoint?} for a given expression
|
|
217
225
|
*/
|
|
218
|
-
endpointOnDemand(expression, from) {
|
|
219
|
-
}
|
|
226
|
+
endpointOnDemand(expression, from) {}
|
|
220
227
|
};
|
|
221
228
|
}
|