@camstack/types 1.2.451 → 1.2.453

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 (47) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/addon/base-addon.d.ts +27 -0
  3. package/dist/addon.js +8 -3
  4. package/dist/addon.mjs +8 -3
  5. package/dist/automation/condition-eval.d.ts +20 -5
  6. package/dist/automation/detection-subject.d.ts +154 -0
  7. package/dist/automation/detection-trigger.d.ts +16 -6
  8. package/dist/automation/index.d.ts +10 -4
  9. package/dist/automation/legacy-recipe.d.ts +130 -0
  10. package/dist/automation/normalize-units.d.ts +4 -3
  11. package/dist/automation/recipe.d.ts +286 -142
  12. package/dist/automation/stationary-trigger.d.ts +4 -4
  13. package/dist/automation/step-runner.d.ts +3 -1
  14. package/dist/automation/trace.d.ts +51 -6
  15. package/dist/automation/when.d.ts +295 -0
  16. package/dist/capabilities/actions.cap.d.ts +10 -0
  17. package/dist/capabilities/addon-settings.cap.d.ts +18 -0
  18. package/dist/capabilities/core-blocks.cap.d.ts +2546 -51
  19. package/dist/capabilities/device-discovery.cap.d.ts +2 -0
  20. package/dist/capabilities/device-manager.cap.d.ts +16 -1
  21. package/dist/capabilities/device-provider.cap.d.ts +165 -0
  22. package/dist/capabilities/index.d.ts +3 -3
  23. package/dist/capabilities/integrations.cap.d.ts +1 -0
  24. package/dist/capabilities/keychain.cap.d.ts +12 -0
  25. package/dist/capabilities/local-network.cap.d.ts +198 -0
  26. package/dist/capabilities/storage-admin.cap.d.ts +155 -0
  27. package/dist/capabilities/terminal-session.cap.d.ts +7 -0
  28. package/dist/client.js +8 -1
  29. package/dist/client.mjs +8 -1
  30. package/dist/device/base-device-provider.d.ts +17 -0
  31. package/dist/generated/addon-api.d.ts +84 -0
  32. package/dist/generated/collection-array-methods.d.ts +1 -1
  33. package/dist/generated/method-access-map.d.ts +1 -1
  34. package/dist/generated/system-proxy.d.ts +3 -3
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +1969 -706
  37. package/dist/index.mjs +1934 -703
  38. package/dist/interfaces/addon.d.ts +16 -0
  39. package/dist/interfaces/config-ui-secrets.d.ts +5 -3
  40. package/dist/interfaces/config-ui.d.ts +34 -1
  41. package/dist/{sleep-BSPhInRm.js → sleep-CewR0zRz.js} +125 -6
  42. package/dist/{sleep-63gM_1JR.mjs → sleep-CeyhrcOk.mjs} +125 -6
  43. package/dist/vendor-login-proxy/cookie-jar.d.ts +30 -0
  44. package/dist/vendor-login-proxy/index.d.ts +1 -0
  45. package/dist/vendor-login-proxy/login-proxy.d.ts +6 -0
  46. package/dist/vendor-login-proxy/url-rewrite.d.ts +9 -2
  47. package/package.json +1 -1
