@terascope/job-components / operations/operation-api / default
Class: abstract
default<T>
An API factory class for operations
Extends
default
<T
>
Extended by
Type parameters
Type parameter | Value |
---|---|
T | APIConfig |
Constructors
new default()
new default<
T
>(context
,apiConfig
,executionConfig
):default
<T
>
Parameters
Parameter | Type |
---|---|
context | Context |
apiConfig | APIConfig & T |
executionConfig | ExecutionConfig |
Returns
default
<T
>
Inherited from
Source
packages/job-components/src/operations/core/api-core.ts:23
Properties
apiConfig
readonly
apiConfig:Readonly
<APIConfig
&T
>
Inherited from
Source
packages/job-components/src/operations/core/api-core.ts:20
context
readonly
context:Readonly
<Context
>
Inherited from
Source
packages/job-components/src/operations/core/core.ts:10
deadLetterAction
deadLetterAction:
string
Inherited from
Source
packages/job-components/src/operations/core/api-core.ts:21
events
readonly
events:EventEmitter
<DefaultEventMap
>
Inherited from
Source
packages/job-components/src/operations/core/core.ts:13
executionConfig
readonly
executionConfig:Readonly
<ExecutionConfig
>
Inherited from
Source
packages/job-components/src/operations/core/core.ts:11
logger
readonly
logger:Logger
Inherited from
Source
packages/job-components/src/operations/core/core.ts:12
Methods
createAPI()
abstract
createAPI(...params
):Promise
<OpAPI
>
Called when the API is created with in another Operation. This will only be called once during an operation
Parameters
Parameter | Type |
---|---|
...params | any [] |
Returns
Promise
<OpAPI
>
an Operation API which is one of the following
- an object with function properties
- an instances of a class
- a function
Source
packages/job-components/src/operations/operation-api.ts:16
initialize()
initialize():
Promise
<void
>
Called during execution initialization, when this is called perform any async setup.
Returns
Promise
<void
>
Inherited from
Source
packages/job-components/src/operations/core/api-core.ts:37
rejectRecord()
rejectRecord(
input
,err
):null
Reject a record using the dead letter action
Based on OpConfig._dead_letter_action the transformation can be handled any of the following ways:
- "throw": throw the original error
- "log": log the error and the data
- "none": skip the error entirely OR a string to specify the api to use as the dead letter queue
Parameters
Parameter | Type |
---|---|
input | unknown |
err | Error |
Returns
null
null
Inherited from
Source
packages/job-components/src/operations/core/api-core.ts:79
shutdown()
shutdown():
Promise
<void
>
Called during execution shutdown, when this is cleanup any open connections or destroy any in-memory state.
Returns
Promise
<void
>
Inherited from
Source
packages/job-components/src/operations/core/api-core.ts:41
tryRecord()
tryRecord<
I
,R
>(fn
): (input
) =>null
|R
Try catch a transformation on a record and place any failed records in a dead letter queue
See #rejectRecord for handling
Type parameters
Type parameter |
---|
I |
R |
Parameters
Parameter | Type | Description |
---|---|---|
fn | (input ) => R | a function to transform the data with |
Returns
Function
a curried a function that will be called with the data and handle the dead letter action
Parameters
Parameter | Type |
---|---|
input | I |
Returns
null
| R