@dronedeploy/rocos-js-sdk 4.3.1 → 4.4.2

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.
@@ -0,0 +1,20 @@
1
+ /** One stored item in a config group, scoped by whatever the group's `type` represents (e.g. one gamepad, one command). */
2
+ export interface ConfigGroupItem<T> {
3
+ id: string;
4
+ value: T;
5
+ /** Robot-scoped response only: whether this robot's config overrides its robot definition's. */
6
+ _isOverridden?: boolean;
7
+ /** Robot-scoped response only: the robot definition's item this one overrides, when it does. */
8
+ _globalItem?: ConfigGroupItem<T>;
9
+ }
10
+ /** Response shape shared by RobotService/ProfileService config-group endpoints (gamepads, commands-v2, ...). */
11
+ export interface ConfigGroupResponse<T> {
12
+ version?: string;
13
+ type: string;
14
+ items: Array<ConfigGroupItem<T>>;
15
+ /** Robot-scoped response only. */
16
+ robotDefinitionId?: string;
17
+ username?: string;
18
+ createdAt?: string;
19
+ updatedAt?: string;
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ import { ConfigGroupItem, ConfigGroupResponse } from '../ConfigGroupResponse';
2
+ /** Declares one named parameter a command accepts. `default` is always a string, whatever `type` names. */
3
+ export interface CommandV2ParameterDeclaration {
4
+ type: string;
5
+ default: string;
6
+ }
7
+ export interface CommandV2Settings {
8
+ target: string;
9
+ /** Stored as a number on newer configs, a numeric string on older ones. Absent on some legacy configs. */
10
+ timeoutMs?: number | string;
11
+ requiresClockSync: boolean;
12
+ payloadTemplate: string;
13
+ /** Should be an object, but a known editor round-trip bug can persist it as a raw JSON string. */
14
+ payloadMeta?: Record<string, unknown> | string | null;
15
+ }
16
+ export interface CommandV2 {
17
+ schemaVersion: number;
18
+ id: string;
19
+ name: string;
20
+ type: string;
21
+ /** Absent for commands declaring no parameters, not an empty object. */
22
+ parameters?: Record<string, CommandV2ParameterDeclaration>;
23
+ settings: CommandV2Settings;
24
+ }
25
+ /** One stored command, scoped to a specific command id (CommandV2.id). */
26
+ export type CommandV2Item = ConfigGroupItem<CommandV2>;
27
+ /** Response shape of RobotService/ProfileService getCommandsV2 — one item per declared command. */
28
+ export type CommandV2Response = ConfigGroupResponse<CommandV2>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  export * from '../ResponseLevelEnum';
2
+ export * from './CommandV2';
2
3
  export * from './IRocosCommandMessageHeartbeat';
3
4
  export * from './IRocosCommandMessageResponse';
4
5
  export * from './RocosCommandResultStatus';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("../ResponseLevelEnum"), exports);
18
+ __exportStar(require("./CommandV2"), exports);
18
19
  __exportStar(require("./IRocosCommandMessageHeartbeat"), exports);
19
20
  __exportStar(require("./IRocosCommandMessageResponse"), exports);
20
21
  __exportStar(require("./RocosCommandResultStatus"), exports);