@@ -0,0 +1,295 @@
1
+ /**
2
+ * The `when` tree — the ONE place an automation says when it runs.
3
+ *
4
+ * Containers are `all` / `any` / `not`. Leaves come in two kinds, told apart by
5
+ * what they ARE, not by which section of a form they sit in:
6
+ *
7
+ * - **event leaves (instants)** — something HAPPENS: a device field *becomes*
8
+ * a value, a device event, a schedule tick, an interval, a manual run, a
9
+ * detection, a parked object appearing or leaving;
10
+ * - **state leaves (durations)** — something IS true: a device field *is*
11
+ * compared to a value, a parked object is present, an expression holds.
12
+ *
13
+ * Firing rule (ADR, "one tree"):
14
+ * 1. A tree with event leaves fires when ONE of them occurs AND the whole tree
15
+ * is true at that instant. The event that occurred is true; every other
16
+ * event leaf is false.
17
+ * 2. A tree of state leaves only fires when it goes false → true. The first
18
+ * evaluation seeds the state, so it never fires because it was already true.
19
+ * 3. Two event leaves that can only be satisfied together are refused at
20
+ * author time ({@link validateWhenTree}).
21
+ */
22
+ import { z } from 'zod';
23
+ /**
24
+ * Depth of the `when` tree, counting the root container as level 1. The old
25
+ * condition tree was bounded at 3 under a flat list of triggers; the trigger
26
+ * list is now the tree's top `any`, one level, so the bound is 3 + 1 and a
27
+ * converted recipe never exceeds it.
28
+ *
29
+ * `NOT` over a group is always rewritable by De Morgan, so the shapes that
30
+ * would need a fifth level have an equivalent at four.
31
+ */
32
+ export declare const MAX_WHEN_DEPTH = 4;
33
+ /** Leaves per automation. A UI that grows without a bound becomes a language. */
34
+ export declare const MAX_WHEN_LEAVES = 32;
35
+ /** How a state leaf compares a device field to a value. Derived from the
36
+ * field's `kind` in `deviceManager.getWireableFields`, never hand-maintained. */
37
+ export declare const AutomationConditionOperatorSchema: z.ZodEnum<{
38
+ contains: "contains";
39
+ eq: "eq";
40
+ gt: "gt";
41
+ gte: "gte";
42
+ in: "in";
43
+ lt: "lt";
44
+ lte: "lte";
45
+ ne: "ne";
46
+ }>;
47
+ export type AutomationConditionOperator = z.infer<typeof AutomationConditionOperatorSchema>;
48
+ /**
49
+ * D8 compliance, and it is the reason a "becomes" leaf is not merely an event
50
+ * subscription: it evaluates against the **state mirror**, which is reconciled,
51
+ * and an event only WAKES the evaluation. A dropped event therefore DELAYS a
52
+ * fire; it does not lose it.
53
+ */
54
+ declare const DeviceBecomesLeafSchema: z.ZodObject<{
55
+ kind: z.ZodLiteral<"device-becomes">;
56
+ deviceId: z.ZodNumber;
57
+ cap: z.ZodString;
58
+ fieldPath: z.ZodString;
59
+ becomes: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
60
+ edge: z.ZodOptional<z.ZodBoolean>;
61
+ forMs: z.ZodOptional<z.ZodNumber>;
62
+ debounceMs: z.ZodOptional<z.ZodNumber>;
63
+ }, z.core.$strip>;
64
+ declare const DeviceEventLeafSchema: z.ZodObject<{
65
+ kind: z.ZodLiteral<"device-event">;
66
+ category: z.ZodString;
67
+ deviceId: z.ZodOptional<z.ZodNumber>;
68
+ }, z.core.$strip>;
69
+ declare const ScheduleLeafSchema: z.ZodObject<{
70
+ kind: z.ZodLiteral<"schedule">;
71
+ cron: z.ZodString;
72
+ }, z.core.$strip>;
73
+ declare const ManualLeafSchema: z.ZodObject<{
74
+ kind: z.ZodLiteral<"manual">;
75
+ }, z.core.$strip>;
76
+ declare const IntervalLeafSchema: z.ZodObject<{
77
+ kind: z.ZodLiteral<"interval">;
78
+ minutes: z.ZodNumber;
79
+ }, z.core.$strip>;
80
+ declare const DetectionLeafSchema: z.ZodObject<{
81
+ kind: z.ZodLiteral<"detection">;
82
+ subjects: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
83
+ macro: z.ZodLiteral<"animal">;
84
+ label: z.ZodOptional<z.ZodObject<{
85
+ kind: z.ZodLiteral<"sub-class">;
86
+ className: z.ZodString;
87
+ }, z.core.$strip>>;
88
+ }, z.core.$strip>, z.ZodObject<{
89
+ macro: z.ZodLiteral<"person">;
90
+ label: z.ZodOptional<z.ZodObject<{
91
+ kind: z.ZodLiteral<"identity">;
92
+ identityId: z.ZodString;
93
+ name: z.ZodString;
94
+ }, z.core.$strip>>;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ macro: z.ZodLiteral<"vehicle">;
97
+ label: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
98
+ kind: z.ZodLiteral<"sub-class">;
99
+ className: z.ZodString;
100
+ }, z.core.$strip>, z.ZodObject<{
101
+ kind: z.ZodLiteral<"plate">;
102
+ text: z.ZodString;
103
+ }, z.core.$strip>], "kind">>;
104
+ }, z.core.$strip>, z.ZodObject<{
105
+ macro: z.ZodLiteral<"package">;
106
+ label: z.ZodOptional<z.ZodObject<{
107
+ kind: z.ZodLiteral<"sub-class">;
108
+ className: z.ZodString;
109
+ }, z.core.$strip>>;
110
+ }, z.core.$strip>, z.ZodObject<{
111
+ macro: z.ZodLiteral<"other">;
112
+ className: z.ZodString;
113
+ }, z.core.$strip>], "macro">>;
114
+ deviceIds: z.ZodArray<z.ZodNumber>;
115
+ zones: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
+ minScore: z.ZodOptional<z.ZodNumber>;
117
+ }, z.core.$strip>;
118
+ declare const StationaryLeafSchema: z.ZodObject<{
119
+ kind: z.ZodLiteral<"stationary">;
120
+ deviceIds: z.ZodArray<z.ZodNumber>;
121
+ subjects: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
122
+ macro: z.ZodLiteral<"animal">;
123
+ label: z.ZodOptional<z.ZodObject<{
124
+ kind: z.ZodLiteral<"sub-class">;
125
+ className: z.ZodString;
126
+ }, z.core.$strip>>;
127
+ }, z.core.$strip>, z.ZodObject<{
128
+ macro: z.ZodLiteral<"person">;
129
+ label: z.ZodOptional<z.ZodObject<{
130
+ kind: z.ZodLiteral<"identity">;
131
+ identityId: z.ZodString;
132
+ name: z.ZodString;
133
+ }, z.core.$strip>>;
134
+ }, z.core.$strip>, z.ZodObject<{
135
+ macro: z.ZodLiteral<"vehicle">;
136
+ label: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
137
+ kind: z.ZodLiteral<"sub-class">;
138
+ className: z.ZodString;
139
+ }, z.core.$strip>, z.ZodObject<{
140
+ kind: z.ZodLiteral<"plate">;
141
+ text: z.ZodString;
142
+ }, z.core.$strip>], "kind">>;
143
+ }, z.core.$strip>, z.ZodObject<{
144
+ macro: z.ZodLiteral<"package">;
145
+ label: z.ZodOptional<z.ZodObject<{
146
+ kind: z.ZodLiteral<"sub-class">;
147
+ className: z.ZodString;
148
+ }, z.core.$strip>>;
149
+ }, z.core.$strip>, z.ZodObject<{
150
+ macro: z.ZodLiteral<"other">;
151
+ className: z.ZodString;
152
+ }, z.core.$strip>], "macro">>>;
153
+ zones: z.ZodOptional<z.ZodArray<z.ZodString>>;
154
+ phase: z.ZodEnum<{
155
+ appeared: "appeared";
156
+ departed: "departed";
157
+ }>;
158
+ }, z.core.$strip>;
159
+ /** "is": one device field compared to one value, NOW. */
160
+ declare const DeviceIsLeafSchema: z.ZodObject<{
161
+ kind: z.ZodLiteral<"device-is">;
162
+ deviceId: z.ZodNumber;
163
+ cap: z.ZodString;
164
+ fieldPath: z.ZodString;
165
+ operator: z.ZodEnum<{
166
+ contains: "contains";
167
+ eq: "eq";
168
+ gt: "gt";
169
+ gte: "gte";
170
+ in: "in";
171
+ lt: "lt";
172
+ lte: "lte";
173
+ ne: "ne";
174
+ }>;
175
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>, z.ZodObject<{
176
+ value: z.ZodNumber;
177
+ unit: z.ZodString;
178
+ }, z.core.$strip>]>;
179
+ unit: z.ZodOptional<z.ZodString>;
180
+ }, z.core.$strip>;
181
+ /**
182
+ * True when the camera currently has a PARKED object matching `subjects` in at
183
+ * least one of `zones`. Reads the zone-analytics snapshot through the same
184
+ * mirror as every other state leaf, so a dropped event never decides it (D49).
185
+ */
186
+ declare const StationaryPresentLeafSchema: z.ZodObject<{
187
+ kind: z.ZodLiteral<"stationary-present">;
188
+ deviceId: z.ZodNumber;
189
+ subjects: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
190
+ macro: z.ZodLiteral<"animal">;
191
+ label: z.ZodOptional<z.ZodObject<{
192
+ kind: z.ZodLiteral<"sub-class">;
193
+ className: z.ZodString;
194
+ }, z.core.$strip>>;
195
+ }, z.core.$strip>, z.ZodObject<{
196
+ macro: z.ZodLiteral<"person">;
197
+ label: z.ZodOptional<z.ZodObject<{
198
+ kind: z.ZodLiteral<"identity">;
199
+ identityId: z.ZodString;
200
+ name: z.ZodString;
201
+ }, z.core.$strip>>;
202
+ }, z.core.$strip>, z.ZodObject<{
203
+ macro: z.ZodLiteral<"vehicle">;
204
+ label: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
205
+ kind: z.ZodLiteral<"sub-class">;
206
+ className: z.ZodString;
207
+ }, z.core.$strip>, z.ZodObject<{
208
+ kind: z.ZodLiteral<"plate">;
209
+ text: z.ZodString;
210
+ }, z.core.$strip>], "kind">>;
211
+ }, z.core.$strip>, z.ZodObject<{
212
+ macro: z.ZodLiteral<"package">;
213
+ label: z.ZodOptional<z.ZodObject<{
214
+ kind: z.ZodLiteral<"sub-class">;
215
+ className: z.ZodString;
216
+ }, z.core.$strip>>;
217
+ }, z.core.$strip>, z.ZodObject<{
218
+ macro: z.ZodLiteral<"other">;
219
+ className: z.ZodString;
220
+ }, z.core.$strip>], "macro">>>;
221
+ zones: z.ZodOptional<z.ZodArray<z.ZodString>>;
222
+ }, z.core.$strip>;
223
+ /**
224
+ * The escape hatch: the bounded expression engine over named device bindings.
225
+ * Declared as a plain object so a discriminated union can read `kind`; the
226
+ * author-time validation is the SAME function `ExpressionSourceSchema` runs.
227
+ */
228
+ declare const ExpressionLeafSchema: z.ZodObject<{
229
+ kind: z.ZodLiteral<"expression">;
230
+ expr: z.ZodString;
231
+ bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
232
+ kind: z.ZodOptional<z.ZodLiteral<"field">>;
233
+ sourceKey: z.ZodString;
234
+ cap: z.ZodString;
235
+ fieldPath: z.ZodString;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ kind: z.ZodLiteral<"literal">;
238
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
239
+ }, z.core.$strip>, z.ZodObject<{
240
+ kind: z.ZodLiteral<"global">;
241
+ sourceStableId: z.ZodString;
242
+ cap: z.ZodString;
243
+ fieldPath: z.ZodString;
244
+ }, z.core.$strip>]>>;
245
+ }, z.core.$strip>;
246
+ export type AutomationEventLeaf = z.infer<typeof DeviceBecomesLeafSchema> | z.infer<typeof DeviceEventLeafSchema> | z.infer<typeof ScheduleLeafSchema> | z.infer<typeof ManualLeafSchema> | z.infer<typeof IntervalLeafSchema> | z.infer<typeof DetectionLeafSchema> | z.infer<typeof StationaryLeafSchema>;
247
+ export type AutomationStateLeaf = z.infer<typeof DeviceIsLeafSchema> | z.infer<typeof StationaryPresentLeafSchema> | z.infer<typeof ExpressionLeafSchema>;
248
+ export type AutomationLeaf = AutomationEventLeaf | AutomationStateLeaf;
249
+ export type DeviceBecomesLeaf = Extract<AutomationEventLeaf, {
250
+ kind: 'device-becomes';
251
+ }>;
252
+ export type DetectionLeaf = Extract<AutomationEventLeaf, {
253
+ kind: 'detection';
254
+ }>;
255
+ export type StationaryLeaf = Extract<AutomationEventLeaf, {
256
+ kind: 'stationary';
257
+ }>;
258
+ export type DeviceIsLeaf = Extract<AutomationStateLeaf, {
259
+ kind: 'device-is';
260
+ }>;
261
+ export type StationaryPresentLeaf = Extract<AutomationStateLeaf, {
262
+ kind: 'stationary-present';
263
+ }>;
264
+ export type ExpressionLeaf = Extract<AutomationStateLeaf, {
265
+ kind: 'expression';
266
+ }>;
267
+ export interface AutomationAll {
268
+ readonly kind: 'all';
269
+ readonly children: readonly AutomationWhen[];
270
+ }
271
+ export interface AutomationAny {
272
+ readonly kind: 'any';
273
+ readonly children: readonly AutomationWhen[];
274
+ }
275
+ export interface AutomationNot {
276
+ readonly kind: 'not';
277
+ readonly child: AutomationWhen;
278
+ }
279
+ export type AutomationWhen = AutomationAll | AutomationAny | AutomationNot | AutomationLeaf;
280
+ export declare const AutomationWhenSchema: z.ZodType<AutomationWhen>;
281
+ export declare function isEventLeaf(node: AutomationWhen): node is AutomationEventLeaf;
282
+ export declare function isLeaf(node: AutomationWhen): node is AutomationLeaf;
283
+ /** Depth of a tree, root container = 1. A bare leaf is depth 1. */
284
+ export declare function whenDepth(node: AutomationWhen): number;
285
+ /** Leaves only — containers do not count toward the leaf budget. */
286
+ export declare function countWhenLeaves(node: AutomationWhen): number;
287
+ /** Every leaf with its path (`when`, `when.0`, `when.0.1`, `when.0` under a `not`). */
288
+ export declare function forEachLeaf(node: AutomationWhen, visit: (leaf: AutomationLeaf, path: string) => void, path?: string): void;
289
+ export declare function hasEventLeaves(node: AutomationWhen): boolean;
290
+ /**
291
+ * Author-time bounds and sense check of a `when` tree. Returns `null` when it
292
+ * is legal, else a message the editor shows verbatim.
293
+ */
294
+ export declare function validateWhenTree(when: AutomationWhen): string | null;
295
+ export {};
@@ -144,6 +144,7 @@ export declare const actionsCapability: {
144
144
  endedAt: z.ZodNumber;
145
145
  trigger: z.ZodObject<{
146
146
  kind: z.ZodString;
147
+ path: z.ZodOptional<z.ZodString>;
147
148
  outcome: z.ZodEnum<{
148
149
  fail: "fail";
149
150
  pass: "pass";
@@ -157,8 +158,16 @@ export declare const actionsCapability: {
157
158
  all: "all";
158
159
  any: "any";
159
160
  condition: "condition";
161
+ detection: "detection";
162
+ "device-becomes": "device-becomes";
163
+ "device-event": "device-event";
164
+ "device-is": "device-is";
160
165
  expression: "expression";
166
+ interval: "interval";
167
+ manual: "manual";
161
168
  not: "not";
169
+ schedule: "schedule";
170
+ stationary: "stationary";
162
171
  "stationary-present": "stationary-present";
163
172
  }>;
164
173
  outcome: z.ZodEnum<{
@@ -207,6 +216,7 @@ export declare const actionsCapability: {
207
216
  deviceId: z.ZodOptional<z.ZodNumber>;
208
217
  startedAt: z.ZodOptional<z.ZodNumber>;
209
218
  endedAt: z.ZodOptional<z.ZodNumber>;
219
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>>;
210
220
  outcome: z.ZodEnum<{
211
221
  error: "error";
212
222
  "not-run": "not-run";
@@ -167,6 +167,24 @@ export declare const addonSettingsCapability: {
167
167
  fields: z.ZodArray<z.ZodAny>;
168
168
  }, z.core.$strip>>;
169
169
  }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
170
+ readonly getDeclaredSettingsKeys: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
171
+ addonId: z.ZodString;
172
+ nodeId: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strip>, z.ZodNullable<z.ZodObject<{
174
+ keys: z.ZodArray<z.ZodString>;
175
+ }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
176
+ readonly unsetStoredSettingsKeys: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
177
+ addonId: z.ZodString;
178
+ nodeId: z.ZodOptional<z.ZodString>;
179
+ keys: z.ZodArray<z.ZodString>;
180
+ }, z.core.$strip>, z.ZodObject<{
181
+ removed: z.ZodArray<z.ZodString>;
182
+ refused: z.ZodArray<z.ZodObject<{
183
+ key: z.ZodString;
184
+ reason: z.ZodString;
185
+ }, z.core.$strip>>;
186
+ secretsCleared: z.ZodNumber;
187
+ }, z.core.$strip>, "mutation">;
170
188
  readonly getDeviceSettings: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
171
189
  addonId: z.ZodString;
172
190
  deviceId: z.ZodNumber;