@reliverse/relinka 1.1.2 → 1.1.4

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 (85) hide show
  1. package/README.md +35 -28
  2. package/dist-npm/components/checkbox/index.js +8 -6
  3. package/dist-npm/components/confirm/index.js +7 -4
  4. package/dist-npm/components/core/Separator.d.ts +0 -4
  5. package/dist-npm/components/core/create-prompt.js +1 -1
  6. package/dist-npm/components/core/key.js +6 -6
  7. package/dist-npm/components/core/lines.d.ts +5 -17
  8. package/dist-npm/components/core/lines.js +6 -2
  9. package/dist-npm/components/core/make-theme.js +3 -1
  10. package/dist-npm/components/core/position.d.ts +0 -8
  11. package/dist-npm/components/core/position.js +9 -3
  12. package/dist-npm/components/core/promise-polyfill.js +2 -2
  13. package/dist-npm/components/core/screen-manager.js +2 -1
  14. package/dist-npm/components/core/theme.d.ts +12 -146
  15. package/dist-npm/components/core/theme.js +1 -1
  16. package/dist-npm/components/core/use-keypress.js +3 -1
  17. package/dist-npm/components/core/use-pagination.d.ts +4 -8
  18. package/dist-npm/components/core/use-prefix.js +1 -1
  19. package/dist-npm/components/core/useKeyPress.js +3 -1
  20. package/dist-npm/components/core/utils.d.ts +0 -11
  21. package/dist-npm/components/date/date.d.ts +1 -1
  22. package/dist-npm/components/date/date.js +74 -12
  23. package/dist-npm/components/expand/index.js +4 -2
  24. package/dist-npm/components/figures/index.js +5 -5
  25. package/dist-npm/components/instance/basic.d.ts +0 -12
  26. package/dist-npm/components/instance/basic.js +1 -1
  27. package/dist-npm/components/instance/browser.d.ts +0 -14
  28. package/dist-npm/components/instance/reporter/browser.js +5 -5
  29. package/dist-npm/components/instance/reporter/fancy.d.ts +1 -1
  30. package/dist-npm/components/instance/reporter/fancy.js +1 -1
  31. package/dist-npm/components/mono/mono.js +9 -9
  32. package/dist-npm/components/mono/monoTwo.d.ts +13 -76
  33. package/dist-npm/components/multiselect/multiselect-main.d.ts +4 -2
  34. package/dist-npm/components/multiselect/multiselect-main.js +12 -10
  35. package/dist-npm/components/password/password-main.js +1 -1
  36. package/dist-npm/components/progressbar/ProgressBar.d.ts +3 -14
  37. package/dist-npm/components/progressbar/ProgressBar.js +3 -14
  38. package/dist-npm/components/progressbar/helper.d.ts +2 -18
  39. package/dist-npm/components/prompts/create.d.ts +0 -13
  40. package/dist-npm/components/prompts/prompt.js +3 -3
  41. package/dist-npm/components/prompts/promptTwo.d.ts +34 -252
  42. package/dist-npm/components/prompts/promptTwo.js +6 -27
  43. package/dist-npm/components/prompts/relinka.d.ts +17 -114
  44. package/dist-npm/components/prompts/relinka.js +18 -103
  45. package/dist-npm/components/range/range.d.ts +12 -64
  46. package/dist-npm/components/range/range.js +36 -59
  47. package/dist-npm/components/rawlist/index.js +6 -4
  48. package/dist-npm/components/search/index.js +7 -5
  49. package/dist-npm/components/select/index.js +9 -3
  50. package/dist-npm/components/select/select-main.d.ts +1 -1
  51. package/dist-npm/components/select/select-main.js +4 -3
  52. package/dist-npm/components/select/select-two.js +3 -1
  53. package/dist-npm/components/toggle/index.js +3 -1
  54. package/dist-npm/testing/index.js +1 -1
  55. package/dist-npm/types/general.d.ts +30 -141
  56. package/dist-npm/types/keypress.d.ts +0 -3
  57. package/dist-npm/types/keypress.js +1 -1
  58. package/dist-npm/types/readline.d.ts +1 -9
  59. package/dist-npm/types/relinka.d.ts +1 -9
  60. package/dist-npm/types/utils.d.ts +0 -12
  61. package/dist-npm/utils/box.d.ts +14 -104
  62. package/dist-npm/utils/color.d.ts +0 -20
  63. package/dist-npm/utils/colorize.js +2 -1
  64. package/dist-npm/utils/component.d.ts +5 -26
  65. package/dist-npm/utils/component.js +1 -2
  66. package/dist-npm/utils/constants.d.ts +0 -21
  67. package/dist-npm/utils/constants.js +8 -8
  68. package/dist-npm/utils/decoder.d.ts +2 -17
  69. package/dist-npm/utils/decoder.js +54 -25
  70. package/dist-npm/utils/error.d.ts +0 -5
  71. package/dist-npm/utils/errors.d.ts +1 -1
  72. package/dist-npm/utils/errors.js +8 -4
  73. package/dist-npm/utils/format.d.ts +0 -12
  74. package/dist-npm/utils/keypress.d.ts +0 -6
  75. package/dist-npm/utils/keypress.js +12 -23
  76. package/dist-npm/utils/log.d.ts +0 -11
  77. package/dist-npm/utils/prompt-tmp.js +2 -2
  78. package/dist-npm/utils/prompt-two.js +2 -2
  79. package/dist-npm/utils/skeleton.d.ts +0 -3
  80. package/dist-npm/utils/skeleton.js +66 -22
  81. package/dist-npm/utils/stream.d.ts +0 -13
  82. package/dist-npm/utils/string.d.ts +0 -45
  83. package/dist-npm/utils/tree.d.ts +5 -34
  84. package/dist-npm/utils/variants.js +9 -9
  85. package/package.json +12 -5
