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

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.
@@ -9,24 +9,17 @@ export interface Target extends TargetBase {
9
9
  translation?: Vector3;
10
10
  rotation?: Quaternion;
11
11
  media?: TargetMedia[];
12
- /**
13
- * Media associated with the target (images)
14
- */
12
+ position?: TargetWgs84 | Vector3;
15
13
  frame?: string;
16
14
  }
17
15
  export interface TargetMedia {
18
16
  id: string;
19
17
  data: Record<string, string>;
20
18
  }
21
- export interface CreateTargetPositionWgs84 {
19
+ export interface TargetWgs84 {
22
20
  lat: number;
23
21
  lon: number;
24
22
  alt?: number;
25
23
  }
26
- export interface CreateTarget extends TargetBase {
27
- data?: Record<string, string>;
28
- position?: CreateTargetPositionWgs84 | Vector3;
29
- frame?: string;
30
- }
24
+ export declare const isTargetWgs84: (position: TargetWgs84 | Vector3) => position is TargetWgs84;
31
25
  export type Asset = Target;
32
- export type CreateAsset = CreateTarget;
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTargetWgs84 = void 0;
4
+ const isTargetWgs84 = (position) => {
5
+ return 'lat' in position && 'lon' in position;
6
+ };
7
+ exports.isTargetWgs84 = isTargetWgs84;
@@ -1,4 +1,4 @@
1
- import { Asset, CreateAsset, CreateTarget, IBaseService, IRocosSDKConfig, RocosError, Target, TargetMedia } from '../models';
1
+ import { Asset, IBaseService, IRocosSDKConfig, RocosError, Target, TargetMedia } from '../models';
2
2
  import { BaseServiceAbstract } from './BaseServiceAbstract';
3
3
  /**
4
4
  * Service for managing targets (such as assets, PoI's, or FLOCS) on DroneDeploy
@@ -8,9 +8,9 @@ export declare class TargetService extends BaseServiceAbstract implements IBaseS
8
8
  constructor(config: IRocosSDKConfig);
9
9
  getStatus(): boolean;
10
10
  protected getError(e: Error): RocosError;
11
- createTargets(projectId: string, targets: CreateTarget[]): Promise<void>;
11
+ createTargets(projectId: string, targets: Target[]): Promise<void>;
12
12
  listTargets(projectId: string, frameID?: string): Promise<Target[]>;
13
- createAssets(projectId: string, assets: CreateAsset[]): Promise<void>;
13
+ createAssets(projectId: string, assets: Asset[]): Promise<void>;
14
14
  listAssets(projectId: string, frameID?: string): Promise<Asset[]>;
15
15
  addMedia(projectId: string, targetId: string, media: TargetMedia): Promise<void>;
16
16
  }
@@ -22,10 +22,10 @@ class TargetService extends BaseServiceAbstract_1.BaseServiceAbstract {
22
22
  return new models_1.RocosError(e, models_1.errorCodes.TARGET_SERVICE_ERROR);
23
23
  }
24
24
  async createTargets(projectId, targets) {
25
- await this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_TARGET_UPLOAD_URL, {
25
+ return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_TARGET_UPLOAD_URL, {
26
26
  url: this.config.url,
27
27
  projectId,
28
- }, this.config.insecure), targets, 'Failed to upload assets');
28
+ }, this.config.insecure), targets, `Failed to upload targets for ${projectId}`);
29
29
  }
30
30
  async listTargets(projectId, frameID = 'seed') {
31
31
  const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_TARGETS_URL, {
@@ -35,10 +35,10 @@ class TargetService extends BaseServiceAbstract_1.BaseServiceAbstract {
35
35
  return resp;
36
36
  }
37
37
  async createAssets(projectId, assets) {
38
- await this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ASSETS_UPLOAD_URL, {
38
+ return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ASSETS_UPLOAD_URL, {
39
39
  url: this.config.url,
40
40
  projectId,
41
- }, this.config.insecure), assets, 'Failed to upload assets');
41
+ }, this.config.insecure), assets, `Failed to upload assets for ${projectId}`);
42
42
  }
43
43
  async listAssets(projectId, frameID = 'seed') {
44
44
  const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ASSETS_URL, {
@@ -9,24 +9,17 @@ export interface Target extends TargetBase {
9
9
  translation?: Vector3;
10
10
  rotation?: Quaternion;
11
11
  media?: TargetMedia[];
12
- /**
13
- * Media associated with the target (images)
14
- */
12
+ position?: TargetWgs84 | Vector3;
15
13
  frame?: string;
16
14
  }
