@intecoag/inteco-cli 1.11.8 → 1.12.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/README.md +13 -1
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +158 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/modules/adbBridge.d.ts +2 -0
  7. package/dist/modules/adbBridge.d.ts.map +1 -0
  8. package/dist/modules/adbBridge.js +40 -0
  9. package/dist/modules/adbBridge.js.map +1 -0
  10. package/dist/modules/adbBridge.test.d.ts +2 -0
  11. package/dist/modules/adbBridge.test.d.ts.map +1 -0
  12. package/dist/modules/adbBridge.test.js +39 -0
  13. package/dist/modules/adbBridge.test.js.map +1 -0
  14. package/dist/modules/adbIntentSender.d.ts +2 -0
  15. package/dist/modules/adbIntentSender.d.ts.map +1 -0
  16. package/dist/modules/adbIntentSender.js +67 -0
  17. package/dist/modules/adbIntentSender.js.map +1 -0
  18. package/dist/modules/adbIntentSender.test.d.ts +2 -0
  19. package/dist/modules/adbIntentSender.test.d.ts.map +1 -0
  20. package/dist/modules/adbIntentSender.test.js +48 -0
  21. package/dist/modules/adbIntentSender.test.js.map +1 -0
  22. package/dist/modules/azureSync.d.ts +16 -0
  23. package/dist/modules/azureSync.d.ts.map +1 -0
  24. package/{src → dist}/modules/azureSync.js +55 -136
  25. package/dist/modules/azureSync.js.map +1 -0
  26. package/dist/modules/azureSync.test.d.ts +2 -0
  27. package/dist/modules/azureSync.test.d.ts.map +1 -0
  28. package/dist/modules/azureSync.test.js +69 -0
  29. package/dist/modules/azureSync.test.js.map +1 -0
  30. package/dist/modules/bundleProduct.d.ts +2 -0
  31. package/dist/modules/bundleProduct.d.ts.map +1 -0
  32. package/{src → dist}/modules/bundleProduct.js +41 -80
  33. package/dist/modules/bundleProduct.js.map +1 -0
  34. package/dist/modules/bundleProduct.test.d.ts +2 -0
  35. package/dist/modules/bundleProduct.test.d.ts.map +1 -0
  36. package/dist/modules/bundleProduct.test.js +75 -0
  37. package/dist/modules/bundleProduct.test.js.map +1 -0
  38. package/dist/modules/changelog.d.ts +3 -0
  39. package/dist/modules/changelog.d.ts.map +1 -0
  40. package/dist/modules/changelog.js +45 -0
  41. package/dist/modules/changelog.js.map +1 -0
  42. package/dist/modules/changelog.test.d.ts +2 -0
  43. package/dist/modules/changelog.test.d.ts.map +1 -0
  44. package/dist/modules/changelog.test.js +33 -0
  45. package/dist/modules/changelog.test.js.map +1 -0
  46. package/dist/modules/configMutation.d.ts +5 -0
  47. package/dist/modules/configMutation.d.ts.map +1 -0
  48. package/{src → dist}/modules/configMutation.js +57 -104
  49. package/dist/modules/configMutation.js.map +1 -0
  50. package/dist/modules/configMutation.test.d.ts +2 -0
  51. package/dist/modules/configMutation.test.d.ts.map +1 -0
  52. package/dist/modules/configMutation.test.js +28 -0
  53. package/dist/modules/configMutation.test.js.map +1 -0
  54. package/dist/modules/csvMerger.d.ts +2 -0
  55. package/dist/modules/csvMerger.d.ts.map +1 -0
  56. package/dist/modules/csvMerger.js +104 -0
  57. package/dist/modules/csvMerger.js.map +1 -0
  58. package/dist/modules/csvMerger.test.d.ts +2 -0
  59. package/dist/modules/csvMerger.test.d.ts.map +1 -0
  60. package/dist/modules/csvMerger.test.js +76 -0
  61. package/dist/modules/csvMerger.test.js.map +1 -0
  62. package/dist/modules/deleteDB.d.ts +2 -0
  63. package/dist/modules/deleteDB.d.ts.map +1 -0
  64. package/dist/modules/deleteDB.js +75 -0
  65. package/dist/modules/deleteDB.js.map +1 -0
  66. package/dist/modules/deleteDB.test.d.ts +2 -0
  67. package/dist/modules/deleteDB.test.d.ts.map +1 -0
  68. package/dist/modules/deleteDB.test.js +78 -0
  69. package/dist/modules/deleteDB.test.js.map +1 -0
  70. package/dist/modules/dumpDB.d.ts +3 -0
  71. package/dist/modules/dumpDB.d.ts.map +1 -0
  72. package/{src → dist}/modules/dumpDB.js +64 -89
  73. package/dist/modules/dumpDB.js.map +1 -0
  74. package/dist/modules/dumpDB.test.d.ts +2 -0
  75. package/dist/modules/dumpDB.test.d.ts.map +1 -0
  76. package/dist/modules/dumpDB.test.js +104 -0
  77. package/dist/modules/dumpDB.test.js.map +1 -0
  78. package/dist/modules/dumpTableToCSV.d.ts +4 -0
  79. package/dist/modules/dumpTableToCSV.d.ts.map +1 -0
  80. package/dist/modules/dumpTableToCSV.js +135 -0
  81. package/dist/modules/dumpTableToCSV.js.map +1 -0
  82. package/dist/modules/dumpTableToCSV.test.d.ts +2 -0
  83. package/dist/modules/dumpTableToCSV.test.d.ts.map +1 -0
  84. package/dist/modules/dumpTableToCSV.test.js +15 -0
  85. package/dist/modules/dumpTableToCSV.test.js.map +1 -0
  86. package/dist/modules/extdSearch.d.ts +2 -0
  87. package/dist/modules/extdSearch.d.ts.map +1 -0
  88. package/{src → dist}/modules/extdSearch.js +60 -60
  89. package/dist/modules/extdSearch.js.map +1 -0
  90. package/dist/modules/extdSearch.test.d.ts +2 -0
  91. package/dist/modules/extdSearch.test.d.ts.map +1 -0
  92. package/dist/modules/extdSearch.test.js +114 -0
  93. package/dist/modules/extdSearch.test.js.map +1 -0
  94. package/dist/modules/githubDeploymentKey.d.ts +3 -0
  95. package/dist/modules/githubDeploymentKey.d.ts.map +1 -0
  96. package/dist/modules/githubDeploymentKey.js +241 -0
  97. package/dist/modules/githubDeploymentKey.js.map +1 -0
  98. package/dist/modules/githubDeploymentKey.test.d.ts +2 -0
  99. package/dist/modules/githubDeploymentKey.test.d.ts.map +1 -0
  100. package/dist/modules/githubDeploymentKey.test.js +50 -0
  101. package/dist/modules/githubDeploymentKey.test.js.map +1 -0
  102. package/dist/modules/githubDeploymentKeysList.d.ts +6 -0
  103. package/dist/modules/githubDeploymentKeysList.d.ts.map +1 -0
  104. package/dist/modules/githubDeploymentKeysList.js +185 -0
  105. package/dist/modules/githubDeploymentKeysList.js.map +1 -0
  106. package/dist/modules/githubDeploymentKeysList.test.d.ts +2 -0
  107. package/dist/modules/githubDeploymentKeysList.test.d.ts.map +1 -0
  108. package/dist/modules/githubDeploymentKeysList.test.js +70 -0
  109. package/dist/modules/githubDeploymentKeysList.test.js.map +1 -0
  110. package/dist/modules/githubSecurityAdvisories.d.ts +3 -0
  111. package/dist/modules/githubSecurityAdvisories.d.ts.map +1 -0
  112. package/dist/modules/githubSecurityAdvisories.js +145 -0
  113. package/dist/modules/githubSecurityAdvisories.js.map +1 -0
  114. package/dist/modules/githubSecurityAdvisories.test.d.ts +2 -0
  115. package/dist/modules/githubSecurityAdvisories.test.d.ts.map +1 -0
  116. package/dist/modules/githubSecurityAdvisories.test.js +67 -0
  117. package/dist/modules/githubSecurityAdvisories.test.js.map +1 -0
  118. package/dist/modules/graphqlSchemaExport.d.ts +2 -0
  119. package/dist/modules/graphqlSchemaExport.d.ts.map +1 -0
  120. package/dist/modules/graphqlSchemaExport.js +59 -0
  121. package/dist/modules/graphqlSchemaExport.js.map +1 -0
  122. package/dist/modules/graphqlSchemaExport.test.d.ts +2 -0
  123. package/dist/modules/graphqlSchemaExport.test.d.ts.map +1 -0
  124. package/dist/modules/graphqlSchemaExport.test.js +61 -0
  125. package/dist/modules/graphqlSchemaExport.test.js.map +1 -0
  126. package/dist/modules/importDB.d.ts +2 -0
  127. package/dist/modules/importDB.d.ts.map +1 -0
  128. package/{src → dist}/modules/importDB.js +48 -66
  129. package/dist/modules/importDB.js.map +1 -0
  130. package/dist/modules/importDB.test.d.ts +2 -0
  131. package/dist/modules/importDB.test.d.ts.map +1 -0
  132. package/dist/modules/importDB.test.js +65 -0
  133. package/dist/modules/importDB.test.js.map +1 -0
  134. package/dist/modules/rewriteConfig.d.ts +3 -0
  135. package/dist/modules/rewriteConfig.d.ts.map +1 -0
  136. package/dist/modules/rewriteConfig.js +75 -0
  137. package/dist/modules/rewriteConfig.js.map +1 -0
  138. package/dist/modules/rewriteConfig.test.d.ts +2 -0
  139. package/dist/modules/rewriteConfig.test.d.ts.map +1 -0
  140. package/dist/modules/rewriteConfig.test.js +62 -0
  141. package/dist/modules/rewriteConfig.test.js.map +1 -0
  142. package/dist/modules/setCLIConfig.d.ts +2 -0
  143. package/dist/modules/setCLIConfig.d.ts.map +1 -0
  144. package/dist/modules/setCLIConfig.js +29 -0
  145. package/dist/modules/setCLIConfig.js.map +1 -0
  146. package/dist/modules/setCLIConfig.test.d.ts +2 -0
  147. package/dist/modules/setCLIConfig.test.d.ts.map +1 -0
  148. package/dist/modules/setCLIConfig.test.js +40 -0
  149. package/dist/modules/setCLIConfig.test.js.map +1 -0
  150. package/dist/modules/syncConfig.d.ts +4 -0
  151. package/dist/modules/syncConfig.d.ts.map +1 -0
  152. package/{src → dist}/modules/syncConfig.js +76 -129
  153. package/dist/modules/syncConfig.js.map +1 -0
  154. package/dist/modules/syncConfig.test.d.ts +2 -0
  155. package/dist/modules/syncConfig.test.d.ts.map +1 -0
  156. package/dist/modules/syncConfig.test.js +71 -0
  157. package/dist/modules/syncConfig.test.js.map +1 -0
  158. package/dist/modules/t003Rewrite.d.ts +2 -0
  159. package/dist/modules/t003Rewrite.d.ts.map +1 -0
  160. package/dist/modules/t003Rewrite.js +53 -0
  161. package/dist/modules/t003Rewrite.js.map +1 -0
  162. package/dist/modules/t003Rewrite.test.d.ts +2 -0
  163. package/dist/modules/t003Rewrite.test.d.ts.map +1 -0
  164. package/dist/modules/t003Rewrite.test.js +43 -0
  165. package/dist/modules/t003Rewrite.test.js.map +1 -0
  166. package/dist/modules/t009Search.d.ts +2 -0
  167. package/dist/modules/t009Search.d.ts.map +1 -0
  168. package/dist/modules/t009Search.js +30 -0
  169. package/dist/modules/t009Search.js.map +1 -0
  170. package/dist/modules/t009Search.test.d.ts +2 -0
  171. package/dist/modules/t009Search.test.d.ts.map +1 -0
  172. package/dist/modules/t009Search.test.js +83 -0
  173. package/dist/modules/t009Search.test.js.map +1 -0
  174. package/{src → dist}/ressources/cmds.json +3 -0
  175. package/dist/utils/azure/azure.d.ts +24 -0
  176. package/dist/utils/azure/azure.d.ts.map +1 -0
  177. package/{src → dist}/utils/azure/azure.js +14 -21
  178. package/dist/utils/azure/azure.js.map +1 -0
  179. package/dist/utils/azure/azure.test.d.ts +2 -0
  180. package/dist/utils/azure/azure.test.d.ts.map +1 -0
  181. package/dist/utils/azure/azure.test.js +98 -0
  182. package/dist/utils/azure/azure.test.js.map +1 -0
  183. package/dist/utils/config/config.d.ts +27 -0
  184. package/dist/utils/config/config.d.ts.map +1 -0
  185. package/dist/utils/config/config.js +74 -0
  186. package/dist/utils/config/config.js.map +1 -0
  187. package/dist/utils/config/config.test.d.ts +2 -0
  188. package/dist/utils/config/config.test.d.ts.map +1 -0
  189. package/dist/utils/config/config.test.js +64 -0
  190. package/dist/utils/config/config.test.js.map +1 -0
  191. package/dist/utils/db/DB.d.ts +14 -0
  192. package/dist/utils/db/DB.d.ts.map +1 -0
  193. package/dist/utils/db/DB.js +61 -0
  194. package/dist/utils/db/DB.js.map +1 -0
  195. package/dist/utils/db/DB.test.d.ts +2 -0
  196. package/dist/utils/db/DB.test.d.ts.map +1 -0
  197. package/dist/utils/db/DB.test.js +73 -0
  198. package/dist/utils/db/DB.test.js.map +1 -0
  199. package/dist/utils/fs/FS.d.ts +15 -0
  200. package/dist/utils/fs/FS.d.ts.map +1 -0
  201. package/{src → dist}/utils/fs/FS.js +31 -45
  202. package/dist/utils/fs/FS.js.map +1 -0
  203. package/dist/utils/fs/FS.test.d.ts +2 -0
  204. package/dist/utils/fs/FS.test.d.ts.map +1 -0
  205. package/dist/utils/fs/FS.test.js +124 -0
  206. package/dist/utils/fs/FS.test.js.map +1 -0
  207. package/dist/utils/github/github.d.ts +29 -0
  208. package/dist/utils/github/github.d.ts.map +1 -0
  209. package/dist/utils/github/github.js +96 -0
  210. package/dist/utils/github/github.js.map +1 -0
  211. package/dist/utils/github/github.test.d.ts +2 -0
  212. package/dist/utils/github/github.test.d.ts.map +1 -0
  213. package/dist/utils/github/github.test.js +83 -0
  214. package/dist/utils/github/github.test.js.map +1 -0
  215. package/dist/utils/shell/DatabaseShell.d.ts +77 -0
  216. package/dist/utils/shell/DatabaseShell.d.ts.map +1 -0
  217. package/{src → dist}/utils/shell/DatabaseShell.js +73 -87
  218. package/dist/utils/shell/DatabaseShell.js.map +1 -0
  219. package/dist/utils/shell/DatabaseShell.test.d.ts +2 -0
  220. package/dist/utils/shell/DatabaseShell.test.d.ts.map +1 -0
  221. package/dist/utils/shell/DatabaseShell.test.js +78 -0
  222. package/dist/utils/shell/DatabaseShell.test.js.map +1 -0
  223. package/dist/utils/shell/DatabaseShellBuilder.d.ts +67 -0
  224. package/dist/utils/shell/DatabaseShellBuilder.d.ts.map +1 -0
  225. package/{src → dist}/utils/shell/DatabaseShellBuilder.js +50 -59
  226. package/dist/utils/shell/DatabaseShellBuilder.js.map +1 -0
  227. package/dist/utils/shell/DatabaseShellBuilder.test.d.ts +2 -0
  228. package/dist/utils/shell/DatabaseShellBuilder.test.d.ts.map +1 -0
  229. package/dist/utils/shell/DatabaseShellBuilder.test.js +55 -0
  230. package/dist/utils/shell/DatabaseShellBuilder.test.js.map +1 -0
  231. package/dist/utils/shell/Shell.d.ts +30 -0
  232. package/dist/utils/shell/Shell.d.ts.map +1 -0
  233. package/{src → dist}/utils/shell/Shell.js +14 -19
  234. package/dist/utils/shell/Shell.js.map +1 -0
  235. package/dist/utils/shell/Shell.test.d.ts +2 -0
  236. package/dist/utils/shell/Shell.test.d.ts.map +1 -0
  237. package/dist/utils/shell/Shell.test.js +65 -0
  238. package/dist/utils/shell/Shell.test.js.map +1 -0
  239. package/dist/utils/shell/ShellBuilder.d.ts +60 -0
  240. package/dist/utils/shell/ShellBuilder.d.ts.map +1 -0
  241. package/{src → dist}/utils/shell/ShellBuilder.js +23 -44
  242. package/dist/utils/shell/ShellBuilder.js.map +1 -0
  243. package/dist/utils/shell/ShellBuilder.test.d.ts +2 -0
  244. package/dist/utils/shell/ShellBuilder.test.d.ts.map +1 -0
  245. package/dist/utils/shell/ShellBuilder.test.js +39 -0
  246. package/dist/utils/shell/ShellBuilder.test.js.map +1 -0
  247. package/package.json +39 -11
  248. package/.github/dependabot.yml +0 -28
  249. package/.github/workflows/publish.yml +0 -31
  250. package/.husky/commit-msg +0 -1
  251. package/.vscode/settings.json +0 -6
  252. package/commitlint.config.mjs +0 -4
  253. package/src/index.js +0 -130
  254. package/src/modules/adbBridge.js +0 -52
  255. package/src/modules/adbIntentSender.js +0 -82
  256. package/src/modules/changelog.js +0 -60
  257. package/src/modules/csvMerger.js +0 -118
  258. package/src/modules/deleteDB.js +0 -84
  259. package/src/modules/dumpTableToCSV.js +0 -154
  260. package/src/modules/githubDeploymentKey.js +0 -265
  261. package/src/modules/githubDeploymentKeysList.js +0 -199
  262. package/src/modules/githubSecurityAdvisories.js +0 -162
  263. package/src/modules/graphqlSchemaExport.js +0 -61
  264. package/src/modules/rewriteConfig.js +0 -93
  265. package/src/modules/setCLIConfig.js +0 -33
  266. package/src/modules/t003Rewrite.js +0 -64
  267. package/src/modules/t009Search.js +0 -34
  268. package/src/utils/config/config.js +0 -70
  269. package/src/utils/db/DB.js +0 -54
  270. package/src/utils/github/github.js +0 -102
  271. /package/{src → dist}/ressources/wegas_p.ico +0 -0
  272. /package/{src → dist}/utils/config/default.json +0 -0
