node-red-contrib-mobius-flow-base 3.3.0 → 3.4.0-beta.1

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.
@@ -1,6 +1,6 @@
1
- import { AxiosInstance } from 'axios';
2
- import { EngineWebSocket } from './engine-websocket';
3
- import { EngineApiCalls } from './engine-api-calls';
1
+ import { AxiosInstance } from "axios";
2
+ import { EngineWebSocket } from "./engine-websocket";
3
+ import { EngineApiCalls } from "./engine-api-calls";
4
4
  export declare class EngineApiClient extends EngineApiCalls {
5
5
  private reloginInterval;
6
6
  client: AxiosInstance | null;
@@ -14,7 +14,7 @@ export declare class EngineApiClient extends EngineApiCalls {
14
14
  EngineWebSocket: EngineWebSocket;
15
15
  private hostname;
16
16
  private protocol;
17
- constructor(protocol: 'http' | 'https', host: string, username: string, password: string);
17
+ constructor(protocol: "http" | "https", host: string, username: string, password: string);
18
18
  private login;
19
19
  private refresh;
20
20
  close: () => void;
@@ -24,11 +24,11 @@ class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
24
24
  this.password = password;
25
25
  this.hostname = host;
26
26
  this.protocol = protocol;
27
- const baseURL = `${this.protocol}://${this.hostname}/api/v1`;
27
+ const baseURL = `${this.protocol}://${this.hostname}/api/engine/v1`;
28
28
  this.client = axios_1.default.create({
29
29
  baseURL: baseURL,
30
30
  headers: {
31
- 'Content-Type': 'application/json',
31
+ "Content-Type": "application/json",
32
32
  },
33
33
  });
34
34
  this.setApiClient(this.client);
@@ -41,15 +41,15 @@ class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
41
41
  this.login();
42
42
  }
43
43
  else {
44
- console.log('No username, password, host, or port provided. Not attempting to login to Mobius Engine API.');
44
+ console.log("No username, password, host, or port provided. Not attempting to login to Mobius Engine API.");
45
45
  this.reloginInterval && clearInterval(this.reloginInterval);
46
46
  this.reloginInterval = null;
47
47
  }
48
48
  // Add auth headers to all axios calls
49
49
  this.client.interceptors.request.use((config) => {
50
- if (!config.url?.endsWith('/auth/login')) {
50
+ if (!config.url?.endsWith("/auth/login")) {
51
51
  if (this.tokens && config.headers) {
52
- config.headers['Authorization'] = `Bearer ${this.tokens.token}`;
52
+ config.headers["Authorization"] = `Bearer ${this.tokens.token}`;
53
53
  }
54
54
  }
55
55
  return config;
@@ -62,7 +62,7 @@ class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
62
62
  throw error;
63
63
  });
64
64
  this.EngineWebSocket = new engine_websocket_1.EngineWebSocket(this.hostname, this.protocol);
65
- this.EngineWebSocket.on('disconnected', () => {
65
+ this.EngineWebSocket.on("disconnected", () => {
66
66
  this.loggedIn = false;
67
67
  });
68
68
  }
@@ -70,8 +70,8 @@ class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
70
70
  console.log(`(${this.hostname}) -> Attempting Mobius Engine API Login`);
71
71
  try {
72
72
  const response = await this.client({
73
- method: 'post',
74
- url: '/auth/login',
73
+ method: "post",
74
+ url: "/auth/login",
75
75
  data: {
76
76
  username: this.username,
77
77
  password: this.password,
@@ -97,8 +97,8 @@ class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
97
97
  }
98
98
  try {
99
99
  const response = await this.client({
100
- method: 'post',
101
- url: '/auth/refresh',
100
+ method: "post",
101
+ url: "/auth/refresh",
102
102
  data: {
103
103
  refreshToken: this.tokens.refreshToken,
104
104
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-mobius-flow-base",
3
- "version": "3.3.0",
3
+ "version": "3.4.0-beta.1",
4
4
  "description": "Node-RED base nodes for Mobius Flow",
5
5
  "main": "index.js",
6
6
  "types": "dist/index.d.ts",