17
15
  export interface TargetMedia {
18
16
  id: string;
19
17
  data: Record<string, string>;
20
18
  }
21
- export interface CreateTargetPositionWgs84 {
19
+ export interface TargetWgs84 {
22
20
  lat: number;
23
21
  lon: number;
24
22
  alt?: number;
25
23
  }
26
- export interface CreateTarget extends TargetBase {
27
- data?: Record<string, string>;
28
- position?: CreateTargetPositionWgs84 | Vector3;
29
- frame?: string;
30
- }
24
+ export declare const isTargetWgs84: (position: TargetWgs84 | Vector3) => position is TargetWgs84;
31
25
  export type Asset = Target;
32
- export type CreateAsset = CreateTarget;
@@ -1 +1,3 @@
1
- export {};
1
+ export const isTargetWgs84 = (position) => {
2
+ return 'lat' in position && 'lon' in position;
3
+ };
@@ -1,4 +1,4 @@
1
- import { Asset, CreateAsset, CreateTarget, IBaseService, IRocosSDKConfig, RocosError, Target, TargetMedia } from '../models';
1
+ import { Asset, IBaseService, IRocosSDKConfig, RocosError, Target, TargetMedia } from '../models';
2
2
  import { BaseServiceAbstract } from './BaseServiceAbstract';
3
3
  /**
4
4
  * Service for managing targets (such as assets, PoI's, or FLOCS) on DroneDeploy
@@ -8,9 +8,9 @@ export declare class TargetService extends BaseServiceAbstract implements IBaseS
8
8
  constructor(config: IRocosSDKConfig);
9
9
  getStatus(): boolean;
10
10
  protected getError(e: Error): RocosError;
11
- createTargets(projectId: string, targets: CreateTarget[]): Promise<void>;
11
+ createTargets(projectId: string, targets: Target[]): Promise<void>;
12
12
  listTargets(projectId: string, frameID?: string): Promise<Target[]>;
13
- createAssets(projectId: string, assets: CreateAsset[]): Promise<void>;
13
+ createAssets(projectId: string, assets: Asset[]): Promise<void>;
14
14
  listAssets(projectId: string, frameID?: string): Promise<Asset[]>;
15
15
  addMedia(projectId: string, targetId: string, media: TargetMedia): Promise<void>;
16
16
  }
@@ -1,5 +1,5 @@
1
1
  import { API_ASSETS_UPLOAD_URL, API_ASSETS_URL, API_TARGETS_URL, API_TARGET_UPLOAD_URL } from '../constants/api';
2
- import { RocosError, errorCodes, } from '../models';
2
+ import { RocosError, errorCodes } from '../models';
3
3
  import { BaseServiceAbstract } from './BaseServiceAbstract';
4
4
  import { RocosLogger } from '../logger/RocosLogger';
5
5
  import { formatServiceUrl } from '../helpers/formatServiceUrl';
@@ -19,10 +19,10 @@ export class TargetService extends BaseServiceAbstract {
19
19
  return new RocosError(e, errorCodes.TARGET_SERVICE_ERROR);
20
20
  }
21
21
  async createTargets(projectId, targets) {
22
- await this.callPut(formatServiceUrl(API_TARGET_UPLOAD_URL, {
22
+ return this.callPut(formatServiceUrl(API_TARGET_UPLOAD_URL, {
23
23
  url: this.config.url,
24
24
  projectId,
25
- }, this.config.insecure), targets, 'Failed to upload assets');
25
+ }, this.config.insecure), targets, `Failed to upload targets for ${projectId}`);
26
26
  }
27
27
  async listTargets(projectId, frameID = 'seed') {
28
28
  const resp = await this.callGet(formatServiceUrl(API_TARGETS_URL, {
@@ -32,10 +32,10 @@ export class TargetService extends BaseServiceAbstract {
32
32
  return resp;
33
33
  }
34
34
  async createAssets(projectId, assets) {
35
- await this.callPut(formatServiceUrl(API_ASSETS_UPLOAD_URL, {
35
+ return this.callPut(formatServiceUrl(API_ASSETS_UPLOAD_URL, {
36
36
  url: this.config.url,
37
37
  projectId,
38
- }, this.config.insecure), assets, 'Failed to upload assets');
38
+ }, this.config.insecure), assets, `Failed to upload assets for ${projectId}`);
39
39
  }
40
40
  async listAssets(projectId, frameID = 'seed') {
41
41
  const resp = await this.callGet(formatServiceUrl(API_ASSETS_URL, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "3.0.1-alpha.33",
3
+ "version": "3.0.1-alpha.35",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",