@abinnovision/nestjs-hatchet 0.6.1 → 0.7.0-beta.2

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.
@@ -1,4 +1,4 @@
1
- import { type BaseCtx, type HostTriggerConfig, type TaskCtx, type WorkflowCtx } from "./types.js";
1
+ import type { BaseCtx, HostTriggerConfig, TaskCtx, WorkflowCtx } from "./types.js";
2
2
  /**
3
3
  * Arguments for context factory functions.
4
4
  * Derived from BaseCtx using Pick to ensure type alignment.
@@ -28,7 +28,8 @@ var DeclarationBuilderService = class {
28
28
  constructor(moduleRef, interceptorRegistration) {
29
29
  this.moduleRef = moduleRef;
30
30
  this.interceptorRegistration = interceptorRegistration;
31
- this.interceptors = this.interceptorRegistration?.refs.map((token) => this.moduleRef.get(token, { strict: false })) ?? [];
31
+ const resolvedRefs = this.interceptorRegistration?.refs.map((token) => this.moduleRef.get(token, { strict: false }));
32
+ this.interceptors = resolvedRefs ?? [];
32
33
  }
33
34
  /**
34
35
  * Creates a WorkflowDeclaration or TaskWorkflowDeclaration from the given host.
@@ -28,7 +28,8 @@ var DeclarationBuilderService = class {
28
28
  constructor(moduleRef, interceptorRegistration) {
29
29
  this.moduleRef = moduleRef;
30
30
  this.interceptorRegistration = interceptorRegistration;
31
- this.interceptors = this.interceptorRegistration?.refs.map((token) => this.moduleRef.get(token, { strict: false })) ?? [];
31
+ const resolvedRefs = this.interceptorRegistration?.refs.map((token) => this.moduleRef.get(token, { strict: false }));
32
+ this.interceptors = resolvedRefs ?? [];
32
33
  }
33
34
  /**
34
35
  * Creates a WorkflowDeclaration or TaskWorkflowDeclaration from the given host.
@@ -62,11 +62,20 @@ var WorkerManagementService = class WorkerManagementService {
62
62
  }
63
63
  /**
64
64
  * Discovers all feature registrations from forFeature() calls.
65
+ *
66
+ * Returns an empty array when no `HatchetModule.forFeature()` has been
67
+ * registered anywhere. Nest's `ModuleRef.get(..., { each: true })` throws
68
+ * `UnknownElementException` when zero providers exist for the token, even
69
+ * with `strict: false`, so we catch that case and treat it as "no features".
65
70
  */ discoverFeatureRegistrations() {
66
- return this.moduleRef.get(require_registrations.HatchetFeatureRegistration, {
67
- strict: false,
68
- each: true
69
- });
71
+ try {
72
+ return this.moduleRef.get(require_registrations.HatchetFeatureRegistration, {
73
+ strict: false,
74
+ each: true
75
+ });
76
+ } catch {
77
+ return [];
78
+ }
70
79
  }
71
80
  /**
72
81
  * Detects workflows registered on the Hatchet server that have no
@@ -1,8 +1,8 @@
1
1
  import { HatchetClient } from "@hatchet-dev/typescript-sdk";
2
2
  import { OnApplicationBootstrap } from "@nestjs/common";
3
3
  import { ModuleRef } from "@nestjs/core";
4
- import { type HatchetModuleConfig } from "../hatchet.module-config.js";
5
4
  import { DeclarationBuilderService } from "./declaration-builder.service.js";
5
+ import type { HatchetModuleConfig } from "../hatchet.module-config.js";
6
6
  export declare class WorkerManagementService implements OnApplicationBootstrap {
7
7
  private readonly client;
8
8
  private readonly declarationBuilder;
@@ -18,6 +18,11 @@ export declare class WorkerManagementService implements OnApplicationBootstrap {
18
18
  private buildDeclarations;
19
19
  /**
20
20
  * Discovers all feature registrations from forFeature() calls.
21
+ *
22
+ * Returns an empty array when no `HatchetModule.forFeature()` has been
23
+ * registered anywhere. Nest's `ModuleRef.get(..., { each: true })` throws
24
+ * `UnknownElementException` when zero providers exist for the token, even
25
+ * with `strict: false`, so we catch that case and treat it as "no features".
21
26
  */
