@duraflows/nestjs 3.0.0 → 4.0.0

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 CHANGED
@@ -22,6 +22,11 @@ Part of the [duraflows](https://github.com/camcima/duraflows) monorepo.
22
22
  pnpm add @duraflows/core @duraflows/nestjs
23
23
  ```
24
24
 
25
+ > **Note:** `@duraflows/core` is a peer dependency — you install it alongside this
26
+ > package so your app and the adapter share a single core instance. `@nestjs/common`,
27
+ > `@nestjs/core`, `reflect-metadata`, and `rxjs` are peers too, but any NestJS app
28
+ > already has them, so no extra install is normally needed.
29
+
25
30
  You will also need a persistence adapter such as [`@duraflows/pg`](https://www.npmjs.com/package/@duraflows/pg):
26
31
 
27
32
  ```bash
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  var WorkflowExceptionFilter_1;
8
8
  import { Catch, HttpStatus, Logger } from "@nestjs/common";
9
- import { WorkflowError, WorkflowInstanceNotFoundError, InvalidEventError } from "@duraflows/core";
9
+ import { WorkflowError, WorkflowInstanceNotFoundError, InvalidEventError, InvalidArgumentError } from "@duraflows/core";
10
10
  /**
11
11
  * Maps duraflows domain errors to HTTP statuses for the optional REST
12
12
  * controllers. Without this filter, a missing instance or an event invalid
@@ -33,6 +33,14 @@ let WorkflowExceptionFilter = WorkflowExceptionFilter_1 = class WorkflowExceptio
33
33
  });
34
34
  return;
35
35
  }
36
+ if (exception instanceof InvalidArgumentError) {
37
+ response.status(HttpStatus.BAD_REQUEST).send({
38
+ statusCode: HttpStatus.BAD_REQUEST,
39
+ error: "Bad Request",
40
+ message: exception.message,
41
+ });
42
+ return;
43
+ }
36
44
  // The response body is sanitized, so log the real cause here — otherwise
37
45
  // unmapped domain errors (e.g. optimistic-locking conflicts under
38
46
  // concurrency) become undiagnosable silent 500s. `WorkflowError` wraps the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duraflows/nestjs",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "NestJS integration for duraflows: dependency injection, services, optional REST controllers, and @WorkflowCommand decorator for DI-backed command handlers.",
5
5
  "keywords": [
6
6
  "duraflows",
@@ -54,7 +54,7 @@
54
54
  "class-validator": "^0.15.1"
55
55
  },
56
56
  "peerDependencies": {
57
- "@duraflows/core": "^3.0.0",
57
+ "@duraflows/core": "^4.0.0",
58
58
  "@nestjs/common": "^11.0.0",
59
59
  "@nestjs/core": "^11.0.0",
60
60
  "reflect-metadata": "^0.2.0",
@@ -64,7 +64,7 @@
64
64
  "@nestjs/common": "^11.1.24",
65
65
  "@nestjs/core": "^11.1.24",
66
66
  "@nestjs/testing": "^11.1.24",
67
- "@duraflows/core": "3.0.0"
67
+ "@duraflows/core": "4.0.0"
68
68
  },
69
69
  "scripts": {
70
70
  "build": "tsc --build"