Class: CapabilityService
Makaio Framework / services-core / CapabilityService
Class: CapabilityService
Section titled “Class: CapabilityService”Defined in: ../../../packages/services/core/src/capability/capability-service.ts:17
Service managing capability provider registration and discovery.
Listens for capability.register events from extensions and maintains
the registry of providers per capability. Handles generic capability
operations (listProviders, validate).
Extends
Section titled “Extends”BaseService
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CapabilityService(
bus):CapabilityService
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:20
Parameters
Section titled “Parameters”Returns
Section titled “Returns”CapabilityService
Overrides
Section titled “Overrides”BaseService.constructor
Properties
Section titled “Properties”
protectedreadonlybus:IMakaioBus
Defined in: ../../../packages/services/base/src/base-service.ts:39
Bus instance used for registering handlers
Inherited from
Section titled “Inherited from”BaseService.bus
Accessors
Section titled “Accessors”initialized
Section titled “initialized”Get Signature
Section titled “Get Signature”get initialized():
boolean
Defined in: ../../../packages/services/base/src/base-service.ts:47
Whether the service has been successfully initialized.
Returns true after init() completes and before destroy() is called.
Returns
Section titled “Returns”boolean
true if initialized, false otherwise
Inherited from
Section titled “Inherited from”BaseService.initialized
Methods
Section titled “Methods”addCleanup()
Section titled “addCleanup()”
protectedaddCleanup(fn):void
Defined in: ../../../packages/services/base/src/base-service.ts:143
Enqueue an arbitrary cleanup function to be called on destroy().
Use for non-handler resources (timers, external subscriptions, etc.).
Parameters
Section titled “Parameters”() => void | Promise<void>
Function to invoke during teardown
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseService.addCleanup
clear()
Section titled “clear()”clear():
void
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:122
Returns
Section titled “Returns”void
destroy()
Section titled “destroy()”destroy():
Promise<void>
Defined in: ../../../packages/services/base/src/base-service.ts:89
Destroy the service and unsubscribe all registered handlers.
Calls the optional onDestroy() hook before running cleanups, then
resets the initialized flag. Safe to call multiple times (idempotent).
Returns
Section titled “Returns”Promise<void>
Promise that resolves after teardown completes
Inherited from
Section titled “Inherited from”BaseService.destroy
getCapabilities()
Section titled “getCapabilities()”getCapabilities():
string[]
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:101
Returns
Section titled “Returns”string[]
getProviders()
Section titled “getProviders()”getProviders(
capabilityId):ICapabilityProvider[]
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:92
Parameters
Section titled “Parameters”capabilityId
Section titled “capabilityId”string
Returns
Section titled “Returns”hasProviders()
Section titled “hasProviders()”hasProviders(
capabilityId):boolean
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:96
Parameters
Section titled “Parameters”capabilityId
Section titled “capabilityId”string
Returns
Section titled “Returns”boolean
init()
Section titled “init()”init():
Promise<void>
Defined in: ../../../packages/services/base/src/base-service.ts:57
Initialize the service.
Delegates to onInit() once; subsequent calls are no-ops (idempotent).
Returns
Section titled “Returns”Promise<void>
Promise that resolves when initialization is complete
Inherited from
Section titled “Inherited from”BaseService.init
onDestroy()
Section titled “onDestroy()”
protectedonDestroy():void
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:118
Optional service teardown hook.
Called by destroy() before automatic handler unsubscription.
Implement only when there are resources beyond bus handlers to clean up
(e.g., stopping trackers, clearing maps, releasing external handles).
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”BaseService.onDestroy
onInit()
Section titled “onInit()”
protectedonInit():Promise<void>
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:24
Service initialization hook.
Called once by init(). Register bus handlers via registerHandler()
and other cleanup resources via addCleanup() here.
Returns
Section titled “Returns”Promise<void>
Promise or void — async is allowed
Overrides
Section titled “Overrides”BaseService.onInit
registerHandler()
Section titled “registerHandler()”
protectedregisterHandler<S>(subject,handler):void
Defined in: ../../../packages/services/base/src/base-service.ts:129
Register a bus handler and enqueue its unsubscribe function for teardown.
Equivalent to this._cleanups.push(this.bus.on(subject, handler)).
Type Parameters
Section titled “Type Parameters”S extends SubjectDefinition
Parameters
Section titled “Parameters”subject
Section titled “subject”S
The subject definition to listen on
handler
Section titled “handler”HandlerForSubjectDefinition<S>
Handler function for the subject
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseService.registerHandler
unregisterProvider()
Section titled “unregisterProvider()”unregisterProvider(
capabilityId,providerId):void
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:79
Remove a provider from a capability bucket.
Parameters
Section titled “Parameters”capabilityId
Section titled “capabilityId”string
Capability bucket to update
providerId
Section titled “providerId”string
Provider identifier to remove
Returns
Section titled “Returns”void
validateAll()
Section titled “validateAll()”validateAll(
capabilityId):Promise<object[]>
Defined in: ../../../packages/services/core/src/capability/capability-service.ts:105
Parameters
Section titled “Parameters”capabilityId
Section titled “capabilityId”string
Returns
Section titled “Returns”Promise<object[]>