@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
package/src/index.js DELETED
@@ -1,130 +0,0 @@
1
- #!/usr/bin/env node
2
- import cliMeowHelp from 'cli-meow-help';
3
- import meow from 'meow';
4
- import adb_bridge from './modules/adbBridge.js';
5
- import adb_intent from './modules/adbIntentSender.js';
6
- import dumpTableToCSV from './modules/dumpTableToCSV.js';
7
- import importDB from './modules/importDB.js';
8
- import rewrite from './modules/rewriteConfig.js';
9
- import writeCLIConfig from './modules/setCLIConfig.js';
10
- import t003Rewrite from './modules/t003Rewrite.js';
11
- import graphqlSchemaExport from './modules/graphqlSchemaExport.js';
12
- import csvMerge from './modules/csvMerger.js';
13
- import {dumpDBMand, dumpDB } from './modules/dumpDB.js';
14
- import deleteDBMand from './modules/deleteDB.js';
15
- import showChangelog from './modules/changelog.js';
16
-
17
- import commands from "./ressources/cmds.json" with {type: 'json'};
18
- import packageJson from "../package.json" with {type: 'json'}
19
- import extdSearch from './modules/extdSearch.js';
20
- import t009Search from './modules/t009Search.js';
21
- import syncConfig from './modules/syncConfig.js';
22
- import configMutation from './modules/configMutation.js';
23
- import bundleProduct from './modules/bundleProduct.js';
24
- import { azureCreateSyncConfig, azurePush, azurePull } from './modules/azureSync.js';
25
- import githubSecurityAdvisories from './modules/githubSecurityAdvisories.js';
26
- import listGithubDeploymentKeys from './modules/githubDeploymentKeysList.js';
27
-
28
- import updateNotifier from 'update-notifier';
29
- import { addGithubDeploymentKey } from './modules/githubDeploymentKey.js';
30
-
31
- updateNotifier({
32
- pkg: {
33
- name: packageJson.name,
34
- version: packageJson.version
35
- },
36
- updateCheckInterval: 1000 * 60 * 60 * 24 // 24h
37
- }).notify();
38
-
39
-
40
- const helpText = cliMeowHelp({
41
- name: `inteco`,
42
- desc: "Version: "+packageJson.version,
43
- commands
44
- });
45
-
46
- const cli = meow(helpText, {
47
- importMeta: import.meta,
48
- });
49
-
50
- switch (cli.input[0]) {
51
- case "config_rewrite":
52
- rewrite(cli)
53
- break;
54
- case "import_db":
55
- importDB(cli)
56
- break;
57
- case "download_db":
58
- downloadDB(cli)
59
- break;
60
- case "t003_rewrite":
61
- t003Rewrite(cli)
62
- break;
63
- case "adb_bridge":
64
- adb_bridge()
65
- break;
66
- case "adb_intent":
67
- adb_intent()
68
- break;
69
- case "set_cli_config":
70
- writeCLIConfig()
71
- break;
72
- case "dump_table_to_csv":
73
- dumpTableToCSV()
74
- break;
75
- case "csv_merge":
76
- csvMerge();
77
- break;
78
- case "graphql_schema_export":
79
- graphqlSchemaExport();
80
- break;
81
- case "dump_db_mand":
82
- dumpDBMand(cli);
83
- break;
84
- case "dump_db":
85
- dumpDB(cli);
86
- break;
87
- case "delete_db_mand":
88
- deleteDBMand();
89
- break;
90
- case "extd_search":
91
- extdSearch();
92
- break;
93
- case "t009_search":
94
- t009Search();
95
- break;
96
- case "sync_config":
97
- syncConfig();
98
- break;
99
- case "config_mutation":
100
- configMutation();
101
- break;
102
- case "bundle_product":
103
- bundleProduct(cli);
104
- break;
105
- case "changelog":
106
- showChangelog();
107
- break;
108
- case "azure_sync_config":
109
- azureCreateSyncConfig();
110
- break;
111
- case "azure_sync_push":
112
- azurePush();
113
- break;
114
- case "azure_sync_pull":
115
- azurePull();
116
- break;
117
- case "github_security_advisories":
118
- githubSecurityAdvisories();
119
- break;
120
- case "github_add_deploy_key":
121
- addGithubDeploymentKey();
122
- break;
123
- case "github_list_deploy_keys":
124
- listGithubDeploymentKeys();
125
- break;
126
- default:
127
- cli.showHelp()
128
- break;
129
- }
130
-
@@ -1,52 +0,0 @@
1
- import adb from "adb-ts";
2
- import chalk from "chalk";
3
- import prompts from "prompts";
4
- import { Config } from "../utils/config/config.js";
5
-
6
-
7
- export default async function adb_bridge(cli){
8
-
9
- console.log()
10
-
11
- const config = await Config.getConfig();
12
-
13
- const adbClient = new adb.AdbClient({host: "127.0.0.1"})
14
-
15
- adbClient.listDevices()
16
- .then(async (devices) => {
17
- let success = true;
18
- const result = await prompts([
19
- {
20
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
21
- type: 'autocomplete',
22
- name: 'device',
23
- message: 'Device?',
24
- choices: devices.map(dev => {return {title: dev.id+" ("+dev.model+")", value:dev}})
25
- },
26
- {
27
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
28
- type: 'number',
29
- name: 'port',
30
- initial: "3000",
31
- message: 'Port?'
32
- }
33
- ],{
34
- onCancel: () => {
35
- console.log()
36
- console.log(chalk.red("Cancelled ADB Bridge!"))
37
- console.log()
38
- success = false
39
- }
40
- })
41
-
42
- if(success){
43
- await adbClient.reverse(result.device.id, "tcp:"+result.port, "tcp:"+result.port)
44
- console.log()
45
- console.log(chalk.green("ADB bridged!"))
46
- console.log()
47
- }
48
- });
49
-
50
-
51
-
52
- }
@@ -1,82 +0,0 @@
1
- import adb from "adb-ts";
2
- import chalk from "chalk";
3
- import prompts from "prompts";
4
- import { Config } from "../utils/config/config.js";
5
-
6
-
7
- export default async function adb_intent(cli){
8
-
9
- console.log()
10
-
11
- const config = await Config.getConfig();
12
-
13
-
14
-
15
- const adbClient = new adb.AdbClient({host: "127.0.0.1"})
16
-
17
- adbClient.listDevices()
18
- .then(async (devices) => {
19
- let success = true;
20
- const result = await prompts([
21
- {
22
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
23
- type: 'autocomplete',
24
- name: 'device',
25
- message: 'Device?',
26
- choices: devices.map(dev => {return {title: dev.id+" ("+dev.model+")", value:dev}})
27
- },
28
- {
29
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
30
- type: 'autocomplete',
31
- name: 'action',
32
- message: 'Action?',
33
- choices: [
34
- {
35
- "title":"BARCODE_DATA",
36
- "value": "ch.inteco.orderprep.action.BARCODE_DATA"
37
- },
38
- ]
39
- },
40
- {
41
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
42
- type: 'text',
43
- name: 'data',
44
- message: 'Data?',
45
- initial:"1"
46
- },
47
- {
48
- // Ordnerauswahl von vorhandenen Ordner in configIndividual
49
- type: 'autocomplete',
50
- name: 'codeId',
51
- message: 'Code-Typ?',
52
- choices: [
53
- {
54
- "title":"QR-Code",
55
- "value": "s"
56
- },
57
- {
58
- "title":"EAN13",
59
- "value": "d"
60
- }
61
- ]
62
- }
63
- ],{
64
- onCancel: () => {
65
- console.log()
66
- console.log(chalk.red("Cancelled ADB Intent!"))
67
- console.log()
68
- success = false
69
- }
70
- })
71
-
72
- if(success){
73
- await adbClient.shell(result.device.id, "am broadcast -a "+result.action+" --ei version 1 --es codeId "+result.codeId+" --es data "+result.data)
74
- console.log()
75
- console.log(chalk.green("Intent sent!"))
76
- console.log()
77
- }
78
- });
79
-
80
-
81
-
82
- }
@@ -1,60 +0,0 @@
1
- import chalk from 'chalk';
2
-
3
- const OWNER = 'intecoag';
4
- const REPO = 'IntecoCLI';
5
-
6
- async function showChangelog() {
7
- const res = await fetch(
8
- `https://api.github.com/repos/${OWNER}/${REPO}/releases`,
9
- {
10
- headers: {
11
- 'Accept': 'application/vnd.github+json',
12
- 'User-Agent': `${REPO}-cli`
13
- }
14
- }
15
- );
16
-
17
- if (!res.ok) {
18
- console.error(chalk.red('Failed to fetch changelog'));
19
- return;
20
- }
21
-
22
- const releases = await res.json();
23
-
24
- // Reverse: oldest → newest
25
- releases.reverse();
26
-
27
- console.log(
28
- chalk.bold.cyan(`\n📦 Changelog for ${OWNER}/${REPO}\n`)
29
- );
30
-
31
- for (const r of releases) {
32
- const title = r.name || r.tag_name;
33
-
34
- console.log(
35
- chalk.bold.yellow(`\n▶ ${title}`)
36
- );
37
-
38
- if (!r.body) {
39
- console.log(chalk.gray(' No changelog provided'));
40
- continue;
41
- }
42
-
43
- // Light formatting for Markdown-like content
44
- const lines = r.body.split('\n');
45
-
46
- for (const line of lines) {
47
- if (line.startsWith('- ') || line.startsWith('* ')) {
48
- console.log(chalk.green(` • ${line.slice(2)}`));
49
- } else if (line.startsWith('### ')) {
50
- console.log(chalk.bold.magenta(`\n ${line.slice(4)}`));
51
- } else if (line.startsWith('## ')) {
52
- console.log(chalk.bold.blue(`\n${line.slice(3)}`));
53
- } else {
54
- console.log(chalk.gray(` ${line}`));
55
- }
56
- }
57
- }
58
- }
59
-
60
- export default showChangelog;
@@ -1,118 +0,0 @@
1
- import chalk from 'chalk';
2
- import csv from 'csv-parser';
3
- import fs from "fs";
4
- import prompts from "prompts";
5
-
6
- export default async function csvMerge() {
7
- console.log()
8
-
9
- let success = true;
10
-
11
- const promptResults = await prompts([
12
- {
13
- // Output-File
14
- type: 'text',
15
- name: 'output',
16
- message: 'Output-File?',
17
- initial: "results.csv"
18
- },
19
- {
20
- // Filterverwendung
21
- type: 'toggle',
22
- name: 'useFilter',
23
- message: 'Use Filter?',
24
- initial: false,
25
- active: 'yes',
26
- inactive: 'no'
27
- },
28
- {
29
- type: prev => prev == true ? "select" : null,
30
- name: 'filtertype',
31
- message: 'Filter type?',
32
- choices: [
33
- { title: 'Equal', value: 'eq' },
34
- { title: 'Non-Equal', value: 'neq' }
35
- ]
36
- },
37
- {
38
- type: prev => prev != "" ? "text" : null,
39
- name: 'filterfield',
40
- message: 'Filter field?'
41
- },
42
- {
43
- type: prev => prev != "" ? "text" : null,
44
- name: 'filtervalue',
45
- message: 'Filter value?'
46
- },
47
- ], {
48
- onCancel: () => {
49
- console.log()
50
- console.log(chalk.red("Cancelled CSV-Merge!"))
51
- console.log()
52
- success = false
53
- }
54
- })
55
-
56
-
57
- if (success) {
58
- console.log()
59
-
60
- let files = fs.readdirSync(process.cwd(), { withFileTypes: true }).filter(file => file.isFile && file.name.endsWith(".csv") && file.name != promptResults.output);
61
-
62
- let finalResult = [];
63
- let counter = 0;
64
-
65
- files.forEach(file => {
66
- const results = [];
67
-
68
- fs.createReadStream(process.cwd() + "/" + file.name)
69
- .pipe(csv({ separator: ";", quote: "'" }))
70
- .on('data', (data) => results.push(data))
71
- .on('end', () => {
72
- const filteredResults = results.map(row => {
73
- const newRow = {}
74
- Object.entries(row).forEach(entry => {
75
- newRow[entry[0].replaceAll("'", "").replaceAll("`", "")] = entry[1]
76
- })
77
- newRow.file = file.name
78
- return newRow
79
- }).filter(row => {
80
- if (promptResults.useFilter) {
81
- switch (promptResults.filtertype){
82
- case "neq":
83
- if(row[promptResults.filterfield] != promptResults.filtervalue){
84
- return true
85
- }
86
- return false;
87
- case "eq":
88
- if(row[promptResults.filterfield] == promptResults.filtervalue){
89
- return true
90
- }
91
- return false;
92
- }
93
- return false;
94
- }
95
- return true;
96
- })
97
-
98
- finalResult = finalResult.concat(filteredResults)
99
- counter = counter + filteredResults.length
100
-
101
- let firstLine = true;
102
- fs.writeFileSync(process.cwd() + "/" + promptResults.output, finalResult.map(row => {
103
- let prev = ""
104
- if (firstLine) {
105
- prev = Object.keys(row).map(entry => { return "\"" + entry + "\"" }).join(";") + "\n";
106
- firstLine = false;
107
- }
108
- return prev + Object.values(row).map(entry => { return "\"" + entry + "\"" }).join(";");
109
- }).join("\n"))
110
- console.log(chalk.green(file.name + " merged."))
111
- });
112
-
113
- })
114
- }
115
-
116
-
117
-
118
- }
@@ -1,84 +0,0 @@
1
- import prompts from "prompts"
2
- import { rmSync } from "fs";
3
- import ora from "ora";
4
- import { DB } from "../utils/db/DB.js";
5
- import chalk from "chalk";
6
- import path from "path";
7
-
8
-
9
- export default async function deleteDBMand(cli){
10
- console.log()
11
-
12
- const databaseNames = await DB.getDatabaseNames();
13
-
14
- let success = true;
15
-
16
- const results = await prompts([
17
- {
18
- // DB-Auswahl von DB
19
- type: 'autocomplete',
20
- name: 'dbName',
21
- message: 'DB-Name?',
22
- choices: databaseNames.map(name => { return { title: name.name } })
23
- },
24
- {
25
- type: 'number',
26
- name: 'mnr',
27
- message: 'Mandant?',
28
- initial: '1'
29
- }
30
- ],{
31
- onCancel: () => {
32
- console.log()
33
- console.log(chalk.red("Cancelled Import!"))
34
- console.log()
35
- success = false
36
- }
37
- })
38
-
39
- if(success){
40
- console.log()
41
-
42
- const spinner = ora('Deleting in DB').start();
43
-
44
- // Load table names
45
- let tables = await DB.executeQueryOnDB("SHOW TABLES;", results.dbName);
46
- const tableKey = Object.keys(tables[0])[0];
47
- tables = tables.map(row => row[tableKey])
48
-
49
- if(tables == null || tables.length == 0){
50
- spinner.fail("Database has no tables: "+results.dbName)
51
- }else{
52
- // Remove previous dump
53
- rmSync("."+path.sep+results.dumpName, {recursive:true, force:true})
54
- for(const table of tables){
55
- // Check if Mand-Column exists
56
- const tableSpinner = ora("Deleting data: "+table).start();
57
- const tableCol = table+"_mnr"
58
- const columnExists = await DB.executeQueryOnDB("SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = '"+results.dbName+"' AND table_name = '"+table+"' AND column_name = '"+tableCol+"';")
59
-
60
- if(columnExists [0]['COUNT(*)'] != 0){
61
- // Check if Mand-Data is present
62
- const dataExists = await DB.executeQueryOnDB("SELECT COUNT(*) FROM "+table+" WHERE "+tableCol+" = '"+results.mnr+"';", results.dbName);
63
-
64
- if(dataExists[0]['COUNT(*)'] != 0){
65
- await DB.executeQueryOnDB("DELETE FROM "+table+" WHERE "+tableCol+" = '"+results.mnr+"';", results.dbName)
66
- tableSpinner.succeed("Data deleted: "+table);
67
- }else{
68
- tableSpinner.info("No data present, Skipping table: "+table)
69
- }
70
- }else{
71
- tableSpinner.info("Column "+tableCol+" not found, Skipping table: "+table)
72
- }
73
- }
74
- // Dump mand-table (special field name)
75
- const tableSpinner = ora("Deleting mand (custom logic)")
76
- await DB.executeQueryOnDB("DELETE FROM mand WHERE mand_mandant = '"+results.mnr+"';", results.dbName)
77
- tableSpinner.succeed("Data deleted: mand")
78
- spinner.succeed("Mand deleted: "+results.mnr);
79
- }
80
-
81
-
82
- console.log();
83
- }
84
- }
@@ -1,154 +0,0 @@
1
- import fs from "fs";
2
- import nReadlines from 'n-readlines';
3
- import prompts from "prompts";
4
- import path from "path";
5
- import ora from "ora";
6
- import Seven from 'node-7z'
7
- import sevenBin from '7zip-bin'
8
-
9
-
10
- export default async function dumpTableToCSV() {
11
- console.log()
12
-
13
- let success = true;
14
-
15
- const results = await prompts([
16
- {
17
- // Tabelle die exportiert werden soll
18
- type: 'text',
19
- name: 'table',
20
- message: 'Tabellen-Name?'
21
- }
22
- ], {
23
- onCancel: () => {
24
- console.log()
25
- console.log(chalk.red("Cancelled Dump!"))
26
- console.log()
27
- success = false
28
- }
29
- })
30
-
31
-
32
- if (success) {
33
- console.log()
34
-
35
- // Unpack archives
36
- let archives = fs.readdirSync(process.cwd(), { withFileTypes: true }).filter(dirent => dirent.isFile() && (dirent.name.split(".")[dirent.name.split(".").length-1] == "gz") || (dirent.name.split(".")[dirent.name.split(".").length-1] == "7z")).map(dirent => { return dirent.name });
37
- for (const archive of archives){
38
- await extractDumpsFromArchive(archive)
39
- }
40
-
41
- console.log()
42
-
43
- // Read Files and create csv
44
- let files = fs.readdirSync(process.cwd(), { withFileTypes: true }).filter(dirent => dirent.isFile() && dirent.name.split(".")[dirent.name.split(".").length-1] == "sql").map(dirent => { return dirent.name });
45
-
46
- await Promise.all(files.map(async (file) => {
47
- await createCSVDump(file, results.table)
48
- }));
49
-
50
- console.log()
51
- }
52
- }
53
-
54
- function getPromiseFromEvent(item, event) {
55
- return new Promise((resolve) => {
56
- const listener = (data) => {
57
- resolve(data);
58
- }
59
- item.on(event, listener);
60
- })
61
- }
62
-
63
- async function extractDumpsFromArchive(archive){
64
- const spinnerZIP = ora('Unpacking Archive: '+archive).start();
65
-
66
- const list = Seven.list(process.cwd() + path.sep + archive, {
67
- $bin: sevenBin.path7za
68
- })
69
-
70
- const data = await getPromiseFromEvent(list, "data")
71
-
72
- let file = data.file
73
-
74
- if(file.split(".").length == 1){
75
- const rename = Seven.rename(process.cwd() + path.sep + archive,[[file, file+".sql"]], {
76
- $bin: sevenBin.path7za
77
- })
78
-
79
- await getPromiseFromEvent(rename, "end")
80
- }
81
-
82
- const unpack = Seven.extract(process.cwd() + path.sep + archive,"."+path.sep, {
83
- $bin: sevenBin.path7za
84
- })
85
-
86
- await getPromiseFromEvent(unpack, "end")
87
-
88
- spinnerZIP.succeed("Archive unpacked: "+archive)
89
-
90
- }
91
-
92
- async function createCSVDump(file, table) {
93
- let count = 0;
94
- const spinner = ora('Reading file (' + file +"): "+count).start();
95
- const readFile = new nReadlines(process.cwd() + path.sep + file);
96
-
97
- let line = "";
98
- let data = "";
99
- let readHeader = false;
100
- let headerData = "";
101
-
102
- while ((line = readFile.next())) {
103
- line = line.toString('utf-8').trim()
104
-
105
- if (line.includes("INSERT INTO `" + table + "` VALUES")) {
106
- data = data + line;
107
- }
108
-
109
- if (line.includes("CREATE TABLE `" + table + "`")) {
110
- readHeader = true;
111
- }
112
-
113
- if (readHeader) {
114
- if (line.includes("PRIMARY KEY")) {
115
- readHeader = false;
116
- } else {
117
- headerData = headerData.concat(line);
118
- }
119
-
120
- }
121
-
122
- count++;
123
- spinner.text = 'Reading file (' + file +"): "+count
124
- spinner.render()
125
- }
126
- spinner.text = 'Writing file (' + file +")"
127
- spinner.render()
128
-
129
- let headers = []
130
- let matchHeader = new RegExp(/`(.*?)`/g);
131
- var found;
132
- while (found = matchHeader.exec(headerData)) {
133
- if (found[0] != "`" + table + "`") {
134
- headers.push(found[0]);
135
- }
136
-
137
- };
138
-
139
- let records = [];
140
- var reBrackets = /\((.*?)\)/g;
141
- var found;
142
- while (found = reBrackets.exec(data)) {
143
- records.push(found[1]);
144
- };
145
-
146
- let recordsString = records.join("\n").replaceAll(",", ";");
147
- let headersString = headers.join(";")
148
-
149
- if (!fs.existsSync(process.cwd() + path.sep + "csv")) {
150
- fs.mkdirSync(process.cwd() + path.sep + "csv")
151
- }
152
- fs.writeFileSync(process.cwd() + path.sep + "csv" + path.sep + file.split(".")[0] + ".csv", headersString + "\n" + recordsString)
153
- spinner.succeed("CSV created: "+file.split(".")[0] + ".csv")
154
- }