@@ -1,98 +1,26 @@
1
1
  export { isCancel } from "../../components/prompts/prompt.js";
2
2
  export type TextOptions = {
3
- /**
4
- * The primary message to display for the prompt.
5
- */
6
- message: string;
7
- /**
8
- * A placeholder string that is displayed in the input field when it is empty. It disappears when the user starts typing.
9
- * @optional
10
- */
11
- placeholder?: string;
12
- /**
13
- * The primary message to display for the prompt.
14
- * A default value for the input field.This value will be returned if the user does not enter a value.
15
- * @optional
16
- */
17
- defaultValue?: string;
18
- /**
19
- * An initial value that appears in the input field. Unlike `defaultValue`, it can be edited or removed by the user.
20
- * @optional
21
- */
22
- initialValue?: string;
23
- /**
24
- * A function to validate the input. If the input is not valid, this function should return a string message.
25
- * The prompt will continue until a valid value is entered or the prompt is aborted.
26
- * @param {string} value - The current value of the input field.
27
- * @returns {string | void} A string with an error message if validation fails or `void` if the input is valid.
28
- * optional
29
- */
30
- validate?: (value: string) => string | void;
3
+ message: string;
4
+ placeholder?: string;
5
+ defaultValue?: string;
6
+ initialValue?: string;
7
+ validate?: (value: string) => string | void;
31
8
  };
32
- /**
33
- * Provides text input functionality with customizable options.
34
- * @param {TextOptions} opts - Options to customize the text prompt. See {@link TextOptions}.
35
- * @returns {Promise<string | symbol>} A promise that resolves to the user input or a symbol for special cases.
36
- */
37
9
  export declare const text: (opts: TextOptions) => any;
38
10
  export type PasswordOptions = {
39
- /**
40
- * The message to be displayed above the input field.
41
- */
42
- message: string;
43
- /**
44
- * A character that masks the user's input, hiding the text they type.
45
- * @optional
46
- */
47
- mask?: string;
48
- /**
49
- * A function to validate the input. Returns an error message if the input fails validation.
50
- * @param {string} value - The current value of the input field.
51
- * @returns {string | void} An error message if the input fails validation, or `void` if the input is valid.
52
- * @optional
53
- */
54
- validate?: (value: string) => string | void;
11
+ message: string;
12
+ mask?: string;
13
+ validate?: (value: string) => string | void;
55
14
  };
56
- /**
57
- * Provides password input functionality with customizable options, including input masking.
58
- * @param {PasswordOptions} opts - Options to customize the password prompt. See {@link PasswordOptions}.
59
- * @returns {Promise<string | symbol>} A promise that resolves to the user input or a symbol for special cases.
60
- */
61
15
  export declare const password: (opts: PasswordOptions) => any;
62
16
  export type ConfirmOptions = {
63
- /**
64
- * The primary message to display for the prompt.
65
- */
66
- message: string;
67
- /**
68
- * The text to display for the active/affirmative choice.
69
- * @optional
70
- */
71
- active?: string;
72
- /**
73
- * Text to display for the inactive/negative choice.
74
- * @optional
75
- */
76
- inactive?: string;
77
- /**
78
- * The initial selection value.
79
- * @optional
80
- */
81
- initialValue?: boolean;
17
+ message: string;
18
+ active?: string;
19
+ inactive?: string;
20
+ initialValue?: boolean;
82
21
  };
83
- /**
84
- * Provides a confirmation prompt with customizable options.
85
- * @param {ConfirmOptions} opts - Options to customize the confirmation prompt. See {@link ConfirmOptions}.
86
- * @returns {Promise<boolean | symbol>} A promise that resolves to the user's choice, or a symbol for special cases.
87
- */
88
22
  export declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
89
- /**
90
- * A generic type for option values in a select prompt, supporting both primitive and complex types.
91
- */
92
23
  type Primitive = Readonly<string | boolean | number>;
