@jdg-keyforge/protocol 0.6.0 → 0.8.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/dist/common.d.ts CHANGED
@@ -61,12 +61,62 @@ export interface Action {
61
61
  */
62
62
  type: string;
63
63
  /**
64
- * Action-specific parameters. Schema depends on 'type'.
64
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
65
65
  */
66
66
  params?: {
67
67
  [k: string]: unknown;
68
68
  };
69
69
  }
70
+ /**
71
+ * Params for the built-in 'send_keys' action: types a key combination.
72
+ *
73
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
74
+ * via the `definition` "SendKeysActionParams".
75
+ */
76
+ export interface SendKeysActionParams {
77
+ /**
78
+ * Key combination to send, e.g. 'Ctrl+Shift+S'.
79
+ */
80
+ keys: string;
81
+ }
82
+ /**
83
+ * Params for the built-in 'launch_app' action: launches an application.
84
+ *
85
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
86
+ * via the `definition` "LaunchAppActionParams".
87
+ */
88
+ export interface LaunchAppActionParams {
89
+ /**
90
+ * Absolute path to the application or executable to launch.
91
+ */
92
+ path: string;
93
+ }
94
+ /**
95
+ * Params for the built-in 'delay' action: waits for the given duration. Mainly useful as a step inside a macro.
96
+ *
97
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
98
+ * via the `definition` "DelayActionParams".
99
+ */
100
+ export interface DelayActionParams {
101
+ /**
102
+ * Milliseconds to wait before continuing.
103
+ */
104
+ ms: number;
105
+ }
106
+ /**
107
+ * Params for the built-in 'macro' action: runs a sequence of actions in order. The schema allows any Action as a step; the daemon rejects nested macros (a step whose type is 'macro').
108
+ *
109
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
110
+ * via the `definition` "MacroActionParams".
111
+ */
112
+ export interface MacroActionParams {
113
+ /**
114
+ * Actions to run in order. Must contain at least one step.
115
+ *
116
+ * @minItems 1
117
+ */
118
+ steps: [Action, ...Action[]];
119
+ }
70
120
  /**
71
121
  * Maps an input on a specific device to an action.
72
122
  *
@@ -99,6 +149,30 @@ export interface Profile {
99
149
  */
100
150
  bindings: Binding[];
101
151
  }
152
+ /**
153
+ * Portable, on-disk representation of a profile, written by export_profile and read by import_profile. Carries no server-local id: the id is meaningless outside the originating installation, so import always assigns a fresh one. The 'version' field lets readers detect and adapt to format changes.
154
+ *
155
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
156
+ * via the `definition` "ExportedProfile".
157
+ */
158
+ export interface ExportedProfile {
159
+ /**
160
+ * Magic marker identifying the file as a KeyForge profile export.
161
+ */
162
+ format: "keyforge.profile";
163
+ /**
164
+ * Export format version. Currently 1; bumped if the on-disk shape changes.
165
+ */
166
+ version: 1;
167
+ /**
168
+ * Human-friendly profile name.
169
+ */
170
+ name: string;
171
+ /**
172
+ * Bindings that belong to the exported profile.
173
+ */
174
+ bindings: Binding[];
175
+ }
102
176
  /**
103
177
  * A single physical input exposed by a device (a key or an encoder).
104
178
  *
package/dist/index.d.ts CHANGED
@@ -3,8 +3,10 @@ export * from './envelope.js';
3
3
  export type { MethodCreateProfile } from './methods/create_profile.js';
4
4
  export type { MethodDeleteProfile } from './methods/delete_profile.js';
5
5
  export type { MethodDuplicateProfile } from './methods/duplicate_profile.js';
6
+ export type { MethodExportProfile } from './methods/export_profile.js';
6
7
  export type { MethodGetAutoSwitch } from './methods/get_auto_switch.js';
7
8
  export type { MethodHello } from './methods/hello.js';
9
+ export type { MethodImportProfile } from './methods/import_profile.js';
8
10
  export type { MethodListActions } from './methods/list_actions.js';
9
11
  export type { MethodListBindings } from './methods/list_bindings.js';
10
12
  export type { MethodListDevices } from './methods/list_devices.js';
@@ -60,7 +60,7 @@ export interface Action {
60
60
  */
61
61
  type: string;
