cdk-common 2.0.1289 → 2.0.1291

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 (93) hide show
  1. package/.jsii +2 -2
  2. package/lib/main.js +1 -1
  3. package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
  4. package/node_modules/@types/concat-stream/node_modules/@types/node/assert/strict.d.ts +105 -2
  5. package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +119 -95
  6. package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +117 -7
  7. package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +79 -0
  8. package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +224 -0
  9. package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +28 -3
  10. package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +3 -3
  11. package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +2 -23
  12. package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +5 -0
  13. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/events.d.ts +3 -0
  14. package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +33 -47
  15. package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +6 -0
  16. package/node_modules/@types/concat-stream/node_modules/undici-types/agent.d.ts +0 -4
  17. package/node_modules/@types/concat-stream/node_modules/undici-types/client.d.ts +0 -2
  18. package/node_modules/@types/concat-stream/node_modules/undici-types/dispatcher.d.ts +0 -6
  19. package/node_modules/@types/concat-stream/node_modules/undici-types/h2c-client.d.ts +0 -2
  20. package/node_modules/@types/concat-stream/node_modules/undici-types/index.d.ts +3 -1
  21. package/node_modules/@types/concat-stream/node_modules/undici-types/mock-interceptor.d.ts +0 -1
  22. package/node_modules/@types/concat-stream/node_modules/undici-types/package.json +1 -1
  23. package/node_modules/@types/concat-stream/node_modules/undici-types/snapshot-agent.d.ts +107 -0
  24. package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
  25. package/node_modules/@types/form-data/node_modules/@types/node/assert/strict.d.ts +105 -2
  26. package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +119 -95
  27. package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +117 -7
  28. package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +79 -0
  29. package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +224 -0
  30. package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +28 -3
  31. package/node_modules/@types/form-data/node_modules/@types/node/package.json +3 -3
  32. package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +2 -23
  33. package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +5 -0
  34. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/events.d.ts +3 -0
  35. package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +33 -47
  36. package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +6 -0
  37. package/node_modules/@types/form-data/node_modules/undici-types/agent.d.ts +0 -4
  38. package/node_modules/@types/form-data/node_modules/undici-types/client.d.ts +0 -2
  39. package/node_modules/@types/form-data/node_modules/undici-types/dispatcher.d.ts +0 -6
  40. package/node_modules/@types/form-data/node_modules/undici-types/h2c-client.d.ts +0 -2
  41. package/node_modules/@types/form-data/node_modules/undici-types/index.d.ts +3 -1
  42. package/node_modules/@types/form-data/node_modules/undici-types/mock-interceptor.d.ts +0 -1
  43. package/node_modules/@types/form-data/node_modules/undici-types/package.json +1 -1
  44. package/node_modules/@types/form-data/node_modules/undici-types/snapshot-agent.d.ts +107 -0
  45. package/node_modules/async-function/.eslintrc +16 -0
  46. package/node_modules/async-function/.github/FUNDING.yml +12 -0
  47. package/node_modules/async-function/.nycrc +9 -0
  48. package/node_modules/async-function/CHANGELOG.md +16 -0
  49. package/node_modules/async-function/LICENSE +21 -0
  50. package/node_modules/async-function/README.md +51 -0
  51. package/node_modules/async-function/index.d.mts +3 -0
  52. package/node_modules/async-function/index.d.ts +13 -0
  53. package/node_modules/async-function/index.js +8 -0
  54. package/node_modules/async-function/index.mjs +4 -0
  55. package/node_modules/async-function/legacy.js +18 -0
  56. package/node_modules/async-function/package.json +86 -0
  57. package/node_modules/async-function/require.mjs +5 -0
  58. package/node_modules/async-function/test/index.js +40 -0
  59. package/node_modules/async-function/tsconfig.json +9 -0
  60. package/node_modules/async-generator-function/.eslintrc +26 -0
  61. package/node_modules/async-generator-function/.github/FUNDING.yml +12 -0
  62. package/node_modules/async-generator-function/.nycrc +9 -0
  63. package/node_modules/async-generator-function/CHANGELOG.md +15 -0
  64. package/node_modules/async-generator-function/LICENSE +21 -0
  65. package/node_modules/async-generator-function/README.md +52 -0
  66. package/node_modules/async-generator-function/index.d.mts +3 -0
  67. package/node_modules/async-generator-function/index.d.ts +22 -0
  68. package/node_modules/async-generator-function/index.js +8 -0
  69. package/node_modules/async-generator-function/index.mjs +4 -0
  70. package/node_modules/async-generator-function/legacy.js +18 -0
  71. package/node_modules/async-generator-function/package.json +87 -0
  72. package/node_modules/async-generator-function/require.mjs +5 -0
  73. package/node_modules/async-generator-function/test/index.js +40 -0
  74. package/node_modules/async-generator-function/tsconfig.json +9 -0
  75. package/node_modules/generator-function/.eslintrc +16 -0
  76. package/node_modules/generator-function/.github/FUNDING.yml +12 -0
  77. package/node_modules/generator-function/.nycrc +9 -0
  78. package/node_modules/generator-function/CHANGELOG.md +21 -0
  79. package/node_modules/generator-function/LICENSE.md +7 -0
  80. package/node_modules/generator-function/README.md +51 -0
  81. package/node_modules/generator-function/index.d.mts +3 -0
  82. package/node_modules/generator-function/index.d.ts +3 -0
  83. package/node_modules/generator-function/index.js +8 -0
  84. package/node_modules/generator-function/index.mjs +4 -0
  85. package/node_modules/generator-function/legacy.js +18 -0
  86. package/node_modules/generator-function/package.json +88 -0
  87. package/node_modules/generator-function/require.mjs +5 -0
  88. package/node_modules/generator-function/test/index.js +42 -0
  89. package/node_modules/generator-function/tsconfig.json +9 -0
  90. package/node_modules/get-intrinsic/CHANGELOG.md +7 -0
  91. package/node_modules/get-intrinsic/index.js +8 -13
  92. package/node_modules/get-intrinsic/package.json +7 -4
  93. package/package.json +3 -3
