@ramme-io/kernel 8.0.0 → 8.1.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/{AiGateway-U28yN4Mf.js → AiGateway-CjamGYdA.js} +1 -1
- package/dist/{bodewellAdapter-Cw9brU9k.js → bodewellAdapter-PfSOdsEI.js} +1 -1
- package/dist/{index-BrFe7_2L.js → deviceReadings-cxZE1T-0.js} +262 -249
- package/dist/index.es.js +19 -18
- package/dist/kernel/src/index.d.ts +1 -0
- package/dist/kernel/src/index.d.ts.map +1 -1
- package/dist/server.es.js +16 -17
- package/dist/signals.es.js +2 -2
- package/package.json +1 -1
- package/dist/deviceReadings-3Z4nql34.js +0 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
var ee = Object.defineProperty, te = (a,
|
|
3
|
-
for (var
|
|
4
|
-
ee(a,
|
|
2
|
+
var ee = Object.defineProperty, te = (a, i) => {
|
|
3
|
+
for (var h in i)
|
|
4
|
+
ee(a, h, { get: i[h], enumerable: !0 });
|
|
5
5
|
}, ae = e.object({
|
|
6
6
|
key: e.string(),
|
|
7
7
|
label: e.string(),
|
|
@@ -97,7 +97,7 @@ var ee = Object.defineProperty, te = (a, s) => {
|
|
|
97
97
|
}), de = e.enum(["ENVIRONMENT", "SESSION_BYOK", "VAULT"]), pe = e.object({
|
|
98
98
|
strategy: de,
|
|
99
99
|
status: e.enum(["VALID", "KEY_EXPIRED", "BYOK_REQUIRED", "DEGRADED", "UNKNOWN"]).default("UNKNOWN")
|
|
100
|
-
}),
|
|
100
|
+
}), At = e.object({
|
|
101
101
|
meta: e.object({
|
|
102
102
|
name: e.string(),
|
|
103
103
|
version: e.string(),
|
|
@@ -120,7 +120,7 @@ var ee = Object.defineProperty, te = (a, s) => {
|
|
|
120
120
|
workflows: e.array(le).optional()
|
|
121
121
|
}),
|
|
122
122
|
pages: e.array(ce).optional()
|
|
123
|
-
}),
|
|
123
|
+
}), Et = e.object({
|
|
124
124
|
timestamp: e.number(),
|
|
125
125
|
soilMoisture: e.number().min(0).max(100),
|
|
126
126
|
ambientLight: e.number().min(0).max(1e5),
|
|
@@ -136,12 +136,12 @@ var ee = Object.defineProperty, te = (a, s) => {
|
|
|
136
136
|
meta: e.record(e.unknown()).optional()
|
|
137
137
|
});
|
|
138
138
|
e.array(he);
|
|
139
|
-
var
|
|
139
|
+
var xe = {
|
|
140
140
|
AGRICULTURE: "agriculture",
|
|
141
141
|
// Derived — Methodology Engine outputs
|
|
142
142
|
ENVIRONMENT: "environment"
|
|
143
143
|
// A device's surroundings — temperature, humidity, light
|
|
144
|
-
},
|
|
144
|
+
}, ge = e.enum(["telemetry", "market", "system", "logic"]), be = e.enum(["mqtt", "http", "ws", "mock"]);
|
|
145
145
|
e.object({
|
|
146
146
|
/**
|
|
147
147
|
* Globally unique signal identifier.
|
|
@@ -153,7 +153,7 @@ e.object({
|
|
|
153
153
|
* The semantic category of this signal.
|
|
154
154
|
* Determines which Methodology Engine processes it.
|
|
155
155
|
*/
|
|
156
|
-
kind:
|
|
156
|
+
kind: ge,
|
|
157
157
|
/**
|
|
158
158
|
* The specific measurement or metric key within its kind.
|
|
159
159
|
* RULE: Keys MUST be abstract and domain-agnostic where possible.
|
|
@@ -181,7 +181,7 @@ e.object({
|
|
|
181
181
|
/**
|
|
182
182
|
* The transport source that produced this signal.
|
|
183
183
|
*/
|
|
184
|
-
source:
|
|
184
|
+
source: be.optional(),
|
|
185
185
|
/**
|
|
186
186
|
* Optional domain namespace for grouping related signals.
|
|
187
187
|
* Examples: 'bodewell', 'finance', 'infrastructure', 'user_behavior'
|
|
@@ -195,11 +195,11 @@ e.object({
|
|
|
195
195
|
*/
|
|
196
196
|
meta: e.record(e.unknown()).optional()
|
|
197
197
|
});
|
|
198
|
-
var
|
|
199
|
-
te(
|
|
200
|
-
BodewellCommandSchema: () =>
|
|
198
|
+
var fe = {};
|
|
199
|
+
te(fe, {
|
|
200
|
+
BodewellCommandSchema: () => ye,
|
|
201
201
|
BodewellDeviceID: () => T,
|
|
202
|
-
BodewellTelemetrySchema: () =>
|
|
202
|
+
BodewellTelemetrySchema: () => ve
|
|
203
203
|
});
|
|
204
204
|
var T = e.enum([
|
|
205
205
|
"STK-V1-001",
|
|
@@ -207,7 +207,7 @@ var T = e.enum([
|
|
|
207
207
|
"STK-V1-003",
|
|
208
208
|
"STK-PRO-001",
|
|
209
209
|
"STK-VIS-001"
|
|
210
|
-
]),
|
|
210
|
+
]), ve = e.object({
|
|
211
211
|
device_id: T,
|
|
212
212
|
stick_id: e.string().optional().describe("Firmware alias for device_id"),
|
|
213
213
|
timestamp: e.number().optional().describe("Epoch timestamp from NTP"),
|
|
@@ -222,12 +222,12 @@ var T = e.enum([
|
|
|
222
222
|
soil_moisture: e.number().optional().describe("Firmware alias for raw capacitance"),
|
|
223
223
|
soil_moisture_raw: e.number().optional().describe("Unscaled capacitance (300-1100)"),
|
|
224
224
|
fw_version: e.string().max(40).optional().describe("Firmware build the board is running; absent on v4 sketches, which cannot be updated over the air")
|
|
225
|
-
}).passthrough(),
|
|
225
|
+
}).passthrough(), ye = e.object({
|
|
226
226
|
stick_id: T,
|
|
227
227
|
// Note: Your API uses stick_id here, not device_id
|
|
228
228
|
type: e.enum(["dry", "wet"]),
|
|
229
229
|
value: e.number()
|
|
230
|
-
}),
|
|
230
|
+
}), we = e.enum([
|
|
231
231
|
"esp32-touch-28",
|
|
232
232
|
// 2.8" 240x320 resistive touch, the workshop board
|
|
233
233
|
"esp32-headless",
|
|
@@ -240,7 +240,7 @@ var T = e.enum([
|
|
|
240
240
|
"aircraft",
|
|
241
241
|
"sensor",
|
|
242
242
|
"blank"
|
|
243
|
-
]),
|
|
243
|
+
]), Ae = e.object({
|
|
244
244
|
/** Postal code is what a person knows; the portal resolves it to coordinates. */
|
|
245
245
|
postalCode: e.string().min(3).max(12),
|
|
246
246
|
latitude: e.number().min(-90).max(90).optional(),
|
|
@@ -248,29 +248,29 @@ var T = e.enum([
|
|
|
248
248
|
units: e.enum(["imperial", "metric"]).default("imperial"),
|
|
249
249
|
showForecast: e.boolean().default(!0),
|
|
250
250
|
refreshSeconds: e.number().int().min(300).max(86400).default(900)
|
|
251
|
-
}),
|
|
251
|
+
}), Ee = e.object({
|
|
252
252
|
/** IANA zone, e.g. "America/New_York". */
|
|
253
253
|
timezone: e.string().default("America/New_York"),
|
|
254
254
|
twentyFourHour: e.boolean().default(!1),
|
|
255
255
|
showSeconds: e.boolean().default(!1),
|
|
256
256
|
showDate: e.boolean().default(!0)
|
|
257
|
-
}),
|
|
257
|
+
}), Se = e.object({
|
|
258
258
|
latitude: e.number().min(-90).max(90),
|
|
259
259
|
longitude: e.number().min(-180).max(180),
|
|
260
260
|
radiusKm: e.number().min(5).max(400).default(80),
|
|
261
261
|
/** Rows the list view can show before the screen runs out. */
|
|
262
262
|
maxRows: e.number().int().min(1).max(12).default(8),
|
|
263
263
|
refreshSeconds: e.number().int().min(10).max(600).default(30)
|
|
264
|
-
}),
|
|
264
|
+
}), Ce = e.object({
|
|
265
265
|
/** Signal keys to display, in order. Abstract keys per the Signal contract. */
|
|
266
266
|
keys: e.array(e.string()).min(1).max(6),
|
|
267
267
|
refreshSeconds: e.number().int().min(1).max(3600).default(10)
|
|
268
|
-
}), Ce = e.object({
|
|
269
|
-
weather: we.optional(),
|
|
270
|
-
clock: Ae.optional(),
|
|
271
|
-
aircraft: Ee.optional(),
|
|
272
|
-
sensor: Se.optional()
|
|
273
268
|
}), _e = e.object({
|
|
269
|
+
weather: Ae.optional(),
|
|
270
|
+
clock: Ee.optional(),
|
|
271
|
+
aircraft: Se.optional(),
|
|
272
|
+
sensor: Ce.optional()
|
|
273
|
+
}), Be = e.object({
|
|
274
274
|
brightness: e.number().int().min(5).max(100).default(80),
|
|
275
275
|
/** Degrees clockwise. The board can sit either way up in a case. */
|
|
276
276
|
rotation: e.union([e.literal(0), e.literal(90), e.literal(180), e.literal(270)]).default(0),
|
|
@@ -283,7 +283,7 @@ var T = e.enum([
|
|
|
283
283
|
}), E = e.string().regex(
|
|
284
284
|
/^\d{1,3} \d{1,3} \d{1,3}$/,
|
|
285
285
|
'Expected space-separated RGB integers, e.g. "13 110 253"'
|
|
286
|
-
),
|
|
286
|
+
), Fe = e.object({
|
|
287
287
|
preset: e.enum(["light", "dark", "corporate", "midnight", "blueprint", "custom"]).default("dark"),
|
|
288
288
|
background: E.optional(),
|
|
289
289
|
foreground: E.optional(),
|
|
@@ -299,11 +299,11 @@ e.object({
|
|
|
299
299
|
revision: e.number().int().nonnegative(),
|
|
300
300
|
updatedAt: e.string().datetime().optional(),
|
|
301
301
|
activeApp: V,
|
|
302
|
-
apps:
|
|
303
|
-
display:
|
|
304
|
-
theme:
|
|
302
|
+
apps: _e,
|
|
303
|
+
display: Be,
|
|
304
|
+
theme: Fe
|
|
305
305
|
});
|
|
306
|
-
var
|
|
306
|
+
var ke = e.enum([
|
|
307
307
|
"unprovisioned",
|
|
308
308
|
"connecting",
|
|
309
309
|
"online",
|
|
@@ -312,11 +312,11 @@ var Fe = e.enum([
|
|
|
312
312
|
]);
|
|
313
313
|
e.object({
|
|
314
314
|
deviceId: e.string().min(1),
|
|
315
|
-
kind:
|
|
315
|
+
kind: we,
|
|
316
316
|
firmwareVersion: e.string(),
|
|
317
317
|
/** Shown on the device's own screen at boot — how the user finds it. */
|
|
318
318
|
ipAddress: e.string().optional(),
|
|
319
|
-
provisioning:
|
|
319
|
+
provisioning: ke,
|
|
320
320
|
/** Revision the device is actually running, not the one it was sent. */
|
|
321
321
|
configRevision: e.number().int().nonnegative(),
|
|
322
322
|
activeApp: V,
|
|
@@ -324,7 +324,7 @@ e.object({
|
|
|
324
324
|
uptimeSeconds: e.number().int().nonnegative().optional(),
|
|
325
325
|
freeHeapBytes: e.number().int().nonnegative().optional()
|
|
326
326
|
});
|
|
327
|
-
var
|
|
327
|
+
var Ie = e.enum([
|
|
328
328
|
"background",
|
|
329
329
|
"foreground",
|
|
330
330
|
"muted",
|
|
@@ -332,7 +332,7 @@ var ke = e.enum([
|
|
|
332
332
|
"success",
|
|
333
333
|
"warning",
|
|
334
334
|
"danger"
|
|
335
|
-
]), je = e.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'RGB must be three space-separated integers, e.g. "13 110 253"'), S = e.union([
|
|
335
|
+
]), je = e.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'RGB must be three space-separated integers, e.g. "13 110 253"'), S = e.union([Ie, je]), H = e.enum(["xs", "sm", "base", "lg", "xl", "display"]), C = e.enum(["start", "center", "end"]), De = e.discriminatedUnion("kind", [
|
|
336
336
|
e.object({
|
|
337
337
|
kind: e.literal("weather"),
|
|
338
338
|
latitude: e.number().min(-90).max(90),
|
|
@@ -395,14 +395,14 @@ var ke = e.enum([
|
|
|
395
395
|
kind: e.literal("board"),
|
|
396
396
|
units: e.enum(["imperial", "metric"]).default("imperial")
|
|
397
397
|
})
|
|
398
|
-
]),
|
|
398
|
+
]), j = e.union([
|
|
399
399
|
e.object({ literal: e.number() }),
|
|
400
400
|
e.object({ source: e.string().min(1), field: e.string().min(1) })
|
|
401
|
-
]),
|
|
401
|
+
]), Te = e.object({
|
|
402
402
|
compute: e.enum(["add", "subtract", "multiply", "divide"]),
|
|
403
|
-
of: e.tuple([
|
|
403
|
+
of: e.tuple([j, j]),
|
|
404
404
|
round: e.boolean().default(!0)
|
|
405
|
-
}),
|
|
405
|
+
}), w = e.union([
|
|
406
406
|
e.object({ literal: e.union([e.string(), e.number(), e.boolean()]) }),
|
|
407
407
|
e.object({
|
|
408
408
|
/** Key into the document's `sources` map. */
|
|
@@ -410,9 +410,9 @@ var ke = e.enum([
|
|
|
410
410
|
/** Field on that source, e.g. "temperature", "high", "condition". */
|
|
411
411
|
field: e.string().min(1)
|
|
412
412
|
}),
|
|
413
|
-
|
|
413
|
+
Te
|
|
414
414
|
]), _ = e.object({
|
|
415
|
-
value:
|
|
415
|
+
value: j,
|
|
416
416
|
op: e.enum(["<", "<=", ">", ">=", "==", "!="]),
|
|
417
417
|
than: e.union([e.number(), e.string(), e.boolean()])
|
|
418
418
|
}), U = e.object({
|
|
@@ -425,9 +425,9 @@ var ke = e.enum([
|
|
|
425
425
|
hideWhen: _.optional(),
|
|
426
426
|
/** Conditional style. First match wins. */
|
|
427
427
|
rules: e.array(U).max(4).optional()
|
|
428
|
-
},
|
|
428
|
+
}, Re = e.object({
|
|
429
429
|
type: e.literal("text"),
|
|
430
|
-
value:
|
|
430
|
+
value: w,
|
|
431
431
|
size: H.default("base"),
|
|
432
432
|
align: C.default("start"),
|
|
433
433
|
/** Printed after the value, e.g. a degree symbol. Never itself bound. */
|
|
@@ -435,30 +435,30 @@ var ke = e.enum([
|
|
|
435
435
|
prefix: e.string().max(8).optional(),
|
|
436
436
|
suffix: e.string().max(8).optional(),
|
|
437
437
|
...B
|
|
438
|
-
}),
|
|
438
|
+
}), Oe = e.object({
|
|
439
439
|
type: e.literal("dial"),
|
|
440
|
-
value:
|
|
440
|
+
value: w,
|
|
441
441
|
min: e.number(),
|
|
442
442
|
max: e.number(),
|
|
443
443
|
label: e.string().max(24).optional(),
|
|
444
444
|
...B
|
|
445
|
-
}),
|
|
445
|
+
}), Me = e.object({
|
|
446
446
|
type: e.literal("sparkline"),
|
|
447
447
|
/** A source field holding a series rather than a scalar. */
|
|
448
|
-
series:
|
|
448
|
+
series: w,
|
|
449
449
|
...B
|
|
450
|
-
}),
|
|
450
|
+
}), Ne = e.object({
|
|
451
451
|
type: e.literal("bar"),
|
|
452
|
-
value:
|
|
452
|
+
value: w,
|
|
453
453
|
min: e.number(),
|
|
454
454
|
max: e.number(),
|
|
455
455
|
...B
|
|
456
456
|
}), Pe = e.object({
|
|
457
457
|
type: e.literal("status"),
|
|
458
|
-
state:
|
|
458
|
+
state: w,
|
|
459
459
|
label: e.string().max(24).optional(),
|
|
460
460
|
...B
|
|
461
|
-
}), F = 64,
|
|
461
|
+
}), F = 64, $e = F / 2, ze = Math.ceil($e * F / 3) * 4, Le = e.object({
|
|
462
462
|
type: e.literal("sprite"),
|
|
463
463
|
width: e.number().int().min(1).max(F),
|
|
464
464
|
height: e.number().int().min(1).max(F),
|
|
@@ -473,11 +473,11 @@ var ke = e.enum([
|
|
|
473
473
|
*/
|
|
474
474
|
palette: e.array(S).min(1).max(16),
|
|
475
475
|
/** base64 of the packed nibbles. */
|
|
476
|
-
pixels: e.string().min(4).max(
|
|
476
|
+
pixels: e.string().min(4).max(ze),
|
|
477
477
|
align: C.default("start"),
|
|
478
478
|
/** Drawn only when this is false, or absent. */
|
|
479
479
|
hideWhen: _.optional()
|
|
480
|
-
}), D = e.string().regex(/^[0-9a-f]{64}$/, "a lowercase hex SHA-256"),
|
|
480
|
+
}), D = e.string().regex(/^[0-9a-f]{64}$/, "a lowercase hex SHA-256"), f = { width: 304, height: 224 }, Ve = 8, $ = {
|
|
481
481
|
/** "RSPR". */
|
|
482
482
|
magic: [82, 83, 80, 82],
|
|
483
483
|
version: 1,
|
|
@@ -486,13 +486,13 @@ var ke = e.enum([
|
|
|
486
486
|
/** Only 4 today: two pixels per byte, high nibble first, rows padded to a byte. */
|
|
487
487
|
bitsPerPixel: 4,
|
|
488
488
|
maxColors: 16
|
|
489
|
-
},
|
|
489
|
+
}, St = $.headerBytes + $.maxColors * 2 + Math.ceil(f.width / 2) * f.height, He = e.object({
|
|
490
490
|
type: e.literal("image"),
|
|
491
491
|
asset: D,
|
|
492
492
|
/** The file's own pixels, not the drawn size. */
|
|
493
|
-
width: e.number().int().min(1).max(
|
|
494
|
-
height: e.number().int().min(1).max(
|
|
495
|
-
scale: e.number().int().min(1).max(
|
|
493
|
+
width: e.number().int().min(1).max(f.width),
|
|
494
|
+
height: e.number().int().min(1).max(f.height),
|
|
495
|
+
scale: e.number().int().min(1).max(Ve).default(1),
|
|
496
496
|
/**
|
|
497
497
|
* What kind of file `asset` names: `spr`, the palette file the retro look
|
|
498
498
|
* uses, or `jpeg`, the full-colour rendition (drawn at scale 1). Absent means
|
|
@@ -502,9 +502,9 @@ var ke = e.enum([
|
|
|
502
502
|
align: C.default("start"),
|
|
503
503
|
/** Drawn only when this is false, or absent. */
|
|
504
504
|
hideWhen: _.optional()
|
|
505
|
-
}),
|
|
505
|
+
}), Ct = { sm: 24, md: 48, lg: 72, xl: 96 }, Ue = e.object({
|
|
506
506
|
type: e.literal("icon"),
|
|
507
|
-
value:
|
|
507
|
+
value: w,
|
|
508
508
|
size: e.enum(["sm", "md", "lg", "xl"]).default("md"),
|
|
509
509
|
align: C.default("start"),
|
|
510
510
|
color: S.default("foreground"),
|
|
@@ -512,15 +512,15 @@ var ke = e.enum([
|
|
|
512
512
|
/** Drawn only when this is false, or absent. */
|
|
513
513
|
hideWhen: _.optional()
|
|
514
514
|
}), K = e.discriminatedUnion("type", [
|
|
515
|
-
Te,
|
|
516
515
|
Re,
|
|
517
516
|
Oe,
|
|
518
517
|
Me,
|
|
518
|
+
Ne,
|
|
519
519
|
Pe,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
]),
|
|
520
|
+
Le,
|
|
521
|
+
He,
|
|
522
|
+
Ue
|
|
523
|
+
]), Ke = e.object({
|
|
524
524
|
type: e.literal("group"),
|
|
525
525
|
direction: e.enum(["row", "stack"]),
|
|
526
526
|
gap: e.number().int().min(0).max(64).default(4),
|
|
@@ -537,12 +537,12 @@ var ke = e.enum([
|
|
|
537
537
|
*/
|
|
538
538
|
pack: e.boolean().optional(),
|
|
539
539
|
children: e.array(K).min(1).max(8)
|
|
540
|
-
}),
|
|
540
|
+
}), We = e.union([K, Ke]);
|
|
541
541
|
e.enum(["landscape", "portrait"]);
|
|
542
|
-
var
|
|
542
|
+
var _t = {
|
|
543
543
|
landscape: { width: 320, height: 240 },
|
|
544
544
|
portrait: { width: 240, height: 320 }
|
|
545
|
-
},
|
|
545
|
+
}, Ge = e.preprocess(
|
|
546
546
|
(a) => a === "240x320" ? "320x240" : a,
|
|
547
547
|
e.enum(["320x240"])
|
|
548
548
|
), W = e.object({
|
|
@@ -552,7 +552,7 @@ var St = {
|
|
|
552
552
|
name: e.string().min(1).max(48),
|
|
553
553
|
/** Free text. Never an email or anything else identifying — see the plan. */
|
|
554
554
|
author: e.string().max(32).optional(),
|
|
555
|
-
screen:
|
|
555
|
+
screen: Ge.default("320x240"),
|
|
556
556
|
background: S.default("background"),
|
|
557
557
|
/**
|
|
558
558
|
* Where the blocks sit on the screen as a whole: from the top, or in the
|
|
@@ -583,42 +583,42 @@ var St = {
|
|
|
583
583
|
*/
|
|
584
584
|
font: e.enum(["inter", "pixel", "tay"]).optional(),
|
|
585
585
|
/** Named so bindings can refer to them. */
|
|
586
|
-
sources: e.record(
|
|
587
|
-
blocks: e.array(
|
|
588
|
-
}).superRefine((a,
|
|
589
|
-
const
|
|
590
|
-
const t =
|
|
586
|
+
sources: e.record(De).default({}),
|
|
587
|
+
blocks: e.array(We).min(1).max(12)
|
|
588
|
+
}).superRefine((a, i) => {
|
|
589
|
+
const h = (d) => Math.ceil(d / 2), m = (d, n) => {
|
|
590
|
+
const t = d;
|
|
591
591
|
if ((t == null ? void 0 : t.type) !== "sprite" || !t.width || !t.height || typeof t.pixels != "string") return;
|
|
592
|
-
const
|
|
593
|
-
l !==
|
|
592
|
+
const s = h(t.width) * t.height, l = Math.floor(t.pixels.replace(/=+$/, "").length * 3 / 4);
|
|
593
|
+
l !== s && i.addIssue({
|
|
594
594
|
code: e.ZodIssueCode.custom,
|
|
595
595
|
path: [...n, "pixels"],
|
|
596
|
-
message: `${t.width}x${t.height} needs ${
|
|
596
|
+
message: `${t.width}x${t.height} needs ${s} bytes of pixel data, and this decodes to ${l}. Rows are padded to whole bytes, so the length is ceil(width / 2) * height.`
|
|
597
597
|
});
|
|
598
|
-
},
|
|
599
|
-
const t =
|
|
598
|
+
}, b = (d, n) => {
|
|
599
|
+
const t = d;
|
|
600
600
|
if ((t == null ? void 0 : t.type) !== "image" || !t.width || !t.height) return;
|
|
601
|
-
const
|
|
602
|
-
if (t.format === "jpeg" &&
|
|
603
|
-
|
|
601
|
+
const s = t.scale ?? 1;
|
|
602
|
+
if (t.format === "jpeg" && s !== 1) {
|
|
603
|
+
i.addIssue({
|
|
604
604
|
code: e.ZodIssueCode.custom,
|
|
605
605
|
path: [...n, "scale"],
|
|
606
606
|
message: "A jpeg image is drawn at scale 1; make the file the size it should appear."
|
|
607
607
|
});
|
|
608
608
|
return;
|
|
609
609
|
}
|
|
610
|
-
const l = t.width *
|
|
611
|
-
l <=
|
|
610
|
+
const l = t.width * s, u = t.height * s;
|
|
611
|
+
l <= f.width && u <= f.height || i.addIssue({
|
|
612
612
|
code: e.ZodIssueCode.custom,
|
|
613
613
|
path: [...n, "scale"],
|
|
614
|
-
message: `${t.width}x${t.height} at scale ${
|
|
614
|
+
message: `${t.width}x${t.height} at scale ${s} draws ${l}x${u}, and a board draws at most ${f.width}x${f.height} inside its margin.`
|
|
615
615
|
});
|
|
616
616
|
};
|
|
617
|
-
a.blocks.forEach((
|
|
618
|
-
|
|
619
|
-
const t =
|
|
620
|
-
Array.isArray(t) && t.forEach((
|
|
621
|
-
|
|
617
|
+
a.blocks.forEach((d, n) => {
|
|
618
|
+
m(d, ["blocks", n]), b(d, ["blocks", n]);
|
|
619
|
+
const t = d.children;
|
|
620
|
+
Array.isArray(t) && t.forEach((s, l) => {
|
|
621
|
+
m(s, ["blocks", n, "children", l]), b(s, ["blocks", n, "children", l]);
|
|
622
622
|
});
|
|
623
623
|
});
|
|
624
624
|
}), G = e.object({
|
|
@@ -651,7 +651,7 @@ e.object({
|
|
|
651
651
|
crop: G.optional()
|
|
652
652
|
});
|
|
653
653
|
e.enum(["register", "poll", "send"]);
|
|
654
|
-
var
|
|
654
|
+
var Ze = e.enum(["working", "missing", "unsupported", "fault"]), Z = e.string().regex(/^[a-z][a-z0-9-]{0,23}$/), q = e.record(Z, Ze).refine((a) => Object.keys(a).length <= 16, { message: "at most 16 features" });
|
|
655
655
|
e.object({
|
|
656
656
|
/** When the board last said any of this, by the server's clock. */
|
|
657
657
|
reportedAt: e.number().int().nonnegative().optional(),
|
|
@@ -717,18 +717,18 @@ e.object({
|
|
|
717
717
|
*/
|
|
718
718
|
rotation: e.number().int().min(0).max(3).optional()
|
|
719
719
|
});
|
|
720
|
-
var
|
|
720
|
+
var qe = e.object({
|
|
721
721
|
key: Z,
|
|
722
722
|
value: e.union([e.number().finite(), e.string().max(64), e.boolean()]),
|
|
723
723
|
unit: e.string().max(16).optional(),
|
|
724
724
|
at: e.number().int().nonnegative().optional()
|
|
725
725
|
});
|
|
726
726
|
e.object({
|
|
727
|
-
readings: e.array(
|
|
727
|
+
readings: e.array(qe).min(1).max(16)
|
|
728
728
|
});
|
|
729
|
-
var
|
|
729
|
+
var x = e.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/, "eight characters, no I L O or U"), R = e.string().regex(/^\d{4}$/);
|
|
730
730
|
e.object({
|
|
731
|
-
deviceId:
|
|
731
|
+
deviceId: x,
|
|
732
732
|
code: R,
|
|
733
733
|
/** Firmware build, so a support question has an answer. */
|
|
734
734
|
version: e.string().max(40).optional(),
|
|
@@ -758,31 +758,31 @@ e.object({
|
|
|
758
758
|
features: q.optional()
|
|
759
759
|
});
|
|
760
760
|
e.object({
|
|
761
|
-
deviceId:
|
|
761
|
+
deviceId: x,
|
|
762
762
|
code: R
|
|
763
763
|
});
|
|
764
764
|
e.object({
|
|
765
|
-
deviceId:
|
|
765
|
+
deviceId: x
|
|
766
766
|
});
|
|
767
767
|
e.object({
|
|
768
768
|
revision: e.number().int().nonnegative(),
|
|
769
769
|
sentAt: e.number().int().nonnegative()
|
|
770
770
|
});
|
|
771
771
|
e.object({
|
|
772
|
-
deviceId:
|
|
772
|
+
deviceId: x,
|
|
773
773
|
code: R,
|
|
774
774
|
ownerId: e.string().nullable().default(null),
|
|
775
775
|
version: e.string().max(40).optional(),
|
|
776
776
|
createdAt: e.number().int().nonnegative(),
|
|
777
777
|
lastSeenAt: e.number().int().nonnegative()
|
|
778
778
|
});
|
|
779
|
-
var
|
|
779
|
+
var Ye = e.object({
|
|
780
780
|
version: e.string().min(1).max(40),
|
|
781
781
|
url: e.string().url().max(200),
|
|
782
782
|
sha256: e.string().regex(/^[0-9a-f]{64}$/),
|
|
783
783
|
bytes: e.number().int().positive(),
|
|
784
784
|
requestedAt: e.number().int().nonnegative()
|
|
785
|
-
}),
|
|
785
|
+
}), Bt = "?", Ft = {
|
|
786
786
|
// Accented Latin, CP437 0x80-0xA5 and 0xE1
|
|
787
787
|
Ç: { byte: 128, shows: "Ç" },
|
|
788
788
|
ü: { byte: 129, shows: "ü" },
|
|
@@ -854,7 +854,7 @@ var qe = e.object({
|
|
|
854
854
|
"—": { byte: 45, shows: "-" },
|
|
855
855
|
"−": { byte: 45, shows: "-" },
|
|
856
856
|
" ": { byte: 32, shows: " " }
|
|
857
|
-
},
|
|
857
|
+
}, kt = 28, It = {
|
|
858
858
|
background: "17 17 17",
|
|
859
859
|
foreground: "238 238 238",
|
|
860
860
|
muted: "153 153 153",
|
|
@@ -862,7 +862,7 @@ var qe = e.object({
|
|
|
862
862
|
success: "34 197 94",
|
|
863
863
|
warning: "245 158 11",
|
|
864
864
|
danger: "220 53 69"
|
|
865
|
-
},
|
|
865
|
+
}, jt = 48, Dt = 3, Tt = {
|
|
866
866
|
sun: [
|
|
867
867
|
[32, 24, 32, 26, 30, 29, 29, 30, 26, 32, 22, 32, 19, 30, 18, 29, 16, 26, 16, 22, 18, 19, 19, 18, 22, 16, 26, 16, 29, 18, 30, 19, 32, 22, 32, 24],
|
|
868
868
|
[37, 24, 43, 24],
|
|
@@ -910,7 +910,7 @@ var qe = e.object({
|
|
|
910
910
|
[41, 25, 37, 29, 35, 30, 13, 30, 10, 29, 9, 27, 9, 22, 10, 20, 14, 18, 15, 15, 15, 13, 19, 9, 21, 8, 26, 8, 29, 9, 31, 11, 33, 15, 36, 16, 38, 17, 40, 19, 41, 22, 41, 24],
|
|
911
911
|
[26, 33, 20, 41, 27, 41, 22, 47]
|
|
912
912
|
]
|
|
913
|
-
}, k = 8,
|
|
913
|
+
}, k = 8, Xe = e.object({
|
|
914
914
|
apps: e.array(W).min(1).max(k),
|
|
915
915
|
/** Which app to show — an index into `apps`. */
|
|
916
916
|
show: e.number().int().min(0).max(k - 1),
|
|
@@ -924,15 +924,15 @@ var qe = e.object({
|
|
|
924
924
|
added: e.array(e.number().int().nonnegative()).max(k).optional()
|
|
925
925
|
});
|
|
926
926
|
e.discriminatedUnion("op", [
|
|
927
|
-
e.object({ op: e.literal("show"), deviceId:
|
|
928
|
-
e.object({ op: e.literal("remove"), deviceId:
|
|
927
|
+
e.object({ op: e.literal("show"), deviceId: x, index: e.number().int().min(0) }),
|
|
928
|
+
e.object({ op: e.literal("remove"), deviceId: x, index: e.number().int().min(0) }),
|
|
929
929
|
e.object({
|
|
930
930
|
op: e.literal("move"),
|
|
931
|
-
deviceId:
|
|
931
|
+
deviceId: x,
|
|
932
932
|
from: e.number().int().min(0),
|
|
933
933
|
to: e.number().int().min(0)
|
|
934
934
|
}),
|
|
935
|
-
e.object({ op: e.literal("rotate"), deviceId:
|
|
935
|
+
e.object({ op: e.literal("rotate"), deviceId: x, minutes: e.number().int().min(0).max(1440) }),
|
|
936
936
|
/**
|
|
937
937
|
* Swap the panel's light and dark. Not about apps, but it rides the same
|
|
938
938
|
* route and the same poll: some units of the same board carry a panel wired
|
|
@@ -940,26 +940,26 @@ e.discriminatedUnion("op", [
|
|
|
940
940
|
* from identical firmware. It is a fact about one board's glass, so it is a
|
|
941
941
|
* per-board setting rather than a build.
|
|
942
942
|
*/
|
|
943
|
-
e.object({ op: e.literal("screen"), deviceId:
|
|
943
|
+
e.object({ op: e.literal("screen"), deviceId: x, invert: e.boolean() }),
|
|
944
944
|
/**
|
|
945
945
|
* Remove one entry from the list of apps sent to this board, by the revision
|
|
946
946
|
* it was sent as. The record only: what the board holds is the shelf's
|
|
947
947
|
* business, and `remove` above is how an app comes off it.
|
|
948
948
|
*/
|
|
949
|
-
e.object({ op: e.literal("forget"), deviceId:
|
|
949
|
+
e.object({ op: e.literal("forget"), deviceId: x, revision: e.number().int().min(1) })
|
|
950
950
|
]);
|
|
951
|
-
var
|
|
952
|
-
background:
|
|
951
|
+
var v = e.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'Must be "R G B", e.g. "13 110 253"').refine((a) => a.split(" ").every((i) => Number(i) <= 255), "Each channel is 0–255"), z = e.object({
|
|
952
|
+
background: v,
|
|
953
953
|
/** Text. */
|
|
954
|
-
foreground:
|
|
954
|
+
foreground: v,
|
|
955
955
|
/** Quieter text: labels, captions, the second line. */
|
|
956
|
-
muted:
|
|
956
|
+
muted: v,
|
|
957
957
|
/** The brand colour: buttons and links on the site, highlights on a board. */
|
|
958
|
-
accent:
|
|
959
|
-
success:
|
|
960
|
-
warning:
|
|
961
|
-
danger:
|
|
962
|
-
}), Y = e.enum(["inter", "tay", "pixel"]),
|
|
958
|
+
accent: v,
|
|
959
|
+
success: v,
|
|
960
|
+
warning: v,
|
|
961
|
+
danger: v
|
|
962
|
+
}), Y = e.enum(["inter", "tay", "pixel"]), Je = ["0rem", "0.25rem", "0.5rem", "0.75rem", "1rem"];
|
|
963
963
|
e.object({
|
|
964
964
|
name: e.string().trim().min(1).max(40),
|
|
965
965
|
/** The preset it started from, when it started from one. */
|
|
@@ -967,20 +967,20 @@ e.object({
|
|
|
967
967
|
light: z,
|
|
968
968
|
dark: z,
|
|
969
969
|
lettering: Y,
|
|
970
|
-
radius: e.enum(
|
|
970
|
+
radius: e.enum(Je)
|
|
971
971
|
});
|
|
972
|
-
var
|
|
972
|
+
var Qe = e.string().regex(/^[0-9a-f]{42}$/), et = e.union([e.literal("auto"), Y]);
|
|
973
973
|
e.object({
|
|
974
974
|
revision: e.number().int().nonnegative(),
|
|
975
975
|
sentAt: e.number().int().nonnegative().optional(),
|
|
976
976
|
document: W.optional(),
|
|
977
|
-
shelf:
|
|
978
|
-
update:
|
|
977
|
+
shelf: Xe.optional(),
|
|
978
|
+
update: Ye.optional(),
|
|
979
979
|
screen: e.object({ invert: e.boolean() }).optional(),
|
|
980
|
-
palette:
|
|
981
|
-
font:
|
|
980
|
+
palette: Qe.optional(),
|
|
981
|
+
font: et.optional()
|
|
982
982
|
});
|
|
983
|
-
var
|
|
983
|
+
var Rt = { inter: { family: "Inter", weight: 500, caps: !1 }, tay: { family: "TAY Dreamboat", weight: 400, caps: !0 } }, Ot = { inter: { 10: { 0: 6, 1: 4, 2: 6, 3: 6, 4: 7, 5: 6, 6: 6, 7: 6, 8: 6, 9: 6, " ": 3, "!": 3, '"': 5, "#": 6, $: 6, "%": 10, "&": 7, "'": 3, "(": 4, ")": 4, "*": 5, "+": 7, ",": 3, "-": 5, ".": 3, "/": 4, ":": 3, ";": 3, "<": 7, "=": 7, ">": 7, "?": 5, "@": 10, A: 7, B: 7, C: 7, D: 7, E: 6, F: 6, G: 7, H: 7, I: 3, J: 6, K: 7, L: 6, M: 9, N: 8, O: 8, P: 6, Q: 8, R: 6, S: 6, T: 7, U: 7, V: 7, W: 10, X: 7, Y: 7, Z: 6, "[": 4, "\\": 4, "]": 4, "^": 5, _: 5, "`": 3, a: 6, b: 6, c: 6, d: 6, e: 6, f: 4, g: 6, h: 6, i: 3, j: 3, k: 6, l: 3, m: 9, n: 6, o: 6, p: 6, q: 6, r: 4, s: 5, t: 3, u: 6, v: 6, w: 8, x: 6, y: 6, z: 6, "{": 4, "|": 3, "}": 4, "~": 7, " ": 3, "¡": 3, "¢": 6, "£": 6, "¥": 6, ª: 5, "«": 6, "¬": 7, "°": 5, "±": 7, "²": 4, µ: 6, "·": 3, º: 5, "»": 6, "¼": 8, "½": 9, "¿": 5, Ä: 7, Å: 7, Æ: 10, Ç: 7, É: 6, Ñ: 8, Ö: 8, Ü: 7, ß: 6, à: 6, á: 6, â: 6, ä: 6, å: 6, æ: 9, ç: 6, è: 6, é: 6, ê: 6, ë: 6, ì: 3, í: 3, î: 3, ï: 3, ñ: 6, ò: 6, ó: 6, ô: 6, ö: 6, "÷": 7, ù: 6, ú: 6, û: 6, ü: 6, ÿ: 6, ƒ: 5, Ω: 8, π: 5, "–": 5, "—": 10, "‘": 3, "’": 3, "“": 5, "”": 5, "−": 7, "√": 5, "∞": 7, "≈": 5, "≤": 5, "≥": 5 }, 12: { 0: 8, 1: 5, 2: 7, 3: 8, 4: 8, 5: 7, 6: 8, 7: 7, 8: 8, 9: 8, " ": 3, "!": 4, '"': 6, "#": 8, $: 8, "%": 12, "&": 8, "'": 4, "(": 4, ")": 4, "*": 6, "+": 8, ",": 4, "-": 6, ".": 4, "/": 4, ":": 4, ";": 4, "<": 8, "=": 8, ">": 8, "?": 6, "@": 12, A: 9, B: 8, C: 9, D: 9, E: 7, F: 7, G: 9, H: 9, I: 3, J: 7, K: 8, L: 7, M: 11, N: 9, O: 9, P: 8, Q: 9, R: 8, S: 8, T: 8, U: 9, V: 9, W: 12, X: 8, Y: 8, Z: 8, "[": 4, "\\": 4, "]": 4, "^": 6, _: 6, "`": 4, a: 7, b: 7, c: 7, d: 7, e: 7, f: 5, g: 7, h: 7, i: 3, j: 3, k: 7, l: 3, m: 11, n: 7, o: 7, p: 7, q: 7, r: 5, s: 6, t: 4, u: 7, v: 7, w: 10, x: 7, y: 7, z: 7, "{": 5, "|": 4, "}": 5, "~": 8, " ": 3, "¡": 4, "¢": 7, "£": 7, "¥": 7, ª: 5, "«": 7, "¬": 8, "°": 5, "±": 8, "²": 5, µ: 7, "·": 4, º: 6, "»": 7, "¼": 10, "½": 10, "¿": 6, Ä: 9, Å: 9, Æ: 12, Ç: 9, É: 7, Ñ: 9, Ö: 9, Ü: 9, ß: 8, à: 7, á: 7, â: 7, ä: 7, å: 7, æ: 11, ç: 7, è: 7, é: 7, ê: 7, ë: 7, ì: 3, í: 3, î: 3, ï: 3, ñ: 7, ò: 7, ó: 7, ô: 7, ö: 7, "÷": 8, ù: 7, ú: 7, û: 7, ü: 7, ÿ: 7, ƒ: 6, Ω: 9, π: 7, "–": 6, "—": 12, "‘": 3, "’": 3, "“": 6, "”": 6, "−": 8, "√": 7, "∞": 9, "≈": 7, "≤": 7, "≥": 7 }, 16: { 0: 10, 1: 7, 2: 10, 3: 10, 4: 11, 5: 10, 6: 10, 7: 9, 8: 10, 9: 10, " ": 4, "!": 5, '"': 8, "#": 10, $: 10, "%": 16, "&": 10, "'": 5, "(": 6, ")": 6, "*": 8, "+": 11, ",": 5, "-": 7, ".": 5, "/": 6, ":": 5, ";": 5, "<": 11, "=": 11, ">": 11, "?": 8, "@": 16, A: 11, B: 11, C: 12, D: 12, E: 10, F: 9, G: 12, H: 12, I: 4, J: 9, K: 11, L: 9, M: 15, N: 12, O: 12, P: 10, Q: 12, R: 10, S: 10, T: 10, U: 12, V: 11, W: 16, X: 11, Y: 11, Z: 10, "[": 6, "\\": 6, "]": 6, "^": 8, _: 7, "`": 5, a: 9, b: 10, c: 9, d: 10, e: 9, f: 6, g: 10, h: 10, i: 4, j: 4, k: 9, l: 4, m: 14, n: 10, o: 10, p: 10, q: 10, r: 6, s: 9, t: 5, u: 10, v: 9, w: 13, x: 9, y: 9, z: 9, "{": 7, "|": 6, "}": 7, "~": 11, " ": 4, "¡": 5, "¢": 9, "£": 10, "¥": 9, ª: 7, "«": 10, "¬": 11, "°": 7, "±": 11, "²": 7, µ: 10, "·": 5, º: 8, "»": 10, "¼": 13, "½": 14, "¿": 8, Ä: 11, Å: 11, Æ: 16, Ç: 12, É: 10, Ñ: 12, Ö: 12, Ü: 12, ß: 10, à: 9, á: 9, â: 9, ä: 9, å: 9, æ: 15, ç: 9, è: 9, é: 9, ê: 9, ë: 9, ì: 4, í: 4, î: 4, ï: 4, ñ: 10, ò: 10, ó: 10, ô: 10, ö: 10, "÷": 11, ù: 10, ú: 10, û: 10, ü: 10, ÿ: 9, ƒ: 8, Ω: 12, π: 9, "–": 8, "—": 16, "‘": 4, "’": 4, "“": 8, "”": 8, "−": 11, "√": 9, "∞": 11, "≈": 9, "≤": 9, "≥": 9 }, 20: { 0: 13, 1: 8, 2: 12, 3: 13, 4: 13, 5: 12, 6: 13, 7: 11, 8: 13, 9: 13, " ": 5, "!": 6, '"': 10, "#": 13, $: 13, "%": 20, "&": 13, "'": 6, "(": 7, ")": 7, "*": 10, "+": 13, ",": 6, "-": 9, ".": 6, "/": 7, ":": 6, ";": 6, "<": 13, "=": 13, ">": 13, "?": 11, "@": 20, A: 14, B: 13, C: 15, D: 14, E: 12, F: 12, G: 15, H: 15, I: 5, J: 12, K: 14, L: 11, M: 18, N: 15, O: 15, P: 13, Q: 15, R: 13, S: 13, T: 13, U: 15, V: 14, W: 20, X: 14, Y: 14, Z: 13, "[": 7, "\\": 7, "]": 7, "^": 10, _: 9, "`": 7, a: 11, b: 12, c: 12, d: 12, e: 12, f: 8, g: 12, h: 12, i: 5, j: 5, k: 11, l: 5, m: 18, n: 12, o: 12, p: 12, q: 12, r: 8, s: 11, t: 7, u: 12, v: 11, w: 17, x: 11, y: 12, z: 11, "{": 9, "|": 7, "}": 9, "~": 13, " ": 5, "¡": 6, "¢": 12, "£": 12, "¥": 11, ª: 9, "«": 12, "¬": 13, "°": 9, "±": 13, "²": 9, µ: 12, "·": 6, º: 10, "»": 12, "¼": 16, "½": 17, "¿": 11, Ä: 14, Å: 14, Æ: 20, Ç: 15, É: 12, Ñ: 15, Ö: 15, Ü: 15, ß: 13, à: 11, á: 11, â: 11, ä: 11, å: 11, æ: 18, ç: 12, è: 12, é: 12, ê: 12, ë: 12, ì: 5, í: 5, î: 5, ï: 5, ñ: 12, ò: 12, ó: 12, ô: 12, ö: 12, "÷": 13, ù: 12, ú: 12, û: 12, ü: 12, ÿ: 12, ƒ: 10, Ω: 15, π: 11, "–": 10, "—": 20, "‘": 6, "’": 6, "“": 9, "”": 9, "−": 13, "√": 11, "∞": 14, "≈": 11, "≤": 11, "≥": 11 }, 28: { 0: 18, 1: 12, 2: 17, 3: 18, 4: 18, 5: 17, 6: 18, 7: 16, 8: 18, 9: 18, " ": 7, "!": 9, '"': 14, "#": 18, $: 18, "%": 28, "&": 18, "'": 9, "(": 10, ")": 10, "*": 15, "+": 19, ",": 8, "-": 13, ".": 8, "/": 10, ":": 8, ";": 9, "<": 19, "=": 19, ">": 19, "?": 15, "@": 28, A: 20, B: 18, C: 21, D: 20, E: 17, F: 17, G: 21, H: 21, I: 8, J: 16, K: 19, L: 16, M: 26, N: 21, O: 21, P: 18, Q: 22, R: 18, S: 18, T: 18, U: 21, V: 20, W: 28, X: 20, Y: 19, Z: 18, "[": 10, "\\": 10, "]": 10, "^": 13, _: 13, "`": 9, a: 16, b: 17, c: 16, d: 17, e: 16, f: 11, g: 17, h: 17, i: 7, j: 7, k: 16, l: 7, m: 25, n: 17, o: 17, p: 17, q: 17, r: 11, s: 15, t: 10, u: 17, v: 16, w: 23, x: 16, y: 16, z: 16, "{": 12, "|": 10, "}": 12, "~": 19, " ": 7, "¡": 9, "¢": 16, "£": 17, "¥": 16, ª: 13, "«": 17, "¬": 19, "°": 13, "±": 19, "²": 13, µ: 17, "·": 8, º: 14, "»": 17, "¼": 23, "½": 24, "¿": 15, Ä: 20, Å: 20, Æ: 28, Ç: 21, É: 17, Ñ: 21, Ö: 21, Ü: 21, ß: 18, à: 16, á: 16, â: 16, ä: 16, å: 16, æ: 26, ç: 16, è: 16, é: 16, ê: 16, ë: 16, ì: 7, í: 7, î: 7, ï: 7, ñ: 17, ò: 17, ó: 17, ô: 17, ö: 17, "÷": 19, ù: 17, ú: 17, û: 17, ü: 17, ÿ: 16, ƒ: 14, Ω: 22, π: 15, "–": 14, "—": 28, "‘": 8, "’": 8, "“": 13, "”": 13, "−": 19, "√": 15, "∞": 20, "≈": 15, "≤": 15, "≥": 15 }, 56: { 0: 36, 1: 23, 2: 35, 3: 35, 4: 37, 5: 34, 6: 35, 7: 32, 8: 35, 9: 35, " ": 15, "!": 17, '"': 28, "#": 36, $: 36, "%": 56, "&": 37, "'": 18, "(": 21, ")": 21, "*": 29, "+": 37, ",": 17, "-": 26, ".": 17, "/": 21, ":": 17, ";": 18, "<": 37, "=": 37, ">": 37, "?": 30, "@": 55, A: 40, B: 37, C: 41, D: 40, E: 34, F: 33, G: 42, H: 42, I: 15, J: 32, K: 39, L: 32, M: 51, N: 42, O: 43, P: 36, Q: 43, R: 36, S: 36, T: 37, U: 41, V: 40, W: 56, X: 39, Y: 39, Z: 36, "[": 21, "\\": 21, "]": 21, "^": 27, _: 26, "`": 19, a: 32, b: 35, c: 32, d: 35, e: 33, f: 21, g: 35, h: 34, i: 14, j: 14, k: 31, l: 14, m: 50, n: 34, o: 34, p: 35, q: 35, r: 22, s: 30, t: 19, u: 34, v: 32, w: 46, x: 31, y: 32, z: 31, "{": 25, "|": 19, "}": 25, "~": 37, "°": 26 } }, tay: { 28: { 0: 29, 1: 16, 2: 28, 3: 28, 4: 30, 5: 27, 6: 28, 7: 26, 8: 29, 9: 29, " ": 12, "!": 16, '"': 12, "#": 27, $: 27, "%": 29, "&": 33, "'": 9, "(": 20, ")": 20, "*": 14, "+": 21, ",": 10, "-": 16, ".": 10, "/": 19, ":": 13, ";": 12, "<": 18, "=": 22, ">": 18, "?": 27, "@": 31, A: 28, B: 32, C: 28, D: 30, E: 30, F: 29, G: 29, H: 32, I: 16, J: 27, K: 29, L: 27, M: 36, N: 32, O: 29, P: 30, Q: 30, R: 30, S: 29, T: 31, U: 29, V: 28, W: 40, X: 29, Y: 29, Z: 30, "[": 17, "\\": 19, "]": 17, "^": 13, _: 19, "`": 9, "{": 13, "|": 6, "}": 13, "~": 15, " ": 8, "¡": 15, "¢": 14, "£": 26, "¥": 31, ª: 8, "«": 14, "¬": 16, "°": 14, "±": 15, "²": 8, "·": 7, º: 9, "»": 14, "¼": 21, "½": 21, "¿": 26, Ä: 28, Å: 28, Æ: 25, Ç: 28, É: 30, Ñ: 32, Ö: 29, Ü: 29, "÷": 15, Ω: 22, "–": 14, "—": 28, "‘": 9, "’": 9, "“": 12, "”": 12, "−": 16, "√": 15, "∞": 20, "≈": 15, "≤": 15, "≥": 15 }, 56: { 0: 58, 1: 33, 2: 56, 3: 57, 4: 60, 5: 55, 6: 57, 7: 51, 8: 58, 9: 59, " ": 24, "!": 32, '"': 23, "#": 55, $: 55, "%": 59, "&": 66, "'": 18, "(": 39, ")": 39, "*": 28, "+": 43, ",": 20, "-": 31, ".": 20, "/": 38, ":": 26, ";": 23, "<": 37, "=": 44, ">": 37, "?": 54, "@": 61, A: 56, B: 63, C: 56, D: 60, E: 60, F: 58, G: 58, H: 63, I: 33, J: 55, K: 58, L: 53, M: 72, N: 65, O: 59, P: 60, Q: 59, R: 61, S: 58, T: 62, U: 58, V: 56, W: 79, X: 58, Y: 58, Z: 59, "[": 34, "\\": 38, "]": 34, "^": 26, _: 39, "`": 19, "{": 27, "|": 11, "}": 27, "~": 30, "°": 27 } } };
|
|
984
984
|
e.object({
|
|
985
985
|
deviceId: e.string().min(1, "Device ID is required"),
|
|
986
986
|
timeRange: e.enum(["1h", "24h", "7d"], {
|
|
@@ -990,29 +990,29 @@ e.object({
|
|
|
990
990
|
e.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
|
|
991
991
|
).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
|
|
992
992
|
});
|
|
993
|
-
var
|
|
993
|
+
var I = "gemini-2.5-flash", tt = "gemini-2.5-flash", at = "gemini-2.5-pro", Mt = {
|
|
994
994
|
"google-gemini": "gemini-2.5-flash",
|
|
995
995
|
openai: "gpt-4o-mini",
|
|
996
996
|
anthropic: "claude-haiku-4-5-20251001",
|
|
997
997
|
grok: "grok-2-1212",
|
|
998
998
|
deepseek: "deepseek-chat",
|
|
999
999
|
ollama: "llama3.3"
|
|
1000
|
-
},
|
|
1000
|
+
}, Nt = {
|
|
1001
1001
|
/** The Strategist: high creativity, exploratory conversation */
|
|
1002
1002
|
STRATEGIST: {
|
|
1003
|
-
model:
|
|
1003
|
+
model: tt,
|
|
1004
1004
|
provider: "google-gemini",
|
|
1005
1005
|
temperature: 0.7
|
|
1006
1006
|
},
|
|
1007
1007
|
/** The Architect: data schema and resource modeling — precision required */
|
|
1008
1008
|
ARCHITECT: {
|
|
1009
|
-
model:
|
|
1009
|
+
model: I,
|
|
1010
1010
|
provider: "google-gemini",
|
|
1011
1011
|
temperature: 0.3
|
|
1012
1012
|
},
|
|
1013
1013
|
/** The Designer: UI layout generation — moderate creativity */
|
|
1014
1014
|
DESIGNER: {
|
|
1015
|
-
model:
|
|
1015
|
+
model: I,
|
|
1016
1016
|
provider: "google-gemini",
|
|
1017
1017
|
temperature: 0.5
|
|
1018
1018
|
},
|
|
@@ -1020,17 +1020,17 @@ var j = "gemini-2.5-flash", et = "gemini-2.5-flash", tt = "gemini-2.5-pro", Rt =
|
|
|
1020
1020
|
* Uses the Pro tier for superior reasoning on complex structured tasks.
|
|
1021
1021
|
*/
|
|
1022
1022
|
REVIEWER: {
|
|
1023
|
-
model:
|
|
1023
|
+
model: at,
|
|
1024
1024
|
provider: "google-gemini",
|
|
1025
1025
|
temperature: 0.2
|
|
1026
1026
|
},
|
|
1027
1027
|
/** The Genesis Engine: one-shot app generation — must be schema-strict */
|
|
1028
1028
|
GENESIS: {
|
|
1029
|
-
model:
|
|
1029
|
+
model: I,
|
|
1030
1030
|
provider: "google-gemini",
|
|
1031
1031
|
temperature: 0.2
|
|
1032
1032
|
}
|
|
1033
|
-
},
|
|
1033
|
+
}, Pt = `
|
|
1034
1034
|
You write tiny apps for a small desk device whose screen is 320 pixels wide and
|
|
1035
1035
|
240 pixels high — landscape.
|
|
1036
1036
|
|
|
@@ -1193,10 +1193,10 @@ RULES
|
|
|
1193
1193
|
closest thing it can and do not invent a component.
|
|
1194
1194
|
6. Prefer a rule over a fixed colour whenever the request ties appearance to a
|
|
1195
1195
|
value. "Red when cold" is a rule; "red" is not.
|
|
1196
|
-
`.trim(),
|
|
1196
|
+
`.trim(), $t = "Here is the current app. Change only what is asked:", o = e.string().regex(
|
|
1197
1197
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
1198
1198
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
1199
|
-
),
|
|
1199
|
+
), nt = e.object({
|
|
1200
1200
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
1201
1201
|
"--app-primary-color": o.optional(),
|
|
1202
1202
|
"--app-primary-foreground-color": o.optional(),
|
|
@@ -1227,7 +1227,7 @@ RULES
|
|
|
1227
1227
|
"--app-chart-3": o.optional(),
|
|
1228
1228
|
"--app-chart-4": o.optional(),
|
|
1229
1229
|
"--app-chart-5": o.optional()
|
|
1230
|
-
}).strict(),
|
|
1230
|
+
}).strict(), ot = e.object({
|
|
1231
1231
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
1232
1232
|
heading: e.string(),
|
|
1233
1233
|
/** Google Font name for body text. Example: "Inter" */
|
|
@@ -1241,13 +1241,13 @@ e.object({
|
|
|
1241
1241
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
1242
1242
|
description: e.string(),
|
|
1243
1243
|
/** Google Font pairing for heading and body text. */
|
|
1244
|
-
fonts:
|
|
1244
|
+
fonts: ot.optional(),
|
|
1245
1245
|
/**
|
|
1246
1246
|
* CSS variable overrides.
|
|
1247
1247
|
* Every key must match an --app-* variable name.
|
|
1248
1248
|
* All color values must be space-separated RGB integers.
|
|
1249
1249
|
*/
|
|
1250
|
-
cssVars:
|
|
1250
|
+
cssVars: nt
|
|
1251
1251
|
});
|
|
1252
1252
|
e.object({
|
|
1253
1253
|
primary: o,
|
|
@@ -1257,105 +1257,105 @@ e.object({
|
|
|
1257
1257
|
destructive: o,
|
|
1258
1258
|
radius: e.enum(["none", "sm", "md", "lg", "full"])
|
|
1259
1259
|
});
|
|
1260
|
-
var
|
|
1260
|
+
var zt = {
|
|
1261
1261
|
primary: "13 110 253",
|
|
1262
1262
|
neutral: "24 24 27",
|
|
1263
1263
|
success: "34 197 94",
|
|
1264
1264
|
warning: "234 179 8",
|
|
1265
1265
|
destructive: "239 68 68",
|
|
1266
1266
|
radius: "md"
|
|
1267
|
-
},
|
|
1267
|
+
}, p = e.number().finite(), r = p.positive(), g = p.nonnegative(), it = e.object({
|
|
1268
1268
|
name: e.string().min(1).default("Bambu Lab X1 Carbon"),
|
|
1269
1269
|
/** Walls are whole multiples of this. */
|
|
1270
|
-
nozzle:
|
|
1270
|
+
nozzle: r.default(0.4),
|
|
1271
1271
|
/** Gap for parts that slide together: the case's lip, a lid. */
|
|
1272
|
-
clearance_slip:
|
|
1272
|
+
clearance_slip: g.default(0.2),
|
|
1273
1273
|
/** Gap for a friction fit. */
|
|
1274
|
-
clearance_press:
|
|
1275
|
-
}),
|
|
1274
|
+
clearance_press: g.default(0.1)
|
|
1275
|
+
}), rt = e.enum(["east", "west", "north", "south", "top", "bottom"]), st = e.object({
|
|
1276
1276
|
/** The tongue's length, from its free end to where it joins the floor. */
|
|
1277
|
-
length:
|
|
1277
|
+
length: r.default(12),
|
|
1278
1278
|
/** Its width. */
|
|
1279
|
-
width:
|
|
1279
|
+
width: r.default(5),
|
|
1280
1280
|
/** The way from the switch to where the tongue joins the floor. */
|
|
1281
1281
|
hinge: e.enum(["east", "west", "north", "south"])
|
|
1282
|
-
}),
|
|
1282
|
+
}), lt = e.object({
|
|
1283
1283
|
/** usb_c, screen, reset_button, status_led, sd_card… */
|
|
1284
1284
|
name: e.string().min(1),
|
|
1285
|
-
edge:
|
|
1285
|
+
edge: rt,
|
|
1286
1286
|
/** From the centre of that face — see COORDINATES above. */
|
|
1287
|
-
offset_from_center: e.tuple([
|
|
1287
|
+
offset_from_center: e.tuple([p, p]).default([0, 0]),
|
|
1288
1288
|
/**
|
|
1289
1289
|
* A grille is a field of small round holes filling an ellipse of
|
|
1290
1290
|
* `cutout_size` — a speaker's — on a top or bottom face only.
|
|
1291
1291
|
*/
|
|
1292
1292
|
cutout_shape: e.enum(["rect", "rounded_rect", "circle", "grille"]),
|
|
1293
1293
|
/** [width, height] of the opening, including room for a plug's boot. A circle uses the first as its diameter. */
|
|
1294
|
-
cutout_size: e.tuple([
|
|
1294
|
+
cutout_size: e.tuple([r, r]),
|
|
1295
1295
|
/** How far the part sticks out past the component's edge. */
|
|
1296
|
-
protrusion:
|
|
1296
|
+
protrusion: g.default(0),
|
|
1297
1297
|
/** A wider recess on the outside face, [width, height, depth], for a thick cable boot. */
|
|
1298
|
-
outer_recess: e.tuple([
|
|
1298
|
+
outer_recess: e.tuple([r, r, r]).optional(),
|
|
1299
1299
|
/** Press it through the floor instead of opening a hole — see FlexButtonSchema. */
|
|
1300
|
-
flex_button:
|
|
1300
|
+
flex_button: st.optional(),
|
|
1301
1301
|
/**
|
|
1302
1302
|
* A 45° ramp this deep round the opening at the outside face, widening it
|
|
1303
1303
|
* by this much a side there. For a screen set back behind a bezel: the
|
|
1304
1304
|
* picture's edges stay in view and a fingertip reaches them. Top or bottom
|
|
1305
1305
|
* openings only.
|
|
1306
1306
|
*/
|
|
1307
|
-
chamfer:
|
|
1308
|
-
}),
|
|
1307
|
+
chamfer: g.optional()
|
|
1308
|
+
}), ut = e.object({
|
|
1309
1309
|
/** Four holes, this far in from each corner: [east-west, north-south]. */
|
|
1310
|
-
inset_from_corners: e.tuple([
|
|
1310
|
+
inset_from_corners: e.tuple([r, r]).optional(),
|
|
1311
1311
|
/** Or exactly where they are: [east, north] from the footprint centre. */
|
|
1312
|
-
positions: e.array(e.tuple([
|
|
1312
|
+
positions: e.array(e.tuple([p, p])).min(1).optional(),
|
|
1313
1313
|
thread: e.enum(["M2", "M2.5", "M3"]),
|
|
1314
1314
|
/** Heat-set insert outer diameter and depth. split_shell_lip only: tray_bezel's screws cut their own thread. */
|
|
1315
|
-
insert_od:
|
|
1316
|
-
insert_depth:
|
|
1315
|
+
insert_od: r.optional(),
|
|
1316
|
+
insert_depth: r.optional()
|
|
1317
1317
|
}).refine((a) => (a.inset_from_corners ? 1 : 0) + (a.positions ? 1 : 0) == 1, {
|
|
1318
1318
|
message: "give either inset_from_corners or positions, not both or neither"
|
|
1319
|
-
}),
|
|
1319
|
+
}), mt = e.object({
|
|
1320
1320
|
relative_to: e.string().min(1),
|
|
1321
1321
|
where: e.enum(["below", "above", "east", "west", "north", "south"]),
|
|
1322
1322
|
/** Space between the two keep-outs. */
|
|
1323
|
-
gap:
|
|
1323
|
+
gap: g.default(1),
|
|
1324
1324
|
/** Moved this far [east, north] from centred on the other, once placed. */
|
|
1325
|
-
offset: e.tuple([
|
|
1325
|
+
offset: e.tuple([p, p]).default([0, 0])
|
|
1326
1326
|
}), X = e.object({
|
|
1327
1327
|
id: e.string().regex(/^[a-z][a-z0-9_]*$/, "lowercase letters, digits and underscores"),
|
|
1328
1328
|
type: e.enum(["pcb", "display", "battery", "speaker", "module"]),
|
|
1329
1329
|
/** [east, north, up] — see COORDINATES. */
|
|
1330
|
-
dimensions: e.tuple([
|
|
1330
|
+
dimensions: e.tuple([r, r, r]),
|
|
1331
1331
|
/**
|
|
1332
1332
|
* Radius of the footprint's corners: most boards are rounded. The case's
|
|
1333
1333
|
* inside corners follow it, so a rounded board gets a rounded tray without
|
|
1334
1334
|
* the tray growing wider. Leave it at 0 for a square one, or when unsure —
|
|
1335
1335
|
* assuming sharper than the part is safe, rounder is not.
|
|
1336
1336
|
*/
|
|
1337
|
-
corner_radius:
|
|
1337
|
+
corner_radius: g.default(0),
|
|
1338
1338
|
/** Height of the tallest part on top (headers, capacitors, a connector), kept clear. */
|
|
1339
|
-
clearance_z_top:
|
|
1339
|
+
clearance_z_top: g.default(0),
|
|
1340
1340
|
/** Height of what is underneath (solder joints, a microSD socket), kept clear. */
|
|
1341
|
-
clearance_z_bottom:
|
|
1341
|
+
clearance_z_bottom: g.default(0),
|
|
1342
1342
|
/** Quarter turns about Z, applied before placement. */
|
|
1343
1343
|
rotation: e.union([e.literal(0), e.literal(90), e.literal(180), e.literal(270)]).default(0),
|
|
1344
|
-
placement:
|
|
1345
|
-
mount_holes:
|
|
1346
|
-
interfaces: e.array(
|
|
1344
|
+
placement: mt.optional(),
|
|
1345
|
+
mount_holes: ut.optional(),
|
|
1346
|
+
interfaces: e.array(lt).default([]),
|
|
1347
1347
|
/** How it is held if it has no screw holes. */
|
|
1348
1348
|
retention: e.enum(["none", "cradle_ribs"]).default("none")
|
|
1349
|
-
}),
|
|
1349
|
+
}), ct = e.object({
|
|
1350
1350
|
/** The SVG file, relative to the manifest. Filled paths only; strokes are ignored. */
|
|
1351
1351
|
svg: e.string().min(1),
|
|
1352
1352
|
face: e.enum(["top", "bottom"]).default("bottom"),
|
|
1353
1353
|
/** Height of the mark on the face, along north. Its width follows the SVG's proportions. */
|
|
1354
|
-
height:
|
|
1354
|
+
height: r,
|
|
1355
1355
|
/** How deep it is pressed in. */
|
|
1356
|
-
depth:
|
|
1356
|
+
depth: r.default(0.6),
|
|
1357
1357
|
/** From the centre of the case's footprint, [east, north]. */
|
|
1358
|
-
offset: e.tuple([
|
|
1358
|
+
offset: e.tuple([p, p]).default([0, 0]),
|
|
1359
1359
|
/**
|
|
1360
1360
|
* Cut it right through the face instead, as a stencil — a speaker's grille
|
|
1361
1361
|
* in the shape of the mark. Whatever its lines enclose would fall out, so
|
|
@@ -1366,14 +1366,14 @@ var Nt = {
|
|
|
1366
1366
|
* check, by where it is.
|
|
1367
1367
|
*/
|
|
1368
1368
|
stencil: e.object({
|
|
1369
|
-
bridges: e.array(e.object({ at: e.tuple([
|
|
1369
|
+
bridges: e.array(e.object({ at: e.tuple([p, p]), angle: e.number().default(0), length: r.default(3) })).default([])
|
|
1370
1370
|
}).optional()
|
|
1371
1371
|
});
|
|
1372
1372
|
e.object({
|
|
1373
1373
|
project: e.string().regex(/^[a-z0-9][a-z0-9_-]*$/, "lowercase, digits, - and _"),
|
|
1374
1374
|
/** How the case goes together — see TWO STYLES above. */
|
|
1375
1375
|
enclosure_style: e.enum(["split_shell_lip", "tray_bezel"]).default("split_shell_lip"),
|
|
1376
|
-
wall_thickness:
|
|
1376
|
+
wall_thickness: r.default(2.4),
|
|
1377
1377
|
/**
|
|
1378
1378
|
* Thicker walls on chosen sides, in place of `wall_thickness` there. A
|
|
1379
1379
|
* screen whose glass is as wide as its board otherwise gets 2.4mm of frame
|
|
@@ -1381,9 +1381,9 @@ e.object({
|
|
|
1381
1381
|
* black ESP32-S3 board's flush case, 2026-10-25). Each is a whole number
|
|
1382
1382
|
* of nozzle lines, and no thinner than `wall_thickness`.
|
|
1383
1383
|
*/
|
|
1384
|
-
walls: e.object({ east:
|
|
1384
|
+
walls: e.object({ east: r, west: r, north: r, south: r }).partial().default({}),
|
|
1385
1385
|
/** Radius of the vertical outside corners. */
|
|
1386
|
-
corner_radius:
|
|
1386
|
+
corner_radius: g.default(2),
|
|
1387
1387
|
/**
|
|
1388
1388
|
* The outside's front and back edges — where the face meets the sides.
|
|
1389
1389
|
* `chamfer` bevels them flat at 45°, `round` rounds them; `soften` then
|
|
@@ -1392,72 +1392,72 @@ e.object({
|
|
|
1392
1392
|
*/
|
|
1393
1393
|
edges: e.object({
|
|
1394
1394
|
style: e.enum(["chamfer", "round"]),
|
|
1395
|
-
size:
|
|
1396
|
-
soften:
|
|
1395
|
+
size: r,
|
|
1396
|
+
soften: g.default(0)
|
|
1397
1397
|
}).optional(),
|
|
1398
|
-
printer:
|
|
1398
|
+
printer: it.default({}),
|
|
1399
1399
|
components: e.array(X).min(1),
|
|
1400
|
-
emblem:
|
|
1401
|
-
}).superRefine((a,
|
|
1402
|
-
const
|
|
1403
|
-
Math.abs(
|
|
1400
|
+
emblem: ct.optional()
|
|
1401
|
+
}).superRefine((a, i) => {
|
|
1402
|
+
const h = a.wall_thickness / a.printer.nozzle;
|
|
1403
|
+
Math.abs(h - Math.round(h)) > 1e-6 && i.addIssue({
|
|
1404
1404
|
code: e.ZodIssueCode.custom,
|
|
1405
1405
|
path: ["wall_thickness"],
|
|
1406
|
-
message: `${a.wall_thickness}mm is not a whole number of ${a.printer.nozzle}mm lines — try ${(Math.round(
|
|
1406
|
+
message: `${a.wall_thickness}mm is not a whole number of ${a.printer.nozzle}mm lines — try ${(Math.round(h) * a.printer.nozzle).toFixed(2)}`
|
|
1407
1407
|
});
|
|
1408
1408
|
for (const [n, t] of Object.entries(a.walls)) {
|
|
1409
1409
|
if (t === void 0) continue;
|
|
1410
|
-
const
|
|
1411
|
-
Math.abs(
|
|
1410
|
+
const s = t / a.printer.nozzle;
|
|
1411
|
+
Math.abs(s - Math.round(s)) > 1e-6 && i.addIssue({
|
|
1412
1412
|
code: e.ZodIssueCode.custom,
|
|
1413
1413
|
path: ["walls", n],
|
|
1414
|
-
message: `${t}mm is not a whole number of ${a.printer.nozzle}mm lines — try ${(Math.round(
|
|
1415
|
-
}), t < a.wall_thickness &&
|
|
1414
|
+
message: `${t}mm is not a whole number of ${a.printer.nozzle}mm lines — try ${(Math.round(s) * a.printer.nozzle).toFixed(2)}`
|
|
1415
|
+
}), t < a.wall_thickness && i.addIssue({
|
|
1416
1416
|
code: e.ZodIssueCode.custom,
|
|
1417
1417
|
path: ["walls", n],
|
|
1418
1418
|
message: `${t}mm is thinner than wall_thickness (${a.wall_thickness}mm): walls only thicken on chosen sides`
|
|
1419
1419
|
});
|
|
1420
1420
|
}
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
-
|
|
1421
|
+
const m = a.components.map((n) => n.id);
|
|
1422
|
+
m.forEach((n, t) => {
|
|
1423
|
+
m.indexOf(n) !== t && i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "id"], message: `"${n}" is used twice` });
|
|
1424
1424
|
});
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1425
|
+
const b = a.components.filter((n) => !n.placement);
|
|
1426
|
+
b.length !== 1 && i.addIssue({
|
|
1427
1427
|
code: e.ZodIssueCode.custom,
|
|
1428
1428
|
path: ["components"],
|
|
1429
|
-
message: `exactly one component must have no placement (the origin); found ${
|
|
1429
|
+
message: `exactly one component must have no placement (the origin); found ${b.length}: ${b.map((n) => n.id).join(", ") || "none"}`
|
|
1430
1430
|
});
|
|
1431
|
-
const
|
|
1431
|
+
const d = new Map(a.components.map((n) => [n.id, n]));
|
|
1432
1432
|
a.components.forEach((n, t) => {
|
|
1433
1433
|
if (!n.placement) return;
|
|
1434
|
-
const
|
|
1435
|
-
if (!
|
|
1436
|
-
|
|
1434
|
+
const s = n.placement.relative_to;
|
|
1435
|
+
if (!d.has(s)) {
|
|
1436
|
+
i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "placement", "relative_to"], message: `no component "${s}"` });
|
|
1437
1437
|
return;
|
|
1438
1438
|
}
|
|
1439
1439
|
const l = /* @__PURE__ */ new Set([n.id]);
|
|
1440
|
-
for (let u =
|
|
1440
|
+
for (let u = d.get(s); u != null && u.placement; u = d.get(u.placement.relative_to)) {
|
|
1441
1441
|
if (l.has(u.id)) {
|
|
1442
|
-
|
|
1442
|
+
i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "placement"], message: `placement loops back to "${u.id}"` });
|
|
1443
1443
|
return;
|
|
1444
1444
|
}
|
|
1445
1445
|
l.add(u.id);
|
|
1446
1446
|
}
|
|
1447
1447
|
}), a.components.forEach((n, t) => {
|
|
1448
|
-
var M,
|
|
1449
|
-
a.enclosure_style === "split_shell_lip" && n.mount_holes && (!n.mount_holes.insert_od || !n.mount_holes.insert_depth) &&
|
|
1450
|
-
|
|
1448
|
+
var M, N, P;
|
|
1449
|
+
a.enclosure_style === "split_shell_lip" && n.mount_holes && (!n.mount_holes.insert_od || !n.mount_holes.insert_depth) && i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "mount_holes"], message: "a split_shell_lip case holds boards on heat-set inserts: give insert_od and insert_depth" }), n.interfaces.forEach((c, A) => {
|
|
1450
|
+
c.chamfer && c.edge !== "top" && c.edge !== "bottom" && i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "interfaces", A, "chamfer"], message: `a chamfer ramps an opening in the bezel or the floor: its edge must be top or bottom, not ${c.edge}` }), c.cutout_shape === "grille" && c.edge !== "top" && c.edge !== "bottom" && i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "interfaces", A, "cutout_shape"], message: `a grille is a field of holes in the bezel or the floor: its edge must be top or bottom, not ${c.edge}` }), c.flex_button && c.edge !== "bottom" && i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "interfaces", A, "flex_button"], message: `a flex button is pressed through the floor: its edge must be bottom, not ${c.edge}` });
|
|
1451
1451
|
});
|
|
1452
|
-
const [
|
|
1453
|
-
(
|
|
1454
|
-
(Math.abs(
|
|
1452
|
+
const [s, l] = n.dimensions;
|
|
1453
|
+
(N = (M = n.mount_holes) == null ? void 0 : M.positions) == null || N.forEach((c, A) => {
|
|
1454
|
+
(Math.abs(c[0]) > s / 2 || Math.abs(c[1]) > l / 2) && i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "mount_holes", "positions", A], message: `hole at [${c}] is outside the ${s}×${l} footprint` });
|
|
1455
1455
|
});
|
|
1456
|
-
const u = (
|
|
1457
|
-
u && (u[0] * 2 >=
|
|
1456
|
+
const u = (P = n.mount_holes) == null ? void 0 : P.inset_from_corners;
|
|
1457
|
+
u && (u[0] * 2 >= s || u[1] * 2 >= l) && i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "mount_holes", "inset_from_corners"], message: `insets [${u}] meet in the middle of a ${s}×${l} footprint` });
|
|
1458
1458
|
});
|
|
1459
1459
|
});
|
|
1460
|
-
var
|
|
1460
|
+
var dt = e.object({
|
|
1461
1461
|
label: e.string().min(1),
|
|
1462
1462
|
/** One sentence: what it is for. */
|
|
1463
1463
|
description: e.string().optional(),
|
|
@@ -1472,16 +1472,16 @@ var ct = e.object({
|
|
|
1472
1472
|
* clearance and widens its screen opening to the glass.
|
|
1473
1473
|
*/
|
|
1474
1474
|
patch: e.record(e.record(e.unknown())).default({})
|
|
1475
|
-
}),
|
|
1475
|
+
}), pt = e.object({
|
|
1476
1476
|
label: e.string().min(1),
|
|
1477
1477
|
/** In order; the first is the default. Ids are lowercase words and dashes. */
|
|
1478
|
-
choices: e.array(
|
|
1478
|
+
choices: e.array(dt.extend({ id: e.string().regex(/^[a-z0-9][a-z0-9-]*$/) })).min(1)
|
|
1479
1479
|
});
|
|
1480
1480
|
e.object({
|
|
1481
1481
|
/** The base manifest, relative to this file. */
|
|
1482
1482
|
manifest: e.string().min(1),
|
|
1483
1483
|
/** Option groups, in the order they are offered: base, top… */
|
|
1484
|
-
options: e.record(e.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
1484
|
+
options: e.record(e.string().regex(/^[a-z][a-z0-9-]*$/), pt)
|
|
1485
1485
|
});
|
|
1486
1486
|
e.object({
|
|
1487
1487
|
id: e.string().default(""),
|
|
@@ -1494,7 +1494,7 @@ e.object({
|
|
|
1494
1494
|
lastActive: e.string().optional(),
|
|
1495
1495
|
avatarUrl: e.string().optional()
|
|
1496
1496
|
});
|
|
1497
|
-
var
|
|
1497
|
+
var y = e.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits"), O = e.enum(["member", "admin"]), J = e.enum(["active", "suspended"]), ht = e.object({
|
|
1498
1498
|
algo: e.literal("scrypt"),
|
|
1499
1499
|
n: e.number().int().positive(),
|
|
1500
1500
|
r: e.number().int().positive(),
|
|
@@ -1504,31 +1504,31 @@ var f = e.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits"), O =
|
|
|
1504
1504
|
hash: e.string().min(16)
|
|
1505
1505
|
});
|
|
1506
1506
|
e.object({
|
|
1507
|
-
accountId:
|
|
1507
|
+
accountId: y,
|
|
1508
1508
|
/** Lowercased on write, because a login must not depend on how it was typed. */
|
|
1509
1509
|
email: e.string().email().max(254),
|
|
1510
1510
|
name: e.string().min(1).max(64),
|
|
1511
1511
|
role: O,
|
|
1512
1512
|
status: J,
|
|
1513
|
-
password:
|
|
1513
|
+
password: ht,
|
|
1514
1514
|
createdAt: e.number().int().nonnegative(),
|
|
1515
1515
|
lastLoginAt: e.number().int().nonnegative().nullable().default(null),
|
|
1516
1516
|
/** Which admin approved this, or null for the bootstrap account. */
|
|
1517
|
-
invitedBy:
|
|
1517
|
+
invitedBy: y.nullable().default(null)
|
|
1518
1518
|
});
|
|
1519
1519
|
var L = 40;
|
|
1520
1520
|
e.string().transform((a) => a.trim().replace(/\s+/g, " ")).pipe(
|
|
1521
1521
|
e.string().min(1, "Give a name.").max(L, `At most ${L} characters.`).refine((a) => !/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/.test(a), "Letters, numbers, spaces and punctuation only.")
|
|
1522
1522
|
);
|
|
1523
1523
|
e.object({
|
|
1524
|
-
accountId:
|
|
1524
|
+
accountId: y,
|
|
1525
1525
|
email: e.string().email(),
|
|
1526
1526
|
name: e.string(),
|
|
1527
1527
|
role: O,
|
|
1528
1528
|
status: J
|
|
1529
1529
|
});
|
|
1530
1530
|
e.object({
|
|
1531
|
-
accountId:
|
|
1531
|
+
accountId: y,
|
|
1532
1532
|
createdAt: e.number().int().nonnegative(),
|
|
1533
1533
|
expiresAt: e.number().int().nonnegative(),
|
|
1534
1534
|
lastSeenAt: e.number().int().nonnegative()
|
|
@@ -1538,7 +1538,7 @@ e.object({
|
|
|
1538
1538
|
role: O,
|
|
1539
1539
|
createdAt: e.number().int().nonnegative(),
|
|
1540
1540
|
expiresAt: e.number().int().nonnegative(),
|
|
1541
|
-
invitedBy:
|
|
1541
|
+
invitedBy: y
|
|
1542
1542
|
});
|
|
1543
1543
|
e.object({
|
|
1544
1544
|
email: e.string().email().max(254),
|
|
@@ -1546,21 +1546,21 @@ e.object({
|
|
|
1546
1546
|
/** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
|
|
1547
1547
|
reason: e.string().max(500).optional()
|
|
1548
1548
|
});
|
|
1549
|
-
var
|
|
1549
|
+
var xt = e.enum(["pending", "approved", "denied"]);
|
|
1550
1550
|
e.object({
|
|
1551
1551
|
requestId: e.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
|
|
1552
1552
|
email: e.string().email().max(254),
|
|
1553
1553
|
name: e.string().min(1).max(64),
|
|
1554
1554
|
reason: e.string().max(500).optional(),
|
|
1555
|
-
status:
|
|
1555
|
+
status: xt,
|
|
1556
1556
|
createdAt: e.number().int().nonnegative(),
|
|
1557
1557
|
decidedAt: e.number().int().nonnegative().nullable().default(null),
|
|
1558
|
-
decidedBy:
|
|
1558
|
+
decidedBy: y.nullable().default(null)
|
|
1559
1559
|
});
|
|
1560
|
-
var
|
|
1560
|
+
var gt = ["boards:read", "boards:send"], Q = e.enum(gt), bt = [7, 30, 90, 365], ft = e.object({
|
|
1561
1561
|
/** The first 12 hex digits of the hash: what the owner sees and revokes by. */
|
|
1562
1562
|
tokenId: e.string().regex(/^[0-9a-f]{12}$/),
|
|
1563
|
-
accountId:
|
|
1563
|
+
accountId: y,
|
|
1564
1564
|
/** What the owner called it: "laptop", "Claude Code". */
|
|
1565
1565
|
name: e.string().trim().min(1).max(60),
|
|
1566
1566
|
scopes: e.array(Q).min(1),
|
|
@@ -1569,46 +1569,59 @@ var xt = ["boards:read", "boards:send"], Q = e.enum(xt), gt = [7, 30, 90, 365],
|
|
|
1569
1569
|
/** Moved forward at most once a day, so using a token is not a write per request. */
|
|
1570
1570
|
lastUsedAt: e.number().int().nonnegative().nullable().default(null)
|
|
1571
1571
|
});
|
|
1572
|
-
|
|
1572
|
+
ft.omit({ accountId: !0 });
|
|
1573
1573
|
e.object({
|
|
1574
1574
|
name: e.string().trim().min(1, "Give it a name.").max(60),
|
|
1575
1575
|
scopes: e.array(Q).min(1, "Choose at least one thing it can do."),
|
|
1576
|
-
days: e.union(
|
|
1576
|
+
days: e.union(bt.map((a) => e.literal(a)))
|
|
1577
|
+
});
|
|
1578
|
+
const vt = Date.UTC(2024, 0, 1), yt = 24 * 60 * 60 * 1e3, Lt = (a, i, h) => i.map((m) => {
|
|
1579
|
+
const b = m.at !== void 0 && m.at >= vt && m.at <= h + yt ? m.at : h;
|
|
1580
|
+
return {
|
|
1581
|
+
id: `${a}:${m.key}`,
|
|
1582
|
+
source: "http",
|
|
1583
|
+
domain: xe.ENVIRONMENT,
|
|
1584
|
+
key: m.key,
|
|
1585
|
+
value: m.value,
|
|
1586
|
+
...m.unit ? { unit: m.unit } : {},
|
|
1587
|
+
timestamp: b
|
|
1588
|
+
};
|
|
1577
1589
|
});
|
|
1578
1590
|
export {
|
|
1579
|
-
|
|
1591
|
+
Nt as A,
|
|
1580
1592
|
ue as B,
|
|
1581
|
-
|
|
1593
|
+
tt as D,
|
|
1582
1594
|
ie as E,
|
|
1583
1595
|
ae as F,
|
|
1584
|
-
|
|
1596
|
+
Ct as I,
|
|
1585
1597
|
me as P,
|
|
1586
1598
|
ne as R,
|
|
1587
|
-
|
|
1599
|
+
he as S,
|
|
1588
1600
|
re as T,
|
|
1589
1601
|
le as W,
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1602
|
+
I as a,
|
|
1603
|
+
Pt as b,
|
|
1604
|
+
$t as c,
|
|
1605
|
+
Lt as d,
|
|
1606
|
+
W as e,
|
|
1595
1607
|
se as f,
|
|
1596
1608
|
ce as g,
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1609
|
+
At as h,
|
|
1610
|
+
xe as i,
|
|
1611
|
+
Mt as j,
|
|
1612
|
+
$ as k,
|
|
1613
|
+
St as l,
|
|
1614
|
+
F as m,
|
|
1615
|
+
zt as n,
|
|
1616
|
+
It as o,
|
|
1617
|
+
Ft as p,
|
|
1606
1618
|
Bt as q,
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1619
|
+
kt as r,
|
|
1620
|
+
Rt as s,
|
|
1621
|
+
_t as t,
|
|
1622
|
+
Tt as u,
|
|
1611
1623
|
jt as v,
|
|
1612
|
-
|
|
1613
|
-
|
|
1624
|
+
Dt as w,
|
|
1625
|
+
Ot as x,
|
|
1626
|
+
Et as y
|
|
1614
1627
|
};
|