Job Components: `Execution Context Api Execution Context API`
execution-context/api.ExecutionContextAPI
A utility API exposed on the Terafoundation Context APIs. The following functionality is included:
- Registering Operation API
- Creating an API (usually done from an Operation), it also includes attaching the API to the Execution LifeCycle. An API will only be created once.
- Getting a reference to an API
Table of contents
Constructors
Accessors
Methods
Constructors
constructor
• new ExecutionContextAPI(context
, executionConfig
): ExecutionContextAPI
Parameters
Name | Type |
---|---|
context | Context |
executionConfig | ExecutionConfig |
Returns
Defined in
packages/job-components/src/execution-context/api.ts:36
Accessors
apis
• get
apis(): Readonly
<JobAPIInstances
>
Returns
Readonly
<JobAPIInstances
>
Defined in
packages/job-components/src/execution-context/api.ts:48
registry
• get
registry(): Record
<string
, any
>
For backwards compatibility
Returns
Record
<string
, any
>
Defined in
packages/job-components/src/execution-context/api.ts:44
Methods
addToRegistry
▸ addToRegistry(name
, API
): void
Add an API constructor to the registry
Parameters
Name | Type |
---|---|
name | string |
API | APIConstructor |
Returns
void
Defined in
packages/job-components/src/execution-context/api.ts:61
getAPI
▸ getAPI<T
>(name
): T
Get a reference to a specific operation API, the must be initialized and created
Type parameters
Name | Type |
---|---|
T | extends OpAPI = OpAPI |
Parameters
Name | Type |
---|---|
name | string |
Returns
T
Defined in
packages/job-components/src/execution-context/api.ts:109
getMetadata
▸ getMetadata(key?
): Promise
<AnyObject
>
Parameters
Name | Type |
---|---|
key? | string |
Returns
Promise
<AnyObject
>
Defined in
packages/job-components/src/execution-context/api.ts:174
getObserver
▸ getObserver<T
>(name
): T
Get a reference to a specific operation API, the must be initialized and created
Type parameters
Name | Type |
---|---|
T | extends default <APIConfig > = default <APIConfig > |
Parameters
Name | Type |
---|---|
name | string |
Returns
T
Defined in
packages/job-components/src/execution-context/api.ts:94
initAPI
▸ initAPI<T
>(name
, ...params
): Promise
<T
>
Create an instance of the API
Type parameters
Name | Type |
---|---|
T | extends OpAPI = OpAPI |
Parameters
Name | Type | Description |
---|---|---|
name | string | the name of API to create |
...params | any [] | any additional options that the API may need |
Returns
Promise
<T
>
Defined in
packages/job-components/src/execution-context/api.ts:126
makeLogger
▸ makeLogger(moduleName
, extra?
): Logger
Make a logger with a the job_id and ex_id in the logger context
Parameters
Name | Type |
---|---|
moduleName | string |
extra | AnyObject |
Returns
Defined in
packages/job-components/src/execution-context/api.ts:154
registerMetadataFns
▸ registerMetadataFns(fns
): void
Parameters
Name | Type |
---|---|
fns | MetadataFns |
Returns
void
Defined in
packages/job-components/src/execution-context/api.ts:52
setMetadata
▸ setMetadata(key
, value
): Promise
<void
>
Update metadata on the execution context Only update the metadata after the execution has been initialized
Parameters
Name | Type |
---|---|
key | string |
value | unknown |
Returns
Promise
<void
>