@ramme-io/kernel 8.0.0 → 8.1.1
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-CuGCK-V3.js} +1 -1
- package/dist/{bodewellAdapter-Cw9brU9k.js → bodewellAdapter-IfhLfL_l.js} +1 -1
- package/dist/{index-BrFe7_2L.js → deviceReadings-CGuQi8A9.js} +259 -243
- 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 +4 -4
- 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 je = 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
|
-
]),
|
|
335
|
+
]), Ie = 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([je, Ie]), 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),
|
|
@@ -398,11 +398,11 @@ var ke = e.enum([
|
|
|
398
398
|
]), I = 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
403
|
of: e.tuple([I, I]),
|
|
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,7 +410,7 @@ 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
415
|
value: I,
|
|
416
416
|
op: e.enum(["<", "<=", ">", ">=", "==", "!="]),
|
|
@@ -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, jt = {
|
|
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
|
+
}, It = 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,23 @@ e.object({
|
|
|
967
967
|
light: z,
|
|
968
968
|
dark: z,
|
|
969
969
|
lettering: Y,
|
|
970
|
-
radius: e.enum(
|
|
970
|
+
radius: e.enum(Je)
|
|
971
|
+
});
|
|
972
|
+
e.object({
|
|
973
|
+
text: e.string().max(2e3)
|
|
971
974
|
});
|
|
972
|
-
var
|
|
975
|
+
var Qe = e.string().regex(/^[0-9a-f]{42}$/), et = e.union([e.literal("auto"), Y]);
|
|
973
976
|
e.object({
|
|
974
977
|
revision: e.number().int().nonnegative(),
|
|
975
978
|
sentAt: e.number().int().nonnegative().optional(),
|
|
976
979
|
document: W.optional(),
|
|
977
|
-
shelf:
|
|
978
|
-
update:
|
|
980
|
+
shelf: Xe.optional(),
|
|
981
|
+
update: Ye.optional(),
|
|
979
982
|
screen: e.object({ invert: e.boolean() }).optional(),
|
|
980
|
-
palette:
|
|
981
|
-
font:
|
|
983
|
+
palette: Qe.optional(),
|
|
984
|
+
font: et.optional()
|
|
982
985
|
});
|
|
983
|
-
var
|
|
986
|
+
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
987
|
e.object({
|
|
985
988
|
deviceId: e.string().min(1, "Device ID is required"),
|
|
986
989
|
timeRange: e.enum(["1h", "24h", "7d"], {
|
|
@@ -990,17 +993,17 @@ e.object({
|
|
|
990
993
|
e.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
|
|
991
994
|
).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
|
|
992
995
|
});
|
|
993
|
-
var j = "gemini-2.5-flash",
|
|
996
|
+
var j = "gemini-2.5-flash", tt = "gemini-2.5-flash", at = "gemini-2.5-pro", Mt = {
|
|
994
997
|
"google-gemini": "gemini-2.5-flash",
|
|
995
998
|
openai: "gpt-4o-mini",
|
|
996
999
|
anthropic: "claude-haiku-4-5-20251001",
|
|
997
1000
|
grok: "grok-2-1212",
|
|
998
1001
|
deepseek: "deepseek-chat",
|
|
999
1002
|
ollama: "llama3.3"
|
|
1000
|
-
},
|
|
1003
|
+
}, Nt = {
|
|
1001
1004
|
/** The Strategist: high creativity, exploratory conversation */
|
|
1002
1005
|
STRATEGIST: {
|
|
1003
|
-
model:
|
|
1006
|
+
model: tt,
|
|
1004
1007
|
provider: "google-gemini",
|
|
1005
1008
|
temperature: 0.7
|
|
1006
1009
|
},
|
|
@@ -1020,7 +1023,7 @@ var j = "gemini-2.5-flash", et = "gemini-2.5-flash", tt = "gemini-2.5-pro", Rt =
|
|
|
1020
1023
|
* Uses the Pro tier for superior reasoning on complex structured tasks.
|
|
1021
1024
|
*/
|
|
1022
1025
|
REVIEWER: {
|
|
1023
|
-
model:
|
|
1026
|
+
model: at,
|
|
1024
1027
|
provider: "google-gemini",
|
|
1025
1028
|
temperature: 0.2
|
|
1026
1029
|
},
|
|
@@ -1030,7 +1033,7 @@ var j = "gemini-2.5-flash", et = "gemini-2.5-flash", tt = "gemini-2.5-pro", Rt =
|
|
|
1030
1033
|
provider: "google-gemini",
|
|
1031
1034
|
temperature: 0.2
|
|
1032
1035
|
}
|
|
1033
|
-
},
|
|
1036
|
+
}, Pt = `
|
|
1034
1037
|
You write tiny apps for a small desk device whose screen is 320 pixels wide and
|
|
1035
1038
|
240 pixels high — landscape.
|
|
1036
1039
|
|
|
@@ -1193,10 +1196,10 @@ RULES
|
|
|
1193
1196
|
closest thing it can and do not invent a component.
|
|
1194
1197
|
6. Prefer a rule over a fixed colour whenever the request ties appearance to a
|
|
1195
1198
|
value. "Red when cold" is a rule; "red" is not.
|
|
1196
|
-
`.trim(),
|
|
1199
|
+
`.trim(), $t = "Here is the current app. Change only what is asked:", o = e.string().regex(
|
|
1197
1200
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
1198
1201
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
1199
|
-
),
|
|
1202
|
+
), nt = e.object({
|
|
1200
1203
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
1201
1204
|
"--app-primary-color": o.optional(),
|
|
1202
1205
|
"--app-primary-foreground-color": o.optional(),
|
|
@@ -1227,7 +1230,7 @@ RULES
|
|
|
1227
1230
|
"--app-chart-3": o.optional(),
|
|
1228
1231
|
"--app-chart-4": o.optional(),
|
|
1229
1232
|
"--app-chart-5": o.optional()
|
|
1230
|
-
}).strict(),
|
|
1233
|
+
}).strict(), ot = e.object({
|
|
1231
1234
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
1232
1235
|
heading: e.string(),
|
|
1233
1236
|
/** Google Font name for body text. Example: "Inter" */
|
|
@@ -1241,13 +1244,13 @@ e.object({
|
|
|
1241
1244
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
1242
1245
|
description: e.string(),
|
|
1243
1246
|
/** Google Font pairing for heading and body text. */
|
|
1244
|
-
fonts:
|
|
1247
|
+
fonts: ot.optional(),
|
|
1245
1248
|
/**
|
|
1246
1249
|
* CSS variable overrides.
|
|
1247
1250
|
* Every key must match an --app-* variable name.
|
|
1248
1251
|
* All color values must be space-separated RGB integers.
|
|
1249
1252
|
*/
|
|
1250
|
-
cssVars:
|
|
1253
|
+
cssVars: nt
|
|
1251
1254
|
});
|
|
1252
1255
|
e.object({
|
|
1253
1256
|
primary: o,
|
|
@@ -1257,105 +1260,105 @@ e.object({
|
|
|
1257
1260
|
destructive: o,
|
|
1258
1261
|
radius: e.enum(["none", "sm", "md", "lg", "full"])
|
|
1259
1262
|
});
|
|
1260
|
-
var
|
|
1263
|
+
var zt = {
|
|
1261
1264
|
primary: "13 110 253",
|
|
1262
1265
|
neutral: "24 24 27",
|
|
1263
1266
|
success: "34 197 94",
|
|
1264
1267
|
warning: "234 179 8",
|
|
1265
1268
|
destructive: "239 68 68",
|
|
1266
1269
|
radius: "md"
|
|
1267
|
-
},
|
|
1270
|
+
}, p = e.number().finite(), r = p.positive(), g = p.nonnegative(), it = e.object({
|
|
1268
1271
|
name: e.string().min(1).default("Bambu Lab X1 Carbon"),
|
|
1269
1272
|
/** Walls are whole multiples of this. */
|
|
1270
|
-
nozzle:
|
|
1273
|
+
nozzle: r.default(0.4),
|
|
1271
1274
|
/** Gap for parts that slide together: the case's lip, a lid. */
|
|
1272
|
-
clearance_slip:
|
|
1275
|
+
clearance_slip: g.default(0.2),
|
|
1273
1276
|
/** Gap for a friction fit. */
|
|
1274
|
-
clearance_press:
|
|
1275
|
-
}),
|
|
1277
|
+
clearance_press: g.default(0.1)
|
|
1278
|
+
}), rt = e.enum(["east", "west", "north", "south", "top", "bottom"]), st = e.object({
|
|
1276
1279
|
/** The tongue's length, from its free end to where it joins the floor. */
|
|
1277
|
-
length:
|
|
1280
|
+
length: r.default(12),
|
|
1278
1281
|
/** Its width. */
|
|
1279
|
-
width:
|
|
1282
|
+
width: r.default(5),
|
|
1280
1283
|
/** The way from the switch to where the tongue joins the floor. */
|
|
1281
1284
|
hinge: e.enum(["east", "west", "north", "south"])
|
|
1282
|
-
}),
|
|
1285
|
+
}), lt = e.object({
|
|
1283
1286
|
/** usb_c, screen, reset_button, status_led, sd_card… */
|
|
1284
1287
|
name: e.string().min(1),
|
|
1285
|
-
edge:
|
|
1288
|
+
edge: rt,
|
|
1286
1289
|
/** From the centre of that face — see COORDINATES above. */
|
|
1287
|
-
offset_from_center: e.tuple([
|
|
1290
|
+
offset_from_center: e.tuple([p, p]).default([0, 0]),
|
|
1288
1291
|
/**
|
|
1289
1292
|
* A grille is a field of small round holes filling an ellipse of
|
|
1290
1293
|
* `cutout_size` — a speaker's — on a top or bottom face only.
|
|
1291
1294
|
*/
|
|
1292
1295
|
cutout_shape: e.enum(["rect", "rounded_rect", "circle", "grille"]),
|
|
1293
1296
|
/** [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([
|
|
1297
|
+
cutout_size: e.tuple([r, r]),
|
|
1295
1298
|
/** How far the part sticks out past the component's edge. */
|
|
1296
|
-
protrusion:
|
|
1299
|
+
protrusion: g.default(0),
|
|
1297
1300
|
/** A wider recess on the outside face, [width, height, depth], for a thick cable boot. */
|
|
1298
|
-
outer_recess: e.tuple([
|
|
1301
|
+
outer_recess: e.tuple([r, r, r]).optional(),
|
|
1299
1302
|
/** Press it through the floor instead of opening a hole — see FlexButtonSchema. */
|
|
1300
|
-
flex_button:
|
|
1303
|
+
flex_button: st.optional(),
|
|
1301
1304
|
/**
|
|
1302
1305
|
* A 45° ramp this deep round the opening at the outside face, widening it
|
|
1303
1306
|
* by this much a side there. For a screen set back behind a bezel: the
|
|
1304
1307
|
* picture's edges stay in view and a fingertip reaches them. Top or bottom
|
|
1305
1308
|
* openings only.
|
|
1306
1309
|
*/
|
|
1307
|
-
chamfer:
|
|
1308
|
-
}),
|
|
1310
|
+
chamfer: g.optional()
|
|
1311
|
+
}), ut = e.object({
|
|
1309
1312
|
/** Four holes, this far in from each corner: [east-west, north-south]. */
|
|
1310
|
-
inset_from_corners: e.tuple([
|
|
1313
|
+
inset_from_corners: e.tuple([r, r]).optional(),
|
|
1311
1314
|
/** Or exactly where they are: [east, north] from the footprint centre. */
|
|
1312
|
-
positions: e.array(e.tuple([
|
|
1315
|
+
positions: e.array(e.tuple([p, p])).min(1).optional(),
|
|
1313
1316
|
thread: e.enum(["M2", "M2.5", "M3"]),
|
|
1314
1317
|
/** 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:
|
|
1318
|
+
insert_od: r.optional(),
|
|
1319
|
+
insert_depth: r.optional()
|
|
1317
1320
|
}).refine((a) => (a.inset_from_corners ? 1 : 0) + (a.positions ? 1 : 0) == 1, {
|
|
1318
1321
|
message: "give either inset_from_corners or positions, not both or neither"
|
|
1319
|
-
}),
|
|
1322
|
+
}), mt = e.object({
|
|
1320
1323
|
relative_to: e.string().min(1),
|
|
1321
1324
|
where: e.enum(["below", "above", "east", "west", "north", "south"]),
|
|
1322
1325
|
/** Space between the two keep-outs. */
|
|
1323
|
-
gap:
|
|
1326
|
+
gap: g.default(1),
|
|
1324
1327
|
/** Moved this far [east, north] from centred on the other, once placed. */
|
|
1325
|
-
offset: e.tuple([
|
|
1328
|
+
offset: e.tuple([p, p]).default([0, 0])
|
|
1326
1329
|
}), X = e.object({
|
|
1327
1330
|
id: e.string().regex(/^[a-z][a-z0-9_]*$/, "lowercase letters, digits and underscores"),
|
|
1328
1331
|
type: e.enum(["pcb", "display", "battery", "speaker", "module"]),
|
|
1329
1332
|
/** [east, north, up] — see COORDINATES. */
|
|
1330
|
-
dimensions: e.tuple([
|
|
1333
|
+
dimensions: e.tuple([r, r, r]),
|
|
1331
1334
|
/**
|
|
1332
1335
|
* Radius of the footprint's corners: most boards are rounded. The case's
|
|
1333
1336
|
* inside corners follow it, so a rounded board gets a rounded tray without
|
|
1334
1337
|
* the tray growing wider. Leave it at 0 for a square one, or when unsure —
|
|
1335
1338
|
* assuming sharper than the part is safe, rounder is not.
|
|
1336
1339
|
*/
|
|
1337
|
-
corner_radius:
|
|
1340
|
+
corner_radius: g.default(0),
|
|
1338
1341
|
/** Height of the tallest part on top (headers, capacitors, a connector), kept clear. */
|
|
1339
|
-
clearance_z_top:
|
|
1342
|
+
clearance_z_top: g.default(0),
|
|
1340
1343
|
/** Height of what is underneath (solder joints, a microSD socket), kept clear. */
|
|
1341
|
-
clearance_z_bottom:
|
|
1344
|
+
clearance_z_bottom: g.default(0),
|
|
1342
1345
|
/** Quarter turns about Z, applied before placement. */
|
|
1343
1346
|
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(
|
|
1347
|
+
placement: mt.optional(),
|
|
1348
|
+
mount_holes: ut.optional(),
|
|
1349
|
+
interfaces: e.array(lt).default([]),
|
|
1347
1350
|
/** How it is held if it has no screw holes. */
|
|
1348
1351
|
retention: e.enum(["none", "cradle_ribs"]).default("none")
|
|
1349
|
-
}),
|
|
1352
|
+
}), ct = e.object({
|
|
1350
1353
|
/** The SVG file, relative to the manifest. Filled paths only; strokes are ignored. */
|
|
1351
1354
|
svg: e.string().min(1),
|
|
1352
1355
|
face: e.enum(["top", "bottom"]).default("bottom"),
|
|
1353
1356
|
/** Height of the mark on the face, along north. Its width follows the SVG's proportions. */
|
|
1354
|
-
height:
|
|
1357
|
+
height: r,
|
|
1355
1358
|
/** How deep it is pressed in. */
|
|
1356
|
-
depth:
|
|
1359
|
+
depth: r.default(0.6),
|
|
1357
1360
|
/** From the centre of the case's footprint, [east, north]. */
|
|
1358
|
-
offset: e.tuple([
|
|
1361
|
+
offset: e.tuple([p, p]).default([0, 0]),
|
|
1359
1362
|
/**
|
|
1360
1363
|
* Cut it right through the face instead, as a stencil — a speaker's grille
|
|
1361
1364
|
* in the shape of the mark. Whatever its lines enclose would fall out, so
|
|
@@ -1366,14 +1369,14 @@ var Nt = {
|
|
|
1366
1369
|
* check, by where it is.
|
|
1367
1370
|
*/
|
|
1368
1371
|
stencil: e.object({
|
|
1369
|
-
bridges: e.array(e.object({ at: e.tuple([
|
|
1372
|
+
bridges: e.array(e.object({ at: e.tuple([p, p]), angle: e.number().default(0), length: r.default(3) })).default([])
|
|
1370
1373
|
}).optional()
|
|
1371
1374
|
});
|
|
1372
1375
|
e.object({
|
|
1373
1376
|
project: e.string().regex(/^[a-z0-9][a-z0-9_-]*$/, "lowercase, digits, - and _"),
|
|
1374
1377
|
/** How the case goes together — see TWO STYLES above. */
|
|
1375
1378
|
enclosure_style: e.enum(["split_shell_lip", "tray_bezel"]).default("split_shell_lip"),
|
|
1376
|
-
wall_thickness:
|
|
1379
|
+
wall_thickness: r.default(2.4),
|
|
1377
1380
|
/**
|
|
1378
1381
|
* Thicker walls on chosen sides, in place of `wall_thickness` there. A
|
|
1379
1382
|
* screen whose glass is as wide as its board otherwise gets 2.4mm of frame
|
|
@@ -1381,9 +1384,9 @@ e.object({
|
|
|
1381
1384
|
* black ESP32-S3 board's flush case, 2026-10-25). Each is a whole number
|
|
1382
1385
|
* of nozzle lines, and no thinner than `wall_thickness`.
|
|
1383
1386
|
*/
|
|
1384
|
-
walls: e.object({ east:
|
|
1387
|
+
walls: e.object({ east: r, west: r, north: r, south: r }).partial().default({}),
|
|
1385
1388
|
/** Radius of the vertical outside corners. */
|
|
1386
|
-
corner_radius:
|
|
1389
|
+
corner_radius: g.default(2),
|
|
1387
1390
|
/**
|
|
1388
1391
|
* The outside's front and back edges — where the face meets the sides.
|
|
1389
1392
|
* `chamfer` bevels them flat at 45°, `round` rounds them; `soften` then
|
|
@@ -1392,72 +1395,72 @@ e.object({
|
|
|
1392
1395
|
*/
|
|
1393
1396
|
edges: e.object({
|
|
1394
1397
|
style: e.enum(["chamfer", "round"]),
|
|
1395
|
-
size:
|
|
1396
|
-
soften:
|
|
1398
|
+
size: r,
|
|
1399
|
+
soften: g.default(0)
|
|
1397
1400
|
}).optional(),
|
|
1398
|
-
printer:
|
|
1401
|
+
printer: it.default({}),
|
|
1399
1402
|
components: e.array(X).min(1),
|
|
1400
|
-
emblem:
|
|
1401
|
-
}).superRefine((a,
|
|
1402
|
-
const
|
|
1403
|
-
Math.abs(
|
|
1403
|
+
emblem: ct.optional()
|
|
1404
|
+
}).superRefine((a, i) => {
|
|
1405
|
+
const h = a.wall_thickness / a.printer.nozzle;
|
|
1406
|
+
Math.abs(h - Math.round(h)) > 1e-6 && i.addIssue({
|
|
1404
1407
|
code: e.ZodIssueCode.custom,
|
|
1405
1408
|
path: ["wall_thickness"],
|
|
1406
|
-
message: `${a.wall_thickness}mm is not a whole number of ${a.printer.nozzle}mm lines — try ${(Math.round(
|
|
1409
|
+
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
1410
|
});
|
|
1408
1411
|
for (const [n, t] of Object.entries(a.walls)) {
|
|
1409
1412
|
if (t === void 0) continue;
|
|
1410
|
-
const
|
|
1411
|
-
Math.abs(
|
|
1413
|
+
const s = t / a.printer.nozzle;
|
|
1414
|
+
Math.abs(s - Math.round(s)) > 1e-6 && i.addIssue({
|
|
1412
1415
|
code: e.ZodIssueCode.custom,
|
|
1413
1416
|
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 &&
|
|
1417
|
+
message: `${t}mm is not a whole number of ${a.printer.nozzle}mm lines — try ${(Math.round(s) * a.printer.nozzle).toFixed(2)}`
|
|
1418
|
+
}), t < a.wall_thickness && i.addIssue({
|
|
1416
1419
|
code: e.ZodIssueCode.custom,
|
|
1417
1420
|
path: ["walls", n],
|
|
1418
1421
|
message: `${t}mm is thinner than wall_thickness (${a.wall_thickness}mm): walls only thicken on chosen sides`
|
|
1419
1422
|
});
|
|
1420
1423
|
}
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
+
const m = a.components.map((n) => n.id);
|
|
1425
|
+
m.forEach((n, t) => {
|
|
1426
|
+
m.indexOf(n) !== t && i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "id"], message: `"${n}" is used twice` });
|
|
1424
1427
|
});
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1428
|
+
const b = a.components.filter((n) => !n.placement);
|
|
1429
|
+
b.length !== 1 && i.addIssue({
|
|
1427
1430
|
code: e.ZodIssueCode.custom,
|
|
1428
1431
|
path: ["components"],
|
|
1429
|
-
message: `exactly one component must have no placement (the origin); found ${
|
|
1432
|
+
message: `exactly one component must have no placement (the origin); found ${b.length}: ${b.map((n) => n.id).join(", ") || "none"}`
|
|
1430
1433
|
});
|
|
1431
|
-
const
|
|
1434
|
+
const d = new Map(a.components.map((n) => [n.id, n]));
|
|
1432
1435
|
a.components.forEach((n, t) => {
|
|
1433
1436
|
if (!n.placement) return;
|
|
1434
|
-
const
|
|
1435
|
-
if (!
|
|
1436
|
-
|
|
1437
|
+
const s = n.placement.relative_to;
|
|
1438
|
+
if (!d.has(s)) {
|
|
1439
|
+
i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "placement", "relative_to"], message: `no component "${s}"` });
|
|
1437
1440
|
return;
|
|
1438
1441
|
}
|
|
1439
1442
|
const l = /* @__PURE__ */ new Set([n.id]);
|
|
1440
|
-
for (let u =
|
|
1443
|
+
for (let u = d.get(s); u != null && u.placement; u = d.get(u.placement.relative_to)) {
|
|
1441
1444
|
if (l.has(u.id)) {
|
|
1442
|
-
|
|
1445
|
+
i.addIssue({ code: e.ZodIssueCode.custom, path: ["components", t, "placement"], message: `placement loops back to "${u.id}"` });
|
|
1443
1446
|
return;
|
|
1444
1447
|
}
|
|
1445
1448
|
l.add(u.id);
|
|
1446
1449
|
}
|
|
1447
1450
|
}), 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
|
-
|
|
1451
|
+
var M, N, P;
|
|
1452
|
+
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) => {
|
|
1453
|
+
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
1454
|
});
|
|
1452
|
-
const [
|
|
1453
|
-
(
|
|
1454
|
-
(Math.abs(
|
|
1455
|
+
const [s, l] = n.dimensions;
|
|
1456
|
+
(N = (M = n.mount_holes) == null ? void 0 : M.positions) == null || N.forEach((c, A) => {
|
|
1457
|
+
(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
1458
|
});
|
|
1456
|
-
const u = (
|
|
1457
|
-
u && (u[0] * 2 >=
|
|
1459
|
+
const u = (P = n.mount_holes) == null ? void 0 : P.inset_from_corners;
|
|
1460
|
+
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
1461
|
});
|
|
1459
1462
|
});
|
|
1460
|
-
var
|
|
1463
|
+
var dt = e.object({
|
|
1461
1464
|
label: e.string().min(1),
|
|
1462
1465
|
/** One sentence: what it is for. */
|
|
1463
1466
|
description: e.string().optional(),
|
|
@@ -1472,16 +1475,16 @@ var ct = e.object({
|
|
|
1472
1475
|
* clearance and widens its screen opening to the glass.
|
|
1473
1476
|
*/
|
|
1474
1477
|
patch: e.record(e.record(e.unknown())).default({})
|
|
1475
|
-
}),
|
|
1478
|
+
}), pt = e.object({
|
|
1476
1479
|
label: e.string().min(1),
|
|
1477
1480
|
/** In order; the first is the default. Ids are lowercase words and dashes. */
|
|
1478
|
-
choices: e.array(
|
|
1481
|
+
choices: e.array(dt.extend({ id: e.string().regex(/^[a-z0-9][a-z0-9-]*$/) })).min(1)
|
|
1479
1482
|
});
|
|
1480
1483
|
e.object({
|
|
1481
1484
|
/** The base manifest, relative to this file. */
|
|
1482
1485
|
manifest: e.string().min(1),
|
|
1483
1486
|
/** Option groups, in the order they are offered: base, top… */
|
|
1484
|
-
options: e.record(e.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
1487
|
+
options: e.record(e.string().regex(/^[a-z][a-z0-9-]*$/), pt)
|
|
1485
1488
|
});
|
|
1486
1489
|
e.object({
|
|
1487
1490
|
id: e.string().default(""),
|
|
@@ -1494,7 +1497,7 @@ e.object({
|
|
|
1494
1497
|
lastActive: e.string().optional(),
|
|
1495
1498
|
avatarUrl: e.string().optional()
|
|
1496
1499
|
});
|
|
1497
|
-
var
|
|
1500
|
+
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
1501
|
algo: e.literal("scrypt"),
|
|
1499
1502
|
n: e.number().int().positive(),
|
|
1500
1503
|
r: e.number().int().positive(),
|
|
@@ -1504,31 +1507,31 @@ var f = e.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits"), O =
|
|
|
1504
1507
|
hash: e.string().min(16)
|
|
1505
1508
|
});
|
|
1506
1509
|
e.object({
|
|
1507
|
-
accountId:
|
|
1510
|
+
accountId: y,
|
|
1508
1511
|
/** Lowercased on write, because a login must not depend on how it was typed. */
|
|
1509
1512
|
email: e.string().email().max(254),
|
|
1510
1513
|
name: e.string().min(1).max(64),
|
|
1511
1514
|
role: O,
|
|
1512
1515
|
status: J,
|
|
1513
|
-
password:
|
|
1516
|
+
password: ht,
|
|
1514
1517
|
createdAt: e.number().int().nonnegative(),
|
|
1515
1518
|
lastLoginAt: e.number().int().nonnegative().nullable().default(null),
|
|
1516
1519
|
/** Which admin approved this, or null for the bootstrap account. */
|
|
1517
|
-
invitedBy:
|
|
1520
|
+
invitedBy: y.nullable().default(null)
|
|
1518
1521
|
});
|
|
1519
1522
|
var L = 40;
|
|
1520
1523
|
e.string().transform((a) => a.trim().replace(/\s+/g, " ")).pipe(
|
|
1521
1524
|
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
1525
|
);
|
|
1523
1526
|
e.object({
|
|
1524
|
-
accountId:
|
|
1527
|
+
accountId: y,
|
|
1525
1528
|
email: e.string().email(),
|
|
1526
1529
|
name: e.string(),
|
|
1527
1530
|
role: O,
|
|
1528
1531
|
status: J
|
|
1529
1532
|
});
|
|
1530
1533
|
e.object({
|
|
1531
|
-
accountId:
|
|
1534
|
+
accountId: y,
|
|
1532
1535
|
createdAt: e.number().int().nonnegative(),
|
|
1533
1536
|
expiresAt: e.number().int().nonnegative(),
|
|
1534
1537
|
lastSeenAt: e.number().int().nonnegative()
|
|
@@ -1538,7 +1541,7 @@ e.object({
|
|
|
1538
1541
|
role: O,
|
|
1539
1542
|
createdAt: e.number().int().nonnegative(),
|
|
1540
1543
|
expiresAt: e.number().int().nonnegative(),
|
|
1541
|
-
invitedBy:
|
|
1544
|
+
invitedBy: y
|
|
1542
1545
|
});
|
|
1543
1546
|
e.object({
|
|
1544
1547
|
email: e.string().email().max(254),
|
|
@@ -1546,21 +1549,21 @@ e.object({
|
|
|
1546
1549
|
/** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
|
|
1547
1550
|
reason: e.string().max(500).optional()
|
|
1548
1551
|
});
|
|
1549
|
-
var
|
|
1552
|
+
var xt = e.enum(["pending", "approved", "denied"]);
|
|
1550
1553
|
e.object({
|
|
1551
1554
|
requestId: e.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
|
|
1552
1555
|
email: e.string().email().max(254),
|
|
1553
1556
|
name: e.string().min(1).max(64),
|
|
1554
1557
|
reason: e.string().max(500).optional(),
|
|
1555
|
-
status:
|
|
1558
|
+
status: xt,
|
|
1556
1559
|
createdAt: e.number().int().nonnegative(),
|
|
1557
1560
|
decidedAt: e.number().int().nonnegative().nullable().default(null),
|
|
1558
|
-
decidedBy:
|
|
1561
|
+
decidedBy: y.nullable().default(null)
|
|
1559
1562
|
});
|
|
1560
|
-
var
|
|
1563
|
+
var gt = ["boards:read", "boards:send"], Q = e.enum(gt), bt = [7, 30, 90, 365], ft = e.object({
|
|
1561
1564
|
/** The first 12 hex digits of the hash: what the owner sees and revokes by. */
|
|
1562
1565
|
tokenId: e.string().regex(/^[0-9a-f]{12}$/),
|
|
1563
|
-
accountId:
|
|
1566
|
+
accountId: y,
|
|
1564
1567
|
/** What the owner called it: "laptop", "Claude Code". */
|
|
1565
1568
|
name: e.string().trim().min(1).max(60),
|
|
1566
1569
|
scopes: e.array(Q).min(1),
|
|
@@ -1569,46 +1572,59 @@ var xt = ["boards:read", "boards:send"], Q = e.enum(xt), gt = [7, 30, 90, 365],
|
|
|
1569
1572
|
/** Moved forward at most once a day, so using a token is not a write per request. */
|
|
1570
1573
|
lastUsedAt: e.number().int().nonnegative().nullable().default(null)
|
|
1571
1574
|
});
|
|
1572
|
-
|
|
1575
|
+
ft.omit({ accountId: !0 });
|
|
1573
1576
|
e.object({
|
|
1574
1577
|
name: e.string().trim().min(1, "Give it a name.").max(60),
|
|
1575
1578
|
scopes: e.array(Q).min(1, "Choose at least one thing it can do."),
|
|
1576
|
-
days: e.union(
|
|
1579
|
+
days: e.union(bt.map((a) => e.literal(a)))
|
|
1580
|
+
});
|
|
1581
|
+
const vt = Date.UTC(2024, 0, 1), yt = 24 * 60 * 60 * 1e3, Lt = (a, i, h) => i.map((m) => {
|
|
1582
|
+
const b = m.at !== void 0 && m.at >= vt && m.at <= h + yt ? m.at : h;
|
|
1583
|
+
return {
|
|
1584
|
+
id: `${a}:${m.key}`,
|
|
1585
|
+
source: "http",
|
|
1586
|
+
domain: xe.ENVIRONMENT,
|
|
1587
|
+
key: m.key,
|
|
1588
|
+
value: m.value,
|
|
1589
|
+
...m.unit ? { unit: m.unit } : {},
|
|
1590
|
+
timestamp: b
|
|
1591
|
+
};
|
|
1577
1592
|
});
|
|
1578
1593
|
export {
|
|
1579
|
-
|
|
1594
|
+
Nt as A,
|
|
1580
1595
|
ue as B,
|
|
1581
|
-
|
|
1596
|
+
tt as D,
|
|
1582
1597
|
ie as E,
|
|
1583
1598
|
ae as F,
|
|
1584
|
-
|
|
1599
|
+
Ct as I,
|
|
1585
1600
|
me as P,
|
|
1586
1601
|
ne as R,
|
|
1587
|
-
|
|
1602
|
+
he as S,
|
|
1588
1603
|
re as T,
|
|
1589
1604
|
le as W,
|
|
1590
1605
|
j as a,
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1606
|
+
Pt as b,
|
|
1607
|
+
$t as c,
|
|
1608
|
+
Lt as d,
|
|
1609
|
+
W as e,
|
|
1595
1610
|
se as f,
|
|
1596
1611
|
ce as g,
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1612
|
+
At as h,
|
|
1613
|
+
xe as i,
|
|
1614
|
+
Mt as j,
|
|
1615
|
+
$ as k,
|
|
1616
|
+
St as l,
|
|
1617
|
+
F as m,
|
|
1618
|
+
zt as n,
|
|
1619
|
+
jt as o,
|
|
1620
|
+
Ft as p,
|
|
1606
1621
|
Bt as q,
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1622
|
+
kt as r,
|
|
1623
|
+
Rt as s,
|
|
1624
|
+
_t as t,
|
|
1625
|
+
Tt as u,
|
|
1626
|
+
It as v,
|
|
1627
|
+
Dt as w,
|
|
1628
|
+
Ot as x,
|
|
1629
|
+
Et as y
|
|
1614
1630
|
};
|