@kronos-integration/service 13.1.15 → 13.2.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/service",
3
- "version": "13.1.15",
3
+ "version": "13.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -36,10 +36,10 @@
36
36
  "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
37
37
  },
38
38
  "dependencies": {
39
- "@kronos-integration/endpoint": "^10.1.4",
39
+ "@kronos-integration/endpoint": "^10.1.5",
40
40
  "@kronos-integration/interceptor": "^12.1.2",
41
41
  "loglevel-mixin": "^7.2.5",
42
- "pacc": "^4.5.2",
42
+ "pacc": "^4.5.3",
43
43
  "statetransition-mixin": "^8.1.3"
44
44
  },
45
45
  "devDependencies": {
@@ -110,7 +110,7 @@ export function EndpointsMixin(superclass) {
110
110
  * Also creates interceptors if they are present in the definition.
111
111
  * @param {string} name of the new endpoint
112
112
  * @param {Object|string} definition endpoint attributes or alias expression
113
- * @param {string} [definition.target] expression pointing to the connected endpoint
113
+ * @param {string?} [definition.target] expression pointing to the connected endpoint
114
114
  * @param {InitializationContext} ic
115
115
  * @return {Endpoint} newly created endpoint
116
116
  */
@@ -180,22 +180,19 @@ export function EndpointsMixin(superclass) {
180
180
  /**
181
181
  * Find Endpoint for a given expression.
182
182
  * Default implementation only supports direct named endpoints.
183
+ * If no matching Endpoint can be identified endpointOnDemand() is consulted.
183
184
  * @param {string|Endpoint} expression to identify endpoint
184
185
  * @param {Endpoint} from to identify endpoint
185
- * @return {Endpoint} for a given expression
186
+ * @return {Endpoint?} for a given expression
186
187
  */
187
188
  endpointForExpression(expression, from) {
188
189
  if (typeof expression === "string") {
189
190
  const endpoint = this.endpoints[expression];
190
191
  if (endpoint === undefined) {
191
- const m = expression.match(/^service\(([^\)]*)\).([^\[]*)/);
192
+ const m = expression.match(/^service\((?<service>[^\)]*)\).(?<suffix>[^\[]*)/);
192
193
  if (m) {
193
- const serviceName = m[1];
194
- const suffixExpression = m[2];
195
- const serviceProvider = this.owner;
196
- const service = serviceName.length === 0 ? serviceProvider : serviceProvider.getService(serviceName);
197
-
198
- return service?.endpointForExpression(suffixExpression);
194
+ const service = m.groups.service.length === 0 ? this.owner : this.owner.getService(m.groups.service);
195
+ return service?.endpointForExpression(m.groups.suffix);
199
196
  }
200
197
 
201
198
  if (from !== undefined) {
@@ -203,11 +200,22 @@ export function EndpointsMixin(superclass) {
203
200
  return from;
204
201
  }
205
202
  }
203
+
204
+ return this.owner.endpointOnDemand(expression, from);
206
205
  }
207
206
 
208
207
  return endpoint;
209
208
  }
210
209
  return expression;
211
210
  }
211
+
212
+ /**
213
+ * Create endpint for a givne expression.
214
+ * @param {string|Endpoint} expression to identify endpoint
215
+ * @param {Endpoint} from to identify endpoint
216
+ * @return {Endpoint?} for a given expression
217
+ */
218
+ endpointOnDemand(expression, from) {
219
+ }
212
220
  };
213
221
  }