@etainabl/nodejs-sdk 1.2.31 → 1.2.32
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 +84 -84
- package/dist/cjs/api.js +22 -22
- package/dist/cjs/db.js +2 -2
- package/dist/cjs/index.js +17 -7
- package/dist/cjs/units.d.ts +3 -3
- package/dist/cjs/units.js +4 -2
- package/dist/mjs/api.d.ts +84 -84
- package/dist/mjs/units.d.ts +3 -3
- package/dist/mjs/units.js +4 -2
- package/package.json +1 -1
- package/src/units.ts +6 -4
package/dist/cjs/api.d.ts
CHANGED
|
@@ -16,89 +16,89 @@ interface AuthOptions {
|
|
|
16
16
|
}
|
|
17
17
|
declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
|
|
18
18
|
instance: AxiosInstance;
|
|
19
|
-
getAccount: (id: string, options?: AxiosRequestConfig
|
|
20
|
-
listAccounts: (options?: AxiosRequestConfig
|
|
21
|
-
updateAccount: (id: string, data: any, options?: AxiosRequestConfig
|
|
22
|
-
createAccount: (data: any, options?: AxiosRequestConfig
|
|
23
|
-
removeAccount: (id: string, options?: AxiosRequestConfig
|
|
24
|
-
getAccountSchema: (options?: AxiosRequestConfig
|
|
25
|
-
invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig
|
|
26
|
-
getAsset: (id: string, options?: AxiosRequestConfig
|
|
27
|
-
listAssets: (options?: AxiosRequestConfig
|
|
28
|
-
updateAsset: (id: string, data: any, options?: AxiosRequestConfig
|
|
29
|
-
createAsset: (data: any, options?: AxiosRequestConfig
|
|
30
|
-
removeAsset: (id: string, options?: AxiosRequestConfig
|
|
31
|
-
getAssetSchema: (options?: AxiosRequestConfig
|
|
32
|
-
getAssetGroup: (id: string, options?: AxiosRequestConfig
|
|
33
|
-
listAssetGroups: (options?: AxiosRequestConfig
|
|
34
|
-
updateAssetGroup: (id: string, data: any, options?: AxiosRequestConfig
|
|
35
|
-
createAssetGroup: (data: any, options?: AxiosRequestConfig
|
|
36
|
-
removeAssetGroup: (id: string, options?: AxiosRequestConfig
|
|
37
|
-
getAssetGroupAssets: (id: string, options?: AxiosRequestConfig
|
|
38
|
-
getAssetGroupSchema: (options?: AxiosRequestConfig
|
|
39
|
-
getAutomation: (id: string, options?: AxiosRequestConfig
|
|
40
|
-
listAutomations: (options?: AxiosRequestConfig
|
|
41
|
-
updateAutomation: (id: string, data: any, options?: AxiosRequestConfig
|
|
42
|
-
createAutomation: (data: any, options?: AxiosRequestConfig
|
|
43
|
-
removeAutomation: (id: string, options?: AxiosRequestConfig
|
|
44
|
-
createAutomationLog: (id: string, data: any, options?: AxiosRequestConfig
|
|
45
|
-
updateAutomationLog: (id: string, subId: string, data: any, options?: AxiosRequestConfig
|
|
46
|
-
removeAutomationLog: (id: string, subId: string, options?: AxiosRequestConfig
|
|
47
|
-
getCompany: (id: string, options?: AxiosRequestConfig
|
|
48
|
-
getConsumption: (id: string, options?: AxiosRequestConfig
|
|
49
|
-
listConsumptions: (options?: AxiosRequestConfig
|
|
50
|
-
updateConsumption: (id: string, data: any, options?: AxiosRequestConfig
|
|
51
|
-
createConsumption: (data: any, options?: AxiosRequestConfig
|
|
52
|
-
removeConsumption: (id: string, options?: AxiosRequestConfig
|
|
53
|
-
getConsumptionSchema: (options?: AxiosRequestConfig
|
|
54
|
-
getEmail: (id: string, options?: AxiosRequestConfig
|
|
55
|
-
listEmails: (options?: AxiosRequestConfig
|
|
56
|
-
updateEmail: (id: string, data: any, options?: AxiosRequestConfig
|
|
57
|
-
createEmail: (data: any, options?: AxiosRequestConfig
|
|
58
|
-
removeEmail: (id: string, options?: AxiosRequestConfig
|
|
59
|
-
getEmissionFactor: (id: string, options?: AxiosRequestConfig
|
|
60
|
-
listEmissionFactors: (options?: AxiosRequestConfig
|
|
61
|
-
updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig
|
|
62
|
-
createEmissionFactor: (data: any, options?: AxiosRequestConfig
|
|
63
|
-
removeEmissionFactor: (id: string, options?: AxiosRequestConfig
|
|
64
|
-
getLog: (id: string, options?: AxiosRequestConfig
|
|
65
|
-
listLogs: (options?: AxiosRequestConfig
|
|
66
|
-
updateLog: (id: string, data: any, options?: AxiosRequestConfig
|
|
67
|
-
createLog: (data: any, options?: AxiosRequestConfig
|
|
68
|
-
removeLog: (id: string, options?: AxiosRequestConfig
|
|
69
|
-
getReading: (id: string, options?: AxiosRequestConfig
|
|
70
|
-
listReadings: (options?: AxiosRequestConfig
|
|
71
|
-
updateReading: (id: string, data: any, options?: AxiosRequestConfig
|
|
72
|
-
createReading: (data: any, options?: AxiosRequestConfig
|
|
73
|
-
removeReading: (id: string, options?: AxiosRequestConfig
|
|
74
|
-
getReadingSchema: (options?: AxiosRequestConfig
|
|
75
|
-
getReport: (id: string, options?: AxiosRequestConfig
|
|
76
|
-
listReports: (options?: AxiosRequestConfig
|
|
77
|
-
updateReport: (id: string, data: any, options?: AxiosRequestConfig
|
|
78
|
-
createReport: (data: any, options?: AxiosRequestConfig
|
|
79
|
-
removeReport: (id: string, options?: AxiosRequestConfig
|
|
80
|
-
sendReport: (id: string, data: any, options?: AxiosRequestConfig
|
|
81
|
-
getReportTemplate: (id: string, options?: AxiosRequestConfig
|
|
82
|
-
listReportTemplates: (options?: AxiosRequestConfig
|
|
83
|
-
updateReportTemplate: (id: string, data: any, options?: AxiosRequestConfig
|
|
84
|
-
createReportTemplate: (data: any, options?: AxiosRequestConfig
|
|
85
|
-
removeReportTemplate: (id: string, options?: AxiosRequestConfig
|
|
86
|
-
getScheduledReport: (id: string, options?: AxiosRequestConfig
|
|
87
|
-
listScheduledReports: (options?: AxiosRequestConfig
|
|
88
|
-
updateScheduledReport: (id: string, data: any, options?: AxiosRequestConfig
|
|
89
|
-
createScheduledReport: (data: any, options?: AxiosRequestConfig
|
|
90
|
-
removeScheduledReport: (id: string, options?: AxiosRequestConfig
|
|
91
|
-
sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig
|
|
92
|
-
getInvoice: (id: string, options?: AxiosRequestConfig
|
|
93
|
-
listInvoices: (options?: AxiosRequestConfig
|
|
94
|
-
updateInvoice: (id: string, data: any, options?: AxiosRequestConfig
|
|
95
|
-
createInvoice: (data: any, options?: AxiosRequestConfig
|
|
96
|
-
removeInvoice: (id: string, options?: AxiosRequestConfig
|
|
97
|
-
getInvoiceSchema: (options?: AxiosRequestConfig
|
|
98
|
-
getSupplierSchema: (options?: AxiosRequestConfig
|
|
99
|
-
getImportTemplate: (id: string, options?: AxiosRequestConfig
|
|
100
|
-
updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig
|
|
101
|
-
createDataIngest: (data: any, options?: AxiosRequestConfig
|
|
102
|
-
listDataIngest: (options?: AxiosRequestConfig
|
|
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
|
+
getLog: (id: string, options?: AxiosRequestConfig) => Promise<Log>;
|
|
65
|
+
listLogs: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Log>>;
|
|
66
|
+
updateLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
67
|
+
createLog: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
68
|
+
removeLog: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
69
|
+
getReading: (id: string, options?: AxiosRequestConfig) => Promise<Reading>;
|
|
70
|
+
listReadings: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Reading>>;
|
|
71
|
+
updateReading: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
72
|
+
createReading: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
73
|
+
removeReading: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
74
|
+
getReadingSchema: (options?: AxiosRequestConfig) => Promise<any>;
|
|
75
|
+
getReport: (id: string, options?: AxiosRequestConfig) => Promise<Report>;
|
|
76
|
+
listReports: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Report>>;
|
|
77
|
+
updateReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
78
|
+
createReport: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
79
|
+
removeReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
80
|
+
sendReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
81
|
+
getReportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
82
|
+
listReportTemplates: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
|
|
83
|
+
updateReportTemplate: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
84
|
+
createReportTemplate: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
85
|
+
removeReportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
86
|
+
getScheduledReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
87
|
+
listScheduledReports: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
|
|
88
|
+
updateScheduledReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
89
|
+
createScheduledReport: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
90
|
+
removeScheduledReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
91
|
+
sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
92
|
+
getInvoice: (id: string, options?: AxiosRequestConfig) => Promise<Invoice>;
|
|
93
|
+
listInvoices: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Invoice>>;
|
|
94
|
+
updateInvoice: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
95
|
+
createInvoice: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
96
|
+
removeInvoice: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
97
|
+
getInvoiceSchema: (options?: AxiosRequestConfig) => Promise<any>;
|
|
98
|
+
getSupplierSchema: (options?: AxiosRequestConfig) => Promise<any>;
|
|
99
|
+
getImportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
100
|
+
updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
101
|
+
createDataIngest: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
102
|
+
listDataIngest: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<DataIngest>>;
|
|
103
103
|
};
|
|
104
104
|
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) => (
|
|
35
|
+
getWithId: (etainablApi, endpoint, postEndpoint) => (id_1, ...args_1) => __awaiter(void 0, [id_1, ...args_1], void 0, function* (id, options = {}) {
|
|
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) => (
|
|
56
|
-
var
|
|
55
|
+
get: (etainablApi, endpoint, postEndpoint) => (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (options = {}) {
|
|
56
|
+
var _a;
|
|
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 ((
|
|
67
|
+
if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.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) => (
|
|
76
|
-
var
|
|
75
|
+
list: (etainablApi, endpoint, postEndpoint) => (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (options = {}) {
|
|
76
|
+
var _a;
|
|
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 ((
|
|
87
|
+
if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.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) => (
|
|
96
|
-
var
|
|
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;
|
|
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 ((
|
|
107
|
+
if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.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) => (
|
|
115
|
-
var
|
|
114
|
+
create: (etainablApi, endpoint, postEndpoint) => (data_1, ...args_1) => __awaiter(void 0, [data_1, ...args_1], void 0, function* (data, options = {}) {
|
|
115
|
+
var _a;
|
|
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 ((
|
|
126
|
+
if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.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) => (
|
|
134
|
-
var
|
|
133
|
+
remove: (etainablApi, endpoint, postEndpoint) => (id_1, ...args_1) => __awaiter(void 0, [id_1, ...args_1], void 0, function* (id, options = {}) {
|
|
134
|
+
var _a;
|
|
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 ((
|
|
145
|
+
if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.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) => (
|
|
153
|
-
var
|
|
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;
|
|
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 ((
|
|
161
|
+
if ((_a = e.response) === null || _a === void 0 ? void 0 : _a.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) => (
|
|
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 = {}) {
|
|
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) => (
|
|
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 = {}) {
|
|
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) => (
|
|
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 = {}) {
|
|
184
184
|
const subUrl = `${subEndpoint}/${subId}`;
|
|
185
185
|
return factory.remove(etainablApi, endpoint, subUrl)(id, options);
|
|
186
186
|
})
|
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,
|
|
19
|
+
function connectToDatabase() {
|
|
20
|
+
return __awaiter(this, arguments, void 0, function* (retryAttempt = 1) {
|
|
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,13 +15,23 @@ 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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/dist/cjs/units.d.ts
CHANGED
|
@@ -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' | 'other';
|
|
8
|
+
export type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | 'oil' | 'other';
|
|
9
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';
|
|
10
|
+
export 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/cjs/units.js
CHANGED
|
@@ -10,7 +10,8 @@ exports.accountTypeMap = {
|
|
|
10
10
|
heating: 'kwh',
|
|
11
11
|
flow: 'm3/h',
|
|
12
12
|
cooling: 'kwh',
|
|
13
|
-
temperature: 'C'
|
|
13
|
+
temperature: 'C',
|
|
14
|
+
oil: 'l'
|
|
14
15
|
};
|
|
15
16
|
const unitConversionFactors = {
|
|
16
17
|
kwh: {
|
|
@@ -46,7 +47,8 @@ exports.accountTypeUnitMap = {
|
|
|
46
47
|
heating: ['kwh', 'mwh', 'wh'],
|
|
47
48
|
flow: ['m3/h'],
|
|
48
49
|
cooling: ['kwh', 'mwh', 'wh'],
|
|
49
|
-
temperature: ['C']
|
|
50
|
+
temperature: ['C'],
|
|
51
|
+
oil: ['l']
|
|
50
52
|
};
|
|
51
53
|
// Convert units to base format
|
|
52
54
|
const convertItems = (items, type, defaultUnits, accountFactor) => {
|
package/dist/mjs/api.d.ts
CHANGED
|
@@ -16,89 +16,89 @@ interface AuthOptions {
|
|
|
16
16
|
}
|
|
17
17
|
declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
|
|
18
18
|
instance: AxiosInstance;
|
|
19
|
-
getAccount: (id: string, options?: AxiosRequestConfig
|
|
20
|
-
listAccounts: (options?: AxiosRequestConfig
|
|
21
|
-
updateAccount: (id: string, data: any, options?: AxiosRequestConfig
|
|
22
|
-
createAccount: (data: any, options?: AxiosRequestConfig
|
|
23
|
-
removeAccount: (id: string, options?: AxiosRequestConfig
|
|
24
|
-
getAccountSchema: (options?: AxiosRequestConfig
|
|
25
|
-
invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig
|
|
26
|
-
getAsset: (id: string, options?: AxiosRequestConfig
|
|
27
|
-
listAssets: (options?: AxiosRequestConfig
|
|
28
|
-
updateAsset: (id: string, data: any, options?: AxiosRequestConfig
|
|
29
|
-
createAsset: (data: any, options?: AxiosRequestConfig
|
|
30
|
-
removeAsset: (id: string, options?: AxiosRequestConfig
|
|
31
|
-
getAssetSchema: (options?: AxiosRequestConfig
|
|
32
|
-
getAssetGroup: (id: string, options?: AxiosRequestConfig
|
|
33
|
-
listAssetGroups: (options?: AxiosRequestConfig
|
|
34
|
-
updateAssetGroup: (id: string, data: any, options?: AxiosRequestConfig
|
|
35
|
-
createAssetGroup: (data: any, options?: AxiosRequestConfig
|
|
36
|
-
removeAssetGroup: (id: string, options?: AxiosRequestConfig
|
|
37
|
-
getAssetGroupAssets: (id: string, options?: AxiosRequestConfig
|
|
38
|
-
getAssetGroupSchema: (options?: AxiosRequestConfig
|
|
39
|
-
getAutomation: (id: string, options?: AxiosRequestConfig
|
|
40
|
-
listAutomations: (options?: AxiosRequestConfig
|
|
41
|
-
updateAutomation: (id: string, data: any, options?: AxiosRequestConfig
|
|
42
|
-
createAutomation: (data: any, options?: AxiosRequestConfig
|
|
43
|
-
removeAutomation: (id: string, options?: AxiosRequestConfig
|
|
44
|
-
createAutomationLog: (id: string, data: any, options?: AxiosRequestConfig
|
|
45
|
-
updateAutomationLog: (id: string, subId: string, data: any, options?: AxiosRequestConfig
|
|
46
|
-
removeAutomationLog: (id: string, subId: string, options?: AxiosRequestConfig
|
|
47
|
-
getCompany: (id: string, options?: AxiosRequestConfig
|
|
48
|
-
getConsumption: (id: string, options?: AxiosRequestConfig
|
|
49
|
-
listConsumptions: (options?: AxiosRequestConfig
|
|
50
|
-
updateConsumption: (id: string, data: any, options?: AxiosRequestConfig
|
|
51
|
-
createConsumption: (data: any, options?: AxiosRequestConfig
|
|
52
|
-
removeConsumption: (id: string, options?: AxiosRequestConfig
|
|
53
|
-
getConsumptionSchema: (options?: AxiosRequestConfig
|
|
54
|
-
getEmail: (id: string, options?: AxiosRequestConfig
|
|
55
|
-
listEmails: (options?: AxiosRequestConfig
|
|
56
|
-
updateEmail: (id: string, data: any, options?: AxiosRequestConfig
|
|
57
|
-
createEmail: (data: any, options?: AxiosRequestConfig
|
|
58
|
-
removeEmail: (id: string, options?: AxiosRequestConfig
|
|
59
|
-
getEmissionFactor: (id: string, options?: AxiosRequestConfig
|
|
60
|
-
listEmissionFactors: (options?: AxiosRequestConfig
|
|
61
|
-
updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig
|
|
62
|
-
createEmissionFactor: (data: any, options?: AxiosRequestConfig
|
|
63
|
-
removeEmissionFactor: (id: string, options?: AxiosRequestConfig
|
|
64
|
-
getLog: (id: string, options?: AxiosRequestConfig
|
|
65
|
-
listLogs: (options?: AxiosRequestConfig
|
|
66
|
-
updateLog: (id: string, data: any, options?: AxiosRequestConfig
|
|
67
|
-
createLog: (data: any, options?: AxiosRequestConfig
|
|
68
|
-
removeLog: (id: string, options?: AxiosRequestConfig
|
|
69
|
-
getReading: (id: string, options?: AxiosRequestConfig
|
|
70
|
-
listReadings: (options?: AxiosRequestConfig
|
|
71
|
-
updateReading: (id: string, data: any, options?: AxiosRequestConfig
|
|
72
|
-
createReading: (data: any, options?: AxiosRequestConfig
|
|
73
|
-
removeReading: (id: string, options?: AxiosRequestConfig
|
|
74
|
-
getReadingSchema: (options?: AxiosRequestConfig
|
|
75
|
-
getReport: (id: string, options?: AxiosRequestConfig
|
|
76
|
-
listReports: (options?: AxiosRequestConfig
|
|
77
|
-
updateReport: (id: string, data: any, options?: AxiosRequestConfig
|
|
78
|
-
createReport: (data: any, options?: AxiosRequestConfig
|
|
79
|
-
removeReport: (id: string, options?: AxiosRequestConfig
|
|
80
|
-
sendReport: (id: string, data: any, options?: AxiosRequestConfig
|
|
81
|
-
getReportTemplate: (id: string, options?: AxiosRequestConfig
|
|
82
|
-
listReportTemplates: (options?: AxiosRequestConfig
|
|
83
|
-
updateReportTemplate: (id: string, data: any, options?: AxiosRequestConfig
|
|
84
|
-
createReportTemplate: (data: any, options?: AxiosRequestConfig
|
|
85
|
-
removeReportTemplate: (id: string, options?: AxiosRequestConfig
|
|
86
|
-
getScheduledReport: (id: string, options?: AxiosRequestConfig
|
|
87
|
-
listScheduledReports: (options?: AxiosRequestConfig
|
|
88
|
-
updateScheduledReport: (id: string, data: any, options?: AxiosRequestConfig
|
|
89
|
-
createScheduledReport: (data: any, options?: AxiosRequestConfig
|
|
90
|
-
removeScheduledReport: (id: string, options?: AxiosRequestConfig
|
|
91
|
-
sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig
|
|
92
|
-
getInvoice: (id: string, options?: AxiosRequestConfig
|
|
93
|
-
listInvoices: (options?: AxiosRequestConfig
|
|
94
|
-
updateInvoice: (id: string, data: any, options?: AxiosRequestConfig
|
|
95
|
-
createInvoice: (data: any, options?: AxiosRequestConfig
|
|
96
|
-
removeInvoice: (id: string, options?: AxiosRequestConfig
|
|
97
|
-
getInvoiceSchema: (options?: AxiosRequestConfig
|
|
98
|
-
getSupplierSchema: (options?: AxiosRequestConfig
|
|
99
|
-
getImportTemplate: (id: string, options?: AxiosRequestConfig
|
|
100
|
-
updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig
|
|
101
|
-
createDataIngest: (data: any, options?: AxiosRequestConfig
|
|
102
|
-
listDataIngest: (options?: AxiosRequestConfig
|
|
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
|
+
getLog: (id: string, options?: AxiosRequestConfig) => Promise<Log>;
|
|
65
|
+
listLogs: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Log>>;
|
|
66
|
+
updateLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
67
|
+
createLog: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
68
|
+
removeLog: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
69
|
+
getReading: (id: string, options?: AxiosRequestConfig) => Promise<Reading>;
|
|
70
|
+
listReadings: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Reading>>;
|
|
71
|
+
updateReading: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
72
|
+
createReading: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
73
|
+
removeReading: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
74
|
+
getReadingSchema: (options?: AxiosRequestConfig) => Promise<any>;
|
|
75
|
+
getReport: (id: string, options?: AxiosRequestConfig) => Promise<Report>;
|
|
76
|
+
listReports: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Report>>;
|
|
77
|
+
updateReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
78
|
+
createReport: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
79
|
+
removeReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
80
|
+
sendReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
81
|
+
getReportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
82
|
+
listReportTemplates: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
|
|
83
|
+
updateReportTemplate: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
84
|
+
createReportTemplate: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
85
|
+
removeReportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
86
|
+
getScheduledReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
87
|
+
listScheduledReports: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<any>>;
|
|
88
|
+
updateScheduledReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
89
|
+
createScheduledReport: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
90
|
+
removeScheduledReport: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
91
|
+
sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
92
|
+
getInvoice: (id: string, options?: AxiosRequestConfig) => Promise<Invoice>;
|
|
93
|
+
listInvoices: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Invoice>>;
|
|
94
|
+
updateInvoice: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
95
|
+
createInvoice: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
96
|
+
removeInvoice: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
97
|
+
getInvoiceSchema: (options?: AxiosRequestConfig) => Promise<any>;
|
|
98
|
+
getSupplierSchema: (options?: AxiosRequestConfig) => Promise<any>;
|
|
99
|
+
getImportTemplate: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
100
|
+
updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
101
|
+
createDataIngest: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
102
|
+
listDataIngest: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<DataIngest>>;
|
|
103
103
|
};
|
|
104
104
|
export default _default;
|
package/dist/mjs/units.d.ts
CHANGED
|
@@ -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' | 'other';
|
|
8
|
+
export type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | 'oil' | 'other';
|
|
9
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';
|
|
10
|
+
export 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/units.js
CHANGED
|
@@ -7,7 +7,8 @@ export const accountTypeMap = {
|
|
|
7
7
|
heating: 'kwh',
|
|
8
8
|
flow: 'm3/h',
|
|
9
9
|
cooling: 'kwh',
|
|
10
|
-
temperature: 'C'
|
|
10
|
+
temperature: 'C',
|
|
11
|
+
oil: 'l'
|
|
11
12
|
};
|
|
12
13
|
const unitConversionFactors = {
|
|
13
14
|
kwh: {
|
|
@@ -43,7 +44,8 @@ export const accountTypeUnitMap = {
|
|
|
43
44
|
heating: ['kwh', 'mwh', 'wh'],
|
|
44
45
|
flow: ['m3/h'],
|
|
45
46
|
cooling: ['kwh', 'mwh', 'wh'],
|
|
46
|
-
temperature: ['C']
|
|
47
|
+
temperature: ['C'],
|
|
48
|
+
oil: ['l']
|
|
47
49
|
};
|
|
48
50
|
// Convert units to base format
|
|
49
51
|
export const convertItems = (items, type, defaultUnits, accountFactor) => {
|
package/package.json
CHANGED
package/src/units.ts
CHANGED
|
@@ -6,9 +6,9 @@ interface Item {
|
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | 'other';
|
|
9
|
+
export type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | 'oil' | 'other';
|
|
10
10
|
export type ETNUnit = 'kwh' | 'kg' | 'm3' | 'lbs' | 'tonnes' | 'wh' | 'mwh' | 'ft3' | 'hcf' | 'm3/h' | 'qty' | 'l' | 'C' | 'mcuf' | 'hcuf' | 'tcuf' | 'ocuf' | 'hm3' | 'tm3' | 'nm3';
|
|
11
|
-
export type BaseUnit = 'kwh' | 'm3' | 'C' | 'kg' | 'm3/h';
|
|
11
|
+
export type BaseUnit = 'kwh' | 'm3' | 'C' | 'kg' | 'm3/h' | 'l';
|
|
12
12
|
export const accountTypeMap: { [key: string]: BaseUnit } = {
|
|
13
13
|
electricity: 'kwh',
|
|
14
14
|
gas: 'kwh',
|
|
@@ -18,7 +18,8 @@ export const accountTypeMap: { [key: string]: BaseUnit } = {
|
|
|
18
18
|
heating: 'kwh',
|
|
19
19
|
flow: 'm3/h',
|
|
20
20
|
cooling: 'kwh',
|
|
21
|
-
temperature: 'C'
|
|
21
|
+
temperature: 'C',
|
|
22
|
+
oil: 'l'
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
const unitConversionFactors: { [key: string]: any } = {
|
|
@@ -56,7 +57,8 @@ export const accountTypeUnitMap: { [key: string]: ETNUnit[] } = {
|
|
|
56
57
|
heating: ['kwh', 'mwh', 'wh'],
|
|
57
58
|
flow: ['m3/h'],
|
|
58
59
|
cooling: ['kwh', 'mwh', 'wh'],
|
|
59
|
-
temperature: ['C']
|
|
60
|
+
temperature: ['C'],
|
|
61
|
+
oil: ['l']
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
// Convert units to base format
|