czech-data-box 0.1.0 → 0.1.2
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/.github/workflows/tests.yml +39 -0
- package/README.md +2 -2
- package/package.json +3 -3
- package/src/index.js +2 -1
- package/src/lib/config.js +8 -1
- package/src/models/DataBox.js +78 -26
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
# This workflow runs standard unit tests to ensure basic integrity and avoid
|
|
4
|
+
# regressions on pull-requests (and pushes)
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main # allthough master is push protected we still keep it
|
|
10
|
+
- develop
|
|
11
|
+
pull_request: # runs on all PR
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
unittest:
|
|
15
|
+
name: unit tests
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
node: [18, 20, 22]
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout ${{ matrix.node }}
|
|
22
|
+
uses: actions/Checkout@v3
|
|
23
|
+
|
|
24
|
+
- name: Setup node ${{ matrix.node }}
|
|
25
|
+
uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version: ${{ matrix.node }}
|
|
28
|
+
|
|
29
|
+
- name: Cache dependencies ${{ matrix.node }}
|
|
30
|
+
uses: actions/cache@v3
|
|
31
|
+
with:
|
|
32
|
+
path: ~/.npm
|
|
33
|
+
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
|
|
34
|
+
restore-keys: |
|
|
35
|
+
${{ runner.os }}-node-${{ matrix.node }}
|
|
36
|
+
- name: Install dependencies
|
|
37
|
+
run: npm install
|
|
38
|
+
- run: npm run lint
|
|
39
|
+
- run: npm run test
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Czech Data Box Library
|
|
2
2
|
|
|
3
|
-
⭐ Star
|
|
3
|
+
⭐ Star this project on GitHub — it motivates us a lot!
|
|
4
4
|
|
|
5
5
|
A library that provides access to the Information Services Data System (ISDS) interface for third-party applications in Node.js
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ This library is used for basic communication with the Information System for Dat
|
|
|
10
10
|
|
|
11
11
|
### Installation
|
|
12
12
|
|
|
13
|
-
`npm install
|
|
13
|
+
`npm install czech-data-box`
|
|
14
14
|
|
|
15
15
|
### Basic usage
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "czech-data-box",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
7
|
+
"node": ">=18.0.0"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"lint": "eslint .",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"description": "A Node.js module for interacting with the Czech Data Box system (ISDS).",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/martinkrivda/czech-data-box.git"
|
|
29
|
+
"url": "git+https://github.com/martinkrivda/czech-data-box.git"
|
|
30
30
|
},
|
|
31
31
|
"bugs": {
|
|
32
32
|
"url": "https://github.com/martinkrivda/czech-data-box/issues"
|
package/src/index.js
CHANGED
package/src/lib/config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// config.js
|
|
2
|
+
import os from 'os';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
|
|
4
5
|
export const DEBUG = false; // Set to true to enable debug mode globally
|
|
@@ -38,13 +39,19 @@ function getServiceURL(serviceType, loginType, productionMode) {
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
function getServiceWSDL(serviceType) {
|
|
41
|
-
|
|
42
|
+
let directory = path.join(
|
|
42
43
|
path.dirname(new URL(import.meta.url).pathname),
|
|
43
44
|
'..',
|
|
44
45
|
'..',
|
|
45
46
|
'resources',
|
|
46
47
|
'wsdl',
|
|
47
48
|
);
|
|
49
|
+
|
|
50
|
+
// Adjust the path for Windows
|
|
51
|
+
if (os.platform() === 'win32') {
|
|
52
|
+
directory = directory.slice(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
switch (serviceType) {
|
|
49
56
|
case 0:
|
|
50
57
|
return path.join(directory, 'dm_operations.wsdl');
|
package/src/models/DataBox.js
CHANGED
|
@@ -5,132 +5,184 @@ class DataBox {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
setDbId(value) {
|
|
8
|
-
|
|
8
|
+
if (typeof value !== 'undefined') {
|
|
9
|
+
this.dbOwnerInfo.dbID = value;
|
|
10
|
+
}
|
|
9
11
|
return this;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
setDbType(value) {
|
|
13
|
-
|
|
15
|
+
if (typeof value !== 'undefined') {
|
|
16
|
+
this.dbOwnerInfo.dbType = value;
|
|
17
|
+
}
|
|
14
18
|
return this;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
setIc(value) {
|
|
18
|
-
|
|
22
|
+
if (typeof value !== 'undefined') {
|
|
23
|
+
this.dbOwnerInfo.ic = value;
|
|
24
|
+
}
|
|
19
25
|
return this;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
setPnFirstName(value) {
|
|
23
|
-
|
|
29
|
+
if (typeof value !== 'undefined') {
|
|
30
|
+
this.dbOwnerInfo.pnFirstName = value;
|
|
31
|
+
}
|
|
24
32
|
return this;
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
setPnMiddleName(value) {
|
|
28
|
-
|
|
36
|
+
if (typeof value !== 'undefined') {
|
|
37
|
+
this.dbOwnerInfo.pnMiddleName = value;
|
|
38
|
+
}
|
|
29
39
|
return this;
|
|
30
40
|
}
|
|
31
41
|
|
|
32
42
|
setPnLastName(value) {
|
|
33
|
-
|
|
43
|
+
if (typeof value !== 'undefined') {
|
|
44
|
+
this.dbOwnerInfo.pnLastName = value;
|
|
45
|
+
}
|
|
34
46
|
return this;
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
setPnLastNameAtBirth(value) {
|
|
38
|
-
|
|
50
|
+
if (typeof value !== 'undefined') {
|
|
51
|
+
this.dbOwnerInfo.pnLastNameAtBirth = value;
|
|
52
|
+
}
|
|
39
53
|
return this;
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
setFirmName(value) {
|
|
43
|
-
|
|
57
|
+
if (typeof value !== 'undefined') {
|
|
58
|
+
this.dbOwnerInfo.firmName = value;
|
|
59
|
+
}
|
|
44
60
|
return this;
|
|
45
61
|
}
|
|
46
62
|
|
|
47
63
|
setBiDate(value) {
|
|
48
|
-
|
|
64
|
+
if (typeof value !== 'undefined') {
|
|
65
|
+
this.dbOwnerInfo.biDate = value;
|
|
66
|
+
}
|
|
49
67
|
return this;
|
|
50
68
|
}
|
|
51
69
|
|
|
52
70
|
setBiCity(value) {
|
|
53
|
-
|
|
71
|
+
if (typeof value !== 'undefined') {
|
|
72
|
+
this.dbOwnerInfo.biCity = value;
|
|
73
|
+
}
|
|
54
74
|
return this;
|
|
55
75
|
}
|
|
56
76
|
|
|
57
77
|
setBiCounty(value) {
|
|
58
|
-
|
|
78
|
+
if (typeof value !== 'undefined') {
|
|
79
|
+
this.dbOwnerInfo.biCounty = value;
|
|
80
|
+
}
|
|
59
81
|
return this;
|
|
60
82
|
}
|
|
61
83
|
|
|
62
84
|
setBiState(value) {
|
|
63
|
-
|
|
85
|
+
if (typeof value !== 'undefined') {
|
|
86
|
+
this.dbOwnerInfo.biState = value;
|
|
87
|
+
}
|
|
64
88
|
return this;
|
|
65
89
|
}
|
|
66
90
|
|
|
67
91
|
setAdCity(value) {
|
|
68
|
-
|
|
92
|
+
if (typeof value !== 'undefined') {
|
|
93
|
+
this.dbOwnerInfo.adCity = value;
|
|
94
|
+
}
|
|
69
95
|
return this;
|
|
70
96
|
}
|
|
71
97
|
|
|
72
98
|
setAdStreet(value) {
|
|
73
|
-
|
|
99
|
+
if (typeof value !== 'undefined') {
|
|
100
|
+
this.dbOwnerInfo.adStreet = value;
|
|
101
|
+
}
|
|
74
102
|
return this;
|
|
75
103
|
}
|
|
76
104
|
|
|
77
105
|
setAdNumberInStreet(value) {
|
|
78
|
-
|
|
106
|
+
if (typeof value !== 'undefined') {
|
|
107
|
+
this.dbOwnerInfo.adNumberInStreet = value;
|
|
108
|
+
}
|
|
79
109
|
return this;
|
|
80
110
|
}
|
|
81
111
|
|
|
82
112
|
setAdNumberInMunicipality(value) {
|
|
83
|
-
|
|
113
|
+
if (typeof value !== 'undefined') {
|
|
114
|
+
this.dbOwnerInfo.adNumberInMunicipality = value;
|
|
115
|
+
}
|
|
84
116
|
return this;
|
|
85
117
|
}
|
|
86
118
|
|
|
87
119
|
setAdZipCode(value) {
|
|
88
|
-
|
|
120
|
+
if (typeof value !== 'undefined') {
|
|
121
|
+
this.dbOwnerInfo.adZipCode = value;
|
|
122
|
+
}
|
|
89
123
|
return this;
|
|
90
124
|
}
|
|
91
125
|
|
|
92
126
|
setAdState(value) {
|
|
93
|
-
|
|
127
|
+
if (typeof value !== 'undefined') {
|
|
128
|
+
this.dbOwnerInfo.adState = value;
|
|
129
|
+
}
|
|
94
130
|
return this;
|
|
95
131
|
}
|
|
96
132
|
|
|
97
133
|
setNationality(value) {
|
|
98
|
-
|
|
134
|
+
if (typeof value !== 'undefined') {
|
|
135
|
+
this.dbOwnerInfo.nationality = value;
|
|
136
|
+
}
|
|
99
137
|
return this;
|
|
100
138
|
}
|
|
101
139
|
|
|
102
140
|
setEmail(value) {
|
|
103
|
-
|
|
141
|
+
if (typeof value !== 'undefined') {
|
|
142
|
+
this.dbOwnerInfo.email = value;
|
|
143
|
+
}
|
|
104
144
|
return this;
|
|
105
145
|
}
|
|
106
146
|
|
|
107
147
|
setTelNumber(value) {
|
|
108
|
-
|
|
148
|
+
if (typeof value !== 'undefined') {
|
|
149
|
+
this.dbOwnerInfo.telNumber = value;
|
|
150
|
+
}
|
|
109
151
|
return this;
|
|
110
152
|
}
|
|
111
153
|
|
|
112
154
|
setIdentifier(value) {
|
|
113
|
-
|
|
155
|
+
if (typeof value !== 'undefined') {
|
|
156
|
+
this.dbOwnerInfo.identifier = value;
|
|
157
|
+
}
|
|
114
158
|
return this;
|
|
115
159
|
}
|
|
116
160
|
|
|
117
161
|
setRegistryCode(value) {
|
|
118
|
-
|
|
162
|
+
if (typeof value !== 'undefined') {
|
|
163
|
+
this.dbOwnerInfo.registryCode = value;
|
|
164
|
+
}
|
|
119
165
|
return this;
|
|
120
166
|
}
|
|
121
167
|
|
|
122
168
|
setDbState(value) {
|
|
123
|
-
|
|
169
|
+
if (typeof value !== 'undefined') {
|
|
170
|
+
this.dbOwnerInfo.dbState = value;
|
|
171
|
+
}
|
|
124
172
|
return this;
|
|
125
173
|
}
|
|
126
174
|
|
|
127
175
|
setDbEffectiveOVM(value) {
|
|
128
|
-
|
|
176
|
+
if (typeof value !== 'undefined') {
|
|
177
|
+
this.dbOwnerInfo.dbEffectiveOVM = value;
|
|
178
|
+
}
|
|
129
179
|
return this;
|
|
130
180
|
}
|
|
131
181
|
|
|
132
182
|
setDbOpenAddressing(value) {
|
|
133
|
-
|
|
183
|
+
if (typeof value !== 'undefined') {
|
|
184
|
+
this.dbOwnerInfo.dbOpenAddressing = value;
|
|
185
|
+
}
|
|
134
186
|
return this;
|
|
135
187
|
}
|
|
136
188
|
|