@camstack/types 1.2.575 → 1.2.576

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/addon.js +1 -1
  3. package/dist/addon.mjs +1 -1
  4. package/dist/automation/action.d.ts +2 -0
  5. package/dist/automation/scheduler.d.ts +2 -0
  6. package/dist/capabilities/action-source.cap.d.ts +1 -0
  7. package/dist/capabilities/actions.cap.d.ts +7 -0
  8. package/dist/capabilities/core-blocks.cap.d.ts +20 -0
  9. package/dist/capabilities/device-manager.cap.d.ts +18 -0
  10. package/dist/capabilities/index.d.ts +3 -1
  11. package/dist/capabilities/schedulers.cap.d.ts +8 -0
  12. package/dist/capabilities/tags.cap.d.ts +123 -0
  13. package/dist/capabilities/template.cap.d.ts +8 -0
  14. package/dist/client.js +685 -678
  15. package/dist/client.mjs +685 -678
  16. package/dist/device/device-management.d.ts +4 -0
  17. package/dist/device-template-catalogue.d.ts +67 -0
  18. package/dist/device-template-catalogue.js +361 -0
  19. package/dist/device-template-catalogue.mjs +346 -0
  20. package/dist/expression/device-template.d.ts +5 -6
  21. package/dist/generated/addon-api.d.ts +43 -0
  22. package/dist/generated/cap-vocabulary.d.ts +1 -1
  23. package/dist/generated/capability-router-map.d.ts +5 -2
  24. package/dist/generated/device-proxy.d.ts +1 -1
  25. package/dist/generated/method-access-map.d.ts +1 -1
  26. package/dist/generated/method-device-selectors.d.ts +2 -2
  27. package/dist/generated/system-proxy.d.ts +2 -0
  28. package/dist/index.d.ts +4 -0
  29. package/dist/index.js +4108 -3872
  30. package/dist/index.mjs +4077 -3873
  31. package/dist/{sleep-CsIzA4m_.js → sleep-BURDyp_n.js} +7 -1
  32. package/dist/{sleep-CLDVTB5R.mjs → sleep-C9EWTQr9.mjs} +7 -1
  33. package/dist/tags/tag.d.ts +56 -0
  34. package/package.json +6 -1
