@shieldiot/pulse-lib 1.0.11 → 1.0.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.
Files changed (107) hide show
  1. package/README.md +63 -11
  2. package/dist/cjs/index.js +0 -1
  3. package/dist/cjs/lib/index.js +0 -1
  4. package/dist/cjs/lib/pulse-client.js +25 -29
  5. package/dist/cjs/lib/services/supportStreamAnalyticsConfig.js +3 -3
  6. package/dist/cjs/lib/services/sysAccountsService.js +3 -3
  7. package/dist/cjs/lib/services/sysAuditLogService.js +3 -3
  8. package/dist/cjs/lib/services/sysCheckpointsService.js +3 -3
  9. package/dist/cjs/lib/services/sysConfigService.js +3 -3
  10. package/dist/cjs/lib/services/sysFeaturesService.js +3 -3
  11. package/dist/cjs/lib/services/sysGroupsService.js +3 -3
  12. package/dist/cjs/lib/services/sysInsightsService.js +3 -3
  13. package/dist/cjs/lib/services/sysKeysService.js +3 -3
  14. package/dist/cjs/lib/services/sysMembersService.js +3 -3
  15. package/dist/cjs/lib/services/sysRuleTemplatesService.js +3 -3
  16. package/dist/cjs/lib/services/sysRulesService.js +3 -3
  17. package/dist/cjs/lib/services/sysStatisticsService.js +3 -3
  18. package/dist/cjs/lib/services/sysStreamsService.js +3 -3
  19. package/dist/cjs/lib/services/sysUsersService.js +3 -3
  20. package/dist/cjs/lib/services/usrAlertsService.js +3 -3
  21. package/dist/cjs/lib/services/usrDevicesService.js +3 -3
  22. package/dist/cjs/lib/services/usrEventsService.js +3 -3
  23. package/dist/cjs/lib/services/usrInsightsService.js +3 -3
  24. package/dist/cjs/lib/services/usrIntegrationsService.js +3 -3
  25. package/dist/cjs/lib/services/usrMembersService.js +3 -3
  26. package/dist/cjs/lib/services/usrNetworkService.js +3 -3
  27. package/dist/cjs/lib/services/usrReportsService.js +3 -3
  28. package/dist/cjs/lib/services/usrRulesService.js +3 -3
  29. package/dist/cjs/lib/services/usrUserService.js +3 -3
  30. package/dist/esm/index.js +0 -1
  31. package/dist/esm/lib/index.js +0 -1
  32. package/dist/esm/lib/pulse-client.js +31 -35
  33. package/dist/esm/lib/services/supportStreamAnalyticsConfig.js +3 -3
  34. package/dist/esm/lib/services/sysAccountsService.js +3 -3
  35. package/dist/esm/lib/services/sysAuditLogService.js +3 -3
  36. package/dist/esm/lib/services/sysCheckpointsService.js +3 -3
  37. package/dist/esm/lib/services/sysConfigService.js +3 -3
  38. package/dist/esm/lib/services/sysFeaturesService.js +3 -3
  39. package/dist/esm/lib/services/sysGroupsService.js +3 -3
  40. package/dist/esm/lib/services/sysInsightsService.js +3 -3
  41. package/dist/esm/lib/services/sysKeysService.js +3 -3
  42. package/dist/esm/lib/services/sysMembersService.js +3 -3
  43. package/dist/esm/lib/services/sysRuleTemplatesService.js +3 -3
  44. package/dist/esm/lib/services/sysRulesService.js +3 -3
  45. package/dist/esm/lib/services/sysStatisticsService.js +3 -3
  46. package/dist/esm/lib/services/sysStreamsService.js +3 -3
  47. package/dist/esm/lib/services/sysUsersService.js +3 -3
  48. package/dist/esm/lib/services/usrAlertsService.js +3 -3
  49. package/dist/esm/lib/services/usrDevicesService.js +3 -3
  50. package/dist/esm/lib/services/usrEventsService.js +3 -3
  51. package/dist/esm/lib/services/usrInsightsService.js +3 -3
  52. package/dist/esm/lib/services/usrIntegrationsService.js +3 -3
  53. package/dist/esm/lib/services/usrMembersService.js +3 -3
  54. package/dist/esm/lib/services/usrNetworkService.js +3 -3
  55. package/dist/esm/lib/services/usrReportsService.js +3 -3
  56. package/dist/esm/lib/services/usrRulesService.js +3 -3
  57. package/dist/esm/lib/services/usrUserService.js +3 -3
  58. package/dist/types/index.d.ts +0 -1
  59. package/dist/types/lib/common/TokenData.d.ts +1 -1
  60. package/dist/types/lib/entities/Account.d.ts +2 -2
  61. package/dist/types/lib/entities/Action.d.ts +1 -1
  62. package/dist/types/lib/entities/Alert.d.ts +5 -5
  63. package/dist/types/lib/entities/AlertWithDevice.d.ts +7 -7
  64. package/dist/types/lib/entities/Device.d.ts +2 -2
  65. package/dist/types/lib/entities/DeviceWithEvents.d.ts +3 -3
  66. package/dist/types/lib/entities/Event.d.ts +4 -4
  67. package/dist/types/lib/entities/EventWithDevice.d.ts +6 -6
  68. package/dist/types/lib/entities/Insight.d.ts +2 -2
  69. package/dist/types/lib/entities/Integration.d.ts +3 -3
  70. package/dist/types/lib/entities/Radius.d.ts +1 -1
  71. package/dist/types/lib/entities/Rule.d.ts +3 -3
  72. package/dist/types/lib/entities/RuleTemplate.d.ts +1 -1
  73. package/dist/types/lib/entities/User.d.ts +2 -2
  74. package/dist/types/lib/entities/UserMembership.d.ts +1 -1
  75. package/dist/types/lib/entities/UserMemberships.d.ts +1 -1
  76. package/dist/types/lib/index.d.ts +0 -1
  77. package/dist/types/lib/pulse-client.d.ts +13 -14
  78. package/dist/types/lib/services/supportStreamAnalyticsConfig.d.ts +2 -3
  79. package/dist/types/lib/services/sysAccountsService.d.ts +2 -3
  80. package/dist/types/lib/services/sysAuditLogService.d.ts +2 -3
  81. package/dist/types/lib/services/sysCheckpointsService.d.ts +2 -3
  82. package/dist/types/lib/services/sysConfigService.d.ts +2 -3
  83. package/dist/types/lib/services/sysFeaturesService.d.ts +3 -4
  84. package/dist/types/lib/services/sysGroupsService.d.ts +2 -3
  85. package/dist/types/lib/services/sysInsightsService.d.ts +2 -3
  86. package/dist/types/lib/services/sysKeysService.d.ts +2 -3
  87. package/dist/types/lib/services/sysMembersService.d.ts +2 -3
  88. package/dist/types/lib/services/sysRuleTemplatesService.d.ts +2 -3
  89. package/dist/types/lib/services/sysRulesService.d.ts +2 -3
  90. package/dist/types/lib/services/sysStatisticsService.d.ts +2 -3
  91. package/dist/types/lib/services/sysStreamsService.d.ts +2 -3
  92. package/dist/types/lib/services/sysUsersService.d.ts +2 -3
  93. package/dist/types/lib/services/usrAlertsService.d.ts +11 -12
  94. package/dist/types/lib/services/usrDevicesService.d.ts +9 -10
  95. package/dist/types/lib/services/usrEventsService.d.ts +10 -11
  96. package/dist/types/lib/services/usrInsightsService.d.ts +2 -3
  97. package/dist/types/lib/services/usrIntegrationsService.d.ts +2 -3
  98. package/dist/types/lib/services/usrMembersService.d.ts +2 -3
  99. package/dist/types/lib/services/usrNetworkService.d.ts +2 -3
  100. package/dist/types/lib/services/usrReportsService.d.ts +2 -3
  101. package/dist/types/lib/services/usrRulesService.d.ts +4 -5
  102. package/dist/types/lib/services/usrUserService.d.ts +4 -5
  103. package/dist/umd/index.js +1 -1
  104. package/package.json +1 -2
  105. package/dist/cjs/config.js +0 -11
  106. package/dist/esm/config.js +0 -7
  107. package/dist/types/config.d.ts +0 -5
