@anuragpal02/zcl-contracts 0.25.0 → 0.26.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.
@@ -18,6 +18,7 @@ export declare const ledPanelSchema: z.ZodObject<{
18
18
  y: z.ZodNumber;
19
19
  color: z.ZodOptional<z.ZodString>;
20
20
  showLabel: z.ZodOptional<z.ZodBoolean>;
21
+ mirrorOf: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
21
22
  }, z.core.$strip>;
22
23
  export declare const ledBoundsSchema: z.ZodObject<{
23
24
  minX: z.ZodNumber;
@@ -37,6 +38,7 @@ export declare const ledPanelsSchema: z.ZodArray<z.ZodObject<{
37
38
  y: z.ZodNumber;
38
39
  color: z.ZodOptional<z.ZodString>;
39
40
  showLabel: z.ZodOptional<z.ZodBoolean>;
41
+ mirrorOf: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
40
42
  }, z.core.$strip>>;
41
43
  export declare const ledMapSchema: z.ZodObject<{
42
44
  projectId: z.ZodString;
@@ -50,6 +52,7 @@ export declare const ledMapSchema: z.ZodObject<{
50
52
  y: z.ZodNumber;
51
53
  color: z.ZodOptional<z.ZodString>;
52
54
  showLabel: z.ZodOptional<z.ZodBoolean>;
55
+ mirrorOf: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
53
56
  }, z.core.$strip>>;
54
57
  bounds: z.ZodNullable<z.ZodObject<{
55
58
  minX: z.ZodNumber;
@@ -74,6 +77,7 @@ export declare const updateLedMapRequestSchema: z.ZodObject<{
74
77
  y: z.ZodNumber;
75
78
  color: z.ZodOptional<z.ZodString>;
76
79
  showLabel: z.ZodOptional<z.ZodBoolean>;
80
+ mirrorOf: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
77
81
  }, z.core.$strip>>;
78
82
  }, z.core.$strip>;
79
83
  export declare const ledMapResponseSchema: z.ZodObject<{
@@ -89,6 +93,7 @@ export declare const ledMapResponseSchema: z.ZodObject<{
89
93
  y: z.ZodNumber;
90
94
  color: z.ZodOptional<z.ZodString>;
91
95
  showLabel: z.ZodOptional<z.ZodBoolean>;
96
+ mirrorOf: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
92
97
  }, z.core.$strip>>;
93
98
  bounds: z.ZodNullable<z.ZodObject<{
94
99
  minX: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../src/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,uBAAuB;;;EAAmC,CAAA;AACvE,eAAO,MAAM,mBAAmB;;;;EAA4C,CAAA;AAE5E,eAAO,MAAM,gBAAgB,aAAmC,CAAA;AAEhE,eAAO,MAAM,cAAc;;;;;;;;;iBASzB,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;iBAQ1B,CAAA;AAMF,eAAO,MAAM,eAAe;;;;;;;;;kBAGgC,CAAA;AAsB5D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;iBAiCrB,CAAA;AAEJ,eAAO,MAAM,yBAAyB;;;;;;;;;;;;iBAGpC,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAiC,CAAA;AAElE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;iBASxB,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;EAA2C,CAAA;AAEzE;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;iBAOlC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;iBAGrC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBASpC,CAAA;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CA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KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACvE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
package/dist/projects.js CHANGED
@@ -3,7 +3,8 @@ import { apiSuccessSchema, idSchema, isoDateSchema } from './common.js';
3
3
  export const projectVisibilitySchema = z.enum(['private', 'workspace']);
4
4
  export const projectStatusSchema = z.enum(['active', 'archived', 'deleted']);
5
5
  export const ledPanelIdSchema = z.string().trim().min(1).max(80);
6
- export const ledPanelSchema = z.object({
6
+ export const ledPanelSchema = z
7
+ .object({
7
8
  id: ledPanelIdSchema,
8
9
  name: z.string().trim().min(1).max(120),
9
10
  width: z.number().int().positive().max(100000),
@@ -11,7 +12,38 @@ export const ledPanelSchema = z.object({
11
12
  x: z.number().int().min(-1000000).max(1000000),
12
13
  y: z.number().int().min(-1000000).max(1000000),
13
14
  color: z.string().trim().min(1).max(64).optional(),
14
- showLabel: z.boolean().optional()
15
+ showLabel: z.boolean().optional(),
16
+ /**
17
+ * Explicit mirror link. DELIBERATELY TRI-STATE — do NOT "simplify" this to a
18
+ * plain `ledPanelIdSchema.optional()` or to `.nullable()` with a default:
19
+ * absent and null mean different things, and collapsing them breaks the feature.
20
+ *
21
+ * undefined (key absent) — AUTO. The server's geometric symmetry detection
22
+ * decides whether this panel is a mirror (zcl-api
23
+ * src/lib/led-panel-classify.ts `detectSymmetricPairs`: same width/height,
24
+ * |Δy| <= 4, centres symmetric about the wall's bounds-centre within 8
25
+ * units). This is the default and the state of every panel stored before
26
+ * this field existed.
27
+ *
28
+ * <panel id> — EXPLICITLY LINKED. This panel renders a horizontally flipped
29
+ * copy of the panel with that id regardless of geometry, and creates no
30
+ * generation job. Overrides the geometric inference.
31
+ *
32
+ * null — EXPLICITLY UNLINKED. The user broke the link by hand; geometric
33
+ * auto-detection must NOT re-link this panel. This is why `.optional()`
34
+ * alone is not enough — "never decided" (undefined) and "decided: no"
35
+ * (null) must stay distinguishable.
36
+ *
37
+ * Only self-links are rejected here (see the refinement below). We deliberately
38
+ * do NOT validate that the target panel exists: a panel can be deleted while
39
+ * another still points at it, and the server is required to degrade gracefully
40
+ * (fall back to AUTO for that panel) rather than reject the whole LED map.
41
+ */
42
+ mirrorOf: z.union([ledPanelIdSchema, z.null()]).optional()
43
+ })
44
+ .refine((panel) => panel.mirrorOf !== panel.id, {
45
+ path: ['mirrorOf'],
46
+ message: 'A LED panel cannot mirror itself'
15
47
  });
16
48
  export const ledBoundsSchema = z.object({
17
49
  minX: z.number(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuragpal02/zcl-contracts",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",