@dronedeploy/rocos-js-sdk 3.0.1-alpha.5 → 3.0.1-alpha.6

Sign up to get free protection for your applications and to get access to all the features.
package/cjs/RocosSDK.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, FunctionService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
2
- import { IBaseService, IDebugLevel, IRocosSDKConfig, ServiceEnum } from './models';
2
+ import { AuthorisedConfig, IBaseService, IDebugLevel, IRocosSDKConfig, ServiceEnum } from './models';
3
3
  import { IRocosSDK } from './IRocosSDK';
4
4
  import { Logger } from 'loglevel';
5
5
  export declare class RocosSDK implements IRocosSDK {
@@ -145,4 +145,5 @@ export declare class RocosSDK implements IRocosSDK {
145
145
  */
146
146
  enableDebugMode(on: boolean): void;
147
147
  setDebugLevel(level: IDebugLevel): void;
148
+ protected overrideConfig(service: ServiceEnum): AuthorisedConfig;
148
149
  }
package/cjs/RocosSDK.js CHANGED
@@ -27,84 +27,85 @@ class RocosSDK {
27
27
  getService(name) {
28
28
  if (!this.services?.[name]) {
29
29
  this.logger.info(`Service ${name} does not exist, creating it now.`);
30
+ const config = this.overrideConfig(name);
30
31
  switch (name) {
31
32
  case models_1.ServiceEnum.AUTH:
32
- this.services[name] = new services_1.AuthService(this.config);
33
+ this.services[name] = new services_1.AuthService(config);
33
34
  break;
34
35
  case models_1.ServiceEnum.TELEMETRY:
35
- this.services[name] = new services_1.TelemetryService(this.config);
36
+ this.services[name] = new services_1.TelemetryService(config);
36
37
  break;
37
38
  case models_1.ServiceEnum.ROBOT:
38
- this.services[name] = new services_1.RobotService(this.config);
39
+ this.services[name] = new services_1.RobotService(config);
39
40
  break;
40
41
  case models_1.ServiceEnum.EVENT:
41
- this.services[name] = new services_1.EventService(this.config);
42
+ this.services[name] = new services_1.EventService(config);
42
43
  break;
43
44
  case models_1.ServiceEnum.PROJECT:
44
- this.services[name] = new services_1.ProjectService(this.config);
45
+ this.services[name] = new services_1.ProjectService(config);
45
46
  break;
46
47
  case models_1.ServiceEnum.CALLER:
47
- this.services[name] = new services_1.CallerService(this.config);
48
+ this.services[name] = new services_1.CallerService(config);
48
49
  break;
49
50
  case models_1.ServiceEnum.COMMAND:
50
- this.services[name] = new services_1.CommandService(this.config);
51
+ this.services[name] = new services_1.CommandService(config);
51
52
  break;
52
53
  case models_1.ServiceEnum.CONTROL:
53
- this.services[name] = new services_1.ControlService(this.config);
54
+ this.services[name] = new services_1.ControlService(config);
54
55
  break;
55
56
  case models_1.ServiceEnum.SEARCH:
56
- this.services[name] = new services_1.SearchService(this.config);
57
+ this.services[name] = new services_1.SearchService(config);
57
58
  break;
58
59
  case models_1.ServiceEnum.CONFIG_GROUP:
59
- this.services[name] = new services_1.ConfigGroupService(this.config);
60
+ this.services[name] = new services_1.ConfigGroupService(config);
60
61
  break;
61
62
  case models_1.ServiceEnum.DASHBOARD:
62
- this.services[name] = new services_1.DashboardService(this.config);
63
+ this.services[name] = new services_1.DashboardService(config);
63
64
  break;
64
65
  case models_1.ServiceEnum.FUNCTION:
65
- this.services[name] = new services_1.FunctionService(this.config);
66
+ this.services[name] = new services_1.FunctionService(config);
66
67
  break;
67
68
  case models_1.ServiceEnum.STREAM:
68
- this.services[name] = new services_1.StreamService(this.config);
69
+ this.services[name] = new services_1.StreamService(config);
69
70
  break;
70
71
  case models_1.ServiceEnum.USER:
71
- this.services[name] = new services_1.UserService(this.config);
72
+ this.services[name] = new services_1.UserService(config);
72
73
  break;
73
74
  case models_1.ServiceEnum.TIME_SYNCER:
74
- this.services[name] = new services_1.TimeSyncerService(this.config);
75
+ this.services[name] = new services_1.TimeSyncerService(config);
75
76
  break;
76
77
  case models_1.ServiceEnum.WORKFLOW:
77
- this.services[name] = new services_1.WorkflowService(this.config);
78
+ this.services[name] = new services_1.WorkflowService(config);
78
79
  break;
79
80
  case models_1.ServiceEnum.ASSET_STORAGE:
80
- this.services[name] = new services_1.AssetStorageService(this.config);
81
+ this.services[name] = new services_1.AssetStorageService(config);
81
82
  break;
82
83
  case models_1.ServiceEnum.PROFILE:
83
- this.services[name] = new services_1.ProfileService(this.config);
84
+ this.services[name] = new services_1.ProfileService(config);
84
85
  break;
85
86
  case models_1.ServiceEnum.RTP_WEBRTC:
86
- this.services[name] = new services_1.RTPWebRTCService(this.config);
87
+ this.services[name] = new services_1.RTPWebRTCService(config);
87
88
  break;
88
89
  case models_1.ServiceEnum.WEBRTC_SIGNALLING:
89
- this.services[name] = new services_1.WebRTCSignallingService(this.config);
90
+ this.services[name] = new services_1.WebRTCSignallingService(config);
90
91
  break;
91
92
  case models_1.ServiceEnum.FILE_ACCESSOR:
92
- this.services[name] = new services_1.FileAccessorService(this.config);
93
+ this.services[name] = new services_1.FileAccessorService(config);
93
94
  break;
94
95
  case models_1.ServiceEnum.SCHEDULE:
95
- this.services[name] = new services_1.ScheduleService(this.config);
96
+ this.services[name] = new services_1.ScheduleService(config);
96
97
  break;
97
98
  case models_1.ServiceEnum.SPOT_PROVISIONER:
98
- this.services[name] = new services_1.SpotProvisioningService(this.config);
99
+ this.services[name] = new services_1.SpotProvisioningService(config);
99
100
  break;
100
101
  case models_1.ServiceEnum.INTEGRATION:
101
- this.services[name] = new services_1.IntegrationService(this.config);
102
+ this.services[name] = new services_1.IntegrationService(config);
102
103
  break;
103
104
  case models_1.ServiceEnum.MAP:
104
- this.services[name] = new services_1.MapService(this.config);
105
+ this.services[name] = new services_1.MapService(config);
105
106
  break;
106
107
  case models_1.ServiceEnum.EVALUATOR:
107
- this.services[name] = new services_1.EvaluatorService(this.config);
108
+ this.services[name] = new services_1.EvaluatorService(config);
108
109
  break;
109
110
  }
110
111
  }
@@ -312,5 +313,16 @@ class RocosSDK {
312
313
  setDebugLevel(level) {
313
314
  RocosLogger_1.RocosLogger.setLevel(level);
314
315
  }
316
+ overrideConfig(service) {
317
+ const override = this.config.overrides?.[service];
318
+ if (!override)
319
+ return this.config;
320
+ // strip out the overrides from the config
321
+ const { overrides: _, ...config } = this.config;
322
+ return {
323
+ ...config,
324
+ ...this.config.overrides?.[service],
325
+ };
326
+ }
315
327
  }
316
328
  exports.RocosSDK = RocosSDK;
@@ -13,8 +13,9 @@ class CallerStream extends CallerStreamAbstract_1.CallerStreamAbstract {
13
13
  super(config);
14
14
  this.logger = RocosLogger_1.RocosLogger.getInstance(`CallerStream(${this.identifier})`);
15
15
  const protocol = config.insecure ? 'http' : 'https';
16
+ const port = config.port ? `:${config.port}` : '';
16
17
  const transport = new grpcweb_transport_1.GrpcWebFetchTransport({
17
- baseUrl: `${protocol}://${this.url}`,
18
+ baseUrl: `${protocol}://${this.url}${port}`,
18
19
  });
19
20
  this.client = new serviette_v1_pb_client_1.WebServiceCallerClient(transport);
20
21
  }
@@ -12,8 +12,9 @@ class CommandStream extends CommandStreamAbstract_1.CommandStreamAbstract {
12
12
  super(config);
13
13
  this.logger = RocosLogger_1.RocosLogger.getInstance(`CommandStream(${this.identifier})`);
14
14
  const protocol = config.insecure ? 'http' : 'https';
15
+ const port = config.port ? `:${config.port}` : '';
15
16
  const transport = new grpcweb_transport_1.GrpcWebFetchTransport({
16
- baseUrl: `${protocol}://${this.url}`,
17
+ baseUrl: `${protocol}://${this.url}${port}`,
17
18
  });
18
19
  this.client = new rambo_v1_pb_client_1.CommandClient(transport);
19
20
  }
@@ -13,8 +13,9 @@ class ControlStream extends ControlStreamAbstract_1.ControlStreamAbstract {
13
13
  super(config);
14
14
  this.logger = RocosLogger_1.RocosLogger.getInstance(`ControlStream(${this.identifier})`);
15
15
  const protocol = config.insecure ? 'http' : 'https';
16
+ const port = config.port ? `:${config.port}` : '';
16
17
  const transport = new grpcweb_transport_1.GrpcWebFetchTransport({
17
- baseUrl: `${protocol}://${this.url}`,
18
+ baseUrl: `${protocol}://${this.url}${port}`,
18
19
  });
19
20
  this.client = new conker_pb_client_1.RobotControlClient(transport);
20
21
  }
@@ -12,8 +12,9 @@ class FileAccessorStream extends FileAccessorStreamAbstract_1.FileAccessorStream
12
12
  super(config);
13
13
  this.logger = RocosLogger_1.RocosLogger.getInstance(`FileAccessorStream(${this.identifier})`);
14
14
  const protocol = config.insecure ? 'http' : 'https';
15
+ const port = config.port ? `:${config.port}` : '';
15
16
  const transport = new grpcweb_transport_1.GrpcWebFetchTransport({
16
- baseUrl: `${protocol}://${this.url}`,
17
+ baseUrl: `${protocol}://${this.url}${port}`,
17
18
  });
18
19
  this.client = new filagree_pb_client_1.FilagreeClient(transport);
19
20
  }
@@ -13,8 +13,9 @@ class SearchStream extends SearchStreamAbstract_1.SearchStreamAbstract {
13
13
  super(config);
14
14
  this.logger = RocosLogger_1.RocosLogger.getInstance(`SearchStream(${this.identifier})`);
15
15
  const protocol = config.insecure ? 'http' : 'https';
16
+ const port = config.port ? `:${config.port}` : '';
16
17
  const transport = new grpcweb_transport_1.GrpcWebFetchTransport({
17
- baseUrl: `${protocol}://${this.url}`,
18
+ baseUrl: `${protocol}://${this.url}${port}`,
18
19
  });
19
20
  this.client = new slowlane_pb_client_1.streamClient(transport);
20
21
  }
@@ -12,8 +12,9 @@ class TelemetryStream extends TelemetryStreamAbstract_1.TelemetryStreamAbstract
12
12
  super(config);
13
13
  this.logger = RocosLogger_1.RocosLogger.getInstance(`TelemetryStreamWeb(${this.identifier})`);
14
14
  const protocol = config.insecure ? 'http' : 'https';
15
+ const port = config.port ? `:${config.port}` : '';
15
16
  const transport = new grpcweb_transport_1.GrpcWebFetchTransport({
16
- baseUrl: `${protocol}://${this.url}`,
17
+ baseUrl: `${protocol}://${this.url}${port}`,
17
18
  });
18
19
  this.client = new teletubby_pb_client_1.TelemetryGatewayClient(transport);
19
20
  }
@@ -13,8 +13,9 @@ class WebRTCSignallingStream extends WebRTCSignallingStreamAbstract_1.WebRTCSign
13
13
  super(config);
14
14
  this.logger = RocosLogger_1.RocosLogger.getInstance(`WebRTCSignallingStream(${this.identifier})`);
15
15
  const protocol = config.insecure ? 'http' : 'https';
16
+ const port = config.port ? `:${config.port}` : '';
16
17
  const transport = new grpcweb_transport_1.GrpcWebFetchTransport({
17
- baseUrl: `${protocol}://${this.url}`,
18
+ baseUrl: `${protocol}://${this.url}${port}`,
18
19
  });
19
20
  this.webRTCOperatorclient = new pigeon_pb_client_1.operatorClient(transport);
20
21
  }
