typespeed 2.3.6 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/app/src/config-development.json +3 -2
  2. package/app/src/test-socket.class.ts +56 -0
  3. package/app/src/views/socket.html +23 -0
  4. package/dist/introduction/decorator/example-import.class.js +17 -0
  5. package/dist/introduction/decorator/main-app.js +14 -0
  6. package/dist/introduction/decorator/main-decorator.js +127 -0
  7. package/dist/introduction/decorator/main-import.js +1 -0
  8. package/dist/introduction/decorator/main-reflect.js +38 -0
  9. package/dist/introduction/web-services/db-init.js +33 -0
  10. package/dist/introduction/web-services/db-singleton.js +49 -0
  11. package/dist/introduction/web-services/http-if.js +12 -0
  12. package/dist/introduction/web-services/http-init.js +7 -0
  13. package/dist/introduction/web-services/http-router.js +23 -0
  14. package/dist/{database.decorator.js → src/database.decorator.js} +2 -4
  15. package/dist/{default → src/default}/express-server.class.js +20 -5
  16. package/dist/{default → src/default}/rabbitmq.class.js +3 -3
  17. package/dist/{default → src/default}/redis.class.js +1 -1
  18. package/dist/src/default/socket-io.class.js +64 -0
  19. package/dist/{typespeed.js → src/typespeed.js} +6 -3
  20. package/dist/typespeed.d.ts +19 -1
  21. package/package.json +8 -8
  22. package/src/database.decorator.ts +2 -4
  23. package/src/default/express-server.class.ts +18 -7
  24. package/src/default/rabbitmq.class.ts +3 -3
  25. package/src/default/redis.class.ts +1 -1
  26. package/src/default/socket-io.class.ts +68 -0
  27. package/src/factory/server-factory.class.ts +1 -1
  28. package/src/typespeed.d.ts +19 -1
  29. package/src/typespeed.ts +7 -4
  30. package/test/socket.test.ts +60 -0
  31. package/tsconfig.json +2 -1
  32. package/app/node_modules/.package-lock.json +0 -134
  33. package/app/node_modules/@types/body-parser/LICENSE +0 -21
  34. package/app/node_modules/@types/body-parser/README.md +0 -16
  35. package/app/node_modules/@types/body-parser/index.d.ts +0 -107
  36. package/app/node_modules/@types/body-parser/package.json +0 -58
  37. package/app/node_modules/@types/connect/LICENSE +0 -21
  38. package/app/node_modules/@types/connect/README.md +0 -16
  39. package/app/node_modules/@types/connect/index.d.ts +0 -93
  40. package/app/node_modules/@types/connect/package.json +0 -32
  41. package/app/node_modules/@types/express/LICENSE +0 -21
  42. package/app/node_modules/@types/express/README.md +0 -16
  43. package/app/node_modules/@types/express/index.d.ts +0 -136
  44. package/app/node_modules/@types/express/package.json +0 -45
  45. package/app/node_modules/@types/express-serve-static-core/LICENSE +0 -21
  46. package/app/node_modules/@types/express-serve-static-core/README.md +0 -16
  47. package/app/node_modules/@types/express-serve-static-core/index.d.ts +0 -1281
  48. package/app/node_modules/@types/express-serve-static-core/package.json +0 -55
  49. package/app/node_modules/@types/mime/LICENSE +0 -21
  50. package/app/node_modules/@types/mime/Mime.d.ts +0 -10
  51. package/app/node_modules/@types/mime/README.md +0 -16
  52. package/app/node_modules/@types/mime/index.d.ts +0 -35
  53. package/app/node_modules/@types/mime/lite.d.ts +0 -7
  54. package/app/node_modules/@types/mime/package.json +0 -29
  55. package/app/node_modules/@types/node/LICENSE +0 -21
  56. package/app/node_modules/@types/node/README.md +0 -16
  57. package/app/node_modules/@types/node/assert/strict.d.ts +0 -8
  58. package/app/node_modules/@types/node/assert.d.ts +0 -961
  59. package/app/node_modules/@types/node/async_hooks.d.ts +0 -518
  60. package/app/node_modules/@types/node/buffer.d.ts +0 -2323
  61. package/app/node_modules/@types/node/child_process.d.ts +0 -1399
  62. package/app/node_modules/@types/node/cluster.d.ts +0 -410
  63. package/app/node_modules/@types/node/console.d.ts +0 -412
  64. package/app/node_modules/@types/node/constants.d.ts +0 -18
  65. package/app/node_modules/@types/node/crypto.d.ts +0 -3973
  66. package/app/node_modules/@types/node/dgram.d.ts +0 -545
  67. package/app/node_modules/@types/node/diagnostics_channel.d.ts +0 -192
  68. package/app/node_modules/@types/node/dns/promises.d.ts +0 -370
  69. package/app/node_modules/@types/node/dns.d.ts +0 -660
  70. package/app/node_modules/@types/node/dom-events.d.ts +0 -126
  71. package/app/node_modules/@types/node/domain.d.ts +0 -170
  72. package/app/node_modules/@types/node/events.d.ts +0 -682
  73. package/app/node_modules/@types/node/fs/promises.d.ts +0 -1159
  74. package/app/node_modules/@types/node/fs.d.ts +0 -3976
  75. package/app/node_modules/@types/node/globals.d.ts +0 -303
  76. package/app/node_modules/@types/node/globals.global.d.ts +0 -1
  77. package/app/node_modules/@types/node/http.d.ts +0 -1714
  78. package/app/node_modules/@types/node/http2.d.ts +0 -2133
  79. package/app/node_modules/@types/node/https.d.ts +0 -542
  80. package/app/node_modules/@types/node/index.d.ts +0 -134
  81. package/app/node_modules/@types/node/inspector.d.ts +0 -2741
  82. package/app/node_modules/@types/node/module.d.ts +0 -115
  83. package/app/node_modules/@types/node/net.d.ts +0 -883
  84. package/app/node_modules/@types/node/os.d.ts +0 -473
  85. package/app/node_modules/@types/node/package.json +0 -237
  86. package/app/node_modules/@types/node/path.d.ts +0 -191
  87. package/app/node_modules/@types/node/perf_hooks.d.ts +0 -625
  88. package/app/node_modules/@types/node/process.d.ts +0 -1488
  89. package/app/node_modules/@types/node/punycode.d.ts +0 -117
  90. package/app/node_modules/@types/node/querystring.d.ts +0 -131
  91. package/app/node_modules/@types/node/readline/promises.d.ts +0 -143
  92. package/app/node_modules/@types/node/readline.d.ts +0 -653
  93. package/app/node_modules/@types/node/repl.d.ts +0 -424
  94. package/app/node_modules/@types/node/stream/consumers.d.ts +0 -12
  95. package/app/node_modules/@types/node/stream/promises.d.ts +0 -42
  96. package/app/node_modules/@types/node/stream/web.d.ts +0 -330
  97. package/app/node_modules/@types/node/stream.d.ts +0 -1440
  98. package/app/node_modules/@types/node/string_decoder.d.ts +0 -67
  99. package/app/node_modules/@types/node/test.d.ts +0 -783
  100. package/app/node_modules/@types/node/timers/promises.d.ts +0 -93
  101. package/app/node_modules/@types/node/timers.d.ts +0 -101
  102. package/app/node_modules/@types/node/tls.d.ts +0 -1111
  103. package/app/node_modules/@types/node/trace_events.d.ts +0 -171
  104. package/app/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  105. package/app/node_modules/@types/node/ts4.8/assert.d.ts +0 -961
  106. package/app/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -518
  107. package/app/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2323
  108. package/app/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1399
  109. package/app/node_modules/@types/node/ts4.8/cluster.d.ts +0 -410
  110. package/app/node_modules/@types/node/ts4.8/console.d.ts +0 -412
  111. package/app/node_modules/@types/node/ts4.8/constants.d.ts +0 -18
  112. package/app/node_modules/@types/node/ts4.8/crypto.d.ts +0 -3972
  113. package/app/node_modules/@types/node/ts4.8/dgram.d.ts +0 -545
  114. package/app/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -192
  115. package/app/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -370
  116. package/app/node_modules/@types/node/ts4.8/dns.d.ts +0 -660
  117. package/app/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -126
  118. package/app/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  119. package/app/node_modules/@types/node/ts4.8/events.d.ts +0 -682
  120. package/app/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1138
  121. package/app/node_modules/@types/node/ts4.8/fs.d.ts +0 -3875
  122. package/app/node_modules/@types/node/ts4.8/globals.d.ts +0 -302
  123. package/app/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  124. package/app/node_modules/@types/node/ts4.8/http.d.ts +0 -1651
  125. package/app/node_modules/@types/node/ts4.8/http2.d.ts +0 -2133
  126. package/app/node_modules/@types/node/ts4.8/https.d.ts +0 -542
  127. package/app/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  128. package/app/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2741
  129. package/app/node_modules/@types/node/ts4.8/module.d.ts +0 -115
  130. package/app/node_modules/@types/node/ts4.8/net.d.ts +0 -883
  131. package/app/node_modules/@types/node/ts4.8/os.d.ts +0 -473
  132. package/app/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  133. package/app/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -625
  134. package/app/node_modules/@types/node/ts4.8/process.d.ts +0 -1488
  135. package/app/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  136. package/app/node_modules/@types/node/ts4.8/querystring.d.ts +0 -131
  137. package/app/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -143
  138. package/app/node_modules/@types/node/ts4.8/readline.d.ts +0 -653
  139. package/app/node_modules/@types/node/ts4.8/repl.d.ts +0 -424
  140. package/app/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  141. package/app/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -42
  142. package/app/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -330
  143. package/app/node_modules/@types/node/ts4.8/stream.d.ts +0 -1440
  144. package/app/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  145. package/app/node_modules/@types/node/ts4.8/test.d.ts +0 -784
  146. package/app/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  147. package/app/node_modules/@types/node/ts4.8/timers.d.ts +0 -94
  148. package/app/node_modules/@types/node/ts4.8/tls.d.ts +0 -1111
  149. package/app/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -171
  150. package/app/node_modules/@types/node/ts4.8/tty.d.ts +0 -206
  151. package/app/node_modules/@types/node/ts4.8/url.d.ts +0 -902
  152. package/app/node_modules/@types/node/ts4.8/util.d.ts +0 -2017
  153. package/app/node_modules/@types/node/ts4.8/v8.d.ts +0 -541
  154. package/app/node_modules/@types/node/ts4.8/vm.d.ts +0 -644
  155. package/app/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  156. package/app/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -695
  157. package/app/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  158. package/app/node_modules/@types/node/tty.d.ts +0 -206
  159. package/app/node_modules/@types/node/url.d.ts +0 -902
  160. package/app/node_modules/@types/node/util.d.ts +0 -2017
  161. package/app/node_modules/@types/node/v8.d.ts +0 -541
  162. package/app/node_modules/@types/node/vm.d.ts +0 -644
  163. package/app/node_modules/@types/node/wasi.d.ts +0 -158
  164. package/app/node_modules/@types/node/worker_threads.d.ts +0 -695
  165. package/app/node_modules/@types/node/zlib.d.ts +0 -517
  166. package/app/node_modules/@types/qs/LICENSE +0 -21
  167. package/app/node_modules/@types/qs/README.md +0 -16
  168. package/app/node_modules/@types/qs/index.d.ts +0 -62
  169. package/app/node_modules/@types/qs/package.json +0 -65
  170. package/app/node_modules/@types/range-parser/LICENSE +0 -21
  171. package/app/node_modules/@types/range-parser/README.md +0 -55
  172. package/app/node_modules/@types/range-parser/index.d.ts +0 -35
  173. package/app/node_modules/@types/range-parser/package.json +0 -25
  174. package/app/node_modules/@types/send/LICENSE +0 -21
  175. package/app/node_modules/@types/send/README.md +0 -16
  176. package/app/node_modules/@types/send/index.d.ts +0 -231
  177. package/app/node_modules/@types/send/package.json +0 -33
  178. package/app/node_modules/@types/serve-static/LICENSE +0 -21
  179. package/app/node_modules/@types/serve-static/README.md +0 -16
  180. package/app/node_modules/@types/serve-static/index.d.ts +0 -113
  181. package/app/node_modules/@types/serve-static/package.json +0 -38
  182. package/app/node_modules/colors/LICENSE +0 -25
  183. package/app/node_modules/colors/README.md +0 -221
  184. package/app/node_modules/colors/examples/normal-usage.js +0 -82
  185. package/app/node_modules/colors/examples/safe-string.js +0 -79
  186. package/app/node_modules/colors/index.d.ts +0 -136
  187. package/app/node_modules/colors/lib/colors.js +0 -211
  188. package/app/node_modules/colors/lib/custom/trap.js +0 -46
  189. package/app/node_modules/colors/lib/custom/zalgo.js +0 -110
  190. package/app/node_modules/colors/lib/extendStringPrototype.js +0 -110
  191. package/app/node_modules/colors/lib/index.js +0 -13
  192. package/app/node_modules/colors/lib/maps/america.js +0 -10
  193. package/app/node_modules/colors/lib/maps/rainbow.js +0 -12
  194. package/app/node_modules/colors/lib/maps/random.js +0 -11
  195. package/app/node_modules/colors/lib/maps/zebra.js +0 -5
  196. package/app/node_modules/colors/lib/styles.js +0 -95
  197. package/app/node_modules/colors/lib/system/has-flag.js +0 -35
  198. package/app/node_modules/colors/lib/system/supports-colors.js +0 -151
  199. package/app/node_modules/colors/package.json +0 -45
  200. package/app/node_modules/colors/safe.d.ts +0 -48
  201. package/app/node_modules/colors/safe.js +0 -10
  202. package/app/node_modules/colors/themes/generic-logging.js +0 -12
  203. package/app/node_modules/dateformat/LICENSE +0 -20
  204. package/app/node_modules/dateformat/Readme.md +0 -204
  205. package/app/node_modules/dateformat/lib/dateformat.js +0 -1
  206. package/app/node_modules/dateformat/package.json +0 -38
  207. package/app/node_modules/mkdirp/CHANGELOG.md +0 -15
  208. package/app/node_modules/mkdirp/LICENSE +0 -21
  209. package/app/node_modules/mkdirp/bin/cmd.js +0 -68
  210. package/app/node_modules/mkdirp/index.js +0 -31
  211. package/app/node_modules/mkdirp/lib/find-made.js +0 -29
  212. package/app/node_modules/mkdirp/lib/mkdirp-manual.js +0 -64
  213. package/app/node_modules/mkdirp/lib/mkdirp-native.js +0 -39
  214. package/app/node_modules/mkdirp/lib/opts-arg.js +0 -23
  215. package/app/node_modules/mkdirp/lib/path-arg.js +0 -29
  216. package/app/node_modules/mkdirp/lib/use-native.js +0 -10
  217. package/app/node_modules/mkdirp/package.json +0 -44
  218. package/app/node_modules/mkdirp/readme.markdown +0 -266
  219. package/app/node_modules/tinytim/.travis.yml +0 -5
  220. package/app/node_modules/tinytim/README.md +0 -212
  221. package/app/node_modules/tinytim/index.js +0 -1
  222. package/app/node_modules/tinytim/lib/index.js +0 -55
  223. package/app/node_modules/tinytim/lib/tinytim.js +0 -50
  224. package/app/node_modules/tinytim/package.json +0 -24
  225. package/app/node_modules/tinytim/test/files/html.tim +0 -1
  226. package/app/node_modules/tinytim/test/files/string.tim +0 -1
  227. package/app/node_modules/tinytim/test/files/string2.tim +0 -1
  228. package/app/node_modules/tinytim/test/render-file-replace.js +0 -39
  229. package/app/node_modules/tinytim/test/render-replace.js +0 -94
  230. package/app/node_modules/tinytim/test/tim-replace.js +0 -95
  231. package/app/node_modules/tracer/README.md +0 -747
  232. package/app/node_modules/tracer/lib/color_console.js +0 -15
  233. package/app/node_modules/tracer/lib/console.js +0 -165
  234. package/app/node_modules/tracer/lib/dailyfile.js +0 -92
  235. package/app/node_modules/tracer/lib/index.js +0 -10
  236. package/app/node_modules/tracer/lib/settings.js +0 -25
  237. package/app/node_modules/tracer/lib/utils.js +0 -58
  238. package/app/node_modules/tracer/package.json +0 -53
  239. package/app/node_modules/tracer/types/index.d.ts +0 -189
  240. package/dist/scaffold/templates/front-page.class.ts.tpl +0 -12
  241. package/dist/scaffold/templates/main.ts.tpl +0 -13
  242. package/dist/scaffold/templates/nodemon.json.tpl +0 -7
  243. package/dist/scaffold/templates/package.json.tpl +0 -16
  244. package/dist/scaffold/templates/tsconfig.json.tpl +0 -20
  245. /package/dist/{core.decorator.js → src/core.decorator.js} +0 -0
  246. /package/dist/{default → src/default}/default-authentication.class.js +0 -0
  247. /package/dist/{default → src/default}/log-default.class.js +0 -0
  248. /package/dist/{default → src/default}/node-cache.class.js +0 -0
  249. /package/dist/{default → src/default}/pages/404.html +0 -0
  250. /package/dist/{default → src/default}/pages/500.html +0 -0
  251. /package/dist/{default → src/default}/read-write-db.class.js +0 -0
  252. /package/dist/{factory → src/factory}/authentication-factory.class.js +0 -0
  253. /package/dist/{factory → src/factory}/cache-factory.class.js +0 -0
  254. /package/dist/{factory → src/factory}/data-source-factory.class.js +0 -0
  255. /package/dist/{factory → src/factory}/log-factory.class.js +0 -0
  256. /package/dist/{factory → src/factory}/server-factory.class.js +0 -0
  257. /package/dist/{route.decorator.js → src/route.decorator.js} +0 -0
  258. /package/dist/{scaffold → src/scaffold}/command.js +0 -0
@@ -1,653 +0,0 @@
1
- /**
2
- * The `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 `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/v18.0.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
-
39
- export { promises };
40
- export interface Key {
41
- sequence?: string | undefined;
42
- name?: string | undefined;
43
- ctrl?: boolean | undefined;
44
- meta?: boolean | undefined;
45
- shift?: boolean | undefined;
46
- }
47
- /**
48
- * Instances of the `readline.Interface` class are constructed using the`readline.createInterface()` method. Every instance is associated with a
49
- * single `input` `Readable` stream and a single `output` `Writable` stream.
50
- * The `output` stream is used to print prompts for user input that arrives on,
51
- * and is read from, the `input` stream.
52
- * @since v0.1.104
53
- */
54
- export class Interface extends EventEmitter {
55
- readonly terminal: boolean;
56
- /**
57
- * The current input data being processed by node.
58
- *
59
- * This can be used when collecting input from a TTY stream to retrieve the
60
- * current value that has been processed thus far, prior to the `line` event
61
- * being emitted. Once the `line` event has been emitted, this property will
62
- * be an empty string.
63
- *
64
- * Be aware that modifying the value during the instance runtime may have
65
- * unintended consequences if `rl.cursor` is not also controlled.
66
- *
67
- * **If not using a TTY stream for input, use the `'line'` event.**
68
- *
69
- * One possible use case would be as follows:
70
- *
71
- * ```js
72
- * const values = ['lorem ipsum', 'dolor sit amet'];
73
- * const rl = readline.createInterface(process.stdin);
74
- * const showResults = debounce(() => {
75
- * console.log(
76
- * '\n',
77
- * values.filter((val) => val.startsWith(rl.line)).join(' ')
78
- * );
79
- * }, 300);
80
- * process.stdin.on('keypress', (c, k) => {
81
- * showResults();
82
- * });
83
- * ```
84
- * @since v0.1.98
85
- */
86
- readonly line: string;
87
- /**
88
- * The cursor position relative to `rl.line`.
89
- *
90
- * This will track where the current cursor lands in the input string, when
91
- * reading input from a TTY stream. The position of cursor determines the
92
- * portion of the input string that will be modified as input is processed,
93
- * as well as the column where the terminal caret will be rendered.
94
- * @since v0.1.98
95
- */
96
- readonly cursor: number;
97
- /**
98
- * NOTE: According to the documentation:
99
- *
100
- * > Instances of the `readline.Interface` class are constructed using the
101
- * > `readline.createInterface()` method.
102
- *
103
- * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
104
- */
105
- protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
106
- /**
107
- * NOTE: According to the documentation:
108
- *
109
- * > Instances of the `readline.Interface` class are constructed using the
110
- * > `readline.createInterface()` method.
111
- *
112
- * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
113
- */
114
- protected constructor(options: ReadLineOptions);
115
- /**
116
- * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
117
- * @since v15.3.0
118
- * @return the current prompt string
119
- */
120
- getPrompt(): string;
121
- /**
122
- * The `rl.setPrompt()` method sets the prompt that will be written to `output`whenever `rl.prompt()` is called.
123
- * @since v0.1.98
124
- */
125
- setPrompt(prompt: string): void;
126
- /**
127
- * The `rl.prompt()` method writes the `readline.Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new
128
- * location at which to provide input.
129
- *
130
- * When called, `rl.prompt()` will resume the `input` stream if it has been
131
- * paused.
132
- *
133
- * If the `readline.Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
134
- * @since v0.1.98
135
- * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.
136
- */
137
- prompt(preserveCursor?: boolean): void;
138
- /**
139
- * The `rl.question()` method displays the `query` by writing it to the `output`,
140
- * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument.
141
- *
142
- * When called, `rl.question()` will resume the `input` stream if it has been
143
- * paused.
144
- *
145
- * If the `readline.Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
146
- *
147
- * The `callback` function passed to `rl.question()` does not follow the typical
148
- * pattern of accepting an `Error` object or `null` as the first argument.
149
- * The `callback` is called with the provided answer as the only argument.
150
- *
151
- * Example usage:
152
- *
153
- * ```js
154
- * rl.question('What is your favorite food? ', (answer) => {
155
- * console.log(`Oh, so your favorite food is ${answer}`);
156
- * });
157
- * ```
158
- *
159
- * Using an `AbortController` to cancel a question.
160
- *
161
- * ```js
162
- * const ac = new AbortController();
163
- * const signal = ac.signal;
164
- *
165
- * rl.question('What is your favorite food? ', { signal }, (answer) => {
166
- * console.log(`Oh, so your favorite food is ${answer}`);
167
- * });
168
- *
169
- * signal.addEventListener('abort', () => {
170
- * console.log('The food question timed out');
171
- * }, { once: true });
172
- *
173
- * setTimeout(() => ac.abort(), 10000);
174
- * ```
175
- *
176
- * If this method is invoked as it's util.promisify()ed version, it returns a
177
- * Promise that fulfills with the answer. If the question is canceled using
178
- * an `AbortController` it will reject with an `AbortError`.
179
- *
180
- * ```js
181
- * const util = require('util');
182
- * const question = util.promisify(rl.question).bind(rl);
183
- *
184
- * async function questionExample() {
185
- * try {
186
- * const answer = await question('What is you favorite food? ');
187
- * console.log(`Oh, so your favorite food is ${answer}`);
188
- * } catch (err) {
189
- * console.error('Question rejected', err);
190
- * }
191
- * }
192
- * questionExample();
193
- * ```
194
- * @since v0.3.3
195
- * @param query A statement or query to write to `output`, prepended to the prompt.
196
- * @param callback A callback function that is invoked with the user's input in response to the `query`.
197
- */
198
- question(query: string, callback: (answer: string) => void): void;
199
- question(query: string, options: Abortable, callback: (answer: string) => void): void;
200
- /**
201
- * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed
202
- * later if necessary.
203
- *
204
- * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `readline.Interface` instance.
205
- * @since v0.3.4
206
- */
207
- pause(): this;
208
- /**
209
- * The `rl.resume()` method resumes the `input` stream if it has been paused.
210
- * @since v0.3.4
211
- */
212
- resume(): this;
213
- /**
214
- * The `rl.close()` method closes the `readline.Interface` instance and
215
- * relinquishes control over the `input` and `output` streams. When called,
216
- * the `'close'` event will be emitted.
217
- *
218
- * Calling `rl.close()` does not immediately stop other events (including `'line'`)
219
- * from being emitted by the `readline.Interface` instance.
220
- * @since v0.1.98
221
- */
222
- close(): void;
223
- /**
224
- * The `rl.write()` method will write either `data` or a key sequence identified
225
- * by `key` to the `output`. The `key` argument is supported only if `output` is
226
- * a `TTY` text terminal. See `TTY keybindings` for a list of key
227
- * combinations.
228
- *
229
- * If `key` is specified, `data` is ignored.
230
- *
231
- * When called, `rl.write()` will resume the `input` stream if it has been
232
- * paused.
233
- *
234
- * If the `readline.Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
235
- *
236
- * ```js
237
- * rl.write('Delete this!');
238
- * // Simulate Ctrl+U to delete the line written previously
239
- * rl.write(null, { ctrl: true, name: 'u' });
240
- * ```
241
- *
242
- * The `rl.write()` method will write the data to the `readline` `Interface`'s`input`_as if it were provided by the user_.
243
- * @since v0.1.98
244
- */
245
- write(data: string | Buffer, key?: Key): void;
246
- write(data: undefined | null | string | Buffer, key: Key): void;
247
- /**
248
- * Returns the real position of the cursor in relation to the input
249
- * prompt + string. Long input (wrapping) strings, as well as multiple
250
- * line prompts are included in the calculations.
251
- * @since v13.5.0, v12.16.0
252
- */
253
- getCursorPos(): CursorPos;
254
- /**
255
- * events.EventEmitter
256
- * 1. close
257
- * 2. line
258
- * 3. pause
259
- * 4. resume
260
- * 5. SIGCONT
261
- * 6. SIGINT
262
- * 7. SIGTSTP
263
- * 8. history
264
- */
265
- addListener(event: string, listener: (...args: any[]) => void): this;
266
- addListener(event: 'close', listener: () => void): this;
267
- addListener(event: 'line', listener: (input: string) => void): this;
268
- addListener(event: 'pause', listener: () => void): this;
269
- addListener(event: 'resume', listener: () => void): this;
270
- addListener(event: 'SIGCONT', listener: () => void): this;
271
- addListener(event: 'SIGINT', listener: () => void): this;
272
- addListener(event: 'SIGTSTP', listener: () => void): this;
273
- addListener(event: 'history', listener: (history: string[]) => void): this;
274
- emit(event: string | symbol, ...args: any[]): boolean;
275
- emit(event: 'close'): boolean;
276
- emit(event: 'line', input: string): boolean;
277
- emit(event: 'pause'): boolean;
278
- emit(event: 'resume'): boolean;
279
- emit(event: 'SIGCONT'): boolean;
280
- emit(event: 'SIGINT'): boolean;
281
- emit(event: 'SIGTSTP'): boolean;
282
- emit(event: 'history', history: string[]): boolean;
283
- on(event: string, listener: (...args: any[]) => void): this;
284
- on(event: 'close', listener: () => void): this;
285
- on(event: 'line', listener: (input: string) => void): this;
286
- on(event: 'pause', listener: () => void): this;
287
- on(event: 'resume', listener: () => void): this;
288
- on(event: 'SIGCONT', listener: () => void): this;
289
- on(event: 'SIGINT', listener: () => void): this;
290
- on(event: 'SIGTSTP', listener: () => void): this;
291
- on(event: 'history', listener: (history: string[]) => void): this;
292
- once(event: string, listener: (...args: any[]) => void): this;
293
- once(event: 'close', listener: () => void): this;
294
- once(event: 'line', listener: (input: string) => void): this;
295
- once(event: 'pause', listener: () => void): this;
296
- once(event: 'resume', listener: () => void): this;
297
- once(event: 'SIGCONT', listener: () => void): this;
298
- once(event: 'SIGINT', listener: () => void): this;
299
- once(event: 'SIGTSTP', listener: () => void): this;
300
- once(event: 'history', listener: (history: string[]) => void): this;
301
- prependListener(event: string, listener: (...args: any[]) => void): this;
302
- prependListener(event: 'close', listener: () => void): this;
303
- prependListener(event: 'line', listener: (input: string) => void): this;
304
- prependListener(event: 'pause', listener: () => void): this;
305
- prependListener(event: 'resume', listener: () => void): this;
306
- prependListener(event: 'SIGCONT', listener: () => void): this;
307
- prependListener(event: 'SIGINT', listener: () => void): this;
308
- prependListener(event: 'SIGTSTP', listener: () => void): this;
309
- prependListener(event: 'history', listener: (history: string[]) => void): this;
310
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
311
- prependOnceListener(event: 'close', listener: () => void): this;
312
- prependOnceListener(event: 'line', listener: (input: string) => void): this;
313
- prependOnceListener(event: 'pause', listener: () => void): this;
314
- prependOnceListener(event: 'resume', listener: () => void): this;
315
- prependOnceListener(event: 'SIGCONT', listener: () => void): this;
316
- prependOnceListener(event: 'SIGINT', listener: () => void): this;
317
- prependOnceListener(event: 'SIGTSTP', listener: () => void): this;
318
- prependOnceListener(event: 'history', listener: (history: string[]) => void): this;
319
- [Symbol.asyncIterator](): AsyncIterableIterator<string>;
320
- }
321
- export type ReadLine = Interface; // type forwarded for backwards compatibility
322
- export type Completer = (line: string) => CompleterResult;
323
- export type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
324
- export type CompleterResult = [string[], string];
325
- export interface ReadLineOptions {
326
- input: NodeJS.ReadableStream;
327
- output?: NodeJS.WritableStream | undefined;
328
- completer?: Completer | AsyncCompleter | undefined;
329
- terminal?: boolean | undefined;
330
- /**
331
- * Initial list of history lines. This option makes sense
332
- * only if `terminal` is set to `true` by the user or by an internal `output`
333
- * check, otherwise the history caching mechanism is not initialized at all.
334
- * @default []
335
- */
336
- history?: string[] | undefined;
337
- historySize?: number | undefined;
338
- prompt?: string | undefined;
339
- crlfDelay?: number | undefined;
340
- /**
341
- * If `true`, when a new input line added
342
- * to the history list duplicates an older one, this removes the older line
343
- * from the list.
344
- * @default false
345
- */
346
- removeHistoryDuplicates?: boolean | undefined;
347
- escapeCodeTimeout?: number | undefined;
348
- tabSize?: number | undefined;
349
- }
350
- /**
351
- * The `readline.createInterface()` method creates a new `readline.Interface`instance.
352
- *
353
- * ```js
354
- * const readline = require('readline');
355
- * const rl = readline.createInterface({
356
- * input: process.stdin,
357
- * output: process.stdout
358
- * });
359
- * ```
360
- *
361
- * Once the `readline.Interface` instance is created, the most common case is to
362
- * listen for the `'line'` event:
363
- *
364
- * ```js
365
- * rl.on('line', (line) => {
366
- * console.log(`Received: ${line}`);
367
- * });
368
- * ```
369
- *
370
- * If `terminal` is `true` for this instance then the `output` stream will get
371
- * the best compatibility if it defines an `output.columns` property and emits
372
- * a `'resize'` event on the `output` if or when the columns ever change
373
- * (`process.stdout` does this automatically when it is a TTY).
374
- *
375
- * When creating a `readline.Interface` using `stdin` as input, the program
376
- * will not terminate until it receives `EOF` (Ctrl+D on
377
- * Linux/macOS, Ctrl+Z followed by Return on
378
- * Windows).
379
- * If you want your application to exit without waiting for user input, you can `unref()` the standard input stream:
380
- *
381
- * ```js
382
- * process.stdin.unref();
383
- * ```
384
- * @since v0.1.98
385
- */
386
- export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
387
- export function createInterface(options: ReadLineOptions): Interface;
388
- /**
389
- * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
390
- *
391
- * Optionally, `interface` specifies a `readline.Interface` instance for which
392
- * autocompletion is disabled when copy-pasted input is detected.
393
- *
394
- * If the `stream` is a `TTY`, then it must be in raw mode.
395
- *
396
- * This is automatically called by any readline instance on its `input` if the`input` is a terminal. Closing the `readline` instance does not stop
397
- * the `input` from emitting `'keypress'` events.
398
- *
399
- * ```js
400
- * readline.emitKeypressEvents(process.stdin);
401
- * if (process.stdin.isTTY)
402
- * process.stdin.setRawMode(true);
403
- * ```
404
- *
405
- * ## Example: Tiny CLI
406
- *
407
- * The following example illustrates the use of `readline.Interface` class to
408
- * implement a small command-line interface:
409
- *
410
- * ```js
411
- * const readline = require('readline');
412
- * const rl = readline.createInterface({
413
- * input: process.stdin,
414
- * output: process.stdout,
415
- * prompt: 'OHAI> '
416
- * });
417
- *
418
- * rl.prompt();
419
- *
420
- * rl.on('line', (line) => {
421
- * switch (line.trim()) {
422
- * case 'hello':
423
- * console.log('world!');
424
- * break;
425
- * default:
426
- * console.log(`Say what? I might have heard '${line.trim()}'`);
427
- * break;
428
- * }
429
- * rl.prompt();
430
- * }).on('close', () => {
431
- * console.log('Have a great day!');
432
- * process.exit(0);
433
- * });
434
- * ```
435
- *
436
- * ## Example: Read file stream line-by-Line
437
- *
438
- * A common use case for `readline` is to consume an input file one line at a
439
- * time. The easiest way to do so is leveraging the `fs.ReadStream` API as
440
- * well as a `for await...of` loop:
441
- *
442
- * ```js
443
- * const fs = require('fs');
444
- * const readline = require('readline');
445
- *
446
- * async function processLineByLine() {
447
- * const fileStream = fs.createReadStream('input.txt');
448
- *
449
- * const rl = readline.createInterface({
450
- * input: fileStream,
451
- * crlfDelay: Infinity
452
- * });
453
- * // Note: we use the crlfDelay option to recognize all instances of CR LF
454
- * // ('\r\n') in input.txt as a single line break.
455
- *
456
- * for await (const line of rl) {
457
- * // Each line in input.txt will be successively available here as `line`.
458
- * console.log(`Line from file: ${line}`);
459
- * }
460
- * }
461
- *
462
- * processLineByLine();
463
- * ```
464
- *
465
- * Alternatively, one could use the `'line'` event:
466
- *
467
- * ```js
468
- * const fs = require('fs');
469
- * const readline = require('readline');
470
- *
471
- * const rl = readline.createInterface({
472
- * input: fs.createReadStream('sample.txt'),
473
- * crlfDelay: Infinity
474
- * });
475
- *
476
- * rl.on('line', (line) => {
477
- * console.log(`Line from file: ${line}`);
478
- * });
479
- * ```
480
- *
481
- * 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:
482
- *
483
- * ```js
484
- * const { once } = require('events');
485
- * const { createReadStream } = require('fs');
486
- * const { createInterface } = require('readline');
487
- *
488
- * (async function processLineByLine() {
489
- * try {
490
- * const rl = createInterface({
491
- * input: createReadStream('big-file.txt'),
492
- * crlfDelay: Infinity
493
- * });
494
- *
495
- * rl.on('line', (line) => {
496
- * // Process the line.
497
- * });
498
- *
499
- * await once(rl, 'close');
500
- *
501
- * console.log('File processed.');
502
- * } catch (err) {
503
- * console.error(err);
504
- * }
505
- * })();
506
- * ```
507
- * @since v0.7.7
508
- */
509
- export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
510
- export type Direction = -1 | 0 | 1;
511
- export interface CursorPos {
512
- rows: number;
513
- cols: number;
514
- }
515
- /**
516
- * The `readline.clearLine()` method clears current line of given `TTY` stream
517
- * in a specified direction identified by `dir`.
518
- * @since v0.7.7
519
- * @param callback Invoked once the operation completes.
520
- * @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`.
521
- */
522
- export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
523
- /**
524
- * The `readline.clearScreenDown()` method clears the given `TTY` stream from
525
- * the current position of the cursor down.
526
- * @since v0.7.7
527
- * @param callback Invoked once the operation completes.
528
- * @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`.
529
- */
530
- export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
531
- /**
532
- * The `readline.cursorTo()` method moves cursor to the specified position in a
533
- * given `TTY` `stream`.
534
- * @since v0.7.7
535
- * @param callback Invoked once the operation completes.
536
- * @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`.
537
- */
538
- export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
539
- /**
540
- * The `readline.moveCursor()` method moves the cursor _relative_ to its current
541
- * position in a given `TTY` `stream`.
542
- *
543
- * ## Example: Tiny CLI
544
- *
545
- * The following example illustrates the use of `readline.Interface` class to
546
- * implement a small command-line interface:
547
- *
548
- * ```js
549
- * const readline = require('readline');
550
- * const rl = readline.createInterface({
551
- * input: process.stdin,
552
- * output: process.stdout,
553
- * prompt: 'OHAI> '
554
- * });
555
- *
556
- * rl.prompt();
557
- *
558
- * rl.on('line', (line) => {
559
- * switch (line.trim()) {
560
- * case 'hello':
561
- * console.log('world!');
562
- * break;
563
- * default:
564
- * console.log(`Say what? I might have heard '${line.trim()}'`);
565
- * break;
566
- * }
567
- * rl.prompt();
568
- * }).on('close', () => {
569
- * console.log('Have a great day!');
570
- * process.exit(0);
571
- * });
572
- * ```
573
- *
574
- * ## Example: Read file stream line-by-Line
575
- *
576
- * A common use case for `readline` is to consume an input file one line at a
577
- * time. The easiest way to do so is leveraging the `fs.ReadStream` API as
578
- * well as a `for await...of` loop:
579
- *
580
- * ```js
581
- * const fs = require('fs');
582
- * const readline = require('readline');
583
- *
584
- * async function processLineByLine() {
585
- * const fileStream = fs.createReadStream('input.txt');
586
- *
587
- * const rl = readline.createInterface({
588
- * input: fileStream,
589
- * crlfDelay: Infinity
590
- * });
591
- * // Note: we use the crlfDelay option to recognize all instances of CR LF
592
- * // ('\r\n') in input.txt as a single line break.
593
- *
594
- * for await (const line of rl) {
595
- * // Each line in input.txt will be successively available here as `line`.
596
- * console.log(`Line from file: ${line}`);
597
- * }
598
- * }
599
- *
600
- * processLineByLine();
601
- * ```
602
- *
603
- * Alternatively, one could use the `'line'` event:
604
- *
605
- * ```js
606
- * const fs = require('fs');
607
- * const readline = require('readline');
608
- *
609
- * const rl = readline.createInterface({
610
- * input: fs.createReadStream('sample.txt'),
611
- * crlfDelay: Infinity
612
- * });
613
- *
614
- * rl.on('line', (line) => {
615
- * console.log(`Line from file: ${line}`);
616
- * });
617
- * ```
618
- *
619
- * 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:
620
- *
621
- * ```js
622
- * const { once } = require('events');
623
- * const { createReadStream } = require('fs');
624
- * const { createInterface } = require('readline');
625
- *
626
- * (async function processLineByLine() {
627
- * try {
628
- * const rl = createInterface({
629
- * input: createReadStream('big-file.txt'),
630
- * crlfDelay: Infinity
631
- * });
632
- *
633
- * rl.on('line', (line) => {
634
- * // Process the line.
635
- * });
636
- *
637
- * await once(rl, 'close');
638
- *
639
- * console.log('File processed.');
640
- * } catch (err) {
641
- * console.error(err);
642
- * }
643
- * })();
644
- * ```
645
- * @since v0.7.7
646
- * @param callback Invoked once the operation completes.
647
- * @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`.
648
- */
649
- export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
650
- }
651
- declare module 'node:readline' {
652
- export * from 'readline';
653
- }