@@ -0,0 +1,87 @@
1
+ import { ConfigGroupItem, ConfigGroupResponse } from '../ConfigGroupResponse';
2
+ export declare enum GamepadButtonType {
3
+ UNKNOWN = 0,
4
+ UP = 1,
5
+ DOWN = 2,
6
+ LEFT = 3,
7
+ RIGHT = 4,
8
+ LEFT_STICK_X = 5,
9
+ LEFT_STICK_Y = 6,
10
+ LEFT_STICK_BUTTON = 7,// Stick pressed
11
+ RIGHT_STICK_X = 8,
12
+ RIGHT_STICK_Y = 9,
13
+ RIGHT_STICK_BUTTON = 10,// Stick pressed
14
+ LEFT_BUMPER = 11,
15
+ RIGHT_BUMPER = 12,
16
+ LEFT_TRIGGER = 13,
17
+ RIGHT_TRIGGER = 14,
18
+ A = 15,// Xbox
19
+ B = 16,// Xbox
20
+ X = 17,// Xbox
21
+ Y = 18,// Xbox
22
+ BACK = 19,// Xbox
23
+ START = 20,// Xbox
24
+ GUIDE = 21,// Xbox
25
+ SHARE = 22,// PS4
26
+ OPTIONS = 23,// PS4
27
+ PS = 24,// PS4
28
+ CIRCLE = 25,// PS4
29
+ SQUARE = 26,// PS4
30
+ TRIANGLE = 27
31
+ }
32
+ /** Per-axis tuning keyed by GamepadButtonType. Absent entirely on configs saved before axis tuning existed. */
33
+ export type GamepadAxisValueMap = Partial<Record<GamepadButtonType, number>>;
34
+ export declare enum GamepadTriggerType {
35
+ ONCE = "once",
36
+ CONTINUOUSLY = "continuously"
37
+ }
38
+ export declare enum GamepadCommandVersion {
39
+ COMMANDS = "commands",
40
+ CONTROLS = "controls",
41
+ COMMANDS_V2 = "commands-v2",
42
+ RUN_JS = "run-js"
43
+ }
44
+ export interface GamepadButtonRef {
45
+ type: GamepadButtonType;
46
+ text: string;
47
+ }
48
+ export interface GamepadAction {
49
+ name: string;
50
+ source: GamepadButtonRef;
51
+ commandId: string;
52
+ /** Absent on configs saved before Commands V2 existed. */
53
+ commandVersion?: GamepadCommandVersion;
54
+ triggerType: GamepadTriggerType;
55
+ /** Milliseconds between repeats. Only meaningful for `continuously`. */
56
+ frequency: number;
57
+ }
58
+ export interface GamepadVariable {
59
+ name: string;
60
+ source: GamepadButtonRef;
61
+ /** Expression evaluated against the button value, with `$value` and `$msg` in scope. */
62
+ value: string;
63
+ /** Stored as a string by the console editor, and used when the source button is absent. */
64
+ defaultValue?: string;
65
+ }
66
+ export interface GamepadHardwareMapping {
67
+ buttons: GamepadButtonRef[];
68
+ axes: GamepadButtonRef[];
69
+ }
70
+ /** Identifies the physical controller model this config applies to, matched against the browser's Gamepad.id. */
71
+ export interface GamepadHardware {
72
+ id: string;
73
+ type: string;
74
+ name: string;
75
+ mapping: GamepadHardwareMapping;
76
+ }
77
+ export interface GamepadConfig {
78
+ gamepad: GamepadHardware;
79
+ actions: GamepadAction[];
80
+ variables: GamepadVariable[];
81
+ axisDeadzones?: GamepadAxisValueMap;
82
+ axisExpos?: GamepadAxisValueMap;
83
+ }
84
+ /** One stored gamepad config, scoped to a specific physical controller model (GamepadConfig.gamepad). */
85
+ export type GamepadConfigItem = ConfigGroupItem<GamepadConfig>;
86
+ /** Response shape of RobotService/ProfileService getGamepads — one item per registered controller model. */
87
+ export type GamepadConfigResponse = ConfigGroupResponse<GamepadConfig>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GamepadCommandVersion = exports.GamepadTriggerType = exports.GamepadButtonType = void 0;
4
+ // Ref: https://github.com/alaingilbert/GamepadJs
5
+ var GamepadButtonType;
6
+ (function (GamepadButtonType) {
7
+ GamepadButtonType[GamepadButtonType["UNKNOWN"] = 0] = "UNKNOWN";
8
+ GamepadButtonType[GamepadButtonType["UP"] = 1] = "UP";
9
+ GamepadButtonType[GamepadButtonType["DOWN"] = 2] = "DOWN";
10
+ GamepadButtonType[GamepadButtonType["LEFT"] = 3] = "LEFT";
11
+ GamepadButtonType[GamepadButtonType["RIGHT"] = 4] = "RIGHT";
12
+ GamepadButtonType[GamepadButtonType["LEFT_STICK_X"] = 5] = "LEFT_STICK_X";
13
+ GamepadButtonType[GamepadButtonType["LEFT_STICK_Y"] = 6] = "LEFT_STICK_Y";
14
+ GamepadButtonType[GamepadButtonType["LEFT_STICK_BUTTON"] = 7] = "LEFT_STICK_BUTTON";
15
+ GamepadButtonType[GamepadButtonType["RIGHT_STICK_X"] = 8] = "RIGHT_STICK_X";
16
+ GamepadButtonType[GamepadButtonType["RIGHT_STICK_Y"] = 9] = "RIGHT_STICK_Y";
17
+ GamepadButtonType[GamepadButtonType["RIGHT_STICK_BUTTON"] = 10] = "RIGHT_STICK_BUTTON";
18
+ GamepadButtonType[GamepadButtonType["LEFT_BUMPER"] = 11] = "LEFT_BUMPER";
19
+ GamepadButtonType[GamepadButtonType["RIGHT_BUMPER"] = 12] = "RIGHT_BUMPER";
20
+ GamepadButtonType[GamepadButtonType["LEFT_TRIGGER"] = 13] = "LEFT_TRIGGER";
21
+ GamepadButtonType[GamepadButtonType["RIGHT_TRIGGER"] = 14] = "RIGHT_TRIGGER";
22
+ GamepadButtonType[GamepadButtonType["A"] = 15] = "A";
23
+ GamepadButtonType[GamepadButtonType["B"] = 16] = "B";
24
+ GamepadButtonType[GamepadButtonType["X"] = 17] = "X";
25
+ GamepadButtonType[GamepadButtonType["Y"] = 18] = "Y";
26
+ GamepadButtonType[GamepadButtonType["BACK"] = 19] = "BACK";
27
+ GamepadButtonType[GamepadButtonType["START"] = 20] = "START";
28
+ GamepadButtonType[GamepadButtonType["GUIDE"] = 21] = "GUIDE";
29
+ GamepadButtonType[GamepadButtonType["SHARE"] = 22] = "SHARE";
30
+ GamepadButtonType[GamepadButtonType["OPTIONS"] = 23] = "OPTIONS";
31
+ GamepadButtonType[GamepadButtonType["PS"] = 24] = "PS";
32
+ GamepadButtonType[GamepadButtonType["CIRCLE"] = 25] = "CIRCLE";
33
+ GamepadButtonType[GamepadButtonType["SQUARE"] = 26] = "SQUARE";
34
+ GamepadButtonType[GamepadButtonType["TRIANGLE"] = 27] = "TRIANGLE";
35
+ })(GamepadButtonType || (exports.GamepadButtonType = GamepadButtonType = {}));
36
+ var GamepadTriggerType;
37
+ (function (GamepadTriggerType) {
38
+ GamepadTriggerType["ONCE"] = "once";
39
+ GamepadTriggerType["CONTINUOUSLY"] = "continuously";
40
+ })(GamepadTriggerType || (exports.GamepadTriggerType = GamepadTriggerType = {}));
41
+ var GamepadCommandVersion;
42
+ (function (GamepadCommandVersion) {
43
+ GamepadCommandVersion["COMMANDS"] = "commands";
44
+ GamepadCommandVersion["CONTROLS"] = "controls";
45
+ GamepadCommandVersion["COMMANDS_V2"] = "commands-v2";
46
+ GamepadCommandVersion["RUN_JS"] = "run-js";
47
+ })(GamepadCommandVersion || (exports.GamepadCommandVersion = GamepadCommandVersion = {}));
@@ -0,0 +1 @@
1
+ export * from './GamepadConfig';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./GamepadConfig"), exports);
@@ -6,11 +6,13 @@ export * from './callsigns/CallsignsLookup';
6
6
  export * from './callsigns/CallsignsQuery';
