@alanszp/serverless 12.0.2 → 13.0.0

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 (165) hide show
  1. package/package.json +8 -11
  2. package/.gitignore +0 -3
  3. package/.npmignore +0 -3
  4. package/node_modules/@alanszp/core/.gitignore +0 -3
  5. package/node_modules/@alanszp/core/.npmignore +0 -3
  6. package/node_modules/@alanszp/core/LICENSE +0 -21
  7. package/node_modules/@alanszp/core/dist/app/appIdentifier.d.ts +0 -1
  8. package/node_modules/@alanszp/core/dist/app/appIdentifier.js +0 -10
  9. package/node_modules/@alanszp/core/dist/app/appIdentifier.js.map +0 -1
  10. package/node_modules/@alanszp/core/dist/app/index.d.ts +0 -1
  11. package/node_modules/@alanszp/core/dist/app/index.js +0 -18
  12. package/node_modules/@alanszp/core/dist/app/index.js.map +0 -1
  13. package/node_modules/@alanszp/core/dist/assignKey.d.ts +0 -2
  14. package/node_modules/@alanszp/core/dist/assignKey.js +0 -20
  15. package/node_modules/@alanszp/core/dist/assignKey.js.map +0 -1
  16. package/node_modules/@alanszp/core/dist/editable/index.d.ts +0 -2
  17. package/node_modules/@alanszp/core/dist/editable/index.js +0 -19
  18. package/node_modules/@alanszp/core/dist/editable/index.js.map +0 -1
  19. package/node_modules/@alanszp/core/dist/editable/keepOrUpdate.d.ts +0 -3
  20. package/node_modules/@alanszp/core/dist/editable/keepOrUpdate.js +0 -26
  21. package/node_modules/@alanszp/core/dist/editable/keepOrUpdate.js.map +0 -1
  22. package/node_modules/@alanszp/core/dist/editable/types.d.ts +0 -6
  23. package/node_modules/@alanszp/core/dist/editable/types.js +0 -3
  24. package/node_modules/@alanszp/core/dist/editable/types.js.map +0 -1
  25. package/node_modules/@alanszp/core/dist/index.d.ts +0 -4
  26. package/node_modules/@alanszp/core/dist/index.js +0 -21
  27. package/node_modules/@alanszp/core/dist/index.js.map +0 -1
  28. package/node_modules/@alanszp/core/dist/lists/ListResult.d.ts +0 -7
  29. package/node_modules/@alanszp/core/dist/lists/ListResult.js +0 -8
  30. package/node_modules/@alanszp/core/dist/lists/ListResult.js.map +0 -1
  31. package/node_modules/@alanszp/core/dist/lists/Orderable.d.ts +0 -11
  32. package/node_modules/@alanszp/core/dist/lists/Orderable.js +0 -13
  33. package/node_modules/@alanszp/core/dist/lists/Orderable.js.map +0 -1
  34. package/node_modules/@alanszp/core/dist/lists/Paginable.d.ts +0 -14
  35. package/node_modules/@alanszp/core/dist/lists/Paginable.js +0 -22
  36. package/node_modules/@alanszp/core/dist/lists/Paginable.js.map +0 -1
  37. package/node_modules/@alanszp/core/dist/lists/index.d.ts +0 -3
  38. package/node_modules/@alanszp/core/dist/lists/index.js +0 -20
  39. package/node_modules/@alanszp/core/dist/lists/index.js.map +0 -1
  40. package/node_modules/@alanszp/core/package.json +0 -25
  41. package/node_modules/@alanszp/core/tsconfig.json +0 -15
  42. package/node_modules/@types/node/LICENSE +0 -21
  43. package/node_modules/@types/node/README.md +0 -15
  44. package/node_modules/@types/node/assert/strict.d.ts +0 -8
  45. package/node_modules/@types/node/assert.d.ts +0 -996
  46. package/node_modules/@types/node/async_hooks.d.ts +0 -539
  47. package/node_modules/@types/node/buffer.d.ts +0 -2362
  48. package/node_modules/@types/node/child_process.d.ts +0 -1540
  49. package/node_modules/@types/node/cluster.d.ts +0 -432
  50. package/node_modules/@types/node/console.d.ts +0 -415
  51. package/node_modules/@types/node/constants.d.ts +0 -19
  52. package/node_modules/@types/node/crypto.d.ts +0 -4487
  53. package/node_modules/@types/node/dgram.d.ts +0 -596
  54. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -545
  55. package/node_modules/@types/node/dns/promises.d.ts +0 -425
  56. package/node_modules/@types/node/dns.d.ts +0 -809
  57. package/node_modules/@types/node/dom-events.d.ts +0 -122
  58. package/node_modules/@types/node/domain.d.ts +0 -170
  59. package/node_modules/@types/node/events.d.ts +0 -879
  60. package/node_modules/@types/node/fs/promises.d.ts +0 -1239
  61. package/node_modules/@types/node/fs.d.ts +0 -4311
  62. package/node_modules/@types/node/globals.d.ts +0 -411
  63. package/node_modules/@types/node/globals.global.d.ts +0 -1
  64. package/node_modules/@types/node/http.d.ts +0 -1887
  65. package/node_modules/@types/node/http2.d.ts +0 -2382
  66. package/node_modules/@types/node/https.d.ts +0 -550
  67. package/node_modules/@types/node/index.d.ts +0 -88
  68. package/node_modules/@types/node/inspector.d.ts +0 -2747
  69. package/node_modules/@types/node/module.d.ts +0 -315
  70. package/node_modules/@types/node/net.d.ts +0 -949
  71. package/node_modules/@types/node/os.d.ts +0 -478
  72. package/node_modules/@types/node/package.json +0 -229
  73. package/node_modules/@types/node/path.d.ts +0 -191
  74. package/node_modules/@types/node/perf_hooks.d.ts +0 -645
  75. package/node_modules/@types/node/process.d.ts +0 -1561
  76. package/node_modules/@types/node/punycode.d.ts +0 -117
  77. package/node_modules/@types/node/querystring.d.ts +0 -141
  78. package/node_modules/@types/node/readline/promises.d.ts +0 -150
  79. package/node_modules/@types/node/readline.d.ts +0 -539
  80. package/node_modules/@types/node/repl.d.ts +0 -430
  81. package/node_modules/@types/node/stream/consumers.d.ts +0 -12
  82. package/node_modules/@types/node/stream/promises.d.ts +0 -83
  83. package/node_modules/@types/node/stream/web.d.ts +0 -366
  84. package/node_modules/@types/node/stream.d.ts +0 -1701
  85. package/node_modules/@types/node/string_decoder.d.ts +0 -67
  86. package/node_modules/@types/node/test.d.ts +0 -1465
  87. package/node_modules/@types/node/timers/promises.d.ts +0 -93
  88. package/node_modules/@types/node/timers.d.ts +0 -240
  89. package/node_modules/@types/node/tls.d.ts +0 -1210
  90. package/node_modules/@types/node/trace_events.d.ts +0 -182
  91. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  92. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  93. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  94. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  95. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  96. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  97. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  98. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  99. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  100. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  101. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  102. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  103. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  104. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  105. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  106. package/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  107. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  108. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  109. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  110. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  111. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  112. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  113. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  114. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  115. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  116. package/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  117. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  118. package/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  119. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  120. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  121. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  122. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  123. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  124. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  125. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  126. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  127. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  128. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  129. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  130. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  131. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  132. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  133. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  134. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  135. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  136. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  137. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  138. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  139. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  140. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  141. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  142. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  143. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  144. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  145. package/node_modules/@types/node/tty.d.ts +0 -208
  146. package/node_modules/@types/node/url.d.ts +0 -927
  147. package/node_modules/@types/node/util.d.ts +0 -2183
  148. package/node_modules/@types/node/v8.d.ts +0 -764
  149. package/node_modules/@types/node/vm.d.ts +0 -903
  150. package/node_modules/@types/node/wasi.d.ts +0 -179
  151. package/node_modules/@types/node/worker_threads.d.ts +0 -691
  152. package/node_modules/@types/node/zlib.d.ts +0 -517
  153. package/src/errors/index.ts +0 -1
  154. package/src/errors/splitCouldNotLoadError.ts +0 -5
  155. package/src/handlers/index.ts +0 -1
  156. package/src/handlers/wrappers/index.ts +0 -1
  157. package/src/handlers/wrappers/withContext.ts +0 -34
  158. package/src/index.ts +0 -5
  159. package/src/middlewares/index.ts +0 -2
  160. package/src/middlewares/initializeDBMiddleware.ts +0 -22
  161. package/src/middlewares/initializeSplitMiddleware.ts +0 -23
  162. package/src/middlewares/withAuditLogMiddleware.ts +0 -23
  163. package/src/types/index.ts +0 -2
  164. package/src/types/lambda.ts +0 -6
  165. package/src/types/middyTypes.ts +0 -10
