@etainabl/nodejs-sdk 1.2.19 → 1.2.21
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 +4 -2
- package/dist/cjs/api.js +1 -0
- package/dist/cjs/units.d.ts +3 -3
- package/dist/mjs/api.d.ts +4 -2
- package/dist/mjs/api.js +1 -0
- package/dist/mjs/units.d.ts +3 -3
- package/package.json +1 -1
- package/src/api.ts +4 -3
- package/types/index.d.ts +2 -0
- package/types/report.d.ts +22 -0
package/dist/cjs/api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AxiosRequestConfig, AxiosInstance, CreateAxiosDefaults } from 'axios';
|
|
2
|
+
import type { Account, Asset, Company, Invoice, Log, Reading } from '../types/index.js';
|
|
2
3
|
export interface ETNPagedResponse<T = any> {
|
|
3
4
|
data: T[];
|
|
4
5
|
total: number;
|
|
@@ -21,6 +22,7 @@ declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefault
|
|
|
21
22
|
createAccount: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
22
23
|
removeAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
23
24
|
getAccountSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
25
|
+
invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
24
26
|
getAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<Asset>;
|
|
25
27
|
listAssets: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Asset>>;
|
|
26
28
|
updateAsset: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
@@ -70,8 +72,8 @@ declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefault
|
|
|
70
72
|
createReading: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
71
73
|
removeReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
72
74
|
getReadingSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
73
|
-
getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<
|
|
74
|
-
listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<
|
|
75
|
+
getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report>;
|
|
76
|
+
listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report>>;
|
|
75
77
|
updateReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
76
78
|
createReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
77
79
|
removeReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
|
package/dist/cjs/api.js
CHANGED
|
@@ -207,6 +207,7 @@ exports.default = (auth, instanceOptions = {}) => {
|
|
|
207
207
|
createAccount: factory.create(etainablApi, 'accounts'),
|
|
208
208
|
removeAccount: factory.remove(etainablApi, 'accounts'),
|
|
209
209
|
getAccountSchema: factory.get(etainablApi, 'accounts', 'schema'),
|
|
210
|
+
invalidateAccountCache: factory.customWithId(etainablApi, 'put', 'accounts', 'invalidate-cache'),
|
|
210
211
|
// assets
|
|
211
212
|
getAsset: factory.getWithId(etainablApi, 'assets'),
|
|
212
213
|
listAssets: factory.list(etainablApi, 'assets'),
|
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
|
|
9
|
-
export
|
|
10
|
-
export
|
|
8
|
+
export type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | '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';
|
|
11
11
|
export declare const accountTypeMap: {
|
|
12
12
|
[key: string]: BaseUnit;
|
|
13
13
|
};
|
package/dist/mjs/api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AxiosRequestConfig, AxiosInstance, CreateAxiosDefaults } from 'axios';
|
|
2
|
+
import type { Account, Asset, Company, Invoice, Log, Reading } from '../types/index.js';
|
|
2
3
|
export interface ETNPagedResponse<T = any> {
|
|
3
4
|
data: T[];
|
|
4
5
|
total: number;
|
|
@@ -21,6 +22,7 @@ declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefault
|
|
|
21
22
|
createAccount: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
22
23
|
removeAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
23
24
|
getAccountSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
25
|
+
invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
24
26
|
getAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<Asset>;
|
|
25
27
|
listAssets: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Asset>>;
|
|
26
28
|
updateAsset: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
@@ -70,8 +72,8 @@ declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefault
|
|
|
70
72
|
createReading: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
71
73
|
removeReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
72
74
|
getReadingSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
73
|
-
getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<
|
|
74
|
-
listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<
|
|
75
|
+
getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report>;
|
|
76
|
+
listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report>>;
|
|
75
77
|
updateReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
76
78
|
createReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
|
|
77
79
|
removeReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
|
package/dist/mjs/api.js
CHANGED
|
@@ -197,6 +197,7 @@ export default (auth, instanceOptions = {}) => {
|
|
|
197
197
|
createAccount: factory.create(etainablApi, 'accounts'),
|
|
198
198
|
removeAccount: factory.remove(etainablApi, 'accounts'),
|
|
199
199
|
getAccountSchema: factory.get(etainablApi, 'accounts', 'schema'),
|
|
200
|
+
invalidateAccountCache: factory.customWithId(etainablApi, 'put', 'accounts', 'invalidate-cache'),
|
|
200
201
|
// assets
|
|
201
202
|
getAsset: factory.getWithId(etainablApi, 'assets'),
|
|
202
203
|
listAssets: factory.list(etainablApi, 'assets'),
|
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
|
|
9
|
-
export
|
|
10
|
-
export
|
|
8
|
+
export type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | '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';
|
|
11
11
|
export declare const accountTypeMap: {
|
|
12
12
|
[key: string]: BaseUnit;
|
|
13
13
|
};
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -4,7 +4,7 @@ import https from 'https';
|
|
|
4
4
|
|
|
5
5
|
import logger from './logger.js';
|
|
6
6
|
|
|
7
|
-
import type { Account, Asset, Automation, Company, DataIngest, Invoice, Log, Reading, Supplier } from '../types/index.js'
|
|
7
|
+
import type { Account, Asset, Automation, Company, DataIngest, Invoice, Log, Reading, Report, Supplier } from '../types/index.js'
|
|
8
8
|
|
|
9
9
|
const log = logger('etainablApi');
|
|
10
10
|
|
|
@@ -253,6 +253,7 @@ export default (auth: AuthOptions, instanceOptions: CreateAxiosDefaults = {}) =>
|
|
|
253
253
|
createAccount: factory.create(etainablApi, 'accounts'),
|
|
254
254
|
removeAccount: factory.remove(etainablApi, 'accounts'),
|
|
255
255
|
getAccountSchema: factory.get(etainablApi, 'accounts', 'schema'),
|
|
256
|
+
invalidateAccountCache: factory.customWithId(etainablApi, 'put', 'accounts', 'invalidate-cache'),
|
|
256
257
|
|
|
257
258
|
// assets
|
|
258
259
|
getAsset: factory.getWithId<Asset>(etainablApi, 'assets'),
|
|
@@ -322,8 +323,8 @@ export default (auth: AuthOptions, instanceOptions: CreateAxiosDefaults = {}) =>
|
|
|
322
323
|
getReadingSchema: factory.get(etainablApi, 'readings', 'schema'),
|
|
323
324
|
|
|
324
325
|
// reports
|
|
325
|
-
getReport: factory.getWithId(etainablApi, 'reports'),
|
|
326
|
-
listReports: factory.list(etainablApi, 'reports'),
|
|
326
|
+
getReport: factory.getWithId<Report>(etainablApi, 'reports'),
|
|
327
|
+
listReports: factory.list<Report>(etainablApi, 'reports'),
|
|
327
328
|
updateReport: factory.update(etainablApi, 'reports'),
|
|
328
329
|
createReport: factory.create(etainablApi, 'reports'),
|
|
329
330
|
removeReport: factory.remove(etainablApi, 'reports'),
|
package/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { Email } from './email.d.ts';
|
|
|
7
7
|
import type { Invoice } from './invoice.d.ts';
|
|
8
8
|
import type { Log } from './log.d.ts';
|
|
9
9
|
import type { Reading } from './reading.d.ts'
|
|
10
|
+
import type { Report } from './report.d.ts'
|
|
10
11
|
import type { Supplier } from './supplier.d.ts'
|
|
11
12
|
|
|
12
13
|
export type {
|
|
@@ -20,6 +21,7 @@ export type {
|
|
|
20
21
|
Invoice,
|
|
21
22
|
Log,
|
|
22
23
|
Reading,
|
|
24
|
+
Report,
|
|
23
25
|
ScraperRun,
|
|
24
26
|
Supplier
|
|
25
27
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface Report {
|
|
2
|
+
type: 'dynamic' | 'spreadsheet' | 'table' | 'pdf';
|
|
3
|
+
subType?: string;
|
|
4
|
+
fileFormat: 'pdf' | 'xlsx' | 'csv' | 'png' | 'jpg' | 'chart';
|
|
5
|
+
fileName?: string;
|
|
6
|
+
status: 'preparing' | 'ready';
|
|
7
|
+
scheduled?: boolean;
|
|
8
|
+
version?: number;
|
|
9
|
+
metadata?: Record<string, any>;
|
|
10
|
+
data?: Record<string, any>;
|
|
11
|
+
requestedAt: Date;
|
|
12
|
+
availableAt?: Date;
|
|
13
|
+
s3Key: string | null;
|
|
14
|
+
batchId?: string;
|
|
15
|
+
scheduledReportId?: string;
|
|
16
|
+
reportTemplateId?: string;
|
|
17
|
+
entityId: string;
|
|
18
|
+
companyId: string;
|
|
19
|
+
userSub?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Report;
|