7
7
  export * from './callsigns/CallsignsQueryPredicate';
8
8
  export * from './command';
9
+ export * from './ConfigGroupResponse';
9
10
  export * from './device-credentials/DeviceCredentials';
10
11
  export * from './Dashboard';
11
12
  export * from './ExportDataQuery';
12
13
  export * from './EventDefinition';
13
14
  export * from './file/FileEnums';
15
+ export * from './gamepad';
14
16
  export * from './graph';
15
17
  export * from './HttpError';
16
18
  export * from './IBaseService';
@@ -22,11 +22,13 @@ __exportStar(require("./callsigns/CallsignsLookup"), exports);
22
22
  __exportStar(require("./callsigns/CallsignsQuery"), exports);
23
23
  __exportStar(require("./callsigns/CallsignsQueryPredicate"), exports);
24
24
  __exportStar(require("./command"), exports);
25
+ __exportStar(require("./ConfigGroupResponse"), exports);
25
26
  __exportStar(require("./device-credentials/DeviceCredentials"), exports);
26
27
  __exportStar(require("./Dashboard"), exports);
27
28
  __exportStar(require("./ExportDataQuery"), exports);
28
29
  __exportStar(require("./EventDefinition"), exports);
29
30
  __exportStar(require("./file/FileEnums"), exports);
31
+ __exportStar(require("./gamepad"), exports);
30
32
  __exportStar(require("./graph"), exports);
31
33
  __exportStar(require("./HttpError"), exports);
32
34
  __exportStar(require("./IBaseService"), exports);
@@ -1,5 +1,7 @@
1
1
  import { AgentSettingsRequestItem, AgentSettingsResponse } from '../models/IRobotSettings';
2
+ import { CommandV2Item, CommandV2Response } from '../models/command/CommandV2';
2
3
  import { CreateRobotDefinitionRequest, RobotProfile } from '../models/RobotProfile';
4
+ import { GamepadConfigItem, GamepadConfigResponse } from '../models/gamepad/GamepadConfig';
3
5
  import { RocosError } from '../models/RocosError';
4
6
  import { BaseServiceAbstract } from './BaseServiceAbstract';
5
7
  import { Dashboard } from '../models/Dashboard';
@@ -167,7 +169,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
167
169
  * @param definitionId - Robot definition Id
168
170
  * @description - Renamed from robotDefGetCommandsV2
169
171
  */
170
- getCommandsV2(projectId: string, definitionId: string): Promise<any>;
172
+ getCommandsV2(projectId: string, definitionId: string): Promise<CommandV2Response>;
171
173
  /**
172
174
  * Update command V2 for a robot definition
173
175
  *
@@ -176,7 +178,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
176
178
  * @param model - Payload
177
179
  * @description - Renamed from robotDefUpdateCommandsV2
178
180
  */
179
- updateCommandsV2(projectId: string, definitionId: string, model: any): Promise<any>;
181
+ updateCommandsV2(projectId: string, definitionId: string, model: CommandV2Item[]): Promise<void>;
180
182
  /**
181
183
  * Get command actions for a robot definition
182
184
  *
@@ -226,7 +228,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
226
228
  * @param definitionId - Robot definition Id
227
229
  * @description - Renamed from robotDefGetGamepads
228
230
  */
229
- getGamepads(projectId: string, definitionId: string): Promise<any>;
231
+ getGamepads(projectId: string, definitionId: string): Promise<GamepadConfigResponse>;
230
232
  /** Export robot definition into JSON format
231
233
  *
232
234
  * Can be used to import robot definition into another project
@@ -265,5 +267,5 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
265
267
  * @param model - \payload
266
268
  * @description - Renamed from robotDefUpdateGamepads
267
269
  */
268
- updateGamepads(projectId: string, definitionId: string, model: any): Promise<any>;
270
+ updateGamepads(projectId: string, definitionId: string, model: GamepadConfigItem[]): Promise<void>;
269
271
  }
@@ -238,7 +238,6 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
238
238
  * @param definitionId - Robot definition Id
239
239
  * @description - Renamed from robotDefGetCommandsV2
240
240
  */
241
- // TODO: map the response object
242
241
  async getCommandsV2(projectId, definitionId) {
243
242
  return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_COMMAND2_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), `Failed to get command list for ${projectId}, definitionId ${definitionId}.`);
244
243
  }
