Job Components: `Operations Api Factory Default`
operations/api-factory.default
An API factory class for operations
Type parameters
Name |
---|
T |
C |
Hierarchy
-
↳
default
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new default<T
, C
>(context
, apiConfig
, executionConfig
): default
<T
, C
>
Type parameters
Name |
---|
T |
C |
Parameters
Name | Type |
---|---|
context | WorkerContext |
apiConfig | APIConfig |
executionConfig | ExecutionConfig |
Returns
default
<T
, C
>
Inherited from
Defined in
packages/job-components/src/operations/core/api-core.ts:23
Properties
_configRegistry
• Protected
Readonly
_configRegistry: Map
<string
, C
>
Defined in
packages/job-components/src/operations/api-factory.ts:6
_registry
• Protected
Readonly
_registry: Map
<string
, T
>
Defined in
packages/job-components/src/operations/api-factory.ts:5
apiConfig
• Readonly
apiConfig: Readonly
<APIConfig
>
Inherited from
Defined in
packages/job-components/src/operations/core/api-core.ts:20
context
• Readonly
context: Readonly
<WorkerContext
>
Inherited from
Defined in
packages/job-components/src/operations/core/core.ts:10
deadLetterAction
• deadLetterAction: string
Inherited from
Defined in
packages/job-components/src/operations/core/api-core.ts:21
events
• Readonly
events: EventEmitter
Inherited from
Defined in
packages/job-components/src/operations/core/core.ts:13
executionConfig
• Readonly
executionConfig: Readonly
<ExecutionConfig
>
Inherited from
Defined in
packages/job-components/src/operations/core/core.ts:11
logger
• Readonly
logger: Logger
Inherited from
Defined in
packages/job-components/src/operations/core/core.ts:12
Methods
create
▸ create(name
, config
): Promise
<{ client
: T
; config
: C
}>
Parameters
Name | Type |
---|---|
name | string |
config | Partial <C > |
Returns
Promise
<{ client
: T
; config
: C
}>
Defined in
packages/job-components/src/operations/api-factory.ts:8
createAPI
▸ createAPI(): Promise
<APIFactoryRegistry
<T
, C
>>
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
Defined in
packages/job-components/src/operations/api-factory.ts:15
initialize
▸ initialize(): Promise
<void
>
Called during execution initialization, when this is called perform any async setup.
Returns
Promise
<void
>
Inherited from
Defined in
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
Name | Type |
---|---|
input | unknown |
err | Error |
Returns
null
null
Inherited from
Defined in
packages/job-components/src/operations/core/api-core.ts:79
remove
▸ remove(name
): Promise
<void
>
Parameters
Name | Type |
---|---|
name | string |
Returns
Promise
<void
>
Defined in
packages/job-components/src/operations/api-factory.ts:13
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
Defined in
packages/job-components/src/operations/core/api-core.ts:41
tryRecord
▸ tryRecord<I
, R
>(fn
): (input
: I
) => 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
Name |
---|
I |
R |
Parameters
Name | Type | Description |
---|---|---|
fn | (input : I ) => R | a function to transform the data with |
Returns
fn
a curried a function that will be called with the data and handle the dead letter action
▸ (input
): null
| R
Try catch a transformation on a record and place any failed records in a dead letter queue
See #rejectRecord for handling
Parameters
Name | Type |
---|---|
input | I |
Returns
null
| R
a curried a function that will be called with the data and handle the dead letter action