Skip to content

Class: ContainerKillOptions ​

The signal ContainerdContainer.kill sends to a running container, without waiting for it to exit. Every field is optional. A SIGKILL also tells containerd's restart monitor not to restart the container; the other signals do not. Unlike the Docker component's options, the signal may be a number, and all the processes can be signaled.

Example ​

typescript
import {Containerd} from 'lakutata/com/containerd'

declare const containerd: Containerd

const container = await containerd.getContainer('web')
//Reload nginx's configuration
await container.kill({signal: 'SIGHUP'})

Extends ​

Indexable ​

[prop: string | symbol]: any

Constructors ​

Constructor ​

new ContainerKillOptions(props?): ContainerKillOptions

Create a DTO from its data, validated against the class schema: the defaults applied, the keys without schema removed (unless the class has an @IndexSignature). The instance then validates each change of a property, or of a value nested in it (an array, an object): an invalid change throws an InvalidValueException and is undone.

Parameters ​

props? ​

Record<string, any>

The data of the DTO. Default: no data ({}).

Returns ​

ContainerKillOptions

Throws ​

When the data does not match the class schema.

Inherited from ​

DTO.constructor

Properties ​

all? ​

optional all?: boolean

Send it to all the container's processes, not only to its main process.

Default ​

ts
false

signal? ​

optional signal?: string | number

The signal: a name ('SIGTERM', 'TERM'), its number as a string ('15'), or a positive integer. An unknown name fails the call.

Default ​

ts
'SIGKILL'

Methods ​

Alternatives() ​

static Alternatives<TSchema>(...types): AlternativesSchema<TSchema>

Build a schema matching a value against several schemas, in order: the first one matching validates it.

Type Parameters ​

TSchema ​

TSchema = any

Parameters ​

types ​

...SchemaLike[]

The schemas tried in order.

Returns ​

AlternativesSchema<TSchema>

A new alternatives schema.

Inherited from ​

DTO.Alternatives


Any() ​

static Any<TSchema>(): AnySchema<TSchema>

Build a schema accepting any value (undefined included unless marked required()).

Type Parameters ​

TSchema ​

TSchema = any

Returns ​

AnySchema<TSchema>

A new schema.

Inherited from ​

DTO.Any


Array() ​

static Array<TSchema>(...types): ArraySchema<TSchema>

Build a schema of arrays whose items match one of the schemas given; strict.

Type Parameters ​

TSchema ​

TSchema = any[]

Parameters ​

types ​

...SchemaLikeWithoutArray[]

The schemas an item may match. Default: any item.

Returns ​

ArraySchema<TSchema>

A new array schema.

Inherited from ​

DTO.Array


AsyncFunction() ​

static AsyncFunction<TSchema>(): FunctionSchema<TSchema>

Build a schema of async functions (declared async); a function which only returns a promise is rejected.

Type Parameters ​

TSchema ​

TSchema = Function

Returns ​

FunctionSchema<TSchema>

A new function schema.

Inherited from ​

DTO.AsyncFunction


Attempt() ​

static Attempt<TSchema>(value, schema, options?): TSchema extends Schema<Value> ? Value : never

Validate a value against a schema and return the validated value. Unlike DTO.validate(), the default options of lakutata are not applied: an unknown key is rejected, not removed.

Type Parameters ​

TSchema ​

TSchema extends Schema

Parameters ​

value ​

any

The value to validate.

schema ​

TSchema

The schema to validate against.

options? ​

ValidationOptions

The validation options.

Returns ​

TSchema extends Schema<Value> ? Value : never

The validated value.

Throws ​

When the value does not match the schema.

Inherited from ​

DTO.Attempt


BigInt() ​

static BigInt<TSchema>(): BigIntSchema<TSchema>

Build a schema of bigints; strict: a value of another type is rejected, not converted.

Type Parameters ​

TSchema ​

TSchema = bigint

Returns ​

BigIntSchema<TSchema>

A new bigint schema.

Inherited from ​

DTO.BigInt


Binary() ​

static Binary<TSchema>(): BinarySchema<TSchema>

Build a schema of Buffers; strict: a value of another type is rejected, not converted.

Type Parameters ​

TSchema ​

TSchema = Buffer<ArrayBufferLike>

Returns ​

BinarySchema<TSchema>

A new binary schema.

Inherited from ​

DTO.Binary


