Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ValidationUnit

Hierarchy

  • Canonical<z.ZodType<unknown>>
    • ValidationUnit

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 = 'type'

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

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 = '.js'

The file suffix of files in the base path that should be loaded. This should EXCLUDE .js or .ts. These file extensions are determined by the framework depending on the Node runtime.

Accessors

Private appClassApplication

canonicalItems

  • get canonicalItems(): string

path

Methods

all

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

Protected app

Protected buildCanonicalDefinition

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

  • get(key: string): undefined | ZodType<unknown, ZodTypeDef, unknown>

getBoundMethod

  • getBoundMethod(methodName: string): (...args: any[]) => any
  • Get the method with the given name from this class, bound to this class.

    Parameters

    • methodName: string

    Returns (...args: any[]) => any

    function

      • (...args: any[]): any
      • Parameters

        • Rest ...args: any[]

        Returns any

getOrFail

  • getOrFail(key: string): ZodType<unknown, ZodTypeDef, unknown>

initCanonicalItem

  • initCanonicalItem(definition: CanonicalDefinition): Promise<ZodType<unknown, ZodTypeDef, unknown>>

isValidSuffix

  • isValidSuffix(path: string): boolean

Protected make

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

namespaces

  • namespaces(): string[]

registerNamespace

  • registerNamespace(name: string, resolver: CanonicalResolver<ZodType<unknown, ZodTypeDef, unknown>>): void
  • 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

safe

  • safe(key: string): Safe

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.