93
- /**
94
- * Defines the structure of an option in a select prompt.
95
- */
96
24
  type Option<Value> = Value extends Primitive ? {
97
25
  value: Value;
98
26
  label?: string;
@@ -102,181 +30,45 @@ type Option<Value> = Value extends Primitive ? {
102
30
  label: string;
103
31
  hint?: string;
104
32
  };
105
- /**
106
- * Options for configuring the select prompt.
107
- * @template Options - An array of option objects. See {@link Option}.
108
- * @template Value - The type of option value. See {@link Option}.
109
- */
110
33
  export type SelectOptions<Options extends Option<Value>[], Value> = {
111
- /**
112
- * The primary message to display at the prompt.
113
- */
114
- message: string;
115
- /**
116
- * The list of options from which the user can choose. See {@link Option}.
117
- */
118
- options: Options;
119
- /**
120
- * The initial value selected in the prompt. See {@link Value}.
121
- * @optional
122
- */
123
- initialValue?: Value;
34
+ message: string;
35
+ options: Options;
36
+ initialValue?: Value;
124
37
  };
125
- /**
126
- * Provides a select prompt functionality where the user can choose from a list of options.
127
- * @param {SelectOptions<Options, Value>} opts - Options to customize the select prompt. See {@link SelectOptions}.
128
- * @returns {Promise<Value | Symbol>} A promise that resolves to the selected value or a symbol for special cases. See {@link Value}.
129
- */
130
38
  export declare const select: <Options extends Option<Value>[], Value>(opts: SelectOptions<Options, Value>) => Promise<Value | symbol>;
131
- /**
132
- * Provides a prompt that allows the user to select an option by pressing a key.
133
- * This is useful for scenarios where each option is associated with a specific key.
134
- * @param {SelectOptions<Options, Value>} opts - Configuration options for the select key prompt. See {@link SelectOptions}.
135
- * @returns {Promise<Value | Symbol>} A promise that resolves to the value of the selected option, or a symbol for special cases such as abort. See {@link Value}.
136
- */
137
39
  export declare const selectKey: <Options extends Option<Value>[], Value extends string>(opts: SelectOptions<Options, Value>) => Promise<Value | symbol>;
138
40
  export type MultiSelectOptions<Options extends Option<Value>[], Value> = {
139
- /**
140
- * The primary message to be displayed above the multi-select list.
141
- */
142
- message: string;
143
- /**
144
- * The list of options from which users can select multiple items. See {@link Option}.
145
- */
146
- options: Options;
147
- /**
148
- * An array of values representing the options initially selected in the prompt. See {@link Value}.
149
- * @optional
150
- */
151
- initialValues?: Value[];
152
- /**
153
- * Specifies whether at least one selection is required before submitting.
154
- * @optional
155
- */
156
- required?: boolean;
157
- /**
158
- * The value of the option on which the cursor is initially placed when the command prompt opens. See {@link Value}.
159
- * @optional
160
- */
161
- cursorAt?: Value;
41
+ message: string;
42
+ options: Options;
43
+ initialValues?: Value[];
44
+ required?: boolean;
45
+ cursorAt?: Value;
162
46
  };
163
- /**
164
- * Provides multi-select prompt functionality where the user can select multiple options from a list.
165
- * @param {MultiSelectOptions<Options, Value>} opts - Options to customize the multi-select prompt. See {@link MultiSelectOptions}.
166
- * @returns {Promise<Value[] | Symbol>} A promise that resolves to an array of selected values, or a symbol for special cases.
167
- */
168
47
  export declare const multiselect: <Options extends Option<Value>[], Value>(opts: MultiSelectOptions<Options, Value>) => Promise<Value[] | symbol>;
169
48
  export type GroupMultiSelectOptions<Options extends Option<Value>[], Value> = {
170
- /**
171
- * The primary message to be displayed above the group multi-select list.
172
- */
173
- message: string;
174
- /**
175
- * An object containing groups of options. Each key represents a group name,
176
- * and the associated value is an array of options within that group. See {@link Option}.
177
- */
178
- options: Record<string, Options>;
179
- /**
180
- * An array of values representing the initially selected options across all groups. See {@link Value}.
181
- * @optional
182
- */
183
- initialValues?: Value[];
184
- /**
185
- * Specifies whether at least one selection is required before submission is allowed.
186
- * @optional
187
- */
188
- required?: boolean;
189
- /**
190
- * The value of the option on which the cursor will initially appear when the command prompt opens. See {@link Value}.
191
- * @optional
192
- */
193
- cursorAt?: Value;
49
+ message: string;
50
+ options: Record<string, Options>;
51
+ initialValues?: Value[];
52
+ required?: boolean;
53
+ cursorAt?: Value;
194
54
  };
195
55
  export declare const groupMultiselect: <Options extends Option<Value>[], Value>(opts: GroupMultiSelectOptions<Options, Value>) => Promise<Value[] | symbol>;
196
- /**
197
- * Displays a formatted note in the console, with an optional title. The note is visually distinguished
198
- * from regular console output with ANSI color codes and styles to make it stand out. The function calculates
199
- * the length of the longest line to ensure the note is properly aligned and framed.
200
- *
201
- * @param {string} [message=""] - The main text of the note. Supports multiline strings.
202
- * @param {string} [title=""] - An optional title for the note. If provided, it'll be displayed above the message.
203
- */
204
56
  export declare const note: (message?: string, title?: string) => void;
205
- /**
206
- * Prints an abort message to the console. This is typically used to indicate
207
- * that a process or operation has been cancelled. The message is colored for
208
- * for emphasis and visual differentiation.
209
- *
210
- * @param {string} [message=""] - The cancellation message to display. This parameter
211
- * is optional; if omitted, the default styling will be used without a specific message.
212
- */
213
57
  export declare const cancel: (message?: string) => void;
214
- /**
215
- * Prints an introductory message to the console. This function is used to
216
- * Display a title or short message at the beginning of a script or application.
217
- * framed by a specified bar character for visual distinction.
218
- *
219
- * @param {string} [title=""] - The title or message to display. This parameter is optional; if omitted, only the framing bar will be printed.
220
- */
221
58
  export declare const intro: (title?: string) => void;
222
- /**
223
- * Prints a closing message to the console. Similar to the `intro` function,
224
- * `outro' is designed to indicate the end of a script or application execution
225
- * with a framed message for clear visual separation from the rest of the console output.
226
- *
227
- * @param {string} [message=""] - The final message to display. This parameter is optional; if omitted, only the border will be printed.
228
- */
229
59
  export declare const outro: (message?: string) => void;
230
60
  export type LogMessageOptions = {
231
- /**
232
- * A custom icon to be placed in front of the log message. This allows visual differentiation
233
- * log messages based on their importance or category (e.g. info, error).
234
- * @optional
235
- */
236
- symbol?: string;
61
+ symbol?: string;
237
62
  };
238
- /**
239
- * Logs a message to the console, with support for different types of messages (info, success, warning, error).
240
- */
241
63
  export declare const log: {
242
- /**
243
- * Logs an message, prefixed with a gray bar.
244
- * @param {string} message - The message to log.
245
- * @param {LogMessageOptions} [opts] - Optional settings for the log message. See {@link LogMessageOptions}.
246
- */
247
- message: (message?: string, { symbol }?: LogMessageOptions) => void;
248
- /**
249
- * Logs an information message, prefixed with a blue info icon.
250
- * @param {string} message - The message to log.
251
- */
252
- info: (message: string) => void;
253
- /**
254
- * Logs a success message, preceded by a green check symbol.
255
- * @param {string} message - The message to log.
256
- */
257
- success: (message: string) => void;
258
- /**
259
- * Logs a step message, typically used to indicate a step in a process, preceded by a green submit symbol.
260
- * @param {string} message - The message to log.
261
- */
262
- step: (message: string) => void;
263
- /**
264
- * Logs a warning message, preceded by a yellow warning icon.
265
- * @param {string} message - The message to log.
266
- */
267
- warn: (message: string) => void;
268
- /** alias for `log.warn()`. See {@link log.warn}. */
269
- warning: (message: string) => void;
270
- /**
271
- * Logs an error message, preceded by a red error icon.
272
- * @param {string} message - The message to log.
273
- */
274
- error: (message: string) => void;
64
+ message: (message?: string, { symbol }?: LogMessageOptions) => void;
65
+ info: (message: string) => void;
66
+ success: (message: string) => void;
67
+ step: (message: string) => void;
68
+ warn: (message: string) => void;
69
+ warning: (message: string) => void;
70
+ error: (message: string) => void;
275
71
  };
276
- /**
277
- * Displays an animated spinner with a message, with functionality to start and stop the animation.
278
- * @returns an object with `start` and `stop` methods to control the spinner.
279
- */
280
72
  export declare const spinner: () => {
281
73
  start(message?: string): void;
282
74
  stop(message?: string): void;
@@ -285,11 +77,7 @@ export type PromptGroupAwaitedReturn<T> = {
285
77
  [P in keyof T]: Exclude<Awaited<T[P]>, symbol>;
286
78
  };
287
79
  export type PromptGroupOptions<T> = {
288
- /**
289
- * Control how the group can be canceled
290
- * if one of the prompts is canceled.
291
- */
292
- onCancel?: (opts: {
80
+ onCancel?: (opts: {
293
81
  results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
294
82
  }) => void;
295
83
  };
@@ -301,10 +89,4 @@ export type PromptGroup<T> = {
301
89
  results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
302
90
  }) => void | Promise<T[P] | void>;
303
91
  };
304
- /**
305
- * Groups multiple prompts together so that they can be displayed and resolved in sequence.
306
- * @param {PromptGroup<T>} prompts - The prompts to display in the group. See {@link PromptGroup}.
307
- * @param {PromptGroupOptions<T>} [opts] - Optional settings for the prompt group. See {@link PromptGroupOptions}.
308
- * @returns {Promise<Prettify<PromptGroupAwaitedReturn<T>>>} A promise that resolves to an object containing the results of each prompt in the group.
309
- */
310
92
  export declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>) => Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
@@ -568,43 +568,22 @@ export const log = {
568
568
  process.stdout.write(`${parts.join("\n")}
569
569
  `);
570
570
  },
571
- /**
572
- * Logs an information message, prefixed with a blue info icon.
573
- * @param {string} message - The message to log.
574
- */
575
- info: (message) => {
571
+ info: (message) => {
576
572
  log.message(message, { symbol: color.blue(S_INFO) });
577
573
  },
578
- /**
579
- * Logs a success message, preceded by a green check symbol.
580
- * @param {string} message - The message to log.
581
- */
582
- success: (message) => {
574
+ success: (message) => {
583
575
  log.message(message, { symbol: color.green(S_SUCCESS) });
584
576
  },
585
- /**
586
- * Logs a step message, typically used to indicate a step in a process, preceded by a green submit symbol.
587
- * @param {string} message - The message to log.
588
- */
589
- step: (message) => {
577
+ step: (message) => {
590
578
  log.message(message, { symbol: color.green(S_STEP_SUBMIT) });
591
579
  },
592
- /**
593
- * Logs a warning message, preceded by a yellow warning icon.
594
- * @param {string} message - The message to log.
595
- */
596
- warn: (message) => {
580
+ warn: (message) => {
597
581
  log.message(message, { symbol: color.yellow(S_WARN) });
598
582
  },
599
- /** alias for `log.warn()`. See {@link log.warn}. */
600
- warning: (message) => {
583
+ warning: (message) => {
601
584
  log.warn(message);
602
585
  },
603
- /**
604
- * Logs an error message, preceded by a red error icon.
605
- * @param {string} message - The message to log.
606
- */
607
- error: (message) => {
586
+ error: (message) => {
608
587
  log.message(message, { symbol: color.red(S_ERROR) });
609
588
  }
610
589
  };
@@ -1,12 +1,6 @@
1
1
  import type { PromptOptions } from "../../components/mono/monoTwo.js";
2
2
  import type { RelinkaReporter, InputLogObject, LogObject, RelinkaOptions } from "../../types/general.js";
3
3
  import type { LogType } from "../../utils/constants.js";
4
- /**
5
- * Relinka class for logging management with support for pause/resume, mocking and customizable reporting.
6
- * Provides flexible logging capabilities including level-based logging, custom reporters and integration options.
7
- *
8
- * @class Relinka
9
- */
10
4
  export declare class Relinka {
11
5
  options: RelinkaOptions;
12
6
  _lastLog: {
@@ -17,112 +11,27 @@ export declare class Relinka {
17
11
  timeout?: ReturnType<typeof setTimeout>;
18
12
  };
19
13
  _mockFn?: RelinkaOptions["mockFn"];
20
- /**
21
- * Creates an instance of Relinka with specified options or defaults.
22
- *
23
- * @param {Partial<RelinkaOptions>} [options={}] - Configuration options for the Relinka instance.
24
- */
25
- constructor(options?: Partial<RelinkaOptions>);
26
- /**
27
- * Gets the current log level of the Relinka instance.
28
- *
29
- * @returns {number} The current log level.
30
- */
31
- get level(): any;
32
- /**
33
- * Sets the minimum log level that will be output by the instance.
34
- *
35
- * @param {number} level - The new log level to set.
36
- */
37
- set level(level: any);
38
- /**
39
- * Displays a prompt to the user and returns the response.
40
- * Throw an error if `prompt` is not supported by the current configuration.
41
- *
42
- * @template T
43
- * @param {string} message - The message to display in the prompt.
44
- * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
45
- * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
46
- */
47
- prompt<T extends PromptOptions>(message: string, opts?: T): any;
48
- /**
49
- * Creates a new instance of Relinka, inheriting options from the current instance, with possible overrides.
50
- *
51
- * @param {Partial<RelinkaOptions>} options - Optional overrides for the new instance. See {@link RelinkaOptions}.
52
- * @returns {RelinkaInstance} A new Relinka instance. See {@link RelinkaInstance}.
53
- */
54
- create(options: Partial<RelinkaOptions>): RelinkaInstance;
55
- /**
56
- * Creates a new Relinka instance with the specified default log object properties.
57
- *
58
- * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
59
- * @returns {RelinkaInstance} A new Relinka instance. See {@link RelinkaInstance}.
60
- */
61
- withDefaults(defaults: InputLogObject): RelinkaInstance;
62
- /**
63
- * Creates a new Relinka instance with a specified tag, which will be included in every log.
64
- *
65
- * @param {string} tag - The tag to include in each log of the new instance.
66
- * @returns {RelinkaInstance} A new Relinka instance. See {@link RelinkaInstance}.
67
- */
68
- withTag(tag: string): RelinkaInstance;
69
- /**
70
- * Adds a custom reporter to the Relinka instance.
71
- * Reporters will be called for each log message, depending on their implementation and log level.
72
- *
73
- * @param {RelinkaReporter} reporter - The reporter to add. See {@link RelinkaReporter}.
74
- * @returns {Relinka} The current Relinka instance.
75
- */
76
- addReporter(reporter: RelinkaReporter): this;
77
- /**
78
- * Removes a custom reporter from the Relinka instance.
79
- * If no reporter is specified, all reporters will be removed.
80
- *
81
- * @param {RelinkaReporter} reporter - The reporter to remove. See {@link RelinkaReporter}.
82
- * @returns {Relinka} The current Relinka instance.
83
- */
84
- removeReporter(reporter: RelinkaReporter): any;
85
- /**
86
- * Replaces all reporters of the Relinka instance with the specified array of reporters.
87
- *
88
- * @param {RelinkaReporter[]} reporters - The new reporters to set. See {@link RelinkaReporter}.
89
- * @returns {Relinka} The current Relinka instance.
90
- */
91
- setReporters(reporters: RelinkaReporter[]): this;
14
+ constructor(options?: Partial<RelinkaOptions>);
15
+ get level(): any;
16
+ set level(level: any);
17
+ prompt<T extends PromptOptions>(message: string, opts?: T): any;
18
+ create(options: Partial<RelinkaOptions>): RelinkaInstance;
19
+ withDefaults(defaults: InputLogObject): RelinkaInstance;
20
+ withTag(tag: string): RelinkaInstance;
21
+ addReporter(reporter: RelinkaReporter): this;
22
+ removeReporter(reporter: RelinkaReporter): any;
23
+ setReporters(reporters: RelinkaReporter[]): this;
92
24
  wrapAll(): void;
93
25
  restoreAll(): void;
94
- /**
95
- * Overrides console methods with Relinka logging methods for consistent logging.
96
- */
97
- wrapConsole(): void;
98
- /**
99
- * Restores the original console methods, removing Relinka overrides.
100
- */
101
- restoreConsole(): void;
102
- /**
103
- * Overrides standard output and error streams to redirect them through Relinka.
104
- */
105
- wrapStd(): void;
26
+ wrapConsole(): void;
27
+ restoreConsole(): void;
28
+ wrapStd(): void;
106
29
  _wrapStream(stream: NodeJS.WriteStream | undefined, type: LogType): void;
107
- /**
108
- * Restores the original standard output and error streams, removing the Relinka redirection.
109
- */
110
- restoreStd(): void;
30
+ restoreStd(): void;
111
31
  _restoreStream(stream?: NodeJS.WriteStream): void;
112
- /**
113
- * Pauses logging, queues incoming logs until resumed.
114
- */
115
- pauseLogs(): void;
116
- /**
117
- * Resumes logging, processing any queued logs.
118
- */
119
- resumeLogs(): void;
120
- /**
121
- * Replaces logging methods with mocks if a mock function is provided.
122
- *
123
- * @param {RelinkaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link RelinkaOptions["mockFn"]}.
124
- */
125
- mockTypes(mockFn?: RelinkaOptions["mockFn"]): void;
32
+ pauseLogs(): void;
33
+ resumeLogs(): void;
34
+ mockTypes(mockFn?: RelinkaOptions["mockFn"]): void;
126
35
  _wrapLogFn(defaults: InputLogObject, isRaw?: boolean): (...args: any[]) => false | undefined;
127
36
  _logFn(defaults: InputLogObject, args: any[], isRaw?: boolean): false | undefined;
128
37
  _log(logObj: LogObject): void;
@@ -132,10 +41,4 @@ export type LogFn = {
132
41
  raw: (...args: any[]) => void;
133
42
  };
134
43
  export type RelinkaInstance = Relinka & Record<LogType, LogFn>;
135
- /**
136
- * Utility for creating a new Relinka instance with optional configuration.
137
- *
138
- * @param {Partial<RelinkaOptions>} [options={}] - Optional configuration options for the new Relinka instance. See {@link RelinkaOptions}.
139
- * @returns {RelinkaInstance} A new instance of Relinka. See {@link RelinkaInstance}.
140
- */
141
44
  export declare function createRelinka(options?: Partial<RelinkaOptions>): RelinkaInstance;