@@ -250,9 +249,6 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
250
249
  * @param model - Payload
251
250
  * @description - Renamed from robotDefUpdateCommandsV2
252
251
  */
253
- // TODO: map the request model
254
- // TODO: map the response object
255
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
256
252
  async updateCommandsV2(projectId, definitionId, model) {
257
253
  return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_COMMAND2_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), model, `Failed to update command list for ${projectId}, definitionId ${definitionId}.`);
258
254
  }
@@ -324,7 +320,6 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
324
320
  * @param definitionId - Robot definition Id
325
321
  * @description - Renamed from robotDefGetGamepads
326
322
  */
327
- // TODO: map the response object
328
323
  async getGamepads(projectId, definitionId) {
329
324
  return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_GAMEPAD_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), `Failed to get gamepads for ${projectId}, definitionId ${definitionId}.`);
330
325
  }
@@ -380,9 +375,6 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
380
375
  * @param model - \payload
381
376
  * @description - Renamed from robotDefUpdateGamepads
382
377
  */
383
- // TODO: map the request model
384
- // TODO: map the response object
385
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
386
378
  async updateGamepads(projectId, definitionId, model) {
387
379
  return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_GAMEPAD_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), model, `Failed to update gamepads for ${projectId}, definitionId ${definitionId}.`);
388
380
  }
@@ -1,4 +1,4 @@
1
- import { AgentSettingsResponse, IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
1
+ import { AgentSettingsResponse, CommandV2Item, CommandV2Response, GamepadConfigItem, GamepadConfigResponse, IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
2
2
  import { BaseServiceAbstract } from './BaseServiceAbstract';
3
3
  export declare class RobotService extends BaseServiceAbstract implements IBaseService {
4
4
  constructor(config: IRocosSDKConfig);
@@ -227,7 +227,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
227
227
  * @param projectId - Project Id
228
228
  * @param callsign - Robot callsign
229
229
  */
230
- getCommandsV2(projectId: string, callsign: string): Promise<any>;
230
+ getCommandsV2(projectId: string, callsign: string): Promise<CommandV2Response>;
231
231
  /**
232
232
  * Update command V2 for a robot
233
233
  *
@@ -235,7 +235,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
235
235
  * @param callsign - Robot callsign
236
236
  * @param model - Payload
237
237
  */
238
- updateCommandsV2(projectId: string, callsign: string, model: any): Promise<any>;
238
+ updateCommandsV2(projectId: string, callsign: string, model: CommandV2Item[]): Promise<void>;
239
239
  /**
240
240
  * Get buttons for a robot
241
241
  *
@@ -272,7 +272,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
272
272
  * @param projectId - Project Id
273
273
  * @param callsign - Robot callsign
274
274
  */
275
- getGamepads(projectId: string, callsign: string): Promise<any>;
275
+ getGamepads(projectId: string, callsign: string): Promise<GamepadConfigResponse>;
276
276
  /**
277
277
  * Update gamepads for a robot
278
278
  *
@@ -280,7 +280,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
280
280
  * @param callsign - Robot callsign
281
281
  * @param model - \payload
282
282
  */
283
- updateGamepads(projectId: string, callsign: string, model: any): Promise<any>;
283
+ updateGamepads(projectId: string, callsign: string, model: GamepadConfigItem[]): Promise<void>;
284
284
  getConnectedCallsigns(projectId: string): Promise<Map<string, IConnectedCallsign>>;
285
285
  getConnectedCallsign(projectId: string, callsign: string): Promise<IConnectedCallsign>;
286
286
  }
@@ -380,7 +380,6 @@ class RobotService extends BaseServiceAbstract_1.BaseServiceAbstract {
380
380
  * @param projectId - Project Id
381
381
  * @param callsign - Robot callsign
382
382
  */
383
- // TODO: map the response object
384
383
  async getCommandsV2(projectId, callsign) {
385
384
  return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_COMMAND2_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), `Failed to get command list for ${projectId}, callsign ${callsign}.`);
386
385
  }
@@ -391,9 +390,6 @@ class RobotService extends BaseServiceAbstract_1.BaseServiceAbstract {
391
390
  * @param callsign - Robot callsign
392
391
  * @param model - Payload
393
392
  */
394
- // TODO: map the request model
395
- // TODO: map the response object
396
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
397
393
  async updateCommandsV2(projectId, callsign, model) {
398
394
  return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_COMMAND2_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), model, `Failed to update commands for ${projectId}, callsign ${callsign}.`);
399
395
  }
@@ -449,7 +445,6 @@ class RobotService extends BaseServiceAbstract_1.BaseServiceAbstract {
449
445
  * @param projectId - Project Id
450
446
  * @param callsign - Robot callsign
451
447
  */
452
- // TODO: map the response object
453
448
  async getGamepads(projectId, callsign) {
454
449
  return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_GAMEPAD_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), `Failed to get gamepads for ${projectId}, callsign ${callsign}.`);
455
450
  }
@@ -460,9 +455,6 @@ class RobotService extends BaseServiceAbstract_1.BaseServiceAbstract {
460
455
  * @param callsign - Robot callsign
461
456
  * @param model - \payload
462
457
  */
463
- // TODO: map the request model
464
- // TODO: map the response object
465
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
466
458
  async updateGamepads(projectId, callsign, model) {
467
459
  return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_GAMEPAD_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), model, `Failed to update gamepads for ${projectId}, callsign ${callsign}.`);
468
460
  }
