@anuragpal02/zcl-contracts 0.48.0 → 0.49.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/dist/common.d.ts CHANGED
@@ -1,12 +1,31 @@
1
1
  import { z } from 'zod';
2
2
  export declare const idSchema: z.ZodString;
3
3
  export declare const isoDateSchema: z.ZodString;
4
+ /**
5
+ * The machine-readable reason a request failed.
6
+ *
7
+ * These are the ONLY values a caller may branch on, and — because a UI turns a code
8
+ * into a sentence — each one has to mean a single thing. Two unrelated failures
9
+ * sharing a code produce a screen that lies:
10
+ *
11
+ * `POST /projects/:id/smart-video` used to answer 409 `conflict` both when another
12
+ * session had edited the wall AND when some panels simply had no image yet. The web
13
+ * app maps `conflict` to "Someone else changed this while you were working on it.
14
+ * Reload and try again." — advice that was useless in the second case, because
15
+ * reloading does not generate a missing still. `precondition_failed` exists to split
16
+ * those two apart.
17
+ *
18
+ * Adding a member is safe for consumers: both the web app and the BFF fall back to a
19
+ * generic sentence for a code they do not recognise, so an old client shows something
20
+ * vague rather than crashing. It is NOT safe to remove or rename one.
21
+ */
4
22
  export declare const apiErrorCodeSchema: z.ZodEnum<{
5
23
  bad_request: "bad_request";
6
24
  unauthorized: "unauthorized";
7
25
  forbidden: "forbidden";
8
26
  payment_required: "payment_required";
9
27
  conflict: "conflict";
28
+ precondition_failed: "precondition_failed";
10
29
  not_found: "not_found";
11
30
  validation_failed: "validation_failed";
12
31
  rate_limited: "rate_limited";
@@ -21,6 +40,7 @@ export declare const errorResponseSchema: z.ZodObject<{
21
40
  forbidden: "forbidden";
22
41
  payment_required: "payment_required";
23
42
  conflict: "conflict";
43
+ precondition_failed: "precondition_failed";
24
44
  not_found: "not_found";
25
45
  validation_failed: "validation_failed";
26
46
  rate_limited: "rate_limited";
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MA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;;;;;kBAKhF;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
package/dist/common.js CHANGED
@@ -1,12 +1,44 @@
1
1
  import { z } from 'zod';
2
2
  export const idSchema = z.string().uuid();
3
3
  export const isoDateSchema = z.string().datetime();
4
+ /**
5
+ * The machine-readable reason a request failed.
6
+ *
7
+ * These are the ONLY values a caller may branch on, and — because a UI turns a code
8
+ * into a sentence — each one has to mean a single thing. Two unrelated failures
9
+ * sharing a code produce a screen that lies:
10
+ *
11
+ * `POST /projects/:id/smart-video` used to answer 409 `conflict` both when another
12
+ * session had edited the wall AND when some panels simply had no image yet. The web
13
+ * app maps `conflict` to "Someone else changed this while you were working on it.
14
+ * Reload and try again." — advice that was useless in the second case, because
15
+ * reloading does not generate a missing still. `precondition_failed` exists to split
16
+ * those two apart.
17
+ *
18
+ * Adding a member is safe for consumers: both the web app and the BFF fall back to a
19
+ * generic sentence for a code they do not recognise, so an old client shows something
20
+ * vague rather than crashing. It is NOT safe to remove or rename one.
21
+ */
4
22
  export const apiErrorCodeSchema = z.enum([
5
23
  'bad_request',
6
24
  'unauthorized',
7
25
  'forbidden',
8
26
  'payment_required',
27
+ /**
28
+ * The resource changed underneath you: the version you loaded is no longer current.
29
+ * "Reload and try again" is honest advice, because reloading genuinely fixes it.
30
+ * Examples: a stale LED-map version, a guideline set edited since it was read.
31
+ */
9
32
  'conflict',
33
+ /**
34
+ * The resource exists and you may act on it, but it is not in a state that permits
35
+ * this operation yet. Reloading does NOT help — something has to be done first, and
36
+ * the accompanying `message` names it.
37
+ *
38
+ * Examples: panels that still have no generated still, a master job that has not
39
+ * finished, a reservation already captured.
40
+ */
41
+ 'precondition_failed',
10
42
  'not_found',
11
43
  'validation_failed',
12
44
  'rate_limited',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuragpal02/zcl-contracts",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",