Services
Defined in: core/src/utils/utils.services.ts:28
A lazy dependency-injection container: services are classes constructed with
the container itself and cached as singletons per instance. Defaults to an
in-memory databaseCreator and bucketCreator when none are supplied, which
is what lets a test construct one with no arguments.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Services(options?): Services;Defined in: core/src/utils/utils.services.ts:33
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
ServiceOptions |
Returns
Section titled “Returns”Services
Properties
Section titled “Properties”[instanceKey]
Section titled “[instanceKey]”[instanceKey]: Map<ServiceDependency<unknown>, unknown>;Defined in: core/src/utils/utils.services.ts:29
Accessors
Section titled “Accessors”bucketCreator
Section titled “bucketCreator”Get Signature
Section titled “Get Signature”get bucketCreator(): BucketCreator;Defined in: core/src/utils/utils.services.ts:45
The storage factory used to open buckets for this container.
Returns
Section titled “Returns”databaseCreator
Section titled “databaseCreator”Get Signature
Section titled “Get Signature”get databaseCreator(): DatabaseCreator;Defined in: core/src/utils/utils.services.ts:40
The dialect factory used to open databases for this container.
Returns
Section titled “Returns”Methods
Section titled “Methods”clone()
Section titled “clone()”clone(): Services;Defined in: core/src/utils/utils.services.ts:67
Returns a new container sharing a shallow copy of the current instance cache.
Returns
Section titled “Returns”Services
destroy()
Section titled “destroy()”destroy(): Promise<void>;Defined in: core/src/utils/utils.services.ts:79
Tears down all cached services, awaiting each one’s [destroy] method if it defines one.
Returns
Section titled “Returns”Promise<void>
get<T>(service): T;Defined in: core/src/utils/utils.services.ts:50
Resolves a service, constructing and caching it on first request. Throws if construction yields no instance.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
service |
ServiceDependency<T> |
Returns
Section titled “Returns”T
set<T>(service, instance): void;Defined in: core/src/utils/utils.services.ts:62
Overrides the cached instance for a service, e.g. to inject a stub in tests.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
service |
ServiceDependency<T> |
instance |
Partial<T> |
Returns
Section titled “Returns”void