trm-client 5.1.1 → 5.2.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/LICENSE +20 -20
- package/README.md +65 -65
- package/changelog.txt +147 -133
- package/dist/commands/alias.js +1 -1
- package/dist/commands/content.js +2 -2
- package/dist/commands/createAlias.js +1 -3
- package/dist/commands/import.js +2 -2
- package/dist/commands/info.js +24 -15
- package/dist/commands/install.js +2 -2
- package/dist/commands/prompts/connect.js +17 -10
- package/dist/commands/settings.js +1 -1
- package/dist/index.js +16 -16
- package/dist/systemAlias/SystemAlias.js +6 -7
- package/dist/utils/CacheData.d.ts +7 -0
- package/dist/utils/CacheData.js +2 -0
- package/dist/utils/Context.d.ts +18 -5
- package/dist/utils/Context.js +62 -14
- package/dist/utils/checkCliUpdate.js +11 -2
- package/dist/utils/getSapLogonConnections.js +2 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/registerCommand.js +2 -2
- package/package.json +65 -63
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 RegestaItalia
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 RegestaItalia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
# <a href="https://docs.trmregistry.com/#/server/README"><img src="https://docs.trmregistry.com/_media/logo.png" height="40" alt="TRM"></a>
|
|
2
|
-
|
|
3
|
-
[](https://github.com/RegestaItalia/trm-docs/blob/main/CODE_OF_CONDUCT.md)
|
|
4
|
-
[](https://github.com/RegestaItalia/trm-client)
|
|
5
|
-
[](https://www.npmjs.com/package/trm-client)
|
|
6
|
-
[](https://www.npmjs.com/package/trm-client)
|
|
7
|
-
|
|
8
|
-
| 🚀 This project is funded and maintained by 🏦 | 🔗 |
|
|
9
|
-
|-------------------------------------------------|----------------------------------------------------------------|
|
|
10
|
-
| Regesta S.p.A. | [https://www.regestaitalia.eu/](https://www.regestaitalia.eu/) |
|
|
11
|
-
| Clarex S.r.l. | [https://www.clarex.it/](https://www.clarex.it/) |
|
|
12
|
-
|
|
13
|
-
This is the official CLI implementation of the core functionalities of TRM.
|
|
14
|
-
|
|
15
|
-
TRM is a software designed to make transports between SAP ECC/S4 systems easy.
|
|
16
|
-
|
|
17
|
-
To find out more about TRM, visit its full [documentation](https://docs.trmregistry.com).
|
|
18
|
-
|
|
19
|
-
# Documentation <!-- {docsify-remove} -->
|
|
20
|
-
|
|
21
|
-
Full documentation can be seen at [https://docs.trmregistry.com](https://docs.trmregistry.com).
|
|
22
|
-
|
|
23
|
-
<!-- START TABLE_OF_CONTENTS.md -->
|
|
24
|
-
- [Setup](/docs/setup.md)
|
|
25
|
-
- [Commands](/docs/commands.md)
|
|
26
|
-
- [Installing your first package](/docs/examples/install.md)
|
|
27
|
-
- [Publishing your first package](/docs/examples/publish.md)
|
|
28
|
-
- [Integrate with abapGit & Github Actions](/docs/examples/githubActions.md)
|
|
29
|
-
<!-- END TABLE_OF_CONTENTS.md -->
|
|
30
|
-
|
|
31
|
-
## Install <!-- {docsify-remove} -->
|
|
32
|
-
|
|
33
|
-
First, make sure you have all the [requirements installed](/docs/setup.md#trm-client-requirements).
|
|
34
|
-
|
|
35
|
-
You can then install the CLI via npm:
|
|
36
|
-
|
|
37
|
-
`npm install trm-client -g`
|
|
38
|
-
|
|
39
|
-
## Commands <!-- {docsify-remove} -->
|
|
40
|
-
|
|
41
|
-
List of all commands is available [here](/docs/commands.md).
|
|
42
|
-
|
|
43
|
-
### Demo publish <!-- {docsify-remove} -->
|
|
44
|
-
|
|
45
|
-
<p align="center">
|
|
46
|
-
<img src="https://docs.trmregistry.com/_media/publish.gif" />
|
|
47
|
-
</p>
|
|
48
|
-
|
|
49
|
-
### Demo install <!-- {docsify-remove} -->
|
|
50
|
-
|
|
51
|
-
<p align="center">
|
|
52
|
-
<img src="https://docs.trmregistry.com/_media/install.gif" />
|
|
53
|
-
</p>
|
|
54
|
-
|
|
55
|
-
# Contributing <!-- {docsify-remove} -->
|
|
56
|
-
|
|
57
|
-
Like every other TRM open-source projects, contributions are always welcomed ❤️.
|
|
58
|
-
|
|
59
|
-
Make sure to open an issue first.
|
|
60
|
-
|
|
61
|
-
Contributions will be merged upon approval.
|
|
62
|
-
|
|
63
|
-
[Click here](https://docs.trmregistry.com/#/CONTRIBUTING) for the full list of TRM contribution guidelines.
|
|
64
|
-
|
|
65
|
-
[<img src="https://trmregistry.com/public/contributors?image=true">](https://docs.trmregistry.com/#/?id=contributors)
|
|
1
|
+
# <a href="https://docs.trmregistry.com/#/server/README"><img src="https://docs.trmregistry.com/_media/logo.png" height="40" alt="TRM"></a>
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RegestaItalia/trm-docs/blob/main/CODE_OF_CONDUCT.md)
|
|
4
|
+
[](https://github.com/RegestaItalia/trm-client)
|
|
5
|
+
[](https://www.npmjs.com/package/trm-client)
|
|
6
|
+
[](https://www.npmjs.com/package/trm-client)
|
|
7
|
+
|
|
8
|
+
| 🚀 This project is funded and maintained by 🏦 | 🔗 |
|
|
9
|
+
|-------------------------------------------------|----------------------------------------------------------------|
|
|
10
|
+
| Regesta S.p.A. | [https://www.regestaitalia.eu/](https://www.regestaitalia.eu/) |
|
|
11
|
+
| Clarex S.r.l. | [https://www.clarex.it/](https://www.clarex.it/) |
|
|
12
|
+
|
|
13
|
+
This is the official CLI implementation of the core functionalities of TRM.
|
|
14
|
+
|
|
15
|
+
TRM is a software designed to make transports between SAP ECC/S4 systems easy.
|
|
16
|
+
|
|
17
|
+
To find out more about TRM, visit its full [documentation](https://docs.trmregistry.com).
|
|
18
|
+
|
|
19
|
+
# Documentation <!-- {docsify-remove} -->
|
|
20
|
+
|
|
21
|
+
Full documentation can be seen at [https://docs.trmregistry.com](https://docs.trmregistry.com).
|
|
22
|
+
|
|
23
|
+
<!-- START TABLE_OF_CONTENTS.md -->
|
|
24
|
+
- [Setup](/docs/setup.md)
|
|
25
|
+
- [Commands](/docs/commands.md)
|
|
26
|
+
- [Installing your first package](/docs/examples/install.md)
|
|
27
|
+
- [Publishing your first package](/docs/examples/publish.md)
|
|
28
|
+
- [Integrate with abapGit & Github Actions](/docs/examples/githubActions.md)
|
|
29
|
+
<!-- END TABLE_OF_CONTENTS.md -->
|
|
30
|
+
|
|
31
|
+
## Install <!-- {docsify-remove} -->
|
|
32
|
+
|
|
33
|
+
First, make sure you have all the [requirements installed](/docs/setup.md#trm-client-requirements).
|
|
34
|
+
|
|
35
|
+
You can then install the CLI via npm:
|
|
36
|
+
|
|
37
|
+
`npm install trm-client -g`
|
|
38
|
+
|
|
39
|
+
## Commands <!-- {docsify-remove} -->
|
|
40
|
+
|
|
41
|
+
List of all commands is available [here](/docs/commands.md).
|
|
42
|
+
|
|
43
|
+
### Demo publish <!-- {docsify-remove} -->
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img src="https://docs.trmregistry.com/_media/publish.gif" />
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
### Demo install <!-- {docsify-remove} -->
|
|
50
|
+
|
|
51
|
+
<p align="center">
|
|
52
|
+
<img src="https://docs.trmregistry.com/_media/install.gif" />
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
# Contributing <!-- {docsify-remove} -->
|
|
56
|
+
|
|
57
|
+
Like every other TRM open-source projects, contributions are always welcomed ❤️.
|
|
58
|
+
|
|
59
|
+
Make sure to open an issue first.
|
|
60
|
+
|
|
61
|
+
Contributions will be merged upon approval.
|
|
62
|
+
|
|
63
|
+
[Click here](https://docs.trmregistry.com/#/CONTRIBUTING) for the full list of TRM contribution guidelines.
|
|
64
|
+
|
|
65
|
+
[<img src="https://trmregistry.com/public/contributors?image=true">](https://docs.trmregistry.com/#/?id=contributors)
|
package/changelog.txt
CHANGED
|
@@ -1,134 +1,148 @@
|
|
|
1
|
-
trm-client changelog
|
|
2
|
-
=================
|
|
3
|
-
|
|
4
|
-
Legend
|
|
5
|
-
------
|
|
6
|
-
* : fixed
|
|
7
|
-
! : changed
|
|
8
|
-
+ : added
|
|
9
|
-
- : removed
|
|
10
|
-
|
|
11
|
-
2025-
|
|
12
|
-
-------------------
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
+
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
+
|
|
47
|
-
+
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
!
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
! error
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
2025-
|
|
108
|
-
-------------------
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
! trm-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
-
|
|
133
|
-
|
|
1
|
+
trm-client changelog
|
|
2
|
+
=================
|
|
3
|
+
|
|
4
|
+
Legend
|
|
5
|
+
------
|
|
6
|
+
* : fixed
|
|
7
|
+
! : changed
|
|
8
|
+
+ : added
|
|
9
|
+
- : removed
|
|
10
|
+
|
|
11
|
+
2025-10-15 v5.2.1
|
|
12
|
+
-------------------
|
|
13
|
+
* system alias connection data
|
|
14
|
+
* typo in update message
|
|
15
|
+
|
|
16
|
+
2025-10-01 v5.2.0
|
|
17
|
+
-------------------
|
|
18
|
+
|
|
19
|
+
! trm-core ^7.5.5
|
|
20
|
+
! trm-commons ^3.4.2
|
|
21
|
+
* connection data problems
|
|
22
|
+
+ cache time consuming data
|
|
23
|
+
+ on after login update alias on changes
|
|
24
|
+
|
|
25
|
+
2025-09-25 v5.1.1
|
|
26
|
+
-------------------
|
|
27
|
+
|
|
28
|
+
* create alias command
|
|
29
|
+
* keep original abap packages name selection
|
|
30
|
+
|
|
31
|
+
2025-09-24 v5.1.0
|
|
32
|
+
-------------------
|
|
33
|
+
|
|
34
|
+
* alias command view/edit
|
|
35
|
+
! npm global path in settings
|
|
36
|
+
! sap landscape in settings
|
|
37
|
+
* sap landscape for mac
|
|
38
|
+
+ add plugins in info command
|
|
39
|
+
! trm-commons ^3.3.2
|
|
40
|
+
! trm-core ^7.5.3
|
|
41
|
+
|
|
42
|
+
2025-09-09 v5.0.2
|
|
43
|
+
-------------------
|
|
44
|
+
|
|
45
|
+
* fix no connection
|
|
46
|
+
+ fallback text for node-rfc and node-r3trans not found in info command
|
|
47
|
+
+ update command now self updates the client if ran without arguments
|
|
48
|
+
|
|
49
|
+
2025-09-03 v5.0.1
|
|
50
|
+
-------------------
|
|
51
|
+
|
|
52
|
+
+ plugin loadCommons
|
|
53
|
+
|
|
54
|
+
2025-09-03 v5.0.0
|
|
55
|
+
-------------------
|
|
56
|
+
|
|
57
|
+
! trm-core ^7.5.1
|
|
58
|
+
! trm-commons ^3.2.0
|
|
59
|
+
! moved settings to context
|
|
60
|
+
+ plugin calls
|
|
61
|
+
+ gracefully close connection
|
|
62
|
+
! moved connection prompts to commons
|
|
63
|
+
|
|
64
|
+
2025-08-13 v4.10.0
|
|
65
|
+
-------------------
|
|
66
|
+
|
|
67
|
+
! trm-core ^7.4.5
|
|
68
|
+
+ support for darwin os
|
|
69
|
+
+ support for r3trans dockerized
|
|
70
|
+
|
|
71
|
+
2025-07-30 v4.9.2
|
|
72
|
+
-------------------
|
|
73
|
+
|
|
74
|
+
! trm-commons ^2.0.0 as peer dependency and dependency
|
|
75
|
+
|
|
76
|
+
2025-07-29 v4.9.1
|
|
77
|
+
-------------------
|
|
78
|
+
|
|
79
|
+
! trm-core ^7.4.1
|
|
80
|
+
! trm-commons ^2.0.0
|
|
81
|
+
|
|
82
|
+
2025-07-29 v4.9.0
|
|
83
|
+
-------------------
|
|
84
|
+
|
|
85
|
+
+ handle registry unauthorized error
|
|
86
|
+
! trm-core ^7.4.0
|
|
87
|
+
! trm-commons ^1.1.0
|
|
88
|
+
|
|
89
|
+
2025-06-04 v4.8.0
|
|
90
|
+
-------------------
|
|
91
|
+
|
|
92
|
+
! trm-core ^7.2.1
|
|
93
|
+
! overwrite flag in install/update ignores existing objects replace
|
|
94
|
+
|
|
95
|
+
2025-06-03 v4.7.0
|
|
96
|
+
-------------------
|
|
97
|
+
|
|
98
|
+
! trm-core ^7.0.0
|
|
99
|
+
|
|
100
|
+
2025-05-29 v4.6.1
|
|
101
|
+
-------------------
|
|
102
|
+
|
|
103
|
+
! logging error changes
|
|
104
|
+
! trm-core ^6.9.0
|
|
105
|
+
+ landscape transport to list and view command
|
|
106
|
+
|
|
107
|
+
2025-05-08 v4.6.0
|
|
108
|
+
-------------------
|
|
109
|
+
|
|
110
|
+
! trm-core ^6.8.0
|
|
111
|
+
* saprouter in alias
|
|
112
|
+
|
|
113
|
+
2025-05-08 v4.5.0
|
|
114
|
+
-------------------
|
|
115
|
+
|
|
116
|
+
! trm-core ^6.7.0
|
|
117
|
+
! error handling
|
|
118
|
+
* alias command/saprouter alias save
|
|
119
|
+
* fix connection validators
|
|
120
|
+
|
|
121
|
+
2025-04-28 v4.4.1
|
|
122
|
+
-------------------
|
|
123
|
+
|
|
124
|
+
* node-r3trans version read
|
|
125
|
+
|
|
126
|
+
2025-04-28 v4.4.0
|
|
127
|
+
-------------------
|
|
128
|
+
|
|
129
|
+
! trm-core ^6.5.0
|
|
130
|
+
! trm-commons ^1.0.0
|
|
131
|
+
|
|
132
|
+
2025-04-28 v4.3.0
|
|
133
|
+
-------------------
|
|
134
|
+
|
|
135
|
+
! trm-core ^6.4.1
|
|
136
|
+
|
|
137
|
+
2025-04-23 v4.2.1
|
|
138
|
+
-------------------
|
|
139
|
+
|
|
140
|
+
* node-r3trans version read
|
|
141
|
+
|
|
142
|
+
2025-02-26 v4.2.0
|
|
143
|
+
-------------------
|
|
144
|
+
|
|
145
|
+
! connect to registry via option
|
|
146
|
+
- trm dependencies on client
|
|
147
|
+
+ content command
|
|
134
148
|
+ pack/import command
|
package/dist/commands/alias.js
CHANGED
|
@@ -27,7 +27,7 @@ const _create = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
const _view = (alias) => {
|
|
30
|
-
const connection = utils_1.Context.getInstance().
|
|
30
|
+
const connection = utils_1.Context.getInstance().getConnections().find(o => o.name === alias.type);
|
|
31
31
|
if (!connection) {
|
|
32
32
|
throw new Error(`Unknown connection type "${alias.type}".`);
|
|
33
33
|
}
|
package/dist/commands/content.js
CHANGED
|
@@ -30,9 +30,9 @@ function content(commandArgs) {
|
|
|
30
30
|
const packageContent = yield remotePackage.fetchRemoteContent(commandArgs.version, {
|
|
31
31
|
tempDirPath: (0, utils_1.getTempFolder)(),
|
|
32
32
|
r3transDirPath: commandArgs.r3transPath,
|
|
33
|
-
useDocker: utils_1.Context.getInstance().
|
|
33
|
+
useDocker: utils_1.Context.getInstance().getSettings().r3transDocker,
|
|
34
34
|
dockerOptions: {
|
|
35
|
-
name: utils_1.Context.getInstance().
|
|
35
|
+
name: utils_1.Context.getInstance().getSettings().r3transDockerName
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
if (!commandArgs.all) {
|
|
@@ -19,9 +19,7 @@ function createAlias(commandArgs) {
|
|
|
19
19
|
noSystemAlias: true,
|
|
20
20
|
force: true
|
|
21
21
|
}, false, false);
|
|
22
|
-
|
|
23
|
-
systemAlias_1.SystemAlias.create(commandArgs.alias, connection.name, data);
|
|
24
|
-
connection.setData(data);
|
|
22
|
+
systemAlias_1.SystemAlias.create(commandArgs.alias, connection.name, connection.getData());
|
|
25
23
|
trm_commons_1.Logger.loading(`Connecting to "${commandArgs.alias}"...`);
|
|
26
24
|
var connectionSuccess = true;
|
|
27
25
|
try {
|
package/dist/commands/import.js
CHANGED
|
@@ -39,9 +39,9 @@ function _import(commandArgs) {
|
|
|
39
39
|
r3transOptions: {
|
|
40
40
|
tempDirPath: (0, utils_1.getTempFolder)(),
|
|
41
41
|
r3transDirPath: commandArgs.r3transPath,
|
|
42
|
-
useDocker: utils_1.Context.getInstance().
|
|
42
|
+
useDocker: utils_1.Context.getInstance().getSettings().r3transDocker,
|
|
43
43
|
dockerOptions: {
|
|
44
|
-
name: utils_1.Context.getInstance().
|
|
44
|
+
name: utils_1.Context.getInstance().getSettings().r3transDockerName
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
noInquirer: commandArgs.noPrompts,
|
package/dist/commands/info.js
CHANGED
|
@@ -17,7 +17,7 @@ const trm_core_1 = require("trm-core");
|
|
|
17
17
|
const utils_1 = require("../utils");
|
|
18
18
|
const commons_1 = require("./commons");
|
|
19
19
|
const fs_1 = require("fs");
|
|
20
|
-
const path_1 =
|
|
20
|
+
const path_1 = require("path");
|
|
21
21
|
const get_root_path_1 = require("get-root-path");
|
|
22
22
|
const chalk_1 = __importDefault(require("chalk"));
|
|
23
23
|
const semver_1 = require("semver");
|
|
@@ -25,10 +25,10 @@ const trm_commons_1 = require("trm-commons");
|
|
|
25
25
|
const _getDependencyVersion = (moduleName, rootModule = 'trm-client') => {
|
|
26
26
|
var file;
|
|
27
27
|
try {
|
|
28
|
-
file = (0, fs_1.readFileSync)(path_1.
|
|
28
|
+
file = (0, fs_1.readFileSync)((0, path_1.join)(get_root_path_1.rootPath, `/node_modules/${rootModule}/node_modules/${moduleName}/package.json`));
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
31
|
-
file = (0, fs_1.readFileSync)(path_1.
|
|
31
|
+
file = (0, fs_1.readFileSync)((0, path_1.join)(get_root_path_1.rootPath, `/node_modules/${moduleName}/package.json`));
|
|
32
32
|
}
|
|
33
33
|
if (!file) {
|
|
34
34
|
trm_commons_1.Logger.warning(`Library ${moduleName} (root ${rootModule}) was not found!`, true);
|
|
@@ -40,7 +40,7 @@ const _getDependencyVersion = (moduleName, rootModule = 'trm-client') => {
|
|
|
40
40
|
const _getNodeRfcVersion = (npmGlobal) => {
|
|
41
41
|
var file;
|
|
42
42
|
try {
|
|
43
|
-
file = (0, fs_1.readFileSync)(path_1.
|
|
43
|
+
file = (0, fs_1.readFileSync)((0, path_1.join)(npmGlobal, `/node-rfc/package.json`));
|
|
44
44
|
}
|
|
45
45
|
catch (e) {
|
|
46
46
|
}
|
|
@@ -69,7 +69,7 @@ const _getNpmLatestForText = (packageName, installedVersion, text) => __awaiter(
|
|
|
69
69
|
function info(commandArgs) {
|
|
70
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
71
|
trm_commons_1.Logger.loading(`Reading data...`);
|
|
72
|
-
const npmGlobal = utils_1.Context.getInstance().
|
|
72
|
+
const npmGlobal = utils_1.Context.getInstance().getSettings().globalNodeModules;
|
|
73
73
|
const clientLatest = yield (0, utils_1.checkCliUpdate)(false);
|
|
74
74
|
const clientVersion = (0, utils_1.getClientVersion)();
|
|
75
75
|
const clientDependencies = (0, utils_1.getClientNodeDependencies)();
|
|
@@ -199,24 +199,33 @@ function info(commandArgs) {
|
|
|
199
199
|
text: chalk_1.default.bold(`Client`),
|
|
200
200
|
children: clientChildrenTree
|
|
201
201
|
};
|
|
202
|
-
trm_commons_1.Logger.tree(clientTree);
|
|
203
202
|
const serverTree = {
|
|
204
203
|
text: chalk_1.default.bold(`Server (${trm_core_1.SystemConnector.getDest()})`),
|
|
205
204
|
children: serverDependenciesTree
|
|
206
205
|
};
|
|
207
|
-
if (!(trm_core_1.SystemConnector.systemConnector instanceof utils_1.DummyConnector)) {
|
|
208
|
-
trm_commons_1.Logger.tree(serverTree);
|
|
209
|
-
}
|
|
210
206
|
const pluginsTree = {
|
|
211
207
|
text: chalk_1.default.bold(`Plugins`),
|
|
212
208
|
children: []
|
|
213
209
|
};
|
|
214
|
-
utils_1.Context.getInstance().
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
children
|
|
218
|
-
|
|
219
|
-
|
|
210
|
+
for (const plugin of utils_1.Context.getInstance().getPlugins()) {
|
|
211
|
+
try {
|
|
212
|
+
const installedVersion = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(plugin.location, 'package.json')).toString()).version;
|
|
213
|
+
pluginsTree.children.push({
|
|
214
|
+
text: yield _getNpmLatestForText(plugin.name, installedVersion, `${plugin.name} ${installedVersion}`),
|
|
215
|
+
children: []
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
catch (_a) {
|
|
219
|
+
pluginsTree.children.push({
|
|
220
|
+
text: plugin.name,
|
|
221
|
+
children: []
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
trm_commons_1.Logger.tree(clientTree);
|
|
226
|
+
if (!(trm_core_1.SystemConnector.systemConnector instanceof utils_1.DummyConnector)) {
|
|
227
|
+
trm_commons_1.Logger.tree(serverTree);
|
|
228
|
+
}
|
|
220
229
|
if (pluginsTree.children.length > 0) {
|
|
221
230
|
trm_commons_1.Logger.tree(pluginsTree);
|
|
222
231
|
}
|
package/dist/commands/install.js
CHANGED
|
@@ -38,9 +38,9 @@ function install(commandArgs) {
|
|
|
38
38
|
r3transOptions: {
|
|
39
39
|
tempDirPath: (0, utils_1.getTempFolder)(),
|
|
40
40
|
r3transDirPath: commandArgs.r3transPath,
|
|
41
|
-
useDocker: utils_1.Context.getInstance().
|
|
41
|
+
useDocker: utils_1.Context.getInstance().getSettings().r3transDocker,
|
|
42
42
|
dockerOptions: {
|
|
43
|
-
name: utils_1.Context.getInstance().
|
|
43
|
+
name: utils_1.Context.getInstance().getSettings().r3transDockerName
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
noInquirer: commandArgs.noPrompts,
|
|
@@ -13,6 +13,7 @@ exports.connect = connect;
|
|
|
13
13
|
const systemAlias_1 = require("../../systemAlias");
|
|
14
14
|
const utils_1 = require("../../utils");
|
|
15
15
|
const trm_commons_1 = require("trm-commons");
|
|
16
|
+
const lodash_1 = require("lodash");
|
|
16
17
|
const languageList = [
|
|
17
18
|
{ value: 'AR', name: 'AR (Arabic)' },
|
|
18
19
|
{ value: 'BG', name: 'BG (Bulgarian)' },
|
|
@@ -120,30 +121,36 @@ function connect(commandArgs_1) {
|
|
|
120
121
|
};
|
|
121
122
|
})
|
|
122
123
|
})).alias;
|
|
123
|
-
const connection = utils_1.Context.getInstance().
|
|
124
|
+
const connection = utils_1.Context.getInstance().getConnections().find(o => o.name === inq2.type);
|
|
124
125
|
if (!connection) {
|
|
125
126
|
throw new Error(`Unknown connection type "${inq2.type}" in alias "${inq2.name}"`);
|
|
126
127
|
}
|
|
127
128
|
connection.setData(inq2.data);
|
|
129
|
+
if (connection.onAfterLoginData) {
|
|
130
|
+
yield connection.onAfterLoginData(force, commandArgs);
|
|
131
|
+
}
|
|
132
|
+
if (!(0, lodash_1.isEqual)(inq2.data, connection.getData())) {
|
|
133
|
+
systemAlias_1.SystemAlias.delete(inq2.alias);
|
|
134
|
+
systemAlias_1.SystemAlias.create(inq2.alias, inq2.type, connection.getData());
|
|
135
|
+
}
|
|
128
136
|
return connection;
|
|
129
137
|
}
|
|
130
138
|
else {
|
|
131
139
|
if (inputType === 'logon') {
|
|
132
|
-
const
|
|
140
|
+
const logonConnection = (yield trm_commons_1.Inquirer.prompt({
|
|
133
141
|
type: `list`,
|
|
134
|
-
name: `
|
|
142
|
+
name: `data`,
|
|
135
143
|
message: `Select connection`,
|
|
136
144
|
choices: aSapLogonConnections.map(o => {
|
|
137
145
|
return {
|
|
138
|
-
value: o
|
|
146
|
+
value: o, name: o.name
|
|
139
147
|
};
|
|
140
148
|
})
|
|
141
|
-
});
|
|
142
|
-
const logonConnection = aSapLogonConnections.find(o => o.id === inq3.logonConnection);
|
|
149
|
+
})).data;
|
|
143
150
|
commandArgs.ashost = logonConnection.ashost;
|
|
144
151
|
commandArgs.dest = logonConnection.dest;
|
|
145
152
|
commandArgs.sysnr = logonConnection.sysnr;
|
|
146
|
-
commandArgs.saprouter = logonConnection.saprouter;
|
|
153
|
+
commandArgs.saprouter = logonConnection.saprouter || ' ';
|
|
147
154
|
type = 'RFC';
|
|
148
155
|
}
|
|
149
156
|
if (!type || force) {
|
|
@@ -151,7 +158,7 @@ function connect(commandArgs_1) {
|
|
|
151
158
|
type: `list`,
|
|
152
159
|
name: `type`,
|
|
153
160
|
message: `Connection type`,
|
|
154
|
-
choices: utils_1.Context.getInstance().
|
|
161
|
+
choices: utils_1.Context.getInstance().getConnections().map(o => {
|
|
155
162
|
return {
|
|
156
163
|
name: o.description,
|
|
157
164
|
value: o.name
|
|
@@ -159,7 +166,7 @@ function connect(commandArgs_1) {
|
|
|
159
166
|
})
|
|
160
167
|
})).type;
|
|
161
168
|
}
|
|
162
|
-
const connectionType = utils_1.Context.getInstance().
|
|
169
|
+
const connectionType = utils_1.Context.getInstance().getConnections().find(o => o.name === type);
|
|
163
170
|
if (!connectionType) {
|
|
164
171
|
throw new Error(`Invalid connection type "${type}"`);
|
|
165
172
|
}
|
|
@@ -209,7 +216,7 @@ function connect(commandArgs_1) {
|
|
|
209
216
|
return (commandArgs.lang ? false : true) || force;
|
|
210
217
|
},
|
|
211
218
|
validate: (input) => {
|
|
212
|
-
return languageList.
|
|
219
|
+
return languageList.find(o => o.value === input.trim().toUpperCase()) ? true : `Unknown language "${input}".`;
|
|
213
220
|
},
|
|
214
221
|
choices: languageList
|
|
215
222
|
}
|
|
@@ -24,7 +24,7 @@ function settings(commandArgs) {
|
|
|
24
24
|
const value = aSplit[1];
|
|
25
25
|
utils_1.Context.getInstance().setSetting(key, value);
|
|
26
26
|
}
|
|
27
|
-
const settingsData = utils_1.Context.getInstance().
|
|
27
|
+
const settingsData = utils_1.Context.getInstance().getSettings();
|
|
28
28
|
Object.keys(settingsData).forEach(k => {
|
|
29
29
|
trm_commons_1.Logger.log(`${k}: ${settingsData[k]}`);
|
|
30
30
|
});
|
package/dist/index.js
CHANGED
|
@@ -7,10 +7,10 @@ const trm_registry_types_1 = require("trm-registry-types");
|
|
|
7
7
|
const program = new commander_1.Command();
|
|
8
8
|
program
|
|
9
9
|
.name(`trm`)
|
|
10
|
-
.description(`TRM - Transport Request Manager CLI
|
|
11
|
-
|
|
12
|
-
Full documentation available at https://docs.trmregistry.com/
|
|
13
|
-
|
|
10
|
+
.description(`TRM - Transport Request Manager CLI
|
|
11
|
+
|
|
12
|
+
Full documentation available at https://docs.trmregistry.com/
|
|
13
|
+
|
|
14
14
|
© 2025 RegestaItalia https://www.regestaitalia.eu/`)
|
|
15
15
|
.version((0, utils_1.getClientVersion)());
|
|
16
16
|
const createAlias = program.command(`createAlias`)
|
|
@@ -69,13 +69,13 @@ const publish = program.command(`publish`)
|
|
|
69
69
|
.argument(`<package>`, `Name of the package to publish.`)
|
|
70
70
|
.argument(`[version]`, `Optional: Version of the package to publish. If not specified, check help text for details.`)
|
|
71
71
|
.description(`Publish package to registry.`)
|
|
72
|
-
.addHelpText(`before`, `When no version argument is defined, it will automatically set to:
|
|
73
|
-
- When it's the first publish: 1.0.0
|
|
74
|
-
- When it's already published: the latest available release with patch increased by 1
|
|
75
|
-
When it's the first publish, full manifest definition is asked.
|
|
76
|
-
When a release is already published, the latest available manifest is used but can be overwritten.
|
|
77
|
-
Translation transport is only generated for packages that contain one or more objects with translations (unless skipped by flag).
|
|
78
|
-
Customizing transport is only generated if a valid list of customizing transports is provided (unless skipped by flag).
|
|
72
|
+
.addHelpText(`before`, `When no version argument is defined, it will automatically set to:
|
|
73
|
+
- When it's the first publish: 1.0.0
|
|
74
|
+
- When it's already published: the latest available release with patch increased by 1
|
|
75
|
+
When it's the first publish, full manifest definition is asked.
|
|
76
|
+
When a release is already published, the latest available manifest is used but can be overwritten.
|
|
77
|
+
Translation transport is only generated for packages that contain one or more objects with translations (unless skipped by flag).
|
|
78
|
+
Customizing transport is only generated if a valid list of customizing transports is provided (unless skipped by flag).
|
|
79
79
|
If a default manifest with dependencies is provided in conjunction with the automatic dependency generation, results will be merged.`)
|
|
80
80
|
.option(`-p, --private`, `Publish package with private visibility.`)
|
|
81
81
|
.option(`-np, --noPrompts`, `No prompts (will force some decisions).`, false)
|
|
@@ -106,9 +106,9 @@ const pack = program.command(`pack`)
|
|
|
106
106
|
.argument(`<package>`, `Name of the package to generate.`)
|
|
107
107
|
.argument(`[version]`, `Optional: Version of the package to generate. If not specified, check help text for details.`)
|
|
108
108
|
.description(`Save package locally.`)
|
|
109
|
-
.addHelpText(`before`, `When no version is defined, it will automatically set to 1.0.0.
|
|
110
|
-
Translation transport is only generated for packages that contain one or more objects with translations (unless skipped by flag).
|
|
111
|
-
Customizing transport is only generated if a valid list of customizing transports is provided (unless skipped by flag).
|
|
109
|
+
.addHelpText(`before`, `When no version is defined, it will automatically set to 1.0.0.
|
|
110
|
+
Translation transport is only generated for packages that contain one or more objects with translations (unless skipped by flag).
|
|
111
|
+
Customizing transport is only generated if a valid list of customizing transports is provided (unless skipped by flag).
|
|
112
112
|
If a default manifest with dependencies is provided in conjunction with the automatic dependency generation, results will be merged.`)
|
|
113
113
|
.option(`-o, --output <<outputPath>>`, `Output path.`)
|
|
114
114
|
.option(`-np, --noPrompts`, `No prompts (will force some decisions).`, false)
|
|
@@ -169,7 +169,7 @@ const update = program.command(`update`)
|
|
|
169
169
|
.argument(`[package]`, `Name of the package to update.`)
|
|
170
170
|
.argument(`[version]`, `Optional: Target package version to update.`)
|
|
171
171
|
.description(`Update trm-client / Update package from registry into system.`)
|
|
172
|
-
.addHelpText(`before`, `When no package name is specified, trm-client will self-update. All options are invalid, in this case.
|
|
172
|
+
.addHelpText(`before`, `When no package name is specified, trm-client will self-update. All options are invalid, in this case.
|
|
173
173
|
When no version is specified, the latest will be installed.`)
|
|
174
174
|
.option(`-np, --noPrompts`, `No prompts (will force some decisions).`, false)
|
|
175
175
|
.option(`-sf, --safe`, `Safe install (needs package integrity).`, false)
|
|
@@ -217,7 +217,7 @@ const _import = program.command(`import <file>`)
|
|
|
217
217
|
const view = program.command(`view`)
|
|
218
218
|
.argument(`<package>`, `Name of the package to view.`)
|
|
219
219
|
.description(`View package.`)
|
|
220
|
-
.addHelpText(`before`, `Shows package details.
|
|
220
|
+
.addHelpText(`before`, `Shows package details.
|
|
221
221
|
If the package is not found on the system, it will automatically fall back to the data provided by the registry, granted it exists.`);
|
|
222
222
|
(0, utils_1.registerCommand)(view, {
|
|
223
223
|
requiresConnection: true,
|
|
@@ -58,11 +58,11 @@ class SystemAlias {
|
|
|
58
58
|
this._data = _data;
|
|
59
59
|
}
|
|
60
60
|
getConnection() {
|
|
61
|
-
const connection = utils_1.Context.getInstance().
|
|
61
|
+
const connection = utils_1.Context.getInstance().getConnections().find(o => o.name === this.type);
|
|
62
62
|
if (!connection) {
|
|
63
|
-
throw new Error(`Unknown connection type "${this.type}". Possible values are ${utils_1.Context.getInstance().
|
|
63
|
+
throw new Error(`Unknown connection type "${this.type}". Possible values are ${utils_1.Context.getInstance().getConnections().map(k => k.name).join(', ')}.`);
|
|
64
64
|
}
|
|
65
|
-
connection.setData(this._data);
|
|
65
|
+
connection.setData(this._data.data);
|
|
66
66
|
return connection.getSystemConnector();
|
|
67
67
|
}
|
|
68
68
|
static generateFile(content, filePath) {
|
|
@@ -71,7 +71,7 @@ class SystemAlias {
|
|
|
71
71
|
}
|
|
72
72
|
var oContent = {};
|
|
73
73
|
content.forEach(o => {
|
|
74
|
-
const connection = utils_1.Context.getInstance().
|
|
74
|
+
const connection = utils_1.Context.getInstance().getConnections().find(k => k.name === o.type);
|
|
75
75
|
if (connection) {
|
|
76
76
|
oContent[o.alias] = o.data;
|
|
77
77
|
oContent[o.alias].type = o.type;
|
|
@@ -95,13 +95,12 @@ class SystemAlias {
|
|
|
95
95
|
if (!oIni[sAlias].type) {
|
|
96
96
|
oIni[sAlias].type = 'RFC';
|
|
97
97
|
}
|
|
98
|
-
const connection = utils_1.Context.getInstance().
|
|
98
|
+
const connection = utils_1.Context.getInstance().getConnections().find(o => o.name === oIni[sAlias].type);
|
|
99
99
|
if (connection) {
|
|
100
|
-
connection.setData(oIni[sAlias]);
|
|
101
100
|
aAlias.push({
|
|
102
101
|
alias: sAlias,
|
|
103
102
|
type: oIni[sAlias].type,
|
|
104
|
-
data:
|
|
103
|
+
data: oIni[sAlias]
|
|
105
104
|
});
|
|
106
105
|
}
|
|
107
106
|
});
|
package/dist/utils/Context.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
+
import { CacheData } from ".";
|
|
1
2
|
import { SettingsData } from "./";
|
|
2
|
-
import { IConnect } from "trm-commons";
|
|
3
|
+
import { IConnect, PluginModule } from "trm-commons";
|
|
3
4
|
export declare class Context {
|
|
4
5
|
private static _instance;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
private _pluginsLoaded;
|
|
7
|
+
private _settings;
|
|
8
|
+
private _cache;
|
|
9
|
+
private _connections;
|
|
10
|
+
private _plugins;
|
|
8
11
|
constructor();
|
|
12
|
+
getSettings(): SettingsData;
|
|
13
|
+
getCache(): CacheData;
|
|
9
14
|
load(): Promise<void>;
|
|
15
|
+
getPlugins(): PluginModule[];
|
|
16
|
+
getConnections(): IConnect[];
|
|
10
17
|
setSetting(key: string, value: string): void;
|
|
18
|
+
setCache(key: string, value: any): void;
|
|
19
|
+
private cloneInstance;
|
|
20
|
+
private cloneArrayOfInstances;
|
|
11
21
|
private getSettingsFilePath;
|
|
22
|
+
private getCacheFilePath;
|
|
12
23
|
private getDefaultSettings;
|
|
13
|
-
private
|
|
24
|
+
private getSettingsInternal;
|
|
25
|
+
private getCacheInternal;
|
|
14
26
|
private generateSettingsFile;
|
|
27
|
+
private generateCacheFile;
|
|
15
28
|
static getInstance(): Context;
|
|
16
29
|
}
|
package/dist/utils/Context.js
CHANGED
|
@@ -52,6 +52,7 @@ const fs = __importStar(require("fs"));
|
|
|
52
52
|
const ini = __importStar(require("ini"));
|
|
53
53
|
const trm_commons_1 = require("trm-commons");
|
|
54
54
|
const trm_core_1 = require("trm-core");
|
|
55
|
+
const CACHE_FILE_NAME = ".cache";
|
|
55
56
|
const SETTINGS_FILE_NAME = "settings.ini";
|
|
56
57
|
class RESTConnectExtended extends trm_commons_1.RESTConnect {
|
|
57
58
|
getSystemConnector() {
|
|
@@ -62,41 +63,74 @@ class RESTConnectExtended extends trm_commons_1.RESTConnect {
|
|
|
62
63
|
class RFCConnectExtended extends trm_commons_1.RFCConnect {
|
|
63
64
|
getSystemConnector() {
|
|
64
65
|
const data = this.getData();
|
|
65
|
-
return new trm_core_1.RFCSystemConnector(data, data, (0, _1.getTempFolder)(), Context.getInstance().
|
|
66
|
+
return new trm_core_1.RFCSystemConnector(data, data, (0, _1.getTempFolder)(), Context.getInstance().getSettings().globalNodeModules);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
class Context {
|
|
69
70
|
constructor() {
|
|
70
|
-
this.
|
|
71
|
-
|
|
71
|
+
this._pluginsLoaded = false;
|
|
72
|
+
this._connections = [];
|
|
73
|
+
this._plugins = [];
|
|
74
|
+
this._settings = this.getSettingsInternal();
|
|
75
|
+
this._cache = this.getCacheInternal();
|
|
76
|
+
if (typeof (this._settings.r3transDocker) !== 'boolean') {
|
|
72
77
|
if (process.platform === 'darwin') {
|
|
73
78
|
trm_commons_1.Logger.info(`R3trans defaults to docker in darwin os.`, true);
|
|
74
|
-
this.
|
|
79
|
+
this._settings.r3transDocker = true;
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
}
|
|
83
|
+
getSettings() {
|
|
84
|
+
return this._settings;
|
|
85
|
+
}
|
|
86
|
+
getCache() {
|
|
87
|
+
return this._cache;
|
|
88
|
+
}
|
|
78
89
|
load() {
|
|
79
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.
|
|
91
|
+
if (!this._pluginsLoaded) {
|
|
92
|
+
this._plugins = yield trm_commons_1.Plugin.load({
|
|
93
|
+
globalNodeModulesPath: this._settings.globalNodeModules
|
|
94
|
+
});
|
|
95
|
+
this._connections = yield trm_commons_1.Plugin.call("client", "onContextLoadConnections", [new RESTConnectExtended(), new RFCConnectExtended()]);
|
|
96
|
+
this._pluginsLoaded = true;
|
|
86
97
|
}
|
|
87
98
|
});
|
|
88
99
|
}
|
|
100
|
+
getPlugins() {
|
|
101
|
+
return this._plugins;
|
|
102
|
+
}
|
|
103
|
+
getConnections() {
|
|
104
|
+
return this.cloneArrayOfInstances(this._connections);
|
|
105
|
+
}
|
|
89
106
|
setSetting(key, value) {
|
|
90
|
-
if (this.
|
|
107
|
+
if (this._settings[key] === undefined) {
|
|
91
108
|
throw new Error(`Invalid key ${key}.`);
|
|
92
109
|
}
|
|
93
110
|
const filePath = this.getSettingsFilePath();
|
|
94
|
-
this.
|
|
95
|
-
this.generateSettingsFile(this.
|
|
111
|
+
this._settings[key] = value;
|
|
112
|
+
this.generateSettingsFile(this._settings, filePath);
|
|
113
|
+
}
|
|
114
|
+
setCache(key, value) {
|
|
115
|
+
const filePath = this.getCacheFilePath();
|
|
116
|
+
this._cache[key] = {
|
|
117
|
+
ts: Date.now(),
|
|
118
|
+
data: value
|
|
119
|
+
};
|
|
120
|
+
this.generateCacheFile(this._cache, filePath);
|
|
121
|
+
}
|
|
122
|
+
cloneInstance(obj) {
|
|
123
|
+
return Object.assign(Object.create(Object.getPrototypeOf(obj)), obj);
|
|
124
|
+
}
|
|
125
|
+
cloneArrayOfInstances(arr) {
|
|
126
|
+
return arr.map(this.cloneInstance);
|
|
96
127
|
}
|
|
97
128
|
getSettingsFilePath() {
|
|
98
129
|
return path_1.default.join((0, _1.getRoamingFolder)(), SETTINGS_FILE_NAME);
|
|
99
130
|
}
|
|
131
|
+
getCacheFilePath() {
|
|
132
|
+
return path_1.default.join((0, _1.getRoamingFolder)(), CACHE_FILE_NAME);
|
|
133
|
+
}
|
|
100
134
|
getDefaultSettings() {
|
|
101
135
|
var sapLandscape = path_1.default.join((0, _1.getRoamingPath)(), process.platform === 'win32' ? 'SAP\\Common\\SAPUILandscape.xml' : 'SAP/SAPGUILandscape.xml');
|
|
102
136
|
if (!fs.existsSync(sapLandscape)) {
|
|
@@ -109,7 +143,7 @@ class Context {
|
|
|
109
143
|
sapLandscape
|
|
110
144
|
};
|
|
111
145
|
}
|
|
112
|
-
|
|
146
|
+
getSettingsInternal() {
|
|
113
147
|
var defaultSettings;
|
|
114
148
|
const filePath = this.getSettingsFilePath();
|
|
115
149
|
if (fs.existsSync(filePath)) {
|
|
@@ -134,9 +168,23 @@ class Context {
|
|
|
134
168
|
this.generateSettingsFile(defaultSettings, filePath);
|
|
135
169
|
return defaultSettings;
|
|
136
170
|
}
|
|
171
|
+
getCacheInternal() {
|
|
172
|
+
const filePath = this.getCacheFilePath();
|
|
173
|
+
if (fs.existsSync(filePath)) {
|
|
174
|
+
try {
|
|
175
|
+
return JSON.parse(fs.readFileSync(filePath).toString());
|
|
176
|
+
}
|
|
177
|
+
catch (e) { }
|
|
178
|
+
}
|
|
179
|
+
this.generateCacheFile({}, filePath);
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
137
182
|
generateSettingsFile(data, filePath) {
|
|
138
183
|
fs.writeFileSync(filePath, ini.encode(data), { encoding: 'utf8', flag: 'w' });
|
|
139
184
|
}
|
|
185
|
+
generateCacheFile(data, filePath) {
|
|
186
|
+
fs.writeFileSync(filePath, JSON.stringify(data), { encoding: 'utf8', flag: 'w' });
|
|
187
|
+
}
|
|
140
188
|
static getInstance() {
|
|
141
189
|
if (!this._instance) {
|
|
142
190
|
this._instance = new Context();
|
|
@@ -18,10 +18,19 @@ const getClientVersion_1 = require("./getClientVersion");
|
|
|
18
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
19
19
|
const getNpmPackageLatestVersion_1 = require("./getNpmPackageLatestVersion");
|
|
20
20
|
const trm_commons_1 = require("trm-commons");
|
|
21
|
+
const Context_1 = require("./Context");
|
|
21
22
|
function checkCliUpdate(print) {
|
|
22
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
24
|
try {
|
|
24
|
-
|
|
25
|
+
var latestVersion;
|
|
26
|
+
const cache = Context_1.Context.getInstance().getCache().latestVersion;
|
|
27
|
+
if (cache && cache.ts && Date.now() - cache.ts <= 60000) {
|
|
28
|
+
latestVersion = cache.data;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
latestVersion = yield (0, getNpmPackageLatestVersion_1.getNpmPackageLatestVersion)('trm-client');
|
|
32
|
+
Context_1.Context.getInstance().setCache('latestVersion', latestVersion);
|
|
33
|
+
}
|
|
25
34
|
const localVersion = (0, getClientVersion_1.getClientVersion)();
|
|
26
35
|
const versionDiff = (0, semver_1.diff)(localVersion, latestVersion);
|
|
27
36
|
if ((versionDiff === 'minor' || versionDiff === 'major') && (0, semver_1.gt)(latestVersion, localVersion)) {
|
|
@@ -29,7 +38,7 @@ function checkCliUpdate(print) {
|
|
|
29
38
|
trm_commons_1.Logger.warning(`A newer release of trm-client (v${chalk_1.default.bold(latestVersion)}) is available.`);
|
|
30
39
|
trm_commons_1.Logger.warning(`New releases can introduce features and bug fixes.`);
|
|
31
40
|
trm_commons_1.Logger.warning(`It is recommended to update your client by running the command`);
|
|
32
|
-
trm_commons_1.Logger.warning(` ${chalk_1.default.bold('trm update')}
|
|
41
|
+
trm_commons_1.Logger.warning(` ${chalk_1.default.bold('trm update')}`);
|
|
33
42
|
trm_commons_1.Logger.warning(` `);
|
|
34
43
|
}
|
|
35
44
|
}
|
|
@@ -49,9 +49,9 @@ const Context_1 = require("./Context");
|
|
|
49
49
|
function getSapLogonConnections() {
|
|
50
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
51
|
var systems = [];
|
|
52
|
-
const sapLandscape = Context_1.Context.getInstance().
|
|
52
|
+
const sapLandscape = Context_1.Context.getInstance().getSettings().sapLandscape;
|
|
53
53
|
if (sapLandscape) {
|
|
54
|
-
const sXml = fs.readFileSync(Context_1.Context.getInstance().
|
|
54
|
+
const sXml = fs.readFileSync(Context_1.Context.getInstance().getSettings().sapLandscape, { encoding: 'utf8', flag: 'r' });
|
|
55
55
|
const result = yield (0, xml2js_1.xml2js)(sXml);
|
|
56
56
|
try {
|
|
57
57
|
result.Landscape.Services[0].Service.forEach((xmlObj) => {
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -31,4 +31,5 @@ __exportStar(require("./getClientNodeDependencies"), exports);
|
|
|
31
31
|
__exportStar(require("./DummyConnector"), exports);
|
|
32
32
|
__exportStar(require("./getNpmPackageLatestVersion"), exports);
|
|
33
33
|
__exportStar(require("./SettingsData"), exports);
|
|
34
|
+
__exportStar(require("./CacheData"), exports);
|
|
34
35
|
__exportStar(require("./Context"), exports);
|
|
@@ -24,8 +24,8 @@ function registerCommand(command, args) {
|
|
|
24
24
|
const ignoreRegistryUnreachable = args.ignoreRegistryUnreachable ? true : false;
|
|
25
25
|
const noSystemAlias = args.noSystemAlias ? true : false;
|
|
26
26
|
const registryAuthBlacklist = args.registryAuthBlacklist || [];
|
|
27
|
-
const defaultLogger = Context_1.Context.getInstance().
|
|
28
|
-
const logOutputFolder = Context_1.Context.getInstance().
|
|
27
|
+
const defaultLogger = Context_1.Context.getInstance().getSettings().loggerType;
|
|
28
|
+
const logOutputFolder = Context_1.Context.getInstance().getSettings().logOutputFolder;
|
|
29
29
|
if (requiresConnection) {
|
|
30
30
|
command.option(`-de, --dest <dest>`, `System ID.`)
|
|
31
31
|
.option(`-us, --user <user>`, `System User Logon.`)
|
package/package.json
CHANGED
|
@@ -1,63 +1,65 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "trm-client",
|
|
3
|
-
"version": "5.
|
|
4
|
-
"description": "TRM (Transport Request Manager) Client",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"changelog.txt",
|
|
9
|
-
"dist",
|
|
10
|
-
"!dist/test.js",
|
|
11
|
-
"!dist/test.js.map",
|
|
12
|
-
"!dist/test.d.ts",
|
|
13
|
-
"!dist/.env",
|
|
14
|
-
"!dist/dev_rfc.log"
|
|
15
|
-
],
|
|
16
|
-
"bin": {
|
|
17
|
-
"trm": "dist/index.js"
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"cleanBuild": "rimraf dist/",
|
|
21
|
-
"build": "npm run cleanBuild && tsc --sourceMap false",
|
|
22
|
-
"prepublishOnly": "npm run build"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"trm",
|
|
26
|
-
"abap"
|
|
27
|
-
],
|
|
28
|
-
"homepage": "https://www.trmregistry.com",
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/RegestaItalia/trm-client.git"
|
|
32
|
-
},
|
|
33
|
-
"author": {
|
|
34
|
-
"name": "Simone Gaffurini",
|
|
35
|
-
"email": "simone.gaffurini@regestaitalia.it"
|
|
36
|
-
},
|
|
37
|
-
"license": "MIT",
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@esm2cjs/normalize-url": "^8.0.0",
|
|
40
|
-
"chalk": "^4.1.2",
|
|
41
|
-
"commander": "^11.0.0",
|
|
42
|
-
"dotenv": "^16.3.1",
|
|
43
|
-
"execa": "^9.6.0",
|
|
44
|
-
"get-latest-version": "^5.1.0",
|
|
45
|
-
"get-root-path": "^2.0.2",
|
|
46
|
-
"ini": "^4.1.1",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"trm-
|
|
50
|
-
"trm-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"@types/
|
|
59
|
-
"@types/
|
|
60
|
-
"@types/
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "trm-client",
|
|
3
|
+
"version": "5.2.1",
|
|
4
|
+
"description": "TRM (Transport Request Manager) Client",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"changelog.txt",
|
|
9
|
+
"dist",
|
|
10
|
+
"!dist/test.js",
|
|
11
|
+
"!dist/test.js.map",
|
|
12
|
+
"!dist/test.d.ts",
|
|
13
|
+
"!dist/.env",
|
|
14
|
+
"!dist/dev_rfc.log"
|
|
15
|
+
],
|
|
16
|
+
"bin": {
|
|
17
|
+
"trm": "dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"cleanBuild": "rimraf dist/",
|
|
21
|
+
"build": "npm run cleanBuild && tsc --sourceMap false",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"trm",
|
|
26
|
+
"abap"
|
|
27
|
+
],
|
|
28
|
+
"homepage": "https://www.trmregistry.com",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/RegestaItalia/trm-client.git"
|
|
32
|
+
},
|
|
33
|
+
"author": {
|
|
34
|
+
"name": "Simone Gaffurini",
|
|
35
|
+
"email": "simone.gaffurini@regestaitalia.it"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@esm2cjs/normalize-url": "^8.0.0",
|
|
40
|
+
"chalk": "^4.1.2",
|
|
41
|
+
"commander": "^11.0.0",
|
|
42
|
+
"dotenv": "^16.3.1",
|
|
43
|
+
"execa": "^9.6.0",
|
|
44
|
+
"get-latest-version": "^5.1.0",
|
|
45
|
+
"get-root-path": "^2.0.2",
|
|
46
|
+
"ini": "^4.1.1",
|
|
47
|
+
"lodash": "^4.17.21",
|
|
48
|
+
"semver": "^7.5.4",
|
|
49
|
+
"trm-commons": "^3.4.2",
|
|
50
|
+
"trm-core": "^7.5.5",
|
|
51
|
+
"trm-registry-types": "^1.2.0",
|
|
52
|
+
"xml2js": "^0.6.2"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"trm-commons": "^3.4.2"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/ini": "^1.3.31",
|
|
59
|
+
"@types/lodash": "^4.17.20",
|
|
60
|
+
"@types/node": "^20.4.8",
|
|
61
|
+
"@types/semver": "^7.5.3",
|
|
62
|
+
"@types/xml2js": "^0.4.11",
|
|
63
|
+
"rimraf": "^6.0.1"
|
|
64
|
+
}
|
|
65
|
+
}
|