@@ -0,0 +1,20 @@
1
+ /** One stored item in a config group, scoped by whatever the group's `type` represents (e.g. one gamepad, one command). */
2
+ export interface ConfigGroupItem<T> {
3
+ id: string;
4
+ value: T;
5
+ /** Robot-scoped response only: whether this robot's config overrides its robot definition's. */
6
+ _isOverridden?: boolean;
7
+ /** Robot-scoped response only: the robot definition's item this one overrides, when it does. */
8
+ _globalItem?: ConfigGroupItem<T>;
9
+ }
10
+ /** Response shape shared by RobotService/ProfileService config-group endpoints (gamepads, commands-v2, ...). */
11
+ export interface ConfigGroupResponse<T> {
12
+ version?: string;
13
+ type: string;
14
+ items: Array<ConfigGroupItem<T>>;
15
+ /** Robot-scoped response only. */
16
+ robotDefinitionId?: string;
17
+ username?: string;
18
+ createdAt?: string;
19
+ updatedAt?: string;
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ import { ConfigGroupItem, ConfigGroupResponse } from '../ConfigGroupResponse';
2
+ /** Declares one named parameter a command accepts. `default` is always a string, whatever `type` names. */
3
+ export interface CommandV2ParameterDeclaration {
4
+ type: string;
5
+ default: string;
6
+ }
7
+ export interface CommandV2Settings {
8
+ target: string;
9
+ /** Stored as a number on newer configs, a numeric string on older ones. Absent on some legacy configs. */
10
+ timeoutMs?: number | string;
11
+ requiresClockSync: boolean;
12
+ payloadTemplate: string;
13
+ /** Should be an object, but a known editor round-trip bug can persist it as a raw JSON string. */
14
+ payloadMeta?: Record<string, unknown> | string | null;
15
+ }
16
+ export interface CommandV2 {
17
+ schemaVersion: number;
18
+ id: string;
19
+ name: string;
20
+ type: string;
21
+ /** Absent for commands declaring no parameters, not an empty object. */
22
+ parameters?: Record<string, CommandV2ParameterDeclaration>;
23
+ settings: CommandV2Settings;
24
+ }
25
+ /** One stored command, scoped to a specific command id (CommandV2.id). */
26
+ export type CommandV2Item = ConfigGroupItem<CommandV2>;
27
+ /** Response shape of RobotService/ProfileService getCommandsV2 — one item per declared command. */
28
+ export type CommandV2Response = ConfigGroupResponse<CommandV2>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from '../ResponseLevelEnum';
2
+ export * from './CommandV2';
2
3
  export * from './IRocosCommandMessageHeartbeat';
3
4
  export * from './IRocosCommandMessageResponse';
4
5
  export * from './RocosCommandResultStatus';
@@ -1,4 +1,5 @@
1
1
  export * from '../ResponseLevelEnum';
2
+ export * from './CommandV2';
2
3
  export * from './IRocosCommandMessageHeartbeat';
3
4
  export * from './IRocosCommandMessageResponse';
4
5
  export * from './RocosCommandResultStatus';
@@ -0,0 +1,87 @@
1
+ import { ConfigGroupItem, ConfigGroupResponse } from '../ConfigGroupResponse';
2
+ export declare enum GamepadButtonType {
3
+ UNKNOWN = 0,
4
+ UP = 1,
5
+ DOWN = 2,
6
+ LEFT = 3,
7
+ RIGHT = 4,
8
+ LEFT_STICK_X = 5,
9
+ LEFT_STICK_Y = 6,
10
+ LEFT_STICK_BUTTON = 7,// Stick pressed
11
+ RIGHT_STICK_X = 8,
12
+ RIGHT_STICK_Y = 9,
13
+ RIGHT_STICK_BUTTON = 10,// Stick pressed
14
+ LEFT_BUMPER = 11,
15
+ RIGHT_BUMPER = 12,
16
+ LEFT_TRIGGER = 13,
17
+ RIGHT_TRIGGER = 14,
18
+ A = 15,// Xbox
19
+ B = 16,// Xbox
20
+ X = 17,// Xbox
21
+ Y = 18,// Xbox
22
+ BACK = 19,// Xbox
23
+ START = 20,// Xbox
24
+ GUIDE = 21,// Xbox
25
+ SHARE = 22,// PS4
26
+ OPTIONS = 23,// PS4
27
+ PS = 24,// PS4
28
+ CIRCLE = 25,// PS4
29
+ SQUARE = 26,// PS4
30
+ TRIANGLE = 27
31
+ }
32
+ /** Per-axis tuning keyed by GamepadButtonType. Absent entirely on configs saved before axis tuning existed. */
33
+ export type GamepadAxisValueMap = Partial<Record<GamepadButtonType, number>>;
34
+ export declare enum GamepadTriggerType {
35
+ ONCE = "once",
36
+ CONTINUOUSLY = "continuously"
37
+ }
38
+ export declare enum GamepadCommandVersion {
39
+ COMMANDS = "commands",
40
+ CONTROLS = "controls",
41
+ COMMANDS_V2 = "commands-v2",
42
+ RUN_JS = "run-js"
43
+ }
44
+ export interface GamepadButtonRef {
45
+ type: GamepadButtonType;
46
+ text: string;
47
+ }
48
+ export interface GamepadAction {
49
+ name: string;
50
+ source: GamepadButtonRef;
51
+ commandId: string;
52
+ /** Absent on configs saved before Commands V2 existed. */
53
+ commandVersion?: GamepadCommandVersion;
54
+ triggerType: GamepadTriggerType;
55
+ /** Milliseconds between repeats. Only meaningful for `continuously`. */
56
+ frequency: number;
57
+ }
58
+ export interface GamepadVariable {
59
+ name: string;
60
+ source: GamepadButtonRef;
61
+ /** Expression evaluated against the button value, with `$value` and `$msg` in scope. */
62
+ value: string;
63
+ /** Stored as a string by the console editor, and used when the source button is absent. */
64
+ defaultValue?: string;
65
+ }
66
+ export interface GamepadHardwareMapping {
67
+ buttons: GamepadButtonRef[];
68
+ axes: GamepadButtonRef[];
69
+ }
70
+ /** Identifies the physical controller model this config applies to, matched against the browser's Gamepad.id. */
71
+ export interface GamepadHardware {
72
+ id: string;
73
+ type: string;
74
+ name: string;
75
+ mapping: GamepadHardwareMapping;
76
+ }
77
+ export interface GamepadConfig {
78
+ gamepad: GamepadHardware;
79
+ actions: GamepadAction[];
80
+ variables: GamepadVariable[];
81
+ axisDeadzones?: GamepadAxisValueMap;
82
+ axisExpos?: GamepadAxisValueMap;
83
+ }
84
+ /** One stored gamepad config, scoped to a specific physical controller model (GamepadConfig.gamepad). */
85
+ export type GamepadConfigItem = ConfigGroupItem<GamepadConfig>;
86
+ /** Response shape of RobotService/ProfileService getGamepads — one item per registered controller model. */
87
+ export type GamepadConfigResponse = ConfigGroupResponse<GamepadConfig>;
@@ -0,0 +1,44 @@
1
+ // Ref: https://github.com/alaingilbert/GamepadJs
2
+ export var GamepadButtonType;
3
+ (function (GamepadButtonType) {
4
+ GamepadButtonType[GamepadButtonType["UNKNOWN"] = 0] = "UNKNOWN";
5
+ GamepadButtonType[GamepadButtonType["UP"] = 1] = "UP";
6
+ GamepadButtonType[GamepadButtonType["DOWN"] = 2] = "DOWN";
7
+ GamepadButtonType[GamepadButtonType["LEFT"] = 3] = "LEFT";
8
+ GamepadButtonType[GamepadButtonType["RIGHT"] = 4] = "RIGHT";
9
+ GamepadButtonType[GamepadButtonType["LEFT_STICK_X"] = 5] = "LEFT_STICK_X";
10
+ GamepadButtonType[GamepadButtonType["LEFT_STICK_Y"] = 6] = "LEFT_STICK_Y";
11
+ GamepadButtonType[GamepadButtonType["LEFT_STICK_BUTTON"] = 7] = "LEFT_STICK_BUTTON";
12
+ GamepadButtonType[GamepadButtonType["RIGHT_STICK_X"] = 8] = "RIGHT_STICK_X";
13
+ GamepadButtonType[GamepadButtonType["RIGHT_STICK_Y"] = 9] = "RIGHT_STICK_Y";
14
+ GamepadButtonType[GamepadButtonType["RIGHT_STICK_BUTTON"] = 10] = "RIGHT_STICK_BUTTON";
15
+ GamepadButtonType[GamepadButtonType["LEFT_BUMPER"] = 11] = "LEFT_BUMPER";
16
+ GamepadButtonType[GamepadButtonType["RIGHT_BUMPER"] = 12] = "RIGHT_BUMPER";
17
+ GamepadButtonType[GamepadButtonType["LEFT_TRIGGER"] = 13] = "LEFT_TRIGGER";
18
+ GamepadButtonType[GamepadButtonType["RIGHT_TRIGGER"] = 14] = "RIGHT_TRIGGER";
19
+ GamepadButtonType[GamepadButtonType["A"] = 15] = "A";
20
+ GamepadButtonType[GamepadButtonType["B"] = 16] = "B";
21
+ GamepadButtonType[GamepadButtonType["X"] = 17] = "X";
22
+ GamepadButtonType[GamepadButtonType["Y"] = 18] = "Y";
23
+ GamepadButtonType[GamepadButtonType["BACK"] = 19] = "BACK";
24
+ GamepadButtonType[GamepadButtonType["START"] = 20] = "START";
25
+ GamepadButtonType[GamepadButtonType["GUIDE"] = 21] = "GUIDE";
26
+ GamepadButtonType[GamepadButtonType["SHARE"] = 22] = "SHARE";
27
+ GamepadButtonType[GamepadButtonType["OPTIONS"] = 23] = "OPTIONS";
28
+ GamepadButtonType[GamepadButtonType["PS"] = 24] = "PS";
29
+ GamepadButtonType[GamepadButtonType["CIRCLE"] = 25] = "CIRCLE";
30
+ GamepadButtonType[GamepadButtonType["SQUARE"] = 26] = "SQUARE";
31
+ GamepadButtonType[GamepadButtonType["TRIANGLE"] = 27] = "TRIANGLE";
32
+ })(GamepadButtonType || (GamepadButtonType = {}));
33
+ export var GamepadTriggerType;
34
+ (function (GamepadTriggerType) {
35
+ GamepadTriggerType["ONCE"] = "once";
36
+ GamepadTriggerType["CONTINUOUSLY"] = "continuously";
37
+ })(GamepadTriggerType || (GamepadTriggerType = {}));
38
+ export var GamepadCommandVersion;
39
+ (function (GamepadCommandVersion) {
40
+ GamepadCommandVersion["COMMANDS"] = "commands";
41
+ GamepadCommandVersion["CONTROLS"] = "controls";
42
+ GamepadCommandVersion["COMMANDS_V2"] = "commands-v2";
43
+ GamepadCommandVersion["RUN_JS"] = "run-js";
44
+ })(GamepadCommandVersion || (GamepadCommandVersion = {}));
@@ -0,0 +1 @@
1
+ export * from './GamepadConfig';
@@ -0,0 +1 @@
1
+ export * from './GamepadConfig';
@@ -6,11 +6,13 @@ export * from './callsigns/CallsignsLookup';
6
6
  export * from './callsigns/CallsignsQuery';
7
7
  export * from './callsigns/CallsignsQueryPredicate';
8
8
  export * from './command';
9
+ export * from './ConfigGroupResponse';
9
10
  export * from './device-credentials/DeviceCredentials';
10
11
  export * from './Dashboard';
11
12
  export * from './ExportDataQuery';
12
13
  export * from './EventDefinition';
13
14
  export * from './file/FileEnums';
15
+ export * from './gamepad';
14
16
  export * from './graph';
15
17
  export * from './HttpError';
16
18
  export * from './IBaseService';
@@ -6,11 +6,13 @@ export * from './callsigns/CallsignsLookup';
6
6
  export * from './callsigns/CallsignsQuery';
7
7
  export * from './callsigns/CallsignsQueryPredicate';
8
8
  export * from './command';
9
+ export * from './ConfigGroupResponse';
9
10
  export * from './device-credentials/DeviceCredentials';
10
11
  export * from './Dashboard';
11
12
  export * from './ExportDataQuery';
12
13
  export * from './EventDefinition';
13
14
  export * from './file/FileEnums';
15
+ export * from './gamepad';
14
16
  export * from './graph';
15
17
  export * from './HttpError';
16
18
  export * from './IBaseService';
@@ -1,5 +1,7 @@
1
1
  import { AgentSettingsRequestItem, AgentSettingsResponse } from '../models/IRobotSettings';
2
+ import { CommandV2Item, CommandV2Response } from '../models/command/CommandV2';
2
3
  import { CreateRobotDefinitionRequest, RobotProfile } from '../models/RobotProfile';
4
+ import { GamepadConfigItem, GamepadConfigResponse } from '../models/gamepad/GamepadConfig';
3
5
  import { RocosError } from '../models/RocosError';
4
6
  import { BaseServiceAbstract } from './BaseServiceAbstract';
5
7
  import { Dashboard } from '../models/Dashboard';
@@ -167,7 +169,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
167
169
  * @param definitionId - Robot definition Id
168
170
  * @description - Renamed from robotDefGetCommandsV2
169
171
  */
170
- getCommandsV2(projectId: string, definitionId: string): Promise<any>;
172
+ getCommandsV2(projectId: string, definitionId: string): Promise<CommandV2Response>;
171
173
  /**
172
174
  * Update command V2 for a robot definition
173
175
  *
@@ -176,7 +178,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
176
178
  * @param model - Payload
177
179
  * @description - Renamed from robotDefUpdateCommandsV2
178
180
  */
179
- updateCommandsV2(projectId: string, definitionId: string, model: any): Promise<any>;
181
+ updateCommandsV2(projectId: string, definitionId: string, model: CommandV2Item[]): Promise<void>;
180
182
  /**
181
183
  * Get command actions for a robot definition
182
184
  *
@@ -226,7 +228,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
226
228
  * @param definitionId - Robot definition Id
227
229
  * @description - Renamed from robotDefGetGamepads
228
230
  */
229
- getGamepads(projectId: string, definitionId: string): Promise<any>;
231
+ getGamepads(projectId: string, definitionId: string): Promise<GamepadConfigResponse>;
230
232
  /** Export robot definition into JSON format
231
233
  *
232
234
  * Can be used to import robot definition into another project
@@ -265,5 +267,5 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
265
267
  * @param model - \payload
266
268
  * @description - Renamed from robotDefUpdateGamepads
267
269
  */
268
- updateGamepads(projectId: string, definitionId: string, model: any): Promise<any>;
270
+ updateGamepads(projectId: string, definitionId: string, model: GamepadConfigItem[]): Promise<void>;
269
271
  }
