@ikalogic/at1000 0.1.13 → 0.1.25
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/build/at1000-BWX7kovf.cjs +3 -0
- package/build/{at1000-DBnCRa4B.cjs.map → at1000-BWX7kovf.cjs.map} +1 -1
- package/build/{at1000-BLTMMFOe.d.cts → at1000-DIVuASWg.d.cts} +7 -7
- package/build/at1000-DIVuASWg.d.cts.map +1 -0
- package/build/at1000-TQqJHjwy.mjs +3 -0
- package/build/{at1000-DOi600n-.mjs.map → at1000-TQqJHjwy.mjs.map} +1 -1
- package/build/{at1000-tq5RRNjA.d.mts → at1000-TeP9-fyr.d.mts} +7 -7
- package/build/at1000-TeP9-fyr.d.mts.map +1 -0
- package/build/browser.cjs +1 -1
- package/build/browser.cjs.map +1 -1
- package/build/browser.d.cts +1 -1
- package/build/browser.d.cts.map +1 -1
- package/build/browser.d.mts +2 -8
- package/build/browser.d.mts.map +1 -1
- package/build/browser.mjs +1 -1
- package/build/browser.mjs.map +1 -1
- package/build/com.cjs +2 -1
- package/build/com.cjs.map +1 -0
- package/build/com.d.cts +1155 -2
- package/build/com.d.cts.map +1 -0
- package/build/com.d.mts +1155 -2
- package/build/com.d.mts.map +1 -0
- package/build/com.mjs +2 -1
- package/build/com.mjs.map +1 -0
- package/build/{common-SFHWBeL2.cjs → common-Bbc8Sixu.cjs} +1 -1
- package/build/{common-SFHWBeL2.cjs.map → common-Bbc8Sixu.cjs.map} +1 -1
- package/build/{common-B_zag9Mq.mjs → common-D4tBd_j2.mjs} +1 -1
- package/build/{common-B_zag9Mq.mjs.map → common-D4tBd_j2.mjs.map} +1 -1
- package/build/{common-DAOxX-Zx.d.cts → common-DJ7WSo1p.d.mts} +1 -1
- package/build/common-DJ7WSo1p.d.mts.map +1 -0
- package/build/{common-SiysH9tt.d.mts → common-DWQyDOs5.d.cts} +1 -1
- package/build/common-DWQyDOs5.d.cts.map +1 -0
- package/build/gpio.cjs +2 -1
- package/build/gpio.cjs.map +1 -0
- package/build/gpio.d.cts +358 -3
- package/build/gpio.d.cts.map +1 -0
- package/build/gpio.d.mts +358 -4
- package/build/gpio.d.mts.map +1 -0
- package/build/gpio.mjs +2 -1
- package/build/gpio.mjs.map +1 -0
- package/build/hmi.cjs +2 -1
- package/build/hmi.cjs.map +1 -0
- package/build/hmi.d.cts +135 -2
- package/build/hmi.d.cts.map +1 -0
- package/build/hmi.d.mts +135 -2
- package/build/hmi.d.mts.map +1 -0
- package/build/hmi.mjs +2 -1
- package/build/hmi.mjs.map +1 -0
- package/build/management.cjs +2 -1
- package/build/management.cjs.map +1 -0
- package/build/management.d.cts +283 -2
- package/build/management.d.cts.map +1 -0
- package/build/management.d.mts +283 -2
- package/build/management.d.mts.map +1 -0
- package/build/management.mjs +2 -1
- package/build/management.mjs.map +1 -0
- package/build/node.cjs +1 -1
- package/build/node.cjs.map +1 -1
- package/build/node.d.cts +1 -1
- package/build/node.d.cts.map +1 -1
- package/build/node.d.mts +2 -8
- package/build/node.d.mts.map +1 -1
- package/build/node.mjs +1 -1
- package/build/node.mjs.map +1 -1
- package/build/power.cjs +2 -1
- package/build/power.cjs.map +1 -0
- package/build/power.d.cts +343 -3
- package/build/power.d.cts.map +1 -0
- package/build/power.d.mts +343 -4
- package/build/power.d.mts.map +1 -0
- package/build/power.mjs +2 -1
- package/build/power.mjs.map +1 -0
- package/build/relays.cjs +2 -1
- package/build/relays.cjs.map +1 -0
- package/build/relays.d.cts +80 -2
- package/build/relays.d.cts.map +1 -0
- package/build/relays.d.mts +80 -2
- package/build/relays.d.mts.map +1 -0
- package/build/relays.mjs +2 -1
- package/build/relays.mjs.map +1 -0
- package/package.json +11 -7
- package/build/at1000-BLTMMFOe.d.cts.map +0 -1
- package/build/at1000-DBnCRa4B.cjs +0 -3
- package/build/at1000-DOi600n-.mjs +0 -3
- package/build/at1000-tq5RRNjA.d.mts.map +0 -1
- package/build/com-9S4BYQCi.mjs +0 -2
- package/build/com-9S4BYQCi.mjs.map +0 -1
- package/build/com-C7d5yOIK.cjs +0 -2
- package/build/com-C7d5yOIK.cjs.map +0 -1
- package/build/com-C9-fdGPZ.d.mts +0 -1155
- package/build/com-C9-fdGPZ.d.mts.map +0 -1
- package/build/com-DFB9TPdI.d.cts +0 -1155
- package/build/com-DFB9TPdI.d.cts.map +0 -1
- package/build/common-DAOxX-Zx.d.cts.map +0 -1
- package/build/common-SiysH9tt.d.mts.map +0 -1
- package/build/gpio-BWNwiLs7.cjs +0 -2
- package/build/gpio-BWNwiLs7.cjs.map +0 -1
- package/build/gpio-DQwp2EAk.d.mts +0 -358
- package/build/gpio-DQwp2EAk.d.mts.map +0 -1
- package/build/gpio-DUqCYSA4.d.cts +0 -358
- package/build/gpio-DUqCYSA4.d.cts.map +0 -1
- package/build/gpio-lBesVV2E.mjs +0 -2
- package/build/gpio-lBesVV2E.mjs.map +0 -1
- package/build/hmi-BCMtWRQH.d.mts +0 -135
- package/build/hmi-BCMtWRQH.d.mts.map +0 -1
- package/build/hmi-CGDU48qM.d.cts +0 -135
- package/build/hmi-CGDU48qM.d.cts.map +0 -1
- package/build/hmi-CTx2jfxU.mjs +0 -2
- package/build/hmi-CTx2jfxU.mjs.map +0 -1
- package/build/hmi-CnTa8kMx.cjs +0 -2
- package/build/hmi-CnTa8kMx.cjs.map +0 -1
- package/build/management-BMEMu2Kx.mjs +0 -2
- package/build/management-BMEMu2Kx.mjs.map +0 -1
- package/build/management-CCwBNLm_.d.cts +0 -240
- package/build/management-CCwBNLm_.d.cts.map +0 -1
- package/build/management-Cw05hjbG.d.mts +0 -240
- package/build/management-Cw05hjbG.d.mts.map +0 -1
- package/build/management-Lna6AzGK.cjs +0 -2
- package/build/management-Lna6AzGK.cjs.map +0 -1
- package/build/power-BkJtVbiA.d.cts +0 -343
- package/build/power-BkJtVbiA.d.cts.map +0 -1
- package/build/power-Bz5S5GGr.mjs +0 -2
- package/build/power-Bz5S5GGr.mjs.map +0 -1
- package/build/power-C7KM2zvR.cjs +0 -2
- package/build/power-C7KM2zvR.cjs.map +0 -1
- package/build/power-nWlY0xFN.d.mts +0 -343
- package/build/power-nWlY0xFN.d.mts.map +0 -1
- package/build/relays-BK2uL5i_.cjs +0 -2
- package/build/relays-BK2uL5i_.cjs.map +0 -1
- package/build/relays-Bn8LBgWl.d.cts +0 -79
- package/build/relays-Bn8LBgWl.d.cts.map +0 -1
- package/build/relays-CkBk7SOg.d.mts +0 -79
- package/build/relays-CkBk7SOg.d.mts.map +0 -1
- package/build/relays-CqglfFwF.mjs +0 -2
- package/build/relays-CqglfFwF.mjs.map +0 -1
package/build/power-C7KM2zvR.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./common-SFHWBeL2.cjs`);let n=require(`valibot`);n=e.t(n);const r=n.object({enabled:n.boolean(),target_voltage:t.t,voltage:t.t,current:n.number()}),i=n.partial(n.pick(r,[`enabled`,`target_voltage`])),a=n.pick(r,[`enabled`,`current`,`voltage`]),o=n.pick(a,[`enabled`]),s=n.pick(r,[`current`]);var c=class{usb_count;dut_count=1;constructor(e,t){this.fetch=e,this.usb_count=t.capabilities.usb_ports.reduce((e,t)=>e+t.count,0)}reset(){return this.fetch(`/power/reset`,{method:`POST`,parseResponse:()=>{}})}dut(e){if(e<0||e>=this.dut_count)throw Error(`Invalid DUT id ${e} (RESOURCE_NOT_FOUND)\n Suggestion: Use a DUT ID between 0 and ${this.dut_count-1}\n Path: /power/dut/${e}`);return new l(this.fetch,e)}usb(e){if(e<0||e>=this.usb_count)throw Error(`Invalid USB port ${e} (RESOURCE_NOT_FOUND)\n Suggestion: Use a USB port ID between 0 and ${this.usb_count-1}\n Path: /power/usb/${e}`);return new u(this.fetch,e)}relay_4(){return new d(this.fetch,4)}},l=class{constructor(e,t){this.fetch=e,this.id=t}reset(){return this.fetch(`/power/dut/${this.id}/reset`,{method:`POST`,parseResponse:()=>{}})}configure(e){return this.fetch(`/power/dut/${this.id}`,{method:`PATCH`,body:n.parse(i,e),schema:r})}enable(e){return this.configure({enabled:!0,target_voltage:e})}disable(){return this.configure({enabled:!1})}read(){return this.fetch(`/power/dut/${this.id}`,{schema:r})}async read_current(){return(await this.read()).current}async read_voltage(){return(await this.read()).voltage}},u=class{constructor(e,t){this.fetch=e,this.id=t}reset(){return this.fetch(`/power/usb/${this.id}/reset`,{method:`POST`,parseResponse:()=>{}})}configure(e){return this.fetch(`/power/usb/${this.id}`,{method:`PATCH`,body:n.parse(o,e),schema:a})}enable(){return this.configure({enabled:!0})}disable(){return this.configure({enabled:!1})}read(){return this.fetch(`/power/usb/${this.id}`,{schema:a})}async read_current(){return(await this.read()).current}async read_voltage(){return(await this.read()).voltage}},d=class{constructor(e,t){this.fetch=e,this.id=t}read(){return this.fetch(`/power/relay/${this.id}`,{schema:s})}async read_current(){return(await this.read()).current}};Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
2
|
-
//# sourceMappingURL=power-C7KM2zvR.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"power-C7KM2zvR.cjs","names":["v","analogLevel"],"sources":["../src/api/power.ts"],"sourcesContent":["import type { UpFetch } from 'up-fetch';\nimport * as v from 'valibot';\n\nimport { analogLevel, type AnalogOutputLevel } from './common';\nimport type { Information } from './management';\n\nexport type { AnalogOutputLevel };\n\nconst dutState = v.object({\n enabled: v.boolean(),\n target_voltage: analogLevel,\n voltage: analogLevel,\n current: v.number(),\n});\nexport type DutState = v.InferOutput<typeof dutState>;\n\nconst dutConfiguration = v.partial(v.pick(dutState, ['enabled', 'target_voltage']));\nexport type DutConfiguration = v.InferOutput<typeof dutConfiguration>;\n\nconst usbState = v.pick(dutState, ['enabled', 'current', 'voltage']);\nexport type UsbState = v.InferOutput<typeof usbState>;\n\nconst usbConfiguration = v.pick(usbState, ['enabled']);\nexport type UsbConfiguration = v.InferOutput<typeof usbConfiguration>;\n\nconst relayState = v.pick(dutState, ['current']);\nexport type RelayState = v.InferOutput<typeof relayState>;\n\n/** @hideconstructor */\nexport class PowerApi {\n private readonly usb_count: number;\n private readonly dut_count = 1;\n\n constructor(private readonly fetch: UpFetch, info: Information) {\n this.usb_count = info.capabilities.usb_ports.reduce((a, b) => a + b.count, 0);\n }\n\n /**\n * Resets the power API.\n */\n reset(): Promise<void> {\n return this.fetch('/power/reset', { method: 'POST', parseResponse: () => {} });\n }\n\n /**\n * Access a specific DUT by id.\n * @param id The DUT id.\n * @returns The DUT instance.\n */\n dut(id: number): Dut {\n if (id < 0 || id >= this.dut_count) {\n throw new Error(\n `Invalid DUT id ${id} (RESOURCE_NOT_FOUND)\\n Suggestion: Use a DUT ID between 0 and ${\n this.dut_count - 1\n }\\n Path: /power/dut/${id}`,\n );\n }\n\n return new Dut(this.fetch, id);\n }\n\n /**\n * Access a specific USB port by id.\n * @param id The USB port id.\n * @returns The USB port instance.\n */\n usb(id: number): Usb {\n if (id < 0 || id >= this.usb_count) {\n throw new Error(\n `Invalid USB port ${id} (RESOURCE_NOT_FOUND)\\n Suggestion: Use a USB port ID between 0 and ${\n this.usb_count - 1\n }\\n Path: /power/usb/${id}`,\n );\n }\n\n return new Usb(this.fetch, id);\n }\n\n /**\n * Access the relay at index 4.\n * @returns The relay instance.\n */\n relay_4(): RelayPower {\n return new RelayPower(this.fetch, 4);\n }\n}\n\n/** @hideconstructor */\nexport class Dut {\n constructor(private readonly fetch: UpFetch, public readonly id: number) {}\n\n /**\n * Resets the DUT.\n */\n reset(): Promise<void> {\n return this.fetch(`/power/dut/${this.id}/reset`, { method: 'POST', parseResponse: () => {} });\n }\n\n /**\n * Configures the DUT.\n * @param config The configuration to apply.\n * @returns The updated DUT state.\n */\n configure(config: DutConfiguration): Promise<DutState> {\n return this.fetch(`/power/dut/${this.id}`, {\n method: 'PATCH',\n body: v.parse(dutConfiguration, config),\n schema: dutState,\n });\n }\n\n /**\n * Enables the DUT power supply at the specified voltage.\n * @param voltage The target voltage to set.\n * @returns The updated DUT state.\n */\n enable(voltage: AnalogOutputLevel): Promise<DutState> {\n return this.configure({ enabled: true, target_voltage: voltage });\n }\n\n /**\n * Disables the DUT power supply.\n * @returns The updated DUT state.\n */\n disable(): Promise<DutState> {\n return this.configure({ enabled: false });\n }\n\n /**\n * Reads the current DUT state.\n * @returns The current DUT state.\n */\n read(): Promise<DutState> {\n return this.fetch(`/power/dut/${this.id}`, { schema: dutState });\n }\n\n /**\n * Reads the current drawn by the DUT.\n * @returns The current drawn by the DUT.\n */\n async read_current(): Promise<number> {\n return (await this.read()).current;\n }\n\n /**\n * Reads the voltage supplied to the DUT.\n * @returns The voltage supplied to the DUT.\n */\n async read_voltage(): Promise<number> {\n return (await this.read()).voltage;\n }\n}\n\n/** @hideconstructor */\nexport class Usb {\n constructor(private readonly fetch: UpFetch, public readonly id: number) {}\n\n /**\n * Resets the USB port.\n */\n reset(): Promise<void> {\n return this.fetch(`/power/usb/${this.id}/reset`, { method: 'POST', parseResponse: () => {} });\n }\n\n /**\n * Configures the USB port.\n * @param config The configuration to apply.\n * @returns The updated USB state.\n */\n configure(config: UsbConfiguration): Promise<UsbState> {\n return this.fetch(`/power/usb/${this.id}`, {\n method: 'PATCH',\n body: v.parse(usbConfiguration, config),\n schema: usbState,\n });\n }\n\n /**\n * Enables the USB port power.\n * @returns The updated USB state.\n */\n enable(): Promise<UsbState> {\n return this.configure({ enabled: true });\n }\n\n /**\n * Disables the USB port power.\n * @returns The updated USB state.\n */\n disable(): Promise<UsbState> {\n return this.configure({ enabled: false });\n }\n\n /**\n * Reads the current state of the USB port.\n * @returns The current USB state.\n */\n read(): Promise<UsbState> {\n return this.fetch(`/power/usb/${this.id}`, { schema: usbState });\n }\n\n /**\n * Reads the current drawn by the USB port.\n * @returns The current drawn by the USB port.\n */\n async read_current(): Promise<number> {\n return (await this.read()).current;\n }\n\n /**\n * Reads the voltage at the USB port.\n * @returns The voltage at the USB port.\n */\n async read_voltage(): Promise<number> {\n return (await this.read()).voltage;\n }\n}\n\n/** @hideconstructor */\nexport class RelayPower {\n constructor(private readonly fetch: UpFetch, public readonly id: number) {}\n\n /**\n * Reads the current state of the relay.\n * @returns The current relay state.\n */\n read(): Promise<RelayState> {\n return this.fetch(`/power/relay/${this.id}`, { schema: relayState });\n }\n\n /**\n * Reads the current drawn through the relay.\n * @returns The current drawn through the relay.\n */\n async read_current(): Promise<number> {\n return (await this.read()).current;\n }\n}\n"],"mappings":"6GAQA,MAAM,EAAWA,EAAE,OAAO,CACxB,QAASA,EAAE,SAAS,CACpB,eAAgBC,EAAAA,EAChB,QAASA,EAAAA,EACT,QAASD,EAAE,QAAQ,CACpB,CAAC,CAGI,EAAmBA,EAAE,QAAQA,EAAE,KAAK,EAAU,CAAC,UAAW,iBAAiB,CAAC,CAAC,CAG7E,EAAWA,EAAE,KAAK,EAAU,CAAC,UAAW,UAAW,UAAU,CAAC,CAG9D,EAAmBA,EAAE,KAAK,EAAU,CAAC,UAAU,CAAC,CAGhD,EAAaA,EAAE,KAAK,EAAU,CAAC,UAAU,CAAC,CAIhD,IAAa,EAAb,KAAsB,CACpB,UACA,UAA6B,EAE7B,YAAY,EAAiC,EAAmB,CAAnC,KAAA,MAAA,EAC3B,KAAK,UAAY,EAAK,aAAa,UAAU,QAAQ,EAAG,IAAM,EAAI,EAAE,MAAO,EAAE,CAM/E,OAAuB,CACrB,OAAO,KAAK,MAAM,eAAgB,CAAE,OAAQ,OAAQ,kBAAqB,GAAI,CAAC,CAQhF,IAAI,EAAiB,CACnB,GAAI,EAAK,GAAK,GAAM,KAAK,UACvB,MAAU,MACR,kBAAkB,EAAG,oEACnB,KAAK,UAAY,EAClB,yBAAyB,IAC3B,CAGH,OAAO,IAAI,EAAI,KAAK,MAAO,EAAG,CAQhC,IAAI,EAAiB,C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K,UAAU,CAAE,QAAS,GAAM,CAAC,CAO1C,SAA6B,CAC3B,OAAO,KAAK,UAAU,CAAE,QAAS,GAAO,CAAC,CAO3C,MAA0B,CACxB,OAAO,KAAK,MAAM,cAAc,KAAK,KAAM,CAAE,OAAQ,EAAU,CAAC,CAOlE,MAAM,cAAgC,CACpC,OAAQ,MAAM,KAAK,MAAM,EAAE,QAO7B,MAAM,cAAgC,CACpC,OAAQ,MAAM,KAAK,MAAM,EAAE,UAKlB,EAAb,KAAwB,CACtB,YAAY,EAAiC,EAA4B,CAA5C,KAAA,MAAA,EAAgC,KAAA,GAAA,EAM7D,MAA4B,CAC1B,OAAO,KAAK,MAAM,gBAAgB,KAAK,KAAM,CAAE,OAAQ,EAAY,CAAC,CAOtE,MAAM,cAAgC,CACpC,OAAQ,MAAM,KAAK,MAAM,EAAE"}
|
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
import { t as AnalogOutputLevel } from "./common-SiysH9tt.mjs";
|
|
2
|
-
import { n as Information } from "./management-Cw05hjbG.mjs";
|
|
3
|
-
import { UpFetch } from "up-fetch";
|
|
4
|
-
import * as v from "valibot";
|
|
5
|
-
|
|
6
|
-
//#region src/api/power.d.ts
|
|
7
|
-
declare const dutState: v.ObjectSchema<{
|
|
8
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
9
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
10
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
11
|
-
readonly current: v.NumberSchema<undefined>;
|
|
12
|
-
}, undefined>;
|
|
13
|
-
type DutState = v.InferOutput<typeof dutState>;
|
|
14
|
-
declare const dutConfiguration: Omit<Omit<v.ObjectSchema<{
|
|
15
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
16
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
17
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
18
|
-
readonly current: v.NumberSchema<undefined>;
|
|
19
|
-
}, undefined>, "~standard" | "~types" | "~run" | "entries"> & {
|
|
20
|
-
readonly entries: Pick<{
|
|
21
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
22
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
23
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
24
|
-
readonly current: v.NumberSchema<undefined>;
|
|
25
|
-
}, "enabled" | "target_voltage">;
|
|
26
|
-
readonly "~standard": v.StandardProps<{
|
|
27
|
-
enabled: boolean;
|
|
28
|
-
target_voltage: number;
|
|
29
|
-
}, {
|
|
30
|
-
enabled: boolean;
|
|
31
|
-
target_voltage: number;
|
|
32
|
-
}>;
|
|
33
|
-
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
34
|
-
enabled: boolean;
|
|
35
|
-
target_voltage: number;
|
|
36
|
-
}, v.NumberIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25> | v.BooleanIssue | v.ObjectIssue>;
|
|
37
|
-
readonly "~types"?: {
|
|
38
|
-
readonly input: {
|
|
39
|
-
enabled: boolean;
|
|
40
|
-
target_voltage: number;
|
|
41
|
-
};
|
|
42
|
-
readonly output: {
|
|
43
|
-
enabled: boolean;
|
|
44
|
-
target_voltage: number;
|
|
45
|
-
};
|
|
46
|
-
readonly issue: v.NumberIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25> | v.BooleanIssue | v.ObjectIssue;
|
|
47
|
-
} | undefined;
|
|
48
|
-
}, "~standard" | "~types" | "~run" | "entries"> & {
|
|
49
|
-
readonly entries: {
|
|
50
|
-
readonly enabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
51
|
-
readonly target_voltage: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>, undefined>;
|
|
52
|
-
};
|
|
53
|
-
readonly "~standard": v.StandardProps<{
|
|
54
|
-
enabled?: boolean | undefined;
|
|
55
|
-
target_voltage?: number | undefined;
|
|
56
|
-
}, {
|
|
57
|
-
enabled?: boolean | undefined;
|
|
58
|
-
target_voltage?: number | undefined;
|
|
59
|
-
}>;
|
|
60
|
-
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
61
|
-
enabled?: boolean | undefined;
|
|
62
|
-
target_voltage?: number | undefined;
|
|
63
|
-
}, v.NumberIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25> | v.BooleanIssue | v.ObjectIssue>;
|
|
64
|
-
readonly "~types"?: {
|
|
65
|
-
readonly input: {
|
|
66
|
-
enabled?: boolean | undefined;
|
|
67
|
-
target_voltage?: number | undefined;
|
|
68
|
-
};
|
|
69
|
-
readonly output: {
|
|
70
|
-
enabled?: boolean | undefined;
|
|
71
|
-
target_voltage?: number | undefined;
|
|
72
|
-
};
|
|
73
|
-
readonly issue: v.NumberIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25> | v.BooleanIssue | v.ObjectIssue;
|
|
74
|
-
} | undefined;
|
|
75
|
-
};
|
|
76
|
-
type DutConfiguration = v.InferOutput<typeof dutConfiguration>;
|
|
77
|
-
declare const usbState: Omit<v.ObjectSchema<{
|
|
78
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
79
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
80
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
81
|
-
readonly current: v.NumberSchema<undefined>;
|
|
82
|
-
}, undefined>, "~standard" | "~types" | "~run" | "entries"> & {
|
|
83
|
-
readonly entries: Pick<{
|
|
84
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
85
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
86
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
87
|
-
readonly current: v.NumberSchema<undefined>;
|
|
88
|
-
}, "enabled" | "current" | "voltage">;
|
|
89
|
-
readonly "~standard": v.StandardProps<{
|
|
90
|
-
enabled: boolean;
|
|
91
|
-
current: number;
|
|
92
|
-
voltage: number;
|
|
93
|
-
}, {
|
|
94
|
-
enabled: boolean;
|
|
95
|
-
current: number;
|
|
96
|
-
voltage: number;
|
|
97
|
-
}>;
|
|
98
|
-
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
99
|
-
enabled: boolean;
|
|
100
|
-
current: number;
|
|
101
|
-
voltage: number;
|
|
102
|
-
}, v.NumberIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25> | v.BooleanIssue | v.ObjectIssue>;
|
|
103
|
-
readonly "~types"?: {
|
|
104
|
-
readonly input: {
|
|
105
|
-
enabled: boolean;
|
|
106
|
-
current: number;
|
|
107
|
-
voltage: number;
|
|
108
|
-
};
|
|
109
|
-
readonly output: {
|
|
110
|
-
enabled: boolean;
|
|
111
|
-
current: number;
|
|
112
|
-
voltage: number;
|
|
113
|
-
};
|
|
114
|
-
readonly issue: v.NumberIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25> | v.BooleanIssue | v.ObjectIssue;
|
|
115
|
-
} | undefined;
|
|
116
|
-
};
|
|
117
|
-
type UsbState = v.InferOutput<typeof usbState>;
|
|
118
|
-
declare const usbConfiguration: Omit<Omit<v.ObjectSchema<{
|
|
119
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
120
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
121
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
122
|
-
readonly current: v.NumberSchema<undefined>;
|
|
123
|
-
}, undefined>, "~standard" | "~types" | "~run" | "entries"> & {
|
|
124
|
-
readonly entries: Pick<{
|
|
125
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
126
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
127
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
128
|
-
readonly current: v.NumberSchema<undefined>;
|
|
129
|
-
}, "enabled" | "current" | "voltage">;
|
|
130
|
-
readonly "~standard": v.StandardProps<{
|
|
131
|
-
enabled: boolean;
|
|
132
|
-
current: number;
|
|
133
|
-
voltage: number;
|
|
134
|
-
}, {
|
|
135
|
-
enabled: boolean;
|
|
136
|
-
current: number;
|
|
137
|
-
voltage: number;
|
|
138
|
-
}>;
|
|
139
|
-
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
140
|
-
enabled: boolean;
|
|
141
|
-
current: number;
|
|
142
|
-
voltage: number;
|
|
143
|
-
}, v.NumberIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25> | v.BooleanIssue | v.ObjectIssue>;
|
|
144
|
-
readonly "~types"?: {
|
|
145
|
-
readonly input: {
|
|
146
|
-
enabled: boolean;
|
|
147
|
-
current: number;
|
|
148
|
-
voltage: number;
|
|
149
|
-
};
|
|
150
|
-
readonly output: {
|
|
151
|
-
enabled: boolean;
|
|
152
|
-
current: number;
|
|
153
|
-
voltage: number;
|
|
154
|
-
};
|
|
155
|
-
readonly issue: v.NumberIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25> | v.BooleanIssue | v.ObjectIssue;
|
|
156
|
-
} | undefined;
|
|
157
|
-
}, "~standard" | "~types" | "~run" | "entries"> & {
|
|
158
|
-
readonly entries: Pick<Pick<{
|
|
159
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
160
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
161
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
162
|
-
readonly current: v.NumberSchema<undefined>;
|
|
163
|
-
}, "enabled" | "current" | "voltage">, "enabled">;
|
|
164
|
-
readonly "~standard": v.StandardProps<{
|
|
165
|
-
enabled: boolean;
|
|
166
|
-
}, {
|
|
167
|
-
enabled: boolean;
|
|
168
|
-
}>;
|
|
169
|
-
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
170
|
-
enabled: boolean;
|
|
171
|
-
}, v.BooleanIssue | v.ObjectIssue>;
|
|
172
|
-
readonly "~types"?: {
|
|
173
|
-
readonly input: {
|
|
174
|
-
enabled: boolean;
|
|
175
|
-
};
|
|
176
|
-
readonly output: {
|
|
177
|
-
enabled: boolean;
|
|
178
|
-
};
|
|
179
|
-
readonly issue: v.BooleanIssue | v.ObjectIssue;
|
|
180
|
-
} | undefined;
|
|
181
|
-
};
|
|
182
|
-
type UsbConfiguration = v.InferOutput<typeof usbConfiguration>;
|
|
183
|
-
declare const relayState: Omit<v.ObjectSchema<{
|
|
184
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
185
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
186
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
187
|
-
readonly current: v.NumberSchema<undefined>;
|
|
188
|
-
}, undefined>, "~standard" | "~types" | "~run" | "entries"> & {
|
|
189
|
-
readonly entries: Pick<{
|
|
190
|
-
readonly enabled: v.BooleanSchema<undefined>;
|
|
191
|
-
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
192
|
-
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
193
|
-
readonly current: v.NumberSchema<undefined>;
|
|
194
|
-
}, "current">;
|
|
195
|
-
readonly "~standard": v.StandardProps<{
|
|
196
|
-
current: number;
|
|
197
|
-
}, {
|
|
198
|
-
current: number;
|
|
199
|
-
}>;
|
|
200
|
-
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
201
|
-
current: number;
|
|
202
|
-
}, v.NumberIssue | v.ObjectIssue>;
|
|
203
|
-
readonly "~types"?: {
|
|
204
|
-
readonly input: {
|
|
205
|
-
current: number;
|
|
206
|
-
};
|
|
207
|
-
readonly output: {
|
|
208
|
-
current: number;
|
|
209
|
-
};
|
|
210
|
-
readonly issue: v.NumberIssue | v.ObjectIssue;
|
|
211
|
-
} | undefined;
|
|
212
|
-
};
|
|
213
|
-
type RelayState = v.InferOutput<typeof relayState>;
|
|
214
|
-
/** @hideconstructor */
|
|
215
|
-
declare class PowerApi {
|
|
216
|
-
private readonly fetch;
|
|
217
|
-
private readonly usb_count;
|
|
218
|
-
private readonly dut_count;
|
|
219
|
-
constructor(fetch: UpFetch, info: Information);
|
|
220
|
-
/**
|
|
221
|
-
* Resets the power API.
|
|
222
|
-
*/
|
|
223
|
-
reset(): Promise<void>;
|
|
224
|
-
/**
|
|
225
|
-
* Access a specific DUT by id.
|
|
226
|
-
* @param id The DUT id.
|
|
227
|
-
* @returns The DUT instance.
|
|
228
|
-
*/
|
|
229
|
-
dut(id: number): Dut;
|
|
230
|
-
/**
|
|
231
|
-
* Access a specific USB port by id.
|
|
232
|
-
* @param id The USB port id.
|
|
233
|
-
* @returns The USB port instance.
|
|
234
|
-
*/
|
|
235
|
-
usb(id: number): Usb;
|
|
236
|
-
/**
|
|
237
|
-
* Access the relay at index 4.
|
|
238
|
-
* @returns The relay instance.
|
|
239
|
-
*/
|
|
240
|
-
relay_4(): RelayPower;
|
|
241
|
-
}
|
|
242
|
-
/** @hideconstructor */
|
|
243
|
-
declare class Dut {
|
|
244
|
-
private readonly fetch;
|
|
245
|
-
readonly id: number;
|
|
246
|
-
constructor(fetch: UpFetch, id: number);
|
|
247
|
-
/**
|
|
248
|
-
* Resets the DUT.
|
|
249
|
-
*/
|
|
250
|
-
reset(): Promise<void>;
|
|
251
|
-
/**
|
|
252
|
-
* Configures the DUT.
|
|
253
|
-
* @param config The configuration to apply.
|
|
254
|
-
* @returns The updated DUT state.
|
|
255
|
-
*/
|
|
256
|
-
configure(config: DutConfiguration): Promise<DutState>;
|
|
257
|
-
/**
|
|
258
|
-
* Enables the DUT power supply at the specified voltage.
|
|
259
|
-
* @param voltage The target voltage to set.
|
|
260
|
-
* @returns The updated DUT state.
|
|
261
|
-
*/
|
|
262
|
-
enable(voltage: AnalogOutputLevel): Promise<DutState>;
|
|
263
|
-
/**
|
|
264
|
-
* Disables the DUT power supply.
|
|
265
|
-
* @returns The updated DUT state.
|
|
266
|
-
*/
|
|
267
|
-
disable(): Promise<DutState>;
|
|
268
|
-
/**
|
|
269
|
-
* Reads the current DUT state.
|
|
270
|
-
* @returns The current DUT state.
|
|
271
|
-
*/
|
|
272
|
-
read(): Promise<DutState>;
|
|
273
|
-
/**
|
|
274
|
-
* Reads the current drawn by the DUT.
|
|
275
|
-
* @returns The current drawn by the DUT.
|
|
276
|
-
*/
|
|
277
|
-
read_current(): Promise<number>;
|
|
278
|
-
/**
|
|
279
|
-
* Reads the voltage supplied to the DUT.
|
|
280
|
-
* @returns The voltage supplied to the DUT.
|
|
281
|
-
*/
|
|
282
|
-
read_voltage(): Promise<number>;
|
|
283
|
-
}
|
|
284
|
-
/** @hideconstructor */
|
|
285
|
-
declare class Usb {
|
|
286
|
-
private readonly fetch;
|
|
287
|
-
readonly id: number;
|
|
288
|
-
constructor(fetch: UpFetch, id: number);
|
|
289
|
-
/**
|
|
290
|
-
* Resets the USB port.
|
|
291
|
-
*/
|
|
292
|
-
reset(): Promise<void>;
|
|
293
|
-
/**
|
|
294
|
-
* Configures the USB port.
|
|
295
|
-
* @param config The configuration to apply.
|
|
296
|
-
* @returns The updated USB state.
|
|
297
|
-
*/
|
|
298
|
-
configure(config: UsbConfiguration): Promise<UsbState>;
|
|
299
|
-
/**
|
|
300
|
-
* Enables the USB port power.
|
|
301
|
-
* @returns The updated USB state.
|
|
302
|
-
*/
|
|
303
|
-
enable(): Promise<UsbState>;
|
|
304
|
-
/**
|
|
305
|
-
* Disables the USB port power.
|
|
306
|
-
* @returns The updated USB state.
|
|
307
|
-
*/
|
|
308
|
-
disable(): Promise<UsbState>;
|
|
309
|
-
/**
|
|
310
|
-
* Reads the current state of the USB port.
|
|
311
|
-
* @returns The current USB state.
|
|
312
|
-
*/
|
|
313
|
-
read(): Promise<UsbState>;
|
|
314
|
-
/**
|
|
315
|
-
* Reads the current drawn by the USB port.
|
|
316
|
-
* @returns The current drawn by the USB port.
|
|
317
|
-
*/
|
|
318
|
-
read_current(): Promise<number>;
|
|
319
|
-
/**
|
|
320
|
-
* Reads the voltage at the USB port.
|
|
321
|
-
* @returns The voltage at the USB port.
|
|
322
|
-
*/
|
|
323
|
-
read_voltage(): Promise<number>;
|
|
324
|
-
}
|
|
325
|
-
/** @hideconstructor */
|
|
326
|
-
declare class RelayPower {
|
|
327
|
-
private readonly fetch;
|
|
328
|
-
readonly id: number;
|
|
329
|
-
constructor(fetch: UpFetch, id: number);
|
|
330
|
-
/**
|
|
331
|
-
* Reads the current state of the relay.
|
|
332
|
-
* @returns The current relay state.
|
|
333
|
-
*/
|
|
334
|
-
read(): Promise<RelayState>;
|
|
335
|
-
/**
|
|
336
|
-
* Reads the current drawn through the relay.
|
|
337
|
-
* @returns The current drawn through the relay.
|
|
338
|
-
*/
|
|
339
|
-
read_current(): Promise<number>;
|
|
340
|
-
}
|
|
341
|
-
//#endregion
|
|
342
|
-
export { RelayPower as a, UsbConfiguration as c, PowerApi as i, UsbState as l, DutConfiguration as n, RelayState as o, DutState as r, Usb as s, Dut as t };
|
|
343
|
-
//# sourceMappingURL=power-nWlY0xFN.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"power-nWlY0xFN.d.mts","names":[],"sources":["../src/api/power.ts"],"sourcesContent":[],"mappings":";;;;;;cAQM,UAAQ,CAAA,CAAA;EAAR,SAAA,OAKJ,iBAAA,CAAA,SAAA,CAAA;;;;;KACU,QAAA,GAAW,CAAA,CAAE,mBAAmB;cAEtC,kBAAgB,KAAA,KAAA,CAAA,CAAA;;;;;CARR,EAAA,SAAA,CAAA,EAAA,WAAA,GAAA,QAAA,GAAA,MAAA,GAAA,SAAA,CAAA,GAAA;E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6D2B,CAAA,IAAA,CAAA;EAK3B;;;;;EAqBC,SAAA,CAAA,MAAA,EA9EQ,gBA8ER,CAAA,EA9E2B,OA8E3B,CA9EmC,QA8EnC,CAAA;EAQS;;;;;EAwBG,MAAA,CAAA,OAAA,EAjGN,iBAiGM,CAAA,EAjGc,OAiGd,CAjGsB,QAiGtB,CAAA;EAAO;AAM/B;;;EAOU,OAAA,CAAA,CAAA,EAtGG,OAsGH,CAtGW,QAsGX,CAAA;EAQc;;;;UAtGd,QAAQ;;;;;kBAQM;;;;;kBAQA;;;cAMX,GAAA;;;qBACyB;;;;WAK3B;;;;;;oBASS,mBAAmB,QAAQ;;;;;YAYnC,QAAQ;;;;;aAQP,QAAQ;;;;;UAQX,QAAQ;;;;;kBAQM;;;;;kBAQA;;;cAMX,UAAA;;;qBACyB;;;;;UAM5B,QAAQ;;;;;kBAQM"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`valibot`);t=e.t(t);const n=t.picklist([`open`,`closed`]),r=t.array(n),i=t.object({state:n}),a=t.picklist([`open`,`close`]);t.object({action:a});var o=class{constructor(e){this.fetch=e}reset(){return this.fetch(`/relays/reset`,{method:`POST`,parseResponse:()=>{}})}relay(e){return new s(this.fetch,e)}read(){return this.fetch(`/relays`,{schema:r})}open(){return this.fetch(`/relays`,{method:`POST`,body:{action:`open`},schema:r})}close(){return this.fetch(`/relays`,{method:`POST`,body:{action:`close`},schema:r})}},s=class{constructor(e,t){this.fetch=e,this.id=t}async read(){return(await this.fetch(`/relays/${this.id}`,{schema:i})).state}async is_open(){return await this.read()===`open`}async is_closed(){return await this.read()===`closed`}async open(){return(await this.fetch(`/relays/${this.id}`,{method:`POST`,body:{action:`open`},schema:i})).state}async close(){return(await this.fetch(`/relays/${this.id}`,{method:`POST`,body:{action:`close`},schema:i})).state}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
|
2
|
-
//# sourceMappingURL=relays-BK2uL5i_.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relays-BK2uL5i_.cjs","names":["v"],"sources":["../src/api/relays.ts"],"sourcesContent":["import type { UpFetch } from 'up-fetch';\nimport * as v from 'valibot';\n\nconst state = v.picklist(['open', 'closed']);\nexport type State = v.InferOutput<typeof state>;\nconst states = v.array(state);\nexport type States = v.InferOutput<typeof states>;\nconst relayState = v.object({ state: state });\n\nconst action = v.picklist(['open', 'close']);\nconst relayAction = v.object({ action: action });\ntype RelayAction = v.InferOutput<typeof relayAction>;\n\n/** @hideconstructor */\nexport class RelaysApi {\n constructor(private readonly fetch: UpFetch) {}\n\n /**\n * Resets all relays to their default state.\n */\n reset() {\n return this.fetch('/relays/reset', { method: 'POST', parseResponse: () => {} });\n }\n\n /**\n * Access a specific relay by id.\n * @param id The relay id.\n * @returns The relay instance.\n */\n relay(id: number): Relay {\n return new Relay(this.fetch, id);\n }\n\n /**\n * Reads the state of all relays.\n * @returns The state of all relays.\n */\n read(): Promise<States> {\n return this.fetch(`/relays`, { schema: states });\n }\n\n /**\n * Opens all the relays.\n * @returns The new state of all relays.\n */\n open(): Promise<States> {\n return this.fetch(`/relays`, {\n method: 'POST',\n body: { action: 'open' } satisfies RelayAction,\n schema: states,\n });\n }\n\n /**\n * Closes all the relays.\n * @returns The new state of all relays.\n */\n close(): Promise<States> {\n return this.fetch(`/relays`, {\n method: 'POST',\n body: { action: 'close' } satisfies RelayAction,\n schema: states,\n });\n }\n}\n\n/** @hideconstructor */\nexport class Relay {\n constructor(\n private readonly fetch: UpFetch,\n /**\n * The relay id.\n */\n public readonly id: number,\n ) {}\n\n /**\n * Reads the state of the relay.\n * @returns The relay state.\n */\n async read(): Promise<State> {\n return (await this.fetch(`/relays/${this.id}`, { schema: relayState })).state;\n }\n\n /**\n * Returns whether the relay is open.\n * @returns True if the relay is open, false otherwise.\n */\n async is_open(): Promise<boolean> {\n return (await this.read()) === 'open';\n }\n\n /**\n * Returns whether the relay is closed.\n * @returns True if the relay is closed, false otherwise.\n */\n async is_closed(): Promise<boolean> {\n return (await this.read()) === 'closed';\n }\n\n /**\n * Opens the relay.\n * @returns The new relay state.\n */\n async open(): Promise<State> {\n return (await this.fetch(`/relays/${this.id}`, {\n method: 'POST',\n body: { action: 'open' } satisfies RelayAction,\n schema: relayState,\n }))\n .state;\n }\n\n /**\n * Closes the relay.\n * @returns The new relay state.\n */\n async close(): Promise<State> {\n return (await this.fetch(`/relays/${this.id}`, {\n method: 'POST',\n body: { action: 'close' } satisfies RelayAction,\n schema: relayState,\n }))\n .state;\n }\n}\n"],"mappings":"0EAGA,MAAM,EAAQA,EAAE,SAAS,CAAC,OAAQ,SAAS,CAAC,CAEtC,EAASA,EAAE,MAAM,EAAM,CAEvB,EAAaA,EAAE,OAAO,CAAS,QAAO,CAAC,CAEvC,EAASA,EAAE,SAAS,CAAC,OAAQ,QAAQ,CAAC,CACxBA,EAAE,OAAO,CAAU,SAAQ,CAAC,CAIhD,IAAa,EAAb,KAAuB,CACrB,YAAY,EAAiC,CAAhB,KAAA,MAAA,EAK7B,OAAQ,CACN,OAAO,KAAK,MAAM,gBAAiB,CAAE,OAAQ,OAAQ,kBAAqB,GAAI,CAAC,CAQjF,MAAM,EAAmB,CACvB,OAAO,IAAI,EAAM,KAAK,MAAO,EAAG,CAOlC,MAAwB,CACtB,OAAO,KAAK,MAAM,UAAW,CAAE,OAAQ,EAAQ,CAAC,CAOlD,MAAwB,CACtB,OAAO,KAAK,MAAM,UAAW,CAC3B,OAAQ,OACR,KAAM,CAAE,OAAQ,OAAQ,CACxB,OAAQ,EACT,CAAC,CAOJ,OAAyB,CACvB,OAAO,KAAK,MAAM,UAAW,CAC3B,OAAQ,OACR,KAAM,CAAE,OAAQ,QAAS,CACzB,OAAQ,EACT,CAAC,GAKO,EAAb,KAAmB,CACjB,YACE,EAIA,EACA,CALiB,KAAA,MAAA,EAID,KAAA,GAAA,EAOlB,MAAM,MAAuB,CAC3B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAAE,OAAQ,EAAY,CAAC,EAAE,MAO1E,MAAM,SAA4B,CAChC,OAAQ,MAAM,KAAK,MAAM,GAAM,OAOjC,MAAM,WAA8B,CAClC,OAAQ,MAAM,KAAK,MAAM,GAAM,SAOjC,MAAM,MAAuB,CAC3B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAC7C,OAAQ,OACR,KAAM,CAAE,OAAQ,OAAQ,CACxB,OAAQ,EACT,CAAC,EACC,MAOL,MAAM,OAAwB,CAC5B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAC7C,OAAQ,OACR,KAAM,CAAE,OAAQ,QAAS,CACzB,OAAQ,EACT,CAAC,EACC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { UpFetch } from "up-fetch";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
|
|
4
|
-
//#region src/api/relays.d.ts
|
|
5
|
-
declare const state: v.PicklistSchema<["open", "closed"], undefined>;
|
|
6
|
-
type State = v.InferOutput<typeof state>;
|
|
7
|
-
declare const states: v.ArraySchema<v.PicklistSchema<["open", "closed"], undefined>, undefined>;
|
|
8
|
-
type States = v.InferOutput<typeof states>;
|
|
9
|
-
/** @hideconstructor */
|
|
10
|
-
declare class RelaysApi {
|
|
11
|
-
private readonly fetch;
|
|
12
|
-
constructor(fetch: UpFetch);
|
|
13
|
-
/**
|
|
14
|
-
* Resets all relays to their default state.
|
|
15
|
-
*/
|
|
16
|
-
reset(): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Access a specific relay by id.
|
|
19
|
-
* @param id The relay id.
|
|
20
|
-
* @returns The relay instance.
|
|
21
|
-
*/
|
|
22
|
-
relay(id: number): Relay;
|
|
23
|
-
/**
|
|
24
|
-
* Reads the state of all relays.
|
|
25
|
-
* @returns The state of all relays.
|
|
26
|
-
*/
|
|
27
|
-
read(): Promise<States>;
|
|
28
|
-
/**
|
|
29
|
-
* Opens all the relays.
|
|
30
|
-
* @returns The new state of all relays.
|
|
31
|
-
*/
|
|
32
|
-
open(): Promise<States>;
|
|
33
|
-
/**
|
|
34
|
-
* Closes all the relays.
|
|
35
|
-
* @returns The new state of all relays.
|
|
36
|
-
*/
|
|
37
|
-
close(): Promise<States>;
|
|
38
|
-
}
|
|
39
|
-
/** @hideconstructor */
|
|
40
|
-
declare class Relay {
|
|
41
|
-
private readonly fetch;
|
|
42
|
-
/**
|
|
43
|
-
* The relay id.
|
|
44
|
-
*/
|
|
45
|
-
readonly id: number;
|
|
46
|
-
constructor(fetch: UpFetch,
|
|
47
|
-
/**
|
|
48
|
-
* The relay id.
|
|
49
|
-
*/
|
|
50
|
-
id: number);
|
|
51
|
-
/**
|
|
52
|
-
* Reads the state of the relay.
|
|
53
|
-
* @returns The relay state.
|
|
54
|
-
*/
|
|
55
|
-
read(): Promise<State>;
|
|
56
|
-
/**
|
|
57
|
-
* Returns whether the relay is open.
|
|
58
|
-
* @returns True if the relay is open, false otherwise.
|
|
59
|
-
*/
|
|
60
|
-
is_open(): Promise<boolean>;
|
|
61
|
-
/**
|
|
62
|
-
* Returns whether the relay is closed.
|
|
63
|
-
* @returns True if the relay is closed, false otherwise.
|
|
64
|
-
*/
|
|
65
|
-
is_closed(): Promise<boolean>;
|
|
66
|
-
/**
|
|
67
|
-
* Opens the relay.
|
|
68
|
-
* @returns The new relay state.
|
|
69
|
-
*/
|
|
70
|
-
open(): Promise<State>;
|
|
71
|
-
/**
|
|
72
|
-
* Closes the relay.
|
|
73
|
-
* @returns The new relay state.
|
|
74
|
-
*/
|
|
75
|
-
close(): Promise<State>;
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
export { States as i, RelaysApi as n, State as r, Relay as t };
|
|
79
|
-
//# sourceMappingURL=relays-Bn8LBgWl.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relays-Bn8LBgWl.d.cts","names":[],"sources":["../src/api/relays.ts"],"sourcesContent":[],"mappings":";;;;cAGM,OAAK,CAAA,CAAA;KACC,KAAA,GAAQ,CAAA,CAAE,mBAAmB;AAHZ,cAIvB,MAFsC,EAEhC,CAAA,CAAA,WAFD,CAEC,CAAA,CAAA,cAFD,CAAA,CAAA,MAAA,EAAA,QAAA,CAAA,EAAA,SAAA,CAAA,EAAA,SAAA,CAAA;AACC,KAEA,MAAA,GAAS,CAAA,CAAE,WAFD,CAAA,OAEoB,MAFT,CAAA;AAAe;AAEpC,cAQC,SAAA,CAR6B;EAQ7B,iBAAS,KAAA;EACgB,WAAA,CAAA,KAAA,EAAA,OAAA;EAK/B;;;EAiBG,KAAA,CAAA,CAAA,EAjBH,OAiBG,CAAA,IAAA,CAAA;EAQQ;;;;;EAsBL,KAAA,CAAA,EAAK,EAAA,MAAA,CAAA,EAtCG,KAsCH;EAEU;;;;EA2BP,IAAA,CAAA,CAAA,EA3DX,OA2DW,CA3DH,MA2DG,CAAA;EAQG;;;;EAaA,IAAA,CAAA,CAAA,EAxEd,OAwEc,CAxEN,MAwEM,CAAA;;;;;WA5Db,QAAQ;;;cAUN,KAAA;;;;;;qBAEe;;;;;;;;;UAWZ,QAAQ;;;;;aAQL;;;;;eAQE;;;;;UAQL,QAAQ;;;;;WAaP,QAAQ"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { UpFetch } from "up-fetch";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
|
|
4
|
-
//#region src/api/relays.d.ts
|
|
5
|
-
declare const state: v.PicklistSchema<["open", "closed"], undefined>;
|
|
6
|
-
type State = v.InferOutput<typeof state>;
|
|
7
|
-
declare const states: v.ArraySchema<v.PicklistSchema<["open", "closed"], undefined>, undefined>;
|
|
8
|
-
type States = v.InferOutput<typeof states>;
|
|
9
|
-
/** @hideconstructor */
|
|
10
|
-
declare class RelaysApi {
|
|
11
|
-
private readonly fetch;
|
|
12
|
-
constructor(fetch: UpFetch);
|
|
13
|
-
/**
|
|
14
|
-
* Resets all relays to their default state.
|
|
15
|
-
*/
|
|
16
|
-
reset(): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Access a specific relay by id.
|
|
19
|
-
* @param id The relay id.
|
|
20
|
-
* @returns The relay instance.
|
|
21
|
-
*/
|
|
22
|
-
relay(id: number): Relay;
|
|
23
|
-
/**
|
|
24
|
-
* Reads the state of all relays.
|
|
25
|
-
* @returns The state of all relays.
|
|
26
|
-
*/
|
|
27
|
-
read(): Promise<States>;
|
|
28
|
-
/**
|
|
29
|
-
* Opens all the relays.
|
|
30
|
-
* @returns The new state of all relays.
|
|
31
|
-
*/
|
|
32
|
-
open(): Promise<States>;
|
|
33
|
-
/**
|
|
34
|
-
* Closes all the relays.
|
|
35
|
-
* @returns The new state of all relays.
|
|
36
|
-
*/
|
|
37
|
-
close(): Promise<States>;
|
|
38
|
-
}
|
|
39
|
-
/** @hideconstructor */
|
|
40
|
-
declare class Relay {
|
|
41
|
-
private readonly fetch;
|
|
42
|
-
/**
|
|
43
|
-
* The relay id.
|
|
44
|
-
*/
|
|
45
|
-
readonly id: number;
|
|
46
|
-
constructor(fetch: UpFetch,
|
|
47
|
-
/**
|
|
48
|
-
* The relay id.
|
|
49
|
-
*/
|
|
50
|
-
id: number);
|
|
51
|
-
/**
|
|
52
|
-
* Reads the state of the relay.
|
|
53
|
-
* @returns The relay state.
|
|
54
|
-
*/
|
|
55
|
-
read(): Promise<State>;
|
|
56
|
-
/**
|
|
57
|
-
* Returns whether the relay is open.
|
|
58
|
-
* @returns True if the relay is open, false otherwise.
|
|
59
|
-
*/
|
|
60
|
-
is_open(): Promise<boolean>;
|
|
61
|
-
/**
|
|
62
|
-
* Returns whether the relay is closed.
|
|
63
|
-
* @returns True if the relay is closed, false otherwise.
|
|
64
|
-
*/
|
|
65
|
-
is_closed(): Promise<boolean>;
|
|
66
|
-
/**
|
|
67
|
-
* Opens the relay.
|
|
68
|
-
* @returns The new relay state.
|
|
69
|
-
*/
|
|
70
|
-
open(): Promise<State>;
|
|
71
|
-
/**
|
|
72
|
-
* Closes the relay.
|
|
73
|
-
* @returns The new relay state.
|
|
74
|
-
*/
|
|
75
|
-
close(): Promise<State>;
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
export { States as i, RelaysApi as n, State as r, Relay as t };
|
|
79
|
-
//# sourceMappingURL=relays-CkBk7SOg.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relays-CkBk7SOg.d.mts","names":[],"sources":["../src/api/relays.ts"],"sourcesContent":[],"mappings":";;;;cAGM,OAAK,CAAA,CAAA;KACC,KAAA,GAAQ,CAAA,CAAE,mBAAmB;AAHZ,cAIvB,MAFsC,EAEhC,CAAA,CAAA,WAFD,CAEC,CAAA,CAAA,cAFD,CAAA,CAAA,MAAA,EAAA,QAAA,CAAA,EAAA,SAAA,CAAA,EAAA,SAAA,CAAA;AACC,KAEA,MAAA,GAAS,CAAA,CAAE,WAFD,CAAA,OAEoB,MAFT,CAAA;AAAe;AAEpC,cAQC,SAAA,CAR6B;EAQ7B,iBAAS,KAAA;EACgB,WAAA,CAAA,KAAA,EAAA,OAAA;EAK/B;;;EAiBG,KAAA,CAAA,CAAA,EAjBH,OAiBG,CAAA,IAAA,CAAA;EAQQ;;;;;EAsBL,KAAA,CAAA,EAAK,EAAA,MAAA,CAAA,EAtCG,KAsCH;EAEU;;;;EA2BP,IAAA,CAAA,CAAA,EA3DX,OA2DW,CA3DH,MA2DG,CAAA;EAQG;;;;EAaA,IAAA,CAAA,CAAA,EAxEd,OAwEc,CAxEN,MAwEM,CAAA;;;;;WA5Db,QAAQ;;;cAUN,KAAA;;;;;;qBAEe;;;;;;;;;UAWZ,QAAQ;;;;;aAQL;;;;;eAQE;;;;;UAQL,QAAQ;;;;;WAaP,QAAQ"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import*as e from"valibot";const t=e.picklist([`open`,`closed`]),n=e.array(t),r=e.object({state:t}),i=e.picklist([`open`,`close`]);e.object({action:i});var a=class{constructor(e){this.fetch=e}reset(){return this.fetch(`/relays/reset`,{method:`POST`,parseResponse:()=>{}})}relay(e){return new o(this.fetch,e)}read(){return this.fetch(`/relays`,{schema:n})}open(){return this.fetch(`/relays`,{method:`POST`,body:{action:`open`},schema:n})}close(){return this.fetch(`/relays`,{method:`POST`,body:{action:`close`},schema:n})}},o=class{constructor(e,t){this.fetch=e,this.id=t}async read(){return(await this.fetch(`/relays/${this.id}`,{schema:r})).state}async is_open(){return await this.read()===`open`}async is_closed(){return await this.read()===`closed`}async open(){return(await this.fetch(`/relays/${this.id}`,{method:`POST`,body:{action:`open`},schema:r})).state}async close(){return(await this.fetch(`/relays/${this.id}`,{method:`POST`,body:{action:`close`},schema:r})).state}};export{a as n,o as t};
|
|
2
|
-
//# sourceMappingURL=relays-CqglfFwF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relays-CqglfFwF.mjs","names":[],"sources":["../src/api/relays.ts"],"sourcesContent":["import type { UpFetch } from 'up-fetch';\nimport * as v from 'valibot';\n\nconst state = v.picklist(['open', 'closed']);\nexport type State = v.InferOutput<typeof state>;\nconst states = v.array(state);\nexport type States = v.InferOutput<typeof states>;\nconst relayState = v.object({ state: state });\n\nconst action = v.picklist(['open', 'close']);\nconst relayAction = v.object({ action: action });\ntype RelayAction = v.InferOutput<typeof relayAction>;\n\n/** @hideconstructor */\nexport class RelaysApi {\n constructor(private readonly fetch: UpFetch) {}\n\n /**\n * Resets all relays to their default state.\n */\n reset() {\n return this.fetch('/relays/reset', { method: 'POST', parseResponse: () => {} });\n }\n\n /**\n * Access a specific relay by id.\n * @param id The relay id.\n * @returns The relay instance.\n */\n relay(id: number): Relay {\n return new Relay(this.fetch, id);\n }\n\n /**\n * Reads the state of all relays.\n * @returns The state of all relays.\n */\n read(): Promise<States> {\n return this.fetch(`/relays`, { schema: states });\n }\n\n /**\n * Opens all the relays.\n * @returns The new state of all relays.\n */\n open(): Promise<States> {\n return this.fetch(`/relays`, {\n method: 'POST',\n body: { action: 'open' } satisfies RelayAction,\n schema: states,\n });\n }\n\n /**\n * Closes all the relays.\n * @returns The new state of all relays.\n */\n close(): Promise<States> {\n return this.fetch(`/relays`, {\n method: 'POST',\n body: { action: 'close' } satisfies RelayAction,\n schema: states,\n });\n }\n}\n\n/** @hideconstructor */\nexport class Relay {\n constructor(\n private readonly fetch: UpFetch,\n /**\n * The relay id.\n */\n public readonly id: number,\n ) {}\n\n /**\n * Reads the state of the relay.\n * @returns The relay state.\n */\n async read(): Promise<State> {\n return (await this.fetch(`/relays/${this.id}`, { schema: relayState })).state;\n }\n\n /**\n * Returns whether the relay is open.\n * @returns True if the relay is open, false otherwise.\n */\n async is_open(): Promise<boolean> {\n return (await this.read()) === 'open';\n }\n\n /**\n * Returns whether the relay is closed.\n * @returns True if the relay is closed, false otherwise.\n */\n async is_closed(): Promise<boolean> {\n return (await this.read()) === 'closed';\n }\n\n /**\n * Opens the relay.\n * @returns The new relay state.\n */\n async open(): Promise<State> {\n return (await this.fetch(`/relays/${this.id}`, {\n method: 'POST',\n body: { action: 'open' } satisfies RelayAction,\n schema: relayState,\n }))\n .state;\n }\n\n /**\n * Closes the relay.\n * @returns The new relay state.\n */\n async close(): Promise<State> {\n return (await this.fetch(`/relays/${this.id}`, {\n method: 'POST',\n body: { action: 'close' } satisfies RelayAction,\n schema: relayState,\n }))\n .state;\n }\n}\n"],"mappings":"0BAGA,MAAM,EAAQ,EAAE,SAAS,CAAC,OAAQ,SAAS,CAAC,CAEtC,EAAS,EAAE,MAAM,EAAM,CAEvB,EAAa,EAAE,OAAO,CAAS,QAAO,CAAC,CAEvC,EAAS,EAAE,SAAS,CAAC,OAAQ,QAAQ,CAAC,CACxB,EAAE,OAAO,CAAU,SAAQ,CAAC,CAIhD,IAAa,EAAb,KAAuB,CACrB,YAAY,EAAiC,CAAhB,KAAA,MAAA,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