@jettacargo/activity-handler 1.0.0-alpha.20 → 1.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -61
- package/build/error/ActivityHandlerMessage.d.ts +9 -0
- package/build/error/ActivityHandlerMessage.js +10 -0
- package/build/error/ActivityHandlerMessage.js.map +1 -0
- package/build/error/CatalogFatalError.d.ts +1 -0
- package/build/error/CatalogFatalError.js +2 -0
- package/build/error/CatalogFatalError.js.map +1 -0
- package/build/error/CatalogMessages.d.ts +10 -0
- package/build/error/CatalogMessages.js +42 -0
- package/build/error/CatalogMessages.js.map +1 -0
- package/build/error/CatalogTemporaryError.d.ts +1 -0
- package/build/error/CatalogTemporaryError.js +2 -0
- package/build/error/CatalogTemporaryError.js.map +1 -0
- package/build/error/Fatal.d.ts +1 -3
- package/build/error/Fatal.js +1 -6
- package/build/error/Fatal.js.map +1 -1
- package/build/error/HandleWorkflowErrorSignal.d.ts +9 -1
- package/build/error/HandleWorkflowErrorSignal.js +29 -13
- package/build/error/HandleWorkflowErrorSignal.js.map +1 -1
- package/build/error/Temporary.d.ts +1 -3
- package/build/error/Temporary.js +1 -6
- package/build/error/Temporary.js.map +1 -1
- package/build/exceptions/ErrorTypeMismatch.d.ts +2 -2
- package/build/exceptions/ErrorTypeMismatch.js +4 -3
- package/build/exceptions/ErrorTypeMismatch.js.map +1 -1
- package/build/exceptions/FailedRetrievingFileFromS3Exception.d.ts +7 -3
- package/build/exceptions/FailedRetrievingFileFromS3Exception.js +8 -4
- package/build/exceptions/FailedRetrievingFileFromS3Exception.js.map +1 -1
- package/build/handler/ActivityHandler.d.ts +2 -0
- package/build/handler/ActivityHandler.js +13 -16
- package/build/handler/ActivityHandler.js.map +1 -1
- package/build/handler/InputReader.d.ts +2 -1
- package/build/handler/InputReader.js +29 -12
- package/build/handler/InputReader.js.map +1 -1
- package/build/handler/OutputWriter.js +1 -1
- package/build/handler/OutputWriter.js.map +1 -1
- package/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/package.json +25 -22
package/README.md
CHANGED
|
@@ -1,79 +1,69 @@
|
|
|
1
1
|
# @jettacargo/activity-handler
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared helper for Temporal activities in the load flow. It downloads the activity input, runs a callback, uploads the callback result, and turns thrown errors into Temporal application failures.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Requirements
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Node.js 24
|
|
8
|
+
- npm
|
|
9
|
+
- ESM only (`"type": "module"`)
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
- **Resilient Error Handling**: Automatically categorizes exceptions into Temporal's `ApplicationFailure` (Retryable vs. Non-Retryable) based on whether they are expected `TemporaryError` or `FatalError` variants.
|
|
11
|
-
- **Contextual Logging**: Automatically injects standard Cargo information (Company and Cargo ID) into your application logs using `@jetta/logger`.
|
|
12
|
-
- **Strict Typing**: Built with TypeScript, ensuring full type-safety for event metadata, callback signatures, and payload interfaces.
|
|
11
|
+
## Dependencies
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
- `@temporalio/common` — `ApplicationFailure` used when a callback throws
|
|
14
|
+
- `@jettacargo/load-models` — `EventMetadata`, `CommonInput`, `ActivityCallback`, `EventStatus`
|
|
15
|
+
- `@jetta/s3` — read and write the JSON payloads referenced by the event
|
|
16
|
+
- `@jetta/logger` — cargo-scoped logs (`company`, `cargo_id`)
|
|
17
|
+
|
|
18
|
+
## How to install
|
|
19
|
+
|
|
20
|
+
As a dependency:
|
|
15
21
|
|
|
16
22
|
```bash
|
|
17
23
|
npm install @jettacargo/activity-handler
|
|
18
24
|
```
|
|
19
25
|
|
|
26
|
+
Local checkout:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
npm run build
|
|
31
|
+
```
|
|
32
|
+
|
|
20
33
|
## Usage
|
|
21
34
|
|
|
22
|
-
|
|
35
|
+
`handle_activity` takes the incoming event, a source name, and the business callback.
|
|
23
36
|
|
|
24
37
|
```typescript
|
|
25
|
-
import handle_activity from '@jettacargo/activity-handler'
|
|
26
|
-
import { ActivityCallback, CommonInput, EventMetadata } from '@jettacargo/load-models'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// 2. Export the temporal activity wrapper
|
|
40
|
-
export async function my_temporal_activity(event_metadata: EventMetadata): Promise<EventMetadata> {
|
|
41
|
-
const source = 'MY_SERVICE_NAME';
|
|
42
|
-
|
|
43
|
-
// handle_activity will take care of reading the input, running the callback,
|
|
44
|
-
// handling potential Temporal retries, and writing the final output to S3.
|
|
45
|
-
return await handle_activity(event_metadata, source, my_activity_callback);
|
|
38
|
+
import { handle_activity, FatalError, TemporaryError } from '@jettacargo/activity-handler'
|
|
39
|
+
import { ActivityCallback, CommonInput, EventMetadata, EventStatus } from '@jettacargo/load-models'
|
|
40
|
+
|
|
41
|
+
const run_activity: ActivityCallback = async (input: CommonInput) =>
|
|
42
|
+
{
|
|
43
|
+
return {
|
|
44
|
+
status: EventStatus.SUCCESS,
|
|
45
|
+
data: input
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function my_temporal_activity(event_metadata: EventMetadata): Promise<EventMetadata>
|
|
50
|
+
{
|
|
51
|
+
return await handle_activity(event_metadata, 'my-service', run_activity)
|
|
46
52
|
}
|
|
47
53
|
```
|
|
48
54
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
1.
|
|
52
|
-
2.
|
|
53
|
-
3.
|
|
54
|
-
4.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* **Build**: Compiles the TypeScript source into the `build/` directory.
|
|
65
|
-
```bash
|
|
66
|
-
npm run build
|
|
67
|
-
```
|
|
68
|
-
* **Test**: Executes the Mocha test suite validating handler pathways.
|
|
69
|
-
```bash
|
|
70
|
-
npm run test
|
|
71
|
-
```
|
|
72
|
-
* **Lint**: Runs ESLint to verify codebase standards.
|
|
73
|
-
```bash
|
|
74
|
-
npm run lint
|
|
75
|
-
```
|
|
76
|
-
* **Lint Fix**: Automatically fixes code formatting style errors.
|
|
77
|
-
```bash
|
|
78
|
-
npm run lint:fix
|
|
79
|
-
```
|
|
55
|
+
Flow:
|
|
56
|
+
|
|
57
|
+
1. `InputReader` downloads the JSON at `event_metadata.data` and parses a `CommonInput`.
|
|
58
|
+
2. The callback runs inside a logger scope set from `cargo_info`.
|
|
59
|
+
3. `OutputWriter` uploads `output.data` and returns a new URI.
|
|
60
|
+
4. The returned `EventMetadata` carries that URI and the callback status.
|
|
61
|
+
|
|
62
|
+
Throw `FatalError` for a non-retryable failure and `TemporaryError` for a retryable one. Other errors are mapped to a Temporal `ApplicationFailure`. `handle_workflow_error_signal` is exported for callers that classify an error before returning a failure payload.
|
|
63
|
+
|
|
64
|
+
## Scripts
|
|
65
|
+
|
|
66
|
+
- `npm run build` — compile TypeScript into `build/`
|
|
67
|
+
- `npm test` — Mocha tests
|
|
68
|
+
- `npm run lint` — ESLint on `src/`
|
|
69
|
+
- `npm run coverage` — tests with an 80% coverage gate
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Dotted keys of the `activity_handler` namespace of the jettacargo_messages catalog. */
|
|
2
|
+
export declare const ACTIVITY_HANDLER_MESSAGE: Readonly<{
|
|
3
|
+
INVALID_S3_URI: "activity_handler.151001";
|
|
4
|
+
S3_ADDRESS_UNDEFINED: "activity_handler.151002";
|
|
5
|
+
UNEXPECTED_ERROR: "activity_handler.154001";
|
|
6
|
+
S3_NO_DATA: "activity_handler.154002";
|
|
7
|
+
S3_INVALID_JSON: "activity_handler.154003";
|
|
8
|
+
ERROR_TYPE_MISMATCH: "activity_handler.154004";
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Dotted keys of the `activity_handler` namespace of the jettacargo_messages catalog. */
|
|
2
|
+
export const ACTIVITY_HANDLER_MESSAGE = Object.freeze({
|
|
3
|
+
INVALID_S3_URI: 'activity_handler.151001',
|
|
4
|
+
S3_ADDRESS_UNDEFINED: 'activity_handler.151002',
|
|
5
|
+
UNEXPECTED_ERROR: 'activity_handler.154001',
|
|
6
|
+
S3_NO_DATA: 'activity_handler.154002',
|
|
7
|
+
S3_INVALID_JSON: 'activity_handler.154003',
|
|
8
|
+
ERROR_TYPE_MISMATCH: 'activity_handler.154004'
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=ActivityHandlerMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivityHandlerMessage.js","sourceRoot":"","sources":["../../src/error/ActivityHandlerMessage.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,cAAc,EAAE,yBAAyB;IACzC,oBAAoB,EAAE,yBAAyB;IAC/C,gBAAgB,EAAE,yBAAyB;IAC3C,UAAU,EAAE,yBAAyB;IACrC,eAAe,EAAE,yBAAyB;IAC1C,mBAAmB,EAAE,yBAAyB;CACjD,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CatalogFatalError, CatalogFatalError as default } from '@jettacargo/load-models';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogFatalError.js","sourceRoot":"","sources":["../../src/error/CatalogFatalError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommonMessages as Messages } from '@jettacargo/load-models';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the `messages` envelope that travels in a failure's details.
|
|
4
|
+
* A failure already wrapped by an earlier handler keeps the envelope it carries.
|
|
5
|
+
*
|
|
6
|
+
* @param error the value thrown by the activity, an Error or any other value
|
|
7
|
+
* @param fallback_key the catalog key used for an error that carries no entry
|
|
8
|
+
* @returns the envelope with the catalog entry of the error
|
|
9
|
+
*/
|
|
10
|
+
export declare function build_messages(error: unknown, fallback_key?: string): Messages;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ApplicationFailure } from '@temporalio/common';
|
|
2
|
+
import { CatalogFatalError } from './CatalogFatalError.js';
|
|
3
|
+
import { CatalogTemporaryError } from './CatalogTemporaryError.js';
|
|
4
|
+
import { ACTIVITY_HANDLER_MESSAGE } from './ActivityHandlerMessage.js';
|
|
5
|
+
/**
|
|
6
|
+
* Builds the `messages` envelope that travels in a failure's details.
|
|
7
|
+
* A failure already wrapped by an earlier handler keeps the envelope it carries.
|
|
8
|
+
*
|
|
9
|
+
* @param error the value thrown by the activity, an Error or any other value
|
|
10
|
+
* @param fallback_key the catalog key used for an error that carries no entry
|
|
11
|
+
* @returns the envelope with the catalog entry of the error
|
|
12
|
+
*/
|
|
13
|
+
export function build_messages(error, fallback_key = ACTIVITY_HANDLER_MESSAGE.UNEXPECTED_ERROR) {
|
|
14
|
+
const entry = catalog_entry_of(error);
|
|
15
|
+
if (entry !== undefined) {
|
|
16
|
+
return envelope_of([entry]);
|
|
17
|
+
}
|
|
18
|
+
return carried_messages(error) ?? envelope_of([[fallback_key, text_of(error)]]);
|
|
19
|
+
}
|
|
20
|
+
function catalog_entry_of(error) {
|
|
21
|
+
if (error instanceof CatalogFatalError || error instanceof CatalogTemporaryError) {
|
|
22
|
+
return error.message_entry;
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
function text_of(error) {
|
|
27
|
+
return error instanceof Error ? error.message : String(error);
|
|
28
|
+
}
|
|
29
|
+
function envelope_of(errors) {
|
|
30
|
+
return { errors, warnings: [], infos: [] };
|
|
31
|
+
}
|
|
32
|
+
function carried_messages(error) {
|
|
33
|
+
if (!(error instanceof ApplicationFailure)) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const last_detail = error.details?.at(-1);
|
|
37
|
+
return is_messages(last_detail) ? last_detail : undefined;
|
|
38
|
+
}
|
|
39
|
+
function is_messages(value) {
|
|
40
|
+
return typeof value === 'object' && value !== null && Array.isArray(value.errors);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=CatalogMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogMessages.js","sourceRoot":"","sources":["../../src/error/CatalogMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAEtE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,eAAuB,wBAAwB,CAAC,gBAAgB;IAE3G,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACrC,IAAI,KAAK,KAAK,SAAS,EACvB,CAAC;QACG,OAAO,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;IAC/B,CAAC;IACD,OAAO,gBAAgB,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACnF,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IAEpC,IAAI,KAAK,YAAY,iBAAiB,IAAI,KAAK,YAAY,qBAAqB,EAChF,CAAC;QACG,OAAO,KAAK,CAAC,aAAa,CAAA;IAC9B,CAAC;IACD,OAAO,SAAS,CAAA;AACpB,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAE3B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACjE,CAAC;AAED,SAAS,WAAW,CAAC,MAA0B;IAE3C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AAC9C,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IAEpC,IAAI,CAAC,CAAC,KAAK,YAAY,kBAAkB,CAAC,EAC1C,CAAC;QACG,OAAO,SAAS,CAAA;IACpB,CAAC;IACD,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACzC,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAA;AAC7D,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAE/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAE,KAAkB,CAAC,MAAM,CAAC,CAAA;AACnG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CatalogTemporaryError } from '@jettacargo/load-models';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogTemporaryError.js","sourceRoot":"","sources":["../../src/error/CatalogTemporaryError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/build/error/Fatal.d.ts
CHANGED
package/build/error/Fatal.js
CHANGED
package/build/error/Fatal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fatal.js","sourceRoot":"","sources":["../../src/error/Fatal.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Fatal.js","sourceRoot":"","sources":["../../src/error/Fatal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Converts an error thrown by an activity into a Temporal failure.
|
|
3
|
+
* An `ApplicationFailure` is rethrown unchanged. The messages envelope is appended as the last detail.
|
|
4
|
+
*
|
|
5
|
+
* @param err the error thrown by the activity
|
|
6
|
+
* @param fallback_key the catalog key for an error that carries no entry; the activity handler key when omitted
|
|
7
|
+
* @throws {ApplicationFailure} non-retryable for fatal and unknown errors, retryable for temporary ones
|
|
8
|
+
*/
|
|
9
|
+
export declare function handle_workflow_error_signal(err: Error, fallback_key?: string): never;
|
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
import { ApplicationFailure } from '@temporalio/
|
|
1
|
+
import { ApplicationFailure } from '@temporalio/common';
|
|
2
2
|
import { FatalError } from './Fatal.js';
|
|
3
3
|
import { TemporaryError } from './Temporary.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
import { build_messages } from './CatalogMessages.js';
|
|
5
|
+
function is_application_failure(err) {
|
|
6
|
+
return err instanceof ApplicationFailure || err.name === 'ApplicationFailure';
|
|
8
7
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
function throw_classified(err, classification) {
|
|
9
|
+
const messages = build_messages(err, classification.fallback_key);
|
|
10
|
+
const failure = classification.retryable
|
|
11
|
+
? ApplicationFailure.retryable(err.message, classification.label, undefined, err, messages)
|
|
12
|
+
: ApplicationFailure.nonRetryable(err.message, classification.label, undefined, err, messages);
|
|
13
|
+
throw failure;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Converts an error thrown by an activity into a Temporal failure.
|
|
17
|
+
* An `ApplicationFailure` is rethrown unchanged. The messages envelope is appended as the last detail.
|
|
18
|
+
*
|
|
19
|
+
* @param err the error thrown by the activity
|
|
20
|
+
* @param fallback_key the catalog key for an error that carries no entry; the activity handler key when omitted
|
|
21
|
+
* @throws {ApplicationFailure} non-retryable for fatal and unknown errors, retryable for temporary ones
|
|
22
|
+
*/
|
|
23
|
+
export function handle_workflow_error_signal(err, fallback_key) {
|
|
24
|
+
if (is_application_failure(err)) {
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
if (err instanceof FatalError) {
|
|
28
|
+
throw_classified(err, { label: 'FatalError', retryable: false, fallback_key });
|
|
29
|
+
}
|
|
30
|
+
if (err instanceof TemporaryError) {
|
|
31
|
+
throw_classified(err, { label: 'TemporaryError', retryable: true, fallback_key });
|
|
32
|
+
}
|
|
33
|
+
throw_classified(err, { label: 'UnknownError', retryable: false, fallback_key });
|
|
18
34
|
}
|
|
19
35
|
//# sourceMappingURL=HandleWorkflowErrorSignal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HandleWorkflowErrorSignal.js","sourceRoot":"","sources":["../../src/error/HandleWorkflowErrorSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"HandleWorkflowErrorSignal.js","sourceRoot":"","sources":["../../src/error/HandleWorkflowErrorSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,SAAS,sBAAsB,CAAC,GAAU;IAEtC,OAAO,GAAG,YAAY,kBAAkB,IAAI,GAAG,CAAC,IAAI,KAAK,oBAAoB,CAAA;AACjF,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAU,EAAE,cAA4E;IAE9G,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;IACjE,MAAM,OAAO,GAAG,cAAc,CAAC,SAAS;QACpC,CAAC,CAAC,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,CAAC;QAC3F,CAAC,CAAC,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;IAClG,MAAM,OAAO,CAAA;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,GAAU,EAAE,YAAqB;IAE1E,IAAI,sBAAsB,CAAC,GAAG,CAAC,EAC/B,CAAC;QACG,MAAM,GAAG,CAAA;IACb,CAAC;IACD,IAAI,GAAG,YAAY,UAAU,EAC7B,CAAC;QACG,gBAAgB,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAA;IAClF,CAAC;IACD,IAAI,GAAG,YAAY,cAAc,EACjC,CAAC;QACG,gBAAgB,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;IACrF,CAAC;IACD,gBAAgB,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAA;AACpF,CAAC"}
|
package/build/error/Temporary.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Temporary.js","sourceRoot":"","sources":["../../src/error/Temporary.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Temporary.js","sourceRoot":"","sources":["../../src/error/Temporary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import CatalogFatalError from '../error/CatalogFatalError.js';
|
|
2
|
+
import { ACTIVITY_HANDLER_MESSAGE } from '../error/ActivityHandlerMessage.js';
|
|
3
|
+
export default class ErrorTypeMismatch extends CatalogFatalError {
|
|
3
4
|
constructor() {
|
|
4
|
-
super('Only supports Error type for exception.');
|
|
5
|
+
super([ACTIVITY_HANDLER_MESSAGE.ERROR_TYPE_MISMATCH], 'Only supports Error type for exception.');
|
|
5
6
|
}
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=ErrorTypeMismatch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorTypeMismatch.js","sourceRoot":"","sources":["../../src/exceptions/ErrorTypeMismatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ErrorTypeMismatch.js","sourceRoot":"","sources":["../../src/exceptions/ErrorTypeMismatch.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAA;AAE7E,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,iBAAiB;IAE5D;QAEI,KAAK,CAAC,CAAC,wBAAwB,CAAC,mBAAmB,CAAC,EAAE,yCAAyC,CAAC,CAAA;IACpG,CAAC;CACJ"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class FailedRetrievingFileFromS3Exception extends
|
|
3
|
-
|
|
1
|
+
import CatalogFatalError from '../error/CatalogFatalError.js';
|
|
2
|
+
export default class FailedRetrievingFileFromS3Exception extends CatalogFatalError {
|
|
3
|
+
/**
|
|
4
|
+
* @param message_entry the dotted catalog key followed by its `%s` parameters
|
|
5
|
+
* @param legacy_message the English text kept for logs and existing consumers
|
|
6
|
+
*/
|
|
7
|
+
constructor(message_entry: [string, ...string[]], legacy_message: string);
|
|
4
8
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class FailedRetrievingFileFromS3Exception extends
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import CatalogFatalError from '../error/CatalogFatalError.js';
|
|
2
|
+
export default class FailedRetrievingFileFromS3Exception extends CatalogFatalError {
|
|
3
|
+
/**
|
|
4
|
+
* @param message_entry the dotted catalog key followed by its `%s` parameters
|
|
5
|
+
* @param legacy_message the English text kept for logs and existing consumers
|
|
6
|
+
*/
|
|
7
|
+
constructor(message_entry, legacy_message) {
|
|
8
|
+
super(message_entry, legacy_message);
|
|
5
9
|
}
|
|
6
10
|
}
|
|
7
11
|
//# sourceMappingURL=FailedRetrievingFileFromS3Exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FailedRetrievingFileFromS3Exception.js","sourceRoot":"","sources":["../../src/exceptions/FailedRetrievingFileFromS3Exception.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FailedRetrievingFileFromS3Exception.js","sourceRoot":"","sources":["../../src/exceptions/FailedRetrievingFileFromS3Exception.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,+BAA+B,CAAA;AAE7D,MAAM,CAAC,OAAO,OAAO,mCAAoC,SAAQ,iBAAiB;IAE9E;;;OAGG;IACH,YAAY,aAAoC,EAAE,cAAsB;QAEpE,KAAK,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACxC,CAAC;CACJ"}
|
|
@@ -2,10 +2,12 @@ import { ActivityCallback, EventMetadata } from '@jettacargo/load-models';
|
|
|
2
2
|
/**
|
|
3
3
|
* Handles an incoming activity by reading its input, executing the provided callback,
|
|
4
4
|
* writing the output, and building the final workflow response.
|
|
5
|
+
* A thrown error is translated once into a Temporal application failure.
|
|
5
6
|
*
|
|
6
7
|
* @param {EventMetadata} event_metadata The metadata of the incoming event containing the input data reference.
|
|
7
8
|
* @param {string} source The source identifier for the activity.
|
|
8
9
|
* @param {ActivityCallback} callback The callback function to execute with the read input data.
|
|
9
10
|
* @returns {Promise<EventMetadata>} A promise that resolves to the metadata of the resulting event.
|
|
11
|
+
* @throws {ApplicationFailure} when the read or the callback throws
|
|
10
12
|
*/
|
|
11
13
|
export default function handle_activity(event_metadata: EventMetadata, source: string, callback: ActivityCallback): Promise<EventMetadata>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EventStatus } from '@jettacargo/load-models';
|
|
2
1
|
import read_input from './InputReader.js';
|
|
3
2
|
import write_output from './OutputWriter.js';
|
|
4
3
|
import ErrorTypeMismatch from '../exceptions/ErrorTypeMismatch.js';
|
|
@@ -7,11 +6,13 @@ import { Logger } from '@jetta/logger';
|
|
|
7
6
|
/**
|
|
8
7
|
* Handles an incoming activity by reading its input, executing the provided callback,
|
|
9
8
|
* writing the output, and building the final workflow response.
|
|
9
|
+
* A thrown error is translated once into a Temporal application failure.
|
|
10
10
|
*
|
|
11
11
|
* @param {EventMetadata} event_metadata The metadata of the incoming event containing the input data reference.
|
|
12
12
|
* @param {string} source The source identifier for the activity.
|
|
13
13
|
* @param {ActivityCallback} callback The callback function to execute with the read input data.
|
|
14
14
|
* @returns {Promise<EventMetadata>} A promise that resolves to the metadata of the resulting event.
|
|
15
|
+
* @throws {ApplicationFailure} when the read or the callback throws
|
|
15
16
|
*/
|
|
16
17
|
export default async function handle_activity(event_metadata, source, callback) {
|
|
17
18
|
try {
|
|
@@ -20,23 +21,19 @@ export default async function handle_activity(event_metadata, source, callback)
|
|
|
20
21
|
const uri = await write_output(output.data);
|
|
21
22
|
return build_workflow_response(output.status, uri, source);
|
|
22
23
|
}
|
|
23
|
-
catch (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
throw new ErrorTypeMismatch();
|
|
24
|
+
catch (error) {
|
|
25
|
+
const failure = error instanceof Error ? error : new ErrorTypeMismatch();
|
|
26
|
+
handle_workflow_error_signal(failure);
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return build_workflow_response(EventStatus.FAILURE, uri, source);
|
|
39
|
-
}
|
|
29
|
+
/**
|
|
30
|
+
* Constructs a standardized workflow response metadata.
|
|
31
|
+
*
|
|
32
|
+
* @param {EventStatus} status The completion status of the activity.
|
|
33
|
+
* @param {string | undefined} uri The URI where the activity output is stored.
|
|
34
|
+
* @param {string} source The source identifier for the activity.
|
|
35
|
+
* @returns {EventMetadata} The constructed event metadata.
|
|
36
|
+
*/
|
|
40
37
|
function build_workflow_response(status, uri, source) {
|
|
41
38
|
return { type: status, data: uri, source: source };
|
|
42
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityHandler.js","sourceRoot":"","sources":["../../src/handler/ActivityHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActivityHandler.js","sourceRoot":"","sources":["../../src/handler/ActivityHandler.ts"],"names":[],"mappings":"AAMA,OAAO,UAAU,MAAM,kBAAkB,CAAA;AACzC,OAAO,YAAY,MAAM,mBAAmB,CAAA;AAC5C,OAAO,iBAAiB,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAA;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,eAAe,CACzC,cAA6B,EAAE,MAAc,EAAE,QAA0B;IAGzE,IACA,CAAC;QACG,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QACxD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAC3C,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,EAC7D,KAAK,IAAI,EAAE,CAAC,MAAM,QAAQ,CAAC,UAAU,CAAC,CACzB,CAAA;QACjB,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,IAAW,CAAC,CAAA;QAClD,OAAO,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IAC9D,CAAC;IACD,OAAO,KAAK,EACZ,CAAC;QACG,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,iBAAiB,EAAE,CAAA;QACxE,4BAA4B,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAAC,MAAmB,EAAE,GAAuB,EAAE,MAAc;IAEzF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACtD,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { CommonInput } from '@jettacargo/load-models';
|
|
|
4
4
|
*
|
|
5
5
|
* @param {string | undefined} uri The S3 URI (e.g., s3://bucket/key) indicating where the input data is stored.
|
|
6
6
|
* @returns {Promise<CommonInput>} A promise that resolves to the parsed CommonInput data.
|
|
7
|
-
* @throws {FailedRetrievingFileFromS3Exception} Thrown if the URI is undefined, invalid,
|
|
7
|
+
* @throws {FailedRetrievingFileFromS3Exception} Thrown if the URI is undefined, invalid, or the data is not valid JSON.
|
|
8
|
+
* @throws {CatalogTemporaryError} Thrown if object retrieval fails or returns no data.
|
|
8
9
|
*/
|
|
9
10
|
export default function read_input(uri: string | undefined): Promise<CommonInput>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Object_Store_Driver } from '@
|
|
1
|
+
import { Object_Store_Driver } from '@jetta/s3';
|
|
2
|
+
import { CatalogTemporaryError } from '@jettacargo/load-models';
|
|
2
3
|
import FailedRetrievingFileFromS3Exception from '../exceptions/FailedRetrievingFileFromS3Exception.js';
|
|
4
|
+
import { ACTIVITY_HANDLER_MESSAGE } from '../error/ActivityHandlerMessage.js';
|
|
3
5
|
function split_uri(uri) {
|
|
4
6
|
const splitted = uri.match(/^s3:\/\/([^\/]+)\/(.+)$/);
|
|
5
7
|
if (!splitted || splitted.length < 3) {
|
|
6
|
-
throw new FailedRetrievingFileFromS3Exception('S3 URI invalid.');
|
|
8
|
+
throw new FailedRetrievingFileFromS3Exception([ACTIVITY_HANDLER_MESSAGE.INVALID_S3_URI], 'S3 URI invalid.');
|
|
7
9
|
}
|
|
8
10
|
const bucket = splitted[1];
|
|
9
11
|
const key = splitted[2];
|
|
@@ -14,26 +16,41 @@ function split_uri(uri) {
|
|
|
14
16
|
*
|
|
15
17
|
* @param {string | undefined} uri The S3 URI (e.g., s3://bucket/key) indicating where the input data is stored.
|
|
16
18
|
* @returns {Promise<CommonInput>} A promise that resolves to the parsed CommonInput data.
|
|
17
|
-
* @throws {FailedRetrievingFileFromS3Exception} Thrown if the URI is undefined, invalid,
|
|
19
|
+
* @throws {FailedRetrievingFileFromS3Exception} Thrown if the URI is undefined, invalid, or the data is not valid JSON.
|
|
20
|
+
* @throws {CatalogTemporaryError} Thrown if object retrieval fails or returns no data.
|
|
18
21
|
*/
|
|
19
22
|
export default async function read_input(uri) {
|
|
20
23
|
if (uri === undefined) {
|
|
21
24
|
const message = `Failed retrieving data from s3 at address: ${uri}`;
|
|
22
|
-
throw new FailedRetrievingFileFromS3Exception(message);
|
|
25
|
+
throw new FailedRetrievingFileFromS3Exception([ACTIVITY_HANDLER_MESSAGE.S3_ADDRESS_UNDEFINED, `${uri}`], message);
|
|
23
26
|
}
|
|
24
27
|
const { bucket, key } = split_uri(uri);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
return parse_input(await read_object(bucket, key));
|
|
29
|
+
}
|
|
30
|
+
async function read_object(bucket, key) {
|
|
31
|
+
try {
|
|
32
|
+
const raw_input = await Object_Store_Driver.get_object(bucket, key);
|
|
33
|
+
if (raw_input === undefined) {
|
|
34
|
+
const message = 'Failed when retrieving data from s3: no data returned.';
|
|
35
|
+
throw new CatalogTemporaryError([ACTIVITY_HANDLER_MESSAGE.S3_NO_DATA], message);
|
|
36
|
+
}
|
|
37
|
+
return raw_input;
|
|
29
38
|
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof CatalogTemporaryError) {
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
44
|
+
throw new CatalogTemporaryError([ACTIVITY_HANDLER_MESSAGE.UNEXPECTED_ERROR, message], message);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function parse_input(raw_input) {
|
|
30
48
|
try {
|
|
31
|
-
|
|
32
|
-
return input_data;
|
|
49
|
+
return JSON.parse(raw_input);
|
|
33
50
|
}
|
|
34
51
|
catch {
|
|
35
|
-
const message =
|
|
36
|
-
throw new FailedRetrievingFileFromS3Exception(message);
|
|
52
|
+
const message = 'JSON retrieved from s3 is in invalid format.';
|
|
53
|
+
throw new FailedRetrievingFileFromS3Exception([ACTIVITY_HANDLER_MESSAGE.S3_INVALID_JSON], message);
|
|
37
54
|
}
|
|
38
55
|
}
|
|
39
56
|
//# sourceMappingURL=InputReader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputReader.js","sourceRoot":"","sources":["../../src/handler/InputReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"InputReader.js","sourceRoot":"","sources":["../../src/handler/InputReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAe,MAAM,yBAAyB,CAAA;AAC5E,OAAO,mCAAmC,MAAM,sDAAsD,CAAA;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAA;AAE7E,SAAS,SAAS,CAAC,GAAY;IAE3B,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;IACrD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EACpC,CAAC;QACG,MAAM,IAAI,mCAAmC,CAAC,CAAC,wBAAwB,CAAC,cAAc,CAAC,EAAE,iBAAiB,CAAC,CAAA;IAC/G,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC1B,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACvB,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;AAC1B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,GAAuB;IAE5D,IAAI,GAAG,KAAK,SAAS,EACrB,CAAC;QACG,MAAM,OAAO,GAAG,8CAA8C,GAAG,EAAE,CAAA;QACnE,MAAM,IAAI,mCAAmC,CAAC,CAAC,wBAAwB,CAAC,oBAAoB,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,CAAA;IACrH,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;IACtC,OAAO,WAAW,CAAC,MAAM,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;AACtD,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,GAAW;IAElD,IACA,CAAC;QACG,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACnE,IAAI,SAAS,KAAK,SAAS,EAC3B,CAAC;YACG,MAAM,OAAO,GAAG,wDAAwD,CAAA;YACxE,MAAM,IAAI,qBAAqB,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAA;QACnF,CAAC;QACD,OAAO,SAAS,CAAA;IACpB,CAAC;IACD,OAAO,KAAK,EACZ,CAAC;QACG,IAAI,KAAK,YAAY,qBAAqB,EAC1C,CAAC;YACG,MAAM,KAAK,CAAA;QACf,CAAC;QACD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACtE,MAAM,IAAI,qBAAqB,CAAC,CAAC,wBAAwB,CAAC,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;IAClG,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,SAAiB;IAElC,IACA,CAAC;QACG,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAgB,CAAA;IAC/C,CAAC;IACD,MACA,CAAC;QACG,MAAM,OAAO,GAAG,8CAA8C,CAAA;QAC9D,MAAM,IAAI,mCAAmC,CAAC,CAAC,wBAAwB,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAA;IACtG,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutputWriter.js","sourceRoot":"","sources":["../../src/handler/OutputWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"OutputWriter.js","sourceRoot":"","sources":["../../src/handler/OutputWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,YAAY,CAAC,MAAoB;IAE3D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IACtC,MAAM,GAAG,GAAO,GAAG,UAAU,EAAE,OAAO,CAAA;IACtC,MAAM,mBAAmB,CAAC,UAAU,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;IAClE,OAAO,QAAQ,cAAc,IAAI,GAAG,EAAE,CAAA;AAC1C,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -2,3 +2,6 @@ export { default as handle_activity } from './handler/ActivityHandler.js';
|
|
|
2
2
|
export { FatalError } from './error/Fatal.js';
|
|
3
3
|
export { TemporaryError } from './error/Temporary.js';
|
|
4
4
|
export { handle_workflow_error_signal } from './error/HandleWorkflowErrorSignal.js';
|
|
5
|
+
export { default as CatalogFatalError } from './error/CatalogFatalError.js';
|
|
6
|
+
export { CatalogTemporaryError } from './error/CatalogTemporaryError.js';
|
|
7
|
+
export { build_messages } from './error/CatalogMessages.js';
|
package/build/index.js
CHANGED
|
@@ -2,4 +2,7 @@ export { default as handle_activity } from './handler/ActivityHandler.js';
|
|
|
2
2
|
export { FatalError } from './error/Fatal.js';
|
|
3
3
|
export { TemporaryError } from './error/Temporary.js';
|
|
4
4
|
export { handle_workflow_error_signal } from './error/HandleWorkflowErrorSignal.js';
|
|
5
|
+
export { default as CatalogFatalError } from './error/CatalogFatalError.js';
|
|
6
|
+
export { CatalogTemporaryError } from './error/CatalogTemporaryError.js';
|
|
7
|
+
export { build_messages } from './error/CatalogMessages.js';
|
|
5
8
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jettacargo/activity-handler",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
"lint:fix": "eslint src/**/*.{js,ts} --fix",
|
|
17
17
|
"audit": "npm audit --omit=dev",
|
|
18
18
|
"preversion": "git fetch --prune --tags",
|
|
19
|
-
"version": "npm run build",
|
|
19
|
+
"version": "npm run build && npm run lint:package",
|
|
20
20
|
"postversion": "git push origin HEAD --follow-tags && rm -rf build/",
|
|
21
21
|
"publish:alpha": "npm version --tag-version-prefix=alpha-v",
|
|
22
22
|
"publish:stable": "npm version",
|
|
23
23
|
"prerelease:alpha": "npm version prerelease --tag-version-prefix=alpha-v",
|
|
24
|
-
"coverage": "c8 --check-coverage --lines 80 --functions 80 --branches 80 --statements 80 --reporter=html --reporter=text npm run test"
|
|
24
|
+
"coverage": "c8 --check-coverage --lines 80 --functions 80 --branches 80 --statements 80 --reporter=html --reporter=text npm run test",
|
|
25
|
+
"lint:package": "publint --strict --pack npm",
|
|
26
|
+
"coverage:ci": "c8 --reporter=text --reporter=text-summary --check-coverage --lines 75 --functions 75 --branches 75 --statements 75 npm run test"
|
|
25
27
|
},
|
|
26
28
|
"repository": {
|
|
27
29
|
"type": "git",
|
|
@@ -39,29 +41,30 @@
|
|
|
39
41
|
},
|
|
40
42
|
"homepage": "https://bitbucket.org/jettasoft_dev/activity-handler#readme",
|
|
41
43
|
"dependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
"@jetta/logger": "^2.0.4",
|
|
45
|
+
"@jetta/s3": "0.0.12",
|
|
46
|
+
"@jettacargo/load-models": "0.5.0-1"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@temporalio/common": "^1.27.0"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {
|
|
49
|
-
"@
|
|
52
|
+
"@temporalio/common": "^1.27.0",
|
|
53
|
+
"@types/chai": "^5.2.3",
|
|
50
54
|
"@types/chai-as-promised": "^8.0.2",
|
|
51
55
|
"@types/mocha": "^10.0.10",
|
|
52
|
-
"@types/node": "^24.
|
|
53
|
-
"@types/sinon": "^
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
55
|
-
"@typescript-eslint/parser": "^8.
|
|
56
|
-
"c8": "^
|
|
57
|
-
"chai": "^6.
|
|
56
|
+
"@types/node": "^24.19.4",
|
|
57
|
+
"@types/sinon": "^22.0.2",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.74.0",
|
|
59
|
+
"@typescript-eslint/parser": "^8.74.0",
|
|
60
|
+
"c8": "^12.0.0",
|
|
61
|
+
"chai": "^6.3.0",
|
|
58
62
|
"chai-as-promised": "^8.0.2",
|
|
59
|
-
"eslint": "^
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"sinon": "^
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"typescript": "^5.9.3"
|
|
63
|
+
"eslint": "^10.16.0",
|
|
64
|
+
"mocha": "^12.0.3",
|
|
65
|
+
"publint": "^0.3.25",
|
|
66
|
+
"sinon": "^22.1.0",
|
|
67
|
+
"tsx": "^4.23.15",
|
|
68
|
+
"typescript": "^6.0.3"
|
|
66
69
|
}
|
|
67
70
|
}
|