22
27
  private discoverFeatureRegistrations;
23
28
  /**
@@ -62,11 +62,20 @@ var WorkerManagementService = class WorkerManagementService {
62
62
  }
63
63
  /**
64
64
  * Discovers all feature registrations from forFeature() calls.
65
+ *
66
+ * Returns an empty array when no `HatchetModule.forFeature()` has been
67
+ * registered anywhere. Nest's `ModuleRef.get(..., { each: true })` throws
68
+ * `UnknownElementException` when zero providers exist for the token, even
69
+ * with `strict: false`, so we catch that case and treat it as "no features".
65
70
  */ discoverFeatureRegistrations() {
66
- return this.moduleRef.get(HatchetFeatureRegistration, {
67
- strict: false,
68
- each: true
69
- });
71
+ try {
72
+ return this.moduleRef.get(HatchetFeatureRegistration, {
73
+ strict: false,
74
+ each: true
75
+ });
76
+ } catch {
77
+ return [];
78
+ }
70
79
  }
71
80
  /**
72
81
  * Detects workflows registered on the Hatchet server that have no
@@ -1,6 +1,6 @@
1
1
  import { DynamicModule, Type } from "@nestjs/common";
2
- import { type HatchetModuleConfig } from "./hatchet.module-config.js";
3
2
  import { Interceptor } from "./interceptor/index.js";
3
+ import type { HatchetModuleConfig } from "./hatchet.module-config.js";
4
4
  import type { AnyCallableRef } from "./references/index.js";
5
5
  /**
6
6
  * Extra options for the module (processed at module definition time).
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@abinnovision/nestjs-hatchet",
4
- "version": "0.6.1",
4
+ "version": "0.7.0-beta.2",
5
+ "description": "NestJS integration for Hatchet workflow orchestration with declarative task and workflow decorators for building distributed job systems.",
5
6
  "keywords": [
6
7
  "nestjs",
7
- "hatchet"
8
+ "hatchet",
9
+ "workflow",
10
+ "orchestration",
11
+ "background-tasks",
12
+ "job-queue",
13
+ "task-scheduling",
14
+ "decorators"
8
15
  ],
9
16
  "repository": {
10
17
  "type": "git",
@@ -13,9 +20,9 @@
13
20
  },
14
21
  "license": "Apache-2.0",
15
22
  "author": {
16
- "name": "AB INNOVISION GmbH",
17
- "email": "info@abinnovision.com",
18
- "url": "https://abinnovision.com/"
23
+ "name": "abi group GmbH",
24
+ "email": "info@abigroup.io",
25
+ "url": "https://abigroup.io"
19
26
  },
20
27
  "type": "module",
21
28
  "exports": {
@@ -72,19 +79,19 @@
72
79
  "directed-graph-typed": "^2.6.0"
73
80
  },
74
81
  "devDependencies": {
75
- "@abinnovision/eslint-config-base": "^3.2.0",
76
- "@abinnovision/prettier-config": "^2.1.5",
82
+ "@abinnovision/eslint-config-base": "^3.4.1",
83
+ "@abinnovision/prettier-config": "^2.2.0",
77
84
  "@swc/core": "^1.15.18",
78
- "eslint": "^9.39.4",
79
- "prettier": "^3.8.1",
80
- "publint": "^0.3.18",
85
+ "eslint": "^10.3.0",
86
+ "prettier": "^3.8.3",
87
+ "publint": "^0.3.21",
81
88
  "reflect-metadata": "^0.2.2",
82
89
  "rxjs": "^7.8.2",
83
- "tsdown": "^0.21.4",
90
+ "tsdown": "^0.22.0",
84
91
  "typescript": "^5.9.3",
85
92
  "unplugin-swc": "^1.5.9",
86
- "vitest": "^4.1.0",
87
- "vitest-mock-extended": "^3.1.0",
93
+ "vitest": "^4.1.6",
94
+ "vitest-mock-extended": "^4.0.0",
88
95
  "zod": "^4.3.6"
89
96
  },
90
97
  "peerDependencies": {