@etainabl/nodejs-sdk 1.2.36 → 1.2.37

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/.prettierrc ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "printWidth": 150,
3
+ "parser": "flow",
4
+ "semi": true,
5
+ "tabWidth": 4,
6
+ "useTabs": false,
7
+ "singleQuote": true,
8
+ "trailingComma": "none",
9
+ "bracketSpacing": true,
10
+ "arrowParens": "avoid"
11
+ }
package/dist/cjs/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
37
  };
@@ -0,0 +1,60 @@
1
+ import tseslint from '@typescript-eslint/eslint-plugin';
2
+ import tsParser from '@typescript-eslint/parser';
3
+
4
+ export default [
5
+ {
6
+ ignores: [
7
+ 'node_modules/**',
8
+ 'dist/**',
9
+ 'coverage/**',
10
+ 'logs/**',
11
+ '*.log',
12
+ '.DS_Store'
13
+ ]
14
+ },
15
+ {
16
+ files: ['**/*.js', '**/*.ts'],
17
+ plugins: {
18
+ '@typescript-eslint': tseslint
19
+ },
20
+ languageOptions: {
21
+ parser: tsParser,
22
+ ecmaVersion: 2020,
23
+ sourceType: 'module',
24
+ parserOptions: {
25
+ ecmaVersion: 2020,
26
+ sourceType: 'module'
27
+ }
28
+ },
29
+ linterOptions: {
30
+ reportUnusedDisableDirectives: true
31
+ },
32
+ rules: {
33
+ 'no-console': 'off',
34
+ 'comma-dangle': ['error', 'never'],
35
+ 'arrow-parens': ['error', 'as-needed'],
36
+ 'linebreak-style': 'off',
37
+ 'padded-blocks': 'off',
38
+ 'no-underscore-dangle': 'off',
39
+ 'no-param-reassign': ['error', { props: false }],
40
+ 'new-cap': ['error', { capIsNewExceptions: ['Router', 'ObjectId'] }],
41
+ 'no-tabs': 'error',
42
+ 'max-len': ['warn', 150],
43
+ 'no-plusplus': 'off',
44
+ 'generator-star-spacing': 'off',
45
+ 'class-methods-use-this': 'off',
46
+ 'import/extensions': 'off',
47
+ 'import/no-unresolved': 'off',
48
+ 'prefer-destructuring': 'off',
49
+ 'no-use-before-define': 'off',
50
+ 'import/prefer-default-export': 'off'
51
+ },
52
+ settings: {
53
+ 'import/resolver': {
54
+ node: {
55
+ extensions: ['.js', '.ts']
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etainabl/nodejs-sdk",
3
- "version": "1.2.36",
3
+ "version": "1.2.37",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/mjs/index.js",
6
6
  "types": "dist/mjs/index.d.ts",
@@ -13,7 +13,16 @@
13
13
  "winston": "^3.10.0"
14
14
  },
15
15
  "devDependencies": {
16
+ "@babel/eslint-parser": "^7.27.0",
16
17
  "@types/node": "^20.4.5",
18
+ "@typescript-eslint/eslint-plugin": "^8.29.0",
19
+ "@typescript-eslint/parser": "^8.29.0",
20
+ "eslint": "^9.23.0",
21
+ "eslint-config-airbnb": "^19.0.4",
22
+ "eslint-config-airbnb-base": "^15.0.0",
23
+ "eslint-config-prettier": "^10.1.1",
24
+ "eslint-plugin-import": "^2.31.0",
25
+ "prettier-eslint": "^16.3.0",
17
26
  "vitest": "^2.1.1"
18
27
  },
19
28
  "scripts": {
@@ -1,5 +1,5 @@
1
- import type { Portal } from './portal.ts';
2
- import type { StatusHistory } from './statusHistory.ts'
1
+ import type { Portal } from './portal.js';
2
+ import type { StatusHistory } from './statusHistory.js'
3
3
 
4
4
  interface PortalAccountSchema extends Portal{
5
5
  invoiceFilenames: any[];
@@ -1,5 +1,3 @@
1
- import { Types } from 'mongoose';
2
-
3
1
  interface Log {
4
2
  message: string;
5
3
  timestamp: Date;
@@ -29,8 +27,8 @@ export interface Automation {
29
27
  data: Record<string, any>;
30
28
  sourceData: Record<string, any>;
31
29
  frequency?: FrequencyType;
32
- accountIds?: Types.ObjectId[];
33
- assetIds?: Types.ObjectId[];
30
+ accountIds?: string[];
31
+ assetIds?: string[];
34
32
  userSub: string;
35
- companyId: Types.ObjectId;
33
+ companyId: string;
36
34
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { Address } from './address.js'
3
- import { Portal } from './portal.ts'
3
+ import { Portal } from './portal.js'
4
4
 
5
5
  interface SupplierPortals {
6
6
  supplierId: string;
@@ -1,8 +1,7 @@
1
1
  export interface DataIngest {
2
2
  messageId: string;
3
3
  status: 'started' | 'processing' | 'importing' | 'completed' | 'failed' | 'dlq'
4
- context: string
4
+ context: any;
5
5
  startTime: string;
6
6
  remainingTime: number;
7
- context: {}
8
7
  }
@@ -1,18 +1,17 @@
1
- import { Types } from 'mongoose';
2
- import { Address} from './address.ts';
1
+ import { Address } from './address.js';
3
2
 
4
3
  type EntityType = 'fund' | 'company' | 'charity' | 'school/university' | 'council' | 'other';
5
4
 
6
5
  export interface Entity {
7
- _id?: Types.ObjectId;
6
+ _id?: string;
8
7
  legalName: string;
9
8
  type: EntityType;
10
9
  companyNumber?: string;
11
10
  companyLogo?: string;
12
11
  billingAddress: Address;
13
- parentEntityId?: Types.ObjectId;
14
- ultimateParentEntityId?: Types.ObjectId;
15
- companyId: Types.ObjectId;
12
+ parentEntityId?: string;
13
+ ultimateParentEntityId?: string;
14
+ companyId: string;
16
15
  batchId?: string;
17
16
  userSub: string;
18
17
  }
@@ -1,33 +1,16 @@
1
- import type { Account } from './account.js'
2
- import type { Asset } from './asset.js'
3
- import type { Automation } from './automation.js'
4
- import type { Company } from './company.js'
5
- import type { CreateScraperRunParams, ScraperRun } from './scraperRun.js';
6
- import type { DataIngest } from './dataIngest.js'
7
- import type { Entity } from './entity.js'
8
- import type { Email } from './email.js';
9
- import type { Invoice } from './invoice.js';
10
- import type { Log } from './log.js';
11
- import type { Reading } from './reading.js'
12
- import type { Report } from './report.js'
13
- import type { Supplier } from './supplier.js'
14
-
15
- export type {
16
- Account,
17
- Asset,
18
- Automation,
19
- Company,
20
- CreateScraperRunParams,
21
- DataIngest,
22
- Email,
23
- Entity,
24
- Invoice,
25
- Log,
26
- Reading,
27
- Report,
28
- ScraperRun,
29
- Supplier
30
- };
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'
31
14
 
32
15
  export interface ETNPagedResponse<T = any> {
33
16
  data: T[];
@@ -1,5 +1,3 @@
1
- import { Types } from 'mongoose';
2
-
3
1
  interface Values {
4
2
  friendlyInvoiceNumber?: string;
5
3
  friendlySupplierRef?: string;
@@ -61,9 +59,23 @@ interface Values {
61
59
  endRead?: string;
62
60
  }
63
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
+
64
76
  type InvoiceStatus = 'processing' | 'pending' | 'uploading' | 'queued' | 'captured' | 'error' | 'completed';
65
77
  type FinancialStatus = 'approved' | 'new' | 'not-approved' | 'paid' | 'sent-for-payment';
66
-
78
+ type RateType = 'unitRate' | 'daily' | 'levy' | 'tax' | 'kva' | 'waterRate' | 'wasteRate' | 'discount'
67
79
  export interface Invoice {
68
80
  jobId?: string | null;
69
81
  startTime?: Date;
@@ -79,7 +91,7 @@ export interface Invoice {
79
91
  tags?: string[];
80
92
  manualResults?: Record<string, any>;
81
93
  values?: Values;
82
- rates?: any[];
94
+ rates?: Rate[];
83
95
  detailedResults?: Record<string, any>;
84
96
  templateVersion?: string | null;
85
97
  error?: Record<string, any>;
@@ -95,12 +107,12 @@ export interface Invoice {
95
107
  scraperInvoiceId?: string;
96
108
  confirmedAt?: Date | null;
97
109
  confirmedBy?: string | null;
98
- supplierId?: Types.ObjectId | null;
110
+ supplierId?: string | null;
99
111
  sisterId?: string | null;
100
112
  batchId?: string | null;
101
- accountId?: Types.ObjectId | null;
102
- entityId?: Types.ObjectId;
103
- companyId: Types.ObjectId;
113
+ accountId?: string | null;
114
+ entityId?: string;
115
+ companyId: string;
104
116
  userSub: string;
105
117
  validation?: any[];
106
118
  }
package/.eslintrc.js DELETED
@@ -1,29 +0,0 @@
1
- module.exports = {
2
- extends: ['airbnb-base'],
3
- parser: '@typescript-eslint/parser',
4
- rules: {
5
- 'no-console': 'off',
6
- 'comma-dangle': [2, 'never'],
7
- 'arrow-parens': [2, 'as-needed'],
8
- 'linebreak-style': 0,
9
- 'padded-blocks': 0,
10
- 'no-underscore-dangle': [0],
11
- 'no-param-reassign': [2, { props: false }],
12
- 'new-cap': [2, { capIsNewExceptions: ['Router', 'ObjectId'] }],
13
- 'no-tabs': 2,
14
- 'max-len': [1, 150],
15
- 'no-plusplus': 0,
16
- 'generator-star-spacing': 0,
17
- 'class-methods-use-this': 0,
18
- 'import/extensions': 0,
19
- 'import/no-unresolved': 0,
20
- 'prefer-destructuring': 0,
21
- 'no-use-before-define': 0,
22
- 'import/prefer-default-export': 'off'
23
- },
24
- env: {
25
- node: true,
26
- browser: true
27
- },
28
- parserOptions: { ecmaVersion: 2020 }
29
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes