fix(core): Fix concurrency and download handling in HandelsRegister class and adjust test cases

This commit is contained in:
Philipp Kunz 2025-01-07 05:06:16 +01:00
parent a19be31381
commit ec2d4f9fbc
7 changed files with 166 additions and 116 deletions

View File

@ -1,5 +1,13 @@
# Changelog
## 2025-01-07 - 1.4.2 - fix(core)
Fix concurrency and download handling in HandelsRegister class and adjust test cases
- Improved the clickFindButton function to include an argument for results limit.
- Enhanced the downloadFile function to rename and ensure files are correctly handled.
- Updated searchCompany method to allow specifying a limit on the number of search results.
- Adjusted test cases to select specific test data indices and output test files to a dedicated directory.
## 2025-01-04 - 1.4.1 - fix(core)
Fix issues with JSONL data processing and improve error handling in business record validation

View File

@ -19,7 +19,7 @@
"@git.zone/tsrun": "^1.3.3",
"@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.5.4",
"@types/node": "^22.10.4"
"@types/node": "^22.10.5"
},
"dependencies": {
"@push.rocks/lik": "^6.1.0",
@ -29,9 +29,9 @@
"@push.rocks/smartbrowser": "^2.0.8",
"@push.rocks/smartdata": "^5.2.10",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile": "^11.0.23",
"@push.rocks/smartfile": "^11.1.5",
"@push.rocks/smartpath": "^5.0.18",
"@push.rocks/smartpromise": "^4.0.4",
"@push.rocks/smartpromise": "^4.1.0",
"@push.rocks/smartrequest": "^2.0.23",
"@push.rocks/smartstream": "^3.2.5",
"@push.rocks/smartunique": "^3.0.9",

200
pnpm-lock.yaml generated
View File

@ -30,14 +30,14 @@ importers:
specifier: ^3.0.5
version: 3.0.5
'@push.rocks/smartfile':
specifier: ^11.0.23
version: 11.0.23
specifier: ^11.1.5
version: 11.1.5
'@push.rocks/smartpath':
specifier: ^5.0.18
version: 5.0.18
'@push.rocks/smartpromise':
specifier: ^4.0.4
version: 4.0.4
specifier: ^4.1.0
version: 4.1.0
'@push.rocks/smartrequest':
specifier: ^2.0.23
version: 2.0.23
@ -70,8 +70,8 @@ importers:
specifier: ^5.5.4
version: 5.5.4(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0))(@aws-sdk/credential-providers@3.716.0(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0)))(socks@2.8.3)
'@types/node':
specifier: ^22.10.4
version: 22.10.4
specifier: ^22.10.5
version: 22.10.5
packages:
@ -801,8 +801,8 @@ packages:
'@push.rocks/smartfile@10.0.41':
resolution: {integrity: sha512-xOOy0duI34M2qrJZggpk51EHGXmg9+mBL1Q55tNiQKXzfx89P3coY1EAZG8tvmep3qB712QEKe7T+u04t42Kjg==}
'@push.rocks/smartfile@11.0.23':
resolution: {integrity: sha512-+tP/ydhNapve/bVDGMoloZmB6eBFvamHVx5uP05GLCKh0KFffNJuMKTHX4DgC0y3BmNm+Bii7jhpQblY+R99kQ==}
'@push.rocks/smartfile@11.1.5':
resolution: {integrity: sha512-N+f7P4MqgkDiPR5CrvzMJF9JVtXQK1Di24cYAd8roFkDVpnILlLQOQql558FPm2QE+HtDLuPLPBu2uaSZRLReA==}
'@push.rocks/smartguard@3.1.0':
resolution: {integrity: sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==}
@ -864,8 +864,8 @@ packages:
'@push.rocks/smartpdf@3.1.8':
resolution: {integrity: sha512-9fxshJAp6VCkrAFWXAFS7X7QzZLFSWM/JzDtllYW7gaWzRKxsMCdfaNy1vKsGq5uK5L91Lrd+A9Olp1mx4xs1w==}
'@push.rocks/smartpromise@4.0.4':
resolution: {integrity: sha512-Mbh+DnX4+rVPEZgYU7LtTJI/AYoNn7+h27AycEFpPJW41DCfjTiXiI0+ecNdyO1AfbcL0Q02RQjoEauEWx5FQg==}
'@push.rocks/smartpromise@4.1.0':
resolution: {integrity: sha512-1E4QZx1bYFMEgbK1C9gb4CB3YRhfkvSeffc5CnT83n7NV4Qly/Sxe9G1Jn0sQBB5+sbFHwTlj/0al5+q4gXiDw==}
'@push.rocks/smartpuppeteer@2.0.2':
resolution: {integrity: sha512-EcYCT0PX++WjfHp7W5UYX3t8x5gSNpJMMUvhA7SHz8b2t76ItslNWxprRcF0CUQyN1fozbf5StZf7dwdGc/dIA==}
@ -1455,8 +1455,8 @@ packages:
'@types/node-forge@1.3.11':
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
'@types/node@22.10.4':
resolution: {integrity: sha512-99l6wv4HEzBQhvaU/UGoeBoCK61SCROQaCCGyQSgX2tEQ3rKkNZ2S7CEWnS/4s1LV+8ODdK21UeyR1fHP2mXug==}
'@types/node@22.10.5':
resolution: {integrity: sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==}
'@types/parse5@6.0.3':
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
@ -4184,7 +4184,7 @@ snapshots:
'@push.rocks/smartbuffer': 3.0.4
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartguard': 3.1.0
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/webrequest': 3.0.37
'@push.rocks/webstream': 1.0.10
@ -4200,7 +4200,7 @@ snapshots:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartenv': 5.0.12
'@push.rocks/smartfeed': 1.0.11
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartlog-destination-devtools': 1.0.12
@ -4211,7 +4211,7 @@ snapshots:
'@push.rocks/smartntml': 2.0.8
'@push.rocks/smartopen': 2.0.0
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrequest': 2.0.23
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smartsitemap': 2.0.3
@ -4877,7 +4877,7 @@ snapshots:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartmarkdown': 3.0.3
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrouter': 1.3.2
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smartstate': 2.0.19
@ -5057,10 +5057,10 @@ snapshots:
'@push.rocks/early': 4.0.4
'@push.rocks/smartcli': 4.0.11
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
typescript: 5.6.3
transitivePeerDependencies:
- aws-crt
@ -5070,11 +5070,11 @@ snapshots:
'@push.rocks/early': 4.0.4
'@push.rocks/smartcli': 4.0.11
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartlog-destination-local': 9.0.2
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartspawn': 3.0.3
'@types/html-minifier': 4.0.5
esbuild: 0.24.2
@ -5087,7 +5087,7 @@ snapshots:
dependencies:
'@push.rocks/smartcli': 4.0.11
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartnpm': 2.0.4
'@push.rocks/smartpath': 5.0.18
@ -5097,7 +5097,7 @@ snapshots:
'@git.zone/tsrun@1.3.3':
dependencies:
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartshell': 3.2.2
tsx: 4.19.2
@ -5109,9 +5109,9 @@ snapshots:
'@push.rocks/consolecolor': 2.0.2
'@push.rocks/smartbrowser': 2.0.8
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartshell': 3.2.2
'@push.rocks/tapbundle': 5.5.4(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0))(@aws-sdk/credential-providers@3.716.0(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0)))(socks@2.8.3)
'@types/ws': 8.5.13
@ -5160,7 +5160,7 @@ snapshots:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/yargs': 17.0.33
chalk: 4.1.2
@ -5282,7 +5282,7 @@ snapshots:
'@push.rocks/early@4.0.4':
dependencies:
'@push.rocks/consolecolor': 2.0.2
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/isohash@2.0.1':
dependencies:
@ -5298,10 +5298,10 @@ snapshots:
'@push.rocks/smartcache': 1.0.16
'@push.rocks/smartenv': 5.0.12
'@push.rocks/smartexit': 1.0.23
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartstring': 4.0.15
'@push.rocks/smartunique': 3.0.9
'@push.rocks/taskbuffer': 3.1.7
@ -5313,7 +5313,7 @@ snapshots:
dependencies:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartmatch': 2.0.0
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smarttime': 4.1.1
'@types/minimatch': 5.1.2
@ -5337,7 +5337,7 @@ snapshots:
dependencies:
'@api.global/typedrequest': 3.1.10
'@configvault.io/interfaces': 1.0.17
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartpath': 5.0.18
@ -5345,7 +5345,7 @@ snapshots:
dependencies:
'@push.rocks/smartfile': 10.0.41
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrequest': 2.0.23
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smartstream': 2.0.8
@ -5359,9 +5359,9 @@ snapshots:
'@push.rocks/smartarchive@4.0.39':
dependencies:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrequest': 2.0.23
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smartstream': 3.2.5
@ -5392,7 +5392,7 @@ snapshots:
'@aws-sdk/client-s3': 3.717.0
'@push.rocks/smartmime': 2.0.4
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smartstream': 3.2.5
'@push.rocks/smartstring': 4.0.15
@ -5416,7 +5416,7 @@ snapshots:
'@push.rocks/smartchok@1.0.34':
dependencies:
'@push.rocks/lik': 6.1.0
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@tempfix/watcher': 2.3.0
@ -5425,13 +5425,13 @@ snapshots:
'@push.rocks/lik': 6.1.0
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartobject': 1.0.12
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
yargs-parser: 21.1.1
'@push.rocks/smartcrypto@2.0.4':
dependencies:
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@types/node-forge': 1.3.11
node-forge: 1.3.1
@ -5441,7 +5441,7 @@ snapshots:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartmongo': 2.0.10(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0))(@aws-sdk/credential-providers@3.716.0(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0)))(socks@2.8.3)
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smartstring': 4.0.15
'@push.rocks/smarttime': 4.1.1
@ -5463,23 +5463,23 @@ snapshots:
'@push.rocks/smartdelay@3.0.5':
dependencies:
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartenv@5.0.12':
dependencies:
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartexit@1.0.23':
dependencies:
'@push.rocks/lik': 6.1.0
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
tree-kill: 1.2.2
'@push.rocks/smartexpect@1.4.0':
dependencies:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
fast-deep-equal: 3.1.3
'@push.rocks/smartfeed@1.0.11':
@ -5499,7 +5499,7 @@ snapshots:
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartmime': 1.0.6
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrequest': 2.0.23
'@push.rocks/smartstream': 2.0.8
'@types/fs-extra': 11.0.4
@ -5509,7 +5509,7 @@ snapshots:
glob: 10.4.5
js-yaml: 4.1.0
'@push.rocks/smartfile@11.0.23':
'@push.rocks/smartfile@11.1.5':
dependencies:
'@push.rocks/lik': 6.1.0
'@push.rocks/smartdelay': 3.0.5
@ -5518,7 +5518,7 @@ snapshots:
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartmime': 2.0.4
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrequest': 2.0.23
'@push.rocks/smartstream': 3.2.5
'@types/fs-extra': 11.0.4
@ -5530,13 +5530,13 @@ snapshots:
'@push.rocks/smartguard@3.1.0':
dependencies:
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrequest': 2.0.23
'@push.rocks/smarthash@3.0.4':
dependencies:
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@types/through2': 2.0.41
through2: 4.0.2
@ -5555,7 +5555,7 @@ snapshots:
dependencies:
'@push.rocks/consolecolor': 2.0.2
'@push.rocks/smartlog-interfaces': 3.0.2
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartlog-interfaces@3.0.2':
dependencies:
@ -5604,7 +5604,7 @@ snapshots:
'@push.rocks/mongodump': 1.0.8(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0))
'@push.rocks/smartdata': 5.2.10(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0))(@aws-sdk/credential-providers@3.716.0(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0)))(socks@2.8.3)
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
mongodb-memory-server: 8.16.1(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0))
transitivePeerDependencies:
- '@aws-sdk/client-sso-oidc'
@ -5635,7 +5635,7 @@ snapshots:
'@push.rocks/smartarchive': 3.0.8
'@push.rocks/smartfile': 10.0.41
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrequest': 2.0.23
'@push.rocks/smarttime': 4.1.1
'@push.rocks/smartversion': 3.0.5
@ -5647,7 +5647,7 @@ snapshots:
dependencies:
'@design.estate/dees-element': 2.0.39
'@happy-dom/global-registrator': 15.11.7
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
fake-indexeddb: 6.0.0
transitivePeerDependencies:
- supports-color
@ -5667,10 +5667,10 @@ snapshots:
dependencies:
'@push.rocks/smartbuffer': 3.0.4
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartnetwork': 3.0.2
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartpuppeteer': 2.0.2
'@push.rocks/smartunique': 3.0.9
'@tsclass/tsclass': 4.2.0
@ -5685,7 +5685,7 @@ snapshots:
- supports-color
- utf-8-validate
'@push.rocks/smartpromise@4.0.4': {}
'@push.rocks/smartpromise@4.1.0': {}
'@push.rocks/smartpuppeteer@2.0.2':
dependencies:
@ -5701,7 +5701,7 @@ snapshots:
'@push.rocks/smartrequest@2.0.23':
dependencies:
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smarturl': 3.1.0
agentkeepalive: 4.6.0
form-data: 4.0.1
@ -5714,13 +5714,13 @@ snapshots:
'@push.rocks/smartrx@3.0.7':
dependencies:
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
rxjs: 7.8.1
'@push.rocks/smarts3@2.2.5':
dependencies:
'@push.rocks/smartbucket': 3.3.7
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartpath': 5.0.18
'@tsclass/tsclass': 4.2.0
'@types/s3rver': 3.7.4
@ -5733,7 +5733,7 @@ snapshots:
dependencies:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartexit': 1.0.23
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@types/which': 3.0.4
tree-kill: 1.2.2
which: 5.0.0
@ -5758,7 +5758,7 @@ snapshots:
'@push.rocks/smartenv': 5.0.12
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smarttime': 4.1.1
engine.io: 6.5.4
@ -5771,7 +5771,7 @@ snapshots:
'@push.rocks/smartspawn@3.0.3':
dependencies:
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
spawn-wrap: 2.0.0
threads: 1.7.0
tiny-worker: 2.3.0
@ -5783,13 +5783,13 @@ snapshots:
'@push.rocks/isohash': 2.0.1
'@push.rocks/lik': 6.1.0
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@push.rocks/webstore': 2.0.20
'@push.rocks/smartstream@2.0.8':
dependencies:
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@types/from2': 2.3.5
'@types/through2': 2.0.41
@ -5800,7 +5800,7 @@ snapshots:
dependencies:
'@push.rocks/lik': 6.1.0
'@push.rocks/smartenv': 5.0.12
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smartstring@4.0.15':
@ -5818,7 +5818,7 @@ snapshots:
dependencies:
'@push.rocks/lik': 6.1.0
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
croner: 9.0.0
date-fns: 4.1.0
dayjs: 1.11.13
@ -5857,11 +5857,11 @@ snapshots:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartenv': 5.0.12
'@push.rocks/smartexpect': 1.4.0
'@push.rocks/smartfile': 11.0.23
'@push.rocks/smartfile': 11.1.5
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartmongo': 2.0.10(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0))(@aws-sdk/credential-providers@3.716.0(@aws-sdk/client-sso-oidc@3.716.0(@aws-sdk/client-sts@3.716.0)))(socks@2.8.3)
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrequest': 2.0.23
'@push.rocks/smarts3': 2.2.5
'@push.rocks/smartshell': 3.2.2
@ -5886,7 +5886,7 @@ snapshots:
'@push.rocks/lik': 6.1.0
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartlog': 3.0.7
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@push.rocks/smarttime': 4.1.1
'@push.rocks/smartunique': 3.0.9
@ -5896,7 +5896,7 @@ snapshots:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartenv': 5.0.12
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/webstore': 2.0.20
'@push.rocks/websetup@3.0.19':
@ -5911,7 +5911,7 @@ snapshots:
'@push.rocks/lik': 6.1.0
'@push.rocks/smartenv': 5.0.12
'@push.rocks/smartjson': 5.0.20
'@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartpromise': 4.1.0
'@push.rocks/smartrx': 3.0.7
'@tempfix/idb': 8.0.3
fake-indexeddb: 5.0.2
@ -6473,14 +6473,14 @@ snapshots:
'@types/accepts@1.3.7':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/babel__code-frame@7.0.6': {}
'@types/body-parser@1.19.5':
dependencies:
'@types/connect': 3.4.38
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/buffer-json@2.0.3': {}
@ -6496,17 +6496,17 @@ snapshots:
'@types/clean-css@4.2.11':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
source-map: 0.6.1
'@types/co-body@6.1.3':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/qs': 6.9.17
'@types/connect@3.4.38':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/content-disposition@0.5.8': {}
@ -6519,11 +6519,11 @@ snapshots:
'@types/connect': 3.4.38
'@types/express': 5.0.0
'@types/keygrip': 1.0.6
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/cors@2.8.17':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/debounce@1.2.4': {}
@ -6537,14 +6537,14 @@ snapshots:
'@types/express-serve-static-core@4.19.6':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/qs': 6.9.17
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
'@types/express-serve-static-core@5.0.3':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/qs': 6.9.17
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@ -6569,30 +6569,30 @@ snapshots:
'@types/from2@2.3.5':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/fs-extra@11.0.4':
dependencies:
'@types/jsonfile': 6.1.4
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/fs-extra@9.0.13':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/glob@7.2.0':
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/glob@8.1.0':
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/gunzip-maybe@1.4.2':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/hast@3.0.4':
dependencies:
@ -6626,7 +6626,7 @@ snapshots:
'@types/jsonfile@6.1.4':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/keygrip@1.0.6': {}
@ -6643,7 +6643,7 @@ snapshots:
'@types/http-errors': 2.0.4
'@types/keygrip': 1.0.6
'@types/koa-compose': 3.2.8
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/mdast@4.0.4':
dependencies:
@ -6661,9 +6661,9 @@ snapshots:
'@types/node-forge@1.3.11':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/node@22.10.4':
'@types/node@22.10.5':
dependencies:
undici-types: 6.20.0
@ -6681,19 +6681,19 @@ snapshots:
'@types/s3rver@3.7.4':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/semver@7.5.8': {}
'@types/send@0.17.4':
dependencies:
'@types/mime': 1.3.5
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/serve-static@1.15.7':
dependencies:
'@types/http-errors': 2.0.4
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/send': 0.17.4
'@types/sinon-chai@3.2.12':
@ -6713,15 +6713,15 @@ snapshots:
'@types/tar-stream@2.2.3':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/tar-stream@3.1.3':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/through2@2.0.41':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/triple-beam@1.3.5': {}
@ -6745,7 +6745,7 @@ snapshots:
'@types/whatwg-url@8.2.2':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/webidl-conversions': 7.0.3
'@types/which@2.0.2': {}
@ -6754,11 +6754,11 @@ snapshots:
'@types/ws@7.4.7':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/ws@8.5.13':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
'@types/yargs-parser@21.0.3': {}
@ -6768,7 +6768,7 @@ snapshots:
'@types/yauzl@2.10.3':
dependencies:
'@types/node': 22.10.4
'@types/node': 22.10.5
optional: true
'@ungap/structured-clone@1.2.1': {}
@ -7353,7 +7353,7 @@ snapshots:
dependencies:
'@types/cookie': 0.4.1
'@types/cors': 2.8.17
'@types/node': 22.10.4
'@types/node': 22.10.5
accepts: 1.3.8
base64id: 2.0.0
cookie: 0.4.2
@ -8061,7 +8061,7 @@ snapshots:
jest-util@29.7.0:
dependencies:
'@jest/types': 29.6.3
'@types/node': 22.10.4
'@types/node': 22.10.5
chalk: 4.1.2
ci-info: 3.9.0
graceful-fs: 4.2.11