@@ -1,93 +0,0 @@
1
- import prompts from "prompts";
2
- import os from 'os';
3
- import { createEditor } from "properties-parser";
4
- import { writeFileSync, readFileSync, readdirSync } from "fs";
5
- import YAML from 'yaml'
6
- import chalk from "chalk";
7
- import { Config } from "../utils/config/config.js";
8
- import { DB } from "../utils/db/DB.js";
9
- import path from "path";
10
-
11
-
12
-
13
- async function configRewrite(cli) {
14
- console.log()
15
-
16
- const homedir = os.homedir();
17
-
18
- const config = await Config.getConfig();
19
-
20
- const databaseNames = await DB.getDatabaseNames();
21
-
22
- const configDirectories = readdirSync(config.configIndividualPath, { withFileTypes: true }).filter(dirent => dirent.isDirectory()).map(dirent => { return { title: dirent.name } })
23
-
24
- let success = true;
25
-
26
- const responses = await prompts([{
27
- // DB-Auswahl von DB
28
- type: 'autocomplete',
29
- name: 'dbName',
30
- message: 'DB-Name?',
31
- choices: databaseNames.map(name => { return { title: name.name } })
32
- }, {
33
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
34
- type: 'autocomplete',
35
- name: 'configName',
36
- message: 'ConfigIndividual-Name?',
37
- choices: configDirectories
38
- }, {
39
- type: 'number',
40
- name: 'mnr',
41
- message: 'Mandant?',
42
- initial: '1'
43
- }, {
44
- type: 'autocomplete',
45
- name: 'language',
46
- message: 'Sprache?',
47
- choices: [
48
- { title: '<Nicht Verändern>', value: '?' },
49
- { title: 'Deutsch', value: 'd' },
50
- { title: 'Französisch', value: 'f' },
51
- { title: 'Italienisch', value: 'i' }
52
- ]
53
- }], {
54
- onCancel: () => {
55
- console.log()
56
- console.log(chalk.red("Cancelled Rewrite!"))
57
- console.log()
58
- success = false
59
- }
60
- });
61
-
62
- if (success) {
63
- // Rewrite jwegas.properties
64
- const editorJwegasProperties = createEditor(homedir + path.sep+"jwegas.properties")
65
- editorJwegasProperties.set("user.mandant", responses.mnr.toString());
66
- editorJwegasProperties.save();
67
-
68
- // Rewrite wegas.properties
69
- const editorWegasProperties = createEditor(config.configIndividualPath + path.sep+"wegas.properties")
70
- editorWegasProperties.set("db.database", responses.dbName);
71
-
72
- if(responses.language != '?') {
73
- editorWegasProperties.set("language", responses.language)
74
- }
75
- editorWegasProperties.save();
76
-
77
- // Rewrite path.yaml
78
- const content = readFileSync(config.configIndividualPath +path.sep+"path.yaml", "utf-8");
79
-
80
- const doc = YAML.parseDocument(content)
81
-
82
- doc.set("pathIndividual", config.configIndividualPathWrite + "\\\\" + responses.configName + "\\\\")
83
-
84
- writeFileSync(config.configIndividualPath +path.sep+"path.yaml", doc.toString());
85
-
86
- console.log()
87
- console.log(chalk.green("Config-Rewrite successful!"))
88
- console.log()
89
- }
90
-
91
- }
92
-
93
- export default configRewrite;
@@ -1,33 +0,0 @@
1
- import prompts from "prompts";
2
- import { Config } from "../utils/config/config.js";
3
- import chalk from "chalk";
4
-
5
- export default async function writeCLIConfig(){
6
- console.log()
7
-
8
- let data = await Config.getConfig();
9
-
10
- let keys = Object.keys(data);
11
- let success = true;
12
-
13
- const responses = await prompts(keys.map(key => {
14
- return {
15
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
16
- type: 'text',
17
- name: key,
18
- message: key+":",
19
- initial: data[key]
20
- }
21
- }), {
22
- onCancel: () => {
23
- console.log()
24
- console.log(chalk.red("Cancelled Config!"))
25
- console.log()
26
- success = false
27
- }
28
- })
29
-
30
- if(success){
31
- Config.setConfig(responses)
32
- }
33
- }
@@ -1,64 +0,0 @@
1
- import chalk from "chalk";
2
- import prompts from "prompts";
3
- import { Config } from "../utils/config/config.js";
4
- import { DB } from "../utils/db/DB.js";
5
-
6
- export default async function t003Rewrite(cli) {
7
- console.log()
8
-
9
- const config = await Config.getConfig();
10
-
11
- const databaseNames = await DB.getDatabaseNames();
12
-
13
- let success = true;
14
-
15
- const responseDB = await prompts([{
16
- // DB-Auswahl von DB
17
- type: 'autocomplete',
18
- name: 'dbName',
19
- message: 'DB-Name?',
20
- choices: databaseNames.map(name => { return { title: name.name } })
21
- }, {
22
- type: 'number',
23
- name: 'mnr',
24
- message: 'Mandant?',
25
- initial: '1'
26
- }], {
27
- onCancel: () => {
28
- console.log()
29
- console.log(chalk.red("Cancelled Rewrite!"))
30
- console.log()
31
- success = false
32
- }
33
- });
34
-
35
- if (success) {
36
-
37
- const users = await DB.executeQueryOnDB("SELECT t003_pw FROM t003 WHERE t003_mnr = " + responseDB.mnr, responseDB.dbName);
38
-
39
-
40
- const responses = await prompts([{
41
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
42
- type: 'autocomplete',
43
- name: 'username',
44
- message: 'Username?',
45
- choices: users.map(entry => { return ({ title: entry.t003_pw }) })
46
- }], {
47
- onCancel: () => {
48
- console.log()
49
- console.log(chalk.red("Cancelled Rewrite!"))
50
- console.log()
51
- success = false
52
- }
53
- })
54
-
55
- if (success) {
56
- console.log()
57
-
58
- await DB.executeQueryOnDB("UPDATE t003 SET t003_pw = '"+config.wegasUsername+"' WHERE t003_mnr = "+responseDB.mnr+" AND t003_pw = '"+responses.username+"'", responseDB.dbName);
59
-
60
- console.log(chalk.green("T003 rewritten!"))
61
- console.log()
62
- }
63
- }
64
- }
@@ -1,34 +0,0 @@
1
- import { DatabaseShellBuilder, TableConfig } from "../utils/shell/DatabaseShellBuilder.js";
2
-
3
- export default async function t009Search() {
4
-
5
- const overviewConfig = new TableConfig()
6
- .withName("Overview")
7
- .withShortcut(":ow")
8
- .withSearchKeys(["mnr", "grp_pw", "lnr", "pgm", "flag", "bez", "bez_f", "bez_i"])
9
- .withThreshold(0.7)
10
- .withHeader(["MNR", "Mitarbeitergruppe", "Zeilennummer", "Programm-Name", "Typ (P=Programm, S=Shell)", "Bezeichnung", "Bezeichnung franz.", "Bezeichnung ital."])
11
- .withFormatter(p => [p.mnr, p.grp_pw, p.lnr, p.pgm, p.flag, p.bez, p.bez_f, p.bez_i]);
12
-
13
- const builder = new DatabaseShellBuilder();
14
- builder
15
- .withEditTools(
16
- [
17
- { title: 'MNR', column: 'mnr', default: '1' },
18
- { title: 'Mitarbeitergruppe', column: 'grp_pw', default: '' },
19
- { title: 'Zeilennummer', column: 'lnr', default: null },
20
- { title: 'Programm-Name', column: 'pgm', default: null },
21
- { title: 'Typ', column: 'flag', default: 'P' },
22
- { title: 'Bezeichnung', column: 'bez', default: null },
23
- { title: 'Bezeichnung franz.', column: 'bez_f', default: null },
24
- { title: 'Bezeichnung ital.', column: 'bez_i', default: null },
25
- ],
26
- ["mnr", "pgm"],
27
- ["mnr", "lnr", "pgm", "bez"],
28
- ["grp_pw", "flag", "bez_f", "bez_i"])
29
- .withConfig(overviewConfig)
30
- .withTables("T009", ["t009"]);
31
-
32
- const shell = builder.build();
33
- await shell.run();
34
- }
@@ -1,70 +0,0 @@
1
- import cfg from "application-config"
2
- import defaultCFG from './default.json' with {type: 'json'};
3
-
4
- export class Config{
5
- static config = cfg("inteco_cli");
6
- static configData;
7
-
8
- static async initConfig(){
9
- if(this.configData == null){
10
- this.configData = await this.config.read();
11
- }
12
-
13
- if(Object.keys(this.configData).length === 0){
14
- // Default Configuration
15
- this.configData = defaultCFG
16
- this.config.write(defaultCFG)
17
- }else{
18
- let data = this.configData;
19
- let hasChange = false;
20
- Object.keys(defaultCFG).forEach(key => {
21
- // Write new config-entries if not present
22
- if(!Object.keys(this.configData).includes(key)){
23
- data[key] = defaultCFG[key];
24
- hasChange = true;
25
- }
26
- })
27
-
28
- Object.keys(this.configData).forEach(key => {
29
- if(!Object.keys(defaultCFG).includes(key)){
30
- delete data[key]
31
- hasChange = true;
32
- }
33
- })
34
-
35
- if(hasChange){
36
- this.configData = data;
37
- this.config.write(data);
38
- }
39
- }
40
- }
41
-
42
- static async getConfig(){
43
- await this.initConfig()
44
-
45
- return this.configData
46
- }
47
-
48
- static async getConfigPath(){
49
- await this.initConfig();
50
- return this.config.filePath;
51
- }
52
-
53
- static async setConfigField(field, value){
54
- await this.initConfig();
55
-
56
- let data = this.configData;
57
-
58
- data[field] = value;
59
-
60
- this.configData = data;
61
- this.config.write(data);
62
- }
63
-
64
- static async setConfig(data){
65
- this.configData = data;
66
- this.config.write(data);
67
- }
68
-
69
-
70
- }
@@ -1,54 +0,0 @@
1
- import mysql from "mysql-await"
2
- import { Config } from "../config/config.js";
3
-
4
- export class DB{
5
- static connection;
6
-
7
- static async connect(db){
8
- const config = await Config.getConfig();
9
-
10
- this.connection = mysql.createConnection({
11
- host:config.dbURL,
12
- user:config.dbUser,
13
- password:config.dbPassword,
14
- database: db!=null?db:""
15
- })
16
- }
17
-
18
- static async executeQuery(query){
19
- await this.connect(null)
20
-
21
- let results = await this.connection.awaitQuery(query)
22
-
23
- this.connection.end();
24
-
25
- return results
26
- }
27
-
28
- static async executeQueryOnDB(query, db){
29
- await this.connect(db)
30
-
31
- let results = await this.connection.awaitQuery(query)
32
-
33
- this.connection.end();
34
-
35
- return results
36
- }
37
-
38
- static async getDatabaseNames(){
39
- await this.connect(null)
40
-
41
- let results = await this.connection.awaitQuery("SHOW DATABASES")
42
-
43
- this.connection.end();
44
-
45
- results = results.filter((val) => {
46
- if(val.Database == "sys" || val.Database == "information_schema" || val.Database == "mysql" || val.Database == "performance_schema"){
47
- return false;
48
- }
49
- return true
50
- })
51
-
52
- return results.map(result => {return {"name":result.Database}})
53
- }
54
- }
@@ -1,102 +0,0 @@
1
- import chalk from 'chalk';
2
- import { execSync } from 'child_process';
3
-
4
- /**
5
- * Get GitHub authentication token from environment or GitHub CLI
6
- * @returns {Promise<{token: string, authMethod: string}>} Token and authentication method
7
- * @throws {Error} If no authentication method is available
8
- */
9
- export async function getGithubToken() {
10
- let token = null;
11
- let authMethod = null;
12
-
13
- // 1. Try GITHUB_TOKEN environment variable
14
- if (process.env.GITHUB_TOKEN) {
15
- token = process.env.GITHUB_TOKEN;
16
- authMethod = 'GITHUB_TOKEN (environment variable)';
17
- }
18
-
19
- // 2. Try GitHub CLI authentication if available
20
- if (!token) {
21
- try {
22
- token = execSync('gh auth token', { encoding: 'utf-8' }).trim();
23
- authMethod = 'GitHub CLI';
24
- } catch (error) {
25
- // GitHub CLI not available or not authenticated
26
- }
27
- }
28
-
29
- // 3. If no token found, prompt user to authenticate
30
- if (!token) {
31
- console.log(chalk.yellow('No GitHub authentication found. Please authenticate with GitHub CLI:'));
32
- console.log(chalk.gray(' Run: gh auth login'));
33
- console.log();
34
- throw new Error('GitHub authentication required. Please run "gh auth login" or set GITHUB_TOKEN environment variable.');
35
- }
36
-
37
- return { token, authMethod };
38
- }
39
-
40
- /**
41
- * Make a GitHub API fetch request with proper headers and error handling
42
- * @param {string} url - GitHub API endpoint URL
43
- * @param {string} token - GitHub authentication token
44
- * @returns {Promise<Response>} Fetch response
45
- * @throws {Error} If fetch fails or returns error status
46
- */
47
- export async function fetchGithubAPI(url, token) {
48
- const res = await fetch(url, {
49
- headers: {
50
- 'Authorization': `Bearer ${token}`,
51
- 'Accept': 'application/vnd.github+json',
52
- 'X-GitHub-Api-Version': '2022-11-28',
53
- 'User-Agent': 'inteco-cli'
54
- }
55
- });
56
-
57
- if (!res.ok) {
58
- if (res.status === 404) {
59
- throw new Error(`404: Resource not found`);
60
- }
61
- if (res.status === 401) {
62
- throw new Error('401: GitHub authentication failed');
63
- }
64
- if (res.status === 403) {
65
- throw new Error('403: Access forbidden (Dependabot alerts may not be enabled)');
66
- }
67
- throw new Error(`${res.status}: GitHub API request failed: ${res.statusText}`);
68
- }
69
-
70
- return res;
71
- }
72
-
73
- /**
74
- * Fetch all items from a paginated GitHub API endpoint
75
- * @param {string} baseUrl - Base GitHub API endpoint URL (without pagination params)
76
- * @param {string} token - GitHub authentication token
77
- * @param {number} page - Current page (default: 1)
78
- * @param {Array} allItems - Accumulated items (default: [])
79
- * @returns {Promise<Array>} All items from all pages
80
- */
81
- export async function fetchPaginatedGithubAPI(baseUrl, token, page = 1, allItems = []) {
82
- const url = `${baseUrl}${baseUrl.includes('?') ? '&' : '?'}page=${page}&per_page=100`;
83
-
84
- try {
85
- const res = await fetchGithubAPI(url, token);
86
- const items = await res.json();
87
-
88
- if (items.length === 0) {
89
- return allItems;
90
- }
91
-
92
- // Recursively fetch all pages
93
- return fetchPaginatedGithubAPI(baseUrl, token, page + 1, [...allItems, ...items]);
94
- } catch (error) {
95
- if (page === 1) {
96
- // Only throw on first page - error getting initial data
97
- throw error;
98
- }
99
- // On subsequent pages, return what we have so far
100
- return allItems;
101
- }
102
- }
File without changes
File without changes