cloudstructs 0.6.1 → 0.6.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 (117) hide show
  1. package/.gitattributes +1 -0
  2. package/.jsii +3 -3
  3. package/lib/codecommit-mirror/index.js +2 -2
  4. package/lib/ecs-service-roller/index.js +2 -2
  5. package/lib/email-receiver/receiver.js +1 -1
  6. package/lib/saml-identity-provider/index.js +2 -2
  7. package/lib/slack-app/manifest.js +1 -1
  8. package/lib/slack-app/slack-app.js +2 -2
  9. package/lib/slack-events/index.js +1 -1
  10. package/lib/slack-textract/index.js +1 -1
  11. package/lib/state-machine-cr-provider/index.js +1 -1
  12. package/lib/static-website/index.js +3 -2
  13. package/lib/toolkit-cleaner/index.js +1 -1
  14. package/lib/url-shortener/index.js +1 -1
  15. package/node_modules/@slack/logger/node_modules/@types/node/README.md +1 -1
  16. package/node_modules/@slack/logger/node_modules/@types/node/buffer.d.ts +1 -1
  17. package/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +3 -3
  18. package/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +4 -3
  19. package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +1 -1
  20. package/node_modules/@slack/logger/node_modules/@types/node/http2.d.ts +1 -1
  21. package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +2 -1
  22. package/node_modules/@slack/logger/node_modules/@types/node/net.d.ts +2 -2
  23. package/node_modules/@slack/logger/node_modules/@types/node/package.json +2 -2
  24. package/node_modules/@slack/logger/node_modules/@types/node/path.d.ts +30 -19
  25. package/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +29 -0
  26. package/node_modules/@slack/logger/node_modules/@types/node/process.d.ts +1 -1
  27. package/node_modules/@slack/logger/node_modules/@types/node/readline/promises.d.ts +143 -0
  28. package/node_modules/@slack/logger/node_modules/@types/node/readline.d.ts +19 -16
  29. package/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +187 -0
  30. package/node_modules/@slack/logger/node_modules/@types/node/vm.d.ts +1 -1
  31. package/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +2 -2
  32. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  33. package/node_modules/@slack/web-api/node_modules/@types/node/buffer.d.ts +1 -1
  34. package/node_modules/@slack/web-api/node_modules/@types/node/events.d.ts +3 -3
  35. package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +4 -3
  36. package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +1 -1
  37. package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +1 -1
  38. package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +2 -1
  39. package/node_modules/@slack/web-api/node_modules/@types/node/net.d.ts +2 -2
  40. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  41. package/node_modules/@slack/web-api/node_modules/@types/node/path.d.ts +30 -19
  42. package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +29 -0
  43. package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +1 -1
  44. package/node_modules/@slack/web-api/node_modules/@types/node/readline/promises.d.ts +143 -0
  45. package/node_modules/@slack/web-api/node_modules/@types/node/readline.d.ts +19 -16
  46. package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +187 -0
  47. package/node_modules/@slack/web-api/node_modules/@types/node/vm.d.ts +1 -1
  48. package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +2 -2
  49. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
  50. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +1 -1
  51. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +3 -3
  52. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +4 -3
  53. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +1 -1
  54. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +1 -1
  55. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +2 -1
  56. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +2 -2
  57. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +2 -2
  58. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +30 -19
  59. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +29 -0
  60. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1 -1
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline/promises.d.ts +143 -0
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +19 -16
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +187 -0
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +1 -1
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +2 -2
  66. package/node_modules/@types/is-stream/node_modules/@types/node/README.md +1 -1
  67. package/node_modules/@types/is-stream/node_modules/@types/node/buffer.d.ts +1 -1
  68. package/node_modules/@types/is-stream/node_modules/@types/node/events.d.ts +3 -3
  69. package/node_modules/@types/is-stream/node_modules/@types/node/fs/promises.d.ts +4 -3
  70. package/node_modules/@types/is-stream/node_modules/@types/node/fs.d.ts +1 -1
  71. package/node_modules/@types/is-stream/node_modules/@types/node/http2.d.ts +1 -1
  72. package/node_modules/@types/is-stream/node_modules/@types/node/index.d.ts +2 -1
  73. package/node_modules/@types/is-stream/node_modules/@types/node/net.d.ts +2 -2
  74. package/node_modules/@types/is-stream/node_modules/@types/node/package.json +2 -2
  75. package/node_modules/@types/is-stream/node_modules/@types/node/path.d.ts +30 -19
  76. package/node_modules/@types/is-stream/node_modules/@types/node/perf_hooks.d.ts +29 -0
  77. package/node_modules/@types/is-stream/node_modules/@types/node/process.d.ts +1 -1
  78. package/node_modules/@types/is-stream/node_modules/@types/node/readline/promises.d.ts +143 -0
  79. package/node_modules/@types/is-stream/node_modules/@types/node/readline.d.ts +19 -16
  80. package/node_modules/@types/is-stream/node_modules/@types/node/util.d.ts +187 -0
  81. package/node_modules/@types/is-stream/node_modules/@types/node/vm.d.ts +1 -1
  82. package/node_modules/@types/is-stream/node_modules/@types/node/worker_threads.d.ts +2 -2
  83. package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
  84. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +1 -1
  85. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +3 -3
  86. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +4 -3
  87. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +1 -1
  88. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +1 -1
  89. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +2 -1
  90. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +2 -2
  91. package/node_modules/@types/keyv/node_modules/@types/node/package.json +2 -2
  92. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +30 -19
  93. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +29 -0
  94. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1 -1
  95. package/node_modules/@types/keyv/node_modules/@types/node/readline/promises.d.ts +143 -0
  96. package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +19 -16
  97. package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +187 -0
  98. package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +1 -1
  99. package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +2 -2
  100. package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
  101. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +1 -1
  102. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +3 -3
  103. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +4 -3
  104. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +1 -1
  105. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +1 -1
  106. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +2 -1
  107. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +2 -2
  108. package/node_modules/@types/responselike/node_modules/@types/node/package.json +2 -2
  109. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +30 -19
  110. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +29 -0
  111. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1 -1
  112. package/node_modules/@types/responselike/node_modules/@types/node/readline/promises.d.ts +143 -0
  113. package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +19 -16
  114. package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +187 -0
  115. package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +1 -1
  116. package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +2 -2
  117. package/package.json +8 -8
