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.
Files changed (92) hide show
  1. package/.eslintrc.js +37 -11
  2. package/CHANGELOG.md +76 -2
  3. package/README.md +8 -8
  4. package/lib/Connection.js +0 -1
  5. package/lib/Deprecated.js +3 -4
  6. package/lib/ProgramCall.js +2 -2
  7. package/lib/transports/httpTransport.js +2 -2
  8. package/lib/transports/idbTransport.js +23 -11
  9. package/lib/transports/odbcTransport.js +16 -2
  10. package/lib/transports/sshTransport.js +4 -5
  11. package/package.json +15 -14
  12. package/test/README.md +2 -4
  13. package/test/functional/CommandCallFunctional.js +20 -12
  14. package/test/functional/ProgramCallFunctional.js +6 -66
  15. package/test/functional/checkObjectExists.js +12 -1
  16. package/test/functional/checkVersion.js +17 -0
  17. package/test/functional/deprecated/commandsFunctional.js +20 -11
  18. package/test/functional/deprecated/iDataQueueFunctional.js +10 -11
  19. package/test/functional/deprecated/iNetworkFunctional.js +8 -9
  20. package/test/functional/deprecated/iObjFunctional.js +18 -19
  21. package/test/functional/deprecated/iPgmFunctional.js +6 -42
  22. package/test/functional/deprecated/iProdFunctional.js +10 -11
  23. package/test/functional/deprecated/iSqlFunctional.js +30 -32
  24. package/test/functional/deprecated/iUserSpaceFunctional.js +29 -18
  25. package/test/functional/deprecated/iWorkFunctional.js +61 -59
  26. package/test/functional/iDataQueueFunctional.js +8 -9
  27. package/test/functional/iNetworkFunctional.js +6 -8
  28. package/test/functional/iObjFunctional.js +16 -17
  29. package/test/functional/iProdFunctional.js +8 -9
  30. package/test/functional/iSqlFunctional.js +30 -31
  31. package/test/functional/iUserSpaceFunctional.js +27 -16
  32. package/test/functional/iWorkFunctional.js +29 -33
  33. package/test/unit/CommandCallUnit.js +10 -11
  34. package/test/unit/ConnectionUnit.js +12 -19
  35. package/test/unit/ProgamCallUnit.js +27 -25
  36. package/test/unit/deprecated/commandsUnit.js +10 -11
  37. package/test/unit/deprecated/iConnUnit.js +12 -16
  38. package/test/unit/deprecated/iPgmUnit.js +25 -21
  39. package/test/unit/deprecated/iSqlUnit.js +69 -70
  40. package/test/unit/deprecated/xmlToJsonUnit.js +6 -9
  41. package/docs/CommandCall.rst +0 -22
  42. package/docs/Connection.rst +0 -133
  43. package/docs/Makefile +0 -20
  44. package/docs/ProgramCall.rst +0 -30
  45. package/docs/conf.py +0 -63
  46. package/docs/deprecated/examples/addQuery.js +0 -27
  47. package/docs/deprecated/examples/addToLibraryList.js +0 -15
  48. package/docs/deprecated/examples/callProcedure.js +0 -28
  49. package/docs/deprecated/examples/clearDataQueue.js +0 -15
  50. package/docs/deprecated/examples/createUserSpace.js +0 -15
  51. package/docs/deprecated/examples/deleteUserSpace.js +0 -15
  52. package/docs/deprecated/examples/getDataArea.js +0 -15
  53. package/docs/deprecated/examples/getInstalledProducts.js +0 -15
  54. package/docs/deprecated/examples/getJobInfo.js +0 -15
  55. package/docs/deprecated/examples/getJobStatus.js +0 -15
  56. package/docs/deprecated/examples/getNetInterfaceData.js +0 -15
  57. package/docs/deprecated/examples/getPTFInfo.js +0 -15
  58. package/docs/deprecated/examples/getProductInfo.js +0 -15
  59. package/docs/deprecated/examples/getSysStatus.js +0 -15
  60. package/docs/deprecated/examples/getSysStatusExt.js +0 -15
  61. package/docs/deprecated/examples/getSysValue.js +0 -15
  62. package/docs/deprecated/examples/getTCPIPAttr.js +0 -15
  63. package/docs/deprecated/examples/getUserSpaceData.js +0 -15
  64. package/docs/deprecated/examples/receiveFromDataQueue.js +0 -15
  65. package/docs/deprecated/examples/retrCmdInfo.js +0 -15
  66. package/docs/deprecated/examples/retrPgmInfo.js +0 -15
  67. package/docs/deprecated/examples/retrSrvPgmInfo.js +0 -16
  68. package/docs/deprecated/examples/retrUserAuthToObj.js +0 -15
  69. package/docs/deprecated/examples/retrUserInfo.js +0 -15
  70. package/docs/deprecated/examples/retrUsrAuth.js +0 -15
  71. package/docs/deprecated/examples/sendToDataQueue.js +0 -15
  72. package/docs/deprecated/examples/setUserSpaceData.js +0 -15
  73. package/docs/deprecated/iCmd.rst +0 -7
  74. package/docs/deprecated/iConn.rst +0 -9
  75. package/docs/deprecated/iDataQueue.rst +0 -33
  76. package/docs/deprecated/iNetwork.rst +0 -27
  77. package/docs/deprecated/iObj.rst +0 -64
  78. package/docs/deprecated/iPgm.rst +0 -9
  79. package/docs/deprecated/iProd.rst +0 -36
  80. package/docs/deprecated/iQsh.rst +0 -7
  81. package/docs/deprecated/iSh.rst +0 -7
  82. package/docs/deprecated/iSql.rst +0 -30
  83. package/docs/deprecated/iUserSpace.rst +0 -38
  84. package/docs/deprecated/iWork.rst +0 -58
  85. package/docs/deprecated.rst +0 -21
  86. package/docs/examples/cosine.js +0 -27
  87. package/docs/examples/qusrobjd.js +0 -80
  88. package/docs/examples/rtvjoba.js +0 -24
  89. package/docs/features.rst +0 -12
  90. package/docs/index.rst +0 -71
  91. package/docs/migratation-guide-v1.0.rst +0 -325
  92. package/docs/requirements.txt +0 -1
