@camstack/types 1.2.402 → 1.2.403
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/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/auth/credential-scope.d.ts +23 -3
- package/dist/auth/viewer-access.d.ts +112 -0
- package/dist/capabilities/capability-definition.d.ts +14 -0
- package/dist/capabilities/face-gallery.cap.d.ts +3 -0
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/pipeline-analytics.cap.d.ts +79 -0
- package/dist/capabilities/plate-gallery.cap.d.ts +3 -0
- package/dist/capabilities/scene-monitor.cap.d.ts +3 -0
- package/dist/capabilities/user-management.cap.d.ts +108 -18
- package/dist/client.js +7 -0
- package/dist/client.mjs +7 -0
- package/dist/clips/clip-event-labels.d.ts +96 -0
- package/dist/device/cap-vocabulary/entries/actuators.d.ts +5 -0
- package/dist/device/cap-vocabulary/entries/appliances.d.ts +5 -0
- package/dist/device/cap-vocabulary/entries/camera.d.ts +5 -0
- package/dist/device/cap-vocabulary/entries/sensors.d.ts +5 -0
- package/dist/device/cap-vocabulary/entries/system.d.ts +8 -0
- package/dist/device/cap-vocabulary/index.d.ts +9 -0
- package/dist/device/cap-vocabulary/l10n.d.ts +7 -0
- package/dist/device/cap-vocabulary/resolve.d.ts +100 -0
- package/dist/device/cap-vocabulary/templates.d.ts +11 -0
- package/dist/device/cap-vocabulary/types.d.ts +398 -0
- package/dist/device/cap-vocabulary/vocabulary.d.ts +5 -0
- package/dist/device/device-do-actions.d.ts +8 -2
- package/dist/generated/addon-api.d.ts +38 -0
- package/dist/generated/method-access-map.d.ts +3 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +7323 -1909
- package/dist/index.mjs +7294 -1910
- package/dist/interfaces/api-responses.d.ts +1 -1
- package/dist/interfaces/auth.d.ts +2 -2
- package/dist/interfaces/birth-decision-ledger.d.ts +17 -0
- package/dist/schemas/auth-records.d.ts +77 -13
- package/dist/schemas/device-selector.d.ts +23 -4
- package/dist/{sleep-CUp20JkO.mjs → sleep-6AqUnQIT.mjs} +1 -0
- package/dist/{sleep-DVovpDRU.js → sleep-Ch67uumJ.js} +1 -0
- package/dist/types/detection.d.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SHAPE of the cap vocabulary (D920): what an operator can make a device
|
|
3
|
+
* DO, and what a device can be WATCHED for, phrased for humans — keyed by
|
|
4
|
+
* capability name, typed against the capability definitions themselves.
|
|
5
|
+
*
|
|
6
|
+
* Every key type here is DERIVED from the cap registry
|
|
7
|
+
* (`generated/capability-router-map.ts`, imported as a TYPE only — no runtime
|
|
8
|
+
* cost, no Zod graph in a browser bundle): a method, status field or event
|
|
9
|
+
* name that does not exist on the cap is a TypeScript error, and so is a
|
|
10
|
+
* missing cap. `scripts/check-cap-vocabulary.ts` checks what a type cannot:
|
|
11
|
+
* that every operate method is phrased or excused, that offered values agree
|
|
12
|
+
* with the method's Zod input, that every placeholder has an arg, and that
|
|
13
|
+
* every label carries both languages.
|
|
14
|
+
*
|
|
15
|
+
* Translations live INLINE (`{ en, it }`) next to the entry they translate —
|
|
16
|
+
* one source, so a new action cannot ship in one language.
|
|
17
|
+
*/
|
|
18
|
+
import type { z } from 'zod';
|
|
19
|
+
import type * as CapRegistry from '../../generated/capability-router-map.js';
|
|
20
|
+
import type { EventCategory } from '../../enums/event-category.js';
|
|
21
|
+
import type { ICON_KEYS } from '../icon-catalog.generated.js';
|
|
22
|
+
import type { DeviceRole, DeviceType } from '../device-type.js';
|
|
23
|
+
/** One catalog icon key (lucide id) — the same vocabulary as `IconKey`. */
|
|
24
|
+
export type VocabIcon = (typeof ICON_KEYS)[number];
|
|
25
|
+
/** A human string in every language the map carries. */
|
|
26
|
+
export interface L10n {
|
|
27
|
+
readonly en: string;
|
|
28
|
+
readonly it: string;
|
|
29
|
+
}
|
|
30
|
+
/** A language the vocabulary is written in. */
|
|
31
|
+
export type VocabLocale = keyof L10n;
|
|
32
|
+
type CapRegistryModule = typeof CapRegistry;
|
|
33
|
+
/** The minimal structural shape that tells a cap definition export apart. */
|
|
34
|
+
interface CapDefinitionLike {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly scope: 'system' | 'device';
|
|
37
|
+
readonly methods: object;
|
|
38
|
+
}
|
|
39
|
+
/** Cap name → its definition TYPE, for every cap the registry exports. */
|
|
40
|
+
export type CapDefinitionsByName = {
|
|
41
|
+
readonly [K in keyof CapRegistryModule as CapRegistryModule[K] extends CapDefinitionLike ? CapRegistryModule[K]['name'] : never]: CapRegistryModule[K];
|
|
42
|
+
};
|
|
43
|
+
/** Every capability name. */
|
|
44
|
+
export type VocabCapName = keyof CapDefinitionsByName & string;
|
|
45
|
+
type CapDef<C extends VocabCapName> = CapDefinitionsByName[C];
|
|
46
|
+
/** Device-scoped cap names (the ones a device's vocabulary is made of). */
|
|
47
|
+
export type DeviceVocabCapName = {
|
|
48
|
+
[C in VocabCapName]: CapDef<C>['scope'] extends 'device' ? C : never;
|
|
49
|
+
}[VocabCapName];
|
|
50
|
+
/** System-scoped cap names (never part of a device's vocabulary). */
|
|
51
|
+
export type SystemVocabCapName = Exclude<VocabCapName, DeviceVocabCapName>;
|
|
52
|
+
/** A method name declared by cap `C`. */
|
|
53
|
+
export type CapMethodName<C extends VocabCapName> = keyof CapDef<C>['methods'] & string;
|
|
54
|
+
type MethodSchemaOf<C extends VocabCapName, M extends CapMethodName<C>> = CapDef<C>['methods'][M];
|
|
55
|
+
type MethodInputOf<C extends VocabCapName, M extends CapMethodName<C>> = MethodSchemaOf<C, M> extends {
|
|
56
|
+
readonly input: infer I extends z.ZodType;
|
|
57
|
+
} ? z.input<I> : never;
|
|
58
|
+
/** The operator-supplied part of a method input (`deviceId` is the target). */
|
|
59
|
+
export type ActionArgs<C extends VocabCapName, M extends CapMethodName<C>> = MethodInputOf<C, M> extends object ? Omit<MethodInputOf<C, M>, 'deviceId'> : Record<never, never>;
|
|
60
|
+
/** A key of {@link ActionArgs}. */
|
|
61
|
+
export type ActionArgKey<C extends VocabCapName, M extends CapMethodName<C>> = keyof ActionArgs<C, M> & string;
|
|
62
|
+
type StatusOf<C extends VocabCapName> = CapDef<C> extends {
|
|
63
|
+
readonly status: {
|
|
64
|
+
readonly schema: infer S extends z.ZodType;
|
|
65
|
+
};
|
|
66
|
+
} ? z.output<S> : CapDef<C> extends {
|
|
67
|
+
readonly runtimeState: infer R extends z.ZodType;
|
|
68
|
+
} ? z.output<R> : never;
|
|
69
|
+
/** A top-level status field of cap `C`. */
|
|
70
|
+
export type CapStatusField<C extends VocabCapName> = [StatusOf<C>] extends [never] ? never : keyof StatusOf<C> & string;
|
|
71
|
+
/** An event name declared by cap `C`. */
|
|
72
|
+
export type CapEventName<C extends VocabCapName> = CapDef<C> extends {
|
|
73
|
+
readonly events: infer E;
|
|
74
|
+
} ? keyof E & string : never;
|
|
75
|
+
/** One choice of a closed set, with its label. */
|
|
76
|
+
export interface VocabChoice {
|
|
77
|
+
readonly value: string | number;
|
|
78
|
+
readonly label: L10n;
|
|
79
|
+
}
|
|
80
|
+
/** A closed set — every value MUST be one the method's Zod input accepts. */
|
|
81
|
+
export interface EnumOffer {
|
|
82
|
+
readonly kind: 'enum';
|
|
83
|
+
readonly values: readonly VocabChoice[];
|
|
84
|
+
}
|
|
85
|
+
/** A number, within the Zod input's bounds. `unit` is a display suffix. */
|
|
86
|
+
export interface NumberOffer {
|
|
87
|
+
readonly kind: 'number';
|
|
88
|
+
readonly min?: number;
|
|
89
|
+
readonly max?: number;
|
|
90
|
+
readonly step?: number;
|
|
91
|
+
readonly unit?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Free text. */
|
|
94
|
+
export interface TextOffer {
|
|
95
|
+
readonly kind: 'text';
|
|
96
|
+
/** True for a secret the UI should mask (a PIN code). */
|
|
97
|
+
readonly secret?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** A yes/no. */
|
|
100
|
+
export interface BooleanOffer {
|
|
101
|
+
readonly kind: 'boolean';
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Values the DEVICE knows, read at authoring time from the same cap:
|
|
105
|
+
* a status field holding a list, or a read method returning one.
|
|
106
|
+
* `valueKey` / `labelKey` pick the fields of an object item (omit both for a
|
|
107
|
+
* list of strings); `where` keeps only items whose field equals a value.
|
|
108
|
+
*/
|
|
109
|
+
export type DynamicOffer<C extends VocabCapName> = {
|
|
110
|
+
readonly kind: 'dynamic';
|
|
111
|
+
readonly from: 'status';
|
|
112
|
+
readonly field: CapStatusField<C>;
|
|
113
|
+
readonly valueKey?: string;
|
|
114
|
+
readonly labelKey?: string;
|
|
115
|
+
readonly where?: {
|
|
116
|
+
readonly key: string;
|
|
117
|
+
readonly equals: string | number | boolean;
|
|
118
|
+
};
|
|
119
|
+
/** The type of the value the method takes (default string). */
|
|
120
|
+
readonly valueKind?: 'string' | 'number';
|
|
121
|
+
} | {
|
|
122
|
+
readonly kind: 'dynamic';
|
|
123
|
+
readonly from: 'method';
|
|
124
|
+
readonly method: CapMethodName<C>;
|
|
125
|
+
readonly valueKey?: string;
|
|
126
|
+
readonly labelKey?: string;
|
|
127
|
+
readonly where?: {
|
|
128
|
+
readonly key: string;
|
|
129
|
+
readonly equals: string | number | boolean;
|
|
130
|
+
};
|
|
131
|
+
readonly valueKind?: 'string' | 'number';
|
|
132
|
+
};
|
|
133
|
+
/** How the authoring UI offers a value for an open arg. */
|
|
134
|
+
export type VocabOffer<C extends VocabCapName> = EnumOffer | NumberOffer | TextOffer | BooleanOffer | DynamicOffer<C>;
|
|
135
|
+
/** An arg the operator fills after picking the action. */
|
|
136
|
+
export interface VocabOpenArg<C extends VocabCapName, K extends string> {
|
|
137
|
+
readonly key: K;
|
|
138
|
+
readonly label: L10n;
|
|
139
|
+
readonly offer: VocabOffer<C>;
|
|
140
|
+
/** The method accepts the call without it. */
|
|
141
|
+
readonly optional?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/** One operator-facing action: a cap method call with a phrase. */
|
|
144
|
+
export interface VocabActionFor<C extends VocabCapName, M extends CapMethodName<C>> {
|
|
145
|
+
/** Stable id — persisted by pickers as a select value (`switch.on`). */
|
|
146
|
+
readonly id: string;
|
|
147
|
+
readonly method: M;
|
|
148
|
+
/** Short label for a picker ("Turn on"). */
|
|
149
|
+
readonly label: L10n;
|
|
150
|
+
/**
|
|
151
|
+
* The sentence ("Turn on {device}", "Move {device} to {presetId}").
|
|
152
|
+
* Placeholders: `{device}` and any open or fixed arg key.
|
|
153
|
+
*/
|
|
154
|
+
readonly phrase: L10n;
|
|
155
|
+
readonly icon: VocabIcon;
|
|
156
|
+
/** Args baked into the action — never asked. */
|
|
157
|
+
readonly args?: Partial<ActionArgs<C, M>>;
|
|
158
|
+
/** Args the operator fills. */
|
|
159
|
+
readonly openArgs?: readonly VocabOpenArg<C, ActionArgKey<C, M>>[];
|
|
160
|
+
}
|
|
161
|
+
/** Any action of cap `C`, discriminated by `method`. */
|
|
162
|
+
export type VocabAction<C extends VocabCapName> = {
|
|
163
|
+
[M in CapMethodName<C>]: VocabActionFor<C, M>;
|
|
164
|
+
}[CapMethodName<C>];
|
|
165
|
+
/** A true/false field: one phrase per edge. */
|
|
166
|
+
export interface BooleanStateTrigger<C extends VocabCapName> {
|
|
167
|
+
readonly kind: 'boolean';
|
|
168
|
+
readonly field: CapStatusField<C>;
|
|
169
|
+
/** What the field is ("Contact", "Motion") — a picker label. */
|
|
170
|
+
readonly label: L10n;
|
|
171
|
+
readonly whenTrue: L10n;
|
|
172
|
+
readonly whenFalse: L10n;
|
|
173
|
+
readonly icon: VocabIcon;
|
|
174
|
+
}
|
|
175
|
+
/** A number: rises above / falls below / changes by, with a unit. */
|
|
176
|
+
export interface NumericStateTrigger<C extends VocabCapName> {
|
|
177
|
+
readonly kind: 'numeric';
|
|
178
|
+
readonly field: CapStatusField<C>;
|
|
179
|
+
/** The quantity WITH its article, as it reads in a sentence ("the temperature" / "la temperatura"). */
|
|
180
|
+
readonly quantity: L10n;
|
|
181
|
+
readonly label: L10n;
|
|
182
|
+
/** Display unit; omit when the device states it (see `unitField`). */
|
|
183
|
+
readonly unit?: string;
|
|
184
|
+
/** A status field carrying the device's own unit (`numeric-sensor.unit`). */
|
|
185
|
+
readonly unitField?: CapStatusField<C>;
|
|
186
|
+
readonly icon: VocabIcon;
|
|
187
|
+
}
|
|
188
|
+
/** One value of an enum field, with how "becomes" reads for it. */
|
|
189
|
+
export interface EnumStateValue {
|
|
190
|
+
readonly value: string;
|
|
191
|
+
readonly label: L10n;
|
|
192
|
+
/** Override of the default "When {device} changes to {value}". */
|
|
193
|
+
readonly phrase?: L10n;
|
|
194
|
+
}
|
|
195
|
+
/** A closed set of states. */
|
|
196
|
+
export interface EnumStateTrigger<C extends VocabCapName> {
|
|
197
|
+
readonly kind: 'enum';
|
|
198
|
+
readonly field: CapStatusField<C>;
|
|
199
|
+
readonly label: L10n;
|
|
200
|
+
readonly values: readonly EnumStateValue[];
|
|
201
|
+
readonly icon: VocabIcon;
|
|
202
|
+
}
|
|
203
|
+
/** A free string the device reports (a presence zone, an enum sensor's state). */
|
|
204
|
+
export interface ValueStateTrigger<C extends VocabCapName> {
|
|
205
|
+
readonly kind: 'value';
|
|
206
|
+
readonly field: CapStatusField<C>;
|
|
207
|
+
readonly label: L10n;
|
|
208
|
+
/** Where known values come from, when the device lists them. */
|
|
209
|
+
readonly offer?: DynamicOffer<C>;
|
|
210
|
+
/** Override of the default "When {device} changes to {value}". */
|
|
211
|
+
readonly phrase?: L10n;
|
|
212
|
+
readonly icon: VocabIcon;
|
|
213
|
+
}
|
|
214
|
+
/** A state field worth triggering on. */
|
|
215
|
+
export type VocabStateTrigger<C extends VocabCapName> = BooleanStateTrigger<C> | NumericStateTrigger<C> | EnumStateTrigger<C> | ValueStateTrigger<C>;
|
|
216
|
+
/** A bus event the device emits, phrased ("When {device} rings"). */
|
|
217
|
+
export interface VocabEventTrigger {
|
|
218
|
+
readonly category: EventCategory;
|
|
219
|
+
readonly label: L10n;
|
|
220
|
+
readonly phrase: L10n;
|
|
221
|
+
readonly icon: VocabIcon;
|
|
222
|
+
}
|
|
223
|
+
/** A declared cap event that is not an automation trigger, and why. */
|
|
224
|
+
export interface VocabEventExcused {
|
|
225
|
+
readonly notOperatorFacing: string;
|
|
226
|
+
}
|
|
227
|
+
/** Re-wording of one action for a kind of device. */
|
|
228
|
+
export interface VocabActionWording {
|
|
229
|
+
readonly label?: L10n;
|
|
230
|
+
readonly phrase?: L10n;
|
|
231
|
+
readonly icon?: VocabIcon;
|
|
232
|
+
}
|
|
233
|
+
/** Re-wording of one state trigger for a kind of device. */
|
|
234
|
+
export interface VocabStateWording {
|
|
235
|
+
readonly label?: L10n;
|
|
236
|
+
readonly whenTrue?: L10n;
|
|
237
|
+
readonly whenFalse?: L10n;
|
|
238
|
+
readonly quantity?: L10n;
|
|
239
|
+
readonly icon?: VocabIcon;
|
|
240
|
+
}
|
|
241
|
+
/** Wording that differs for a device type or role (a switch that is a siren). */
|
|
242
|
+
export interface VocabWording<C extends VocabCapName> {
|
|
243
|
+
/** Keyed by action id. */
|
|
244
|
+
readonly actions?: Readonly<Record<string, VocabActionWording>>;
|
|
245
|
+
readonly state?: {
|
|
246
|
+
readonly [F in CapStatusField<C>]?: VocabStateWording;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/** Overrides, keyed in the same map: a role beats a type. */
|
|
250
|
+
export interface VocabOverrides<C extends VocabCapName> {
|
|
251
|
+
readonly byType?: {
|
|
252
|
+
readonly [T in DeviceType]?: VocabWording<C>;
|
|
253
|
+
};
|
|
254
|
+
readonly byRole?: {
|
|
255
|
+
readonly [R in DeviceRole]?: VocabWording<C>;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
type DeviceEventsBlock<C extends VocabCapName> = [CapEventName<C>] extends [never] ? {
|
|
259
|
+
readonly events?: undefined;
|
|
260
|
+
} : {
|
|
261
|
+
/** EVERY declared cap event: a trigger, or an excuse. */
|
|
262
|
+
readonly events: {
|
|
263
|
+
readonly [E in CapEventName<C>]: VocabEventTrigger | VocabEventExcused;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
/** The vocabulary of a device-scoped cap. */
|
|
267
|
+
export type DeviceCapVocabulary<C extends VocabCapName> = {
|
|
268
|
+
readonly scope: 'device';
|
|
269
|
+
/** What the cap is, for grouping ("Switch" / "Interruttore"). */
|
|
270
|
+
readonly noun: L10n;
|
|
271
|
+
readonly actions?: readonly VocabAction<C>[];
|
|
272
|
+
/** Operate methods deliberately NOT offered, with the reason. */
|
|
273
|
+
readonly notOperatorFacing?: {
|
|
274
|
+
readonly [M in CapMethodName<C>]?: string;
|
|
275
|
+
};
|
|
276
|
+
readonly state?: readonly VocabStateTrigger<C>[];
|
|
277
|
+
/** Bus events the cap's devices emit with no declared cap event behind them. */
|
|
278
|
+
readonly extraEvents?: readonly VocabEventTrigger[];
|
|
279
|
+
readonly overrides?: VocabOverrides<C>;
|
|
280
|
+
} & DeviceEventsBlock<C>;
|
|
281
|
+
/** A system-scoped cap: never a device's vocabulary, and why. */
|
|
282
|
+
export interface SystemCapVocabulary {
|
|
283
|
+
readonly scope: 'system';
|
|
284
|
+
readonly notOperatorFacing: string;
|
|
285
|
+
}
|
|
286
|
+
/** The entry a cap must have. */
|
|
287
|
+
export type CapVocabularyEntry<C extends VocabCapName> = CapDef<C>['scope'] extends 'device' ? DeviceCapVocabulary<C> : SystemCapVocabulary;
|
|
288
|
+
/** The complete map: one entry per cap, no more, no fewer. */
|
|
289
|
+
export type CapVocabularyMap = {
|
|
290
|
+
readonly [C in VocabCapName]: CapVocabularyEntry<C>;
|
|
291
|
+
};
|
|
292
|
+
/** A slice of the map, for files that hold a family of caps. */
|
|
293
|
+
export type CapVocabularySlice<K extends VocabCapName> = {
|
|
294
|
+
readonly [C in K]: CapVocabularyEntry<C>;
|
|
295
|
+
};
|
|
296
|
+
/** A dynamic offer with no cap-specific key type. */
|
|
297
|
+
export type LooseDynamicOffer = {
|
|
298
|
+
readonly kind: 'dynamic';
|
|
299
|
+
readonly from: 'status';
|
|
300
|
+
readonly field: string;
|
|
301
|
+
readonly valueKey?: string;
|
|
302
|
+
readonly labelKey?: string;
|
|
303
|
+
readonly where?: {
|
|
304
|
+
readonly key: string;
|
|
305
|
+
readonly equals: string | number | boolean;
|
|
306
|
+
};
|
|
307
|
+
readonly valueKind?: 'string' | 'number';
|
|
308
|
+
} | {
|
|
309
|
+
readonly kind: 'dynamic';
|
|
310
|
+
readonly from: 'method';
|
|
311
|
+
readonly method: string;
|
|
312
|
+
readonly valueKey?: string;
|
|
313
|
+
readonly labelKey?: string;
|
|
314
|
+
readonly where?: {
|
|
315
|
+
readonly key: string;
|
|
316
|
+
readonly equals: string | number | boolean;
|
|
317
|
+
};
|
|
318
|
+
readonly valueKind?: 'string' | 'number';
|
|
319
|
+
};
|
|
320
|
+
/** An offer as a consumer reads it. */
|
|
321
|
+
export type LooseVocabOffer = EnumOffer | NumberOffer | TextOffer | BooleanOffer | LooseDynamicOffer;
|
|
322
|
+
/** An open arg as a consumer reads it, with no cap-specific key type. */
|
|
323
|
+
export interface LooseVocabOpenArg {
|
|
324
|
+
readonly key: string;
|
|
325
|
+
readonly label: L10n;
|
|
326
|
+
readonly offer: LooseVocabOffer;
|
|
327
|
+
readonly optional?: boolean;
|
|
328
|
+
}
|
|
329
|
+
/** An action as a consumer reads it. */
|
|
330
|
+
export interface LooseVocabAction {
|
|
331
|
+
readonly id: string;
|
|
332
|
+
readonly method: string;
|
|
333
|
+
readonly label: L10n;
|
|
334
|
+
readonly phrase: L10n;
|
|
335
|
+
readonly icon: VocabIcon;
|
|
336
|
+
readonly args?: Readonly<Record<string, unknown>>;
|
|
337
|
+
readonly openArgs?: readonly LooseVocabOpenArg[];
|
|
338
|
+
}
|
|
339
|
+
/** A boolean state trigger, string-keyed. */
|
|
340
|
+
export interface LooseBooleanStateTrigger {
|
|
341
|
+
readonly kind: 'boolean';
|
|
342
|
+
readonly field: string;
|
|
343
|
+
readonly label: L10n;
|
|
344
|
+
readonly whenTrue: L10n;
|
|
345
|
+
readonly whenFalse: L10n;
|
|
346
|
+
readonly icon: VocabIcon;
|
|
347
|
+
}
|
|
348
|
+
/** A numeric state trigger, string-keyed. */
|
|
349
|
+
export interface LooseNumericStateTrigger {
|
|
350
|
+
readonly kind: 'numeric';
|
|
351
|
+
readonly field: string;
|
|
352
|
+
readonly quantity: L10n;
|
|
353
|
+
readonly label: L10n;
|
|
354
|
+
readonly unit?: string;
|
|
355
|
+
readonly unitField?: string;
|
|
356
|
+
readonly icon: VocabIcon;
|
|
357
|
+
}
|
|
358
|
+
/** An enum state trigger, string-keyed. */
|
|
359
|
+
export interface LooseEnumStateTrigger {
|
|
360
|
+
readonly kind: 'enum';
|
|
361
|
+
readonly field: string;
|
|
362
|
+
readonly label: L10n;
|
|
363
|
+
readonly values: readonly EnumStateValue[];
|
|
364
|
+
readonly icon: VocabIcon;
|
|
365
|
+
}
|
|
366
|
+
/** A free-value state trigger, string-keyed. */
|
|
367
|
+
export interface LooseValueStateTrigger {
|
|
368
|
+
readonly kind: 'value';
|
|
369
|
+
readonly field: string;
|
|
370
|
+
readonly label: L10n;
|
|
371
|
+
readonly offer?: LooseDynamicOffer;
|
|
372
|
+
readonly phrase?: L10n;
|
|
373
|
+
readonly icon: VocabIcon;
|
|
374
|
+
}
|
|
375
|
+
/** A state trigger as a consumer reads it. */
|
|
376
|
+
export type LooseVocabStateTrigger = LooseBooleanStateTrigger | LooseNumericStateTrigger | LooseEnumStateTrigger | LooseValueStateTrigger;
|
|
377
|
+
/** Wording overrides as a consumer reads them. */
|
|
378
|
+
export interface LooseVocabWording {
|
|
379
|
+
readonly actions?: Readonly<Record<string, VocabActionWording>>;
|
|
380
|
+
readonly state?: Readonly<Record<string, VocabStateWording | undefined>>;
|
|
381
|
+
}
|
|
382
|
+
/** Overrides as a consumer reads them. */
|
|
383
|
+
export interface LooseVocabOverrides {
|
|
384
|
+
readonly byType?: Readonly<Record<string, LooseVocabWording | undefined>>;
|
|
385
|
+
readonly byRole?: Readonly<Record<string, LooseVocabWording | undefined>>;
|
|
386
|
+
}
|
|
387
|
+
/** Any entry of the map, string-keyed. */
|
|
388
|
+
export interface LooseCapVocabularyEntry {
|
|
389
|
+
readonly scope: 'device' | 'system';
|
|
390
|
+
readonly noun?: L10n;
|
|
391
|
+
readonly actions?: readonly LooseVocabAction[];
|
|
392
|
+
readonly notOperatorFacing?: string | Readonly<Record<string, string | undefined>>;
|
|
393
|
+
readonly state?: readonly LooseVocabStateTrigger[];
|
|
394
|
+
readonly events?: Readonly<Record<string, VocabEventTrigger | VocabEventExcused>>;
|
|
395
|
+
readonly extraEvents?: readonly VocabEventTrigger[];
|
|
396
|
+
readonly overrides?: LooseVocabOverrides;
|
|
397
|
+
}
|
|
398
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CapVocabularyMap, LooseCapVocabularyEntry } from './types.js';
|
|
2
|
+
/** Every capability's vocabulary, keyed by cap name. */
|
|
3
|
+
export declare const CAP_VOCABULARY: CapVocabularyMap;
|
|
4
|
+
/** The same map, read by a string cap name (a binding names caps as strings). */
|
|
5
|
+
export declare const CAP_VOCABULARY_BY_NAME: Readonly<Record<string, LooseCapVocabularyEntry>>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import type { LooseVocabOffer } from './cap-vocabulary/types.js';
|
|
1
2
|
import { DeviceType } from './device-type.js';
|
|
2
3
|
/** An arg the authoring UI collects (not baked into the catalogue entry). */
|
|
3
4
|
export interface DeviceDoOpenArg {
|
|
4
5
|
readonly key: string;
|
|
5
6
|
readonly label: string;
|
|
6
7
|
readonly kind: 'string' | 'number';
|
|
8
|
+
/** How the vocabulary says to offer values (enum, range, the device's own list). */
|
|
9
|
+
readonly offer?: LooseVocabOffer;
|
|
10
|
+
/** The method accepts the call without it. */
|
|
11
|
+
readonly optional?: boolean;
|
|
7
12
|
}
|
|
8
13
|
/** One operator-facing action that becomes a cap method call. */
|
|
9
14
|
export interface DeviceDoAction {
|
|
@@ -22,8 +27,9 @@ export interface DeviceDoAction {
|
|
|
22
27
|
readonly openArgs?: readonly DeviceDoOpenArg[];
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
30
|
+
* The catalogue: every device-cap action of the vocabulary, in the
|
|
31
|
+
* vocabulary's order (the order the select draws). Args are baked in so the
|
|
32
|
+
* authoring UI never asks for JSON for these.
|
|
27
33
|
*/
|
|
28
34
|
export declare const DEVICE_DO_ACTIONS: readonly DeviceDoAction[];
|
|
29
35
|
/** True when METHOD_ACCESS_MAP still exposes this cap.method as actuatable. */
|
|
@@ -12942,6 +12942,11 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
12942
12942
|
access: ("delete" | "view" | "create")[];
|
|
12943
12943
|
} | {
|
|
12944
12944
|
type: "preferences-self";
|
|
12945
|
+
} | {
|
|
12946
|
+
type: "viewer";
|
|
12947
|
+
allow: "*" | number[];
|
|
12948
|
+
block: number[];
|
|
12949
|
+
features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
12945
12950
|
})[];
|
|
12946
12951
|
createdAt: number;
|
|
12947
12952
|
expiresAt: number | null;
|
|
@@ -12999,6 +13004,11 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
12999
13004
|
access: ("delete" | "view" | "create")[];
|
|
13000
13005
|
} | {
|
|
13001
13006
|
type: "preferences-self";
|
|
13007
|
+
} | {
|
|
13008
|
+
type: "viewer";
|
|
13009
|
+
allow: "*" | number[];
|
|
13010
|
+
block: number[];
|
|
13011
|
+
features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
13002
13012
|
})[];
|
|
13003
13013
|
createdAt: number;
|
|
13004
13014
|
expiresAt: number | null;
|
|
@@ -13056,6 +13066,11 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
13056
13066
|
access: ("delete" | "view" | "create")[];
|
|
13057
13067
|
} | {
|
|
13058
13068
|
type: "preferences-self";
|
|
13069
|
+
} | {
|
|
13070
|
+
type: "viewer";
|
|
13071
|
+
allow: "*" | number[];
|
|
13072
|
+
block: number[];
|
|
13073
|
+
features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
13059
13074
|
})[];
|
|
13060
13075
|
createdAt: number;
|
|
13061
13076
|
expiresAt: number | null;
|
|
@@ -13550,6 +13565,8 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
13550
13565
|
isApiKey: boolean;
|
|
13551
13566
|
scope?: {
|
|
13552
13567
|
isAdmin: boolean;
|
|
13568
|
+
role: "scoped" | "admin" | "viewer";
|
|
13569
|
+
features: readonly ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
13553
13570
|
allDevicesViewable: boolean;
|
|
13554
13571
|
viewableDeviceCount: number;
|
|
13555
13572
|
device: {
|
|
@@ -13586,6 +13603,8 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
13586
13603
|
};
|
|
13587
13604
|
output: {
|
|
13588
13605
|
isAdmin: boolean;
|
|
13606
|
+
role: "scoped" | "admin" | "viewer";
|
|
13607
|
+
features: readonly ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
13589
13608
|
allDevicesViewable: boolean;
|
|
13590
13609
|
viewableDeviceCount: number;
|
|
13591
13610
|
device: {
|
|
@@ -13918,6 +13937,11 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
13918
13937
|
access: ("delete" | "view" | "create")[];
|
|
13919
13938
|
} | {
|
|
13920
13939
|
type: "preferences-self";
|
|
13940
|
+
} | {
|
|
13941
|
+
type: "viewer";
|
|
13942
|
+
allow: "*" | number[];
|
|
13943
|
+
block: number[];
|
|
13944
|
+
features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
13921
13945
|
})[];
|
|
13922
13946
|
createdAt: number;
|
|
13923
13947
|
expiresAt: number | null;
|
|
@@ -13975,6 +13999,11 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
13975
13999
|
access: ("delete" | "view" | "create")[];
|
|
13976
14000
|
} | {
|
|
13977
14001
|
type: "preferences-self";
|
|
14002
|
+
} | {
|
|
14003
|
+
type: "viewer";
|
|
14004
|
+
allow: "*" | number[];
|
|
14005
|
+
block: number[];
|
|
14006
|
+
features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
13978
14007
|
})[];
|
|
13979
14008
|
createdAt: number;
|
|
13980
14009
|
expiresAt: number | null;
|
|
@@ -14032,6 +14061,11 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
14032
14061
|
access: ("delete" | "view" | "create")[];
|
|
14033
14062
|
} | {
|
|
14034
14063
|
type: "preferences-self";
|
|
14064
|
+
} | {
|
|
14065
|
+
type: "viewer";
|
|
14066
|
+
allow: "*" | number[];
|
|
14067
|
+
block: number[];
|
|
14068
|
+
features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
14035
14069
|
})[];
|
|
14036
14070
|
createdAt: number;
|
|
14037
14071
|
expiresAt: number | null;
|
|
@@ -14526,6 +14560,8 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
14526
14560
|
isApiKey: boolean;
|
|
14527
14561
|
scope?: {
|
|
14528
14562
|
isAdmin: boolean;
|
|
14563
|
+
role: "scoped" | "admin" | "viewer";
|
|
14564
|
+
features: readonly ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
14529
14565
|
allDevicesViewable: boolean;
|
|
14530
14566
|
viewableDeviceCount: number;
|
|
14531
14567
|
device: {
|
|
@@ -14562,6 +14598,8 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
14562
14598
|
};
|
|
14563
14599
|
output: {
|
|
14564
14600
|
isAdmin: boolean;
|
|
14601
|
+
role: "scoped" | "admin" | "viewer";
|
|
14602
|
+
features: readonly ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
|
|
14565
14603
|
allDevicesViewable: boolean;
|
|
14566
14604
|
viewableDeviceCount: number;
|
|
14567
14605
|
device: {
|
|
@@ -8,12 +8,15 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Coverage: 1384 method paths across 179 capabilities.
|
|
10
10
|
*/
|
|
11
|
+
import type { MethodRole } from '../auth/viewer-access.js';
|
|
11
12
|
import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
|
|
12
13
|
export interface MethodAccessRecord {
|
|
13
14
|
readonly capName: string;
|
|
14
15
|
readonly capScope: 'device' | 'system';
|
|
15
16
|
readonly addonId: string | null;
|
|
16
17
|
readonly access: CapabilityMethodAccess;
|
|
18
|
+
/** What the method is for a viewer (D921): `public`, `viewer`, `admin` or `feature:<id>`. */
|
|
19
|
+
readonly role: MethodRole;
|
|
17
20
|
}
|
|
18
21
|
export declare const METHOD_ACCESS_MAP: Readonly<Record<string, MethodAccessRecord>>;
|
|
19
22
|
/** Set of all known cap names — handy for the scope picker. */
|
package/dist/index.d.ts
CHANGED
|
@@ -152,6 +152,7 @@ export * from './types/pipeline-step.js';
|
|
|
152
152
|
export * from './types/tracked.js';
|
|
153
153
|
export { type BearerPayloadShape, type BearerPrincipal, classifyBearerPrincipal, methodAccessForHttpMethod, type PrincipalAddonReachInput, type PrincipalAddonReachVerdict, principalMayReachAddon, scopesAllowAddon, scopesAllowDeviceCap, } from './auth/principal-scope.js';
|
|
154
154
|
export { ADMIN_SCOPE, ALL_METHOD_ACCESS, type AddonRoutesScope, AddonRoutesScopeSchema, capabilityScopesOf, CREDENTIAL_TOKEN_AUDIENCE, CREDENTIAL_TOKEN_KIND, isCredentialTokenPayload, type CredentialScope, CredentialScopeSchema, type CredentialTokenClaims, CredentialTokenClaimsSchema, parseCredentialScopes, PREFERENCES_SELF_SCOPE, type PreferencesSelfScope, PreferencesSelfScopeSchema, SHARE_VIEW_MAX_DEVICES, scopesAllowAddonRoutes, scopesAllowOwnPreferences, scopesGrantAdmin, type ShareViewGrant, ShareViewGrantSchema, type ShareViewScope, ShareViewScopeSchema, shareViewGrantOf, } from './auth/credential-scope.js';
|
|
155
|
+
export { DEFAULT_VIEWER_SCOPE, featureOfRole, type MethodRole, type MethodRoleDecl, type MethodRoleSource, methodRoleOf, resolveMethodRole, type ViewerAncestorLookup, viewerAdmitsDevice, type ViewerDeviceAllow, ViewerDeviceAllowSchema, VIEWER_FEATURE_IDS, VIEWER_FEATURES, type ViewerFeatureId, ViewerFeatureIdSchema, type ViewerFeatureSpec, viewerHoldsRole, type ViewerTokenScope, ViewerTokenScopeSchema, } from './auth/viewer-access.js';
|
|
155
156
|
export { type PreferenceNamespace, PreferenceNamespaceSchema, type PreferenceRow, PreferenceRowSchema, type PreferenceValue, PreferenceValueSchema, PreferenceDeviceIdSchema, type PreferencesChangedSinceInput, PreferencesChangedSinceInputSchema, type PreferencesChangedSinceOutput, PreferencesChangedSinceOutputSchema, type PreferencesDeleteInput, PreferencesDeleteInputSchema, type PreferencesDeleteOutput, PreferencesDeleteOutputSchema, type PreferencesGetInput, PreferencesGetInputSchema, type PreferencesGetOutput, PreferencesGetOutputSchema, type PreferencesPutInput, PreferencesPutInputSchema, type PreferencesPutOutput, PreferencesPutOutputSchema, PREFERENCES_MAX_DEVICE_ID_LENGTH, PREFERENCES_MAX_NAMESPACES, PREFERENCES_MAX_VALUE_BYTES, PREFERENCES_NAMESPACE_PATTERN, } from './schemas/user-preferences.js';
|
|
156
157
|
export { APP_AUTH_CALLBACK_MAX_LENGTH, APP_AUTH_CALLBACK_URLS, canonicalizeAppCallback, hasUrlScheme, parseAppAuthCallback, } from './auth/app-callback.js';
|
|
157
158
|
export { APP_FLOW_DEFAULT_REDIRECT, APP_FLOW_REFUSAL_MESSAGES, APP_FLOW_STATE_PREFIX, APP_REFUSED_PATH, APP_START_REFUSAL_MESSAGES, type AppFlowParse, type AppFlowPurpose, AppFlowPurposeSchema, type AppFlowRefusal, type AppFlowRequest, type AppPageLang, AppPageLangSchema, type AppLoginPath, AppLoginPathSchema, type AppStartRefusal, appFlowLocation, isAppStartRefusal, parseAppFlowRequest, parseAppPageLang, } from './auth/app-flow.js';
|
|
@@ -162,6 +163,7 @@ export type { AutomationAction, AutomationCondition, AutomationConditionAll, Aut
|
|
|
162
163
|
export { AutomationActionSchema, AutomationConditionOperatorSchema, AutomationConditionSchema, AutomationRecipeSchema, AutomationTriggerSchema, conditionDepth, countConditionLeaves, generateAutomationBlock, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, validateRecipeBounds, } from './automation/index.js';
|
|
163
164
|
export * from './cap-call-context.js';
|
|
164
165
|
export * from './capabilities/index.js';
|
|
166
|
+
export * from './clips/clip-event-labels.js';
|
|
165
167
|
export * from './device-extension/index.js';
|
|
166
168
|
export * from './composition/index.js';
|
|
167
169
|
export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, getAudioMacroClassIds, mapAudioLabelToMacro, YAMNET_TO_MACRO, } from './catalogs/audio-classmap.js';
|
|
@@ -197,6 +199,8 @@ export type { AccessoryControlInput, AccessoryControlKind, AccessoryControlPick,
|
|
|
197
199
|
export { DEVICE_TYPE_CONTROL_KIND, hasMotionTrigger, isNode, MOTION_TRIGGER_FEATURE, pickAccessoryControl, resolveDeviceControlKind, resolveMutate, SENSOR_FEATURES, SENSOR_MAP, } from './device/device-control-resolution.js';
|
|
198
200
|
export type { DeviceDoAction, DeviceDoOpenArg } from './device/device-do-actions.js';
|
|
199
201
|
export { actionsForBoundCaps, actionsForDevice, actionsForDevices, actionsForDeviceType, allDoActions, DEVICE_DO_ACTIONS, DEVICE_TYPE_DO_CAPS, deviceDoFamily, doActionSelectValue, isDoActionActuatable, isDoPickerDeviceType, matchDoAction, sameDoFamily, } from './device/device-do-actions.js';
|
|
202
|
+
export type { CapVocabularyEntry, CapVocabularyMap, L10n as VocabL10n, LooseCapVocabularyEntry, LooseVocabOffer, LooseVocabOpenArg, ResolvedBooleanTrigger, ResolvedEnumTrigger, ResolvedEnumValue, ResolvedEventTrigger, ResolvedNumericTrigger, ResolvedValueTrigger, ResolvedVocabAction, ResolvedVocabTrigger, VocabBindingsInput, VocabCapName, VocabLocale, } from './device/cap-vocabulary/index.js';
|
|
203
|
+
export { actionsForDevice as vocabularyActionsForDevice, CAP_VOCABULARY, CAP_VOCABULARY_BY_NAME, renderVocabPhrase, triggersForDevice as vocabularyTriggersForDevice, VOCAB_TEMPLATES, } from './device/cap-vocabulary/index.js';
|
|
200
204
|
export type { ChildLayout, ChildLayoutEntry, CreateDeviceSpec, DeviceCapDisplayOverride, DeviceDiscovery, DeviceDisplayOverride, DeviceManualCreation, DeviceMeta, DiscoveredDevice, InitialDeviceMeta, RoleDisplayDefault, SavedDevice, } from './device/device-management.js';
|
|
201
205
|
export type { DeviceProfile, DeviceProfileDefaults, DeviceProfileMatch, PipelinePhaseMode, } from './device/device-profile.js';
|
|
202
206
|
export { BATTERY_DEVICE_PROFILE, DEVICE_PROFILES, deviceMatchesProfile, resolveDeviceProfile, } from './device/device-profile.js';
|
|
@@ -303,8 +307,8 @@ export { DEFAULT_DETAIL_CROP_CONVENTION, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_
|
|
|
303
307
|
export { FACE_RESCORE_INTERVAL_FIELD, FACE_RESCORE_INTERVAL_KEY, FACE_RESCORE_INTERVAL_MIN_RUNNING, FACE_RESCORE_SECTION_ID, type FaceRescoreSettingsView, pickFaceRescoreIntervalMinutes, readFaceRescoreIntervalMinutes, } from './pipeline/face-rescore-schedule.js';
|
|
304
308
|
export { DEFAULT_NATIVE_LEASE_SETTINGS, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SCENE_BUDGET_FIELD, NATIVE_LEASE_SCENE_BUDGET_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, type NativeLeaseAdmission, NativeLeaseAdmissionSchema, type NativeLeaseKnob, type NativeLeaseNumberKnob, type NativeLeaseSettings, type NativeLeaseSettingsOverride, NativeLeaseSettingsSchema, pickNativeLeaseOverride, readNativeLeaseOverride, } from './pipeline/native-lease.js';
|
|
305
309
|
export { ACCESS_ROLES, type AccessRoleAssignment, type AccessRoleId, type AccessRoleSpec, buildRoleScopes, detectAccessRole, roleSpec, } from './schemas/access-roles.js';
|
|
306
|
-
export { type CapScope, CapScopeSchema, type DeviceSelector, DeviceSelectorSchema, type DeviceTokenScope, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, } from './schemas/auth-records.js';
|
|
307
|
-
export { type DeviceMetaLike, type DeviceReachSummary, deviceSelectorMatches, type EffectiveScope, normalizeTokenScopes, resolveViewableDeviceIds, type ScopeGrantSummary, scopeInherits, summarizeEffectiveScope, } from './schemas/device-selector.js';
|
|
310
|
+
export { type CapScope, CapScopeSchema, type DeviceSelector, DeviceSelectorSchema, type DeviceTokenScope, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, type UserScope, UserScopeSchema, } from './schemas/auth-records.js';
|
|
311
|
+
export { type DeviceMetaLike, type DeviceReachSummary, deviceSelectorMatches, type EffectiveScope, grantRowsOf, normalizeTokenScopes, resolveViewableDeviceIds, type ScopeGrantSummary, scopeInherits, summarizeEffectiveScope, viewerScopeOf, } from './schemas/device-selector.js';
|
|
308
312
|
export type { CameraDetectionCapabilities, CameraMotionConfig, CameraNativeDetectionConfig, } from './types/camera-detection.js';
|
|
309
313
|
export { DEVICE_TYPE_INFO, type DeviceTypeInfo } from './types/device-type.js';
|
|
310
314
|
export * from './units/index.js';
|