Protected
appThe base path directory where the canonical definitions reside.
Protected
Readonly
canonProtected
canonicalThe singular, programmatic name of one of these canonical items.
middleware
Protected
loadedObject mapping canonical names to loaded file references.
Protected
loadedObject mapping canonical namespaces to resolver functions.
Protected
Readonly
loggingThe current status of the unit.
Protected
suffixThe 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.
.service
.middleware
Private
appThe global application instance.
Get the plural name of the canonical items provided by this unit.
Get a Universal path to the base directory where this unit loads its canonical files from.
Protected
appGet the global Application.
Protected
buildProtected
Given the path to a file in the canonical items directory, create a CanonicalDefinition record from that file.
Optional
basePath: UniversalPathProtected
containerThis 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.
Get a canonical item by key.
Get the method with the given name from this class, bound to this class.
function
Get the method with the given name from this class, bound to this class.
function
Rest
...args: any[]Get a canonical item by key, throwing an error if it could not be found.
Called for each canonical item loaded from a file. This function should do any setup necessary and return the item that should be associated with the canonical name.
Protected
makeRegister 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.
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
Static
resolveResolve a canonical reference from its string form to a CanonicalReference.
CanonicalReference
A canonical unit that resolves Queueable classes from
app/jobs
and sets up any non-default queues.