@camstack/types 1.2.535 → 1.2.536

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.
@@ -8,12 +8,15 @@
8
8
  * 4. a trailing fact (power, else battery, else consumables).
9
9
  *
10
10
  * Selection rules, all taken from the model:
11
- * - ONE control is ever shown: the device's own power; else the FIRST control of
11
+ * - the primary control is the device's own power; else the FIRST control of
12
12
  * the FIRST row that has any (a later row's control is never promoted). When
13
13
  * the model lists that part in `gated`, the row has no inline control: the
14
14
  * projection never falls through to another control the caller could use.
15
+ * - a timed run, when the model carries the slot, sits beside that primary:
16
+ * Run while idle, Stop while armed. Gating the slot hides the control.
15
17
  * - the status line is the head (what plays, else the state) plus at most
16
- * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
18
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded, then the
19
+ * time left on an armed timed run;
17
20
  * - the trailing fact is the first of power, battery, consumables.
18
21
  *
19
22
  * `projectDeviceRow` is pure and computes nothing: it selects from a
@@ -22,6 +25,23 @@
22
25
  */
23
26
  import { z } from 'zod';
24
27
  import { type HeroModel } from './hero-model.js';
28
+ /**
29
+ * The row's timed-run control. `id` is `timed-run.run` while idle and
30
+ * `timed-run.cancel` while armed; `duration` and `unit` are the one-tap run
31
+ * a Run press starts.
32
+ */
33
+ export declare const HeroRowTimedRunSchema: z.ZodObject<{
34
+ id: z.ZodEnum<{
35
+ "timed-run.cancel": "timed-run.cancel";
36
+ "timed-run.run": "timed-run.run";
37
+ }>;
38
+ duration: z.ZodNumber;
39
+ unit: z.ZodEnum<{
40
+ min: "min";
41
+ s: "s";
42
+ }>;
43
+ }, z.core.$strip>;
44
+ export type HeroRowTimedRun = z.infer<typeof HeroRowTimedRunSchema>;
25
45
  export declare const HeroRowModelSchema: z.ZodObject<{
26
46
  deviceId: z.ZodNumber;
27
47
  name: z.ZodString;
@@ -241,6 +261,17 @@ export declare const HeroRowModelSchema: z.ZodObject<{
241
261
  }, z.core.$strip>;
242
262
  valueArg: z.ZodString;
243
263
  }, z.core.$strip>], "kind">>;