View File

@ -1,6 +1,11 @@
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import { tapNodeTools } from '@push.rocks/tapbundle/node';
import * as opendata from '../ts/index.js'
import { BusinessRecord } from '../ts/classes.businessrecord.js';
let testOpenDataInstance: opendata.OpenData;
tap.test('first test', async () => {
@ -12,22 +17,28 @@ tap.test('should start the instance', async () => {
await testOpenDataInstance.start();
})
tap.test('should build initial data', async () => {
tap.skip.test('should build initial data', async () => {
await testOpenDataInstance.buildInitialDb();
});
const resultsSearch = tap.test('should get the data for a company', async () => {
const result = await testOpenDataInstance.handelsregister.searchCompany('Volkswagen');
const result = await testOpenDataInstance.handelsregister.searchCompany('Volkswagen', 20);
console.log(result);
return result;
});
tap.test('should get the data for a specific company', async () => {
const testCompany = (await resultsSearch.testResultPromise)[21]['germanParsedRegistration'];
let testCompany: BusinessRecord['data']['germanParsedRegistration'] = (await resultsSearch.testResultPromise)[8]['germanParsedRegistration'];
console.log(`trying to find specific company with:`);
console.log(testCompany);
const result = await testOpenDataInstance.handelsregister.getSpecificCompany(testCompany);
console.log(result);
result.files.map(async (file) => {
await file.writeToDir('./.nogit/testoutput');
});
});
tap.test('should stop the instance', async () => {

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@fin.cx/opendata',
version: '1.4.1',
version: '1.4.2',
description: 'A TypeScript library for accessing, managing, and updating open business data, focused on German companies and integrating with MongoDB.'
}

View File

@ -5,6 +5,18 @@ export class BusinessRecord extends plugins.smartdata.SmartDataDbDoc<
BusinessRecord,
BusinessRecord
> {
// STATIC
public static getByGermanParsedRegistration = async (parsedGermanRegistrationArg: BusinessRecord['data']['germanParsedRegistration']) => {
const businessRecords = await BusinessRecord.getInstance({
data: {
germanParsedRegistration: parsedGermanRegistrationArg,
}
});
return businessRecords;
};
// INSTANCE
@plugins.smartdata.unI()
id: string;

View File

@ -113,13 +113,13 @@ export class HandelsRegister {
return businessRecords;
};
private clickFindButton = async (pageArg: plugins.smartbrowser.smartpuppeteer.puppeteer.Page) => {
private clickFindButton = async (pageArg: plugins.smartbrowser.smartpuppeteer.puppeteer.Page, resultsLimitArg: number = 100) => {
try {
// Wait for the button with the text "Find" to appear
await pageArg.waitForSelector('span.ui-button-text.ui-c', { timeout: 5000 });
// adjust to 100 results per page
await pageArg.select('#form\\:ergebnisseProSeite_input', '100');
await pageArg.select('#form\\:ergebnisseProSeite_input', `${resultsLimitArg}`);
// Locate and click the button using its text
await pageArg.evaluate(() => {
@ -183,14 +183,24 @@ export class HandelsRegister {
}
}, typeArg);
// Wait a bit for the download to complete (you might want to implement
// a more robust file-exists check or a wait-for-download library)
await pageArg.waitForTimeout(10000);
await plugins.smartfile.fs.waitForFileToBeReady(this.uniqueDowloadFolder);
const files = await plugins.smartfile.fs.fileTreeToObject(this.uniqueDowloadFolder, '**/*');
await plugins.smartfile.fs.ensureEmptyDir(this.uniqueDowloadFolder);
const file = files[0];
return files [0];
// lets clear the folder for the next download
await plugins.smartfile.fs.ensureEmptyDir(this.uniqueDowloadFolder);
switch (typeArg) {
case 'AD':
await file.rename(`ad.pdf`);
break;
case 'SI':
await file.rename(`si.xml`);
break;
break;
}
return file;
}
/**
@ -216,7 +226,7 @@ export class HandelsRegister {
/**
* Search for a company by name and return basic info
*/
public async searchCompany(companyNameArg: string) {
public async searchCompany(companyNameArg: string, resultsLimitArg: number = 100) {
return this.asyncExecutionStack.getExclusiveExecutionSlot(async () => {
const page = await this.getNewPage();
await this.navigateToPage(page, 'Normal search');
@ -261,7 +271,7 @@ export class HandelsRegister {
console.error('Failed to find or click the radio button:', error);
}
await this.clickFindButton(page);
await this.clickFindButton(page, resultsLimitArg);
const businessRecords = await this.waitForResults(page);
@ -336,4 +346,13 @@ export class HandelsRegister {
};
}, 60000);
}
/**
* get specific company by full name
*/
public async getSpecificCompanyByName(companyNameArg: string) {
const businessRecords = await this.searchCompany(companyNameArg, 1);
const result = this.getSpecificCompany(businessRecords[0].germanParsedRegistration);
return result;
}
}