@seamapi/http
Advanced tools
Comparing version 0.30.1 to 0.31.0
@@ -1,2 +0,2 @@ | ||
import type { ActionAttempt, FailedActionAttempt, SuccessfulActionAttempt } from './action-attempt-types.js'; | ||
import type { ActionAttempt } from '@seamapi/types/connect'; | ||
import type { SeamHttpActionAttempts } from './routes/index.js'; | ||
@@ -7,4 +7,636 @@ export interface ResolveActionAttemptOptions { | ||
} | ||
export declare const resolveActionAttempt: <T extends ActionAttempt>(actionAttempt: T, actionAttempts: SeamHttpActionAttempts, { timeout, pollingInterval }: ResolveActionAttemptOptions) => Promise<SuccessfulActionAttempt<T>>; | ||
export declare const isSeamActionAttemptError: <T extends ActionAttempt>(error: unknown) => error is SeamActionAttemptError<T>; | ||
export declare const resolveActionAttempt: <T extends { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
}>(actionAttempt: T, actionAttempts: SeamHttpActionAttempts, { timeout, pollingInterval }: ResolveActionAttemptOptions) => Promise<Extract<T, { | ||
status: 'success'; | ||
}>>; | ||
export declare const isSeamActionAttemptError: <T extends { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
}>(error: unknown) => error is SeamActionAttemptError<T>; | ||
export declare class SeamActionAttemptError<T extends ActionAttempt> extends Error { | ||
@@ -14,3 +646,318 @@ actionAttempt: T; | ||
} | ||
export declare const isSeamActionAttemptFailedError: <T extends ActionAttempt>(error: unknown) => error is SeamActionAttemptFailedError<T>; | ||
export declare const isSeamActionAttemptFailedError: <T extends { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
}>(error: unknown) => error is SeamActionAttemptFailedError<T>; | ||
export declare class SeamActionAttemptFailedError<T extends ActionAttempt> extends SeamActionAttemptError<T> { | ||
@@ -20,5 +967,326 @@ code: string; | ||
} | ||
export declare const isSeamActionAttemptTimeoutError: <T extends ActionAttempt>(error: unknown) => error is SeamActionAttemptTimeoutError<T>; | ||
export declare const isSeamActionAttemptTimeoutError: <T extends { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "LOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UNLOCK_DOOR"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "RESET_SANDBOX_WORKSPACE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_COOL"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_HEAT_COOL"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_FAN_MODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
result: {}; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SET_THERMOSTAT_OFF"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "SYNC_ACCESS_CODES"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_ACCESS_CODE"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "CREATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "DELETE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "pending"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
} | { | ||
error: null; | ||
status: "success"; | ||
action_attempt_id: string; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
result?: any; | ||
} | { | ||
error: { | ||
type: string; | ||
message: string; | ||
}; | ||
status: "error"; | ||
action_attempt_id: string; | ||
result: null; | ||
action_type: "UPDATE_NOISE_THRESHOLD"; | ||
}>(error: unknown) => error is SeamActionAttemptTimeoutError<T>; | ||
export declare class SeamActionAttemptTimeoutError<T extends ActionAttempt> extends SeamActionAttemptError<T> { | ||
constructor(actionAttempt: T, timeout: number); | ||
} | ||
export type SucceededActionAttempt<T extends ActionAttempt> = Extract<T, { | ||
status: 'success'; | ||
}>; | ||
export type FailedActionAttempt<T extends ActionAttempt> = Extract<T, { | ||
status: 'error'; | ||
}>; |
@@ -1,2 +0,2 @@ | ||
declare const seamapiJavascriptHttpVersion = "0.30.1"; | ||
declare const seamapiJavascriptHttpVersion = "0.31.0"; | ||
export default seamapiJavascriptHttpVersion; |
@@ -1,3 +0,3 @@ | ||
const seamapiJavascriptHttpVersion = '0.30.1'; | ||
const seamapiJavascriptHttpVersion = '0.31.0'; | ||
export default seamapiJavascriptHttpVersion; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@seamapi/http", | ||
"version": "0.30.1", | ||
"version": "0.31.0", | ||
"description": "JavaScript HTTP client for the Seam API written in TypeScript.", | ||
@@ -87,3 +87,3 @@ "type": "module", | ||
"peerDependencies": { | ||
"@seamapi/types": "^1.173.0" | ||
"@seamapi/types": "^1.186.0" | ||
}, | ||
@@ -103,3 +103,3 @@ "peerDependenciesMeta": { | ||
"@seamapi/fake-seam-connect": "^1.44.2", | ||
"@seamapi/types": "1.173.0", | ||
"@seamapi/types": "1.186.0", | ||
"@types/eslint": "^8.44.2", | ||
@@ -106,0 +106,0 @@ "@types/node": "^20.8.10", |
@@ -1,6 +0,3 @@ | ||
import type { | ||
ActionAttempt, | ||
FailedActionAttempt, | ||
SuccessfulActionAttempt, | ||
} from './action-attempt-types.js' | ||
import type { ActionAttempt } from '@seamapi/types/connect' | ||
import type { SeamHttpActionAttempts } from './routes/index.js' | ||
@@ -17,5 +14,5 @@ | ||
{ timeout = 5000, pollingInterval = 500 }: ResolveActionAttemptOptions, | ||
): Promise<SuccessfulActionAttempt<T>> => { | ||
): Promise<SucceededActionAttempt<T>> => { | ||
let timeoutRef | ||
const timeoutPromise = new Promise<SuccessfulActionAttempt<T>>( | ||
const timeoutPromise = new Promise<SucceededActionAttempt<T>>( | ||
(_resolve, reject) => { | ||
@@ -42,3 +39,3 @@ timeoutRef = globalThis.setTimeout(() => { | ||
options: Pick<ResolveActionAttemptOptions, 'pollingInterval'>, | ||
): Promise<SuccessfulActionAttempt<T>> => { | ||
): Promise<SucceededActionAttempt<T>> => { | ||
if (isSuccessfulActionAttempt(actionAttempt)) { | ||
@@ -119,3 +116,3 @@ return actionAttempt | ||
actionAttempt: T, | ||
): actionAttempt is SuccessfulActionAttempt<T> => | ||
): actionAttempt is SucceededActionAttempt<T> => | ||
actionAttempt.status === 'success' | ||
@@ -126,1 +123,11 @@ | ||
): actionAttempt is FailedActionAttempt<T> => actionAttempt.status === 'error' | ||
export type SucceededActionAttempt<T extends ActionAttempt> = Extract< | ||
T, | ||
{ status: 'success' } | ||
> | ||
export type FailedActionAttempt<T extends ActionAttempt> = Extract< | ||
T, | ||
{ status: 'error' } | ||
> |
@@ -1,3 +0,3 @@ | ||
const seamapiJavascriptHttpVersion = '0.30.1' | ||
const seamapiJavascriptHttpVersion = '0.31.0' | ||
export default seamapiJavascriptHttpVersion |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1589939
19862
218