264
+ timedRun: z.ZodNullable<z.ZodObject<{
265
+ id: z.ZodEnum<{
266
+ "timed-run.cancel": "timed-run.cancel";
267
+ "timed-run.run": "timed-run.run";
268
+ }>;
269
+ duration: z.ZodNumber;
270
+ unit: z.ZodEnum<{
271
+ min: "min";
272
+ s: "s";
273
+ }>;
274
+ }, z.core.$strip>>;
244
275
  trailing: z.ZodNullable<z.ZodObject<{
245
276
  id: z.ZodEnum<{
246
277
  "air-quality": "air-quality";
@@ -30,27 +30,88 @@ export interface DeviceTemplateRef {
30
30
  readonly alias: string;
31
31
  readonly path: readonly (string | number)[];
32
32
  }
33
- export type DeviceTemplateRefusalReason = 'too-long' | 'syntax' | 'forbidden-syntax' | 'forbidden-member' | 'unknown-filter' | 'ambiguous-field' | 'busy' | 'budget-exceeded' | 'timeout' | 'output-too-large' | 'render-failed';
33
+ export declare const DEVICE_TEMPLATE_REFUSAL_REASONS: readonly ['too-long', 'syntax', 'forbidden-syntax', 'forbidden-member', 'unknown-filter', 'ambiguous-field', 'busy', 'budget-exceeded', 'timeout', 'output-too-large', 'render-failed',
34
+ /** The template names a device the caller was not proven to see (D1021 run-time contract). */
35
+ 'out-of-scope',
36
+ /** No renderer on this node, or the call to it failed: the template was not run. */
37
+ 'unavailable'];
38
+ export type DeviceTemplateRefusalReason = (typeof DEVICE_TEMPLATE_REFUSAL_REASONS)[number];
39
+ export declare const DeviceTemplateRefusalSchema: z.ZodObject<{
40
+ reason: z.ZodEnum<{
41
+ "ambiguous-field": "ambiguous-field";
42
+ "budget-exceeded": "budget-exceeded";
43
+ busy: "busy";
44
+ "forbidden-member": "forbidden-member";
45
+ "forbidden-syntax": "forbidden-syntax";
46
+ "out-of-scope": "out-of-scope";
47
+ "output-too-large": "output-too-large";
48
+ "render-failed": "render-failed";
49
+ syntax: "syntax";
50
+ timeout: "timeout";
51
+ "too-long": "too-long";
52
+ unavailable: "unavailable";
53
+ "unknown-filter": "unknown-filter";
54
+ }>;
55
+ message: z.ZodString;
56
+ }, z.core.$strip>;
34
57
  /** A template the engine will not run, or a render that did not finish — named, never a bare string. */
35
- export interface DeviceTemplateRefusal {
36
- readonly reason: DeviceTemplateRefusalReason;
37
- readonly message: string;
38
- }
39
- export type DeviceTemplateTraceReason = 'unknown-alias' | 'unknown-field' | 'no-field' | 'unavailable';
58
+ export type DeviceTemplateRefusal = z.infer<typeof DeviceTemplateRefusalSchema>;
59
+ export declare const DEVICE_TEMPLATE_TRACE_REASONS: readonly ['unknown-alias', 'unknown-field', 'no-field', 'unavailable'];
60
+ export type DeviceTemplateTraceReason = (typeof DEVICE_TEMPLATE_TRACE_REASONS)[number];
61
+ export declare const DeviceTemplateTraceEntrySchema: z.ZodObject<{
62
+ ref: z.ZodString;
63
+ reason: z.ZodEnum<{
64
+ "no-field": "no-field";
65
+ unavailable: "unavailable";
66
+ "unknown-alias": "unknown-alias";
67
+ "unknown-field": "unknown-field";
68
+ }>;
69
+ }, z.core.$strip>;
40
70
  /** One value that rendered as `—`, and why. */
41
- export interface DeviceTemplateTraceEntry {
42
- readonly ref: string;
43
- readonly reason: DeviceTemplateTraceReason;
44
- }
45
- export type DeviceTemplateRender = {
46
- readonly ok: true;
47
- readonly text: string;
48
- readonly trace: readonly DeviceTemplateTraceEntry[];
49
- } | {
50
- readonly ok: false;
51
- readonly refusal: DeviceTemplateRefusal;
52
- readonly trace: readonly DeviceTemplateTraceEntry[];
53
- };
71
+ export type DeviceTemplateTraceEntry = z.infer<typeof DeviceTemplateTraceEntrySchema>;
72
+ export declare const DeviceTemplateRenderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
73
+ ok: z.ZodLiteral<true>;
74
+ text: z.ZodString;
75
+ trace: z.ZodArray<z.ZodObject<{
76
+ ref: z.ZodString;
77
+ reason: z.ZodEnum<{
78
+ "no-field": "no-field";
79
+ unavailable: "unavailable";
80
+ "unknown-alias": "unknown-alias";
81
+ "unknown-field": "unknown-field";
82
+ }>;
83
+ }, z.core.$strip>>;
84
+ }, z.core.$strip>, z.ZodObject<{
85
+ ok: z.ZodLiteral<false>;
86
+ refusal: z.ZodObject<{
87
+ reason: z.ZodEnum<{
88
+ "ambiguous-field": "ambiguous-field";
89
+ "budget-exceeded": "budget-exceeded";
90
+ busy: "busy";
91
+ "forbidden-member": "forbidden-member";
92
+ "forbidden-syntax": "forbidden-syntax";
93
+ "out-of-scope": "out-of-scope";
94
+ "output-too-large": "output-too-large";
95
+ "render-failed": "render-failed";
96
+ syntax: "syntax";
97
+ timeout: "timeout";
98
+ "too-long": "too-long";
99
+ unavailable: "unavailable";
100
+ "unknown-filter": "unknown-filter";
101
+ }>;
102
+ message: z.ZodString;
103
+ }, z.core.$strip>;
104
+ trace: z.ZodArray<z.ZodObject<{
105
+ ref: z.ZodString;
106
+ reason: z.ZodEnum<{
107
+ "no-field": "no-field";
108
+ unavailable: "unavailable";
109
+ "unknown-alias": "unknown-alias";
110
+ "unknown-field": "unknown-field";
111
+ }>;
112
+ }, z.core.$strip>>;
113
+ }, z.core.$strip>], "ok">;
114
+ export type DeviceTemplateRender = z.infer<typeof DeviceTemplateRenderSchema>;
54
115
  /** What the renderer knows about one device when it resolves an alias. */
55
116
  export interface DeviceTemplateView {
56
117
  readonly deviceId: number;
@@ -2677,6 +2677,20 @@ export type AppRouter = TrpcCoreRouter<{
2677
2677
  output: z.infer<typeof deviceManagerCapability.methods.setAlias.output>;
2678
2678
  meta: object;
2679
2679
  }>;
2680
+ renderDeviceTemplates: TRPCQueryProcedure<{
2681
+ input: {
2682
+ [x: string]: unknown;
2683
+ } & z.input<typeof deviceManagerCapability.methods.renderDeviceTemplates.input>;
2684
+ output: z.infer<typeof deviceManagerCapability.methods.renderDeviceTemplates.output>;
2685
+ meta: object;
2686
+ }>;
2687
+ checkDeviceTemplates: TRPCQueryProcedure<{
2688
+ input: {
2689
+ [x: string]: unknown;
2690
+ } & z.input<typeof deviceManagerCapability.methods.checkDeviceTemplates.input>;
2691
+ output: z.infer<typeof deviceManagerCapability.methods.checkDeviceTemplates.output>;
2692
+ meta: object;
2693
+ }>;
2680
2694
  setLocation: TRPCMutationProcedure<{
2681
2695
  input: {
2682
2696
  [x: string]: unknown;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 1485 method paths across 205 capabilities.
9
+ * Coverage: 1487 method paths across 205 capabilities.
10
10
  */
11
11
  import type { MethodRole } from '../auth/viewer-access.js';
12
12
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
@@ -91,7 +91,7 @@ export interface SystemProxy {
91
91
  readonly deviceCredentials: Pick<InferProvider<typeof deviceCredentialsCapability>, 'listDeviceCredentials' | 'startEnrollment' | 'revokeDeviceCredential' | 'getDeviceCertificateSettings' | 'setDeviceCertificateSettings' | 'deleteDeviceCredential' | 'getDeviceCaStatus' | 'renameDeviceCredential'>;
92
92
  readonly deviceExport: Pick<InferProvider<typeof deviceExportCapability>, 'getStatus' | 'listInstances' | 'listSupportedDeviceKinds' | 'listExposedDevices' | 'exposeDevice' | 'unexposeDevice' | 'listSupportedEntityKinds' | 'listExposedEntities' | 'exposeEntity' | 'unexposeEntity'>;
93
93
  readonly deviceHistory: Pick<InferProvider<typeof deviceHistoryCapability>, 'listNodeSeries' | 'queryNode' | 'queryMany' | 'declareSeries' | 'record' | 'recordBuckets' | 'getStatus' | 'listOrphanSeries' | 'deleteOrphanSeries'>;
94
- readonly deviceManager: Pick<InferProvider<typeof deviceManagerCapability>, 'allocateDeviceId' | 'migrateDevice' | 'registerDevice' | 'removeDevice' | 'persistConfig' | 'getRoleDisplayDefaults' | 'setRoleDisplayDefaults' | 'listLocations' | 'addLocation' | 'removeLocation' | 'renameLocation' | 'listLocationIcons' | 'setLocationIcon' | 'listLocationDescriptions' | 'setLocationDescription' | 'listSiteZones' | 'setSiteZone' | 'removeSiteZone' | 'renameSiteZone' | 'setLocationZone' | 'listPersistedByAddon' | 'listAll' | 'getChildren' | 'getChildrenBatch' | 'getLinkedDevicesBatch' | 'listDeletedSince' | 'cleanupDeletedDevicesData' | 'removeByIntegration' | 'getBindingsBatch' | 'getAllBindings' | 'listDeviceIdsByCaps' | 'listWrappersForCap' | 'listBindableCapsForDeviceType' | 'discoverDevices' | 'adoptDevice' | 'getCreationSchema' | 'createDevice' | 'testCreationField' | 'adoptionListCandidateFilters' | 'adoptionListCandidates' | 'adoptionRefresh' | 'adoptionAdopt' | 'adoptionRelease' | 'adoptionStartJob' | 'adoptionListJobs' | 'adoptionCancelJob' | 'adoptionResync' | 'discoveryProviders' | 'discoverAllProviders' | 'discoverProvider' | 'listDiscoveryProposals' | 'dismissDiscoveryProposal' | 'reportDiscoveryObservations' | 'runDiscoverySweep' | 'providerCreationType' | 'providerDiscoveryParamsSchema' | 'getDeviceStatusAggregateBatch'>;
94
+ readonly deviceManager: Pick<InferProvider<typeof deviceManagerCapability>, 'allocateDeviceId' | 'migrateDevice' | 'registerDevice' | 'removeDevice' | 'persistConfig' | 'renderDeviceTemplates' | 'checkDeviceTemplates' | 'getRoleDisplayDefaults' | 'setRoleDisplayDefaults' | 'listLocations' | 'addLocation' | 'removeLocation' | 'renameLocation' | 'listLocationIcons' | 'setLocationIcon' | 'listLocationDescriptions' | 'setLocationDescription' | 'listSiteZones' | 'setSiteZone' | 'removeSiteZone' | 'renameSiteZone' | 'setLocationZone' | 'listPersistedByAddon' | 'listAll' | 'getChildren' | 'getChildrenBatch' | 'getLinkedDevicesBatch' | 'listDeletedSince' | 'cleanupDeletedDevicesData' | 'removeByIntegration' | 'getBindingsBatch' | 'getAllBindings' | 'listDeviceIdsByCaps' | 'listWrappersForCap' | 'listBindableCapsForDeviceType' | 'discoverDevices' | 'adoptDevice' | 'getCreationSchema' | 'createDevice' | 'testCreationField' | 'adoptionListCandidateFilters' | 'adoptionListCandidates' | 'adoptionRefresh' | 'adoptionAdopt' | 'adoptionRelease' | 'adoptionStartJob' | 'adoptionListJobs' | 'adoptionCancelJob' | 'adoptionResync' | 'discoveryProviders' | 'discoverAllProviders' | 'discoverProvider' | 'listDiscoveryProposals' | 'dismissDiscoveryProposal' | 'reportDiscoveryObservations' | 'runDiscoverySweep' | 'providerCreationType' | 'providerDiscoveryParamsSchema' | 'getDeviceStatusAggregateBatch'>;
95
95
  readonly deviceProvider: Pick<InferProvider<typeof deviceProviderCapability>, 'start' | 'stop' | 'getStatus' | 'getDevices' | 'reloadDevice' | 'supportsDiscovery' | 'discoverDevices' | 'getDiscoveryModes' | 'classifyDiscoveryHits' | 'getDiscoveryParamsSchema' | 'getManualCreationType' | 'adoptDiscoveredDevice' | 'supportsManualCreation' | 'getChildCreationSchema' | 'createDevice' | 'testCreationField'>;
96
96
  readonly deviceState: Pick<InferProvider<typeof deviceStateCapability>, 'getAllSnapshots' | 'listClaims'>;
97
97
  readonly displayPalette: Pick<InferProvider<typeof displayPaletteCapability>, 'getPalette' | 'listPresets' | 'setPalette'>;
package/dist/index.d.ts CHANGED
@@ -199,6 +199,7 @@ export * from './automation/action.js';
199
199
  export * from './automation/action-target.js';
200
200
  export * from './automation/scheduler.js';
201
201
  export * from './automation/nc-action-target.js';
202
+ export * from './automation/step-condition.js';
202
203
  export * from './automation/step-runner.js';
203
204
  export * from './automation/export-entities.js';
204
205
  export * from './automation/draft/index.js';
@@ -296,7 +297,7 @@ export { collectZodSecretPaths, isZodSecret, SECRET_META } from './device/zod-se
296
297
  export { EventCategory, isOwnerOnlyEventCategory, OWNER_ONLY_EVENT_CATEGORIES, publicEventCategories, } from './enums/event-category.js';
297
298
  export * from './enums/index.js';
298
299
  export type { CompileResult, EvaluateExpressionSourceResult, ExpressionBinaryOperator, ExpressionBindingSource, ExpressionBuiltin, ExpressionEvalHooks, ExpressionEvalOptions, ExpressionFieldBinding, ExpressionGlobalBinding, ExpressionLiteralBinding, ExpressionLogicalOperator, ExpressionNode, ExpressionNodePath, ExpressionSource, ExpressionSourceInput, ExpressionUnaryOperator, ExpressionValue, CountCallState, RoseCallState, StatefulCallState, StatefulCallInvocation, StatefulExpressionEnvironment, StatefulExpressionMemory, StatefulExpressionBuiltin, Keyword, ParsedExpression, Punctuator, Token, } from './expression/index.js';
299
- export { DEVICE_TEMPLATE_BUDGET_MS, DEVICE_TEMPLATE_FILTERS, DEVICE_TEMPLATE_MAX_LENGTH, DEVICE_TEMPLATE_MAX_OUTPUT, DEVICE_TEMPLATE_UNAVAILABLE, DeviceTemplateSchema, resolveTemplateRef, templateCapKey, } from './expression/device-template.js';
300
+ export { DEVICE_TEMPLATE_BUDGET_MS, DEVICE_TEMPLATE_FILTERS, DEVICE_TEMPLATE_MAX_LENGTH, DEVICE_TEMPLATE_MAX_OUTPUT, DEVICE_TEMPLATE_UNAVAILABLE, DEVICE_TEMPLATE_REFUSAL_REASONS, DEVICE_TEMPLATE_TRACE_REASONS, DeviceTemplateRefusalSchema, DeviceTemplateRenderSchema, DeviceTemplateSchema, DeviceTemplateTraceEntrySchema, resolveTemplateRef, templateCapKey, } from './expression/device-template.js';
300
301
  export type { DeviceTemplateFilter, DeviceTemplateRef, DeviceTemplateRefusal, DeviceTemplateRefusalReason, DeviceTemplateRender, DeviceTemplateTraceEntry, DeviceTemplateTraceReason, DeviceTemplateView, ResolvedTemplateRef, } from './expression/device-template.js';
301
302
  export { compileExpression, compileExpressionSafe, cloneStatefulExpressionMemory, createExpressionScope, createStatefulExpressionMemory, EXPRESSION_BUILTIN_NAMES, EXPRESSION_BUILTINS, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, ExpressionBindingSourceSchema, ExpressionEvalError, ExpressionFieldBindingSchema, ExpressionGlobalBindingSchema, ExpressionLiteralBindingSchema, ExpressionParseError, ExpressionSourceSchema, evaluateAst, evaluateCount, disarmRoseMemory, evaluateExpressionSource, evaluateRose, evaluateStatefulExpressionCall, isStatefulBuiltin, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, parseExpression, RESERVED_BINDING_NAMES, toExpressionValue, tokenize, validateExpressionSource, } from './expression/index.js';
302
303
  export type { AddonApi, AppRouter } from './generated/addon-api.js';