@etainabl/nodejs-sdk 1.2.33 → 1.2.34

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.
package/dist/cjs/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AxiosRequestConfig, AxiosInstance, CreateAxiosDefaults } from 'axios';
2
- import type { Account, Asset, Automation, Entity, Company, DataIngest, Invoice, Log, Reading, Report } from './types/index.js';
2
+ import type { Account, Asset, Automation, Entity, Company, DataIngest, Invoice, Log, Reading, Report, Supplier } from './types/index.js';
3
3
  export interface ETNPagedResponse<T = any> {
4
4
  data: T[];
5
5
  total: number;
@@ -16,95 +16,96 @@ interface AuthOptions {
16
16
  }
17
17
  declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
18
18
  instance: AxiosInstance;
19
- getAccount: (id: string, options?: AxiosRequestConfig) => Promise<Account>;
20
- listAccounts: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Account>>;
21
- updateAccount: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
22
- createAccount: (data: any, options?: AxiosRequestConfig) => Promise<any>;
23
- removeAccount: (id: string, options?: AxiosRequestConfig) => Promise<any>;
24
- getAccountSchema: (options?: AxiosRequestConfig) => Promise<any>;
25
- invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
26
- getAsset: (id: string, options?: AxiosRequestConfig) => Promise<Asset>;
27
- listAssets: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Asset>>;
28
- updateAsset: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
29
- createAsset: (data: any, options?: AxiosRequestConfig) => Promise<any>;
30
- removeAsset: (id: string, options?: AxiosRequestConfig) => Promise<any>;
31
- getAssetSchema: (options?: AxiosRequestConfig) => Promise<any>;
32
- getAssetGroup: (id: string, options?: AxiosRequestConfig) => Promise<any>;
33
- listAssetGroups: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
34
- updateAssetGroup: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
35
- createAssetGroup: (data: any, options?: AxiosRequestConfig) => Promise<any>;
36
- removeAssetGroup: (id: string, options?: AxiosRequestConfig) => Promise<any>;
37
- getAssetGroupAssets: (id: string, options?: AxiosRequestConfig) => Promise<any>;
38
- getAssetGroupSchema: (options?: AxiosRequestConfig) => Promise<any>;
39
- getAutomation: (id: string, options?: AxiosRequestConfig) => Promise<Automation>;
40
- listAutomations: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Automation>>;
41
- updateAutomation: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
42
- createAutomation: (data: any, options?: AxiosRequestConfig) => Promise<any>;
43
- removeAutomation: (id: string, options?: AxiosRequestConfig) => Promise<any>;
44
- createAutomationLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
45
- updateAutomationLog: (id: string, subId: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
46
- removeAutomationLog: (id: string, subId: string, options?: AxiosRequestConfig) => Promise<any>;
47
- getCompany: (id: string, options?: AxiosRequestConfig) => Promise<Company>;
48
- getConsumption: (id: string, options?: AxiosRequestConfig) => Promise<any>;
49
- listConsumptions: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
50
- updateConsumption: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
51
- createConsumption: (data: any, options?: AxiosRequestConfig) => Promise<any>;
52
- removeConsumption: (id: string, options?: AxiosRequestConfig) => Promise<any>;
53
- getConsumptionSchema: (options?: AxiosRequestConfig) => Promise<any>;
54
- getEmail: (id: string, options?: AxiosRequestConfig) => Promise<any>;
55
- listEmails: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
56
- updateEmail: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
57
- createEmail: (data: any, options?: AxiosRequestConfig) => Promise<any>;
58
- removeEmail: (id: string, options?: AxiosRequestConfig) => Promise<any>;
59
- getEmissionFactor: (id: string, options?: AxiosRequestConfig) => Promise<any>;
60
- listEmissionFactors: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
61
- updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
62
- createEmissionFactor: (data: any, options?: AxiosRequestConfig) => Promise<any>;
63
- removeEmissionFactor: (id: string, options?: AxiosRequestConfig) => Promise<any>;
64
- getEntity: (id: string, options?: AxiosRequestConfig) => Promise<Entity>;
65
- listEntities: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Entity>>;
66
- updateEntity: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
67
- createEntity: (data: any, options?: AxiosRequestConfig) => Promise<any>;
68
- removeEntity: (id: string, options?: AxiosRequestConfig) => Promise<any>;
69
- getEntitiesSchema: (options?: AxiosRequestConfig) => Promise<any>;
70
- getLog: (id: string, options?: AxiosRequestConfig) => Promise<Log>;
71
- listLogs: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Log>>;
72
- updateLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
73
- createLog: (data: any, options?: AxiosRequestConfig) => Promise<any>;
74
- removeLog: (id: string, options?: AxiosRequestConfig) => Promise<any>;
75
- getReading: (id: string, options?: AxiosRequestConfig) => Promise<Reading>;
76
- listReadings: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Reading>>;
77
- updateReading: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
78
- createReading: (data: any, options?: AxiosRequestConfig) => Promise<any>;
79
- removeReading: (id: string, options?: AxiosRequestConfig) => Promise<any>;
80
- getReadingSchema: (options?: AxiosRequestConfig) => Promise<any>;
81
- getReport: (id: string, options?: AxiosRequestConfig) => Promise<Report>;
82
- listReports: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Report>>;
83
- updateReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
84
- createReport: (data: any, options?: AxiosRequestConfig) => Promise<any>;
85
- removeReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
86
- sendReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
87
- getReportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
88
- listReportTemplates: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
89
- updateReportTemplate: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
90
- createReportTemplate: (data: any, options?: AxiosRequestConfig) => Promise<any>;
91
- removeReportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
92
- getScheduledReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
93
- listScheduledReports: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
94
- updateScheduledReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
95
- createScheduledReport: (data: any, options?: AxiosRequestConfig) => Promise<any>;
96
- removeScheduledReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
97
- sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
98
- getInvoice: (id: string, options?: AxiosRequestConfig) => Promise<Invoice>;
99
- listInvoices: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Invoice>>;
100
- updateInvoice: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
101
- createInvoice: (data: any, options?: AxiosRequestConfig) => Promise<any>;
102
- removeInvoice: (id: string, options?: AxiosRequestConfig) => Promise<any>;
103
- getInvoiceSchema: (options?: AxiosRequestConfig) => Promise<any>;
104
- getSupplierSchema: (options?: AxiosRequestConfig) => Promise<any>;
105
- getImportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
106
- updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
107
- createDataIngest: (data: any, options?: AxiosRequestConfig) => Promise<any>;
108
- listDataIngest: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<DataIngest>>;
19
+ getAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<Account>;
20
+ listAccounts: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Account>>;
21
+ updateAccount: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
22
+ createAccount: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
23
+ removeAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
24
+ getAccountSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
25
+ invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
26
+ getAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<Asset>;
27
+ listAssets: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Asset>>;
28
+ updateAsset: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
29
+ createAsset: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
30
+ removeAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
31
+ getAssetSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
32
+ getAssetGroup: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
33
+ listAssetGroups: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
34
+ updateAssetGroup: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
35
+ createAssetGroup: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
36
+ removeAssetGroup: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
37
+ getAssetGroupAssets: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
38
+ getAssetGroupSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
39
+ getAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<Automation>;
40
+ listAutomations: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Automation>>;
41
+ updateAutomation: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
42
+ createAutomation: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
43
+ removeAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
44
+ createAutomationLog: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
45
+ updateAutomationLog: (id: string, subId: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
46
+ removeAutomationLog: (id: string, subId: string, options?: AxiosRequestConfig<any>) => Promise<any>;
47
+ getCompany: (id: string, options?: AxiosRequestConfig<any>) => Promise<Company>;
48
+ getConsumption: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
49
+ listConsumptions: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
50
+ updateConsumption: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
51
+ createConsumption: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
52
+ removeConsumption: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
53
+ getConsumptionSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
54
+ getEmail: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
55
+ listEmails: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
56
+ updateEmail: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
57
+ createEmail: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
58
+ removeEmail: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
59
+ getEmissionFactor: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
60
+ listEmissionFactors: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
61
+ updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
62
+ createEmissionFactor: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
63
+ removeEmissionFactor: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
64
+ getEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<Entity>;
65
+ listEntities: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Entity>>;
66
+ updateEntity: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
67
+ createEntity: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
68
+ removeEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
69
+ getEntitiesSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
70
+ getLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<Log>;
71
+ listLogs: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Log>>;
72
+ updateLog: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
73
+ createLog: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
74
+ removeLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
75
+ getReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<Reading>;
76
+ listReadings: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Reading>>;
77
+ updateReading: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
78
+ createReading: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
79
+ removeReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
80
+ getReadingSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
81
+ getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report>;
82
+ listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report>>;
83
+ updateReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
84
+ createReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
85
+ removeReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
86
+ sendReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
87
+ getReportTemplate: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
88
+ listReportTemplates: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
89
+ updateReportTemplate: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
90
+ createReportTemplate: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
91
+ removeReportTemplate: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
92
+ getScheduledReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
93
+ listScheduledReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
94
+ updateScheduledReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
95
+ createScheduledReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
96
+ removeScheduledReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
97
+ sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
98
+ getInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<Invoice>;
99
+ listInvoices: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Invoice>>;
100
+ updateInvoice: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
101
+ createInvoice: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
102
+ removeInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
103
+ getInvoiceSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
104
+ listSuppliers: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Supplier>>;
105
+ getSupplierSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
106
+ getImportTemplate: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
107
+ updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
108
+ createDataIngest: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
109
+ listDataIngest: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<DataIngest>>;
109
110
  };
110
111
  export default _default;
package/dist/cjs/api.js CHANGED
@@ -32,7 +32,7 @@ function _handleResponse(req, res, isPaged = false) {
32
32
  return res;
33
33
  }
34
34
  const factory = {
35
- getWithId: (etainablApi, endpoint, postEndpoint) => (id_1, ...args_1) => __awaiter(void 0, [id_1, ...args_1], void 0, function* (id, options = {}) {
35
+ getWithId: (etainablApi, endpoint, postEndpoint) => (id, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
36
36
  var _a;
37
37
  const req = {
38
38
  method: 'GET',
@@ -52,8 +52,8 @@ const factory = {
52
52
  _handleResponse(req, res);
53
53
  return res.data;
54
54
  }),
55
- get: (etainablApi, endpoint, postEndpoint) => (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (options = {}) {
56
- var _a;
55
+ get: (etainablApi, endpoint, postEndpoint) => (options = {}) => __awaiter(void 0, void 0, void 0, function* () {
56
+ var _b;
57
57
  const req = {
58
58
  method: 'GET',
59
59
  url: `${endpoint}${postEndpoint ? `/${postEndpoint}` : ''}`
@@ -64,7 +64,7 @@ const factory = {
64
64
  res = yield etainablApi.get(req.url, options);
65
65
  }
66
66
  catch (e) {
67
- if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data)
67
+ if ((_b = e.response) === null || _b === void 0 ? void 0 : _b.data)
68
68
  throw new Error(`API error response: ${JSON.stringify(e.response.data)}`);
69
69
  throw e;
70
70
  }
@@ -72,8 +72,8 @@ const factory = {
72
72
  _handleResponse(req, res);
73
73
  return res.data;
74
74
  }),
75
- list: (etainablApi, endpoint, postEndpoint) => (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (options = {}) {
76
- var _a;
75
+ list: (etainablApi, endpoint, postEndpoint) => (options = {}) => __awaiter(void 0, void 0, void 0, function* () {
76
+ var _c;
77
77
  const req = {
78
78
  method: 'GET',
79
79
  url: `${endpoint}${postEndpoint ? `/${postEndpoint}` : ''}`
@@ -84,7 +84,7 @@ const factory = {
84
84
  res = yield etainablApi.get(req.url, options);
85
85
  }
86
86
  catch (e) {
87
- if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data)
87
+ if ((_c = e.response) === null || _c === void 0 ? void 0 : _c.data)
88
88
  throw new Error(`API error response: ${JSON.stringify(e.response.data)}`);
89
89
  throw e;
90
90
  }
@@ -92,8 +92,8 @@ const factory = {
92
92
  _handleResponse(req, res, true);
93
93
  return res.data;
94
94
  }),
95
- update: (etainablApi, endpoint, postEndpoint) => (id_1, data_1, ...args_1) => __awaiter(void 0, [id_1, data_1, ...args_1], void 0, function* (id, data, options = {}) {
96
- var _a;
95
+ update: (etainablApi, endpoint, postEndpoint) => (id, data, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
96
+ var _d;
97
97
  const req = {
98
98
  method: 'PATCH',
99
99
  url: `${endpoint}/${id}${postEndpoint ? `/${postEndpoint}` : ''}`
@@ -104,15 +104,15 @@ const factory = {
104
104
  res = yield etainablApi.patch(req.url, data, options);
105
105
  }
106
106
  catch (e) {
107
- if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data)
107
+ if ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data)
108
108
  throw new Error(`API error response: ${JSON.stringify(e.response.data)}`);
109
109
  throw e;
110
110
  }
111
111
  _handleResponse(req, res);
112
112
  return res.data;
113
113
  }),
114
- create: (etainablApi, endpoint, postEndpoint) => (data_1, ...args_1) => __awaiter(void 0, [data_1, ...args_1], void 0, function* (data, options = {}) {
115
- var _a;
114
+ create: (etainablApi, endpoint, postEndpoint) => (data, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
115
+ var _e;
116
116
  const req = {
117
117
  method: 'POST',
118
118
  url: `${endpoint}${postEndpoint ? `/${postEndpoint}` : ''}`
@@ -123,15 +123,15 @@ const factory = {
123
123
  res = yield etainablApi.post(req.url, data, options);
124
124
  }
125
125
  catch (e) {
126
- if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data)
126
+ if ((_e = e.response) === null || _e === void 0 ? void 0 : _e.data)
127
127
  throw new Error(`API error response: ${JSON.stringify(e.response.data)}`);
128
128
  throw e;
129
129
  }
130
130
  _handleResponse(req, res);
131
131
  return res.data;
132
132
  }),
133
- remove: (etainablApi, endpoint, postEndpoint) => (id_1, ...args_1) => __awaiter(void 0, [id_1, ...args_1], void 0, function* (id, options = {}) {
134
- var _a;
133
+ remove: (etainablApi, endpoint, postEndpoint) => (id, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
134
+ var _f;
135
135
  const req = {
136
136
  method: 'DELETE',
137
137
  url: `${endpoint}/${id}${postEndpoint ? `/${postEndpoint}` : ''}`
@@ -142,15 +142,15 @@ const factory = {
142
142
  res = yield etainablApi.delete(req.url, options);
143
143
  }
144
144
  catch (e) {
145
- if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data)
145
+ if ((_f = e.response) === null || _f === void 0 ? void 0 : _f.data)
146
146
  throw new Error(`API error response: ${JSON.stringify(e.response.data)}`);
147
147
  throw e;
148
148
  }
149
149
  _handleResponse(req, res);
150
150
  return res.data;
151
151
  }),
152
- customWithId: (etainablApi, method, endpoint, postEndpoint) => (id_1, data_1, ...args_1) => __awaiter(void 0, [id_1, data_1, ...args_1], void 0, function* (id, data, options = {}) {
153
- var _a;
152
+ customWithId: (etainablApi, method, endpoint, postEndpoint) => (id, data, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
153
+ var _g;
154
154
  const req = Object.assign({ method: method, url: `${endpoint}/${id}${postEndpoint ? `/${postEndpoint}` : ''}`, data }, options);
155
155
  log.info(`API Request (Custom): ${req.method} ${process.env.ETAINABL_API_URL}/${req.url}`);
156
156
  let res;
@@ -158,7 +158,7 @@ const factory = {
158
158
  res = yield etainablApi.request(req);
159
159
  }
160
160
  catch (e) {
161
- if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data)
161
+ if ((_g = e.response) === null || _g === void 0 ? void 0 : _g.data)
162
162
  throw new Error(`API error response: ${JSON.stringify(e.response.data)}`);
163
163
  throw e;
164
164
  }
@@ -170,17 +170,17 @@ const factory = {
170
170
  // e.g. /assets/:id/documents/:documentId
171
171
  const subFactory = {
172
172
  // e.g. POST /assets/:id/documents
173
- create: (etainablApi, endpoint, subEndpoint) => (id_1, data_1, ...args_1) => __awaiter(void 0, [id_1, data_1, ...args_1], void 0, function* (id, data, options = {}) {
173
+ create: (etainablApi, endpoint, subEndpoint) => (id, data, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
174
174
  const subUrl = `${id}/${subEndpoint}`;
175
175
  return factory.create(etainablApi, endpoint, subUrl)(data, options);
176
176
  }),
177
177
  // e.g. PATCH /assets/:id/documents/:documentId
178
- update: (etainablApi, endpoint, subEndpoint) => (id_1, subId_1, data_1, ...args_1) => __awaiter(void 0, [id_1, subId_1, data_1, ...args_1], void 0, function* (id, subId, data, options = {}) {
178
+ update: (etainablApi, endpoint, subEndpoint) => (id, subId, data, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
179
179
  const subUrl = `${subEndpoint}/${subId}`;
180
180
  return factory.update(etainablApi, endpoint, subUrl)(id, data, options);
181
181
  }),
182
182
  // e.g. DELETE /assets/:id/documents/:documentId
183
- remove: (etainablApi, endpoint, subEndpoint) => (id_1, subId_1, ...args_1) => __awaiter(void 0, [id_1, subId_1, ...args_1], void 0, function* (id, subId, options = {}) {
183
+ remove: (etainablApi, endpoint, subEndpoint) => (id, subId, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
184
184
  const subUrl = `${subEndpoint}/${subId}`;
185
185
  return factory.remove(etainablApi, endpoint, subUrl)(id, options);
186
186
  })
@@ -301,6 +301,7 @@ exports.default = (auth, instanceOptions = {}) => {
301
301
  removeInvoice: factory.remove(etainablApi, 'invoices'),
302
302
  getInvoiceSchema: factory.get(etainablApi, 'invoices', 'schema'),
303
303
  //suppliers
304
+ listSuppliers: factory.list(etainablApi, 'suppliers'),
304
305
  getSupplierSchema: factory.get(etainablApi, 'suppliers', 'schema'),
305
306
  // import templates
306
307
  getImportTemplate: factory.getWithId(etainablApi, 'import-templates'),
package/dist/cjs/db.js CHANGED
@@ -16,8 +16,8 @@ const mongodb_1 = require("mongodb");
16
16
  const logger_js_1 = __importDefault(require("./logger.js"));
17
17
  const log = (0, logger_js_1.default)('dbHelpers');
18
18
  let cachedDb;
19
- function connectToDatabase() {
20
- return __awaiter(this, arguments, void 0, function* (retryAttempt = 1) {
19
+ function connectToDatabase(retryAttempt = 1) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
21
  if (!process.env.ETAINABL_DB_URL)
22
22
  throw new Error("ETAINABL_DB_URL is not set");
23
23
  if (!process.env.AWS_ACCESS_KEY_ID)
package/dist/cjs/index.js CHANGED
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
35
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
27
  };
@@ -5,9 +5,9 @@ interface Item {
5
5
  value: number;
6
6
  [key: string]: any;
7
7
  }
8
- export type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | 'oil' | 'other';
9
- export type ETNUnit = 'kwh' | 'kg' | 'm3' | 'lbs' | 'tonnes' | 'wh' | 'mwh' | 'ft3' | 'hcf' | 'm3/h' | 'qty' | 'l' | 'C' | 'mcuf' | 'hcuf' | 'tcuf' | 'ocuf' | 'hm3' | 'tm3' | 'nm3';
10
- export type BaseUnit = 'kwh' | 'm3' | 'C' | 'kg' | 'm3/h' | 'l';
8
+ export declare type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | 'oil' | 'other';
9
+ export declare type ETNUnit = 'kwh' | 'kg' | 'm3' | 'lbs' | 'tonnes' | 'wh' | 'mwh' | 'ft3' | 'hcf' | 'm3/h' | 'qty' | 'l' | 'C' | 'mcuf' | 'hcuf' | 'tcuf' | 'ocuf' | 'hm3' | 'tm3' | 'nm3';
10
+ export declare type BaseUnit = 'kwh' | 'm3' | 'C' | 'kg' | 'm3/h' | 'l';
11
11
  export declare const accountTypeMap: {
12
12
  [key: string]: BaseUnit;
13
13
  };
@@ -15,7 +15,7 @@ export declare const accountTypeUnitMap: {
15
15
  [key: string]: ETNUnit[];
16
16
  };
17
17
  export declare const convertItems: (items: Item[], type: AccountType, defaultUnits: ETNUnit | undefined, accountFactor: number | undefined) => any;
18
- export declare const checkAccountTypeVsUnits: (type: string, unit: string, additionalLog?: number | "") => {
18
+ export declare const checkAccountTypeVsUnits: (type: string, unit: string, additionalLog?: number | '') => {
19
19
  type: AccountType;
20
20
  unit: ETNUnit;
21
21
  };
package/dist/mjs/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AxiosRequestConfig, AxiosInstance, CreateAxiosDefaults } from 'axios';
2
- import type { Account, Asset, Automation, Entity, Company, DataIngest, Invoice, Log, Reading, Report } from './types/index.js';
2
+ import type { Account, Asset, Automation, Entity, Company, DataIngest, Invoice, Log, Reading, Report, Supplier } from './types/index.js';
3
3
  export interface ETNPagedResponse<T = any> {
4
4
  data: T[];
5
5
  total: number;
@@ -16,95 +16,96 @@ interface AuthOptions {
16
16
  }
17
17
  declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
18
18
  instance: AxiosInstance;
19
- getAccount: (id: string, options?: AxiosRequestConfig) => Promise<Account>;
20
- listAccounts: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Account>>;
21
- updateAccount: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
22
- createAccount: (data: any, options?: AxiosRequestConfig) => Promise<any>;
23
- removeAccount: (id: string, options?: AxiosRequestConfig) => Promise<any>;
24
- getAccountSchema: (options?: AxiosRequestConfig) => Promise<any>;
25
- invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
26
- getAsset: (id: string, options?: AxiosRequestConfig) => Promise<Asset>;
27
- listAssets: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Asset>>;
28
- updateAsset: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
29
- createAsset: (data: any, options?: AxiosRequestConfig) => Promise<any>;
30
- removeAsset: (id: string, options?: AxiosRequestConfig) => Promise<any>;
31
- getAssetSchema: (options?: AxiosRequestConfig) => Promise<any>;
32
- getAssetGroup: (id: string, options?: AxiosRequestConfig) => Promise<any>;
33
- listAssetGroups: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
34
- updateAssetGroup: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
35
- createAssetGroup: (data: any, options?: AxiosRequestConfig) => Promise<any>;
36
- removeAssetGroup: (id: string, options?: AxiosRequestConfig) => Promise<any>;
37
- getAssetGroupAssets: (id: string, options?: AxiosRequestConfig) => Promise<any>;
38
- getAssetGroupSchema: (options?: AxiosRequestConfig) => Promise<any>;
39
- getAutomation: (id: string, options?: AxiosRequestConfig) => Promise<Automation>;
40
- listAutomations: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Automation>>;
41
- updateAutomation: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
42
- createAutomation: (data: any, options?: AxiosRequestConfig) => Promise<any>;
43
- removeAutomation: (id: string, options?: AxiosRequestConfig) => Promise<any>;
44
- createAutomationLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
45
- updateAutomationLog: (id: string, subId: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
46
- removeAutomationLog: (id: string, subId: string, options?: AxiosRequestConfig) => Promise<any>;
47
- getCompany: (id: string, options?: AxiosRequestConfig) => Promise<Company>;
48
- getConsumption: (id: string, options?: AxiosRequestConfig) => Promise<any>;
49
- listConsumptions: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
50
- updateConsumption: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
51
- createConsumption: (data: any, options?: AxiosRequestConfig) => Promise<any>;
52
- removeConsumption: (id: string, options?: AxiosRequestConfig) => Promise<any>;
53
- getConsumptionSchema: (options?: AxiosRequestConfig) => Promise<any>;
54
- getEmail: (id: string, options?: AxiosRequestConfig) => Promise<any>;
55
- listEmails: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
56
- updateEmail: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
57
- createEmail: (data: any, options?: AxiosRequestConfig) => Promise<any>;
58
- removeEmail: (id: string, options?: AxiosRequestConfig) => Promise<any>;
59
- getEmissionFactor: (id: string, options?: AxiosRequestConfig) => Promise<any>;
60
- listEmissionFactors: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
61
- updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
62
- createEmissionFactor: (data: any, options?: AxiosRequestConfig) => Promise<any>;
63
- removeEmissionFactor: (id: string, options?: AxiosRequestConfig) => Promise<any>;
64
- getEntity: (id: string, options?: AxiosRequestConfig) => Promise<Entity>;
65
- listEntities: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Entity>>;
66
- updateEntity: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
67
- createEntity: (data: any, options?: AxiosRequestConfig) => Promise<any>;
68
- removeEntity: (id: string, options?: AxiosRequestConfig) => Promise<any>;
69
- getEntitiesSchema: (options?: AxiosRequestConfig) => Promise<any>;
70
- getLog: (id: string, options?: AxiosRequestConfig) => Promise<Log>;
71
- listLogs: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Log>>;
72
- updateLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
73
- createLog: (data: any, options?: AxiosRequestConfig) => Promise<any>;
74
- removeLog: (id: string, options?: AxiosRequestConfig) => Promise<any>;
75
- getReading: (id: string, options?: AxiosRequestConfig) => Promise<Reading>;
76
- listReadings: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Reading>>;
77
- updateReading: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
78
- createReading: (data: any, options?: AxiosRequestConfig) => Promise<any>;
79
- removeReading: (id: string, options?: AxiosRequestConfig) => Promise<any>;
80
- getReadingSchema: (options?: AxiosRequestConfig) => Promise<any>;
81
- getReport: (id: string, options?: AxiosRequestConfig) => Promise<Report>;
82
- listReports: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Report>>;
83
- updateReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
84
- createReport: (data: any, options?: AxiosRequestConfig) => Promise<any>;
85
- removeReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
86
- sendReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
87
- getReportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
88
- listReportTemplates: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
89
- updateReportTemplate: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
90
- createReportTemplate: (data: any, options?: AxiosRequestConfig) => Promise<any>;
91
- removeReportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
92
- getScheduledReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
93
- listScheduledReports: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
94
- updateScheduledReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
95
- createScheduledReport: (data: any, options?: AxiosRequestConfig) => Promise<any>;
96
- removeScheduledReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
97
- sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
98
- getInvoice: (id: string, options?: AxiosRequestConfig) => Promise<Invoice>;
99
- listInvoices: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Invoice>>;
100
- updateInvoice: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
101
- createInvoice: (data: any, options?: AxiosRequestConfig) => Promise<any>;
102
- removeInvoice: (id: string, options?: AxiosRequestConfig) => Promise<any>;
103
- getInvoiceSchema: (options?: AxiosRequestConfig) => Promise<any>;
104
- getSupplierSchema: (options?: AxiosRequestConfig) => Promise<any>;
105
- getImportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
106
- updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
107
- createDataIngest: (data: any, options?: AxiosRequestConfig) => Promise<any>;
108
- listDataIngest: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<DataIngest>>;
19
+ getAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<Account>;
20
+ listAccounts: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Account>>;
21
+ updateAccount: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
22
+ createAccount: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
23
+ removeAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
24
+ getAccountSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
25
+ invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
26
+ getAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<Asset>;
27
+ listAssets: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Asset>>;
28
+ updateAsset: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
29
+ createAsset: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
30
+ removeAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
31
+ getAssetSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
32
+ getAssetGroup: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
33
+ listAssetGroups: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
34
+ updateAssetGroup: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
35
+ createAssetGroup: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
36
+ removeAssetGroup: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
37
+ getAssetGroupAssets: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
38
+ getAssetGroupSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
39
+ getAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<Automation>;
40
+ listAutomations: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Automation>>;
41
+ updateAutomation: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
42
+ createAutomation: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
43
+ removeAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
44
+ createAutomationLog: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
45
+ updateAutomationLog: (id: string, subId: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
46
+ removeAutomationLog: (id: string, subId: string, options?: AxiosRequestConfig<any>) => Promise<any>;
47
+ getCompany: (id: string, options?: AxiosRequestConfig<any>) => Promise<Company>;
48
+ getConsumption: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
49
+ listConsumptions: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
50
+ updateConsumption: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
51
+ createConsumption: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
52
+ removeConsumption: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
53
+ getConsumptionSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
54
+ getEmail: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
55
+ listEmails: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
56
+ updateEmail: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
57
+ createEmail: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
58
+ removeEmail: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
59
+ getEmissionFactor: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
60
+ listEmissionFactors: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
61
+ updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
62
+ createEmissionFactor: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
63
+ removeEmissionFactor: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
64
+ getEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<Entity>;
65
+ listEntities: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Entity>>;
66
+ updateEntity: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
67
+ createEntity: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
68
+ removeEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
69
+ getEntitiesSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
70
+ getLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<Log>;
71
+ listLogs: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Log>>;
72
+ updateLog: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
73
+ createLog: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
74
+ removeLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
75
+ getReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<Reading>;
76
+ listReadings: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Reading>>;
77
+ updateReading: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
78
+ createReading: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
79
+ removeReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
80
+ getReadingSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
81
+ getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report>;
82
+ listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report>>;
83
+ updateReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
84
+ createReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
85
+ removeReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
86
+ sendReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
87
+ getReportTemplate: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
88
+ listReportTemplates: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
89
+ updateReportTemplate: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
90
+ createReportTemplate: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
91
+ removeReportTemplate: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
92
+ getScheduledReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
93
+ listScheduledReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
94
+ updateScheduledReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
95
+ createScheduledReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
96
+ removeScheduledReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
97
+ sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
98
+ getInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<Invoice>;
99
+ listInvoices: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Invoice>>;
100
+ updateInvoice: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
101
+ createInvoice: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
102
+ removeInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
103
+ getInvoiceSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
104
+ listSuppliers: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Supplier>>;
105
+ getSupplierSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
106
+ getImportTemplate: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
107
+ updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
108
+ createDataIngest: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
109
+ listDataIngest: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<DataIngest>>;
109
110
  };
110
111
  export default _default;
package/dist/mjs/api.js CHANGED
@@ -291,6 +291,7 @@ export default (auth, instanceOptions = {}) => {
291
291
  removeInvoice: factory.remove(etainablApi, 'invoices'),
292
292
  getInvoiceSchema: factory.get(etainablApi, 'invoices', 'schema'),
293
293
  //suppliers
294
+ listSuppliers: factory.list(etainablApi, 'suppliers'),
294
295
  getSupplierSchema: factory.get(etainablApi, 'suppliers', 'schema'),
295
296
  // import templates
296
297
  getImportTemplate: factory.getWithId(etainablApi, 'import-templates'),
@@ -5,9 +5,9 @@ interface Item {
5
5
  value: number;
6
6
  [key: string]: any;
7
7
  }
8
- export type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | 'oil' | 'other';
9
- export type ETNUnit = 'kwh' | 'kg' | 'm3' | 'lbs' | 'tonnes' | 'wh' | 'mwh' | 'ft3' | 'hcf' | 'm3/h' | 'qty' | 'l' | 'C' | 'mcuf' | 'hcuf' | 'tcuf' | 'ocuf' | 'hm3' | 'tm3' | 'nm3';
10
- export type BaseUnit = 'kwh' | 'm3' | 'C' | 'kg' | 'm3/h' | 'l';
8
+ export declare type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | 'oil' | 'other';
9
+ export declare type ETNUnit = 'kwh' | 'kg' | 'm3' | 'lbs' | 'tonnes' | 'wh' | 'mwh' | 'ft3' | 'hcf' | 'm3/h' | 'qty' | 'l' | 'C' | 'mcuf' | 'hcuf' | 'tcuf' | 'ocuf' | 'hm3' | 'tm3' | 'nm3';
10
+ export declare type BaseUnit = 'kwh' | 'm3' | 'C' | 'kg' | 'm3/h' | 'l';
11
11
  export declare const accountTypeMap: {
12
12
  [key: string]: BaseUnit;
13
13
  };
@@ -15,7 +15,7 @@ export declare const accountTypeUnitMap: {
15
15
  [key: string]: ETNUnit[];
16
16
  };
17
17
  export declare const convertItems: (items: Item[], type: AccountType, defaultUnits: ETNUnit | undefined, accountFactor: number | undefined) => any;
18
- export declare const checkAccountTypeVsUnits: (type: string, unit: string, additionalLog?: number | "") => {
18
+ export declare const checkAccountTypeVsUnits: (type: string, unit: string, additionalLog?: number | '') => {
19
19
  type: AccountType;
20
20
  unit: ETNUnit;
21
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etainabl/nodejs-sdk",
3
- "version": "1.2.33",
3
+ "version": "1.2.34",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/mjs/index.js",
6
6
  "types": "dist/mjs/index.d.ts",
package/src/api.ts CHANGED
@@ -363,6 +363,7 @@ export default (auth: AuthOptions, instanceOptions: CreateAxiosDefaults = {}) =>
363
363
  getInvoiceSchema: factory.get(etainablApi, 'invoices', 'schema'),
364
364
 
365
365
  //suppliers
366
+ listSuppliers: factory.list<Supplier>(etainablApi, 'suppliers'),
366
367
  getSupplierSchema: factory.get(etainablApi, 'suppliers', 'schema'),
367
368
 
368
369
  // import templates