itoolkit 1.0.0-rc.1 → 1.0.1
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 +37 -11
- package/CHANGELOG.md +76 -2
- package/README.md +8 -8
- package/lib/Connection.js +0 -1
- package/lib/Deprecated.js +3 -4
- package/lib/ProgramCall.js +2 -2
- package/lib/transports/httpTransport.js +2 -2
- package/lib/transports/idbTransport.js +23 -11
- package/lib/transports/odbcTransport.js +16 -2
- package/lib/transports/sshTransport.js +4 -5
- package/package.json +15 -14
- package/test/README.md +2 -4
- package/test/functional/CommandCallFunctional.js +20 -12
- package/test/functional/ProgramCallFunctional.js +6 -66
- package/test/functional/checkObjectExists.js +12 -1
- package/test/functional/checkVersion.js +17 -0
- package/test/functional/deprecated/commandsFunctional.js +20 -11
- package/test/functional/deprecated/iDataQueueFunctional.js +10 -11
- package/test/functional/deprecated/iNetworkFunctional.js +8 -9
- package/test/functional/deprecated/iObjFunctional.js +18 -19
- package/test/functional/deprecated/iPgmFunctional.js +6 -42
- package/test/functional/deprecated/iProdFunctional.js +10 -11
- package/test/functional/deprecated/iSqlFunctional.js +30 -32
- package/test/functional/deprecated/iUserSpaceFunctional.js +29 -18
- package/test/functional/deprecated/iWorkFunctional.js +61 -59
- package/test/functional/iDataQueueFunctional.js +8 -9
- package/test/functional/iNetworkFunctional.js +6 -8
- package/test/functional/iObjFunctional.js +16 -17
- package/test/functional/iProdFunctional.js +8 -9
- package/test/functional/iSqlFunctional.js +30 -31
- package/test/functional/iUserSpaceFunctional.js +27 -16
- package/test/functional/iWorkFunctional.js +29 -33
- package/test/unit/CommandCallUnit.js +10 -11
- package/test/unit/ConnectionUnit.js +12 -19
- package/test/unit/ProgamCallUnit.js +27 -25
- package/test/unit/deprecated/commandsUnit.js +10 -11
- package/test/unit/deprecated/iConnUnit.js +12 -16
- package/test/unit/deprecated/iPgmUnit.js +25 -21
- package/test/unit/deprecated/iSqlUnit.js +69 -70
- package/test/unit/deprecated/xmlToJsonUnit.js +6 -9
- package/docs/CommandCall.rst +0 -22
- package/docs/Connection.rst +0 -133
- package/docs/Makefile +0 -20
- package/docs/ProgramCall.rst +0 -30
- package/docs/conf.py +0 -63
- package/docs/deprecated/examples/addQuery.js +0 -27
- package/docs/deprecated/examples/addToLibraryList.js +0 -15
- package/docs/deprecated/examples/callProcedure.js +0 -28
- package/docs/deprecated/examples/clearDataQueue.js +0 -15
- package/docs/deprecated/examples/createUserSpace.js +0 -15
- package/docs/deprecated/examples/deleteUserSpace.js +0 -15
- package/docs/deprecated/examples/getDataArea.js +0 -15
- package/docs/deprecated/examples/getInstalledProducts.js +0 -15
- package/docs/deprecated/examples/getJobInfo.js +0 -15
- package/docs/deprecated/examples/getJobStatus.js +0 -15
- package/docs/deprecated/examples/getNetInterfaceData.js +0 -15
- package/docs/deprecated/examples/getPTFInfo.js +0 -15
- package/docs/deprecated/examples/getProductInfo.js +0 -15
- package/docs/deprecated/examples/getSysStatus.js +0 -15
- package/docs/deprecated/examples/getSysStatusExt.js +0 -15
- package/docs/deprecated/examples/getSysValue.js +0 -15
- package/docs/deprecated/examples/getTCPIPAttr.js +0 -15
- package/docs/deprecated/examples/getUserSpaceData.js +0 -15
- package/docs/deprecated/examples/receiveFromDataQueue.js +0 -15
- package/docs/deprecated/examples/retrCmdInfo.js +0 -15
- package/docs/deprecated/examples/retrPgmInfo.js +0 -15
- package/docs/deprecated/examples/retrSrvPgmInfo.js +0 -16
- package/docs/deprecated/examples/retrUserAuthToObj.js +0 -15
- package/docs/deprecated/examples/retrUserInfo.js +0 -15
- package/docs/deprecated/examples/retrUsrAuth.js +0 -15
- package/docs/deprecated/examples/sendToDataQueue.js +0 -15
- package/docs/deprecated/examples/setUserSpaceData.js +0 -15
- package/docs/deprecated/iCmd.rst +0 -7
- package/docs/deprecated/iConn.rst +0 -9
- package/docs/deprecated/iDataQueue.rst +0 -33
- package/docs/deprecated/iNetwork.rst +0 -27
- package/docs/deprecated/iObj.rst +0 -64
- package/docs/deprecated/iPgm.rst +0 -9
- package/docs/deprecated/iProd.rst +0 -36
- package/docs/deprecated/iQsh.rst +0 -7
- package/docs/deprecated/iSh.rst +0 -7
- package/docs/deprecated/iSql.rst +0 -30
- package/docs/deprecated/iUserSpace.rst +0 -38
- package/docs/deprecated/iWork.rst +0 -58
- package/docs/deprecated.rst +0 -21
- package/docs/examples/cosine.js +0 -27
- package/docs/examples/qusrobjd.js +0 -80
- package/docs/examples/rtvjoba.js +0 -24
- package/docs/features.rst +0 -12
- package/docs/index.rst +0 -71
- package/docs/migratation-guide-v1.0.rst +0 -325
- package/docs/requirements.txt +0 -1
|
@@ -15,22 +15,21 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
22
21
|
const { iSql } = require('../../../lib/itoolkit');
|
|
23
22
|
|
|
24
|
-
describe('iSql Class Unit Tests', ()
|
|
25
|
-
describe('constructor', ()
|
|
26
|
-
it('creates returns an instance of iSql', ()
|
|
23
|
+
describe('iSql Class Unit Tests', function () {
|
|
24
|
+
describe('constructor', function () {
|
|
25
|
+
it('creates returns an instance of iSql', function () {
|
|
27
26
|
const sql = new iSql();
|
|
28
27
|
|
|
29
28
|
expect(sql).to.be.instanceOf(iSql);
|
|
30
29
|
});
|
|
31
30
|
});
|
|
32
|
-
describe('toXML', ()
|
|
33
|
-
it('returns current sql XML', ()
|
|
31
|
+
describe('toXML', function () {
|
|
32
|
+
it('returns current sql XML', function () {
|
|
34
33
|
const sql = new iSql();
|
|
35
34
|
|
|
36
35
|
const expectedXML = '<sql></sql>';
|
|
@@ -38,8 +37,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
38
37
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
39
38
|
});
|
|
40
39
|
});
|
|
41
|
-
describe('addQuery', ()
|
|
42
|
-
it('appends query with error is on to sql XML', ()
|
|
40
|
+
describe('addQuery', function () {
|
|
41
|
+
it('appends query with error is on to sql XML', function () {
|
|
43
42
|
const sql = new iSql();
|
|
44
43
|
|
|
45
44
|
const expectedXML = '<sql><query error=\'on\'>select * from QIWS.QCUSTCDT</query></sql>';
|
|
@@ -48,7 +47,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
48
47
|
|
|
49
48
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
50
49
|
});
|
|
51
|
-
it('appends query with options object to sql XML', ()
|
|
50
|
+
it('appends query with options object to sql XML', function () {
|
|
52
51
|
const sql = new iSql();
|
|
53
52
|
|
|
54
53
|
const expectedXML = '<sql><query error=\'fast\'>select * from QIWS.QCUSTCDT</query></sql>';
|
|
@@ -58,8 +57,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
58
57
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
59
58
|
});
|
|
60
59
|
});
|
|
61
|
-
describe('fetch', ()
|
|
62
|
-
it('appends fetch without options object to sql XML', ()
|
|
60
|
+
describe('fetch', function () {
|
|
61
|
+
it('appends fetch without options object to sql XML', function () {
|
|
63
62
|
const sql = new iSql();
|
|
64
63
|
|
|
65
64
|
const expectedXML = '<sql><fetch block=\'all\' desc=\'on\' error=\'fast\'></fetch></sql>';
|
|
@@ -67,7 +66,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
67
66
|
sql.fetch();
|
|
68
67
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
69
68
|
});
|
|
70
|
-
it('appends fetch with block is 10 to sql XML', ()
|
|
69
|
+
it('appends fetch with block is 10 to sql XML', function () {
|
|
71
70
|
const sql = new iSql();
|
|
72
71
|
|
|
73
72
|
const expectedXML = '<sql><fetch block=\'10\' desc=\'on\' error=\'fast\'></fetch></sql>';
|
|
@@ -75,7 +74,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
75
74
|
sql.fetch({ block: '10' });
|
|
76
75
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
77
76
|
});
|
|
78
|
-
it('appends fetch with desc is off to sql XML', ()
|
|
77
|
+
it('appends fetch with desc is off to sql XML', function () {
|
|
79
78
|
const sql = new iSql();
|
|
80
79
|
|
|
81
80
|
const expectedXML = '<sql><fetch block=\'all\' desc=\'off\' error=\'fast\'></fetch></sql>';
|
|
@@ -83,7 +82,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
83
82
|
sql.fetch({ desc: 'off' });
|
|
84
83
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
85
84
|
});
|
|
86
|
-
it('appends fetch with error is on to sql XML', ()
|
|
85
|
+
it('appends fetch with error is on to sql XML', function () {
|
|
87
86
|
const sql = new iSql();
|
|
88
87
|
|
|
89
88
|
const expectedXML = '<sql><fetch block=\'all\' desc=\'on\' error=\'on\'></fetch></sql>';
|
|
@@ -92,8 +91,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
92
91
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
93
92
|
});
|
|
94
93
|
});
|
|
95
|
-
describe('commit', ()
|
|
96
|
-
it('appends commit with action commit to sql XML', ()
|
|
94
|
+
describe('commit', function () {
|
|
95
|
+
it('appends commit with action commit to sql XML', function () {
|
|
97
96
|
const sql = new iSql();
|
|
98
97
|
|
|
99
98
|
const expectedXML = '<sql><commit action=\'commit\' error=\'fast\'></commit></sql>';
|
|
@@ -101,7 +100,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
101
100
|
sql.commit({ action: 'commit' });
|
|
102
101
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
103
102
|
});
|
|
104
|
-
it('appends commit with action rollback to sql XML', ()
|
|
103
|
+
it('appends commit with action rollback to sql XML', function () {
|
|
105
104
|
const sql = new iSql();
|
|
106
105
|
|
|
107
106
|
const expectedXML = '<sql><commit action=\'rollback\' error=\'fast\'></commit></sql>';
|
|
@@ -109,7 +108,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
109
108
|
sql.commit({ action: 'rollback' });
|
|
110
109
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
111
110
|
});
|
|
112
|
-
it('appends commit with default action to sql XML', ()
|
|
111
|
+
it('appends commit with default action to sql XML', function () {
|
|
113
112
|
const sql = new iSql();
|
|
114
113
|
|
|
115
114
|
const expectedXML = '<sql><commit action=\'commit\' error=\'fast\'></commit></sql>';
|
|
@@ -117,7 +116,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
117
116
|
sql.commit();
|
|
118
117
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
119
118
|
});
|
|
120
|
-
it('appends commit with error is on to sql XML', ()
|
|
119
|
+
it('appends commit with error is on to sql XML', function () {
|
|
121
120
|
const sql = new iSql();
|
|
122
121
|
|
|
123
122
|
const expectedXML = '<sql><commit action=\'commit\' error=\'on\'></commit></sql>';
|
|
@@ -126,8 +125,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
126
125
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
127
126
|
});
|
|
128
127
|
});
|
|
129
|
-
describe('prepare', ()
|
|
130
|
-
it('appends prepare to sql XML', ()
|
|
128
|
+
describe('prepare', function () {
|
|
129
|
+
it('appends prepare to sql XML', function () {
|
|
131
130
|
const sql = new iSql();
|
|
132
131
|
|
|
133
132
|
const expectedXML = '<sql><prepare error=\'fast\'>SELECT * FROM QIWS.QCUSTCDT WHERE BALDUE > ?</prepare></sql>';
|
|
@@ -135,7 +134,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
135
134
|
sql.prepare('SELECT * FROM QIWS.QCUSTCDT WHERE BALDUE > ?');
|
|
136
135
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
137
136
|
});
|
|
138
|
-
it('appends prepare with error on to sql XML', ()
|
|
137
|
+
it('appends prepare with error on to sql XML', function () {
|
|
139
138
|
const sql = new iSql();
|
|
140
139
|
|
|
141
140
|
const expectedXML = '<sql><prepare error=\'on\'>SELECT * FROM QIWS.QCUSTCDT WHERE BALDUE > ?</prepare></sql>';
|
|
@@ -145,8 +144,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
145
144
|
});
|
|
146
145
|
});
|
|
147
146
|
|
|
148
|
-
describe('execute', ()
|
|
149
|
-
it('appends execute with parameters to sql XML', ()
|
|
147
|
+
describe('execute', function () {
|
|
148
|
+
it('appends execute with parameters to sql XML', function () {
|
|
150
149
|
const sql = new iSql();
|
|
151
150
|
|
|
152
151
|
const expectedXML = '<sql><execute error=\'fast\'><parm io=\'in\'>30</parm></execute></sql>';
|
|
@@ -154,7 +153,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
154
153
|
sql.execute([[30, 'in']]);
|
|
155
154
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
156
155
|
});
|
|
157
|
-
it('appends execute with parameters and error on to sql XML', ()
|
|
156
|
+
it('appends execute with parameters and error on to sql XML', function () {
|
|
158
157
|
const sql = new iSql();
|
|
159
158
|
|
|
160
159
|
const expectedXML = '<sql><execute error=\'on\'><parm io=\'in\'>30</parm></execute></sql>';
|
|
@@ -162,7 +161,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
162
161
|
sql.execute([[30, 'in']], { error: 'on' });
|
|
163
162
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
164
163
|
});
|
|
165
|
-
it('appends execute without parameters to sql XML', ()
|
|
164
|
+
it('appends execute without parameters to sql XML', function () {
|
|
166
165
|
const sql = new iSql();
|
|
167
166
|
|
|
168
167
|
const expectedXML = '<sql><execute error=\'fast\'></execute></sql>';
|
|
@@ -170,7 +169,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
170
169
|
sql.execute();
|
|
171
170
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
172
171
|
});
|
|
173
|
-
it('appends execute without parameters and error on to sql XML', ()
|
|
172
|
+
it('appends execute without parameters and error on to sql XML', function () {
|
|
174
173
|
const sql = new iSql();
|
|
175
174
|
|
|
176
175
|
const expectedXML = '<sql><execute error=\'on\'></execute></sql>';
|
|
@@ -179,8 +178,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
179
178
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
180
179
|
});
|
|
181
180
|
});
|
|
182
|
-
describe('tables', ()
|
|
183
|
-
it('appends tables to sql XML', ()
|
|
181
|
+
describe('tables', function () {
|
|
182
|
+
it('appends tables to sql XML', function () {
|
|
184
183
|
const sql = new iSql();
|
|
185
184
|
|
|
186
185
|
const expectedXML = '<sql><tables error=\'fast\'><parm></parm><parm>QIWS</parm><parm></parm><parm></parm></tables></sql>';
|
|
@@ -188,7 +187,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
188
187
|
sql.tables(['', 'QIWS', '', '']);
|
|
189
188
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
190
189
|
});
|
|
191
|
-
it('appends tables with error on to sql XML', ()
|
|
190
|
+
it('appends tables with error on to sql XML', function () {
|
|
192
191
|
const sql = new iSql();
|
|
193
192
|
|
|
194
193
|
const expectedXML = '<sql><tables error=\'on\'><parm></parm><parm>QIWS</parm><parm></parm><parm></parm></tables></sql>';
|
|
@@ -197,8 +196,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
197
196
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
198
197
|
});
|
|
199
198
|
});
|
|
200
|
-
describe('tablePriv', ()
|
|
201
|
-
it('appends tablepriv to sql XML', ()
|
|
199
|
+
describe('tablePriv', function () {
|
|
200
|
+
it('appends tablepriv to sql XML', function () {
|
|
202
201
|
const sql = new iSql();
|
|
203
202
|
|
|
204
203
|
const expectedXML = '<sql><tablepriv error=\'fast\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm></tablepriv></sql>';
|
|
@@ -206,7 +205,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
206
205
|
sql.tablePriv(['', 'QIWS', 'QCUSTCDT']);
|
|
207
206
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
208
207
|
});
|
|
209
|
-
it('appends tablepriv with error on to sql XML', ()
|
|
208
|
+
it('appends tablepriv with error on to sql XML', function () {
|
|
210
209
|
const sql = new iSql();
|
|
211
210
|
|
|
212
211
|
const expectedXML = '<sql><tablepriv error=\'on\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm></tablepriv></sql>';
|
|
@@ -215,8 +214,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
215
214
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
216
215
|
});
|
|
217
216
|
});
|
|
218
|
-
describe('columns', ()
|
|
219
|
-
it('appends columns to sql XML', ()
|
|
217
|
+
describe('columns', function () {
|
|
218
|
+
it('appends columns to sql XML', function () {
|
|
220
219
|
const sql = new iSql();
|
|
221
220
|
|
|
222
221
|
const expectedXML = '<sql><columns error=\'fast\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm><parm></parm></columns></sql>';
|
|
@@ -224,7 +223,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
224
223
|
sql.columns(['', 'QIWS', 'QCUSTCDT', '']);
|
|
225
224
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
226
225
|
});
|
|
227
|
-
it('appends columns with error on to sql XML', ()
|
|
226
|
+
it('appends columns with error on to sql XML', function () {
|
|
228
227
|
const sql = new iSql();
|
|
229
228
|
|
|
230
229
|
const expectedXML = '<sql><columns error=\'on\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm><parm></parm></columns></sql>';
|
|
@@ -233,8 +232,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
233
232
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
234
233
|
});
|
|
235
234
|
});
|
|
236
|
-
describe('columnPriv', ()
|
|
237
|
-
it('appends columnpriv to sql XML', ()
|
|
235
|
+
describe('columnPriv', function () {
|
|
236
|
+
it('appends columnpriv to sql XML', function () {
|
|
238
237
|
const sql = new iSql();
|
|
239
238
|
|
|
240
239
|
const expectedXML = '<sql><columnpriv error=\'fast\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm><parm></parm></columnpriv></sql>';
|
|
@@ -242,7 +241,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
242
241
|
sql.columnPriv(['', 'QIWS', 'QCUSTCDT', '']);
|
|
243
242
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
244
243
|
});
|
|
245
|
-
it('appends columnpriv with error on to sql XML', ()
|
|
244
|
+
it('appends columnpriv with error on to sql XML', function () {
|
|
246
245
|
const sql = new iSql();
|
|
247
246
|
|
|
248
247
|
const expectedXML = '<sql><columnpriv error=\'on\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm><parm></parm></columnpriv></sql>';
|
|
@@ -251,8 +250,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
251
250
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
252
251
|
});
|
|
253
252
|
});
|
|
254
|
-
describe('procedures', ()
|
|
255
|
-
it('appends procedures to sql XML', ()
|
|
253
|
+
describe('procedures', function () {
|
|
254
|
+
it('appends procedures to sql XML', function () {
|
|
256
255
|
const sql = new iSql();
|
|
257
256
|
|
|
258
257
|
const expectedXML = '<sql><procedures error=\'fast\'><parm></parm><parm>QSYS2</parm><parm>TCPIP_INFO</parm></procedures></sql>';
|
|
@@ -260,7 +259,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
260
259
|
sql.procedures(['', 'QSYS2', 'TCPIP_INFO']);
|
|
261
260
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
262
261
|
});
|
|
263
|
-
it('appends procedures with error on to sql XML', ()
|
|
262
|
+
it('appends procedures with error on to sql XML', function () {
|
|
264
263
|
const sql = new iSql();
|
|
265
264
|
|
|
266
265
|
const expectedXML = '<sql><procedures error=\'on\'><parm></parm><parm>QSYS2</parm><parm>TCPIP_INFO</parm></procedures></sql>';
|
|
@@ -269,8 +268,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
269
268
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
270
269
|
});
|
|
271
270
|
});
|
|
272
|
-
describe('pColumns', ()
|
|
273
|
-
it('appends pColumns to sql XML', ()
|
|
271
|
+
describe('pColumns', function () {
|
|
272
|
+
it('appends pColumns to sql XML', function () {
|
|
274
273
|
// procedure columns:
|
|
275
274
|
const sql = new iSql();
|
|
276
275
|
|
|
@@ -279,7 +278,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
279
278
|
sql.pColumns(['', 'QSYS2', 'QCMDEXC', 'COMMAND']);
|
|
280
279
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
281
280
|
});
|
|
282
|
-
it('appends pColumns with error on to sql XML', ()
|
|
281
|
+
it('appends pColumns with error on to sql XML', function () {
|
|
283
282
|
// procedure columns:
|
|
284
283
|
const sql = new iSql();
|
|
285
284
|
|
|
@@ -289,8 +288,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
289
288
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
290
289
|
});
|
|
291
290
|
});
|
|
292
|
-
describe('primaryKeys', ()
|
|
293
|
-
it('appends primarykeys to sql XML', ()
|
|
291
|
+
describe('primaryKeys', function () {
|
|
292
|
+
it('appends primarykeys to sql XML', function () {
|
|
294
293
|
const sql = new iSql();
|
|
295
294
|
|
|
296
295
|
const expectedXML = '<sql><primarykeys error=\'fast\'><parm></parm><parm>QUSRSYS</parm><parm>QASZRAIRX</parm></primarykeys></sql>';
|
|
@@ -298,7 +297,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
298
297
|
sql.primaryKeys(['', 'QUSRSYS', 'QASZRAIRX']);
|
|
299
298
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
300
299
|
});
|
|
301
|
-
it('appends primarykeys with error on to sql XML', ()
|
|
300
|
+
it('appends primarykeys with error on to sql XML', function () {
|
|
302
301
|
const sql = new iSql();
|
|
303
302
|
|
|
304
303
|
const expectedXML = '<sql><primarykeys error=\'on\'><parm></parm><parm>QUSRSYS</parm><parm>QASZRAIRX</parm></primarykeys></sql>';
|
|
@@ -307,8 +306,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
307
306
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
308
307
|
});
|
|
309
308
|
});
|
|
310
|
-
describe('foreignKeys', ()
|
|
311
|
-
it('appends foreignkeys to sql XML', ()
|
|
309
|
+
describe('foreignKeys', function () {
|
|
310
|
+
it('appends foreignkeys to sql XML', function () {
|
|
312
311
|
const sql = new iSql();
|
|
313
312
|
|
|
314
313
|
const expectedXML = '<sql><foreignkeys error=\'fast\'><parm></parm><parm>QUSRSYS</parm><parm>QASZRAIRC</parm><parm></parm><parm>QUSRSYS</parm><parm>QASZRAIRX</parm></foreignkeys></sql>';
|
|
@@ -318,7 +317,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
318
317
|
sql.foreignKeys(['', 'QUSRSYS', 'QASZRAIRC', '', 'QUSRSYS', 'QASZRAIRX']);
|
|
319
318
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
320
319
|
});
|
|
321
|
-
it('appends foreignkeys with error on to sql XML', ()
|
|
320
|
+
it('appends foreignkeys with error on to sql XML', function () {
|
|
322
321
|
const sql = new iSql();
|
|
323
322
|
|
|
324
323
|
const expectedXML = '<sql><foreignkeys error=\'on\'><parm></parm><parm>QUSRSYS</parm><parm>QASZRAIRC</parm><parm></parm><parm>QUSRSYS</parm><parm>QASZRAIRX</parm></foreignkeys></sql>';
|
|
@@ -329,8 +328,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
329
328
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
330
329
|
});
|
|
331
330
|
});
|
|
332
|
-
describe('statistics', ()
|
|
333
|
-
it('appends statistics to sql XML', ()
|
|
331
|
+
describe('statistics', function () {
|
|
332
|
+
it('appends statistics to sql XML', function () {
|
|
334
333
|
const sql = new iSql();
|
|
335
334
|
|
|
336
335
|
const expectedXML = '<sql><statistics error=\'fast\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm><parm>all</parm></statistics></sql>';
|
|
@@ -338,7 +337,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
338
337
|
sql.statistics(['', 'QIWS', 'QCUSTCDT', 'all']);
|
|
339
338
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
340
339
|
});
|
|
341
|
-
it('appends statistics with error on to sql XML', ()
|
|
340
|
+
it('appends statistics with error on to sql XML', function () {
|
|
342
341
|
const sql = new iSql();
|
|
343
342
|
|
|
344
343
|
const expectedXML = '<sql><statistics error=\'on\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm><parm>all</parm></statistics></sql>';
|
|
@@ -347,8 +346,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
347
346
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
348
347
|
});
|
|
349
348
|
});
|
|
350
|
-
describe('special', ()
|
|
351
|
-
it('appends special to sql XML', ()
|
|
349
|
+
describe('special', function () {
|
|
350
|
+
it('appends special to sql XML', function () {
|
|
352
351
|
const sql = new iSql();
|
|
353
352
|
|
|
354
353
|
const expectedXML = '<sql><special error=\'fast\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm><parm>row</parm><parm>no</parm></special></sql>';
|
|
@@ -356,7 +355,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
356
355
|
sql.special(['', 'QIWS', 'QCUSTCDT', 'row', 'no']);
|
|
357
356
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
358
357
|
});
|
|
359
|
-
it('appends special with error on to sql XML', ()
|
|
358
|
+
it('appends special with error on to sql XML', function () {
|
|
360
359
|
const sql = new iSql();
|
|
361
360
|
|
|
362
361
|
const expectedXML = '<sql><special error=\'on\'><parm></parm><parm>QIWS</parm><parm>QCUSTCDT</parm><parm>row</parm><parm>no</parm></special></sql>';
|
|
@@ -365,22 +364,22 @@ describe('iSql Class Unit Tests', () => {
|
|
|
365
364
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
366
365
|
});
|
|
367
366
|
});
|
|
368
|
-
describe('count', ()
|
|
369
|
-
it('appends count to sql XML', ()
|
|
367
|
+
describe('count', function () {
|
|
368
|
+
it('appends count to sql XML', function () {
|
|
370
369
|
const sql = new iSql();
|
|
371
370
|
|
|
372
371
|
const expectedXML = '<sql><count desc=\'both\' error=\'fast\'></count></sql>';
|
|
373
372
|
sql.count({ desc: 'both' });
|
|
374
373
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
375
374
|
});
|
|
376
|
-
it('appends count without options object to sql XML', ()
|
|
375
|
+
it('appends count without options object to sql XML', function () {
|
|
377
376
|
const sql = new iSql();
|
|
378
377
|
|
|
379
378
|
const expectedXML = '<sql><count desc=\'both\' error=\'fast\'></count></sql>';
|
|
380
379
|
sql.count();
|
|
381
380
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
382
381
|
});
|
|
383
|
-
it('appends count with error on to sql XML', ()
|
|
382
|
+
it('appends count with error on to sql XML', function () {
|
|
384
383
|
const sql = new iSql();
|
|
385
384
|
|
|
386
385
|
const expectedXML = '<sql><count desc=\'both\' error=\'on\'></count></sql>';
|
|
@@ -388,15 +387,15 @@ describe('iSql Class Unit Tests', () => {
|
|
|
388
387
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
389
388
|
});
|
|
390
389
|
});
|
|
391
|
-
describe('rowCount', ()
|
|
392
|
-
it('appends rowcount to sql XML', ()
|
|
390
|
+
describe('rowCount', function () {
|
|
391
|
+
it('appends rowcount to sql XML', function () {
|
|
393
392
|
const sql = new iSql();
|
|
394
393
|
|
|
395
394
|
const expectedXML = '<sql><rowcount error=\'fast\'></rowcount></sql>';
|
|
396
395
|
sql.rowCount();
|
|
397
396
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
398
397
|
});
|
|
399
|
-
it('appends rowcount with error on to sql XML', ()
|
|
398
|
+
it('appends rowcount with error on to sql XML', function () {
|
|
400
399
|
const sql = new iSql();
|
|
401
400
|
|
|
402
401
|
const expectedXML = '<sql><rowcount error=\'on\'></rowcount></sql>';
|
|
@@ -404,8 +403,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
404
403
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
405
404
|
});
|
|
406
405
|
});
|
|
407
|
-
describe('free', ()
|
|
408
|
-
it('appends free to sql XML', ()
|
|
406
|
+
describe('free', function () {
|
|
407
|
+
it('appends free to sql XML', function () {
|
|
409
408
|
const sql = new iSql();
|
|
410
409
|
|
|
411
410
|
const expectedXML = '<sql><free></free></sql>';
|
|
@@ -413,8 +412,8 @@ describe('iSql Class Unit Tests', () => {
|
|
|
413
412
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
414
413
|
});
|
|
415
414
|
});
|
|
416
|
-
describe('describe', ()
|
|
417
|
-
it('appends describe to sql XML', ()
|
|
415
|
+
describe('describe', function () {
|
|
416
|
+
it('appends describe to sql XML', function () {
|
|
418
417
|
const sql = new iSql();
|
|
419
418
|
|
|
420
419
|
const expectedXML = '<sql><describe desc=\'both\' error=\'fast\'></describe></sql>';
|
|
@@ -422,7 +421,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
422
421
|
sql.describe({ desc: 'both' });
|
|
423
422
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
424
423
|
});
|
|
425
|
-
it('appends describe without options object to sql XML', ()
|
|
424
|
+
it('appends describe without options object to sql XML', function () {
|
|
426
425
|
const sql = new iSql();
|
|
427
426
|
|
|
428
427
|
const expectedXML = '<sql><describe desc=\'both\' error=\'fast\'></describe></sql>';
|
|
@@ -430,7 +429,7 @@ describe('iSql Class Unit Tests', () => {
|
|
|
430
429
|
sql.describe();
|
|
431
430
|
expect(sql.toXML()).to.equal(expectedXML);
|
|
432
431
|
});
|
|
433
|
-
it('appends describe with error on to sql XML', ()
|
|
432
|
+
it('appends describe with error on to sql XML', function () {
|
|
434
433
|
const sql = new iSql();
|
|
435
434
|
|
|
436
435
|
const expectedXML = '<sql><describe desc=\'both\' error=\'on\'></describe></sql>';
|
|
@@ -15,13 +15,11 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
|
-
|
|
20
18
|
const { expect } = require('chai');
|
|
21
19
|
const { xmlToJson } = require('../../../lib/itoolkit');
|
|
22
20
|
|
|
23
|
-
describe('xmlToJson Tests', ()
|
|
24
|
-
it('converts CL command XML output to js object', ()
|
|
21
|
+
describe('xmlToJson Tests', function () {
|
|
22
|
+
it('converts CL command XML output to js object', function () {
|
|
25
23
|
const xmlOut = '<?xml version=\'1.0\'?><myscript><cmd exec=\'rexx\' error=\'fast\'>'
|
|
26
24
|
+ '<success>+++ success RTVJOBA USRLIBL(?) SYSLIBL(?)</success>'
|
|
27
25
|
+ '<row><data desc=\'USRLIBL\'>QGPL QTEMP QDEVELOP QBLDSYS'
|
|
@@ -45,7 +43,7 @@ describe('xmlToJson Tests', () => {
|
|
|
45
43
|
expect(result[0].data[0]).to.haveOwnProperty('value').and.to.equal(value);
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
it('converts sh command XML output to js object', ()
|
|
46
|
+
it('converts sh command XML output to js object', function () {
|
|
49
47
|
const xmlOut = '<?xml version=\'1.0\'?><myscript><sh error=\'fast\'>\n'
|
|
50
48
|
+ 'bin\n'
|
|
51
49
|
+ 'ccs\n'
|
|
@@ -71,8 +69,7 @@ describe('xmlToJson Tests', () => {
|
|
|
71
69
|
expect(result[0]).to.haveOwnProperty('data').and.to.equal(data);
|
|
72
70
|
});
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
it('converts qsh command XML output to js object', () => {
|
|
72
|
+
it('converts qsh command XML output to js object', function () {
|
|
76
73
|
const xmlOut = '<?xml version=\'1.0\'?><myscript><qsh error=\'fast\'>\n'
|
|
77
74
|
+ 'bin\n'
|
|
78
75
|
+ 'ccs\n'
|
|
@@ -98,7 +95,7 @@ describe('xmlToJson Tests', () => {
|
|
|
98
95
|
expect(result[0]).to.haveOwnProperty('data').and.to.equal(data);
|
|
99
96
|
});
|
|
100
97
|
|
|
101
|
-
it('converts pgm command XML output to js object', ()
|
|
98
|
+
it('converts pgm command XML output to js object', function () {
|
|
102
99
|
const xmlOut = `<?xml version='1.0'?><myscript><pgm name='QWCRSVAL' lib='QSYS' error='fast'>
|
|
103
100
|
<parm io='out'>
|
|
104
101
|
<ds len='rec1'>
|
|
@@ -152,7 +149,7 @@ describe('xmlToJson Tests', () => {
|
|
|
152
149
|
});
|
|
153
150
|
});
|
|
154
151
|
|
|
155
|
-
it('converts sql command XML output to js object', ()
|
|
152
|
+
it('converts sql command XML output to js object', function () {
|
|
156
153
|
const xmlOut = `<?xml version='1.0'?><myscript><sql>
|
|
157
154
|
<query error='fast' conn='conn1' stmt='stmt1'>
|
|
158
155
|
<success><![CDATA[+++ success SELECT LSTNAM, STATE FROM QIWS.QCUSTCDT]]></success>
|
package/docs/CommandCall.rst
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.. _CommandCall:
|
|
2
|
-
|
|
3
|
-
Calling a Command
|
|
4
|
-
-----------------
|
|
5
|
-
|
|
6
|
-
CommandCall API
|
|
7
|
-
^^^^^^^^^^^^^^^
|
|
8
|
-
.. autoclass:: CommandCall
|
|
9
|
-
:members:
|
|
10
|
-
|
|
11
|
-
.. autofunction:: clOptions
|
|
12
|
-
.. autofunction:: shOptions
|
|
13
|
-
.. autofunction:: commandCallConfig
|
|
14
|
-
|
|
15
|
-
Example
|
|
16
|
-
^^^^^^^^
|
|
17
|
-
|
|
18
|
-
Call the RTVJOBA CL command
|
|
19
|
-
""""""""""""""""""""""""""""
|
|
20
|
-
|
|
21
|
-
.. literalinclude:: examples/rtvjoba.js
|
|
22
|
-
:language: javascript
|
package/docs/Connection.rst
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
.. _Connection:
|
|
2
|
-
|
|
3
|
-
Creating a Connection
|
|
4
|
-
=====================
|
|
5
|
-
|
|
6
|
-
Transports
|
|
7
|
-
----------
|
|
8
|
-
|
|
9
|
-
The ``Connection`` Class uses ``ODBC``, ``SSH``, ``idb``, and ``REST`` transports to access ``XMLSERVICE``.
|
|
10
|
-
Some transports require prerequisite setup. Learn morre about each transport below.
|
|
11
|
-
|
|
12
|
-
ODBC
|
|
13
|
-
^^^^
|
|
14
|
-
.. _guide: https://github.com/IBM/ibmi-oss-examples/blob/master/odbc/odbc.md#table-of-contents
|
|
15
|
-
|
|
16
|
-
The ODBC transport establishes a database connection and calls XMLSERVICE stored procedure.
|
|
17
|
-
Refer to the odbc guide_ for setup instructions.
|
|
18
|
-
|
|
19
|
-
SSH
|
|
20
|
-
^^^
|
|
21
|
-
The SSH transport executes ``xmlservice-cli`` program via ssh.
|
|
22
|
-
Install ``xmlservice-cli`` before using the ``SSH`` transport.
|
|
23
|
-
|
|
24
|
-
.. code-block:: bash
|
|
25
|
-
|
|
26
|
-
$ yum install itoolkit-utils
|
|
27
|
-
|
|
28
|
-
idb
|
|
29
|
-
^^^^
|
|
30
|
-
|
|
31
|
-
The idb transport establishes a database connection and calls the XMLSERVICE stored procedure.
|
|
32
|
-
|
|
33
|
-
**NOTE** the idb transport is only supported on an IBM i system.
|
|
34
|
-
|
|
35
|
-
REST
|
|
36
|
-
^^^^
|
|
37
|
-
The REST transport makes an HTTP request to an endpoint that process the XML input and returns XML output.
|
|
38
|
-
|
|
39
|
-
Initial configuration is required for the endpoint.
|
|
40
|
-
|
|
41
|
-
A quick example is to add the following to ``/www/apachedft/conf/httpd.conf``.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.. code-block:: apache
|
|
45
|
-
|
|
46
|
-
ScriptAlias /cgi-bin/ /QSYS.LIB/XMLSERVICE.LIB/
|
|
47
|
-
<Directory /QSYS.LIB/XMLSERVICE.LIB/>
|
|
48
|
-
AllowOverride None
|
|
49
|
-
Require all granted
|
|
50
|
-
SetHandler cgi-script
|
|
51
|
-
Options +ExecCGI
|
|
52
|
-
</Directory>
|
|
53
|
-
|
|
54
|
-
Connection API
|
|
55
|
-
--------------
|
|
56
|
-
|
|
57
|
-
.. autoclass:: Connection
|
|
58
|
-
:members:
|
|
59
|
-
|
|
60
|
-
.. autofunction:: connectionConfig
|
|
61
|
-
.. autofunction:: odbcOptions
|
|
62
|
-
.. autofunction:: sshOptions
|
|
63
|
-
.. autofunction:: idbOptions
|
|
64
|
-
.. autofunction:: restOptions
|
|
65
|
-
.. autofunction:: runCallback
|
|
66
|
-
|
|
67
|
-
Examples
|
|
68
|
-
--------
|
|
69
|
-
|
|
70
|
-
Creating a ``Connection`` using the ``ODBC`` tranport.
|
|
71
|
-
|
|
72
|
-
.. code-block:: js
|
|
73
|
-
|
|
74
|
-
const connection = new Connection({
|
|
75
|
-
transport: 'odbc',
|
|
76
|
-
transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword'}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
Creating a ``Connection`` using the ``ODBC`` tranport with a ``DSN``.
|
|
80
|
-
|
|
81
|
-
.. code-block:: js
|
|
82
|
-
|
|
83
|
-
const connection = new Connection({
|
|
84
|
-
transport: 'odbc',
|
|
85
|
-
transportOptions: { dsn: '*LOCAL'}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
Creating a ``Connection`` with ``ssh`` tranport using private key to authenticate.
|
|
89
|
-
|
|
90
|
-
.. code-block:: js
|
|
91
|
-
|
|
92
|
-
const connection = new Connection({
|
|
93
|
-
transport: 'ssh',
|
|
94
|
-
transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword' }
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
Creating a ``Connection`` using the ``ssh`` tranport with a private key to authenticate.
|
|
98
|
-
|
|
99
|
-
.. code-block:: js
|
|
100
|
-
|
|
101
|
-
const { readFileSync } = require('fs');
|
|
102
|
-
|
|
103
|
-
const privateKey = readFileSync('path/to/privateKey', 'utf-8');
|
|
104
|
-
|
|
105
|
-
// NOTE if your privateKey also requires a passphrase provide it
|
|
106
|
-
|
|
107
|
-
const connection = new Connection({
|
|
108
|
-
transport: 'ssh',
|
|
109
|
-
transportOptions: { host: 'myhost', username: 'myuser', privateKey, passphrase: 'myphrase' }
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
Creating a ``Connection`` using the ``idb`` tranport.
|
|
113
|
-
|
|
114
|
-
.. code-block:: js
|
|
115
|
-
|
|
116
|
-
const connection = new Connection({
|
|
117
|
-
transport: 'idb',
|
|
118
|
-
transportOptions: { database: '*LOCAL', username: 'myuser', password: 'mypass' }
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
Creating a ``Connection`` using the ``REST`` tranport.
|
|
122
|
-
|
|
123
|
-
.. code-block:: js
|
|
124
|
-
|
|
125
|
-
const connection = new Connection({
|
|
126
|
-
transport: 'rest',
|
|
127
|
-
transportOptions: {
|
|
128
|
-
database: '*LOCAL',
|
|
129
|
-
username: 'myuser',
|
|
130
|
-
password: 'mypass'
|
|
131
|
-
url: 'http://myhost.example.com/cgi-bin/xmlcgi.pgm',
|
|
132
|
-
}
|
|
133
|
-
});
|