ln-accounting 7.0.1 → 8.0.0

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/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Versions
2
2
 
3
- ## Version 7.0.1
3
+ ## Version 8.0.0
4
+
5
+ ### Breaking Changes
6
+
7
+ - Node.js 18 or higher is now required
8
+
9
+ ## Version 7.0.2
4
10
 
5
11
  ### Breaking Changes
6
12
 
package/package.json CHANGED
@@ -7,20 +7,17 @@
7
7
  "url": "https://github.com/alexbosworth/ln-accounting/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@json2csv/plainjs": "6.1.3",
11
- "async": "3.2.4",
12
- "asyncjs-util": "1.2.11",
13
- "bitcoinjs-lib": "6.1.0",
14
- "goldengate": "12.0.5",
10
+ "@json2csv/plainjs": "7.0.6",
11
+ "async": "3.2.5",
12
+ "asyncjs-util": "1.2.12",
13
+ "bitcoinjs-lib": "6.1.5",
14
+ "goldengate": "14.0.2",
15
15
  "hot-formula-parser": "4.0.0",
16
- "ln-service": "56.3.0"
16
+ "ln-service": "57.8.1"
17
17
  },
18
18
  "description": "lnd accounting reports",
19
- "devDependencies": {
20
- "@alexbosworth/tap": "15.0.12"
21
- },
22
19
  "engines": {
23
- "node": ">=16"
20
+ "node": ">=18"
24
21
  },
25
22
  "keywords": [
26
23
  "accounting",
@@ -34,7 +31,7 @@
34
31
  "url": "https://github.com/alexbosworth/ln-accounting.git"
35
32
  },
36
33
  "scripts": {
37
- "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 test/blockstream/*.js test/fiat/*.js test/harmony/*.js test/records/*.js test/report/*.js"
34
+ "test": "npx nyc@15.1.0 node --experimental-test-coverage --test"
38
35
  },
39
- "version": "7.0.1"
36
+ "version": "8.0.0"
40
37
  }
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const {rejects} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
5
  const method = require('./../../blockstream/get_blockstream_tx');
4
6
 
@@ -95,15 +97,15 @@ const tests = [
95
97
  ];
96
98
 