@@ -0,0 +1,143 @@
1
+ /**
2
+ * The `readline/promise` module provides an API for reading lines of input from a Readable stream one line at a time.
3
+ *
4
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline/promises.js)
5
+ * @since v17.0.0
6
+ */
7
+ declare module 'readline/promises' {
8
+ import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline';
9
+ import { Abortable } from 'node:events';
10
+
11
+ class Interface extends _Interface {
12
+ /**
13
+ * The rl.question() method displays the query by writing it to the output, waits for user input to be provided on input,
14
+ * then invokes the callback function passing the provided input as the first argument.
15
+ *
16
+ * When called, rl.question() will resume the input stream if it has been paused.
17
+ *
18
+ * If the readlinePromises.Interface was created with output set to null or undefined the query is not written.
19
+ *
20
+ * If the question is called after rl.close(), it returns a rejected promise.
21
+ *
22
+ * Example usage:
23
+ *
24
+ * ```js
25
+ * const answer = await rl.question('What is your favorite food? ');
26
+ * console.log(`Oh, so your favorite food is ${answer}`);
27
+ * ```
28
+ *
29
+ * Using an AbortSignal to cancel a question.
30
+ *
31
+ * ```js
32
+ * const signal = AbortSignal.timeout(10_000);
33
+ *
34
+ * signal.addEventListener('abort', () => {
35
+ * console.log('The food question timed out');
36
+ * }, { once: true });
37
+ *
38
+ * const answer = await rl.question('What is your favorite food? ', { signal });
39
+ * console.log(`Oh, so your favorite food is ${answer}`);
40
+ * ```
41
+ *
42
+ * @since v17.0.0
43
+ * @param query A statement or query to write to output, prepended to the prompt.
44
+ */
45
+ question(query: string): Promise<string>;
46
+ question(query: string, options: Abortable): Promise<string>;
47
+ }
48
+
49
+ class Readline {
50
+ /**
51
+ * @param stream A TTY stream.
52
+ */
53
+ constructor(stream: NodeJS.WritableStream, options?: { autoCommit?: boolean });
54
+ /**
55
+ * The `rl.clearLine()` method adds to the internal list of pending action an action that clears current line of the associated `stream` in a specified direction identified by `dir`.
56
+ * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
57
+ */
58
+ clearLine(dir: Direction): this;
59
+ /**
60
+ * The `rl.clearScreenDown()` method adds to the internal list of pending action an action that clears the associated `stream` from the current position of the cursor down.
61
+ * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
62
+ */
63
+ clearScreenDown(): this;
64
+ /**
65
+ * The `rl.commit()` method sends all the pending actions to the associated `stream` and clears the internal list of pending actions.
66
+ */
67
+ commit(): Promise<void>;
68
+ /**
69
+ * The `rl.cursorTo()` method adds to the internal list of pending action an action that moves cursor to the specified position in the associated `stream`.
70
+ * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
71
+ */
72
+ cursorTo(x: number, y?: number): this;
73
+ /**
74
+ * The `rl.moveCursor()` method adds to the internal list of pending action an action that moves the cursor relative to its current position in the associated `stream`.
75
+ * Call `rl.commit()` to see the effect of this method, unless autoCommit: true was passed to the constructor.
76
+ */
77
+ moveCursor(dx: number, dy: number): this;
78
+ /**
79
+ * The `rl.rollback()` method clears the internal list of pending actions without sending it to the associated `stream`.
80
+ */
81
+ rollback(): this;
82
+ }
83
+
84
+ /**
85
+ * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
86
+ *
87
+ * ```js
88
+ * const readlinePromises = require('node:readline/promises');
89
+ * const rl = readlinePromises.createInterface({
90
+ * input: process.stdin,
91
+ * output: process.stdout
92
+ * });
93
+ * ```
94
+ *
95
+ * Once the `readlinePromises.Interface` instance is created, the most common case is to listen for the `'line'` event:
96
+ *
97
+ * ```js
98
+ * rl.on('line', (line) => {
99
+ * console.log(`Received: ${line}`);
100
+ * });
101
+ * ```
102
+ *
103
+ * If `terminal` is `true` for this instance then the `output` stream will get the best compatibility if it defines an `output.columns` property,
104
+ * and emits a `'resize'` event on the `output`, if or when the columns ever change (`process.stdout` does this automatically when it is a TTY).
105
+ *
106
+ * ## Use of the `completer` function
107
+ *
108
+ * The `completer` function takes the current line entered by the user as an argument, and returns an `Array` with 2 entries:
109
+ *
110
+ * - An Array with matching entries for the completion.
111
+ * - The substring that was used for the matching.
112
+ *
113
+ * For instance: `[[substr1, substr2, ...], originalsubstring]`.
114
+ *
115
+ * ```js
116
+ * function completer(line) {
117
+ * const completions = '.help .error .exit .quit .q'.split(' ');
118
+ * const hits = completions.filter((c) => c.startsWith(line));
119
+ * // Show all completions if none found
120
+ * return [hits.length ? hits : completions, line];
121
+ * }
122
+ * ```
123
+ *
124
+ * The `completer` function can also returns a `Promise`, or be asynchronous:
125
+ *
126
+ * ```js
127
+ * async function completer(linePartial) {
128
+ * await someAsyncWork();
129
+ * return [['123'], linePartial];
130
+ * }
131
+ * ```
132
+ */
133
+ function createInterface(
134
+ input: NodeJS.ReadableStream,
135
+ output?: NodeJS.WritableStream,
136
+ completer?: Completer | AsyncCompleter,
137
+ terminal?: boolean,
138
+ ): Interface;
139
+ function createInterface(options: ReadLineOptions): Interface;
140
+ }
141
+ declare module 'node:readline/promises' {
142
+ export * from 'readline/promises';
143
+ }
@@ -34,7 +34,10 @@
34
34
  */
