errors: typed helpers for every documented error type
AlexaErrors has a helper for each of the 73 types of the table on alexa-errorresponse.html, named after the type in camel case: 63 take the message only, 10 take the payload fields their page documents. A field the page requires (reason, currentDeviceMode, currentChargeState, resourceType) is a required argument, so leaving it out does not compile; from JavaScript the helper throws a TypeError that lists the values. validRange is optional, as the page says, and has both ends when given. temperatureOutOfRange and setpointsTooClose stay as shorter names. The helpers are compared with the 15 examples of the four error pages. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
4a3dd81bcf
commit
94b13f733a
36 changed files with 874 additions and 138 deletions
16
dist/types/registry/catalog.d.ts
vendored
16
dist/types/registry/catalog.d.ts
vendored
|
|
@ -42,5 +42,21 @@ export declare const LIMITS: {
|
|||
readonly additionalAttributeLength: 256;
|
||||
readonly cookieBytes: 5000;
|
||||
};
|
||||
declare const ERROR_TYPES_BY_NAMESPACE: {
|
||||
readonly Alexa: readonly ["ALREADY_IN_OPERATION", "BRIDGE_UNREACHABLE", "CLOUD_CONTROL_DISABLED", "DEVICE_STUCK", "DO_NOT_DISTURB_MODE", "ENDPOINT_BUSY", "ENDPOINT_CONTROL_UNAVAILABLE", "ENDPOINT_LOW_POWER", "ENDPOINT_UNREACHABLE", "EXPIRED_AUTHORIZATION_CREDENTIAL", "FIRMWARE_OUT_OF_DATE", "HARDWARE_MALFUNCTION", "INSUFFICIENT_PERMISSIONS", "INSUFFICIENT_RESOURCE", "INTERNAL_ERROR", "INVALID_AUTHORIZATION_CREDENTIAL", "INVALID_DIRECTIVE", "INVALID_VALUE", "MAINTENANCE_REQUIRED", "NO_SUCH_ENDPOINT", "NOT_CALIBRATED", "NOT_IN_OPERATION", "NOT_SUPPORTED_IN_CURRENT_MODE", "NOT_SUPPORTED_WITH_CURRENT_BATTERY_CHARGE_STATE", "PARTNER_APPLICATION_REDIRECTION", "POWER_LEVEL_NOT_SUPPORTED", "RATE_LIMIT_EXCEEDED", "TEMPERATURE_VALUE_OUT_OF_RANGE", "TOO_MANY_FAILED_ATTEMPTS", "UNABLE_TO_CHARGE", "VALUE_OUT_OF_RANGE"];
|
||||
readonly "Alexa.Commissionable.ReportCommissioningInformation": readonly ["FAILED_TO_BOOTSTRAP_COMMISSIONING_PROCESS", "MAX_COMMISSIONING_LIMIT_REACHED"];
|
||||
readonly "Alexa.Cooking": readonly ["CHILD_LOCK", "COOK_DURATION_TOO_LONG", "DOOR_CLOSED_TOO_LONG", "DOOR_OPEN", "PREHEAT_REQUIRED", "PROBE_REQUIRED", "REMOTE_START_NOT_SUPPORTED", "REMOVE_PROBE", "REMOTE_START_DISABLED"];
|
||||
readonly "Alexa.DataController": readonly ["DATA_DELETION_NOT_SUPPORTED", "DATA_RETRIEVAL_NOT_SUPPORTED"];
|
||||
readonly "Alexa.Safety": readonly ["OBSTACLE_DETECTED", "SAFETY_BEAM_BREACHED"];
|
||||
readonly "Alexa.SecurityPanelController": readonly ["AUTHORIZATION_REQUIRED", "BYPASS_NEEDED", "NOT_READY", "UNAUTHORIZED", "UNCLEARED_ALARM", "UNCLEARED_TROUBLE"];
|
||||
readonly "Alexa.SmartVision.ObjectDetectionSensor": readonly ["SUBSCRIPTION_REQUIRED"];
|
||||
readonly "Alexa.SmartVision.SnapshotProvider": readonly ["DISABLED_BY_USER"];
|
||||
readonly "Alexa.ThermostatController": readonly ["DUAL_SETPOINTS_UNSUPPORTED", "REQUESTED_SETPOINTS_TOO_CLOSE", "THERMOSTAT_IS_OFF", "TRIPLE_SETPOINTS_UNSUPPORTED", "UNSUPPORTED_THERMOSTAT_MODE", "UNWILLING_TO_SET_SCHEDULE", "UNWILLING_TO_SET_VALUE"];
|
||||
readonly "Alexa.ThermostatController.Configuration": readonly ["CONFIGURATION_UPDATE_NOT_ALLOWED", "COOLING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE", "COOLING_STAGES_EXCEEDS_LIMIT", "HEATING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE", "HEATING_STAGES_EXCEEDS_LIMIT", "INVALID_AUXILIARY_HEATING_SYSTEM_TYPE", "INVALID_SYSTEM_TYPE", "INVALID_TARGET_STATE", "INVALID_TEMPERATURE_SCALE", "INVALID_TERMINAL_CONNECTION", "MISSING_SETUP_INFORMATION"];
|
||||
readonly "Alexa.ThermostatController.Schedule": readonly ["INSUFFICIENT_SPACE"];
|
||||
};
|
||||
/** "ENDPOINT_UNREACHABLE": a type of the table. */
|
||||
export type ErrorType = (typeof ERROR_TYPES_BY_NAMESPACE)[keyof typeof ERROR_TYPES_BY_NAMESPACE][number];
|
||||
/** The 73 error types of the table, each with the namespace its ErrorResponse goes under. */
|
||||
export declare const ERROR_TYPES: Readonly<Record<string, string>>;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export declare const EndpointHealth: import("../types.js").InterfaceDescriptor<{
|
|||
connectivity: {
|
||||
name: string;
|
||||
value: import("../schema.js").Schema<import("../schema.js").InferShape<{
|
||||
value: import("../schema.js").EnumSchema<"OK" | "UNREACHABLE">;
|
||||
value: import("../schema.js").EnumSchema<"UNREACHABLE" | "OK">;
|
||||
reason: import("../schema.js").OptionalSchema<"UNKNOWN" | "WIFI_BAD_PASSWORD" | "WIFI_AP_NOT_FOUND" | "WIFI_ROUTER_UNREACHABLE" | "WIFI_AP_CHANNEL_QUALITY_LOW" | "INTERNET_UNREACHABLE" | "CAPTIVE_PORTAL_CHECK_FAILED">;
|
||||
}>>;
|
||||
note: string;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
export declare const PowerController: import("../types.js").InterfaceDescriptor<{
|
||||
powerState: {
|
||||
name: string;
|
||||
value: import("../schema.js").EnumSchema<"ON" | "OFF">;
|
||||
value: import("../schema.js").EnumSchema<"OFF" | "ON">;
|
||||
};
|
||||
}, {
|
||||
TurnOn: {
|
||||
|
|
|
|||
|
|
@ -17,25 +17,25 @@ export declare const SecurityPanelController: import("../types.js").InterfaceDes
|
|||
burglaryAlarm: {
|
||||
name: string;
|
||||
value: import("../schema.js").Schema<import("../schema.js").InferShape<{
|
||||
value: import("../schema.js").EnumSchema<"OK" | "ALARM">;
|
||||
value: import("../schema.js").EnumSchema<"ALARM" | "OK">;
|
||||
}>>;
|
||||
};
|
||||
fireAlarm: {
|
||||
name: string;
|
||||
value: import("../schema.js").Schema<import("../schema.js").InferShape<{
|
||||
value: import("../schema.js").EnumSchema<"OK" | "ALARM">;
|
||||
value: import("../schema.js").EnumSchema<"ALARM" | "OK">;
|
||||
}>>;
|
||||
};
|
||||
carbonMonoxideAlarm: {
|
||||
name: string;
|
||||
value: import("../schema.js").Schema<import("../schema.js").InferShape<{
|
||||
value: import("../schema.js").EnumSchema<"OK" | "ALARM">;
|
||||
value: import("../schema.js").EnumSchema<"ALARM" | "OK">;
|
||||
}>>;
|
||||
};
|
||||
waterAlarm: {
|
||||
name: string;
|
||||
value: import("../schema.js").Schema<import("../schema.js").InferShape<{
|
||||
value: import("../schema.js").EnumSchema<"OK" | "ALARM">;
|
||||
value: import("../schema.js").EnumSchema<"ALARM" | "OK">;
|
||||
}>>;
|
||||
};
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -67,5 +67,5 @@ export declare const ThermostatController: import("../types.js").InterfaceDescri
|
|||
/** The user can set a temperature for a time: SetTargetTemperature comes with holdUntil. Default: false. */
|
||||
supportsScheduling: import("../schema.js").OptionalSchema<boolean>;
|
||||
/** The properties the thermostat has. Default: the three setpoints and thermostatMode. */
|
||||
properties: import("../schema.js").OptionalSchema<("targetSetpoint" | "lowerSetpoint" | "upperSetpoint" | "thermostatMode" | "adaptiveRecoveryStatus")[]>;
|
||||
properties: import("../schema.js").OptionalSchema<("thermostatMode" | "targetSetpoint" | "lowerSetpoint" | "upperSetpoint" | "adaptiveRecoveryStatus")[]>;
|
||||
}>, false>;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
export declare const ToggleController: import("../types.js").InterfaceDescriptor<{
|
||||
toggleState: {
|
||||
name: string;
|
||||
value: import("../schema.js").EnumSchema<"ON" | "OFF">;
|
||||
value: import("../schema.js").EnumSchema<"OFF" | "ON">;
|
||||
};
|
||||
}, {
|
||||
TurnOn: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue