@open-discord-bots/framework 0.2.12 → 0.2.14

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 (107) hide show
  1. package/dist/api/index.d.ts +26 -26
  2. package/dist/api/index.js +26 -42
  3. package/dist/api/main.d.ts +24 -24
  4. package/dist/api/main.js +7 -11
  5. package/dist/api/modules/action.d.ts +3 -3
  6. package/dist/api/modules/action.js +8 -14
  7. package/dist/api/modules/base.d.ts +2 -2
  8. package/dist/api/modules/base.js +14 -63
  9. package/dist/api/modules/builder.d.ts +3 -3
  10. package/dist/api/modules/builder.js +61 -122
  11. package/dist/api/modules/checker.d.ts +4 -4
  12. package/dist/api/modules/checker.js +55 -87
  13. package/dist/api/modules/client.d.ts +4 -4
  14. package/dist/api/modules/client.js +71 -118
  15. package/dist/api/modules/code.d.ts +2 -2
  16. package/dist/api/modules/code.js +3 -8
  17. package/dist/api/modules/config.d.ts +2 -2
  18. package/dist/api/modules/config.js +21 -63
  19. package/dist/api/modules/console.d.ts +2 -2
  20. package/dist/api/modules/console.js +45 -67
  21. package/dist/api/modules/cooldown.d.ts +2 -2
  22. package/dist/api/modules/cooldown.js +13 -23
  23. package/dist/api/modules/database.d.ts +2 -2
  24. package/dist/api/modules/database.js +19 -29
  25. package/dist/api/modules/event.d.ts +2 -2
  26. package/dist/api/modules/event.js +6 -11
  27. package/dist/api/modules/flag.d.ts +2 -2
  28. package/dist/api/modules/flag.js +3 -8
  29. package/dist/api/modules/fuse.js +2 -7
  30. package/dist/api/modules/helpmenu.d.ts +2 -2
  31. package/dist/api/modules/helpmenu.js +8 -16
  32. package/dist/api/modules/language.d.ts +2 -2
  33. package/dist/api/modules/language.js +12 -21
  34. package/dist/api/modules/permission.d.ts +3 -3
  35. package/dist/api/modules/permission.js +9 -47
  36. package/dist/api/modules/plugin.d.ts +2 -2
  37. package/dist/api/modules/plugin.js +10 -19
  38. package/dist/api/modules/post.d.ts +3 -3
  39. package/dist/api/modules/post.js +3 -8
  40. package/dist/api/modules/progressbar.d.ts +2 -2
  41. package/dist/api/modules/progressbar.js +13 -26
  42. package/dist/api/modules/responder.d.ts +5 -5
  43. package/dist/api/modules/responder.js +66 -125
  44. package/dist/api/modules/session.d.ts +2 -2
  45. package/dist/api/modules/session.js +4 -42
  46. package/dist/api/modules/startscreen.d.ts +4 -4
  47. package/dist/api/modules/startscreen.js +28 -44
  48. package/dist/api/modules/statistic.d.ts +3 -3
  49. package/dist/api/modules/statistic.js +11 -20
  50. package/dist/api/modules/verifybar.d.ts +5 -5
  51. package/dist/api/modules/verifybar.js +6 -11
  52. package/dist/api/modules/worker.d.ts +1 -1
  53. package/dist/api/modules/worker.js +6 -11
  54. package/dist/cli/editConfig.d.ts +2 -2
  55. package/dist/cli/editConfig.js +189 -229
  56. package/dist/cli/index.d.ts +2 -2
  57. package/dist/cli/index.js +37 -62
  58. package/dist/index.d.ts +4 -4
  59. package/dist/index.js +6 -13
  60. package/dist/startup/compilation.d.ts +1 -1
  61. package/dist/startup/compilation.js +36 -43
  62. package/dist/startup/dump.d.ts +1 -1
  63. package/dist/startup/dump.js +4 -41
  64. package/dist/startup/errorHandling.d.ts +1 -1
  65. package/dist/startup/errorHandling.js +2 -38
  66. package/dist/startup/pluginLauncher.d.ts +1 -1
  67. package/dist/startup/pluginLauncher.js +9 -49
  68. package/dist/utilities/index.d.ts +1 -1
  69. package/dist/utilities/index.js +21 -72
  70. package/package.json +2 -1
  71. package/src/api/index.ts +26 -26
  72. package/src/api/main.ts +25 -25
  73. package/src/api/modules/action.ts +3 -3
  74. package/src/api/modules/base.ts +2 -2
  75. package/src/api/modules/builder.ts +3 -3
  76. package/src/api/modules/checker.ts +4 -4
  77. package/src/api/modules/client.ts +4 -4
  78. package/src/api/modules/code.ts +2 -2
  79. package/src/api/modules/component.txt +3 -3
  80. package/src/api/modules/config.ts +2 -2
  81. package/src/api/modules/console.ts +2 -2
  82. package/src/api/modules/cooldown.ts +2 -2
  83. package/src/api/modules/database.ts +2 -2
  84. package/src/api/modules/event.ts +2 -2
  85. package/src/api/modules/flag.ts +2 -2
  86. package/src/api/modules/helpmenu.ts +2 -2
  87. package/src/api/modules/language.ts +2 -2
  88. package/src/api/modules/permission.ts +3 -3
  89. package/src/api/modules/plugin.ts +4 -4
  90. package/src/api/modules/post.ts +3 -3
  91. package/src/api/modules/progressbar.ts +2 -2
  92. package/src/api/modules/responder.ts +5 -5
  93. package/src/api/modules/session.ts +2 -2
  94. package/src/api/modules/startscreen.ts +4 -4
  95. package/src/api/modules/statistic.ts +3 -3
  96. package/src/api/modules/verifybar.ts +5 -5
  97. package/src/api/modules/worker.ts +1 -1
  98. package/src/cli/editConfig.ts +3 -3
  99. package/src/cli/index.ts +3 -3
  100. package/src/index.ts +5 -5
  101. package/src/startup/compilation.ts +2 -2
  102. package/src/startup/dump.ts +2 -2
  103. package/src/startup/errorHandling.ts +2 -2
  104. package/src/startup/pluginLauncher.ts +2 -2
  105. package/src/utilities/index.ts +2 -2
  106. package/tools/cleanup.js +1 -1
  107. package/tsconfig.json +1 -1
