QService
@quik/services / QService
Abstract Class: QService
Defined in: services/src/QService.ts:15
Base class for application services.
Extends
QObject
Constructors
Constructor
new QService():
QService
Returns
QService
Inherited from
QObject.constructor
Properties
_language?
protectedoptional_language?:string
Defined in: services/src/QService.ts:17
_user
protected_user:IQUser
Defined in: services/src/QService.ts:16
Accessors
language
Get Signature
get
protectedlanguage():string
Defined in: services/src/QService.ts:27
Returns
string
Set Signature
set
protectedlanguage(value):void
Defined in: services/src/QService.ts:31
Parameters
value
string
Returns
void
logger
Get Signature
get
protectedlogger():IQLogger
Defined in: core/src/QObject.ts:15
The logger getter for the object.
Returns
IQLogger
Inherited from
QObject.logger
name
Get Signature
get name():
string
Defined in: core/src/QObject.ts:8
Returns
string
Inherited from
QObject.name
user
Get Signature
get
protecteduser():IQUser
Defined in: services/src/QService.ts:19
Returns
IQUser
Set Signature
set
protecteduser(newUser):void
Defined in: services/src/QService.ts:23
Parameters
newUser
IQUser
Returns
void
Methods
clone()
clone<
T>(properties?):T
Defined in: services/src/QService.ts:40
Creates a clone of the current service.
Type Parameters
T
T extends QService = QService
Parameters
properties?
Record<string, any>
A list of properties that you want to pass to the new instance.
Returns
T
endSpan()
protectedendSpan(span):void
Defined in: core/src/QObject.ts:35
End a span returned by startSpan.
Parameters
span
TelemetrySpan
The span to end.
Returns
void
Inherited from
QObject.endSpan
executeCommand()
protectedexecuteCommand<T>(command,args?):Promise<void>
Defined in: services/src/QService.ts:106
Executes a CLI command if the CLI module is loaded.
Type Parameters
T
T = any
Parameters
command
string
The command to execute.
args?
T
Arguments passed to the command.
Returns
Promise<void>
getLanguageStore()
protectedgetLanguageStore():IQI18n
Defined in: services/src/QService.ts:116
Retrieves the i18n store in use by the application.
Returns
IQI18n
hasModule()
protectedhasModule(module):boolean
Defined in: services/src/QService.ts:96
Checks if a module has been registered in the bootstrapper.
Parameters
module
string
Returns
boolean
init()
init():
Promise<void>
Defined in: services/src/QService.ts:82
Method used to perform some initializations in the class.
Returns
Promise<void>
recordSpanError()
protectedrecordSpanError(span,err):void
Defined in: core/src/QObject.ts:45
Record an exception on an active span.
Parameters
span
TelemetrySpan
The span to record the error on.
err
unknown
The error to record.
Returns
void
Inherited from
QObject.recordSpanError
scope()
scope(
scope?):QService
Defined in: services/src/QService.ts:55
Creates a scoped clone of the current service.
Parameters
scope?
The scope applied to the cloned instance.
Returns
QService
session()
session(
user,properties?):QService
Defined in: services/src/QService.ts:75
Creates a session bound to a specific user.
Parameters
user
IQUser
The user to attach to the service instance.
properties?
Record<string, any>
Extra properties applied when cloning the service.
Returns
QService
setSpanAttribute()
protectedsetSpanAttribute(span,key,value):void
Defined in: core/src/QObject.ts:64
Set a single attribute on an active span.
Parameters
span
TelemetrySpan
The span to update.
key
string
Attribute key.
value
string | number | boolean
Attribute value.
Returns
void
Inherited from
QObject.setSpanAttribute
shutdown()
shutdown():
Promise<void>
Defined in: services/src/QService.ts:89
Method used to clean up resources before shutdown.
Returns
Promise<void>
startSpan()
protectedstartSpan(spanName,options?):TelemetrySpan
Defined in: core/src/QObject.ts:26
Start a telemetry span for the given operation name. Returns undefined when no telemetry provider is active.
Parameters
spanName
string
Name of the span.
options?
TelemetrySpanOptions
Optional span attributes and kind.
Returns
TelemetrySpan
Inherited from
QObject.startSpan
translate()
protectedtranslate(key,options):string
Defined in: services/src/QService.ts:126
Helper method to translate a key using the i18n store.
Parameters
key
string
The translation key.
options
Record<string, any>
The interpolation options.
Returns
string