@@ -235,7 +235,6 @@ export class ProfileService extends BaseServiceAbstract {
235
235
  * @param definitionId - Robot definition Id
236
236
  * @description - Renamed from robotDefGetCommandsV2
237
237
  */
238
- // TODO: map the response object
239
238
  async getCommandsV2(projectId, definitionId) {
240
239
  return this.callGet(formatServiceUrl(API_PROJECT_DEFINITION_COMMAND2_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), `Failed to get command list for ${projectId}, definitionId ${definitionId}.`);
241
240
  }
@@ -247,9 +246,6 @@ export class ProfileService extends BaseServiceAbstract {
247
246
  * @param model - Payload
248
247
  * @description - Renamed from robotDefUpdateCommandsV2
249
248
  */
250
- // TODO: map the request model
251
- // TODO: map the response object
252
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
253
249
  async updateCommandsV2(projectId, definitionId, model) {
254
250
  return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_COMMAND2_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), model, `Failed to update command list for ${projectId}, definitionId ${definitionId}.`);
255
251
  }
@@ -321,7 +317,6 @@ export class ProfileService extends BaseServiceAbstract {
321
317
  * @param definitionId - Robot definition Id
322
318
  * @description - Renamed from robotDefGetGamepads
323
319
  */
324
- // TODO: map the response object
325
320
  async getGamepads(projectId, definitionId) {
326
321
  return this.callGet(formatServiceUrl(API_PROJECT_DEFINITION_GAMEPAD_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), `Failed to get gamepads for ${projectId}, definitionId ${definitionId}.`);
327
322
  }
@@ -377,9 +372,6 @@ export class ProfileService extends BaseServiceAbstract {
377
372
  * @param model - \payload
378
373
  * @description - Renamed from robotDefUpdateGamepads
379
374
  */
380
- // TODO: map the request model
381
- // TODO: map the response object
382
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
383
375
  async updateGamepads(projectId, definitionId, model) {
384
376
  return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_GAMEPAD_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), model, `Failed to update gamepads for ${projectId}, definitionId ${definitionId}.`);
385
377
  }
