@camstack/types 1.2.576 → 1.2.578
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/CHANGELOG.md +12 -0
- package/dist/capabilities/air-quality-sensor.cap.d.ts +2 -0
- package/dist/capabilities/capability-definition.d.ts +22 -0
- package/dist/capabilities/climate-control.cap.d.ts +6 -0
- package/dist/capabilities/energy-system.cap.d.ts +7 -0
- package/dist/capabilities/heat-pump-status.cap.d.ts +4 -0
- package/dist/capabilities/humidity-sensor.cap.d.ts +2 -0
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/power-meter.cap.d.ts +2 -0
- package/dist/capabilities/stream-params.cap.d.ts +4 -0
- package/dist/capabilities/temperature-sensor.cap.d.ts +2 -0
- package/dist/capabilities/water-heater.cap.d.ts +2 -0
- package/dist/capabilities/weather-station.cap.d.ts +10 -0
- package/dist/device-template-catalogue.d.ts +39 -0
- package/dist/device-template-catalogue.js +135 -6
- package/dist/device-template-catalogue.mjs +134 -7
- package/dist/generated/history-catalog.d.ts +6 -1
- package/dist/history/primary-series.d.ts +10 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +405 -264
- package/dist/index.mjs +402 -266
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.578] - 2026-11-15
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Device template functions declare typed value sources (units of the piped field, choices, ranges) for their parameters
|
|
15
|
+
|
|
16
|
+
## [1.2.577] - 2026-11-15
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Capability history declares which fields share a chart (group) and which series a device card trends (primary, priority)
|
|
21
|
+
|
|
10
22
|
## [1.2.576] - 2026-11-15
|
|
11
23
|
|
|
12
24
|
### Changed
|
|
@@ -68,11 +68,13 @@ export declare const airQualitySensorCapability: {
|
|
|
68
68
|
readonly deadband: 5;
|
|
69
69
|
};
|
|
70
70
|
readonly pm25: {
|
|
71
|
+
readonly group: 'particulates';
|
|
71
72
|
readonly kind: 'gauge';
|
|
72
73
|
readonly unit: 'µg/m³';
|
|
73
74
|
readonly deadband: 1;
|
|
74
75
|
};
|
|
75
76
|
readonly pm10: {
|
|
77
|
+
readonly group: 'particulates';
|
|
76
78
|
readonly kind: 'gauge';
|
|
77
79
|
readonly unit: 'µg/m³';
|
|
78
80
|
readonly deadband: 1;
|
|
@@ -461,6 +461,15 @@ export interface CapabilityHistoryField {
|
|
|
461
461
|
*/
|
|
462
462
|
readonly unitFrom?: string;
|
|
463
463
|
readonly displayName?: string;
|
|
464
|
+
/**
|
|
465
|
+
* Fields of ONE cap that name the same group share a History chart; a field
|
|
466
|
+
* with no group gets a chart of its own. Only closely related GAUGES belong
|
|
467
|
+
* together (the five `powerW` of an energy system), so the members must share
|
|
468
|
+
* a unit dimension. A counter is always its own per-period bar chart and takes
|
|
469
|
+
* no group; neither does a state, nor a field of a keyed `items` array. Judged
|
|
470
|
+
* by `scripts/check-cap-history-declared.ts`.
|
|
471
|
+
*/
|
|
472
|
+
readonly group?: string;
|
|
464
473
|
/** Drop a change smaller than this (ABSOLUTE) — anti-jitter for noisy gauges. */
|
|
465
474
|
readonly deadband?: number;
|
|
466
475
|
/**
|
|
@@ -523,7 +532,20 @@ export declare function historyItemFieldPath(itemsPath: string, field: string):
|
|
|
523
532
|
export type CapabilityHistory = 'none' | {
|
|
524
533
|
readonly fields: Readonly<Record<string, CapabilityHistoryField>>;
|
|
525
534
|
readonly items?: CapabilityHistoryItems;
|
|
535
|
+
/**
|
|
536
|
+
* The field a device card trends: a numeric `fields` key. Declared with
|
|
537
|
+
* {@link priority}; the card shows the primary of the ENABLED cap with the
|
|
538
|
+
* highest priority that has data on the device.
|
|
539
|
+
*/
|
|
540
|
+
readonly primary?: string;
|
|
541
|
+
/** Higher wins between the caps of one device; required with `primary`. */
|
|
542
|
+
readonly priority?: number;
|
|
526
543
|
};
|
|
544
|
+
/** A cap's declared card series: a numeric history field and its rank between caps. */
|
|
545
|
+
export interface CapabilityHistoryPrimary {
|
|
546
|
+
readonly field: string;
|
|
547
|
+
readonly priority: number;
|
|
548
|
+
}
|
|
527
549
|
/** Capture floor (ms) applied to `gauge` / `counter` series when a field states none. */
|
|
528
550
|
export declare const HISTORY_DEFAULT_MIN_INTERVAL_MS = 10000;
|
|
529
551
|
/**
|
|
@@ -311,8 +311,11 @@ export declare const climateControlCapability: {
|
|
|
311
311
|
* History (D850): recorded series. Celsius by contract; setpoints keep every change (`minIntervalMs: 0`).
|
|
312
312
|
*/
|
|
313
313
|
readonly history: {
|
|
314
|
+
readonly primary: 'currentTemp';
|
|
315
|
+
readonly priority: 70;
|
|
314
316
|
readonly fields: {
|
|
315
317
|
readonly currentTemp: {
|
|
318
|
+
readonly group: 'temperature';
|
|
316
319
|
readonly kind: 'gauge';
|
|
317
320
|
readonly unit: '°C';
|
|
318
321
|
readonly deadband: 0.1;
|
|
@@ -323,16 +326,19 @@ export declare const climateControlCapability: {
|
|
|
323
326
|
readonly deadband: 0.5;
|
|
324
327
|
};
|
|
325
328
|
readonly target: {
|
|
329
|
+
readonly group: 'temperature';
|
|
326
330
|
readonly kind: 'gauge';
|
|
327
331
|
readonly unit: '°C';
|
|
328
332
|
readonly minIntervalMs: 0;
|
|
329
333
|
};
|
|
330
334
|
readonly targetHigh: {
|
|
335
|
+
readonly group: 'target-range';
|
|
331
336
|
readonly kind: 'gauge';
|
|
332
337
|
readonly unit: '°C';
|
|
333
338
|
readonly minIntervalMs: 0;
|
|
334
339
|
};
|
|
335
340
|
readonly targetLow: {
|
|
341
|
+
readonly group: 'target-range';
|
|
336
342
|
readonly kind: 'gauge';
|
|
337
343
|
readonly unit: '°C';
|
|
338
344
|
readonly minIntervalMs: 0;
|
|
@@ -200,8 +200,11 @@ export declare const energySystemCapability: {
|
|
|
200
200
|
* counters' difference over the day.
|
|
201
201
|
*/
|
|
202
202
|
readonly history: {
|
|
203
|
+
readonly primary: 'house.powerW';
|
|
204
|
+
readonly priority: 50;
|
|
203
205
|
readonly fields: {
|
|
204
206
|
readonly 'solar.powerW': {
|
|
207
|
+
readonly group: 'power-flow';
|
|
205
208
|
readonly kind: 'gauge';
|
|
206
209
|
readonly unit: 'W';
|
|
207
210
|
readonly deadband: 50;
|
|
@@ -213,6 +216,7 @@ export declare const energySystemCapability: {
|
|
|
213
216
|
readonly displayName: 'Solar energy';
|
|
214
217
|
};
|
|
215
218
|
readonly 'grid.powerW': {
|
|
219
|
+
readonly group: 'power-flow';
|
|
216
220
|
readonly kind: 'gauge';
|
|
217
221
|
readonly unit: 'W';
|
|
218
222
|
readonly deadband: 50;
|
|
@@ -229,6 +233,7 @@ export declare const energySystemCapability: {
|
|
|
229
233
|
readonly displayName: 'Grid export';
|
|
230
234
|
};
|
|
231
235
|
readonly 'house.powerW': {
|
|
236
|
+
readonly group: 'power-flow';
|
|
232
237
|
readonly kind: 'gauge';
|
|
233
238
|
readonly unit: 'W';
|
|
234
239
|
readonly deadband: 50;
|
|
@@ -240,6 +245,7 @@ export declare const energySystemCapability: {
|
|
|
240
245
|
readonly displayName: 'House energy';
|
|
241
246
|
};
|
|
242
247
|
readonly 'heatPump.powerW': {
|
|
248
|
+
readonly group: 'power-flow';
|
|
243
249
|
readonly kind: 'gauge';
|
|
244
250
|
readonly unit: 'W';
|
|
245
251
|
readonly deadband: 50;
|
|
@@ -263,6 +269,7 @@ export declare const energySystemCapability: {
|
|
|
263
269
|
readonly displayName: 'Stored energy';
|
|
264
270
|
};
|
|
265
271
|
readonly 'storage.powerW': {
|
|
272
|
+
readonly group: 'power-flow';
|
|
266
273
|
readonly kind: 'gauge';
|
|
267
274
|
readonly unit: 'W';
|
|
268
275
|
readonly deadband: 50;
|
|
@@ -442,12 +442,14 @@ export declare const heatPumpStatusCapability: {
|
|
|
442
442
|
readonly history: {
|
|
443
443
|
readonly fields: {
|
|
444
444
|
readonly 'power.thermalW': {
|
|
445
|
+
readonly group: 'power';
|
|
445
446
|
readonly kind: 'gauge';
|
|
446
447
|
readonly unit: 'W';
|
|
447
448
|
readonly deadband: 50;
|
|
448
449
|
readonly displayName: 'Thermal power';
|
|
449
450
|
};
|
|
450
451
|
readonly 'power.electricalW': {
|
|
452
|
+
readonly group: 'power';
|
|
451
453
|
readonly kind: 'gauge';
|
|
452
454
|
readonly unit: 'W';
|
|
453
455
|
readonly deadband: 50;
|
|
@@ -460,12 +462,14 @@ export declare const heatPumpStatusCapability: {
|
|
|
460
462
|
readonly displayName: 'Compressor';
|
|
461
463
|
};
|
|
462
464
|
readonly 'temperatures.supply': {
|
|
465
|
+
readonly group: 'loop';
|
|
463
466
|
readonly kind: 'gauge';
|
|
464
467
|
readonly unit: '°C';
|
|
465
468
|
readonly deadband: 0.5;
|
|
466
469
|
readonly displayName: 'Supply';
|
|
467
470
|
};
|
|
468
471
|
readonly 'temperatures.return': {
|
|
472
|
+
readonly group: 'loop';
|
|
469
473
|
readonly kind: 'gauge';
|
|
470
474
|
readonly unit: '°C';
|
|
471
475
|
readonly deadband: 0.5;
|
|
@@ -36,7 +36,7 @@ export { BrokerGetStateInputSchema, BrokerPublishInputSchema, BrokerRegistryStat
|
|
|
36
36
|
export { cameraPipelineConfigCapability, type ICameraPipelineConfigProvider, } from './camera-pipeline-config.cap.js';
|
|
37
37
|
export { cameraStreamsCapability, type ICameraStreamsProvider, type PickedCamStream, PickedCamStreamSchema, type PickStreamPreferences, PickStreamPreferencesSchema, type PickStreamRequirements, PickStreamRequirementsSchema, type StreamCodec, StreamCodecSchema, } from './camera-streams.cap.js';
|
|
38
38
|
export { emitsCollectionSelector, extractNestedAddonId, isArrayOutputSchema, isCollectionArrayMethod, isObjectInput, isVoidInput, kebabToCamel, looseSchema, objectInputDeclaresAddonId, objectInputDeclaresRequiredDeviceId, procedureAuthKey, resolveMethodAuth, } from './cap-router-predicates.js';
|
|
39
|
-
export type { CapabilityDefinition, CapabilityEventSchema, CapabilityMethodAuth, CapabilityMethodCaller, CapabilityMethodKind, CapabilityMethodOptions, CapabilityMethodSchema, CapabilityMountHint, CapabilityMountKind, CapabilityStatusItemArray, CapabilityStatusKind, CapabilityStatusSchema, CapCaller, DeviceConfigDerivedFormUi, DeviceConfigSpec, DeviceConfigUiSpec, DeviceConfigWidgetUi, DeviceSettingsContribution, InferDeviceProxyCap, InferEvents, InferName, InferNativeProvider, InferProvider, InferRuntimeState, CapabilityHistory, CapabilityHistoryField, CapabilityPowerHint, PowerHintField, PowerHintMethods, PowerHintMode, CapabilityHistoryItems, HistoryUnit, ProviderKind, RuntimeStateDurability, UiContribution, UiContributionKind, UiContributionRemote, } from './capability-definition.js';
|
|
39
|
+
export type { CapabilityDefinition, CapabilityEventSchema, CapabilityMethodAuth, CapabilityMethodCaller, CapabilityMethodKind, CapabilityMethodOptions, CapabilityMethodSchema, CapabilityMountHint, CapabilityMountKind, CapabilityStatusItemArray, CapabilityStatusKind, CapabilityStatusSchema, CapCaller, DeviceConfigDerivedFormUi, DeviceConfigSpec, DeviceConfigUiSpec, DeviceConfigWidgetUi, DeviceSettingsContribution, InferDeviceProxyCap, InferEvents, InferName, InferNativeProvider, InferProvider, InferRuntimeState, CapabilityHistory, CapabilityHistoryField, CapabilityPowerHint, PowerHintField, PowerHintMethods, PowerHintMode, CapabilityHistoryItems, CapabilityHistoryPrimary, HistoryUnit, ProviderKind, RuntimeStateDurability, UiContribution, UiContributionKind, UiContributionRemote, } from './capability-definition.js';
|
|
40
40
|
export { DEFAULT_RUNTIME_STATE_DURABILITY, HISTORY_DEFAULT_MIN_INTERVAL_MS, HISTORY_UNIT_LABELS, historyItemFieldPath, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, event, expandCapMethods, isDeviceConfigCap, method, optionalMethod, PROVIDER_PIN_FIELD, resolveCapMount, } from './capability-definition.js';
|
|
41
41
|
export { COMPOSER_RUNNER_ID, type ComposerApplyInput, ComposerApplyInputSchema, type ComposerApplyResult, ComposerApplyResultSchema, type ComposerBlock, ComposerBlockSchema, type ComposerBlockVerdict, ComposerBlockVerdictSchema, type ComposerUnreadableBlock, ComposerUnreadableBlockSchema, composerCapability, type IComposerProvider, type UnreleasedClaim, UnreleasedClaimSchema, } from './composer.cap.js';
|
|
42
42
|
export { CORE_BLOCK_ADDON_PREFIX, CORE_BLOCKS_ADDON_ID, type CompositionBlockInput, CompositionBlockInputSchema, type CompositionBlockPatch, type CompositionCustomizationRead, CompositionCustomizationReadSchema, type CompositionGetRead, CompositionGetReadSchema, type CompositionListRead, CompositionListReadSchema, type CompositionStateRead, CompositionStateReadSchema, type CompositionView, CompositionViewSchema, type CoreBlock, type CoreBlockCompileInput, CoreBlockCompileInputSchema, type CoreBlockCompileResult, CoreBlockCompileResultSchema, type CoreBlockFiles, CoreBlockFilesSchema, type CoreBlockInput, CoreBlockInputFieldsSchema, CoreBlockInputSchema, type CoreBlockPlacement, CoreBlockPlacementSchema, CoreBlockSchema, type CoreBlockSource, type CoreBlockSourceKind, CoreBlockSourceSchema, type CoreBlockStatus, CoreBlockStatusSchema, coreBlockAddonId, coreBlockComposition, coreBlockIdFromAddonId, coreBlockSourceKind, coreBlocksCapability, DEFAULT_CORE_BLOCK_ENTRY, type ICoreBlocksProvider, normalizeCoreBlockWrite, resolveCoreBlockEntry, resolveCoreBlockFiles, } from './core-blocks.cap.js';
|
|
@@ -75,6 +75,8 @@ export declare const powerMeterCapability: {
|
|
|
75
75
|
* History (D850): recorded series. Gauges are floored at 30 s; `energy` is the one monotonic meter (counter).
|
|
76
76
|
*/
|
|
77
77
|
readonly history: {
|
|
78
|
+
readonly primary: 'power';
|
|
79
|
+
readonly priority: 80;
|
|
78
80
|
readonly fields: {
|
|
79
81
|
readonly power: {
|
|
80
82
|
readonly kind: 'gauge';
|
|
@@ -497,18 +497,22 @@ export declare const streamParamsCapability: {
|
|
|
497
497
|
readonly history: {
|
|
498
498
|
readonly fields: {
|
|
499
499
|
readonly 'main.bitrate': {
|
|
500
|
+
readonly group: 'bitrate';
|
|
500
501
|
readonly kind: 'gauge';
|
|
501
502
|
readonly unit: 'kbps';
|
|
502
503
|
};
|
|
503
504
|
readonly 'main.framerate': {
|
|
505
|
+
readonly group: 'framerate';
|
|
504
506
|
readonly kind: 'gauge';
|
|
505
507
|
readonly unit: 'fps';
|
|
506
508
|
};
|
|
507
509
|
readonly 'sub.bitrate': {
|
|
510
|
+
readonly group: 'bitrate';
|
|
508
511
|
readonly kind: 'gauge';
|
|
509
512
|
readonly unit: 'kbps';
|
|
510
513
|
};
|
|
511
514
|
readonly 'sub.framerate': {
|
|
515
|
+
readonly group: 'framerate';
|
|
512
516
|
readonly kind: 'gauge';
|
|
513
517
|
readonly unit: 'fps';
|
|
514
518
|
};
|
|
@@ -97,11 +97,13 @@ export declare const waterHeaterCapability: {
|
|
|
97
97
|
readonly history: {
|
|
98
98
|
readonly fields: {
|
|
99
99
|
readonly currentTemp: {
|
|
100
|
+
readonly group: 'temperature';
|
|
100
101
|
readonly kind: 'gauge';
|
|
101
102
|
readonly unit: '°C';
|
|
102
103
|
readonly deadband: 0.5;
|
|
103
104
|
};
|
|
104
105
|
readonly targetTemp: {
|
|
106
|
+
readonly group: 'temperature';
|
|
105
107
|
readonly kind: 'gauge';
|
|
106
108
|
readonly unit: '°C';
|
|
107
109
|
readonly minIntervalMs: 0;
|
|
@@ -122,8 +122,11 @@ export declare const weatherStationCapability: {
|
|
|
122
122
|
* levels, so `gauge`; `counter` is for a monotonic meter only.
|
|
123
123
|
*/
|
|
124
124
|
readonly history: {
|
|
125
|
+
readonly primary: 'temperature';
|
|
126
|
+
readonly priority: 60;
|
|
125
127
|
readonly fields: {
|
|
126
128
|
readonly temperature: {
|
|
129
|
+
readonly group: 'temperature';
|
|
127
130
|
readonly kind: 'gauge';
|
|
128
131
|
readonly unit: '°C';
|
|
129
132
|
readonly deadband: 0.1;
|
|
@@ -139,16 +142,19 @@ export declare const weatherStationCapability: {
|
|
|
139
142
|
readonly deadband: 0.2;
|
|
140
143
|
};
|
|
141
144
|
readonly windSpeed: {
|
|
145
|
+
readonly group: 'wind-speed';
|
|
142
146
|
readonly kind: 'gauge';
|
|
143
147
|
readonly unit: 'm/s';
|
|
144
148
|
readonly deadband: 0.2;
|
|
145
149
|
};
|
|
146
150
|
readonly windGust: {
|
|
151
|
+
readonly group: 'wind-speed';
|
|
147
152
|
readonly kind: 'gauge';
|
|
148
153
|
readonly unit: 'm/s';
|
|
149
154
|
readonly deadband: 0.2;
|
|
150
155
|
};
|
|
151
156
|
readonly windBearing: {
|
|
157
|
+
readonly group: 'wind-bearing';
|
|
152
158
|
readonly kind: 'gauge';
|
|
153
159
|
readonly unit: '°';
|
|
154
160
|
readonly deadband: 5;
|
|
@@ -179,11 +185,13 @@ export declare const weatherStationCapability: {
|
|
|
179
185
|
readonly deadband: 5;
|
|
180
186
|
};
|
|
181
187
|
readonly dewPoint: {
|
|
188
|
+
readonly group: 'temperature';
|
|
182
189
|
readonly kind: 'gauge';
|
|
183
190
|
readonly unit: '°C';
|
|
184
191
|
readonly deadband: 0.1;
|
|
185
192
|
};
|
|
186
193
|
readonly feelsLike: {
|
|
194
|
+
readonly group: 'temperature';
|
|
187
195
|
readonly kind: 'gauge';
|
|
188
196
|
readonly unit: '°C';
|
|
189
197
|
readonly deadband: 0.1;
|
|
@@ -194,11 +202,13 @@ export declare const weatherStationCapability: {
|
|
|
194
202
|
readonly deadband: 0.05;
|
|
195
203
|
};
|
|
196
204
|
readonly windGustMax: {
|
|
205
|
+
readonly group: 'wind-speed';
|
|
197
206
|
readonly kind: 'gauge';
|
|
198
207
|
readonly unit: 'm/s';
|
|
199
208
|
readonly deadband: 0.2;
|
|
200
209
|
};
|
|
201
210
|
readonly windBearingAvg: {
|
|
211
|
+
readonly group: 'wind-bearing';
|
|
202
212
|
readonly kind: 'gauge';
|
|
203
213
|
readonly unit: '°';
|
|
204
214
|
readonly deadband: 5;
|
|
@@ -15,11 +15,34 @@ export declare const DEVICE_TEMPLATE_CATALOGUE_CATEGORIES: readonly ['number', '
|
|
|
15
15
|
export type DeviceTemplateCatalogueCategory = (typeof DEVICE_TEMPLATE_CATALOGUE_CATEGORIES)[number];
|
|
16
16
|
export declare const DEVICE_TEMPLATE_PARAM_TYPES: readonly ['string', 'number', 'boolean'];
|
|
17
17
|
export type DeviceTemplateParamType = (typeof DEVICE_TEMPLATE_PARAM_TYPES)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Where the values a parameter takes come from, when a fixed set makes sense.
|
|
20
|
+
* `units-of-field` is the units in the dimension of the piped field's unit;
|
|
21
|
+
* `choices` is a named list (a time pattern); `range` is the numbers
|
|
22
|
+
* `min…max` by `step`. An absent source means free input.
|
|
23
|
+
*/
|
|
24
|
+
declare const deviceTemplateParamValuesSchemaValue: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
|
+
kind: z.ZodLiteral<"units-of-field">;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
kind: z.ZodLiteral<"choices">;
|
|
28
|
+
options: z.ZodArray<z.ZodObject<{
|
|
29
|
+
value: z.ZodString;
|
|
30
|
+
labelKey: z.ZodString;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
kind: z.ZodLiteral<"range">;
|
|
34
|
+
min: z.ZodNumber;
|
|
35
|
+
max: z.ZodNumber;
|
|
36
|
+
step: z.ZodNumber;
|
|
37
|
+
}, z.core.$strip>], "kind">;
|
|
38
|
+
export type DeviceTemplateParamValues = z.infer<typeof deviceTemplateParamValuesSchemaValue>;
|
|
39
|
+
export declare const deviceTemplateParamValuesSchema: z.ZodType<DeviceTemplateParamValues>;
|
|
18
40
|
declare const deviceTemplateParamSchemaValue: z.ZodType<{
|
|
19
41
|
name: string;
|
|
20
42
|
type: DeviceTemplateParamType;
|
|
21
43
|
optional: boolean;
|
|
22
44
|
default?: string | number | boolean;
|
|
45
|
+
values?: DeviceTemplateParamValues;
|
|
23
46
|
}>;
|
|
24
47
|
export type DeviceTemplateParam = z.infer<typeof deviceTemplateParamSchemaValue>;
|
|
25
48
|
export declare const deviceTemplateParamSchema: z.ZodType<DeviceTemplateParam>;
|
|
@@ -64,4 +87,20 @@ export declare function deviceTemplateSignature(item: DeviceTemplateCatalogueEnt
|
|
|
64
87
|
export declare function deviceTemplateCatalogueSentence(key: string, language: 'en' | 'it'): string | undefined;
|
|
65
88
|
/** A markdown table of the catalogue, for the public docs page. */
|
|
66
89
|
export declare function deviceTemplateCatalogueMarkdown(): string;
|
|
90
|
+
/** One selectable value of a parameter: the literal to write, and its label key when it has one. */
|
|
91
|
+
export interface DeviceTemplateParamChoice {
|
|
92
|
+
readonly value: string;
|
|
93
|
+
readonly labelKey?: string;
|
|
94
|
+
}
|
|
95
|
+
/** Choices under one heading (a unit dimension); `group` is null when there is a single list. */
|
|
96
|
+
export interface DeviceTemplateParamChoiceGroup {
|
|
97
|
+
readonly group: string | null;
|
|
98
|
+
readonly choices: readonly DeviceTemplateParamChoice[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The values a parameter offers. `fieldUnit` is the unit of the piped field:
|
|
102
|
+
* `units-of-field` narrows to its dimension, and lists every unit grouped by
|
|
103
|
+
* dimension when the unit is unknown. Empty when the parameter is free input.
|
|
104
|
+
*/
|
|
105
|
+
export declare function deviceTemplateParamChoices(source: DeviceTemplateParamValues | undefined, fieldUnit?: string): readonly DeviceTemplateParamChoiceGroup[];
|
|
67
106
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_convert = require("./convert-BI8iTXn6.js");
|
|
2
3
|
let zod = require("zod");
|
|
3
4
|
//#region src/device-template-catalogue.ts
|
|
4
5
|
/**
|
|
@@ -31,6 +32,29 @@ var DEVICE_TEMPLATE_PARAM_TYPES = [
|
|
|
31
32
|
"number",
|
|
32
33
|
"boolean"
|
|
33
34
|
];
|
|
35
|
+
/**
|
|
36
|
+
* Where the values a parameter takes come from, when a fixed set makes sense.
|
|
37
|
+
* `units-of-field` is the units in the dimension of the piped field's unit;
|
|
38
|
+
* `choices` is a named list (a time pattern); `range` is the numbers
|
|
39
|
+
* `min…max` by `step`. An absent source means free input.
|
|
40
|
+
*/
|
|
41
|
+
var deviceTemplateParamValuesSchemaValue = zod.z.discriminatedUnion("kind", [
|
|
42
|
+
zod.z.object({ kind: zod.z.literal("units-of-field") }),
|
|
43
|
+
zod.z.object({
|
|
44
|
+
kind: zod.z.literal("choices"),
|
|
45
|
+
options: zod.z.array(zod.z.object({
|
|
46
|
+
value: zod.z.string(),
|
|
47
|
+
labelKey: zod.z.string().min(1)
|
|
48
|
+
})).min(1)
|
|
49
|
+
}),
|
|
50
|
+
zod.z.object({
|
|
51
|
+
kind: zod.z.literal("range"),
|
|
52
|
+
min: zod.z.number(),
|
|
53
|
+
max: zod.z.number(),
|
|
54
|
+
step: zod.z.number().positive()
|
|
55
|
+
})
|
|
56
|
+
]);
|
|
57
|
+
var deviceTemplateParamValuesSchema = deviceTemplateParamValuesSchemaValue;
|
|
34
58
|
var deviceTemplateParamSchema = zod.z.object({
|
|
35
59
|
name: zod.z.string().min(1),
|
|
36
60
|
type: zod.z.enum(DEVICE_TEMPLATE_PARAM_TYPES),
|
|
@@ -39,7 +63,8 @@ var deviceTemplateParamSchema = zod.z.object({
|
|
|
39
63
|
zod.z.string(),
|
|
40
64
|
zod.z.number(),
|
|
41
65
|
zod.z.boolean()
|
|
42
|
-
]).optional()
|
|
66
|
+
]).optional(),
|
|
67
|
+
values: deviceTemplateParamValuesSchemaValue.optional()
|
|
43
68
|
});
|
|
44
69
|
var deviceTemplateCatalogueEntrySchema = zod.z.object({
|
|
45
70
|
name: zod.z.string().min(1),
|
|
@@ -49,8 +74,8 @@ var deviceTemplateCatalogueEntrySchema = zod.z.object({
|
|
|
49
74
|
descriptionKey: zod.z.string().min(1),
|
|
50
75
|
exampleKey: zod.z.string().min(1)
|
|
51
76
|
});
|
|
52
|
-
function param(name, type, optional, fallback) {
|
|
53
|
-
|
|
77
|
+
function param(name, type, optional, fallback, values) {
|
|
78
|
+
const base = fallback === void 0 ? {
|
|
54
79
|
name,
|
|
55
80
|
type,
|
|
56
81
|
optional
|
|
@@ -60,6 +85,10 @@ function param(name, type, optional, fallback) {
|
|
|
60
85
|
optional,
|
|
61
86
|
default: fallback
|
|
62
87
|
};
|
|
88
|
+
return values === void 0 ? base : {
|
|
89
|
+
...base,
|
|
90
|
+
values
|
|
91
|
+
};
|
|
63
92
|
}
|
|
64
93
|
function entry(name, kind, category, params) {
|
|
65
94
|
return {
|
|
@@ -71,12 +100,71 @@ function entry(name, kind, category, params) {
|
|
|
71
100
|
exampleKey: `uiLibrary.deviceTemplateCatalogue.${name}.example`
|
|
72
101
|
};
|
|
73
102
|
}
|
|
74
|
-
var DIGITS = param("digits", "number", true, 0
|
|
103
|
+
var DIGITS = param("digits", "number", true, 0, {
|
|
104
|
+
kind: "range",
|
|
105
|
+
min: 0,
|
|
106
|
+
max: 4,
|
|
107
|
+
step: 1
|
|
108
|
+
});
|
|
109
|
+
var UNITS_OF_FIELD = { kind: "units-of-field" };
|
|
110
|
+
/** Named time patterns: the engine's tokens are `YYYY MM DD HH mm ss`. */
|
|
111
|
+
var TIME_PATTERNS = [
|
|
112
|
+
[
|
|
113
|
+
"hm",
|
|
114
|
+
"HH:mm",
|
|
115
|
+
"Hours and minutes (14:05)",
|
|
116
|
+
"Ore e minuti (14:05)"
|
|
117
|
+
],
|
|
118
|
+
[
|
|
119
|
+
"hms",
|
|
120
|
+
"HH:mm:ss",
|
|
121
|
+
"Hours, minutes, seconds (14:05:09)",
|
|
122
|
+
"Ore, minuti, secondi (14:05:09)"
|
|
123
|
+
],
|
|
124
|
+
[
|
|
125
|
+
"dm",
|
|
126
|
+
"DD/MM",
|
|
127
|
+
"Day and month (31/12)",
|
|
128
|
+
"Giorno e mese (31/12)"
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
"dmy",
|
|
132
|
+
"DD/MM/YYYY",
|
|
133
|
+
"Day, month, year (31/12/2026)",
|
|
134
|
+
"Giorno, mese, anno (31/12/2026)"
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"dmyhm",
|
|
138
|
+
"DD/MM/YYYY HH:mm",
|
|
139
|
+
"Date and time (31/12/2026 14:05)",
|
|
140
|
+
"Data e ora (31/12/2026 14:05)"
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
"iso",
|
|
144
|
+
"YYYY-MM-DD",
|
|
145
|
+
"ISO date (2026-12-31)",
|
|
146
|
+
"Data ISO (2026-12-31)"
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
"isohms",
|
|
150
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
151
|
+
"ISO date and time (2026-12-31 14:05:09)",
|
|
152
|
+
"Data e ora ISO (2026-12-31 14:05:09)"
|
|
153
|
+
]
|
|
154
|
+
];
|
|
155
|
+
var TIME_PATTERN_KEY = (id) => `uiLibrary.deviceTemplateCatalogue.choice.time.${id}`;
|
|
156
|
+
var TIME_PATTERN_VALUES = {
|
|
157
|
+
kind: "choices",
|
|
158
|
+
options: TIME_PATTERNS.map(([id, pattern]) => ({
|
|
159
|
+
value: pattern,
|
|
160
|
+
labelKey: TIME_PATTERN_KEY(id)
|
|
161
|
+
}))
|
|
162
|
+
};
|
|
75
163
|
var FALLBACK_TEXT = param("fallback", "string", false);
|
|
76
164
|
var FALSY = param("falsy", "boolean", true, false);
|
|
77
165
|
/** Every name the engine allows, in the order operators meet them. */
|
|
78
166
|
var DEVICE_TEMPLATE_CATALOGUE = [
|
|
79
|
-
entry("unit", "filter", "unit", [param("symbol", "string", false), param("from", "string", true)]),
|
|
167
|
+
entry("unit", "filter", "unit", [param("symbol", "string", false, void 0, UNITS_OF_FIELD), param("from", "string", true, void 0, UNITS_OF_FIELD)]),
|
|
80
168
|
entry("round", "filter", "number", [DIGITS]),
|
|
81
169
|
entry("trunc", "filter", "number", [DIGITS]),
|
|
82
170
|
entry("onoff", "filter", "state", []),
|
|
@@ -112,7 +200,7 @@ var DEVICE_TEMPLATE_CATALOGUE = [
|
|
|
112
200
|
param("killwords", "boolean", true, false),
|
|
113
201
|
param("end", "string", true, "…")
|
|
114
202
|
]),
|
|
115
|
-
entry("time", "filter", "time", [param("pattern", "string", false)]),
|
|
203
|
+
entry("time", "filter", "time", [param("pattern", "string", false, void 0, TIME_PATTERN_VALUES)]),
|
|
116
204
|
entry("range", "global", "loop", [
|
|
117
205
|
param("stop", "number", false),
|
|
118
206
|
param("start", "number", true, 0),
|
|
@@ -280,6 +368,10 @@ function buildText() {
|
|
|
280
368
|
it: row.example[1]
|
|
281
369
|
};
|
|
282
370
|
}
|
|
371
|
+
for (const [id, , en, it] of TIME_PATTERNS) out[TIME_PATTERN_KEY(id)] = {
|
|
372
|
+
en,
|
|
373
|
+
it
|
|
374
|
+
};
|
|
283
375
|
return out;
|
|
284
376
|
}
|
|
285
377
|
/** English and Italian for every description and example key. */
|
|
@@ -343,6 +435,41 @@ function deviceTemplateCatalogueMarkdown() {
|
|
|
343
435
|
function escapeCell(text) {
|
|
344
436
|
return text.replaceAll("|", "\\|");
|
|
345
437
|
}
|
|
438
|
+
function allUnitGroups() {
|
|
439
|
+
const dimensions = [];
|
|
440
|
+
for (const spec of Object.values(require_convert.UNIT_TABLE)) if (!dimensions.includes(spec.dimension)) dimensions.push(spec.dimension);
|
|
441
|
+
return dimensions.map((dimension) => ({
|
|
442
|
+
group: dimension,
|
|
443
|
+
choices: require_convert.unitsForDimension(dimension).map((value) => ({ value }))
|
|
444
|
+
}));
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* The values a parameter offers. `fieldUnit` is the unit of the piped field:
|
|
448
|
+
* `units-of-field` narrows to its dimension, and lists every unit grouped by
|
|
449
|
+
* dimension when the unit is unknown. Empty when the parameter is free input.
|
|
450
|
+
*/
|
|
451
|
+
function deviceTemplateParamChoices(source, fieldUnit) {
|
|
452
|
+
if (source === void 0) return [];
|
|
453
|
+
if (source.kind === "choices") return [{
|
|
454
|
+
group: null,
|
|
455
|
+
choices: source.options.map((o) => ({ ...o }))
|
|
456
|
+
}];
|
|
457
|
+
if (source.kind === "range") {
|
|
458
|
+
const out = [];
|
|
459
|
+
const steps = Math.floor((source.max - source.min) / source.step + 1e-9);
|
|
460
|
+
for (let i = 0; i <= steps; i += 1) out.push({ value: String(source.min + i * source.step) });
|
|
461
|
+
return [{
|
|
462
|
+
group: null,
|
|
463
|
+
choices: out
|
|
464
|
+
}];
|
|
465
|
+
}
|
|
466
|
+
const dimension = fieldUnit === void 0 ? void 0 : require_convert.unitDimension(fieldUnit);
|
|
467
|
+
if (dimension === void 0) return allUnitGroups();
|
|
468
|
+
return [{
|
|
469
|
+
group: dimension,
|
|
470
|
+
choices: require_convert.unitsForDimension(dimension).map((value) => ({ value }))
|
|
471
|
+
}];
|
|
472
|
+
}
|
|
346
473
|
//#endregion
|
|
347
474
|
exports.DEVICE_TEMPLATE_CATALOGUE = DEVICE_TEMPLATE_CATALOGUE;
|
|
348
475
|
exports.DEVICE_TEMPLATE_CATALOGUE_CATEGORIES = DEVICE_TEMPLATE_CATALOGUE_CATEGORIES;
|
|
@@ -356,6 +483,8 @@ exports.deviceTemplateCatalogueMarkdown = deviceTemplateCatalogueMarkdown;
|
|
|
356
483
|
exports.deviceTemplateCatalogueSentence = deviceTemplateCatalogueSentence;
|
|
357
484
|
exports.deviceTemplateFilterMaxParams = deviceTemplateFilterMaxParams;
|
|
358
485
|
exports.deviceTemplateFilterNames = deviceTemplateFilterNames;
|
|
486
|
+
exports.deviceTemplateParamChoices = deviceTemplateParamChoices;
|
|
359
487
|
exports.deviceTemplateParamSchema = deviceTemplateParamSchema;
|
|
488
|
+
exports.deviceTemplateParamValuesSchema = deviceTemplateParamValuesSchema;
|
|
360
489
|
exports.deviceTemplateRootVariables = deviceTemplateRootVariables;
|
|
361
490
|
exports.deviceTemplateSignature = deviceTemplateSignature;
|