@@ -34,6 +34,8 @@ export interface SavedDevice {
34
34
  * Kitchen" filters.
35
35
  */
36
36
  readonly location: string | null;
37
+ /** Operator tags (D1054). Absent = no tags. */
38
+ readonly tags?: readonly string[];
37
39
  /**
38
40
  * Soft-disabled flag. When `true`, the device class is still
39
41
  * instantiated and visible in the UI (so the operator can flip it
@@ -146,6 +148,8 @@ export interface DeviceMeta {
146
148
  * auto-derived children land with the flag unset and self-heal their names. */
147
149
  readonly userNamed?: boolean;
148
150
  readonly location: string | null;
151
+ /** Operator tags (D1054). Absent = no tags. */
152
+ readonly tags?: readonly string[];
149
153
  readonly disabled: boolean;
150
154
  readonly parentDeviceId: number | null;
151
155
  /** Hardware + identity blob; null when nothing has been populated yet. */
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The one catalogue of what a device template may name (D1021, D1029).
3
+ *
4
+ * Filters, the `range` global and the reserved names (`now`, `camera`, the
5
+ * caller's recognition values) are listed here. The grammar's allow-list and
6
+ * argument caps are derived from this module; nothing else keeps a second list.
7
+ * The renderer imports this module through the
8
+ * `@camstack/types/device-template-catalogue` subpath, never the types barrel
9
+ * (D453), and sends the derived caps to the worker. The worker does not import it.
10
+ */
11
+ import { z } from 'zod';
12
+ export declare const DEVICE_TEMPLATE_CATALOGUE_KINDS: readonly ['filter', 'global', 'variable'];
13
+ export type DeviceTemplateCatalogueKind = (typeof DEVICE_TEMPLATE_CATALOGUE_KINDS)[number];
14
+ export declare const DEVICE_TEMPLATE_CATALOGUE_CATEGORIES: readonly ['number', 'unit', 'text', 'state', 'time', 'fallback', 'loop', 'variable'];
15
+ export type DeviceTemplateCatalogueCategory = (typeof DEVICE_TEMPLATE_CATALOGUE_CATEGORIES)[number];
16
+ export declare const DEVICE_TEMPLATE_PARAM_TYPES: readonly ['string', 'number', 'boolean'];
17
+ export type DeviceTemplateParamType = (typeof DEVICE_TEMPLATE_PARAM_TYPES)[number];
18
+ declare const deviceTemplateParamSchemaValue: z.ZodType<{
19
+ name: string;
20
+ type: DeviceTemplateParamType;
21
+ optional: boolean;
22
+ default?: string | number | boolean;
23
+ }>;
24
+ export type DeviceTemplateParam = z.infer<typeof deviceTemplateParamSchemaValue>;
25
+ export declare const deviceTemplateParamSchema: z.ZodType<DeviceTemplateParam>;
26
+ declare const deviceTemplateCatalogueEntrySchemaValue: z.ZodType<{
27
+ name: string;
28
+ kind: DeviceTemplateCatalogueKind;
29
+ category: DeviceTemplateCatalogueCategory;
30
+ params: DeviceTemplateParam[];
31
+ descriptionKey: string;
32
+ exampleKey: string;
33
+ }>;
34
+ export type DeviceTemplateCatalogueEntry = z.infer<typeof deviceTemplateCatalogueEntrySchemaValue>;
35
+ export declare const deviceTemplateCatalogueEntrySchema: z.ZodType<DeviceTemplateCatalogueEntry>;
36
+ export interface DeviceTemplateCatalogueText {
37
+ readonly en: string;
38
+ readonly it: string;
39
+ }
40
+ /** Every name the engine allows, in the order operators meet them. */
41
+ export declare const DEVICE_TEMPLATE_CATALOGUE: readonly DeviceTemplateCatalogueEntry[];
42
+ /** English and Italian for every description and example key. */
43
+ export declare const DEVICE_TEMPLATE_CATALOGUE_TEXT: Readonly<Record<string, DeviceTemplateCatalogueText>>;
44
+ /** Names a template may use after `|`. Order matches the catalogue. */
45
+ export declare function deviceTemplateFilterNames(): readonly string[];
46
+ /**
47
+ * How many arguments a filter may take after its input. Derived from the
48
+ * catalogue's parameter list — the grammar refuses anything past this.
49
+ */
50
+ export declare function deviceTemplateFilterMaxParams(): Readonly<Record<string, number>>;
51
+ export interface DeviceTemplateCallableBounds {
52
+ readonly name: string;
53
+ readonly min: number;
54
+ readonly max: number;
55
+ }
56
+ /** Globals a template may call, with how many numbers each takes. */
57
+ export declare function deviceTemplateCallableBounds(): readonly DeviceTemplateCallableBounds[];
58
+ /** Names offered at the start of `{{ }}`: the clock, the for-loop, and `camera` when the field has a device. */
59
+ export declare function deviceTemplateRootVariables(): readonly DeviceTemplateCatalogueEntry[];
60
+ /** Values the caller stores on `camera` (`lastPerson`, `lastPlate`), not device fields. */
61
+ export declare function deviceTemplateCameraValues(): readonly DeviceTemplateCatalogueEntry[];
62
+ export declare function deviceTemplateSignature(item: DeviceTemplateCatalogueEntry): string;
63
+ /** The operator-facing English (or Italian) sentence for a catalogue key. */
64
+ export declare function deviceTemplateCatalogueSentence(key: string, language: 'en' | 'it'): string | undefined;
65
+ /** A markdown table of the catalogue, for the public docs page. */
66
+ export declare function deviceTemplateCatalogueMarkdown(): string;
67
+ export {};
@@ -0,0 +1,361 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let zod = require("zod");
3
+ //#region src/device-template-catalogue.ts
4
+ /**
5
+ * The one catalogue of what a device template may name (D1021, D1029).
6
+ *
7
+ * Filters, the `range` global and the reserved names (`now`, `camera`, the
8
+ * caller's recognition values) are listed here. The grammar's allow-list and
9
+ * argument caps are derived from this module; nothing else keeps a second list.
10
+ * The renderer imports this module through the
11
+ * `@camstack/types/device-template-catalogue` subpath, never the types barrel
12
+ * (D453), and sends the derived caps to the worker. The worker does not import it.
13
+ */
14
+ var DEVICE_TEMPLATE_CATALOGUE_KINDS = [
15
+ "filter",
16
+ "global",
17
+ "variable"
18
+ ];
19
+ var DEVICE_TEMPLATE_CATALOGUE_CATEGORIES = [
20
+ "number",
21
+ "unit",
22
+ "text",
23
+ "state",
24
+ "time",
25
+ "fallback",
26
+ "loop",
27
+ "variable"
28
+ ];
29
+ var DEVICE_TEMPLATE_PARAM_TYPES = [
30
+ "string",
31
+ "number",
32
+ "boolean"
33
+ ];
34
+ var deviceTemplateParamSchema = zod.z.object({
35
+ name: zod.z.string().min(1),
36
+ type: zod.z.enum(DEVICE_TEMPLATE_PARAM_TYPES),
37
+ optional: zod.z.boolean(),
38
+ default: zod.z.union([
39
+ zod.z.string(),
40
+ zod.z.number(),
41
+ zod.z.boolean()
42
+ ]).optional()
43
+ });
44
+ var deviceTemplateCatalogueEntrySchema = zod.z.object({
45
+ name: zod.z.string().min(1),
46
+ kind: zod.z.enum(DEVICE_TEMPLATE_CATALOGUE_KINDS),
47
+ category: zod.z.enum(DEVICE_TEMPLATE_CATALOGUE_CATEGORIES),
48
+ params: zod.z.array(deviceTemplateParamSchema),
49
+ descriptionKey: zod.z.string().min(1),
50
+ exampleKey: zod.z.string().min(1)
51
+ });
52
+ function param(name, type, optional, fallback) {
53
+ return fallback === void 0 ? {
54
+ name,
55
+ type,
56
+ optional
57
+ } : {
58
+ name,
59
+ type,
60
+ optional,
61
+ default: fallback
62
+ };
63
+ }
64
+ function entry(name, kind, category, params) {
65
+ return {
66
+ name,
67
+ kind,
68
+ category,
69
+ params: [...params],
70
+ descriptionKey: `uiLibrary.deviceTemplateCatalogue.${name}.description`,
71
+ exampleKey: `uiLibrary.deviceTemplateCatalogue.${name}.example`
72
+ };
73
+ }
74
+ var DIGITS = param("digits", "number", true, 0);
75
+ var FALLBACK_TEXT = param("fallback", "string", false);
76
+ var FALSY = param("falsy", "boolean", true, false);
77
+ /** Every name the engine allows, in the order operators meet them. */
78
+ var DEVICE_TEMPLATE_CATALOGUE = [
79
+ entry("unit", "filter", "unit", [param("symbol", "string", false), param("from", "string", true)]),
80
+ entry("round", "filter", "number", [DIGITS]),
81
+ entry("trunc", "filter", "number", [DIGITS]),
82
+ entry("onoff", "filter", "state", []),
83
+ entry("default", "filter", "fallback", [FALLBACK_TEXT, FALSY]),
84
+ entry("since", "filter", "time", []),
85
+ entry("ago", "filter", "time", []),
86
+ entry("format", "filter", "text", [param("pattern", "string", false)]),
87
+ entry("upper", "filter", "text", []),
88
+ entry("lower", "filter", "text", []),
89
+ entry("title", "filter", "text", []),
90
+ entry("capitalize", "filter", "text", []),
91
+ entry("trim", "filter", "text", []),
92
+ entry("abs", "filter", "number", []),
93
+ entry("int", "filter", "number", [param("fallback", "number", true, 0)]),
94
+ entry("float", "filter", "number", [param("fallback", "number", true, 0)]),
95
+ entry("length", "filter", "text", []),
96
+ entry("d", "filter", "fallback", [FALLBACK_TEXT, FALSY]),
97
+ entry("join", "filter", "text", [param("separator", "string", true, "")]),
98
+ entry("replace", "filter", "text", [
99
+ param("old", "string", false),
100
+ param("new", "string", false),
101
+ param("count", "number", true)
102
+ ]),
103
+ entry("first", "filter", "loop", []),
104
+ entry("last", "filter", "loop", []),
105
+ entry("sort", "filter", "loop", [param("reverse", "boolean", true, false), param("caseSensitive", "boolean", true, false)]),
106
+ entry("reverse", "filter", "loop", []),
107
+ entry("sum", "filter", "number", []),
108
+ entry("string", "filter", "text", []),
109
+ entry("list", "filter", "loop", []),
110
+ entry("truncate", "filter", "text", [
111
+ param("length", "number", false),
112
+ param("killwords", "boolean", true, false),
113
+ param("end", "string", true, "…")
114
+ ]),
115
+ entry("time", "filter", "time", [param("pattern", "string", false)]),
116
+ entry("range", "global", "loop", [
117
+ param("stop", "number", false),
118
+ param("start", "number", true, 0),
119
+ param("step", "number", true, 1)
120
+ ]),
121
+ entry("now", "variable", "time", []),
122
+ entry("camera", "variable", "variable", []),
123
+ entry("loop", "variable", "loop", []),
124
+ entry("lastPerson", "variable", "variable", []),
125
+ entry("lastPlate", "variable", "variable", [])
126
+ ];
127
+ var COPY = {
128
+ unit: {
129
+ description: ["Converts a number from the field’s base unit and prints the symbol.", "Converte un numero dall’unità di base del campo e stampa il simbolo."],
130
+ example: ["{{ garage.temperature | unit('°C') }}", "{{ garage.temperature | unit('°C') }}"]
131
+ },
132
+ round: {
133
+ description: ["Rounds a number to the given decimals.", "Arrotonda un numero ai decimali indicati."],
134
+ example: ["{{ garage.temperature | round(1) }}", "{{ garage.temperature | round(1) }}"]
135
+ },
136
+ trunc: {
137
+ description: ["Cuts decimals toward zero, without rounding.", "Taglia i decimali verso zero, senza arrotondare."],
138
+ example: ["{{ garage.temperature | trunc(1) }}", "{{ garage.temperature | trunc(1) }}"]
139
+ },
140
+ onoff: {
141
+ description: ["Prints a boolean as ON or OFF.", "Stampa un sì/no come ON oppure OFF."],
142
+ example: ["{{ garage.switch | onoff }}", "{{ garage.switch | onoff }}"]
143
+ },
144
+ default: {
145
+ description: ["Replaces a missing value. The second argument also replaces a false or zero.", "Sostituisce un valore assente. Il secondo argomento sostituisce anche falso o zero."],
146
+ example: ["{{ camera.lastPerson | default('') }}", "{{ camera.lastPerson | default('') }}"]
147
+ },
148
+ since: {
149
+ description: ["How long ago a timestamp was, as “5 min”.", "Quanto tempo fa era un istante, come «5 min»."],
150
+ example: ["{{ garage.updated | since }}", "{{ garage.updated | since }}"]
151
+ },
152
+ ago: {
153
+ description: ["The same duration as since, followed by “ago”.", "La stessa durata di since, seguita da «ago»."],
154
+ example: ["{{ garage.updated | ago }}", "{{ garage.updated | ago }}"]
155
+ },
156
+ format: {
157
+ description: ["Prints one value with a single %s, %d or %.Nf placeholder.", "Stampa un valore con un solo segnaposto %s, %d o %.Nf."],
158
+ example: ["{{ garage.temperature | format('%.1f') }}", "{{ garage.temperature | format('%.1f') }}"]
159
+ },
160
+ upper: {
161
+ description: ["Uppercase text.", "Testo in maiuscolo."],
162
+ example: ["{{ camera.lastPerson | upper }}", "{{ camera.lastPerson | upper }}"]
163
+ },
164
+ lower: {
165
+ description: ["Lowercase text.", "Testo in minuscolo."],
166
+ example: ["{{ camera.lastPlate | lower }}", "{{ camera.lastPlate | lower }}"]
167
+ },
168
+ title: {
169
+ description: ["Capitalises each word.", "Mette la maiuscola a ogni parola."],
170
+ example: ["{{ camera.lastPerson | title }}", "{{ camera.lastPerson | title }}"]
171
+ },
172
+ capitalize: {
173
+ description: ["Capitalises the first letter.", "Mette la maiuscola alla prima lettera."],
174
+ example: ["{{ camera.lastPerson | capitalize }}", "{{ camera.lastPerson | capitalize }}"]
175
+ },
176
+ trim: {
177
+ description: ["Removes spaces at both ends.", "Toglie gli spazi alle estremità."],
178
+ example: ["{{ camera.lastPerson | trim }}", "{{ camera.lastPerson | trim }}"]
179
+ },
180
+ abs: {
181
+ description: ["The absolute value of a number.", "Il valore assoluto di un numero."],
182
+ example: ["{{ garage.power | abs }}", "{{ garage.power | abs }}"]
183
+ },
184
+ int: {
185
+ description: ["The whole part of a number.", "La parte intera di un numero."],
186
+ example: ["{{ garage.temperature | int }}", "{{ garage.temperature | int }}"]
187
+ },
188
+ float: {
189
+ description: ["Reads the value as a decimal number.", "Legge il valore come numero decimale."],
190
+ example: ["{{ garage.temperature | float }}", "{{ garage.temperature | float }}"]
191
+ },
192
+ length: {
193
+ description: ["How many characters or items.", "Quanti caratteri o elementi."],
194
+ example: ["{{ camera.lastPerson | length }}", "{{ camera.lastPerson | length }}"]
195
+ },
196
+ d: {
197
+ description: ["The short name of default.", "Il nome breve di default."],
198
+ example: ["{{ camera.lastPerson | d('') }}", "{{ camera.lastPerson | d('') }}"]
199
+ },
200
+ join: {
201
+ description: ["Joins a list with a separator.", "Unisce un elenco con un separatore."],
202
+ example: ["{{ range(3) | join(', ') }}", "{{ range(3) | join(', ') }}"]
203
+ },
204
+ replace: {
205
+ description: ["Replaces text, optionally only the first few times.", "Sostituisce del testo, volendo solo le prime volte."],
206
+ example: ["{{ camera.lastPlate | replace(' ', '') }}", "{{ camera.lastPlate | replace(' ', '') }}"]
207
+ },
208
+ first: {
209
+ description: ["The first item of a list.", "Il primo elemento di un elenco."],
210
+ example: ["{{ range(3) | first }}", "{{ range(3) | first }}"]
211
+ },
212
+ last: {
213
+ description: ["The last item of a list.", "L’ultimo elemento di un elenco."],
214
+ example: ["{{ range(3) | last }}", "{{ range(3) | last }}"]
215
+ },
216
+ sort: {
217
+ description: ["Sorts a list. The arguments reverse it or keep case.", "Ordina un elenco. Gli argomenti lo invertono o rispettano le maiuscole."],
218
+ example: ["{{ range(3) | reverse | sort }}", "{{ range(3) | reverse | sort }}"]
219
+ },
220
+ reverse: {
221
+ description: ["Reverses a list.", "Inverte un elenco."],
222
+ example: ["{{ range(3) | reverse }}", "{{ range(3) | reverse }}"]
223
+ },
224
+ sum: {
225
+ description: ["Adds the numbers in a list.", "Somma i numeri di un elenco."],
226
+ example: ["{{ range(3) | sum }}", "{{ range(3) | sum }}"]
227
+ },
228
+ string: {
229
+ description: ["Prints the value as text.", "Stampa il valore come testo."],
230
+ example: ["{{ garage.temperature | string }}", "{{ garage.temperature | string }}"]
231
+ },
232
+ list: {
233
+ description: ["Wraps the value in a list.", "Mette il valore in un elenco."],
234
+ example: ["{{ garage.temperature | list }}", "{{ garage.temperature | list }}"]
235
+ },
236
+ truncate: {
237
+ description: ["Shortens text to a length, with an ending.", "Accorcia il testo a una lunghezza, con una chiusura."],
238
+ example: ["{{ camera.lastPerson | truncate(12) }}", "{{ camera.lastPerson | truncate(12) }}"]
239
+ },
240
+ time: {
241
+ description: ["Prints a timestamp in the server’s time zone. Tokens: YYYY MM DD HH mm ss.", "Stampa un istante nel fuso del server. Segni: YYYY MM DD HH mm ss."],
242
+ example: ["{{ now | time('HH:mm') }}", "{{ now | time('HH:mm') }}"]
243
+ },
244
+ range: {
245
+ description: ["The integers up to stop, or from start to stop by step. At most 1000 items.", "Gli interi fino a stop, oppure da start a stop con step. Al massimo 1000 elementi."],
246
+ example: ["{% for i in range(3) %}{{ i }}{% endfor %}", "{% for i in range(3) %}{{ i }}{% endfor %}"]
247
+ },
248
+ now: {
249
+ description: ["The hub clock. A bare now prints ISO; time prints a pattern.", "L’orologio dell’hub. now da solo stampa ISO; time stampa un formato."],
250
+ example: ["{{ now | time('HH:mm') }}", "{{ now | time('HH:mm') }}"]
251
+ },
252
+ camera: {
253
+ description: ["The device this text is written for. It stays correct when the text is copied to another camera.", "Il dispositivo per cui è scritto il testo. Resta corretto se il testo viene copiato su un’altra telecamera."],
254
+ example: ["{{ camera.temperature }}", "{{ camera.temperature }}"]
255
+ },
256
+ loop: {
257
+ description: ["The for-loop counter (index, length) inside {% for %}.", "Il contatore del ciclo (index, length) dentro {% for %}."],
258
+ example: ["{% for i in range(3) %}{{ loop.index }}{% endfor %}", "{% for i in range(3) %}{{ loop.index }}{% endfor %}"]
259
+ },
260
+ lastPerson: {
261
+ description: ["The last person recognised on this camera, empty until there is one.", "L’ultima persona riconosciuta su questa telecamera, vuota finché non ce n’è una."],
262
+ example: ["{{ camera.lastPerson }}", "{{ camera.lastPerson }}"]
263
+ },
264
+ lastPlate: {
265
+ description: ["The last plate recognised on this camera, empty until there is one.", "L’ultima targa riconosciuta su questa telecamera, vuota finché non ce n’è una."],
266
+ example: ["{{ camera.lastPlate }}", "{{ camera.lastPlate }}"]
267
+ }
268
+ };
269
+ function buildText() {
270
+ const out = {};
271
+ for (const item of DEVICE_TEMPLATE_CATALOGUE) {
272
+ const row = COPY[item.name];
273
+ if (row === void 0) continue;
274
+ out[item.descriptionKey] = {
275
+ en: row.description[0],
276
+ it: row.description[1]
277
+ };
278
+ out[item.exampleKey] = {
279
+ en: row.example[0],
280
+ it: row.example[1]
281
+ };
282
+ }
283
+ return out;
284
+ }
285
+ /** English and Italian for every description and example key. */
286
+ var DEVICE_TEMPLATE_CATALOGUE_TEXT = buildText();
287
+ /** Names a template may use after `|`. Order matches the catalogue. */
288
+ function deviceTemplateFilterNames() {
289
+ return DEVICE_TEMPLATE_CATALOGUE.filter((item) => item.kind === "filter").map((item) => item.name);
290
+ }
291
+ /**
292
+ * How many arguments a filter may take after its input. Derived from the
293
+ * catalogue's parameter list — the grammar refuses anything past this.
294
+ */
295
+ function deviceTemplateFilterMaxParams() {
296
+ const out = {};
297
+ for (const item of DEVICE_TEMPLATE_CATALOGUE) {
298
+ if (item.kind !== "filter") continue;
299
+ out[item.name] = item.params.length;
300
+ }
301
+ return out;
302
+ }
303
+ /** Globals a template may call, with how many numbers each takes. */
304
+ function deviceTemplateCallableBounds() {
305
+ return DEVICE_TEMPLATE_CATALOGUE.filter((item) => item.kind === "global").map((item) => ({
306
+ name: item.name,
307
+ min: Math.max(1, item.params.filter((p) => !p.optional).length),
308
+ max: item.params.length
309
+ }));
310
+ }
311
+ var ROOT_VARIABLES = new Set([
312
+ "now",
313
+ "camera",
314
+ "loop"
315
+ ]);
316
+ /** Names offered at the start of `{{ }}`: the clock, the for-loop, and `camera` when the field has a device. */
317
+ function deviceTemplateRootVariables() {
318
+ return DEVICE_TEMPLATE_CATALOGUE.filter((item) => item.kind === "variable" && ROOT_VARIABLES.has(item.name));
319
+ }
320
+ /** Values the caller stores on `camera` (`lastPerson`, `lastPlate`), not device fields. */
321
+ function deviceTemplateCameraValues() {
322
+ return DEVICE_TEMPLATE_CATALOGUE.filter((item) => item.kind === "variable" && !ROOT_VARIABLES.has(item.name));
323
+ }
324
+ function deviceTemplateSignature(item) {
325
+ if (item.kind === "variable") return item.name;
326
+ const args = item.params.map((p) => p.optional ? `${p.name}?` : p.name).join(", ");
327
+ return `${item.name}(${args})`;
328
+ }
329
+ /** The operator-facing English (or Italian) sentence for a catalogue key. */
330
+ function deviceTemplateCatalogueSentence(key, language) {
331
+ return DEVICE_TEMPLATE_CATALOGUE_TEXT[key]?.[language];
332
+ }
333
+ /** A markdown table of the catalogue, for the public docs page. */
334
+ function deviceTemplateCatalogueMarkdown() {
335
+ const header = ["| Name | Kind | What it does | Example |", "| --- | --- | --- | --- |"];
336
+ const rows = DEVICE_TEMPLATE_CATALOGUE.map((item) => {
337
+ const description = escapeCell(deviceTemplateCatalogueSentence(item.descriptionKey, "en") ?? "");
338
+ const example = escapeCell(deviceTemplateCatalogueSentence(item.exampleKey, "en") ?? "");
339
+ return `| \`${deviceTemplateSignature(item)}\` | ${item.kind} | ${description} | \`${example}\` |`;
340
+ });
341
+ return [...header, ...rows].join("\n");
342
+ }
343
+ function escapeCell(text) {
344
+ return text.replaceAll("|", "\\|");
345
+ }
346
+ //#endregion
347
+ exports.DEVICE_TEMPLATE_CATALOGUE = DEVICE_TEMPLATE_CATALOGUE;
348
+ exports.DEVICE_TEMPLATE_CATALOGUE_CATEGORIES = DEVICE_TEMPLATE_CATALOGUE_CATEGORIES;
349
+ exports.DEVICE_TEMPLATE_CATALOGUE_KINDS = DEVICE_TEMPLATE_CATALOGUE_KINDS;
350
+ exports.DEVICE_TEMPLATE_CATALOGUE_TEXT = DEVICE_TEMPLATE_CATALOGUE_TEXT;
351
+ exports.DEVICE_TEMPLATE_PARAM_TYPES = DEVICE_TEMPLATE_PARAM_TYPES;
352
+ exports.deviceTemplateCallableBounds = deviceTemplateCallableBounds;
353
+ exports.deviceTemplateCameraValues = deviceTemplateCameraValues;
354
+ exports.deviceTemplateCatalogueEntrySchema = deviceTemplateCatalogueEntrySchema;
355
+ exports.deviceTemplateCatalogueMarkdown = deviceTemplateCatalogueMarkdown;
356
+ exports.deviceTemplateCatalogueSentence = deviceTemplateCatalogueSentence;
357
+ exports.deviceTemplateFilterMaxParams = deviceTemplateFilterMaxParams;
358
+ exports.deviceTemplateFilterNames = deviceTemplateFilterNames;
359
+ exports.deviceTemplateParamSchema = deviceTemplateParamSchema;
360
+ exports.deviceTemplateRootVariables = deviceTemplateRootVariables;
361
+ exports.deviceTemplateSignature = deviceTemplateSignature;