@voyantjs/bookings 0.81.19 → 0.81.20

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.
@@ -10,9 +10,8 @@ export interface BookingStatusDispatchTarget {
10
10
  *
11
11
  * - For named verbs (`/confirm`, `/expire`, `/start`, `/complete`, `/cancel`)
12
12
  * this is `{ note }` when a note is provided, otherwise an empty object.
13
- * - For `/override-status` it is `{ status, reason, note? }` the server
14
- * rejects empty reasons with a 400, so callers should pass a meaningful
15
- * note when the dispatch falls through to override.
13
+ * - For `/override-status` it is `{ status, reason, note? }`. When callers
14
+ * do not provide a note, the dispatcher supplies a non-empty audit reason.
16
15
  */
17
16
  body: Record<string, unknown>;
18
17
  }
@@ -21,7 +20,7 @@ export interface BookingStatusDispatchTarget {
21
20
  * arrows that have a named verb on the server go to that verb; everything else
22
21
  * (non-adjacent jumps, e.g. cancelled → confirmed for data correction) falls
23
22
  * through to /override-status, which requires a reason. The note text is used
24
- * as the reason the server rejects empty reasons with a 400.
23
+ * as the reason when provided; otherwise a non-empty audit reason is generated.
25
24
  *
26
25
  * Framework-agnostic: returns the URL + body to send. Callers own the
27
26
  * transport (fetch, axios, the React hook, server-to-server scripts, etc).
@@ -1 +1 @@
1
- {"version":3,"file":"status-dispatch.d.ts","sourceRoot":"","sources":["../src/status-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;;;OAQG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EACpB,OAAO,CAAC,EAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/E,2BAA2B,CAwD7B"}
1
+ {"version":3,"file":"status-dispatch.d.ts","sourceRoot":"","sources":["../src/status-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;;OAOG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EACpB,OAAO,CAAC,EAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/E,2BAA2B,CAmD7B"}
@@ -3,7 +3,7 @@
3
3
  * arrows that have a named verb on the server go to that verb; everything else
4
4
  * (non-adjacent jumps, e.g. cancelled → confirmed for data correction) falls
5
5
  * through to /override-status, which requires a reason. The note text is used
6
- * as the reason the server rejects empty reasons with a 400.
6
+ * as the reason when provided; otherwise a non-empty audit reason is generated.
7
7
  *
8
8
  * Framework-agnostic: returns the URL + body to send. Callers own the
9
9
  * transport (fetch, axios, the React hook, server-to-server scripts, etc).
@@ -38,14 +38,10 @@ export function dispatchBookingStatusChange(bookingId, current, target, note, op
38
38
  current === "in_progress")) {
39
39
  return { path: `/v1/bookings/${bookingId}/cancel`, body: noteBody };
40
40
  }
41
- // The override-status route rejects empty reasons. For the common
42
- // post-create transitions out of `draft` (the operator commits the
43
- // booking to either confirmed-with-money-in or awaiting-payment) we
44
- // don't want to force a reason prompt, so supply a benign default.
45
- // Callers can still pass an explicit note to override.
46
- const defaultReason = current === "draft" && (target === "confirmed" || target === "awaiting_payment")
47
- ? `Set to ${target} after create`
48
- : "";
41
+ // The override-status route rejects empty reasons. Callers can pass an
42
+ // explicit note for the audit reason; otherwise generate a concise default
43
+ // so UI flows with optional notes never submit an invalid override payload.
44
+ const defaultReason = `Status override from ${current} to ${target}`;
49
45
  const reason = note?.trim() || defaultReason;
50
46
  return {
51
47
  path: `/v1/bookings/${bookingId}/override-status`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/bookings",
3
- "version": "0.81.19",
3
+ "version": "0.81.20",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -84,15 +84,15 @@
84
84
  "drizzle-orm": "^0.45.2",
85
85
  "hono": "^4.12.10",
86
86
  "zod": "^4.3.6",
87
- "@voyantjs/action-ledger": "0.81.19",
88
- "@voyantjs/core": "0.81.19",
89
- "@voyantjs/db": "0.81.19",
90
- "@voyantjs/hono": "0.81.19",
91
- "@voyantjs/utils": "0.81.19"
87
+ "@voyantjs/action-ledger": "0.81.20",
88
+ "@voyantjs/core": "0.81.20",
89
+ "@voyantjs/db": "0.81.20",
90
+ "@voyantjs/hono": "0.81.20",
91
+ "@voyantjs/utils": "0.81.20"
92
92
  },
93
93
  "devDependencies": {
94
94
  "typescript": "^6.0.2",
95
- "@voyantjs/products": "0.81.19",
95
+ "@voyantjs/products": "0.81.20",
96
96
  "@voyantjs/voyant-typescript-config": "0.1.0"
97
97
  },
98
98
  "files": [