@tasenor/common-node 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.
- package/.eslintrc.js +4 -0
- package/LICENSE +21 -0
- package/dist/tasenor-common-node/src/cli.d.ts +81 -0
- package/dist/tasenor-common-node/src/cli.js +242 -0
- package/dist/tasenor-common-node/src/cli.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/account.d.ts +12 -0
- package/dist/tasenor-common-node/src/commands/account.js +58 -0
- package/dist/tasenor-common-node/src/commands/account.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/balance.d.ts +11 -0
- package/dist/tasenor-common-node/src/commands/balance.js +117 -0
- package/dist/tasenor-common-node/src/commands/balance.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/db.d.ts +14 -0
- package/dist/tasenor-common-node/src/commands/db.js +69 -0
- package/dist/tasenor-common-node/src/commands/db.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/entry.d.ts +13 -0
- package/dist/tasenor-common-node/src/commands/entry.js +106 -0
- package/dist/tasenor-common-node/src/commands/entry.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/import.d.ts +17 -0
- package/dist/tasenor-common-node/src/commands/import.js +140 -0
- package/dist/tasenor-common-node/src/commands/import.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/importer.d.ts +13 -0
- package/dist/tasenor-common-node/src/commands/importer.js +71 -0
- package/dist/tasenor-common-node/src/commands/importer.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/index.d.ts +191 -0
- package/dist/tasenor-common-node/src/commands/index.js +482 -0
- package/dist/tasenor-common-node/src/commands/index.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/period.d.ts +12 -0
- package/dist/tasenor-common-node/src/commands/period.js +48 -0
- package/dist/tasenor-common-node/src/commands/period.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/plugin.d.ts +15 -0
- package/dist/tasenor-common-node/src/commands/plugin.js +78 -0
- package/dist/tasenor-common-node/src/commands/plugin.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/report.d.ts +11 -0
- package/dist/tasenor-common-node/src/commands/report.js +96 -0
- package/dist/tasenor-common-node/src/commands/report.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/settings.d.ts +10 -0
- package/dist/tasenor-common-node/src/commands/settings.js +64 -0
- package/dist/tasenor-common-node/src/commands/settings.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/stock.d.ts +8 -0
- package/dist/tasenor-common-node/src/commands/stock.js +73 -0
- package/dist/tasenor-common-node/src/commands/stock.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/tag.d.ts +13 -0
- package/dist/tasenor-common-node/src/commands/tag.js +89 -0
- package/dist/tasenor-common-node/src/commands/tag.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/tx.d.ts +12 -0
- package/dist/tasenor-common-node/src/commands/tx.js +81 -0
- package/dist/tasenor-common-node/src/commands/tx.js.map +1 -0
- package/dist/tasenor-common-node/src/commands/user.d.ts +12 -0
- package/dist/tasenor-common-node/src/commands/user.js +52 -0
- package/dist/tasenor-common-node/src/commands/user.js.map +1 -0
- package/dist/tasenor-common-node/src/database/BookkeeperImporter.d.ts +77 -0
- package/dist/tasenor-common-node/src/database/BookkeeperImporter.js +343 -0
- package/dist/tasenor-common-node/src/database/BookkeeperImporter.js.map +1 -0
- package/dist/tasenor-common-node/src/database/DB.d.ts +51 -0
- package/dist/tasenor-common-node/src/database/DB.js +354 -0
- package/dist/tasenor-common-node/src/database/DB.js.map +1 -0
- package/dist/tasenor-common-node/src/database/index.d.ts +7 -0
- package/dist/tasenor-common-node/src/database/index.js +8 -0
- package/dist/tasenor-common-node/src/database/index.js.map +1 -0
- package/dist/tasenor-common-node/src/doccer.d.ts +29 -0
- package/dist/tasenor-common-node/src/doccer.js +30 -0
- package/dist/tasenor-common-node/src/doccer.js.map +1 -0
- package/dist/tasenor-common-node/src/error.d.ts +30 -0
- package/dist/tasenor-common-node/src/error.js +35 -0
- package/dist/tasenor-common-node/src/error.js.map +1 -0
- package/dist/tasenor-common-node/src/export/Exporter.d.ts +69 -0
- package/dist/tasenor-common-node/src/export/Exporter.js +123 -0
- package/dist/tasenor-common-node/src/export/Exporter.js.map +1 -0
- package/dist/tasenor-common-node/src/export/TasenorExporter.d.ts +55 -0
- package/dist/tasenor-common-node/src/export/TasenorExporter.js +135 -0
- package/dist/tasenor-common-node/src/export/TasenorExporter.js.map +1 -0
- package/dist/tasenor-common-node/src/export/TilitinExporter.d.ts +71 -0
- package/dist/tasenor-common-node/src/export/TilitinExporter.js +290 -0
- package/dist/tasenor-common-node/src/export/TilitinExporter.js.map +1 -0
- package/dist/tasenor-common-node/src/export/index.d.ts +8 -0
- package/dist/tasenor-common-node/src/export/index.js +9 -0
- package/dist/tasenor-common-node/src/export/index.js.map +1 -0
- package/dist/tasenor-common-node/src/import/TextFileProcessHandler.d.ts +104 -0
- package/dist/tasenor-common-node/src/import/TextFileProcessHandler.js +354 -0
- package/dist/tasenor-common-node/src/import/TextFileProcessHandler.js.map +1 -0
- package/dist/tasenor-common-node/src/import/TransactionImportConnector.d.ts +38 -0
- package/dist/tasenor-common-node/src/import/TransactionImportConnector.js +27 -0
- package/dist/tasenor-common-node/src/import/TransactionImportConnector.js.map +1 -0
- package/dist/tasenor-common-node/src/import/TransactionImportHandler.d.ts +173 -0
- package/dist/tasenor-common-node/src/import/TransactionImportHandler.js +733 -0
- package/dist/tasenor-common-node/src/import/TransactionImportHandler.js.map +1 -0
- package/dist/tasenor-common-node/src/import/TransactionRules.d.ts +238 -0
- package/dist/tasenor-common-node/src/import/TransactionRules.js +522 -0
- package/dist/tasenor-common-node/src/import/TransactionRules.js.map +1 -0
- package/dist/tasenor-common-node/src/import/TransactionUI.d.ts +181 -0
- package/dist/tasenor-common-node/src/import/TransactionUI.js +482 -0
- package/dist/tasenor-common-node/src/import/TransactionUI.js.map +1 -0
- package/dist/tasenor-common-node/src/import/TransferAnalyzer.d.ts +324 -0
- package/dist/tasenor-common-node/src/import/TransferAnalyzer.js +1379 -0
- package/dist/tasenor-common-node/src/import/TransferAnalyzer.js.map +1 -0
- package/dist/tasenor-common-node/src/import/index.d.ts +11 -0
- package/dist/tasenor-common-node/src/import/index.js +12 -0
- package/dist/tasenor-common-node/src/import/index.js.map +1 -0
- package/dist/tasenor-common-node/src/index.d.ts +12 -0
- package/dist/tasenor-common-node/src/index.js +13 -0
- package/dist/tasenor-common-node/src/index.js.map +1 -0
- package/dist/tasenor-common-node/src/net/crypto.d.ts +33 -0
- package/dist/tasenor-common-node/src/net/crypto.js +63 -0
- package/dist/tasenor-common-node/src/net/crypto.js.map +1 -0
- package/dist/tasenor-common-node/src/net/git.d.ts +49 -0
- package/dist/tasenor-common-node/src/net/git.js +137 -0
- package/dist/tasenor-common-node/src/net/git.js.map +1 -0
- package/dist/tasenor-common-node/src/net/index.d.ts +10 -0
- package/dist/tasenor-common-node/src/net/index.js +11 -0
- package/dist/tasenor-common-node/src/net/index.js.map +1 -0
- package/dist/tasenor-common-node/src/net/middleware.d.ts +61 -0
- package/dist/tasenor-common-node/src/net/middleware.js +220 -0
- package/dist/tasenor-common-node/src/net/middleware.js.map +1 -0
- package/dist/tasenor-common-node/src/net/tokens.d.ts +50 -0
- package/dist/tasenor-common-node/src/net/tokens.js +141 -0
- package/dist/tasenor-common-node/src/net/tokens.js.map +1 -0
- package/dist/tasenor-common-node/src/net/vault.d.ts +67 -0
- package/dist/tasenor-common-node/src/net/vault.js +145 -0
- package/dist/tasenor-common-node/src/net/vault.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/BackendPlugin.d.ts +91 -0
- package/dist/tasenor-common-node/src/plugins/BackendPlugin.js +165 -0
- package/dist/tasenor-common-node/src/plugins/BackendPlugin.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/DataPlugin.d.ts +13 -0
- package/dist/tasenor-common-node/src/plugins/DataPlugin.js +26 -0
- package/dist/tasenor-common-node/src/plugins/DataPlugin.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/ImportPlugin.d.ts +188 -0
- package/dist/tasenor-common-node/src/plugins/ImportPlugin.js +204 -0
- package/dist/tasenor-common-node/src/plugins/ImportPlugin.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/ReportPlugin.d.ts +132 -0
- package/dist/tasenor-common-node/src/plugins/ReportPlugin.js +393 -0
- package/dist/tasenor-common-node/src/plugins/ReportPlugin.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/SchemePlugin.d.ts +34 -0
- package/dist/tasenor-common-node/src/plugins/SchemePlugin.js +47 -0
- package/dist/tasenor-common-node/src/plugins/SchemePlugin.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/ServicePlugin.d.ts +80 -0
- package/dist/tasenor-common-node/src/plugins/ServicePlugin.js +168 -0
- package/dist/tasenor-common-node/src/plugins/ServicePlugin.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/ToolPlugin.d.ts +27 -0
- package/dist/tasenor-common-node/src/plugins/ToolPlugin.js +37 -0
- package/dist/tasenor-common-node/src/plugins/ToolPlugin.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/index.d.ts +13 -0
- package/dist/tasenor-common-node/src/plugins/index.js +14 -0
- package/dist/tasenor-common-node/src/plugins/index.js.map +1 -0
- package/dist/tasenor-common-node/src/plugins/plugins.d.ts +101 -0
- package/dist/tasenor-common-node/src/plugins/plugins.js +292 -0
- package/dist/tasenor-common-node/src/plugins/plugins.js.map +1 -0
- package/dist/tasenor-common-node/src/process/Process.d.ts +108 -0
- package/dist/tasenor-common-node/src/process/Process.js +335 -0
- package/dist/tasenor-common-node/src/process/Process.js.map +1 -0
- package/dist/tasenor-common-node/src/process/ProcessConnector.d.ts +24 -0
- package/dist/tasenor-common-node/src/process/ProcessConnector.js +28 -0
- package/dist/tasenor-common-node/src/process/ProcessConnector.js.map +1 -0
- package/dist/tasenor-common-node/src/process/ProcessFile.d.ts +69 -0
- package/dist/tasenor-common-node/src/process/ProcessFile.js +145 -0
- package/dist/tasenor-common-node/src/process/ProcessFile.js.map +1 -0
- package/dist/tasenor-common-node/src/process/ProcessHandler.d.ts +60 -0
- package/dist/tasenor-common-node/src/process/ProcessHandler.js +73 -0
- package/dist/tasenor-common-node/src/process/ProcessHandler.js.map +1 -0
- package/dist/tasenor-common-node/src/process/ProcessStep.d.ts +52 -0
- package/dist/tasenor-common-node/src/process/ProcessStep.js +78 -0
- package/dist/tasenor-common-node/src/process/ProcessStep.js.map +1 -0
- package/dist/tasenor-common-node/src/process/ProcessingSystem.d.ts +60 -0
- package/dist/tasenor-common-node/src/process/ProcessingSystem.js +182 -0
- package/dist/tasenor-common-node/src/process/ProcessingSystem.js.map +1 -0
- package/dist/tasenor-common-node/src/process/index.d.ts +11 -0
- package/dist/tasenor-common-node/src/process/index.js +12 -0
- package/dist/tasenor-common-node/src/process/index.js.map +1 -0
- package/dist/tasenor-common-node/src/reports/conversions.d.ts +8 -0
- package/dist/tasenor-common-node/src/reports/conversions.js +47 -0
- package/dist/tasenor-common-node/src/reports/conversions.js.map +1 -0
- package/dist/tasenor-common-node/src/reports/index.d.ts +6 -0
- package/dist/tasenor-common-node/src/reports/index.js +7 -0
- package/dist/tasenor-common-node/src/reports/index.js.map +1 -0
- package/dist/tasenor-common-node/src/server/ISPDemoServer.d.ts +43 -0
- package/dist/tasenor-common-node/src/server/ISPDemoServer.js +112 -0
- package/dist/tasenor-common-node/src/server/ISPDemoServer.js.map +1 -0
- package/dist/tasenor-common-node/src/server/api.d.ts +15 -0
- package/dist/tasenor-common-node/src/server/api.js +27 -0
- package/dist/tasenor-common-node/src/server/api.js.map +1 -0
- package/dist/tasenor-common-node/src/server/index.d.ts +7 -0
- package/dist/tasenor-common-node/src/server/index.js +8 -0
- package/dist/tasenor-common-node/src/server/index.js.map +1 -0
- package/dist/tasenor-common-node/src/server/router.d.ts +5 -0
- package/dist/tasenor-common-node/src/server/router.js +37 -0
- package/dist/tasenor-common-node/src/server/router.js.map +1 -0
- package/dist/tasenor-common-node/src/system.d.ts +27 -0
- package/dist/tasenor-common-node/src/system.js +95 -0
- package/dist/tasenor-common-node/src/system.js.map +1 -0
- package/dist/tasenor-common-node/src/testing/ProcessingSystemMock.d.ts +21 -0
- package/dist/tasenor-common-node/src/testing/ProcessingSystemMock.js +33 -0
- package/dist/tasenor-common-node/src/testing/ProcessingSystemMock.js.map +1 -0
- package/dist/tasenor-common-node/src/testing/UnitTestImportConnector.d.ts +24 -0
- package/dist/tasenor-common-node/src/testing/UnitTestImportConnector.js +68 -0
- package/dist/tasenor-common-node/src/testing/UnitTestImportConnector.js.map +1 -0
- package/dist/tasenor-common-node/src/testing/UnitTester.d.ts +64 -0
- package/dist/tasenor-common-node/src/testing/UnitTester.js +199 -0
- package/dist/tasenor-common-node/src/testing/UnitTester.js.map +1 -0
- package/dist/tasenor-common-node/src/testing/index.d.ts +4 -0
- package/dist/tasenor-common-node/src/testing/index.js +5 -0
- package/dist/tasenor-common-node/src/testing/index.js.map +1 -0
- package/dist/tasenor-common-node/src/testing/test-handlers.d.ts +13 -0
- package/dist/tasenor-common-node/src/testing/test-handlers.js +52 -0
- package/dist/tasenor-common-node/src/testing/test-handlers.js.map +1 -0
- package/dist/tasenor-common-node/tests/TransactionRules.spec.d.ts +1 -0
- package/dist/tasenor-common-node/tests/TransactionRules.spec.js +64 -0
- package/dist/tasenor-common-node/tests/TransactionRules.spec.js.map +1 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-account-address.spec.d.ts +1 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-account-address.spec.js +80 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-account-address.spec.js.map +1 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-buying-and-selling.spec.d.ts +1 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-buying-and-selling.spec.js +342 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-buying-and-selling.spec.js.map +1 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-loans.spec.d.ts +1 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-loans.spec.js +174 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-loans.spec.js.map +1 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-multiple-null-amounts.spec.d.ts +1 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-multiple-null-amounts.spec.js +175 -0
- package/dist/tasenor-common-node/tests/TransferAnalyzer-multiple-null-amounts.spec.js.map +1 -0
- package/dist/tasenor-common-node/tests/password.spec.d.ts +1 -0
- package/dist/tasenor-common-node/tests/password.spec.js +8 -0
- package/dist/tasenor-common-node/tests/password.spec.js.map +1 -0
- package/dist/tasenor-common-node/tests/tokens.spec.d.ts +1 -0
- package/dist/tasenor-common-node/tests/tokens.spec.js +49 -0
- package/dist/tasenor-common-node/tests/tokens.spec.js.map +1 -0
- package/dist/tasenor-common-node/tests/vault.spec.d.ts +1 -0
- package/dist/tasenor-common-node/tests/vault.spec.js +19 -0
- package/dist/tasenor-common-node/tests/vault.spec.js.map +1 -0
- package/dist/tasenor-common-plugins/src/CoinbaseImport/backend/CoinbaseHandler.d.ts +11 -0
- package/dist/tasenor-common-plugins/src/CoinbaseImport/backend/CoinbaseHandler.js +30 -0
- package/dist/tasenor-common-plugins/src/CoinbaseImport/backend/CoinbaseHandler.js.map +1 -0
- package/dist/tasenor-common-plugins/src/IncomeAndExpenses/backend/index.d.ts +5 -0
- package/dist/tasenor-common-plugins/src/IncomeAndExpenses/backend/index.js +350 -0
- package/dist/tasenor-common-plugins/src/IncomeAndExpenses/backend/index.js.map +1 -0
- package/dist/tasenor-common-plugins/src/KrakenImport/backend/KrakenHandler.d.ts +23 -0
- package/dist/tasenor-common-plugins/src/KrakenImport/backend/KrakenHandler.js +83 -0
- package/dist/tasenor-common-plugins/src/KrakenImport/backend/KrakenHandler.js.map +1 -0
- package/dist/tasenor-common-plugins/src/LynxImport/backend/LynxHandler.d.ts +28 -0
- package/dist/tasenor-common-plugins/src/LynxImport/backend/LynxHandler.js +340 -0
- package/dist/tasenor-common-plugins/src/LynxImport/backend/LynxHandler.js.map +1 -0
- package/dist/tasenor-common-plugins/src/NordeaImport/backend/NordeaHandler.d.ts +11 -0
- package/dist/tasenor-common-plugins/src/NordeaImport/backend/NordeaHandler.js +39 -0
- package/dist/tasenor-common-plugins/src/NordeaImport/backend/NordeaHandler.js.map +1 -0
- package/dist/tasenor-common-plugins/src/NordnetImport/backend/NordnetHandler.d.ts +17 -0
- package/dist/tasenor-common-plugins/src/NordnetImport/backend/NordnetHandler.js +66 -0
- package/dist/tasenor-common-plugins/src/NordnetImport/backend/NordnetHandler.js.map +1 -0
- package/dist/tasenor-common-plugins/src/TITOImport/backend/TITOHandler.d.ts +13 -0
- package/dist/tasenor-common-plugins/src/TITOImport/backend/TITOHandler.js +241 -0
- package/dist/tasenor-common-plugins/src/TITOImport/backend/TITOHandler.js.map +1 -0
- package/jest.config.js +1 -0
- package/package.json +62 -0
- package/src/cli.ts +267 -0
- package/src/commands/account.ts +69 -0
- package/src/commands/balance.ts +131 -0
- package/src/commands/db.ts +84 -0
- package/src/commands/entry.ts +117 -0
- package/src/commands/import.ts +160 -0
- package/src/commands/importer.ts +84 -0
- package/src/commands/index.ts +534 -0
- package/src/commands/period.ts +59 -0
- package/src/commands/plugin.ts +95 -0
- package/src/commands/report.ts +113 -0
- package/src/commands/settings.ts +75 -0
- package/src/commands/stock.ts +80 -0
- package/src/commands/tag.ts +102 -0
- package/src/commands/tx.ts +93 -0
- package/src/commands/user.ts +65 -0
- package/src/database/BookkeeperImporter.ts +358 -0
- package/src/database/DB.ts +396 -0
- package/src/database/index.ts +7 -0
- package/src/doccer.ts +29 -0
- package/src/error.ts +32 -0
- package/src/export/Exporter.ts +136 -0
- package/src/export/TasenorExporter.ts +144 -0
- package/src/export/TilitinExporter.ts +302 -0
- package/src/export/index.ts +8 -0
- package/src/import/TextFileProcessHandler.ts +384 -0
- package/src/import/TransactionImportConnector.ts +65 -0
- package/src/import/TransactionImportHandler.ts +819 -0
- package/src/import/TransactionRules.ts +570 -0
- package/src/import/TransactionUI.ts +520 -0
- package/src/import/TransferAnalyzer.ts +1450 -0
- package/src/import/index.ts +11 -0
- package/src/index.ts +12 -0
- package/src/net/crypto.ts +69 -0
- package/src/net/git.ts +151 -0
- package/src/net/index.ts +10 -0
- package/src/net/middleware.ts +261 -0
- package/src/net/tokens.ts +140 -0
- package/src/net/vault.ts +161 -0
- package/src/plugins/BackendPlugin.ts +188 -0
- package/src/plugins/DataPlugin.ts +29 -0
- package/src/plugins/ImportPlugin.ts +211 -0
- package/src/plugins/ReportPlugin.ts +443 -0
- package/src/plugins/SchemePlugin.ts +56 -0
- package/src/plugins/ServicePlugin.ts +188 -0
- package/src/plugins/ToolPlugin.ts +44 -0
- package/src/plugins/index.ts +13 -0
- package/src/plugins/plugins.ts +345 -0
- package/src/process/Process.ts +368 -0
- package/src/process/ProcessConnector.ts +45 -0
- package/src/process/ProcessFile.ts +169 -0
- package/src/process/ProcessHandler.ts +94 -0
- package/src/process/ProcessStep.ts +100 -0
- package/src/process/ProcessingSystem.ts +202 -0
- package/src/process/index.ts +11 -0
- package/src/reports/conversions.ts +52 -0
- package/src/reports/index.ts +6 -0
- package/src/server/ISPDemoServer.ts +122 -0
- package/src/server/api.ts +37 -0
- package/src/server/index.ts +7 -0
- package/src/server/router.ts +60 -0
- package/src/system.ts +96 -0
- package/src/testing/ProcessingSystemMock.ts +45 -0
- package/src/testing/UnitTestImportConnector.ts +86 -0
- package/src/testing/UnitTester.ts +231 -0
- package/src/testing/index.ts +4 -0
- package/src/testing/test-handlers.ts +55 -0
- package/tests/TransactionRules.spec.ts +73 -0
- package/tests/TransferAnalyzer-account-address.spec.ts +87 -0
- package/tests/TransferAnalyzer-buying-and-selling.spec.ts +354 -0
- package/tests/TransferAnalyzer-loans.spec.ts +197 -0
- package/tests/TransferAnalyzer-multiple-null-amounts.spec.ts +181 -0
- package/tests/password.spec.ts +8 -0
- package/tests/tokens.spec.ts +52 -0
- package/tests/vault.spec.ts +20 -0
- package/tsconfig.json +13 -0
package/src/net/vault.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Secret } from '@dataplug/tasenor-common'
|
|
2
|
+
import { randomString } from './crypto'
|
|
3
|
+
|
|
4
|
+
export const ALLOWED_VAULT_VARIABLES = [
|
|
5
|
+
'TASENOR_API_URL',
|
|
6
|
+
'API_SITE_TOKEN',
|
|
7
|
+
'DATABASE_ROOT_PASSWORD',
|
|
8
|
+
'DATABASE_ROOT_USER',
|
|
9
|
+
'DATABASE_URL',
|
|
10
|
+
'SECRET',
|
|
11
|
+
'TASENOR_SITE_TOKEN'
|
|
12
|
+
]
|
|
13
|
+
const validVariables = new Set(ALLOWED_VAULT_VARIABLES)
|
|
14
|
+
|
|
15
|
+
export type VaultVariable = typeof ALLOWED_VAULT_VARIABLES[number]
|
|
16
|
+
export type VaultValue = string
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Base class for a secret vault implementations.
|
|
20
|
+
*/
|
|
21
|
+
export class Vault {
|
|
22
|
+
url: string
|
|
23
|
+
values: { [key: string]: VaultValue }
|
|
24
|
+
initialized: boolean
|
|
25
|
+
secret: Secret | null
|
|
26
|
+
|
|
27
|
+
constructor(url: string) {
|
|
28
|
+
this.url = url
|
|
29
|
+
this.values = {}
|
|
30
|
+
this.initialized = false
|
|
31
|
+
this.secret = null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Retrieve all secret values.
|
|
36
|
+
*/
|
|
37
|
+
async initialize(): Promise<void> {
|
|
38
|
+
throw new Error(`A class ${this.constructor.name} does not implement initialize().`)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get a secret value.
|
|
43
|
+
* @param variable
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
get(variable: VaultVariable, def: undefined | VaultValue = undefined): VaultValue {
|
|
47
|
+
if (!validVariables.has(variable)) throw new Error(`A variable ${variable} is not valid vault value.`)
|
|
48
|
+
if (!(variable in this.values)) {
|
|
49
|
+
if (def !== undefined) {
|
|
50
|
+
return def
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Cannot find variable ${variable} from the vault.`)
|
|
53
|
+
}
|
|
54
|
+
return this.values[variable]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get the internally generated secret and generate new if none yet generated.
|
|
59
|
+
*/
|
|
60
|
+
getPrivateSecret() {
|
|
61
|
+
if (this.secret === null) {
|
|
62
|
+
this.secret = randomString(512) as Secret
|
|
63
|
+
}
|
|
64
|
+
return this.secret
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Set the internal secret (use only in developement).
|
|
69
|
+
*/
|
|
70
|
+
setPrivateSecret(secret: Secret): void {
|
|
71
|
+
this.secret = secret
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A secret vault using environment variables only.
|
|
77
|
+
*/
|
|
78
|
+
export class EnvironmentVault extends Vault {
|
|
79
|
+
|
|
80
|
+
async initialize(): Promise<void> {
|
|
81
|
+
for (const variable of ALLOWED_VAULT_VARIABLES) {
|
|
82
|
+
const value = process.env[variable]
|
|
83
|
+
if (value !== undefined) {
|
|
84
|
+
this.values[variable] = value
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Instantiate and return the current vault based on the environment VAULT_URL.
|
|
92
|
+
*/
|
|
93
|
+
let currentVault: Vault | undefined
|
|
94
|
+
export function getVault(): Vault {
|
|
95
|
+
if (currentVault && currentVault.url === process.env.VAULT_URL) return currentVault
|
|
96
|
+
if (!process.env.VAULT_URL) {
|
|
97
|
+
throw new Error('No VAULT_URL set and cannot instantiate the vault.')
|
|
98
|
+
}
|
|
99
|
+
const url = new URL(process.env.VAULT_URL)
|
|
100
|
+
switch (url.protocol) {
|
|
101
|
+
case 'env:':
|
|
102
|
+
currentVault = new EnvironmentVault(process.env.VAULT_URL)
|
|
103
|
+
break
|
|
104
|
+
default:
|
|
105
|
+
throw new Error(`Cannot recognize protocol ${url.protocol} of vault URL ${process.env.VAULT_URL}`)
|
|
106
|
+
}
|
|
107
|
+
return currentVault
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Retrieve a value from the vault.
|
|
112
|
+
* @param variable
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
function get(variable: VaultVariable, def: undefined | VaultValue = undefined): VaultValue {
|
|
116
|
+
const vault = getVault()
|
|
117
|
+
if (!vault.initialized) {
|
|
118
|
+
throw new Error('Cannot use the vault before it is initialized.')
|
|
119
|
+
}
|
|
120
|
+
const value = vault.get(variable, def)
|
|
121
|
+
if (value === undefined) {
|
|
122
|
+
throw new Error(`Cannot find value ${variable} from the vault.`)
|
|
123
|
+
}
|
|
124
|
+
return value
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Get the internally generated secret and generate new if none yet generated.
|
|
129
|
+
*/
|
|
130
|
+
function getPrivateSecret(): Secret {
|
|
131
|
+
const vault = getVault()
|
|
132
|
+
if (!vault.initialized) {
|
|
133
|
+
throw new Error('Cannot use the vault before it is initialized.')
|
|
134
|
+
}
|
|
135
|
+
return vault.getPrivateSecret()
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Set the internal secret.
|
|
140
|
+
*/
|
|
141
|
+
function setPrivateSecret(secret: Secret): void {
|
|
142
|
+
const vault = getVault()
|
|
143
|
+
vault.setPrivateSecret(secret)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Set up the vault.
|
|
148
|
+
*/
|
|
149
|
+
async function initialize(): Promise<void> {
|
|
150
|
+
const vault = getVault()
|
|
151
|
+
vault.initialized = true
|
|
152
|
+
await vault.initialize()
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const vault = {
|
|
156
|
+
get,
|
|
157
|
+
getPrivateSecret,
|
|
158
|
+
getVault,
|
|
159
|
+
initialize,
|
|
160
|
+
setPrivateSecret
|
|
161
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import { TasenorElement, BackendCatalog, Constructor, DirectoryPath, FilePath, Language, PluginCode, PluginType, PluginUse, Version, ID, getServerRoot } from '@dataplug/tasenor-common'
|
|
3
|
+
import * as path from 'path'
|
|
4
|
+
import * as fs from 'fs'
|
|
5
|
+
import { KnexDatabase } from '..'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Baseclass for all plugins for back-end.
|
|
9
|
+
*/
|
|
10
|
+
export class BackendPlugin {
|
|
11
|
+
|
|
12
|
+
public id: ID
|
|
13
|
+
public code: PluginCode
|
|
14
|
+
public title: string
|
|
15
|
+
public version: Version | null
|
|
16
|
+
public releaseDate: Date | string | null
|
|
17
|
+
public use: PluginUse | 'unknown'
|
|
18
|
+
public type: PluginType | 'unknown'
|
|
19
|
+
public icon: string
|
|
20
|
+
public description: string
|
|
21
|
+
public path: string
|
|
22
|
+
public languages: Record<string, Record<string, string>>
|
|
23
|
+
private catalog?: BackendCatalog
|
|
24
|
+
|
|
25
|
+
constructor() {
|
|
26
|
+
this.id = null
|
|
27
|
+
this.code = '' as PluginCode
|
|
28
|
+
this.title = ''
|
|
29
|
+
this.version = null
|
|
30
|
+
this.releaseDate = null
|
|
31
|
+
this.use = 'unknown'
|
|
32
|
+
this.type = 'unknown'
|
|
33
|
+
this.icon = ''
|
|
34
|
+
this.description = ''
|
|
35
|
+
this.path = ''
|
|
36
|
+
|
|
37
|
+
// Plugin translations from language code to the translation dictionary.
|
|
38
|
+
this.languages = {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Hook to be executed once during installing.
|
|
44
|
+
*/
|
|
45
|
+
async install(): Promise<void> {
|
|
46
|
+
// Do nothing by default.
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Hook to be executed one during uninstalling.
|
|
51
|
+
*/
|
|
52
|
+
async uninstall(): Promise<void> {
|
|
53
|
+
// Do nothing by default.
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Hook to register hooks when launching backend.
|
|
58
|
+
*/
|
|
59
|
+
load(catalog: BackendCatalog) {
|
|
60
|
+
// Do nothing by default.
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Hook to be executed once for every database during installing.
|
|
65
|
+
* @param db Knex instance of the database.
|
|
66
|
+
*/
|
|
67
|
+
async installToDb(db: KnexDatabase): Promise<void> {
|
|
68
|
+
// Do nothing by default.
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Hook to be executed once for every database during uninstalling.
|
|
73
|
+
* @param db Knex instance of the database.
|
|
74
|
+
*/
|
|
75
|
+
async uninstallFromDb(db: KnexDatabase): Promise<void> {
|
|
76
|
+
// Do nothing by default.
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the full path to the directory of this plugin.
|
|
81
|
+
* @returns The path.
|
|
82
|
+
*/
|
|
83
|
+
get fullPath(): DirectoryPath {
|
|
84
|
+
return this.path as DirectoryPath
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Construct the full path to the file of this module.
|
|
89
|
+
* @param name
|
|
90
|
+
* @returns The path.
|
|
91
|
+
*/
|
|
92
|
+
filePath(name: string): FilePath {
|
|
93
|
+
return `${this.fullPath}/backend/${name}` as FilePath
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Collect meta data as a JSON object.
|
|
98
|
+
* @returns Object
|
|
99
|
+
*/
|
|
100
|
+
toJSON(): Record<string, unknown> {
|
|
101
|
+
return {
|
|
102
|
+
id: this.id,
|
|
103
|
+
code: this.code,
|
|
104
|
+
title: this.title,
|
|
105
|
+
description: this.description,
|
|
106
|
+
icon: this.icon,
|
|
107
|
+
version: this.version,
|
|
108
|
+
releaseDate: this.releaseDate,
|
|
109
|
+
use: this.use,
|
|
110
|
+
type: this.type,
|
|
111
|
+
path: this.path
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get the UI setting description or null if the plugin has no settings.
|
|
117
|
+
*/
|
|
118
|
+
getSettings(): TasenorElement | null {
|
|
119
|
+
return null
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Do the translation for a string.
|
|
124
|
+
*/
|
|
125
|
+
t(str: string, lang: Language): string {
|
|
126
|
+
if (this.catalog) {
|
|
127
|
+
return this.catalog.t(str, lang)
|
|
128
|
+
}
|
|
129
|
+
// Mainly useful for plugin testing: translate using local plugin translations if no catalog available.
|
|
130
|
+
if ((lang in this.languages) && (str in this.languages[lang])) {
|
|
131
|
+
return this.languages[lang][str]
|
|
132
|
+
}
|
|
133
|
+
return str
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get the settings variable values for this plugin.
|
|
138
|
+
* @param db
|
|
139
|
+
* @param name
|
|
140
|
+
*/
|
|
141
|
+
async getSetting(db: KnexDatabase, name: string) {
|
|
142
|
+
const setting = await db('settings').select('value').where({ name: `${this.code}.${name}` }).first()
|
|
143
|
+
return setting ? setting.value : undefined
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A scheduled function that is ran once an hour. The hour number is in server time.
|
|
148
|
+
*/
|
|
149
|
+
async hourly(hour: number) {
|
|
150
|
+
// Do nothing by default.
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* A scheduled function that is ran once a day during night time on server time.
|
|
155
|
+
*/
|
|
156
|
+
async nightly(db: KnexDatabase) {
|
|
157
|
+
// Do nothing by default.
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Ensure private working directory for this plugin and reserved for the given database.
|
|
162
|
+
*/
|
|
163
|
+
getWorkSpace(db: KnexDatabase): DirectoryPath {
|
|
164
|
+
const workdir = path.join(getServerRoot(), 'src', 'plugins', 'workspace', this.code, db.client.config.connection.database)
|
|
165
|
+
|
|
166
|
+
if (!fs.existsSync(workdir)) {
|
|
167
|
+
fs.mkdirSync(workdir, { recursive: true })
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
fs.chmodSync(workdir, 0o700)
|
|
171
|
+
|
|
172
|
+
return workdir as DirectoryPath
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Create an instance of a plugin class and copy static fields into the instance.
|
|
177
|
+
* @param Class
|
|
178
|
+
* @param path
|
|
179
|
+
* @returns
|
|
180
|
+
*/
|
|
181
|
+
static create(Class: Constructor<BackendPlugin>, id: ID, path: FilePath, catalog: BackendCatalog): BackendPlugin {
|
|
182
|
+
const instance = new Class()
|
|
183
|
+
instance.id = id
|
|
184
|
+
instance.path = path
|
|
185
|
+
instance.catalog = catalog
|
|
186
|
+
return instance
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import { BackendPlugin } from './BackendPlugin'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A plugin providing mainly some kind of possibly frequently updated data source services.
|
|
6
|
+
* Data will be publicly available from API.
|
|
7
|
+
*/
|
|
8
|
+
export class DataPlugin extends BackendPlugin {
|
|
9
|
+
|
|
10
|
+
protected sources: string[]
|
|
11
|
+
|
|
12
|
+
constructor(...sources: string[]) {
|
|
13
|
+
super()
|
|
14
|
+
this.sources = sources
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Provide the public knowledge this plugin is providing.
|
|
19
|
+
*/
|
|
20
|
+
async getKnowledge(): Promise<Record<string, unknown>> {
|
|
21
|
+
const result = {}
|
|
22
|
+
for (const source of this.sources) {
|
|
23
|
+
const filePath = this.filePath(`${source}.json`)
|
|
24
|
+
const data = JSON.parse(fs.readFileSync(filePath).toString('utf-8'))
|
|
25
|
+
Object.assign(result, { [source]: data })
|
|
26
|
+
}
|
|
27
|
+
return result
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { log } from '@dataplug/tasenor-common'
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import { TransactionImportHandler } from '../import/TransactionImportHandler'
|
|
4
|
+
import { TransactionUI } from '../import/TransactionUI'
|
|
5
|
+
import { BackendPlugin } from './BackendPlugin'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A plugin providing import services for one or more file formats.
|
|
9
|
+
*/
|
|
10
|
+
export class ImportPlugin extends BackendPlugin {
|
|
11
|
+
|
|
12
|
+
private handler: TransactionImportHandler
|
|
13
|
+
private UI: TransactionUI
|
|
14
|
+
|
|
15
|
+
constructor(handler: TransactionImportHandler) {
|
|
16
|
+
super()
|
|
17
|
+
this.handler = handler
|
|
18
|
+
this.UI = handler.UI
|
|
19
|
+
// This class is used as its own for translations. Let us initialize it.
|
|
20
|
+
this.languages = this.getLanguages()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get common translations for all import plugins.
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
getLanguages() {
|
|
28
|
+
return {
|
|
29
|
+
en: {
|
|
30
|
+
'account-debt-currency': 'Account for recording debt in {asset} currency',
|
|
31
|
+
'account-deposit-currency': 'Account for depositing {asset} currency',
|
|
32
|
+
'account-deposit-external': 'Account for external deposit source for {asset}',
|
|
33
|
+
'account-distribution-currency': 'Account to pay our {asset} dividends from',
|
|
34
|
+
'account-distribution-statement': 'Account to record our dividend payments for {asset}',
|
|
35
|
+
'account-dividend-currency': 'Account for recording received {asset} dividends',
|
|
36
|
+
'account-expense-currency': 'Account for expenses in {asset} currency',
|
|
37
|
+
'account-expense-statement': 'Account for recording expense {asset}',
|
|
38
|
+
'account-fee-currency': 'Account for fees in {asset} currency',
|
|
39
|
+
'account-fee-crypto': 'Account for fees in {asset} crypto currency',
|
|
40
|
+
'account-forex-currency': 'Account for {asset} foreign exchange',
|
|
41
|
+
'account-income-currency': 'Account for income in {asset} currency',
|
|
42
|
+
'account-income-statement': 'Account for recording income {asset}',
|
|
43
|
+
'account-investment-currency': 'Account for receiving investments in {asset} currency',
|
|
44
|
+
'account-investment-statement': 'Account for recording investment {asset}',
|
|
45
|
+
'account-tax-currency': 'Account for recording tax in currency {asset}',
|
|
46
|
+
'account-tax-statement': 'Account for tax statament {asset}',
|
|
47
|
+
'account-trade-crypto': 'Account for trading crypto currency {asset}',
|
|
48
|
+
'account-trade-stock': 'Account for trading stocks {asset}',
|
|
49
|
+
'account-trade-currency': 'Account for using currency {asset} for trading',
|
|
50
|
+
'account-transfer-currency': 'Account for transferring currency {asset}',
|
|
51
|
+
'account-transfer-external': 'Account for transferring to/from external source {asset}',
|
|
52
|
+
'account-withdrawal-currency': 'Account for withdrawing currency {asset}',
|
|
53
|
+
'account-withdrawal-external': 'Account for withdrawing from external source {asset}',
|
|
54
|
+
'asset-type-crypto': 'a crypto currency',
|
|
55
|
+
'asset-type-currency': 'a currency',
|
|
56
|
+
'asset-type-external': 'an external instance',
|
|
57
|
+
'asset-type-statement': 'a statement recording',
|
|
58
|
+
'asset-type-stock': 'a stock exchange traded asset',
|
|
59
|
+
'asset-type-short': 'a short position',
|
|
60
|
+
'import-text-buy': 'Buy {takeAmount} {takeAsset}',
|
|
61
|
+
'import-text-correction': '{name}',
|
|
62
|
+
'import-text-deposit': 'Deposit to {exchange} service',
|
|
63
|
+
'import-text-distribution': '{name}',
|
|
64
|
+
'import-text-dividend': 'Dividend {asset}',
|
|
65
|
+
'import-text-expense': '{name}',
|
|
66
|
+
'import-text-forex': 'Sell currency {giveAsset} for {takeAsset}',
|
|
67
|
+
'import-text-income': '{name}',
|
|
68
|
+
'import-text-investment': '{name}',
|
|
69
|
+
'import-text-sell': 'Sell {giveAmount} {giveAsset}',
|
|
70
|
+
'import-text-short-buy': 'Closing short position {takeAmount} {takeAsset}',
|
|
71
|
+
'import-text-short-sell': 'Short selling {giveAmount} {giveAsset}',
|
|
72
|
+
'import-text-tax': '{name}',
|
|
73
|
+
'import-text-trade': 'Trade {giveAmount} {giveAsset} {takeAmount} {takeAsset}',
|
|
74
|
+
'import-text-transfer': '{service} transfer',
|
|
75
|
+
'import-text-withdrawal': 'Withdrawal from {exchange} service',
|
|
76
|
+
'reason-deposit': 'deposit',
|
|
77
|
+
'reason-dividend': 'payment',
|
|
78
|
+
'reason-expense': 'expense',
|
|
79
|
+
'reason-fee': 'fee',
|
|
80
|
+
'reason-forex': 'exchange',
|
|
81
|
+
'reason-income': 'income',
|
|
82
|
+
'reason-trade': 'trading',
|
|
83
|
+
'reason-transfer': 'transfers',
|
|
84
|
+
'reason-withdrawal': 'withdrawal',
|
|
85
|
+
'note-split': 'Split',
|
|
86
|
+
'note-converted': 'Converted',
|
|
87
|
+
'note-spinoff': 'Spinoff',
|
|
88
|
+
'note-renamed': 'Renamed',
|
|
89
|
+
'note-old-name': 'Old name',
|
|
90
|
+
'note-new-name': 'New name',
|
|
91
|
+
'note-renaming': 'Renaming'
|
|
92
|
+
},
|
|
93
|
+
fi: {
|
|
94
|
+
'account-debt-currency': 'Tili veloille valuutassa {asset}',
|
|
95
|
+
'account-deposit-currency': 'Tili valuutan {asset} talletuksille',
|
|
96
|
+
'account-deposit-external': 'Vastatili ulkoisille talletuksille {asset}',
|
|
97
|
+
'account-distribution-currency': 'Tili, josta maksetaan {asset} osingot',
|
|
98
|
+
'account-distribution-statement': 'Raportointitili, johon kirjataan maksettavat osingot {asset}',
|
|
99
|
+
'account-dividend-currency': 'Tili saaduista {asset} osingoista',
|
|
100
|
+
'account-expense-currency': 'Tili kuluille {asset} valuutassa',
|
|
101
|
+
'account-expense-statement': 'Raportointitili {asset} kuluille',
|
|
102
|
+
'account-fee-currency': 'Tili käyttömaksuille {asset} valuutassa',
|
|
103
|
+
'account-fee-crypto': 'Tili käyttömaksuille {asset} kryptovaluutassa',
|
|
104
|
+
'account-forex-currency': 'Valuutanvaihtotili {asset} valuutalle',
|
|
105
|
+
'account-income-currency': 'Tili tuloille {asset} valuutassa',
|
|
106
|
+
'account-income-statement': 'Raportointitili {asset} tuloille',
|
|
107
|
+
'account-investment-currency': 'Tili saaduille sijoituksille {asset} valuutassa',
|
|
108
|
+
'account-investment-statement': 'Raportointitili sijoituksille {asset}',
|
|
109
|
+
'account-tax-currency': 'Verot {asset} valuutassa',
|
|
110
|
+
'account-tax-statement': 'Raportointitili veroille {asset}',
|
|
111
|
+
'account-trade-crypto': 'Vaihto-omaisuustili {asset} kryptovaluutalle',
|
|
112
|
+
'account-trade-stock': 'Vaihto-omaisuustili {asset} osakkeelle',
|
|
113
|
+
'account-trade-currency': 'Valuuttatili {asset} valuutalle vaihto-omaisuuden hankintaan',
|
|
114
|
+
'account-transfer-currency': 'Siirtotili {asset} valuutalle',
|
|
115
|
+
'account-transfer-external': 'Siirtotili ulkoiseen kohteeseen {asset}',
|
|
116
|
+
'account-withdrawal-currency': 'Nostotili {asset} valuutalle',
|
|
117
|
+
'account-withdrawal-external': 'Vastatili {asset} nostoille',
|
|
118
|
+
'asset-type-crypto': 'kryptovaluutta',
|
|
119
|
+
'asset-type-currency': 'valuutta',
|
|
120
|
+
'asset-type-external': 'ulkopuolinen instanssi',
|
|
121
|
+
'asset-type-statement': 'raportointi',
|
|
122
|
+
'asset-type-stock': 'osake tai vastaava',
|
|
123
|
+
'asset-type-short': 'lyhyeksi myyty positio',
|
|
124
|
+
'Do you want to import also currency deposits here?': 'Haluatko tuoda myös valuuttojen talletukset tänne?',
|
|
125
|
+
'Do you want to import also currency withdrawals here?': 'Haluatko tuoda myös valuuttojen nostot tänne?',
|
|
126
|
+
'import-text-buy': 'Osto {takeAmount} {takeAsset}',
|
|
127
|
+
'import-text-correction': '{name}',
|
|
128
|
+
'import-text-deposit': 'Talletus {exchange}-palveluun',
|
|
129
|
+
'import-text-distribution': '{name}',
|
|
130
|
+
'import-text-dividend': 'Osinko {asset}',
|
|
131
|
+
'import-text-expense': '{name}',
|
|
132
|
+
'import-text-forex': 'Valuutanvaihto',
|
|
133
|
+
'import-text-income': '{name}',
|
|
134
|
+
'import-text-investment': '{name}',
|
|
135
|
+
'import-text-sell': 'Myynti {giveAmount} {giveAsset}',
|
|
136
|
+
'import-text-short-buy': 'Suljettu lyhyeksimyynti {takeAmount} {takeAsset}',
|
|
137
|
+
'import-text-short-sell': 'Lyhyeksimyynti {giveAmount} {giveAsset}',
|
|
138
|
+
'import-text-tax': '{name}',
|
|
139
|
+
'import-text-trade': 'Vaihto {giveAmount} {giveAsset} {takeAmount} {takeAsset}',
|
|
140
|
+
'import-text-transfer': '{service} siirto',
|
|
141
|
+
'import-text-withdrawal': 'Nosto {exchange}-palvelusta',
|
|
142
|
+
'Parsing error in expression `{expr}`: {message}': 'Virhe laskukaavassa `{expr}`: {message}',
|
|
143
|
+
'reason-deposit': 'talletus',
|
|
144
|
+
'reason-dividend': 'maksu',
|
|
145
|
+
'reason-expense': 'meno',
|
|
146
|
+
'reason-fee': 'kulu',
|
|
147
|
+
'reason-forex': 'vaihto',
|
|
148
|
+
'reason-income': 'tulo',
|
|
149
|
+
'reason-trade': 'vaihdanta',
|
|
150
|
+
'reason-transfer': 'siirto',
|
|
151
|
+
'reason-withdrawal': 'nosto',
|
|
152
|
+
'Retried successfully': 'Uudelleenyritys onnistui',
|
|
153
|
+
'Retry failed': 'Uudelleenyritys ei onnistunut',
|
|
154
|
+
'Select one of the following:': 'Valitse yksi seuraavista:',
|
|
155
|
+
'Additional information needed': 'Tarvitaan lisätietoja',
|
|
156
|
+
'Based on the following imported lines': 'Seuraavien tuotujen rivien perusteella',
|
|
157
|
+
'Do you want to use the same account for all of them?': 'Haluatko käyttää samaa tiliä kaikille samanlaisille?',
|
|
158
|
+
Created: 'Luotuja',
|
|
159
|
+
Duplicates: 'Aiemmin luotuja',
|
|
160
|
+
Ignored: 'Väliinjätettyjä',
|
|
161
|
+
Skipped: 'Ohitettuja',
|
|
162
|
+
'Account Changes': 'Tilien muutokset',
|
|
163
|
+
'Process Was Successfully Completed!': 'Prosessointi saatu päätökseen onnistuneesti!',
|
|
164
|
+
'Do we allow short selling of assets?': 'Sallitaanko lyhyeksi myynti?',
|
|
165
|
+
January: 'tammikuu',
|
|
166
|
+
February: 'helmikuu',
|
|
167
|
+
March: 'maaliskuu',
|
|
168
|
+
April: 'huhtikuu',
|
|
169
|
+
May: 'toukokuu',
|
|
170
|
+
June: 'kesäkuu',
|
|
171
|
+
July: 'heinäkuu',
|
|
172
|
+
August: 'elokuu',
|
|
173
|
+
September: 'syyskuu',
|
|
174
|
+
October: 'lokakuu',
|
|
175
|
+
November: 'marraskuu',
|
|
176
|
+
December: 'joulukuu',
|
|
177
|
+
'note-split': 'splitti',
|
|
178
|
+
'note-converted': 'konvertoitu',
|
|
179
|
+
'note-spinoff': 'irtautuminen',
|
|
180
|
+
'note-renamed': 'uudelleennimeäminen',
|
|
181
|
+
'note-old-name': 'vanha nimi',
|
|
182
|
+
'note-new-name': 'uusi nimi',
|
|
183
|
+
'The account below has negative balance. If you want to record it to the separate debt account, please select another account below:': 'Tilillä {account} on negatiivinen saldo. Jos haluat kirjata negatiiviset saldot erilliselle velkatilille, valitse tili seuraavasta:',
|
|
184
|
+
'The date {date} falls outside of the period {firstDate} to {lastDate}.': 'Päivämäärä {date} on tilikauden {firstDate} - {lastDate} ulkopuolella.',
|
|
185
|
+
'What do we do with that kind of transactions?': 'Mitä tämänkaltaisille tapahtumille tulisi tehdä?',
|
|
186
|
+
'Ignore transaction': 'Jättää väliin',
|
|
187
|
+
'Halt with an error': 'Keskeyttää tuonti virheeseen',
|
|
188
|
+
'Is transaction fee of type {type} already included in the {reason} total?': 'Onko {reason}-tapahtumassa tyypin {type} kulut lisätty valmiiksi yhteissummaan?',
|
|
189
|
+
'Select contra account for imported transactions, i.e. cash account.': 'Valitse vastatili tuotaville tapahtumille (esim. kohteen käteistili).'
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Get instance of internal handler class.
|
|
196
|
+
* @returns
|
|
197
|
+
*/
|
|
198
|
+
getHandler(): TransactionImportHandler {
|
|
199
|
+
return this.handler
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Load and return default rules from the JSON-rules file.
|
|
204
|
+
* @returns
|
|
205
|
+
*/
|
|
206
|
+
getRules(): JSON {
|
|
207
|
+
const path = this.filePath('rules.json')
|
|
208
|
+
log(`Reading rules ${path}.`)
|
|
209
|
+
return JSON.parse(fs.readFileSync(path).toString('utf-8')).rules
|
|
210
|
+
}
|
|
211
|
+
}
|