cloudstructs 0.6.21 → 0.6.23

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 (138) hide show
  1. package/.jsii +3 -3
  2. package/assets/slack-textract/detect.lambda/index.js +6 -6
  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/ssl-server-test/index.js +1 -1
  12. package/lib/state-machine-cr-provider/index.js +1 -1
  13. package/lib/static-website/index.js +1 -1
  14. package/lib/toolkit-cleaner/index.js +1 -1
  15. package/lib/url-shortener/index.js +1 -1
  16. package/node_modules/@slack/logger/node_modules/@types/node/README.md +1 -1
  17. package/node_modules/@slack/logger/node_modules/@types/node/buffer.d.ts +61 -7
  18. package/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +12 -4
  19. package/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +21 -0
  20. package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +100 -0
  21. package/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +1 -1
  22. package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +1 -1
  23. package/node_modules/@slack/logger/node_modules/@types/node/net.d.ts +6 -0
  24. package/node_modules/@slack/logger/node_modules/@types/node/os.d.ts +7 -0
  25. package/node_modules/@slack/logger/node_modules/@types/node/package.json +2 -2
  26. package/node_modules/@slack/logger/node_modules/@types/node/test.d.ts +238 -1
  27. package/node_modules/@slack/logger/node_modules/@types/node/timers.d.ts +7 -0
  28. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/buffer.d.ts +61 -7
  29. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/crypto.d.ts +12 -4
  30. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/globals.d.ts +1 -1
  31. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/net.d.ts +6 -0
  32. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/os.d.ts +7 -0
  33. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/test.d.ts +247 -1
  34. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  35. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  36. package/node_modules/@slack/web-api/node_modules/@types/node/buffer.d.ts +61 -7
  37. package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +12 -4
  38. package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +21 -0
  39. package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +100 -0
  40. package/node_modules/@slack/web-api/node_modules/@types/node/globals.d.ts +1 -1
  41. package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +1 -1
  42. package/node_modules/@slack/web-api/node_modules/@types/node/net.d.ts +6 -0
  43. package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +7 -0
  44. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  45. package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +238 -1
  46. package/node_modules/@slack/web-api/node_modules/@types/node/timers.d.ts +7 -0
  47. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/buffer.d.ts +61 -7
  48. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/crypto.d.ts +12 -4
  49. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/globals.d.ts +1 -1
  50. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/net.d.ts +6 -0
  51. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/os.d.ts +7 -0
  52. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/test.d.ts +247 -1
  53. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  54. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
  55. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +61 -7
  56. package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +12 -4
  57. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +21 -0
  58. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +100 -0
  59. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +1 -1
  60. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +1 -1
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +6 -0
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +7 -0
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +2 -2
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +238 -1
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +7 -0
  66. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/buffer.d.ts +61 -7
  67. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/crypto.d.ts +12 -4
  68. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/globals.d.ts +1 -1
  69. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/net.d.ts +6 -0
  70. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/os.d.ts +7 -0
  71. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/test.d.ts +247 -1
  72. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  73. package/node_modules/@types/is-stream/node_modules/@types/node/README.md +1 -1
  74. package/node_modules/@types/is-stream/node_modules/@types/node/buffer.d.ts +61 -7
  75. package/node_modules/@types/is-stream/node_modules/@types/node/crypto.d.ts +12 -4
  76. package/node_modules/@types/is-stream/node_modules/@types/node/fs/promises.d.ts +21 -0
  77. package/node_modules/@types/is-stream/node_modules/@types/node/fs.d.ts +100 -0
  78. package/node_modules/@types/is-stream/node_modules/@types/node/globals.d.ts +1 -1
  79. package/node_modules/@types/is-stream/node_modules/@types/node/index.d.ts +1 -1
  80. package/node_modules/@types/is-stream/node_modules/@types/node/net.d.ts +6 -0
  81. package/node_modules/@types/is-stream/node_modules/@types/node/os.d.ts +7 -0
  82. package/node_modules/@types/is-stream/node_modules/@types/node/package.json +2 -2
  83. package/node_modules/@types/is-stream/node_modules/@types/node/test.d.ts +238 -1
  84. package/node_modules/@types/is-stream/node_modules/@types/node/timers.d.ts +7 -0
  85. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/buffer.d.ts +61 -7
  86. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/crypto.d.ts +12 -4
  87. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/globals.d.ts +1 -1
  88. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/net.d.ts +6 -0
  89. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/os.d.ts +7 -0
  90. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/test.d.ts +247 -1
  91. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  92. package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
  93. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +61 -7
  94. package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +12 -4
  95. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +21 -0
  96. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +100 -0
  97. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +1 -1
  98. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +1 -1
  99. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +6 -0
  100. package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +7 -0
  101. package/node_modules/@types/keyv/node_modules/@types/node/package.json +2 -2
  102. package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +238 -1
  103. package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +7 -0
  104. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/buffer.d.ts +61 -7
  105. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/crypto.d.ts +12 -4
  106. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.d.ts +1 -1
  107. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/net.d.ts +6 -0
  108. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/os.d.ts +7 -0
  109. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/test.d.ts +247 -1
  110. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  111. package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
  112. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +61 -7
  113. package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +12 -4
  114. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +21 -0
  115. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +100 -0
  116. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +1 -1
  117. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +1 -1
  118. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +6 -0
  119. package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +7 -0
  120. package/node_modules/@types/responselike/node_modules/@types/node/package.json +2 -2
  121. package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +238 -1
  122. package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +7 -0
  123. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/buffer.d.ts +61 -7
  124. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/crypto.d.ts +12 -4
  125. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/globals.d.ts +1 -1
  126. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/net.d.ts +6 -0
  127. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/os.d.ts +7 -0
  128. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/test.d.ts +247 -1
  129. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  130. package/package.json +8 -8
  131. /package/node_modules/{retry → p-retry/node_modules/retry}/License +0 -0
  132. /package/node_modules/{retry → p-retry/node_modules/retry}/README.md +0 -0
  133. /package/node_modules/{retry → p-retry/node_modules/retry}/example/dns.js +0 -0
  134. /package/node_modules/{retry → p-retry/node_modules/retry}/example/stop.js +0 -0
  135. /package/node_modules/{retry → p-retry/node_modules/retry}/index.js +0 -0
  136. /package/node_modules/{retry → p-retry/node_modules/retry}/lib/retry.js +0 -0
  137. /package/node_modules/{retry → p-retry/node_modules/retry}/lib/retry_operation.js +0 -0
  138. /package/node_modules/{retry → p-retry/node_modules/retry}/package.json +0 -0