@@ -1,6 +1,9 @@
1
1
  import { IStreamOptions } from './IStreamOptions';
2
- export type IRocosSDKConfig = IRocosSDKConfigApp | IRocosSDKConfigToken;
3
- interface IRocosSDKConfigBase {
2
+ import { ServiceEnum } from './ServiceEnum';
3
+ export type IRocosSDKConfig = AuthorisedConfig & {
4
+ overrides?: Partial<Record<ServiceEnum, Partial<AuthorisedConfig>>>;
5
+ };
6
+ interface ConfigBase {
4
7
  url: string;
5
8
  token?: string;
6
9
  refreshToken?: string;
@@ -8,12 +11,13 @@ interface IRocosSDKConfigBase {
8
11
  port?: number;
9
12
  insecure?: boolean;
10
13
  }
11
- export interface IRocosSDKConfigApp extends IRocosSDKConfigBase {
14
+ export interface IRocosSDKConfigApp extends ConfigBase {
12
15
  appId: string;
13
16
  appKey: string;
14
17
  }
15
- export interface IRocosSDKConfigToken extends IRocosSDKConfigBase {
18
+ export interface IRocosSDKConfigToken extends ConfigBase {
16
19
  token: string;
17
20
  refreshToken?: string;
18
21
  }
22
+ export type AuthorisedConfig = IRocosSDKConfigApp | IRocosSDKConfigToken;
19
23
  export {};
@@ -1,12 +1,11 @@
1
1
  import { EvaluatorService, ScheduleService } from '../services';
2
+ import { IBaseService, ServiceEnum } from '../models';
2
3
  import { CallerServiceNode } from '../services/CallerServiceNode';
3
4
  import { CommandServiceNode } from '../services/CommandServiceNode';
4
5
  import { ControlServiceNode } from '../services/ControlServiceNode';
5
6
  import { FileAccessorServiceNode } from '../services/FileAccessorServiceNode';
6
- import { IBaseService } from '../models/IBaseService';
7
7
  import { RocosSDK } from '../RocosSDK';
8
8
  import { SearchServiceNode } from '../services/SearchServiceNode';
9
- import { ServiceEnum } from '../models/ServiceEnum';
10
9
  import { TelemetryServiceNode } from '../services/TelemetryServiceNode';
11
10
  export declare class RocosSDKNode extends RocosSDK {
12
11
  getService<T extends IBaseService>(name: ServiceEnum): T;
@@ -2,98 +2,86 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RocosSDKNode = void 0;
4
4
  const services_1 = require("../services");
5
- const AssetStorageService_1 = require("../services/AssetStorageService");
6
- const AuthService_1 = require("../services/AuthService");
5
+ const models_1 = require("../models");
7
6
  const CallerServiceNode_1 = require("../services/CallerServiceNode");
8
7
  const CommandServiceNode_1 = require("../services/CommandServiceNode");
9
- const ConfigGroupService_1 = require("../services/ConfigGroupService");
10
8
  const ControlServiceNode_1 = require("../services/ControlServiceNode");
11
- const DashboardService_1 = require("../services/DashboardService");
12
- const EventService_1 = require("../services/EventService");
13
9
  const FileAccessorServiceNode_1 = require("../services/FileAccessorServiceNode");
14
- const FunctionService_1 = require("../services/FunctionService");
15
- const IntegrationService_1 = require("../services/IntegrationService");
16
- const ProfileService_1 = require("../services/ProfileService");
17
- const ProjectService_1 = require("../services/ProjectService");
18
- const RobotService_1 = require("../services/RobotService");
19
10
  const RocosSDK_1 = require("../RocosSDK");
20
11
  const SearchServiceNode_1 = require("../services/SearchServiceNode");
21
- const ServiceEnum_1 = require("../models/ServiceEnum");
22
- const StreamService_1 = require("../services/StreamService");
23
12
  const TelemetryServiceNode_1 = require("../services/TelemetryServiceNode");
24
- const UserService_1 = require("../services/UserService");
25
- const WorkflowService_1 = require("../services/WorkflowService");
26
13
  class RocosSDKNode extends RocosSDK_1.RocosSDK {
27
14
  // eslint-disable-next-line max-lines-per-function
28
15
  getService(name) {
29
16
  if (!this.services?.[name]) {
30
17
  this.logger.info(`Service ${name} does not exist, creating it now.`);
18
+ const config = this.overrideConfig(name);
31
19
  switch (name) {
32
- case ServiceEnum_1.ServiceEnum.AUTH:
33
- this.services[name] = new AuthService_1.AuthService(this.config);
20
+ case models_1.ServiceEnum.AUTH:
21
+ this.services[name] = new services_1.AuthService(config);
34
22
  break;
35
- case ServiceEnum_1.ServiceEnum.TELEMETRY:
36
- this.services[name] = new TelemetryServiceNode_1.TelemetryServiceNode(this.config);
23
+ case models_1.ServiceEnum.TELEMETRY:
24
+ this.services[name] = new TelemetryServiceNode_1.TelemetryServiceNode(config);
37
25
  break;
38
- case ServiceEnum_1.ServiceEnum.ROBOT:
39
- this.services[name] = new RobotService_1.RobotService(this.config);
26
+ case models_1.ServiceEnum.ROBOT:
27
+ this.services[name] = new services_1.RobotService(config);
40
28
  break;
41
- case ServiceEnum_1.ServiceEnum.EVENT:
42
- this.services[name] = new EventService_1.EventService(this.config);
29
+ case models_1.ServiceEnum.EVENT:
30
+ this.services[name] = new services_1.EventService(config);
43
31
  break;
44
- case ServiceEnum_1.ServiceEnum.PROJECT:
45
- this.services[name] = new ProjectService_1.ProjectService(this.config);
32
+ case models_1.ServiceEnum.PROJECT:
33
+ this.services[name] = new services_1.ProjectService(config);
46
34
  break;
47
- case ServiceEnum_1.ServiceEnum.CALLER:
48
- this.services[name] = new CallerServiceNode_1.CallerServiceNode(this.config);
35
+ case models_1.ServiceEnum.CALLER:
36
+ this.services[name] = new CallerServiceNode_1.CallerServiceNode(config);
49
37
  break;
50
- case ServiceEnum_1.ServiceEnum.COMMAND:
51
- this.services[name] = new CommandServiceNode_1.CommandServiceNode(this.config);
38
+ case models_1.ServiceEnum.COMMAND:
39
+ this.services[name] = new CommandServiceNode_1.CommandServiceNode(config);
52
40
  break;
53
- case ServiceEnum_1.ServiceEnum.CONTROL:
54
- this.services[name] = new ControlServiceNode_1.ControlServiceNode(this.config);
41
+ case models_1.ServiceEnum.CONTROL:
42
+ this.services[name] = new ControlServiceNode_1.ControlServiceNode(config);
55
43
  break;
56
- case ServiceEnum_1.ServiceEnum.SEARCH:
57
- this.services[name] = new SearchServiceNode_1.SearchServiceNode(this.config);
44
+ case models_1.ServiceEnum.SEARCH:
45
+ this.services[name] = new SearchServiceNode_1.SearchServiceNode(config);
58
46
  break;
59
- case ServiceEnum_1.ServiceEnum.CONFIG_GROUP:
60
- this.services[name] = new ConfigGroupService_1.ConfigGroupService(this.config);
47
+ case models_1.ServiceEnum.CONFIG_GROUP:
48
+ this.services[name] = new services_1.ConfigGroupService(config);
61
49
  break;
62
- case ServiceEnum_1.ServiceEnum.DASHBOARD:
63
- this.services[name] = new DashboardService_1.DashboardService(this.config);
50
+ case models_1.ServiceEnum.DASHBOARD:
51
+ this.services[name] = new services_1.DashboardService(config);
64
52
  break;
65
- case ServiceEnum_1.ServiceEnum.FUNCTION:
66
- this.services[name] = new FunctionService_1.FunctionService(this.config);
53
+ case models_1.ServiceEnum.FUNCTION:
54
+ this.services[name] = new services_1.FunctionService(config);
67
55
  break;
68
- case ServiceEnum_1.ServiceEnum.STREAM:
69
- this.services[name] = new StreamService_1.StreamService(this.config);
56
+ case models_1.ServiceEnum.STREAM:
57
+ this.services[name] = new services_1.StreamService(config);
70
58
  break;
71
- case ServiceEnum_1.ServiceEnum.USER:
72
- this.services[name] = new UserService_1.UserService(this.config);
59
+ case models_1.ServiceEnum.USER:
60
+ this.services[name] = new services_1.UserService(config);
73
61
  break;
74
- case ServiceEnum_1.ServiceEnum.WORKFLOW:
75
- this.services[name] = new WorkflowService_1.WorkflowService(this.config);
62
+ case models_1.ServiceEnum.WORKFLOW:
63
+ this.services[name] = new services_1.WorkflowService(config);
76
64
  break;
77
- case ServiceEnum_1.ServiceEnum.ASSET_STORAGE:
78
- this.services[name] = new AssetStorageService_1.AssetStorageService(this.config);
65
+ case models_1.ServiceEnum.ASSET_STORAGE:
66
+ this.services[name] = new services_1.AssetStorageService(config);
79
67
  break;
80
- case ServiceEnum_1.ServiceEnum.PROFILE:
81
- this.services[name] = new ProfileService_1.ProfileService(this.config);
68
+ case models_1.ServiceEnum.PROFILE:
69
+ this.services[name] = new services_1.ProfileService(config);
82
70
  break;
83
- case ServiceEnum_1.ServiceEnum.FILE_ACCESSOR:
84
- this.services[name] = new FileAccessorServiceNode_1.FileAccessorServiceNode(this.config);
71
+ case models_1.ServiceEnum.FILE_ACCESSOR:
72
+ this.services[name] = new FileAccessorServiceNode_1.FileAccessorServiceNode(config);
85
73
  break;
86
- case ServiceEnum_1.ServiceEnum.SPOT_PROVISIONER:
87
- this.services[name] = new services_1.SpotProvisioningServiceNode(this.config);
74
+ case models_1.ServiceEnum.SPOT_PROVISIONER:
75
+ this.services[name] = new services_1.SpotProvisioningServiceNode(config);
88
76
  break;
89
- case ServiceEnum_1.ServiceEnum.SCHEDULE:
90
- this.services[name] = new services_1.ScheduleService(this.config);
77
+ case models_1.ServiceEnum.SCHEDULE:
78
+ this.services[name] = new services_1.ScheduleService(config);
91
79
  break;
92
- case ServiceEnum_1.ServiceEnum.INTEGRATION:
93
- this.services[name] = new IntegrationService_1.IntegrationService(this.config);
80
+ case models_1.ServiceEnum.INTEGRATION:
81
+ this.services[name] = new services_1.IntegrationService(config);
94
82
  break;
95
- case ServiceEnum_1.ServiceEnum.MAP:
96
- this.services[name] = new services_1.MapService(this.config);
83
+ case models_1.ServiceEnum.MAP:
84
+ this.services[name] = new services_1.MapService(config);
97
85
  break;
98
86
  }
99
87
  }
@@ -104,44 +92,44 @@ class RocosSDKNode extends RocosSDK_1.RocosSDK {
104
92
  * Gets the telemetry service.
105
93
  */
106
94
  getTelemetryService() {
107
- return this.getService(ServiceEnum_1.ServiceEnum.TELEMETRY);
95
+ return this.getService(models_1.ServiceEnum.TELEMETRY);
108
96
  }
109
97
  /**
110
98
  * Gets the scheduler service.
111
99
  */
112
100
  getSchedulerService() {
113
- return this.getService(ServiceEnum_1.ServiceEnum.SCHEDULE);
101
+ return this.getService(models_1.ServiceEnum.SCHEDULE);
114
102
  }
115
103
  /**
116
104
  * Gets the service call service.
117
105
  */
118
106
  getCallerService() {
119
- return this.getService(ServiceEnum_1.ServiceEnum.CALLER);
107
+ return this.getService(models_1.ServiceEnum.CALLER);
120
108
  }
121
109
  /**
122
110
  * Gets the command service.
123
111
  */
124
112
  getCommandService() {
125
- return this.getService(ServiceEnum_1.ServiceEnum.COMMAND);
113
+ return this.getService(models_1.ServiceEnum.COMMAND);
126
114
  }
127
115
  /**
128
116
  * Gets the robot control service.
129
117
  */
130
118
  getControlService() {
131
- return this.getService(ServiceEnum_1.ServiceEnum.CONTROL);
119
+ return this.getService(models_1.ServiceEnum.CONTROL);
132
120
  }
133
121
  /**
134
122
  * Gets the search service.
135
123
  */
136
124
  getSearchService() {
137
- return this.getService(ServiceEnum_1.ServiceEnum.SEARCH);
125
+ return this.getService(models_1.ServiceEnum.SEARCH);
138
126
  }
139
127
  /**
140
128
  * Gets the file accessor service
141
129
  * @returns FileAccessorServiceNode
142
130
  */
143
131
  getFileAccessorService() {
144
- return this.getService(ServiceEnum_1.ServiceEnum.FILE_ACCESSOR);
132
+ return this.getService(models_1.ServiceEnum.FILE_ACCESSOR);
145
133
  }
146
134
  /**
147
135
  * Gets the evaluator service
@@ -211,7 +211,7 @@ class AssetStorageService extends BaseServiceAbstract_1.BaseServiceAbstract {
211
211
  * @param integration
212
212
  */
213
213
  updateSyncIntegration(projectId, integrationId, integration) {
214
- return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ASSET_INTEGRATION_PATH_URL, { url: this.config.url, projectId, integrationId: integrationId }, this.config.insecure), integration, `Failed to update asset sync integrations for ${projectId}.`);
214
+ return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ASSET_INTEGRATION_PATH_URL, { url: this.config.url, projectId, integrationId }, this.config.insecure), integration, `Failed to update asset sync integrations for ${projectId}.`);
215
215
  }
216
216
  /**
217
217
  * Delete a Sync Integration
@@ -17,6 +17,8 @@ class BaseStreamService {
17
17
  return this.status;
18
18
  }
19
19
  async initStream(stream) {
20
+ if (this.config.insecure)
21
+ return; // no need to init auth for insecure connections
20
22
  const authService = RocosStore_1.RocosStore.getSDKInstance(this.config).getAuthService();
21
23
  if (!this.config.token || !authService.isTokenValid(new models_1.Token(this.config.token))) {
22
24
  try {
package/esm/RocosSDK.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, FunctionService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
2
- import { IBaseService, IDebugLevel, IRocosSDKConfig, ServiceEnum } from './models';
2
+ import { AuthorisedConfig, IBaseService, IDebugLevel, IRocosSDKConfig, ServiceEnum } from './models';
3
3
  import { IRocosSDK } from './IRocosSDK';
4
4
  import { Logger } from 'loglevel';
5
5
  export declare class RocosSDK implements IRocosSDK {
@@ -145,4 +145,5 @@ export declare class RocosSDK implements IRocosSDK {
145
145
  */
146
146
  enableDebugMode(on: boolean): void;
147
147
  setDebugLevel(level: IDebugLevel): void;
148
+ protected overrideConfig(service: ServiceEnum): AuthorisedConfig;
148
149
  }
package/esm/RocosSDK.js CHANGED
@@ -24,84 +24,85 @@ export class RocosSDK {
24
24
  getService(name) {
25
25
  if (!this.services?.[name]) {
26
26
  this.logger.info(`Service ${name} does not exist, creating it now.`);
27
+ const config = this.overrideConfig(name);
27
28
  switch (name) {
28
29
  case ServiceEnum.AUTH:
29
- this.services[name] = new AuthService(this.config);
30
+ this.services[name] = new AuthService(config);
30
31
  break;
31
32
  case ServiceEnum.TELEMETRY:
32
- this.services[name] = new TelemetryService(this.config);
33
+ this.services[name] = new TelemetryService(config);
33
34
  break;
34
35
  case ServiceEnum.ROBOT:
35
- this.services[name] = new RobotService(this.config);
36
+ this.services[name] = new RobotService(config);
36
37
  break;
37
38
  case ServiceEnum.EVENT:
38
- this.services[name] = new EventService(this.config);
39
+ this.services[name] = new EventService(config);
39
40
  break;
40
41
  case ServiceEnum.PROJECT:
41
- this.services[name] = new ProjectService(this.config);
42
+ this.services[name] = new ProjectService(config);
42
43
  break;
43
44
  case ServiceEnum.CALLER:
44
- this.services[name] = new CallerService(this.config);
45
+ this.services[name] = new CallerService(config);
45
46
  break;
46
47
  case ServiceEnum.COMMAND:
47
- this.services[name] = new CommandService(this.config);
48
+ this.services[name] = new CommandService(config);
48
49
  break;
49
50
  case ServiceEnum.CONTROL:
50
- this.services[name] = new ControlService(this.config);
51
+ this.services[name] = new ControlService(config);
51
52
  break;
52
53
  case ServiceEnum.SEARCH:
53
- this.services[name] = new SearchService(this.config);
54
+ this.services[name] = new SearchService(config);
54
55
  break;
55
56
  case ServiceEnum.CONFIG_GROUP:
56
- this.services[name] = new ConfigGroupService(this.config);
57
+ this.services[name] = new ConfigGroupService(config);
57
58
  break;
58
59
  case ServiceEnum.DASHBOARD:
59
- this.services[name] = new DashboardService(this.config);
60
+ this.services[name] = new DashboardService(config);
60
61
  break;
61
62
  case ServiceEnum.FUNCTION:
62
- this.services[name] = new FunctionService(this.config);
63
+ this.services[name] = new FunctionService(config);
63
64
  break;
64
65
  case ServiceEnum.STREAM:
65
- this.services[name] = new StreamService(this.config);
66
+ this.services[name] = new StreamService(config);
66
67
  break;
67
68
  case ServiceEnum.USER:
68
- this.services[name] = new UserService(this.config);
69
+ this.services[name] = new UserService(config);
69
70
  break;
70
71
  case ServiceEnum.TIME_SYNCER:
71
- this.services[name] = new TimeSyncerService(this.config);
72
+ this.services[name] = new TimeSyncerService(config);
72
73
  break;
73
74
  case ServiceEnum.WORKFLOW:
74
- this.services[name] = new WorkflowService(this.config);
75
+ this.services[name] = new WorkflowService(config);
75
76
  break;
76
77
  case ServiceEnum.ASSET_STORAGE:
77
- this.services[name] = new AssetStorageService(this.config);
78
+ this.services[name] = new AssetStorageService(config);
78
79
  break;
79
80
  case ServiceEnum.PROFILE:
80
- this.services[name] = new ProfileService(this.config);
81
+ this.services[name] = new ProfileService(config);
81
82
  break;
82
83
  case ServiceEnum.RTP_WEBRTC:
83
- this.services[name] = new RTPWebRTCService(this.config);
84
+ this.services[name] = new RTPWebRTCService(config);
84
85
  break;
85
86
  case ServiceEnum.WEBRTC_SIGNALLING:
86
- this.services[name] = new WebRTCSignallingService(this.config);
87
+ this.services[name] = new WebRTCSignallingService(config);
87
88
  break;
88
89
  case ServiceEnum.FILE_ACCESSOR:
89
- this.services[name] = new FileAccessorService(this.config);
90
+ this.services[name] = new FileAccessorService(config);
90
91
  break;
91
92
  case ServiceEnum.SCHEDULE:
92
- this.services[name] = new ScheduleService(this.config);
93
+ this.services[name] = new ScheduleService(config);
93
94
  break;
94
95
  case ServiceEnum.SPOT_PROVISIONER:
95
- this.services[name] = new SpotProvisioningService(this.config);
96
+ this.services[name] = new SpotProvisioningService(config);
96
97
  break;
97
98
  case ServiceEnum.INTEGRATION:
98
- this.services[name] = new IntegrationService(this.config);
99
+ this.services[name] = new IntegrationService(config);
99
100
  break;
100
101
  case ServiceEnum.MAP:
101
- this.services[name] = new MapService(this.config);
102
+ this.services[name] = new MapService(config);
102
103
  break;
103
104
  case ServiceEnum.EVALUATOR:
104
- this.services[name] = new EvaluatorService(this.config);
105
+ this.services[name] = new EvaluatorService(config);
105
106
  break;
106
107
  }
107
108
  }
@@ -309,4 +310,15 @@ export class RocosSDK {
309
310
  setDebugLevel(level) {
310
311
  RocosLogger.setLevel(level);
311
312
  }
313
+ overrideConfig(service) {
314
+ const override = this.config.overrides?.[service];
315
+ if (!override)
316
+ return this.config;
317
+ // strip out the overrides from the config
318
+ const { overrides: _, ...config } = this.config;
319
+ return {
320
+ ...config,
321
+ ...this.config.overrides?.[service],
322
+ };
323
+ }
312
324
  }
@@ -10,8 +10,9 @@ export class CallerStream extends CallerStreamAbstract {
10
10
  super(config);
11
11
  this.logger = RocosLogger.getInstance(`CallerStream(${this.identifier})`);
12
12
  const protocol = config.insecure ? 'http' : 'https';
13
+ const port = config.port ? `:${config.port}` : '';
13
14
  const transport = new GrpcWebFetchTransport({
14
- baseUrl: `${protocol}://${this.url}`,
15
+ baseUrl: `${protocol}://${this.url}${port}`,
15
16
  });
16
17
  this.client = new WebServiceCallerClient(transport);
17
18
  }
@@ -9,8 +9,9 @@ export class CommandStream extends CommandStreamAbstract {
9
9
  super(config);
10
10
  this.logger = RocosLogger.getInstance(`CommandStream(${this.identifier})`);
11
11
  const protocol = config.insecure ? 'http' : 'https';
12
+ const port = config.port ? `:${config.port}` : '';
12
13
  const transport = new GrpcWebFetchTransport({
13
- baseUrl: `${protocol}://${this.url}`,
14
+ baseUrl: `${protocol}://${this.url}${port}`,
14
15
  });
15
16
  this.client = new CommandClient(transport);
16
17
  }
@@ -10,8 +10,9 @@ export class ControlStream extends ControlStreamAbstract {
10
10
  super(config);
11
11
  this.logger = RocosLogger.getInstance(`ControlStream(${this.identifier})`);
12
12
  const protocol = config.insecure ? 'http' : 'https';
13
+ const port = config.port ? `:${config.port}` : '';
13
14
  const transport = new GrpcWebFetchTransport({
14
- baseUrl: `${protocol}://${this.url}`,
15
+ baseUrl: `${protocol}://${this.url}${port}`,
15
16
  });
16
17
  this.client = new RobotControlClient(transport);
17
18
  }
@@ -9,8 +9,9 @@ export class FileAccessorStream extends FileAccessorStreamAbstract {
9
9
  super(config);
10
10
  this.logger = RocosLogger.getInstance(`FileAccessorStream(${this.identifier})`);
11
11
  const protocol = config.insecure ? 'http' : 'https';
12
+ const port = config.port ? `:${config.port}` : '';
12
13
  const transport = new GrpcWebFetchTransport({
13
- baseUrl: `${protocol}://${this.url}`,
14
+ baseUrl: `${protocol}://${this.url}${port}`,
14
15
  });
15
16
  this.client = new FilagreeClient(transport);
16
17
  }
@@ -10,8 +10,9 @@ export class SearchStream extends SearchStreamAbstract {
10
10
  super(config);
11
11
  this.logger = RocosLogger.getInstance(`SearchStream(${this.identifier})`);
12
12
  const protocol = config.insecure ? 'http' : 'https';
13
+ const port = config.port ? `:${config.port}` : '';
13
14
  const transport = new GrpcWebFetchTransport({
14
- baseUrl: `${protocol}://${this.url}`,
15
+ baseUrl: `${protocol}://${this.url}${port}`,
15
16
  });
16
17
  this.client = new streamClient(transport);
17
18
  }
@@ -9,8 +9,9 @@ export class TelemetryStream extends TelemetryStreamAbstract {
9
9
  super(config);
10
10
  this.logger = RocosLogger.getInstance(`TelemetryStreamWeb(${this.identifier})`);
11
11
  const protocol = config.insecure ? 'http' : 'https';
12
+ const port = config.port ? `:${config.port}` : '';
12
13
  const transport = new GrpcWebFetchTransport({
13
- baseUrl: `${protocol}://${this.url}`,
14
+ baseUrl: `${protocol}://${this.url}${port}`,
14
15
  });
15
16
  this.client = new TelemetryGatewayClient(transport);
16
17
  }
@@ -10,8 +10,9 @@ export class WebRTCSignallingStream extends WebRTCSignallingStreamAbstract {
10
10
  super(config);
11
11
  this.logger = RocosLogger.getInstance(`WebRTCSignallingStream(${this.identifier})`);
12
12
  const protocol = config.insecure ? 'http' : 'https';
13
+ const port = config.port ? `:${config.port}` : '';
13
14
  const transport = new GrpcWebFetchTransport({
14
- baseUrl: `${protocol}://${this.url}`,
15
+ baseUrl: `${protocol}://${this.url}${port}`,
15
16
  });
16
17
  this.webRTCOperatorclient = new operatorClient(transport);
17
18
  }
@@ -1,6 +1,9 @@
1
1
  import { IStreamOptions } from './IStreamOptions';
2
- export type IRocosSDKConfig = IRocosSDKConfigApp | IRocosSDKConfigToken;
3
- interface IRocosSDKConfigBase {
2
+ import { ServiceEnum } from './ServiceEnum';
3
+ export type IRocosSDKConfig = AuthorisedConfig & {
4
+ overrides?: Partial<Record<ServiceEnum, Partial<AuthorisedConfig>>>;
5
+ };
6
+ interface ConfigBase {
4
7
  url: string;
5
8
  token?: string;
6
9
  refreshToken?: string;
@@ -8,12 +11,13 @@ interface IRocosSDKConfigBase {
8
11
  port?: number;
9
12
  insecure?: boolean;
10
13
  }
11
- export interface IRocosSDKConfigApp extends IRocosSDKConfigBase {
14
+ export interface IRocosSDKConfigApp extends ConfigBase {
12
15
  appId: string;
13
16
  appKey: string;
14
17
  }
15
- export interface IRocosSDKConfigToken extends IRocosSDKConfigBase {
18
+ export interface IRocosSDKConfigToken extends ConfigBase {
16
19
  token: string;
17
20
  refreshToken?: string;
18
21
  }
22
+ export type AuthorisedConfig = IRocosSDKConfigApp | IRocosSDKConfigToken;
19
23
  export {};
@@ -1,12 +1,11 @@
1
1
  import { EvaluatorService, ScheduleService } from '../services';
2
+ import { IBaseService, ServiceEnum } from '../models';
2
3
  import { CallerServiceNode } from '../services/CallerServiceNode';
3
4
  import { CommandServiceNode } from '../services/CommandServiceNode';
4
5
  import { ControlServiceNode } from '../services/ControlServiceNode';
5
6
  import { FileAccessorServiceNode } from '../services/FileAccessorServiceNode';
6
- import { IBaseService } from '../models/IBaseService';
7
7
  import { RocosSDK } from '../RocosSDK';
8
8
  import { SearchServiceNode } from '../services/SearchServiceNode';
9
- import { ServiceEnum } from '../models/ServiceEnum';
10
9
  import { TelemetryServiceNode } from '../services/TelemetryServiceNode';
11
10
  export declare class RocosSDKNode extends RocosSDK {
12
11
  getService<T extends IBaseService>(name: ServiceEnum): T;
@@ -1,96 +1,84 @@
1
- import { MapService, ScheduleService, SpotProvisioningServiceNode } from '../services';
2
- import { AssetStorageService } from '../services/AssetStorageService';
3
- import { AuthService } from '../services/AuthService';
1
+ import { AssetStorageService, AuthService, ConfigGroupService, DashboardService, EventService, FunctionService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, ScheduleService, SpotProvisioningServiceNode, StreamService, UserService, WorkflowService, } from '../services';
2
+ import { ServiceEnum } from '../models';
4
3
  import { CallerServiceNode } from '../services/CallerServiceNode';
5
4
  import { CommandServiceNode } from '../services/CommandServiceNode';
6
- import { ConfigGroupService } from '../services/ConfigGroupService';
7
5
  import { ControlServiceNode } from '../services/ControlServiceNode';
8
- import { DashboardService } from '../services/DashboardService';
9
- import { EventService } from '../services/EventService';
10
6
  import { FileAccessorServiceNode } from '../services/FileAccessorServiceNode';
11
- import { FunctionService } from '../services/FunctionService';
12
- import { IntegrationService } from '../services/IntegrationService';
13
- import { ProfileService } from '../services/ProfileService';
14
- import { ProjectService } from '../services/ProjectService';
15
- import { RobotService } from '../services/RobotService';
16
7
  import { RocosSDK } from '../RocosSDK';
17
8
  import { SearchServiceNode } from '../services/SearchServiceNode';
18
- import { ServiceEnum } from '../models/ServiceEnum';
19
- import { StreamService } from '../services/StreamService';
20
9
  import { TelemetryServiceNode } from '../services/TelemetryServiceNode';
21
- import { UserService } from '../services/UserService';
22
- import { WorkflowService } from '../services/WorkflowService';
23
10
  export class RocosSDKNode extends RocosSDK {
24
11
  // eslint-disable-next-line max-lines-per-function
25
12
  getService(name) {
26
13
  if (!this.services?.[name]) {
27
14
  this.logger.info(`Service ${name} does not exist, creating it now.`);
15
+ const config = this.overrideConfig(name);
28
16
  switch (name) {
29
17
  case ServiceEnum.AUTH:
30
- this.services[name] = new AuthService(this.config);
18
+ this.services[name] = new AuthService(config);
31
19
  break;
32
20
  case ServiceEnum.TELEMETRY:
33
- this.services[name] = new TelemetryServiceNode(this.config);
21
+ this.services[name] = new TelemetryServiceNode(config);
34
22
  break;
35
23
  case ServiceEnum.ROBOT:
36
- this.services[name] = new RobotService(this.config);
24
+ this.services[name] = new RobotService(config);
37
25
  break;
38
26
  case ServiceEnum.EVENT:
39
- this.services[name] = new EventService(this.config);
27
+ this.services[name] = new EventService(config);
40
28
  break;
41
29
  case ServiceEnum.PROJECT:
42
- this.services[name] = new ProjectService(this.config);
30
+ this.services[name] = new ProjectService(config);
43
31
  break;
44
32
  case ServiceEnum.CALLER:
45
- this.services[name] = new CallerServiceNode(this.config);
33
+ this.services[name] = new CallerServiceNode(config);
46
34
  break;
47
35
  case ServiceEnum.COMMAND:
48
- this.services[name] = new CommandServiceNode(this.config);
36
+ this.services[name] = new CommandServiceNode(config);
49
37
  break;
50
38
  case ServiceEnum.CONTROL:
51
- this.services[name] = new ControlServiceNode(this.config);
39
+ this.services[name] = new ControlServiceNode(config);
52
40
  break;
53
41
  case ServiceEnum.SEARCH:
54
- this.services[name] = new SearchServiceNode(this.config);
42
+ this.services[name] = new SearchServiceNode(config);
55
43
  break;
56
44
  case ServiceEnum.CONFIG_GROUP:
57
- this.services[name] = new ConfigGroupService(this.config);
45
+ this.services[name] = new ConfigGroupService(config);
58
46
  break;
59
47
  case ServiceEnum.DASHBOARD:
60
- this.services[name] = new DashboardService(this.config);
48
+ this.services[name] = new DashboardService(config);
61
49
  break;
62
50
  case ServiceEnum.FUNCTION:
63
- this.services[name] = new FunctionService(this.config);
51
+ this.services[name] = new FunctionService(config);
64
52
  break;
65
53
  case ServiceEnum.STREAM:
66
- this.services[name] = new StreamService(this.config);
54
+ this.services[name] = new StreamService(config);
67
55
  break;
68
56
  case ServiceEnum.USER:
69
- this.services[name] = new UserService(this.config);
57
+ this.services[name] = new UserService(config);
70
58
  break;
71
59
  case ServiceEnum.WORKFLOW:
72
- this.services[name] = new WorkflowService(this.config);
60
+ this.services[name] = new WorkflowService(config);
73
61
  break;
74
62
  case ServiceEnum.ASSET_STORAGE:
75
- this.services[name] = new AssetStorageService(this.config);
63
+ this.services[name] = new AssetStorageService(config);
76
64
  break;
77
65
  case ServiceEnum.PROFILE:
78
- this.services[name] = new ProfileService(this.config);
66
+ this.services[name] = new ProfileService(config);
79
67
  break;
80
68
  case ServiceEnum.FILE_ACCESSOR:
81
- this.services[name] = new FileAccessorServiceNode(this.config);
69
+ this.services[name] = new FileAccessorServiceNode(config);
82
70
  break;
83
71
  case ServiceEnum.SPOT_PROVISIONER:
84
- this.services[name] = new SpotProvisioningServiceNode(this.config);
72
+ this.services[name] = new SpotProvisioningServiceNode(config);
85
73
  break;
86
74
  case ServiceEnum.SCHEDULE:
87
- this.services[name] = new ScheduleService(this.config);
75
+ this.services[name] = new ScheduleService(config);
88
76
  break;
89
77
  case ServiceEnum.INTEGRATION:
90
- this.services[name] = new IntegrationService(this.config);
78
+ this.services[name] = new IntegrationService(config);
91
79
  break;
92
80
  case ServiceEnum.MAP:
93
- this.services[name] = new MapService(this.config);
81
+ this.services[name] = new MapService(config);
94
82
  break;
95
83
  }
96
84
  }
@@ -1,5 +1,5 @@
1
- import { API_PROJECT_ASSET_INTEGRATION_PATH_URL, API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL, API_PROJECT_ASSET_INTEGRATIONS_PATH_URL, API_PROJECT_ASSET_PATH_URL, API_PROJECT_ASSET_PROFILES_SYNC_DEFINITION_PATH_URL, API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL, API_PROJECT_ASSET_URL, API_PROJECT_FLOW_ASSET_PATH_URL, API_PROJECT_MAPPED_ASSETS_PATH_URL, API_PROJECT_MISSION_ASSET_PATH_URL, API_PROJECT_MISSION_ASSETS_PATH_URL, API_PROJECT_ROBOT_ASSET_PATH_URL, } from '../constants/api';
2
- import { errorCodes, RocosError } from '../models/RocosError';
1
+ import { API_PROJECT_ASSET_INTEGRATIONS_PATH_URL, API_PROJECT_ASSET_INTEGRATION_PATH_URL, API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL, API_PROJECT_ASSET_PATH_URL, API_PROJECT_ASSET_PROFILES_SYNC_DEFINITION_PATH_URL, API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL, API_PROJECT_ASSET_URL, API_PROJECT_FLOW_ASSET_PATH_URL, API_PROJECT_MAPPED_ASSETS_PATH_URL, API_PROJECT_MISSION_ASSETS_PATH_URL, API_PROJECT_MISSION_ASSET_PATH_URL, API_PROJECT_ROBOT_ASSET_PATH_URL, } from '../constants/api';
2
+ import { RocosError, errorCodes } from '../models/RocosError';
3
3
  import { BaseServiceAbstract } from './BaseServiceAbstract';
4
4
  import { RocosLogger } from '../logger/RocosLogger';
5
5
  import { formatServiceUrl } from '../helpers/formatServiceUrl';
@@ -208,7 +208,7 @@ export class AssetStorageService extends BaseServiceAbstract {
208
208
  * @param integration
209
209
  */
210
210
  updateSyncIntegration(projectId, integrationId, integration) {
211
- return this.callPut(formatServiceUrl(API_PROJECT_ASSET_INTEGRATION_PATH_URL, { url: this.config.url, projectId, integrationId: integrationId }, this.config.insecure), integration, `Failed to update asset sync integrations for ${projectId}.`);
211
+ return this.callPut(formatServiceUrl(API_PROJECT_ASSET_INTEGRATION_PATH_URL, { url: this.config.url, projectId, integrationId }, this.config.insecure), integration, `Failed to update asset sync integrations for ${projectId}.`);
212
212
  }
213
213
  /**
214
214
  * Delete a Sync Integration
@@ -14,6 +14,8 @@ export class BaseStreamService {
14
14
  return this.status;
15
15
  }
16
16
  async initStream(stream) {
17
+ if (this.config.insecure)
18
+ return; // no need to init auth for insecure connections
17
19
  const authService = RocosStore.getSDKInstance(this.config).getAuthService();
18
20
  if (!this.config.token || !authService.isTokenValid(new Token(this.config.token))) {
19
21
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "3.0.1-alpha.5",
3
+ "version": "3.0.1-alpha.6",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",