@etainabl/nodejs-sdk 1.2.32 → 1.2.33
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 +7 -1
- package/dist/cjs/api.js +7 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/mjs/api.d.ts +7 -1
- package/dist/mjs/api.js +7 -0
- package/dist/mjs/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/api.ts +10 -1
- package/src/types/entity.d.ts +18 -0
- package/src/types/index.ts +2 -0
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, Company, DataIngest, Invoice, Log, Reading, Report } from './types/index.js';
|
|
2
|
+
import type { Account, Asset, Automation, Entity, Company, DataIngest, Invoice, Log, Reading, Report } from './types/index.js';
|
|
3
3
|
export interface ETNPagedResponse<T = any> {
|
|
4
4
|
data: T[];
|
|
5
5
|
total: number;
|
|
@@ -61,6 +61,12 @@ declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefault
|
|
|
61
61
|
updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
62
62
|
createEmissionFactor: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
63
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>;
|
|
64
70
|
getLog: (id: string, options?: AxiosRequestConfig) => Promise<Log>;
|
|
65
71
|
listLogs: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Log>>;
|
|
66
72
|
updateLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
package/dist/cjs/api.js
CHANGED
|
@@ -253,6 +253,13 @@ exports.default = (auth, instanceOptions = {}) => {
|
|
|
253
253
|
updateEmissionFactor: factory.update(etainablApi, 'emission-factors'),
|
|
254
254
|
createEmissionFactor: factory.create(etainablApi, 'emission-factors'),
|
|
255
255
|
removeEmissionFactor: factory.remove(etainablApi, 'emission-factors'),
|
|
256
|
+
// entity
|
|
257
|
+
getEntity: factory.getWithId(etainablApi, 'entities'),
|
|
258
|
+
listEntities: factory.list(etainablApi, 'entities'),
|
|
259
|
+
updateEntity: factory.update(etainablApi, 'entities'),
|
|
260
|
+
createEntity: factory.create(etainablApi, 'entities'),
|
|
261
|
+
removeEntity: factory.remove(etainablApi, 'entities'),
|
|
262
|
+
getEntitiesSchema: factory.get(etainablApi, 'entities', 'schema'),
|
|
256
263
|
// logs
|
|
257
264
|
getLog: factory.getWithId(etainablApi, 'logs'),
|
|
258
265
|
listLogs: factory.list(etainablApi, 'logs'),
|
|
@@ -4,13 +4,14 @@ import type { Automation } from './automation.js';
|
|
|
4
4
|
import type { Company } from './company.js';
|
|
5
5
|
import type { CreateScraperRunParams, ScraperRun } from './scraperRun.js';
|
|
6
6
|
import type { DataIngest } from './dataIngest.js';
|
|
7
|
+
import type { Entity } from './entity.js';
|
|
7
8
|
import type { Email } from './email.js';
|
|
8
9
|
import type { Invoice } from './invoice.js';
|
|
9
10
|
import type { Log } from './log.js';
|
|
10
11
|
import type { Reading } from './reading.js';
|
|
11
12
|
import type { Report } from './report.js';
|
|
12
13
|
import type { Supplier } from './supplier.js';
|
|
13
|
-
export type { Account, Asset, Automation, Company, CreateScraperRunParams, DataIngest, Email, Invoice, Log, Reading, Report, ScraperRun, Supplier };
|
|
14
|
+
export type { Account, Asset, Automation, Company, CreateScraperRunParams, DataIngest, Email, Entity, Invoice, Log, Reading, Report, ScraperRun, Supplier };
|
|
14
15
|
export interface ETNPagedResponse<T = any> {
|
|
15
16
|
data: T[];
|
|
16
17
|
total: number;
|
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, Company, DataIngest, Invoice, Log, Reading, Report } from './types/index.js';
|
|
2
|
+
import type { Account, Asset, Automation, Entity, Company, DataIngest, Invoice, Log, Reading, Report } from './types/index.js';
|
|
3
3
|
export interface ETNPagedResponse<T = any> {
|
|
4
4
|
data: T[];
|
|
5
5
|
total: number;
|
|
@@ -61,6 +61,12 @@ declare const _default: (auth: AuthOptions, instanceOptions?: CreateAxiosDefault
|
|
|
61
61
|
updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
62
62
|
createEmissionFactor: (data: any, options?: AxiosRequestConfig) => Promise<any>;
|
|
63
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>;
|
|
64
70
|
getLog: (id: string, options?: AxiosRequestConfig) => Promise<Log>;
|
|
65
71
|
listLogs: (options?: AxiosRequestConfig) => Promise<ETNPagedResponse<Log>>;
|
|
66
72
|
updateLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
|
package/dist/mjs/api.js
CHANGED
|
@@ -243,6 +243,13 @@ export default (auth, instanceOptions = {}) => {
|
|
|
243
243
|
updateEmissionFactor: factory.update(etainablApi, 'emission-factors'),
|
|
244
244
|
createEmissionFactor: factory.create(etainablApi, 'emission-factors'),
|
|
245
245
|
removeEmissionFactor: factory.remove(etainablApi, 'emission-factors'),
|
|
246
|
+
// entity
|
|
247
|
+
getEntity: factory.getWithId(etainablApi, 'entities'),
|
|
248
|
+
listEntities: factory.list(etainablApi, 'entities'),
|
|
249
|
+
updateEntity: factory.update(etainablApi, 'entities'),
|
|
250
|
+
createEntity: factory.create(etainablApi, 'entities'),
|
|
251
|
+
removeEntity: factory.remove(etainablApi, 'entities'),
|
|
252
|
+
getEntitiesSchema: factory.get(etainablApi, 'entities', 'schema'),
|
|
246
253
|
// logs
|
|
247
254
|
getLog: factory.getWithId(etainablApi, 'logs'),
|
|
248
255
|
listLogs: factory.list(etainablApi, 'logs'),
|
|
@@ -4,13 +4,14 @@ import type { Automation } from './automation.js';
|
|
|
4
4
|
import type { Company } from './company.js';
|
|
5
5
|
import type { CreateScraperRunParams, ScraperRun } from './scraperRun.js';
|
|
6
6
|
import type { DataIngest } from './dataIngest.js';
|
|
7
|
+
import type { Entity } from './entity.js';
|
|
7
8
|
import type { Email } from './email.js';
|
|
8
9
|
import type { Invoice } from './invoice.js';
|
|
9
10
|
import type { Log } from './log.js';
|
|
10
11
|
import type { Reading } from './reading.js';
|
|
11
12
|
import type { Report } from './report.js';
|
|
12
13
|
import type { Supplier } from './supplier.js';
|
|
13
|
-
export type { Account, Asset, Automation, Company, CreateScraperRunParams, DataIngest, Email, Invoice, Log, Reading, Report, ScraperRun, Supplier };
|
|
14
|
+
export type { Account, Asset, Automation, Company, CreateScraperRunParams, DataIngest, Email, Entity, Invoice, Log, Reading, Report, ScraperRun, Supplier };
|
|
14
15
|
export interface ETNPagedResponse<T = any> {
|
|
15
16
|
data: T[];
|
|
16
17
|
total: number;
|
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, Report, Supplier } from './types/index.js'
|
|
7
|
+
import type { Account, Asset, Automation, Entity, Company, DataIngest, Invoice, Log, Reading, Report, Supplier } from './types/index.js'
|
|
8
8
|
|
|
9
9
|
const log = logger('etainablApi');
|
|
10
10
|
|
|
@@ -306,6 +306,15 @@ export default (auth: AuthOptions, instanceOptions: CreateAxiosDefaults = {}) =>
|
|
|
306
306
|
updateEmissionFactor: factory.update(etainablApi, 'emission-factors'),
|
|
307
307
|
createEmissionFactor: factory.create(etainablApi, 'emission-factors'),
|
|
308
308
|
removeEmissionFactor: factory.remove(etainablApi, 'emission-factors'),
|
|
309
|
+
|
|
310
|
+
// entity
|
|
311
|
+
getEntity: factory.getWithId<Entity>(etainablApi, 'entities'),
|
|
312
|
+
listEntities: factory.list<Entity>(etainablApi, 'entities'),
|
|
313
|
+
updateEntity: factory.update(etainablApi, 'entities'),
|
|
314
|
+
createEntity: factory.create(etainablApi, 'entities'),
|
|
315
|
+
removeEntity: factory.remove(etainablApi, 'entities'),
|
|
316
|
+
getEntitiesSchema: factory.get(etainablApi, 'entities', 'schema'),
|
|
317
|
+
|
|
309
318
|
|
|
310
319
|
// logs
|
|
311
320
|
getLog: factory.getWithId<Log>(etainablApi, 'logs'),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Types } from 'mongoose';
|
|
2
|
+
import { Address} from './address.ts';
|
|
3
|
+
|
|
4
|
+
type EntityType = 'fund' | 'company' | 'charity' | 'school/university' | 'council' | 'other';
|
|
5
|
+
|
|
6
|
+
export interface Entity {
|
|
7
|
+
_id?: Types.ObjectId;
|
|
8
|
+
legalName: string;
|
|
9
|
+
type: EntityType;
|
|
10
|
+
companyNumber?: string;
|
|
11
|
+
companyLogo?: string;
|
|
12
|
+
billingAddress: Address;
|
|
13
|
+
parentEntityId?: Types.ObjectId;
|
|
14
|
+
ultimateParentEntityId?: Types.ObjectId;
|
|
15
|
+
companyId: Types.ObjectId;
|
|
16
|
+
batchId?: string;
|
|
17
|
+
userSub: string;
|
|
18
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Automation } from './automation.js'
|
|
|
4
4
|
import type { Company } from './company.js'
|
|
5
5
|
import type { CreateScraperRunParams, ScraperRun } from './scraperRun.js';
|
|
6
6
|
import type { DataIngest } from './dataIngest.js'
|
|
7
|
+
import type { Entity } from './entity.js'
|
|
7
8
|
import type { Email } from './email.js';
|
|
8
9
|
import type { Invoice } from './invoice.js';
|
|
9
10
|
import type { Log } from './log.js';
|
|
@@ -19,6 +20,7 @@ export type {
|
|
|
19
20
|
CreateScraperRunParams,
|
|
20
21
|
DataIngest,
|
|
21
22
|
Email,
|
|
23
|
+
Entity,
|
|
22
24
|
Invoice,
|
|
23
25
|
Log,
|
|
24
26
|
Reading,
|