@bettercorp/service-base
Advanced tools
Comparing version 8.5.61 to 8.5.62
@@ -7,4 +7,11 @@ import { ServiceEventsBase } from "../interfaces"; | ||
} | ||
export interface BSBServiceClientDefinition { | ||
name: string; | ||
initBeforePlugins?: Array<string>; | ||
initAfterPlugins?: Array<string>; | ||
runBeforePlugins?: Array<string>; | ||
runAfterPlugins?: Array<string>; | ||
} | ||
export declare abstract class BSBService<ReferencedConfig extends BSBReferencePluginConfigType = any, Events extends BSBPluginEvents = BSBPluginEventsRef> extends BaseWithLoggingAndConfig<ReferencedConfig extends null ? null : BSBReferencePluginConfigDefinition<ReferencedConfig>> { | ||
static PLUGIN_NAME: string; | ||
static PLUGIN_CLIENT: BSBServiceClientDefinition; | ||
abstract readonly initBeforePlugins?: Array<string>; | ||
@@ -28,3 +35,3 @@ abstract readonly initAfterPlugins?: Array<string>; | ||
export declare class BSBServiceRef extends BSBService<any> { | ||
static PLUGIN_NAME: string; | ||
static PLUGIN_CLIENT: BSBServiceClientDefinition; | ||
methods: {}; | ||
@@ -31,0 +38,0 @@ initBeforePlugins?: string[] | undefined; |
@@ -6,3 +6,3 @@ "use strict"; | ||
class BSBService extends index_1.BaseWithLoggingAndConfig { | ||
static PLUGIN_NAME; | ||
static PLUGIN_CLIENT; | ||
events; | ||
@@ -17,3 +17,5 @@ _clients = []; | ||
class BSBServiceRef extends BSBService { | ||
static PLUGIN_NAME = "BSBServiceRef"; | ||
static PLUGIN_CLIENT = { | ||
name: "BSBServiceRef" | ||
}; | ||
methods = {}; | ||
@@ -20,0 +22,0 @@ initBeforePlugins; |
@@ -27,3 +27,7 @@ "use strict"; | ||
super(context); | ||
this.pluginName = service.PLUGIN_NAME; | ||
this.pluginName = service.PLUGIN_CLIENT.name; | ||
this.initBeforePlugins = service.PLUGIN_CLIENT.initBeforePlugins; | ||
this.initAfterPlugins = service.PLUGIN_CLIENT.initAfterPlugins; | ||
this.runBeforePlugins = service.PLUGIN_CLIENT.runBeforePlugins; | ||
this.runAfterPlugins = service.PLUGIN_CLIENT.runAfterPlugins; | ||
} | ||
@@ -30,0 +34,0 @@ } |
@@ -46,3 +46,3 @@ "use strict"; | ||
async loadPlugin(log, npmPackage, plugin, name) { | ||
log.debug(`PLUGIN {name} from {package} try load as {pluginName}`, { | ||
log.debug(`Plugin {name} from {package} try load as {pluginName}`, { | ||
name: plugin, | ||
@@ -74,3 +74,3 @@ pluginName: name, | ||
if (!(0, fs_1.existsSync)(pluginPath)) { | ||
log.error(`PLUGIN {name} in {package} not found`, { | ||
log.error(`Plugin {name} in {package} not found`, { | ||
name: plugin, | ||
@@ -90,3 +90,3 @@ package: npmPackage ?? "self", | ||
if ((0, fs_1.existsSync)(tsPluginFile)) { | ||
log.debug("PLUGIN {pluginName} running in development mode", { | ||
log.debug("Plugin {pluginName} running in development mode", { | ||
pluginName: name, | ||
@@ -97,3 +97,3 @@ }); | ||
if (!(0, fs_1.existsSync)(pluginFile)) | ||
throw new __1.BSBError("PLUGIN {pluginName} not found at {location}", { | ||
throw new __1.BSBError("Plugin {pluginName} not found at {location}", { | ||
pluginName: name, | ||
@@ -104,3 +104,3 @@ location: pluginFile, | ||
if (importedPlugin.Plugin === undefined) | ||
throw new __1.BSBError("PLUGIN {pluginName} does not export a Plugin class - so possibly not a valid BSB Plugin", { | ||
throw new __1.BSBError("Plugin {pluginName} does not export a Plugin class - so possibly not a valid BSB Plugin", { | ||
pluginName: name, | ||
@@ -107,0 +107,0 @@ }); |
@@ -31,3 +31,3 @@ { | ||
"main": "lib/index.js", | ||
"version": "8.5.61", | ||
"version": "8.5.62", | ||
"bsb_project": true, | ||
@@ -34,0 +34,0 @@ "bsbInit": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
401522
5006