97
99
  tests.forEach(({args, description, error, expected}) => {
98
- return test(description, async ({end, rejects, strictSame}) => {
100
+ return test(description, async () => {
99
101
  if (!!error) {
100
102
  await rejects(method(args), error, 'Got expected error');
101
103
  } else {
102
104
  const res = await method(args);
103
105
 
104
- strictSame(res, expected, 'Got expected result');
106
+ deepEqual(res, expected, 'Got expected result');
105
107
  }
106
108
 
107
- return end();
109
+ return;
108
110
  });
109
111
  });
@@ -1,6 +1,8 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {equal} = require('node:assert').strict;
2
+ const {rejects} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
- const getCoincapHistoricRate = require('./../../fiat/get_coincap_historic_rate');
5
+ const method = require('./../../fiat/get_coincap_historic_rate');
4
6
 
5
7
  const date = new Date().toISOString();
6
8
 
@@ -70,15 +72,15 @@ const tests = [
70
72
  ];
71
73
 
72
74
  tests.forEach(({args, description, error, expected}) => {
73
- return test(description, async ({end, equal, rejects}) => {
75
+ return test(description, async () => {
74
76
  if (!!error) {
75
- rejects(getCoincapHistoricRate(args), error, 'Got expected error');
77
+ await rejects(method(args), error, 'Got expected error');
76
78
  } else {
77
- const {cents} = await getCoincapHistoricRate(args);
79
+ const {cents} = await method(args);
78
80
 
79
81
  equal(cents, expected.cents, 'Cents returned');
80
82
  }
81
83
 
82
- return end();
84
+ return;
83
85
  });
84
86
  });
@@ -1,6 +1,8 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {equal} = require('node:assert').strict;
2
+ const {rejects} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
- const getCoindeskHistoricRate = require('./../../fiat/get_coindesk_historic_rate');
5
+ const method = require('./../../fiat/get_coindesk_historic_rate');
4
6
 
5
7
  const api = ({qs}, cbk) => {
6
8
  const bpi = {};
@@ -64,15 +66,15 @@ const tests = [
64
66
  ];
65
67
 
66
68
  tests.forEach(({args, description, error, expected}) => {
67
- return test(description, async ({end, equal, rejects}) => {
69
+ return test(description, async () => {
68
70
  if (!!error) {
69
- rejects(getCoindeskHistoricRate(args), error, 'Got expected error');
71
+ await rejects(method(args), error, 'Got expected error');
70
72
  } else {
71
- const {cents} = await getCoindeskHistoricRate(args);
73
+ const {cents} = await method(args);
72
74
 
73
75
  equal(cents, expected.cents, 'Cents returned');
74
76
  }
75
77
 
76
- return end();
78
+ return;
77
79
  });
78
80
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const {rejects} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
5
  const method = require('./../../fiat/get_coingecko_historic_rate');
4
6
 
@@ -73,15 +75,15 @@ const tests = [
73
75
  ];
74
76
 
75
77
  tests.forEach(({args, description, error, expected}) => {
76
- return test(description, async ({end, rejects, strictSame}) => {
78
+ return test(description, async () => {
77
79
  if (!!error) {
78
80
  await rejects(method(args), error, 'Got expected error');
79
81
  } else {
80
82
  const res = await method(args);
81
83
 
82
- strictSame(res, expected, 'Got expected return value');
84
+ deepEqual(res, expected, 'Got expected return value');
83
85
  }
84
86
 
85
- return end();
87
+ return;
86
88
  });
87
89
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const {rejects} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
5
  const {getFiatValues} = require('./../../fiat/');
4
6
 
@@ -30,10 +32,10 @@ const tests = [
30
32
  currency: 'BTC',
31
33
  dates: [date],
32
34
  fiat: 'USD',
33
- rate: ({}, cbk) => cbk('err'),
35
+ rate: ({}, cbk) => cbk(['err']),
34
36
  },
35
37
  description: 'Rate method errors are passed back',
36
- error: 'err',
38
+ error: ['err'],
37
39
  },
38
40
  {
39
41
  args: {
@@ -58,15 +60,15 @@ const tests = [
58
60
  ];
59
61
 
60
62
  tests.forEach(({args, description, error, expected}) => {
61
- return test(description, async ({end, equal, rejects, strictSame}) => {
63
+ return test(description, async () => {
62
64
  if (!!error) {
63
65
  await rejects(getFiatValues(args), error, 'Got expected error');
64
66
  } else {
65
67
  const {rates} = await getFiatValues(args);
66
68
 
67
- strictSame(rates, expected.rates, 'Rates returned');
69
+ deepEqual(rates, expected.rates, 'Rates returned');
68
70
  }
69
71
 
70
- return end();
72
+ return;
71
73
  });
72
74
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {equal} = require('node:assert').strict;
2
+ const {rejects} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
5
  const getHistoricRate = require('./../../fiat/get_historic_rate');
4
6
 
@@ -61,15 +63,15 @@ const tests = [
61
63
  ];
62
64
 
63
65
  tests.forEach(({args, description, error, expected}) => {
64
- return test(description, async ({end, equal, rejects}) => {
66
+ return test(description, async () => {
65
67
  if (!!error) {
66
- rejects(getHistoricRate(args), error, 'Gote expected error');
68
+ await rejects(getHistoricRate(args), error, 'Gote expected error');
67
69
  } else {
68
70
  const {cents} = await getHistoricRate(args);
69
71
 
70
72
  equal(cents, expected.cents, 'Rate returned');
71
73
  }
72
74
 
73
- return end();
75
+ return;
74
76
  });
75
77
  });
@@ -1,4 +1,7 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const {equal} = require('node:assert').strict;
3
+ const test = require('node:test');
4
+ const {throws} = require('node:assert').strict;
2
5
 
3
6
  const {categorizeRecords} = require('./../../harmony');
4
7
 
@@ -138,13 +141,13 @@ const tests = [
138
141
  ];
139
142
 
140
143
  tests.forEach(({args, description, error, expected}) => {
141
- return test(description, async ({end, equal, strictSame, throws}) => {
144
+ return test(description, (t, end) => {
142
145
  if (!!error) {
143
146
  throws(() => categorizeRecords(args), new Error(error), 'Got error');
144
147
  } else {
145
- const categorized = await categorizeRecords(args);
148
+ const categorized = categorizeRecords(args);
146
149
 
147
- strictSame(categorized.payments, expected.payments, 'Categorized records');
150
+ deepEqual(categorized.payments, expected.payments, 'Categorized');
148
151
  equal(categorized.payments_csv, expected.payments_csv, 'Categorize csv');
149
152
  }
150
153
 
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
2
3
 
3
4
  const {chainFeesAsRecords} = require('./../../harmony');
4
5
 
@@ -29,10 +30,10 @@ const tests = [
29
30
  ];
30
31
 
31
32
  tests.forEach(({args, description, expected}) => {
32
- return test(description, ({end, equal, strictSame}) => {
33
+ return test(description, (t, end) => {
33
34
  const {records} = chainFeesAsRecords(args);
34
35
 
35
- strictSame(records, expected.records, 'Fees formatted as records');
36
+ deepEqual(records, expected.records, 'Fees formatted as records');
36
37
 
37
38
  return end();
38
39
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const {chainReceivesAsRecords} = require('./../../harmony');
4
6
 
@@ -57,13 +59,13 @@ const tests = [
57
59
  ];
58
60
 
59
61
  tests.forEach(({args, description, error, expected}) => {
60
- return test(description, ({end, equal, strictSame, throws}) => {
62
+ return test(description, (t, end) => {
61
63
  if (!!error) {
62
64
  throws(() => chainReceivesAsRecords(args), new Error(error), 'Got err');
63
65
  } else {
64
66
  const {records} = chainReceivesAsRecords(args);
65
67
 
66
- strictSame(records, expected.records, 'Fees formatted as records');
68
+ deepEqual(records, expected.records, 'Fees formatted as records');
67
69
  }
68
70
 
69
71
  return end();
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
2
3
 
3
4
  const {chainSendsAsRecords} = require('./../../harmony');
4
5
 
@@ -44,10 +45,10 @@ const tests = [
44
45
  ];
45
46
 
46
47
  tests.forEach(({args, description, expected}) => {
47
- return test(description, ({end, equal, strictSame}) => {
48
+ return test(description, (t, end) => {
48
49
  const {records} = chainSendsAsRecords(args);
49
50
 
50
- strictSame(records, expected.records, 'Fees formatted as records');
51
+ deepEqual(records, expected.records, 'Fees formatted as records');
51
52
 
52
53
  return end();
53
54
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const formattedNotes = require('./../../harmony/formatted_notes');
4
6
 
@@ -16,7 +18,7 @@ const tests = [
16
18
  ];
17
19
 
18
20
  tests.forEach(({args, description, error, expected}) => {
19
- return test(description, ({end, equal, throws}) => {
21
+ return test(description, (t, end) => {
20
22
  if (!!error) {
21
23
  throws(() => formattedNotes(args), new Error(error), 'Got error');
22
24
  } else {
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const {forwardsAsRecords} = require('./../../harmony');
4
6
 
@@ -36,13 +38,13 @@ const tests = [
36
38
  ];
37
39
 
38
40
  tests.forEach(({args, description, error, expected}) => {
39
- return test(description, ({end, strictSame, throws}) => {
41
+ return test(description, (t, end) => {
40
42
  if (!!error) {
41
43
  throws(() => forwardsAsRecords(args), new Error(error), 'Got error');
42
44
  } else {
43
45
  const {records} = forwardsAsRecords(args);
44
46
 
45
- strictSame(records, expected.records, 'Forwards formatted as records');
47
+ deepEqual(records, expected.records, 'Forwards formatted as records');
46
48
  }
47
49
 
48
50
  return end();
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const test = require('node:test');
2
+ const {throws} = require('node:assert').strict;
2
3
 
3
4
  const {harmonize} = require('./../../harmony');
4
5
 
@@ -11,7 +12,7 @@ const tests = [
11
12
  ];
12
13
 
13
14
  tests.forEach(({args, description, error}) => {
14
- return test(description, ({end, throws}) => {
15
+ return test(description, (t, end) => {
15
16
  if (!!error) {
16
17
  throws(() => harmonize(args), new Error(error), 'Got error');
17
18
  } else {
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const {invoicesAsRecords} = require('./../../harmony');
4
6
 
@@ -61,13 +63,13 @@ const tests = [
61
63
  ];
62
64
 
63
65
  tests.forEach(({args, description, error, expected}) => {
64
- return test(description, ({end, strictSame, throws}) => {
66
+ return test(description, (t, end) => {
65
67
  if (!!error) {
66
68
  throws(() => invoicesAsRecords(args), new Error(error), 'Got error');
67
69
  } else {
68
70
  const {records} = invoicesAsRecords(args);
69
71
 
70
- strictSame(records, expected.records, 'Forwards formatted as records');
72
+ deepEqual(records, expected.records, 'Forwards formatted as records');
71
73
  }
72
74
 
73
75
  return end();
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
2
3
 
3
4
  const notesForChainTx = require('./../../harmony/notes_for_chain_transaction');
4
5
 
@@ -32,7 +33,7 @@ const tests = [
32
33
  ];
33
34
 
34
35
  tests.forEach(({args, description, expected}) => {
35
- return test(description, ({equal, end}) => {
36
+ return test(description, (t, end) => {
36
37
  const {notes} = notesForChainTx(args);
37
38
 
38
39
  equal(notes, expected.notes, 'Notes for chain transaction');
@@ -1,4 +1,5 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
2
3
 
3
4
  const {paymentsAsRecords} = require('./../../harmony');
4
5
 
@@ -148,10 +149,10 @@ const tests = [
148
149
  ];
149
150
 
150
151
  tests.forEach(({args, description, expected}) => {
151
- return test(description, ({end, equal, strictSame}) => {
152
+ return test(description, (t, end) => {
152
153
  const {records} = paymentsAsRecords(args);
153
154
 
154
- strictSame(records, expected.records, 'Forwards formatted as records');
155
+ deepEqual(records, expected.records, 'Forwards formatted as records');
155
156
 
156
157
  return end();
157
158
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const {recordsWithFiat} = require('./../../harmony');
4
6
 
@@ -96,17 +98,15 @@ const tests = [
96
98
  ];
97
99
 
98
100
  tests.forEach(({args, description, error, expected}) => {
99
- return test(description, ({end, strictSame, throws}) => {
101
+ return test(description, (t, end) => {
100
102
  if (!!error) {
101
103
  throws(() => recordsWithFiat(args), new Error(error), 'Got error');
104
+ } else {
105
+ const {records} = recordsWithFiat(args);
102
106
 
103
- return end();
107
+ deepEqual(records, expected.records, 'Fiat added to records');
104
108
  }
105
109
 
106
- const {records} = recordsWithFiat(args);
107
-
108
- strictSame(records, expected.records, 'Fiat added to records');
109
-
110
110
  return end();
111
111
  });
112
112
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const {rejects} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
5
  const {getAllInvoices} = require('./../../records');
4
6
 
@@ -89,15 +91,15 @@ const tests = [
89
91
  ];
90
92
 
91
93
  tests.forEach(({args, description, error, expected}) => {
92
- return test(description, async ({end, equal, rejects, strictSame}) => {
94
+ return test(description, async () => {
93
95
  if (!!error) {
94
96
  await rejects(getAllInvoices(args), error, 'Got expected error');
95
97
  } else {
96
98
  const {invoices} = await getAllInvoices(args);
97
99
 
98
- strictSame(invoices, expected.invoices, 'Got expected result');
100
+ deepEqual(invoices, expected.invoices, 'Got expected result');
99
101
  }
100
102
 
101
- return end();
103
+ return;
102
104
  });
103
105
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const {rejects} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
5
  const {getAllPayments} = require('./../../records');
4
6
 
@@ -260,15 +262,15 @@ const tests = [
260
262
  ];
261
263
 
262
264
  tests.forEach(({args, description, error, expected}) => {
263
- return test(description, async ({end, equal, rejects, strictSame}) => {
265
+ return test(description, async () => {
264
266
  if (!!error) {
265
267
  await rejects(getAllPayments(args), error, 'Got expected error');
266
268
  } else {
267
269
  const {payments} = await getAllPayments(args);
268
270
 
269
- strictSame(payments, expected.payments, 'Got expected result');
271
+ deepEqual(payments, expected.payments, 'Got expected result');
270
272
  }
271
273
 
272
- return end();
274
+ return;
273
275
  });
274
276
  });
@@ -1,4 +1,6 @@
1
- const {test} = require('@alexbosworth/tap');
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+ const {throws} = require('node:assert').strict;
2
4
 
3
5
  const {parseAmount} = require('./../../');
4
6
 
@@ -41,7 +43,7 @@ const tests = [
41
43
  ];
42
44
 
43
45
  tests.forEach(({args, description, error, expected}) => {
44
- return test(description, ({end, equal, throws}) => {
46
+ return test(description, (t, end) => {
45
47
  if (!!error) {
46
48
  throws(() => parseAmount(args), new Error(error), 'Got expected error');
47
49
  } else {