@@ -1,539 +0,0 @@
1
- /**
2
- * The `node:readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
3
- *
4
- * To use the promise-based APIs:
5
- *
6
- * ```js
7
- * import * as readline from 'node:readline/promises';
8
- * ```
9
- *
10
- * To use the callback and sync APIs:
11
- *
12
- * ```js
13
- * import * as readline from 'node:readline';
14
- * ```
15
- *
16
- * The following simple example illustrates the basic use of the `node:readline`module.
17
- *
18
- * ```js
19
- * import * as readline from 'node:readline/promises';
20
- * import { stdin as input, stdout as output } from 'node:process';
21
- *
22
- * const rl = readline.createInterface({ input, output });
23
- *
24
- * const answer = await rl.question('What do you think of Node.js? ');
25
- *
26
- * console.log(`Thank you for your valuable feedback: ${answer}`);
27
- *
28
- * rl.close();
29
- * ```
30
- *
31
- * Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
32
- * received on the `input` stream.
33
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js)
34
- */
35
- declare module "readline" {
36
- import { Abortable, EventEmitter } from "node:events";
37
- import * as promises from "node:readline/promises";
38
- export { promises };
39
- export interface Key {
40
- sequence?: string | undefined;
41
- name?: string | undefined;
42
- ctrl?: boolean | undefined;
43
- meta?: boolean | undefined;
44
- shift?: boolean | undefined;
45
- }
46
- /**
47
- * Instances of the `readline.Interface` class are constructed using the`readline.createInterface()` method. Every instance is associated with a
48
- * single `input` `Readable` stream and a single `output` `Writable` stream.
49
- * The `output` stream is used to print prompts for user input that arrives on,
50
- * and is read from, the `input` stream.
51
- * @since v0.1.104
52
- */
53
- export class Interface extends EventEmitter {
54
- readonly terminal: boolean;
55
- /**
56
- * The current input data being processed by node.
57
- *
58
- * This can be used when collecting input from a TTY stream to retrieve the
59
- * current value that has been processed thus far, prior to the `line` event
60
- * being emitted. Once the `line` event has been emitted, this property will
61
- * be an empty string.
62
- *
63
- * Be aware that modifying the value during the instance runtime may have
64
- * unintended consequences if `rl.cursor` is not also controlled.
65
- *
66
- * **If not using a TTY stream for input, use the `'line'` event.**
67
- *
68
- * One possible use case would be as follows:
69
- *
70
- * ```js
71
- * const values = ['lorem ipsum', 'dolor sit amet'];
72
- * const rl = readline.createInterface(process.stdin);
73
- * const showResults = debounce(() => {
74
- * console.log(
75
- * '\n',
76
- * values.filter((val) => val.startsWith(rl.line)).join(' '),
77
- * );
78
- * }, 300);
79
- * process.stdin.on('keypress', (c, k) => {
80
- * showResults();
81
- * });
82
- * ```
83
- * @since v0.1.98
84
- */
85
- readonly line: string;
86
- /**
87
- * The cursor position relative to `rl.line`.
88
- *
89
- * This will track where the current cursor lands in the input string, when
90
- * reading input from a TTY stream. The position of cursor determines the
91
- * portion of the input string that will be modified as input is processed,
92
- * as well as the column where the terminal caret will be rendered.
93
- * @since v0.1.98
94
- */
95
- readonly cursor: number;
96
- /**
97
- * NOTE: According to the documentation:
98
- *
99
- * > Instances of the `readline.Interface` class are constructed using the
100
- * > `readline.createInterface()` method.
101
- *
102
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
103
- */
104
- protected constructor(
105
- input: NodeJS.ReadableStream,
106
- output?: NodeJS.WritableStream,
107
- completer?: Completer | AsyncCompleter,
108
- terminal?: boolean,
109
- );
110
- /**
111
- * NOTE: According to the documentation:
112
- *
113
- * > Instances of the `readline.Interface` class are constructed using the
114
- * > `readline.createInterface()` method.
115
- *
116
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
117
- */
118
- protected constructor(options: ReadLineOptions);
119
- /**
120
- * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
121
- * @since v15.3.0, v14.17.0
122
- * @return the current prompt string
123
- */
124
- getPrompt(): string;
125
- /**
126
- * The `rl.setPrompt()` method sets the prompt that will be written to `output`whenever `rl.prompt()` is called.
127
- * @since v0.1.98
128
- */
129
- setPrompt(prompt: string): void;
130
- /**
131
- * The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new
132
- * location at which to provide input.
133
- *
134
- * When called, `rl.prompt()` will resume the `input` stream if it has been
135
- * paused.
136
- *
137
- * If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
138
- * @since v0.1.98
139
- * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.
140
- */
141
- prompt(preserveCursor?: boolean): void;
142
- /**
143
- * The `rl.question()` method displays the `query` by writing it to the `output`,
144
- * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument.
145
- *
146
- * When called, `rl.question()` will resume the `input` stream if it has been
147
- * paused.
148
- *
149
- * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
150
- *
151
- * The `callback` function passed to `rl.question()` does not follow the typical
152
- * pattern of accepting an `Error` object or `null` as the first argument.
153
- * The `callback` is called with the provided answer as the only argument.
154
- *
155
- * An error will be thrown if calling `rl.question()` after `rl.close()`.
156
- *
157
- * Example usage:
158
- *
159
- * ```js
160
- * rl.question('What is your favorite food? ', (answer) => {
161
- * console.log(`Oh, so your favorite food is ${answer}`);
162
- * });
163
- * ```
164
- *
165
- * Using an `AbortController` to cancel a question.
166
- *
167
- * ```js
168
- * const ac = new AbortController();
169
- * const signal = ac.signal;
170
- *
171
- * rl.question('What is your favorite food? ', { signal }, (answer) => {
172
- * console.log(`Oh, so your favorite food is ${answer}`);
173
- * });
174
- *
175
- * signal.addEventListener('abort', () => {
176
- * console.log('The food question timed out');
177
- * }, { once: true });
178
- *
179
- * setTimeout(() => ac.abort(), 10000);
180
- * ```
181
- * @since v0.3.3
182
- * @param query A statement or query to write to `output`, prepended to the prompt.
183
- * @param callback A callback function that is invoked with the user's input in response to the `query`.
184
- */
185
- question(query: string, callback: (answer: string) => void): void;
186
- question(query: string, options: Abortable, callback: (answer: string) => void): void;
187
- /**
188
- * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed
189
- * later if necessary.
190
- *
191
- * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance.
192
- * @since v0.3.4
193
- */
194
- pause(): this;
195
- /**
196
- * The `rl.resume()` method resumes the `input` stream if it has been paused.
197
- * @since v0.3.4
198
- */
199
- resume(): this;
200
- /**
201
- * The `rl.close()` method closes the `Interface` instance and
202
- * relinquishes control over the `input` and `output` streams. When called,
203
- * the `'close'` event will be emitted.
204
- *
205
- * Calling `rl.close()` does not immediately stop other events (including `'line'`)
206
- * from being emitted by the `Interface` instance.
207
- * @since v0.1.98
208
- */
209
- close(): void;
210
- /**
211
- * The `rl.write()` method will write either `data` or a key sequence identified
212
- * by `key` to the `output`. The `key` argument is supported only if `output` is
213
- * a `TTY` text terminal. See `TTY keybindings` for a list of key
214
- * combinations.
215
- *
216
- * If `key` is specified, `data` is ignored.
217
- *
218
- * When called, `rl.write()` will resume the `input` stream if it has been
219
- * paused.
220
- *
221
- * If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
222
- *
223
- * ```js
224
- * rl.write('Delete this!');
225
- * // Simulate Ctrl+U to delete the line written previously
226
- * rl.write(null, { ctrl: true, name: 'u' });
227
- * ```
228
- *
229
- * The `rl.write()` method will write the data to the `readline` `Interface`'s`input`_as if it were provided by the user_.
230
- * @since v0.1.98
231
- */
232
- write(data: string | Buffer, key?: Key): void;
233
- write(data: undefined | null | string | Buffer, key: Key): void;
234
- /**
235
- * Returns the real position of the cursor in relation to the input
236
- * prompt + string. Long input (wrapping) strings, as well as multiple
237
- * line prompts are included in the calculations.
238
- * @since v13.5.0, v12.16.0
239
- */
240
- getCursorPos(): CursorPos;
241
- /**
242
- * events.EventEmitter
243
- * 1. close
244
- * 2. line
245
- * 3. pause
246
- * 4. resume
247
- * 5. SIGCONT
248
- * 6. SIGINT
249
- * 7. SIGTSTP
250
- * 8. history
251
- */
252
- addListener(event: string, listener: (...args: any[]) => void): this;
253
- addListener(event: "close", listener: () => void): this;
254
- addListener(event: "line", listener: (input: string) => void): this;
255
- addListener(event: "pause", listener: () => void): this;
256
- addListener(event: "resume", listener: () => void): this;
257
- addListener(event: "SIGCONT", listener: () => void): this;
258
- addListener(event: "SIGINT", listener: () => void): this;
259
- addListener(event: "SIGTSTP", listener: () => void): this;
260
- addListener(event: "history", listener: (history: string[]) => void): this;
261
- emit(event: string | symbol, ...args: any[]): boolean;
262
- emit(event: "close"): boolean;
263
- emit(event: "line", input: string): boolean;
264
- emit(event: "pause"): boolean;
265
- emit(event: "resume"): boolean;
266
- emit(event: "SIGCONT"): boolean;
267
- emit(event: "SIGINT"): boolean;
268
- emit(event: "SIGTSTP"): boolean;
269
- emit(event: "history", history: string[]): boolean;
270
- on(event: string, listener: (...args: any[]) => void): this;
271
- on(event: "close", listener: () => void): this;
272
- on(event: "line", listener: (input: string) => void): this;
273
- on(event: "pause", listener: () => void): this;
274
- on(event: "resume", listener: () => void): this;
275
- on(event: "SIGCONT", listener: () => void): this;
276
- on(event: "SIGINT", listener: () => void): this;
277
- on(event: "SIGTSTP", listener: () => void): this;
278
- on(event: "history", listener: (history: string[]) => void): this;
279
- once(event: string, listener: (...args: any[]) => void): this;
280
- once(event: "close", listener: () => void): this;
281
- once(event: "line", listener: (input: string) => void): this;
282
- once(event: "pause", listener: () => void): this;
283
- once(event: "resume", listener: () => void): this;
284
- once(event: "SIGCONT", listener: () => void): this;
285
- once(event: "SIGINT", listener: () => void): this;
286
- once(event: "SIGTSTP", listener: () => void): this;
287
- once(event: "history", listener: (history: string[]) => void): this;
288
- prependListener(event: string, listener: (...args: any[]) => void): this;
289
- prependListener(event: "close", listener: () => void): this;
290
- prependListener(event: "line", listener: (input: string) => void): this;
291
- prependListener(event: "pause", listener: () => void): this;
292
- prependListener(event: "resume", listener: () => void): this;
293
- prependListener(event: "SIGCONT", listener: () => void): this;
294
- prependListener(event: "SIGINT", listener: () => void): this;
295
- prependListener(event: "SIGTSTP", listener: () => void): this;
296
- prependListener(event: "history", listener: (history: string[]) => void): this;
297
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
298
- prependOnceListener(event: "close", listener: () => void): this;
299
- prependOnceListener(event: "line", listener: (input: string) => void): this;
300
- prependOnceListener(event: "pause", listener: () => void): this;
301
- prependOnceListener(event: "resume", listener: () => void): this;
302
- prependOnceListener(event: "SIGCONT", listener: () => void): this;
303
- prependOnceListener(event: "SIGINT", listener: () => void): this;
304
- prependOnceListener(event: "SIGTSTP", listener: () => void): this;
305
- prependOnceListener(event: "history", listener: (history: string[]) => void): this;
306
- [Symbol.asyncIterator](): AsyncIterableIterator<string>;
307
- }
308
- export type ReadLine = Interface; // type forwarded for backwards compatibility
309
- export type Completer = (line: string) => CompleterResult;
310
- export type AsyncCompleter = (
311
- line: string,
312
- callback: (err?: null | Error, result?: CompleterResult) => void,
313
- ) => void;
314
- export type CompleterResult = [string[], string];
315
- export interface ReadLineOptions {
316
- input: NodeJS.ReadableStream;
317
- output?: NodeJS.WritableStream | undefined;
318
- completer?: Completer | AsyncCompleter | undefined;
319
- terminal?: boolean | undefined;
320
- /**
321
- * Initial list of history lines. This option makes sense
322
- * only if `terminal` is set to `true` by the user or by an internal `output`
323
- * check, otherwise the history caching mechanism is not initialized at all.
324
- * @default []
325
- */
326
- history?: string[] | undefined;
327
- historySize?: number | undefined;
328
- prompt?: string | undefined;
329
- crlfDelay?: number | undefined;
330
- /**
331
- * If `true`, when a new input line added
332
- * to the history list duplicates an older one, this removes the older line
333
- * from the list.
334
- * @default false
335
- */
336
- removeHistoryDuplicates?: boolean | undefined;
337
- escapeCodeTimeout?: number | undefined;
338
- tabSize?: number | undefined;
339
- }
340
- /**
341
- * The `readline.createInterface()` method creates a new `readline.Interface`instance.
342
- *
343
- * ```js
344
- * const readline = require('node:readline');
345
- * const rl = readline.createInterface({
346
- * input: process.stdin,
347
- * output: process.stdout,
348
- * });
349
- * ```
350
- *
351
- * Once the `readline.Interface` instance is created, the most common case is to
352
- * listen for the `'line'` event:
353
- *
354
- * ```js
355
- * rl.on('line', (line) => {
356
- * console.log(`Received: ${line}`);
357
- * });
358
- * ```
359
- *
360
- * If `terminal` is `true` for this instance then the `output` stream will get
361
- * the best compatibility if it defines an `output.columns` property and emits
362
- * a `'resize'` event on the `output` if or when the columns ever change
363
- * (`process.stdout` does this automatically when it is a TTY).
364
- *
365
- * When creating a `readline.Interface` using `stdin` as input, the program
366
- * will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without
367
- * waiting for user input, call `process.stdin.unref()`.
368
- * @since v0.1.98
369
- */
370
- export function createInterface(
371
- input: NodeJS.ReadableStream,
372
- output?: NodeJS.WritableStream,
373
- completer?: Completer | AsyncCompleter,
374
- terminal?: boolean,
375
- ): Interface;
376
- export function createInterface(options: ReadLineOptions): Interface;
377
- /**
378
- * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
379
- *
380
- * Optionally, `interface` specifies a `readline.Interface` instance for which
381
- * autocompletion is disabled when copy-pasted input is detected.
382
- *
383
- * If the `stream` is a `TTY`, then it must be in raw mode.
384
- *
385
- * This is automatically called by any readline instance on its `input` if the`input` is a terminal. Closing the `readline` instance does not stop
386
- * the `input` from emitting `'keypress'` events.
387
- *
388
- * ```js
389
- * readline.emitKeypressEvents(process.stdin);
390
- * if (process.stdin.isTTY)
391
- * process.stdin.setRawMode(true);
392
- * ```
393
- *
394
- * ## Example: Tiny CLI
395
- *
396
- * The following example illustrates the use of `readline.Interface` class to
397
- * implement a small command-line interface:
398
- *
399
- * ```js
400
- * const readline = require('node:readline');
401
- * const rl = readline.createInterface({
402
- * input: process.stdin,
403
- * output: process.stdout,
404
- * prompt: 'OHAI> ',
405
- * });
406
- *
407
- * rl.prompt();
408
- *
409
- * rl.on('line', (line) => {
410
- * switch (line.trim()) {
411
- * case 'hello':
412
- * console.log('world!');
413
- * break;
414
- * default:
415
- * console.log(`Say what? I might have heard '${line.trim()}'`);
416
- * break;
417
- * }
418
- * rl.prompt();
419
- * }).on('close', () => {
420
- * console.log('Have a great day!');
421
- * process.exit(0);
422
- * });
423
- * ```
424
- *
425
- * ## Example: Read file stream line-by-Line
426
- *
427
- * A common use case for `readline` is to consume an input file one line at a
428
- * time. The easiest way to do so is leveraging the `fs.ReadStream` API as
429
- * well as a `for await...of` loop:
430
- *
431
- * ```js
432
- * const fs = require('node:fs');
433
- * const readline = require('node:readline');
434
- *
435
- * async function processLineByLine() {
436
- * const fileStream = fs.createReadStream('input.txt');
437
- *
438
- * const rl = readline.createInterface({
439
- * input: fileStream,
440
- * crlfDelay: Infinity,
441
- * });
442
- * // Note: we use the crlfDelay option to recognize all instances of CR LF
443
- * // ('\r\n') in input.txt as a single line break.
444
- *
445
- * for await (const line of rl) {
446
- * // Each line in input.txt will be successively available here as `line`.
447
- * console.log(`Line from file: ${line}`);
448
- * }
449
- * }
450
- *
451
- * processLineByLine();
452
- * ```
453
- *
454
- * Alternatively, one could use the `'line'` event:
455
- *
456
- * ```js
457
- * const fs = require('node:fs');
458
- * const readline = require('node:readline');
459
- *
460
- * const rl = readline.createInterface({
461
- * input: fs.createReadStream('sample.txt'),
462
- * crlfDelay: Infinity,
463
- * });
464
- *
465
- * rl.on('line', (line) => {
466
- * console.log(`Line from file: ${line}`);
467
- * });
468
- * ```
469
- *
470
- * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
471
- *
472
- * ```js
473
- * const { once } = require('node:events');
474
- * const { createReadStream } = require('node:fs');
475
- * const { createInterface } = require('node:readline');
476
- *
477
- * (async function processLineByLine() {
478
- * try {
479
- * const rl = createInterface({
480
- * input: createReadStream('big-file.txt'),
481
- * crlfDelay: Infinity,
482
- * });
483
- *
484
- * rl.on('line', (line) => {
485
- * // Process the line.
486
- * });
487
- *
488
- * await once(rl, 'close');
489
- *
490
- * console.log('File processed.');
491
- * } catch (err) {
492
- * console.error(err);
493
- * }
494
- * })();
495
- * ```
496
- * @since v0.7.7
497
- */
498
- export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
499
- export type Direction = -1 | 0 | 1;
500
- export interface CursorPos {
501
- rows: number;
502
- cols: number;
503
- }
504
- /**
505
- * The `readline.clearLine()` method clears current line of given `TTY` stream
506
- * in a specified direction identified by `dir`.
507
- * @since v0.7.7
508
- * @param callback Invoked once the operation completes.
509
- * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
510
- */
511
- export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
512
- /**
513
- * The `readline.clearScreenDown()` method clears the given `TTY` stream from
514
- * the current position of the cursor down.
515
- * @since v0.7.7
516
- * @param callback Invoked once the operation completes.
517
- * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
518
- */
519
- export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
520
- /**
521
- * The `readline.cursorTo()` method moves cursor to the specified position in a
522
- * given `TTY` `stream`.
523
- * @since v0.7.7
524
- * @param callback Invoked once the operation completes.
525
- * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
526
- */
527
- export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
528
- /**
529
- * The `readline.moveCursor()` method moves the cursor _relative_ to its current
530
- * position in a given `TTY` `stream`.
531
- * @since v0.7.7
532
- * @param callback Invoked once the operation completes.
533
- * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
534
- */
535
- export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
536
- }
537
- declare module "node:readline" {
538
- export * from "readline";
539
- }