@jdg-keyforge/protocol 0.7.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 +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/methods/export_profile.d.ts +26 -0
- package/dist/methods/export_profile.js +7 -0
- package/dist/methods/import_profile.d.ts +68 -0
- package/dist/methods/import_profile.js +7 -0
- package/package.json +1 -1
- package/src/common.ts +24 -0
- package/src/index.ts +2 -0
- package/src/methods/export_profile.ts +28 -0
- package/src/methods/import_profile.ts +71 -0
package/dist/common.d.ts
CHANGED
|
@@ -149,6 +149,30 @@ export interface Profile {
|
|
|
149
149
|
*/
|
|
150
150
|
bindings: Binding[];
|
|
151
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
|
+
}
|
|
152
176
|
/**
|
|
153
177
|
* A single physical input exposed by a device (a key or an encoder).
|
|
154
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';
|
|
@@ -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,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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jdg-keyforge/protocol",
|
|
3
|
-
"version": "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
|
@@ -152,6 +152,30 @@ export interface Profile {
|
|
|
152
152
|
*/
|
|
153
153
|
bindings: Binding[];
|
|
154
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
|
+
}
|
|
155
179
|
/**
|
|
156
180
|
* A single physical input exposed by a device (a key or an encoder).
|
|
157
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';
|
|
@@ -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
|
+
}
|