@bettercorp/service-base
Advanced tools
Comparing version 8.5.58 to 8.5.59
@@ -11,3 +11,2 @@ "use strict"; | ||
pluginCwd; | ||
pluginName; | ||
constructor(config) { | ||
@@ -14,0 +13,0 @@ this.appId = config.appId; |
@@ -8,2 +8,3 @@ import { ServiceEventsBase } from "../interfaces"; | ||
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; | ||
abstract readonly initBeforePlugins?: Array<string>; | ||
@@ -27,2 +28,3 @@ abstract readonly initAfterPlugins?: Array<string>; | ||
export declare class BSBServiceRef extends BSBService<null> { | ||
static PLUGIN_NAME: string; | ||
methods: {}; | ||
@@ -29,0 +31,0 @@ initBeforePlugins?: string[] | undefined; |
@@ -6,2 +6,3 @@ "use strict"; | ||
class BSBService extends index_1.BaseWithLoggingAndConfig { | ||
static PLUGIN_NAME; | ||
_virtual_internal_events = {}; | ||
@@ -17,2 +18,3 @@ events; | ||
class BSBServiceRef extends BSBService { | ||
static PLUGIN_NAME = "BSBServiceRef"; | ||
methods = {}; | ||
@@ -19,0 +21,0 @@ initBeforePlugins; |
import { IPluginLogger, DynamicallyReferencedMethodCallable } from "../interfaces"; | ||
import { BSBService, PluginEvents } from "./index"; | ||
import { BSBService, PluginEvents, BSBServiceRef } from "./index"; | ||
import { DynamicallyReferencedMethodType } from "@bettercorp/tools/lib/Interfaces"; | ||
@@ -7,3 +7,3 @@ export declare abstract class BSBServiceClient<Service extends BSBService = any> { | ||
protected readonly events: PluginEvents<Service["_virtual_internal_events"]["emitEvents"], Service["_virtual_internal_events"]["onEvents"], Service["_virtual_internal_events"]["emitReturnableEvents"], Service["_virtual_internal_events"]["onReturnableEvents"], Service["_virtual_internal_events"]["emitBroadcast"], Service["_virtual_internal_events"]["onBroadcast"]>; | ||
callMethod<TA extends keyof Service["methods"]>(...args: DynamicallyReferencedMethodCallable<DynamicallyReferencedMethodType<Service["methods"]>, TA>): DynamicallyReferencedMethodCallable<DynamicallyReferencedMethodType<Service["methods"]>, TA, false>; | ||
protected callMethod<TA extends keyof Service["methods"]>(...args: DynamicallyReferencedMethodCallable<DynamicallyReferencedMethodType<Service["methods"]>, TA>): DynamicallyReferencedMethodCallable<DynamicallyReferencedMethodType<Service["methods"]>, TA, false>; | ||
constructor(context: BSBService); | ||
@@ -19,2 +19,15 @@ abstract readonly pluginName: string; | ||
} | ||
export declare class ServiceClient<Service extends BSBService, ServiceT extends typeof BSBServiceRef = any> extends BSBServiceClient<Service> { | ||
readonly pluginName: string; | ||
readonly initBeforePlugins?: Array<string>; | ||
readonly initAfterPlugins?: Array<string>; | ||
readonly runBeforePlugins?: Array<string>; | ||
readonly runAfterPlugins?: Array<string>; | ||
dispose?(): void; | ||
init?(): Promise<void>; | ||
run?(): Promise<void>; | ||
callMethod<TA extends keyof Service["methods"]>(...args: DynamicallyReferencedMethodCallable<DynamicallyReferencedMethodType<Service["methods"]>, TA>): DynamicallyReferencedMethodCallable<DynamicallyReferencedMethodType<Service["methods"]>, TA, false>; | ||
events: PluginEvents<Service["_virtual_internal_events"]["emitEvents"], Service["_virtual_internal_events"]["onEvents"], Service["_virtual_internal_events"]["emitReturnableEvents"], Service["_virtual_internal_events"]["onReturnableEvents"], Service["_virtual_internal_events"]["emitBroadcast"], Service["_virtual_internal_events"]["onBroadcast"]>; | ||
constructor(service: ServiceT, context: BSBService); | ||
} | ||
export declare class BSBServiceClientRef extends BSBServiceClient<any> { | ||
@@ -21,0 +34,0 @@ pluginName: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BSBServiceClientRef = exports.BSBServiceClient = void 0; | ||
exports.BSBServiceClientRef = exports.ServiceClient = exports.BSBServiceClient = void 0; | ||
const index_1 = require("./index"); | ||
class BSBServiceClient { | ||
log; | ||
events; | ||
callMethod(...args) { | ||
@@ -18,2 +16,17 @@ throw new index_1.BSBError("The plugin {plugin} is not enabled so you cannot call methods from it", { | ||
exports.BSBServiceClient = BSBServiceClient; | ||
class ServiceClient extends BSBServiceClient { | ||
pluginName = "{UNSET SERVICE CLIENT PLUGIN NAME}"; | ||
initBeforePlugins; | ||
initAfterPlugins; | ||
runBeforePlugins; | ||
runAfterPlugins; | ||
callMethod(...args) { | ||
return this.callMethod(...args); | ||
} | ||
constructor(service, context) { | ||
super(context); | ||
this.pluginName = service.PLUGIN_NAME; | ||
} | ||
} | ||
exports.ServiceClient = ServiceClient; | ||
class BSBServiceClientRef extends BSBServiceClient { | ||
@@ -20,0 +33,0 @@ pluginName = ""; |
@@ -31,3 +31,3 @@ { | ||
"main": "lib/index.js", | ||
"version": "8.5.58", | ||
"version": "8.5.59", | ||
"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
Sorry, the diff of this file is not supported yet
400418
4990