@dronedeploy/rocos-js-sdk 4.4.12 → 4.4.13

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.
@@ -247,16 +247,17 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
247
247
  * @param profileData - Robot definition data
248
248
  * @param newName - Optional new name for the robot definition. If not provided, the name from the imported definition will be used.
249
249
  * @param newDescription - Optional new description for the robot definition. If not provided, the description from the imported definition will be used.
250
+ * @param replaceExisting - Move robots from same-named definitions to the import and delete those definitions.
250
251
  *
251
252
  * @see export
252
253
  */
253
- import(projectId: string, profileData: Blob | File, newName?: string, newDescription?: string): Promise<{
254
+ import(projectId: string, profileData: Blob | File, newName?: string, newDescription?: string, replaceExisting?: boolean): Promise<{
254
255
  profileId: string;
255
256
  }>;
256
257
  getLibraryProfiles(): Promise<(RobotProfile & {
257
258
  last_modified: Date;
258
259
  })[]>;
259
- importFromLibrary(projectId: string, profileId: string, name?: string, description?: string): Promise<{
260
+ importFromLibrary(projectId: string, profileId: string, name?: string, description?: string, replaceExisting?: boolean): Promise<{
260
261
  profileId: string;
261
262
  }>;
262
263
  /**
@@ -343,10 +343,11 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
343
343
  * @param profileData - Robot definition data
344
344
  * @param newName - Optional new name for the robot definition. If not provided, the name from the imported definition will be used.
345
345
  * @param newDescription - Optional new description for the robot definition. If not provided, the description from the imported definition will be used.
346
+ * @param replaceExisting - Move robots from same-named definitions to the import and delete those definitions.
346
347
  *
347
348
  * @see export
348
349
  */
349
- async import(projectId, profileData, newName, newDescription) {
350
+ async import(projectId, profileData, newName, newDescription, replaceExisting) {
350
351
  const formData = new FormData();
351
352
  if (newName) {
352
353
  formData.append('name', newName);
@@ -354,6 +355,9 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
354
355
  if (newDescription) {
355
356
  formData.append('description', newDescription);
356
357
  }
358
+ if (replaceExisting) {
359
+ formData.append('replaceExisting', 'true');
360
+ }
357
361
  formData.append('file', profileData);
358
362
  return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_IMPORT, { url: this.config.url, projectId }, this.config.insecure), formData, `Failed to import robot definition for ${projectId}.`);
359
363
  }
@@ -364,8 +368,8 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
364
368
  last_modified: new Date(profile.last_modified),
365
369
  }));
366
370
  }
367
- async importFromLibrary(projectId, profileId, name, description) {
368
- return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_IMPORT_LIBRARY, { url: this.config.url, projectId, profileId }, this.config.insecure), { name, description }, `Failed to import library profile ${profileId} into project ${projectId}.`);
371
+ async importFromLibrary(projectId, profileId, name, description, replaceExisting) {
372
+ return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_IMPORT_LIBRARY, { url: this.config.url, projectId, profileId }, this.config.insecure), { name, description, ...(replaceExisting ? { replaceExisting } : {}) }, `Failed to import library profile ${profileId} into project ${projectId}.`);
369
373
  }
370
374
  /**
371
375
  * Update gamepads for a robot definition
@@ -247,16 +247,17 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
247
247
  * @param profileData - Robot definition data
248
248
  * @param newName - Optional new name for the robot definition. If not provided, the name from the imported definition will be used.
249
249
  * @param newDescription - Optional new description for the robot definition. If not provided, the description from the imported definition will be used.
250
+ * @param replaceExisting - Move robots from same-named definitions to the import and delete those definitions.
250
251
  *
251
252
  * @see export
252
253
  */
253
- import(projectId: string, profileData: Blob | File, newName?: string, newDescription?: string): Promise<{
254
+ import(projectId: string, profileData: Blob | File, newName?: string, newDescription?: string, replaceExisting?: boolean): Promise<{
254
255
  profileId: string;
255
256
  }>;
256
257
  getLibraryProfiles(): Promise<(RobotProfile & {
257
258
  last_modified: Date;
258
259
  })[]>;
259
- importFromLibrary(projectId: string, profileId: string, name?: string, description?: string): Promise<{
260
+ importFromLibrary(projectId: string, profileId: string, name?: string, description?: string, replaceExisting?: boolean): Promise<{
260
261
  profileId: string;
261
262
  }>;
262
263
  /**
@@ -340,10 +340,11 @@ export class ProfileService extends BaseServiceAbstract {
340
340
  * @param profileData - Robot definition data
341
341
  * @param newName - Optional new name for the robot definition. If not provided, the name from the imported definition will be used.
342
342
  * @param newDescription - Optional new description for the robot definition. If not provided, the description from the imported definition will be used.
343
+ * @param replaceExisting - Move robots from same-named definitions to the import and delete those definitions.
343
344
  *
344
345
  * @see export
345
346
  */
346
- async import(projectId, profileData, newName, newDescription) {
347
+ async import(projectId, profileData, newName, newDescription, replaceExisting) {
347
348
  const formData = new FormData();
348
349
  if (newName) {
349
350
  formData.append('name', newName);
@@ -351,6 +352,9 @@ export class ProfileService extends BaseServiceAbstract {
351
352
  if (newDescription) {
352
353
  formData.append('description', newDescription);
353
354
  }
355
+ if (replaceExisting) {
356
+ formData.append('replaceExisting', 'true');
357
+ }
354
358
  formData.append('file', profileData);
355
359
  return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_IMPORT, { url: this.config.url, projectId }, this.config.insecure), formData, `Failed to import robot definition for ${projectId}.`);
356
360
  }
@@ -361,8 +365,8 @@ export class ProfileService extends BaseServiceAbstract {
361
365
  last_modified: new Date(profile.last_modified),
362
366
  }));
363
367
  }
364
- async importFromLibrary(projectId, profileId, name, description) {
365
- return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_IMPORT_LIBRARY, { url: this.config.url, projectId, profileId }, this.config.insecure), { name, description }, `Failed to import library profile ${profileId} into project ${projectId}.`);
368
+ async importFromLibrary(projectId, profileId, name, description, replaceExisting) {
369
+ return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_IMPORT_LIBRARY, { url: this.config.url, projectId, profileId }, this.config.insecure), { name, description, ...(replaceExisting ? { replaceExisting } : {}) }, `Failed to import library profile ${profileId} into project ${projectId}.`);
366
370
  }
367
371
  /**
368
372
  * Update gamepads for a robot definition
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "4.4.12",
3
+ "version": "4.4.13",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",