@onzag/itemize / Modules / server/services/base/UserLocalizationProvider / default
server/services/base/UserLocalizationProvider.default
| Name |
|---|
T |
-
↳
default
- appConfig
- appDbConfig
- appRedisConfig
- appSensitiveConfig
- config
- globalCustomServices
- globalDatabaseConnection
- globalInstance
- globalMailProvider
- globalPhoneProvider
- globalRawDB
- globalRedis
- globalRedisPub
- globalRedisSub
- globalRoot
- instanceName
- localAppData
- localInstance
- registry
- execute
- expressRouter
- getInstanceName
- getLocalizationFor
- getRouter
- getRunCycleTime
- getTriggerRegistry
- initialize
- isInstanceGlobal
- isInstanceLocal
- logDebug
- logError
- logInfo
- run
- setInstanceName
- setupGlobalResources
- setupLocalResources
- expressRouter
- getRouter
- getTriggerRegistry
- getType
- logDebug
- logError
- logInfo
• new default<T>(config, registry, configs): default<T>
| Name |
|---|
T |
| Name | Type |
|---|---|
config |
T |
registry |
RegistryService |
configs |
Object |
configs.config |
IConfigRawJSONDataType |
configs.dbConfig |
IDBConfigRawJSONDataType |
configs.redisConfig |
IRedisConfigRawJSONDataType |
configs.sensitiveConfig |
ISensitiveConfigRawJSONDataType |
default<T>
• appConfig: IConfigRawJSONDataType
• appDbConfig: IDBConfigRawJSONDataType
• appRedisConfig: IRedisConfigRawJSONDataType
ServiceProvider.appRedisConfig
• appSensitiveConfig: ISensitiveConfigRawJSONDataType
ServiceProvider.appSensitiveConfig
• config: T
• globalCustomServices: Object
▪ [name: string]: ServiceProvider<any>
ServiceProvider.globalCustomServices
• globalDatabaseConnection: DatabaseConnection
ServiceProvider.globalDatabaseConnection
• globalInstance: boolean = false
ServiceProvider.globalInstance
• globalMailProvider: default<any>
ServiceProvider.globalMailProvider
• globalPhoneProvider: default<any>
ServiceProvider.globalPhoneProvider
• globalRawDB: ItemizeRawDB
• globalRedis: ItemizeRedisClient
• globalRedisPub: ItemizeRedisClient
ServiceProvider.globalRedisPub
• globalRedisSub: ItemizeRedisClient
ServiceProvider.globalRedisSub
• globalRoot: default
• instanceName: string
• localAppData: IAppDataType
• localInstance: boolean = false
• registry: RegistryService
▸ execute(): void
Performs the execution of the service, basically it will do the run function and then re-run as specified
void
▸ expressRouter(options?): Router
| Name | Type |
|---|---|
options? |
RouterOptions |
Router
▸ getInstanceName(): string
string
ServiceProvider.getInstanceName
▸ getLocalizationFor(ip, fallback): Promise<IUserLocalizationType>
Should provide the localization for the user
| Name | Type | Description |
|---|---|---|
ip |
string |
the ip address |
fallback |
IUserLocalizationType |
- |
Promise<IUserLocalizationType>
server/services/base/UserLocalizationProvider.ts:19
▸ getRouter(appData): Router | Promise<Router>
Provides a router endpoint, the router endpoint will exist directly under the rest services this enables to create webhooks and other subservices that are attached to this service
If the service provider if executed on a global environment the endpoint does not get created, this means that in the global manager this won't be executed, or anything that is meant for the global manager
The router gets attached to /rest/service
| Name | Type |
|---|---|
appData |
IAppDataType |
Router | Promise<Router>
▸ getRunCycleTime(): number
Determines whether the run function should run over again
number
ServiceProvider.getRunCycleTime
▸ getTriggerRegistry(): ITriggerRegistry | Promise<ITriggerRegistry>
Allows to setup trigger registries via the service so that they trigger just as normal trigger will do
ITriggerRegistry | Promise<ITriggerRegistry>
ServiceProvider.getTriggerRegistry
▸ initialize(): void | Promise<void>
This function is executed during the initialization of the service
If your service is a global service you will have access to the global resources while this function executes
void | Promise<void>
▸ isInstanceGlobal(): boolean
boolean
ServiceProvider.isInstanceGlobal
▸ isInstanceLocal(): boolean
boolean
ServiceProvider.isInstanceLocal
▸ logDebug<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingStructure<T> |
void
▸ logError<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingErrorStructure<T> |
void
▸ logInfo<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingStructure<T> |
void
▸ run(): void | Promise<void>
Executes some code
void | Promise<void>
▸ setInstanceName(n): void
| Name | Type |
|---|---|
n |
string |
void
ServiceProvider.setInstanceName
▸ setupGlobalResources(globalDatabaseConnection, globalClient, globalPub, globalSub, globalMailProvider, globalPhoneProvider, globalCustomServices, root): void
| Name | Type |
|---|---|
globalDatabaseConnection |
DatabaseConnection |
globalClient |
ItemizeRedisClient |
globalPub |
ItemizeRedisClient |
globalSub |
ItemizeRedisClient |
globalMailProvider |
default<any> |
globalPhoneProvider |
default<any> |
globalCustomServices |
Object |
root |
default |
void
ServiceProvider.setupGlobalResources
▸ setupLocalResources(appData): void
| Name | Type |
|---|---|
appData |
IAppDataType |
void
ServiceProvider.setupLocalResources
▸ expressRouter(options?): Router
| Name | Type |
|---|---|
options? |
RouterOptions |
Router
▸ getRouter(appData): Router | Promise<Router>
Provides a router endpoint, but this method is static, which means it only gets added once
If the service provider if executed on a global environment the endpoint does not get created, this means that in the global manager this won't be executed, or anything that is meant for the global manager
the router gets attached to /rest/service
| Name | Type |
|---|---|
appData |
IAppDataType |
Router | Promise<Router>
▸ getTriggerRegistry(): ITriggerRegistry | Promise<ITriggerRegistry>
Allows to setup trigger registries via the service so that they trigger just as normal trigger will do
This gets attached if a class is used rather than per instance
ITriggerRegistry | Promise<ITriggerRegistry>
ServiceProvider.getTriggerRegistry
▸ getType(): ServiceProviderType
Specifies whether the current service is a global service if true global services will only execute initialize and a router will not be extracted from them
it will instead have access to the global resources
server/services/base/UserLocalizationProvider.ts:10
▸ logDebug<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingStructure<T> |
void
▸ logError<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingErrorStructure<T> |
void
▸ logInfo<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingStructure<T> |
void