Boolean() ​

static Boolean<TSchema>(): BooleanSchema<TSchema>

Build a schema of booleans; strict: a value of another type is rejected, not converted (the string 'true' is not a boolean).

Type Parameters ​

TSchema ​

TSchema = boolean

Returns ​

BooleanSchema<TSchema>

A new boolean schema.

Inherited from ​

DTO.Boolean


Build() ​

static Build<TSchema>(description): Schema<TSchema>

Rebuild a schema from its description (the output of schema.describe()), exactly.

Type Parameters ​

TSchema ​

TSchema = any

Parameters ​

description ​

Description

The description of the schema.

Returns ​

Schema<TSchema>

The schema.

Inherited from ​

DTO.Build


Class() ​

static Class<TSchema>(inheritsFrom?): FunctionSchema<TSchema>

Build a schema of classes, optionally of the subclasses of a class.

Type Parameters ​

TSchema ​

TSchema = Function

Parameters ​

inheritsFrom? ​

TSchema | (() => TSchema)

The class the value must be or extend, or a function returning it (for a class declared later). Default: any class.

Returns ​

FunctionSchema<TSchema>

A new function schema.

Inherited from ​

DTO.Class


Cron() ​

static Cron<TSchema>(options?): StringSchema<TSchema>

Build a schema of cron expression strings. The options not given default to: seconds allowed (6 fields), ? allowed for a day, 7 accepted as Sunday, no aliases (@daily).

Type Parameters ​

TSchema ​

TSchema = string

Parameters ​

options? ​

CronOptions

The cron syntax accepted.

Returns ​

StringSchema<TSchema>

A new string schema.

Inherited from ​

DTO.Cron


Date() ​

static Date<TSchema>(): DateSchema<TSchema>

Build a schema of Date objects; strict: a value of another type is rejected, not converted (a date string or a timestamp is not a date).

Type Parameters ​

TSchema ​

TSchema = Date

Returns ​

DateSchema<TSchema>

A new date schema.

Inherited from ​

DTO.Date


description() ​

static description(desc): typeof DTO

Set the description of the class schema, written into its JSON Schema and its descriptions. The description is not inherited by the subclasses.

Parameters ​

desc ​

string

The description.

Returns ​

typeof DTO

The class itself, for chaining.

Inherited from ​

DTO.description


fromJsonSchema() ​

static fromJsonSchema<T>(this, schema, options?): T

Create a DTO class (a subclass of the current DTO class) from an object JSON Schema (or an OpenAPI schema object), validating like JSON Schema: its properties become the properties of the DTO, its other keywords (unknown keys, pattern properties, key counts, dependencies, subschemas) constrain the whole object.

Type Parameters ​

T ​

T extends typeof DTO

Parameters ​

this ​

T

schema ​

JSONSchema

The JSON Schema of an object (or an OpenAPI schema object), or a reference ($ref) to one.

options? ​

FromJsonSchemaOptions & object

The version of the JSON Schema, where its references are resolved, whether the values are converted, and the name of the class. Default name: the title of the JSON Schema, else the current class name followed by FromJsonSchema.

Returns ​

T

The new DTO class.

Throws ​

When the JSON Schema does not describe objects, a reference cannot be resolved, or a pattern is not a valid regular expression.

Inherited from ​

DTO.fromJsonSchema


fromOpenAPI() ​

static fromOpenAPI<T>(this, document, options?): Record<string, T>

Create the DTO classes of the object schemas of an OpenAPI document (its components.schemas), by name; the references between the schemas are resolved in the document. The schemas which do not describe objects are skipped.

Type Parameters ​

T ​

T extends typeof DTO

Parameters ​

this ​

T

document ​

Record<string, unknown>

The OpenAPI 3.0 or 3.1 document.

options? ​

Omit<FromJsonSchemaOptions, "document">

How the JSON Schemas are read. Default dialect: the version of the document's openapi field.

Returns ​

Record<string, T>

The DTO classes, by the names of their schemas.

Throws ​

When the document has no components.schemas, or a schema cannot be converted.

Inherited from ​

DTO.fromOpenAPI


Function() ​

static Function<TSchema>(): FunctionSchema<TSchema>

Build a schema of functions; strict.

Type Parameters ​

TSchema ​

TSchema = Function

Returns ​

FunctionSchema<TSchema>

A new function schema.

