@etainabl/nodejs-sdk 1.2.44 → 1.2.46

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 (154) hide show
  1. package/dist/index.d.cts +782 -0
  2. package/dist/index.d.ts +782 -0
  3. package/dist/index.js +626 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +588 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +28 -31
  8. package/.prettierrc +0 -11
  9. package/__tests__/reporting.test.ts +0 -88
  10. package/dist/cjs/api.d.ts +0 -111
  11. package/dist/cjs/api.js +0 -318
  12. package/dist/cjs/consumption.d.ts +0 -14
  13. package/dist/cjs/consumption.js +0 -32
  14. package/dist/cjs/db.d.ts +0 -6
  15. package/dist/cjs/db.js +0 -69
  16. package/dist/cjs/etainabl.d.ts +0 -10
  17. package/dist/cjs/etainabl.js +0 -2
  18. package/dist/cjs/index.d.ts +0 -10
  19. package/dist/cjs/index.js +0 -59
  20. package/dist/cjs/logger.d.ts +0 -3
  21. package/dist/cjs/logger.js +0 -14
  22. package/dist/cjs/monitoring.d.ts +0 -1
  23. package/dist/cjs/monitoring.js +0 -31
  24. package/dist/cjs/package.json +0 -3
  25. package/dist/cjs/reporting.d.ts +0 -2
  26. package/dist/cjs/reporting.js +0 -69
  27. package/dist/cjs/slack.d.ts +0 -4
  28. package/dist/cjs/slack.js +0 -28
  29. package/dist/cjs/types/account.d.ts +0 -112
  30. package/dist/cjs/types/account.js +0 -2
  31. package/dist/cjs/types/address.d.ts +0 -11
  32. package/dist/cjs/types/address.js +0 -2
  33. package/dist/cjs/types/asset.d.ts +0 -122
  34. package/dist/cjs/types/asset.js +0 -3
  35. package/dist/cjs/types/automation.d.ts +0 -33
  36. package/dist/cjs/types/automation.js +0 -2
  37. package/dist/cjs/types/company.d.ts +0 -42
  38. package/dist/cjs/types/company.js +0 -2
  39. package/dist/cjs/types/dataIngest.d.ts +0 -8
  40. package/dist/cjs/types/dataIngest.js +0 -2
  41. package/dist/cjs/types/email.d.ts +0 -18
  42. package/dist/cjs/types/email.js +0 -2
  43. package/dist/cjs/types/entity.d.ts +0 -16
  44. package/dist/cjs/types/entity.js +0 -2
  45. package/dist/cjs/types/index.d.ts +0 -19
  46. package/dist/cjs/types/index.js +0 -2
  47. package/dist/cjs/types/invoice.d.ts +0 -118
  48. package/dist/cjs/types/invoice.js +0 -2
  49. package/dist/cjs/types/log.d.ts +0 -10
  50. package/dist/cjs/types/log.js +0 -2
  51. package/dist/cjs/types/portal.d.ts +0 -8
  52. package/dist/cjs/types/portal.js +0 -2
  53. package/dist/cjs/types/reading.d.ts +0 -17
  54. package/dist/cjs/types/reading.js +0 -2
  55. package/dist/cjs/types/report.d.ts +0 -21
  56. package/dist/cjs/types/report.js +0 -2
  57. package/dist/cjs/types/scraperRun.d.ts +0 -15
  58. package/dist/cjs/types/scraperRun.js +0 -2
  59. package/dist/cjs/types/statusHistory.d.ts +0 -5
  60. package/dist/cjs/types/statusHistory.js +0 -2
  61. package/dist/cjs/types/supplier.d.ts +0 -28
  62. package/dist/cjs/types/supplier.js +0 -3
  63. package/dist/cjs/units.d.ts +0 -22
  64. package/dist/cjs/units.js +0 -94
  65. package/dist/mjs/api.d.ts +0 -111
  66. package/dist/mjs/api.js +0 -308
  67. package/dist/mjs/consumption.d.ts +0 -14
  68. package/dist/mjs/consumption.js +0 -22
  69. package/dist/mjs/db.d.ts +0 -6
  70. package/dist/mjs/db.js +0 -53
  71. package/dist/mjs/etainabl.d.ts +0 -10
  72. package/dist/mjs/etainabl.js +0 -1
  73. package/dist/mjs/index.d.ts +0 -10
  74. package/dist/mjs/index.js +0 -10
  75. package/dist/mjs/logger.d.ts +0 -3
  76. package/dist/mjs/logger.js +0 -9
  77. package/dist/mjs/monitoring.d.ts +0 -1
  78. package/dist/mjs/monitoring.js +0 -15
  79. package/dist/mjs/package.json +0 -3
  80. package/dist/mjs/reporting.d.ts +0 -2
  81. package/dist/mjs/reporting.js +0 -62
  82. package/dist/mjs/slack.d.ts +0 -4
  83. package/dist/mjs/slack.js +0 -14
  84. package/dist/mjs/types/account.d.ts +0 -112
  85. package/dist/mjs/types/account.js +0 -1
  86. package/dist/mjs/types/address.d.ts +0 -11
  87. package/dist/mjs/types/address.js +0 -1
  88. package/dist/mjs/types/asset.d.ts +0 -122
  89. package/dist/mjs/types/asset.js +0 -2
  90. package/dist/mjs/types/automation.d.ts +0 -33
  91. package/dist/mjs/types/automation.js +0 -1
  92. package/dist/mjs/types/company.d.ts +0 -42
  93. package/dist/mjs/types/company.js +0 -1
  94. package/dist/mjs/types/dataIngest.d.ts +0 -8
  95. package/dist/mjs/types/dataIngest.js +0 -1
  96. package/dist/mjs/types/email.d.ts +0 -18
  97. package/dist/mjs/types/email.js +0 -1
  98. package/dist/mjs/types/entity.d.ts +0 -16
  99. package/dist/mjs/types/entity.js +0 -1
  100. package/dist/mjs/types/index.d.ts +0 -19
  101. package/dist/mjs/types/index.js +0 -1
  102. package/dist/mjs/types/invoice.d.ts +0 -118
  103. package/dist/mjs/types/invoice.js +0 -1
  104. package/dist/mjs/types/log.d.ts +0 -10
  105. package/dist/mjs/types/log.js +0 -1
  106. package/dist/mjs/types/portal.d.ts +0 -8
  107. package/dist/mjs/types/portal.js +0 -1
  108. package/dist/mjs/types/reading.d.ts +0 -17
  109. package/dist/mjs/types/reading.js +0 -1
  110. package/dist/mjs/types/report.d.ts +0 -21
  111. package/dist/mjs/types/report.js +0 -1
  112. package/dist/mjs/types/scraperRun.d.ts +0 -15
  113. package/dist/mjs/types/scraperRun.js +0 -1
  114. package/dist/mjs/types/statusHistory.d.ts +0 -5
  115. package/dist/mjs/types/statusHistory.js +0 -1
  116. package/dist/mjs/types/supplier.d.ts +0 -28
  117. package/dist/mjs/types/supplier.js +0 -2
  118. package/dist/mjs/units.d.ts +0 -22
  119. package/dist/mjs/units.js +0 -89
  120. package/eslint.config.js +0 -60
  121. package/fixup.sh +0 -11
  122. package/src/api.ts +0 -382
  123. package/src/consumption.ts +0 -40
  124. package/src/db.ts +0 -69
  125. package/src/etainabl.ts +0 -10
  126. package/src/index.ts +0 -21
  127. package/src/logger.ts +0 -13
  128. package/src/monitoring.ts +0 -18
  129. package/src/reporting.ts +0 -78
  130. package/src/slack.ts +0 -16
  131. package/src/types/account.ts +0 -116
  132. package/src/types/address.ts +0 -12
  133. package/src/types/asset.ts +0 -142
  134. package/src/types/automation.ts +0 -35
  135. package/src/types/company.ts +0 -47
  136. package/src/types/dataIngest.ts +0 -8
  137. package/src/types/email.ts +0 -18
  138. package/src/types/entity.ts +0 -17
  139. package/src/types/index.ts +0 -20
  140. package/src/types/invoice.ts +0 -119
  141. package/src/types/log.ts +0 -10
  142. package/src/types/portal.ts +0 -9
  143. package/src/types/reading.ts +0 -17
  144. package/src/types/report.ts +0 -21
  145. package/src/types/scraperRun.ts +0 -15
  146. package/src/types/statusHistory.ts +0 -5
  147. package/src/types/supplier.ts +0 -31
  148. package/src/units.ts +0 -111
  149. package/tsconfig.base.json +0 -31
  150. package/tsconfig.cjs.json +0 -8
  151. package/tsconfig.json +0 -9
  152. package/tsconfig.test.json +0 -13
  153. package/vitest.config.js +0 -10
  154. package/vitest.workspace.js +0 -5
