@ikalogic/at1000 0.2.2 → 0.3.0
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/README.md +21 -0
- package/build/at1000-3evjqv7V.d.mts +69 -0
- package/build/at1000-3evjqv7V.d.mts.map +1 -0
- package/build/at1000-BAZbVgLx.cjs +3 -0
- package/build/at1000-BAZbVgLx.cjs.map +1 -0
- package/build/at1000-Cxx254i3.mjs +3 -0
- package/build/at1000-Cxx254i3.mjs.map +1 -0
- package/build/at1000-D_y0MxFy.d.cts +69 -0
- package/build/at1000-D_y0MxFy.d.cts.map +1 -0
- package/build/browser.cjs +1 -1
- package/build/browser.cjs.map +1 -1
- package/build/browser.d.cts +2 -2
- package/build/browser.d.cts.map +1 -1
- package/build/browser.d.mts +2 -2
- package/build/browser.d.mts.map +1 -1
- package/build/browser.mjs +1 -1
- package/build/browser.mjs.map +1 -1
- package/build/{com-CBhjFJPB.d.cts → com-BzaKOH_B.d.cts} +8 -8
- package/build/{com-CBhjFJPB.d.cts.map → com-BzaKOH_B.d.cts.map} +1 -1
- package/build/{com-CBhjFJPB.d.mts → com-BzaKOH_B.d.mts} +8 -8
- package/build/{com-CBhjFJPB.d.mts.map → com-BzaKOH_B.d.mts.map} +1 -1
- package/build/com.cjs +1 -1
- package/build/com.cjs.map +1 -1
- package/build/com.d.cts +2 -2
- package/build/com.d.mts +2 -2
- package/build/com.mjs +1 -1
- package/build/com.mjs.map +1 -1
- package/build/events-PyyK1XbE.d.cts +351 -0
- package/build/events-PyyK1XbE.d.cts.map +1 -0
- package/build/events-PyyK1XbE.d.mts +351 -0
- package/build/events-PyyK1XbE.d.mts.map +1 -0
- package/build/events.cjs +1 -0
- package/build/events.d.cts +2 -0
- package/build/events.d.mts +2 -0
- package/build/events.mjs +1 -0
- package/build/{gpio-DNrdX-QV.d.cts → gpio-CHg2nztz.d.cts} +17 -11
- package/build/gpio-CHg2nztz.d.cts.map +1 -0
- package/build/{gpio-DchxrXWK.d.mts → gpio-CbGcoT9b.d.mts} +17 -11
- package/build/gpio-CbGcoT9b.d.mts.map +1 -0
- package/build/gpio.cjs +1 -1
- package/build/gpio.cjs.map +1 -1
- package/build/gpio.d.cts +2 -2
- package/build/gpio.d.mts +2 -2
- package/build/gpio.mjs +1 -1
- package/build/gpio.mjs.map +1 -1
- package/build/{hmi-DszM-Hfp.d.cts → hmi-B6LU4yaL.d.cts} +10 -2
- package/build/hmi-B6LU4yaL.d.cts.map +1 -0
- package/build/{hmi-DszM-Hfp.d.mts → hmi-B6LU4yaL.d.mts} +10 -2
- package/build/hmi-B6LU4yaL.d.mts.map +1 -0
- package/build/hmi.cjs +1 -1
- package/build/hmi.cjs.map +1 -1
- package/build/hmi.d.cts +2 -2
- package/build/hmi.d.mts +2 -2
- package/build/hmi.mjs +1 -1
- package/build/hmi.mjs.map +1 -1
- package/build/{management-C0iQha23.d.cts → management-DliNzoq1.d.cts} +243 -12
- package/build/management-DliNzoq1.d.cts.map +1 -0
- package/build/{management-C0iQha23.d.mts → management-DliNzoq1.d.mts} +243 -12
- package/build/management-DliNzoq1.d.mts.map +1 -0
- package/build/management.cjs +1 -1
- package/build/management.cjs.map +1 -1
- package/build/management.d.cts +2 -2
- package/build/management.d.mts +2 -2
- package/build/management.mjs +1 -1
- package/build/management.mjs.map +1 -1
- package/build/node.cjs +1 -1
- package/build/node.cjs.map +1 -1
- package/build/node.d.cts +2 -2
- package/build/node.d.cts.map +1 -1
- package/build/node.d.mts +2 -2
- package/build/node.d.mts.map +1 -1
- package/build/node.mjs +1 -1
- package/build/node.mjs.map +1 -1
- package/build/package-BGnFmux8.mjs +2 -0
- package/build/package-BGnFmux8.mjs.map +1 -0
- package/build/package-Dd7S_M7n.cjs +2 -0
- package/build/package-Dd7S_M7n.cjs.map +1 -0
- package/build/{power-CN_9o_NX.d.mts → power-DUs5Sw8n.d.mts} +16 -16
- package/build/{power-CN_9o_NX.d.mts.map → power-DUs5Sw8n.d.mts.map} +1 -1
- package/build/{power-o75Gjpwf.d.cts → power-zT64Y-Q9.d.cts} +16 -16
- package/build/{power-o75Gjpwf.d.cts.map → power-zT64Y-Q9.d.cts.map} +1 -1
- package/build/power.cjs +1 -1
- package/build/power.cjs.map +1 -1
- package/build/power.d.cts +2 -2
- package/build/power.d.mts +2 -2
- package/build/power.mjs +1 -1
- package/build/power.mjs.map +1 -1
- package/build/{relays-BCn6rQN1.d.cts → relays-8EGNIK1T.d.cts} +5 -2
- package/build/relays-8EGNIK1T.d.cts.map +1 -0
- package/build/{relays-BCn6rQN1.d.mts → relays-8EGNIK1T.d.mts} +5 -2
- package/build/relays-8EGNIK1T.d.mts.map +1 -0
- package/build/relays.cjs +1 -1
- package/build/relays.cjs.map +1 -1
- package/build/relays.d.cts +2 -2
- package/build/relays.d.mts +2 -2
- package/build/relays.mjs +1 -1
- package/build/relays.mjs.map +1 -1
- package/package.json +11 -1
- package/build/at1000-BXtrf8Rt.d.cts +0 -50
- package/build/at1000-BXtrf8Rt.d.cts.map +0 -1
- package/build/at1000-BuI_g7jF.cjs +0 -3
- package/build/at1000-BuI_g7jF.cjs.map +0 -1
- package/build/at1000-DVDltAyk.mjs +0 -3
- package/build/at1000-DVDltAyk.mjs.map +0 -1
- package/build/at1000-D_rOUVFH.d.mts +0 -50
- package/build/at1000-D_rOUVFH.d.mts.map +0 -1
- package/build/gpio-DNrdX-QV.d.cts.map +0 -1
- package/build/gpio-DchxrXWK.d.mts.map +0 -1
- package/build/hmi-DszM-Hfp.d.cts.map +0 -1
- package/build/hmi-DszM-Hfp.d.mts.map +0 -1
- package/build/management-C0iQha23.d.cts.map +0 -1
- package/build/management-C0iQha23.d.mts.map +0 -1
- package/build/relays-BCn6rQN1.d.cts.map +0 -1
- package/build/relays-BCn6rQN1.d.mts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AnalogOutputLevel } from "./common-BY1vXz1l.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { u as Information } from "./management-DliNzoq1.mjs";
|
|
3
3
|
import { UpFetch } from "up-fetch";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
|
|
@@ -85,31 +85,31 @@ declare const usbState: Omit<v.ObjectSchema<{
|
|
|
85
85
|
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
86
86
|
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
87
87
|
readonly current: v.NumberSchema<undefined>;
|
|
88
|
-
}, "enabled" | "
|
|
88
|
+
}, "enabled" | "voltage" | "current">;
|
|
89
89
|
readonly "~standard": v.StandardProps<{
|
|
90
90
|
enabled: boolean;
|
|
91
|
-
current: number;
|
|
92
91
|
voltage: number;
|
|
92
|
+
current: number;
|
|
93
93
|
}, {
|
|
94
94
|
enabled: boolean;
|
|
95
|
-
current: number;
|
|
96
95
|
voltage: number;
|
|
96
|
+
current: number;
|
|
97
97
|
}>;
|
|
98
98
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
99
99
|
enabled: boolean;
|
|
100
|
-
current: number;
|
|
101
100
|
voltage: number;
|
|
101
|
+
current: number;
|
|
102
102
|
}, v.NumberIssue | v.BooleanIssue | v.ObjectIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25>>;
|
|
103
103
|
readonly "~types"?: {
|
|
104
104
|
readonly input: {
|
|
105
105
|
enabled: boolean;
|
|
106
|
-
current: number;
|
|
107
106
|
voltage: number;
|
|
107
|
+
current: number;
|
|
108
108
|
};
|
|
109
109
|
readonly output: {
|
|
110
110
|
enabled: boolean;
|
|
111
|
-
current: number;
|
|
112
111
|
voltage: number;
|
|
112
|
+
current: number;
|
|
113
113
|
};
|
|
114
114
|
readonly issue: v.NumberIssue | v.BooleanIssue | v.ObjectIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25>;
|
|
115
115
|
} | undefined;
|
|
@@ -126,31 +126,31 @@ declare const usbConfiguration: Omit<Omit<v.ObjectSchema<{
|
|
|
126
126
|
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
127
127
|
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
128
128
|
readonly current: v.NumberSchema<undefined>;
|
|
129
|
-
}, "enabled" | "
|
|
129
|
+
}, "enabled" | "voltage" | "current">;
|
|
130
130
|
readonly "~standard": v.StandardProps<{
|
|
131
131
|
enabled: boolean;
|
|
132
|
-
current: number;
|
|
133
132
|
voltage: number;
|
|
133
|
+
current: number;
|
|
134
134
|
}, {
|
|
135
135
|
enabled: boolean;
|
|
136
|
-
current: number;
|
|
137
136
|
voltage: number;
|
|
137
|
+
current: number;
|
|
138
138
|
}>;
|
|
139
139
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
140
140
|
enabled: boolean;
|
|
141
|
-
current: number;
|
|
142
141
|
voltage: number;
|
|
142
|
+
current: number;
|
|
143
143
|
}, v.NumberIssue | v.BooleanIssue | v.ObjectIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25>>;
|
|
144
144
|
readonly "~types"?: {
|
|
145
145
|
readonly input: {
|
|
146
146
|
enabled: boolean;
|
|
147
|
-
current: number;
|
|
148
147
|
voltage: number;
|
|
148
|
+
current: number;
|
|
149
149
|
};
|
|
150
150
|
readonly output: {
|
|
151
151
|
enabled: boolean;
|
|
152
|
-
current: number;
|
|
153
152
|
voltage: number;
|
|
153
|
+
current: number;
|
|
154
154
|
};
|
|
155
155
|
readonly issue: v.NumberIssue | v.BooleanIssue | v.ObjectIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25>;
|
|
156
156
|
} | undefined;
|
|
@@ -160,7 +160,7 @@ declare const usbConfiguration: Omit<Omit<v.ObjectSchema<{
|
|
|
160
160
|
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
161
161
|
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
162
162
|
readonly current: v.NumberSchema<undefined>;
|
|
163
|
-
}, "enabled" | "
|
|
163
|
+
}, "enabled" | "voltage" | "current">, "enabled">;
|
|
164
164
|
readonly "~standard": v.StandardProps<{
|
|
165
165
|
enabled: boolean;
|
|
166
166
|
}, {
|
|
@@ -339,5 +339,5 @@ declare class RelayPower {
|
|
|
339
339
|
read_current(): Promise<number>;
|
|
340
340
|
}
|
|
341
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-
|
|
342
|
+
export { RelayPower as a, UsbConfiguration as c, usbState as d, PowerApi as i, UsbState as l, DutConfiguration as n, RelayState as o, DutState as r, Usb as s, Dut as t, dutState as u };
|
|
343
|
+
//# sourceMappingURL=power-DUs5Sw8n.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"power-
|
|
1
|
+
{"version":3,"file":"power-DUs5Sw8n.d.mts","names":[],"sources":["../src/api/power.ts"],"mappings":";;;;;;cAQa,QAAA,EAAQ,CAAA,CAAA,YAAA;EAAA;;;;;KAMT,QAAA,GAAW,CAAA,CAAE,WAAW,QAAQ,QAAA;AAAA,cAEtC,gBAAA,EAAgB,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;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YAAA,IAAgB,OAAA;;;;;EAQhB,YAAA,IAAgB,OAAA;AAAA;;cAMX,GAAA;EAAA,iBACkB,KAAA;EAAA,SAAgC,EAAA;cAAhC,KAAA,EAAO,OAAA,EAAyB,EAAA;;;;EAK7D,KAAA,IAAS,OAAA;;;;AA/IX;;EAwJE,SAAA,CAAU,MAAA,EAAQ,gBAAA,GAAmB,OAAA,CAAQ,QAAA;EAxJH;;;;EAoK1C,MAAA,IAAU,OAAA,CAAQ,QAAA;EApKgD;AAEpE;;;EA0KE,OAAA,IAAW,OAAA,CAAQ,QAAA;;;;;EAQnB,IAAA,IAAQ,OAAA,CAAQ,QAAA;;;;;EAQV,YAAA,IAAgB,OAAA;EA1LH;;;;EAkMb,YAAA,IAAgB,OAAA;AAAA;;cAMX,UAAA;EAAA,iBACkB,KAAA;EAAA,SAAgC,EAAA;cAAhC,KAAA,EAAO,OAAA,EAAyB,EAAA;;;;;EAM7D,IAAA,IAAQ,OAAA,CAAQ,UAAA;;;;;EAQV,YAAA,IAAgB,OAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AnalogOutputLevel } from "./common-BY1vXz1l.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { u as Information } from "./management-DliNzoq1.cjs";
|
|
3
3
|
import { UpFetch } from "up-fetch";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
|
|
@@ -85,31 +85,31 @@ declare const usbState: Omit<v.ObjectSchema<{
|
|
|
85
85
|
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
86
86
|
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
87
87
|
readonly current: v.NumberSchema<undefined>;
|
|
88
|
-
}, "enabled" | "
|
|
88
|
+
}, "enabled" | "voltage" | "current">;
|
|
89
89
|
readonly "~standard": v.StandardProps<{
|
|
90
90
|
enabled: boolean;
|
|
91
|
-
current: number;
|
|
92
91
|
voltage: number;
|
|
92
|
+
current: number;
|
|
93
93
|
}, {
|
|
94
94
|
enabled: boolean;
|
|
95
|
-
current: number;
|
|
96
95
|
voltage: number;
|
|
96
|
+
current: number;
|
|
97
97
|
}>;
|
|
98
98
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
99
99
|
enabled: boolean;
|
|
100
|
-
current: number;
|
|
101
100
|
voltage: number;
|
|
101
|
+
current: number;
|
|
102
102
|
}, v.NumberIssue | v.BooleanIssue | v.ObjectIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25>>;
|
|
103
103
|
readonly "~types"?: {
|
|
104
104
|
readonly input: {
|
|
105
105
|
enabled: boolean;
|
|
106
|
-
current: number;
|
|
107
106
|
voltage: number;
|
|
107
|
+
current: number;
|
|
108
108
|
};
|
|
109
109
|
readonly output: {
|
|
110
110
|
enabled: boolean;
|
|
111
|
-
current: number;
|
|
112
111
|
voltage: number;
|
|
112
|
+
current: number;
|
|
113
113
|
};
|
|
114
114
|
readonly issue: v.NumberIssue | v.BooleanIssue | v.ObjectIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25>;
|
|
115
115
|
} | undefined;
|
|
@@ -126,31 +126,31 @@ declare const usbConfiguration: Omit<Omit<v.ObjectSchema<{
|
|
|
126
126
|
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
127
127
|
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
128
128
|
readonly current: v.NumberSchema<undefined>;
|
|
129
|
-
}, "enabled" | "
|
|
129
|
+
}, "enabled" | "voltage" | "current">;
|
|
130
130
|
readonly "~standard": v.StandardProps<{
|
|
131
131
|
enabled: boolean;
|
|
132
|
-
current: number;
|
|
133
132
|
voltage: number;
|
|
133
|
+
current: number;
|
|
134
134
|
}, {
|
|
135
135
|
enabled: boolean;
|
|
136
|
-
current: number;
|
|
137
136
|
voltage: number;
|
|
137
|
+
current: number;
|
|
138
138
|
}>;
|
|
139
139
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
140
140
|
enabled: boolean;
|
|
141
|
-
current: number;
|
|
142
141
|
voltage: number;
|
|
142
|
+
current: number;
|
|
143
143
|
}, v.NumberIssue | v.BooleanIssue | v.ObjectIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25>>;
|
|
144
144
|
readonly "~types"?: {
|
|
145
145
|
readonly input: {
|
|
146
146
|
enabled: boolean;
|
|
147
|
-
current: number;
|
|
148
147
|
voltage: number;
|
|
148
|
+
current: number;
|
|
149
149
|
};
|
|
150
150
|
readonly output: {
|
|
151
151
|
enabled: boolean;
|
|
152
|
-
current: number;
|
|
153
152
|
voltage: number;
|
|
153
|
+
current: number;
|
|
154
154
|
};
|
|
155
155
|
readonly issue: v.NumberIssue | v.BooleanIssue | v.ObjectIssue | v.MinValueIssue<number, -25> | v.MaxValueIssue<number, 25>;
|
|
156
156
|
} | undefined;
|
|
@@ -160,7 +160,7 @@ declare const usbConfiguration: Omit<Omit<v.ObjectSchema<{
|
|
|
160
160
|
readonly target_voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
161
161
|
readonly voltage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
162
162
|
readonly current: v.NumberSchema<undefined>;
|
|
163
|
-
}, "enabled" | "
|
|
163
|
+
}, "enabled" | "voltage" | "current">, "enabled">;
|
|
164
164
|
readonly "~standard": v.StandardProps<{
|
|
165
165
|
enabled: boolean;
|
|
166
166
|
}, {
|
|
@@ -339,5 +339,5 @@ declare class RelayPower {
|
|
|
339
339
|
read_current(): Promise<number>;
|
|
340
340
|
}
|
|
341
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-
|
|
342
|
+
export { RelayPower as a, UsbConfiguration as c, usbState as d, PowerApi as i, UsbState as l, DutConfiguration as n, RelayState as o, DutState as r, Usb as s, Dut as t, dutState as u };
|
|
343
|
+
//# sourceMappingURL=power-zT64Y-Q9.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"power-
|
|
1
|
+
{"version":3,"file":"power-zT64Y-Q9.d.cts","names":[],"sources":["../src/api/power.ts"],"mappings":";;;;;;cAQa,QAAA,EAAQ,CAAA,CAAA,YAAA;EAAA;;;;;KAMT,QAAA,GAAW,CAAA,CAAE,WAAW,QAAQ,QAAA;AAAA,cAEtC,gBAAA,EAAgB,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KACV,gBAAA,GAAmB,CAAA,CAAE,WAAW,QAAQ,gBAAA;AAAA,cAEvC,QAAA,EAAQ,IAAA,CAAA,CAAA,CAAA,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KACT,QAAA,GAAW,CAAA,CAAE,WAAW,QAAQ,QAAA;AAAA,cAEtC,gBAAA,EAAgB,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KACV,gBAAA,GAAmB,CAAA,CAAE,WAAW,QAAQ,gBAAA;AAAA,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AgB,OAAA;AAAA;;cAMX,UAAA;EAAA,iBACkB,KAAA;EAAA,SAAgC,EAAA;cAAhC,KAAA,EAAO,OAAA,EAAyB,EAAA;;;;;EAM7D,IAAA,IAAQ,OAAA,CAAQ,UAAA;;;;;EAQV,YAAA,IAAgB,OAAA;AAAA"}
|
package/build/power.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunk-CMqjfN_6.cjs"),t=require("./common-BSabSaAU.cjs");let n=require("valibot");n=e.t(n,1);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{fetch;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_0(){return new d(this.fetch,0)}},l=class{fetch;id;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{fetch;id;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{fetch;id;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}};exports.Dut=l,exports.PowerApi=c,exports.RelayPower=d,exports.Usb=u;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunk-CMqjfN_6.cjs"),t=require("./common-BSabSaAU.cjs");let n=require("valibot");n=e.t(n,1);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{fetch;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_0(){return new d(this.fetch,0)}},l=class{fetch;id;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{fetch;id;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{fetch;id;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}};exports.Dut=l,exports.PowerApi=c,exports.RelayPower=d,exports.Usb=u,exports.dutState=r,exports.usbState=a;
|
|
2
2
|
//# sourceMappingURL=power.cjs.map
|
package/build/power.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"power.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\
|
|
1
|
+
{"version":3,"file":"power.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\nexport const 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\nexport const 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 0.\n * @returns The relay instance.\n */\n relay_0(): RelayPower {\n return new RelayPower(this.fetch, 0);\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":"kLAQA,MAAa,EAAWA,EAAE,OAAO,CAC/B,QAASA,EAAE,QAAQ,EACnB,eAAgBC,EAAAA,EAChB,QAASA,EAAAA,EACT,QAASD,EAAE,OAAO,CACpB,CAAC,EAGK,EAAmBA,EAAE,QAAQA,EAAE,KAAK,EAAU,CAAC,UAAW,gBAAgB,CAAC,CAAC,EAGrE,EAAWA,EAAE,KAAK,EAAU,CAAC,UAAW,UAAW,SAAS,CAAC,EAGpE,EAAmBA,EAAE,KAAK,EAAU,CAAC,SAAS,CAAC,EAG/C,EAAaA,EAAE,KAAK,EAAU,CAAC,SAAS,CAAC,EAI/C,IAAa,EAAb,KAAsB,CAIS,MAH7B,UACA,UAA6B,EAE7B,YAAY,EAAiC,EAAmB,CAAnC,KAAA,MAAA,EAC3B,KAAK,UAAY,EAAK,aAAa,UAAU,QAAQ,EAAG,IAAM,EAAI,EAAE,MAAO,CAAC,CAC9E,CAKA,OAAuB,CACrB,OAAO,KAAK,MAAM,eAAgB,CAAE,OAAQ,OAAQ,kBAAqB,CAAC,CAA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AiC,EAA4B,CAA5C,KAAA,MAAA,EAAgC,KAAA,GAAA,CAAa,CAK1E,OAAuB,CACrB,OAAO,KAAK,MAAM,cAAc,KAAK,GAAG,QAAS,CAAE,OAAQ,OAAQ,kBAAqB,CAAC,CAAE,CAAC,CAC9F,CAOA,UAAU,EAA6C,CACrD,OAAO,KAAK,MAAM,cAAc,KAAK,KAAM,CACzC,OAAQ,QACR,KAAMA,EAAE,MAAM,EAAkB,CAAM,EACtC,OAAQ,CACV,CAAC,CACH,CAMA,QAA4B,CAC1B,OAAO,KAAK,UAAU,CAAE,QAAS,EAAK,CAAC,CACzC,CAMA,SAA6B,CAC3B,OAAO,KAAK,UAAU,CAAE,QAAS,EAAM,CAAC,CAC1C,CAMA,MAA0B,CACxB,OAAO,KAAK,MAAM,cAAc,KAAK,KAAM,CAAE,OAAQ,CAAS,CAAC,CACjE,CAMA,MAAM,cAAgC,CACpC,OAAQ,MAAM,KAAK,KAAK,EAAA,CAAG,OAC7B,CAMA,MAAM,cAAgC,CACpC,OAAQ,MAAM,KAAK,KAAK,EAAA,CAAG,OAC7B,CACF,EAGa,EAAb,KAAwB,CACO,MAAgC,GAA7D,YAAY,EAAiC,EAA4B,CAA5C,KAAA,MAAA,EAAgC,KAAA,GAAA,CAAa,CAM1E,MAA4B,CAC1B,OAAO,KAAK,MAAM,gBAAgB,KAAK,KAAM,CAAE,OAAQ,CAAW,CAAC,CACrE,CAMA,MAAM,cAAgC,CACpC,OAAQ,MAAM,KAAK,KAAK,EAAA,CAAG,OAC7B,CACF"}
|
package/build/power.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as AnalogOutputLevel } from "./common-BY1vXz1l.cjs";
|
|
2
|
-
import { a as RelayPower, c as UsbConfiguration, i as PowerApi, l as UsbState, n as DutConfiguration, o as RelayState, r as DutState, s as Usb, t as Dut } from "./power-
|
|
3
|
-
export { type AnalogOutputLevel, Dut, DutConfiguration, DutState, PowerApi, RelayPower, RelayState, Usb, UsbConfiguration, UsbState };
|
|
2
|
+
import { a as RelayPower, c as UsbConfiguration, d as usbState, i as PowerApi, l as UsbState, n as DutConfiguration, o as RelayState, r as DutState, s as Usb, t as Dut, u as dutState } from "./power-zT64Y-Q9.cjs";
|
|
3
|
+
export { type AnalogOutputLevel, Dut, DutConfiguration, DutState, PowerApi, RelayPower, RelayState, Usb, UsbConfiguration, UsbState, dutState, usbState };
|
package/build/power.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as AnalogOutputLevel } from "./common-BY1vXz1l.mjs";
|
|
2
|
-
import { a as RelayPower, c as UsbConfiguration, i as PowerApi, l as UsbState, n as DutConfiguration, o as RelayState, r as DutState, s as Usb, t as Dut } from "./power-
|
|
3
|
-
export { type AnalogOutputLevel, Dut, DutConfiguration, DutState, PowerApi, RelayPower, RelayState, Usb, UsbConfiguration, UsbState };
|
|
2
|
+
import { a as RelayPower, c as UsbConfiguration, d as usbState, i as PowerApi, l as UsbState, n as DutConfiguration, o as RelayState, r as DutState, s as Usb, t as Dut, u as dutState } from "./power-DUs5Sw8n.mjs";
|
|
3
|
+
export { type AnalogOutputLevel, Dut, DutConfiguration, DutState, PowerApi, RelayPower, RelayState, Usb, UsbConfiguration, UsbState, dutState, usbState };
|
package/build/power.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./common-Ce3FeF-Q.mjs";import*as t from"valibot";const n=t.object({enabled:t.boolean(),target_voltage:e,voltage:e,current:t.number()}),r=t.partial(t.pick(n,[`enabled`,`target_voltage`])),i=t.pick(n,[`enabled`,`current`,`voltage`]),a=t.pick(i,[`enabled`]),o=t.pick(n,[`current`]);var s=class{fetch;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 c(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 l(this.fetch,e)}relay_0(){return new u(this.fetch,0)}},c=class{fetch;id;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:t.parse(r,e),schema:n})}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:n})}async read_current(){return(await this.read()).current}async read_voltage(){return(await this.read()).voltage}},l=class{fetch;id;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:t.parse(a,e),schema:i})}enable(){return this.configure({enabled:!0})}disable(){return this.configure({enabled:!1})}read(){return this.fetch(`/power/usb/${this.id}`,{schema:i})}async read_current(){return(await this.read()).current}async read_voltage(){return(await this.read()).voltage}},u=class{fetch;id;constructor(e,t){this.fetch=e,this.id=t}read(){return this.fetch(`/power/relay/${this.id}`,{schema:o})}async read_current(){return(await this.read()).current}};export{c as Dut,s as PowerApi,u as RelayPower,l as Usb};
|
|
1
|
+
import{t as e}from"./common-Ce3FeF-Q.mjs";import*as t from"valibot";const n=t.object({enabled:t.boolean(),target_voltage:e,voltage:e,current:t.number()}),r=t.partial(t.pick(n,[`enabled`,`target_voltage`])),i=t.pick(n,[`enabled`,`current`,`voltage`]),a=t.pick(i,[`enabled`]),o=t.pick(n,[`current`]);var s=class{fetch;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 c(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 l(this.fetch,e)}relay_0(){return new u(this.fetch,0)}},c=class{fetch;id;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:t.parse(r,e),schema:n})}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:n})}async read_current(){return(await this.read()).current}async read_voltage(){return(await this.read()).voltage}},l=class{fetch;id;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:t.parse(a,e),schema:i})}enable(){return this.configure({enabled:!0})}disable(){return this.configure({enabled:!1})}read(){return this.fetch(`/power/usb/${this.id}`,{schema:i})}async read_current(){return(await this.read()).current}async read_voltage(){return(await this.read()).voltage}},u=class{fetch;id;constructor(e,t){this.fetch=e,this.id=t}read(){return this.fetch(`/power/relay/${this.id}`,{schema:o})}async read_current(){return(await this.read()).current}};export{c as Dut,s as PowerApi,u as RelayPower,l as Usb,n as dutState,i as usbState};
|
|
2
2
|
//# sourceMappingURL=power.mjs.map
|
package/build/power.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"power.mjs","names":[],"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\
|
|
1
|
+
{"version":3,"file":"power.mjs","names":[],"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\nexport const 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\nexport const 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 0.\n * @returns The relay instance.\n */\n relay_0(): RelayPower {\n return new RelayPower(this.fetch, 0);\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":"oEAQA,MAAa,EAAW,EAAE,OAAO,CAC/B,QAAS,EAAE,QAAQ,EACnB,eAAgB,EAChB,QAAS,EACT,QAAS,EAAE,OAAO,CACpB,CAAC,EAGK,EAAmB,EAAE,QAAQ,EAAE,KAAK,EAAU,CAAC,UAAW,gBAAgB,CAAC,CAAC,EAGrE,EAAW,EAAE,KAAK,EAAU,CAAC,UAAW,UAAW,S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AAQ,CAAW,CAAC,CACrE,CAMA,MAAM,cAAgC,CACpC,OAAQ,MAAM,KAAK,KAAK,EAAA,CAAG,OAC7B,CACF"}
|
|
@@ -6,6 +6,9 @@ declare const state: v.PicklistSchema<["open", "closed"], undefined>;
|
|
|
6
6
|
type State = v.InferOutput<typeof state>;
|
|
7
7
|
declare const states: v.ArraySchema<v.PicklistSchema<["open", "closed"], undefined>, undefined>;
|
|
8
8
|
type States = v.InferOutput<typeof states>;
|
|
9
|
+
declare const relayState: v.ObjectSchema<{
|
|
10
|
+
readonly state: v.PicklistSchema<["open", "closed"], undefined>;
|
|
11
|
+
}, undefined>;
|
|
9
12
|
/** @hideconstructor */
|
|
10
13
|
declare class RelaysApi {
|
|
11
14
|
private readonly fetch;
|
|
@@ -76,5 +79,5 @@ declare class Relay {
|
|
|
76
79
|
close(): Promise<State>;
|
|
77
80
|
}
|
|
78
81
|
//#endregion
|
|
79
|
-
export { States as i, RelaysApi as n, State as r, Relay as t };
|
|
80
|
-
//# sourceMappingURL=relays-
|
|
82
|
+
export { relayState as a, States as i, RelaysApi as n, states as o, State as r, Relay as t };
|
|
83
|
+
//# sourceMappingURL=relays-8EGNIK1T.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relays-8EGNIK1T.d.cts","names":[],"sources":["../src/api/relays.ts"],"mappings":";;;;cAGM,KAAA,EAAK,CAAA,CAAA,cAAA;AAAA,KACC,KAAA,GAAQ,CAAA,CAAE,WAAW,QAAQ,KAAA;AAAA,cAC5B,MAAA,EAAM,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,cAAA;AAAA,KACP,MAAA,GAAS,CAAA,CAAE,WAAW,QAAQ,MAAA;AAAA,cAC7B,UAAA,EAAU,CAAA,CAAA,YAAA;EAAA,gBAA6B,CAAA,CAAA,cAAA;AAAA;AAHpD;AAAA,cAUa,SAAA;EAAA,iBACkB,KAAA;cAAA,KAAA,EAAO,OAAA;EAXlB;;;EAgBlB,KAAA,IAAK,OAAA;EAhBuC;AAC9C;;;;EAwBE,KAAA,CAAM,EAAA,WAAa,KAAA;EAxBF;;;;EAgCjB,IAAA,IAAQ,OAAA,CAAQ,MAAA;EA/BN;;;;EAuCV,IAAA,IAAQ,OAAA,CAAQ,MAAA;EAvCK;;;AAAyB;EAmD9C,KAAA,IAAS,OAAA,CAAQ,MAAA;AAAA;;cAUN,KAAA;EAAA,iBAEQ,KAAA;EA9DE;;;EAAA,SAkEH,EAAA;cAJC,KAAA,EAAO,OAAA;;AAvD5B;;;EA2DoB,EAAA;EA1DkB;;;;EAiE9B,IAAA,IAAQ,OAAA,CAAQ,KAAA;EAnCN;;;;EA2CV,OAAA,IAAW,OAAA;EA/BD;;;;EAuCV,SAAA,IAAa,OAAA;EA5EnB;;;;EAoFM,IAAA,IAAQ,OAAA,CAAQ,KAAA;EAnEtB;;;;EAgFM,KAAA,IAAS,OAAA,CAAQ,KAAA;AAAA"}
|
|
@@ -6,6 +6,9 @@ declare const state: v.PicklistSchema<["open", "closed"], undefined>;
|
|
|
6
6
|
type State = v.InferOutput<typeof state>;
|
|
7
7
|
declare const states: v.ArraySchema<v.PicklistSchema<["open", "closed"], undefined>, undefined>;
|
|
8
8
|
type States = v.InferOutput<typeof states>;
|
|
9
|
+
declare const relayState: v.ObjectSchema<{
|
|
10
|
+
readonly state: v.PicklistSchema<["open", "closed"], undefined>;
|
|
11
|
+
}, undefined>;
|
|
9
12
|
/** @hideconstructor */
|
|
10
13
|
declare class RelaysApi {
|
|
11
14
|
private readonly fetch;
|
|
@@ -76,5 +79,5 @@ declare class Relay {
|
|
|
76
79
|
close(): Promise<State>;
|
|
77
80
|
}
|
|
78
81
|
//#endregion
|
|
79
|
-
export { States as i, RelaysApi as n, State as r, Relay as t };
|
|
80
|
-
//# sourceMappingURL=relays-
|
|
82
|
+
export { relayState as a, States as i, RelaysApi as n, states as o, State as r, Relay as t };
|
|
83
|
+
//# sourceMappingURL=relays-8EGNIK1T.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relays-8EGNIK1T.d.mts","names":[],"sources":["../src/api/relays.ts"],"mappings":";;;;cAGM,KAAA,EAAK,CAAA,CAAA,cAAA;AAAA,KACC,KAAA,GAAQ,CAAA,CAAE,WAAW,QAAQ,KAAA;AAAA,cAC5B,MAAA,EAAM,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,cAAA;AAAA,KACP,MAAA,GAAS,CAAA,CAAE,WAAW,QAAQ,MAAA;AAAA,cAC7B,UAAA,EAAU,CAAA,CAAA,YAAA;EAAA,gBAA6B,CAAA,CAAA,cAAA;AAAA;AAHpD;AAAA,cAUa,SAAA;EAAA,iBACkB,KAAA;cAAA,KAAA,EAAO,OAAA;EAXlB;;;EAgBlB,KAAA,IAAK,OAAA;EAhBuC;AAC9C;;;;EAwBE,KAAA,CAAM,EAAA,WAAa,KAAA;EAxBF;;;;EAgCjB,IAAA,IAAQ,OAAA,CAAQ,MAAA;EA/BN;;;;EAuCV,IAAA,IAAQ,OAAA,CAAQ,MAAA;EAvCK;;;AAAyB;EAmD9C,KAAA,IAAS,OAAA,CAAQ,MAAA;AAAA;;cAUN,KAAA;EAAA,iBAEQ,KAAA;EA9DE;;;EAAA,SAkEH,EAAA;cAJC,KAAA,EAAO,OAAA;;AAvD5B;;;EA2DoB,EAAA;EA1DkB;;;;EAiE9B,IAAA,IAAQ,OAAA,CAAQ,KAAA;EAnCN;;;;EA2CV,OAAA,IAAW,OAAA;EA/BD;;;;EAuCV,SAAA,IAAa,OAAA;EA5EnB;;;;EAoFM,IAAA,IAAQ,OAAA,CAAQ,KAAA;EAnEtB;;;;EAgFM,KAAA,IAAS,OAAA,CAAQ,KAAA;AAAA"}
|
package/build/relays.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunk-CMqjfN_6.cjs");let t=require("valibot");t=e.t(t,1);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{fetch;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{fetch;id;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}};exports.Relay=s,exports.RelaysApi=o;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunk-CMqjfN_6.cjs");let t=require("valibot");t=e.t(t,1);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{fetch;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{fetch;id;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}};exports.Relay=s,exports.RelaysApi=o,exports.relayState=i,exports.states=r;
|
|
2
2
|
//# sourceMappingURL=relays.cjs.map
|
package/build/relays.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relays.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>;\
|
|
1
|
+
{"version":3,"file":"relays.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>;\nexport const states = v.array(state);\nexport type States = v.InferOutput<typeof states>;\nexport const 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":"+IAGA,MAAM,EAAQA,EAAE,SAAS,CAAC,OAAQ,QAAQ,CAAC,EAE9B,EAASA,EAAE,MAAM,CAAK,EAEtB,EAAaA,EAAE,OAAO,CAAS,OAAM,CAAC,EAE7C,EAASA,EAAE,SAAS,CAAC,OAAQ,OAAO,CAAC,EACvBA,EAAE,OAAO,CAAU,QAAO,CAAC,EAI/C,IAAa,EAAb,KAAuB,CACQ,MAA7B,YAAY,EAAiC,CAAhB,KAAA,MAAA,CAAiB,CAK9C,OAAQ,CACN,OAAO,KAAK,MAAM,gBAAiB,CAAE,OAAQ,OAAQ,kBAAqB,CAAC,CAAE,CAAC,CAChF,CAOA,MAAM,EAAmB,CACvB,OAAO,IAAI,EAAM,KAAK,MAAO,CAAE,CACjC,CAMA,MAAwB,CACtB,OAAO,KAAK,MAAM,UAAW,CAAE,OAAQ,CAAO,CAAC,CACjD,CAMA,MAAwB,CACtB,OAAO,KAAK,MAAM,UAAW,CAC3B,OAAQ,OACR,KAAM,CAAE,OAAQ,MAAO,EACvB,OAAQ,CACV,CAAC,CACH,CAMA,OAAyB,CACvB,OAAO,KAAK,MAAM,UAAW,CAC3B,OAAQ,OACR,KAAM,CAAE,OAAQ,OAAQ,EACxB,OAAQ,CACV,CAAC,CACH,CACF,EAGa,EAAb,KAAmB,CAEE,MAID,GALlB,YACE,EAIA,EACA,CALiB,KAAA,MAAA,EAID,KAAA,GAAA,CACf,CAMH,MAAM,MAAuB,CAC3B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAAE,OAAQ,CAAW,CAAC,EAAA,CAAG,KAC1E,CAMA,MAAM,SAA4B,CAChC,OAAQ,MAAM,KAAK,KAAK,IAAO,MACjC,CAMA,MAAM,WAA8B,CAClC,OAAQ,MAAM,KAAK,KAAK,IAAO,QACjC,CAMA,MAAM,MAAuB,CAC3B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAC7C,OAAQ,OACR,KAAM,CAAE,OAAQ,MAAO,EACvB,OAAQ,CACV,CAAC,EAAA,CACE,KACL,CAMA,MAAM,OAAwB,CAC5B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAC7C,OAAQ,OACR,KAAM,CAAE,OAAQ,OAAQ,EACxB,OAAQ,CACV,CAAC,EAAA,CACE,KACL,CACF"}
|
package/build/relays.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as States, n as RelaysApi, r as State, t as Relay } from "./relays-
|
|
2
|
-
export { Relay, RelaysApi, State, States };
|
|
1
|
+
import { a as relayState, i as States, n as RelaysApi, o as states, r as State, t as Relay } from "./relays-8EGNIK1T.cjs";
|
|
2
|
+
export { Relay, RelaysApi, State, States, relayState, states };
|
package/build/relays.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as States, n as RelaysApi, r as State, t as Relay } from "./relays-
|
|
2
|
-
export { Relay, RelaysApi, State, States };
|
|
1
|
+
import { a as relayState, i as States, n as RelaysApi, o as states, r as State, t as Relay } from "./relays-8EGNIK1T.mjs";
|
|
2
|
+
export { Relay, RelaysApi, State, States, relayState, states };
|
package/build/relays.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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{fetch;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{fetch;id;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{o as Relay,a as RelaysApi};
|
|
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{fetch;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{fetch;id;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{o as Relay,a as RelaysApi,r as relayState,n as states};
|
|
2
2
|
//# sourceMappingURL=relays.mjs.map
|
package/build/relays.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relays.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>;\
|
|
1
|
+
{"version":3,"file":"relays.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>;\nexport const states = v.array(state);\nexport type States = v.InferOutput<typeof states>;\nexport const 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,QAAQ,CAAC,EAE9B,EAAS,EAAE,MAAM,CAAK,EAEtB,EAAa,EAAE,OAAO,CAAS,OAAM,CAAC,EAE7C,EAAS,EAAE,SAAS,CAAC,OAAQ,OAAO,CAAC,EACvB,EAAE,OAAO,CAAU,QAAO,CAAC,EAI/C,IAAa,EAAb,KAAuB,CACQ,MAA7B,YAAY,EAAiC,CAAhB,KAAA,MAAA,CAAiB,CAK9C,OAAQ,CACN,OAAO,KAAK,MAAM,gBAAiB,CAAE,OAAQ,OAAQ,kBAAqB,CAAC,CAAE,CAAC,CAChF,CAOA,MAAM,EAAmB,CACvB,OAAO,IAAI,EAAM,KAAK,MAAO,CAAE,CACjC,CAMA,MAAwB,CACtB,OAAO,KAAK,MAAM,UAAW,CAAE,OAAQ,CAAO,CAAC,CACjD,CAMA,MAAwB,CACtB,OAAO,KAAK,MAAM,UAAW,CAC3B,OAAQ,OACR,KAAM,CAAE,OAAQ,MAAO,EACvB,OAAQ,CACV,CAAC,CACH,CAMA,OAAyB,CACvB,OAAO,KAAK,MAAM,UAAW,CAC3B,OAAQ,OACR,KAAM,CAAE,OAAQ,OAAQ,EACxB,OAAQ,CACV,CAAC,CACH,CACF,EAGa,EAAb,KAAmB,CAEE,MAID,GALlB,YACE,EAIA,EACA,CALiB,KAAA,MAAA,EAID,KAAA,GAAA,CACf,CAMH,MAAM,MAAuB,CAC3B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAAE,OAAQ,CAAW,CAAC,EAAA,CAAG,KAC1E,CAMA,MAAM,SAA4B,CAChC,OAAQ,MAAM,KAAK,KAAK,IAAO,MACjC,CAMA,MAAM,WAA8B,CAClC,OAAQ,MAAM,KAAK,KAAK,IAAO,QACjC,CAMA,MAAM,MAAuB,CAC3B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAC7C,OAAQ,OACR,KAAM,CAAE,OAAQ,MAAO,EACvB,OAAQ,CACV,CAAC,EAAA,CACE,KACL,CAMA,MAAM,OAAwB,CAC5B,OAAQ,MAAM,KAAK,MAAM,WAAW,KAAK,KAAM,CAC7C,OAAQ,OACR,KAAM,CAAE,OAAQ,OAAQ,EACxB,OAAQ,CACV,CAAC,EAAA,CACE,KACL,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikalogic/at1000",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Ikalogic AT1000 API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/node.cjs",
|
|
@@ -44,6 +44,16 @@
|
|
|
44
44
|
"default": "./build/com.cjs"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
+
"./events": {
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./build/events.d.mts",
|
|
50
|
+
"default": "./build/events.mjs"
|
|
51
|
+
},
|
|
52
|
+
"require": {
|
|
53
|
+
"types": "./build/events.d.cts",
|
|
54
|
+
"default": "./build/events.cjs"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
47
57
|
"./gpio": {
|
|
48
58
|
"import": {
|
|
49
59
|
"types": "./build/gpio.d.mts",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { s as ComApi } from "./com-CBhjFJPB.cjs";
|
|
2
|
-
import { d as ManagementApi, l as Information } from "./management-C0iQha23.cjs";
|
|
3
|
-
import { s as GpioApi } from "./gpio-DNrdX-QV.cjs";
|
|
4
|
-
import { r as HmiApi } from "./hmi-DszM-Hfp.cjs";
|
|
5
|
-
import { i as PowerApi } from "./power-o75Gjpwf.cjs";
|
|
6
|
-
import { n as RelaysApi } from "./relays-BCn6rQN1.cjs";
|
|
7
|
-
|
|
8
|
-
//#region src/at1000.d.ts
|
|
9
|
-
/** @hideconstructor */
|
|
10
|
-
declare class AT1000Base {
|
|
11
|
-
/**
|
|
12
|
-
* IP address or hostname of the AT1000 device
|
|
13
|
-
*/
|
|
14
|
-
readonly host: string;
|
|
15
|
-
/**
|
|
16
|
-
* Device information
|
|
17
|
-
*/
|
|
18
|
-
readonly info: Information;
|
|
19
|
-
private fetch;
|
|
20
|
-
/**
|
|
21
|
-
* COM API
|
|
22
|
-
*/
|
|
23
|
-
readonly com: ComApi;
|
|
24
|
-
/**
|
|
25
|
-
* HMI API
|
|
26
|
-
*/
|
|
27
|
-
readonly hmi: HmiApi;
|
|
28
|
-
/**
|
|
29
|
-
* GPIO API
|
|
30
|
-
*/
|
|
31
|
-
readonly gpio: GpioApi;
|
|
32
|
-
/**
|
|
33
|
-
* Management API
|
|
34
|
-
*/
|
|
35
|
-
readonly management: ManagementApi;
|
|
36
|
-
/**
|
|
37
|
-
* Power management API
|
|
38
|
-
*/
|
|
39
|
-
readonly power: PowerApi;
|
|
40
|
-
/**
|
|
41
|
-
* Relays API
|
|
42
|
-
*/
|
|
43
|
-
readonly relays: RelaysApi;
|
|
44
|
-
constructor(host: string, info: Information);
|
|
45
|
-
reset(): Promise<void>;
|
|
46
|
-
static create: (host: string) => Promise<AT1000Base>;
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
export { AT1000Base as t };
|
|
50
|
-
//# sourceMappingURL=at1000-BXtrf8Rt.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"at1000-BXtrf8Rt.d.cts","names":[],"sources":["../src/at1000.ts"],"mappings":";;;;;;;;;cAkBa,UAAA;EAAA;;;EAAA,SAIK,IAAA;EAUK;;;EAAA,SANL,IAAA,EAAM,WAAA;EAAA,QAEd,KAAA;EAwBgB;;;EAAA,SApBR,GAAA,EAAK,MAAA;EA+EwB;;;EAAA,SA3E7B,GAAA,EAAK,MAAA;EAVL;;;EAAA,SAcA,IAAA,EAAM,OAAA;EARD;;;EAAA,SAYL,UAAA,EAAY,aAAA;EAJN;;;EAAA,SAQN,KAAA,EAAO,QAAA;EAAA;;;EAAA,SAIP,MAAA,EAAQ,SAAA;cAEZ,IAAA,UAAc,IAAA,EAAM,WAAA;EAiD1B,KAAA,IAAK,OAAA;EAAA,OAQG,MAAA,GAAgB,IAAA,aAAe,OAAA,CAAQ,UAAA;AAAA"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const e=require("./com.cjs"),t=require("./gpio.cjs"),n=require("./hmi.cjs"),r=require("./management.cjs"),i=require("./power.cjs"),a=require("./relays.cjs");let o=require("up-fetch");var s=`0.2.2`;function c(e){return e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}var l=class s{host;info;fetch;com;hmi;gpio;management;power;relays;constructor(s,l){this.host=s,this.info=l,this.fetch=(0,o.up)(fetch,()=>({baseUrl:`http://${c(this.host)}/v0`,timeout:1e3,parseRejected:async(e,t)=>{let n,r=e.headers.get(`content-type`);try{n=r?.includes(`application/json`)?await e.json():await e.text()}catch{n=`Failed to parse response body`}if(typeof n==`object`&&[`code`,`message`,`suggestion`,`path`].every(e=>e in n)){let e=n.suggestion.replace(/\n/g,`
|
|
2
|
-
`);throw Error(`${n.message} (${n.code})\n Suggestion: ${e}\n Path: ${n.path}`)}throw Error(`API request to ${t.method} ${e.url} failed with status ${e.status}: ${typeof n==`string`?n:JSON.stringify(n)}`)}})),this.com=new e.ComApi(this.fetch),this.hmi=new n.HmiApi(this.fetch),this.gpio=new t.GpioApi(this.fetch,this.info),this.management=new r.ManagementApi(this.fetch),this.power=new i.PowerApi(this.fetch,this.info),this.relays=new a.RelaysApi(this.fetch)}async reset(){await this.com.reset(),await this.hmi.reset(),await this.gpio.reset(),await this.power.reset(),await this.relays.reset()}static create=async e=>new s(e,await new r.ManagementApi((0,o.up)(fetch,()=>({baseUrl:`http://${c(e)}/v0`,timeout:1e3}))).info())};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
3
|
-
//# sourceMappingURL=at1000-BuI_g7jF.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"at1000-BuI_g7jF.cjs","names":["ComApi","HmiApi","GpioApi","ManagementApi","PowerApi","RelaysApi"],"sources":["../package.json","../src/at1000.ts"],"sourcesContent":["","import { up, type UpFetch } from 'up-fetch';\n\nimport { ComApi } from './api/com';\nimport { GpioApi } from './api/gpio';\nimport { HmiApi } from './api/hmi';\nimport { type Information, ManagementApi } from './api/management';\nimport { PowerApi } from './api/power';\nimport { RelaysApi } from './api/relays';\n\n/** Wraps IPv6 literal addresses in brackets for use in URLs (RFC 3986). */\nfunction format_host_for_url(host: string): string {\n if (host.includes(':') && !host.startsWith('[')) {\n return `[${host}]`;\n }\n return host;\n}\n\n/** @hideconstructor */\nexport class AT1000Base {\n /**\n * IP address or hostname of the AT1000 device\n */\n public readonly host: string;\n /**\n * Device information\n */\n public readonly info: Information;\n\n private fetch: UpFetch;\n /**\n * COM API\n */\n public readonly com: ComApi;\n /**\n * HMI API\n */\n public readonly hmi: HmiApi;\n /**\n * GPIO API\n */\n public readonly gpio: GpioApi;\n /**\n * Management API\n */\n public readonly management: ManagementApi;\n /**\n * Power management API\n */\n public readonly power: PowerApi;\n /**\n * Relays API\n */\n public readonly relays: RelaysApi;\n\n constructor(host: string, info: Information) {\n this.host = host;\n this.info = info;\n\n this.fetch = up(\n fetch,\n () => ({\n baseUrl: `http://${format_host_for_url(this.host)}/v0`,\n timeout: 1000,\n parseRejected: async (response, request) => {\n let errorData: any;\n const contentType = response.headers.get('content-type');\n try {\n if (contentType?.includes('application/json')) {\n errorData = await response.json();\n } else {\n errorData = await response.text();\n }\n } catch {\n errorData = 'Failed to parse response body';\n }\n\n if (\n typeof errorData === 'object'\n && ['code', 'message', 'suggestion', 'path'].every((key) => key in errorData)\n ) {\n const formattedSuggestion = errorData.suggestion.replace(/\\n/g, '\\n ');\n throw new Error(\n `${errorData.message} (${errorData.code})\\n Suggestion: ${formattedSuggestion}\\n Path: ${errorData.path}`,\n );\n }\n\n throw new Error(\n `API request to ${request.method} ${response.url} failed with status ${response.status}: ${\n typeof errorData === 'string' ? errorData : JSON.stringify(errorData)\n }`,\n );\n },\n }),\n );\n\n this.com = new ComApi(this.fetch);\n this.hmi = new HmiApi(this.fetch);\n this.gpio = new GpioApi(this.fetch, this.info);\n this.management = new ManagementApi(this.fetch);\n this.power = new PowerApi(this.fetch, this.info);\n this.relays = new RelaysApi(this.fetch);\n }\n\n async reset() {\n await this.com.reset();\n await this.hmi.reset();\n await this.gpio.reset();\n await this.power.reset();\n await this.relays.reset();\n }\n\n public static create = async (host: string): Promise<AT1000Base> => {\n // Create a temporary client to fetch device info\n const management = new ManagementApi(\n up(fetch, () => ({ baseUrl: `http://${format_host_for_url(host)}/v0`, timeout: 1000 })),\n );\n const info = await management.info();\n\n return new AT1000Base(host, info);\n };\n}\n"],"mappings":"qMCUA,SAAS,EAAoB,EAAsB,CAIjD,OAHI,EAAK,SAAS,GAAG,GAAK,CAAC,EA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ACxC,CAEA,MAAM,OAAQ,CACZ,MAAM,KAAK,IAAI,MAAM,EACrB,MAAM,KAAK,IAAI,MAAM,EACrB,MAAM,KAAK,KAAK,MAAM,EACtB,MAAM,KAAK,MAAM,MAAM,EACvB,MAAM,KAAK,OAAO,MAAM,CAC1B,CAEA,OAAc,OAAS,KAAO,IAOrB,IAAI,EAAW,EAAM,MAFT,IAHIF,EAAAA,eAAAA,EAAAA,EAAAA,GAAAA,CAClB,WAAc,CAAE,QAAS,UAAU,EAAoB,CAAI,EAAE,KAAM,QAAS,GAAK,EAAE,CAE5D,CAAC,CAAC,KAAK,CAEH,CAEpC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{ComApi as e}from"./com.mjs";import{GpioApi as t}from"./gpio.mjs";import{HmiApi as n}from"./hmi.mjs";import{ManagementApi as r}from"./management.mjs";import{PowerApi as i}from"./power.mjs";import{RelaysApi as a}from"./relays.mjs";import{up as o}from"up-fetch";var s=`0.2.2`;function c(e){return e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}var l=class s{host;info;fetch;com;hmi;gpio;management;power;relays;constructor(s,l){this.host=s,this.info=l,this.fetch=o(fetch,()=>({baseUrl:`http://${c(this.host)}/v0`,timeout:1e3,parseRejected:async(e,t)=>{let n,r=e.headers.get(`content-type`);try{n=r?.includes(`application/json`)?await e.json():await e.text()}catch{n=`Failed to parse response body`}if(typeof n==`object`&&[`code`,`message`,`suggestion`,`path`].every(e=>e in n)){let e=n.suggestion.replace(/\n/g,`
|
|
2
|
-
`);throw Error(`${n.message} (${n.code})\n Suggestion: ${e}\n Path: ${n.path}`)}throw Error(`API request to ${t.method} ${e.url} failed with status ${e.status}: ${typeof n==`string`?n:JSON.stringify(n)}`)}})),this.com=new e(this.fetch),this.hmi=new n(this.fetch),this.gpio=new t(this.fetch,this.info),this.management=new r(this.fetch),this.power=new i(this.fetch,this.info),this.relays=new a(this.fetch)}async reset(){await this.com.reset(),await this.hmi.reset(),await this.gpio.reset(),await this.power.reset(),await this.relays.reset()}static create=async e=>new s(e,await new r(o(fetch,()=>({baseUrl:`http://${c(e)}/v0`,timeout:1e3}))).info())};export{s as n,l as t};
|
|
3
|
-
//# sourceMappingURL=at1000-DVDltAyk.mjs.map
|