Inherited from ​

DTO.Function


Glob() ​

static Glob<TSchema>(): StringSchema<TSchema>

Build a schema of glob pattern strings (*.ts, src/**).

Type Parameters ​

TSchema ​

TSchema = string

Returns ​

StringSchema<TSchema>

A new string schema.

Inherited from ​

DTO.Glob


HttpDocument() ​

static HttpDocument<TSchema>(): StringSchema<TSchema>

Build a schema of HTML or XML document strings.

Type Parameters ​

TSchema ​

TSchema = string

Returns ​

StringSchema<TSchema>

A new string schema.

Inherited from ​

DTO.HttpDocument


In() ​

static In(ref, options?): Reference

Create a reference to an array of the validated object, whose items are the values allowed, for valid() or invalid().

Parameters ​

ref ​

string

The path of the referenced array.

options? ​

ReferenceOptions

How the reference is resolved.

Returns ​

Reference

The reference.

Inherited from ​

DTO.In


InstanceOf() ​

static InstanceOf<TSchema>(constructor): AnySchema<TSchema>

Build a schema of the instances of a class (the instances of its subclasses included).

Type Parameters ​

TSchema ​

TSchema = Function

Parameters ​

constructor ​

TSchema

The class.

Returns ​

AnySchema<TSchema>

A new schema.

Inherited from ​

DTO.InstanceOf


isValid() ​

Call Signature ​

static isValid<T>(data): boolean

Check whether a value matches a schema (the class schema when none is given), without throwing.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

Returns ​

boolean

true when the value matches the schema, else false.

Inherited from ​

DTO.isValid

Call Signature ​

static isValid<T>(data, options): boolean

Check whether a value matches a schema (the class schema when none is given), without throwing.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

options ​

ValidationOptions

The validation options, merged with the defaults (unknown keys removed, the first error only).

Returns ​

boolean

true when the value matches the schema, else false.

Inherited from ​

DTO.isValid

Call Signature ​

static isValid<T>(data, schema): boolean

Check whether a value matches a schema (the class schema when none is given), without throwing.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

schema ​

Schema

The schema to check against, instead of the class schema.

Returns ​

boolean

true when the value matches the schema, else false.

Inherited from ​

DTO.isValid

Call Signature ​

static isValid<T>(data, schema, options): boolean

Check whether a value matches a schema (the class schema when none is given), without throwing.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

schema ​

Schema

The schema to check against, instead of the class schema.

options ​

ValidationOptions

The validation options, merged with the defaults (unknown keys removed, the first error only).

Returns ​

boolean

true when the value matches the schema, else false.

Inherited from ​

DTO.isValid


isValidAsync() ​

Call Signature ​

static isValidAsync<T>(data): Promise<boolean>

Check whether a value matches a schema (the class schema when none is given), without throwing; asynchronously, running the external rules of the schema.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

Returns ​

Promise<boolean>

A promise of true when the value matches the schema, else false.

Inherited from ​

DTO.isValidAsync

Call Signature ​

static isValidAsync<T>(data, options): Promise<boolean>

Check whether a value matches a schema (the class schema when none is given), without throwing; asynchronously, running the external rules of the schema.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

options ​

ValidationOptions

The validation options, merged with the defaults (unknown keys removed, the first error only).

Returns ​

Promise<boolean>

A promise of true when the value matches the schema, else false.

Inherited from ​

DTO.isValidAsync

Call Signature ​

static isValidAsync<T>(data, schema): Promise<boolean>

Check whether a value matches a schema (the class schema when none is given), without throwing; asynchronously, running the external rules of the schema.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

schema ​

Schema

The schema to check against, instead of the class schema.

Returns ​

Promise<boolean>

A promise of true when the value matches the schema, else false.

Inherited from ​

DTO.isValidAsync

Call Signature ​

static isValidAsync<T>(data, schema, options): Promise<boolean>

Check whether a value matches a schema (the class schema when none is given), without throwing; asynchronously, running the external rules of the schema.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

schema ​

Schema

The schema to check against, instead of the class schema.

options ​

ValidationOptions

The validation options, merged with the defaults (unknown keys removed, the first error only).

Returns ​

Promise<boolean>

A promise of true when the value matches the schema, else false.

Inherited from ​

DTO.isValidAsync


static Link<TSchema>(ref): LinkSchema<TSchema>

Build a schema linking to another schema of the same tree, for the recursive structures (a tree of nodes): #id for the schema given that id, / for the root, ... for an ancestor.

Type Parameters ​

TSchema ​

TSchema extends Schema

Parameters ​

ref ​

string

The path of the linked schema.

Returns ​

LinkSchema<TSchema>

A new link schema.

Inherited from ​

DTO.Link


Number() ​

static Number<TSchema>(): NumberSchema<TSchema>

Build a schema of numbers; strict: a value of another type is rejected, not converted (the string '5' is not the number 5).

Type Parameters ​

TSchema ​

TSchema = number

Returns ​

NumberSchema<TSchema>

A new number schema.

Inherited from ​

DTO.Number


Object() ​

static Object<TSchema, isStrict, T>(schema?): ObjectSchema<TSchema>

Build a schema of objects, with the schemas of their keys; strict. With the default validation options, the keys without schema are removed.

Type Parameters ​

TSchema ​

TSchema = any

isStrict ​

isStrict = false

T ​

T = TSchema

Parameters ​

schema? ​

SchemaMap<T, isStrict>

The schemas of the keys, by key. Default: no key declared.

Returns ​

ObjectSchema<TSchema>

A new object schema.

Inherited from ​

DTO.Object


optional() ​

static optional(): ObjectSchema

Get the class schema marked as optional: undefined is accepted (as by Schema()).

Returns ​

ObjectSchema

A new object schema.

Inherited from ​

DTO.optional


options() ​

static options(options): ObjectSchema

Get the class schema with its own validation options, which override the options of the validation for the object and its nested values.

Parameters ​

options ​

ValidationOptions

The validation options.

Returns ​

ObjectSchema

A new object schema.

Inherited from ​

DTO.options


Ref() ​

static Ref(key, options?): Reference

Create a reference to another value of the validated object (a sibling key by default), resolved at validation, for the rules comparing values (DTO.Number().greater(DTO.Ref('min'))).

Parameters ​

key ​

string

The path of the referenced value: a key, a.b for a nested key, /key from the root.

options? ​

ReferenceOptions

How the reference is resolved.

Returns ​

Reference

The reference.

Inherited from ​

DTO.Ref


required() ​

static required(): ObjectSchema

Get the class schema marked as required: undefined is rejected.

Returns ​

ObjectSchema

A new object schema.

Inherited from ​

DTO.required


Schema() ​

static Schema(): ObjectSchema

Get the class schema: an object schema of the properties declared with @Expect (the parents' included), with the @IndexSignature and the description of the class. The schema is optional (it accepts undefined): use required() for a required one.

Returns ​

ObjectSchema

The object schema; the same instance until a schema declaration changes.

Inherited from ​

DTO.Schema


String() ​

static String<TSchema>(): StringSchema<TSchema>

Build a schema of strings; strict: a value of another type is rejected, not converted.

Type Parameters ​

TSchema ​

TSchema = string

Returns ​

StringSchema<TSchema>

A new string schema.

Inherited from ​

DTO.String


Symbol() ​

static Symbol<TSchema>(): SymbolSchema<TSchema>

Build a schema of symbols; strict.

Type Parameters ​

TSchema ​

TSchema = Symbol

Returns ​

SymbolSchema<TSchema>

A new symbol schema.

Inherited from ​

DTO.Symbol


toJsonSchema() ​

static toJsonSchema(version?, options?): JSONSchema

Convert the class schema to a JSON Schema, for an API document or another validator. What JSON Schema cannot express (custom rules, references to other values) is dropped, so the JSON Schema may accept more values, never less.

Parameters ​

version? ​

"draft-2020-12" | "draft-2019-09" | "draft-07" | "draft-04"

The JSON Schema version to write. Default 'draft-2020-12'.

options? ​

Omit<ToJsonSchemaOptions, "target">

The validation options the schema is used with, whether $schema is written, and the object receiving the shared schemas. Default: no option ({}).

Returns ​

JSONSchema

A new JSON Schema.

Throws ​

When the version is unknown.

Inherited from ​

DTO.toJsonSchema


toOpenAPIJsonSchema() ​

static toOpenAPIJsonSchema(version?, options?): JSONSchema

Convert the class schema to an OpenAPI schema object, for the components.schemas of an OpenAPI document.

Parameters ​

version? ​

"3.0" | "3.1"

The OpenAPI version: '3.0' or '3.1'. Default '3.1'.

options? ​

Omit<ToJsonSchemaOptions, "target" | "dialect">

The validation options the schema is used with, and the object receiving the shared schemas. Default: no option ({}).

Returns ​

JSONSchema

A new OpenAPI schema object.

Inherited from ​

DTO.toOpenAPIJsonSchema


validate() ​

Call Signature ​

static validate<T>(data): T

Validate a value against a schema (the class schema when none is given).

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

Returns ​

T

The validated value: the defaults applied, the unknown keys removed (a plain object, not a DTO instance).

Throws ​

When the value does not match the schema (its cause holds the details).

Inherited from ​

DTO.validate

Call Signature ​

static validate<T>(data, options): T

Validate a value against a schema (the class schema when none is given).

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

options ​

ValidationOptions

The validation options, merged with the defaults (unknown keys removed, the first error only).

Returns ​

T

The validated value: the defaults applied, the unknown keys removed (a plain object, not a DTO instance).

Throws ​

When the value does not match the schema (its cause holds the details).

Inherited from ​

DTO.validate

Call Signature ​

static validate<T>(data, schema): T

Validate a value against a schema (the class schema when none is given).

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

schema ​

Schema

The schema to check against, instead of the class schema.

Returns ​

T

The validated value: the defaults applied, the unknown keys removed (a plain object, not a DTO instance).

Throws ​

When the value does not match the schema (its cause holds the details).

Inherited from ​

DTO.validate

Call Signature ​

static validate<T>(data, schema, options): T

Validate a value against a schema (the class schema when none is given).

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

schema ​

Schema

The schema to check against, instead of the class schema.

options ​

ValidationOptions

The validation options, merged with the defaults (unknown keys removed, the first error only).

Returns ​

T

The validated value: the defaults applied, the unknown keys removed (a plain object, not a DTO instance).

Throws ​

When the value does not match the schema (its cause holds the details).

Inherited from ​

DTO.validate


validateAsync() ​

Call Signature ​

static validateAsync<T>(data): Promise<T>

Validate a value against a schema (the class schema when none is given), asynchronously: the external rules of the schema (.external()) run, which the synchronous validation cannot run.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

Returns ​

Promise<T>

A promise of the validated value: the defaults applied, the unknown keys removed (a plain object, not a DTO instance).

Throws ​

When the value does not match the schema (the promise rejects; its cause holds the details).

Inherited from ​

DTO.validateAsync

Call Signature ​

static validateAsync<T>(data, options): Promise<T>

Validate a value against a schema (the class schema when none is given), asynchronously: the external rules of the schema (.external()) run, which the synchronous validation cannot run.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

options ​

ValidationOptions

The validation options, merged with the defaults (unknown keys removed, the first error only).

Returns ​

Promise<T>

A promise of the validated value: the defaults applied, the unknown keys removed (a plain object, not a DTO instance).

Throws ​

When the value does not match the schema (the promise rejects; its cause holds the details).

Inherited from ​

DTO.validateAsync

Call Signature ​

static validateAsync<T>(data, schema): Promise<T>

Validate a value against a schema (the class schema when none is given), asynchronously: the external rules of the schema (.external()) run, which the synchronous validation cannot run.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

schema ​

Schema

The schema to check against, instead of the class schema.

Returns ​

Promise<T>

A promise of the validated value: the defaults applied, the unknown keys removed (a plain object, not a DTO instance).

Throws ​

When the value does not match the schema (the promise rejects; its cause holds the details).

Inherited from ​

DTO.validateAsync

Call Signature ​

static validateAsync<T>(data, schema, options): Promise<T>

Validate a value against a schema (the class schema when none is given), asynchronously: the external rules of the schema (.external()) run, which the synchronous validation cannot run.

Type Parameters ​
T ​

T = any

Parameters ​
data ​

T

The value to check.

schema ​

Schema

The schema to check against, instead of the class schema.

options ​

ValidationOptions

The validation options, merged with the defaults (unknown keys removed, the first error only).

Returns ​

Promise<T>

A promise of the validated value: the defaults applied, the unknown keys removed (a plain object, not a DTO instance).

Throws ​

When the value does not match the schema (the promise rejects; its cause holds the details).

Inherited from ​

DTO.validateAsync

Released under the MIT License.