@ramme-io/shared 4.4.0 → 4.6.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/index.cjs +249 -178
- package/dist/index.d.cts +8902 -13
- package/dist/index.d.ts +8902 -13
- package/dist/index.js +239 -178
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -76,9 +76,17 @@ __export(index_exports, {
|
|
|
76
76
|
AppTextSizeSchema: () => AppTextSizeSchema,
|
|
77
77
|
AssetHashSchema: () => AssetHashSchema,
|
|
78
78
|
AuthStrategySchema: () => AuthStrategySchema,
|
|
79
|
+
BOARD_REMOTE_COMMANDS: () => BOARD_REMOTE_COMMANDS,
|
|
80
|
+
BOARD_REMOTE_PENDING_MAX: () => BOARD_REMOTE_PENDING_MAX,
|
|
81
|
+
BOARD_REMOTE_TTL_MS: () => BOARD_REMOTE_TTL_MS,
|
|
82
|
+
BOARD_SLEEP_MINUTES: () => BOARD_SLEEP_MINUTES,
|
|
83
|
+
BOARD_SLEEP_MINUTES_DEFAULT: () => BOARD_SLEEP_MINUTES_DEFAULT,
|
|
79
84
|
BlockSchema: () => BlockSchema,
|
|
80
85
|
BoardFontSchema: () => BoardFontSchema,
|
|
81
86
|
BoardPaletteHexSchema: () => BoardPaletteHexSchema,
|
|
87
|
+
BoardRemoteCommandSchema: () => BoardRemoteCommandSchema,
|
|
88
|
+
BoardRemotePressSchema: () => BoardRemotePressSchema,
|
|
89
|
+
BoardSleepMinutesSchema: () => BoardSleepMinutesSchema,
|
|
82
90
|
Bodewell: () => schema_exports,
|
|
83
91
|
CLAIMED_DEVICE_TTL_SECONDS: () => CLAIMED_DEVICE_TTL_SECONDS,
|
|
84
92
|
CONTROL_STATES: () => CONTROL_STATES,
|
|
@@ -181,6 +189,7 @@ __export(index_exports, {
|
|
|
181
189
|
PublicAccountSchema: () => PublicAccountSchema,
|
|
182
190
|
RETRO_RENDITION: () => RETRO_RENDITION,
|
|
183
191
|
ResourceSchema: () => ResourceSchema,
|
|
192
|
+
SAVED_APPS_MAX: () => SAVED_APPS_MAX,
|
|
184
193
|
SCRYPT_PARAMS: () => SCRYPT_PARAMS,
|
|
185
194
|
SESSION_COOKIE_NAME: () => SESSION_COOKIE_NAME,
|
|
186
195
|
SESSION_TTL_SECONDS: () => SESSION_TTL_SECONDS,
|
|
@@ -198,6 +207,7 @@ __export(index_exports, {
|
|
|
198
207
|
SPRITE_MAX_SIDE: () => SPRITE_MAX_SIDE,
|
|
199
208
|
SPR_FORMAT: () => SPR_FORMAT,
|
|
200
209
|
SPR_MAX_BYTES: () => SPR_MAX_BYTES,
|
|
210
|
+
SavedAppSchema: () => SavedAppSchema,
|
|
201
211
|
ScryptHashSchema: () => ScryptHashSchema,
|
|
202
212
|
SendRequestSchema: () => SendRequestSchema,
|
|
203
213
|
SensorAppConfigSchema: () => SensorAppConfigSchema,
|
|
@@ -1438,6 +1448,26 @@ var ShelfSchema = import_zod10.z.object({
|
|
|
1438
1448
|
*/
|
|
1439
1449
|
added: import_zod10.z.array(import_zod10.z.number().int().nonnegative()).max(SHELF_MAX_APPS).optional()
|
|
1440
1450
|
});
|
|
1451
|
+
var BOARD_SLEEP_MINUTES = [10, 30, 60, 0];
|
|
1452
|
+
var BOARD_SLEEP_MINUTES_DEFAULT = 10;
|
|
1453
|
+
var BoardSleepMinutesSchema = import_zod10.z.union([import_zod10.z.literal(10), import_zod10.z.literal(30), import_zod10.z.literal(60), import_zod10.z.literal(0)]);
|
|
1454
|
+
var BOARD_REMOTE_COMMANDS = [
|
|
1455
|
+
"podcasts",
|
|
1456
|
+
"radio",
|
|
1457
|
+
"music",
|
|
1458
|
+
"snake",
|
|
1459
|
+
"menu",
|
|
1460
|
+
"settings",
|
|
1461
|
+
"home",
|
|
1462
|
+
"next",
|
|
1463
|
+
"quieter",
|
|
1464
|
+
"louder",
|
|
1465
|
+
"sleep"
|
|
1466
|
+
];
|
|
1467
|
+
var BoardRemoteCommandSchema = import_zod10.z.enum(BOARD_REMOTE_COMMANDS);
|
|
1468
|
+
var BOARD_REMOTE_PENDING_MAX = 8;
|
|
1469
|
+
var BOARD_REMOTE_TTL_MS = 10 * 6e4;
|
|
1470
|
+
var BoardRemotePressSchema = import_zod10.z.object({ n: import_zod10.z.number().int().positive(), do: BoardRemoteCommandSchema });
|
|
1441
1471
|
var ShelfEditSchema = import_zod10.z.discriminatedUnion("op", [
|
|
1442
1472
|
import_zod10.z.object({ op: import_zod10.z.literal("show"), deviceId: DeviceIdSchema, index: import_zod10.z.number().int().min(0) }),
|
|
1443
1473
|
import_zod10.z.object({ op: import_zod10.z.literal("remove"), deviceId: DeviceIdSchema, index: import_zod10.z.number().int().min(0) }),
|
|
@@ -1456,6 +1486,14 @@ var ShelfEditSchema = import_zod10.z.discriminatedUnion("op", [
|
|
|
1456
1486
|
* per-board setting rather than a build.
|
|
1457
1487
|
*/
|
|
1458
1488
|
import_zod10.z.object({ op: import_zod10.z.literal("screen"), deviceId: DeviceIdSchema, invert: import_zod10.z.boolean() }),
|
|
1489
|
+
/**
|
|
1490
|
+
* How long the board may be left alone on its battery before it sleeps,
|
|
1491
|
+
* 0 for never. Beside the panel setting, and for the same reason: it is
|
|
1492
|
+
* about one board, not the apps on it.
|
|
1493
|
+
*/
|
|
1494
|
+
import_zod10.z.object({ op: import_zod10.z.literal("sleep"), deviceId: DeviceIdSchema, minutes: BoardSleepMinutesSchema }),
|
|
1495
|
+
/** A press from the page's Remote; see BOARD_REMOTE_COMMANDS. */
|
|
1496
|
+
import_zod10.z.object({ op: import_zod10.z.literal("remote"), deviceId: DeviceIdSchema, do: BoardRemoteCommandSchema }),
|
|
1459
1497
|
/**
|
|
1460
1498
|
* Remove one entry from the list of apps sent to this board, by the revision
|
|
1461
1499
|
* it was sent as. The record only: what the board holds is the shelf's
|
|
@@ -1464,13 +1502,22 @@ var ShelfEditSchema = import_zod10.z.discriminatedUnion("op", [
|
|
|
1464
1502
|
import_zod10.z.object({ op: import_zod10.z.literal("forget"), deviceId: DeviceIdSchema, revision: import_zod10.z.number().int().min(1) })
|
|
1465
1503
|
]);
|
|
1466
1504
|
|
|
1505
|
+
// src/apps/library.ts
|
|
1506
|
+
var import_zod11 = require("zod");
|
|
1507
|
+
var SAVED_APPS_MAX = 100;
|
|
1508
|
+
var SavedAppSchema = import_zod11.z.object({
|
|
1509
|
+
document: AppDocumentSchema,
|
|
1510
|
+
savedAt: import_zod11.z.number().int().nonnegative(),
|
|
1511
|
+
updatedAt: import_zod11.z.number().int().nonnegative()
|
|
1512
|
+
});
|
|
1513
|
+
|
|
1467
1514
|
// src/apps/protocol.ts
|
|
1468
|
-
var
|
|
1515
|
+
var import_zod13 = require("zod");
|
|
1469
1516
|
|
|
1470
1517
|
// src/theme/account.ts
|
|
1471
|
-
var
|
|
1472
|
-
var ThemeRgbSchema =
|
|
1473
|
-
var ThemePaletteSchema =
|
|
1518
|
+
var import_zod12 = require("zod");
|
|
1519
|
+
var ThemeRgbSchema = import_zod12.z.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'Must be "R G B", e.g. "13 110 253"').refine((v) => v.split(" ").every((n) => Number(n) <= 255), "Each channel is 0\u2013255");
|
|
1520
|
+
var ThemePaletteSchema = import_zod12.z.object({
|
|
1474
1521
|
background: ThemeRgbSchema,
|
|
1475
1522
|
/** Text. */
|
|
1476
1523
|
foreground: ThemeRgbSchema,
|
|
@@ -1491,21 +1538,21 @@ var THEME_PALETTE_TOKENS = [
|
|
|
1491
1538
|
"warning",
|
|
1492
1539
|
"danger"
|
|
1493
1540
|
];
|
|
1494
|
-
var ThemeLetteringSchema =
|
|
1541
|
+
var ThemeLetteringSchema = import_zod12.z.enum(["inter", "tay", "pixel"]);
|
|
1495
1542
|
var THEME_RADII = ["0rem", "0.25rem", "0.5rem", "0.75rem", "1rem"];
|
|
1496
|
-
var WebFontFamilySchema =
|
|
1497
|
-
var ThemeWebFontsSchema =
|
|
1543
|
+
var WebFontFamilySchema = import_zod12.z.string().trim().min(1).max(60).regex(/^[A-Za-z0-9 ]+$/);
|
|
1544
|
+
var ThemeWebFontsSchema = import_zod12.z.object({
|
|
1498
1545
|
heading: WebFontFamilySchema.optional(),
|
|
1499
1546
|
body: WebFontFamilySchema.optional()
|
|
1500
1547
|
});
|
|
1501
|
-
var AccountThemeSchema =
|
|
1502
|
-
name:
|
|
1548
|
+
var AccountThemeSchema = import_zod12.z.object({
|
|
1549
|
+
name: import_zod12.z.string().trim().min(1).max(40),
|
|
1503
1550
|
/** The preset it started from, when it started from one. */
|
|
1504
|
-
base:
|
|
1551
|
+
base: import_zod12.z.string().max(40).optional(),
|
|
1505
1552
|
light: ThemePaletteSchema,
|
|
1506
1553
|
dark: ThemePaletteSchema,
|
|
1507
1554
|
lettering: ThemeLetteringSchema,
|
|
1508
|
-
radius:
|
|
1555
|
+
radius: import_zod12.z.enum(THEME_RADII),
|
|
1509
1556
|
fonts: ThemeWebFontsSchema.optional()
|
|
1510
1557
|
});
|
|
1511
1558
|
|
|
@@ -1538,7 +1585,14 @@ var DEVICE_PROTOCOL = {
|
|
|
1538
1585
|
* a local model, ramme.io a metered cloud one. The board sends the same clip
|
|
1539
1586
|
* to either.
|
|
1540
1587
|
*/
|
|
1541
|
-
voice: { method: "POST", path: "/api/device/voice" }
|
|
1588
|
+
voice: { method: "POST", path: "/api/device/voice" },
|
|
1589
|
+
/**
|
|
1590
|
+
* GET `?id=` → 200 `{ shows: [{ t, e: [{ i, t, m }] }] }`: the newest
|
|
1591
|
+
* episodes of each podcast the board follows, `i` naming one and `m` its
|
|
1592
|
+
* minutes. GET `?id=&ep=<i>` → 302 to that episode's MP3, which the board
|
|
1593
|
+
* plays as it plays a station. 404 for an episode it does not follow.
|
|
1594
|
+
*/
|
|
1595
|
+
podcasts: { method: "GET", path: "/api/device/podcasts" }
|
|
1542
1596
|
};
|
|
1543
1597
|
var DEVICE_VOICE_CLIP = {
|
|
1544
1598
|
contentType: "audio/wav",
|
|
@@ -1549,8 +1603,8 @@ var DEVICE_VOICE_CLIP = {
|
|
|
1549
1603
|
/** The 44-byte header plus fifteen seconds of samples. */
|
|
1550
1604
|
maxBytes: 44 + 16e3 * 2 * 15
|
|
1551
1605
|
};
|
|
1552
|
-
var DeviceVoiceReplySchema =
|
|
1553
|
-
text:
|
|
1606
|
+
var DeviceVoiceReplySchema = import_zod13.z.object({
|
|
1607
|
+
text: import_zod13.z.string().max(2e3)
|
|
1554
1608
|
});
|
|
1555
1609
|
var DEVICE_POLL_QUERY = {
|
|
1556
1610
|
id: "the board id (required)",
|
|
@@ -1562,20 +1616,25 @@ var DEVICE_POLL_QUERY = {
|
|
|
1562
1616
|
rot: "which way it stands, 0\u20133",
|
|
1563
1617
|
pl: "the palette it draws in, as 42 hex digits",
|
|
1564
1618
|
fn: "the lettering it draws in",
|
|
1619
|
+
ha: 'the firmware apps it has switched off, ids joined by commas, "-" for none',
|
|
1565
1620
|
bt: "battery millivolts",
|
|
1621
|
+
sl: 'minutes left alone on battery before it sleeps, "0" for never',
|
|
1622
|
+
rc: 'the number of the last press from its page it carried out, "0" for none',
|
|
1566
1623
|
u: "what happened to the last update it was asked to install"
|
|
1567
1624
|
};
|
|
1568
|
-
var BoardPaletteHexSchema =
|
|
1569
|
-
var BoardFontSchema =
|
|
1570
|
-
var DevicePollReplySchema =
|
|
1571
|
-
revision:
|
|
1572
|
-
sentAt:
|
|
1625
|
+
var BoardPaletteHexSchema = import_zod13.z.string().regex(/^[0-9a-f]{42}$/);
|
|
1626
|
+
var BoardFontSchema = import_zod13.z.union([import_zod13.z.literal("auto"), ThemeLetteringSchema]);
|
|
1627
|
+
var DevicePollReplySchema = import_zod13.z.object({
|
|
1628
|
+
revision: import_zod13.z.number().int().nonnegative(),
|
|
1629
|
+
sentAt: import_zod13.z.number().int().nonnegative().optional(),
|
|
1573
1630
|
document: AppDocumentSchema.optional(),
|
|
1574
1631
|
shelf: ShelfSchema.optional(),
|
|
1575
1632
|
update: FirmwareUpdateSchema.optional(),
|
|
1576
|
-
screen:
|
|
1633
|
+
screen: import_zod13.z.object({ invert: import_zod13.z.boolean(), sleepMinutes: BoardSleepMinutesSchema.optional() }).optional(),
|
|
1577
1634
|
palette: BoardPaletteHexSchema.optional(),
|
|
1578
|
-
font: BoardFontSchema.optional()
|
|
1635
|
+
font: BoardFontSchema.optional(),
|
|
1636
|
+
hiddenApps: import_zod13.z.string().regex(/^([a-z]+(,[a-z]+)*)?$/).optional(),
|
|
1637
|
+
remote: import_zod13.z.array(BoardRemotePressSchema).max(BOARD_REMOTE_PENDING_MAX).optional()
|
|
1579
1638
|
});
|
|
1580
1639
|
|
|
1581
1640
|
// src/apps/deviceFonts.generated.ts
|
|
@@ -1583,14 +1642,14 @@ var SMOOTH_FACES = { "inter": { "family": "Inter", "weight": 500, "caps": false
|
|
|
1583
1642
|
var SMOOTH_FONT_ADVANCES = { "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, "\xA0": 3, "\xA1": 3, "\xA2": 6, "\xA3": 6, "\xA5": 6, "\xAA": 5, "\xAB": 6, "\xAC": 7, "\xB0": 5, "\xB1": 7, "\xB2": 4, "\xB5": 6, "\xB7": 3, "\xBA": 5, "\xBB": 6, "\xBC": 8, "\xBD": 9, "\xBF": 5, "\xC4": 7, "\xC5": 7, "\xC6": 10, "\xC7": 7, "\xC9": 6, "\xD1": 8, "\xD6": 8, "\xDC": 7, "\xDF": 6, "\xE0": 6, "\xE1": 6, "\xE2": 6, "\xE4": 6, "\xE5": 6, "\xE6": 9, "\xE7": 6, "\xE8": 6, "\xE9": 6, "\xEA": 6, "\xEB": 6, "\xEC": 3, "\xED": 3, "\xEE": 3, "\xEF": 3, "\xF1": 6, "\xF2": 6, "\xF3": 6, "\xF4": 6, "\xF6": 6, "\xF7": 7, "\xF9": 6, "\xFA": 6, "\xFB": 6, "\xFC": 6, "\xFF": 6, "\u0192": 5, "\u03A9": 8, "\u03C0": 5, "\u2013": 5, "\u2014": 10, "\u2018": 3, "\u2019": 3, "\u201C": 5, "\u201D": 5, "\u2212": 7, "\u221A": 5, "\u221E": 7, "\u2248": 5, "\u2264": 5, "\u2265": 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, "\xA0": 3, "\xA1": 4, "\xA2": 7, "\xA3": 7, "\xA5": 7, "\xAA": 5, "\xAB": 7, "\xAC": 8, "\xB0": 5, "\xB1": 8, "\xB2": 5, "\xB5": 7, "\xB7": 4, "\xBA": 6, "\xBB": 7, "\xBC": 10, "\xBD": 10, "\xBF": 6, "\xC4": 9, "\xC5": 9, "\xC6": 12, "\xC7": 9, "\xC9": 7, "\xD1": 9, "\xD6": 9, "\xDC": 9, "\xDF": 8, "\xE0": 7, "\xE1": 7, "\xE2": 7, "\xE4": 7, "\xE5": 7, "\xE6": 11, "\xE7": 7, "\xE8": 7, "\xE9": 7, "\xEA": 7, "\xEB": 7, "\xEC": 3, "\xED": 3, "\xEE": 3, "\xEF": 3, "\xF1": 7, "\xF2": 7, "\xF3": 7, "\xF4": 7, "\xF6": 7, "\xF7": 8, "\xF9": 7, "\xFA": 7, "\xFB": 7, "\xFC": 7, "\xFF": 7, "\u0192": 6, "\u03A9": 9, "\u03C0": 7, "\u2013": 6, "\u2014": 12, "\u2018": 3, "\u2019": 3, "\u201C": 6, "\u201D": 6, "\u2212": 8, "\u221A": 7, "\u221E": 9, "\u2248": 7, "\u2264": 7, "\u2265": 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, "\xA0": 4, "\xA1": 5, "\xA2": 9, "\xA3": 10, "\xA5": 9, "\xAA": 7, "\xAB": 10, "\xAC": 11, "\xB0": 7, "\xB1": 11, "\xB2": 7, "\xB5": 10, "\xB7": 5, "\xBA": 8, "\xBB": 10, "\xBC": 13, "\xBD": 14, "\xBF": 8, "\xC4": 11, "\xC5": 11, "\xC6": 16, "\xC7": 12, "\xC9": 10, "\xD1": 12, "\xD6": 12, "\xDC": 12, "\xDF": 10, "\xE0": 9, "\xE1": 9, "\xE2": 9, "\xE4": 9, "\xE5": 9, "\xE6": 15, "\xE7": 9, "\xE8": 9, "\xE9": 9, "\xEA": 9, "\xEB": 9, "\xEC": 4, "\xED": 4, "\xEE": 4, "\xEF": 4, "\xF1": 10, "\xF2": 10, "\xF3": 10, "\xF4": 10, "\xF6": 10, "\xF7": 11, "\xF9": 10, "\xFA": 10, "\xFB": 10, "\xFC": 10, "\xFF": 9, "\u0192": 8, "\u03A9": 12, "\u03C0": 9, "\u2013": 8, "\u2014": 16, "\u2018": 4, "\u2019": 4, "\u201C": 8, "\u201D": 8, "\u2212": 11, "\u221A": 9, "\u221E": 11, "\u2248": 9, "\u2264": 9, "\u2265": 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, "\xA0": 5, "\xA1": 6, "\xA2": 12, "\xA3": 12, "\xA5": 11, "\xAA": 9, "\xAB": 12, "\xAC": 13, "\xB0": 9, "\xB1": 13, "\xB2": 9, "\xB5": 12, "\xB7": 6, "\xBA": 10, "\xBB": 12, "\xBC": 16, "\xBD": 17, "\xBF": 11, "\xC4": 14, "\xC5": 14, "\xC6": 20, "\xC7": 15, "\xC9": 12, "\xD1": 15, "\xD6": 15, "\xDC": 15, "\xDF": 13, "\xE0": 11, "\xE1": 11, "\xE2": 11, "\xE4": 11, "\xE5": 11, "\xE6": 18, "\xE7": 12, "\xE8": 12, "\xE9": 12, "\xEA": 12, "\xEB": 12, "\xEC": 5, "\xED": 5, "\xEE": 5, "\xEF": 5, "\xF1": 12, "\xF2": 12, "\xF3": 12, "\xF4": 12, "\xF6": 12, "\xF7": 13, "\xF9": 12, "\xFA": 12, "\xFB": 12, "\xFC": 12, "\xFF": 12, "\u0192": 10, "\u03A9": 15, "\u03C0": 11, "\u2013": 10, "\u2014": 20, "\u2018": 6, "\u2019": 6, "\u201C": 9, "\u201D": 9, "\u2212": 13, "\u221A": 11, "\u221E": 14, "\u2248": 11, "\u2264": 11, "\u2265": 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, "\xA0": 7, "\xA1": 9, "\xA2": 16, "\xA3": 17, "\xA5": 16, "\xAA": 13, "\xAB": 17, "\xAC": 19, "\xB0": 13, "\xB1": 19, "\xB2": 13, "\xB5": 17, "\xB7": 8, "\xBA": 14, "\xBB": 17, "\xBC": 23, "\xBD": 24, "\xBF": 15, "\xC4": 20, "\xC5": 20, "\xC6": 28, "\xC7": 21, "\xC9": 17, "\xD1": 21, "\xD6": 21, "\xDC": 21, "\xDF": 18, "\xE0": 16, "\xE1": 16, "\xE2": 16, "\xE4": 16, "\xE5": 16, "\xE6": 26, "\xE7": 16, "\xE8": 16, "\xE9": 16, "\xEA": 16, "\xEB": 16, "\xEC": 7, "\xED": 7, "\xEE": 7, "\xEF": 7, "\xF1": 17, "\xF2": 17, "\xF3": 17, "\xF4": 17, "\xF6": 17, "\xF7": 19, "\xF9": 17, "\xFA": 17, "\xFB": 17, "\xFC": 17, "\xFF": 16, "\u0192": 14, "\u03A9": 22, "\u03C0": 15, "\u2013": 14, "\u2014": 28, "\u2018": 8, "\u2019": 8, "\u201C": 13, "\u201D": 13, "\u2212": 19, "\u221A": 15, "\u221E": 20, "\u2248": 15, "\u2264": 15, "\u2265": 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, "\xB0": 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, "\xA0": 8, "\xA1": 15, "\xA2": 14, "\xA3": 26, "\xA5": 31, "\xAA": 8, "\xAB": 14, "\xAC": 16, "\xB0": 14, "\xB1": 15, "\xB2": 8, "\xB7": 7, "\xBA": 9, "\xBB": 14, "\xBC": 21, "\xBD": 21, "\xBF": 26, "\xC4": 28, "\xC5": 28, "\xC6": 25, "\xC7": 28, "\xC9": 30, "\xD1": 32, "\xD6": 29, "\xDC": 29, "\xF7": 15, "\u03A9": 22, "\u2013": 14, "\u2014": 28, "\u2018": 9, "\u2019": 9, "\u201C": 12, "\u201D": 12, "\u2212": 16, "\u221A": 15, "\u221E": 20, "\u2248": 15, "\u2264": 15, "\u2265": 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, "\xB0": 27 } } };
|
|
1584
1643
|
|
|
1585
1644
|
// src/ai/tools.ts
|
|
1586
|
-
var
|
|
1587
|
-
var telemetryGraphParameters =
|
|
1588
|
-
deviceId:
|
|
1589
|
-
timeRange:
|
|
1645
|
+
var import_zod14 = require("zod");
|
|
1646
|
+
var telemetryGraphParameters = import_zod14.z.object({
|
|
1647
|
+
deviceId: import_zod14.z.string().min(1, "Device ID is required"),
|
|
1648
|
+
timeRange: import_zod14.z.enum(["1h", "24h", "7d"], {
|
|
1590
1649
|
errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
|
|
1591
1650
|
}),
|
|
1592
|
-
metrics:
|
|
1593
|
-
|
|
1651
|
+
metrics: import_zod14.z.array(
|
|
1652
|
+
import_zod14.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
|
|
1594
1653
|
).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
|
|
1595
1654
|
});
|
|
1596
1655
|
var AI_TOOLS = {
|
|
@@ -1967,12 +2026,12 @@ RULES
|
|
|
1967
2026
|
var APP_DOCUMENT_EDIT_PREFIX = "Here is the current app. Change only what is asked:";
|
|
1968
2027
|
|
|
1969
2028
|
// src/theme/schema.ts
|
|
1970
|
-
var
|
|
1971
|
-
var RGBString =
|
|
2029
|
+
var import_zod15 = require("zod");
|
|
2030
|
+
var RGBString = import_zod15.z.string().regex(
|
|
1972
2031
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
1973
2032
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
1974
2033
|
);
|
|
1975
|
-
var ThemeOverridesSchema =
|
|
2034
|
+
var ThemeOverridesSchema = import_zod15.z.object({
|
|
1976
2035
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
1977
2036
|
"--app-primary-color": RGBString.optional(),
|
|
1978
2037
|
"--app-primary-foreground-color": RGBString.optional(),
|
|
@@ -1988,9 +2047,9 @@ var ThemeOverridesSchema = import_zod14.z.object({
|
|
|
1988
2047
|
"--app-muted-bg": RGBString.optional(),
|
|
1989
2048
|
"--app-muted-text": RGBString.optional(),
|
|
1990
2049
|
// ── Shape ────────────────────────────────────────────────────────────────
|
|
1991
|
-
"--app-border-radius-sm":
|
|
1992
|
-
"--app-border-radius-md":
|
|
1993
|
-
"--app-border-radius-lg":
|
|
2050
|
+
"--app-border-radius-sm": import_zod15.z.string().optional(),
|
|
2051
|
+
"--app-border-radius-md": import_zod15.z.string().optional(),
|
|
2052
|
+
"--app-border-radius-lg": import_zod15.z.string().optional(),
|
|
1994
2053
|
// ── Form Controls ────────────────────────────────────────────────────────
|
|
1995
2054
|
"--app-input-bg-color": RGBString.optional(),
|
|
1996
2055
|
"--app-input-text-color": RGBString.optional(),
|
|
@@ -2004,19 +2063,19 @@ var ThemeOverridesSchema = import_zod14.z.object({
|
|
|
2004
2063
|
"--app-chart-4": RGBString.optional(),
|
|
2005
2064
|
"--app-chart-5": RGBString.optional()
|
|
2006
2065
|
}).strict();
|
|
2007
|
-
var ThemeFontsSchema =
|
|
2066
|
+
var ThemeFontsSchema = import_zod15.z.object({
|
|
2008
2067
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
2009
|
-
heading:
|
|
2068
|
+
heading: import_zod15.z.string(),
|
|
2010
2069
|
/** Google Font name for body text. Example: "Inter" */
|
|
2011
|
-
body:
|
|
2070
|
+
body: import_zod15.z.string(),
|
|
2012
2071
|
/** Optional monospace font. Example: "Roboto Mono" */
|
|
2013
|
-
mono:
|
|
2072
|
+
mono: import_zod15.z.string().optional()
|
|
2014
2073
|
});
|
|
2015
|
-
var AIThemeSchema =
|
|
2074
|
+
var AIThemeSchema = import_zod15.z.object({
|
|
2016
2075
|
/** Short descriptive theme name. Example: "Midnight Garden" */
|
|
2017
|
-
name:
|
|
2076
|
+
name: import_zod15.z.string(),
|
|
2018
2077
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
2019
|
-
description:
|
|
2078
|
+
description: import_zod15.z.string(),
|
|
2020
2079
|
/** Google Font pairing for heading and body text. */
|
|
2021
2080
|
fonts: ThemeFontsSchema.optional(),
|
|
2022
2081
|
/**
|
|
@@ -2027,13 +2086,13 @@ var AIThemeSchema = import_zod14.z.object({
|
|
|
2027
2086
|
cssVars: ThemeOverridesSchema
|
|
2028
2087
|
});
|
|
2029
2088
|
var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint", "markets"];
|
|
2030
|
-
var ThemeTokensSchema =
|
|
2089
|
+
var ThemeTokensSchema = import_zod15.z.object({
|
|
2031
2090
|
primary: RGBString,
|
|
2032
2091
|
neutral: RGBString,
|
|
2033
2092
|
success: RGBString,
|
|
2034
2093
|
warning: RGBString,
|
|
2035
2094
|
destructive: RGBString,
|
|
2036
|
-
radius:
|
|
2095
|
+
radius: import_zod15.z.enum(["none", "sm", "md", "lg", "full"])
|
|
2037
2096
|
});
|
|
2038
2097
|
var DEFAULT_THEME_TOKENS = {
|
|
2039
2098
|
primary: "13 110 253",
|
|
@@ -2055,12 +2114,12 @@ var CONTROL_STATE_MEANINGS = {
|
|
|
2055
2114
|
};
|
|
2056
2115
|
|
|
2057
2116
|
// src/enclosures/schema.ts
|
|
2058
|
-
var
|
|
2059
|
-
var Mm =
|
|
2117
|
+
var import_zod16 = require("zod");
|
|
2118
|
+
var Mm = import_zod16.z.number().finite();
|
|
2060
2119
|
var PositiveMm = Mm.positive();
|
|
2061
2120
|
var NonNegativeMm = Mm.nonnegative();
|
|
2062
|
-
var PrinterProfileSchema =
|
|
2063
|
-
name:
|
|
2121
|
+
var PrinterProfileSchema = import_zod16.z.object({
|
|
2122
|
+
name: import_zod16.z.string().min(1).default("Bambu Lab X1 Carbon"),
|
|
2064
2123
|
/** Walls are whole multiples of this. */
|
|
2065
2124
|
nozzle: PositiveMm.default(0.4),
|
|
2066
2125
|
/** Gap for parts that slide together: the case's lip, a lid. */
|
|
@@ -2068,32 +2127,32 @@ var PrinterProfileSchema = import_zod15.z.object({
|
|
|
2068
2127
|
/** Gap for a friction fit. */
|
|
2069
2128
|
clearance_press: NonNegativeMm.default(0.1)
|
|
2070
2129
|
});
|
|
2071
|
-
var EdgeSchema =
|
|
2072
|
-
var FlexButtonSchema =
|
|
2130
|
+
var EdgeSchema = import_zod16.z.enum(["east", "west", "north", "south", "top", "bottom"]);
|
|
2131
|
+
var FlexButtonSchema = import_zod16.z.object({
|
|
2073
2132
|
/** The tongue's length, from its free end to where it joins the floor. */
|
|
2074
2133
|
length: PositiveMm.default(12),
|
|
2075
2134
|
/** Its width. */
|
|
2076
2135
|
width: PositiveMm.default(5),
|
|
2077
2136
|
/** The way from the switch to where the tongue joins the floor. */
|
|
2078
|
-
hinge:
|
|
2137
|
+
hinge: import_zod16.z.enum(["east", "west", "north", "south"])
|
|
2079
2138
|
});
|
|
2080
|
-
var InterfaceSchema =
|
|
2139
|
+
var InterfaceSchema = import_zod16.z.object({
|
|
2081
2140
|
/** usb_c, screen, reset_button, status_led, sd_card… */
|
|
2082
|
-
name:
|
|
2141
|
+
name: import_zod16.z.string().min(1),
|
|
2083
2142
|
edge: EdgeSchema,
|
|
2084
2143
|
/** From the centre of that face — see COORDINATES above. */
|
|
2085
|
-
offset_from_center:
|
|
2144
|
+
offset_from_center: import_zod16.z.tuple([Mm, Mm]).default([0, 0]),
|
|
2086
2145
|
/**
|
|
2087
2146
|
* A grille is a field of small round holes filling an ellipse of
|
|
2088
2147
|
* `cutout_size` — a speaker's — on a top or bottom face only.
|
|
2089
2148
|
*/
|
|
2090
|
-
cutout_shape:
|
|
2149
|
+
cutout_shape: import_zod16.z.enum(["rect", "rounded_rect", "circle", "grille"]),
|
|
2091
2150
|
/** [width, height] of the opening, including room for a plug's boot. A circle uses the first as its diameter. */
|
|
2092
|
-
cutout_size:
|
|
2151
|
+
cutout_size: import_zod16.z.tuple([PositiveMm, PositiveMm]),
|
|
2093
2152
|
/** How far the part sticks out past the component's edge. */
|
|
2094
2153
|
protrusion: NonNegativeMm.default(0),
|
|
2095
2154
|
/** A wider recess on the outside face, [width, height, depth], for a thick cable boot. */
|
|
2096
|
-
outer_recess:
|
|
2155
|
+
outer_recess: import_zod16.z.tuple([PositiveMm, PositiveMm, PositiveMm]).optional(),
|
|
2097
2156
|
/** Press it through the floor instead of opening a hole — see FlexButtonSchema. */
|
|
2098
2157
|
flex_button: FlexButtonSchema.optional(),
|
|
2099
2158
|
/**
|
|
@@ -2104,31 +2163,31 @@ var InterfaceSchema = import_zod15.z.object({
|
|
|
2104
2163
|
*/
|
|
2105
2164
|
chamfer: NonNegativeMm.optional()
|
|
2106
2165
|
});
|
|
2107
|
-
var MountHolesSchema =
|
|
2166
|
+
var MountHolesSchema = import_zod16.z.object({
|
|
2108
2167
|
/** Four holes, this far in from each corner: [east-west, north-south]. */
|
|
2109
|
-
inset_from_corners:
|
|
2168
|
+
inset_from_corners: import_zod16.z.tuple([PositiveMm, PositiveMm]).optional(),
|
|
2110
2169
|
/** Or exactly where they are: [east, north] from the footprint centre. */
|
|
2111
|
-
positions:
|
|
2112
|
-
thread:
|
|
2170
|
+
positions: import_zod16.z.array(import_zod16.z.tuple([Mm, Mm])).min(1).optional(),
|
|
2171
|
+
thread: import_zod16.z.enum(["M2", "M2.5", "M3"]),
|
|
2113
2172
|
/** Heat-set insert outer diameter and depth. split_shell_lip only: tray_bezel's screws cut their own thread. */
|
|
2114
2173
|
insert_od: PositiveMm.optional(),
|
|
2115
2174
|
insert_depth: PositiveMm.optional()
|
|
2116
2175
|
}).refine((m) => (m.inset_from_corners ? 1 : 0) + (m.positions ? 1 : 0) === 1, {
|
|
2117
2176
|
message: "give either inset_from_corners or positions, not both or neither"
|
|
2118
2177
|
});
|
|
2119
|
-
var PlacementSchema =
|
|
2120
|
-
relative_to:
|
|
2121
|
-
where:
|
|
2178
|
+
var PlacementSchema = import_zod16.z.object({
|
|
2179
|
+
relative_to: import_zod16.z.string().min(1),
|
|
2180
|
+
where: import_zod16.z.enum(["below", "above", "east", "west", "north", "south"]),
|
|
2122
2181
|
/** Space between the two keep-outs. */
|
|
2123
2182
|
gap: NonNegativeMm.default(1),
|
|
2124
2183
|
/** Moved this far [east, north] from centred on the other, once placed. */
|
|
2125
|
-
offset:
|
|
2184
|
+
offset: import_zod16.z.tuple([Mm, Mm]).default([0, 0])
|
|
2126
2185
|
});
|
|
2127
|
-
var ComponentSchema =
|
|
2128
|
-
id:
|
|
2129
|
-
type:
|
|
2186
|
+
var ComponentSchema = import_zod16.z.object({
|
|
2187
|
+
id: import_zod16.z.string().regex(/^[a-z][a-z0-9_]*$/, "lowercase letters, digits and underscores"),
|
|
2188
|
+
type: import_zod16.z.enum(["pcb", "display", "battery", "speaker", "module"]),
|
|
2130
2189
|
/** [east, north, up] — see COORDINATES. */
|
|
2131
|
-
dimensions:
|
|
2190
|
+
dimensions: import_zod16.z.tuple([PositiveMm, PositiveMm, PositiveMm]),
|
|
2132
2191
|
/**
|
|
2133
2192
|
* Radius of the footprint's corners: most boards are rounded. The case's
|
|
2134
2193
|
* inside corners follow it, so a rounded board gets a rounded tray without
|
|
@@ -2141,23 +2200,23 @@ var ComponentSchema = import_zod15.z.object({
|
|
|
2141
2200
|
/** Height of what is underneath (solder joints, a microSD socket), kept clear. */
|
|
2142
2201
|
clearance_z_bottom: NonNegativeMm.default(0),
|
|
2143
2202
|
/** Quarter turns about Z, applied before placement. */
|
|
2144
|
-
rotation:
|
|
2203
|
+
rotation: import_zod16.z.union([import_zod16.z.literal(0), import_zod16.z.literal(90), import_zod16.z.literal(180), import_zod16.z.literal(270)]).default(0),
|
|
2145
2204
|
placement: PlacementSchema.optional(),
|
|
2146
2205
|
mount_holes: MountHolesSchema.optional(),
|
|
2147
|
-
interfaces:
|
|
2206
|
+
interfaces: import_zod16.z.array(InterfaceSchema).default([]),
|
|
2148
2207
|
/** How it is held if it has no screw holes. */
|
|
2149
|
-
retention:
|
|
2208
|
+
retention: import_zod16.z.enum(["none", "cradle_ribs"]).default("none")
|
|
2150
2209
|
});
|
|
2151
|
-
var EmblemSchema =
|
|
2210
|
+
var EmblemSchema = import_zod16.z.object({
|
|
2152
2211
|
/** The SVG file, relative to the manifest. Filled paths only; strokes are ignored. */
|
|
2153
|
-
svg:
|
|
2154
|
-
face:
|
|
2212
|
+
svg: import_zod16.z.string().min(1),
|
|
2213
|
+
face: import_zod16.z.enum(["top", "bottom"]).default("bottom"),
|
|
2155
2214
|
/** Height of the mark on the face, along north. Its width follows the SVG's proportions. */
|
|
2156
2215
|
height: PositiveMm,
|
|
2157
2216
|
/** How deep it is pressed in. */
|
|
2158
2217
|
depth: PositiveMm.default(0.6),
|
|
2159
2218
|
/** From the centre of the case's footprint, [east, north]. */
|
|
2160
|
-
offset:
|
|
2219
|
+
offset: import_zod16.z.tuple([Mm, Mm]).default([0, 0]),
|
|
2161
2220
|
/**
|
|
2162
2221
|
* Cut it right through the face instead, as a stencil — a speaker's grille
|
|
2163
2222
|
* in the shape of the mark. Whatever its lines enclose would fall out, so
|
|
@@ -2167,14 +2226,14 @@ var EmblemSchema = import_zod15.z.object({
|
|
|
2167
2226
|
* (STENCIL_SPECK) are cut away; a larger one with no bridge fails the fit
|
|
2168
2227
|
* check, by where it is.
|
|
2169
2228
|
*/
|
|
2170
|
-
stencil:
|
|
2171
|
-
bridges:
|
|
2229
|
+
stencil: import_zod16.z.object({
|
|
2230
|
+
bridges: import_zod16.z.array(import_zod16.z.object({ at: import_zod16.z.tuple([Mm, Mm]), angle: import_zod16.z.number().default(0), length: PositiveMm.default(3) })).default([])
|
|
2172
2231
|
}).optional()
|
|
2173
2232
|
});
|
|
2174
|
-
var HardwareManifestSchema =
|
|
2175
|
-
project:
|
|
2233
|
+
var HardwareManifestSchema = import_zod16.z.object({
|
|
2234
|
+
project: import_zod16.z.string().regex(/^[a-z0-9][a-z0-9_-]*$/, "lowercase, digits, - and _"),
|
|
2176
2235
|
/** How the case goes together — see TWO STYLES above. */
|
|
2177
|
-
enclosure_style:
|
|
2236
|
+
enclosure_style: import_zod16.z.enum(["split_shell_lip", "tray_bezel"]).default("split_shell_lip"),
|
|
2178
2237
|
wall_thickness: PositiveMm.default(2.4),
|
|
2179
2238
|
/**
|
|
2180
2239
|
* Thicker walls on chosen sides, in place of `wall_thickness` there. A
|
|
@@ -2183,7 +2242,7 @@ var HardwareManifestSchema = import_zod15.z.object({
|
|
|
2183
2242
|
* black ESP32-S3 board's flush case, 2026-10-25). Each is a whole number
|
|
2184
2243
|
* of nozzle lines, and no thinner than `wall_thickness`.
|
|
2185
2244
|
*/
|
|
2186
|
-
walls:
|
|
2245
|
+
walls: import_zod16.z.object({ east: PositiveMm, west: PositiveMm, north: PositiveMm, south: PositiveMm }).partial().default({}),
|
|
2187
2246
|
/** Radius of the vertical outside corners. */
|
|
2188
2247
|
corner_radius: NonNegativeMm.default(2),
|
|
2189
2248
|
/**
|
|
@@ -2192,19 +2251,19 @@ var HardwareManifestSchema = import_zod15.z.object({
|
|
|
2192
2251
|
* rounds every edge the bevel leaves, so nothing on the outside is sharp.
|
|
2193
2252
|
* Without it they are square, and a case reads as a printed box.
|
|
2194
2253
|
*/
|
|
2195
|
-
edges:
|
|
2196
|
-
style:
|
|
2254
|
+
edges: import_zod16.z.object({
|
|
2255
|
+
style: import_zod16.z.enum(["chamfer", "round"]),
|
|
2197
2256
|
size: PositiveMm,
|
|
2198
2257
|
soften: NonNegativeMm.default(0)
|
|
2199
2258
|
}).optional(),
|
|
2200
2259
|
printer: PrinterProfileSchema.default({}),
|
|
2201
|
-
components:
|
|
2260
|
+
components: import_zod16.z.array(ComponentSchema).min(1),
|
|
2202
2261
|
emblem: EmblemSchema.optional()
|
|
2203
2262
|
}).superRefine((m, ctx) => {
|
|
2204
2263
|
const lines = m.wall_thickness / m.printer.nozzle;
|
|
2205
2264
|
if (Math.abs(lines - Math.round(lines)) > 1e-6) {
|
|
2206
2265
|
ctx.addIssue({
|
|
2207
|
-
code:
|
|
2266
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
2208
2267
|
path: ["wall_thickness"],
|
|
2209
2268
|
message: `${m.wall_thickness}mm is not a whole number of ${m.printer.nozzle}mm lines \u2014 try ${(Math.round(lines) * m.printer.nozzle).toFixed(2)}`
|
|
2210
2269
|
});
|
|
@@ -2214,14 +2273,14 @@ var HardwareManifestSchema = import_zod15.z.object({
|
|
|
2214
2273
|
const n = t / m.printer.nozzle;
|
|
2215
2274
|
if (Math.abs(n - Math.round(n)) > 1e-6) {
|
|
2216
2275
|
ctx.addIssue({
|
|
2217
|
-
code:
|
|
2276
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
2218
2277
|
path: ["walls", side],
|
|
2219
2278
|
message: `${t}mm is not a whole number of ${m.printer.nozzle}mm lines \u2014 try ${(Math.round(n) * m.printer.nozzle).toFixed(2)}`
|
|
2220
2279
|
});
|
|
2221
2280
|
}
|
|
2222
2281
|
if (t < m.wall_thickness) {
|
|
2223
2282
|
ctx.addIssue({
|
|
2224
|
-
code:
|
|
2283
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
2225
2284
|
path: ["walls", side],
|
|
2226
2285
|
message: `${t}mm is thinner than wall_thickness (${m.wall_thickness}mm): walls only thicken on chosen sides`
|
|
2227
2286
|
});
|
|
@@ -2230,13 +2289,13 @@ var HardwareManifestSchema = import_zod15.z.object({
|
|
|
2230
2289
|
const ids = m.components.map((c) => c.id);
|
|
2231
2290
|
ids.forEach((id, i) => {
|
|
2232
2291
|
if (ids.indexOf(id) !== i) {
|
|
2233
|
-
ctx.addIssue({ code:
|
|
2292
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "id"], message: `"${id}" is used twice` });
|
|
2234
2293
|
}
|
|
2235
2294
|
});
|
|
2236
2295
|
const roots = m.components.filter((c) => !c.placement);
|
|
2237
2296
|
if (roots.length !== 1) {
|
|
2238
2297
|
ctx.addIssue({
|
|
2239
|
-
code:
|
|
2298
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
2240
2299
|
path: ["components"],
|
|
2241
2300
|
message: `exactly one component must have no placement (the origin); found ${roots.length}: ${roots.map((r) => r.id).join(", ") || "none"}`
|
|
2242
2301
|
});
|
|
@@ -2246,13 +2305,13 @@ var HardwareManifestSchema = import_zod15.z.object({
|
|
|
2246
2305
|
if (!c.placement) return;
|
|
2247
2306
|
const target = c.placement.relative_to;
|
|
2248
2307
|
if (!byId.has(target)) {
|
|
2249
|
-
ctx.addIssue({ code:
|
|
2308
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "placement", "relative_to"], message: `no component "${target}"` });
|
|
2250
2309
|
return;
|
|
2251
2310
|
}
|
|
2252
2311
|
const seen = /* @__PURE__ */ new Set([c.id]);
|
|
2253
2312
|
for (let at = byId.get(target); at?.placement; at = byId.get(at.placement.relative_to)) {
|
|
2254
2313
|
if (seen.has(at.id)) {
|
|
2255
|
-
ctx.addIssue({ code:
|
|
2314
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "placement"], message: `placement loops back to "${at.id}"` });
|
|
2256
2315
|
return;
|
|
2257
2316
|
}
|
|
2258
2317
|
seen.add(at.id);
|
|
@@ -2260,139 +2319,139 @@ var HardwareManifestSchema = import_zod15.z.object({
|
|
|
2260
2319
|
});
|
|
2261
2320
|
m.components.forEach((c, i) => {
|
|
2262
2321
|
if (m.enclosure_style === "split_shell_lip" && c.mount_holes && (!c.mount_holes.insert_od || !c.mount_holes.insert_depth)) {
|
|
2263
|
-
ctx.addIssue({ code:
|
|
2322
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "mount_holes"], message: "a split_shell_lip case holds boards on heat-set inserts: give insert_od and insert_depth" });
|
|
2264
2323
|
}
|
|
2265
2324
|
c.interfaces.forEach((f, j) => {
|
|
2266
2325
|
if (f.chamfer && f.edge !== "top" && f.edge !== "bottom") {
|
|
2267
|
-
ctx.addIssue({ code:
|
|
2326
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "chamfer"], message: `a chamfer ramps an opening in the bezel or the floor: its edge must be top or bottom, not ${f.edge}` });
|
|
2268
2327
|
}
|
|
2269
2328
|
if (f.cutout_shape === "grille" && f.edge !== "top" && f.edge !== "bottom") {
|
|
2270
|
-
ctx.addIssue({ code:
|
|
2329
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "cutout_shape"], message: `a grille is a field of holes in the bezel or the floor: its edge must be top or bottom, not ${f.edge}` });
|
|
2271
2330
|
}
|
|
2272
2331
|
if (f.flex_button && f.edge !== "bottom") {
|
|
2273
|
-
ctx.addIssue({ code:
|
|
2332
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "flex_button"], message: `a flex button is pressed through the floor: its edge must be bottom, not ${f.edge}` });
|
|
2274
2333
|
}
|
|
2275
2334
|
});
|
|
2276
2335
|
const [x, y] = c.dimensions;
|
|
2277
2336
|
c.mount_holes?.positions?.forEach((p, j) => {
|
|
2278
2337
|
if (Math.abs(p[0]) > x / 2 || Math.abs(p[1]) > y / 2) {
|
|
2279
|
-
ctx.addIssue({ code:
|
|
2338
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "mount_holes", "positions", j], message: `hole at [${p}] is outside the ${x}\xD7${y} footprint` });
|
|
2280
2339
|
}
|
|
2281
2340
|
});
|
|
2282
2341
|
const inset = c.mount_holes?.inset_from_corners;
|
|
2283
2342
|
if (inset && (inset[0] * 2 >= x || inset[1] * 2 >= y)) {
|
|
2284
|
-
ctx.addIssue({ code:
|
|
2343
|
+
ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["components", i, "mount_holes", "inset_from_corners"], message: `insets [${inset}] meet in the middle of a ${x}\xD7${y} footprint` });
|
|
2285
2344
|
}
|
|
2286
2345
|
});
|
|
2287
2346
|
});
|
|
2288
|
-
var FamilyChoiceSchema =
|
|
2289
|
-
label:
|
|
2347
|
+
var FamilyChoiceSchema = import_zod16.z.object({
|
|
2348
|
+
label: import_zod16.z.string().min(1),
|
|
2290
2349
|
/** One sentence: what it is for. */
|
|
2291
|
-
description:
|
|
2350
|
+
description: import_zod16.z.string().optional(),
|
|
2292
2351
|
/** Components added to the base manifest's. */
|
|
2293
|
-
components:
|
|
2352
|
+
components: import_zod16.z.array(ComponentSchema).default([]),
|
|
2294
2353
|
/** Top-level manifest fields this choice sets: wall_thickness, emblem… */
|
|
2295
|
-
set:
|
|
2354
|
+
set: import_zod16.z.record(import_zod16.z.unknown()).default({}),
|
|
2296
2355
|
/**
|
|
2297
2356
|
* Changes to the base's own components, by id: fields to set, null to
|
|
2298
2357
|
* remove one, and `interfaces` by name the same way — a null interface is
|
|
2299
2358
|
* removed, an unknown one added. How a flush top lowers the board's
|
|
2300
2359
|
* clearance and widens its screen opening to the glass.
|
|
2301
2360
|
*/
|
|
2302
|
-
patch:
|
|
2361
|
+
patch: import_zod16.z.record(import_zod16.z.record(import_zod16.z.unknown())).default({})
|
|
2303
2362
|
});
|
|
2304
|
-
var FamilyOptionSchema =
|
|
2305
|
-
label:
|
|
2363
|
+
var FamilyOptionSchema = import_zod16.z.object({
|
|
2364
|
+
label: import_zod16.z.string().min(1),
|
|
2306
2365
|
/** In order; the first is the default. Ids are lowercase words and dashes. */
|
|
2307
|
-
choices:
|
|
2366
|
+
choices: import_zod16.z.array(FamilyChoiceSchema.extend({ id: import_zod16.z.string().regex(/^[a-z0-9][a-z0-9-]*$/) })).min(1)
|
|
2308
2367
|
});
|
|
2309
|
-
var CaseFamilySchema =
|
|
2368
|
+
var CaseFamilySchema = import_zod16.z.object({
|
|
2310
2369
|
/** The base manifest, relative to this file. */
|
|
2311
|
-
manifest:
|
|
2370
|
+
manifest: import_zod16.z.string().min(1),
|
|
2312
2371
|
/** Option groups, in the order they are offered: base, top… */
|
|
2313
|
-
options:
|
|
2372
|
+
options: import_zod16.z.record(import_zod16.z.string().regex(/^[a-z][a-z0-9-]*$/), FamilyOptionSchema)
|
|
2314
2373
|
});
|
|
2315
2374
|
|
|
2316
2375
|
// src/auth/schema.ts
|
|
2317
|
-
var
|
|
2318
|
-
var UserSchema =
|
|
2319
|
-
id:
|
|
2320
|
-
name:
|
|
2321
|
-
email:
|
|
2322
|
-
password:
|
|
2323
|
-
role:
|
|
2324
|
-
status:
|
|
2325
|
-
joinedAt:
|
|
2326
|
-
lastActive:
|
|
2327
|
-
avatarUrl:
|
|
2376
|
+
var import_zod17 = require("zod");
|
|
2377
|
+
var UserSchema = import_zod17.z.object({
|
|
2378
|
+
id: import_zod17.z.string().default(""),
|
|
2379
|
+
name: import_zod17.z.string(),
|
|
2380
|
+
email: import_zod17.z.string().email(),
|
|
2381
|
+
password: import_zod17.z.string().optional(),
|
|
2382
|
+
role: import_zod17.z.string(),
|
|
2383
|
+
status: import_zod17.z.string().optional(),
|
|
2384
|
+
joinedAt: import_zod17.z.string().optional(),
|
|
2385
|
+
lastActive: import_zod17.z.string().optional(),
|
|
2386
|
+
avatarUrl: import_zod17.z.string().optional()
|
|
2328
2387
|
});
|
|
2329
2388
|
|
|
2330
2389
|
// src/auth/accounts.ts
|
|
2331
|
-
var
|
|
2332
|
-
var AccountIdSchema =
|
|
2333
|
-
var AccountRoleSchema =
|
|
2334
|
-
var AccountStatusSchema =
|
|
2335
|
-
var ScryptHashSchema =
|
|
2336
|
-
algo:
|
|
2337
|
-
n:
|
|
2338
|
-
r:
|
|
2339
|
-
p:
|
|
2340
|
-
keylen:
|
|
2341
|
-
salt:
|
|
2342
|
-
hash:
|
|
2343
|
-
});
|
|
2344
|
-
var AccountRecordSchema =
|
|
2390
|
+
var import_zod18 = require("zod");
|
|
2391
|
+
var AccountIdSchema = import_zod18.z.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits");
|
|
2392
|
+
var AccountRoleSchema = import_zod18.z.enum(["member", "admin"]);
|
|
2393
|
+
var AccountStatusSchema = import_zod18.z.enum(["active", "suspended"]);
|
|
2394
|
+
var ScryptHashSchema = import_zod18.z.object({
|
|
2395
|
+
algo: import_zod18.z.literal("scrypt"),
|
|
2396
|
+
n: import_zod18.z.number().int().positive(),
|
|
2397
|
+
r: import_zod18.z.number().int().positive(),
|
|
2398
|
+
p: import_zod18.z.number().int().positive(),
|
|
2399
|
+
keylen: import_zod18.z.number().int().positive(),
|
|
2400
|
+
salt: import_zod18.z.string().min(16),
|
|
2401
|
+
hash: import_zod18.z.string().min(16)
|
|
2402
|
+
});
|
|
2403
|
+
var AccountRecordSchema = import_zod18.z.object({
|
|
2345
2404
|
accountId: AccountIdSchema,
|
|
2346
2405
|
/** Lowercased on write, because a login must not depend on how it was typed. */
|
|
2347
|
-
email:
|
|
2348
|
-
name:
|
|
2406
|
+
email: import_zod18.z.string().email().max(254),
|
|
2407
|
+
name: import_zod18.z.string().min(1).max(64),
|
|
2349
2408
|
role: AccountRoleSchema,
|
|
2350
2409
|
status: AccountStatusSchema,
|
|
2351
2410
|
password: ScryptHashSchema,
|
|
2352
|
-
createdAt:
|
|
2353
|
-
lastLoginAt:
|
|
2411
|
+
createdAt: import_zod18.z.number().int().nonnegative(),
|
|
2412
|
+
lastLoginAt: import_zod18.z.number().int().nonnegative().nullable().default(null),
|
|
2354
2413
|
/** Which admin approved this, or null for the bootstrap account. */
|
|
2355
2414
|
invitedBy: AccountIdSchema.nullable().default(null)
|
|
2356
2415
|
});
|
|
2357
2416
|
var DISPLAY_NAME_MAX = 40;
|
|
2358
|
-
var DisplayNameSchema =
|
|
2359
|
-
|
|
2417
|
+
var DisplayNameSchema = import_zod18.z.string().transform((s) => s.trim().replace(/\s+/g, " ")).pipe(
|
|
2418
|
+
import_zod18.z.string().min(1, "Give a name.").max(DISPLAY_NAME_MAX, `At most ${DISPLAY_NAME_MAX} characters.`).refine((s) => !/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/.test(s), "Letters, numbers, spaces and punctuation only.")
|
|
2360
2419
|
);
|
|
2361
|
-
var PublicAccountSchema =
|
|
2420
|
+
var PublicAccountSchema = import_zod18.z.object({
|
|
2362
2421
|
accountId: AccountIdSchema,
|
|
2363
|
-
email:
|
|
2364
|
-
name:
|
|
2422
|
+
email: import_zod18.z.string().email(),
|
|
2423
|
+
name: import_zod18.z.string(),
|
|
2365
2424
|
role: AccountRoleSchema,
|
|
2366
2425
|
status: AccountStatusSchema
|
|
2367
2426
|
});
|
|
2368
|
-
var SessionRecordSchema =
|
|
2427
|
+
var SessionRecordSchema = import_zod18.z.object({
|
|
2369
2428
|
accountId: AccountIdSchema,
|
|
2370
|
-
createdAt:
|
|
2371
|
-
expiresAt:
|
|
2372
|
-
lastSeenAt:
|
|
2429
|
+
createdAt: import_zod18.z.number().int().nonnegative(),
|
|
2430
|
+
expiresAt: import_zod18.z.number().int().nonnegative(),
|
|
2431
|
+
lastSeenAt: import_zod18.z.number().int().nonnegative()
|
|
2373
2432
|
});
|
|
2374
|
-
var InviteRecordSchema =
|
|
2375
|
-
email:
|
|
2433
|
+
var InviteRecordSchema = import_zod18.z.object({
|
|
2434
|
+
email: import_zod18.z.string().email().max(254),
|
|
2376
2435
|
role: AccountRoleSchema,
|
|
2377
|
-
createdAt:
|
|
2378
|
-
expiresAt:
|
|
2436
|
+
createdAt: import_zod18.z.number().int().nonnegative(),
|
|
2437
|
+
expiresAt: import_zod18.z.number().int().nonnegative(),
|
|
2379
2438
|
invitedBy: AccountIdSchema
|
|
2380
2439
|
});
|
|
2381
|
-
var AccessRequestSchema =
|
|
2382
|
-
email:
|
|
2383
|
-
name:
|
|
2440
|
+
var AccessRequestSchema = import_zod18.z.object({
|
|
2441
|
+
email: import_zod18.z.string().email().max(254),
|
|
2442
|
+
name: import_zod18.z.string().min(1).max(64),
|
|
2384
2443
|
/** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
|
|
2385
|
-
reason:
|
|
2386
|
-
});
|
|
2387
|
-
var AccessRequestStatusSchema =
|
|
2388
|
-
var AccessRequestRecordSchema =
|
|
2389
|
-
requestId:
|
|
2390
|
-
email:
|
|
2391
|
-
name:
|
|
2392
|
-
reason:
|
|
2444
|
+
reason: import_zod18.z.string().max(500).optional()
|
|
2445
|
+
});
|
|
2446
|
+
var AccessRequestStatusSchema = import_zod18.z.enum(["pending", "approved", "denied"]);
|
|
2447
|
+
var AccessRequestRecordSchema = import_zod18.z.object({
|
|
2448
|
+
requestId: import_zod18.z.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
|
|
2449
|
+
email: import_zod18.z.string().email().max(254),
|
|
2450
|
+
name: import_zod18.z.string().min(1).max(64),
|
|
2451
|
+
reason: import_zod18.z.string().max(500).optional(),
|
|
2393
2452
|
status: AccessRequestStatusSchema,
|
|
2394
|
-
createdAt:
|
|
2395
|
-
decidedAt:
|
|
2453
|
+
createdAt: import_zod18.z.number().int().nonnegative(),
|
|
2454
|
+
decidedAt: import_zod18.z.number().int().nonnegative().nullable().default(null),
|
|
2396
2455
|
decidedBy: AccountIdSchema.nullable().default(null)
|
|
2397
2456
|
});
|
|
2398
2457
|
var SCRYPT_PARAMS = {
|
|
@@ -2411,35 +2470,37 @@ var INVITE_TTL_SECONDS = 60 * 60 * 24 * 14;
|
|
|
2411
2470
|
var ACCESS_REQUEST_TTL_SECONDS = 60 * 60 * 24 * 90;
|
|
2412
2471
|
|
|
2413
2472
|
// src/auth/accessTokens.ts
|
|
2414
|
-
var
|
|
2415
|
-
var ACCESS_TOKEN_SCOPES = ["boards:read", "boards:send", "boards:configure"];
|
|
2416
|
-
var AccessTokenScopeSchema =
|
|
2473
|
+
var import_zod19 = require("zod");
|
|
2474
|
+
var ACCESS_TOKEN_SCOPES = ["boards:read", "boards:send", "boards:configure", "apps:read", "apps:write"];
|
|
2475
|
+
var AccessTokenScopeSchema = import_zod19.z.enum(ACCESS_TOKEN_SCOPES);
|
|
2417
2476
|
var ACCESS_TOKEN_SCOPE_LABELS = {
|
|
2418
2477
|
"boards:read": "See my boards",
|
|
2419
2478
|
"boards:send": "Send apps to my boards",
|
|
2420
|
-
"boards:configure": "Change my boards\u2019 settings"
|
|
2479
|
+
"boards:configure": "Change my boards\u2019 settings",
|
|
2480
|
+
"apps:read": "See my saved apps",
|
|
2481
|
+
"apps:write": "Save apps to my account"
|
|
2421
2482
|
};
|
|
2422
2483
|
var ACCESS_TOKEN_PREFIX = "rmk_";
|
|
2423
2484
|
var ACCESS_TOKEN_LIFETIMES_DAYS = [7, 30, 90, 365];
|
|
2424
2485
|
var ACCESS_TOKEN_MAX_PER_ACCOUNT = 20;
|
|
2425
2486
|
var ACCESS_TOKEN_RATE_PER_MINUTE = 60;
|
|
2426
|
-
var AccessTokenRecordSchema =
|
|
2487
|
+
var AccessTokenRecordSchema = import_zod19.z.object({
|
|
2427
2488
|
/** The first 12 hex digits of the hash: what the owner sees and revokes by. */
|
|
2428
|
-
tokenId:
|
|
2489
|
+
tokenId: import_zod19.z.string().regex(/^[0-9a-f]{12}$/),
|
|
2429
2490
|
accountId: AccountIdSchema,
|
|
2430
2491
|
/** What the owner called it: "laptop", "Claude Code". */
|
|
2431
|
-
name:
|
|
2432
|
-
scopes:
|
|
2433
|
-
createdAt:
|
|
2434
|
-
expiresAt:
|
|
2492
|
+
name: import_zod19.z.string().trim().min(1).max(60),
|
|
2493
|
+
scopes: import_zod19.z.array(AccessTokenScopeSchema).min(1),
|
|
2494
|
+
createdAt: import_zod19.z.number().int().nonnegative(),
|
|
2495
|
+
expiresAt: import_zod19.z.number().int().nonnegative(),
|
|
2435
2496
|
/** Moved forward at most once a day, so using a token is not a write per request. */
|
|
2436
|
-
lastUsedAt:
|
|
2497
|
+
lastUsedAt: import_zod19.z.number().int().nonnegative().nullable().default(null)
|
|
2437
2498
|
});
|
|
2438
2499
|
var PublicAccessTokenSchema = AccessTokenRecordSchema.omit({ accountId: true });
|
|
2439
|
-
var NewAccessTokenSchema =
|
|
2440
|
-
name:
|
|
2441
|
-
scopes:
|
|
2442
|
-
days:
|
|
2500
|
+
var NewAccessTokenSchema = import_zod19.z.object({
|
|
2501
|
+
name: import_zod19.z.string().trim().min(1, "Give it a name.").max(60),
|
|
2502
|
+
scopes: import_zod19.z.array(AccessTokenScopeSchema).min(1, "Choose at least one thing it can do."),
|
|
2503
|
+
days: import_zod19.z.union(ACCESS_TOKEN_LIFETIMES_DAYS.map((d) => import_zod19.z.literal(d)))
|
|
2443
2504
|
});
|
|
2444
2505
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2445
2506
|
0 && (module.exports = {
|
|
@@ -2499,9 +2560,17 @@ var NewAccessTokenSchema = import_zod18.z.object({
|
|
|
2499
2560
|
AppTextSizeSchema,
|
|
2500
2561
|
AssetHashSchema,
|
|
2501
2562
|
AuthStrategySchema,
|
|
2563
|
+
BOARD_REMOTE_COMMANDS,
|
|
2564
|
+
BOARD_REMOTE_PENDING_MAX,
|
|
2565
|
+
BOARD_REMOTE_TTL_MS,
|
|
2566
|
+
BOARD_SLEEP_MINUTES,
|
|
2567
|
+
BOARD_SLEEP_MINUTES_DEFAULT,
|
|
2502
2568
|
BlockSchema,
|
|
2503
2569
|
BoardFontSchema,
|
|
2504
2570
|
BoardPaletteHexSchema,
|
|
2571
|
+
BoardRemoteCommandSchema,
|
|
2572
|
+
BoardRemotePressSchema,
|
|
2573
|
+
BoardSleepMinutesSchema,
|
|
2505
2574
|
Bodewell,
|
|
2506
2575
|
CLAIMED_DEVICE_TTL_SECONDS,
|
|
2507
2576
|
CONTROL_STATES,
|
|
@@ -2604,6 +2673,7 @@ var NewAccessTokenSchema = import_zod18.z.object({
|
|
|
2604
2673
|
PublicAccountSchema,
|
|
2605
2674
|
RETRO_RENDITION,
|
|
2606
2675
|
ResourceSchema,
|
|
2676
|
+
SAVED_APPS_MAX,
|
|
2607
2677
|
SCRYPT_PARAMS,
|
|
2608
2678
|
SESSION_COOKIE_NAME,
|
|
2609
2679
|
SESSION_TTL_SECONDS,
|
|
@@ -2621,6 +2691,7 @@ var NewAccessTokenSchema = import_zod18.z.object({
|
|
|
2621
2691
|
SPRITE_MAX_SIDE,
|
|
2622
2692
|
SPR_FORMAT,
|
|
2623
2693
|
SPR_MAX_BYTES,
|
|
2694
|
+
SavedAppSchema,
|
|
2624
2695
|
ScryptHashSchema,
|
|
2625
2696
|
SendRequestSchema,
|
|
2626
2697
|
SensorAppConfigSchema,
|