@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
|
@@ -89,15 +89,20 @@ export function ServiceProviderMixin(
|
|
|
89
89
|
/**
|
|
90
90
|
* Register service or interceptor factories.
|
|
91
91
|
*
|
|
92
|
-
* @param {Function
|
|
92
|
+
* @param {[Function|string]} factories
|
|
93
93
|
*/
|
|
94
|
-
registerFactories(factories) {
|
|
95
|
-
for (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
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
|
|
33
|
+
* @param {[Function|string]} factories
|
|
34
34
|
*/
|
|
35
|
-
registerFactories(factories: Function
|
|
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
|
|
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;
|