@kronos-integration/service 11.2.1 → 11.2.3
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 +1 -1
- package/src/endpoints-mixin.mjs +12 -12
- package/src/service.mjs +4 -7
package/package.json
CHANGED
package/src/endpoints-mixin.mjs
CHANGED
|
@@ -54,15 +54,17 @@ export function EndpointsMixin(superclass) {
|
|
|
54
54
|
const receive = definition.receive;
|
|
55
55
|
|
|
56
56
|
if (typeof receive === "string") {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
switch(typeof this[receive]) {
|
|
58
|
+
case "function":
|
|
59
|
+
definition.receive = (...args) => this[receive](...args);
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
definition.receive = () => this[receive];
|
|
63
|
+
break;
|
|
64
|
+
case "undefined":
|
|
65
|
+
throw new Error(
|
|
66
|
+
`No sucht method or property ${this.name}.${receive}`
|
|
67
|
+
);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
}
|
|
@@ -193,9 +195,7 @@ export function EndpointsMixin(superclass) {
|
|
|
193
195
|
const serviceProvider = this.owner;
|
|
194
196
|
const service = serviceName.length === 0 ? serviceProvider : serviceProvider.getService(serviceName);
|
|
195
197
|
|
|
196
|
-
return service
|
|
197
|
-
? service.endpointForExpression(suffixExpression)
|
|
198
|
-
: undefined;
|
|
198
|
+
return service?.endpointForExpression(suffixExpression);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
if (from !== undefined) {
|
package/src/service.mjs
CHANGED
|
@@ -79,7 +79,7 @@ const ssfDefault = {
|
|
|
79
79
|
* @param {string} config.description human readable description
|
|
80
80
|
* @param {Object} config.endpoints will be merged with the build in ones
|
|
81
81
|
* @param {InitializationContext} ic
|
|
82
|
-
*
|
|
82
|
+
*
|
|
83
83
|
* @property {Object} endpoints
|
|
84
84
|
*/
|
|
85
85
|
export class Service extends EndpointsMixin(
|
|
@@ -368,16 +368,13 @@ export class Service extends EndpointsMixin(
|
|
|
368
368
|
Object.assign(json, atts);
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
for (const endpointName
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
function add(ep) {
|
|
371
|
+
for (const [endpointName, ep] of Object.entries(this.endpoints)) {
|
|
372
|
+
const add = ep => {
|
|
375
373
|
if (json.endpoints === undefined) {
|
|
376
374
|
json.endpoints = {};
|
|
377
375
|
}
|
|
378
376
|
json.endpoints[endpointName] = ep.toJSONWithOptions(options);
|
|
379
|
-
}
|
|
380
|
-
|
|
377
|
+
};
|
|
381
378
|
if (ep.isDefault) {
|
|
382
379
|
if (options.includeDefaults) {
|
|
383
380
|
add(ep);
|