@etainabl/nodejs-sdk 1.2.52 → 1.2.55

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.
Files changed (3) hide show
  1. package/dist/index.d.cts +111 -118
  2. package/dist/index.d.ts +111 -118
  3. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,15 +1,16 @@
1
+ import * as bson from 'bson';
1
2
  import * as axios from 'axios';
2
3
  import { CreateAxiosDefaults, AxiosInstance, AxiosRequestConfig } from 'axios';
3
4
  import { ObjectId, Db } from 'mongodb';
4
5
  import winston from 'winston';
5
6
  import moment from 'moment';
6
7
 
7
- interface Portal {
8
+ interface Portal<IDType = ObjectId | string> {
8
9
  username?: string;
9
10
  password?: string;
10
11
  scraperEnabled?: boolean;
11
12
  url?: string;
12
- scraperId?: ObjectId | string;
13
+ scraperId?: IDType;
13
14
  scraperStartDate?: Date;
14
15
  }
15
16
 
@@ -29,8 +30,8 @@ interface RateSchema {
29
30
  value: number;
30
31
  description: string;
31
32
  }
32
- interface ContractSchema {
33
- _id: ObjectId | string;
33
+ interface ContractSchema<IDType = ObjectId | string> {
34
+ _id: IDType;
34
35
  startDate: Date;
35
36
  endDate: Date;
36
37
  terminationDate?: Date;
@@ -47,13 +48,13 @@ interface ContractSchema {
47
48
  s3Key?: string;
48
49
  rateTypeMapping?: object;
49
50
  batchId?: string;
50
- supplierId?: ObjectId | string;
51
+ supplierId?: IDType;
51
52
  status: 'active' | 'inactive';
52
53
  userSub?: string;
53
54
  deletedOn?: Date;
54
55
  }
55
- interface CreditNoteSchema {
56
- _id: ObjectId | string;
56
+ interface CreditNoteSchema<IDType = ObjectId | string> {
57
+ _id: IDType;
57
58
  name: string;
58
59
  type: string;
59
60
  amount: number;
@@ -66,8 +67,8 @@ interface CreditNoteSchema {
66
67
  fileName: string;
67
68
  invoiceData: object;
68
69
  userSub: string;
69
- readingIds: ObjectId[] | string[];
70
- supplierId: ObjectId | string;
70
+ readingIds: IDType[];
71
+ supplierId: IDType;
71
72
  totalUnits: number;
72
73
  endDate: Date;
73
74
  startDate: Date;
@@ -77,8 +78,8 @@ interface CreditNoteSchema {
77
78
  totalWaterCost: number;
78
79
  totalWasteCost: number;
79
80
  }
80
- interface Account {
81
- _id: ObjectId | string;
81
+ interface Account<IDType = ObjectId | string> {
82
+ _id: IDType;
82
83
  name: string;
83
84
  modifiedBy?: string;
84
85
  siteCode?: string;
@@ -100,7 +101,7 @@ interface Account {
100
101
  meterOperatorType?: 'lease' | 'purchase';
101
102
  meterOperatorExpiryDate?: Date;
102
103
  dataCollector?: string;
103
- parentAccountId?: ObjectId | string;
104
+ parentAccountId?: IDType;
104
105
  processingInvoices?: object[];
105
106
  contracts?: ContractSchema[];
106
107
  creditNotes?: CreditNoteSchema[];
@@ -125,11 +126,11 @@ interface Account {
125
126
  };
126
127
  automationIds?: ObjectId[] | string[];
127
128
  customIntegrations?: object;
128
- supplierId?: ObjectId | string;
129
+ supplierId?: IDType;
129
130
  batchId?: string;
130
- assetId: ObjectId | string;
131
- entityId: ObjectId | string;
132
- companyId: ObjectId | string;
131
+ assetId: IDType;
132
+ entityId: IDType;
133
+ companyId: IDType;
133
134
  userSub: string;
134
135
  }
135
136
 
@@ -208,9 +209,9 @@ interface TimelineEvent {
208
209
  icon?: string;
209
210
  accountIds?: ObjectId[] | string[];
210
211
  }
211
- interface AssetRecommendation {
212
- recommendationId: ObjectId | string;
213
- documentIds?: ObjectId[] | string[];
212
+ interface AssetRecommendation<IDType = ObjectId | string> {
213
+ recommendationId: IDType;
214
+ documentIds?: IDType[];
214
215
  }
215
216
  interface AssetSettings {
216
217
  consumptionSources: {
@@ -220,8 +221,8 @@ interface AssetSettings {
220
221
  water: string;
221
222
  };
222
223
  }
223
- interface Asset {
224
- _id: ObjectId | string;
224
+ interface Asset<IDType = ObjectId | string> {
225
+ _id: IDType;
225
226
  siteName: string;
226
227
  address: Address;
227
228
  assetType: string;
@@ -258,15 +259,15 @@ interface Asset {
258
259
  lastPopulated?: Date;
259
260
  deletedOn?: Date;
260
261
  batchId?: string;
261
- companyId: ObjectId | string;
262
- entityId: ObjectId | string;
262
+ companyId: IDType;
263
+ entityId: IDType;
263
264
  assetGroupIds: ObjectId[] | string[];
264
265
  userSub: string;
265
266
  gresbId?: string;
266
267
  }
267
268
 
268
- interface Log$1 {
269
- _id: ObjectId | string;
269
+ interface Log$1<IDType = ObjectId | string> {
270
+ _id: IDType;
270
271
  message: string;
271
272
  timestamp: Date;
272
273
  batchId?: string;
@@ -280,8 +281,8 @@ interface LastCollection {
280
281
  source: Record<string, any> | null;
281
282
  }
282
283
  type FrequencyType = 'never' | 'trigger' | 'hourly' | 'daily' | 'weekly' | 'monthly';
283
- interface Automation {
284
- _id: ObjectId | string;
284
+ interface Automation<IDType = ObjectId | string> {
285
+ _id: IDType;
285
286
  description?: string;
286
287
  service: string;
287
288
  source: string;
@@ -296,11 +297,11 @@ interface Automation {
296
297
  accountIds?: ObjectId[] | string[];
297
298
  assetIds?: ObjectId[] | string[];
298
299
  userSub: string;
299
- companyId: ObjectId | string;
300
+ companyId: IDType;
300
301
  }
301
302
 
302
- interface SupplierPortals {
303
- supplierId: ObjectId | string;
303
+ interface SupplierPortals<IDType = ObjectId | string> {
304
+ supplierId: IDType;
304
305
  portal: Portal;
305
306
  }
306
307
  interface CustomIntegrations {
@@ -328,8 +329,8 @@ interface CompanySettings {
328
329
  defaultSources?: DefaultSources;
329
330
  scraperCounter?: number;
330
331
  }
331
- interface Company {
332
- _id: ObjectId | string;
332
+ interface Company<IDType = ObjectId | string> {
333
+ _id: IDType;
333
334
  name: string;
334
335
  address?: Address;
335
336
  invoiceEmail?: string;
@@ -339,24 +340,24 @@ interface Company {
339
340
  logoUrl?: string;
340
341
  }
341
342
 
342
- interface CreateScraperRunParams {
343
- supplierId: ObjectId | string;
344
- accountId: ObjectId | string;
345
- companyId: ObjectId | string;
343
+ interface CreateScraperRunParams<IDType = ObjectId | string> {
344
+ supplierId: IDType;
345
+ accountId: IDType;
346
+ companyId: IDType;
346
347
  }
347
- interface ScraperRun {
348
- _id: ObjectId | string;
348
+ interface ScraperRun<IDType = ObjectId | string> {
349
+ _id: IDType;
349
350
  logs?: {}[];
350
- supplierId: ObjectId | string;
351
- accountId: ObjectId | string;
352
- companyId: ObjectId | string;
351
+ supplierId: IDType;
352
+ accountId: IDType;
353
+ companyId: IDType;
353
354
  invoiceData?: [];
354
355
  status: string[];
355
356
  error?: string;
356
357
  }
357
358
 
358
- interface DataIngest {
359
- _id: ObjectId | string;
359
+ interface DataIngest<IDType = ObjectId | string> {
360
+ _id: IDType;
360
361
  messageId: string;
361
362
  status: 'started' | 'processing' | 'importing' | 'completed' | 'failed' | 'dlq';
362
363
  context: any;
@@ -365,16 +366,16 @@ interface DataIngest {
365
366
  }
366
367
 
367
368
  type EntityType = 'fund' | 'company' | 'charity' | 'school/university' | 'council' | 'other';
368
- interface Entity {
369
- _id: ObjectId | string;
369
+ interface Entity<IDType = ObjectId | string> {
370
+ _id: IDType;
370
371
  legalName: string;
371
372
  type: EntityType;
372
373
  companyNumber?: string;
373
374
  companyLogo?: string;
374
375
  billingAddress: Address;
375
- parentEntityId?: ObjectId | string;
376
- ultimateParentEntityId?: ObjectId | string;
377
- companyId: ObjectId | string;
376
+ parentEntityId?: IDType;
377
+ ultimateParentEntityId?: IDType;
378
+ companyId: IDType;
378
379
  batchId?: string;
379
380
  userSub: string;
380
381
  }
@@ -383,8 +384,8 @@ interface Attachment {
383
384
  filename: string;
384
385
  s3Key: string;
385
386
  }
386
- interface Email {
387
- _id: ObjectId | string;
387
+ interface Email<IDType = ObjectId | string> {
388
+ _id: IDType;
388
389
  destinations: string[];
389
390
  service: string;
390
391
  subject: string;
@@ -394,7 +395,7 @@ interface Email {
394
395
  sesMessageId: string;
395
396
  s3Key: string;
396
397
  userSub?: string;
397
- companyId?: ObjectId | string;
398
+ companyId?: IDType;
398
399
  }
399
400
 
400
401
  interface InvoiceValues {
@@ -474,8 +475,8 @@ interface InvoiceRate {
474
475
  type InvoiceStatus = 'processing' | 'pending' | 'uploading' | 'queued' | 'captured' | 'error' | 'completed';
475
476
  type FinancialStatus = 'approved' | 'new' | 'not-approved' | 'paid' | 'sent-for-payment';
476
477
  type InvoiceRateType = 'unitRate' | 'daily' | 'levy' | 'tax' | 'kva' | 'waterRate' | 'wasteRate' | 'discount';
477
- interface Invoice {
478
- _id: ObjectId | string;
478
+ interface Invoice<IDType = ObjectId | string> {
479
+ _id: IDType;
479
480
  jobId?: string | null;
480
481
  startTime?: Date;
481
482
  endTime?: Date | null;
@@ -507,74 +508,74 @@ interface Invoice {
507
508
  confirmedAt?: Date | null;
508
509
  confirmedBy?: string | null;
509
510
  supplierId?: string | null;
510
- sisterId?: ObjectId | string | null;
511
- batchId?: ObjectId | string | null;
512
- accountId?: ObjectId | string | null;
513
- entityId?: ObjectId | string;
511
+ sisterId?: IDType | null;
512
+ batchId?: IDType | null;
513
+ accountId?: IDType | null;
514
+ entityId?: IDType;
514
515
  companyId: string;
515
516
  userSub: string;
516
517
  validation?: any[];
517
518
  }
518
519
 
519
- interface Log {
520
- _id: ObjectId | string;
520
+ interface Log<IDType = ObjectId | string> {
521
+ _id: IDType;
521
522
  message: string;
522
523
  context?: {};
523
- linkedId?: ObjectId | string;
524
+ linkedId?: IDType;
524
525
  linkedType?: string;
525
526
  type: string;
526
527
  userSub?: string;
527
- companyId?: ObjectId | string;
528
+ companyId?: IDType;
528
529
  }
529
530
 
530
- interface Reading {
531
+ interface Reading<IDType = ObjectId | string> {
531
532
  _id: string;
532
533
  submittedAt: Date;
533
534
  value: number;
534
535
  type?: string;
535
536
  invoiceStartRead?: number;
536
537
  source: string;
537
- invoiceId?: ObjectId | string;
538
- rateId?: ObjectId | string;
538
+ invoiceId?: IDType;
539
+ rateId?: IDType;
539
540
  contractRateType?: string;
540
541
  invoiceBatchId?: string;
541
542
  batchId?: string;
542
- accountId: ObjectId | string;
543
- entityId: ObjectId | string;
544
- companyId: ObjectId | string;
543
+ accountId: IDType;
544
+ entityId: IDType;
545
+ companyId: IDType;
545
546
  userSub?: string;
546
547
  }
547
548
 
548
549
  type ReportSource = 'assetGroup' | 'asset' | 'account' | 'accountsByRegister';
549
- interface ReportSourceIdItem {
550
- _id: ObjectId | string;
550
+ interface ReportSourceIdItem<IDType = ObjectId | string> {
551
+ _id: IDType;
551
552
  type: ReportSource;
552
553
  }
553
- interface ReportMetadata {
554
+ interface ReportMetadata<IDType = ObjectId | string> {
554
555
  type: string;
555
556
  format: string;
556
557
  source: ReportSource;
558
+ subType: string;
559
+ filters: Record<string, any>;
560
+ activityType?: string;
561
+ utilityType?: UtilityType;
557
562
  startDate?: string;
558
563
  endDate?: string;
559
- subType: string;
560
564
  granularity?: string;
561
- sourceIds?: ReportSourceIdItem[];
565
+ sourceIds?: ReportSourceIdItem<IDType>[];
562
566
  schema?: [string];
563
567
  rawUnits?: boolean;
564
- dayNightSplit: boolean;
568
+ dayNightSplit?: boolean;
565
569
  consumptionSource?: 'reading' | 'invoice' | 'combined' | 'hh' | 'reading-hh';
566
570
  showSimulated?: boolean;
567
571
  chartOptions?: any;
568
- filters: Record<string, any>;
569
- readingSource: Reading['source'];
570
- dateField: 'startDateEndDate' | 'startDate' | 'endDate' | 'confirmedAt';
571
- includeSubMeters: boolean;
572
- utilityType: UtilityType;
573
- accountTag: string;
574
- activityType: string;
575
- }
576
- interface Report {
577
- _id: ObjectId | string;
572
+ readingSource?: Reading['source'];
573
+ dateField?: 'startDateEndDate' | 'startDate' | 'endDate' | 'confirmedAt';
574
+ includeSubMeters?: boolean;
575
+ accountTag?: string;
576
+ }
577
+ interface Report<IDType = ObjectId | string> {
578
+ _id: IDType;
578
579
  type: 'dynamic' | 'spreadsheet' | 'table' | 'pdf';
579
580
  subType?: string;
580
581
  fileFormat: 'pdf' | 'xlsx' | 'csv' | 'json' | 'png' | 'jpg' | 'chart';
@@ -582,16 +583,16 @@ interface Report {
582
583
  status: 'preparing' | 'ready';
583
584
  scheduled?: boolean;
584
585
  version?: number;
585
- metadata?: ReportMetadata;
586
+ metadata?: ReportMetadata<IDType>;
586
587
  data?: Record<string, any>;
587
588
  requestedAt: Date;
588
589
  availableAt?: Date;
589
590
  s3Key: string | null;
590
591
  batchId?: string;
591
- scheduledReportId?: ObjectId | string;
592
- reportTemplateId?: ObjectId | string;
593
- entityId: ObjectId | string;
594
- companyId: ObjectId | string;
592
+ scheduledReportId?: IDType;
593
+ reportTemplateId?: IDType;
594
+ entityId: IDType;
595
+ companyId: IDType;
595
596
  userSub?: string;
596
597
  }
597
598
 
@@ -604,8 +605,8 @@ interface InvoiceOptionsSchema {
604
605
  stampPositionX?: number;
605
606
  stampPositionY?: number;
606
607
  }
607
- interface Supplier {
608
- _id: ObjectId | string;
608
+ interface Supplier<IDType = ObjectId | string> {
609
+ _id: IDType;
609
610
  name: string;
610
611
  logoUrl?: string;
611
612
  websiteUrl?: string;
@@ -628,14 +629,6 @@ interface ETNPagedResponse$1<T = any> {
628
629
  limit: number;
629
630
  skip: number;
630
631
  }
631
- type ToAPIType<T> = T extends (ObjectId | string) ? string : T extends Array<infer U> ? Array<ToAPIType<U>> : T extends object ? {
632
- [K in keyof T]: ToAPIType<T[K]>;
633
- } : T;
634
- type ToMongoType<T> = T extends (ObjectId | string) ? ObjectId : T extends Array<infer U> ? Array<ToMongoType<U>> : T extends object ? {
635
- [K in keyof T]: ToMongoType<T[K]>;
636
- } : T;
637
- type APIResponse<T> = ToAPIType<T>;
638
- type DBResponse<T> = ToMongoType<T>;
639
632
 
640
633
  interface ETNPagedResponse<T = any> {
641
634
  data: T[];
@@ -649,15 +642,15 @@ interface AuthOptions {
649
642
  }
650
643
  declare const _default$3: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
651
644
  instance: AxiosInstance;
652
- getAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<Account>;
653
- listAccounts: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Account>>;
645
+ getAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<Account<string | bson.ObjectId>>;
646
+ listAccounts: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Account<string | bson.ObjectId>>>;
654
647
  updateAccount: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
655
648
  createAccount: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
656
649
  removeAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
657
650
  getAccountSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
658
651
  invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
659
- getAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<Asset>;
660
- listAssets: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Asset>>;
652
+ getAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<Asset<string | bson.ObjectId>>;
653
+ listAssets: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Asset<string | bson.ObjectId>>>;
661
654
  updateAsset: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
662
655
  createAsset: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
663
656
  removeAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
@@ -669,15 +662,15 @@ declare const _default$3: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
669
662
  removeAssetGroup: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
670
663
  getAssetGroupAssets: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
671
664
  getAssetGroupSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
672
- getAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<Automation>;
673
- listAutomations: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Automation>>;
665
+ getAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<Automation<string | bson.ObjectId>>;
666
+ listAutomations: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Automation<string | bson.ObjectId>>>;
674
667
  updateAutomation: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
675
668
  createAutomation: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
676
669
  removeAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
677
670
  createAutomationLog: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
678
671
  updateAutomationLog: (id: string, subId: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
679
672
  removeAutomationLog: (id: string, subId: string, options?: AxiosRequestConfig<any>) => Promise<any>;
680
- getCompany: (id: string, options?: AxiosRequestConfig<any>) => Promise<Company>;
673
+ getCompany: (id: string, options?: AxiosRequestConfig<any>) => Promise<Company<string | bson.ObjectId>>;
681
674
  getConsumption: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
682
675
  listConsumptions: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
683
676
  updateConsumption: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
@@ -694,25 +687,25 @@ declare const _default$3: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
694
687
  updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
695
688
  createEmissionFactor: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
696
689
  removeEmissionFactor: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
697
- getEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<Entity>;
698
- listEntities: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Entity>>;
690
+ getEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<Entity<string | bson.ObjectId>>;
691
+ listEntities: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Entity<string | bson.ObjectId>>>;
699
692
  updateEntity: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
700
693
  createEntity: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
701
694
  removeEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
702
695
  getEntitiesSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
703
- getLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<Log>;
704
- listLogs: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Log>>;
696
+ getLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<Log<string | bson.ObjectId>>;
697
+ listLogs: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Log<string | bson.ObjectId>>>;
705
698
  updateLog: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
706
699
  createLog: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
707
700
  removeLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
708
- getReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<Reading>;
709
- listReadings: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Reading>>;
701
+ getReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<Reading<string | bson.ObjectId>>;
702
+ listReadings: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Reading<string | bson.ObjectId>>>;
710
703
  updateReading: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
711
704
  createReading: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
712
705
  removeReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
713
706
  getReadingSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
714
- getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report>;
715
- listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report>>;
707
+ getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report<string | bson.ObjectId>>;
708
+ listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report<string | bson.ObjectId>>>;
716
709
  updateReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
717
710
  createReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
718
711
  removeReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
@@ -728,18 +721,18 @@ declare const _default$3: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
728
721
  createScheduledReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
729
722
  removeScheduledReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
730
723
  sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
731
- getInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<Invoice>;
732
- listInvoices: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Invoice>>;
724
+ getInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<Invoice<string | bson.ObjectId>>;
725
+ listInvoices: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Invoice<string | bson.ObjectId>>>;
733
726
  updateInvoice: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
734
727
  createInvoice: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
735
728
  removeInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
736
729
  getInvoiceSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
737
- listSuppliers: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Supplier>>;
730
+ listSuppliers: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Supplier<string | bson.ObjectId>>>;
738
731
  getSupplierSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
739
732
  getImportTemplate: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
740
733
  updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
741
734
  createDataIngest: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
742
- listDataIngest: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<DataIngest>>;
735
+ listDataIngest: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<DataIngest<string | bson.ObjectId>>>;
743
736
  };
744
737
 
745
738
  declare const _default$2: (namespace: string) => winston.Logger;
@@ -821,4 +814,4 @@ declare namespace reporting {
821
814
  export { reporting_getScheduledReportRunTimes as getScheduledReportRunTimes };
822
815
  }
823
816
 
824
- export { type APIResponse, type Account, type Asset, type Automation, type Company, type CreateScraperRunParams, type DBResponse, type DataIngest, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, type Invoice, type InvoiceRate, type InvoiceRateType, type InvoiceValues, type Log, type Reading, type Report, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ScraperRun, type Supplier, type ToAPIType, type ToMongoType, type UtilityType, _default$3 as api, consumption, _default$1 as db, _default$2 as logger, monitoring, reporting, _default as slack, units };
817
+ export { type Account, type Asset, type Automation, type Company, type CreateScraperRunParams, type DataIngest, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, type Invoice, type InvoiceRate, type InvoiceRateType, type InvoiceValues, type Log, type Reading, type Report, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ScraperRun, type Supplier, type UtilityType, _default$3 as api, consumption, _default$1 as db, _default$2 as logger, monitoring, reporting, _default as slack, units };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,16 @@
1
+ import * as bson from 'bson';
1
2
  import * as axios from 'axios';
2
3
  import { CreateAxiosDefaults, AxiosInstance, AxiosRequestConfig } from 'axios';
3
4
  import { ObjectId, Db } from 'mongodb';
4
5
  import winston from 'winston';
5
6
  import moment from 'moment';
6
7
 
7
- interface Portal {
8
+ interface Portal<IDType = ObjectId | string> {
8
9
  username?: string;
9
10
  password?: string;
10
11
  scraperEnabled?: boolean;
11
12
  url?: string;
12
- scraperId?: ObjectId | string;
13
+ scraperId?: IDType;
13
14
  scraperStartDate?: Date;
14
15
  }
15
16
 
@@ -29,8 +30,8 @@ interface RateSchema {
29
30
  value: number;
30
31
  description: string;
31
32
  }
32
- interface ContractSchema {
33
- _id: ObjectId | string;
33
+ interface ContractSchema<IDType = ObjectId | string> {
34
+ _id: IDType;
34
35
  startDate: Date;
35
36
  endDate: Date;
36
37
  terminationDate?: Date;
@@ -47,13 +48,13 @@ interface ContractSchema {
47
48
  s3Key?: string;
48
49
  rateTypeMapping?: object;
49
50
  batchId?: string;
50
- supplierId?: ObjectId | string;
51
+ supplierId?: IDType;
51
52
  status: 'active' | 'inactive';
52
53
  userSub?: string;
53
54
  deletedOn?: Date;
54
55
  }
55
- interface CreditNoteSchema {
56
- _id: ObjectId | string;
56
+ interface CreditNoteSchema<IDType = ObjectId | string> {
57
+ _id: IDType;
57
58
  name: string;
58
59
  type: string;
59
60
  amount: number;
@@ -66,8 +67,8 @@ interface CreditNoteSchema {
66
67
  fileName: string;
67
68
  invoiceData: object;
68
69
  userSub: string;
69
- readingIds: ObjectId[] | string[];
70
- supplierId: ObjectId | string;
70
+ readingIds: IDType[];
71
+ supplierId: IDType;
71
72
  totalUnits: number;
72
73
  endDate: Date;
73
74
  startDate: Date;
@@ -77,8 +78,8 @@ interface CreditNoteSchema {
77
78
  totalWaterCost: number;
78
79
  totalWasteCost: number;
79
80
  }
80
- interface Account {
81
- _id: ObjectId | string;
81
+ interface Account<IDType = ObjectId | string> {
82
+ _id: IDType;
82
83
  name: string;
83
84
  modifiedBy?: string;
84
85
  siteCode?: string;
@@ -100,7 +101,7 @@ interface Account {
100
101
  meterOperatorType?: 'lease' | 'purchase';
101
102
  meterOperatorExpiryDate?: Date;
102
103
  dataCollector?: string;
103
- parentAccountId?: ObjectId | string;
104
+ parentAccountId?: IDType;
104
105
  processingInvoices?: object[];
105
106
  contracts?: ContractSchema[];
106
107
  creditNotes?: CreditNoteSchema[];
@@ -125,11 +126,11 @@ interface Account {
125
126
  };
126
127
  automationIds?: ObjectId[] | string[];
127
128
  customIntegrations?: object;
128
- supplierId?: ObjectId | string;
129
+ supplierId?: IDType;
129
130
  batchId?: string;
130
- assetId: ObjectId | string;
131
- entityId: ObjectId | string;
132
- companyId: ObjectId | string;
131
+ assetId: IDType;
132
+ entityId: IDType;
133
+ companyId: IDType;
133
134
  userSub: string;
134
135
  }
135
136
 
@@ -208,9 +209,9 @@ interface TimelineEvent {
208
209
  icon?: string;
209
210
  accountIds?: ObjectId[] | string[];
210
211
  }
211
- interface AssetRecommendation {
212
- recommendationId: ObjectId | string;
213
- documentIds?: ObjectId[] | string[];
212
+ interface AssetRecommendation<IDType = ObjectId | string> {
213
+ recommendationId: IDType;
214
+ documentIds?: IDType[];
214
215
  }
215
216
  interface AssetSettings {
216
217
  consumptionSources: {
@@ -220,8 +221,8 @@ interface AssetSettings {
220
221
  water: string;
221
222
  };
222
223
  }
223
- interface Asset {
224
- _id: ObjectId | string;
224
+ interface Asset<IDType = ObjectId | string> {
225
+ _id: IDType;
225
226
  siteName: string;
226
227
  address: Address;
227
228
  assetType: string;
@@ -258,15 +259,15 @@ interface Asset {
258
259
  lastPopulated?: Date;
259
260
  deletedOn?: Date;
260
261
  batchId?: string;
261
- companyId: ObjectId | string;
262
- entityId: ObjectId | string;
262
+ companyId: IDType;
263
+ entityId: IDType;
263
264
  assetGroupIds: ObjectId[] | string[];
264
265
  userSub: string;
265
266
  gresbId?: string;
266
267
  }
267
268
 
268
- interface Log$1 {
269
- _id: ObjectId | string;
269
+ interface Log$1<IDType = ObjectId | string> {
270
+ _id: IDType;
270
271
  message: string;
271
272
  timestamp: Date;
272
273
  batchId?: string;
@@ -280,8 +281,8 @@ interface LastCollection {
280
281
  source: Record<string, any> | null;
281
282
  }
282
283
  type FrequencyType = 'never' | 'trigger' | 'hourly' | 'daily' | 'weekly' | 'monthly';
283
- interface Automation {
284
- _id: ObjectId | string;
284
+ interface Automation<IDType = ObjectId | string> {
285
+ _id: IDType;
285
286
  description?: string;
286
287
  service: string;
287
288
  source: string;
@@ -296,11 +297,11 @@ interface Automation {
296
297
  accountIds?: ObjectId[] | string[];
297
298
  assetIds?: ObjectId[] | string[];
298
299
  userSub: string;
299
- companyId: ObjectId | string;
300
+ companyId: IDType;
300
301
  }
301
302
 
302
- interface SupplierPortals {
303
- supplierId: ObjectId | string;
303
+ interface SupplierPortals<IDType = ObjectId | string> {
304
+ supplierId: IDType;
304
305
  portal: Portal;
305
306
  }
306
307
  interface CustomIntegrations {
@@ -328,8 +329,8 @@ interface CompanySettings {
328
329
  defaultSources?: DefaultSources;
329
330
  scraperCounter?: number;
330
331
  }
331
- interface Company {
332
- _id: ObjectId | string;
332
+ interface Company<IDType = ObjectId | string> {
333
+ _id: IDType;
333
334
  name: string;
334
335
  address?: Address;
335
336
  invoiceEmail?: string;
@@ -339,24 +340,24 @@ interface Company {
339
340
  logoUrl?: string;
340
341
  }
341
342
 
342
- interface CreateScraperRunParams {
343
- supplierId: ObjectId | string;
344
- accountId: ObjectId | string;
345
- companyId: ObjectId | string;
343
+ interface CreateScraperRunParams<IDType = ObjectId | string> {
344
+ supplierId: IDType;
345
+ accountId: IDType;
346
+ companyId: IDType;
346
347
  }
347
- interface ScraperRun {
348
- _id: ObjectId | string;
348
+ interface ScraperRun<IDType = ObjectId | string> {
349
+ _id: IDType;
349
350
  logs?: {}[];
350
- supplierId: ObjectId | string;
351
- accountId: ObjectId | string;
352
- companyId: ObjectId | string;
351
+ supplierId: IDType;
352
+ accountId: IDType;
353
+ companyId: IDType;
353
354
  invoiceData?: [];
354
355
  status: string[];
355
356
  error?: string;
356
357
  }
357
358
 
358
- interface DataIngest {
359
- _id: ObjectId | string;
359
+ interface DataIngest<IDType = ObjectId | string> {
360
+ _id: IDType;
360
361
  messageId: string;
361
362
  status: 'started' | 'processing' | 'importing' | 'completed' | 'failed' | 'dlq';
362
363
  context: any;
@@ -365,16 +366,16 @@ interface DataIngest {
365
366
  }
366
367
 
367
368
  type EntityType = 'fund' | 'company' | 'charity' | 'school/university' | 'council' | 'other';
368
- interface Entity {
369
- _id: ObjectId | string;
369
+ interface Entity<IDType = ObjectId | string> {
370
+ _id: IDType;
370
371
  legalName: string;
371
372
  type: EntityType;
372
373
  companyNumber?: string;
373
374
  companyLogo?: string;
374
375
  billingAddress: Address;
375
- parentEntityId?: ObjectId | string;
376
- ultimateParentEntityId?: ObjectId | string;
377
- companyId: ObjectId | string;
376
+ parentEntityId?: IDType;
377
+ ultimateParentEntityId?: IDType;
378
+ companyId: IDType;
378
379
  batchId?: string;
379
380
  userSub: string;
380
381
  }
@@ -383,8 +384,8 @@ interface Attachment {
383
384
  filename: string;
384
385
  s3Key: string;
385
386
  }
386
- interface Email {
387
- _id: ObjectId | string;
387
+ interface Email<IDType = ObjectId | string> {
388
+ _id: IDType;
388
389
  destinations: string[];
389
390
  service: string;
390
391
  subject: string;
@@ -394,7 +395,7 @@ interface Email {
394
395
  sesMessageId: string;
395
396
  s3Key: string;
396
397
  userSub?: string;
397
- companyId?: ObjectId | string;
398
+ companyId?: IDType;
398
399
  }
399
400
 
400
401
  interface InvoiceValues {
@@ -474,8 +475,8 @@ interface InvoiceRate {
474
475
  type InvoiceStatus = 'processing' | 'pending' | 'uploading' | 'queued' | 'captured' | 'error' | 'completed';
475
476
  type FinancialStatus = 'approved' | 'new' | 'not-approved' | 'paid' | 'sent-for-payment';
476
477
  type InvoiceRateType = 'unitRate' | 'daily' | 'levy' | 'tax' | 'kva' | 'waterRate' | 'wasteRate' | 'discount';
477
- interface Invoice {
478
- _id: ObjectId | string;
478
+ interface Invoice<IDType = ObjectId | string> {
479
+ _id: IDType;
479
480
  jobId?: string | null;
480
481
  startTime?: Date;
481
482
  endTime?: Date | null;
@@ -507,74 +508,74 @@ interface Invoice {
507
508
  confirmedAt?: Date | null;
508
509
  confirmedBy?: string | null;
509
510
  supplierId?: string | null;
510
- sisterId?: ObjectId | string | null;
511
- batchId?: ObjectId | string | null;
512
- accountId?: ObjectId | string | null;
513
- entityId?: ObjectId | string;
511
+ sisterId?: IDType | null;
512
+ batchId?: IDType | null;
513
+ accountId?: IDType | null;
514
+ entityId?: IDType;
514
515
  companyId: string;
515
516
  userSub: string;
516
517
  validation?: any[];
517
518
  }
518
519
 
519
- interface Log {
520
- _id: ObjectId | string;
520
+ interface Log<IDType = ObjectId | string> {
521
+ _id: IDType;
521
522
  message: string;
522
523
  context?: {};
523
- linkedId?: ObjectId | string;
524
+ linkedId?: IDType;
524
525
  linkedType?: string;
525
526
  type: string;
526
527
  userSub?: string;
527
- companyId?: ObjectId | string;
528
+ companyId?: IDType;
528
529
  }
529
530
 
530
- interface Reading {
531
+ interface Reading<IDType = ObjectId | string> {
531
532
  _id: string;
532
533
  submittedAt: Date;
533
534
  value: number;
534
535
  type?: string;
535
536
  invoiceStartRead?: number;
536
537
  source: string;
537
- invoiceId?: ObjectId | string;
538
- rateId?: ObjectId | string;
538
+ invoiceId?: IDType;
539
+ rateId?: IDType;
539
540
  contractRateType?: string;
540
541
  invoiceBatchId?: string;
541
542
  batchId?: string;
542
- accountId: ObjectId | string;
543
- entityId: ObjectId | string;
544
- companyId: ObjectId | string;
543
+ accountId: IDType;
544
+ entityId: IDType;
545
+ companyId: IDType;
545
546
  userSub?: string;
546
547
  }
547
548
 
548
549
  type ReportSource = 'assetGroup' | 'asset' | 'account' | 'accountsByRegister';
549
- interface ReportSourceIdItem {
550
- _id: ObjectId | string;
550
+ interface ReportSourceIdItem<IDType = ObjectId | string> {
551
+ _id: IDType;
551
552
  type: ReportSource;
552
553
  }
553
- interface ReportMetadata {
554
+ interface ReportMetadata<IDType = ObjectId | string> {
554
555
  type: string;
555
556
  format: string;
556
557
  source: ReportSource;
558
+ subType: string;
559
+ filters: Record<string, any>;
560
+ activityType?: string;
561
+ utilityType?: UtilityType;
557
562
  startDate?: string;
558
563
  endDate?: string;
559
- subType: string;
560
564
  granularity?: string;
561
- sourceIds?: ReportSourceIdItem[];
565
+ sourceIds?: ReportSourceIdItem<IDType>[];
562
566
  schema?: [string];
563
567
  rawUnits?: boolean;
564
- dayNightSplit: boolean;
568
+ dayNightSplit?: boolean;
565
569
  consumptionSource?: 'reading' | 'invoice' | 'combined' | 'hh' | 'reading-hh';
566
570
  showSimulated?: boolean;
567
571
  chartOptions?: any;
568
- filters: Record<string, any>;
569
- readingSource: Reading['source'];
570
- dateField: 'startDateEndDate' | 'startDate' | 'endDate' | 'confirmedAt';
571
- includeSubMeters: boolean;
572
- utilityType: UtilityType;
573
- accountTag: string;
574
- activityType: string;
575
- }
576
- interface Report {
577
- _id: ObjectId | string;
572
+ readingSource?: Reading['source'];
573
+ dateField?: 'startDateEndDate' | 'startDate' | 'endDate' | 'confirmedAt';
574
+ includeSubMeters?: boolean;
575
+ accountTag?: string;
576
+ }
577
+ interface Report<IDType = ObjectId | string> {
578
+ _id: IDType;
578
579
  type: 'dynamic' | 'spreadsheet' | 'table' | 'pdf';
579
580
  subType?: string;
580
581
  fileFormat: 'pdf' | 'xlsx' | 'csv' | 'json' | 'png' | 'jpg' | 'chart';
@@ -582,16 +583,16 @@ interface Report {
582
583
  status: 'preparing' | 'ready';
583
584
  scheduled?: boolean;
584
585
  version?: number;
585
- metadata?: ReportMetadata;
586
+ metadata?: ReportMetadata<IDType>;
586
587
  data?: Record<string, any>;
587
588
  requestedAt: Date;
588
589
  availableAt?: Date;
589
590
  s3Key: string | null;
590
591
  batchId?: string;
591
- scheduledReportId?: ObjectId | string;
592
- reportTemplateId?: ObjectId | string;
593
- entityId: ObjectId | string;
594
- companyId: ObjectId | string;
592
+ scheduledReportId?: IDType;
593
+ reportTemplateId?: IDType;
594
+ entityId: IDType;
595
+ companyId: IDType;
595
596
  userSub?: string;
596
597
  }
597
598
 
@@ -604,8 +605,8 @@ interface InvoiceOptionsSchema {
604
605
  stampPositionX?: number;
605
606
  stampPositionY?: number;
606
607
  }
607
- interface Supplier {
608
- _id: ObjectId | string;
608
+ interface Supplier<IDType = ObjectId | string> {
609
+ _id: IDType;
609
610
  name: string;
610
611
  logoUrl?: string;
611
612
  websiteUrl?: string;
@@ -628,14 +629,6 @@ interface ETNPagedResponse$1<T = any> {
628
629
  limit: number;
629
630
  skip: number;
630
631
  }
631
- type ToAPIType<T> = T extends (ObjectId | string) ? string : T extends Array<infer U> ? Array<ToAPIType<U>> : T extends object ? {
632
- [K in keyof T]: ToAPIType<T[K]>;
633
- } : T;
634
- type ToMongoType<T> = T extends (ObjectId | string) ? ObjectId : T extends Array<infer U> ? Array<ToMongoType<U>> : T extends object ? {
635
- [K in keyof T]: ToMongoType<T[K]>;
636
- } : T;
637
- type APIResponse<T> = ToAPIType<T>;
638
- type DBResponse<T> = ToMongoType<T>;
639
632
 
640
633
  interface ETNPagedResponse<T = any> {
641
634
  data: T[];
@@ -649,15 +642,15 @@ interface AuthOptions {
649
642
  }
650
643
  declare const _default$3: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
651
644
  instance: AxiosInstance;
652
- getAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<Account>;
653
- listAccounts: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Account>>;
645
+ getAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<Account<string | bson.ObjectId>>;
646
+ listAccounts: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Account<string | bson.ObjectId>>>;
654
647
  updateAccount: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
655
648
  createAccount: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
656
649
  removeAccount: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
657
650
  getAccountSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
658
651
  invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
659
- getAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<Asset>;
660
- listAssets: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Asset>>;
652
+ getAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<Asset<string | bson.ObjectId>>;
653
+ listAssets: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Asset<string | bson.ObjectId>>>;
661
654
  updateAsset: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
662
655
  createAsset: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
663
656
  removeAsset: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
@@ -669,15 +662,15 @@ declare const _default$3: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
669
662
  removeAssetGroup: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
670
663
  getAssetGroupAssets: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
671
664
  getAssetGroupSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
672
- getAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<Automation>;
673
- listAutomations: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Automation>>;
665
+ getAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<Automation<string | bson.ObjectId>>;
666
+ listAutomations: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Automation<string | bson.ObjectId>>>;
674
667
  updateAutomation: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
675
668
  createAutomation: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
676
669
  removeAutomation: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
677
670
  createAutomationLog: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
678
671
  updateAutomationLog: (id: string, subId: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
679
672
  removeAutomationLog: (id: string, subId: string, options?: AxiosRequestConfig<any>) => Promise<any>;
680
- getCompany: (id: string, options?: AxiosRequestConfig<any>) => Promise<Company>;
673
+ getCompany: (id: string, options?: AxiosRequestConfig<any>) => Promise<Company<string | bson.ObjectId>>;
681
674
  getConsumption: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
682
675
  listConsumptions: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<any>>;
683
676
  updateConsumption: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
@@ -694,25 +687,25 @@ declare const _default$3: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
694
687
  updateEmissionFactor: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
695
688
  createEmissionFactor: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
696
689
  removeEmissionFactor: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
697
- getEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<Entity>;
698
- listEntities: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Entity>>;
690
+ getEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<Entity<string | bson.ObjectId>>;
691
+ listEntities: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Entity<string | bson.ObjectId>>>;
699
692
  updateEntity: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
700
693
  createEntity: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
701
694
  removeEntity: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
702
695
  getEntitiesSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
703
- getLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<Log>;
704
- listLogs: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Log>>;
696
+ getLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<Log<string | bson.ObjectId>>;
697
+ listLogs: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Log<string | bson.ObjectId>>>;
705
698
  updateLog: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
706
699
  createLog: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
707
700
  removeLog: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
708
- getReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<Reading>;
709
- listReadings: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Reading>>;
701
+ getReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<Reading<string | bson.ObjectId>>;
702
+ listReadings: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Reading<string | bson.ObjectId>>>;
710
703
  updateReading: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
711
704
  createReading: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
712
705
  removeReading: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
713
706
  getReadingSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
714
- getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report>;
715
- listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report>>;
707
+ getReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<Report<string | bson.ObjectId>>;
708
+ listReports: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Report<string | bson.ObjectId>>>;
716
709
  updateReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
717
710
  createReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
718
711
  removeReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
@@ -728,18 +721,18 @@ declare const _default$3: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
728
721
  createScheduledReport: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
729
722
  removeScheduledReport: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
730
723
  sendScheduledReport: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
731
- getInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<Invoice>;
732
- listInvoices: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Invoice>>;
724
+ getInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<Invoice<string | bson.ObjectId>>;
725
+ listInvoices: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Invoice<string | bson.ObjectId>>>;
733
726
  updateInvoice: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
734
727
  createInvoice: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
735
728
  removeInvoice: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
736
729
  getInvoiceSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
737
- listSuppliers: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Supplier>>;
730
+ listSuppliers: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<Supplier<string | bson.ObjectId>>>;
738
731
  getSupplierSchema: (options?: AxiosRequestConfig<any>) => Promise<any>;
739
732
  getImportTemplate: (id: string, options?: AxiosRequestConfig<any>) => Promise<any>;
740
733
  updateDataIngest: (id: string, data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
741
734
  createDataIngest: (data: any, options?: AxiosRequestConfig<any>) => Promise<any>;
742
- listDataIngest: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<DataIngest>>;
735
+ listDataIngest: (options?: AxiosRequestConfig<any>) => Promise<ETNPagedResponse<DataIngest<string | bson.ObjectId>>>;
743
736
  };
744
737
 
745
738
  declare const _default$2: (namespace: string) => winston.Logger;
@@ -821,4 +814,4 @@ declare namespace reporting {
821
814
  export { reporting_getScheduledReportRunTimes as getScheduledReportRunTimes };
822
815
  }
823
816
 
824
- export { type APIResponse, type Account, type Asset, type Automation, type Company, type CreateScraperRunParams, type DBResponse, type DataIngest, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, type Invoice, type InvoiceRate, type InvoiceRateType, type InvoiceValues, type Log, type Reading, type Report, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ScraperRun, type Supplier, type ToAPIType, type ToMongoType, type UtilityType, _default$3 as api, consumption, _default$1 as db, _default$2 as logger, monitoring, reporting, _default as slack, units };
817
+ export { type Account, type Asset, type Automation, type Company, type CreateScraperRunParams, type DataIngest, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, type Invoice, type InvoiceRate, type InvoiceRateType, type InvoiceValues, type Log, type Reading, type Report, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ScraperRun, type Supplier, type UtilityType, _default$3 as api, consumption, _default$1 as db, _default$2 as logger, monitoring, reporting, _default as slack, units };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etainabl/nodejs-sdk",
3
- "version": "1.2.52",
3
+ "version": "1.2.55",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",