@tasenor/common-node 1.12.0 → 1.13.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/dist/src/cli/cli.js.map +1 -1
- package/dist/src/cli/mini-util.d.ts +1 -1
- package/dist/src/cli/mini-util.js.map +1 -1
- package/dist/src/commands/account.js.map +1 -1
- package/dist/src/commands/balance.js.map +1 -1
- package/dist/src/commands/db.js.map +1 -1
- package/dist/src/commands/entry.js.map +1 -1
- package/dist/src/commands/import.js.map +1 -1
- package/dist/src/commands/importer.js +1 -1
- package/dist/src/commands/importer.js.map +1 -1
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/period.js.map +1 -1
- package/dist/src/commands/plugin.js.map +1 -1
- package/dist/src/commands/report.js.map +1 -1
- package/dist/src/commands/settings.js.map +1 -1
- package/dist/src/commands/stock.js.map +1 -1
- package/dist/src/commands/tag.js.map +1 -1
- package/dist/src/commands/tx.js.map +1 -1
- package/dist/src/commands/user.js.map +1 -1
- package/dist/src/data/csv.d.ts +5 -0
- package/dist/src/data/csv.js +28 -0
- package/dist/src/data/csv.js.map +1 -0
- package/dist/src/data/index.d.ts +1 -0
- package/dist/src/data/index.js +1 -0
- package/dist/src/data/index.js.map +1 -1
- package/dist/src/data/utils.js.map +1 -1
- package/dist/src/database/BookkeeperImporter.d.ts +1 -0
- package/dist/src/database/BookkeeperImporter.js +13 -12
- package/dist/src/database/BookkeeperImporter.js.map +1 -1
- package/dist/src/database/DB.js +2 -1
- package/dist/src/database/DB.js.map +1 -1
- package/dist/src/export/Exporter.d.ts +2 -2
- package/dist/src/export/Exporter.js +0 -2
- package/dist/src/export/Exporter.js.map +1 -1
- package/dist/src/export/TasenorExporter.js.map +1 -1
- package/dist/src/export/TilitinExporter.js.map +1 -1
- package/dist/src/import/TextFileProcessHandler.js +2 -2
- package/dist/src/import/TextFileProcessHandler.js.map +1 -1
- package/dist/src/import/TransactionImportConnector.js.map +1 -1
- package/dist/src/import/TransactionImportHandler.d.ts +4 -26
- package/dist/src/import/TransactionImportHandler.js +8 -27
- package/dist/src/import/TransactionImportHandler.js.map +1 -1
- package/dist/src/import/TransactionRules.d.ts +1 -172
- package/dist/src/import/TransactionRules.js +8 -172
- package/dist/src/import/TransactionRules.js.map +1 -1
- package/dist/src/import/TransactionUI.js +16 -2
- package/dist/src/import/TransactionUI.js.map +1 -1
- package/dist/src/import/TransferAnalyzer.js +27 -6
- package/dist/src/import/TransferAnalyzer.js.map +1 -1
- package/dist/src/net/git.d.ts +10 -1
- package/dist/src/net/git.js +45 -13
- package/dist/src/net/git.js.map +1 -1
- package/dist/src/net/middleware.js.map +1 -1
- package/dist/src/net/tokens.js.map +1 -1
- package/dist/src/net/vault.js.map +1 -1
- package/dist/src/plugins/BackendPlugin.d.ts +1 -1
- package/dist/src/plugins/BackendPlugin.js.map +1 -1
- package/dist/src/plugins/DataPlugin.js.map +1 -1
- package/dist/src/plugins/ImportPlugin.d.ts +4 -1
- package/dist/src/plugins/ImportPlugin.js +2 -0
- package/dist/src/plugins/ImportPlugin.js.map +1 -1
- package/dist/src/plugins/LanguageBackendPlugin.d.ts +15 -0
- package/dist/src/plugins/LanguageBackendPlugin.js +18 -0
- package/dist/src/plugins/LanguageBackendPlugin.js.map +1 -0
- package/dist/src/plugins/ReportPlugin.d.ts +8 -3
- package/dist/src/plugins/ReportPlugin.js +38 -4
- package/dist/src/plugins/ReportPlugin.js.map +1 -1
- package/dist/src/plugins/ServicePlugin.js.map +1 -1
- package/dist/src/plugins/index.d.ts +1 -0
- package/dist/src/plugins/index.js +1 -0
- package/dist/src/plugins/index.js.map +1 -1
- package/dist/src/plugins/plugins.d.ts +2 -2
- package/dist/src/plugins/plugins.js +27 -5
- package/dist/src/plugins/plugins.js.map +1 -1
- package/dist/src/process/Process.js +4 -4
- package/dist/src/process/Process.js.map +1 -1
- package/dist/src/process/ProcessFile.js.map +1 -1
- package/dist/src/process/ProcessHandler.d.ts +0 -6
- package/dist/src/process/ProcessStep.js.map +1 -1
- package/dist/src/process/ProcessingSystem.d.ts +2 -8
- package/dist/src/process/ProcessingSystem.js +17 -31
- package/dist/src/process/ProcessingSystem.js.map +1 -1
- package/dist/src/reports/conversions.js +0 -3
- package/dist/src/reports/conversions.js.map +1 -1
- package/dist/src/server/ISPDemoServer.js.map +1 -1
- package/dist/src/server/api.js.map +1 -1
- package/dist/src/server/index.d.ts +1 -0
- package/dist/src/server/index.js +1 -0
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/router.js.map +1 -1
- package/dist/src/server/server.d.ts +11 -0
- package/dist/src/server/server.js +39 -0
- package/dist/src/server/server.js.map +1 -0
- package/dist/src/system.d.ts +1 -1
- package/dist/src/system.js +8 -3
- package/dist/src/system.js.map +1 -1
- package/package.json +26 -27
- package/src/cli/mini-util.ts +6 -6
- package/src/commands/importer.ts +1 -1
- package/src/commands/index.ts +1 -1
- package/src/database/DB.ts +3 -1
- package/src/export/Exporter.ts +5 -7
- package/src/import/TransactionImportHandler.ts +9 -27
- package/src/import/TransactionRules.ts +8 -172
- package/src/import/TransactionUI.ts +16 -2
- package/src/import/TransferAnalyzer.ts +38 -7
- package/src/plugins/BackendPlugin.ts +1 -1
- package/src/plugins/ImportPlugin.ts +2 -2
- package/src/plugins/LanguageBackendPlugin.ts +22 -0
- package/src/plugins/ReportPlugin.ts +40 -4
- package/src/plugins/index.ts +1 -0
- package/src/process/Process.ts +4 -4
- package/src/process/ProcessHandler.ts +0 -7
- package/src/process/ProcessingSystem.ts +18 -31
- package/src/reports/conversions.ts +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Process } from './Process'
|
|
2
2
|
import { ProcessFile, ProcessFileData } from './ProcessFile'
|
|
3
3
|
import { ProcessStep } from './ProcessStep'
|
|
4
|
-
import { ProcessHandler
|
|
4
|
+
import { ProcessHandler } from './ProcessHandler'
|
|
5
5
|
import { ProcessConnector } from './ProcessConnector'
|
|
6
6
|
import { ProcessName, ProcessConfig, ID } from '@tasenor/common'
|
|
7
7
|
import { InvalidArgument } from '../error'
|
|
@@ -13,7 +13,7 @@ import { KnexDatabase } from '../database'
|
|
|
13
13
|
export class ProcessingSystem {
|
|
14
14
|
|
|
15
15
|
db: KnexDatabase
|
|
16
|
-
|
|
16
|
+
handler: ProcessHandler
|
|
17
17
|
connector: ProcessConnector
|
|
18
18
|
logger: {
|
|
19
19
|
info: (...msg) => void
|
|
@@ -54,14 +54,14 @@ export class ProcessingSystem {
|
|
|
54
54
|
if (!handler.name) {
|
|
55
55
|
throw new InvalidArgument('A handler without name cannot be registered.')
|
|
56
56
|
}
|
|
57
|
-
if (
|
|
58
|
-
throw new InvalidArgument(`The handler '${handler.name}' is already defined.`)
|
|
57
|
+
if (this.handler) {
|
|
58
|
+
throw new InvalidArgument(`The handler '${this.handler.name}' is already defined.`)
|
|
59
59
|
}
|
|
60
60
|
if (handler.name.length > 32) {
|
|
61
61
|
throw new InvalidArgument(`The handler name '${handler.name}' is too long.`)
|
|
62
62
|
}
|
|
63
63
|
handler.system = this
|
|
64
|
-
this.
|
|
64
|
+
this.handler = handler
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -90,23 +90,22 @@ export class ProcessingSystem {
|
|
|
90
90
|
|
|
91
91
|
// Find the handler.
|
|
92
92
|
let selectedHandler: ProcessHandler | null = null
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
selectedHandler = handler
|
|
103
|
-
break
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
const version = this.handler.canHandle(processFile)
|
|
96
|
+
if (version) {
|
|
97
|
+
if (version === true) {
|
|
98
|
+
this.handler.version = 1
|
|
99
|
+
} else {
|
|
100
|
+
this.handler.version = version
|
|
104
101
|
}
|
|
105
|
-
|
|
106
|
-
await process.crashed(err)
|
|
107
|
-
return process
|
|
102
|
+
selectedHandler = this.handler
|
|
108
103
|
}
|
|
104
|
+
} catch (err) {
|
|
105
|
+
await process.crashed(err)
|
|
106
|
+
return process
|
|
109
107
|
}
|
|
108
|
+
|
|
110
109
|
if (!selectedHandler) {
|
|
111
110
|
await process.crashed(new InvalidArgument(`No handler found for the file ${file.name} of type ${file.type}.`))
|
|
112
111
|
return process
|
|
@@ -183,18 +182,6 @@ export class ProcessingSystem {
|
|
|
183
182
|
await step.process.updateStatus()
|
|
184
183
|
}
|
|
185
184
|
|
|
186
|
-
/**
|
|
187
|
-
* Get the named handler or throw an error if not registered.
|
|
188
|
-
* @param name
|
|
189
|
-
* @returns
|
|
190
|
-
*/
|
|
191
|
-
getHandler(name: string): ProcessHandler {
|
|
192
|
-
if (!(name in this.handlers)) {
|
|
193
|
-
throw new InvalidArgument(`There is no handler for '${name}'.`)
|
|
194
|
-
}
|
|
195
|
-
return this.handlers[name]
|
|
196
|
-
}
|
|
197
|
-
|
|
198
185
|
/**
|
|
199
186
|
* Load the process data from the disk.
|
|
200
187
|
* @param id
|