@kronos-integration/service 11.1.0 → 11.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/service",
3
- "version": "11.1.0",
3
+ "version": "11.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -89,15 +89,20 @@ export function ServiceProviderMixin(
89
89
  /**
90
90
  * Register service or interceptor factories.
91
91
  *
92
- * @param {Function[]} factories
92
+ * @param {[Function|string]} factories
93
93
  */
94
- registerFactories(factories) {
95
- for (const f of factories) {
96
- const p = f.prototype;
97
- if (p instanceof Interceptor) {
98
- this.registerInterceptorFactory(f);
99
- } else if (p instanceof Service) {
100
- this.registerServiceFactory(f);
94
+ async registerFactories(factories) {
95
+ for (let factory of factories) {
96
+ if(typeof factory === 'string') {
97
+ const module = await import(factory);
98
+ factory = new module.default();
99
+ }
100
+
101
+ const prototype = factory.prototype;
102
+ if (prototype instanceof Interceptor) {
103
+ this.registerInterceptorFactory(factory);
104
+ } else if (prototype instanceof Service) {
105
+ this.registerServiceFactory(factory);
101
106
  }
102
107
  }
103
108
  }
@@ -30,9 +30,9 @@ export function ServiceProviderMixin(superclass: any, serviceLoggerClass?: new (
30
30
  /**
31
31
  * Register service or interceptor factories.
32
32
  *
33
- * @param {Function[]} factories
33
+ * @param {[Function|string]} factories
34
34
  */
35
- registerFactories(factories: Function[]): void;
35
+ registerFactories(factories: [Function | string]): Promise<void>;
36
36
  /**
37
37
  * Registers a interceptor factory for later use by
38
38
  * @see {instantiateInterceptor}.
@@ -11,7 +11,7 @@ declare const StandaloneServiceProvider_base: {
11
11
  removeListener(name: any, listener: any): void;
12
12
  readonly owner: any;
13
13
  readonly isServiceProvider: boolean;
14
- registerFactories(factories: Function[]): void;
14
+ registerFactories(factories: [Function | string]): Promise<void>;
15
15
  registerInterceptorFactory(factory: new () => new () => any): new () => new () => any;
16
16
  unregisterInterceptorFactory(factory: any): void;
17
17
  instantiateInterceptor(definition: any): import("@kronos-integration/interceptor").Interceptor;