@@ -56,7 +56,7 @@
56
56
  */
57
57
  declare module "worker_threads" {
58
58
  import { Context } from "node:vm";
59
- import { EventEmitter } from "node:events";
59
+ import { EventEmitter, NodeEventTarget } from "node:events";
60
60
  import { EventLoopUtilityFunction } from "node:perf_hooks";
61
61
  import { FileHandle } from "node:fs/promises";
62
62
  import { Readable, Writable } from "node:stream";
@@ -70,6 +70,7 @@ declare module "worker_threads" {
70
70
  const resourceLimits: ResourceLimits;
71
71
  const SHARE_ENV: unique symbol;
72
72
  const threadId: number;
73
+ const threadName: string | null;
73
74
  const workerData: any;
74
75
  /**
75
76
  * Instances of the `worker.MessageChannel` class represent an asynchronous,
@@ -112,7 +113,7 @@ declare module "worker_threads" {
112
113
  * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
113
114
  * @since v10.5.0
114
115
  */
115
- class MessagePort extends EventEmitter {
116
+ class MessagePort extends EventTarget {
116
117
  /**
117
118
  * Disables further sending of messages on either side of the connection.
118
119
  * This method can be called when no further communication will happen over this `MessagePort`.
@@ -225,42 +226,32 @@ declare module "worker_threads" {
225
226
  * @since v10.5.0
226
227
  */
227
228
  start(): void;
228
- addListener(event: "close", listener: () => void): this;
229
+ addListener(event: "close", listener: (ev: Event) => void): this;
229
230
  addListener(event: "message", listener: (value: any) => void): this;
230
231
  addListener(event: "messageerror", listener: (error: Error) => void): this;
231
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
232
- emit(event: "close"): boolean;
232
+ addListener(event: string, listener: (arg: any) => void): this;
233
+ emit(event: "close", ev: Event): boolean;
233
234
  emit(event: "message", value: any): boolean;
234
235
  emit(event: "messageerror", error: Error): boolean;
235
- emit(event: string | symbol, ...args: any[]): boolean;
236
- on(event: "close", listener: () => void): this;
236
+ emit(event: string, arg: any): boolean;
237
+ off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
238
+ off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
239
+ off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
240
+ off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
241
+ on(event: "close", listener: (ev: Event) => void): this;
237
242
  on(event: "message", listener: (value: any) => void): this;
238
243
  on(event: "messageerror", listener: (error: Error) => void): this;
239
- on(event: string | symbol, listener: (...args: any[]) => void): this;
240
- once(event: "close", listener: () => void): this;
244
+ on(event: string, listener: (arg: any) => void): this;
245
+ once(event: "close", listener: (ev: Event) => void): this;
241
246
  once(event: "message", listener: (value: any) => void): this;
242
247
  once(event: "messageerror", listener: (error: Error) => void): this;
243
- once(event: string | symbol, listener: (...args: any[]) => void): this;
244
- prependListener(event: "close", listener: () => void): this;
245
- prependListener(event: "message", listener: (value: any) => void): this;
246
- prependListener(event: "messageerror", listener: (error: Error) => void): this;
247
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
248
- prependOnceListener(event: "close", listener: () => void): this;
249
- prependOnceListener(event: "message", listener: (value: any) => void): this;
250
- prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
251
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
252
- removeListener(event: "close", listener: () => void): this;
253
- removeListener(event: "message", listener: (value: any) => void): this;
254
- removeListener(event: "messageerror", listener: (error: Error) => void): this;
255
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
256
- off(event: "close", listener: () => void): this;
257
- off(event: "message", listener: (value: any) => void): this;
258
- off(event: "messageerror", listener: (error: Error) => void): this;
259
- off(event: string | symbol, listener: (...args: any[]) => void): this;
260
- addEventListener: EventTarget["addEventListener"];
261
- dispatchEvent: EventTarget["dispatchEvent"];
262
- removeEventListener: EventTarget["removeEventListener"];
248
+ once(event: string, listener: (arg: any) => void): this;
249
+ removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
250
+ removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
251
+ removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
252
+ removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
263
253
  }
254
+ interface MessagePort extends NodeEventTarget {}
264
255
  interface WorkerOptions {
265
256
  /**
266
257
  * List of arguments which would be stringified and appended to
@@ -402,6 +393,12 @@ declare module "worker_threads" {
402
393
  * @since v10.5.0
403
394
  */
404
395
  readonly threadId: number;
396
+ /**
397
+ * A string identifier for the referenced thread or null if the thread is not running.
398
+ * Inside the worker thread, it is available as `require('node:worker_threads').threadName`.
399
+ * @since v24.6.0
400
+ */
401
+ readonly threadName: string | null;
405
402
  /**
406
403
  * Provides the set of JS engine resource constraints for this Worker thread.
407
404
  * If the `resourceLimits` option was passed to the `Worker` constructor,
@@ -429,24 +426,6 @@ declare module "worker_threads" {
429
426
  * @since v10.5.0
430
427
  */
431
428
  postMessage(value: any, transferList?: readonly Transferable[]): void;
432
- /**
433
- * Sends a value to another worker, identified by its thread ID.
434
- * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
435
- * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
436
- * @param value The value to send.
437
- * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
438
- * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
439
- * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
440
- * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
441
- * @since v22.5.0
442
- */
443
- postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
444
- postMessageToThread(
445
- threadId: number,
446
- value: any,
447
- transferList: readonly Transferable[],
448
- timeout?: number,
449
- ): Promise<void>;
450
429
  /**
451
430
  * 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
452
431
  * behavior). If the worker is `ref()`ed, calling `ref()` again has
@@ -466,6 +445,13 @@ declare module "worker_threads" {
466
445
  * @since v10.5.0
467
446
  */
468
447
  terminate(): Promise<number>;
448
+ /**
449
+ * This method returns a `Promise` that will resolve to an object identical to `process.threadCpuUsage()`,
450
+ * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
451
+ * This methods allows the statistics to be observed from outside the actual thread.
452
+ * @since v24.6.0
453
+ */
454
+ cpuUsage(prev?: NodeJS.CpuUsage): Promise<NodeJS.CpuUsage>;
469
455
  /**
470
456
  * Returns a readable stream for a V8 snapshot of the current state of the Worker.
471
457
  * See `v8.getHeapSnapshot()` for more details.
@@ -180,6 +180,12 @@ declare module "zlib" {
180
180
  * If `true`, returns an object with `buffer` and `engine`.
181
181
  */
182
182
  info?: boolean | undefined;
183
+ /**
184
+ * Optional dictionary used to improve compression efficiency when compressing or decompressing data that
185
+ * shares common patterns with the dictionary.
186
+ * @since v24.6.0
187
+ */
188
+ dictionary?: NodeJS.ArrayBufferView | undefined;
183
189
  }
184
190
  interface Zlib {
185
191
  readonly bytesWritten: number;
@@ -22,14 +22,10 @@ declare namespace Agent {
22
22
  export interface Options extends Pool.Options {
23
23
  /** Default: `(origin, opts) => new Pool(origin, opts)`. */
24
24
  factory?(origin: string | URL, opts: Object): Dispatcher;
25
- /** Integer. Default: `0` */
26
- maxRedirections?: number;
27
25
 
28
26
  interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options['interceptors']
29
27
  }
30
28
 
31
29
  export interface DispatchOptions extends Dispatcher.DispatchOptions {
32
- /** Integer. */
33
- maxRedirections?: number;
34
30
  }
35
31
  }
@@ -71,8 +71,6 @@ export declare namespace Client {
71
71
  /** TODO */
72
72
  maxCachedSessions?: number;
73
73
  /** TODO */
74
- maxRedirections?: number;
75
- /** TODO */
76
74
  connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
77
75
  /** TODO */
78
76
  maxRequestsPerClient?: number;
@@ -135,8 +135,6 @@ declare namespace Dispatcher {
135
135
  signal?: AbortSignal | EventEmitter | null;
136
136
  /** This argument parameter is passed through to `ConnectData` */
137
137
  opaque?: TOpaque;
138
- /** Default: 0 */
139
- maxRedirections?: number;
140
138
  /** Default: false */
141
139
  redirectionLimitReached?: boolean;
142
140
  /** Default: `null` */
@@ -147,8 +145,6 @@ declare namespace Dispatcher {
147
145
  opaque?: TOpaque;
148
146
  /** Default: `null` */
149
147
  signal?: AbortSignal | EventEmitter | null;
150
- /** Default: 0 */
151
- maxRedirections?: number;
152
148
  /** Default: false */
153
149
  redirectionLimitReached?: boolean;
154
150
  /** Default: `null` */
@@ -172,8 +168,6 @@ declare namespace Dispatcher {
172
168
  protocol?: string;
173
169
  /** Default: `null` */
174
170
  signal?: AbortSignal | EventEmitter | null;
175
- /** Default: 0 */
176
- maxRedirections?: number;
177
171
  /** Default: false */
178
172
  redirectionLimitReached?: boolean;
179
173
  /** Default: `null` */
@@ -51,8 +51,6 @@ export declare namespace H2CClient {
51
51
  /** TODO */
52
52
  maxCachedSessions?: number;
53
53
  /** TODO */
54
- maxRedirections?: number;
55
- /** TODO */
56
54
  connect?: Omit<Partial<buildConnector.BuildOptions>, 'allowH2'> | buildConnector.connector;
57
55
  /** TODO */
58
56
  maxRequestsPerClient?: number;
@@ -13,6 +13,7 @@ import Agent from './agent'
13
13
  import MockClient from './mock-client'
14
14
  import MockPool from './mock-pool'
15
15
  import MockAgent from './mock-agent'
16
+ import { SnapshotAgent } from './snapshot-agent'
16
17
  import { MockCallHistory, MockCallHistoryLog } from './mock-call-history'
17
18
  import mockErrors from './mock-errors'
18
19
  import ProxyAgent from './proxy-agent'
@@ -33,7 +34,7 @@ export * from './content-type'
33
34
  export * from './cache'
34
35
  export { Interceptable } from './mock-interceptor'
35
36
 
36
- export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient }
37
+ export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient }
37
38
  export default Undici
38
39
 
39
40
  declare namespace Undici {
@@ -58,6 +59,7 @@ declare namespace Undici {
58
59
  const MockClient: typeof import('./mock-client').default
59
60
  const MockPool: typeof import('./mock-pool').default
60
61
  const MockAgent: typeof import('./mock-agent').default
62
+ const SnapshotAgent: typeof import('./snapshot-agent').SnapshotAgent
61
63
  const MockCallHistory: typeof import('./mock-call-history').MockCallHistory
62
64
  const MockCallHistoryLog: typeof import('./mock-call-history').MockCallHistoryLog
63
65
  const mockErrors: typeof import('./mock-errors').default
@@ -69,7 +69,6 @@ declare namespace MockInterceptor {
69
69
  headers?: Headers | Record<string, string>;
70
70
  origin?: string;
71
71
  body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
72
- maxRedirections?: number;
73
72
  }
74
73
 
75
74
  export type MockResponseDataHandler<TData extends object = object> = (
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici-types",
3
- "version": "7.12.0",
3
+ "version": "7.13.0",
4
4
  "description": "A stand-alone types package for Undici",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -0,0 +1,107 @@
1
+ import MockAgent from './mock-agent'
2
+
3
+ declare class SnapshotRecorder {
4
+ constructor (options?: SnapshotRecorder.Options)
5
+
6
+ record (requestOpts: any, response: any): Promise<void>
7
+ findSnapshot (requestOpts: any): SnapshotRecorder.Snapshot | undefined
8
+ loadSnapshots (filePath?: string): Promise<void>
9
+ saveSnapshots (filePath?: string): Promise<void>
10
+ clear (): void
11
+ getSnapshots (): SnapshotRecorder.Snapshot[]
12
+ size (): number
13
+ resetCallCounts (): void
14
+ deleteSnapshot (requestOpts: any): boolean
15
+ getSnapshotInfo (requestOpts: any): SnapshotRecorder.SnapshotInfo | null
16
+ replaceSnapshots (snapshotData: SnapshotRecorder.SnapshotData[]): void
17
+ destroy (): void
18
+ }
19
+
20
+ declare namespace SnapshotRecorder {
21
+ export interface Options {
22
+ snapshotPath?: string
23
+ mode?: 'record' | 'playback' | 'update'
24
+ maxSnapshots?: number
25
+ autoFlush?: boolean
26
+ flushInterval?: number
27
+ matchHeaders?: string[]
28
+ ignoreHeaders?: string[]
29
+ excludeHeaders?: string[]
30
+ matchBody?: boolean
31
+ matchQuery?: boolean
32
+ caseSensitive?: boolean
33
+ shouldRecord?: (requestOpts: any) => boolean
34
+ shouldPlayback?: (requestOpts: any) => boolean
35
+ excludeUrls?: (string | RegExp)[]
36
+ }
37
+
38
+ export interface Snapshot {
39
+ request: {
40
+ method: string
41
+ url: string
42
+ headers: Record<string, string>
43
+ body?: string
44
+ }
45
+ responses: {
46
+ statusCode: number
47
+ headers: Record<string, string>
48
+ body: string
49
+ trailers: Record<string, string>
50
+ }[]
51
+ callCount: number
52
+ timestamp: string
53
+ }
54
+
55
+ export interface SnapshotInfo {
56
+ hash: string
57
+ request: {
58
+ method: string
59
+ url: string
60
+ headers: Record<string, string>
61
+ body?: string
62
+ }
63
+ responseCount: number
64
+ callCount: number
65
+ timestamp: string
66
+ }
67
+
68
+ export interface SnapshotData {
69
+ hash: string
70
+ snapshot: Snapshot
71
+ }
72
+ }
73
+
74
+ declare class SnapshotAgent extends MockAgent {
75
+ constructor (options?: SnapshotAgent.Options)
76
+
77
+ saveSnapshots (filePath?: string): Promise<void>
78
+ loadSnapshots (filePath?: string): Promise<void>
79
+ getRecorder (): SnapshotRecorder
80
+ getMode (): 'record' | 'playback' | 'update'
81
+ clearSnapshots (): void
82
+ resetCallCounts (): void
83
+ deleteSnapshot (requestOpts: any): boolean
84
+ getSnapshotInfo (requestOpts: any): SnapshotRecorder.SnapshotInfo | null
85
+ replaceSnapshots (snapshotData: SnapshotRecorder.SnapshotData[]): void
86
+ }
87
+
88
+ declare namespace SnapshotAgent {
89
+ export interface Options extends MockAgent.Options {
90
+ mode?: 'record' | 'playback' | 'update'
91
+ snapshotPath?: string
92
+ maxSnapshots?: number
93
+ autoFlush?: boolean
94
+ flushInterval?: number
95
+ matchHeaders?: string[]
96
+ ignoreHeaders?: string[]
97
+ excludeHeaders?: string[]
98
+ matchBody?: boolean
99
+ matchQuery?: boolean
100
+ caseSensitive?: boolean
101
+ shouldRecord?: (requestOpts: any) => boolean
102
+ shouldPlayback?: (requestOpts: any) => boolean
103
+ excludeUrls?: (string | RegExp)[]
104
+ }
105
+ }
106
+
107
+ export { SnapshotAgent, SnapshotRecorder }
@@ -0,0 +1,16 @@
1
+ {
2
+ "root": true,
3
+
4
+ "extends": "@ljharb",
5
+
6
+ "overrides": [
7
+ {
8
+ "files": "./index.js",
9
+ "extends": "@ljharb/eslint-config/node/8"
10
+ },
11
+ {
12
+ "files": "./require.mjs",
13
+ "extends": "@ljharb/eslint-config/node/16",
14
+ },
15
+ ],
16
+ }
@@ -0,0 +1,12 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [ljharb]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: npm/async-function
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,9 @@
1
+ {
2
+ "all": true,
3
+ "check-coverage": false,
4
+ "reporter": ["text-summary", "text", "html", "json"],
5
+ "exclude": [
6
+ "coverage",
7
+ "test"
8
+ ]
9
+ }
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## v1.0.0 - 2025-01-22
9
+
10
+ ### Commits
11
+
12
+ - Initial implementation, tests, readme, types [`8ad64e4`](https://github.com/ljharb/async-function/commit/8ad64e45668359cf032e095afcbe6ef0d291d6b4)
13
+ - Initial commit [`36dac0d`](https://github.com/ljharb/async-function/commit/36dac0de439b8b6d7af6a246cf984b087efaaf87)
14
+ - [meta] reformat `package.json` [`11ff004`](https://github.com/ljharb/async-function/commit/11ff0044813122c6d22e3bf360af979f7c3f7fc8)
15
+ - first publish [`5ed020c`](https://github.com/ljharb/async-function/commit/5ed020c7852e90f280517a06e4a4d3cb1d295e40)
16
+ - Only apps should have lockfiles [`b746134`](https://github.com/ljharb/async-function/commit/b74613407f749720b7d02b26b9fb2093a0124878)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 EduardoRFS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,51 @@
1
+ # async-function <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
+
3
+ [![github actions][actions-image]][actions-url]
4
+ [![coverage][codecov-image]][codecov-url]
5
+ [![License][license-image]][license-url]
6
+ [![Downloads][downloads-image]][downloads-url]
7
+
8
+ [![npm badge][npm-badge-png]][package-url]
9
+
10
+ A function that returns the normally hidden `AsyncFunction` constructor, when available.
11
+
12
+ ## Getting started
13
+
14
+ ```sh
15
+ npm install --save async-function
16
+ ```
17
+
18
+ ## Usage/Examples
19
+
20
+ ```js
21
+ const assert = require('assert');
22
+ const AsyncFunction = require('async-function')();
23
+
24
+ const fn = new AsyncFunction('return 1');
25
+
26
+ assert.equal(fn.toString(), 'async function anonymous(\n) {\nreturn 1\n}');
27
+
28
+ fn().then(x => {
29
+ assert.equal(x, 1);
30
+ });
31
+ ```
32
+
33
+ ## Tests
34
+
35
+ Clone the repo, `npm install`, and run `npm test`
36
+
37
+ [package-url]: https://npmjs.org/package/async-function
38
+ [npm-version-svg]: https://versionbadg.es/ljharb/async-function.svg
39
+ [deps-svg]: https://david-dm.org/ljharb/async-function.svg
40
+ [deps-url]: https://david-dm.org/ljharb/async-function
41
+ [dev-deps-svg]: https://david-dm.org/ljharb/async-function/dev-status.svg
42
+ [dev-deps-url]: https://david-dm.org/ljharb/async-function#info=devDependencies
43
+ [npm-badge-png]: https://nodei.co/npm/async-function.png?downloads=true&stars=true
44
+ [license-image]: https://img.shields.io/npm/l/async-function.svg
45
+ [license-url]: LICENSE
46
+ [downloads-image]: https://img.shields.io/npm/dm/async-function.svg
47
+ [downloads-url]: https://npm-stat.com/charts.html?package=async-function
48
+ [codecov-image]: https://codecov.io/gh/ljharb/async-function/branch/main/graphs/badge.svg
49
+ [codecov-url]: https://app.codecov.io/gh/ljharb/async-function/
50
+ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/async-function
51
+ [actions-url]: https://github.com/ljharb/async-function/actions
@@ -0,0 +1,3 @@
1
+ import getAsyncFunction = require('.');
2
+
3
+ export default getAsyncFunction;
@@ -0,0 +1,13 @@
1
+ declare namespace getAsyncFunction {
2
+ type AsyncFunction<T = unknown> = (...args: any[]) => Promise<T>;
3
+
4
+ interface AsyncFunctionConstructor extends FunctionConstructor {
5
+ new <T>(...args: string[]): AsyncFunction<T>;
6
+ <T>(...args: string[]): AsyncFunction<T>;
7
+ readonly prototype: AsyncFunction;
8
+ }
9
+ }
10
+
11
+ declare function getAsyncFunction(): getAsyncFunction.AsyncFunctionConstructor | false;
12
+
13
+ export = getAsyncFunction;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ // eslint-disable-next-line no-extra-parens, no-empty-function
4
+ const cached = /** @type {import('.').AsyncFunctionConstructor} */ (async function () {}.constructor);
5
+
6
+ /** @type {import('.')} */
7
+ module.exports = () => cached;
8
+
@@ -0,0 +1,4 @@
1
+ import getAsyncFunction from './index.js';
2
+
3
+ /** @type {import('./index.d.mts').default} */
4
+ export default getAsyncFunction;
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ /** @type {import('.').AsyncFunctionConstructor | false} */
4
+ var cached;
5
+
6
+ /** @type {import('.')} */
7
+ module.exports = function getAsyncFunction() {
8
+ if (typeof cached === 'undefined') {
9
+ try {
10
+ // eslint-disable-next-line no-new-func
11
+ cached = Function('return async function () {}')().constructor;
12
+ } catch (e) {
13
+ cached = false;
14
+ }
15
+ }
16
+ return cached;
17
+ };
18
+
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "async-function",
3
+ "version": "1.0.0",
4
+ "description": "A function that returns the normally hidden `AsyncFunction` constructor",
5
+ "main": "./legacy.js",
6
+ "jsnext:main": "./index.mjs",
7
+ "module": "./index.mjs",
8
+ "exports": {
9
+ ".": [
10
+ {
11
+ "module-sync": "./require.mjs",
12
+ "import": "./index.mjs",
13
+ "default": "./index.js"
14
+ },
15
+ "./index.js"
16
+ ],
17
+ "./package.json": "./package.json"
18
+ },
19
+ "scripts": {
20
+ "prepack": "npmignore --auto --commentLines=autogenerated",
21
+ "prepublish": "not-in-publish || npm run prepublishOnly",
22
+ "prepublishOnly": "safe-publish-latest",
23
+ "pretest": "npm run --silent lint",
24
+ "test": "npm run tests-only",
25
+ "posttest": "npx npm@\">=10.2\" audit --production",
26
+ "tests-only": "nyc tape 'test/**/*.js'",
27
+ "prelint": "evalmd README.md",
28
+ "lint": "eslint --ext=js,mjs .",
29
+ "postlint": "tsc && attw -P",
30
+ "version": "auto-changelog && git add CHANGELOG.md",
31
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/ljharb/async-function.git"
36
+ },
37
+ "keywords": [
38
+ "async",
39
+ "await",
40
+ "function",
41
+ "native"
42
+ ],
43
+ "author": "Jordan Harbamd <ljharb@gmail.com>",
44
+ "license": "MIT",
45
+ "bugs": {
46
+ "url": "https://github.com/ljharb/async-function/issues"
47
+ },
48
+ "homepage": "https://github.com/ljharb/async-function#readme",
49
+ "devDependencies": {
50
+ "@arethetypeswrong/cli": "^0.17.3",
51
+ "@ljharb/eslint-config": "^21.1.1",
52
+ "@ljharb/tsconfig": "^0.2.3",
53
+ "@types/semver": "^6.2.7",
54
+ "@types/tape": "^5.8.1",
55
+ "auto-changelog": "^2.5.0",
56
+ "eslint": "=8.8.0",
57
+ "evalmd": "^0.0.19",
58
+ "get-proto": "^1.0.1",
59
+ "in-publish": "^2.0.1",
60
+ "npmignore": "^0.3.1",
61
+ "nyc": "^10.3.2",
62
+ "safe-publish-latest": "^2.0.0",
63
+ "semver": "^6.3.1",
64
+ "tape": "^5.9.0",
65
+ "typescript": "next"
66
+ },
67
+ "engines": {
68
+ "node": ">= 0.4"
69
+ },
70
+ "auto-changelog": {
71
+ "output": "CHANGELOG.md",
72
+ "template": "keepachangelog",
73
+ "unreleased": false,
74
+ "commitLimit": false,
75
+ "backfillLimit": false,
76
+ "hideCredit": true
77
+ },
78
+ "publishConfig": {
79
+ "ignore": [
80
+ ".github/workflows"
81
+ ]
82
+ },
83
+ "testling": {
84
+ "files": "test/index.js"
85
+ }
86
+ }
@@ -0,0 +1,5 @@
1
+ import getAsyncFunction from './index.js';
2
+
3
+ export default getAsyncFunction;
4
+
5
+ export { getAsyncFunction as 'module.exports' };