package/README.md CHANGED
@@ -1,26 +1,78 @@
1
1
  # Pulse IoT client library
2
2
 
3
- This package is a typescript client library for the pulse IoT API
3
+ This package is a typescript client library for the pulse IoT API.
4
+ The library includes all the types and services exposed the the pulse API.
4
5
 
5
- ##### Install dependencies with npm:
6
+ ###### Install
6
7
 
7
- Install dependencies:
8
- `npm i`
9
-
10
- Build package:
11
- `npm run build`
8
+ Install client library:
9
+ ```typescript
10
+ npm i @shieldiot/pulse-lib
11
+ ```
12
12
 
13
13
 
14
14
  ##### How to use:
15
+ To use the library, first create a PulseClient instance with the API endpoint URL and optionally the API key and Accesss Token.
16
+
17
+ > The apiKey and accessToken parameters in the PulseClient constructor are optional since
18
+ it is recomended to use HTTP interceptors to inject the API key and access token instead of constructor injection.
19
+
20
+ > The use of interceptor is the preferred approach since for any API response, the response header includes new access toekn with
21
+ new expiration time. Using the same token without refreshing it will eventually result access denied error after the expiration time of the original token (30 minutes).
22
+ The use of constructor injection of access token is recomended for non-expired tokens only (system-to-system integration).
15
23
 
