@etainabl/nodejs-sdk 1.2.44 → 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.
Files changed (155) hide show
  1. package/dist/cjs/package.json +2 -2
  2. package/dist/esm/package.json +3 -0
  3. package/dist/index.d.cts +782 -0
  4. package/dist/index.d.ts +782 -0
  5. package/dist/index.js +626 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +588 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +28 -31
  10. package/.prettierrc +0 -11
  11. package/__tests__/reporting.test.ts +0 -88
  12. package/dist/cjs/api.d.ts +0 -111
  13. package/dist/cjs/api.js +0 -318
  14. package/dist/cjs/consumption.d.ts +0 -14
  15. package/dist/cjs/consumption.js +0 -32
  16. package/dist/cjs/db.d.ts +0 -6
  17. package/dist/cjs/db.js +0 -69
  18. package/dist/cjs/etainabl.d.ts +0 -10
  19. package/dist/cjs/etainabl.js +0 -2
  20. package/dist/cjs/index.d.ts +0 -10
  21. package/dist/cjs/index.js +0 -59
  22. package/dist/cjs/logger.d.ts +0 -3
  23. package/dist/cjs/logger.js +0 -14
  24. package/dist/cjs/monitoring.d.ts +0 -1
  25. package/dist/cjs/monitoring.js +0 -31
  26. package/dist/cjs/reporting.d.ts +0 -2
  27. package/dist/cjs/reporting.js +0 -69
  28. package/dist/cjs/slack.d.ts +0 -4
  29. package/dist/cjs/slack.js +0 -28
  30. package/dist/cjs/types/account.d.ts +0 -112
  31. package/dist/cjs/types/account.js +0 -2
  32. package/dist/cjs/types/address.d.ts +0 -11
  33. package/dist/cjs/types/address.js +0 -2
  34. package/dist/cjs/types/asset.d.ts +0 -122
  35. package/dist/cjs/types/asset.js +0 -3
  36. package/dist/cjs/types/automation.d.ts +0 -33
  37. package/dist/cjs/types/automation.js +0 -2
  38. package/dist/cjs/types/company.d.ts +0 -42
  39. package/dist/cjs/types/company.js +0 -2
  40. package/dist/cjs/types/dataIngest.d.ts +0 -8
  41. package/dist/cjs/types/dataIngest.js +0 -2
  42. package/dist/cjs/types/email.d.ts +0 -18
  43. package/dist/cjs/types/email.js +0 -2
  44. package/dist/cjs/types/entity.d.ts +0 -16
  45. package/dist/cjs/types/entity.js +0 -2
  46. package/dist/cjs/types/index.d.ts +0 -19
  47. package/dist/cjs/types/index.js +0 -2
  48. package/dist/cjs/types/invoice.d.ts +0 -118
  49. package/dist/cjs/types/invoice.js +0 -2
  50. package/dist/cjs/types/log.d.ts +0 -10
  51. package/dist/cjs/types/log.js +0 -2
  52. package/dist/cjs/types/portal.d.ts +0 -8
  53. package/dist/cjs/types/portal.js +0 -2
  54. package/dist/cjs/types/reading.d.ts +0 -17
  55. package/dist/cjs/types/reading.js +0 -2
  56. package/dist/cjs/types/report.d.ts +0 -21
  57. package/dist/cjs/types/report.js +0 -2
  58. package/dist/cjs/types/scraperRun.d.ts +0 -15
  59. package/dist/cjs/types/scraperRun.js +0 -2
  60. package/dist/cjs/types/statusHistory.d.ts +0 -5
  61. package/dist/cjs/types/statusHistory.js +0 -2
  62. package/dist/cjs/types/supplier.d.ts +0 -28
  63. package/dist/cjs/types/supplier.js +0 -3
  64. package/dist/cjs/units.d.ts +0 -22
  65. package/dist/cjs/units.js +0 -94
  66. package/dist/mjs/api.d.ts +0 -111
  67. package/dist/mjs/api.js +0 -308
  68. package/dist/mjs/consumption.d.ts +0 -14
  69. package/dist/mjs/consumption.js +0 -22
  70. package/dist/mjs/db.d.ts +0 -6
  71. package/dist/mjs/db.js +0 -53
  72. package/dist/mjs/etainabl.d.ts +0 -10
  73. package/dist/mjs/etainabl.js +0 -1
  74. package/dist/mjs/index.d.ts +0 -10
  75. package/dist/mjs/index.js +0 -10
  76. package/dist/mjs/logger.d.ts +0 -3
  77. package/dist/mjs/logger.js +0 -9
  78. package/dist/mjs/monitoring.d.ts +0 -1
  79. package/dist/mjs/monitoring.js +0 -15
  80. package/dist/mjs/package.json +0 -3
  81. package/dist/mjs/reporting.d.ts +0 -2
  82. package/dist/mjs/reporting.js +0 -62
  83. package/dist/mjs/slack.d.ts +0 -4
  84. package/dist/mjs/slack.js +0 -14
  85. package/dist/mjs/types/account.d.ts +0 -112
  86. package/dist/mjs/types/account.js +0 -1
  87. package/dist/mjs/types/address.d.ts +0 -11
  88. package/dist/mjs/types/address.js +0 -1
  89. package/dist/mjs/types/asset.d.ts +0 -122
  90. package/dist/mjs/types/asset.js +0 -2
  91. package/dist/mjs/types/automation.d.ts +0 -33
  92. package/dist/mjs/types/automation.js +0 -1
  93. package/dist/mjs/types/company.d.ts +0 -42
  94. package/dist/mjs/types/company.js +0 -1
  95. package/dist/mjs/types/dataIngest.d.ts +0 -8
  96. package/dist/mjs/types/dataIngest.js +0 -1
  97. package/dist/mjs/types/email.d.ts +0 -18
  98. package/dist/mjs/types/email.js +0 -1
  99. package/dist/mjs/types/entity.d.ts +0 -16
  100. package/dist/mjs/types/entity.js +0 -1
  101. package/dist/mjs/types/index.d.ts +0 -19
  102. package/dist/mjs/types/index.js +0 -1
  103. package/dist/mjs/types/invoice.d.ts +0 -118
  104. package/dist/mjs/types/invoice.js +0 -1
  105. package/dist/mjs/types/log.d.ts +0 -10
  106. package/dist/mjs/types/log.js +0 -1
  107. package/dist/mjs/types/portal.d.ts +0 -8
  108. package/dist/mjs/types/portal.js +0 -1
  109. package/dist/mjs/types/reading.d.ts +0 -17
  110. package/dist/mjs/types/reading.js +0 -1
  111. package/dist/mjs/types/report.d.ts +0 -21
  112. package/dist/mjs/types/report.js +0 -1
  113. package/dist/mjs/types/scraperRun.d.ts +0 -15
  114. package/dist/mjs/types/scraperRun.js +0 -1
  115. package/dist/mjs/types/statusHistory.d.ts +0 -5
  116. package/dist/mjs/types/statusHistory.js +0 -1
  117. package/dist/mjs/types/supplier.d.ts +0 -28
  118. package/dist/mjs/types/supplier.js +0 -2
  119. package/dist/mjs/units.d.ts +0 -22
  120. package/dist/mjs/units.js +0 -89
  121. package/eslint.config.js +0 -60
  122. package/fixup.sh +0 -11
  123. package/src/api.ts +0 -382
  124. package/src/consumption.ts +0 -40
  125. package/src/db.ts +0 -69
  126. package/src/etainabl.ts +0 -10
  127. package/src/index.ts +0 -21
  128. package/src/logger.ts +0 -13
  129. package/src/monitoring.ts +0 -18
  130. package/src/reporting.ts +0 -78
  131. package/src/slack.ts +0 -16
  132. package/src/types/account.ts +0 -116
  133. package/src/types/address.ts +0 -12
  134. package/src/types/asset.ts +0 -142
  135. package/src/types/automation.ts +0 -35
  136. package/src/types/company.ts +0 -47
  137. package/src/types/dataIngest.ts +0 -8
  138. package/src/types/email.ts +0 -18
  139. package/src/types/entity.ts +0 -17
  140. package/src/types/index.ts +0 -20
  141. package/src/types/invoice.ts +0 -119
  142. package/src/types/log.ts +0 -10
  143. package/src/types/portal.ts +0 -9
  144. package/src/types/reading.ts +0 -17
  145. package/src/types/report.ts +0 -21
  146. package/src/types/scraperRun.ts +0 -15
  147. package/src/types/statusHistory.ts +0 -5
  148. package/src/types/supplier.ts +0 -31
  149. package/src/units.ts +0 -111
  150. package/tsconfig.base.json +0 -31
  151. package/tsconfig.cjs.json +0 -8
  152. package/tsconfig.json +0 -9
  153. package/tsconfig.test.json +0 -13
  154. package/vitest.config.js +0 -10
  155. package/vitest.workspace.js +0 -5
