@etainabl/nodejs-sdk 1.2.43 → 1.2.45
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/package.json +3 -0
- package/dist/esm/package.json +3 -0
- package/dist/index.d.cts +782 -0
- package/dist/index.d.ts +782 -0
- package/dist/index.js +626 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +588 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +27 -26
- package/.prettierrc +0 -11
- package/__tests__/reporting.test.ts +0 -88
- package/dist/cjs/index.js +0 -59
- package/eslint.config.js +0 -60
- package/fixup.sh +0 -11
- package/package-lock.json +0 -6327
- package/src/api.ts +0 -382
- package/src/consumption.ts +0 -40
- package/src/db.ts +0 -69
- package/src/etainabl.ts +0 -10
- package/src/index.ts +0 -21
- package/src/logger.ts +0 -13
- package/src/monitoring.ts +0 -18
- package/src/reporting.ts +0 -78
- package/src/slack.ts +0 -16
- package/src/types/account.ts +0 -116
- package/src/types/address.ts +0 -12
- package/src/types/asset.ts +0 -142
- package/src/types/automation.ts +0 -35
- package/src/types/company.ts +0 -47
- package/src/types/dataIngest.ts +0 -8
- package/src/types/email.ts +0 -18
- package/src/types/entity.ts +0 -17
- package/src/types/index.ts +0 -20
- package/src/types/invoice.ts +0 -119
- package/src/types/log.ts +0 -10
- package/src/types/portal.ts +0 -9
- package/src/types/reading.ts +0 -17
- package/src/types/report.ts +0 -21
- package/src/types/scraperRun.ts +0 -15
- package/src/types/statusHistory.ts +0 -5
- package/src/types/supplier.ts +0 -31
- package/src/units.ts +0 -111
- package/tsconfig.base.json +0 -31
- package/tsconfig.cjs.json +0 -8
- package/tsconfig.json +0 -9
- package/tsconfig.test.json +0 -13
- package/vitest.config.js +0 -10
- package/vitest.workspace.js +0 -5
package/src/types/account.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { Portal } from './portal.js';
|
|
2
|
-
import type { StatusHistory } from './statusHistory.js'
|
|
3
|
-
|
|
4
|
-
interface PortalAccountSchema extends Portal{
|
|
5
|
-
invoiceFilenames: any[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface RateSchema {
|
|
9
|
-
type: string;
|
|
10
|
-
value: number;
|
|
11
|
-
description: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface ContractSchema {
|
|
15
|
-
startDate: Date;
|
|
16
|
-
endDate: Date;
|
|
17
|
-
terminationDate?: Date;
|
|
18
|
-
paymentTerms?: string;
|
|
19
|
-
duration?: string;
|
|
20
|
-
tariffName?: string;
|
|
21
|
-
contractConsumption?: number;
|
|
22
|
-
volumeTolerance?: any[];
|
|
23
|
-
renewablePercentage?: number;
|
|
24
|
-
marketBasedEmissionFactor?: number;
|
|
25
|
-
chargeableCclPercentage?: number;
|
|
26
|
-
commissionRates?: number;
|
|
27
|
-
rates: any[];
|
|
28
|
-
s3Key?: string;
|
|
29
|
-
rateTypeMapping?: object;
|
|
30
|
-
batchId?: string;
|
|
31
|
-
supplierId?: string;
|
|
32
|
-
status: 'active' | 'inactive';
|
|
33
|
-
userSub?: string;
|
|
34
|
-
deletedOn?: Date;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface CreditNoteSchema {
|
|
38
|
-
name: string;
|
|
39
|
-
type: string;
|
|
40
|
-
amount: number;
|
|
41
|
-
netAmount: number;
|
|
42
|
-
taxAmount: number;
|
|
43
|
-
date: Date;
|
|
44
|
-
isPaid: boolean;
|
|
45
|
-
s3Key: string;
|
|
46
|
-
stampedS3Key: string;
|
|
47
|
-
fileName: string;
|
|
48
|
-
invoiceData: object;
|
|
49
|
-
userSub: string;
|
|
50
|
-
readingIds: any[];
|
|
51
|
-
supplierId: string;
|
|
52
|
-
totalUnits: number;
|
|
53
|
-
endDate: Date;
|
|
54
|
-
startDate: Date;
|
|
55
|
-
stampDate: Date;
|
|
56
|
-
totalWaterVolume: number;
|
|
57
|
-
totalWasteVolume: number;
|
|
58
|
-
totalWaterCost: number;
|
|
59
|
-
totalWasteCost: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface Account {
|
|
63
|
-
_id: string,
|
|
64
|
-
name: string;
|
|
65
|
-
modifiedBy?: string;
|
|
66
|
-
siteCode?: string;
|
|
67
|
-
type: 'gas' | 'electricity' | 'water' | 'waste' | 'solar';
|
|
68
|
-
supplierRef?: string;
|
|
69
|
-
financialCode?: string;
|
|
70
|
-
propertyCode?: string;
|
|
71
|
-
meterPointNumber?: string;
|
|
72
|
-
meterSerialNumber?: string;
|
|
73
|
-
meterPointNumber2?: string;
|
|
74
|
-
meterUnits: 'kwh' | 'm3' | 'ft3';
|
|
75
|
-
automaticMeterRead?: boolean;
|
|
76
|
-
status?: 'active' | 'inactive';
|
|
77
|
-
statusHistory?: StatusHistory[]; // Referenced from another file
|
|
78
|
-
rates?: RateSchema[];
|
|
79
|
-
capacity?: string;
|
|
80
|
-
meterOperator?: string;
|
|
81
|
-
meterLocation?: string;
|
|
82
|
-
meterOperatorType?: 'lease' | 'purchase';
|
|
83
|
-
meterOperatorExpiryDate?: Date;
|
|
84
|
-
dataCollector?: string;
|
|
85
|
-
parentAccountId?: string;
|
|
86
|
-
processingInvoices?: object[];
|
|
87
|
-
contracts?: ContractSchema[];
|
|
88
|
-
creditNotes?: CreditNoteSchema[];
|
|
89
|
-
meterUser?: string;
|
|
90
|
-
isTrc?: boolean;
|
|
91
|
-
floorArea?: string;
|
|
92
|
-
floorAreaUnit?: 'metric' | 'imperial';
|
|
93
|
-
reportingType?: string;
|
|
94
|
-
solarType?: 'generation' | 'export';
|
|
95
|
-
consumptionSource?: 'primary' | 'sub' | 'primary-sub';
|
|
96
|
-
esec?: 'a' | 'b' | 'c' | 'd' | 'e' | 'g' | 'h' | 'j' | 'k' | 'l' | 'm' | 'n' | 'p' | 'q' | 'r' | 's' | 't' | 'u';
|
|
97
|
-
portal?: PortalAccountSchema;
|
|
98
|
-
deviceId?: string;
|
|
99
|
-
gridfetchLoa?: {
|
|
100
|
-
s3Key?: string;
|
|
101
|
-
name?: string;
|
|
102
|
-
uploadedBy?: string;
|
|
103
|
-
uploadedAt?: Date;
|
|
104
|
-
expiryDate?: Date;
|
|
105
|
-
error?: string;
|
|
106
|
-
uploaded?: boolean;
|
|
107
|
-
};
|
|
108
|
-
automationIds?: string[];
|
|
109
|
-
customIntegrations?: object;
|
|
110
|
-
supplierId?: string;
|
|
111
|
-
batchId?: string;
|
|
112
|
-
assetId: string;
|
|
113
|
-
entityId: string;
|
|
114
|
-
companyId: string;
|
|
115
|
-
userSub: string;
|
|
116
|
-
}
|
package/src/types/address.ts
DELETED
package/src/types/asset.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import type { Address } from './address.js'
|
|
2
|
-
import type { StatusHistory } from './statusHistory.js'
|
|
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
|
-
|
package/src/types/automation.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
interface Log {
|
|
2
|
-
message: string;
|
|
3
|
-
timestamp: Date;
|
|
4
|
-
batchId?: string;
|
|
5
|
-
source?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface LastCollection {
|
|
9
|
-
collectedAt: Date | null;
|
|
10
|
-
data: Record<string, any> | null;
|
|
11
|
-
error: Record<string, any> | null;
|
|
12
|
-
status: 'success' | 'error' | 'pending';
|
|
13
|
-
source: Record<string, any> | null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type FrequencyType = 'never' | 'trigger' | 'hourly' | 'daily' | 'weekly' | 'monthly';
|
|
17
|
-
|
|
18
|
-
export interface Automation {
|
|
19
|
-
_id: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
service: string;
|
|
22
|
-
source: string;
|
|
23
|
-
category: string;
|
|
24
|
-
active: boolean;
|
|
25
|
-
status?: 'running' | 'pending';
|
|
26
|
-
lastCollection: LastCollection;
|
|
27
|
-
logs: Log[];
|
|
28
|
-
data: Record<string, any>;
|
|
29
|
-
sourceData: Record<string, any>;
|
|
30
|
-
frequency?: FrequencyType;
|
|
31
|
-
accountIds?: string[];
|
|
32
|
-
assetIds?: string[];
|
|
33
|
-
userSub: string;
|
|
34
|
-
companyId: string;
|
|
35
|
-
}
|
package/src/types/company.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Address } from './address.js'
|
|
3
|
-
import { Portal } from './portal.js'
|
|
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
|
-
}
|
package/src/types/dataIngest.ts
DELETED
package/src/types/email.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
interface Attachment {
|
|
2
|
-
filename: string;
|
|
3
|
-
s3Key: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface Email {
|
|
7
|
-
_id: string;
|
|
8
|
-
destinations: string[];
|
|
9
|
-
service: string;
|
|
10
|
-
subject: string;
|
|
11
|
-
body: string;
|
|
12
|
-
from: string;
|
|
13
|
-
attachments?: Attachment[];
|
|
14
|
-
sesMessageId: string;
|
|
15
|
-
s3Key: string;
|
|
16
|
-
userSub?: string;
|
|
17
|
-
companyId?: string
|
|
18
|
-
}
|
package/src/types/entity.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Address } from './address.js';
|
|
2
|
-
|
|
3
|
-
type EntityType = 'fund' | 'company' | 'charity' | 'school/university' | 'council' | 'other';
|
|
4
|
-
|
|
5
|
-
export interface Entity {
|
|
6
|
-
_id: string;
|
|
7
|
-
legalName: string;
|
|
8
|
-
type: EntityType;
|
|
9
|
-
companyNumber?: string;
|
|
10
|
-
companyLogo?: string;
|
|
11
|
-
billingAddress: Address;
|
|
12
|
-
parentEntityId?: string;
|
|
13
|
-
ultimateParentEntityId?: string;
|
|
14
|
-
companyId: string;
|
|
15
|
-
batchId?: string;
|
|
16
|
-
userSub: string;
|
|
17
|
-
}
|
package/src/types/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type { Account } from './account.js'
|
|
2
|
-
export type { Asset } from './asset.js'
|
|
3
|
-
export type { Automation } from './automation.js'
|
|
4
|
-
export type { Company } from './company.js'
|
|
5
|
-
export type { CreateScraperRunParams, ScraperRun } from './scraperRun.js';
|
|
6
|
-
export type { DataIngest } from './dataIngest.js'
|
|
7
|
-
export type { Entity } from './entity.js'
|
|
8
|
-
export type { Email } from './email.js';
|
|
9
|
-
export type { Invoice } from './invoice.js';
|
|
10
|
-
export type { Log } from './log.js';
|
|
11
|
-
export type { Reading } from './reading.js'
|
|
12
|
-
export type { Report } from './report.js'
|
|
13
|
-
export type { Supplier } from './supplier.js'
|
|
14
|
-
|
|
15
|
-
export interface ETNPagedResponse<T = any> {
|
|
16
|
-
data: T[];
|
|
17
|
-
total: number;
|
|
18
|
-
limit: number;
|
|
19
|
-
skip: number;
|
|
20
|
-
}
|
package/src/types/invoice.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
interface Values {
|
|
2
|
-
friendlyInvoiceNumber?: string;
|
|
3
|
-
friendlySupplierRef?: string;
|
|
4
|
-
friendlyStartDate?: string;
|
|
5
|
-
friendlyEndDate?: string;
|
|
6
|
-
friendlyInvoiceDate?: string;
|
|
7
|
-
friendlyMeterPointNumber?: string;
|
|
8
|
-
friendlyMeterPointNumber2?: string;
|
|
9
|
-
friendlyMeterSerialNumber?: string;
|
|
10
|
-
friendlyPipeSize?: string;
|
|
11
|
-
friendlyTotalUnitCost?: number;
|
|
12
|
-
friendlyTotalWaterCost?: number;
|
|
13
|
-
friendlyTotalWasteCost?: number;
|
|
14
|
-
friendlyTotalDaily?: number;
|
|
15
|
-
friendlyTotalLevy?: number;
|
|
16
|
-
friendlyTotalKva?: number;
|
|
17
|
-
friendlyTotalUnits?: number;
|
|
18
|
-
friendlyTotalWaterVolume?: number;
|
|
19
|
-
friendlyTotalWasteVolume?: number;
|
|
20
|
-
friendlyNetTotalCost?: number;
|
|
21
|
-
friendlyTotalTax?: number;
|
|
22
|
-
friendlyTotalCost?: number;
|
|
23
|
-
friendlyMeteredConsumption?: string;
|
|
24
|
-
friendlyCorrectedConsumption?: string;
|
|
25
|
-
friendlyCorrectionFactor?: string;
|
|
26
|
-
friendlyCalorificValue?: string;
|
|
27
|
-
friendlyReadFactor?: string;
|
|
28
|
-
friendlyType?: string;
|
|
29
|
-
friendlyStartRead?: string;
|
|
30
|
-
friendlyEndRead?: string;
|
|
31
|
-
invoiceNumber?: string;
|
|
32
|
-
supplierRef?: string;
|
|
33
|
-
startDate?: Date;
|
|
34
|
-
endDate?: Date;
|
|
35
|
-
invoiceDate?: Date;
|
|
36
|
-
meterPointNumber?: string;
|
|
37
|
-
meterPointNumber2?: string;
|
|
38
|
-
meterSerialNumber?: string;
|
|
39
|
-
pipeSize?: string;
|
|
40
|
-
totalUnitCost?: number;
|
|
41
|
-
totalWaterCost?: number;
|
|
42
|
-
totalWasteCost?: number;
|
|
43
|
-
totalDaily?: number;
|
|
44
|
-
totalLevy?: number;
|
|
45
|
-
totalKva?: number;
|
|
46
|
-
totalUnits?: number;
|
|
47
|
-
totalWaterVolume?: number;
|
|
48
|
-
totalWasteVolume?: number;
|
|
49
|
-
netTotalCost?: number;
|
|
50
|
-
totalTax?: number;
|
|
51
|
-
totalCost?: number;
|
|
52
|
-
meteredConsumption?: string;
|
|
53
|
-
correctedConsumption?: string;
|
|
54
|
-
correctionFactor?: string;
|
|
55
|
-
calorificValue?: string;
|
|
56
|
-
readFactor?: string;
|
|
57
|
-
type?: string;
|
|
58
|
-
startRead?: string;
|
|
59
|
-
endRead?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
interface Rate {
|
|
63
|
-
consumption?: string;
|
|
64
|
-
cost?: string;
|
|
65
|
-
endDate?: Date | null;
|
|
66
|
-
endRead?: string | null;
|
|
67
|
-
endReadType?: string | null;
|
|
68
|
-
rateName?: string | null;
|
|
69
|
-
startDate?: Date | null;
|
|
70
|
-
startRead?: string | null;
|
|
71
|
-
startReadType?: string | null;
|
|
72
|
-
type: RateType | null;
|
|
73
|
-
unitRate?: string | null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
type InvoiceStatus = 'processing' | 'pending' | 'uploading' | 'queued' | 'captured' | 'error' | 'completed';
|
|
77
|
-
type FinancialStatus = 'approved' | 'new' | 'not-approved' | 'paid' | 'sent-for-payment';
|
|
78
|
-
type RateType = 'unitRate' | 'daily' | 'levy' | 'tax' | 'kva' | 'waterRate' | 'wasteRate' | 'discount'
|
|
79
|
-
export interface Invoice {
|
|
80
|
-
_id: string;
|
|
81
|
-
jobId?: string | null;
|
|
82
|
-
startTime?: Date;
|
|
83
|
-
endTime?: Date | null;
|
|
84
|
-
s3Key: string;
|
|
85
|
-
s3TextractKey?: string | null;
|
|
86
|
-
stampedS3Key: string | null;
|
|
87
|
-
fileName?: string | null;
|
|
88
|
-
status: InvoiceStatus;
|
|
89
|
-
financialStatus: FinancialStatus;
|
|
90
|
-
completed?: boolean;
|
|
91
|
-
type?: string | null;
|
|
92
|
-
tags?: string[];
|
|
93
|
-
manualResults?: Record<string, any>;
|
|
94
|
-
values?: Values;
|
|
95
|
-
rates?: Rate[];
|
|
96
|
-
detailedResults?: Record<string, any>;
|
|
97
|
-
templateVersion?: string | null;
|
|
98
|
-
error?: Record<string, any>;
|
|
99
|
-
isPaid?: boolean;
|
|
100
|
-
isCreditNote?: boolean;
|
|
101
|
-
isConvertedCreditNote?: boolean;
|
|
102
|
-
isManual?: boolean;
|
|
103
|
-
uploaderStatus?: string;
|
|
104
|
-
simulated?: boolean;
|
|
105
|
-
notes?: string | null;
|
|
106
|
-
assignedTo?: string;
|
|
107
|
-
noScrape?: boolean;
|
|
108
|
-
scraperInvoiceId?: string;
|
|
109
|
-
confirmedAt?: Date | null;
|
|
110
|
-
confirmedBy?: string | null;
|
|
111
|
-
supplierId?: string | null;
|
|
112
|
-
sisterId?: string | null;
|
|
113
|
-
batchId?: string | null;
|
|
114
|
-
accountId?: string | null;
|
|
115
|
-
entityId?: string;
|
|
116
|
-
companyId: string;
|
|
117
|
-
userSub: string;
|
|
118
|
-
validation?: any[];
|
|
119
|
-
}
|
package/src/types/log.ts
DELETED
package/src/types/portal.ts
DELETED
package/src/types/reading.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface Reading {
|
|
2
|
-
_id: string;
|
|
3
|
-
submittedAt: Date;
|
|
4
|
-
value: number;
|
|
5
|
-
type?: string;
|
|
6
|
-
invoiceStartRead?: number;
|
|
7
|
-
source: string;
|
|
8
|
-
invoiceId?: string;
|
|
9
|
-
rateId?: string;
|
|
10
|
-
contractRateType?: string;
|
|
11
|
-
invoiceBatchId?: string;
|
|
12
|
-
batchId?: string;
|
|
13
|
-
accountId: string;
|
|
14
|
-
entityId: string;
|
|
15
|
-
companyId: string;
|
|
16
|
-
userSub?: string;
|
|
17
|
-
}
|
package/src/types/report.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface Report {
|
|
2
|
-
_id: string;
|
|
3
|
-
type: 'dynamic' | 'spreadsheet' | 'table' | 'pdf';
|
|
4
|
-
subType?: string;
|
|
5
|
-
fileFormat: 'pdf' | 'xlsx' | 'csv' | 'png' | 'jpg' | 'chart';
|
|
6
|
-
fileName?: string;
|
|
7
|
-
status: 'preparing' | 'ready';
|
|
8
|
-
scheduled?: boolean;
|
|
9
|
-
version?: number;
|
|
10
|
-
metadata?: Record<string, any>;
|
|
11
|
-
data?: Record<string, any>;
|
|
12
|
-
requestedAt: Date;
|
|
13
|
-
availableAt?: Date;
|
|
14
|
-
s3Key: string | null;
|
|
15
|
-
batchId?: string;
|
|
16
|
-
scheduledReportId?: string;
|
|
17
|
-
reportTemplateId?: string;
|
|
18
|
-
entityId: string;
|
|
19
|
-
companyId: string;
|
|
20
|
-
userSub?: string;
|
|
21
|
-
}
|
package/src/types/scraperRun.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
package/src/types/supplier.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
|