@tasenor/common-plugins 1.9.16

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 (114) hide show
  1. package/.eslintrc.js +4 -0
  2. package/.turbo/turbo-fix.log +4 -0
  3. package/.turbo/turbo-lint.log +4 -0
  4. package/.turbo/turbo-version.log +5 -0
  5. package/LICENSE +21 -0
  6. package/README.md +15 -0
  7. package/data/FinnishBalanceSheetReport.mjs +9 -0
  8. package/data/FinnishBalanceSheetReportInvestment.mjs +11 -0
  9. package/data/FinnishBalanceSheetReportLite.mjs +9 -0
  10. package/data/FinnishIncomeStatementReport.mjs +9 -0
  11. package/data/FinnishIncomeStatementReportInvestment.mjs +11 -0
  12. package/data/FinnishIncomeStatementReportLite.mjs +9 -0
  13. package/data/FinnishInvestmentCompany.mjs +5 -0
  14. package/data/FinnishLimitedCompanyComplete.mjs +5 -0
  15. package/data/FinnishLimitedCompanyLite.mjs +9 -0
  16. package/data/IncomeAndExpenses.mjs +64 -0
  17. package/data/README.md +8 -0
  18. package/data/VATFinland.mjs +22 -0
  19. package/data/bin/build_all +11 -0
  20. package/data/lib/utils.mjs +314 -0
  21. package/data/src/Assets Tree - Definitions.tsv +101 -0
  22. package/data/src/Expense Tree - Definitions.tsv +99 -0
  23. package/data/src/Finland VAT - Definitions.tsv +22 -0
  24. package/data/src/FinnishBalanceSheetReport - balance-sheet-detailed-fi.tsv +215 -0
  25. package/data/src/FinnishBalanceSheetReport - balance-sheet-fi.tsv +93 -0
  26. package/data/src/FinnishBalanceSheetReportInvestment - balance-sheet-detailed-fi.tsv +100 -0
  27. package/data/src/FinnishBalanceSheetReportInvestment - balance-sheet-fi.tsv +52 -0
  28. package/data/src/FinnishBalanceSheetReportLite - balance-sheet-en.tsv +21 -0
  29. package/data/src/FinnishBalanceSheetReportLite - balance-sheet-fi.tsv +21 -0
  30. package/data/src/FinnishBalanceSheetReportLite - balance-sheet-lite-en.tsv +21 -0
  31. package/data/src/FinnishBalanceSheetReportLite - balance-sheet-lite-fi.tsv +21 -0
  32. package/data/src/FinnishIncomeStatementReport - income-statement-detailed-fi.tsv +118 -0
  33. package/data/src/FinnishIncomeStatementReport - income-statement-fi.tsv +45 -0
  34. package/data/src/FinnishIncomeStatementReportInvestment - income-statement-detailed-fi.tsv +96 -0
  35. package/data/src/FinnishIncomeStatementReportInvestment - income-statement-fi.tsv +39 -0
  36. package/data/src/FinnishIncomeStatementReportLite - income-statement-lite-en.tsv +23 -0
  37. package/data/src/FinnishIncomeStatementReportLite - income-statement-lite-fi.tsv +23 -0
  38. package/data/src/FinnishInvestmentCompany - fi-EUR.tsv +722 -0
  39. package/data/src/FinnishLimitedCompanyComplete - fi-EUR.tsv +1086 -0
  40. package/data/src/FinnishLimitedCompanyLite - en-EUR.tsv +97 -0
  41. package/data/src/FinnishLimitedCompanyLite - fi-EUR.tsv +99 -0
  42. package/data/src/Income Tree - Definitions.tsv +60 -0
  43. package/data/src/Tax Types - Definitions.tsv +11 -0
  44. package/package.json +51 -0
  45. package/src/CoinAPI/backend/index.ts +102 -0
  46. package/src/CoinbaseImport/backend/CoinbaseHandler.ts +35 -0
  47. package/src/CoinbaseImport/backend/index.ts +24 -0
  48. package/src/CoinbaseImport/backend/rules.json +64 -0
  49. package/src/DocumentCleaner/ui/index.tsx +165 -0
  50. package/src/Euro/ui/index.tsx +27 -0
  51. package/src/Finnish/ui/finnish.json +341 -0
  52. package/src/Finnish/ui/index.tsx +54 -0
  53. package/src/FinnishBalanceSheetReport/backend/balance-sheet-detailed-fi.tsv +215 -0
  54. package/src/FinnishBalanceSheetReport/backend/balance-sheet-fi.tsv +93 -0
  55. package/src/FinnishBalanceSheetReport/backend/index.ts +107 -0
  56. package/src/FinnishBalanceSheetReportInvestment/backend/balance-sheet-investment-detailed-fi.tsv +100 -0
  57. package/src/FinnishBalanceSheetReportInvestment/backend/balance-sheet-investment-fi.tsv +52 -0
  58. package/src/FinnishBalanceSheetReportInvestment/backend/index.ts +107 -0
  59. package/src/FinnishBalanceSheetReportLite/backend/balance-sheet-lite-en.tsv +21 -0
  60. package/src/FinnishBalanceSheetReportLite/backend/balance-sheet-lite-fi.tsv +21 -0
  61. package/src/FinnishBalanceSheetReportLite/backend/index.ts +121 -0
  62. package/src/FinnishIncomeStatementReport/backend/income-statement-detailed-fi.tsv +118 -0
  63. package/src/FinnishIncomeStatementReport/backend/income-statement-fi.tsv +45 -0
  64. package/src/FinnishIncomeStatementReport/backend/index.ts +212 -0
  65. package/src/FinnishIncomeStatementReportInvestment/backend/income-statement-detailed-fi.tsv +118 -0
  66. package/src/FinnishIncomeStatementReportInvestment/backend/income-statement-fi.tsv +45 -0
  67. package/src/FinnishIncomeStatementReportInvestment/backend/income-statement-investment-detailed-fi.tsv +96 -0
  68. package/src/FinnishIncomeStatementReportInvestment/backend/income-statement-investment-fi.tsv +39 -0
  69. package/src/FinnishIncomeStatementReportInvestment/backend/index.ts +212 -0
  70. package/src/FinnishIncomeStatementReportLite/backend/income-statement-lite-en.tsv +23 -0
  71. package/src/FinnishIncomeStatementReportLite/backend/income-statement-lite-fi.tsv +23 -0
  72. package/src/FinnishIncomeStatementReportLite/backend/index.ts +210 -0
  73. package/src/FinnishInvestmentCompany/backend/fi-EUR.tsv +722 -0
  74. package/src/FinnishInvestmentCompany/backend/index.ts +46 -0
  75. package/src/FinnishInvestmentCompany/ui/index.tsx +26 -0
  76. package/src/FinnishLimitedCompanyComplete/backend/fi-EUR.tsv +1086 -0
  77. package/src/FinnishLimitedCompanyComplete/backend/index.ts +46 -0
  78. package/src/FinnishLimitedCompanyComplete/ui/index.tsx +26 -0
  79. package/src/FinnishLimitedCompanyLite/backend/en-EUR.tsv +97 -0
  80. package/src/FinnishLimitedCompanyLite/backend/fi-EUR.tsv +99 -0
  81. package/src/FinnishLimitedCompanyLite/backend/index.ts +53 -0
  82. package/src/FinnishLimitedCompanyLite/ui/index.tsx +28 -0
  83. package/src/GitBackup/backend/index.ts +109 -0
  84. package/src/GitBackup/ui/index.tsx +127 -0
  85. package/src/IncomeAndExpenses/backend/assetCodes.json +126 -0
  86. package/src/IncomeAndExpenses/backend/expense.json +190 -0
  87. package/src/IncomeAndExpenses/backend/income.json +120 -0
  88. package/src/IncomeAndExpenses/backend/index.ts +354 -0
  89. package/src/IncomeAndExpenses/backend/taxTypes.json +12 -0
  90. package/src/JournalReport/backend/index.ts +157 -0
  91. package/src/KrakenImport/backend/KrakenHandler.ts +88 -0
  92. package/src/KrakenImport/backend/index.ts +24 -0
  93. package/src/KrakenImport/backend/rules.json +52 -0
  94. package/src/LedgerReport/backend/index.ts +161 -0
  95. package/src/LynxImport/backend/LynxHandler.ts +389 -0
  96. package/src/LynxImport/backend/index.ts +24 -0
  97. package/src/LynxImport/backend/rules.json +412 -0
  98. package/src/NordeaImport/backend/NordeaHandler.ts +44 -0
  99. package/src/NordeaImport/backend/index.ts +24 -0
  100. package/src/NordeaImport/backend/rules.json +4 -0
  101. package/src/NordnetImport/backend/NordnetHandler.ts +78 -0
  102. package/src/NordnetImport/backend/index.ts +24 -0
  103. package/src/NordnetImport/backend/rules.json +271 -0
  104. package/src/Rand/ui/index.tsx +27 -0
  105. package/src/RapidAPI/backend/index.ts +133 -0
  106. package/src/TITOImport/backend/TITOHandler.ts +268 -0
  107. package/src/TITOImport/backend/index.ts +24 -0
  108. package/src/TITOImport/backend/rules.json +4 -0
  109. package/src/TagEditor/ui/index.tsx +510 -0
  110. package/src/USDollar/ui/index.tsx +27 -0
  111. package/src/VAT/ui/index.tsx +572 -0
  112. package/src/VATFinland/backend/index.ts +22 -0
  113. package/src/VATFinland/backend/vat.json +23 -0
  114. package/tsconfig.json +13 -0