package/dist/mjs/db.js DELETED
@@ -1,53 +0,0 @@
1
- import { MongoClient } from 'mongodb';
2
- import logger from './logger.js';
3
- const log = logger('dbHelpers');
4
- let cachedDb;
5
- async function connectToDatabase(retryAttempt = 1) {
6
- if (!process.env.ETAINABL_DB_URL)
7
- throw new Error("ETAINABL_DB_URL is not set");
8
- if (!process.env.AWS_ACCESS_KEY_ID)
9
- throw new Error("AWS_ACCESS_KEY_ID is not set");
10
- if (!process.env.AWS_SECRET_ACCESS_KEY)
11
- throw new Error("AWS_SECRET_ACCESS_KEY is not set");
12
- if (cachedDb) {
13
- log.debug('Using cached MongoDB connection.');
14
- return Promise.resolve(cachedDb);
15
- }
16
- const uri = `mongodb+srv://${process.env.ETAINABL_DB_URL}`;
17
- try {
18
- if (process.env.DB_BASIC_AUTH === 'true') {
19
- log.debug('Connecting to MongoDB server... (Auth: Basic)');
20
- const client = new MongoClient(uri);
21
- await client.connect();
22
- log.debug('Connected successfully to MongoDB server! (Auth: Basic)');
23
- cachedDb = client.db('etainabl');
24
- return cachedDb;
25
- }
26
- log.debug('Connecting to MongoDB server... (Auth: AWS)');
27
- const client = new MongoClient(uri, {
28
- auth: {
29
- username: process.env.AWS_ACCESS_KEY_ID,
30
- password: process.env.AWS_SECRET_ACCESS_KEY
31
- },
32
- authSource: '$external',
33
- authMechanism: 'MONGODB-AWS'
34
- });
35
- await client.connect();
36
- log.debug('Connected successfully to MongoDB server! (Auth: AWS)');
37
- cachedDb = client.db('etainabl');
38
- return cachedDb;
39
- }
40
- catch (e) {
41
- // Retry
42
- if (retryAttempt > 5) {
43
- console.log(`Error connecting to MongoDB server after 5 attempts...`);
44
- throw e;
45
- }
46
- console.log(`MongoDB Connection error: ${e.message}`);
47
- console.log(`Error connecting to MongoDB server... Retrying in 3 seconds... (Attempt ${retryAttempt})`);
48
- return connectToDatabase(retryAttempt + 1);
49
- }
50
- }
51
- export default {
52
- connectToDatabase
53
- };
@@ -1,10 +0,0 @@
1
- export interface AuthorizerContext {
2
- companyId: string;
3
- isAdmin: boolean;
4
- isKiosk: boolean;
5
- isPublicApiRequest: boolean;
6
- isService: boolean;
7
- scope: string;
8
- sub: string;
9
- token: string;
10
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import api from './api.js';
2
- import logger from './logger.js';
3
- import db from './db.js';
4
- import slack from './slack.js';
5
- import * as units from './units.js';
6
- import * as consumption from './consumption.js';
7
- import * as monitoring from './monitoring.js';
8
- import * as reporting from './reporting.js';
9
- export { api, logger, consumption, monitoring, db, slack, units, reporting };
10
- export * from './types/index.js';
package/dist/mjs/index.js DELETED
@@ -1,10 +0,0 @@
1
- import api from './api.js';
2
- import logger from './logger.js';
3
- import db from './db.js';
4
- import slack from './slack.js';
5
- import * as units from './units.js';
6
- import * as consumption from './consumption.js';
7
- import * as monitoring from './monitoring.js';
8
- import * as reporting from './reporting.js';
9
- export { api, logger, consumption, monitoring, db, slack, units, reporting };
10
- export * from './types/index.js';
@@ -1,3 +0,0 @@
1
- import winston from 'winston';
2
- declare const _default: (namespace: string) => winston.Logger;
3
- export default _default;
@@ -1,9 +0,0 @@
1
- import winston from 'winston';
2
- export default (namespace) => winston.createLogger({
3
- level: 'debug',
4
- format: winston.format.combine(winston.format.timestamp(), winston.format.json()),
5
- defaultMeta: { service: process.env.AWS_LAMBDA_FUNCTION_NAME, script: namespace },
6
- transports: [
7
- new winston.transports.Console()
8
- ]
9
- });
@@ -1 +0,0 @@
1
- export declare const sendHeartbeat: () => Promise<boolean>;
@@ -1,15 +0,0 @@
1
- import axios from 'axios';
2
- import logger from './logger.js';
3
- const log = logger('monitoring');
4
- export const sendHeartbeat = async () => {
5
- if (!process.env.HEARTBEAT_URL || process.env.HEARTBEAT_URL.endsWith('/'))
6
- return false;
7
- try {
8
- await axios.post(process.env.HEARTBEAT_URL);
9
- return true;
10
- }
11
- catch (e) {
12
- log.warn(`Failed to send heartbeat: ${e.message || e}`);
13
- return false;
14
- }
15
- };
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,2 +0,0 @@
1
- import moment from 'moment';
2
- export declare const getScheduledReportRunTimes: (schedule: any, limit?: number, taskTime?: moment.Moment) => moment.Moment[];
@@ -1,62 +0,0 @@
1
- import moment from 'moment';
2
- moment.locale('en', {
3
- week: {
4
- dow: 1
5
- }
6
- });
7
- const getNextRunTime = (startDate, schedule, taskTime) => {
8
- const [num, freq] = schedule.frequency.split('|');
9
- const targetDate = moment(startDate).add(num, freq);
10
- if (schedule.frequencyPeriod === 'first') {
11
- targetDate.startOf(freq);
12
- }
13
- else if (schedule.frequencyPeriod === 'last') {
14
- targetDate.endOf(freq);
15
- }
16
- const isWeekday = targetDate.isoWeekday() > 0 && targetDate.isoWeekday() < 6;
17
- const isSaturday = targetDate.isoWeekday() === 6;
18
- // The weekday or weekend chosen should be within the same month as the target date
19
- if (schedule.frequencyDay === 'weekdays' && !isWeekday) {
20
- if ((targetDate.date() / 7) < 2) {
21
- targetDate.add(isSaturday ? 2 : 1, 'days');
22
- }
23
- else {
24
- targetDate.subtract(isSaturday ? 1 : 2, 'days');
25
- }
26
- }
27
- else if (schedule.frequencyDay === 'weekends' && isWeekday) {
28
- if ((targetDate.date() / 7) < 2) {
29
- targetDate.isoWeekday(6);
30
- }
31
- else {
32
- targetDate.isoWeekday(0);
33
- }
34
- }
35
- if (taskTime.isAfter(targetDate, 'minute')) {
36
- return getNextRunTime(targetDate, schedule, taskTime);
37
- }
38
- return targetDate;
39
- };
40
- export const getScheduledReportRunTimes = (schedule, limit = 1, taskTime = moment()) => {
41
- if (!schedule.startDate || !schedule.enabled)
42
- return [];
43
- const originalStartDate = moment.utc(schedule.startDate);
44
- let startDate = originalStartDate;
45
- const includeStartDate = taskTime.isSameOrBefore(originalStartDate, 'minute');
46
- let runTimes = [];
47
- if (includeStartDate) {
48
- runTimes = [originalStartDate];
49
- }
50
- const [, freq] = schedule.frequency.split('|');
51
- if (freq === 'once') {
52
- const nextRunTime = runTimes[0];
53
- // If this is now beyond the start date, return an empty array
54
- return taskTime.isAfter(nextRunTime, 'minute') ? [] : runTimes;
55
- }
56
- const scheduleRunTimes = Array.from(Array(includeStartDate ? limit - 1 : limit).keys()).map(() => {
57
- const nextRunTime = getNextRunTime(startDate, schedule, taskTime);
58
- startDate = nextRunTime.hour(originalStartDate.hour()).minute(originalStartDate.minute());
59
- return nextRunTime;
60
- });
61
- return [...runTimes, ...scheduleRunTimes];
62
- };
@@ -1,4 +0,0 @@
1
- declare const _default: {
2
- postMessage: (message: string) => Promise<import("axios").AxiosResponse<any, any>>;
3
- };
4
- export default _default;
package/dist/mjs/slack.js DELETED
@@ -1,14 +0,0 @@
1
- import axios from 'axios';
2
- const postMessage = async (message) => {
3
- const url = 'https://hooks.slack.com/services/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';
4
- const data = {
5
- text: `[${(process.env.ENV || '').toUpperCase()}][${process.env.AWS_LAMBDA_FUNCTION_NAME}] ${message}`
6
- };
7
- const headers = {
8
- 'Content-Type': 'application/json'
9
- };
10
- return axios.post(url, data, { headers });
11
- };
12
- export default {
13
- postMessage
14
- };
@@ -1,112 +0,0 @@
1
- import type { Portal } from './portal.js';
2
- import type { StatusHistory } from './statusHistory.js';
3
- interface PortalAccountSchema extends Portal {
4
- invoiceFilenames: any[];
5
- }
6
- interface RateSchema {
7
- type: string;
8
- value: number;
9
- description: string;
10
- }
11
- interface ContractSchema {
12
- startDate: Date;
13
- endDate: Date;
14
- terminationDate?: Date;
15
- paymentTerms?: string;
16
- duration?: string;
17
- tariffName?: string;
18
- contractConsumption?: number;
19
- volumeTolerance?: any[];
20
- renewablePercentage?: number;
21
- marketBasedEmissionFactor?: number;
22
- chargeableCclPercentage?: number;
23
- commissionRates?: number;
24
- rates: any[];
25
- s3Key?: string;
26
- rateTypeMapping?: object;
27
- batchId?: string;
28
- supplierId?: string;
29
- status: 'active' | 'inactive';
30
- userSub?: string;
31
- deletedOn?: Date;
32
- }
33
- interface CreditNoteSchema {
34
- name: string;
35
- type: string;
36
- amount: number;
37
- netAmount: number;
38
- taxAmount: number;
39
- date: Date;
40
- isPaid: boolean;
41
- s3Key: string;
42
- stampedS3Key: string;
43
- fileName: string;
44
- invoiceData: object;
45
- userSub: string;
46
- readingIds: any[];
47
- supplierId: string;
48
- totalUnits: number;
49
- endDate: Date;
50
- startDate: Date;
51
- stampDate: Date;
52
- totalWaterVolume: number;
53
- totalWasteVolume: number;
54
- totalWaterCost: number;
55
- totalWasteCost: number;
56
- }
57
- export interface Account {
58
- _id: string;
59
- name: string;
60
- modifiedBy?: string;
61
- siteCode?: string;
62
- type: 'gas' | 'electricity' | 'water' | 'waste' | 'solar';
63
- supplierRef?: string;
64
- financialCode?: string;
65
- propertyCode?: string;
66
- meterPointNumber?: string;
67
- meterSerialNumber?: string;
68
- meterPointNumber2?: string;
69
- meterUnits: 'kwh' | 'm3' | 'ft3';
70
- automaticMeterRead?: boolean;
71
- status?: 'active' | 'inactive';
72
- statusHistory?: StatusHistory[];
73
- rates?: RateSchema[];
74
- capacity?: string;
75
- meterOperator?: string;
76
- meterLocation?: string;
77
- meterOperatorType?: 'lease' | 'purchase';
78
- meterOperatorExpiryDate?: Date;
79
- dataCollector?: string;
80
- parentAccountId?: string;
81
- processingInvoices?: object[];
82
- contracts?: ContractSchema[];
83
- creditNotes?: CreditNoteSchema[];
84
- meterUser?: string;
85
- isTrc?: boolean;
86
- floorArea?: string;
87
- floorAreaUnit?: 'metric' | 'imperial';
88
- reportingType?: string;
89
- solarType?: 'generation' | 'export';
90
- consumptionSource?: 'primary' | 'sub' | 'primary-sub';
91
- esec?: 'a' | 'b' | 'c' | 'd' | 'e' | 'g' | 'h' | 'j' | 'k' | 'l' | 'm' | 'n' | 'p' | 'q' | 'r' | 's' | 't' | 'u';
92
- portal?: PortalAccountSchema;
93
- deviceId?: string;
94
- gridfetchLoa?: {
95
- s3Key?: string;
96
- name?: string;
97
- uploadedBy?: string;
98
- uploadedAt?: Date;
99
- expiryDate?: Date;
100
- error?: string;
101
- uploaded?: boolean;
102
- };
103
- automationIds?: string[];
104
- customIntegrations?: object;
105
- supplierId?: string;
106
- batchId?: string;
107
- assetId: string;
108
- entityId: string;
109
- companyId: string;
110
- userSub: string;
111
- }
112
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,122 +0,0 @@
1
- import type { Address } from './address.js';
2
- import type { StatusHistory } from './statusHistory.js';
3
- interface Image {
4
- url?: string;
5
- label?: string;
6
- type?: string;
7
- isHidden?: boolean;
8
- isPrimary?: boolean;
9
- }
10
- interface FloodRisk {
11
- url?: string;
12
- description?: string;
13
- label?: string;
14
- latitude?: number;
15
- longitude?: number;
16
- fetchedAt?: Date;
17
- }
18
- interface Crime {
19
- category?: string;
20
- month?: string;
21
- crimeId?: string;
22
- outcomeCategory?: string;
23
- outcomeDate?: string;
24
- location?: {
25
- latitude: string;
26
- longitude: string;
27
- street: string;
28
- };
29
- fetchedAt?: Date;
30
- }
31
- interface AirQuality {
32
- index?: number;
33
- indexColour?: string;
34
- indexRating?: string;
35
- details?: object;
36
- location?: object;
37
- lastMeasured?: Date;
38
- fetchedAt?: Date;
39
- }
40
- interface Benchmark {
41
- benchmarkId: string;
42
- fieldCode: string;
43
- fieldValue: string;
44
- }
45
- interface Document {
46
- s3Key?: string;
47
- name: string;
48
- extension?: string;
49
- type: string;
50
- status: string;
51
- score?: string;
52
- providerId?: string;
53
- providerData?: object;
54
- certificate?: object;
55
- createdAt: Date;
56
- accountIds?: string[];
57
- }
58
- interface TimelineEvent {
59
- date: Date;
60
- title: string;
61
- status: string;
62
- content?: string;
63
- icon?: string;
64
- accountIds?: string[];
65
- }
66
- interface AssetRecommendation {
67
- recommendationId: string;
68
- documentIds?: string[];
69
- }
70
- interface AssetSettings {
71
- consumptionSources: {
72
- electricity: string;
73
- solar: string;
74
- gas: string;
75
- water: string;
76
- };
77
- }
78
- export interface Asset {
79
- _id: string;
80
- siteName: string;
81
- address: Address;
82
- assetType: string;
83
- floorArea: number;
84
- floorAreaUnit: 'metric' | 'imperial';
85
- noOfFloors?: number;
86
- energyRating: string;
87
- gav: string;
88
- gavCurrency: string;
89
- currency: string;
90
- occupationStatus: 'occupied' | 'vacant' | 'other' | 'n/a';
91
- type: 'new construction' | 'major renovation' | 'standing investment' | 'n/a';
92
- vacancyRate?: number;
93
- constructionYear?: number;
94
- ownedSince?: Date;
95
- disposalDate?: Date;
96
- tenure: 'freehold' | 'leasehold';
97
- tenantControlledPercent?: number;
98
- landlordControlledPercent?: number;
99
- occupancyLevel?: number;
100
- images: Image[];
101
- pricePaid?: number;
102
- floodRisks: FloodRisk[];
103
- recentCrimes: Crime[];
104
- recentAirQuality: AirQuality;
105
- documents?: Document[];
106
- epbCertificates: any[];
107
- status?: string;
108
- settings: AssetSettings;
109
- recommendations?: AssetRecommendation[];
110
- statusHistory: StatusHistory[];
111
- timelineEvents: TimelineEvent[];
112
- benchmarks: Benchmark[];
113
- lastPopulated?: Date;
114
- deletedOn?: Date;
115
- batchId?: string;
116
- companyId: string;
117
- entityId: string;
118
- assetGroupIds: string[];
119
- userSub: string;
120
- gresbId?: string;
121
- }
122
- export {};
@@ -1,2 +0,0 @@
1
- ;
2
- export {};
@@ -1,33 +0,0 @@
1
- interface Log {
2
- message: string;
3
- timestamp: Date;
4
- batchId?: string;
5
- source?: string;
6
- }
7
- interface LastCollection {
8
- collectedAt: Date | null;
9
- data: Record<string, any> | null;
10
- error: Record<string, any> | null;
11
- status: 'success' | 'error' | 'pending';
12
- source: Record<string, any> | null;
13
- }
14
- type FrequencyType = 'never' | 'trigger' | 'hourly' | 'daily' | 'weekly' | 'monthly';
15
- export interface Automation {
16
- _id: string;
17
- description?: string;
18
- service: string;
19
- source: string;
20
- category: string;
21
- active: boolean;
22
- status?: 'running' | 'pending';
23
- lastCollection: LastCollection;
24
- logs: Log[];
25
- data: Record<string, any>;
26
- sourceData: Record<string, any>;
27
- frequency?: FrequencyType;
28
- accountIds?: string[];
29
- assetIds?: string[];
30
- userSub: string;
31
- companyId: string;
32
- }
33
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,42 +0,0 @@
1
- import { Address } from './address.js';
2
- import { Portal } from './portal.js';
3
- interface SupplierPortals {
4
- supplierId: string;
5
- portal: Portal;
6
- }
7
- interface CustomIntegrations {
8
- account: any[];
9
- asset: any[];
10
- entity: any[];
11
- }
12
- interface DefaultSources {
13
- electricity: 'invoice' | 'consumption' | 'reading';
14
- solar: 'invoice' | 'consumption' | 'reading';
15
- gas: 'invoice' | 'consumption' | 'reading';
16
- water: 'invoice' | 'consumption' | 'reading';
17
- }
18
- interface CompanySettings {
19
- showLogo?: boolean;
20
- invoiceCategories?: any[];
21
- miscInvoiceCategories?: any[];
22
- messageCategories?: any[];
23
- documentCategories?: any[];
24
- assetDataSchemas?: any[];
25
- hideCostData?: boolean;
26
- calendarPeriod?: string;
27
- customIntegrations?: CustomIntegrations;
28
- supplierPortals?: SupplierPortals[];
29
- defaultSources?: DefaultSources;
30
- scraperCounter?: number;
31
- }
32
- export interface Company {
33
- _id: string;
34
- name: string;
35
- address?: Address;
36
- invoiceEmail?: string;
37
- users?: string[];
38
- settings: CompanySettings;
39
- logoS3Key: string;
40
- logoUrl?: string;
41
- }
42
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -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 +0,0 @@
1
- export {};
@@ -1,18 +0,0 @@
1
- interface Attachment {
2
- filename: string;
3
- s3Key: string;
4
- }
5
- export interface Email {
6
- _id: string;
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
- }
18
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- import { Address } from './address.js';
2
- type EntityType = 'fund' | 'company' | 'charity' | 'school/university' | 'council' | 'other';
3
- export interface Entity {
4
- _id: string;
5
- legalName: string;
6
- type: EntityType;
7
- companyNumber?: string;
8
- companyLogo?: string;
9
- billingAddress: Address;
10
- parentEntityId?: string;
11
- ultimateParentEntityId?: string;
12
- companyId: string;
13
- batchId?: string;
14
- userSub: string;
15
- }
16
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +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
- export interface ETNPagedResponse<T = any> {
15
- data: T[];
16
- total: number;
17
- limit: number;
18
- skip: number;
19
- }
@@ -1 +0,0 @@
1
- export {};