@@ -1,4 +1,4 @@
1
- import { AgentSettingsResponse, IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
1
+ import { AgentSettingsResponse, CommandV2Item, CommandV2Response, GamepadConfigItem, GamepadConfigResponse, IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
2
2
  import { BaseServiceAbstract } from './BaseServiceAbstract';
3
3
  export declare class RobotService extends BaseServiceAbstract implements IBaseService {
4
4
  constructor(config: IRocosSDKConfig);
@@ -227,7 +227,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
227
227
  * @param projectId - Project Id
228
228
  * @param callsign - Robot callsign
229
229
  */
230
- getCommandsV2(projectId: string, callsign: string): Promise<any>;
230
+ getCommandsV2(projectId: string, callsign: string): Promise<CommandV2Response>;
231
231
  /**
232
232
  * Update command V2 for a robot
233
233
  *
@@ -235,7 +235,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
235
235
  * @param callsign - Robot callsign
236
236
  * @param model - Payload
237
237
  */
238
- updateCommandsV2(projectId: string, callsign: string, model: any): Promise<any>;
238
+ updateCommandsV2(projectId: string, callsign: string, model: CommandV2Item[]): Promise<void>;
239
239
  /**
240
240
  * Get buttons for a robot
241
241
  *
@@ -272,7 +272,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
272
272
  * @param projectId - Project Id
273
273
  * @param callsign - Robot callsign
274
274
  */
275
- getGamepads(projectId: string, callsign: string): Promise<any>;
275
+ getGamepads(projectId: string, callsign: string): Promise<GamepadConfigResponse>;
276
276
  /**
277
277
  * Update gamepads for a robot
278
278
  *
@@ -280,7 +280,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
280
280
  * @param callsign - Robot callsign
281
281
  * @param model - \payload
282
282
  */
283
- updateGamepads(projectId: string, callsign: string, model: any): Promise<any>;
283
+ updateGamepads(projectId: string, callsign: string, model: GamepadConfigItem[]): Promise<void>;
284
284
  getConnectedCallsigns(projectId: string): Promise<Map<string, IConnectedCallsign>>;
285
285
  getConnectedCallsign(projectId: string, callsign: string): Promise<IConnectedCallsign>;
286
286
  }
@@ -377,7 +377,6 @@ export class RobotService extends BaseServiceAbstract {
377
377
  * @param projectId - Project Id
378
378
  * @param callsign - Robot callsign
379
379
  */
380
- // TODO: map the response object
381
380
  async getCommandsV2(projectId, callsign) {
382
381
  return this.callGet(formatServiceUrl(API_PROJECT_ROBOT_COMMAND2_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), `Failed to get command list for ${projectId}, callsign ${callsign}.`);
383
382
  }
@@ -388,9 +387,6 @@ export class RobotService extends BaseServiceAbstract {
388
387
  * @param callsign - Robot callsign
389
388
  * @param model - Payload
390
389
  */
391
- // TODO: map the request model
392
- // TODO: map the response object
393
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
394
390
  async updateCommandsV2(projectId, callsign, model) {
395
391
  return this.callPost(formatServiceUrl(API_PROJECT_ROBOT_COMMAND2_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), model, `Failed to update commands for ${projectId}, callsign ${callsign}.`);
396
392
  }
@@ -446,7 +442,6 @@ export class RobotService extends BaseServiceAbstract {
446
442
  * @param projectId - Project Id
447
443
  * @param callsign - Robot callsign
448
444
  */
449
- // TODO: map the response object
450
445
  async getGamepads(projectId, callsign) {
451
446
  return this.callGet(formatServiceUrl(API_PROJECT_ROBOT_GAMEPAD_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), `Failed to get gamepads for ${projectId}, callsign ${callsign}.`);
452
447
  }
@@ -457,9 +452,6 @@ export class RobotService extends BaseServiceAbstract {
457
452
  * @param callsign - Robot callsign
458
453
  * @param model - \payload
459
454
  */
460
- // TODO: map the request model
461
- // TODO: map the response object
462
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
463
455
  async updateGamepads(projectId, callsign, model) {
464
456
  return this.callPost(formatServiceUrl(API_PROJECT_ROBOT_GAMEPAD_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), model, `Failed to update gamepads for ${projectId}, callsign ${callsign}.`);
465
457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "4.3.1",
3
+ "version": "4.4.2",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",