@abinnovision/nestjs-hatchet 0.8.0-beta.2 → 0.8.0-beta.3
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 +6 -0
- package/dist/events/event-definition.cjs +4 -3
- package/dist/events/event-definition.d.ts +2 -2
- package/dist/events/event-definition.mjs +4 -3
- package/dist/exceptions/event-payload-malformed.exception.cjs +19 -0
- package/dist/exceptions/event-payload-malformed.exception.d.ts +13 -0
- package/dist/exceptions/event-payload-malformed.exception.mjs +19 -0
- package/dist/exceptions/hatchet.exception.cjs +14 -0
- package/dist/exceptions/hatchet.exception.d.ts +11 -0
- package/dist/exceptions/hatchet.exception.mjs +14 -0
- package/dist/exceptions/index.d.ts +4 -0
- package/dist/exceptions/input-validation-failed.exception.cjs +21 -0
- package/dist/exceptions/input-validation-failed.exception.d.ts +16 -0
- package/dist/exceptions/input-validation-failed.exception.mjs +21 -0
- package/dist/exceptions/validation-issue.cjs +52 -0
- package/dist/exceptions/validation-issue.d.ts +30 -0
- package/dist/exceptions/validation-issue.mjs +51 -0
- package/dist/explorer/declaration-builder.service.cjs +2 -1
- package/dist/explorer/declaration-builder.service.mjs +2 -1
- package/dist/index.cjs +10 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +6 -2
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @abinnovision/nestjs-hatchet
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@abinnovision/nestjs-hatchet)
|
|
4
|
+
|
|
3
5
|
NestJS integration for [Hatchet](https://hatchet.run) - a distributed workflow
|
|
4
6
|
orchestration engine. Provides type-safe decorators, services, and event
|
|
5
7
|
handling for building robust workflows.
|
|
@@ -231,3 +233,7 @@ export class MyTask extends taskHost(schema) {
|
|
|
231
233
|
}
|
|
232
234
|
}
|
|
233
235
|
```
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
Apache-2.0
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_event_payload_malformed_exception = require("../exceptions/event-payload-malformed.exception.cjs");
|
|
1
2
|
//#region src/events/event-definition.ts
|
|
2
3
|
/**
|
|
3
4
|
* Marker embedded in event payload to identify an event type.
|
|
@@ -33,12 +34,12 @@
|
|
|
33
34
|
*
|
|
34
35
|
* @param ctx The context to check (TaskCtx, WorkflowCtx, HelperCtx, or SDK Context).
|
|
35
36
|
* @returns True if the context input is a non-null object that passes schema validation.
|
|
36
|
-
* @throws
|
|
37
|
+
* @throws {EventPayloadMalformedException} If the payload fails schema validation.
|
|
37
38
|
*/ cast(ctx) {
|
|
38
39
|
if (typeof ctx.input !== "object" || ctx.input === null) return false;
|
|
39
40
|
const result = this.schema["~standard"].validate(ctx.input);
|
|
40
41
|
if (result instanceof Promise) throw new Error(`Event '${this.name}' schema validation must be synchronous. Use a sync schema.`);
|
|
41
|
-
if ("issues" in result && result.issues) throw new
|
|
42
|
+
if ("issues" in result && result.issues) throw new require_event_payload_malformed_exception.EventPayloadMalformedException(this.name, result.issues);
|
|
42
43
|
return true;
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
*
|
|
48
49
|
* @param ctx The context to check (TaskCtx, WorkflowCtx, HelperCtx, or SDK Context).
|
|
49
50
|
* @returns True if the context input contains the event marker matching this event.
|
|
50
|
-
* @throws
|
|
51
|
+
* @throws {EventPayloadMalformedException} If the event marker matches but the payload fails schema validation.
|
|
51
52
|
*/ isCtx(ctx) {
|
|
52
53
|
if (typeof ctx.input !== "object" || ctx.input === null || !("__event_name" in ctx.input) || ctx.input["__event_name"] !== this.name) return false;
|
|
53
54
|
return this.cast(ctx);
|
|
@@ -33,7 +33,7 @@ export declare class EventDefinition<TName extends string, TSchema extends Stand
|
|
|
33
33
|
*
|
|
34
34
|
* @param ctx The context to check (TaskCtx, WorkflowCtx, HelperCtx, or SDK Context).
|
|
35
35
|
* @returns True if the context input is a non-null object that passes schema validation.
|
|
36
|
-
* @throws
|
|
36
|
+
* @throws {EventPayloadMalformedException} If the payload fails schema validation.
|
|
37
37
|
*/
|
|
38
38
|
cast<C extends {
|
|
39
39
|
input: unknown;
|
|
@@ -46,7 +46,7 @@ export declare class EventDefinition<TName extends string, TSchema extends Stand
|
|
|
46
46
|
*
|
|
47
47
|
* @param ctx The context to check (TaskCtx, WorkflowCtx, HelperCtx, or SDK Context).
|
|
48
48
|
* @returns True if the context input contains the event marker matching this event.
|
|
49
|
-
* @throws
|
|
49
|
+
* @throws {EventPayloadMalformedException} If the event marker matches but the payload fails schema validation.
|
|
50
50
|
*/
|
|
51
51
|
isCtx<C extends {
|
|
52
52
|
input: unknown;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventPayloadMalformedException } from "../exceptions/event-payload-malformed.exception.mjs";
|
|
1
2
|
//#region src/events/event-definition.ts
|
|
2
3
|
/**
|
|
3
4
|
* Marker embedded in event payload to identify an event type.
|
|
@@ -33,12 +34,12 @@
|
|
|
33
34
|
*
|
|
34
35
|
* @param ctx The context to check (TaskCtx, WorkflowCtx, HelperCtx, or SDK Context).
|
|
35
36
|
* @returns True if the context input is a non-null object that passes schema validation.
|
|
36
|
-
* @throws
|
|
37
|
+
* @throws {EventPayloadMalformedException} If the payload fails schema validation.
|
|
37
38
|
*/ cast(ctx) {
|
|
38
39
|
if (typeof ctx.input !== "object" || ctx.input === null) return false;
|
|
39
40
|
const result = this.schema["~standard"].validate(ctx.input);
|
|
40
41
|
if (result instanceof Promise) throw new Error(`Event '${this.name}' schema validation must be synchronous. Use a sync schema.`);
|
|
41
|
-
if ("issues" in result && result.issues) throw new
|
|
42
|
+
if ("issues" in result && result.issues) throw new EventPayloadMalformedException(this.name, result.issues);
|
|
42
43
|
return true;
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
*
|
|
48
49
|
* @param ctx The context to check (TaskCtx, WorkflowCtx, HelperCtx, or SDK Context).
|
|
49
50
|
* @returns True if the context input contains the event marker matching this event.
|
|
50
|
-
* @throws
|
|
51
|
+
* @throws {EventPayloadMalformedException} If the event marker matches but the payload fails schema validation.
|
|
51
52
|
*/ isCtx(ctx) {
|
|
52
53
|
if (typeof ctx.input !== "object" || ctx.input === null || !("__event_name" in ctx.input) || ctx.input["__event_name"] !== this.name) return false;
|
|
53
54
|
return this.cast(ctx);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_hatchet_exception = require("./hatchet.exception.cjs");
|
|
2
|
+
const require_validation_issue = require("./validation-issue.cjs");
|
|
3
|
+
//#region src/exceptions/event-payload-malformed.exception.ts
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when an event payload received by
|
|
6
|
+
* {@link EventDefinition.cast} or {@link EventDefinition.isCtx} does not
|
|
7
|
+
* match the event's declared schema.
|
|
8
|
+
*/ var EventPayloadMalformedException = class extends require_hatchet_exception.HatchetException {
|
|
9
|
+
eventName;
|
|
10
|
+
issues;
|
|
11
|
+
constructor(eventName, rawIssues) {
|
|
12
|
+
const issues = require_validation_issue.normalizeIssues(rawIssues);
|
|
13
|
+
super(require_validation_issue.formatIssueSummary(`Event '${eventName}' payload is malformed`, issues));
|
|
14
|
+
this.eventName = eventName;
|
|
15
|
+
this.issues = issues;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.EventPayloadMalformedException = EventPayloadMalformedException;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HatchetException } from "./hatchet.exception.js";
|
|
2
|
+
import type { ValidationIssue } from "./validation-issue.js";
|
|
3
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when an event payload received by
|
|
6
|
+
* {@link EventDefinition.cast} or {@link EventDefinition.isCtx} does not
|
|
7
|
+
* match the event's declared schema.
|
|
8
|
+
*/
|
|
9
|
+
export declare class EventPayloadMalformedException extends HatchetException {
|
|
10
|
+
readonly eventName: string;
|
|
11
|
+
readonly issues: ValidationIssue[];
|
|
12
|
+
constructor(eventName: string, rawIssues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HatchetException } from "./hatchet.exception.mjs";
|
|
2
|
+
import { formatIssueSummary, normalizeIssues } from "./validation-issue.mjs";
|
|
3
|
+
//#region src/exceptions/event-payload-malformed.exception.ts
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when an event payload received by
|
|
6
|
+
* {@link EventDefinition.cast} or {@link EventDefinition.isCtx} does not
|
|
7
|
+
* match the event's declared schema.
|
|
8
|
+
*/ var EventPayloadMalformedException = class extends HatchetException {
|
|
9
|
+
eventName;
|
|
10
|
+
issues;
|
|
11
|
+
constructor(eventName, rawIssues) {
|
|
12
|
+
const issues = normalizeIssues(rawIssues);
|
|
13
|
+
super(formatIssueSummary(`Event '${eventName}' payload is malformed`, issues));
|
|
14
|
+
this.eventName = eventName;
|
|
15
|
+
this.issues = issues;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { EventPayloadMalformedException };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/exceptions/hatchet.exception.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base class for all exceptions thrown by the hatchet integration.
|
|
4
|
+
*
|
|
5
|
+
* Subclasses set `name` to their own class name for clean stack traces
|
|
6
|
+
* and may expose typed metadata via additional readonly properties.
|
|
7
|
+
*/ var HatchetException = class extends Error {
|
|
8
|
+
constructor(message, options) {
|
|
9
|
+
super(message, options);
|
|
10
|
+
this.name = new.target.name;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.HatchetException = HatchetException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all exceptions thrown by the hatchet integration.
|
|
3
|
+
*
|
|
4
|
+
* Subclasses set `name` to their own class name for clean stack traces
|
|
5
|
+
* and may expose typed metadata via additional readonly properties.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class HatchetException extends Error {
|
|
8
|
+
protected constructor(message: string, options?: {
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/exceptions/hatchet.exception.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base class for all exceptions thrown by the hatchet integration.
|
|
4
|
+
*
|
|
5
|
+
* Subclasses set `name` to their own class name for clean stack traces
|
|
6
|
+
* and may expose typed metadata via additional readonly properties.
|
|
7
|
+
*/ var HatchetException = class extends Error {
|
|
8
|
+
constructor(message, options) {
|
|
9
|
+
super(message, options);
|
|
10
|
+
this.name = new.target.name;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { HatchetException };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_hatchet_exception = require("./hatchet.exception.cjs");
|
|
2
|
+
const require_validation_issue = require("./validation-issue.cjs");
|
|
3
|
+
//#region src/exceptions/input-validation-failed.exception.ts
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when a hatchet task or workflow is invoked via the `run`
|
|
6
|
+
* trigger with an input that does not match the host's declared input
|
|
7
|
+
* schema.
|
|
8
|
+
*
|
|
9
|
+
* The {@link InputValidationFailedException.issues} property exposes the
|
|
10
|
+
* structured, per-field validation failures so callers can react
|
|
11
|
+
* programmatically instead of parsing the message string.
|
|
12
|
+
*/ var InputValidationFailedException = class extends require_hatchet_exception.HatchetException {
|
|
13
|
+
issues;
|
|
14
|
+
constructor(rawIssues) {
|
|
15
|
+
const issues = require_validation_issue.normalizeIssues(rawIssues);
|
|
16
|
+
super(require_validation_issue.formatIssueSummary("Input validation failed", issues));
|
|
17
|
+
this.issues = issues;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.InputValidationFailedException = InputValidationFailedException;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HatchetException } from "./hatchet.exception.js";
|
|
2
|
+
import type { ValidationIssue } from "./validation-issue.js";
|
|
3
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when a hatchet task or workflow is invoked via the `run`
|
|
6
|
+
* trigger with an input that does not match the host's declared input
|
|
7
|
+
* schema.
|
|
8
|
+
*
|
|
9
|
+
* The {@link InputValidationFailedException.issues} property exposes the
|
|
10
|
+
* structured, per-field validation failures so callers can react
|
|
11
|
+
* programmatically instead of parsing the message string.
|
|
12
|
+
*/
|
|
13
|
+
export declare class InputValidationFailedException extends HatchetException {
|
|
14
|
+
readonly issues: ValidationIssue[];
|
|
15
|
+
constructor(rawIssues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HatchetException } from "./hatchet.exception.mjs";
|
|
2
|
+
import { formatIssueSummary, normalizeIssues } from "./validation-issue.mjs";
|
|
3
|
+
//#region src/exceptions/input-validation-failed.exception.ts
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when a hatchet task or workflow is invoked via the `run`
|
|
6
|
+
* trigger with an input that does not match the host's declared input
|
|
7
|
+
* schema.
|
|
8
|
+
*
|
|
9
|
+
* The {@link InputValidationFailedException.issues} property exposes the
|
|
10
|
+
* structured, per-field validation failures so callers can react
|
|
11
|
+
* programmatically instead of parsing the message string.
|
|
12
|
+
*/ var InputValidationFailedException = class extends HatchetException {
|
|
13
|
+
issues;
|
|
14
|
+
constructor(rawIssues) {
|
|
15
|
+
const issues = normalizeIssues(rawIssues);
|
|
16
|
+
super(formatIssueSummary("Input validation failed", issues));
|
|
17
|
+
this.issues = issues;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { InputValidationFailedException };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/exceptions/validation-issue.ts
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the raw key from a StandardSchema path entry, which can be
|
|
4
|
+
* either a {@link PropertyKey} or a {@link StandardSchemaV1.PathSegment}.
|
|
5
|
+
*/ function toSegmentKey(entry) {
|
|
6
|
+
if (typeof entry === "object") return entry.key;
|
|
7
|
+
return entry;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Formats a sequence of path keys into dot/bracket notation.
|
|
11
|
+
* Numeric keys become `[n]` segments; string keys become dot-joined
|
|
12
|
+
* segments. Symbol keys fall back to their `.toString()` form.
|
|
13
|
+
*/ function formatPath(segments) {
|
|
14
|
+
let result = "";
|
|
15
|
+
for (const segment of segments) {
|
|
16
|
+
if (typeof segment === "number") {
|
|
17
|
+
result += `[${String(segment)}]`;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const asString = typeof segment === "symbol" ? segment.toString() : segment;
|
|
21
|
+
if (result.length === 0) result = asString;
|
|
22
|
+
else result += `.${asString}`;
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Converts the raw issues produced by a StandardSchema-compatible schema
|
|
28
|
+
* into the structured {@link ValidationIssue} shape exposed on hatchet
|
|
29
|
+
* exceptions.
|
|
30
|
+
*/ function normalizeIssues(raw) {
|
|
31
|
+
return raw.map((issue) => {
|
|
32
|
+
const segments = (issue.path ?? []).map(toSegmentKey);
|
|
33
|
+
if (segments.length === 0) return { message: issue.message };
|
|
34
|
+
return {
|
|
35
|
+
message: issue.message,
|
|
36
|
+
path: formatPath(segments)
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Builds a human-readable summary by joining each issue as
|
|
42
|
+
* `<path>: <message>` (or just `<message>` when no path is present),
|
|
43
|
+
* prefixed with the given prefix.
|
|
44
|
+
*
|
|
45
|
+
* Falls back to just the prefix when no issues are provided.
|
|
46
|
+
*/ function formatIssueSummary(prefix, issues) {
|
|
47
|
+
if (issues.length === 0) return prefix;
|
|
48
|
+
return `${prefix}: ${issues.map((issue) => issue.path !== void 0 ? `${issue.path}: ${issue.message}` : issue.message).join("; ")}`;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.formatIssueSummary = formatIssueSummary;
|
|
52
|
+
exports.normalizeIssues = normalizeIssues;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
/**
|
|
3
|
+
* Structured representation of a single schema validation issue.
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidationIssue {
|
|
6
|
+
/**
|
|
7
|
+
* Human-readable description of why this field failed validation.
|
|
8
|
+
*/
|
|
9
|
+
message: string;
|
|
10
|
+
/**
|
|
11
|
+
* Dot/bracket notation path to the offending field
|
|
12
|
+
* (e.g. `user.email`, `items[0].id`).
|
|
13
|
+
* Omitted when the failure is at the root.
|
|
14
|
+
*/
|
|
15
|
+
path?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Converts the raw issues produced by a StandardSchema-compatible schema
|
|
19
|
+
* into the structured {@link ValidationIssue} shape exposed on hatchet
|
|
20
|
+
* exceptions.
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeIssues(raw: ReadonlyArray<StandardSchemaV1.Issue>): ValidationIssue[];
|
|
23
|
+
/**
|
|
24
|
+
* Builds a human-readable summary by joining each issue as
|
|
25
|
+
* `<path>: <message>` (or just `<message>` when no path is present),
|
|
26
|
+
* prefixed with the given prefix.
|
|
27
|
+
*
|
|
28
|
+
* Falls back to just the prefix when no issues are provided.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatIssueSummary(prefix: string, issues: ValidationIssue[]): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/exceptions/validation-issue.ts
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the raw key from a StandardSchema path entry, which can be
|
|
4
|
+
* either a {@link PropertyKey} or a {@link StandardSchemaV1.PathSegment}.
|
|
5
|
+
*/ function toSegmentKey(entry) {
|
|
6
|
+
if (typeof entry === "object") return entry.key;
|
|
7
|
+
return entry;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Formats a sequence of path keys into dot/bracket notation.
|
|
11
|
+
* Numeric keys become `[n]` segments; string keys become dot-joined
|
|
12
|
+
* segments. Symbol keys fall back to their `.toString()` form.
|
|
13
|
+
*/ function formatPath(segments) {
|
|
14
|
+
let result = "";
|
|
15
|
+
for (const segment of segments) {
|
|
16
|
+
if (typeof segment === "number") {
|
|
17
|
+
result += `[${String(segment)}]`;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const asString = typeof segment === "symbol" ? segment.toString() : segment;
|
|
21
|
+
if (result.length === 0) result = asString;
|
|
22
|
+
else result += `.${asString}`;
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Converts the raw issues produced by a StandardSchema-compatible schema
|
|
28
|
+
* into the structured {@link ValidationIssue} shape exposed on hatchet
|
|
29
|
+
* exceptions.
|
|
30
|
+
*/ function normalizeIssues(raw) {
|
|
31
|
+
return raw.map((issue) => {
|
|
32
|
+
const segments = (issue.path ?? []).map(toSegmentKey);
|
|
33
|
+
if (segments.length === 0) return { message: issue.message };
|
|
34
|
+
return {
|
|
35
|
+
message: issue.message,
|
|
36
|
+
path: formatPath(segments)
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Builds a human-readable summary by joining each issue as
|
|
42
|
+
* `<path>: <message>` (or just `<message>` when no path is present),
|
|
43
|
+
* prefixed with the given prefix.
|
|
44
|
+
*
|
|
45
|
+
* Falls back to just the prefix when no issues are provided.
|
|
46
|
+
*/ function formatIssueSummary(prefix, issues) {
|
|
47
|
+
if (issues.length === 0) return prefix;
|
|
48
|
+
return `${prefix}: ${issues.map((issue) => issue.path !== void 0 ? `${issue.path}: ${issue.message}` : issue.message).join("; ")}`;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { formatIssueSummary, normalizeIssues };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_input_validation_failed_exception = require("../exceptions/input-validation-failed.exception.cjs");
|
|
1
2
|
const require_hosts = require("../abstracts/hosts.cjs");
|
|
2
3
|
const require_accessor = require("../metadata/accessor.cjs");
|
|
3
4
|
const require_factory = require("../execution/context/factory.cjs");
|
|
@@ -165,7 +166,7 @@ var DeclarationBuilderService = class {
|
|
|
165
166
|
triggerSource,
|
|
166
167
|
hostConfig
|
|
167
168
|
};
|
|
168
|
-
throw new
|
|
169
|
+
throw new require_input_validation_failed_exception.InputValidationFailedException(result.issues);
|
|
169
170
|
} else return {
|
|
170
171
|
input,
|
|
171
172
|
triggerSource,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InputValidationFailedException } from "../exceptions/input-validation-failed.exception.mjs";
|
|
1
2
|
import { WorkflowHost } from "../abstracts/hosts.mjs";
|
|
2
3
|
import { fromInstance } from "../metadata/accessor.mjs";
|
|
3
4
|
import { createTaskCtx, createWorkflowCtx } from "../execution/context/factory.mjs";
|
|
@@ -165,7 +166,7 @@ var DeclarationBuilderService = class {
|
|
|
165
166
|
triggerSource,
|
|
166
167
|
hostConfig
|
|
167
168
|
};
|
|
168
|
-
throw new
|
|
169
|
+
throw new InputValidationFailedException(result.issues);
|
|
169
170
|
} else return {
|
|
170
171
|
input,
|
|
171
172
|
triggerSource,
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_hatchet_exception = require("./exceptions/hatchet.exception.cjs");
|
|
3
|
+
const require_validation_issue = require("./exceptions/validation-issue.cjs");
|
|
4
|
+
const require_event_payload_malformed_exception = require("./exceptions/event-payload-malformed.exception.cjs");
|
|
5
|
+
const require_input_validation_failed_exception = require("./exceptions/input-validation-failed.exception.cjs");
|
|
2
6
|
const require_event_definition = require("./events/event-definition.cjs");
|
|
3
7
|
const require_hosts = require("./abstracts/hosts.cjs");
|
|
4
8
|
const require_helpers = require("./references/helpers.cjs");
|
|
5
9
|
const require_client = require("./client/client.cjs");
|
|
6
10
|
require("./client/index.cjs");
|
|
7
11
|
const require_hatchet_module = require("./hatchet.module.cjs");
|
|
12
|
+
const require_interceptor = require("./interceptor/interceptor.cjs");
|
|
8
13
|
const require_host_decorator = require("./metadata/decorators/host.decorator.cjs");
|
|
9
14
|
const require_task_decorator = require("./metadata/decorators/task.decorator.cjs");
|
|
10
15
|
const require_workflow_task_decorator = require("./metadata/decorators/workflow-task.decorator.cjs");
|
|
11
16
|
require("./metadata/index.cjs");
|
|
12
|
-
const require_interceptor = require("./interceptor/interceptor.cjs");
|
|
13
17
|
Object.defineProperty(exports, "Client", {
|
|
14
18
|
enumerable: true,
|
|
15
19
|
get: function() {
|
|
@@ -17,6 +21,8 @@ Object.defineProperty(exports, "Client", {
|
|
|
17
21
|
}
|
|
18
22
|
});
|
|
19
23
|
exports.EventDefinition = require_event_definition.EventDefinition;
|
|
24
|
+
exports.EventPayloadMalformedException = require_event_payload_malformed_exception.EventPayloadMalformedException;
|
|
25
|
+
exports.HatchetException = require_hatchet_exception.HatchetException;
|
|
20
26
|
Object.defineProperty(exports, "HatchetModule", {
|
|
21
27
|
enumerable: true,
|
|
22
28
|
get: function() {
|
|
@@ -24,12 +30,15 @@ Object.defineProperty(exports, "HatchetModule", {
|
|
|
24
30
|
}
|
|
25
31
|
});
|
|
26
32
|
exports.Host = require_host_decorator.Host;
|
|
33
|
+
exports.InputValidationFailedException = require_input_validation_failed_exception.InputValidationFailedException;
|
|
27
34
|
exports.Interceptor = require_interceptor.Interceptor;
|
|
28
35
|
exports.Task = require_task_decorator.Task;
|
|
29
36
|
exports.TaskHost = require_hosts.TaskHost;
|
|
30
37
|
exports.WorkflowHost = require_hosts.WorkflowHost;
|
|
31
38
|
exports.WorkflowTask = require_workflow_task_decorator.WorkflowTask;
|
|
32
39
|
exports.defineEvent = require_event_definition.defineEvent;
|
|
40
|
+
exports.formatIssueSummary = require_validation_issue.formatIssueSummary;
|
|
41
|
+
exports.normalizeIssues = require_validation_issue.normalizeIssues;
|
|
33
42
|
exports.taskHost = require_hosts.taskHost;
|
|
34
43
|
exports.taskRef = require_helpers.taskRef;
|
|
35
44
|
exports.workflowHost = require_hosts.workflowHost;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from "./hatchet.module.js";
|
|
2
2
|
export * from "./abstracts/index.js";
|
|
3
3
|
export * from "./client/index.js";
|
|
4
|
-
export * from "./execution/index.js";
|
|
5
|
-
export * from "./metadata/index.js";
|
|
6
4
|
export * from "./events/index.js";
|
|
5
|
+
export * from "./exceptions/index.js";
|
|
6
|
+
export * from "./execution/index.js";
|
|
7
7
|
export * from "./interceptor/index.js";
|
|
8
|
+
export * from "./metadata/index.js";
|
|
8
9
|
export * from "./references/index.js";
|
|
9
10
|
export type { HatchetModuleConfig } from "./hatchet.module-config.js";
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { HatchetException } from "./exceptions/hatchet.exception.mjs";
|
|
2
|
+
import { formatIssueSummary, normalizeIssues } from "./exceptions/validation-issue.mjs";
|
|
3
|
+
import { EventPayloadMalformedException } from "./exceptions/event-payload-malformed.exception.mjs";
|
|
4
|
+
import { InputValidationFailedException } from "./exceptions/input-validation-failed.exception.mjs";
|
|
1
5
|
import { EventDefinition, defineEvent } from "./events/event-definition.mjs";
|
|
2
6
|
import { TaskHost, WorkflowHost, taskHost, workflowHost } from "./abstracts/hosts.mjs";
|
|
3
7
|
import { taskRef, workflowRef } from "./references/helpers.mjs";
|
|
4
8
|
import { Client } from "./client/client.mjs";
|
|
5
9
|
import "./client/index.mjs";
|
|
6
10
|
import { HatchetModule } from "./hatchet.module.mjs";
|
|
11
|
+
import { Interceptor } from "./interceptor/interceptor.mjs";
|
|
7
12
|
import { Host } from "./metadata/decorators/host.decorator.mjs";
|
|
8
13
|
import { Task } from "./metadata/decorators/task.decorator.mjs";
|
|
9
14
|
import { WorkflowTask } from "./metadata/decorators/workflow-task.decorator.mjs";
|
|
10
15
|
import "./metadata/index.mjs";
|
|
11
|
-
|
|
12
|
-
export { Client, EventDefinition, HatchetModule, Host, Interceptor, Task, TaskHost, WorkflowHost, WorkflowTask, defineEvent, taskHost, taskRef, workflowHost, workflowRef };
|
|
16
|
+
export { Client, EventDefinition, EventPayloadMalformedException, HatchetException, HatchetModule, Host, InputValidationFailedException, Interceptor, Task, TaskHost, WorkflowHost, WorkflowTask, defineEvent, formatIssueSummary, normalizeIssues, taskHost, taskRef, workflowHost, workflowRef };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@abinnovision/nestjs-hatchet",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
4
|
+
"version": "0.8.0-beta.3",
|
|
5
5
|
"description": "NestJS integration for Hatchet workflow orchestration with declarative task and workflow decorators for building distributed job systems.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"nestjs",
|
|
@@ -82,8 +82,9 @@
|
|
|
82
82
|
"@abinnovision/eslint-config-base": "^3.4.1",
|
|
83
83
|
"@abinnovision/prettier-config": "^2.2.0",
|
|
84
84
|
"@swc/core": "^1.15.18",
|
|
85
|
-
"@types/node": "^25.
|
|
86
|
-
"
|
|
85
|
+
"@types/node": "^25.9.1",
|
|
86
|
+
"arktype": "^2.2.0",
|
|
87
|
+
"eslint": "^10.4.0",
|
|
87
88
|
"prettier": "^3.8.3",
|
|
88
89
|
"publint": "^0.3.21",
|
|
89
90
|
"reflect-metadata": "^0.2.2",
|