35
35
  declare module 'readline' {
36
36
  import { Abortable, EventEmitter } from 'node:events';
37
- interface Key {
37
+ import * as promises from 'node:readline/promises';
38
+
39
+ export { promises };
40
+ export interface Key {
38
41
  sequence?: string | undefined;
39
42
  name?: string | undefined;
40
43
  ctrl?: boolean | undefined;
@@ -48,7 +51,7 @@ declare module 'readline' {
48
51
  * and is read from, the `input` stream.
49
52
  * @since v0.1.104
50
53
  */
51
- class Interface extends EventEmitter {
54
+ export class Interface extends EventEmitter {
52
55
  readonly terminal: boolean;
53
56
  /**
54
57
  * The current input data being processed by node.
@@ -315,11 +318,11 @@ declare module 'readline' {
315
318
  prependOnceListener(event: 'history', listener: (history: string[]) => void): this;
316
319
  [Symbol.asyncIterator](): AsyncIterableIterator<string>;
317
320
  }
318
- type ReadLine = Interface; // type forwarded for backwards compatibility
319
- type Completer = (line: string) => CompleterResult;
320
- type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
321
- type CompleterResult = [string[], string];
322
- interface ReadLineOptions {
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 {
323
326
  input: NodeJS.ReadableStream;
324
327
  output?: NodeJS.WritableStream | undefined;
325
328
  completer?: Completer | AsyncCompleter | undefined;
@@ -380,8 +383,8 @@ declare module 'readline' {
380
383
  * ```
381
384
  * @since v0.1.98
382
385
  */
383
- function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
384
- function createInterface(options: ReadLineOptions): Interface;
386
+ export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
387
+ export function createInterface(options: ReadLineOptions): Interface;
385
388
  /**
386
389
  * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
387
390
  *
@@ -503,9 +506,9 @@ declare module 'readline' {
503
506
  * ```
504
507
  * @since v0.7.7
505
508
  */
506
- function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
507
- type Direction = -1 | 0 | 1;
508
- interface CursorPos {
509
+ export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
510
+ export type Direction = -1 | 0 | 1;
511
+ export interface CursorPos {
509
512
  rows: number;
510
513
  cols: number;
511
514
  }
@@ -516,7 +519,7 @@ declare module 'readline' {
516
519
  * @param callback Invoked once the operation completes.
517
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`.
518
521
  */
519
- function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
522
+ export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
520
523
  /**
521
524
  * The `readline.clearScreenDown()` method clears the given `TTY` stream from
522
525
  * the current position of the cursor down.
@@ -524,7 +527,7 @@ declare module 'readline' {
524
527
  * @param callback Invoked once the operation completes.
525
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`.
526
529
  */
527
- function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
530
+ export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
528
531
  /**
529
532
  * The `readline.cursorTo()` method moves cursor to the specified position in a
530
533
  * given `TTY` `stream`.
@@ -532,7 +535,7 @@ declare module 'readline' {
532
535
  * @param callback Invoked once the operation completes.
533
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`.
534
537
  */
535
- function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
538
+ export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
536
539
  /**
537
540
  * The `readline.moveCursor()` method moves the cursor _relative_ to its current
538
541
  * position in a given `TTY` `stream`.
@@ -643,7 +646,7 @@ declare module 'readline' {
643
646
  * @param callback Invoked once the operation completes.
644
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`.
645
648
  */
646
- function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
649
+ export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
647
650
  }
648
651
  declare module 'node:readline' {
649
652
  export * from 'readline';
@@ -1105,6 +1105,193 @@ declare module 'util' {
1105
1105
  */
1106
1106
  encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
1107
1107
  }
1108
+
1109
+ /**
1110
+ * Provides a high-level API for command-line argument parsing. Takes a
1111
+ * specification for the expected arguments and returns a structured object
1112
+ * with the parsed values and positionals.
1113
+ *
1114
+ * `config` provides arguments for parsing and configures the parser. It
1115
+ * supports the following properties:
1116
+ *
1117
+ * - `args` The array of argument strings. **Default:** `process.argv` with
1118
+ * `execPath` and `filename` removed.
1119
+ * - `options` Arguments known to the parser. Keys of `options` are the long
1120
+ * names of options and values are objects accepting the following properties:
1121
+ *
1122
+ * - `type` Type of argument, which must be either `boolean` (for options
1123
+ * which do not take values) or `string` (for options which do).
1124
+ * - `multiple` Whether this option can be provided multiple
1125
+ * times. If `true`, all values will be collected in an array. If
1126
+ * `false`, values for the option are last-wins. **Default:** `false`.
1127
+ * - `short` A single character alias for the option.
1128
+ *
1129
+ * - `strict`: Whether an error should be thrown when unknown arguments
1130
+ * are encountered, or when arguments are passed that do not match the
1131
+ * `type` configured in `options`. **Default:** `true`.
1132
+ * - `allowPositionals`: Whether this command accepts positional arguments.
1133
+ * **Default:** `false` if `strict` is `true`, otherwise `true`.
1134
+ * - `tokens`: Whether tokens {boolean} Return the parsed tokens. This is useful
1135
+ * for extending the built-in behavior, from adding additional checks through
1136
+ * to reprocessing the tokens in different ways.
1137
+ * **Default:** `false`.
1138
+ *
1139
+ * @returns The parsed command line arguments:
1140
+ *
1141
+ * - `values` A mapping of parsed option names with their string
1142
+ * or boolean values.
1143
+ * - `positionals` Positional arguments.
1144
+ * - `tokens` Detailed parse information (only if `tokens` was specified).
1145
+ *
1146
+ */
1147
+ export function parseArgs<T extends ParseArgsConfig>(config: T): ParsedResults<T>;
1148
+
1149
+ interface ParseArgsOptionConfig {
1150
+ type: 'string' | 'boolean';
1151
+ short?: string;
1152
+ multiple?: boolean;
1153
+ }
1154
+
1155
+ interface ParseArgsOptionsConfig {
1156
+ [longOption: string]: ParseArgsOptionConfig;
1157
+ }
1158
+
1159
+ export interface ParseArgsConfig {
1160
+ strict?: boolean;
1161
+ allowPositionals?: boolean;
1162
+ tokens?: boolean;
1163
+ options?: ParseArgsOptionsConfig;
1164
+ args?: string[];
1165
+ }
1166
+
1167
+ /*
1168
+ IfDefaultsTrue and IfDefaultsFalse are helpers to handle default values for missing boolean properties.
1169
+ TypeScript does not have exact types for objects: https://github.com/microsoft/TypeScript/issues/12936
1170
+ This means it is impossible to distinguish between "field X is definitely not present" and "field X may or may not be present".
1171
+ But we expect users to generally provide their config inline or `as const`, which means TS will always know whether a given field is present.
1172
+ So this helper treats "not definitely present" (i.e., not `extends boolean`) as being "definitely not present", i.e. it should have its default value.
1173
+ This is technically incorrect but is a much nicer UX for the common case.
1174
+ The IfDefaultsTrue version is for things which default to true; the IfDefaultsFalse version is for things which default to false.
1175
+ */
1176
+ type IfDefaultsTrue<T, IfTrue, IfFalse> = T extends true
1177
+ ? IfTrue
1178
+ : T extends false
1179
+ ? IfFalse
1180
+ : IfTrue;
1181
+
1182
+ // we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false`
1183
+ type IfDefaultsFalse<T, IfTrue, IfFalse> = T extends false
1184
+ ? IfFalse
1185
+ : T extends true
1186
+ ? IfTrue
1187
+ : IfFalse;
1188
+
1189
+ type ExtractOptionValue<T extends ParseArgsConfig, O extends ParseArgsOptionConfig> = IfDefaultsTrue<
1190
+ T['strict'],
1191
+ O['type'] extends 'string' ? string : O['type'] extends 'boolean' ? boolean : string | boolean,
1192
+ string | boolean
1193
+ >;
1194
+
1195
+ type ParsedValues<T extends ParseArgsConfig> =
1196
+ & IfDefaultsTrue<T['strict'], unknown, { [longOption: string]: undefined | string | boolean }>
1197
+ & (T['options'] extends ParseArgsOptionsConfig
1198
+ ? {
1199
+ -readonly [LongOption in keyof T['options']]: IfDefaultsFalse<
1200
+ T['options'][LongOption]['multiple'],
1201
+ undefined | Array<ExtractOptionValue<T, T['options'][LongOption]>>,
1202
+ undefined | ExtractOptionValue<T, T['options'][LongOption]>
1203
+ >;
1204
+ }
1205
+ : {});
1206
+
1207
+ type ParsedPositionals<T extends ParseArgsConfig> = IfDefaultsTrue<
1208
+ T['strict'],
1209
+ IfDefaultsFalse<T['allowPositionals'], string[], []>,
1210
+ IfDefaultsTrue<T['allowPositionals'], string[], []>
1211
+ >;
1212
+
1213
+ type PreciseTokenForOptions<
1214
+ K extends string,
1215
+ O extends ParseArgsOptionConfig,
1216
+ > = O['type'] extends 'string'
1217
+ ? {
1218
+ kind: 'option';
1219
+ index: number;
1220
+ name: K;
1221
+ rawName: string;
1222
+ value: string;
1223
+ inlineValue: boolean;
1224
+ }
1225
+ : O['type'] extends 'boolean'
1226
+ ? {
1227
+ kind: 'option';
1228
+ index: number;
1229
+ name: K;
1230
+ rawName: string;
1231
+ value: undefined;
1232
+ inlineValue: undefined;
1233
+ }
1234
+ : OptionToken & { name: K };
1235
+
1236
+ type TokenForOptions<
1237
+ T extends ParseArgsConfig,
1238
+ K extends keyof T['options'] = keyof T['options'],
1239
+ > = K extends unknown
1240
+ ? T['options'] extends ParseArgsOptionsConfig
1241
+ ? PreciseTokenForOptions<K & string, T['options'][K]>
1242
+ : OptionToken
1243
+ : never;
1244
+
1245
+ type ParsedOptionToken<T extends ParseArgsConfig> = IfDefaultsTrue<T['strict'], TokenForOptions<T>, OptionToken>;
1246
+
1247
+ type ParsedPositionalToken<T extends ParseArgsConfig> = IfDefaultsTrue<
1248
+ T['strict'],
1249
+ IfDefaultsFalse<T['allowPositionals'], { kind: 'positional'; index: number; value: string }, never>,
1250
+ IfDefaultsTrue<T['allowPositionals'], { kind: 'positional'; index: number; value: string }, never>
1251
+ >;
1252
+
1253
+ type ParsedTokens<T extends ParseArgsConfig> = Array<
1254
+ ParsedOptionToken<T> | ParsedPositionalToken<T> | { kind: 'option-terminator'; index: number }
1255
+ >;
1256
+
1257
+ type PreciseParsedResults<T extends ParseArgsConfig> = IfDefaultsFalse<
1258
+ T['tokens'],
1259
+ {
1260
+ values: ParsedValues<T>;
1261
+ positionals: ParsedPositionals<T>;
1262
+ tokens: ParsedTokens<T>;
1263
+ },
1264
+ {
1265
+ values: ParsedValues<T>;
1266
+ positionals: ParsedPositionals<T>;
1267
+ }
1268
+ >;
1269
+
1270
+ type OptionToken =
1271
+ | { kind: 'option'; index: number; name: string; rawName: string; value: string; inlineValue: boolean }
1272
+ | {
1273
+ kind: 'option';
1274
+ index: number;
1275
+ name: string;
1276
+ rawName: string;
1277
+ value: undefined;
1278
+ inlineValue: undefined;
1279
+ };
1280
+
1281
+ type Token =
1282
+ | OptionToken
1283
+ | { kind: 'positional'; index: number; value: string }
1284
+ | { kind: 'option-terminator'; index: number };
1285
+
1286
+ // If ParseArgsConfig extends T, then the user passed config constructed elsewhere.
1287
+ // So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above.
1288
+ type ParsedResults<T extends ParseArgsConfig> = ParseArgsConfig extends T
1289
+ ? {
1290
+ values: { [longOption: string]: undefined | string | boolean | Array<string | boolean> };
1291
+ positionals: string[];
1292
+ tokens?: Token[];
1293
+ }
1294
+ : PreciseParsedResults<T>;
1108
1295
  }
1109
1296
  declare module 'util/types' {
1110
1297
  export * from 'util/types';
@@ -223,7 +223,7 @@ declare module 'vm' {
223
223
  runInNewContext(contextObject?: Context, options?: RunningScriptOptions): any;
224
224
  /**
225
225
  * Runs the compiled code contained by the `vm.Script` within the context of the
226
- * current `global` object. Running code does not have access to local scope, but_does_ have access to the current `global` object.
226
+ * current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object.
227
227
  *
228
228
  * The following example compiles code that increments a `global` variable then
229
229
  * executes that code multiple times:
@@ -175,7 +175,7 @@ declare module 'worker_threads' {
175
175
  */
176
176
  postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
177
177
  /**
178
- * Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does_not_ let the program exit if it's the only active handle left (the default
178
+ * Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
179
179
  * behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
180
180
  *
181
181
  * If listeners are attached or removed using `.on('message')`, the port
@@ -400,7 +400,7 @@ declare module 'worker_threads' {
400
400
  */
401
401
  postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
402
402
  /**
403
- * Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does_not_ let the program exit if it's the only active handle left (the default
403
+ * Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
404
404
  * behavior). If the worker is `ref()`ed, calling `ref()` again has
405
405
  * no effect.
406
406
  * @since v10.5.0
package/package.json CHANGED
@@ -82,7 +82,7 @@
82
82
  "devDependencies": {
83
83
  "@aws-cdk/aws-apigatewayv2-alpha": "2.1.0-alpha.0",
84
84
  "@aws-cdk/aws-apigatewayv2-integrations-alpha": "2.1.0-alpha.0",
85
- "@types/aws-lambda": "^8.10.101",
85
+ "@types/aws-lambda": "^8.10.102",
86
86
  "@types/jest": "^27",
87
87
  "@types/node": "^14",
88
88
  "@types/tsscmp": "^1.0.0",
@@ -90,24 +90,24 @@
90
90
  "@typescript-eslint/parser": "^5",
91
91
  "aws-cdk": "^2",
92
92
  "aws-cdk-lib": "2.1.0",
93
- "aws-sdk": "^2.1184.0",
93
+ "aws-sdk": "^2.1194.0",
94
94
  "aws-sdk-mock": "^5.7.0",
95
95
  "constructs": "10.0.5",
96
- "esbuild": "^0.14.51",
96
+ "esbuild": "^0.15.2",
97
97
  "eslint": "^8",
98
98
  "eslint-import-resolver-node": "^0.3.6",
99
99
  "eslint-import-resolver-typescript": "^2.7.1",
100
100
  "eslint-plugin-import": "^2.26.0",
101
101
  "jest": "^27",
102
102
  "jest-junit": "^13",
103
- "jsii": "^1.63.1",
104
- "jsii-diff": "^1.63.1",
103
+ "jsii": "^1.64.0",
104
+ "jsii-diff": "^1.64.0",
105
105
  "jsii-docgen": "^1.8.110",
106
- "jsii-pacmak": "^1.63.1",
106
+ "jsii-pacmak": "^1.64.0",
107
107
  "json-schema": "^0.4.0",
108
108
  "nock": "^13.2.9",
109
109
  "npm-check-updates": "^15",
110
- "projen": "^0.60.7",
110
+ "projen": "^0.61.10",
111
111
  "standard-version": "^9",
112
112
  "ts-jest": "^27",
113
113
  "ts-node": "^10.9.1",
@@ -132,7 +132,7 @@
132
132
  ],
133
133
  "main": "lib/index.js",
134
134
  "license": "Apache-2.0",
135
- "version": "0.6.1",
135
+ "version": "0.6.4",
136
136
  "jest": {
137
137
  "testMatch": [
138
138
  "<rootDir>/src/**/__tests__/**/*.ts?(x)",