@tasenor/common-plugins 1.9.116 → 1.9.118

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 (43) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-ci.log +2 -2
  3. package/.turbo/turbo-lint.log +4 -0
  4. package/.turbo/turbo-nightly.log +3 -3
  5. package/data/src/Income Tree - Definitions.tsv +2 -0
  6. package/dist/AssetReport/backend/index.d.ts +15 -0
  7. package/dist/AssetReport/backend/index.js +145 -0
  8. package/dist/AssetReport/backend/index.js.map +1 -0
  9. package/dist/CoinbaseImport/backend/CoinbaseHandler.d.ts +2 -1
  10. package/dist/CoinbaseImport/backend/CoinbaseHandler.js +40 -3
  11. package/dist/CoinbaseImport/backend/CoinbaseHandler.js.map +1 -1
  12. package/dist/FinnishBalanceSheetReport/backend/index.d.ts +2 -2
  13. package/dist/FinnishBalanceSheetReport/backend/index.js +2 -2
  14. package/dist/FinnishBalanceSheetReport/backend/index.js.map +1 -1
  15. package/dist/FinnishBalanceSheetReportLite/backend/index.js +3 -3
  16. package/dist/FinnishBalanceSheetReportLite/backend/index.js.map +1 -1
  17. package/dist/FinnishIncomeStatementReport/backend/index.js +5 -5
  18. package/dist/FinnishIncomeStatementReport/backend/index.js.map +1 -1
  19. package/dist/FinnishIncomeStatementReportLite/backend/index.js +5 -5
  20. package/dist/FinnishIncomeStatementReportLite/backend/index.js.map +1 -1
  21. package/dist/IncomeAndExpenses/backend/index.js +4 -0
  22. package/dist/IncomeAndExpenses/backend/index.js.map +1 -1
  23. package/dist/JournalReport/backend/index.js +5 -5
  24. package/dist/JournalReport/backend/index.js.map +1 -1
  25. package/dist/LedgerReport/backend/index.js +10 -10
  26. package/dist/LedgerReport/backend/index.js.map +1 -1
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +1 -0
  29. package/dist/index.js.map +1 -1
  30. package/package.json +7 -7
  31. package/src/AssetReport/backend/index.ts +160 -0
  32. package/src/CoinbaseImport/backend/CoinbaseHandler.ts +43 -4
  33. package/src/CoinbaseImport/backend/rules.json +92 -14
  34. package/src/FinnishBalanceSheetReport/backend/index.ts +4 -4
  35. package/src/FinnishBalanceSheetReportLite/backend/index.ts +3 -3
  36. package/src/FinnishIncomeStatementReport/backend/index.ts +5 -5
  37. package/src/FinnishIncomeStatementReportLite/backend/index.ts +5 -5
  38. package/src/IncomeAndExpenses/backend/income.json +8 -0
  39. package/src/IncomeAndExpenses/backend/index.ts +4 -0
  40. package/src/JournalReport/backend/index.ts +5 -5
  41. package/src/LedgerReport/backend/index.ts +10 -10
  42. package/src/index.ts +1 -0
  43. package/.turbo/turbo-nightly3.log +0 -56
@@ -1,4 +1,4 @@
1
- import { AccountNumber, Language, PluginCode, ReportID, ReportOptions, Version } from '@tasenor/common'
1
+ import { AccountNumber, Language, PluginCode, ReportID, ReportLine, ReportOptions, Version } from '@tasenor/common'
2
2
  import { ReportPlugin } from '@tasenor/common-node'
3
3
  import dayjs from 'dayjs'
4
4
  import quarterOfYear from 'dayjs/plugin/quarterOfYear'
@@ -66,7 +66,7 @@ class FinnishBalanceSheetReport extends ReportPlugin {
66
66
  }
67
67
  }
68
68
 