@@ -0,0 +1,97 @@
1
+ # number / title text type code data
2
+ ASSETS
3
+ __Current Assets
4
+ ___Short-term Receivables
5
+ _____Trade Receivables
6
+ 1701 Trade Receivables 1 ASSET
7
+ _____Other Current Assets
8
+ 1761 Tax Receivables ASSET
9
+ 1763 VAT Receivables ASSET
10
+ _____Accrued Income
11
+ 1849 Other Accrued Income ASSET
12
+ ___Cash & Bank Balance
13
+ ____Cash
14
+ 1900 Cash Asset ASSET
15
+ ____Bank Balances
16
+ 1910 Bank Account 1 ASSET
17
+ 1920 Bank Account 2 ASSET
18
+ CAPITAL, RESERVES & LIABILITIES
19
+ __Equity
20
+ ___Share Capital
21
+ 2001 Share Capital EQUITY
22
+ ___Retained Earning/Loss
23
+ 2251 Retained Earning/Loss PROFIT_PREV
24
+ __Creditors
25
+ ___Long-term Debt
26
+ ____Loans
27
+ 2621 Long-term Loan 1 LIABILITY
28
+ ___Short-term Debt
29
+ ____Loans (credit institutions)
30
+ 2825 Short-term Loan 1 LIABILITY
31
+ ____Unearned Income
32
+ 2861 Unearned Income LIABILITY
33
+ ____Account Payables
34
+ 2871 Account Payables 1 LIABILITY
35
+ ____Other Debts
36
+ 2921 Withholding Tax Liability LIABILITY
37
+ 2931 TyEL Contribution (employment pension insurance) LIABILITY
38
+ 2939 VAT Liability LIABILITY
39
+ 29391 VAT on Sales LIABILITY
40
+ 29392 VAT on Purchases LIABILITY
41
+ 29393 VAT payable on EU purchases LIABILITY
42
+ 29394 VAT deductible from EU purchases LIABILITY
43
+ 29395 VAT payable on Construction Services LIABILITY
44
+ 29396 VAT deductible from Construction Services LIABILITY
45
+ ____Accrued Expenses
46
+ 2979 Other Accrued Expenses LIABILITY
47
+ INCOME STATEMENT
48
+ _Revenue from Sales
49
+ __General Sales Account
50
+ 3000 Sales REVENUE ____FINLAND_SALES
51
+ _Other Operating Income
52
+ 3800 Grants Received REVENUE
53
+ 3990 Other Operating Income REVENUE __OTHER_OPERATING_INCOME
54
+ _Materials & Services
55
+ __Materials, supplies & goods
56
+ ___Purchases
57
+ ____Purchases of goods & services
58
+ 4000 Purchases EXPENSE 24
59
+ 4080 Purchases, buyer taxpayer EXPENSE 24
60
+ ____Import of Goods
61
+ 4110 Intercompany Acquisitions EXPENSE 24
62
+ 4140 Duties, Taxes & Custom Clearance Charges EXPENSE
63
+ ___Increase/Decrease in Stocks
64
+ 4400 Changes in stock of materials & supplies EXPENSE
65
+ __External Services
66
+ 4450 Subcontracting 1 EXPENSE 24
67
+ 4470 Purchase of Construction services (reversible tax liability) EXPENSE 24
68
+ 4475 Purchase of Services (EU-countries) EXPENSE 24
69
+ _Staffing Costs
70
+ __Wages & Salaries
71
+ ___Employees' Salaries & Wages
72
+ ____ [Normal] Wages & Salaries
73
+ 5000 Employees' Salaries EXPENSE
74
+ ____Remuneration/Commission
75
+ 5200 remuneration/commission EXPENSE
76
+ __Social Security Contributions
77
+ ___Pension Expenses
78
+ ____Pension Contributions
79
+ 6100 YEL (Pension Payment for the Self-Employed) EXPENSE
80
+ 6130 TyEL (Employees' Pension Contributions) EXPENSE
81
+ ____Accruals during the financial year
82
+ 6290 Accruals during the financial year EXPENSE
83
+ ___Other Social Security Expenses
84
+ ____Social Security Contributions
85
+ 6300 Social Security Contributions EXPENSE
86
+ ____Compulsory Insurance Premiums
87
+ 6400 Accident Insurance Contributions EXPENSE
88
+ 6410 Unemployment Insurance Contributions EXPENSE
89
+ _Other Operating Expenses
90
+ __Voluntary Social Security Contributions
91
+ 7170 Other Social Security Expenses EXPENSE 24
92
+ __Administrative Services
93
+ 8440 Government Fees EXPENSE 24
94
+ _Income Tax
95
+ __For the financial year & earlier
96
+ 9900 Anticipatory Tax EXPENSE
97
+ 9950 Tax Refund / Residual Tax EXPENSE
@@ -0,0 +1,99 @@
1
+ # number / title text type code data
2
+ Vastaavaa
3
+ __Vaihtuvat vastaavat
4
+ ___Lyhytaikaiset saamiset
5
+ _____Myyntisaamiset
6
+ 1701 Myyntisaamiset 1 ASSET
7
+ _____Muut saamiset
8
+ 1761 Verosaamiset ASSET
9
+ 1763 Arvonlisäverosaamiset ASSET
10
+ _____Siirtosaamiset
11
+ 1849 Muut siirtosaamiset ASSET
12
+ ___Rahat ja pankkisaamiset
13
+ ____Rahat
14
+ 1900 Käteisvarat ASSET
15
+ ____Pankkisaamiset
16
+ 1910 Pankkitili 1 ASSET
17
+ 1920 Pankkitili 2 ASSET
18
+ Vastattavaa
19
+ __Oma pääoma
20
+ ___Osakepääoma
21
+ 2001 Osakepääoma EQUITY
22
+ ___Edellisten tilikausien voitto (tappio)
23
+ 2251 Edellisten tilikausien voitto/tappio PROFIT_PREV
24
+ __Vieras pääoma
25
+ ___Pitkäaikainen vieras pääoma
26
+ ____Lainat rahoituslaitoksilta
27
+ 2621 Pitkäaikainen rahoituslaitoslaina 1 LIABILITY
28
+ ___Lyhytaikainen vieras pääoma
29
+ ____Lainat rahoituslaitoksilta
30
+ 2825 Lyhytaikainen rahoituslaitoslaina 1 LIABILITY
31
+ ____Saadut ennakot
32
+ 2861 Saadut ennakot LIABILITY
33
+ ____Ostovelat
34
+ 2871 Ostovelat 1 LIABILITY
35
+ ____Muut velat
36
+ 2921 Ennakonpidätysvelka LIABILITY
37
+ 2931 TyEL-velka LIABILITY
38
+ 2939 Arvonlisäverovelka LIABILITY
39
+ 29391 Alv myynnistä LIABILITY
40
+ 29392 Alv ostoista LIABILITY
41
+ 29393 Alv suoritettava EU-ostoista LIABILITY
42
+ 29394 Alv vähennettävä EU-ostoista LIABILITY
43
+ 29395 Alv suoritettava rak.palveluista LIABILITY
44
+ 29396 Alv vähennettävä rak.palveluista LIABILITY
45
+ ____Siirtovelat
46
+ 2979 Muut siirtovelat LIABILITY
47
+ Tuloslaskelma
48
+ _Myyntituotot
49
+ __Yleiset myyntitilit
50
+ 3000 Myynti REVENUE ____FINLAND_SALES
51
+ _Liiketoiminnan muut tuotot
52
+ 3800 Saadut avustukset REVENUE
53
+ 3990 Muut liiketoiminnan tuotot REVENUE __OTHER_OPERATING_INCOME
54
+ _Materiaalit ja palvelut
55
+ __Aineet, tarvikkeet ja tavarat
56
+ ___Ostot tilikauden aikana
57
+ ____Aine-, tarvike- ja tavaraostot
58
+ 4000 Ostot EXPENSE 24
59
+ 4080 Ostot, ostaja verovelvollinen EXPENSE 24
60
+ ____Tavaratuonti
61
+ 4110 Yhteisöhankinnat EXPENSE 24
62
+ 4140 Tullit, verot ja muut maksut tullattaessa EXPENSE
63
+ ___Varastojen lisäys tai vähennys
64
+ 4400 Aine- ja tarvikevaraston muutos EXPENSE
65
+ __Ulkopuoliset palvelut
66
+ 4450 Alihankinta 1 EXPENSE 24
67
+ 4470 Rakentamispalveluiden osto (käänn. verovelv.) EXPENSE 24
68
+ 4475 Palveluiden osto EU-maista EXPENSE 24
69
+ _Henkilöstökulut
70
+ __Palkat ja palkkiot
71
+ ___Työntekijöiden palkat ja palkkiot
72
+ ____Työssäoloajan normaalipalkat
73
+ 5000 Työntekijäpalkat EXPENSE
74
+ ____Palkkiot
75
+ 5200 Palkkiot EXPENSE
76
+ __Henkilösivukulut
77
+ ___Eläkekulut
78
+ ____Eläkevakuutusmaksut
79
+ 6100 YEL-maksut EXPENSE
80
+ 6130 TyEL-maksut EXPENSE
81
+ ____Tilikauden aikainen jaksotus
82
+ 6290 Tilikauden aikainen jaksotus EXPENSE
83
+ ___Muut henkilösivukulut
84
+ ____Sosiaaliturvamaksut
85
+ 6300 Sosiaaliturvamaksut EXPENSE
86
+ ____Pakolliset vakuutusmaksut
87
+ 6400 Tapaturmavakuutusmaksut EXPENSE
88
+ 6410 Työttömyysvakuutusmaksut EXPENSE
89
+ _Liiketoiminnan muut kulut
90
+ __Vapaaehtoiset henkilösivukulut
91
+ 7170 Muut henkilösivukulut EXPENSE 24
92
+ __Hallintopalvelut
93
+ 8440 Viranomaismaksut EXPENSE 24
94
+ _Tuloverot
95
+ __Tilikauden ja aikaisempien tilikausien verot
96
+ 9900 Ennakkoverot EXPENSE
97
+ 9950 Veronpalautukset / jäännösverot EXPENSE
98
+ _Erikoistilit
99
+ 9999 Selvittelyä vaativat tapahtumat EXPENSE SUSPENSE_ACCOUNT
@@ -0,0 +1,60 @@
1
+ # id en fi
2
+ INCOME Income Tulot
3
+ _INVEST Capital Investments Pääomasijoitukset
4
+ __NREQ Non-Restricted Equity Capital SVOP sijoitus
5
+ __SHARE_ISSUED Issue New Shares Uusien osakkeiden liikkeellelasku
6
+
7
+ _CAPITAL_INCOME Capital Income Pääomatulot
8
+ __DIVIDEND Dividends Osingot
9
+ ___LISTED_DIVIDEND Dividends from Listed Companies Osingot listatuista yhtiöistä
10
+ ____LISTED_CASH_DIVIDEND Cash Dividends from Listed Companies Käteisosingot listatuista yhtiöistä
11
+ ____LISTED_STOCK_DIVIDEND Stock Dividends from Listed Companies Osakeosingot listatuista yhtiöistä
12
+ ___NON_LISTED_DIVIDEND Dividends from Non-Listed Companies Osingot listaamattomista yhtiöistä
13
+
14
+ __INTEREST Interest Income Korkotulot
15
+ ___P2P_INTEREST Interest Income from P2P Loaning Korkotulot P2P lainaamisesta
16
+
17
+ _CAPITAL_RELATED_TRANSFERS_IN Capital Related Transfers Pääomaliikkeisiin liittyvät tilisiirrot
18
+ __SHAREHOLDER_BORROWING Loan from a Shareholder Osakaslainan nosto
19
+ __FX_IN Foreign Exchange Valuutanvaihto
20
+ __PAID_SHARES Payment Received from Company Shares Osakeannista saadut maksut
21
+ ___TAX_RELATED_TRANSFERS_IN Tax Related Transfers Veroihin liittyvät tilisiirrot
22
+ ____VAT_REFUND VAT Refund ALV alarajahuojennus
23
+ ____CORPORATE_TAX_REFUND Corporate Tax Refund Yhteisöveron palautus
24
+ ____VAT_DELAYED_REFUND VAT Refund (from previous period) ALV alarajahuojennus (siirretty)
25
+
26
+
27
+
28
+
29
+ __CAPITAL_GAIN Capital Gains Myyntivoitot
30
+ ___TRADE_PROFIT Trade Profits Myyntivoitot vaihto-omaisuuden kaupankäynnistä
31
+ ___TRADE_PROFIT_CRYPTO Trade Profits from Cryptocurrencies Myyntivoitot kryptovaluutoista
32
+ ___TRADE_PROFIT_CURRENCY Trade Profits from Currencies Myyntivoitot valuutoista
33
+ ___TRADE_PROFIT_STOCK Trade Profits from Stocks Myyntivoitot osakkeista
34
+ ___TRADE_PROFIT_SHORT Trade Profits from Short Contracts Myyntivoitot lyhyeksimyynnistä
35
+
36
+ _SALES Sales Myynti
37
+ __EU_SALES Sales to EU Area Myynti euroopan yhteisön alueelle
38
+ ___EURO_AREA_SALES Sales to Euro Area Myynti euroalueelle
39
+ ____FINLAND_SALES Sales to Finland Myynti Suomeen
40
+ ___NON_EURO_AREA_SALES Sales to Non-Euro EU Area Myynti euroopan yhteisön euroalueen ulkopuolelle
41
+ __NON_EU_SALES Sales to Outside EU Area Myynti euroopan yhteisön ulkopuolelle
42
+
43
+
44
+
45
+
46
+ _OTHER_INCOME Other Income Muut tulot
47
+ __OTHER_OPERATING_INCOME Other operating income Muut liiketoiminnan tuotot
48
+
49
+ __MISC_INCOME Miscellaneous Income Satunnaiset tulot
50
+
51
+
52
+ _SPECIAL_INCOME_CASES Cases That Need Special Handling Erityiskäsittelyä vaativat tapaukset
53
+ __NEEDS_MANUAL_INSPECTION_IN Needs Manual Inspection Tutkittava tarkemmin käsin
54
+ __ERROR_INCOME Error in Income Virheellinen tulo
55
+
56
+
57
+
58
+ _INCOME_CORRECTIONS Corrections in income Korjaukset tulotietoihin
59
+ __INCOME_CORRECTION_WITHHOLDING_TAX Corrections in Withholding Tax Korjaukset ennakonpidätyksiin
60
+ __INCOME_CORRECTION_DEPOSIT Corrections in Deposit Korjaukset talletuksiin
@@ -0,0 +1,11 @@
1
+ # id en fi
2
+ VAT_FROM_SALES VAT from Sales ALV myynnistä
3
+ VAT_FROM_PURCHASES VAT from Purchases ALV ostoista
4
+ VAT_PAYABLE VAT Payable ALV velat
5
+ VAT_RECEIVABLE VAT Receivable ALV saatavat
6
+ VAT_DELAYED_PAYABLE Delayed VAT Payable ALV siirtosaatavat
7
+ VAT_DELAYED_RECEIVABLE Delayed VAT Receivable ALV siirtovelat
8
+ CORPORATE_TAX Corporate Tax Yhteisövero
9
+ TAX_AT_SOURCE Tax at Source Lähdevero
10
+ WITHHOLDING_TAX Withholding Tax Ennakonpidätys
11
+ PENALTY_OF_DELAY Penalty of Delayed Payment Veromaksun myöhästymissakko
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@tasenor/common-plugins",
3
+ "version": "1.9.16",
4
+ "description": "Shared common plugins of Tasenor project",
5
+ "repository": "git@github.com:dataplugoy/tasenor-bookkeeper.git",
6
+ "author": "Tommi Ronkainen <tommi.ronkainen@gmail.com>",
7
+ "license": "MIT",
8
+ "dependencies": {
9
+ "clone": "^2.1.2",
10
+ "dayjs": "1.10.8",
11
+ "sprintf-js": "^1.1.2",
12
+ "@dataplug/tasenor-common": "npm:@tasenor/common@1.9.16",
13
+ "@dataplug/tasenor-common-ui": "npm:@tasenor/common-ui@1.9.16",
14
+ "@dataplug/tasenor-common-node": "npm:@tasenor/common-node@1.9.16"
15
+ },
16
+ "devDependencies": {
17
+ "@mui/icons-material": "^5.14.1",
18
+ "@mui/material": "^5.13.7",
19
+ "@types/jest": "^29.5.2",
20
+ "@types/node": "^20.4.1",
21
+ "i18next": "^23.2.11",
22
+ "mobx": "^6.9.0",
23
+ "mobx-react": "^7.6.0",
24
+ "react": "^17.0.2",
25
+ "react-dom": "^17",
26
+ "react-i18next": "^13.0.2",
27
+ "react-router-dom": "^6.14.1",
28
+ "typescript": "^5.1.6",
29
+ "eslint-config-tasenor": "0.0.0",
30
+ "tsconfig": "0.0.0"
31
+ },
32
+ "peerDependencies": {
33
+ "@mui/icons-material": "^5.14.1",
34
+ "@mui/material": "^5.13.7",
35
+ "i18next": "^23.2.11",
36
+ "mobx": "^6.9.0",
37
+ "mobx-react": "^7.6.0",
38
+ "react": "^17.0.2",
39
+ "react-dom": "^17",
40
+ "react-i18next": "^13.0.2",
41
+ "react-router-dom": "^6.14.1"
42
+ },
43
+ "scripts": {
44
+ "ci": "pnpm run lint && pnpm run build",
45
+ "build": "tsc",
46
+ "fix": "eslint --fix 'src/**/*.{ts,tsx}' 'data/**/*.mjs'",
47
+ "lint": "eslint 'src/**/*.{ts,tsx}' 'data/**/*.mjs'",
48
+ "data": "data/bin/build_all",
49
+ "version": "jq .version < package.json"
50
+ }
51
+ }
@@ -0,0 +1,102 @@
1
+ import { ServicePlugin } from '@dataplug/tasenor-common-node'
2
+ import { PluginCode, Version, TasenorElement } from '@dataplug/tasenor-common'
3
+
4
+ /**
5
+ * Service: historical-crypto-rate
6
+ *
7
+ * Query:
8
+ * - *from* A crypto asset code to convert from.
9
+ * - *to* A currency code to convert to.
10
+ * - *date* A timestamp when rating is wanted.
11
+ *
12
+ * Response:
13
+ * {
14
+ * status: 200,
15
+ * rate: 0.88123123
16
+ * }
17
+ */
18
+ class CoinAPI extends ServicePlugin {
19
+
20
+ constructor() {
21
+ super('historical-crypto-rate')
22
+
23
+ this.code = 'CoinAPI' as PluginCode
24
+ this.title = 'Coin API Service'
25
+ this.version = '1.0.5' as Version
26
+ this.icon = '<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M12.89,11.1c-1.78-0.59-2.64-0.96-2.64-1.9c0-1.02,1.11-1.39,1.81-1.39c1.31,0,1.79,0.99,1.9,1.34l1.58-0.67 C15.39,8.03,14.72,6.56,13,6.24V5h-2v1.26C8.52,6.82,8.51,9.12,8.51,9.22c0,2.27,2.25,2.91,3.35,3.31 c1.58,0.56,2.28,1.07,2.28,2.03c0,1.13-1.05,1.61-1.98,1.61c-1.82,0-2.34-1.87-2.4-2.09L8.1,14.75c0.63,2.19,2.28,2.78,2.9,2.96V19 h2v-1.24c0.4-0.09,2.9-0.59,2.9-3.22C15.9,13.15,15.29,11.93,12.89,11.1z M3,21H1v-6h6v2l-2.48,0c1.61,2.41,4.36,4,7.48,4 c4.97,0,9-4.03,9-9h2c0,6.08-4.92,11-11,11c-3.72,0-7.01-1.85-9-4.67L3,21z M1,12C1,5.92,5.92,1,12,1c3.72,0,7.01,1.85,9,4.67L21,3 h2v6h-6V7l2.48,0C17.87,4.59,15.12,3,12,3c-4.97,0-9,4.03-9,9H1z"/></g></svg>'
27
+ this.releaseDate = '2022-05-13'
28
+ this.use = 'backend'
29
+ this.type = 'service'
30
+ this.description = 'This service provides historical rates from https://coinapi.io/. Currently it has a service `historical-crypto-rate`, which can be used to fetch historical crypto currency rates.'
31
+
32
+ this.languages = {
33
+ en: {
34
+ 'label-apiKey': 'Your API key to use',
35
+ },
36
+ fi: {
37
+ 'label-apiKey': 'API key eli avain',
38
+ }
39
+ }
40
+ }
41
+
42
+ async query(db, settings, service, query) {
43
+ const apiKey = settings.apiKey
44
+ if (!apiKey) {
45
+ return {
46
+ status: 400,
47
+ message: 'Setting apiKey is not set.'
48
+ }
49
+ }
50
+ if (!query.date) {
51
+ return {
52
+ status: 400,
53
+ message: 'Query parameter `date` is not set.'
54
+ }
55
+ }
56
+ if (!query.from) {
57
+ return {
58
+ status: 400,
59
+ message: 'Query parameter `from` is not set.'
60
+ }
61
+ }
62
+ if (!query.to) {
63
+ return {
64
+ status: 400,
65
+ message: 'Query parameter `to` is not set.'
66
+ }
67
+ }
68
+ const date = new Date(query.date)
69
+ const res = await this.cachedRequest(
70
+ db,
71
+ service,
72
+ 'GET', `https://rest.coinapi.io/v1/exchangerate/${query.from}/${query.to}`,
73
+ {
74
+ time: date.toISOString()
75
+ }, {
76
+ 'X-CoinAPI-Key': apiKey,
77
+ })
78
+ return res.status === 200 ? { status: 200, rate: res.data.rate } : res
79
+ }
80
+
81
+ getSettings(): TasenorElement {
82
+ return {
83
+ type: 'flat',
84
+ elements: [
85
+ {
86
+ type: 'text',
87
+ name: 'apiKey',
88
+ actions: {}
89
+ },
90
+ {
91
+ type: 'button',
92
+ label: 'Save',
93
+ actions: {
94
+ onClick: { type: 'saveSettings', backend: true, plugin: 'CoinAPI' as PluginCode }
95
+ }
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ }
101
+
102
+ export default CoinAPI
@@ -0,0 +1,35 @@
1
+ import { NO_SEGMENT, SegmentId, TextFileLine } from '@dataplug/tasenor-common'
2
+ import { ProcessFile, TransactionImportHandler } from '@dataplug/tasenor-common-node'
3
+
4
+ /**
5
+ * Import implementation for Coinbase CSV format.
6
+ */
7
+ export class CoinbaseHandler extends TransactionImportHandler {
8
+
9
+ constructor() {
10
+ super('CoinbaseImport')
11
+ this.importOptions = {
12
+ parser: 'csv',
13
+ numericFields: ['amount', 'balance'],
14
+ requiredFields: [],
15
+ textField: 'type',
16
+ totalAmountField: 'amount',
17
+ csv: { useFirstLineHeadings: true }
18
+ }
19
+ }
20
+
21
+ canHandle(file: ProcessFile): boolean {
22
+ return file.firstLineMatch(/^(portfolio,)?type,time,amount,balance,amount.balance unit,transfer id,trade id,order id/)
23
+ }
24
+
25
+ segmentId(line: TextFileLine): SegmentId | typeof NO_SEGMENT {
26
+ if (['deposit', 'withdrawal'].includes(line.columns.type)) {
27
+ return line.columns['transfer id']
28
+ }
29
+ return line.columns['trade id']
30
+ }
31
+
32
+ time(line: TextFileLine): Date | undefined {
33
+ return line.columns.time ? new Date(line.columns.time) : undefined
34
+ }
35
+ }
@@ -0,0 +1,24 @@
1
+ import { ImportPlugin } from '@dataplug/tasenor-common-node'
2
+ import { PluginCode, Version } from '@dataplug/tasenor-common'
3
+ import { CoinbaseHandler } from './CoinbaseHandler'
4
+
5
+ class CoinbaseImportPlugin extends ImportPlugin {
6
+
7
+ constructor() {
8
+ super(new CoinbaseHandler())
9
+
10
+ this.code = 'CoinbaseImport' as PluginCode
11
+ this.title = 'Import for Coinbase'
12
+ this.version = '1.0.21' as Version
13
+ this.icon = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M5 6.99h3V14h2V6.99h3L9 3zM14 10v7.01h-3L15 21l4-3.99h-3V10z"/></svg>'
14
+ this.releaseDate = '2022-10-24'
15
+ this.use = 'backend'
16
+ this.type = 'import'
17
+ this.description = 'Import plugin for importing transaction data in CSV format provided by Coinbase crypto exchange.'
18
+
19
+ this.languages = this.getLanguages()
20
+ }
21
+
22
+ }
23
+
24
+ export default CoinbaseImportPlugin
@@ -0,0 +1,64 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "name": "Coinbase withdrawal",
5
+ "filter": "type == 'withdrawal'",
6
+ "result": [
7
+ {
8
+ "reason": "type",
9
+ "type": "'external'",
10
+ "asset": "$('amount/balance unit')",
11
+ "amount": "-amount"
12
+ },
13
+ {
14
+ "reason": "type",
15
+ "type": "isCurrency($('amount/balance unit')) ? 'currency' : 'crypto'",
16
+ "asset": "$('amount/balance unit')",
17
+ "amount": "amount"
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "name": "Coinbase deposit",
23
+ "filter": "type == 'deposit'",
24
+ "result": [
25
+ {
26
+ "reason": "type",
27
+ "type": "'external'",
28
+ "asset": "$('amount/balance unit')",
29
+ "amount": "-amount"
30
+ },
31
+ {
32
+ "reason": "type",
33
+ "type": "isCurrency($('amount/balance unit')) ? 'currency' : 'crypto'",
34
+ "asset": "$('amount/balance unit')",
35
+ "amount": "amount"
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ "name": "Trade",
41
+ "filter": "type == 'match'",
42
+ "result": [
43
+ {
44
+ "reason": "'trade'",
45
+ "type": "isCurrency($('amount/balance unit')) ? 'currency' : 'crypto'",
46
+ "asset": "$('amount/balance unit')",
47
+ "amount": "amount"
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ "name": "Trading fee",
53
+ "filter": "type == 'fee'",
54
+ "result": [
55
+ {
56
+ "reason": "'fee'",
57
+ "type": "isCurrency($('amount/balance unit')) ? 'currency' : 'crypto'",
58
+ "asset": "$('amount/balance unit')",
59
+ "amount": "-amount"
60
+ }
61
+ ]
62
+ }
63
+ ]
64
+ }