62
62
  /**
63
- * Action-specific parameters. Schema depends on 'type'.
63
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
64
64
  */
65
65
  params?: {
66
66
  [k: string]: unknown;
@@ -64,7 +64,7 @@ export interface Action {
64
64
  */
65
65
  type: string;
66
66
  /**
67
- * Action-specific parameters. Schema depends on 'type'.
67
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
68
68
  */
69
69
  params?: {
70
70
  [k: string]: unknown;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file was automatically generated by json-schema-to-typescript.
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
+ * and run json-schema-to-typescript to regenerate this file.
5
+ */
6
+ /**
7
+ * Serializes the profile identified by 'id' as a portable ExportedProfile document and writes it to 'path' on the daemon host's filesystem. The exported file omits the server-local id. Returns the path that was written.
8
+ */
9
+ export interface MethodExportProfile {
10
+ params: {
11
+ /**
12
+ * Identifier of the profile to export.
13
+ */
14
+ id: string;
15
+ /**
16
+ * Filesystem path on the daemon host where the exported file is written.
17
+ */
18
+ path: string;
19
+ };
20
+ result: {
21
+ /**
22
+ * Echo of the path that was written.
23
+ */
24
+ path: string;
25
+ };
26
+ }
@@ -0,0 +1,7 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+ export {};
@@ -0,0 +1,68 @@
1
+ /**
2
+ * This file was automatically generated by json-schema-to-typescript.
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
+ * and run json-schema-to-typescript to regenerate this file.
5
+ */
6
+ /**
7
+ * Stable identifier for a HID device. Format: VID_<hex>_PID_<hex>[_<serial>].
8
+ */
9
+ export type DeviceID = string;
10
+ /**
11
+ * What happened on the input.
12
+ */
13
+ export type InputAction = "press" | "release" | "rotate_cw" | "rotate_ccw" | "click";
14
+ /**
15
+ * Reads an ExportedProfile document from 'path' on the daemon host's filesystem, validates it, and creates a new profile from it. The server generates a fresh id; any id in the file is ignored. Does not change the active profile. Returns the created profile.
16
+ */
17
+ export interface MethodImportProfile {
18
+ params: {
19
+ /**
20
+ * Filesystem path on the daemon host of the exported file to import.
21
+ */
22
+ path: string;
23
+ };
24
+ result: {
25
+ profile: Profile;
26
+ };
27
+ }
28
+ /**
29
+ * A named set of bindings. The daemon keeps exactly one profile active at a time; switching profiles swaps the active binding set.
30
+ */
31
+ export interface Profile {
32
+ /**
33
+ * Stable server-generated identifier for the profile.
34
+ */
35
+ id: string;
36
+ /**
37
+ * Human-friendly profile name.
38
+ */
39
+ name: string;
40
+ /**
41
+ * Bindings that belong to this profile.
42
+ */
43
+ bindings: Binding[];
44
+ }
45
+ /**
46
+ * Maps an input on a specific device to an action.
47
+ */
48
+ export interface Binding {
49
+ device_id: DeviceID;
50
+ input_id: string;
51
+ trigger: InputAction;
52
+ action: Action;
53
+ }
54
+ /**
55
+ * An executable action bound to an input.
56
+ */
57
+ export interface Action {
58
+ /**
59
+ * Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
60
+ */
61
+ type: string;
62
+ /**
63
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
64
+ */
65
+ params?: {
66
+ [k: string]: unknown;
67
+ };
68
+ }
@@ -0,0 +1,7 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+ export {};
@@ -44,7 +44,7 @@ export interface Action {
44
44
  */
45
45
  type: string;
46
46
  /**
47
- * Action-specific parameters. Schema depends on 'type'.
47
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
48
48
  */
49
49
  params?: {
50
50
  [k: string]: unknown;
@@ -65,7 +65,7 @@ export interface Action {
65
65
  */
66
66
  type: string;
67
67
  /**
68
- * Action-specific parameters. Schema depends on 'type'.
68
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
69
69
  */
70
70
  params?: {
71
71
  [k: string]: unknown;
@@ -41,7 +41,7 @@ export interface Action {
41
41
  */
42
42
  type: string;
43
43
  /**
44
- * Action-specific parameters. Schema depends on 'type'.
44
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
45
45
  */
46
46
  params?: {
47
47
  [k: string]: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jdg-keyforge/protocol",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "TypeScript types for the KeyForge WebSocket protocol, generated from the canonical JSON Schema contracts.",
5
5
  "keywords": ["keyforge", "protocol", "types", "json-schema", "websocket"],
6
6
  "license": "Apache-2.0",
package/src/common.ts CHANGED
@@ -64,12 +64,62 @@ export interface Action {
64
64
  */
65
65
  type: string;
66
66
  /**
67
- * Action-specific parameters. Schema depends on 'type'.
67
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
68
68
  */
69
69
  params?: {
70
70
  [k: string]: unknown;
71
71
  };
72
72
  }
73
+ /**
74
+ * Params for the built-in 'send_keys' action: types a key combination.
75
+ *
76
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
77
+ * via the `definition` "SendKeysActionParams".
78
+ */
79
+ export interface SendKeysActionParams {
80
+ /**
81
+ * Key combination to send, e.g. 'Ctrl+Shift+S'.
82
+ */
83
+ keys: string;
84
+ }
85
+ /**
86
+ * Params for the built-in 'launch_app' action: launches an application.
87
+ *
88
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
89
+ * via the `definition` "LaunchAppActionParams".
90
+ */
91
+ export interface LaunchAppActionParams {
92
+ /**
93
+ * Absolute path to the application or executable to launch.
94
+ */
95
+ path: string;
96
+ }
97
+ /**
98
+ * Params for the built-in 'delay' action: waits for the given duration. Mainly useful as a step inside a macro.
99
+ *
100
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
101
+ * via the `definition` "DelayActionParams".
102
+ */
103
+ export interface DelayActionParams {
104
+ /**
105
+ * Milliseconds to wait before continuing.
106
+ */
107
+ ms: number;
108
+ }
109
+ /**
110
+ * Params for the built-in 'macro' action: runs a sequence of actions in order. The schema allows any Action as a step; the daemon rejects nested macros (a step whose type is 'macro').
111
+ *
112
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
113
+ * via the `definition` "MacroActionParams".
114
+ */
115
+ export interface MacroActionParams {
116
+ /**
117
+ * Actions to run in order. Must contain at least one step.
118
+ *
119
+ * @minItems 1
120
+ */
121
+ steps: [Action, ...Action[]];
122
+ }
73
123
  /**
74
124
  * Maps an input on a specific device to an action.
75
125
  *
@@ -102,6 +152,30 @@ export interface Profile {
102
152
  */
103
153
  bindings: Binding[];
104
154
  }
155
+ /**
156
+ * Portable, on-disk representation of a profile, written by export_profile and read by import_profile. Carries no server-local id: the id is meaningless outside the originating installation, so import always assigns a fresh one. The 'version' field lets readers detect and adapt to format changes.
157
+ *
158
+ * This interface was referenced by `CommonTypes`'s JSON-Schema
159
+ * via the `definition` "ExportedProfile".
160
+ */
161
+ export interface ExportedProfile {
162
+ /**
163
+ * Magic marker identifying the file as a KeyForge profile export.
164
+ */
165
+ format: "keyforge.profile";
166
+ /**
167
+ * Export format version. Currently 1; bumped if the on-disk shape changes.
168
+ */
169
+ version: 1;
170
+ /**
171
+ * Human-friendly profile name.
172
+ */
173
+ name: string;
174
+ /**
175
+ * Bindings that belong to the exported profile.
176
+ */
177
+ bindings: Binding[];
178
+ }
105
179
  /**
106
180
  * A single physical input exposed by a device (a key or an encoder).
107
181
  *
package/src/index.ts CHANGED
@@ -6,8 +6,10 @@ export * from './envelope.js';
6
6
  export type { MethodCreateProfile } from './methods/create_profile.js';
7
7
  export type { MethodDeleteProfile } from './methods/delete_profile.js';
8
8
  export type { MethodDuplicateProfile } from './methods/duplicate_profile.js';
9
+ export type { MethodExportProfile } from './methods/export_profile.js';
9
10
  export type { MethodGetAutoSwitch } from './methods/get_auto_switch.js';
10
11
  export type { MethodHello } from './methods/hello.js';
12
+ export type { MethodImportProfile } from './methods/import_profile.js';
11
13
  export type { MethodListActions } from './methods/list_actions.js';
12
14
  export type { MethodListBindings } from './methods/list_bindings.js';
13
15
  export type { MethodListDevices } from './methods/list_devices.js';
@@ -63,7 +63,7 @@ export interface Action {
63
63
  */
64
64
  type: string;
65
65
  /**
66
- * Action-specific parameters. Schema depends on 'type'.
66
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
67
67
  */
68
68
  params?: {
69
69
  [k: string]: unknown;
@@ -67,7 +67,7 @@ export interface Action {
67
67
  */
68
68
  type: string;
69
69
  /**
70
- * Action-specific parameters. Schema depends on 'type'.
70
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
71
71
  */
72
72
  params?: {
73
73
  [k: string]: unknown;
@@ -0,0 +1,28 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ /**
9
+ * Serializes the profile identified by 'id' as a portable ExportedProfile document and writes it to 'path' on the daemon host's filesystem. The exported file omits the server-local id. Returns the path that was written.
10
+ */
11
+ export interface MethodExportProfile {
12
+ params: {
13
+ /**
14
+ * Identifier of the profile to export.
15
+ */
16
+ id: string;
17
+ /**
18
+ * Filesystem path on the daemon host where the exported file is written.
19
+ */
20
+ path: string;
21
+ };
22
+ result: {
23
+ /**
24
+ * Echo of the path that was written.
25
+ */
26
+ path: string;
27
+ };
28
+ }
@@ -0,0 +1,71 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ /**
9
+ * Stable identifier for a HID device. Format: VID_<hex>_PID_<hex>[_<serial>].
10
+ */
11
+ export type DeviceID = string;
12
+ /**
13
+ * What happened on the input.
14
+ */
15
+ export type InputAction = "press" | "release" | "rotate_cw" | "rotate_ccw" | "click";
16
+
17
+ /**
18
+ * Reads an ExportedProfile document from 'path' on the daemon host's filesystem, validates it, and creates a new profile from it. The server generates a fresh id; any id in the file is ignored. Does not change the active profile. Returns the created profile.
19
+ */
20
+ export interface MethodImportProfile {
21
+ params: {
22
+ /**
23
+ * Filesystem path on the daemon host of the exported file to import.
24
+ */
25
+ path: string;
26
+ };
27
+ result: {
28
+ profile: Profile;
29
+ };
30
+ }
31
+ /**
32
+ * A named set of bindings. The daemon keeps exactly one profile active at a time; switching profiles swaps the active binding set.
33
+ */
34
+ export interface Profile {
35
+ /**
36
+ * Stable server-generated identifier for the profile.
37
+ */
38
+ id: string;
39
+ /**
40
+ * Human-friendly profile name.
41
+ */
42
+ name: string;
43
+ /**
44
+ * Bindings that belong to this profile.
45
+ */
46
+ bindings: Binding[];
47
+ }
48
+ /**
49
+ * Maps an input on a specific device to an action.
50
+ */
51
+ export interface Binding {
52
+ device_id: DeviceID;
53
+ input_id: string;
54
+ trigger: InputAction;
55
+ action: Action;
56
+ }
57
+ /**
58
+ * An executable action bound to an input.
59
+ */
60
+ export interface Action {
61
+ /**
62
+ * Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
63
+ */
64
+ type: string;
65
+ /**
66
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
67
+ */
68
+ params?: {
69
+ [k: string]: unknown;
70
+ };
71
+ }
@@ -47,7 +47,7 @@ export interface Action {
47
47
  */
48
48
  type: string;
49
49
  /**
50
- * Action-specific parameters. Schema depends on 'type'.
50
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
51
51
  */
52
52
  params?: {
53
53
  [k: string]: unknown;
@@ -68,7 +68,7 @@ export interface Action {
68
68
  */
69
69
  type: string;
70
70
  /**
71
- * Action-specific parameters. Schema depends on 'type'.
71
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
72
72
  */
73
73
  params?: {
74
74
  [k: string]: unknown;
@@ -44,7 +44,7 @@ export interface Action {
44
44
  */
45
45
  type: string;
46
46
  /**
47
- * Action-specific parameters. Schema depends on 'type'.
47
+ * Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
48
48
  */
49
49
  params?: {
50
50
  [k: string]: unknown;