@etainabl/nodejs-sdk 1.2.15 → 1.2.17

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.
@@ -0,0 +1,142 @@
1
+ import type { Address } from './address.js'
2
+ import type { StatusHistory } from './statusHistory.ts'
3
+
4
+ // Define the Image Schema
5
+ interface Image {
6
+ url?: string;
7
+ label?: string;
8
+ type?: string;
9
+ isHidden?: boolean;
10
+ isPrimary?: boolean;
11
+ }
12
+
13
+ // Define the Flood Risk Schema
14
+ interface FloodRisk {
15
+ url?: string;
16
+ description?: string;
17
+ label?: string;
18
+ latitude?: number;
19
+ longitude?: number;
20
+ fetchedAt?: Date;
21
+ }
22
+
23
+ // Define the Crime Schema
24
+ interface Crime {
25
+ category?: string;
26
+ month?: string;
27
+ crimeId?: string;
28
+ outcomeCategory?: string;
29
+ outcomeDate?: string;
30
+ location?: {
31
+ latitude: string;
32
+ longitude: string;
33
+ street: string;
34
+ };
35
+ fetchedAt?: Date;
36
+ }
37
+
38
+ // Define the Air Quality Schema
39
+ interface AirQuality {
40
+ index?: number;
41
+ indexColour?: string;
42
+ indexRating?: string;
43
+ details?: object;
44
+ location?: object;
45
+ lastMeasured?: Date;
46
+ fetchedAt?: Date;
47
+ }
48
+
49
+ // Define the Benchmark Schema
50
+ interface Benchmark {
51
+ benchmarkId: string
52
+ fieldCode: string;
53
+ fieldValue: string;
54
+ }
55
+
56
+ // Define the Document Schema
57
+ interface Document {
58
+ s3Key?: string;
59
+ name: string;
60
+ extension?: string;
61
+ type: string;
62
+ status: string;
63
+ score?: string;
64
+ providerId?: string;
65
+ providerData?: object;
66
+ certificate?: object;
67
+ createdAt: Date;
68
+ accountIds?: string[];
69
+ }
70
+
71
+ // Define the Timeline Event Schema
72
+ interface TimelineEvent {
73
+ date: Date;
74
+ title: string;
75
+ status: string;
76
+ content?: string;
77
+ icon?: string;
78
+ accountIds?: string[];
79
+ }
80
+
81
+ // Define the Asset Recommendation Schema
82
+ interface AssetRecommendation {
83
+ recommendationId: string
84
+ documentIds?: string[];
85
+ }
86
+
87
+ // Define the Asset Settings Schema
88
+ interface AssetSettings {
89
+ consumptionSources: {
90
+ electricity: string;
91
+ solar: string;
92
+ gas: string;
93
+ water: string;
94
+ };
95
+ }
96
+
97
+ // Main export, mirroring the main object in your code
98
+ export interface Asset {
99
+ _id: string
100
+ siteName: string;
101
+ address: Address;
102
+ assetType: string;
103
+ floorArea: number;
104
+ floorAreaUnit: 'metric' | 'imperial';
105
+ noOfFloors?: number;
106
+ energyRating: string;
107
+ gav: string;
108
+ gavCurrency: string;
109
+ currency: string;
110
+ occupationStatus: 'occupied' | 'vacant' | 'other' | 'n/a';
111
+ type: 'new construction' | 'major renovation' | 'standing investment' | 'n/a';
112
+ vacancyRate?: number;
113
+ constructionYear?: number;
114
+ ownedSince?: Date;
115
+ disposalDate?: Date;
116
+ tenure: 'freehold' | 'leasehold';
117
+ tenantControlledPercent?: number;
118
+ landlordControlledPercent?: number;
119
+ occupancyLevel?: number;
120
+ images: Image[];
121
+ pricePaid?: number;
122
+ floodRisks: FloodRisk[];
123
+ recentCrimes: Crime[];
124
+ recentAirQuality: AirQuality;
125
+ documents?: Document[];
126
+ epbCertificates: any[];
127
+ status?: string;
128
+ settings: AssetSettings;
129
+ recommendations?: AssetRecommendation[];
130
+ statusHistory: StatusHistory[];
131
+ timelineEvents: TimelineEvent[];
132
+ benchmarks: Benchmark[];
133
+ lastPopulated?: Date;
134
+ deletedOn?: Date;
135
+ batchId?: string;
136
+ companyId: string;
137
+ entityId: string;
138
+ assetGroupIds: string[];
139
+ userSub: string;
140
+ gresbId?: string;
141
+ };
142
+
@@ -0,0 +1,36 @@
1
+ import { Types } from 'mongoose';
2
+
3
+ interface Log {
4
+ message: string;
5
+ timestamp: Date;
6
+ batchId?: string;
7
+ source?: string;
8
+ }
9
+
10
+ interface LastCollection {
11
+ collectedAt: Date | null;
12
+ data: Record<string, any> | null;
13
+ error: Record<string, any> | null;
14
+ status: 'success' | 'error' | 'pending';
15
+ source: Record<string, any> | null;
16
+ }
17
+
18
+ type FrequencyType = 'never' | 'trigger' | 'hourly' | 'daily' | 'weekly' | 'monthly';
19
+
20
+ export interface Automation {
21
+ description?: string;
22
+ service: string;
23
+ source: string;
24
+ category: string;
25
+ active: boolean;
26
+ status?: 'running' | 'pending';
27
+ lastCollection: LastCollection;
28
+ logs: Log[];
29
+ data: Record<string, any>;
30
+ sourceData: Record<string, any>;
31
+ frequency?: FrequencyType;
32
+ accountIds?: Types.ObjectId[];
33
+ assetIds?: Types.ObjectId[];
34
+ userSub: string;
35
+ companyId: Types.ObjectId;
36
+ }
@@ -0,0 +1,47 @@
1
+
2
+ import { Address } from './address.js'
3
+ import { Portal } from './portal.ts'
4
+
5
+ interface SupplierPortals {
6
+ supplierId: string;
7
+ portal: Portal;
8
+ }
9
+
10
+ interface CustomIntegrations {
11
+ account: any[];
12
+ asset: any[];
13
+ entity: any[];
14
+ }
15
+
16
+ interface DefaultSources {
17
+ electricity: 'invoice' | 'consumption' | 'reading';
18
+ solar: 'invoice' | 'consumption' | 'reading';
19
+ gas: 'invoice' | 'consumption' | 'reading';
20
+ water: 'invoice' | 'consumption' | 'reading';
21
+ }
22
+
23
+ interface CompanySettings {
24
+ showLogo?: boolean;
25
+ invoiceCategories?: any[];
26
+ miscInvoiceCategories?: any[];
27
+ messageCategories?: any[];
28
+ documentCategories?: any[];
29
+ assetDataSchemas?: any[];
30
+ hideCostData?: boolean;
31
+ calendarPeriod?: string;
32
+ customIntegrations?: CustomIntegrations;
33
+ supplierPortals?: SupplierPortals[];
34
+ defaultSources?: DefaultSources;
35
+ scraperCounter?: number;
36
+ }
37
+
38
+ export interface Company {
39
+ _id: string
40
+ name: string;
41
+ address?: Address;
42
+ invoiceEmail?: string;
43
+ users?: string[];
44
+ settings: CompanySettings;
45
+ logoS3Key: string;
46
+ logoUrl?: string;
47
+ }
@@ -0,0 +1,17 @@
1
+ interface Attachment {
2
+ filename: string;
3
+ s3Key: string;
4
+ }
5
+
6
+ export interface Email {
7
+ destinations: string[];
8
+ service: string;
9
+ subject: string;
10
+ body: string;
11
+ from: string;
12
+ attachments?: Attachment[];
13
+ sesMessageId: string;
14
+ s3Key: string;
15
+ userSub?: string;
16
+ companyId?: string
17
+ }
@@ -0,0 +1,30 @@
1
+ import type { Account } from './account.d.ts'
2
+ import type { Asset } from './asset.d.ts'
3
+ import type { Company } from './company.d.ts'
4
+ import type { CreateScraperRunParams, ScraperRun } from './scraperRun.d.ts';
5
+ import type { Email } from './email.d.ts';
6
+ import type { Invoice } from './invoice.d.ts';
7
+ import type { Log } from './log.d.ts';
8
+ import type { Reading } from './reading.d.ts'
9
+ import type { Supplier } from './supplier.d.ts'
10
+
11
+ export type {
12
+ Account,
13
+ Asset,
14
+ Automation,
15
+ Company,
16
+ CreateScraperRunParams,
17
+ Email,
18
+ Invoice,
19
+ Log,
20
+ Reading,
21
+ ScraperRun,
22
+ Supplier
23
+ };
24
+
25
+ export interface ETNPagedResponse<T = any> {
26
+ data: T[];
27
+ total: number;
28
+ limit: number;
29
+ skip: number;
30
+ }
@@ -0,0 +1,106 @@
1
+ import { Types } from 'mongoose';
2
+
3
+ interface Values {
4
+ friendlyInvoiceNumber?: string;
5
+ friendlySupplierRef?: string;
6
+ friendlyStartDate?: string;
7
+ friendlyEndDate?: string;
8
+ friendlyInvoiceDate?: string;
9
+ friendlyMeterPointNumber?: string;
10
+ friendlyMeterPointNumber2?: string;
11
+ friendlyMeterSerialNumber?: string;
12
+ friendlyPipeSize?: string;
13
+ friendlyTotalUnitCost?: number;
14
+ friendlyTotalWaterCost?: number;
15
+ friendlyTotalWasteCost?: number;
16
+ friendlyTotalDaily?: number;
17
+ friendlyTotalLevy?: number;
18
+ friendlyTotalKva?: number;
19
+ friendlyTotalUnits?: number;
20
+ friendlyTotalWaterVolume?: number;
21
+ friendlyTotalWasteVolume?: number;
22
+ friendlyNetTotalCost?: number;
23
+ friendlyTotalTax?: number;
24
+ friendlyTotalCost?: number;
25
+ friendlyMeteredConsumption?: string;
26
+ friendlyCorrectedConsumption?: string;
27
+ friendlyCorrectionFactor?: string;
28
+ friendlyCalorificValue?: string;
29
+ friendlyReadFactor?: string;
30
+ friendlyType?: string;
31
+ friendlyStartRead?: string;
32
+ friendlyEndRead?: string;
33
+ invoiceNumber?: string;
34
+ supplierRef?: string;
35
+ startDate?: Date;
36
+ endDate?: Date;
37
+ invoiceDate?: Date;
38
+ meterPointNumber?: string;
39
+ meterPointNumber2?: string;
40
+ meterSerialNumber?: string;
41
+ pipeSize?: string;
42
+ totalUnitCost?: number;
43
+ totalWaterCost?: number;
44
+ totalWasteCost?: number;
45
+ totalDaily?: number;
46
+ totalLevy?: number;
47
+ totalKva?: number;
48
+ totalUnits?: number;
49
+ totalWaterVolume?: number;
50
+ totalWasteVolume?: number;
51
+ netTotalCost?: number;
52
+ totalTax?: number;
53
+ totalCost?: number;
54
+ meteredConsumption?: string;
55
+ correctedConsumption?: string;
56
+ correctionFactor?: string;
57
+ calorificValue?: string;
58
+ readFactor?: string;
59
+ type?: string;
60
+ startRead?: string;
61
+ endRead?: string;
62
+ }
63
+
64
+ type InvoiceStatus = 'processing' | 'pending' | 'uploading' | 'queued' | 'captured' | 'error' | 'completed';
65
+ type FinancialStatus = 'approved' | 'new' | 'not-approved' | 'paid' | 'sent-for-payment';
66
+
67
+ export interface Invoice {
68
+ jobId?: string | null;
69
+ startTime?: Date;
70
+ endTime?: Date | null;
71
+ s3Key: string;
72
+ s3TextractKey?: string | null;
73
+ stampedS3Key: string;
74
+ fileName?: string | null;
75
+ status: InvoiceStatus;
76
+ financialStatus: FinancialStatus;
77
+ completed?: boolean;
78
+ type?: string | null;
79
+ tags?: string[];
80
+ manualResults?: Record<string, any>;
81
+ values?: Values;
82
+ rates?: any[];
83
+ detailedResults?: Record<string, any>;
84
+ templateVersion?: string | null;
85
+ error?: Record<string, any>;
86
+ isPaid?: boolean;
87
+ isCreditNote?: boolean;
88
+ isConvertedCreditNote?: boolean;
89
+ isManual?: boolean;
90
+ uploaderStatus?: string;
91
+ simulated?: boolean;
92
+ notes?: string | null;
93
+ assignedTo?: string;
94
+ noScrape?: boolean;
95
+ scraperInvoiceId?: string;
96
+ confirmedAt?: Date | null;
97
+ confirmedBy?: string | null;
98
+ supplierId?: Types.ObjectId | null;
99
+ sisterId?: string | null;
100
+ batchId?: string | null;
101
+ accountId?: Types.ObjectId | null;
102
+ entityId?: Types.ObjectId;
103
+ companyId: Types.ObjectId;
104
+ userSub: string;
105
+ validation?: any[];
106
+ }
package/types/log.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export interface Log {
2
+ message: string
3
+ context?: {}
4
+ linkedId?: string
5
+ linkedType?: string
6
+ type: string
7
+ userSub?: string
8
+ companyId?: string
9
+ }
@@ -0,0 +1,9 @@
1
+ export interface Portal {
2
+ username?: string;
3
+ password?: string;
4
+ scraperEnabled?: boolean;
5
+ url?: string;
6
+ scraperId?: string;
7
+ scraperStartDate?: Date;
8
+ }
9
+
@@ -0,0 +1,16 @@
1
+ export interface Reading {
2
+ submittedAt: Date;
3
+ value: number;
4
+ type?: string;
5
+ invoiceStartRead?: number;
6
+ source: string;
7
+ invoiceId?: string;
8
+ rateId?: string;
9
+ contractRateType?: string;
10
+ invoiceBatchId?: string;
11
+ batchId?: string;
12
+ accountId: string;
13
+ entityId: string;
14
+ companyId: string;
15
+ userSub?: string;
16
+ }
@@ -0,0 +1,15 @@
1
+ export interface CreateScraperRunParams {
2
+ supplierId: string;
3
+ accountId: string;
4
+ companyId: string;
5
+ }
6
+ export interface ScraperRun {
7
+ _id: string;
8
+ logs?: {}[];
9
+ supplierId: string;
10
+ accountId: string;
11
+ companyId: string;
12
+ invoiceData?: [];
13
+ status: string[];
14
+ error?: string;
15
+ }
@@ -0,0 +1,5 @@
1
+ export interface StatusHistory {
2
+ date: Date;
3
+ value: 'active' | 'inactive';
4
+ notes?: string;
5
+ }
@@ -0,0 +1,31 @@
1
+ import { Portal } from './portal.js'
2
+
3
+ interface PortalSupplierSchema extends Portal {
4
+ concurrent: boolean;
5
+ checkInvoiceFilenames: boolean;
6
+ supplierRefRequired: boolean;
7
+ }
8
+
9
+ interface InvoiceOptionsSchema {
10
+ stampPositionX?: number;
11
+ stampPositionY?: number;
12
+ }
13
+
14
+ export interface Supplier {
15
+ _id: string
16
+ name: string;
17
+ logoUrl?: string;
18
+ websiteUrl?: string;
19
+ portalUrl?: string;
20
+ identifier?: string;
21
+ type: 'supplier' | 'distributor';
22
+ region?: string;
23
+ countryCode: string;
24
+ defaultScraper?: string;
25
+ active: boolean;
26
+ transferSupplier: boolean;
27
+ transferSupplierId?: string;
28
+ portal: PortalSupplierSchema;
29
+ invoiceOptions?: InvoiceOptionsSchema;
30
+ };
31
+