24
+
25
+ Example: how to search list of devices:
16
26
  ```typescript
17
- import { Account, PulseClient } from 'pulse-lib'
27
+ import { PulseClient } from '@shieldiot/pulse-lib'
28
+
29
+
30
+ function searchDevices() : void{
31
+
32
+ const apiUrl: string = "http://myaccount-api.pulseiot.io/v1";
33
+ const apiKey: string = "your_api_key";
34
+ const accessToken: string = "your_access_token";
35
+
36
+ // It is recomended to use a single instance of PulseClient for the entire application
37
+ let cli = new PulseClient(apiUrl, apiKey, accessToken);
38
+
39
+ // remember to release the subject: sub to avoid memory leaks
40
+ let sub = cli.UsrDevicesService.find("streamId").subscribe({
41
+ next: (res) => console.log("process response", res)
42
+ });
43
+ };
44
+
45
+ ```
46
+
47
+ Example2: how to add account:
48
+ ```typescript
49
+ import { Account, AccountTypeCode, PulseClient } from '@shieldiot/pulse-lib'
50
+
51
+ function createAccount() : void{
52
+
53
+ const apiUrl: string = "http://myaccount-api.pulseiot.io/v1";
54
+ const apiKey: string = "your_api_key";
55
+ const accessToken: string = "your_access_token";
56
+
57
+ // It is recomended to use a single instance of PulseClient for the entire application
58
+ let cli = new PulseClient(apiUrl, apiKey, accessToken);
59
+
60
+ // Add account
61
+ let account = new Account("id");
62
+ account.name = "new account";
63
+ account.description = "account description";
64
+ account.type = AccountTypeCode.CUSTOMER;
18
65
 
19
- let pc = new PulseClient("https://your-pulse-api-endpoint", "your-api-key", "your-access-token");
20
- pc.UsrRulesService.find("streamId").pipe();
66
+ // remember to release the subject: sub to avoid memory leaks
67
+ let sub = cli.SysAccountsService.create(account).subscribe({
68
+ next: (res) => console.log("process response", res)
69
+ });
70
+ };
21
71
 
22
72
  ```
23
73
 
24
- It is recomended to use HTTP interceptors to inject the API key and access token
74
+ ##### Best Practices
25
75
 
76
+ * Use a single instance of the PulseClient (as a singleton) for the entire application to avoid high memory consumption since this instance initializes all the pulse services that can be access as readonly properties.
77
+ * All the service methods return a generic typed Observable (e.g. `Observable<EntitiesResponse<Device>>`) that can be used in async manner in the UI or with the subscribe method in the code. Always remember to delete the subject of the subscribe to avoid memory leaks.
26
78
 
package/dist/cjs/index.js CHANGED
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./config"), exports);
18
17
  __exportStar(require("./utils"), exports);
19
18
  __exportStar(require("./lib"), exports);
20
19
  __exportStar(require("./lib/pulse-client"), exports);
@@ -19,4 +19,3 @@ __exportStar(require("./common"), exports);
19
19
  __exportStar(require("./entities"), exports);
20
20
  __exportStar(require("./enums"), exports);
21
21
  __exportStar(require("./services"), exports);
22
- __exportStar(require("./pulse-client"), exports);
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PulseClient = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
- const config_1 = require("../config");
9
8
  const utils_1 = require("../utils");
10
9
  const services_1 = require("./services");
11
10
  const services_2 = require("./services");
