@dronedeploy/rocos-js-sdk 4.4.10 → 4.4.11

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.
@@ -57,12 +57,9 @@ export interface GamepadButtonRef {
57
57
  type: GamepadButtonType;
58
58
  text: string;
59
59
  }
60
- export interface GamepadAction {
60
+ export interface GamepadActionBase {
61
61
  name: string;
62
62
  source: GamepadButtonRef;
63
- commandId: string;
64
- /** Absent on configs saved before Commands V2 existed. */
65
- commandVersion?: GamepadCommandVersion;
66
63
  triggerType: GamepadTriggerType;
67
64
  /** Milliseconds between repeats. Only meaningful for `continuously`. */
68
65
  frequency: number;
@@ -76,6 +73,26 @@ export interface GamepadAction {
76
73
  */
77
74
  modifiers?: GamepadButtonRef[];
78
75
  }
76
+ export type GamepadActionType = 'robot' | 'dashboard';
77
+ /** A robot-side action. `actionType` is absent on configurations saved before destinations existed. */
78
+ export interface GamepadRobotAction extends GamepadActionBase {
79
+ actionType?: 'robot';
80
+ commandId: string;
81
+ /** Absent on configs saved before Commands V2 existed. */
82
+ commandVersion?: GamepadCommandVersion;
83
+ }
84
+ /** A semantic action broadcast to widgets mounted on the current dashboard page. */
85
+ export interface GamepadDashboardAction extends GamepadActionBase {
86
+ actionType: 'dashboard';
87
+ actionName: string;
88
+ /** Custom-widget bundles that predate destinations skip any action without a `commandId`, so it must stay absent. */
89
+ commandId?: never;
90
+ commandVersion?: never;
91
+ }
92
+ export type GamepadAction = GamepadRobotAction | GamepadDashboardAction;
93
+ /** Prefer this over checking `actionType === 'robot'`, which misses configurations saved before destinations existed. */
94
+ export declare const isGamepadRobotAction: (action: GamepadAction) => action is GamepadRobotAction;
95
+ export declare const isGamepadDashboardAction: (action: GamepadAction) => action is GamepadDashboardAction;
79
96
  export interface GamepadVariable {
80
97
  name: string;
81
98
  source: GamepadButtonRef;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GamepadCommandVersion = exports.GamepadTriggerType = exports.MODIFIER_RELEASE_FRACTION = exports.DEFAULT_MODIFIER_THRESHOLD = exports.GamepadButtonType = void 0;
3
+ exports.isGamepadDashboardAction = exports.isGamepadRobotAction = exports.GamepadCommandVersion = exports.GamepadTriggerType = exports.MODIFIER_RELEASE_FRACTION = exports.DEFAULT_MODIFIER_THRESHOLD = exports.GamepadButtonType = void 0;
4
4
  // Ref: https://github.com/alaingilbert/GamepadJs
5
5
  var GamepadButtonType;
6
6
  (function (GamepadButtonType) {
@@ -55,3 +55,12 @@ var GamepadCommandVersion;
55
55
  GamepadCommandVersion["COMMANDS_V2"] = "commands-v2";
56
56
  GamepadCommandVersion["RUN_JS"] = "run-js";
57
57
  })(GamepadCommandVersion || (exports.GamepadCommandVersion = GamepadCommandVersion = {}));
58
+ /** Prefer this over checking `actionType === 'robot'`, which misses configurations saved before destinations existed. */
59
+ const isGamepadRobotAction = (action) => {
60
+ return action.actionType !== 'dashboard';
61
+ };
62
+ exports.isGamepadRobotAction = isGamepadRobotAction;
63
+ const isGamepadDashboardAction = (action) => {
64
+ return action.actionType === 'dashboard';
65
+ };
66
+ exports.isGamepadDashboardAction = isGamepadDashboardAction;
@@ -57,12 +57,9 @@ export interface GamepadButtonRef {
57
57
  type: GamepadButtonType;
58
58
  text: string;
59
59
  }
60
- export interface GamepadAction {
60
+ export interface GamepadActionBase {
61
61
  name: string;
62
62
  source: GamepadButtonRef;
63
- commandId: string;
64
- /** Absent on configs saved before Commands V2 existed. */
65
- commandVersion?: GamepadCommandVersion;
66
63
  triggerType: GamepadTriggerType;
67
64
  /** Milliseconds between repeats. Only meaningful for `continuously`. */
68
65
  frequency: number;
@@ -76,6 +73,26 @@ export interface GamepadAction {
76
73
  */
77
74
  modifiers?: GamepadButtonRef[];
78
75
  }
76
+ export type GamepadActionType = 'robot' | 'dashboard';
77
+ /** A robot-side action. `actionType` is absent on configurations saved before destinations existed. */
78
+ export interface GamepadRobotAction extends GamepadActionBase {
79
+ actionType?: 'robot';
80
+ commandId: string;
81
+ /** Absent on configs saved before Commands V2 existed. */
82
+ commandVersion?: GamepadCommandVersion;
83
+ }
84
+ /** A semantic action broadcast to widgets mounted on the current dashboard page. */
85
+ export interface GamepadDashboardAction extends GamepadActionBase {
86
+ actionType: 'dashboard';
87
+ actionName: string;
88
+ /** Custom-widget bundles that predate destinations skip any action without a `commandId`, so it must stay absent. */
89
+ commandId?: never;
90
+ commandVersion?: never;
91
+ }
92
+ export type GamepadAction = GamepadRobotAction | GamepadDashboardAction;
93
+ /** Prefer this over checking `actionType === 'robot'`, which misses configurations saved before destinations existed. */
94
+ export declare const isGamepadRobotAction: (action: GamepadAction) => action is GamepadRobotAction;
95
+ export declare const isGamepadDashboardAction: (action: GamepadAction) => action is GamepadDashboardAction;
79
96
  export interface GamepadVariable {
80
97
  name: string;
81
98
  source: GamepadButtonRef;
@@ -52,3 +52,10 @@ export var GamepadCommandVersion;
52
52
  GamepadCommandVersion["COMMANDS_V2"] = "commands-v2";
53
53
  GamepadCommandVersion["RUN_JS"] = "run-js";
54
54
  })(GamepadCommandVersion || (GamepadCommandVersion = {}));
55
+ /** Prefer this over checking `actionType === 'robot'`, which misses configurations saved before destinations existed. */
56
+ export const isGamepadRobotAction = (action) => {
57
+ return action.actionType !== 'dashboard';
58
+ };
59
+ export const isGamepadDashboardAction = (action) => {
60
+ return action.actionType === 'dashboard';
61
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "4.4.10",
3
+ "version": "4.4.11",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",