@terascope/job-components / operations/api-factory / default
Class: abstract
default<T, C>
Defined in: packages/job-components/src/operations/api-factory.ts:4
An API factory class for operations
Extends
Type Parameters
Type Parameter |
---|
T |
C |
Constructors
new default()
new default<
T
,C
>(context
,apiConfig
,executionConfig
):default
<T
,C
>
Defined in: packages/job-components/src/operations/core/api-core.ts:23
Parameters
Parameter | Type |
---|---|
context | Context |
apiConfig | APIConfig |
executionConfig | ExecutionConfig |
Returns
default
<T
, C
>
Inherited from
Properties
Property | Modifier | Type | Inherited from | Defined in |
---|---|---|---|---|
_configRegistry | readonly | Map <string , C > | - | packages/job-components/src/operations/api-factory.ts:6 |
_registry | readonly | Map <string , T > | - | packages/job-components/src/operations/api-factory.ts:5 |
apiConfig | readonly | Readonly <APIConfig > | default .apiConfig | packages/job-components/src/operations/core/api-core.ts:20 |
context | readonly | Readonly <Context > | default .context | packages/job-components/src/operations/core/core.ts:10 |
deadLetterAction | public | string | default .deadLetterAction | packages/job-components/src/operations/core/api-core.ts:21 |
events | readonly | EventEmitter | default .events | packages/job-components/src/operations/core/core.ts:13 |
executionConfig | readonly | Readonly <ExecutionConfig > | default .executionConfig | packages/job-components/src/operations/core/core.ts:11 |
logger | readonly | Logger | default .logger | packages/job-components/src/operations/core/core.ts:12 |
Methods
create()
abstract
create(name
,config
):Promise
<{client
:T
;config
:C
; }>
Defined in: packages/job-components/src/operations/api-factory.ts:8
Parameters
Parameter | Type |
---|---|
name | string |
config | Partial <C > |
Returns
Promise
<{ client
: T
; config
: C
; }>
createAPI()
createAPI():
Promise
<APIFactoryRegistry
<T
,C
>>
Defined in: packages/job-components/src/operations/api-factory.ts:15
Called when the API is created with in another Operation. This will only be called once during an operation
Returns
Promise
<APIFactoryRegistry
<T
, C
>>
an Operation API which is one of the following
- an object with function properties
- an instances of a class
- a function
Overrides
initialize()
initialize():
Promise
<void
>
Defined in: packages/job-components/src/operations/core/api-core.ts:37
Called during execution initialization, when this is called perform any async setup.
Returns
Promise
<void
>
Inherited from
rejectRecord()
rejectRecord(
input
,err
):null
Defined in: packages/job-components/src/operations/core/api-core.ts:79
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
remove()
abstract
remove(name
):Promise
<void
>
Defined in: packages/job-components/src/operations/api-factory.ts:13
Parameters
Parameter | Type |
---|---|
name | string |
Returns
Promise
<void
>
shutdown()
shutdown():
Promise
<void
>
Defined in: packages/job-components/src/operations/core/api-core.ts:41
Called during execution shutdown, when this is cleanup any open connections or destroy any in-memory state.
Returns
Promise
<void
>
Inherited from
tryRecord()
tryRecord<
I
,R
>(fn
): (input
) =>null
|R
Defined in: packages/job-components/src/operations/core/api-core.ts:54
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