@@ -131,6 +131,42 @@ declare module 'fs' {
131
131
  * @since v0.1.21
132
132
  */
133
133
  export class Stats {}
134
+
135
+ export interface StatsFsBase<T> {
136
+ /** Type of file system. */
137
+ type: T;
138
+ /** Optimal transfer block size. */
139
+ bsize: T;
140
+ /** Total data blocks in file system. */
141
+ blocks: T;
142
+ /** Free blocks in file system. */
143
+ bfree: T;
144
+ /** Available blocks for unprivileged users */
145
+ bavail: T;
146
+ /** Total file nodes in file system. */
147
+ files: T;
148
+ /** Free file nodes in file system. */
149
+ ffree: T;
150
+ }
151
+
152
+ export interface StatsFs extends StatsFsBase<number> {}
153
+
154
+ /**
155
+ * Provides information about a mounted file system
156
+ *
157
+ * Objects returned from {@link statfs} and {@link statfsSync} are of this type.
158
+ * If `bigint` in the `options` passed to those methods is true, the numeric values
159
+ * will be `bigint` instead of `number`.
160
+ * @since v18.15.0
161
+ */
162
+ export class StatsFs {}
163
+
164
+ export interface BigIntStatsFs extends StatsFsBase<bigint> {}
165
+
166
+ export interface StatFsOptions {
167
+ bigint?: boolean | undefined;
168
+ }
169
+
134
170
  /**
135
171
  * A representation of a directory entry, which can be a file or a subdirectory
136
172
  * within the directory, as returned by reading from an `fs.Dir`. The
@@ -1081,6 +1117,70 @@ declare module 'fs' {
1081
1117
  ): Promise<BigIntStats>;
1082
1118
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
1083
1119
  }
1120
+ /**
1121
+ * Asynchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
1122
+ * In case of an error, the err.code will be one of Common System Errors.
1123
+ * @param path A path to an existing file or directory on the file system to be queried.
1124
+ * @param callback
1125
+ */
1126
+ export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1127
+ export function statfs(
1128
+ path: PathLike,
1129
+ options:
1130
+ | (StatFsOptions & {
1131
+ bigint?: false | undefined;
1132
+ })
1133
+ | undefined,
1134
+ callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void
1135
+ ): void;
1136
+ export function statfs(
1137
+ path: PathLike,
1138
+ options: StatFsOptions & {
1139
+ bigint: true;
1140
+ },
1141
+ callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void
1142
+ ): void;
1143
+ export function statfs(path: PathLike, options: StatFsOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void): void;
1144
+ export namespace statfs {
1145
+ /**
1146
+ * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
1147
+ * @param path A path to an existing file or directory on the file system to be queried.
1148
+ */
1149
+ function __promisify__(
1150
+ path: PathLike,
1151
+ options?: StatFsOptions & {
1152
+ bigint?: false | undefined;
1153
+ }
1154
+ ): Promise<StatsFs>;
1155
+ function __promisify__(
1156
+ path: PathLike,
1157
+ options: StatFsOptions & {
1158
+ bigint: true;
1159
+ }
1160
+ ): Promise<BigIntStatsFs>;
1161
+ function __promisify__(path: PathLike, options?: StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
1162
+ }
1163
+
1164
+ /**
1165
+ * Synchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
1166
+ * In case of an error, the err.code will be one of Common System Errors.
1167
+ * @param path A path to an existing file or directory on the file system to be queried.
1168
+ * @param callback
1169
+ */
1170
+ export function statfsSync(
1171
+ path: PathLike,
1172
+ options?: StatFsOptions & {
1173
+ bigint?: false | undefined;
1174
+ }
1175
+ ): StatsFs;
1176
+ export function statfsSync(
1177
+ path: PathLike,
1178
+ options: StatFsOptions & {
1179
+ bigint: true;
1180
+ }
1181
+ ): BigIntStatsFs;
1182
+
1183
+ export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1084
1184
  /**
1085
1185
  * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
1086
1186
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -53,7 +53,7 @@ interface AbortController {
53
53
  /**
54
54
  * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
55
55
  */
56
- abort(): void;
56
+ abort(reason?: any): void;
57
57
  }
58
58
 
59
59
  /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 18.13
1
+ // Type definitions for non-npm package Node.js 18.15
2
2
  // Project: https://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
@@ -269,6 +269,12 @@ declare module 'net' {
269
269
  * @since v6.1.0
270
270
  */
271
271
  readonly connecting: boolean;
272
+ /**
273
+ * This is `true` if the socket is not connected yet, either because `.connect()`
274
+ * has not yet been called or because it is still in the process of connecting (see `socket.connecting`).
275
+ * @since v10.16.0
276
+ */
277
+ readonly pending: boolean;
272
278
  /**
273
279
  * See `writable.destroyed` for further details.
274
280
  */
@@ -132,6 +132,13 @@ declare module 'os' {
132
132
  * @since v0.3.3
133
133
  */
134
134
  function cpus(): CpuInfo[];
135
+ /**
136
+ * Returns an estimate of the default amount of parallelism a program should use. Always returns a value greater than zero.
137
+ *
138
+ * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism).
139
+ * @since 18.4.0
140
+ */
141
+ function availableParallelism(): number;
135
142
  /**
136
143
  * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
137
144
  * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.13.0",
3
+ "version": "18.15.3",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -232,6 +232,6 @@
232
232
  },
233
233
  "scripts": {},
234
234
  "dependencies": {},
235
- "typesPublisherContentHash": "6c5087993475c3d03552602e518e6747e3493f7e7dec65e81e1f206b013ad890",
235
+ "typesPublisherContentHash": "2b0bdc90cf6594c1dad97a20429a1c7b90e2dc449ce05846f01e2ecc1f0c0467",
236
236
  "typeScriptVersion": "4.2"
237
237
  }
@@ -342,6 +342,10 @@ declare module 'node:test' {
342
342
  * @returns A {@link Promise} resolved with `undefined` once the test completes.
343
343
  */
344
344
  test: typeof test;
345
+ /**
346
+ * Each test provides its own MockTracker instance.
347
+ */
348
+ readonly mock: MockTracker;
345
349
  }
346
350
 
347
351
  interface TestOptions {
@@ -451,5 +455,238 @@ declare module 'node:test' {
451
455
  timeout?: number | undefined;
452
456
  }
453
457
 
454
- export { test as default, run, test, describe, it, before, after, beforeEach, afterEach };
458
+ interface MockFunctionOptions {
459
+ /**
460
+ * The number of times that the mock will use the behavior of `implementation`.
461
+ * Once the mock function has been called `times` times,
462
+ * it will automatically restore the behavior of `original`.
463
+ * This value must be an integer greater than zero.
464
+ * @default Infinity
465
+ */
466
+ times?: number | undefined;
467
+ }
468
+
469
+ interface MockMethodOptions extends MockFunctionOptions {
470
+ /**
471
+ * If `true`, `object[methodName]` is treated as a getter.
472
+ * This option cannot be used with the `setter` option.
473
+ */
474
+ getter?: boolean | undefined;
475
+
476
+ /**
477
+ * If `true`, `object[methodName]` is treated as a setter.
478
+ * This option cannot be used with the `getter` option.
479
+ */
480
+ setter?: boolean | undefined;
481
+ }
482
+
483
+ type Mock<F extends Function> = F & {
484
+ mock: MockFunctionContext<F>;
485
+ };
486
+
487
+ type NoOpFunction = (...args: any[]) => undefined;
488
+
489
+ type FunctionPropertyNames<T> = {
490
+ [K in keyof T]: T[K] extends Function ? K : never;
491
+ }[keyof T];
492
+
493
+ interface MockTracker {
494
+ /**
495
+ * This function is used to create a mock function.
496
+ * @param original An optional function to create a mock on.
497
+ * @param implementation An optional function used as the mock implementation for `original`.
498
+ * This is useful for creating mocks that exhibit one behavior for a specified number of calls and then restore the behavior of `original`.
499
+ * @param options Optional configuration options for the mock function.
500
+ */
501
+ fn<F extends Function = NoOpFunction>(original?: F, options?: MockFunctionOptions): Mock<F>;
502
+ fn<F extends Function = NoOpFunction, Implementation extends Function = F>(original?: F, implementation?: Implementation, options?: MockFunctionOptions): Mock<F | Implementation>;
503
+
504
+ /**
505
+ * This function is used to create a mock on an existing object method.
506
+ * @param object The object whose method is being mocked.
507
+ * @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown.
508
+ * @param implementation An optional function used as the mock implementation for `object[methodName]`.
509
+ * @param options Optional configuration options for the mock method.
510
+ */
511
+ method<
512
+ MockedObject extends object,
513
+ MethodName extends FunctionPropertyNames<MockedObject>,
514
+ >(
515
+ object: MockedObject,
516
+ methodName: MethodName,
517
+ options?: MockFunctionOptions,
518
+ ): MockedObject[MethodName] extends Function
519
+ ? Mock<MockedObject[MethodName]>
520
+ : never;
521
+ method<
522
+ MockedObject extends object,
523
+ MethodName extends FunctionPropertyNames<MockedObject>,
524
+ Implementation extends Function,
525
+ >(
526
+ object: MockedObject,
527
+ methodName: MethodName,
528
+ implementation: Implementation,
529
+ options?: MockFunctionOptions,
530
+ ): MockedObject[MethodName] extends Function
531
+ ? Mock<MockedObject[MethodName] | Implementation>
532
+ : never;
533
+ method<MockedObject extends object>(
534
+ object: MockedObject,
535
+ methodName: keyof MockedObject,
536
+ options: MockMethodOptions,
537
+ ): Mock<Function>;
538
+ method<MockedObject extends object>(
539
+ object: MockedObject,
540
+ methodName: keyof MockedObject,
541
+ implementation: Function,
542
+ options: MockMethodOptions,
543
+ ): Mock<Function>;
544
+
545
+ /**
546
+ * This function is syntax sugar for {@link MockTracker.method} with `options.getter` set to `true`.
547
+ */
548
+ getter<
549
+ MockedObject extends object,
550
+ MethodName extends keyof MockedObject,
551
+ >(
552
+ object: MockedObject,
553
+ methodName: MethodName,
554
+ options?: MockFunctionOptions,
555
+ ): Mock<() => MockedObject[MethodName]>;
556
+ getter<
557
+ MockedObject extends object,
558
+ MethodName extends keyof MockedObject,
559
+ Implementation extends Function,
560
+ >(
561
+ object: MockedObject,
562
+ methodName: MethodName,
563
+ implementation?: Implementation,
564
+ options?: MockFunctionOptions,
565
+ ): Mock<(() => MockedObject[MethodName]) | Implementation>;
566
+
567
+ /**
568
+ * This function is syntax sugar for {@link MockTracker.method} with `options.setter` set to `true`.
569
+ */
570
+ setter<
571
+ MockedObject extends object,
572
+ MethodName extends keyof MockedObject,
573
+ >(
574
+ object: MockedObject,
575
+ methodName: MethodName,
576
+ options?: MockFunctionOptions,
577
+ ): Mock<(value: MockedObject[MethodName]) => void>;
578
+ setter<
579
+ MockedObject extends object,
580
+ MethodName extends keyof MockedObject,
581
+ Implementation extends Function,
582
+ >(
583
+ object: MockedObject,
584
+ methodName: MethodName,
585
+ implementation?: Implementation,
586
+ options?: MockFunctionOptions,
587
+ ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>;
588
+
589
+ /**
590
+ * This function restores the default behavior of all mocks that were previously created by this `MockTracker`
591
+ * and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used,
592
+ * but the `MockTracker` instance can no longer be used to reset their behavior or otherwise interact with them.
593
+ *
594
+ * After each test completes, this function is called on the test context's `MockTracker`.
595
+ * If the global `MockTracker` is used extensively, calling this function manually is recommended.
596
+ */
597
+ reset(): void;
598
+
599
+ /**
600
+ * This function restores the default behavior of all mocks that were previously created by this `MockTracker`.
601
+ * Unlike `mock.reset()`, `mock.restoreAll()` does not disassociate the mocks from the `MockTracker` instance.
602
+ */
603
+ restoreAll(): void;
604
+ }
605
+
606
+ const mock: MockTracker;
607
+
608
+ interface MockFunctionCall<
609
+ F extends Function,
610
+ ReturnType = F extends (...args: any) => infer T
611
+ ? T
612
+ : F extends abstract new (...args: any) => infer T
613
+ ? T
614
+ : unknown,
615
+ Args = F extends (...args: infer Y) => any
616
+ ? Y
617
+ : F extends abstract new (...args: infer Y) => any
618
+ ? Y
619
+ : unknown[],
620
+ > {
621
+ /**
622
+ * An array of the arguments passed to the mock function.
623
+ */
624
+ arguments: Args;
625
+ /**
626
+ * If the mocked function threw then this property contains the thrown value.
627
+ */
628
+ error: unknown | undefined;
629
+ /**
630
+ * The value returned by the mocked function.
631
+ *
632
+ * If the mocked function threw, it will be `undefined`.
633
+ */
634
+ result: ReturnType | undefined;
635
+ /**
636
+ * An `Error` object whose stack can be used to determine the callsite of the mocked function invocation.
637
+ */
638
+ stack: Error;
639
+ /**
640
+ * If the mocked function is a constructor, this field contains the class being constructed.
641
+ * Otherwise this will be `undefined`.
642
+ */
643
+ target: F extends abstract new (...args: any) => any ? F : undefined;
644
+ /**
645
+ * The mocked function's `this` value.
646
+ */
647
+ this: unknown;
648
+ }
649
+
650
+ interface MockFunctionContext<F extends Function> {
651
+ /**
652
+ * A getter that returns a copy of the internal array used to track calls to the mock.
653
+ */
654
+ readonly calls: Array<MockFunctionCall<F>>;
655
+
656
+ /**
657
+ * This function returns the number of times that this mock has been invoked.
658
+ * This function is more efficient than checking `ctx.calls.length`
659
+ * because `ctx.calls` is a getter that creates a copy of the internal call tracking array.
660
+ */
661
+ callCount(): number;
662
+
663
+ /**
664
+ * This function is used to change the behavior of an existing mock.
665
+ * @param implementation The function to be used as the mock's new implementation.
666
+ */
667
+ mockImplementation(implementation: Function): void;
668
+
669
+ /**
670
+ * This function is used to change the behavior of an existing mock for a single invocation.
671
+ * Once invocation `onCall` has occurred, the mock will revert to whatever behavior
672
+ * it would have used had `mockImplementationOnce()` not been called.
673
+ * @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`.
674
+ * @param onCall The invocation number that will use `implementation`.
675
+ * If the specified invocation has already occurred then an exception is thrown.
676
+ */
677
+ mockImplementationOnce(implementation: Function, onCall?: number): void;
678
+
679
+ /**
680
+ * Resets the call history of the mock function.
681
+ */
682
+ resetCalls(): void;
683
+
684
+ /**
685
+ * Resets the implementation of the mock function to its original behavior.
686
+ * The mock can still be used after calling this function.
687
+ */
688
+ restore(): void;
689
+ }
690
+
691
+ export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock };
455
692
  }
@@ -62,6 +62,13 @@ declare module 'timers' {
62
62
  [Symbol.toPrimitive](): number;
63
63
  }
64
64
  }
65
+ /**
66
+ * Schedules execution of a one-time `callback` after `delay` milliseconds. The `callback` will likely not be invoked in precisely `delay` milliseconds.
67
+ * Node.js makes no guarantees about the exact timing of when callbacks will fire, nor of their ordering. The callback will be called as close as possible to the time specified.
68
+ * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be set to `1`. Non-integer delays are truncated to an integer.
69
+ * If `callback` is not a function, a [TypeError](https://nodejs.org/api/errors.html#class-typeerror) will be thrown.
70
+ * @since v0.0.1
71
+ */
65
72
  function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
66
73
  // util.promisify no rest args compability
67
74
  // tslint:disable-next-line void-return
@@ -46,6 +46,8 @@
46
46
  declare module 'buffer' {
47
47
  import { BinaryLike } from 'node:crypto';
48
48
  import { ReadableStream as WebReadableStream } from 'node:stream/web';
49
+ export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
50
+ export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
49
51
  export const INSPECT_MAX_BYTES: number;
50
52
  export const kMaxLength: number;
51
53
  export const kStringMaxLength: number;
@@ -163,18 +165,57 @@ declare module 'buffer' {
163
165
  */
164
166
  stream(): WebReadableStream;
165
167
  }
168
+ export interface FileOptions {
169
+ /**
170
+ * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
171
+ * converted to the platform native line-ending as specified by `require('node:os').EOL`.
172
+ */
173
+ endings?: 'native' | 'transparent';
174
+ /** The File content-type. */
175
+ type?: string;
176
+ /** The last modified date of the file. `Default`: Date.now(). */
177
+ lastModified?: number;
178
+ }
179
+ /**
180
+ * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
181
+ * @experimental
182
+ * @since v18.13.0
183
+ */
184
+ export class File extends Blob {
185
+ constructor(sources: Array<BinaryLike | Blob>, fileName: string, options?: FileOptions);
186
+ /**
187
+ * The name of the `File`.
188
+ * @since v18.13.0
189
+ */
190
+ readonly name: string;
191
+ /**
192
+ * The last modified date of the `File`.
193
+ * @since v18.13.0
194
+ */
195
+ readonly lastModified: number;
196
+ }
166
197
  export import atob = globalThis.atob;
167
198
  export import btoa = globalThis.btoa;
168
199
 
169
200
  import { Blob as NodeBlob } from 'buffer';
170
201
  // This conditional type will be the existing global Blob in a browser, or
171
202
  // the copy below in a Node environment.
172
- type __Blob = typeof globalThis extends { onmessage: any, Blob: any }
173
- ? {} : NodeBlob;
203
+ type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
174
204
 
175
205
  global {
176
206
  // Buffer class
177
- type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
207
+ type BufferEncoding =
208
+ | 'ascii'
209
+ | 'utf8'
210
+ | 'utf-8'
211
+ | 'utf16le'
212
+ | 'ucs2'
213
+ | 'ucs-2'
214
+ | 'base64'
215
+ | 'base64url'
216
+ | 'latin1'
217
+ | 'binary'
218
+ | 'hex';
178
219
  type WithImplicitCoercion<T> =
179
220
  | T
180
221
  | {
@@ -248,7 +289,11 @@ declare module 'buffer' {
248
289
  * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
249
290
  * @since v5.10.0
250
291
  */
251
- from(arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, byteOffset?: number, length?: number): Buffer;
292
+ from(
293
+ arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>,
294
+ byteOffset?: number,
295
+ length?: number,
296
+ ): Buffer;
252
297
  /**
253
298
  * Creates a new Buffer using the passed {data}
254
299
  * @param data data to create a new Buffer
@@ -266,7 +311,7 @@ declare module 'buffer' {
266
311
  | {
267
312
  [Symbol.toPrimitive](hint: 'string'): string;
268
313
  },
269
- encoding?: BufferEncoding
314
+ encoding?: BufferEncoding,
270
315
  ): Buffer;
271
316
  /**
272
317
  * Creates a new Buffer using the passed {data}
@@ -340,7 +385,10 @@ declare module 'buffer' {
340
385
  * @param [encoding='utf8'] If `string` is a string, this is its encoding.
341
386
  * @return The number of bytes contained within `string`.
342
387
  */
343
- byteLength(string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
388
+ byteLength(
389
+ string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
390
+ encoding?: BufferEncoding,
391
+ ): number;
344
392
  /**
345
393
  * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
346
394
  *
@@ -711,7 +759,13 @@ declare module 'buffer' {
711
759
  * @param [sourceStart=0] The offset within `buf` at which to begin comparison.
712
760
  * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive).
713
761
  */
714
- compare(target: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 | 0 | 1;
762
+ compare(
763
+ target: Uint8Array,
764
+ targetStart?: number,
765
+ targetEnd?: number,
766
+ sourceStart?: number,
767
+ sourceEnd?: number,
768
+ ): -1 | 0 | 1;
715
769
  /**
716
770
  * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
717
771
  *
@@ -1190,11 +1190,13 @@ declare module 'crypto' {
1190
1190
  format?: KeyFormat | undefined;
1191
1191
  type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
1192
1192
  passphrase?: string | Buffer | undefined;
1193
+ encoding?: string | undefined;
1193
1194
  }
1194
1195
  interface PublicKeyInput {
1195
1196
  key: string | Buffer;
1196
1197
  format?: KeyFormat | undefined;
1197
1198
  type?: 'pkcs1' | 'spki' | undefined;
1199
+ encoding?: string | undefined;
1198
1200
  }
1199
1201
  /**
1200
1202
  * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
@@ -1305,6 +1307,7 @@ declare module 'crypto' {
1305
1307
  interface VerifyKeyObjectInput extends SigningOptions {
1306
1308
  key: KeyObject;
1307
1309
  }
1310
+ interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
1308
1311
  type KeyLike = string | Buffer | KeyObject;
1309
1312
  /**
1310
1313
  * The `Sign` class is a utility for generating signatures. It can be used in one
@@ -1459,8 +1462,8 @@ declare module 'crypto' {
1459
1462
  * be passed instead of a public key.
1460
1463
  * @since v0.1.92
1461
1464
  */
1462
- verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
1463
- verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
1465
+ verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean;
1466
+ verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
1464
1467
  }
1465
1468
  /**
1466
1469
  * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
@@ -2968,11 +2971,16 @@ declare module 'crypto' {
2968
2971
  * If the `callback` function is provided this function uses libuv's threadpool.
2969
2972
  * @since v12.0.0
2970
2973
  */
2971
- function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
2972
2974
  function verify(
2973
2975
  algorithm: string | null | undefined,
2974
2976
  data: NodeJS.ArrayBufferView,
2975
- key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
2977
+ key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
2978
+ signature: NodeJS.ArrayBufferView
2979
+ ): boolean;
2980
+ function verify(
2981
+ algorithm: string | null | undefined,
2982
+ data: NodeJS.ArrayBufferView,
2983
+ key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
2976
2984
  signature: NodeJS.ArrayBufferView,
2977
2985
  callback: (error: Error | null, result: boolean) => void
2978
2986
  ): void;
@@ -53,7 +53,7 @@ interface AbortController {
53
53
  /**
54
54
  * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
55
55
  */
56
- abort(): void;
56
+ abort(reason?: any): void;
57
57
  }
58
58
 
59
59
  /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
@@ -290,6 +290,12 @@ declare module 'net' {
290
290
  * @since v18.8.0
291
291
  */
292
292
  readonly localFamily?: string;
293
+ /**
294
+ * This is `true` if the socket is not connected yet, either because `.connect()`
295
+ * has not yet been called or because it is still in the process of connecting (see `socket.connecting`).
296
+ * @since v10.16.0
297
+ */
298
+ readonly pending: boolean;
293
299
  /**
294
300
  * This property represents the state of the connection as a string.
295
301
  * @see {https://nodejs.org/api/net.html#socketreadystate}
@@ -132,6 +132,13 @@ declare module 'os' {
132
132
  * @since v0.3.3
133
133
  */
134
134
  function cpus(): CpuInfo[];
135
+ /**
136
+ * Returns an estimate of the default amount of parallelism a program should use. Always returns a value greater than zero.
137
+ *
138
+ * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism).
139
+ * @since 18.4.0
140
+ */
141
+ function availableParallelism(): number;
135
142
  /**
136
143
  * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
137
144
  * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.