@tx5dr/contracts 1.2.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/CLAUDE.md +41 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/schema/__tests__/plugin-runtime-log.schema.test.d.ts +2 -0
- package/dist/schema/__tests__/plugin-runtime-log.schema.test.d.ts.map +1 -0
- package/dist/schema/__tests__/plugin-runtime-log.schema.test.js +78 -0
- package/dist/schema/__tests__/plugin-runtime-log.schema.test.js.map +1 -0
- package/dist/schema/ability.d.ts +85 -0
- package/dist/schema/ability.d.ts.map +1 -0
- package/dist/schema/ability.js +119 -0
- package/dist/schema/ability.js.map +1 -0
- package/dist/schema/api-response.schema.d.ts +1017 -0
- package/dist/schema/api-response.schema.d.ts.map +1 -0
- package/dist/schema/api-response.schema.js +137 -0
- package/dist/schema/api-response.schema.js.map +1 -0
- package/dist/schema/audio-sidecar.schema.d.ts +106 -0
- package/dist/schema/audio-sidecar.schema.d.ts.map +1 -0
- package/dist/schema/audio-sidecar.schema.js +47 -0
- package/dist/schema/audio-sidecar.schema.js.map +1 -0
- package/dist/schema/audio.schema.d.ts +227 -0
- package/dist/schema/audio.schema.d.ts.map +1 -0
- package/dist/schema/audio.schema.js +56 -0
- package/dist/schema/audio.schema.js.map +1 -0
- package/dist/schema/auth.schema.d.ts +738 -0
- package/dist/schema/auth.schema.d.ts.map +1 -0
- package/dist/schema/auth.schema.js +161 -0
- package/dist/schema/auth.schema.js.map +1 -0
- package/dist/schema/cycle.schema.d.ts +33 -0
- package/dist/schema/cycle.schema.d.ts.map +1 -0
- package/dist/schema/cycle.schema.js +23 -0
- package/dist/schema/cycle.schema.js.map +1 -0
- package/dist/schema/desktop-https.schema.d.ts +146 -0
- package/dist/schema/desktop-https.schema.d.ts.map +1 -0
- package/dist/schema/desktop-https.schema.js +31 -0
- package/dist/schema/desktop-https.schema.js.map +1 -0
- package/dist/schema/ft8.schema.d.ts +1107 -0
- package/dist/schema/ft8.schema.d.ts.map +1 -0
- package/dist/schema/ft8.schema.js +268 -0
- package/dist/schema/ft8.schema.js.map +1 -0
- package/dist/schema/hello.schema.d.ts +10 -0
- package/dist/schema/hello.schema.d.ts.map +1 -0
- package/dist/schema/hello.schema.js +5 -0
- package/dist/schema/hello.schema.js.map +1 -0
- package/dist/schema/logbook.schema.d.ts +1472 -0
- package/dist/schema/logbook.schema.d.ts.map +1 -0
- package/dist/schema/logbook.schema.js +256 -0
- package/dist/schema/logbook.schema.js.map +1 -0
- package/dist/schema/mode.schema.d.ts +130 -0
- package/dist/schema/mode.schema.d.ts.map +1 -0
- package/dist/schema/mode.schema.js +141 -0
- package/dist/schema/mode.schema.js.map +1 -0
- package/dist/schema/openwebrx.schema.d.ts +352 -0
- package/dist/schema/openwebrx.schema.d.ts.map +1 -0
- package/dist/schema/openwebrx.schema.js +139 -0
- package/dist/schema/openwebrx.schema.js.map +1 -0
- package/dist/schema/operator.schema.d.ts +883 -0
- package/dist/schema/operator.schema.d.ts.map +1 -0
- package/dist/schema/operator.schema.js +97 -0
- package/dist/schema/operator.schema.js.map +1 -0
- package/dist/schema/plugin.schema.d.ts +1579 -0
- package/dist/schema/plugin.schema.d.ts.map +1 -0
- package/dist/schema/plugin.schema.js +336 -0
- package/dist/schema/plugin.schema.js.map +1 -0
- package/dist/schema/process-monitor.schema.d.ts +282 -0
- package/dist/schema/process-monitor.schema.d.ts.map +1 -0
- package/dist/schema/process-monitor.schema.js +31 -0
- package/dist/schema/process-monitor.schema.js.map +1 -0
- package/dist/schema/pskreporter.schema.d.ts +185 -0
- package/dist/schema/pskreporter.schema.d.ts.map +1 -0
- package/dist/schema/pskreporter.schema.js +80 -0
- package/dist/schema/pskreporter.schema.js.map +1 -0
- package/dist/schema/qso.schema.d.ts +419 -0
- package/dist/schema/qso.schema.d.ts.map +1 -0
- package/dist/schema/qso.schema.js +137 -0
- package/dist/schema/qso.schema.js.map +1 -0
- package/dist/schema/radio-capability.schema.d.ts +625 -0
- package/dist/schema/radio-capability.schema.d.ts.map +1 -0
- package/dist/schema/radio-capability.schema.js +191 -0
- package/dist/schema/radio-capability.schema.js.map +1 -0
- package/dist/schema/radio-power-support.d.ts +45 -0
- package/dist/schema/radio-power-support.d.ts.map +1 -0
- package/dist/schema/radio-power-support.js +64 -0
- package/dist/schema/radio-power-support.js.map +1 -0
- package/dist/schema/radio-power.schema.d.ts +319 -0
- package/dist/schema/radio-power.schema.d.ts.map +1 -0
- package/dist/schema/radio-power.schema.js +87 -0
- package/dist/schema/radio-power.schema.js.map +1 -0
- package/dist/schema/radio-profile.schema.d.ts +2694 -0
- package/dist/schema/radio-profile.schema.d.ts.map +1 -0
- package/dist/schema/radio-profile.schema.js +71 -0
- package/dist/schema/radio-profile.schema.js.map +1 -0
- package/dist/schema/radio.schema.d.ts +1438 -0
- package/dist/schema/radio.schema.d.ts.map +1 -0
- package/dist/schema/radio.schema.js +314 -0
- package/dist/schema/radio.schema.js.map +1 -0
- package/dist/schema/realtime.schema.d.ts +1299 -0
- package/dist/schema/realtime.schema.d.ts.map +1 -0
- package/dist/schema/realtime.schema.js +184 -0
- package/dist/schema/realtime.schema.js.map +1 -0
- package/dist/schema/rigctld.schema.d.ts +151 -0
- package/dist/schema/rigctld.schema.d.ts.map +1 -0
- package/dist/schema/rigctld.schema.js +42 -0
- package/dist/schema/rigctld.schema.js.map +1 -0
- package/dist/schema/server-message-keys.d.ts +21 -0
- package/dist/schema/server-message-keys.d.ts.map +1 -0
- package/dist/schema/server-message-keys.js +22 -0
- package/dist/schema/server-message-keys.js.map +1 -0
- package/dist/schema/slot-info.schema.d.ts +696 -0
- package/dist/schema/slot-info.schema.d.ts.map +1 -0
- package/dist/schema/slot-info.schema.js +144 -0
- package/dist/schema/slot-info.schema.js.map +1 -0
- package/dist/schema/spectrum.schema.d.ts +716 -0
- package/dist/schema/spectrum.schema.d.ts.map +1 -0
- package/dist/schema/spectrum.schema.js +128 -0
- package/dist/schema/spectrum.schema.js.map +1 -0
- package/dist/schema/station-info.schema.d.ts +202 -0
- package/dist/schema/station-info.schema.d.ts.map +1 -0
- package/dist/schema/station-info.schema.js +32 -0
- package/dist/schema/station-info.schema.js.map +1 -0
- package/dist/schema/system.schema.d.ts +113 -0
- package/dist/schema/system.schema.d.ts.map +1 -0
- package/dist/schema/system.schema.js +95 -0
- package/dist/schema/system.schema.js.map +1 -0
- package/dist/schema/transmission.schema.d.ts +413 -0
- package/dist/schema/transmission.schema.d.ts.map +1 -0
- package/dist/schema/transmission.schema.js +78 -0
- package/dist/schema/transmission.schema.js.map +1 -0
- package/dist/schema/voice.schema.d.ts +38 -0
- package/dist/schema/voice.schema.d.ts.map +1 -0
- package/dist/schema/voice.schema.js +24 -0
- package/dist/schema/voice.schema.js.map +1 -0
- package/dist/schema/websocket.schema.d.ts +16916 -0
- package/dist/schema/websocket.schema.d.ts.map +1 -0
- package/dist/schema/websocket.schema.js +1050 -0
- package/dist/schema/websocket.schema.js.map +1 -0
- package/dist/utils/grid.d.ts +13 -0
- package/dist/utils/grid.d.ts.map +1 -0
- package/dist/utils/grid.js +71 -0
- package/dist/utils/grid.js.map +1 -0
- package/eslint.config.js +15 -0
- package/package.json +28 -0
- package/src/index.ts +152 -0
- package/src/schema/__tests__/plugin-runtime-log.schema.test.ts +90 -0
- package/src/schema/ability.ts +205 -0
- package/src/schema/api-response.schema.ts +187 -0
- package/src/schema/audio-sidecar.schema.ts +53 -0
- package/src/schema/audio.schema.ts +73 -0
- package/src/schema/auth.schema.ts +224 -0
- package/src/schema/cycle.schema.ts +25 -0
- package/src/schema/desktop-https.schema.ts +43 -0
- package/src/schema/ft8.schema.ts +362 -0
- package/src/schema/hello.schema.ts +7 -0
- package/src/schema/logbook.schema.ts +310 -0
- package/src/schema/mode.schema.ts +158 -0
- package/src/schema/openwebrx.schema.ts +160 -0
- package/src/schema/operator.schema.ts +112 -0
- package/src/schema/plugin.schema.ts +503 -0
- package/src/schema/process-monitor.schema.ts +41 -0
- package/src/schema/pskreporter.schema.ts +102 -0
- package/src/schema/qso.schema.ts +173 -0
- package/src/schema/radio-capability.schema.ts +244 -0
- package/src/schema/radio-power-support.ts +107 -0
- package/src/schema/radio-power.schema.ts +101 -0
- package/src/schema/radio-profile.schema.ts +91 -0
- package/src/schema/radio.schema.ts +385 -0
- package/src/schema/realtime.schema.ts +262 -0
- package/src/schema/rigctld.schema.ts +51 -0
- package/src/schema/server-message-keys.ts +26 -0
- package/src/schema/slot-info.schema.ts +162 -0
- package/src/schema/spectrum.schema.ts +166 -0
- package/src/schema/station-info.schema.ts +40 -0
- package/src/schema/system.schema.ts +121 -0
- package/src/schema/transmission.schema.ts +105 -0
- package/src/schema/voice.schema.ts +28 -0
- package/src/schema/websocket.schema.ts +1480 -0
- package/src/utils/grid.ts +94 -0
- package/test/mode-schema.test.ts +48 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HamlibConfigSchema } from './radio.schema.js';
|
|
3
|
+
/**
|
|
4
|
+
* High-level runtime state tracked by the RadioPowerController.
|
|
5
|
+
*
|
|
6
|
+
* - `off`: radio is known to be off (or was never connected).
|
|
7
|
+
* - `waking`: power-on command sent, waiting for the radio to respond.
|
|
8
|
+
* - `awake`: radio is responding; the engine is being started (if autoEngine).
|
|
9
|
+
* - `shutting_down`: engine is stopping in preparation for a power-off command.
|
|
10
|
+
* - `entering_standby`: powerstat(2) sent, waiting for radio to drop CAT link.
|
|
11
|
+
* - `failed`: last transition failed; UI should show an error + retry.
|
|
12
|
+
*/
|
|
13
|
+
export const RadioPowerStateSchema = z.enum([
|
|
14
|
+
'off',
|
|
15
|
+
'waking',
|
|
16
|
+
'awake',
|
|
17
|
+
'shutting_down',
|
|
18
|
+
'entering_standby',
|
|
19
|
+
'failed',
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* Finer-grained progress stage inside `waking` / `shutting_down`.
|
|
23
|
+
* UI uses this to show progress bar labels.
|
|
24
|
+
*/
|
|
25
|
+
export const RadioPowerStageSchema = z.enum([
|
|
26
|
+
'idle',
|
|
27
|
+
'sending_command',
|
|
28
|
+
'waiting_ready',
|
|
29
|
+
'waiting_standby_disconnect',
|
|
30
|
+
'starting_engine',
|
|
31
|
+
'stopping_engine',
|
|
32
|
+
'disconnecting',
|
|
33
|
+
]);
|
|
34
|
+
/**
|
|
35
|
+
* WS event payload: server → client.
|
|
36
|
+
*/
|
|
37
|
+
export const RadioPowerStateEventSchema = z.object({
|
|
38
|
+
profileId: z.string().optional(),
|
|
39
|
+
state: RadioPowerStateSchema,
|
|
40
|
+
stage: RadioPowerStageSchema,
|
|
41
|
+
/** Translation key reference for an inline error, e.g. 'radio:power.error.timeout'. */
|
|
42
|
+
errorKey: z.string().optional(),
|
|
43
|
+
/** Free-form details for debugging; not user-facing. */
|
|
44
|
+
errorDetail: z.string().optional(),
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* REST request body: POST /api/radio/power
|
|
48
|
+
*/
|
|
49
|
+
/** Allowed target states for a power request. */
|
|
50
|
+
export const RadioPowerTargetSchema = z.enum(['on', 'off', 'standby', 'operate']);
|
|
51
|
+
export const RadioPowerRequestSchema = z.object({
|
|
52
|
+
profileId: z.string().min(1),
|
|
53
|
+
state: RadioPowerTargetSchema,
|
|
54
|
+
/** Automatically start the engine after successful power-on. Defaults to true. */
|
|
55
|
+
autoEngine: z.boolean().optional().default(true),
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* REST response: POST /api/radio/power
|
|
59
|
+
*/
|
|
60
|
+
export const RadioPowerResponseSchema = z.object({
|
|
61
|
+
success: z.boolean(),
|
|
62
|
+
state: RadioPowerStateSchema,
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* REST response: GET /api/radio/power/support?profileId=xxx
|
|
66
|
+
* The server resolves mfgName/modelName internally via HamLib.getSupportedRigs().
|
|
67
|
+
*/
|
|
68
|
+
export const RadioPowerSupportInfoSchema = z.object({
|
|
69
|
+
profileId: z.string(),
|
|
70
|
+
canPowerOn: z.boolean(),
|
|
71
|
+
canPowerOff: z.boolean(),
|
|
72
|
+
/**
|
|
73
|
+
* States the user is allowed to switch *between* while the radio is connected.
|
|
74
|
+
* Empty when the radio is unsupported or not connected (UI then renders no dropdown).
|
|
75
|
+
*/
|
|
76
|
+
supportedStates: z.array(z.enum(['operate', 'standby', 'off'])).default([]),
|
|
77
|
+
reason: z.enum(['model-unsupported', 'network-mode-no-wake', 'none-mode']).optional(),
|
|
78
|
+
rigInfo: z
|
|
79
|
+
.object({
|
|
80
|
+
mfgName: z.string(),
|
|
81
|
+
modelName: z.string(),
|
|
82
|
+
})
|
|
83
|
+
.optional(),
|
|
84
|
+
});
|
|
85
|
+
/** Convenience re-export so callers can validate a full config blob. */
|
|
86
|
+
export const RadioPowerProfileConfigSchema = HamlibConfigSchema;
|
|
87
|
+
//# sourceMappingURL=radio-power.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-power.schema.js","sourceRoot":"","sources":["../../src/schema/radio-power.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1C,KAAK;IACL,QAAQ;IACR,OAAO;IACP,eAAe;IACf,kBAAkB;IAClB,QAAQ;CACT,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1C,MAAM;IACN,iBAAiB;IACjB,eAAe;IACf,4BAA4B;IAC5B,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;CAChB,CAAC,CAAC;AAGH;;G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