@etainabl/nodejs-sdk 1.2.20 → 1.2.22

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,4 +1,5 @@
1
1
  import type { AxiosRequestConfig, AxiosInstance, CreateAxiosDefaults } from 'axios';
2
+ import type { Account, Asset, Company, Invoice, Log, Reading, Report } from '../types/index.js';
2
3
  export interface ETNPagedResponse<T = any> {
3
4
  data: T[];
4
5
  total: number;
@@ -71,8 +72,8 @@ declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefault
71
72
  createReading: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
72
73
  removeReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
73
74
  getReadingSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
74
- getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
75
- listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
75
+ getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report>;
76
+ listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report>>;
76
77
  updateReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
77
78
  createReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
78
79
  removeReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
@@ -5,9 +5,9 @@ interface Item {
5
5
  value: number;
6
6
  [key: string]: any;
7
7
  }
8
- export declare type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | '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';
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, Report } from '../types/index.js';
2
3
  export interface ETNPagedResponse<T = any> {
3
4
  data: T[];
4
5
  total: number;
@@ -71,8 +72,8 @@ declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefault
71
72
  createReading: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
72
73
  removeReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
73
74
  getReadingSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
74
- getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
75
- listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
75
+ getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report>;
76
+ listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report>>;
76
77
  updateReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
77
78
  createReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
78
79
  removeReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
@@ -5,9 +5,9 @@ interface Item {
5
5
  value: number;
6
6
  [key: string]: any;
7
7
  }
8
- export declare type AccountType = 'electricity' | 'gas' | 'water' | 'waste' | 'solar' | 'heating' | 'flow' | 'cooling' | 'temperature' | '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';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etainabl/nodejs-sdk",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/mjs/index.js",
6
6
  "author": "Jonathan Lambert <jonathan@etainabl.com>",
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
 
@@ -323,8 +323,8 @@ export default (auth: AuthOptions, instanceOptions: CreateAxiosDefaults = {}) =>
323
323
  getReadingSchema: factory.get(etainablApi, 'readings', 'schema'),
324
324
 
325
325
  // reports
326
- getReport: factory.getWithId(etainablApi, 'reports'),
327
- listReports: factory.list(etainablApi, 'reports'),
326
+ getReport: factory.getWithId<Report>(etainablApi, 'reports'),
327
+ listReports: factory.list<Report>(etainablApi, 'reports'),
328
328
  updateReport: factory.update(etainablApi, 'reports'),
329
329
  createReport: factory.create(etainablApi, 'reports'),
330
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,20 @@
1
+ export 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
+ }