@camstack/types 1.2.453 → 1.2.455
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 +14 -0
- package/dist/automation/action-target.d.ts +86 -0
- package/dist/automation/action.d.ts +28 -4
- package/dist/automation/index.d.ts +6 -4
- package/dist/automation/nc-action-target.d.ts +21 -0
- package/dist/automation/normalize-units.d.ts +1 -1
- package/dist/automation/recipe.d.ts +173 -18
- package/dist/automation/step-runner.d.ts +21 -2
- package/dist/automation/trace.d.ts +42 -0
- package/dist/automation/when.d.ts +33 -1
- package/dist/capabilities/action-source.cap.d.ts +14 -2
- package/dist/capabilities/actions.cap.d.ts +108 -14
- package/dist/capabilities/core-blocks.cap.d.ts +982 -136
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/notification-rules.cap.d.ts +845 -65
- package/dist/capabilities/pipeline-analytics.cap.d.ts +357 -0
- package/dist/capabilities/remote.cap.d.ts +2 -2
- package/dist/capabilities/system.cap.d.ts +4 -0
- package/dist/client.js +1629 -796
- package/dist/client.mjs +1629 -796
- package/dist/device/cap-vocabulary/action-index.d.ts +31 -0
- package/dist/device/cap-vocabulary/index.d.ts +3 -1
- package/dist/device/cap-vocabulary/types.d.ts +27 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +90952 -89858
- package/dist/index.mjs +90918 -89859
- package/dist/remote/remote-config.d.ts +14 -4
- package/dist/time/index.d.ts +2 -0
- package/dist/time/solar.d.ts +37 -0
- package/dist/time/time-spec.d.ts +117 -0
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LooseVocabAction, VocabEffectValue } from './types.js';
|
|
2
|
+
/** A vocabulary action with the cap that offers it. */
|
|
3
|
+
export interface IndexedVocabAction {
|
|
4
|
+
readonly cap: string;
|
|
5
|
+
readonly action: LooseVocabAction;
|
|
6
|
+
}
|
|
7
|
+
/** The state an action leads to, resolved against the args the step carries. */
|
|
8
|
+
export interface ActionEffect {
|
|
9
|
+
readonly cap: string;
|
|
10
|
+
readonly field: string;
|
|
11
|
+
readonly value: VocabEffectValue;
|
|
12
|
+
}
|
|
13
|
+
/** Every vocabulary action id, with its cap. */
|
|
14
|
+
export declare function allVocabActions(): readonly IndexedVocabAction[];
|
|
15
|
+
/** The vocabulary action with this id, or `undefined`. */
|
|
16
|
+
export declare function findVocabAction(actionId: string): IndexedVocabAction | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The action id a stored `cap` + `method` (+ args) pair stands for, when
|
|
19
|
+
* exactly ONE vocabulary action matches it: same cap, same method, and every
|
|
20
|
+
* arg the action bakes in equals the stored one. Two matches (`cover.position`
|
|
21
|
+
* and … none today, but `switch.on` / `switch.off` share a method and differ
|
|
22
|
+
* by their baked arg) are told apart by the baked args; still ambiguous, or
|
|
23
|
+
* none, gives `undefined`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function vocabActionIdFor(cap: string, method: string, args: Readonly<Record<string, unknown>> | undefined): string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The state `actionId` leads to with these args, or `null` when the action
|
|
28
|
+
* declares none (toggle, press, stop), is unknown, or the arg carrying the
|
|
29
|
+
* value is missing.
|
|
30
|
+
*/
|
|
31
|
+
export declare function actionEffect(actionId: string, args: Readonly<Record<string, unknown>> | undefined): ActionEffect | null;
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type { ResolvedBooleanTrigger, ResolvedEnumTrigger, ResolvedEnumValue, ResolvedEventTrigger, ResolvedNumericTrigger, ResolvedValueTrigger, ResolvedVocabAction, ResolvedVocabTrigger, VocabBindingsInput, } from './resolve.js';
|
|
6
6
|
export { actionsForDevice, renderVocabPhrase, triggersForDevice, } from './resolve.js';
|
|
7
|
+
export type { ActionEffect, IndexedVocabAction } from './action-index.js';
|
|
8
|
+
export { actionEffect, allVocabActions, findVocabAction, vocabActionIdFor, } from './action-index.js';
|
|
7
9
|
export { VOCAB_TEMPLATES } from './templates.js';
|
|
8
|
-
export type { ActionArgKey, ActionArgs, BooleanOffer, CapEventName, CapMethodName, CapStatusField, CapVocabularyEntry, CapVocabularyMap, CapVocabularySlice, DeviceCapVocabulary, DeviceVocabCapName, DynamicOffer, EnumOffer, EnumStateValue, L10n, LooseCapVocabularyEntry, LooseDynamicOffer, LooseVocabAction, LooseVocabOffer, LooseVocabOpenArg, LooseVocabStateTrigger, NumberOffer, SystemCapVocabulary, SystemVocabCapName, TextOffer, VocabAction, VocabCapName, VocabChoice, VocabEventTrigger, VocabIcon, VocabLocale, VocabOffer, VocabOpenArg, VocabStateTrigger, } from './types.js';
|
|
10
|
+
export type { ActionArgKey, ActionArgs, BooleanOffer, CapEventName, CapMethodName, CapStatusField, CapVocabularyEntry, CapVocabularyMap, CapVocabularySlice, DeviceCapVocabulary, DeviceVocabCapName, DynamicOffer, EnumOffer, EnumStateValue, L10n, LooseCapVocabularyEntry, LooseDynamicOffer, LooseVocabAction, LooseVocabEffect, LooseVocabOffer, LooseVocabOpenArg, LooseVocabStateTrigger, NumberOffer, SystemCapVocabulary, SystemVocabCapName, TextOffer, VocabAction, VocabCapName, VocabChoice, VocabEffectFor, VocabEffectValue, VocabEventTrigger, VocabIcon, VocabLocale, VocabOffer, VocabOpenArg, VocabStateTrigger, } from './types.js';
|
|
9
11
|
export { CAP_VOCABULARY, CAP_VOCABULARY_BY_NAME } from './vocabulary.js';
|
|
@@ -148,6 +148,22 @@ export interface VocabOpenArg<C extends VocabCapName, K extends string> {
|
|
|
148
148
|
/** The method accepts the call without it. */
|
|
149
149
|
readonly optional?: boolean;
|
|
150
150
|
}
|
|
151
|
+
/** A value a status field can hold, as an action's effect states it. */
|
|
152
|
+
export type VocabEffectValue = string | number | boolean;
|
|
153
|
+
/**
|
|
154
|
+
* The state an action LEADS TO (D983): the cap status field and either a
|
|
155
|
+
* literal value (`cover.open` → `state = 'open'`) or the arg that carries it
|
|
156
|
+
* (`brightness.set` → `level = <level arg>`). Only an action with an effect
|
|
157
|
+
* can be HELD by a scheduler. Absent where the outcome is not a state
|
|
158
|
+
* (toggle, press, stop).
|
|
159
|
+
*/
|
|
160
|
+
export type VocabEffectFor<C extends VocabCapName, M extends CapMethodName<C>> = {
|
|
161
|
+
readonly field: CapStatusField<C>;
|
|
162
|
+
readonly value: VocabEffectValue;
|
|
163
|
+
} | {
|
|
164
|
+
readonly field: CapStatusField<C>;
|
|
165
|
+
readonly fromArg: ActionArgKey<C, M>;
|
|
166
|
+
};
|
|
151
167
|
/** One operator-facing action: a cap method call with a phrase. */
|
|
152
168
|
export interface VocabActionFor<C extends VocabCapName, M extends CapMethodName<C>> {
|
|
153
169
|
/** Stable id — persisted by pickers as a select value (`switch.on`). */
|
|
@@ -165,6 +181,8 @@ export interface VocabActionFor<C extends VocabCapName, M extends CapMethodName<
|
|
|
165
181
|
readonly args?: Partial<ActionArgs<C, M>>;
|
|
166
182
|
/** Args the operator fills. */
|
|
167
183
|
readonly openArgs?: readonly VocabOpenArg<C, ActionArgKey<C, M>>[];
|
|
184
|
+
/** The state this action leads to, when it is one (see {@link VocabEffectFor}). */
|
|
185
|
+
readonly effect?: VocabEffectFor<C, M>;
|
|
168
186
|
}
|
|
169
187
|
/** Any action of cap `C`, discriminated by `method`. */
|
|
170
188
|
export type VocabAction<C extends VocabCapName> = {
|
|
@@ -343,6 +361,14 @@ export interface LooseVocabOpenArg {
|
|
|
343
361
|
readonly offer: LooseVocabOffer;
|
|
344
362
|
readonly optional?: boolean;
|
|
345
363
|
}
|
|
364
|
+
/** An effect as a consumer reads it, with no cap-specific key type. */
|
|
365
|
+
export type LooseVocabEffect = {
|
|
366
|
+
readonly field: string;
|
|
367
|
+
readonly value: VocabEffectValue;
|
|
368
|
+
} | {
|
|
369
|
+
readonly field: string;
|
|
370
|
+
readonly fromArg: string;
|
|
371
|
+
};
|
|
346
372
|
/** An action as a consumer reads it. */
|
|
347
373
|
export interface LooseVocabAction {
|
|
348
374
|
readonly id: string;
|
|
@@ -352,6 +378,7 @@ export interface LooseVocabAction {
|
|
|
352
378
|
readonly icon: VocabIcon;
|
|
353
379
|
readonly args?: Readonly<Record<string, unknown>>;
|
|
354
380
|
readonly openArgs?: readonly LooseVocabOpenArg[];
|
|
381
|
+
readonly effect?: LooseVocabEffect;
|
|
355
382
|
}
|
|
356
383
|
/** A boolean state trigger, string-keyed. */
|
|
357
384
|
export interface LooseBooleanStateTrigger {
|
package/dist/index.d.ts
CHANGED
|
@@ -163,11 +163,13 @@ export { APP_FLOW_DEFAULT_REDIRECT, APP_FLOW_REFUSAL_MESSAGES, APP_FLOW_STATE_PR
|
|
|
163
163
|
export { SSO_STATE_COOKIE, SSO_STATE_COOKIE_MAX_AGE_SEC } from './auth/sso-state.js';
|
|
164
164
|
export { buildDeviceEnrollmentLink, buildDeviceSignatureMessage, type CompleteEnrollmentInput, CompleteEnrollmentInputSchema, type CompleteEnrollmentOutput, CompleteEnrollmentOutputSchema, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_CERT_SIGNATURE, DEVICE_CERT_VALIDITY_DAYS, DEVICE_ENROLLMENT_TTL_MS, DEVICE_NONCE_TTL_MS, DEVICE_SAN_CREDENTIAL_PREFIX, DEVICE_SAN_USER_PREFIX, DEVICE_SIGNATURE_MESSAGE_VERSION, type DeviceCertificateLoginMethod, DeviceCertificateLoginMethodSchema, type DeviceChallenge, DeviceChallengeSchema, type DeviceCredential, DeviceCredentialSchema, type DeviceCredentialStatus, DeviceCredentialStatusSchema, type DevicePlatform, DevicePlatformSchema, type DeviceProofInput, DeviceProofInputSchema, type CompleteEnrollmentResult, CompleteEnrollmentResultSchema, DEFINITIVE_DEVICE_REFUSALS, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, deviceRefusalFromMessage, type DeviceChallengeResult, DeviceChallengeResultSchema, DeviceEnrollProofSchema, type DeviceRefusal, type DeviceRefusalReason, DeviceRefusalReasonSchema, DeviceRefusalSchema, type DeviceRevoker, type EnrollSelfInput, EnrollSelfInputSchema, formatDeviceRevoker, isDefinitiveDeviceRefusal, type RenewDeviceCertificateResult, RenewDeviceCertificateResultSchema, type RevokeOwnDeviceCertificateResult, RevokeOwnDeviceCertificateResultSchema, type DeviceSignaturePurpose, DeviceSignaturePurposeSchema, type RenewDeviceCertificateOutput, RenewDeviceCertificateOutputSchema, type StartEnrollmentOutput, StartEnrollmentOutputSchema, parseDeviceEnrollmentLink, } from './auth/device-certificate.js';
|
|
165
165
|
export { advertisedHubOrigins, claimedRequestOrigins, normalizeOrigin, pickRequestOrigin, type RequestHeaders, requestMountPrefix, } from './auth/request-origin.js';
|
|
166
|
-
export type { ActionStep, AutomationAction, AutomationAll, AutomationAny, AutomationCapStep, AutomationConditionOperator, AutomationConditionTraceNode, AutomationEventLeaf, AutomationLeaf, AutomationNot, AutomationStateLeaf, AutomationWhen, DetectionLabelSource, DetectionLeaf, DetectionSubject, DeviceBecomesLeaf, DeviceIsLeaf, ExpressionLeaf, IdentityLabel, LegacyAutomationRecipe, LegacyCondition, LegacyTrigger, PlateLabel, StationaryLeaf, StationaryPresentLeaf, SubClassLabel, SubjectObservation, SubjectVerdict, AutomationRecipe, AutomationRunMode, AutomationRunOutcome, AutomationRunTrace, AutomationRunVerdict, AutomationStateDoc, AutomationStepTrace, AutomationTriggerTrace, ConditionEvaluation, ConditionReader, DetectionDecision, DetectionTrigger, DetectionVars, GenerateAutomationBlockInput, MirrorRefreshFetchers, MirrorRefreshReport, MirrorSource, StationaryChangedInput, StationaryDecision, StationaryTrigger, StationaryVars, TraceNodeOutcome, TraceValue, TrackLifecycleInput, } from './automation/index.js';
|
|
167
|
-
export { ActionStepSchema, AutomationActionSchema, AutomationCapStepSchema, AutomationWaitStepSchema, EMPTY_AUTOMATION_STATE, mergeSkipTraces, AutomationConditionOperatorSchema, AutomationConditionTraceNodeSchema, AutomationRecipeSchema, AutomationWhenSchema, CurrentAutomationRecipeSchema, DETECTION_LABEL_SOURCES, DetectionSubjectSchema, LegacyAutomationRecipeSchema, LegacyConditionSchema, LegacyTriggerSchema, MAX_TRACE_ARG_LENGTH, MAX_TRACE_ARGS, MAX_WHEN_DEPTH, MAX_WHEN_LEAVES, REDACTED_ARG, StationarySubjectSchema, anySubjectMatches, buildStepArgsTrace, collectWhenMirrorSources, convertLegacyCondition, convertLegacyRecipe, convertLegacyWhen, countWhenLeaves, describeSubject, evaluateWhenTree, forEachLeaf, hasEventLeaves, isEventLeaf, isLeaf, subClassesOf, subjectFromClassName, subjectMatches, validateWhenTree, whenDepth, AutomationRunModeSchema, AutomationRunOutcomeSchema, AutomationRunTraceSchema, AutomationRunVerdictSchema, AutomationStateDocSchema, AutomationStepTraceSchema, AutomationTriggerTraceSchema, appendTrace, buildTriggerTrace, collectMirrorSources, ConditionMirror, DEFAULT_TRACE_KEEP, DetectionTriggerFilter, detectionClassMatches, evaluateConditionTree, evaluateStationaryTrigger, generateAutomationBlock, isSkippedTrace, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_TRACE_KEEP, RunGate, skipSignature, TraceNodeOutcomeSchema, TraceValueSchema, validateRecipeBounds, } from './automation/index.js';
|
|
166
|
+
export type { ActionStep, AutomationAction, AutomationAll, AutomationAny, AutomationCapStep, AutomationConditionOperator, AutomationConditionTraceNode, AutomationEventLeaf, AutomationLeaf, AutomationNot, AutomationStateLeaf, AutomationWhen, DetectionLabelSource, DetectionLeaf, DetectionSubject, DeviceBecomesLeaf, DeviceIsLeaf, ExpressionLeaf, IdentityLabel, LegacyAutomationRecipe, NormalizedCapStep, StepDeviceTrace, LegacyCondition, LegacyTrigger, PlateLabel, StationaryLeaf, StationaryPresentLeaf, SubClassLabel, SubjectObservation, SubjectVerdict, AutomationRecipe, AutomationRunMode, AutomationRunOutcome, AutomationRunTrace, AutomationRunVerdict, AutomationStateDoc, AutomationStepTrace, AutomationTriggerTrace, ConditionEvaluation, ConditionReader, DetectionDecision, DetectionTrigger, DetectionVars, GenerateAutomationBlockInput, MirrorRefreshFetchers, MirrorRefreshReport, MirrorSource, StationaryChangedInput, StationaryDecision, StationaryTrigger, StationaryVars, TraceNodeOutcome, TraceValue, TrackLifecycleInput, } from './automation/index.js';
|
|
167
|
+
export { ActionStepSchema, AutomationActionSchema, AutomationCapStepSchema, AutomationWaitStepSchema, EMPTY_AUTOMATION_STATE, mergeSkipTraces, AutomationConditionOperatorSchema, AutomationConditionTraceNodeSchema, AutomationRecipeSchema, AutomationWhenSchema, CurrentAutomationRecipeSchema, DETECTION_LABEL_SOURCES, DetectionSubjectSchema, LegacyAutomationRecipeSchema, LegacyConditionSchema, LegacyTriggerSchema, MAX_TRACE_ARG_LENGTH, MAX_STEP_DEVICE_OUTCOMES, MAX_TRACE_ARGS, MAX_WHEN_DEPTH, normalizeCapStep, normalizeStepTargets, StepDeviceTraceSchema, MAX_WHEN_LEAVES, REDACTED_ARG, StationarySubjectSchema, anySubjectMatches, buildStepArgsTrace, collectWhenMirrorSources, convertLegacyCondition, convertLegacyRecipe, convertLegacyWhen, countWhenLeaves, describeSubject, evaluateWhenTree, forEachLeaf, hasEventLeaves, isEventLeaf, isLeaf, subClassesOf, subjectFromClassName, subjectMatches, validateWhenTree, whenDepth, AutomationRunModeSchema, AutomationRunOutcomeSchema, AutomationRunTraceSchema, AutomationRunVerdictSchema, AutomationStateDocSchema, AutomationStepTraceSchema, AutomationTriggerTraceSchema, appendTrace, buildTriggerTrace, collectMirrorSources, ConditionMirror, DEFAULT_TRACE_KEEP, DetectionTriggerFilter, detectionClassMatches, evaluateConditionTree, evaluateStationaryTrigger, generateAutomationBlock, isSkippedTrace, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_TRACE_KEEP, RunGate, skipSignature, TraceNodeOutcomeSchema, TraceValueSchema, validateRecipeBounds, } from './automation/index.js';
|
|
168
168
|
export { UnitWarningSchema, capUnitResolver, normalizeActionUnits, normalizeConditionUnits, normalizeRecipeUnits, prepareRecipeUnits, } from './automation/index.js';
|
|
169
169
|
export type { PreparedRecipe, UnitResolver, UnitWarning, UnitsNormalized, } from './automation/index.js';
|
|
170
170
|
export * from './automation/action.js';
|
|
171
|
+
export * from './automation/action-target.js';
|
|
172
|
+
export * from './automation/nc-action-target.js';
|
|
171
173
|
export * from './automation/step-runner.js';
|
|
172
174
|
export * from './automation/export-entities.js';
|
|
173
175
|
export * from './cap-call-context.js';
|
|
@@ -220,8 +222,8 @@ export type { AccessoryControlInput, AccessoryControlKind, AccessoryControlPick,
|
|
|
220
222
|
export { DEVICE_TYPE_CONTROL_KIND, hasMotionTrigger, isNode, MOTION_TRIGGER_FEATURE, pickAccessoryControl, resolveDeviceControlKind, resolveMutate, SENSOR_FEATURES, SENSOR_MAP, } from './device/device-control-resolution.js';
|
|
221
223
|
export type { DeviceDoAction, DeviceDoOpenArg } from './device/device-do-actions.js';
|
|
222
224
|
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';
|
|
223
|
-
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';
|
|
224
|
-
export { actionsForDevice as vocabularyActionsForDevice, CAP_VOCABULARY, CAP_VOCABULARY_BY_NAME, renderVocabPhrase, triggersForDevice as vocabularyTriggersForDevice, VOCAB_TEMPLATES, } from './device/cap-vocabulary/index.js';
|
|
225
|
+
export type { CapVocabularyEntry, CapVocabularyMap, L10n as VocabL10n, ActionEffect, IndexedVocabAction, LooseCapVocabularyEntry, LooseVocabEffect, LooseVocabOffer, LooseVocabOpenArg, ResolvedBooleanTrigger, ResolvedEnumTrigger, ResolvedEnumValue, ResolvedEventTrigger, ResolvedNumericTrigger, ResolvedValueTrigger, ResolvedVocabAction, ResolvedVocabTrigger, VocabBindingsInput, VocabCapName, VocabLocale, } from './device/cap-vocabulary/index.js';
|
|
226
|
+
export { actionEffect, actionsForDevice as vocabularyActionsForDevice, allVocabActions, CAP_VOCABULARY, CAP_VOCABULARY_BY_NAME, findVocabAction, renderVocabPhrase, triggersForDevice as vocabularyTriggersForDevice, VOCAB_TEMPLATES, vocabActionIdFor, } from './device/cap-vocabulary/index.js';
|
|
225
227
|
export type { ChildLayout, ChildLayoutEntry, CreateDeviceSpec, DeviceCapDisplayOverride, DeviceDiscovery, DeviceDisplayOverride, DeviceManualCreation, DeviceMeta, DiscoveredDevice, InitialDeviceMeta, RoleDisplayDefault, SavedDevice, } from './device/device-management.js';
|
|
226
228
|
export type { DeviceProfile, DeviceProfileDefaults, DeviceProfileMatch, PipelinePhaseMode, } from './device/device-profile.js';
|
|
227
229
|
export { BATTERY_DEVICE_PROFILE, DEVICE_PROFILES, deviceMatchesProfile, resolveDeviceProfile, } from './device/device-profile.js';
|
|
@@ -388,3 +390,4 @@ export type { ServerNameInfo } from './system/server-name.js';
|
|
|
388
390
|
export { resolveServerName, SERVER_NAME_MAX_LENGTH, SERVER_NAME_SETTING_KEY, ServerNameInfoSchema, ServerNameSchema, shortHostname, } from './system/server-name.js';
|
|
389
391
|
export { armRemovalReconcile, reconcileRemovedDevices, REMOVAL_RECONCILE_INTERVAL_MS, type RemovalReconcileOptions, type RemovalReconcileOutcome, type TombstoneSource, } from './device/device-removal-reconcile.js';
|
|
390
392
|
export * from './ir/index.js';
|
|
393
|
+
export * from './time/index.js';
|