Options
All
  • Public
  • Public/Protected
  • All
Menu

Service unit that loads and instantiates migration classes.

Hierarchy

Index

Constructors

constructor

Properties

Protected appPath

appPath: string[] = ...

The base path directory where the canonical definitions reside.

Protected Readonly canon

canon: Canon

Protected canonicalItem

canonicalItem: string = 'migration'

The singular, programmatic name of one of these canonical items.

Protected Readonly cli

Protected loadedItems

loadedItems: {} = {}

Object mapping canonical names to loaded file references.

Type declaration

  • [key: string]: T

Protected loadedNamespaces

loadedNamespaces: {} = {}

Object mapping canonical namespaces to resolver functions.

Type declaration

Protected Readonly logging

logging: Logging

status

status: UnitStatus = ...

The current status of the unit.

Protected suffix

suffix: string = '.migration.js'

The file suffix of files in the base path that should be loaded.

Accessors

Private appClassApplication

canonicalItems

  • get canonicalItems(): string

path

Methods

all

  • all(namespace?: string): string[]

Protected app

Protected buildCanonicalDefinition

buildMigrationNamespaceResolver

  • Creates a CanonicalResolver for a directory that contains migration files.

    example
    const path = universalPath('path', 'to', 'migrations', 'folder')
    const namespace = '@mypackage'
    
    const resolver = await migrations.buildMigrationNamespaceResolver(namespace, path)
    migrations.registerNamespace(namespace, resolver)
    

    Parameters

    Returns Promise<CanonicalResolver<Migration>>

Protected container

down

  • down(): void | Promise<void>
  • This method is called to stop the unit when the application is shutting down. Here, you should do any teardown required to stop the package cleanly.

    IN PARTICULAR take care to free blocking resources that could prevent the process from exiting without a kill.

    Returns void | Promise<void>

get

getBoundMethod

  • getBoundMethod(methodName: string): (...args: any[]) => any

initCanonicalItem

Protected make

  • make<T>(target: any, ...parameters: any[]): T

namespaces

  • namespaces(): string[]

registerNamespace

  • Register a namespace resolver with the canonical unit.

    Namespaces are canonical names that start with a particular key, beginning with the @ character, which resolve their resources using a resolver function.

    example
    const items = {
        'foo:bar': 123,
        'bob': 456,
    }
    
    const resolver = (key: string) => items[key]
    
    canonical.registerNamespace('@mynamespace', resolver)
    

    Now, the items in the @mynamespace namespace can be accessed like so:

    canonical.get('@mynamespace:foo:bar')  // => 123
    canonical.get('@mynamespace:bob')  // => 456
    

    Parameters

    Returns void

up

  • up(): Promise<void>

Static resolve

Extollo Logo

extollo (v. latin) - to lift up, to elevate

Extollo is a free & libre application framework in TypeScript.