@@ -1,48 +1,9 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ODCliEditConfigInstance = void 0;
40
- const api = __importStar(require("../api/index"));
41
- const utilities = __importStar(require("../utilities/index"));
42
- const terminal_kit_1 = require("terminal-kit");
43
- const ansis_1 = __importDefault(require("ansis"));
44
- const _1 = require(".");
45
- class ODCliEditConfigInstance {
1
+ import * as api from "../api/index.js";
2
+ import * as utilities from "../utilities/index.js";
3
+ import { terminal } from "terminal-kit";
4
+ import ansis from "ansis";
5
+ import { renderHeader } from "./index.js";
6
+ export class ODCliEditConfigInstance {
46
7
  opts;
47
8
  opendiscord;
48
9
  constructor(opts, opendiscord) {
@@ -50,17 +11,17 @@ class ODCliEditConfigInstance {
50
11
  this.opendiscord = opendiscord;
51
12
  }
52
13
  async renderEditConfig(backFn) {
53
- (0, _1.renderHeader)(this.opts, []);
54
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select which config you would like to edit.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
14
+ renderHeader(this.opts, []);
15
+ terminal(ansis.bold.green("Please select which config you would like to edit.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
55
16
  const checkerList = this.opendiscord.checkers.getAll();
56
17
  const checkerNameList = checkerList.map((checker) => (checker.options.cliDisplayName ? checker.options.cliDisplayName + " (" + checker.config.file + ")" : checker.config.file));
57
18
  const checkerNameLength = utilities.getLongestLength(checkerNameList);
58
- const finalCheckerNameList = checkerNameList.map((name, index) => name.padEnd(checkerNameLength + 5, " ") + ansis_1.default.gray(checkerList[index].options.cliDisplayDescription ? "=> " + checkerList[index].options.cliDisplayDescription : ""));
59
- const answer = await terminal_kit_1.terminal.singleColumnMenu(finalCheckerNameList, {
19
+ const finalCheckerNameList = checkerNameList.map((name, index) => name.padEnd(checkerNameLength + 5, " ") + ansis.gray(checkerList[index].options.cliDisplayDescription ? "=> " + checkerList[index].options.cliDisplayDescription : ""));
20
+ const answer = await terminal.singleColumnMenu(finalCheckerNameList, {
60
21
  leftPadding: "> ",
61
- style: terminal_kit_1.terminal.cyan,
62
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
63
- submittedStyle: terminal_kit_1.terminal.bgBlue,
22
+ style: terminal.cyan,
23
+ selectedStyle: terminal.bgDefaultColor.bold,
24
+ submittedStyle: terminal.bgBlue,
64
25
  extraLines: 2,
65
26
  cancelable: true
66
27
  }).promise;
@@ -90,28 +51,28 @@ class ODCliEditConfigInstance {
90
51
  else if (structure instanceof api.ODCheckerTypeSwitchStructure)
91
52
  await this.renderConfigTypeSwitchStructureEditor(checker, backFn, structure, data, parent, parentIndex, path);
92
53
  else
93
- terminal_kit_1.terminal.red.bold("❌ Unable to detect type of variable! Please try to edit this property in the JSON file itself!");
54
+ terminal.red.bold("❌ Unable to detect type of variable! Please try to edit this property in the JSON file itself!");
94
55
  }
95
56
  async renderConfigObjectStructureSelector(checker, backFn, structure, data, parent, parentIndex, path) {
96
57
  if (typeof data != "object" || Array.isArray(data))
97
58
  throw new api.ODSystemError("OD CLI => Property is not of the type 'object'. Please check your config for possible errors. (index: " + parentIndex + ", path: " + path.join(".") + ")");
98
- (0, _1.renderHeader)(this.opts, path);
99
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select which variable you would like to edit.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
59
+ renderHeader(this.opts, path);
60
+ terminal(ansis.bold.green("Please select which variable you would like to edit.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
100
61
  if (!structure.options.children)
101
62
  return await backFn();
102
63
  if (structure.options.cliDisplayName) {
103
- terminal_kit_1.terminal.gray("\nProperty: " + ansis_1.default.bold.blue(structure.options.cliDisplayName) + "\n");
104
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
64
+ terminal.gray("\nProperty: " + ansis.bold.blue(structure.options.cliDisplayName) + "\n");
65
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
105
66
  }
106
67
  const list = structure.options.children.filter((child) => !child.cliHideInEditMode);
107
68
  const nameList = list.map((child) => (child.checker.options.cliDisplayName ? child.checker.options.cliDisplayName : child.key));
108
69
  const nameLength = utilities.getLongestLength(nameList);
109
- const finalnameList = nameList.map((name, index) => name.padEnd(nameLength + 5, " ") + ansis_1.default.gray((!list[index].checker.options.cliHideDescriptionInParent && list[index].checker.options.cliDisplayDescription) ? "=> " + list[index].checker.options.cliDisplayDescription : ""));
110
- const answer = await terminal_kit_1.terminal.singleColumnMenu(finalnameList, {
70
+ const finalnameList = nameList.map((name, index) => name.padEnd(nameLength + 5, " ") + ansis.gray((!list[index].checker.options.cliHideDescriptionInParent && list[index].checker.options.cliDisplayDescription) ? "=> " + list[index].checker.options.cliDisplayDescription : ""));
71
+ const answer = await terminal.singleColumnMenu(finalnameList, {
111
72
  leftPadding: "> ",
112
- style: terminal_kit_1.terminal.cyan,
113
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold.defaultColor,
114
- submittedStyle: terminal_kit_1.terminal.bgBlue,
73
+ style: terminal.cyan,
74
+ selectedStyle: terminal.bgDefaultColor.bold.defaultColor,
75
+ submittedStyle: terminal.bgBlue,
115
76
  extraLines: 2,
116
77
  cancelable: true
117
78
  }).promise;
@@ -158,16 +119,16 @@ class ODCliEditConfigInstance {
158
119
  async renderConfigArrayStructureSelector(checker, backFn, structure, data, parent, parentIndex, path) {
159
120
  if (!Array.isArray(data))
160
121
  throw new api.ODSystemError("OD CLI => Property is not of the type 'array'. Please check your config for possible errors. (index: " + parentIndex + ", path: " + path.join(".") + ")");
161
- (0, _1.renderHeader)(this.opts, path);
162
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select what you would like to do.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
122
+ renderHeader(this.opts, path);
123
+ terminal(ansis.bold.green("Please select what you would like to do.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
163
124
  if (!structure.options.propertyChecker)
164
125
  return await backFn();
165
126
  if (structure.options.cliDisplayName || typeof parentIndex == "string" || !isNaN(parentIndex)) {
166
- terminal_kit_1.terminal.gray("\nProperty: " + ansis_1.default.bold.blue(structure.options.cliDisplayName ?? parentIndex.toString()) + "\n");
167
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
127
+ terminal.gray("\nProperty: " + ansis.bold.blue(structure.options.cliDisplayName ?? parentIndex.toString()) + "\n");
128
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
168
129
  }
169
130
  const propertyName = structure.options.cliDisplayPropertyName ?? "index";
170
- const answer = await terminal_kit_1.terminal.singleColumnMenu(data.length < 1 ? ["Add " + propertyName] : [
131
+ const answer = await terminal.singleColumnMenu(data.length < 1 ? ["Add " + propertyName] : [
171
132
  "Add " + propertyName,
172
133
  "Edit " + propertyName,
173
134
  "Move " + propertyName,
@@ -175,9 +136,9 @@ class ODCliEditConfigInstance {
175
136
  "Duplicate " + propertyName
176
137
  ], {
177
138
  leftPadding: "> ",
178
- style: terminal_kit_1.terminal.cyan,
179
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
180
- submittedStyle: terminal_kit_1.terminal.bgBlue,
139
+ style: terminal.cyan,
140
+ selectedStyle: terminal.bgDefaultColor.bold,
141
+ submittedStyle: terminal.bgBlue,
181
142
  extraLines: 2,
182
143
  cancelable: true
183
144
  }).promise;
@@ -201,15 +162,15 @@ class ODCliEditConfigInstance {
201
162
  }
202
163
  async renderConfigArrayStructureEditSelector(checker, backFn, arrayStructure, structure, data, parent, parentIndex, path) {
203
164
  const propertyName = arrayStructure.options.cliDisplayPropertyName ?? "index";
204
- (0, _1.renderHeader)(this.opts, path);
205
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select the " + propertyName + " you would like to edit.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
165
+ renderHeader(this.opts, path);
166
+ terminal(ansis.bold.green("Please select the " + propertyName + " you would like to edit.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
206
167
  const longestDataListName = Math.max(...data.map((d, i) => this.getArrayPreviewStructureNameLength(structure, d, data, i)));
207
168
  const dataList = data.map((d, i) => (i + 1) + ". " + this.getArrayPreviewFromStructure(structure, d, data, i, longestDataListName));
208
- const dataAnswer = await terminal_kit_1.terminal.singleColumnMenu(dataList, {
169
+ const dataAnswer = await terminal.singleColumnMenu(dataList, {
209
170
  leftPadding: "> ",
210
- style: terminal_kit_1.terminal.cyan,
211
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
212
- submittedStyle: terminal_kit_1.terminal.bgBlue,
171
+ style: terminal.cyan,
172
+ selectedStyle: terminal.bgDefaultColor.bold,
173
+ submittedStyle: terminal.bgBlue,
213
174
  extraLines: 2,
214
175
  cancelable: true
215
176
  }).promise;
@@ -220,27 +181,27 @@ class ODCliEditConfigInstance {
220
181
  }
221
182
  async renderConfigArrayStructureMoveSelector(checker, backFn, arrayStructure, structure, data, parent, parentIndex, path) {
222
183
  const propertyName = arrayStructure.options.cliDisplayPropertyName ?? "index";
223
- (0, _1.renderHeader)(this.opts, path);
224
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select the " + propertyName + " you would like to move.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
184
+ renderHeader(this.opts, path);
185
+ terminal(ansis.bold.green("Please select the " + propertyName + " you would like to move.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
225
186
  const longestDataListName = Math.max(...data.map((d, i) => this.getArrayPreviewStructureNameLength(structure, d, data, i)));
226
187
  const dataList = data.map((d, i) => (i + 1) + ". " + this.getArrayPreviewFromStructure(structure, d, data, i, longestDataListName));
227
- const dataAnswer = await terminal_kit_1.terminal.singleColumnMenu(dataList, {
188
+ const dataAnswer = await terminal.singleColumnMenu(dataList, {
228
189
  leftPadding: "> ",
229
- style: terminal_kit_1.terminal.cyan,
230
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
231
- submittedStyle: terminal_kit_1.terminal.bgBlue,
190
+ style: terminal.cyan,
191
+ selectedStyle: terminal.bgDefaultColor.bold,
192
+ submittedStyle: terminal.bgBlue,
232
193
  extraLines: 2,
233
194
  cancelable: true
234
195
  }).promise;
235
196
  if (dataAnswer.canceled)
236
197
  return await backFn();
237
- (0, _1.renderHeader)(this.opts, [...path, dataAnswer.selectedIndex]);
238
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select the position you would like to move to.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
239
- const moveAnswer = await terminal_kit_1.terminal.singleColumnMenu(data.map((d, i) => "Position " + (i + 1)), {
198
+ renderHeader(this.opts, [...path, dataAnswer.selectedIndex]);
199
+ terminal(ansis.bold.green("Please select the position you would like to move to.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
200
+ const moveAnswer = await terminal.singleColumnMenu(data.map((d, i) => "Position " + (i + 1)), {
240
201
  leftPadding: "> ",
241
- style: terminal_kit_1.terminal.cyan,
242
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
243
- submittedStyle: terminal_kit_1.terminal.bgBlue,
202
+ style: terminal.cyan,
203
+ selectedStyle: terminal.bgDefaultColor.bold,
204
+ submittedStyle: terminal.bgBlue,
244
205
  extraLines: 2,
245
206
  cancelable: true
246
207
  }).promise;
@@ -251,21 +212,21 @@ class ODCliEditConfigInstance {
251
212
  const insertedData = [...slicedData.slice(0, moveAnswer.selectedIndex), subData, ...slicedData.slice(moveAnswer.selectedIndex)];
252
213
  insertedData.forEach((d, i) => data[i] = d);
253
214
  await checker.config.save();
254
- terminal_kit_1.terminal.bold.blue("\n\n✅ Property moved succesfully!");
215
+ terminal.bold.blue("\n\n✅ Property moved succesfully!");
255
216
  await utilities.timer(400);
256
217
  await backFn();
257
218
  }
258
219
  async renderConfigArrayStructureRemoveSelector(checker, backFn, arrayStructure, structure, data, parent, parentIndex, path) {
259
220
  const propertyName = arrayStructure.options.cliDisplayPropertyName ?? "index";
260
- (0, _1.renderHeader)(this.opts, path);
261
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select the " + propertyName + " you would like to delete.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
221
+ renderHeader(this.opts, path);
222
+ terminal(ansis.bold.green("Please select the " + propertyName + " you would like to delete.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
262
223
  const longestDataListName = Math.max(...data.map((d, i) => this.getArrayPreviewStructureNameLength(structure, d, data, i)));
263
224
  const dataList = data.map((d, i) => (i + 1) + ". " + this.getArrayPreviewFromStructure(structure, d, data, i, longestDataListName));
264
- const dataAnswer = await terminal_kit_1.terminal.singleColumnMenu(dataList, {
225
+ const dataAnswer = await terminal.singleColumnMenu(dataList, {
265
226
  leftPadding: "> ",
266
- style: terminal_kit_1.terminal.cyan,
267
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
268
- submittedStyle: terminal_kit_1.terminal.bgBlue,
227
+ style: terminal.cyan,
228
+ selectedStyle: terminal.bgDefaultColor.bold,
229
+ submittedStyle: terminal.bgBlue,
269
230
  extraLines: 2,
270
231
  cancelable: true
271
232
  }).promise;
@@ -273,21 +234,21 @@ class ODCliEditConfigInstance {
273
234
  return await backFn();
274
235
  data.splice(dataAnswer.selectedIndex, 1);
275
236
  await checker.config.save();
276
- terminal_kit_1.terminal.bold.blue("\n\n✅ Property deleted succesfully!");
237
+ terminal.bold.blue("\n\n✅ Property deleted succesfully!");
277
238
  await utilities.timer(400);
278
239
  await backFn();
279
240
  }
280
241
  async renderConfigArrayStructureDuplicateSelector(checker, backFn, arrayStructure, structure, data, parent, parentIndex, path) {
281
242
  const propertyName = arrayStructure.options.cliDisplayPropertyName ?? "index";
282
- (0, _1.renderHeader)(this.opts, path);
283
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select the " + propertyName + " you would like to duplicate.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
243
+ renderHeader(this.opts, path);
244
+ terminal(ansis.bold.green("Please select the " + propertyName + " you would like to duplicate.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
284
245
  const longestDataListName = Math.max(...data.map((d, i) => this.getArrayPreviewStructureNameLength(structure, d, data, i)));
285
246
  const dataList = data.map((d, i) => (i + 1) + ". " + this.getArrayPreviewFromStructure(structure, d, data, i, longestDataListName));
286
- const dataAnswer = await terminal_kit_1.terminal.singleColumnMenu(dataList, {
247
+ const dataAnswer = await terminal.singleColumnMenu(dataList, {
287
248
  leftPadding: "> ",
288
- style: terminal_kit_1.terminal.cyan,
289
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
290
- submittedStyle: terminal_kit_1.terminal.bgBlue,
249
+ style: terminal.cyan,
250
+ selectedStyle: terminal.bgDefaultColor.bold,
251
+ submittedStyle: terminal.bgBlue,
291
252
  extraLines: 2,
292
253
  cancelable: true
293
254
  }).promise;
@@ -295,22 +256,22 @@ class ODCliEditConfigInstance {
295
256
  return await backFn();
296
257
  data.push(JSON.parse(JSON.stringify(data[dataAnswer.selectedIndex])));
297
258
  await checker.config.save();
298
- terminal_kit_1.terminal.bold.blue("\n\n✅ Property duplicated succesfully!");
259
+ terminal.bold.blue("\n\n✅ Property duplicated succesfully!");
299
260
  await utilities.timer(400);
300
261
  await backFn();
301
262
  }
302
263
  async renderConfigBooleanStructureEditor(checker, backFn, structure, data, parent, parentIndex, path) {
303
264
  if (typeof data != "boolean")
304
265
  throw new api.ODSystemError("OD CLI => Property is not of the type 'boolean'. Please check your config for possible errors. (index: " + parentIndex + ", path: " + path.join(".") + ")");
305
- (0, _1.renderHeader)(this.opts, path);
306
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the boolean property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "boolean property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
307
- terminal_kit_1.terminal.gray("\nCurrent value: " + ansis_1.default.bold[data ? "green" : "red"](data.toString()) + "\n");
308
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
309
- const answer = await terminal_kit_1.terminal.singleColumnMenu(["false (Disabled)", "true (Enabled)"], {
266
+ renderHeader(this.opts, path);
267
+ terminal(ansis.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the boolean property " + ansis.blue("\"" + parentIndex + "\"") : "boolean property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
268
+ terminal.gray("\nCurrent value: " + ansis.bold[data ? "green" : "red"](data.toString()) + "\n");
269
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
270
+ const answer = await terminal.singleColumnMenu(["false (Disabled)", "true (Enabled)"], {
310
271
  leftPadding: "> ",
311
- style: terminal_kit_1.terminal.cyan,
312
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
313
- submittedStyle: terminal_kit_1.terminal.bgBlue,
272
+ style: terminal.cyan,
273
+ selectedStyle: terminal.bgDefaultColor.bold,
274
+ submittedStyle: terminal.bgBlue,
314
275
  extraLines: 2,
315
276
  cancelable: true
316
277
  }).promise;
@@ -325,14 +286,14 @@ class ODCliEditConfigInstance {
325
286
  if (isDataValid) {
326
287
  parent[parentIndex] = newValue;
327
288
  await checker.config.save();
328
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
289
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
329
290
  await utilities.timer(400);
330
291
  await backFn();
331
292
  }
332
293
  else {
333
294
  const messages = checker.messages.map((msg) => "=> [" + msg.type.toUpperCase() + "] " + msg.message).join("\n");
334
- terminal_kit_1.terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
335
- terminal_kit_1.terminal.gray("\n" + messages);
295
+ terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
296
+ terminal.gray("\n" + messages);
336
297
  await utilities.timer(1000 + (2000 * checker.messages.length));
337
298
  await this.renderConfigBooleanStructureEditor(checker, backFn, structure, data, parent, parentIndex, path);
338
299
  }
@@ -340,13 +301,13 @@ class ODCliEditConfigInstance {
340
301
  async renderConfigNumberStructureEditor(checker, backFn, structure, data, parent, parentIndex, path, prefillValue) {
341
302
  if (typeof data != "number")
342
303
  throw new api.ODSystemError("OD CLI => Property is not of the type 'number'. Please check your config for possible errors. (index: " + parentIndex + ", path: " + path.join(".") + ")");
343
- (0, _1.renderHeader)(this.opts, path);
344
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the number property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "number property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(insert a new value and press enter, go back using escape)\n"));
345
- terminal_kit_1.terminal.gray("\nCurrent value: " + ansis_1.default.bold.blue(data.toString()) + "\n");
346
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
347
- const answer = await terminal_kit_1.terminal.inputField({
304
+ renderHeader(this.opts, path);
305
+ terminal(ansis.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the number property " + ansis.blue("\"" + parentIndex + "\"") : "number property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(insert a new value and press enter, go back using escape)\n"));
306
+ terminal.gray("\nCurrent value: " + ansis.bold.blue(data.toString()) + "\n");
307
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
308
+ const answer = await terminal.inputField({
348
309
  default: prefillValue,
349
- style: terminal_kit_1.terminal.cyan,
310
+ style: terminal.cyan,
350
311
  cancelable: true
351
312
  }).promise;
352
313
  if (typeof answer != "string")
@@ -360,14 +321,14 @@ class ODCliEditConfigInstance {
360
321
  if (isDataValid) {
361
322
  parent[parentIndex] = newValue;
362
323
  await checker.config.save();
363
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
324
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
364
325
  await utilities.timer(400);
365
326
  await backFn();
366
327
  }
367
328
  else {
368
329
  const messages = checker.messages.map((msg) => "=> [" + msg.type.toUpperCase() + "] " + msg.message).join("\n");
369
- terminal_kit_1.terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
370
- terminal_kit_1.terminal.red("\n" + messages);
330
+ terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
331
+ terminal.red("\n" + messages);
371
332
  await utilities.timer(1000 + (2000 * checker.messages.length));
372
333
  await this.renderConfigNumberStructureEditor(checker, backFn, structure, data, parent, parentIndex, path, answer);
373
334
  }
@@ -375,35 +336,35 @@ class ODCliEditConfigInstance {
375
336
  async renderConfigStringStructureEditor(checker, backFn, structure, data, parent, parentIndex, path, prefillValue) {
376
337
  if (typeof data != "string")
377
338
  throw new api.ODSystemError("OD CLI => Property is not of the type 'string'. Please check your config for possible errors. (index: " + parentIndex + ", path: " + path.join(".") + ")");
378
- (0, _1.renderHeader)(this.opts, path);
379
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the string property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "string property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(insert a new value and press enter, go back using escape)\n"));
380
- terminal_kit_1.terminal.gray("\nCurrent value:" + (data.includes("\n") ? "\n" : " \"") + ansis_1.default.bold.blue(data) + ansis_1.default.gray(!data.includes("\n") ? "\"\n" : "\n"));
381
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
339
+ renderHeader(this.opts, path);
340
+ terminal(ansis.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the string property " + ansis.blue("\"" + parentIndex + "\"") : "string property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(insert a new value and press enter, go back using escape)\n"));
341
+ terminal.gray("\nCurrent value:" + (data.includes("\n") ? "\n" : " \"") + ansis.bold.blue(data) + ansis.gray(!data.includes("\n") ? "\"\n" : "\n"));
342
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
382
343
  const customExtraOptions = (structure instanceof api.ODCheckerCustomStructure_DiscordId) ? structure.extraOptions : undefined;
383
344
  const customAutocompleteFunc = structure.options.cliAutocompleteFunc ? await structure.options.cliAutocompleteFunc() : null;
384
345
  const autocompleteList = ((customAutocompleteFunc ?? structure.options.cliAutocompleteList) ?? customExtraOptions) ?? structure.options.choices;
385
346
  const autoCompleteMenuOpts = {
386
- style: terminal_kit_1.terminal.white,
387
- selectedStyle: terminal_kit_1.terminal.bgBlue.white
347
+ style: terminal.white,
348
+ selectedStyle: terminal.bgBlue.white
388
349
  };
389
- const input = terminal_kit_1.terminal.inputField({
350
+ const input = terminal.inputField({
390
351
  default: prefillValue,
391
- style: terminal_kit_1.terminal.cyan,
392
- hintStyle: terminal_kit_1.terminal.gray,
352
+ style: terminal.cyan,
353
+ hintStyle: terminal.gray,
393
354
  cancelable: false,
394
355
  autoComplete: autocompleteList,
395
356
  autoCompleteHint: (!!autocompleteList),
396
357
  autoCompleteMenu: (autocompleteList) ? autoCompleteMenuOpts : false
397
358
  });
398
- terminal_kit_1.terminal.on("key", async (name, matches, data) => {
359
+ terminal.on("key", async (name, matches, data) => {
399
360
  if (name == "ESCAPE") {
400
- terminal_kit_1.terminal.removeListener("key", "cli-render-string-structure-edit");
361
+ terminal.removeListener("key", "cli-render-string-structure-edit");
401
362
  input.abort();
402
363
  await backFn();
403
364
  }
404
365
  }, { id: "cli-render-string-structure-edit" });
405
366
  const answer = await input.promise;
406
- terminal_kit_1.terminal.removeListener("key", "cli-render-string-structure-edit");
367
+ terminal.removeListener("key", "cli-render-string-structure-edit");
407
368
  if (typeof answer != "string")
408
369
  return;
409
370
  //run config checker
@@ -415,14 +376,14 @@ class ODCliEditConfigInstance {
415
376
  if (isDataValid) {
416
377
  parent[parentIndex] = newValue;
417
378
  await checker.config.save();
418
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
379
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
419
380
  await utilities.timer(400);
420
381
  await backFn();
421
382
  }
422
383
  else {
423
384
  const messages = checker.messages.map((msg) => "=> [" + msg.type.toUpperCase() + "] " + msg.message).join("\n");
424
- terminal_kit_1.terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
425
- terminal_kit_1.terminal.red("\n" + messages);
385
+ terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
386
+ terminal.red("\n" + messages);
426
387
  await utilities.timer(1000 + (2000 * checker.messages.length));
427
388
  await this.renderConfigStringStructureEditor(checker, backFn, structure, data, parent, parentIndex, path, answer);
428
389
  }
@@ -430,15 +391,15 @@ class ODCliEditConfigInstance {
430
391
  async renderConfigNullStructureEditor(checker, backFn, structure, data, parent, parentIndex, path) {
431
392
  if (data !== null)
432
393
  throw new api.ODSystemError("OD CLI => Property is not of the type 'null'. Please check your config for possible errors. (index: " + parentIndex + ", path: " + path.join(".") + ")");
433
- (0, _1.renderHeader)(this.opts, path);
434
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the null property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "null property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
435
- terminal_kit_1.terminal.gray("\nCurrent value: " + ansis_1.default.bold.blue("null") + "\n");
436
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
437
- const answer = await terminal_kit_1.terminal.singleColumnMenu(["null"], {
394
+ renderHeader(this.opts, path);
395
+ terminal(ansis.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the null property " + ansis.blue("\"" + parentIndex + "\"") : "null property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
396
+ terminal.gray("\nCurrent value: " + ansis.bold.blue("null") + "\n");
397
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
398
+ const answer = await terminal.singleColumnMenu(["null"], {
438
399
  leftPadding: "> ",
439
- style: terminal_kit_1.terminal.cyan,
440
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
441
- submittedStyle: terminal_kit_1.terminal.bgBlue,
400
+ style: terminal.cyan,
401
+ selectedStyle: terminal.bgDefaultColor.bold,
402
+ submittedStyle: terminal.bgBlue,
442
403
  extraLines: 2,
443
404
  cancelable: true
444
405
  }).promise;
@@ -453,23 +414,23 @@ class ODCliEditConfigInstance {
453
414
  if (isDataValid) {
454
415
  parent[parentIndex] = newValue;
455
416
  await checker.config.save();
456
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
417
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
457
418
  await utilities.timer(400);
458
419
  await backFn();
459
420
  }
460
421
  else {
461
422
  const messages = checker.messages.map((msg) => "=> [" + msg.type.toUpperCase() + "] " + msg.message).join("\n");
462
- terminal_kit_1.terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
463
- terminal_kit_1.terminal.red("\n" + messages);
423
+ terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
424
+ terminal.red("\n" + messages);
464
425
  await utilities.timer(1000 + (2000 * checker.messages.length));
465
426
  await this.renderConfigNullStructureEditor(checker, backFn, structure, data, parent, parentIndex, path);
466
427
  }
467
428
  }
468
429
  async renderConfigTypeSwitchStructureEditor(checker, backFn, structure, data, parent, parentIndex, path) {
469
- (0, _1.renderHeader)(this.opts, path);
470
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
471
- terminal_kit_1.terminal.gray("\nCurrent value: " + ansis_1.default.bold.blue(data.toString()) + "\n");
472
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
430
+ renderHeader(this.opts, path);
431
+ terminal(ansis.bold.green("You are now editing " + (typeof parentIndex == "string" ? "the property " + ansis.blue("\"" + parentIndex + "\"") : "property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
432
+ terminal.gray("\nCurrent value: " + ansis.bold.blue(data.toString()) + "\n");
433
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
473
434
  const actionsList = [];
474
435
  if (structure.options.boolean)
475
436
  actionsList.push("Edit as boolean");
@@ -483,11 +444,11 @@ class ODCliEditConfigInstance {
483
444
  actionsList.push("Edit as array/list");
484
445
  if (structure.options.null)
485
446
  actionsList.push("Edit as null");
486
- const answer = await terminal_kit_1.terminal.singleColumnMenu(actionsList, {
447
+ const answer = await terminal.singleColumnMenu(actionsList, {
487
448
  leftPadding: "> ",
488
- style: terminal_kit_1.terminal.cyan,
489
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
490
- submittedStyle: terminal_kit_1.terminal.bgBlue,
449
+ style: terminal.cyan,
450
+ selectedStyle: terminal.bgDefaultColor.bold,
451
+ submittedStyle: terminal.bgBlue,
491
452
  extraLines: 2,
492
453
  cancelable: true
493
454
  }).promise;
@@ -575,7 +536,7 @@ class ODCliEditConfigInstance {
575
536
  if (!structure.options.cliDisplayKeyInParentArray)
576
537
  return "Object";
577
538
  else
578
- return data[structure.options.cliDisplayKeyInParentArray]?.toString().padEnd(nameLength + 5, " ") + ansis_1.default.gray(additionalKeys.length > 0 ? "(" + additionalKeys + ")" : "");
539
+ return data[structure.options.cliDisplayKeyInParentArray]?.toString().padEnd(nameLength + 5, " ") + ansis.gray(additionalKeys.length > 0 ? "(" + additionalKeys + ")" : "");
579
540
  }
580
541
  else if (structure instanceof api.ODCheckerEnabledObjectStructure && typeof data == "object" && !Array.isArray(data) && data) {
581
542
  const subStructure = structure.options.checker;
@@ -671,7 +632,7 @@ class ODCliEditConfigInstance {
671
632
  await backFn();
672
633
  }, async () => {
673
634
  //finish setup
674
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
635
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
675
636
  await utilities.timer(400);
676
637
  await nextFn(localData);
677
638
  });
@@ -723,13 +684,13 @@ class ODCliEditConfigInstance {
723
684
  }, propertyStructure, localData, enabledProperty, [...path, parentIndex], [...localPath, parentIndex]);
724
685
  }
725
686
  async renderAdditionConfigObjectSwitchStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath) {
726
- (0, _1.renderHeader)(this.opts, [...path, parentIndex]);
727
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("What type of object would you like to add?\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
728
- const answer = await terminal_kit_1.terminal.singleColumnMenu(structure.options.objects.map((obj) => obj.name), {
687
+ renderHeader(this.opts, [...path, parentIndex]);
688
+ terminal(ansis.bold.green("What type of object would you like to add?\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
689
+ const answer = await terminal.singleColumnMenu(structure.options.objects.map((obj) => obj.name), {
729
690
  leftPadding: "> ",
730
- style: terminal_kit_1.terminal.cyan,
731
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
732
- submittedStyle: terminal_kit_1.terminal.bgBlue,
691
+ style: terminal.cyan,
692
+ selectedStyle: terminal.bgDefaultColor.bold,
693
+ submittedStyle: terminal.bgBlue,
733
694
  extraLines: 2,
734
695
  cancelable: true
735
696
  }).promise;
@@ -760,15 +721,15 @@ class ODCliEditConfigInstance {
760
721
  await this.chooseAdditionConfigStructure(checker, backFn, nextFn, newStructure, parent, parentIndex, path, localPath);
761
722
  }
762
723
  async renderAdditionConfigBooleanStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath) {
763
- (0, _1.renderHeader)(this.opts, [...path, parentIndex]);
764
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the boolean property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "boolean property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
765
- terminal_kit_1.terminal.gray("\nProperty: " + ansis_1.default.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
766
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
767
- const answer = await terminal_kit_1.terminal.singleColumnMenu(["false (Disabled)", "true (Enabled)"], {
724
+ renderHeader(this.opts, [...path, parentIndex]);
725
+ terminal(ansis.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the boolean property " + ansis.blue("\"" + parentIndex + "\"") : "boolean property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
726
+ terminal.gray("\nProperty: " + ansis.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
727
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
728
+ const answer = await terminal.singleColumnMenu(["false (Disabled)", "true (Enabled)"], {
768
729
  leftPadding: "> ",
769
- style: terminal_kit_1.terminal.cyan,
770
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
771
- submittedStyle: terminal_kit_1.terminal.bgBlue,
730
+ style: terminal.cyan,
731
+ selectedStyle: terminal.bgDefaultColor.bold,
732
+ submittedStyle: terminal.bgBlue,
772
733
  extraLines: 2,
773
734
  cancelable: true
774
735
  }).promise;
@@ -781,26 +742,26 @@ class ODCliEditConfigInstance {
781
742
  checker.messages = []; //manually clear previous messages
782
743
  const isDataValid = structure.check(checker, newValue, newPath);
783
744
  if (isDataValid) {
784
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
745
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
785
746
  await utilities.timer(400);
786
747
  await nextFn(newValue);
787
748
  }
788
749
  else {
789
750
  const messages = checker.messages.map((msg) => "=> [" + msg.type.toUpperCase() + "] " + msg.message).join("\n");
790
- terminal_kit_1.terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
791
- terminal_kit_1.terminal.gray("\n" + messages);
751
+ terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
752
+ terminal.gray("\n" + messages);
792
753
  await utilities.timer(1000 + (2000 * checker.messages.length));
793
754
  await this.renderAdditionConfigBooleanStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath);
794
755
  }
795
756
  }
796
757
  async renderAdditionConfigNumberStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath, prefillValue) {
797
- (0, _1.renderHeader)(this.opts, [...path, parentIndex]);
798
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the number property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "number property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(insert a new value and press enter, go back using escape)\n"));
799
- terminal_kit_1.terminal.gray("\nProperty: " + ansis_1.default.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
800
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
801
- const answer = await terminal_kit_1.terminal.inputField({
758
+ renderHeader(this.opts, [...path, parentIndex]);
759
+ terminal(ansis.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the number property " + ansis.blue("\"" + parentIndex + "\"") : "number property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(insert a new value and press enter, go back using escape)\n"));
760
+ terminal.gray("\nProperty: " + ansis.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
761
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
762
+ const answer = await terminal.inputField({
802
763
  default: prefillValue,
803
- style: terminal_kit_1.terminal.cyan,
764
+ style: terminal.cyan,
804
765
  cancelable: true
805
766
  }).promise;
806
767
  if (typeof answer != "string")
@@ -812,48 +773,48 @@ class ODCliEditConfigInstance {
812
773
  checker.messages = []; //manually clear previous messages
813
774
  const isDataValid = structure.check(checker, newValue, newPath);
814
775
  if (isDataValid) {
815
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
776
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
816
777
  await utilities.timer(400);
817
778
  await nextFn(newValue);
818
779
  }
819
780
  else {
820
781
  const messages = checker.messages.map((msg) => "=> [" + msg.type.toUpperCase() + "] " + msg.message).join("\n");
821
- terminal_kit_1.terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
822
- terminal_kit_1.terminal.red("\n" + messages);
782
+ terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
783
+ terminal.red("\n" + messages);
823
784
  await utilities.timer(1000 + (2000 * checker.messages.length));
824
785
  await this.renderAdditionConfigNumberStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath, answer);
825
786
  }
826
787
  }
827
788
  async renderAdditionConfigStringStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath, prefillValue) {
828
- (0, _1.renderHeader)(this.opts, [...path, parentIndex]);
829
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the string property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "string property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(insert a new value and press enter, go back using escape)\n"));
830
- terminal_kit_1.terminal.gray("\nProperty: " + ansis_1.default.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
831
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
789
+ renderHeader(this.opts, [...path, parentIndex]);
790
+ terminal(ansis.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the string property " + ansis.blue("\"" + parentIndex + "\"") : "string property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(insert a new value and press enter, go back using escape)\n"));
791
+ terminal.gray("\nProperty: " + ansis.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
792
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
832
793
  const customExtraOptions = (structure instanceof api.ODCheckerCustomStructure_DiscordId) ? structure.extraOptions : undefined;
833
794
  const customAutocompleteFunc = structure.options.cliAutocompleteFunc ? await structure.options.cliAutocompleteFunc() : null;
834
795
  const autocompleteList = ((customAutocompleteFunc ?? structure.options.cliAutocompleteList) ?? customExtraOptions) ?? structure.options.choices;
835
796
  const autoCompleteMenuOpts = {
836
- style: terminal_kit_1.terminal.white,
837
- selectedStyle: terminal_kit_1.terminal.bgBlue.white
797
+ style: terminal.white,
798
+ selectedStyle: terminal.bgBlue.white
838
799
  };
839
- const input = terminal_kit_1.terminal.inputField({
800
+ const input = terminal.inputField({
840
801
  default: prefillValue,
841
- style: terminal_kit_1.terminal.cyan,
842
- hintStyle: terminal_kit_1.terminal.gray,
802
+ style: terminal.cyan,
803
+ hintStyle: terminal.gray,
843
804
  cancelable: false,
844
805
  autoComplete: autocompleteList,
845
806
  autoCompleteHint: (!!autocompleteList),
846
807
  autoCompleteMenu: (autocompleteList) ? autoCompleteMenuOpts : false
847
808
  });
848
- terminal_kit_1.terminal.on("key", async (name, matches, data) => {
809
+ terminal.on("key", async (name, matches, data) => {
849
810
  if (name == "ESCAPE") {
850
- terminal_kit_1.terminal.removeListener("key", "cli-render-string-structure-add");
811
+ terminal.removeListener("key", "cli-render-string-structure-add");
851
812
  input.abort();
852
813
  await backFn();
853
814
  }
854
815
  }, { id: "cli-render-string-structure-add" });
855
816
  const answer = await input.promise;
856
- terminal_kit_1.terminal.removeListener("key", "cli-render-string-structure-add");
817
+ terminal.removeListener("key", "cli-render-string-structure-add");
857
818
  if (typeof answer != "string")
858
819
  return;
859
820
  //run config checker
@@ -863,28 +824,28 @@ class ODCliEditConfigInstance {
863
824
  checker.messages = []; //manually clear previous messages
864
825
  const isDataValid = structure.check(checker, newValue, newPath);
865
826
  if (isDataValid) {
866
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
827
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
867
828
  await utilities.timer(400);
868
829
  await nextFn(newValue);
869
830
  }
870
831
  else {
871
832
  const messages = checker.messages.map((msg) => "=> [" + msg.type.toUpperCase() + "] " + msg.message).join("\n");
872
- terminal_kit_1.terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
873
- terminal_kit_1.terminal.red("\n" + messages);
833
+ terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
834
+ terminal.red("\n" + messages);
874
835
  await utilities.timer(1000 + (2000 * checker.messages.length));
875
836
  await this.renderAdditionConfigStringStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath, answer);
876
837
  }
877
838
  }
878
839
  async renderAdditionConfigNullStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath) {
879
- (0, _1.renderHeader)(this.opts, [...path, parentIndex]);
880
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the null property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "null property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
881
- terminal_kit_1.terminal.gray("\nProperty: " + ansis_1.default.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
882
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
883
- const answer = await terminal_kit_1.terminal.singleColumnMenu(["null"], {
840
+ renderHeader(this.opts, [...path, parentIndex]);
841
+ terminal(ansis.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the null property " + ansis.blue("\"" + parentIndex + "\"") : "null property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
842
+ terminal.gray("\nProperty: " + ansis.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
843
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
844
+ const answer = await terminal.singleColumnMenu(["null"], {
884
845
  leftPadding: "> ",
885
- style: terminal_kit_1.terminal.cyan,
886
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
887
- submittedStyle: terminal_kit_1.terminal.bgBlue,
846
+ style: terminal.cyan,
847
+ selectedStyle: terminal.bgDefaultColor.bold,
848
+ submittedStyle: terminal.bgBlue,
888
849
  extraLines: 2,
889
850
  cancelable: true
890
851
  }).promise;
@@ -897,28 +858,28 @@ class ODCliEditConfigInstance {
897
858
  checker.messages = []; //manually clear previous messages
898
859
  const isDataValid = structure.check(checker, newValue, newPath);
899
860
  if (isDataValid) {
900
- terminal_kit_1.terminal.bold.blue("\n\n✅ Variable saved succesfully!");
861
+ terminal.bold.blue("\n\n✅ Variable saved succesfully!");
901
862
  await utilities.timer(400);
902
863
  await nextFn(newValue);
903
864
  }
904
865
  else {
905
866
  const messages = checker.messages.map((msg) => "=> [" + msg.type.toUpperCase() + "] " + msg.message).join("\n");
906
- terminal_kit_1.terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
907
- terminal_kit_1.terminal.red("\n" + messages);
867
+ terminal.bold.blue("\n\n❌ Variable is invalid! Please try again!");
868
+ terminal.red("\n" + messages);
908
869
  await utilities.timer(1000 + (2000 * checker.messages.length));
909
870
  await this.renderAdditionConfigNullStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath);
910
871
  }
911
872
  }
912
873
  async renderAdditionConfigArrayStructureSelector(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath, localData = []) {
913
- (0, _1.renderHeader)(this.opts, [...path, parentIndex]);
914
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("Please select what you would like to do with the new array.\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
874
+ renderHeader(this.opts, [...path, parentIndex]);
875
+ terminal(ansis.bold.green("Please select what you would like to do with the new array.\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
915
876
  if (!structure.options.propertyChecker)
916
877
  return await backFn();
917
- terminal_kit_1.terminal.gray("\nProperty: " + ansis_1.default.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
918
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
878
+ terminal.gray("\nProperty: " + ansis.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
879
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
919
880
  const propertyName = structure.options.cliDisplayPropertyName ?? "index";
920
- const answer = await terminal_kit_1.terminal.singleColumnMenu(localData.length < 1 ? [ansis_1.default.magenta("-> Continue to next variable"), "Add " + propertyName] : [
921
- ansis_1.default.magenta("-> Continue to next variable"),
881
+ const answer = await terminal.singleColumnMenu(localData.length < 1 ? [ansis.magenta("-> Continue to next variable"), "Add " + propertyName] : [
882
+ ansis.magenta("-> Continue to next variable"),
922
883
  "Add " + propertyName,
923
884
  "Edit " + propertyName,
924
885
  "Move " + propertyName,
@@ -926,9 +887,9 @@ class ODCliEditConfigInstance {
926
887
  "Duplicate " + propertyName,
927
888
  ], {
928
889
  leftPadding: "> ",
929
- style: terminal_kit_1.terminal.cyan,
930
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
931
- submittedStyle: terminal_kit_1.terminal.bgBlue,
890
+ style: terminal.cyan,
891
+ selectedStyle: terminal.bgDefaultColor.bold,
892
+ submittedStyle: terminal.bgBlue,
932
893
  extraLines: 2,
933
894
  cancelable: true
934
895
  }).promise;
@@ -952,10 +913,10 @@ class ODCliEditConfigInstance {
952
913
  await this.renderConfigArrayStructureDuplicateSelector(checker, backFnFunc, structure, structure.options.propertyChecker, localData, parent, parentIndex, path);
953
914
  }
954
915
  async renderAdditionConfigTypeSwitchStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath) {
955
- (0, _1.renderHeader)(this.opts, path);
956
- (0, terminal_kit_1.terminal)(ansis_1.default.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the property " + ansis_1.default.blue("\"" + parentIndex + "\"") : "property " + ansis_1.default.blue("#" + (parentIndex + 1))) + ".\n") + ansis_1.default.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
957
- terminal_kit_1.terminal.gray("\nProperty: " + ansis_1.default.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
958
- terminal_kit_1.terminal.gray("Description: " + ansis_1.default.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
916
+ renderHeader(this.opts, path);
917
+ terminal(ansis.bold.green("You are now creating " + (typeof parentIndex == "string" ? "the property " + ansis.blue("\"" + parentIndex + "\"") : "property " + ansis.blue("#" + (parentIndex + 1))) + ".\n") + ansis.italic.gray("(use arrow keys to navigate, go back using escape)\n"));
918
+ terminal.gray("\nProperty: " + ansis.bold.blue(structure.options.cliDisplayName ?? [...localPath, parentIndex].join(".")) + "\n");
919
+ terminal.gray("Description: " + ansis.bold(structure.options.cliDisplayDescription ?? "/") + "\n");
959
920
  const actionsList = [];
960
921
  if (structure.options.boolean)
961
922
  actionsList.push("Create as boolean");
@@ -969,11 +930,11 @@ class ODCliEditConfigInstance {
969
930
  actionsList.push("Create as array/list");
970
931
  if (structure.options.null)
971
932
  actionsList.push("Create as null");
972
- const answer = await terminal_kit_1.terminal.singleColumnMenu(actionsList, {
933
+ const answer = await terminal.singleColumnMenu(actionsList, {
973
934
  leftPadding: "> ",
974
- style: terminal_kit_1.terminal.cyan,
975
- selectedStyle: terminal_kit_1.terminal.bgDefaultColor.bold,
976
- submittedStyle: terminal_kit_1.terminal.bgBlue,
935
+ style: terminal.cyan,
936
+ selectedStyle: terminal.bgDefaultColor.bold,
937
+ submittedStyle: terminal.bgBlue,
977
938
  extraLines: 2,
978
939
  cancelable: true
979
940
  }).promise;
@@ -994,4 +955,3 @@ class ODCliEditConfigInstance {
994
955
  await this.renderAdditionConfigNullStructure(checker, async () => { await this.renderAdditionConfigTypeSwitchStructure(checker, backFn, nextFn, structure, parent, parentIndex, path, localPath); }, nextFn, structure.options.null, parent, parentIndex, path, localPath);
995
956
  }
996
957
  }
997
- exports.ODCliEditConfigInstance = ODCliEditConfigInstance;