Skip to main content

@terascope/job-components / operations/convict-schema / default

Class: abstract default<T, S>

A base class for supporting convict "Schema" definitions

Extends

Extended by

Type parameters

Type parameterValue
T extends Record<string, any>-
Sany

Constructors

new default()

new default<T, S>(context, opType): default<T, S>

Parameters

ParameterTypeDefault value
contextContextundefined
opTypeOpType'operation'

Returns

default<T, S>

Overrides

default.constructor

Source

packages/job-components/src/operations/convict-schema.ts:21

Properties

context

protected context: Context

Inherited from

default.context

Source

packages/job-components/src/operations/core/schema-core.ts:8


opType

readonly opType: OpType

Inherited from

default.opType

Source

packages/job-components/src/operations/core/schema-core.ts:9


schema

schema: Schema<S>

Source

packages/job-components/src/operations/convict-schema.ts:19

Methods

build()

abstract build<U>(context?): Schema<S & U>

Type parameters

Type parameterValue
Uany

Parameters

ParameterType
context?Context

Returns

Schema<S & U>

Overrides

default.build

Source

packages/job-components/src/operations/convict-schema.ts:102


ensureAPIFromConfig()

ensureAPIFromConfig(apiName, job, config): void

This method will make sure that the api exists on the job, if it does not then it will inject it using apiName provided and with the config key/values provided. If the api does exist it will compare the apiConfig against the provided config. If the key/values do not match, then it will throw

Parameters

ParameterType
apiNamestring
jobValidatedJobConfig
configRecord<string, any>

Returns

void

Example

const job = newTestJobConfig({
operations: [
{ _op: 'test-reader' },
{ _op: 'noop' },
]
});

schema.ensureAPIFromConfig('someApi', job, { some: 'configs' });

job === {
apis: [{ _name: 'someApi', some: 'configs' }],
operations: [
{ _op: 'test-reader' },
{ _op: 'noop' },
]
}

Source

packages/job-components/src/operations/convict-schema.ts:65


validate()

validate(inputConfig)

validate(inputConfig): APIConfig & T

Parameters
ParameterType
inputConfigRecord<string, any>
Returns

APIConfig & T

Overrides

default.validate

Source

packages/job-components/src/operations/convict-schema.ts:26

validate(inputConfig)

validate(inputConfig): OpConfig & T

Parameters
ParameterType
inputConfigRecord<string, any>
Returns

OpConfig & T

Overrides

SchemaCore.validate

Source

packages/job-components/src/operations/convict-schema.ts:27


validateJob()

validateJob(_job): void

Parameters

ParameterType
_jobValidatedJobConfig

Returns

void

Overrides

default.validateJob

Source

packages/job-components/src/operations/convict-schema.ts:36


type()

static type(): string

Returns

string

Source

packages/job-components/src/operations/convict-schema.ts:98