Options
All
  • Public
  • Public/Protected
  • All
Menu

GBCoreService contains main logic for handling storage services related to instance handling. When the server starts a instance is needed and if no instance is found a boot instance is created. After that high-level instance management methods can be created. Core scheduling, base network services are also handled in this service.

Hierarchy

  • GBCoreService

Implements

  • IGBCoreService

Index

Constructors

constructor

Properties

adminService

adminService: GBAdminService

Administrative services.

Private changeColumnQuery

changeColumnQuery: (tableName: string, attributes: any) => string

Custom change column query.

Type declaration

    • (tableName: string, attributes: any): string
    • Parameters

      • tableName: string
      • attributes: any

      Returns string

Private createTableQuery

createTableQuery: (tableName: string, attributes: any, options: any) => string

Custom create table query.

Type declaration

    • (tableName: string, attributes: any, options: any): string
    • Parameters

      • tableName: string
      • attributes: any
      • options: any

      Returns string

Private dialect

dialect: string

Dialect used. Tested: mssql and sqlite.

Private queryGenerator

queryGenerator: any

Allows filtering on SQL generated before send to the database.

sequelize

sequelize: Sequelize

Data access layer instance.

Methods

Private changeColumnQueryOverride

  • changeColumnQueryOverride(tableName: any, attributes: any): string
  • SQL: let sql = '' + 'ALTER TABLE [UserGroup]' + ' ADD CONSTRAINT [invalid1] FOREIGN KEY ([userId1], [userId2], [userId3]) REFERENCES [User] ([userId1], [userId2], [userId3]) ON DELETE NO ACTION,' + ' CONSTRAINT [invalid2] FOREIGN KEY ([groupId1], [groupId2]) REFERENCES [Group] ([groupId1], [groupId2]) ON DELETE NO ACTION, ' + ' CONSTRAINT [invalid3] FOREIGN KEY ([instanceId1]) REFERENCES [Instance] ([instanceId1]) ON DELETE NO ACTION'

    Parameters

    • tableName: any
    • attributes: any

    Returns string

checkStorage

  • checkStorage(installationDeployer: IGBInstallationDeployer): Promise<void>

createBootInstance

  • createBootInstance(core: GBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string): Promise<any>
  • Creates the first bot instance (boot instance) used to "boot" the server. At least one bot is required to perform conversational administrative tasks. So a base main bot is always deployed and will act as root bot for configuration tree with three levels: .env > root bot > all other bots.

    Parameters

    • core: GBCoreService
    • installationDeployer: IGBInstallationDeployer
    • proxyAddress: string

    Returns Promise<any>

Private createTableQueryOverride

  • createTableQueryOverride(tableName: any, attributes: any, options: any): string
  • SQL:

    // let sql: string = '' + // 'IF OBJECT_ID('[UserGroup]', 'U') IS NULL' + // 'CREATE TABLE [UserGroup] (' + // ' [id] INTEGER NOT NULL IDENTITY(1,1),' + // ' [userId] INTEGER NULL,' + // ' [groupId] INTEGER NULL,' + // ' [instanceId] INTEGER NULL,' + // ' PRIMARY KEY ([id1], [id2]),' + // ' FOREIGN KEY ([userId1], [userId2], [userId3]) REFERENCES [User] ([userId1], [userId2], [userId3]) ON DELETE NO ACTION,' + // ' FOREIGN KEY ([groupId1], [groupId2]) REFERENCES [Group] ([groupId1], [groupId1]) ON DELETE NO ACTION,' + // ' FOREIGN KEY ([instanceId]) REFERENCES [Instance] ([instanceId]) ON DELETE NO ACTION)'

    Parameters

    • tableName: any
    • attributes: any
    • options: any

    Returns string

deleteInstance

  • deleteInstance(botId: string): Promise<void>

ensureAdminIsSecured

  • ensureAdminIsSecured(): void

ensureInstances

  • ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService): Promise<void>

ensureProxy

  • ensureProxy(port: any): Promise<string>
  • Certifies that network servers will reach back the development machine when calling back from web services. This ensures that reverse proxy is established.

    Parameters

    • port: any

    Returns Promise<string>

getParam

  • getParam<T>(instance: IGBInstance, name: string, defaultValue?: T): any
  • Get a dynamic param from instance. Dynamic params are defined in Config.xlsx and loaded into the work folder from /publish command.

    Type parameters

    • T

    Parameters

    • instance: IGBInstance
    • name: string

      Name of param to get from instance.

    • Optional defaultValue: T

      Value returned when no param is defined in Config.xlsx.

    Returns any

initStorage

  • initStorage(): Promise<any>

installWebHook

  • installWebHook(isGet: boolean, url: string, callback: any): void

loadAllInstances

  • loadAllInstances(core: IGBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string): Promise<any[]>
  • Loads all bot instances from object storage, if it's formatted.

    Parameters

    • core: IGBCoreService
    • installationDeployer: IGBInstallationDeployer
    • proxyAddress: string

    Returns Promise<any[]>

loadInstanceByActivationCode

  • loadInstanceByActivationCode(code: string): Promise<IGBInstance>

loadInstanceByBotId

  • loadInstanceByBotId(botId: string): Promise<IGBInstance>

loadInstanceById

  • loadInstanceById(instanceId: number): Promise<IGBInstance>

loadInstances

  • loadInstances(): Promise<IGBInstance[]>

loadSchedules

  • loadSchedules(): Promise<any>

loadSysPackages

openBrowserInDevelopment

  • openBrowserInDevelopment(): void

Private openStorageFrontier

  • openStorageFrontier(installationDeployer: IGBInstallationDeployer): Promise<void>

saveInstance

setEntryPointDialog

  • setEntryPointDialog(dialogName: string): void

setWWWRoot

  • setWWWRoot(localPath: string): void

syncDatabaseStructure

  • syncDatabaseStructure(): Promise<Sequelize>

writeEnv

  • writeEnv(instance: IGBInstance): Promise<void>
  • Writes .env required to start the full server. Used during first startup, when user is asked some questions to create the full base environment.

    Parameters

    • instance: IGBInstance

    Returns Promise<void>

Generated using TypeDoc