@@ -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
- }
@@ -1,12 +0,0 @@
1
- export interface Address {
2
- streetAddress: string;
3
- locality?: string;
4
- region?: string;
5
- postCode: string;
6
- province?: string;
7
- countryCode?: string;
8
- jurisdictionCode?: string;
9
- latitude?: string;
10
- longitude?: string;
11
- }
12
-
@@ -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
-
@@ -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
- }
@@ -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
- }
@@ -1,8 +0,0 @@
1
- export interface DataIngest {
2
- _id: string;
3
- messageId: string;
4
- status: 'started' | 'processing' | 'importing' | 'completed' | 'failed' | 'dlq'
5
- context: any;
6
- startTime: string;
7
- remainingTime: number;
8
- }
@@ -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
- }
@@ -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
- }
@@ -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
- }
@@ -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
@@ -1,10 +0,0 @@
1
- export interface Log {
2
- _id: string;
3
- message: string
4
- context?: {}
5
- linkedId?: string
6
- linkedType?: string
7
- type: string
8
- userSub?: string
9
- companyId?: string
10
- }
@@ -1,9 +0,0 @@
1
- export interface Portal {
2
- username?: string;
3
- password?: string;
4
- scraperEnabled?: boolean;
5
- url?: string;
6
- scraperId?: string;
7
- scraperStartDate?: Date;
8
- }
9
-
@@ -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
- }
@@ -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
- }
@@ -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
- }
@@ -1,5 +0,0 @@
1
- export interface StatusHistory {
2
- date: Date;
3
- value: 'active' | 'inactive';
4
- notes?: string;
5
- }
@@ -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
-