@jettacargo/activity-handler 1.0.0-alpha.2 → 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 +69 -0
- package/build/constants/Constants.d.ts +2 -0
- package/build/constants/Constants.js +3 -0
- package/build/constants/Constants.js.map +1 -0
- 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 -0
- package/build/error/Fatal.js +2 -0
- package/build/error/Fatal.js.map +1 -0
- package/build/error/HandleWorkflowErrorSignal.d.ts +9 -0
- package/build/error/HandleWorkflowErrorSignal.js +35 -0
- package/build/error/HandleWorkflowErrorSignal.js.map +1 -0
- package/build/error/Temporary.d.ts +1 -0
- package/build/error/Temporary.js +2 -0
- package/build/error/Temporary.js.map +1 -0
- package/build/exceptions/ErrorTypeMismatch.d.ts +4 -0
- package/build/exceptions/ErrorTypeMismatch.js +8 -0
- package/build/exceptions/ErrorTypeMismatch.js.map +1 -0
- package/build/exceptions/FailedRetrievingFileFromS3Exception.d.ts +8 -0
- package/build/exceptions/FailedRetrievingFileFromS3Exception.js +11 -0
- package/build/exceptions/FailedRetrievingFileFromS3Exception.js.map +1 -0
- package/build/handler/ActivityHandler.d.ts +13 -0
- package/build/handler/ActivityHandler.js +40 -0
- package/build/handler/ActivityHandler.js.map +1 -0
- package/build/handler/InputReader.d.ts +10 -0
- package/build/handler/InputReader.js +56 -0
- package/build/handler/InputReader.js.map +1 -0
- package/build/handler/OutputWriter.d.ts +8 -0
- package/build/handler/OutputWriter.js +16 -0
- package/build/handler/OutputWriter.js.map +1 -0
- package/build/index.d.ts +7 -0
- package/build/index.js +8 -0
- package/build/index.js.map +1 -0
- package/package.json +39 -23
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @jettacargo/activity-handler
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 24
|
|
8
|
+
- npm
|
|
9
|
+
- ESM only (`"type": "module"`)
|
|
10
|
+
|
|
11
|
+
## Dependencies
|
|
12
|
+
|
|
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:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @jettacargo/activity-handler
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Local checkout:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
npm run build
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
`handle_activity` takes the incoming event, a source name, and the business callback.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
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)
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/constants/Constants.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,WAAW,CAAA;AAElC,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FatalError } from '@jettacargo/load-models';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fatal.js","sourceRoot":"","sources":["../../src/error/Fatal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ApplicationFailure } from '@temporalio/common';
|
|
2
|
+
import { FatalError } from './Fatal.js';
|
|
3
|
+
import { TemporaryError } from './Temporary.js';
|
|
4
|
+
import { build_messages } from './CatalogMessages.js';
|
|
5
|
+
function is_application_failure(err) {
|
|
6
|
+
return err instanceof ApplicationFailure || err.name === 'ApplicationFailure';
|
|
7
|
+
}
|
|
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;
|
|
14
|
+
}
|
|
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 });
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=HandleWorkflowErrorSignal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TemporaryError } from '@jettacargo/load-models';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Temporary.js","sourceRoot":"","sources":["../../src/error/Temporary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import CatalogFatalError from '../error/CatalogFatalError.js';
|
|
2
|
+
import { ACTIVITY_HANDLER_MESSAGE } from '../error/ActivityHandlerMessage.js';
|
|
3
|
+
export default class ErrorTypeMismatch extends CatalogFatalError {
|
|
4
|
+
constructor() {
|
|
5
|
+
super([ACTIVITY_HANDLER_MESSAGE.ERROR_TYPE_MISMATCH], 'Only supports Error type for exception.');
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ErrorTypeMismatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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);
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=FailedRetrievingFileFromS3Exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActivityCallback, EventMetadata } from '@jettacargo/load-models';
|
|
2
|
+
/**
|
|
3
|
+
* Handles an incoming activity by reading its input, executing the provided callback,
|
|
4
|
+
* writing the output, and building the final workflow response.
|
|
5
|
+
* A thrown error is translated once into a Temporal application failure.
|
|
6
|
+
*
|
|
7
|
+
* @param {EventMetadata} event_metadata The metadata of the incoming event containing the input data reference.
|
|
8
|
+
* @param {string} source The source identifier for the activity.
|
|
9
|
+
* @param {ActivityCallback} callback The callback function to execute with the read input data.
|
|
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
|
|
12
|
+
*/
|
|
13
|
+
export default function handle_activity(event_metadata: EventMetadata, source: string, callback: ActivityCallback): Promise<EventMetadata>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import read_input from './InputReader.js';
|
|
2
|
+
import write_output from './OutputWriter.js';
|
|
3
|
+
import ErrorTypeMismatch from '../exceptions/ErrorTypeMismatch.js';
|
|
4
|
+
import { handle_workflow_error_signal } from '../error/HandleWorkflowErrorSignal.js';
|
|
5
|
+
import { Logger } from '@jetta/logger';
|
|
6
|
+
/**
|
|
7
|
+
* Handles an incoming activity by reading its input, executing the provided callback,
|
|
8
|
+
* writing the output, and building the final workflow response.
|
|
9
|
+
* A thrown error is translated once into a Temporal application failure.
|
|
10
|
+
*
|
|
11
|
+
* @param {EventMetadata} event_metadata The metadata of the incoming event containing the input data reference.
|
|
12
|
+
* @param {string} source The source identifier for the activity.
|
|
13
|
+
* @param {ActivityCallback} callback The callback function to execute with the read input data.
|
|
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
|
|
16
|
+
*/
|
|
17
|
+
export default async function handle_activity(event_metadata, source, callback) {
|
|
18
|
+
try {
|
|
19
|
+
const input_data = await read_input(event_metadata.data);
|
|
20
|
+
const output = await Logger.run_with_cargo_info(input_data.cargo_info.company, input_data.cargo_info.cargo_id, async () => await callback(input_data));
|
|
21
|
+
const uri = await write_output(output.data);
|
|
22
|
+
return build_workflow_response(output.status, uri, source);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
const failure = error instanceof Error ? error : new ErrorTypeMismatch();
|
|
26
|
+
handle_workflow_error_signal(failure);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
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
|
+
*/
|
|
37
|
+
function build_workflow_response(status, uri, source) {
|
|
38
|
+
return { type: status, data: uri, source: source };
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ActivityHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CommonInput } from '@jettacargo/load-models';
|
|
2
|
+
/**
|
|
3
|
+
* Reads and parses the input data from a specified S3 URI.
|
|
4
|
+
*
|
|
5
|
+
* @param {string | undefined} uri The S3 URI (e.g., s3://bucket/key) indicating where the input data is stored.
|
|
6
|
+
* @returns {Promise<CommonInput>} A promise that resolves to the parsed CommonInput data.
|
|
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.
|
|
9
|
+
*/
|
|
10
|
+
export default function read_input(uri: string | undefined): Promise<CommonInput>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Object_Store_Driver } from '@jetta/s3';
|
|
2
|
+
import { CatalogTemporaryError } from '@jettacargo/load-models';
|
|
3
|
+
import FailedRetrievingFileFromS3Exception from '../exceptions/FailedRetrievingFileFromS3Exception.js';
|
|
4
|
+
import { ACTIVITY_HANDLER_MESSAGE } from '../error/ActivityHandlerMessage.js';
|
|
5
|
+
function split_uri(uri) {
|
|
6
|
+
const splitted = uri.match(/^s3:\/\/([^\/]+)\/(.+)$/);
|
|
7
|
+
if (!splitted || splitted.length < 3) {
|
|
8
|
+
throw new FailedRetrievingFileFromS3Exception([ACTIVITY_HANDLER_MESSAGE.INVALID_S3_URI], 'S3 URI invalid.');
|
|
9
|
+
}
|
|
10
|
+
const bucket = splitted[1];
|
|
11
|
+
const key = splitted[2];
|
|
12
|
+
return { bucket, key };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Reads and parses the input data from a specified S3 URI.
|
|
16
|
+
*
|
|
17
|
+
* @param {string | undefined} uri The S3 URI (e.g., s3://bucket/key) indicating where the input data is stored.
|
|
18
|
+
* @returns {Promise<CommonInput>} A promise that resolves to the parsed CommonInput data.
|
|
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.
|
|
21
|
+
*/
|
|
22
|
+
export default async function read_input(uri) {
|
|
23
|
+
if (uri === undefined) {
|
|
24
|
+
const message = `Failed retrieving data from s3 at address: ${uri}`;
|
|
25
|
+
throw new FailedRetrievingFileFromS3Exception([ACTIVITY_HANDLER_MESSAGE.S3_ADDRESS_UNDEFINED, `${uri}`], message);
|
|
26
|
+
}
|
|
27
|
+
const { bucket, key } = split_uri(uri);
|
|
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;
|
|
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) {
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(raw_input);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
const message = 'JSON retrieved from s3 is in invalid format.';
|
|
53
|
+
throw new FailedRetrievingFileFromS3Exception([ACTIVITY_HANDLER_MESSAGE.S3_INVALID_JSON], message);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=InputReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommonOutput } from '@jettacargo/load-models';
|
|
2
|
+
/**
|
|
3
|
+
* Serializes the provided output payload and writes it to the default S3 bucket.
|
|
4
|
+
*
|
|
5
|
+
* @param {CommonOutput} output The standardized output payload containing the result or error state of the activity.
|
|
6
|
+
* @returns {Promise<string>} A promise that resolves to the generated S3 URI string where the output was saved.
|
|
7
|
+
*/
|
|
8
|
+
export default function write_output(output: CommonOutput): Promise<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Object_Store_Driver } from '@jetta/s3';
|
|
2
|
+
import { randomUUID } from 'crypto';
|
|
3
|
+
import { DEFAULT_BUCKET } from '../constants/Constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* Serializes the provided output payload and writes it to the default S3 bucket.
|
|
6
|
+
*
|
|
7
|
+
* @param {CommonOutput} output The standardized output payload containing the result or error state of the activity.
|
|
8
|
+
* @returns {Promise<string>} A promise that resolves to the generated S3 URI string where the output was saved.
|
|
9
|
+
*/
|
|
10
|
+
export default async function write_output(output) {
|
|
11
|
+
const payload = JSON.stringify(output);
|
|
12
|
+
const key = `${randomUUID()}.json`;
|
|
13
|
+
await Object_Store_Driver.put_object(DEFAULT_BUCKET, key, payload);
|
|
14
|
+
return `s3://${DEFAULT_BUCKET}/${key}`;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=OutputWriter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as handle_activity } from './handler/ActivityHandler.js';
|
|
2
|
+
export { FatalError } from './error/Fatal.js';
|
|
3
|
+
export { TemporaryError } from './error/Temporary.js';
|
|
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
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as handle_activity } from './handler/ActivityHandler.js';
|
|
2
|
+
export { FatalError } from './error/Fatal.js';
|
|
3
|
+
export { TemporaryError } from './error/Temporary.js';
|
|
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';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;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,17 +1,30 @@
|
|
|
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
|
+
"types": "build/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"build"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
6
11
|
"scripts": {
|
|
12
|
+
"prebuild": "rm -rf build/*",
|
|
13
|
+
"build": "tsc",
|
|
7
14
|
"test": "tsx ./node_modules/mocha/bin/mocha \"test/**/*.ts\"",
|
|
8
15
|
"lint": "eslint src --ext .ts",
|
|
9
|
-
"lint:fix": "eslint
|
|
16
|
+
"lint:fix": "eslint src/**/*.{js,ts} --fix",
|
|
10
17
|
"audit": "npm audit --omit=dev",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
18
|
+
"preversion": "git fetch --prune --tags",
|
|
19
|
+
"version": "npm run build && npm run lint:package",
|
|
20
|
+
"postversion": "git push origin HEAD --follow-tags && rm -rf build/",
|
|
21
|
+
"publish:alpha": "npm version --tag-version-prefix=alpha-v",
|
|
22
|
+
"publish:stable": "npm version",
|
|
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",
|
|
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"
|
|
13
27
|
},
|
|
14
|
-
"type": "module",
|
|
15
28
|
"repository": {
|
|
16
29
|
"type": "git",
|
|
17
30
|
"url": "git+ssh://git@bitbucket.org/jettasoft_dev/activity-handler.git"
|
|
@@ -28,27 +41,30 @@
|
|
|
28
41
|
},
|
|
29
42
|
"homepage": "https://bitbucket.org/jettasoft_dev/activity-handler#readme",
|
|
30
43
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
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"
|
|
34
50
|
},
|
|
35
51
|
"devDependencies": {
|
|
36
|
-
"@
|
|
52
|
+
"@temporalio/common": "^1.27.0",
|
|
53
|
+
"@types/chai": "^5.2.3",
|
|
37
54
|
"@types/chai-as-promised": "^8.0.2",
|
|
38
|
-
"@types/mocha": "10.0.10",
|
|
39
|
-
"@types/node": "24.
|
|
40
|
-
"@types/sinon": "^
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
42
|
-
"@typescript-eslint/parser": "8.
|
|
43
|
-
"c8": "
|
|
44
|
-
"chai": "6.
|
|
55
|
+
"@types/mocha": "^10.0.10",
|
|
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",
|
|
45
62
|
"chai-as-promised": "^8.0.2",
|
|
46
|
-
"eslint": "
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"sinon": "^
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"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"
|
|
53
69
|
}
|
|
54
70
|
}
|