@@ -38,9 +37,6 @@ const services_25 = require("./services");
38
37
  class PulseClient {
39
38
  // Constructor
40
39
  constructor(apiUrl, apiKey, accessToken) {
41
- this.config = new config_1.PulseConfig();
42
- this.config.api = apiUrl;
43
- this.config.apiKey = apiKey;
44
40
  // Set axios config
45
41
  let axiosRequestConfiguration = {
46
42
  baseURL: apiUrl,
@@ -55,31 +51,31 @@ class PulseClient {
55
51
  this.axiosInst = axios_1.default.create(axiosRequestConfiguration);
56
52
  this.restSvc = new utils_1.RestUtil(this.axiosInst);
57
53
  // initialize services
58
- this.SupportStreamAnalyticsConfig = new services_1.SupportStreamAnalyticsConfig(this.config, this.restSvc);
59
- this.SysAccountsService = new services_2.SysAccountsService(this.config, this.restSvc);
60
- this.SysAuditLogService = new services_3.SysAuditLogService(this.config, this.restSvc);
61
- this.SysCheckpointsService = new services_4.SysCheckpointsService(this.config, this.restSvc);
62
- this.SysConfigService = new services_5.SysConfigService(this.config, this.restSvc);
63
- this.SysFeaturesService = new services_6.SysFeaturesService(this.config, this.restSvc);
64
- this.SysGroupsService = new services_7.SysGroupsService(this.config, this.restSvc);
65
- this.SysInsightsService = new services_8.SysInsightsService(this.config, this.restSvc);
66
- this.SysKeysService = new services_9.SysKeysService(this.config, this.restSvc);
67
- this.SysMembersService = new services_10.SysMembersService(this.config, this.restSvc);
68
- this.SysRuleTemplatesService = new services_11.SysRuleTemplatesService(this.config, this.restSvc);
69
- this.SysRulesService = new services_12.SysRulesService(this.config, this.restSvc);
70
- this.SysStatisticsService = new services_13.SysStatisticsService(this.config, this.restSvc);
71
- this.SysStreamsService = new services_14.SysStreamsService(this.config, this.restSvc);
72
- this.SysUsersService = new services_15.SysUsersService(this.config, this.restSvc);
73
- this.UsrInsightsService = new services_16.UsrInsightsService(this.config, this.restSvc);
74
- this.UsrIntegrationsService = new services_17.UsrIntegrationsService(this.config, this.restSvc);
75
- this.UsrMembersService = new services_18.UsrMembersService(this.config, this.restSvc);
76
- this.UsrUserService = new services_19.UsrUserService(this.config, this.restSvc);
77
- this.UsrAlertsService = new services_20.UsrAlertsService(this.config, this.restSvc);
78
- this.UsrDevicesService = new services_21.UsrDevicesService(this.config, this.restSvc);
79
- this.UsrEventsService = new services_22.UsrEventsService(this.config, this.restSvc);
80
- this.UsrNetworkService = new services_23.UsrNetworkService(this.config, this.restSvc);
81
- this.UsrReportsService = new services_24.UsrReportsService(this.config, this.restSvc);
82
- this.UsrRulesService = new services_25.UsrRulesService(this.config, this.restSvc);
54
+ this.UsrAlertsService = new services_1.UsrAlertsService(apiUrl, this.restSvc);
55
+ this.UsrDevicesService = new services_2.UsrDevicesService(apiUrl, this.restSvc);
56
+ this.UsrEventsService = new services_3.UsrEventsService(apiUrl, this.restSvc);
57
+ this.UsrNetworkService = new services_4.UsrNetworkService(apiUrl, this.restSvc);
58
+ this.UsrReportsService = new services_5.UsrReportsService(apiUrl, this.restSvc);
59
+ this.UsrRulesService = new services_6.UsrRulesService(apiUrl, this.restSvc);
60
+ this.SupportStreamAnalyticsConfig = new services_7.SupportStreamAnalyticsConfig(apiUrl, this.restSvc);
61
+ this.SysAccountsService = new services_8.SysAccountsService(apiUrl, this.restSvc);
62
+ this.SysAuditLogService = new services_9.SysAuditLogService(apiUrl, this.restSvc);
63
+ this.SysCheckpointsService = new services_10.SysCheckpointsService(apiUrl, this.restSvc);
64
+ this.SysConfigService = new services_11.SysConfigService(apiUrl, this.restSvc);
65
+ this.SysFeaturesService = new services_12.SysFeaturesService(apiUrl, this.restSvc);
66
+ this.SysGroupsService = new services_13.SysGroupsService(apiUrl, this.restSvc);
67
+ this.SysInsightsService = new services_14.SysInsightsService(apiUrl, this.restSvc);
68
+ this.SysKeysService = new services_15.SysKeysService(apiUrl, this.restSvc);
69
+ this.SysMembersService = new services_16.SysMembersService(apiUrl, this.restSvc);
70
+ this.SysRuleTemplatesService = new services_17.SysRuleTemplatesService(apiUrl, this.restSvc);
71
+ this.SysRulesService = new services_18.SysRulesService(apiUrl, this.restSvc);
72
+ this.SysStatisticsService = new services_19.SysStatisticsService(apiUrl, this.restSvc);
73
+ this.SysStreamsService = new services_20.SysStreamsService(apiUrl, this.restSvc);
74
+ this.SysUsersService = new services_21.SysUsersService(apiUrl, this.restSvc);
75
+ this.UsrInsightsService = new services_22.UsrInsightsService(apiUrl, this.restSvc);
76
+ this.UsrIntegrationsService = new services_23.UsrIntegrationsService(apiUrl, this.restSvc);
77
+ this.UsrMembersService = new services_24.UsrMembersService(apiUrl, this.restSvc);
78
+ this.UsrUserService = new services_25.UsrUserService(apiUrl, this.restSvc);
83
79
  }
84
80
  }
85
81
  exports.PulseClient = PulseClient;
@@ -6,12 +6,12 @@ exports.SupportStreamAnalyticsConfig = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SupportStreamAnalyticsConfig {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/support/stream-analytics-config';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new stream analytics configuration
@@ -6,12 +6,12 @@ exports.SysAccountsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysAccountsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/accounts';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new account
@@ -6,12 +6,12 @@ exports.SysAuditLogService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysAuditLogService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/audit-log';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Get single log entry by id
@@ -6,12 +6,12 @@ exports.SysCheckpointsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysCheckpointsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/checkpoints';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Get a single checkpoint entry by id
@@ -6,12 +6,12 @@ exports.SysConfigService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysConfigService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/config';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new configuration parameter
@@ -6,12 +6,12 @@ exports.SysFeaturesService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysFeaturesService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/features';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Find list of feature
@@ -6,12 +6,12 @@ exports.SysGroupsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysGroupsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/groups';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new groups
@@ -6,12 +6,12 @@ exports.SysInsightsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysInsightsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/insights';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new insight query
@@ -6,12 +6,12 @@ exports.SysKeysService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysKeysService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/keys';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new API key
@@ -6,12 +6,12 @@ exports.SysMembersService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysMembersService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/members';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new member
@@ -6,12 +6,12 @@ exports.SysRuleTemplatesService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysRuleTemplatesService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/rule-templates';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new rule template
@@ -6,12 +6,12 @@ exports.SysRulesService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysRulesService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/rules';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new rule
@@ -6,12 +6,12 @@ exports.SysStatisticsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysStatisticsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/statistics';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Get accounts distribution by field
@@ -6,12 +6,12 @@ exports.SysStreamsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysStreamsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/streams';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new stream
@@ -6,12 +6,12 @@ exports.SysUsersService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class SysUsersService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/sys/users';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new user
@@ -6,12 +6,12 @@ exports.UsrAlertsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrAlertsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/alerts';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Get single alert by id
@@ -6,12 +6,12 @@ exports.UsrDevicesService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrDevicesService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/devices';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new device
@@ -6,12 +6,12 @@ exports.UsrEventsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrEventsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/events';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Get single event by id
@@ -6,12 +6,12 @@ exports.UsrInsightsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrInsightsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/insights';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Find list of insights by day
@@ -6,12 +6,12 @@ exports.UsrIntegrationsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrIntegrationsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/integrations';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new integration
@@ -6,12 +6,12 @@ exports.UsrMembersService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrMembersService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/members';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new member
@@ -6,12 +6,12 @@ exports.UsrNetworkService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrNetworkService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/network';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Find list of usage records by query
@@ -6,12 +6,12 @@ exports.UsrReportsService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrReportsService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/reports';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new report
@@ -6,12 +6,12 @@ exports.UsrRulesService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrRulesService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/rules';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Create new rule
@@ -6,12 +6,12 @@ exports.UsrUserService = void 0;
6
6
  // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
7
7
  class UsrUserService {
8
8
  // Class constructor
9
- constructor(config, rest) {
10
- this.config = config;
9
+ constructor(apiUrl, rest) {
10
+ this.apiUrl = apiUrl;
11
11
  this.rest = rest;
12
12
  // URL to web api
13
13
  this.baseUrl = '/user';
14
- this.baseUrl = this.config.api + this.baseUrl;
14
+ this.baseUrl = apiUrl + this.baseUrl;
15
15
  }
16
16
  /**
17
17
  * Authorize user, verify user exists in the system (user was already authenticated by OAuth provider)
package/dist/esm/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export * from './config';
2
1
  export * from './utils';
3
2
  export * from './lib';
4
3
  export * from './lib/pulse-client';
@@ -3,4 +3,3 @@ export * from './common';
3
3
  export * from './entities';
4
4
  export * from './enums';
5
5
  export * from './services';
6
- export * from './pulse-client';