@dronedeploy/rocos-js-sdk 3.0.1-alpha.35 → 3.0.1-alpha.36

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,8 +3,6 @@ import { Vector3 } from '../graph/Vector3';
3
3
  export interface TargetBase {
4
4
  id: string;
5
5
  name: string;
6
- }
7
- export interface Target extends TargetBase {
8
6
  data?: Record<string, string>;
9
7
  translation?: Vector3;
10
8
  rotation?: Quaternion;
@@ -22,4 +20,11 @@ export interface TargetWgs84 {
22
20
  alt?: number;
23
21
  }
24
22
  export declare const isTargetWgs84: (position: TargetWgs84 | Vector3) => position is TargetWgs84;
25
- export type Asset = Target;
23
+ export interface Target extends TargetBase {
24
+ type: 'TARGET';
25
+ }
26
+ export declare const isTarget: (target: Target | Asset) => target is Target;
27
+ export interface Asset extends TargetBase {
28
+ type: 'ASSET';
29
+ }
30
+ export declare const isAsset: (target: Target | Asset) => target is Asset;
@@ -1,7 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTargetWgs84 = void 0;
3
+ exports.isAsset = exports.isTarget = exports.isTargetWgs84 = void 0;
4
4
  const isTargetWgs84 = (position) => {
5
- return 'lat' in position && 'lon' in position;
5
+ return Boolean(position) && 'lat' in position && 'lon' in position;
6
6
  };
7
7
  exports.isTargetWgs84 = isTargetWgs84;
8
+ const isTarget = (target) => {
9
+ return target.type === 'TARGET';
10
+ };
11
+ exports.isTarget = isTarget;
12
+ const isAsset = (target) => {
13
+ return target.type === 'ASSET';
14
+ };
15
+ exports.isAsset = isAsset;
@@ -3,8 +3,6 @@ import { Vector3 } from '../graph/Vector3';
3
3
  export interface TargetBase {
4
4
  id: string;
5
5
  name: string;
6
- }
7
- export interface Target extends TargetBase {
8
6
  data?: Record<string, string>;
9
7
  translation?: Vector3;
10
8
  rotation?: Quaternion;
@@ -22,4 +20,11 @@ export interface TargetWgs84 {
22
20
  alt?: number;
23
21
  }
24
22
  export declare const isTargetWgs84: (position: TargetWgs84 | Vector3) => position is TargetWgs84;
25
- export type Asset = Target;
23
+ export interface Target extends TargetBase {
24
+ type: 'TARGET';
25
+ }
26
+ export declare const isTarget: (target: Target | Asset) => target is Target;
27
+ export interface Asset extends TargetBase {
28
+ type: 'ASSET';
29
+ }
30
+ export declare const isAsset: (target: Target | Asset) => target is Asset;
@@ -1,3 +1,9 @@
1
1
  export const isTargetWgs84 = (position) => {
2
- return 'lat' in position && 'lon' in position;
2
+ return Boolean(position) && 'lat' in position && 'lon' in position;
3
+ };
4
+ export const isTarget = (target) => {
5
+ return target.type === 'TARGET';
6
+ };
7
+ export const isAsset = (target) => {
8
+ return target.type === 'ASSET';
3
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "3.0.1-alpha.35",
3
+ "version": "3.0.1-alpha.36",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",