@@ -1,64 +0,0 @@
1
- .. _iObj:
2
-
3
- iObj
4
- ----
5
-
6
- .. autoclass:: iObj
7
- :members:
8
-
9
- .. autofunction:: addToLibraryListCallback
10
- .. autofunction:: retrUsrAuthCallback
11
- .. autofunction:: retrUsrAuthOutput
12
- .. autofunction:: retrCmdInfoCallback
13
- .. autofunction:: retrCmdInfoOutput
14
- .. autofunction:: retrPgmInfoCallback
15
- .. autofunction:: retrPgmInfoOutput
16
- .. autofunction:: retrSrvPgmInfoCallback
17
- .. autofunction:: retrSrvPgmInfoOutput
18
- .. autofunction:: retrUserInfoCallback
19
- .. autofunction:: retrUserInfoOutput
20
- .. autofunction:: retrUserAuthToObjCallback
21
- .. autofunction:: retrUserAuthToObjOutput
22
-
23
- Examples
24
- ^^^^^^^^
25
-
26
- Retrieve a user's authority to an object
27
- """"""""""""""""""""""""""""""""""""""""
28
- .. literalinclude:: examples/retrUsrAuth.js
29
- :language: javascript
30
-
31
- Retrieve command information
32
- """"""""""""""""""""""""""""
33
-
34
- .. literalinclude:: examples/retrCmdInfo.js
35
- :language: javascript
36
-
37
- Retrieve program information
38
- """"""""""""""""""""""""""""
39
-
40
- .. literalinclude:: examples/retrPgmInfo.js
41
- :language: javascript
42
-
43
- Retrieve service program information
44
-
45
- .. literalinclude:: examples/retrSrvPgmInfo.js
46
- :language: javascript
47
-
48
- Retrieve user information
49
- """""""""""""""""""""""""
50
-
51
- .. literalinclude:: examples/retrUserInfo.js
52
- :language: javascript
53
-
54
- Retrieve users authorized to an object
55
- """"""""""""""""""""""""""""""""""""""
56
-
57
- .. literalinclude:: examples/retrUserAuthToObj.js
58
- :language: javascript
59
-
60
- Add a library to the library list
61
- """""""""""""""""""""""""""""""""
62
-
63
- .. literalinclude:: examples/addToLibraryList.js
64
- :language: javascript
@@ -1,9 +0,0 @@
1
- .. _ipgm:
2
-
3
- iPgm
4
- ----
5
-
6
- .. autoclass:: iPgm
7
- :members:
8
-
9
- .. autofunction:: iPgmOptions
@@ -1,36 +0,0 @@
1
- .. _iProd:
2
-
3
- iProd
4
- -----
5
-
6
- .. autoclass:: iProd
7
- :members:
8
-
9
- .. autofunction:: getPTFInfoCallback
10
- .. autofunction:: getPTFInfoOutput
11
- .. autofunction:: getProductInfoCallback
12
- .. autofunction:: getProductInfoOutput
13
- .. autofunction:: getInstalledProductsCallback
14
- .. autofunction:: getInstalledProductsOutput
15
-
16
- Examples
17
- ^^^^^^^^
18
-
19
- Retrieve basic PTF info
20
- """""""""""""""""""""""
21
-
22
- .. literalinclude:: examples/getPTFInfo.js
23
- :language: javascript
24
-
25
-
26
- Retrieve basic information about the product load
27
- """""""""""""""""""""""""""""""""""""""""""""""""
28
-
29
- .. literalinclude:: examples/getProductInfo.js
30
- :language: javascript
31
-
32
- Retrieve the list of all installed products
33
- """""""""""""""""""""""""""""""""""""""""""
34
-
35
- .. literalinclude:: examples/getInstalledProducts.js
36
- :language: javascript
@@ -1,7 +0,0 @@
1
- .. _iQsh:
2
-
3
- iQsh
4
- ----
5
-
6
- .. autofunction:: iQsh
7
- .. autofunction:: qshOptionsDeprecated
@@ -1,7 +0,0 @@
1
- .. _iSh:
2
-
3
- iSh
4
- ---
5
-
6
- .. autofunction:: iSh
7
- .. autofunction:: shOptionsDeprecated
@@ -1,30 +0,0 @@
1
- .. _iSql:
2
-
3
- iSql
4
- ----
5
-
6
- .. autoclass:: iSql
7
- :members:
8
-
9
- .. autofunction:: iSqlOptions
10
- .. autofunction:: commitOptions
11
- .. autofunction:: describeOptions
12
- .. autofunction:: countOptions
13
- .. autofunction:: executeParams
14
- .. autofunction:: fetchOptions
15
-
16
- Examples
17
- ^^^^^^^^
18
-
19
- Run a query
20
- """""""""""
21
-
22
- .. literalinclude:: examples/addQuery.js
23
- :language: javascript
24
-
25
-
26
- Call a procedure
27
- """"""""""""""""
28
-
29
- .. literalinclude:: examples/callProcedure.js
30
- :language: javascript
@@ -1,38 +0,0 @@
1
- .. _iUserSpace:
2
-
3
- iUserSpace
4
- ----------
5
-
6
- .. autoclass:: iUserSpace
7
- :members:
8
-
9
- .. autofunction:: createUserSpaceCallback
10
- .. autofunction:: setUserSpaceDataCallback
11
- .. autofunction:: getUserSpaceDataCallback
12
- .. autofunction:: deleteUserSpaceCallback
13
-
14
- Examples
15
- ^^^^^^^^
16
-
17
- Create a new user space
18
- """""""""""""""""""""""
19
-
20
- .. literalinclude:: examples/createUserSpace.js
21
- :language: javascript
22
-
23
- Set the content of the user space
24
- """""""""""""""""""""""""""""""""
25
- .. literalinclude:: examples/setUserSpaceData.js
26
- :language: javascript
27
-
28
- Retrieve the content of the user space
29
- """"""""""""""""""""""""""""""""""""""
30
-
31
- .. literalinclude:: examples/getUserSpaceData.js
32
- :language: javascript
33
-
34
- Delete the user space
35
- """""""""""""""""""""
36
-
37
- .. literalinclude:: examples/deleteUserSpace.js
38
- :language: javascript
@@ -1,58 +0,0 @@
1
- .. _iWork:
2
-
3
- iWork
4
- -----
5
-
6
- .. autoclass:: iWork
7
- :members:
8
-
9
- .. autofunction:: getSysValueCallback
10
- .. autofunction:: getSysStatusCallback
11
- .. autofunction:: getSysStatusOutput
12
- .. autofunction:: getSysStatusExtCallback
13
- .. autofunction:: getSysStatusExtOutput
14
- .. autofunction:: getJobStatusCallback
15
- .. autofunction:: getJobStatusOutput
16
- .. autofunction:: getJobInfoCallback
17
- .. autofunction:: getJobInfoOutput
18
- .. autofunction:: getDataAreaCallback
19
- .. autofunction:: getDataAreaOutput
20
-
21
- Examples
22
- ^^^^^^^^
23
-
24
- Retrieve a system value
25
- """""""""""""""""""""""
26
-
27
- .. literalinclude:: examples/getSysValue.js
28
- :language: javascript
29
-
30
- Retrieve basic system status
31
- """"""""""""""""""""""""""""
32
-
33
- .. literalinclude:: examples/getSysStatus.js
34
- :language: javascript
35
-
36
- Retrieve extended system status
37
- """""""""""""""""""""""""""""""
38
-
39
- .. literalinclude:: examples/getSysStatusExt.js
40
- :language: javascript
41
-
42
- Retrieve job status
43
- """""""""""""""""""
44
-
45
- .. literalinclude:: examples/getJobStatus.js
46
- :language: javascript
47
-
48
- Retrieve job info
49
- """""""""""""""""
50
-
51
- .. literalinclude:: examples/getJobInfo.js
52
- :language: javascript
53
-
54
- Retrieve the contents of a data area
55
- """""""""""""""""""""""""""""""""""""
56
-
57
- .. literalinclude:: examples/getDataArea.js
58
- :language: javascript
@@ -1,21 +0,0 @@
1
- .. _deprecated:
2
-
3
-
4
- Deprecated Classes and Functions
5
- ================================
6
-
7
- .. toctree::
8
- :maxdepth: 1
9
-
10
- deprecated/iConn
11
- deprecated/iCmd
12
- deprecated/iDataQueue
13
- deprecated/iNetwork
14
- deprecated/iObj
15
- deprecated/iPgm
16
- deprecated/iProd
17
- deprecated/iQsh
18
- deprecated/iSh
19
- deprecated/iSql
20
- deprecated/iUserSpace
21
- deprecated/iWork
@@ -1,27 +0,0 @@
1
- const { Connection, ProgramCall } = require('itoolkit');
2
- const { parseString } = require('xml2js');
3
-
4
- const conn = new Connection({
5
- transport: 'ssh',
6
- transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword' },
7
- });
8
-
9
- const program = new ProgramCall('QC2UTIL2', { lib: 'QSYS', func: 'cos' });
10
-
11
- program.addParam({ type: '8f', value: '0' });
12
- program.addReturn({ type: '8f', value: '' });
13
-
14
- conn.add(program);
15
- conn.debug(true);
16
-
17
- conn.run((error, xmlOutput) => {
18
- if (error) {
19
- throw error;
20
- }
21
- parseString(xmlOutput, (parseError, result) => {
22
- if (parseError) {
23
- throw parseError;
24
- }
25
- console.log(result.myscript.pgm[0].return[0].data[0]._); // 1
26
- });
27
- });
@@ -1,80 +0,0 @@
1
- const { Connection, ProgramCall } = require('itoolkit');
2
- const { parseString } = require('xml2js');
3
-
4
- const conn = new Connection({
5
- transport: 'ssh',
6
- transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword' },
7
- });
8
-
9
- const receiver = {
10
- name: 'receiver',
11
- type: 'ds',
12
- io: 'out',
13
- len: 'rec1',
14
- fields: [
15
- { name: 'bytes_returned', type: '10i0', value: '0' },
16
- { name: 'bytes_available', type: '10i0', value: '0' },
17
- { name: 'object_name', type: '10A', value: '' },
18
- { name: 'object_library_name', type: '10A', value: '' },
19
- { name: 'object_type', type: '10A', value: '' },
20
- { name: 'return_library', type: '10A', value: '0' },
21
- { name: 'storage_pool_number', type: '10i0', value: '0' },
22
- { name: 'object_owner', type: '10A', value: '' },
23
- { name: 'object_domain', type: '2A', value: '' },
24
- { name: 'creation_datetime', type: '13A', value: '' },
25
- { name: 'object_change_datetime', type: '13A', value: '' },
26
- ],
27
- };
28
-
29
- const errno = {
30
- name: 'error_code',
31
- type: 'ds',
32
- io: 'both',
33
- len: 'rec2',
34
- fields: [
35
- {
36
- name: 'bytes_provided',
37
- type: '10i0',
38
- value: 0,
39
- setlen: 'rec2',
40
- },
41
- { name: 'bytes_available', type: '10i0', value: 0 },
42
- { name: 'msgid', type: '7A', value: '' },
43
- { type: '1A', value: '' },
44
- ],
45
- };
46
-
47
- const objectAndLibrary = {
48
- type: 'ds',
49
- fields: [
50
- { name: 'object', type: '10A', value: 'QCSRC' },
51
- { name: 'lib', type: '10A', value: '*LIBL' },
52
- ],
53
- };
54
-
55
- const program = new ProgramCall('QUSROBJD', { lib: 'QSYS' });
56
- program.addParam(receiver);
57
- program.addParam({
58
- name: 'length_of_receiver',
59
- type: '10i0',
60
- setlen: 'rec1',
61
- value: '0',
62
- });
63
- program.addParam({ name: 'format_name', type: '8A', value: 'OBJD0100' });
64
- program.addParam(objectAndLibrary);
65
- program.addParam({ name: 'object_type', type: '10A', value: '*FILE' });
66
- program.addParam(errno);
67
-
68
- conn.add(program);
69
-
70
- conn.run((error, xmlOutput) => {
71
- if (error) {
72
- throw error;
73
- }
74
- parseString(xmlOutput, (parseError, result) => {
75
- if (parseError) {
76
- throw parseError;
77
- }
78
- console.log(JSON.stringify(result));
79
- });
80
- });
@@ -1,24 +0,0 @@
1
- const { Connection, CommandCall } = require('itoolkit');
2
- const { parseString } = require('xml2js');
3
-
4
-
5
- const connection = new Connection({
6
- transport: 'ssh',
7
- transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword' },
8
- });
9
-
10
- const command = new CommandCall({ type: 'cl', command: 'RTVJOBA USRLIBL(?) SYSLIBL(?)' });
11
-
12
- connection.add(command);
13
-
14
- connection.run((error, xmlOutput) => {
15
- if (error) {
16
- throw error;
17
- }
18
- parseString(xmlOutput, (parseError, result) => {
19
- if (parseError) {
20
- throw parseError;
21
- }
22
- console.log(JSON.stringify(result));
23
- });
24
- });
package/docs/features.rst DELETED
@@ -1,12 +0,0 @@
1
- .. _features:
2
-
3
-
4
- Features
5
- ========
6
-
7
- .. toctree::
8
- :maxdepth: 1
9
-
10
- Connection
11
- CommandCall
12
- ProgramCall
package/docs/index.rst DELETED
@@ -1,71 +0,0 @@
1
- .. nodejs-itoolkit documentation master file, created by
2
- sphinx-quickstart on Tue Mar 31 16:50:35 2020.
3
- You can adapt this file completely to your liking, but it should at least
4
- contain the root `toctree` directive.
5
-
6
- Welcome to nodejs-itoolkit's documentation!
7
- ===========================================
8
-
9
- Introduction
10
- ============
11
-
12
- .. _XMLSERVICE: https://github.com/IBM/xmlservice#xmlservice
13
-
14
- ``itoolkit`` is a Node.js interface to XMLSERVICE_ to access all things IBM i.
15
-
16
- XMLSERVICE provides interfaces to interact with IBM i resources such as programs and commands.
17
-
18
- XMLSERVICE receives xml input and returns xml output.
19
-
20
- For example we can execute a CL command by sending the following XML input to XMLSERVICE.
21
-
22
- .. code-block:: xml
23
-
24
- <?xml version="1.0" encoding="UTF-8"?>
25
- <myscript>
26
- <cmd exec="rexx">RTVJOBA USRLIBL(?) SYSLIBL(?)</cmd>
27
- </myscript>
28
-
29
- XMLSERVICE will run the command and respond with XML output.
30
-
31
- .. code-block:: xml
32
-
33
- <?xml version="1.0" encoding="UTF-8"?>
34
- <myscript>
35
- <cmd exec="rexx">
36
- <success>+++ success RTVJOBA USRLIBL(?) SYSLIBL(?)</success>
37
- <row>
38
- <data desc="USRLIBL">QGPL QTEMP</data>
39
- </row>
40
- <row>
41
- <data desc="SYSLIBL">QSYS QSYS2 QHLPSYS QUSRSYS</data>
42
- </row>
43
- </cmd>
44
- </myscript>
45
-
46
- The purpose of this package is to simplify the process of creating XMLSERVICE input, invoking XMLSERVICE, and returning XMLSERVICE output from Node.js.
47
-
48
- Installation
49
- ^^^^^^^^^^^^
50
-
51
- .. code-block:: bash
52
-
53
- $ npm install itoolkit
54
-
55
- .. NOTE::
56
- If you are upgrading from ``0.1.x`` be sure to read the :doc:`migration guide </migratation-guide-v1.0>`.
57
-
58
- .. toctree::
59
- :maxdepth: 1
60
- :caption: Contents:
61
-
62
- features
63
- deprecated
64
- migratation-guide-v1.0
65
-
66
-
67
- Indices and tables
68
- ==================
69
-
70
- * :ref:`genindex`
71
- * :ref:`search`