69
- preProcess(id, entries, options, settings, columns) {
69
+ preProcess(id, entries, options, settings, columns): ReportLine[] {
70
70
  const columnNames = columns.map((col) => col.name)
71
71
 
72
72
  // Summarize all totals from the entries.
@@ -92,8 +92,8 @@ class FinnishBalanceSheetReport extends ReportPlugin {
92
92
  const liabilities = data.find(line => line.name === 'Vastattavaa yhteensä')
93
93
  const assets = data.find(line => line.name === 'Vastaavaa yhteensä')
94
94
  if (liabilities && assets) {
95
- Object.values(liabilities.amounts).forEach((value, idx) => {
96
- if (Object.values(assets.amounts)[idx] !== value) {
95
+ Object.values(liabilities.values).forEach((value, idx) => {
96
+ if (Object.values(assets.values)[idx] !== value) {
97
97
  assets.error = true
98
98
  liabilities.error = true
99
99
  }
@@ -67,7 +67,7 @@ class FinnishBalanceSheetReportLite extends ReportPlugin {
67
67
  async getColumns(id, entries, options) {
68
68
  const columns = options.periods.map((period) => {
69
69
  return {
70
- type: 'numeric',
70
+ type: 'currency',
71
71
  name: 'period' + period.id,
72
72
  title: this.columnTitle(id, period, options)
73
73
  }
@@ -106,8 +106,8 @@ class FinnishBalanceSheetReportLite extends ReportPlugin {
106
106
  const liabilities = data.find(line => line.name === 'Vastattavaa yhteensä')
107
107
  const assets = data.find(line => line.name === 'Vastaavaa yhteensä')
108
108
  if (liabilities && assets) {
109
- Object.values(liabilities.amounts).forEach((value, idx) => {
110
- if (Object.values(assets.amounts)[idx] !== value) {
109
+ Object.values(liabilities.values).forEach((value, idx) => {
110
+ if (Object.values(assets.values)[idx] !== value) {
111
111
  assets.error = true
112
112
  liabilities.error = true
113
113
  }
@@ -82,12 +82,12 @@ class FinnishIncomeStatementReport extends ReportPlugin {
82
82
  // Construct columns for each tag and extra column for non-tagged.
83
83
  if (options.byTags) {
84
84
  const columns = settings.tags.map((tag) => ({
85
- type: 'numeric',
85
+ type: 'currency',
86
86
  name: `tag-${tag.tag}`,
87
87
  title: tag.name
88
88
  }))
89
89
  columns.push({
90
- type: 'numeric',
90
+ type: 'currency',
91
91
  name: 'other',
92
92
  title: '{Other}'
93
93
  })
@@ -188,10 +188,10 @@ class FinnishIncomeStatementReport extends ReportPlugin {
188
188
  // Find empty columns.
189
189
  const found = new Set()
190
190
  for (const line of data) {
191
- if (!line.amounts) {
191
+ if (!line.values) {
192
192
  continue
193
193
  }
194
- for (const [k, v] of Object.entries(line.amounts)) {
194
+ for (const [k, v] of Object.entries(line.values)) {
195
195
  if (v !== null && !isNaN(v as number)) {
196
196
  found.add(k)
197
197
  }
@@ -200,7 +200,7 @@ class FinnishIncomeStatementReport extends ReportPlugin {
200
200
 
201
201
  // Remove empty columns.
202
202
  for (let i = 0; i < columns.length; i++) {
203
- if (columns[i].type === 'numeric' && !found.has(columns[i].name)) {
203
+ if ((columns[i].type === 'currency' || columns[i].type === 'numeric') && !found.has(columns[i].name)) {
204
204
  columns.splice(i, 1)
205
205
  i--
206
206
  }
@@ -80,12 +80,12 @@ class FinnishIncomeStatementReportLite extends ReportPlugin {
80
80
  // Construct columns for each tag and extra column for non-tagged.
81
81
  if (options.byTags) {
82
82
  const columns = settings.tags.map((tag) => ({
83
- type: 'numeric',
83
+ type: 'currency',
84
84
  name: `tag-${tag.tag}`,
85
85
  title: tag.name
86
86
  }))
87
87
  columns.push({
88
- type: 'numeric',
88
+ type: 'currency',
89
89
  name: 'other',
90
90
  title: '{Other}'
91
91
  })
@@ -186,10 +186,10 @@ class FinnishIncomeStatementReportLite extends ReportPlugin {
186
186
  // Find empty columns.
187
187
  const found = new Set()
188
188
  for (const line of data) {
189
- if (!line.amounts) {
189
+ if (!line.values) {
190
190
  continue
191
191
  }
192
- for (const [k, v] of Object.entries(line.amounts)) {
192
+ for (const [k, v] of Object.entries(line.values)) {
193
193
  if (v !== null && !isNaN(v as number)) {
194
194
  found.add(k)
195
195
  }
@@ -198,7 +198,7 @@ class FinnishIncomeStatementReportLite extends ReportPlugin {
198
198
 
199
199
  // Remove empty columns.
200
200
  for (let i = 0; i < columns.length; i++) {
201
- if (columns[i].type === 'numeric' && !found.has(columns[i].name)) {
201
+ if ((columns[i].type === 'numeric' || columns[i].type === 'currency') && !found.has(columns[i].name)) {
202
202
  columns.splice(i, 1)
203
203
  i--
204
204
  }
@@ -65,6 +65,12 @@
65
65
  "OTHER_OPERATING_INCOME",
66
66
  "MISC_INCOME"
67
67
  ],
68
+ "MISC_INCOME": [
69
+ "REWARDS"
70
+ ],
71
+ "REWARDS": [
72
+ "LEARNING_REWARDS"
73
+ ],
68
74
  "SPECIAL_INCOME_CASES": [
69
75
  "NEEDS_MANUAL_INSPECTION_IN",
70
76
  "ERROR_INCOME"
@@ -110,6 +116,8 @@
110
116
  "OTHER_INCOME": "INCOME",
111
117
  "OTHER_OPERATING_INCOME": "OTHER_INCOME",
112
118
  "MISC_INCOME": "OTHER_INCOME",
119
+ "REWARDS": "MISC_INCOME",
120
+ "LEARNING_REWARDS": "REWARDS",
113
121
  "SPECIAL_INCOME_CASES": "INCOME",
114
122
  "NEEDS_MANUAL_INSPECTION_IN": "SPECIAL_INCOME_CASES",
115
123
  "ERROR_INCOME": "SPECIAL_INCOME_CASES",
@@ -145,6 +145,7 @@ class IncomeAndExpenses extends DataPlugin {
145
145
  'income-INCOME_CORRECTION_WITHHOLDING_TAX': 'Corrections in Withholding Tax',
146
146
  'income-INTEREST': 'Interest Income',
147
147
  'income-INVEST': 'Capital Investments',
148
+ 'income-LEARNING_REWARDS': 'Learning rewards',
148
149
  'income-LISTED_CASH_DIVIDEND': 'Cash Dividends from Listed Companies',
149
150
  'income-LISTED_DIVIDEND': 'Dividends from Listed Companies',
150
151
  'income-LISTED_STOCK_DIVIDEND': 'Stock Dividends from Listed Companies',
@@ -158,6 +159,7 @@ class IncomeAndExpenses extends DataPlugin {
158
159
  'income-OTHER_OPERATING_INCOME': 'Other operating income',
159
160
  'income-P2P_INTEREST': 'Interest Income from P2P Loaning',
160
161
  'income-PAID_SHARES': 'Payment Received from Company Shares',
162
+ 'income-REWARDS': 'Rewards',
161
163
  'income-SALES': 'Sales',
162
164
  'income-SHAREHOLDER_BORROWING': 'Loan from a Shareholder',
163
165
  'income-SHARE_ISSUED': 'Issue New Shares',
@@ -310,6 +312,7 @@ class IncomeAndExpenses extends DataPlugin {
310
312
  'income-INCOME_CORRECTION_WITHHOLDING_TAX': 'Korjaukset ennakonpidätyksiin',
311
313
  'income-INTEREST': 'Korkotulot',
312
314
  'income-INVEST': 'Pääomasijoitukset',
315
+ 'income-LEARNING_REWARDS': 'Opintopalkkiot',
313
316
  'income-LISTED_CASH_DIVIDEND': 'Käteisosingot listatuista yhtiöistä',
314
317
  'income-LISTED_DIVIDEND': 'Osingot listatuista yhtiöistä',
315
318
  'income-LISTED_STOCK_DIVIDEND': 'Osakeosingot listatuista yhtiöistä',
@@ -323,6 +326,7 @@ class IncomeAndExpenses extends DataPlugin {
323
326
  'income-OTHER_OPERATING_INCOME': 'Muut liiketoiminnan tuotot',
324
327
  'income-P2P_INTEREST': 'Korkotulot P2P lainaamisesta',
325
328
  'income-PAID_SHARES': 'Osakeannista saadut maksut',
329
+ 'income-REWARDS': 'Palkkiot',
326
330
  'income-SALES': 'Myynti',
327
331
  'income-SHAREHOLDER_BORROWING': 'Osakaslainan nosto',
328
332
  'income-SHARE_ISSUED': 'Uusien osakkeiden liikkeellelasku',
@@ -56,11 +56,11 @@ class JournalReport extends ReportPlugin {
56
56
  name: 'title',
57
57
  title: '{column-date-and-accounts}'
58
58
  }, {
59
- type: 'numeric',
59
+ type: 'currency',
60
60
  name: 'debit',
61
61
  title: '{column-debit}'
62
62
  }, {
63
- type: 'numeric',
63
+ type: 'currency',
64
64
  name: 'credit',
65
65
  title: '{column-credit}'
66
66
  }]
@@ -81,7 +81,7 @@ class JournalReport extends ReportPlugin {
81
81
  number: entry.number,
82
82
  description: entry.description,
83
83
  date: entry.date,
84
- amounts: {
84
+ values: {
85
85
  debit: entry.amount >= 0 ? entry.amount : null,
86
86
  credit: entry.amount < 0 ? -entry.amount : null
87
87
  }
@@ -138,13 +138,13 @@ class JournalReport extends ReportPlugin {
138
138
  data.push({
139
139
  tab: 0,
140
140
  name: `${line.number} ${line.name}: ${line.description}`,
141
- amounts: line.amounts
141
+ values: line.values
142
142
  })
143
143
  } else {
144
144
  data.push({
145
145
  tab: 2,
146
146
  name: `${line.number} ${line.name}`,
147
- amounts: line.amounts
147
+ values: line.values
148
148
  })
149
149
  }
150
150
  })
@@ -56,15 +56,15 @@ class LedgerReport extends ReportPlugin {
56
56
  name: 'name',
57
57
  title: '{column-name-or-date}'
58
58
  }, {
59
- type: 'numeric',
59
+ type: 'currency',
60
60
  name: 'debit',
61
61
  title: '{column-debit}'
62
62
  }, {
63
- type: 'numeric',
63
+ type: 'currency',
64
64
  name: 'credit',
65
65
  title: '{column-credit}'
66
66
  }, {
67
- type: 'numeric',
67
+ type: 'currency',
68
68
  name: 'balance',
69
69
  title: '{column-balance}'
70
70
  }]
@@ -87,7 +87,7 @@ class LedgerReport extends ReportPlugin {
87
87
  documentId: entry.documentId,
88
88
  description: entry.description,
89
89
  date: entry.date,
90
- amounts: {
90
+ values: {
91
91
  debit: entry.amount >= 0 ? entry.amount : null,
92
92
  credit: entry.amount < 0 ? -entry.amount : null,
93
93
  balance: null
@@ -110,16 +110,16 @@ class LedgerReport extends ReportPlugin {
110
110
  })
111
111
  let total = 0
112
112
  lines.forEach((line) => {
113
- total += line.amounts.debit
114
- total -= line.amounts.credit
115
- line.amounts.balance = total
113
+ total += line.values.debit
114
+ total -= line.values.credit
115
+ line.values.balance = total
116
116
  if (options.compact) {
117
117
  data.push({
118
118
  tab: 0,
119
119
  needLocalization: true,
120
120
  id: `#${line.documentId}`,
121
121
  name: `{${this.time2str(line.date)}} ${line.description.replace(/^(\[.+?\])+\s*/g, '')}`,
122
- amounts: line.amounts
122
+ values: line.values
123
123
  })
124
124
  } else {
125
125
  data.push({
@@ -137,7 +137,7 @@ class LedgerReport extends ReportPlugin {
137
137
  data.push({
138
138
  tab: 0,
139
139
  name: '',
140
- amounts: line.amounts
140
+ values: line.values
141
141
  })
142
142
  }
143
143
  })
@@ -146,7 +146,7 @@ class LedgerReport extends ReportPlugin {
146
146
  name: '',
147
147
  bold: true,
148
148
  bigger: true,
149
- amounts: {
149
+ values: {
150
150
  debit: '',
151
151
  credit: '',
152
152
  balance: total
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { default as AssetReportBackend } from './AssetReport/backend'
1
2
  export { default as CoinAPIBackend } from './CoinAPI/backend'
2
3
  export { default as CoinbaseImportBackend } from './CoinbaseImport/backend'
3
4
  export { CoinbaseHandler } from './CoinbaseImport/backend/CoinbaseHandler'
@@ -1,56 +0,0 @@
1
-
2
- > @tasenor/common-plugins@1.9.113 nightly3 /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins
3
- > pnpm run data
4
-
5
-
6
- > @tasenor/common-plugins@1.9.113 data /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins
7
- > data/bin/build_all
8
-
9
-
10
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/FinnishBalanceSheetReportLite.mjs
11
-
12
- 2023-11-02T02:16:00.414Z Saved text data to src/FinnishBalanceSheetReportLite/backend/balance-sheet-lite-fi.tsv
13
- 2023-11-02T02:16:00.417Z Saved text data to src/FinnishBalanceSheetReportLite/backend/balance-sheet-lite-en.tsv
14
-
15
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/FinnishBalanceSheetReport.mjs
16
-
17
- 2023-11-02T02:16:02.840Z Saved text data to src/FinnishBalanceSheetReport/backend/balance-sheet-fi.tsv
18
- 2023-11-02T02:16:02.842Z Saved text data to src/FinnishBalanceSheetReport/backend/balance-sheet-detailed-fi.tsv
19
-
20
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/FinnishIncomeStatementReportLite.mjs
21
-
22
- 2023-11-02T02:16:05.274Z Saved text data to src/FinnishIncomeStatementReportLite/backend/income-statement-lite-fi.tsv
23
- 2023-11-02T02:16:05.276Z Saved text data to src/FinnishIncomeStatementReportLite/backend/income-statement-lite-en.tsv
24
-
25
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/FinnishIncomeStatementReport.mjs
26
-
27
- 2023-11-02T02:16:07.668Z Saved text data to src/FinnishIncomeStatementReport/backend/income-statement-fi.tsv
28
- 2023-11-02T02:16:07.670Z Saved text data to src/FinnishIncomeStatementReport/backend/income-statement-detailed-fi.tsv
29
-
30
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/FinnishLimitedCompanyComplete.mjs
31
-
32
- 2023-11-02T02:16:10.049Z Saved data to src/FinnishLimitedCompanyComplete/backend/fi-EUR.tsv
33
-
34
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/FinnishLimitedCompanyLite.mjs
35
-
36
- 2023-11-02T02:16:12.479Z Saved data to src/FinnishLimitedCompanyLite/backend/fi-EUR.tsv
37
- 2023-11-02T02:16:12.482Z Saved data to src/FinnishLimitedCompanyLite/backend/en-EUR.tsv
38
-
39
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/IncomeAndExpenses.mjs
40
-
41
- 2023-11-02T02:16:14.903Z Saved JSON data to src/IncomeAndExpenses/backend/income.json
42
- 2023-11-02T02:16:14.906Z Saved JSON data to src/IncomeAndExpenses/backend/expense.json
43
- 2023-11-02T02:16:14.907Z Saved JSON data to src/IncomeAndExpenses/backend/assetCodes.json
44
- 2023-11-02T02:16:14.907Z Saved JSON data to src/IncomeAndExpenses/backend/taxTypes.json
45
- 2023-11-02T02:16:14.908Z Refreshed translation data in src/IncomeAndExpenses/backend/index.ts
46
- 2023-11-02T02:16:14.908Z Saved data to ../tasenor-common/src/types/income.ts
47
- 2023-11-02T02:16:14.909Z Saved data to ../tasenor-common/src/types/expense.ts
48
- 2023-11-02T02:16:14.909Z Saved data to ../tasenor-common/src/types/assetCodes.ts
49
-
50
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/PluginIndex.mjs
51
-
52
- 2023-11-02T02:16:15.640Z Saved plugin index to /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/src/index.ts
53
-
54
- Running /home/wigy/project/tasenor-qa/tasenor-bookkeeper/packages/tasenor-common-plugins/data/VATFinland.mjs
55
-
56
- 2023-11-02T02:16:18.033Z Saved JSON data to src/VATFinland/backend/vat.json