@datadog/datadog-ci 5.12.0 → 5.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2904 @@
1
+ /// <reference types="node" />
2
+ import * as stream from "stream";
3
+ import { Duplex, Readable, Writable } from "stream";
4
+ import { URL as URL$1, URLSearchParams } from "node:url";
5
+ import { Duplex as Duplex$1, Readable as Readable$1, Writable as Writable$1 } from "node:stream";
6
+ import { EventEmitter } from "node:events";
7
+ import { Blob, File } from "node:buffer";
8
+ import { ConnectionOptions, TLSSocket } from "node:tls";
9
+ import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from "node:net";
10
+ import * as http from "http";
11
+ import http_, { OutgoingHttpHeaders } from "http";
12
+ import * as net from "net";
13
+ import * as tls from "tls";
14
+ import { ConnectionOptions as ConnectionOptions$1 } from "tls";
15
+ import https from "https";
16
+ import { Stats, createReadStream } from "fs";
17
+ import { Context } from "vm";
18
+
19
+ //#region \0rolldown/runtime.js
20
+ //#endregion
21
+ //#region ../../node_modules/typanion/lib/types.d.ts
22
+ declare type BoundCoercionFn = () => BoundCoercionFn;
23
+ declare type CoercionFn = (v: any) => BoundCoercionFn;
24
+ declare type Coercion = [string, BoundCoercionFn];
25
+ declare type LooseTest<U> = (value: U, test?: ValidationState) => boolean;
26
+ declare type ValidationState = {
27
+ p?: string;
28
+ errors?: string[];
29
+ coercions?: Coercion[];
30
+ coercion?: CoercionFn;
31
+ };
32
+ //#endregion
33
+ //#region ../../node_modules/clipanion/lib/core.d.ts
34
+ declare type StateMachine = {
35
+ nodes: Array<Node>;
36
+ };
37
+ declare type RunState = {
38
+ candidateUsage: string | null;
39
+ requiredOptions: Array<Array<string>>;
40
+ errorMessage: string | null;
41
+ ignoreOptions: boolean;
42
+ options: Array<{
43
+ name: string;
44
+ value: any;
45
+ }>;
46
+ path: Array<string>;
47
+ positionals: Array<{
48
+ value: string;
49
+ extra: boolean | typeof NoLimits;
50
+ }>;
51
+ remainder: string | null;
52
+ selectedIndex: number | null;
53
+ };
54
+ declare type Transition = {
55
+ to: number;
56
+ reducer?: Callback<keyof typeof reducers, typeof reducers>;
57
+ };
58
+ declare type Node = {
59
+ dynamics: Array<[Callback<keyof typeof tests, typeof tests>, Transition]>;
60
+ shortcuts: Array<Transition>;
61
+ statics: {
62
+ [segment: string]: Array<Transition>;
63
+ };
64
+ };
65
+ declare type UndefinedKeys<T> = { [P in keyof T]-?: undefined extends T[P] ? P : never }[keyof T];
66
+ declare type UndefinedTupleKeys<T extends Array<unknown>> = UndefinedKeys<Omit<T, keyof []>>;
67
+ declare type TupleKeys<T> = Exclude<keyof T, keyof []>;
68
+ declare type CallbackFn<P extends Array<any>, R> = (state: RunState, segment: string, ...args: P) => R;
69
+ declare type CallbackFnParameters<T extends CallbackFn<any, any>> = T extends ((state: RunState, segment: string, ...args: infer P) => any) ? P : never;
70
+ declare type CallbackStore<T extends string, R> = Record<T, CallbackFn<any, R>>;
71
+ declare type Callback<T extends string, S extends CallbackStore<T, any>> = [TupleKeys<CallbackFnParameters<S[T]>>] extends [UndefinedTupleKeys<CallbackFnParameters<S[T]>>] ? (T | [T, ...CallbackFnParameters<S[T]>]) : [T, ...CallbackFnParameters<S[T]>];
72
+ declare const tests: {
73
+ always: () => boolean;
74
+ isOptionLike: (state: RunState, segment: string) => boolean;
75
+ isNotOptionLike: (state: RunState, segment: string) => boolean;
76
+ isOption: (state: RunState, segment: string, name: string, hidden?: boolean) => boolean;
77
+ isBatchOption: (state: RunState, segment: string, names: Array<string>) => boolean;
78
+ isBoundOption: (state: RunState, segment: string, names: Array<string>, options: Array<OptDefinition>) => boolean;
79
+ isNegatedOption: (state: RunState, segment: string, name: string) => boolean;
80
+ isHelp: (state: RunState, segment: string) => boolean;
81
+ isUnsupportedOption: (state: RunState, segment: string, names: Array<string>) => boolean;
82
+ isInvalidOption: (state: RunState, segment: string) => boolean;
83
+ };
84
+ declare const reducers: {
85
+ setCandidateState: (state: RunState, segment: string, candidateState: Partial<RunState>) => {
86
+ candidateUsage: string | null;
87
+ requiredOptions: Array<Array<string>>;
88
+ errorMessage: string | null;
89
+ ignoreOptions: boolean;
90
+ options: Array<{
91
+ name: string;
92
+ value: any;
93
+ }>;
94
+ path: Array<string>;
95
+ positionals: Array<{
96
+ value: string;
97
+ extra: boolean | typeof NoLimits;
98
+ }>;
99
+ remainder: string | null;
100
+ selectedIndex: number | null;
101
+ };
102
+ setSelectedIndex: (state: RunState, segment: string, index: number) => {
103
+ selectedIndex: number;
104
+ candidateUsage: string | null;
105
+ requiredOptions: Array<Array<string>>;
106
+ errorMessage: string | null;
107
+ ignoreOptions: boolean;
108
+ options: Array<{
109
+ name: string;
110
+ value: any;
111
+ }>;
112
+ path: Array<string>;
113
+ positionals: Array<{
114
+ value: string;
115
+ extra: boolean | typeof NoLimits;
116
+ }>;
117
+ remainder: string | null;
118
+ };
119
+ pushBatch: (state: RunState, segment: string) => {
120
+ options: {
121
+ name: string;
122
+ value: any;
123
+ }[];
124
+ candidateUsage: string | null;
125
+ requiredOptions: Array<Array<string>>;
126
+ errorMessage: string | null;
127
+ ignoreOptions: boolean;
128
+ path: Array<string>;
129
+ positionals: Array<{
130
+ value: string;
131
+ extra: boolean | typeof NoLimits;
132
+ }>;
133
+ remainder: string | null;
134
+ selectedIndex: number | null;
135
+ };
136
+ pushBound: (state: RunState, segment: string) => {
137
+ options: {
138
+ name: string;
139
+ value: any;
140
+ }[];
141
+ candidateUsage: string | null;
142
+ requiredOptions: Array<Array<string>>;
143
+ errorMessage: string | null;
144
+ ignoreOptions: boolean;
145
+ path: Array<string>;
146
+ positionals: Array<{
147
+ value: string;
148
+ extra: boolean | typeof NoLimits;
149
+ }>;
150
+ remainder: string | null;
151
+ selectedIndex: number | null;
152
+ };
153
+ pushPath: (state: RunState, segment: string) => {
154
+ path: string[];
155
+ candidateUsage: string | null;
156
+ requiredOptions: Array<Array<string>>;
157
+ errorMessage: string | null;
158
+ ignoreOptions: boolean;
159
+ options: Array<{
160
+ name: string;
161
+ value: any;
162
+ }>;
163
+ positionals: Array<{
164
+ value: string;
165
+ extra: boolean | typeof NoLimits;
166
+ }>;
167
+ remainder: string | null;
168
+ selectedIndex: number | null;
169
+ };
170
+ pushPositional: (state: RunState, segment: string) => {
171
+ positionals: {
172
+ value: string;
173
+ extra: boolean | typeof NoLimits;
174
+ }[];
175
+ candidateUsage: string | null;
176
+ requiredOptions: Array<Array<string>>;
177
+ errorMessage: string | null;
178
+ ignoreOptions: boolean;
179
+ options: Array<{
180
+ name: string;
181
+ value: any;
182
+ }>;
183
+ path: Array<string>;
184
+ remainder: string | null;
185
+ selectedIndex: number | null;
186
+ };
187
+ pushExtra: (state: RunState, segment: string) => {
188
+ positionals: {
189
+ value: string;
190
+ extra: boolean | typeof NoLimits;
191
+ }[];
192
+ candidateUsage: string | null;
193
+ requiredOptions: Array<Array<string>>;
194
+ errorMessage: string | null;
195
+ ignoreOptions: boolean;
196
+ options: Array<{
197
+ name: string;
198
+ value: any;
199
+ }>;
200
+ path: Array<string>;
201
+ remainder: string | null;
202
+ selectedIndex: number | null;
203
+ };
204
+ pushExtraNoLimits: (state: RunState, segment: string) => {
205
+ positionals: {
206
+ value: string;
207
+ extra: boolean | typeof NoLimits;
208
+ }[];
209
+ candidateUsage: string | null;
210
+ requiredOptions: Array<Array<string>>;
211
+ errorMessage: string | null;
212
+ ignoreOptions: boolean;
213
+ options: Array<{
214
+ name: string;
215
+ value: any;
216
+ }>;
217
+ path: Array<string>;
218
+ remainder: string | null;
219
+ selectedIndex: number | null;
220
+ };
221
+ pushTrue: (state: RunState, segment: string, name?: string) => {
222
+ options: {
223
+ name: string;
224
+ value: any;
225
+ }[];
226
+ candidateUsage: string | null;
227
+ requiredOptions: Array<Array<string>>;
228
+ errorMessage: string | null;
229
+ ignoreOptions: boolean;
230
+ path: Array<string>;
231
+ positionals: Array<{
232
+ value: string;
233
+ extra: boolean | typeof NoLimits;
234
+ }>;
235
+ remainder: string | null;
236
+ selectedIndex: number | null;
237
+ };
238
+ pushFalse: (state: RunState, segment: string, name?: string) => {
239
+ options: {
240
+ name: string;
241
+ value: any;
242
+ }[];
243
+ candidateUsage: string | null;
244
+ requiredOptions: Array<Array<string>>;
245
+ errorMessage: string | null;
246
+ ignoreOptions: boolean;
247
+ path: Array<string>;
248
+ positionals: Array<{
249
+ value: string;
250
+ extra: boolean | typeof NoLimits;
251
+ }>;
252
+ remainder: string | null;
253
+ selectedIndex: number | null;
254
+ };
255
+ pushUndefined: (state: RunState, segment: string) => {
256
+ options: {
257
+ name: string;
258
+ value: any;
259
+ }[];
260
+ candidateUsage: string | null;
261
+ requiredOptions: Array<Array<string>>;
262
+ errorMessage: string | null;
263
+ ignoreOptions: boolean;
264
+ path: Array<string>;
265
+ positionals: Array<{
266
+ value: string;
267
+ extra: boolean | typeof NoLimits;
268
+ }>;
269
+ remainder: string | null;
270
+ selectedIndex: number | null;
271
+ };
272
+ pushStringValue: (state: RunState, segment: string) => {
273
+ options: {
274
+ name: string;
275
+ value: any;
276
+ }[];
277
+ candidateUsage: string | null;
278
+ requiredOptions: Array<Array<string>>;
279
+ errorMessage: string | null;
280
+ ignoreOptions: boolean;
281
+ path: Array<string>;
282
+ positionals: Array<{
283
+ value: string;
284
+ extra: boolean | typeof NoLimits;
285
+ }>;
286
+ remainder: string | null;
287
+ selectedIndex: number | null;
288
+ };
289
+ setStringValue: (state: RunState, segment: string) => {
290
+ options: {
291
+ name: string;
292
+ value: any;
293
+ }[];
294
+ candidateUsage: string | null;
295
+ requiredOptions: Array<Array<string>>;
296
+ errorMessage: string | null;
297
+ ignoreOptions: boolean;
298
+ path: Array<string>;
299
+ positionals: Array<{
300
+ value: string;
301
+ extra: boolean | typeof NoLimits;
302
+ }>;
303
+ remainder: string | null;
304
+ selectedIndex: number | null;
305
+ };
306
+ inhibateOptions: (state: RunState) => {
307
+ ignoreOptions: boolean;
308
+ candidateUsage: string | null;
309
+ requiredOptions: Array<Array<string>>;
310
+ errorMessage: string | null;
311
+ options: Array<{
312
+ name: string;
313
+ value: any;
314
+ }>;
315
+ path: Array<string>;
316
+ positionals: Array<{
317
+ value: string;
318
+ extra: boolean | typeof NoLimits;
319
+ }>;
320
+ remainder: string | null;
321
+ selectedIndex: number | null;
322
+ };
323
+ useHelp: (state: RunState, segment: string, command: number) => {
324
+ options: {
325
+ name: string;
326
+ value: string;
327
+ }[];
328
+ candidateUsage: string | null;
329
+ requiredOptions: Array<Array<string>>;
330
+ errorMessage: string | null;
331
+ ignoreOptions: boolean;
332
+ path: Array<string>;
333
+ positionals: Array<{
334
+ value: string;
335
+ extra: boolean | typeof NoLimits;
336
+ }>;
337
+ remainder: string | null;
338
+ selectedIndex: number | null;
339
+ };
340
+ setError: (state: RunState, segment: string, errorMessage: string) => {
341
+ errorMessage: string;
342
+ candidateUsage: string | null;
343
+ requiredOptions: Array<Array<string>>;
344
+ ignoreOptions: boolean;
345
+ options: Array<{
346
+ name: string;
347
+ value: any;
348
+ }>;
349
+ path: Array<string>;
350
+ positionals: Array<{
351
+ value: string;
352
+ extra: boolean | typeof NoLimits;
353
+ }>;
354
+ remainder: string | null;
355
+ selectedIndex: number | null;
356
+ };
357
+ setOptionArityError: (state: RunState, segment: string) => {
358
+ errorMessage: string;
359
+ candidateUsage: string | null;
360
+ requiredOptions: Array<Array<string>>;
361
+ ignoreOptions: boolean;
362
+ options: Array<{
363
+ name: string;
364
+ value: any;
365
+ }>;
366
+ path: Array<string>;
367
+ positionals: Array<{
368
+ value: string;
369
+ extra: boolean | typeof NoLimits;
370
+ }>;
371
+ remainder: string | null;
372
+ selectedIndex: number | null;
373
+ };
374
+ };
375
+ declare const NoLimits: unique symbol;
376
+ declare type ArityDefinition = {
377
+ leading: Array<string>;
378
+ extra: Array<string> | typeof NoLimits;
379
+ trailing: Array<string>;
380
+ proxy: boolean;
381
+ };
382
+ declare type OptDefinition = {
383
+ names: Array<string>;
384
+ description?: string;
385
+ arity: number;
386
+ hidden: boolean;
387
+ required: boolean;
388
+ allowBinding: boolean;
389
+ };
390
+ declare class CommandBuilder<Context> {
391
+ readonly cliIndex: number;
392
+ readonly cliOpts: Readonly<CliOptions$1>;
393
+ readonly allOptionNames: Array<string>;
394
+ readonly arity: ArityDefinition;
395
+ readonly options: Array<OptDefinition>;
396
+ readonly paths: Array<Array<string>>;
397
+ private context?;
398
+ constructor(cliIndex: number, cliOpts: CliOptions$1);
399
+ addPath(path: Array<string>): void;
400
+ setArity({
401
+ leading,
402
+ trailing,
403
+ extra,
404
+ proxy
405
+ }: Partial<ArityDefinition>): void;
406
+ addPositional({
407
+ name,
408
+ required
409
+ }?: {
410
+ name?: string;
411
+ required?: boolean;
412
+ }): void;
413
+ addRest({
414
+ name,
415
+ required
416
+ }?: {
417
+ name?: string;
418
+ required?: number;
419
+ }): void;
420
+ addProxy({
421
+ required
422
+ }?: {
423
+ name?: string;
424
+ required?: number;
425
+ }): void;
426
+ addOption({
427
+ names,
428
+ description,
429
+ arity,
430
+ hidden,
431
+ required,
432
+ allowBinding
433
+ }: Partial<OptDefinition> & {
434
+ names: Array<string>;
435
+ }): void;
436
+ setContext(context: Context): void;
437
+ usage({
438
+ detailed,
439
+ inlineOptions
440
+ }?: {
441
+ detailed?: boolean;
442
+ inlineOptions?: boolean;
443
+ }): {
444
+ usage: string;
445
+ options: {
446
+ definition: string;
447
+ description: string;
448
+ required: boolean;
449
+ }[];
450
+ };
451
+ compile(): {
452
+ machine: StateMachine;
453
+ context: Context;
454
+ };
455
+ private registerOptions;
456
+ }
457
+ declare type CliOptions$1 = {
458
+ binaryName: string;
459
+ };
460
+ //#endregion
461
+ //#region ../../node_modules/clipanion/lib/format.d.ts
462
+ interface ColorFormat {
463
+ header(str: string): string;
464
+ bold(str: string): string;
465
+ error(str: string): string;
466
+ code(str: string): string;
467
+ }
468
+ //#endregion
469
+ //#region ../../node_modules/clipanion/lib/advanced/options/utils.d.ts
470
+ declare const isOptionSymbol: unique symbol;
471
+ declare type CommandOption<T> = {
472
+ [isOptionSymbol]: true;
473
+ definition: <Context extends BaseContext>(builder: CommandBuilder<CliContext<Context>>, key: string) => void;
474
+ transformer: <Context extends BaseContext>(builder: CommandBuilder<CliContext<Context>>, key: string, state: RunState, context: Context) => T;
475
+ };
476
+ //#endregion
477
+ //#region ../../node_modules/clipanion/lib/advanced/Cli.d.ts
478
+ declare type MakeOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
479
+ declare type VoidIfEmpty<T> = keyof T extends never ? void : never;
480
+ /**
481
+ * The base context of the CLI.
482
+ *
483
+ * All Contexts have to extend it.
484
+ */
485
+ declare type BaseContext = {
486
+ /**
487
+ * Environment variables.
488
+ *
489
+ * @default
490
+ * process.env
491
+ */
492
+ env: Record<string, string | undefined>;
493
+ /**
494
+ * The input stream of the CLI.
495
+ *
496
+ * @default
497
+ * process.stdin
498
+ */
499
+ stdin: Readable;
500
+ /**
501
+ * The output stream of the CLI.
502
+ *
503
+ * @default
504
+ * process.stdout
505
+ */
506
+ stdout: Writable;
507
+ /**
508
+ * The error stream of the CLI.
509
+ *
510
+ * @default
511
+ * process.stderr
512
+ */
513
+ stderr: Writable;
514
+ /**
515
+ * Whether colors should be enabled.
516
+ */
517
+ colorDepth: number;
518
+ };
519
+ declare type CliContext<Context extends BaseContext> = {
520
+ commandClass: CommandClass<Context>;
521
+ };
522
+ declare type RunCommand<Context extends BaseContext = BaseContext> = Array<CommandClass<Context>> | CommandClass<Context>;
523
+ declare type CliOptions = Readonly<{
524
+ /**
525
+ * The label of the binary.
526
+ *
527
+ * Shown at the top of the usage information.
528
+ */
529
+ binaryLabel?: string;
530
+ /**
531
+ * The name of the binary.
532
+ *
533
+ * Included in the path and the examples of the definitions.
534
+ */
535
+ binaryName: string;
536
+ /**
537
+ * The version of the binary.
538
+ *
539
+ * Shown at the top of the usage information.
540
+ */
541
+ binaryVersion?: string;
542
+ /**
543
+ * If `true`, the Cli will hook into the process standard streams to catch
544
+ * the output produced by console.log and redirect them into the context
545
+ * streams. Note: stdin isn't captured at the moment.
546
+ *
547
+ * @default
548
+ * false
549
+ */
550
+ enableCapture: boolean;
551
+ /**
552
+ * If `true`, the Cli will use colors in the output. If `false`, it won't.
553
+ * If `undefined`, Clipanion will infer the correct value from the env.
554
+ */
555
+ enableColors?: boolean;
556
+ }>;
557
+ declare type MiniCli<Context extends BaseContext> = CliOptions & {
558
+ /**
559
+ * Returns an Array representing the definitions of all registered commands.
560
+ */
561
+ definitions(): Array<Definition>;
562
+ /**
563
+ * Formats errors using colors.
564
+ *
565
+ * @param error The error to format. If `error.name` is `'Error'`, it is replaced with `'Internal Error'`.
566
+ * @param opts.command The command whose usage will be included in the formatted error.
567
+ */
568
+ error(error: Error, opts?: {
569
+ command?: Command<Context> | null;
570
+ }): string;
571
+ /**
572
+ * Returns a rich color format if colors are enabled, or a plain text format otherwise.
573
+ *
574
+ * @param colored Forcefully enable or disable colors.
575
+ */
576
+ format(colored?: boolean): ColorFormat;
577
+ /**
578
+ * Compiles a command and its arguments using the `CommandBuilder`.
579
+ *
580
+ * @param input An array containing the name of the command and its arguments
581
+ *
582
+ * @returns The compiled `Command`, with its properties populated with the arguments.
583
+ */
584
+ process(input: Array<string>, context?: Partial<Context>): Command<Context>;
585
+ /**
586
+ * Runs a command.
587
+ *
588
+ * @param input An array containing the name of the command and its arguments
589
+ * @param context Overrides the Context of the main `Cli` instance
590
+ *
591
+ * @returns The exit code of the command
592
+ */
593
+ run(input: Array<string>, context?: Partial<Context>): Promise<number>;
594
+ /**
595
+ * Returns the usage of a command.
596
+ *
597
+ * @param command The `Command` whose usage will be returned or `null` to return the usage of all commands.
598
+ * @param opts.detailed If `true`, the usage of a command will also include its description, details, and examples. Doesn't have any effect if `command` is `null` or doesn't have a `usage` property.
599
+ * @param opts.prefix The prefix displayed before each command. Defaults to `$`.
600
+ */
601
+ usage(command?: CommandClass<Context> | Command<Context> | null, opts?: {
602
+ detailed?: boolean;
603
+ prefix?: string;
604
+ }): string;
605
+ };
606
+ /**
607
+ * @template Context The context shared by all commands. Contexts are a set of values, defined when calling the `run`/`runExit` functions from the CLI instance, that will be made available to the commands via `this.context`.
608
+ */
609
+ declare class Cli<Context extends BaseContext = BaseContext> implements Omit<MiniCli<Context>, `process` | `run`> {
610
+ /**
611
+ * The default context of the CLI.
612
+ *
613
+ * Contains the stdio of the current `process`.
614
+ */
615
+ static defaultContext: {
616
+ env: NodeJS.ProcessEnv;
617
+ stdin: NodeJS.ReadStream & {
618
+ fd: 0;
619
+ };
620
+ stdout: NodeJS.WriteStream & {
621
+ fd: 1;
622
+ };
623
+ stderr: NodeJS.WriteStream & {
624
+ fd: 2;
625
+ };
626
+ colorDepth: number;
627
+ };
628
+ private readonly builder;
629
+ protected readonly registrations: Map<CommandClass<Context>, {
630
+ index: number;
631
+ builder: CommandBuilder<CliContext<Context>>;
632
+ specs: Map<string, CommandOption<unknown>>;
633
+ }>;
634
+ readonly binaryLabel?: string;
635
+ readonly binaryName: string;
636
+ readonly binaryVersion?: string;
637
+ readonly enableCapture: boolean;
638
+ readonly enableColors?: boolean;
639
+ /**
640
+ * Creates a new Cli and registers all commands passed as parameters.
641
+ *
642
+ * @param commandClasses The Commands to register
643
+ * @returns The created `Cli` instance
644
+ */
645
+ static from<Context extends BaseContext = BaseContext>(commandClasses: RunCommand<Context>, options?: Partial<CliOptions>): Cli<Context>;
646
+ constructor({
647
+ binaryLabel,
648
+ binaryName: binaryNameOpt,
649
+ binaryVersion,
650
+ enableCapture,
651
+ enableColors
652
+ }?: Partial<CliOptions>);
653
+ /**
654
+ * Registers a command inside the CLI.
655
+ */
656
+ register(commandClass: CommandClass<Context>): void;
657
+ process(input: Array<string>, context: VoidIfEmpty<Omit<Context, keyof BaseContext>>): Command<Context>;
658
+ process(input: Array<string>, context: MakeOptional<Context, keyof BaseContext>): Command<Context>;
659
+ run(input: Command<Context> | Array<string>, context: VoidIfEmpty<Omit<Context, keyof BaseContext>>): Promise<number>;
660
+ run(input: Command<Context> | Array<string>, context: MakeOptional<Context, keyof BaseContext>): Promise<number>;
661
+ /**
662
+ * Runs a command and exits the current `process` with the exit code returned by the command.
663
+ *
664
+ * @param input An array containing the name of the command and its arguments.
665
+ *
666
+ * @example
667
+ * cli.runExit(process.argv.slice(2))
668
+ */
669
+ runExit(input: Command<Context> | Array<string>, context: VoidIfEmpty<Omit<Context, keyof BaseContext>>): Promise<void>;
670
+ runExit(input: Command<Context> | Array<string>, context: MakeOptional<Context, keyof BaseContext>): Promise<void>;
671
+ suggest(input: Array<string>, partial: boolean): string[][];
672
+ definitions({
673
+ colored
674
+ }?: {
675
+ colored?: boolean;
676
+ }): Array<Definition>;
677
+ usage(command?: CommandClass<Context> | Command<Context> | null, {
678
+ colored,
679
+ detailed,
680
+ prefix
681
+ }?: {
682
+ colored?: boolean;
683
+ detailed?: boolean;
684
+ prefix?: string;
685
+ }): string;
686
+ error(error: Error | any, {
687
+ colored,
688
+ command
689
+ }?: {
690
+ colored?: boolean;
691
+ command?: Command<Context> | null;
692
+ }): string;
693
+ format(colored?: boolean): ColorFormat;
694
+ protected getUsageByRegistration(klass: CommandClass<Context>, opts?: {
695
+ detailed?: boolean;
696
+ inlineOptions?: boolean;
697
+ }): {
698
+ usage: string;
699
+ options: {
700
+ definition: string;
701
+ description: string;
702
+ required: boolean;
703
+ }[];
704
+ };
705
+ protected getUsageByIndex(n: number, opts?: {
706
+ detailed?: boolean;
707
+ inlineOptions?: boolean;
708
+ }): {
709
+ usage: string;
710
+ options: {
711
+ definition: string;
712
+ description: string;
713
+ required: boolean;
714
+ }[];
715
+ };
716
+ }
717
+ //#endregion
718
+ //#region ../../node_modules/clipanion/lib/advanced/Command.d.ts
719
+ /**
720
+ * The usage of a Command.
721
+ */
722
+ declare type Usage = {
723
+ /**
724
+ * The category of the command.
725
+ *
726
+ * Included in the detailed usage.
727
+ */
728
+ category?: string;
729
+ /**
730
+ * The short description of the command, formatted as Markdown.
731
+ *
732
+ * Included in the detailed usage.
733
+ */
734
+ description?: string;
735
+ /**
736
+ * The extended details of the command, formatted as Markdown.
737
+ *
738
+ * Included in the detailed usage.
739
+ */
740
+ details?: string;
741
+ /**
742
+ * Examples of the command represented as an Array of tuples.
743
+ *
744
+ * The first element of the tuple represents the description of the example.
745
+ *
746
+ * The second element of the tuple represents the command of the example.
747
+ * If present, the leading `$0` is replaced with `cli.binaryName`.
748
+ */
749
+ examples?: Array<[string, string]>;
750
+ };
751
+ /**
752
+ * The definition of a Command.
753
+ */
754
+ declare type Definition = Usage & {
755
+ /**
756
+ * The path of the command, starting with `cli.binaryName`.
757
+ */
758
+ path: string;
759
+ /**
760
+ * The detailed usage of the command.
761
+ */
762
+ usage: string;
763
+ /**
764
+ * The various options registered on the command.
765
+ */
766
+ options: Array<{
767
+ definition: string;
768
+ description?: string;
769
+ required: boolean;
770
+ }>;
771
+ };
772
+ declare type CommandClass<Context extends BaseContext = BaseContext> = {
773
+ new (): Command<Context>;
774
+ paths?: Array<Array<string>>;
775
+ schema?: Array<LooseTest<{
776
+ [key: string]: unknown;
777
+ }>>;
778
+ usage?: Usage;
779
+ };
780
+ /**
781
+ * Base abstract class for CLI commands. The main thing to remember is to
782
+ * declare an async `execute` member function that will be called when the
783
+ * command is invoked from the CLI, and optionally a `paths` property to
784
+ * declare the set of paths under which the command should be exposed.
785
+ */
786
+ declare abstract class Command<Context extends BaseContext = BaseContext> {
787
+ /**
788
+ * @deprecated Do not use this; prefer the static `paths` property instead.
789
+ */
790
+ paths?: undefined;
791
+ /**
792
+ * Defined to prevent a common typo.
793
+ */
794
+ static path: never;
795
+ /**
796
+ * Paths under which the command should be exposed.
797
+ */
798
+ static paths?: Array<Array<string>>;
799
+ /**
800
+ * Defines the usage information for the given command.
801
+ */
802
+ static Usage(usage: Usage): Usage;
803
+ /**
804
+ * Contains the usage information for the command. If undefined, the
805
+ * command will be hidden from the general listing.
806
+ */
807
+ static usage?: Usage;
808
+ /**
809
+ * Defines a schema to apply before running the `execute` method. The
810
+ * schema is expected to be generated by Typanion.
811
+ *
812
+ * @see https://github.com/arcanis/typanion
813
+ */
814
+ static schema?: Array<LooseTest<{
815
+ [key: string]: unknown;
816
+ }>>;
817
+ /**
818
+ * Standard function that'll get executed by `Cli#run` and `Cli#runExit`.
819
+ *
820
+ * Expected to return an exit code or nothing (which Clipanion will treat
821
+ * as if 0 had been returned).
822
+ */
823
+ abstract execute(): Promise<number | void>;
824
+ /**
825
+ * Standard error handler which will simply rethrow the error. Can be used
826
+ * to add custom logic to handle errors from the command or simply return
827
+ * the parent class error handling.
828
+ */
829
+ catch(error: any): Promise<void>;
830
+ /**
831
+ * Predefined that will be set to true if `-h,--help` has been used, in
832
+ * which case `Command#execute` won't be called.
833
+ */
834
+ help: boolean;
835
+ /**
836
+ * Predefined variable that will be populated with a miniature API that can
837
+ * be used to query Clipanion and forward commands.
838
+ */
839
+ cli: MiniCli<Context>;
840
+ /**
841
+ * Predefined variable that will be populated with the context of the
842
+ * application.
843
+ */
844
+ context: Context;
845
+ /**
846
+ * Predefined variable that will be populated with the path that got used
847
+ * to access the command currently being executed.
848
+ */
849
+ path: Array<string>;
850
+ validateAndExecute(): Promise<number>;
851
+ /**
852
+ * Used to detect option definitions.
853
+ */
854
+ static isOption: typeof isOptionSymbol;
855
+ /**
856
+ * Just an helper to use along with the `paths` fields, to make it
857
+ * clearer that a command is the default one.
858
+ *
859
+ * @example
860
+ * class MyCommand extends Command {
861
+ * static paths = [Command.Default];
862
+ * }
863
+ */
864
+ static Default: never[];
865
+ }
866
+ //#endregion
867
+ //#region ../base/dist/index.d.ts
868
+ type CommandContext = BaseContext & {
869
+ builtinPlugins: string[];
870
+ };
871
+ //#endregion
872
+ //#region ../base/dist/helpers/apikey.d.ts
873
+ /** ApiKeyValidator is an helper interface to interpret Datadog error responses and possibly check the
874
+ * validity of the api key.
875
+ */
876
+ interface ApiKeyValidator {
877
+ verifyApiKey(error: unknown): Promise<void>;
878
+ validateApiKey(): Promise<boolean>;
879
+ }
880
+ //#endregion
881
+ //#region ../../node_modules/undici/types/utility.d.ts
882
+ type AutocompletePrimitiveBaseType<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : never;
883
+ type Autocomplete<T> = T | (AutocompletePrimitiveBaseType<T> & Record<never, never>);
884
+ //#endregion
885
+ //#region ../../node_modules/undici/types/header.d.ts
886
+ /**
887
+ * The header type declaration of `undici`.
888
+ */
889
+ type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
890
+ type HeaderNames = Autocomplete<'Accept' | 'Accept-CH' | 'Accept-Charset' | 'Accept-Encoding' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Age' | 'Allow' | 'Alt-Svc' | 'Alt-Used' | 'Authorization' | 'Cache-Control' | 'Clear-Site-Data' | 'Connection' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'Device-Memory' | 'ETag' | 'Expect' | 'Expect-CT' | 'Expires' | 'Forwarded' | 'From' | 'Host' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Unmodified-Since' | 'Keep-Alive' | 'Last-Modified' | 'Link' | 'Location' | 'Max-Forwards' | 'Origin' | 'Permissions-Policy' | 'Priority' | 'Proxy-Authenticate' | 'Proxy-Authorization' | 'Range' | 'Referer' | 'Referrer-Policy' | 'Retry-After' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-Purpose' | 'Sec-WebSocket-Accept' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'SourceMap' | 'Strict-Transport-Security' | 'TE' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Upgrade-Insecure-Requests' | 'User-Agent' | 'Vary' | 'Via' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-Frame-Options'>;
891
+ type IANARegisteredMimeType = Autocomplete<'audio/aac' | 'video/x-msvideo' | 'image/avif' | 'video/av1' | 'application/octet-stream' | 'image/bmp' | 'text/css' | 'text/csv' | 'application/vnd.ms-fontobject' | 'application/epub+zip' | 'image/gif' | 'application/gzip' | 'text/html' | 'image/x-icon' | 'text/calendar' | 'image/jpeg' | 'text/javascript' | 'application/json' | 'application/ld+json' | 'audio/x-midi' | 'audio/mpeg' | 'video/mp4' | 'video/mpeg' | 'audio/ogg' | 'video/ogg' | 'application/ogg' | 'audio/opus' | 'font/otf' | 'application/pdf' | 'image/png' | 'application/rtf' | 'image/svg+xml' | 'image/tiff' | 'video/mp2t' | 'font/ttf' | 'text/plain' | 'application/wasm' | 'video/webm' | 'audio/webm' | 'image/webp' | 'font/woff' | 'font/woff2' | 'application/xhtml+xml' | 'application/xml' | 'application/zip' | 'video/3gpp' | 'video/3gpp2' | 'model/gltf+json' | 'model/gltf-binary'>;
892
+ type KnownHeaderValues = {
893
+ 'content-type': IANARegisteredMimeType;
894
+ };
895
+ type HeaderRecord = { [K in HeaderNames | Lowercase<HeaderNames>]?: Lowercase<K> extends keyof KnownHeaderValues ? KnownHeaderValues[Lowercase<K>] : string };
896
+ //#endregion
897
+ //#region ../../node_modules/undici/types/readable.d.ts
898
+ declare class BodyReadable extends Readable$1 {
899
+ constructor(opts: {
900
+ resume: (this: Readable$1, size: number) => void | null;
901
+ abort: () => void | null;
902
+ contentType?: string;
903
+ contentLength?: number;
904
+ highWaterMark?: number;
905
+ });
906
+ /** Consumes and returns the body as a string
907
+ * https://fetch.spec.whatwg.org/#dom-body-text
908
+ */
909
+ text(): Promise<string>;
910
+ /** Consumes and returns the body as a JavaScript Object
911
+ * https://fetch.spec.whatwg.org/#dom-body-json
912
+ */
913
+ json(): Promise<unknown>;
914
+ /** Consumes and returns the body as a Blob
915
+ * https://fetch.spec.whatwg.org/#dom-body-blob
916
+ */
917
+ blob(): Promise<Blob>;
918
+ /** Consumes and returns the body as an Uint8Array
919
+ * https://fetch.spec.whatwg.org/#dom-body-bytes
920
+ */
921
+ bytes(): Promise<Uint8Array>;
922
+ /** Consumes and returns the body as an ArrayBuffer
923
+ * https://fetch.spec.whatwg.org/#dom-body-arraybuffer
924
+ */
925
+ arrayBuffer(): Promise<ArrayBuffer>;
926
+ /** Not implemented
927
+ *
928
+ * https://fetch.spec.whatwg.org/#dom-body-formdata
929
+ */
930
+ formData(): Promise<never>;
931
+ /** Returns true if the body is not null and the body has been consumed
932
+ *
933
+ * Otherwise, returns false
934
+ *
935
+ * https://fetch.spec.whatwg.org/#dom-body-bodyused
936
+ */
937
+ readonly bodyUsed: boolean;
938
+ /**
939
+ * If body is null, it should return null as the body
940
+ *
941
+ * If body is not null, should return the body as a ReadableStream
942
+ *
943
+ * https://fetch.spec.whatwg.org/#dom-body-body
944
+ */
945
+ readonly body: never | undefined;
946
+ /** Dumps the response body by reading `limit` number of bytes.
947
+ * @param opts.limit Number of bytes to read (optional) - Default: 131072
948
+ * @param opts.signal AbortSignal to cancel the operation (optional)
949
+ */
950
+ dump(opts?: {
951
+ limit: number;
952
+ signal?: AbortSignal;
953
+ }): Promise<void>;
954
+ }
955
+ //#endregion
956
+ //#region ../../node_modules/undici/types/fetch.d.ts
957
+ type BodyInit = ArrayBuffer | AsyncIterable<Uint8Array> | Blob | FormData$1 | Iterable<Uint8Array> | NodeJS.ArrayBufferView | URLSearchParams | null | string;
958
+ interface SpecIterator<T, TReturn = any, TNext = undefined> {
959
+ next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
960
+ }
961
+ interface SpecIterableIterator<T> extends SpecIterator<T> {
962
+ [Symbol.iterator](): SpecIterableIterator<T>;
963
+ }
964
+ interface SpecIterable<T> {
965
+ [Symbol.iterator](): SpecIterator<T>;
966
+ }
967
+ type HeadersInit = [string, string][] | HeaderRecord | Headers$1;
968
+ declare class Headers$1 implements SpecIterable<[string, string]> {
969
+ constructor(init?: HeadersInit);
970
+ readonly append: (name: string, value: string) => void;
971
+ readonly delete: (name: string) => void;
972
+ readonly get: (name: string) => string | null;
973
+ readonly has: (name: string) => boolean;
974
+ readonly set: (name: string, value: string) => void;
975
+ readonly getSetCookie: () => string[];
976
+ readonly forEach: (callbackfn: (value: string, key: string, iterable: Headers$1) => void, thisArg?: unknown) => void;
977
+ readonly keys: () => SpecIterableIterator<string>;
978
+ readonly values: () => SpecIterableIterator<string>;
979
+ readonly entries: () => SpecIterableIterator<[string, string]>;
980
+ readonly [Symbol.iterator]: () => SpecIterableIterator<[string, string]>;
981
+ }
982
+ //#endregion
983
+ //#region ../../node_modules/undici/types/formdata.d.ts
984
+ /**
985
+ * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
986
+ */
987
+ declare type FormDataEntryValue = string | File;
988
+ /**
989
+ * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
990
+ */
991
+ declare class FormData$1 {
992
+ /**
993
+ * Appends a new value onto an existing key inside a FormData object,
994
+ * or adds the key if it does not already exist.
995
+ *
996
+ * The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values.
997
+ *
998
+ * @param name The name of the field whose data is contained in `value`.
999
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
1000
+ or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
1001
+ * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
1002
+ */
1003
+ append(name: string, value: unknown, fileName?: string): void;
1004
+ /**
1005
+ * Set a new value for an existing key inside FormData,
1006
+ * or add the new field if it does not already exist.
1007
+ *
1008
+ * @param name The name of the field whose data is contained in `value`.
1009
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
1010
+ or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
1011
+ * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
1012
+ *
1013
+ */
1014
+ set(name: string, value: unknown, fileName?: string): void;
1015
+ /**
1016
+ * Returns the first value associated with a given key from within a `FormData` object.
1017
+ * If you expect multiple values and want all of them, use the `getAll()` method instead.
1018
+ *
1019
+ * @param {string} name A name of the value you want to retrieve.
1020
+ *
1021
+ * @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
1022
+ */
1023
+ get(name: string): FormDataEntryValue | null;
1024
+ /**
1025
+ * Returns all the values associated with a given key from within a `FormData` object.
1026
+ *
1027
+ * @param {string} name A name of the value you want to retrieve.
1028
+ *
1029
+ * @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
1030
+ */
1031
+ getAll(name: string): FormDataEntryValue[];
1032
+ /**
1033
+ * Returns a boolean stating whether a `FormData` object contains a certain key.
1034
+ *
1035
+ * @param name A string representing the name of the key you want to test for.
1036
+ *
1037
+ * @return A boolean value.
1038
+ */
1039
+ has(name: string): boolean;
1040
+ /**
1041
+ * Deletes a key and its value(s) from a `FormData` object.
1042
+ *
1043
+ * @param name The name of the key you want to delete.
1044
+ */
1045
+ delete(name: string): void;
1046
+ /**
1047
+ * Executes given callback function for each field of the FormData instance
1048
+ */
1049
+ forEach: (callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData$1) => void, thisArg?: unknown) => void;
1050
+ /**
1051
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object.
1052
+ * Each key is a `string`.
1053
+ */
1054
+ keys: () => SpecIterableIterator<string>;
1055
+ /**
1056
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object.
1057
+ * Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
1058
+ */
1059
+ values: () => SpecIterableIterator<FormDataEntryValue>;
1060
+ /**
1061
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
1062
+ * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
1063
+ */
1064
+ entries: () => SpecIterableIterator<[string, FormDataEntryValue]>;
1065
+ /**
1066
+ * An alias for FormData#entries()
1067
+ */
1068
+ [Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>;
1069
+ readonly [Symbol.toStringTag]: string;
1070
+ }
1071
+ //#endregion
1072
+ //#region ../../node_modules/undici/types/connector.d.ts
1073
+ declare function buildConnector(options?: buildConnector.BuildOptions): buildConnector.connector;
1074
+ declare namespace buildConnector {
1075
+ export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
1076
+ allowH2?: boolean;
1077
+ maxCachedSessions?: number | null;
1078
+ socketPath?: string | null;
1079
+ timeout?: number | null;
1080
+ port?: number;
1081
+ keepAlive?: boolean | null;
1082
+ keepAliveInitialDelay?: number | null;
1083
+ typeOfService?: number | null;
1084
+ };
1085
+ export interface Options {
1086
+ hostname: string;
1087
+ host?: string;
1088
+ protocol: string;
1089
+ port: string;
1090
+ servername?: string;
1091
+ localAddress?: string | null;
1092
+ socketPath?: string | null;
1093
+ httpSocket?: Socket;
1094
+ }
1095
+ export type Callback = (...args: CallbackArgs) => void;
1096
+ type CallbackArgs = [null, Socket | TLSSocket] | [Error, null];
1097
+ export interface connector {
1098
+ (options: buildConnector.Options, callback: buildConnector.Callback): void;
1099
+ }
1100
+ }
1101
+ //#endregion
1102
+ //#region ../../node_modules/undici/types/client-stats.d.ts
1103
+ declare class ClientStats {
1104
+ constructor(pool: Client);
1105
+ /** If socket has open connection. */
1106
+ connected: boolean;
1107
+ /** Number of open socket connections in this client that do not have an active request. */
1108
+ pending: number;
1109
+ /** Number of currently active requests of this client. */
1110
+ running: number;
1111
+ /** Number of active, pending, or queued requests of this client. */
1112
+ size: number;
1113
+ }
1114
+ //#endregion
1115
+ //#region ../../node_modules/undici/types/client.d.ts
1116
+ type ClientConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>;
1117
+ /**
1118
+ * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
1119
+ */
1120
+ declare class Client extends Dispatcher {
1121
+ constructor(url: string | URL$1, options?: Client.Options);
1122
+ /** Property to get and set the pipelining factor. */
1123
+ pipelining: number;
1124
+ /** `true` after `client.close()` has been called. */
1125
+ closed: boolean;
1126
+ /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
1127
+ destroyed: boolean;
1128
+ /** Aggregate stats for a Client. */
1129
+ readonly stats: ClientStats; // Override dispatcher APIs.
1130
+ override connect(options: ClientConnectOptions): Promise<Dispatcher.ConnectData>;
1131
+ override connect(options: ClientConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
1132
+ }
1133
+ declare namespace Client {
1134
+ export interface OptionsInterceptors {
1135
+ Client: readonly Dispatcher.DispatchInterceptor[];
1136
+ }
1137
+ export interface Options {
1138
+ /** TODO */
1139
+ interceptors?: OptionsInterceptors;
1140
+ /** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
1141
+ maxHeaderSize?: number;
1142
+ /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
1143
+ headersTimeout?: number;
1144
+ /** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */
1145
+ socketTimeout?: never;
1146
+ /** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
1147
+ requestTimeout?: never;
1148
+ /** TODO */
1149
+ connectTimeout?: number;
1150
+ /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
1151
+ bodyTimeout?: number;
1152
+ /** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */
1153
+ idleTimeout?: never;
1154
+ /** @deprecated unsupported keepAlive, use pipelining=0 instead */
1155
+ keepAlive?: never;
1156
+ /** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
1157
+ keepAliveTimeout?: number;
1158
+ /** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */
1159
+ maxKeepAliveTimeout?: never;
1160
+ /** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
1161
+ keepAliveMaxTimeout?: number;
1162
+ /** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
1163
+ keepAliveTimeoutThreshold?: number;
1164
+ /** TODO */
1165
+ socketPath?: string;
1166
+ /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
1167
+ pipelining?: number;
1168
+ /** @deprecated use the connect option instead */
1169
+ tls?: never;
1170
+ /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
1171
+ strictContentLength?: boolean;
1172
+ /** TODO */
1173
+ maxCachedSessions?: number;
1174
+ /** TODO */
1175
+ connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
1176
+ /** TODO */
1177
+ maxRequestsPerClient?: number;
1178
+ /** TODO */
1179
+ localAddress?: string;
1180
+ /** Max response body size in bytes, -1 is disabled */
1181
+ maxResponseSize?: number;
1182
+ /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
1183
+ autoSelectFamily?: boolean;
1184
+ /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
1185
+ autoSelectFamilyAttemptTimeout?: number;
1186
+ /**
1187
+ * @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
1188
+ * @default false
1189
+ */
1190
+ allowH2?: boolean;
1191
+ /**
1192
+ * @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
1193
+ * @default 100
1194
+ */
1195
+ maxConcurrentStreams?: number;
1196
+ /**
1197
+ * @description Sets the HTTP/2 stream-level flow-control window size (SETTINGS_INITIAL_WINDOW_SIZE).
1198
+ * @default 262144
1199
+ */
1200
+ initialWindowSize?: number;
1201
+ /**
1202
+ * @description Sets the HTTP/2 connection-level flow-control window size (ClientHttp2Session.setLocalWindowSize).
1203
+ * @default 524288
1204
+ */
1205
+ connectionWindowSize?: number;
1206
+ /**
1207
+ * @description Time interval between PING frames dispatch
1208
+ * @default 60000
1209
+ */
1210
+ pingInterval?: number;
1211
+ }
1212
+ export interface SocketInfo {
1213
+ localAddress?: string;
1214
+ localPort?: number;
1215
+ remoteAddress?: string;
1216
+ remotePort?: number;
1217
+ remoteFamily?: string;
1218
+ timeout?: number;
1219
+ bytesWritten?: number;
1220
+ bytesRead?: number;
1221
+ }
1222
+ }
1223
+ //#endregion
1224
+ //#region ../../node_modules/undici/types/errors.d.ts
1225
+ declare namespace Errors {
1226
+ export class UndiciError extends Error {
1227
+ name: string;
1228
+ code: string;
1229
+ }
1230
+ /** Connect timeout error. */
1231
+ export class ConnectTimeoutError extends UndiciError {
1232
+ name: 'ConnectTimeoutError';
1233
+ code: 'UND_ERR_CONNECT_TIMEOUT';
1234
+ }
1235
+ /** A header exceeds the `headersTimeout` option. */
1236
+ export class HeadersTimeoutError extends UndiciError {
1237
+ name: 'HeadersTimeoutError';
1238
+ code: 'UND_ERR_HEADERS_TIMEOUT';
1239
+ }
1240
+ /** Headers overflow error. */
1241
+ export class HeadersOverflowError extends UndiciError {
1242
+ name: 'HeadersOverflowError';
1243
+ code: 'UND_ERR_HEADERS_OVERFLOW';
1244
+ }
1245
+ /** A body exceeds the `bodyTimeout` option. */
1246
+ export class BodyTimeoutError extends UndiciError {
1247
+ name: 'BodyTimeoutError';
1248
+ code: 'UND_ERR_BODY_TIMEOUT';
1249
+ }
1250
+ export class ResponseError extends UndiciError {
1251
+ constructor(message: string, code: number, options: {
1252
+ headers?: IncomingHttpHeaders | string[] | null;
1253
+ body?: null | Record<string, any> | string;
1254
+ });
1255
+ name: 'ResponseError';
1256
+ code: 'UND_ERR_RESPONSE';
1257
+ statusCode: number;
1258
+ body: null | Record<string, any> | string;
1259
+ headers: IncomingHttpHeaders | string[] | null;
1260
+ }
1261
+ /** Passed an invalid argument. */
1262
+ export class InvalidArgumentError extends UndiciError {
1263
+ name: 'InvalidArgumentError';
1264
+ code: 'UND_ERR_INVALID_ARG';
1265
+ }
1266
+ /** Returned an invalid value. */
1267
+ export class InvalidReturnValueError extends UndiciError {
1268
+ name: 'InvalidReturnValueError';
1269
+ code: 'UND_ERR_INVALID_RETURN_VALUE';
1270
+ }
1271
+ /** The request has been aborted by the user. */
1272
+ export class RequestAbortedError extends UndiciError {
1273
+ name: 'AbortError';
1274
+ code: 'UND_ERR_ABORTED';
1275
+ }
1276
+ /** Expected error with reason. */
1277
+ export class InformationalError extends UndiciError {
1278
+ name: 'InformationalError';
1279
+ code: 'UND_ERR_INFO';
1280
+ }
1281
+ /** Request body length does not match content-length header. */
1282
+ export class RequestContentLengthMismatchError extends UndiciError {
1283
+ name: 'RequestContentLengthMismatchError';
1284
+ code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
1285
+ }
1286
+ /** Response body length does not match content-length header. */
1287
+ export class ResponseContentLengthMismatchError extends UndiciError {
1288
+ name: 'ResponseContentLengthMismatchError';
1289
+ code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
1290
+ }
1291
+ /** Trying to use a destroyed client. */
1292
+ export class ClientDestroyedError extends UndiciError {
1293
+ name: 'ClientDestroyedError';
1294
+ code: 'UND_ERR_DESTROYED';
1295
+ }
1296
+ /** Trying to use a closed client. */
1297
+ export class ClientClosedError extends UndiciError {
1298
+ name: 'ClientClosedError';
1299
+ code: 'UND_ERR_CLOSED';
1300
+ }
1301
+ /** There is an error with the socket. */
1302
+ export class SocketError extends UndiciError {
1303
+ name: 'SocketError';
1304
+ code: 'UND_ERR_SOCKET';
1305
+ socket: Client.SocketInfo | null;
1306
+ }
1307
+ /** Encountered unsupported functionality. */
1308
+ export class NotSupportedError extends UndiciError {
1309
+ name: 'NotSupportedError';
1310
+ code: 'UND_ERR_NOT_SUPPORTED';
1311
+ }
1312
+ /** No upstream has been added to the BalancedPool. */
1313
+ export class BalancedPoolMissingUpstreamError extends UndiciError {
1314
+ name: 'MissingUpstreamError';
1315
+ code: 'UND_ERR_BPL_MISSING_UPSTREAM';
1316
+ }
1317
+ export class HTTPParserError extends UndiciError {
1318
+ name: 'HTTPParserError';
1319
+ code: string;
1320
+ }
1321
+ /** The response exceed the length allowed. */
1322
+ export class ResponseExceededMaxSizeError extends UndiciError {
1323
+ name: 'ResponseExceededMaxSizeError';
1324
+ code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
1325
+ }
1326
+ export class RequestRetryError extends UndiciError {
1327
+ constructor(message: string, statusCode: number, headers?: IncomingHttpHeaders | string[] | null, body?: null | Record<string, any> | string);
1328
+ name: 'RequestRetryError';
1329
+ code: 'UND_ERR_REQ_RETRY';
1330
+ statusCode: number;
1331
+ data: {
1332
+ count: number;
1333
+ };
1334
+ headers: Record<string, string | string[]>;
1335
+ }
1336
+ export class SecureProxyConnectionError extends UndiciError {
1337
+ constructor(cause?: Error, message?: string, options?: Record<any, any>);
1338
+ name: 'SecureProxyConnectionError';
1339
+ code: 'UND_ERR_PRX_TLS';
1340
+ }
1341
+ export class MaxOriginsReachedError extends UndiciError {
1342
+ name: 'MaxOriginsReachedError';
1343
+ code: 'UND_ERR_MAX_ORIGINS_REACHED';
1344
+ }
1345
+ /** SOCKS5 proxy related error. */
1346
+ export class Socks5ProxyError extends UndiciError {
1347
+ constructor(message?: string, code?: string);
1348
+ name: 'Socks5ProxyError';
1349
+ code: string;
1350
+ }
1351
+ /** WebSocket decompressed message exceeded maximum size. */
1352
+ export class MessageSizeExceededError extends UndiciError {
1353
+ name: 'MessageSizeExceededError';
1354
+ code: 'UND_ERR_WS_MESSAGE_SIZE_EXCEEDED';
1355
+ }
1356
+ }
1357
+ //#endregion
1358
+ //#region ../../node_modules/undici/types/dispatcher.d.ts
1359
+ type AbortSignal$1 = unknown;
1360
+ type UndiciHeaders = Record<string, string | string[]> | IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null;
1361
+ /** Dispatcher is the core API used to dispatch requests. */
1362
+ declare class Dispatcher extends EventEmitter {
1363
+ /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
1364
+ dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean;
1365
+ /** Starts two-way communications with the requested resource. */
1366
+ connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void;
1367
+ connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>;
1368
+ /** Compose a chain of dispatchers */
1369
+ compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
1370
+ compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
1371
+ /** Performs an HTTP request. */
1372
+ request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void;
1373
+ request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>;
1374
+ /** For easy use with `stream.pipeline`. */
1375
+ pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex$1;
1376
+ /** A faster version of `Dispatcher.request`. */
1377
+ stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void;
1378
+ stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>;
1379
+ /** Upgrade to a different protocol. */
1380
+ upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
1381
+ upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
1382
+ /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
1383
+ close(callback: () => void): void;
1384
+ close(): Promise<void>;
1385
+ /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
1386
+ destroy(err: Error | null, callback: () => void): void;
1387
+ destroy(callback: () => void): void;
1388
+ destroy(err: Error | null): Promise<void>;
1389
+ destroy(): Promise<void>;
1390
+ on(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
1391
+ on(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1392
+ on(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1393
+ on(eventName: 'drain', callback: (origin: URL$1) => void): this;
1394
+ once(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
1395
+ once(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1396
+ once(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1397
+ once(eventName: 'drain', callback: (origin: URL$1) => void): this;
1398
+ off(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
1399
+ off(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1400
+ off(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1401
+ off(eventName: 'drain', callback: (origin: URL$1) => void): this;
1402
+ addListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
1403
+ addListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1404
+ addListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1405
+ addListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
1406
+ removeListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
1407
+ removeListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1408
+ removeListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1409
+ removeListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
1410
+ prependListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
1411
+ prependListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1412
+ prependListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1413
+ prependListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
1414
+ prependOnceListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
1415
+ prependOnceListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1416
+ prependOnceListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
1417
+ prependOnceListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
1418
+ listeners(eventName: 'connect'): ((origin: URL$1, targets: readonly Dispatcher[]) => void)[];
1419
+ listeners(eventName: 'disconnect'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
1420
+ listeners(eventName: 'connectionError'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
1421
+ listeners(eventName: 'drain'): ((origin: URL$1) => void)[];
1422
+ rawListeners(eventName: 'connect'): ((origin: URL$1, targets: readonly Dispatcher[]) => void)[];
1423
+ rawListeners(eventName: 'disconnect'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
1424
+ rawListeners(eventName: 'connectionError'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
1425
+ rawListeners(eventName: 'drain'): ((origin: URL$1) => void)[];
1426
+ emit(eventName: 'connect', origin: URL$1, targets: readonly Dispatcher[]): boolean;
1427
+ emit(eventName: 'disconnect', origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
1428
+ emit(eventName: 'connectionError', origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
1429
+ emit(eventName: 'drain', origin: URL$1): boolean;
1430
+ }
1431
+ declare namespace Dispatcher {
1432
+ export interface ComposedDispatcher extends Dispatcher {}
1433
+ export type Dispatch = Dispatcher['dispatch'];
1434
+ export type DispatcherComposeInterceptor = (dispatch: Dispatch) => Dispatch;
1435
+ export interface DispatchOptions {
1436
+ origin?: string | URL$1;
1437
+ path: string;
1438
+ method: HttpMethod;
1439
+ /** Default: `null` */
1440
+ body?: string | Buffer | Uint8Array | Readable$1 | null | FormData$1;
1441
+ /** Default: `null` */
1442
+ headers?: UndiciHeaders;
1443
+ /** Query string params to be embedded in the request URL. Default: `null` */
1444
+ query?: Record<string, any>;
1445
+ /** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
1446
+ idempotent?: boolean;
1447
+ /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
1448
+ blocking?: boolean;
1449
+ /** The IP Type of Service (ToS) value for the request socket. Must be an integer between 0 and 255. Default: `0` */
1450
+ typeOfService?: number | null;
1451
+ /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
1452
+ upgrade?: boolean | string | null;
1453
+ /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
1454
+ headersTimeout?: number | null;
1455
+ /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */
1456
+ bodyTimeout?: number | null;
1457
+ /** Whether the request should stablish a keep-alive or not. Default `false` */
1458
+ reset?: boolean;
1459
+ /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
1460
+ throwOnError?: boolean;
1461
+ /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
1462
+ expectContinue?: boolean;
1463
+ }
1464
+ export interface ConnectOptions<TOpaque = null> {
1465
+ origin: string | URL$1;
1466
+ path: string;
1467
+ /** Default: `null` */
1468
+ headers?: UndiciHeaders;
1469
+ /** Default: `null` */
1470
+ signal?: AbortSignal$1 | EventEmitter | null;
1471
+ /** This argument parameter is passed through to `ConnectData` */
1472
+ opaque?: TOpaque;
1473
+ /** Default: false */
1474
+ redirectionLimitReached?: boolean;
1475
+ /** Default: `null` */
1476
+ responseHeaders?: 'raw' | null;
1477
+ }
1478
+ export interface RequestOptions<TOpaque = null> extends DispatchOptions {
1479
+ /** Default: `null` */
1480
+ opaque?: TOpaque;
1481
+ /** Default: `null` */
1482
+ signal?: AbortSignal$1 | EventEmitter | null;
1483
+ /** Default: false */
1484
+ redirectionLimitReached?: boolean;
1485
+ /** Default: `null` */
1486
+ onInfo?: (info: {
1487
+ statusCode: number;
1488
+ headers: Record<string, string | string[]>;
1489
+ }) => void;
1490
+ /** Default: `null` */
1491
+ responseHeaders?: 'raw' | null;
1492
+ /** Default: `64 KiB` */
1493
+ highWaterMark?: number;
1494
+ }
1495
+ export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
1496
+ /** `true` if the `handler` will return an object stream. Default: `false` */
1497
+ objectMode?: boolean;
1498
+ }
1499
+ export interface UpgradeOptions {
1500
+ path: string;
1501
+ /** Default: `'GET'` */
1502
+ method?: string;
1503
+ /** Default: `null` */
1504
+ headers?: UndiciHeaders;
1505
+ /** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
1506
+ protocol?: string;
1507
+ /** Default: `null` */
1508
+ signal?: AbortSignal$1 | EventEmitter | null;
1509
+ /** Default: false */
1510
+ redirectionLimitReached?: boolean;
1511
+ /** Default: `null` */
1512
+ responseHeaders?: 'raw' | null;
1513
+ }
1514
+ export interface ConnectData<TOpaque = null> {
1515
+ statusCode: number;
1516
+ headers: IncomingHttpHeaders;
1517
+ socket: Duplex$1;
1518
+ opaque: TOpaque;
1519
+ }
1520
+ export interface ResponseData<TOpaque = null> {
1521
+ statusCode: number;
1522
+ statusText: string;
1523
+ headers: IncomingHttpHeaders;
1524
+ body: BodyReadable & BodyMixin;
1525
+ trailers: Record<string, string>;
1526
+ opaque: TOpaque;
1527
+ context: object;
1528
+ }
1529
+ export interface PipelineHandlerData<TOpaque = null> {
1530
+ statusCode: number;
1531
+ headers: IncomingHttpHeaders;
1532
+ opaque: TOpaque;
1533
+ body: BodyReadable;
1534
+ context: object;
1535
+ }
1536
+ export interface StreamData<TOpaque = null> {
1537
+ opaque: TOpaque;
1538
+ trailers: Record<string, string>;
1539
+ }
1540
+ export interface UpgradeData<TOpaque = null> {
1541
+ headers: IncomingHttpHeaders;
1542
+ socket: Duplex$1;
1543
+ opaque: TOpaque;
1544
+ }
1545
+ export interface StreamFactoryData<TOpaque = null> {
1546
+ statusCode: number;
1547
+ headers: IncomingHttpHeaders;
1548
+ opaque: TOpaque;
1549
+ context: object;
1550
+ }
1551
+ export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable$1;
1552
+ export interface DispatchController {
1553
+ get aborted(): boolean;
1554
+ get paused(): boolean;
1555
+ get reason(): Error | null;
1556
+ abort(reason: Error): void;
1557
+ pause(): void;
1558
+ resume(): void;
1559
+ }
1560
+ export interface DispatchHandler {
1561
+ onRequestStart?(controller: DispatchController, context: any): void;
1562
+ onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, socket: Duplex$1): void;
1563
+ onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, statusMessage?: string): void;
1564
+ onResponseData?(controller: DispatchController, chunk: Buffer): void;
1565
+ onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
1566
+ onResponseError?(controller: DispatchController, error: Error): void;
1567
+ /** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
1568
+ /** @deprecated */
1569
+ onConnect?(abort: (err?: Error) => void): void;
1570
+ /** Invoked when an error has occurred. */
1571
+ /** @deprecated */
1572
+ onError?(err: Error): void;
1573
+ /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
1574
+ /** @deprecated */
1575
+ onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex$1): void;
1576
+ /** Invoked when response is received, before headers have been read. **/
1577
+ /** @deprecated */
1578
+ onResponseStarted?(): void;
1579
+ /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
1580
+ /** @deprecated */
1581
+ onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
1582
+ /** Invoked when response payload data is received. */
1583
+ /** @deprecated */
1584
+ onData?(chunk: Buffer): boolean;
1585
+ /** Invoked when response payload and trailers have been received and the request has completed. */
1586
+ /** @deprecated */
1587
+ onComplete?(trailers: string[] | null): void;
1588
+ /** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
1589
+ /** @deprecated */
1590
+ onBodySent?(chunkSize: number, totalBytesSent: number): void;
1591
+ }
1592
+ export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable$1;
1593
+ export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>;
1594
+ /**
1595
+ * @link https://fetch.spec.whatwg.org/#body-mixin
1596
+ */
1597
+ interface BodyMixin {
1598
+ readonly body?: never;
1599
+ readonly bodyUsed: boolean;
1600
+ arrayBuffer(): Promise<ArrayBuffer>;
1601
+ blob(): Promise<Blob>;
1602
+ bytes(): Promise<Uint8Array>;
1603
+ formData(): Promise<never>;
1604
+ json(): Promise<unknown>;
1605
+ text(): Promise<string>;
1606
+ }
1607
+ export interface DispatchInterceptor {
1608
+ (dispatch: Dispatch): Dispatch;
1609
+ }
1610
+ }
1611
+ //#endregion
1612
+ //#region ../../node_modules/undici/types/mock-interceptor.d.ts
1613
+ /** The scope associated with a mock dispatch. */
1614
+ declare class MockScope<TData extends object = object> {
1615
+ constructor(mockDispatch: MockInterceptor.MockDispatch<TData>);
1616
+ /** Delay a reply by a set amount of time in ms. */
1617
+ delay(waitInMs: number): MockScope<TData>;
1618
+ /** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
1619
+ persist(): MockScope<TData>;
1620
+ /** Define a reply for a set amount of matching requests. */
1621
+ times(repeatTimes: number): MockScope<TData>;
1622
+ }
1623
+ /** The interceptor for a Mock. */
1624
+ declare class MockInterceptor {
1625
+ constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]);
1626
+ /** Mock an undici request with the defined reply. */
1627
+ reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>;
1628
+ reply<TData extends object = object>(statusCode: number, data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>, responseOptions?: MockInterceptor.MockResponseOptions): MockScope<TData>;
1629
+ /** Mock an undici request by throwing the defined reply error. */
1630
+ replyWithError<TError extends Error = Error>(error: TError): MockScope;
1631
+ /** Set default reply headers on the interceptor for subsequent mocked replies. */
1632
+ defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor;
1633
+ /** Set default reply trailers on the interceptor for subsequent mocked replies. */
1634
+ defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor;
1635
+ /** Set automatically calculated content-length header on subsequent mocked replies. */
1636
+ replyContentLength(): MockInterceptor;
1637
+ }
1638
+ declare namespace MockInterceptor {
1639
+ /** MockInterceptor options. */
1640
+ export interface Options {
1641
+ /** Path to intercept on. */
1642
+ path: string | RegExp | ((path: string) => boolean);
1643
+ /** Method to intercept on. Defaults to GET. */
1644
+ method?: string | RegExp | ((method: string) => boolean);
1645
+ /** Body to intercept on. */
1646
+ body?: string | RegExp | ((body: string) => boolean);
1647
+ /** Headers to intercept on. */
1648
+ headers?: Record<string, string | RegExp | ((body: string) => boolean)> | ((headers: Record<string, string>) => boolean);
1649
+ /** Query params to intercept on */
1650
+ query?: Record<string, any>;
1651
+ }
1652
+ export interface MockDispatch<TData extends object = object, TError extends Error = Error> extends Options {
1653
+ times: number | null;
1654
+ persist: boolean;
1655
+ consumed: boolean;
1656
+ data: MockDispatchData<TData, TError>;
1657
+ }
1658
+ export interface MockDispatchData<TData extends object = object, TError extends Error = Error> extends MockResponseOptions {
1659
+ error: TError | null;
1660
+ statusCode?: number;
1661
+ data?: TData | string;
1662
+ }
1663
+ export interface MockResponseOptions {
1664
+ headers?: IncomingHttpHeaders;
1665
+ trailers?: Record<string, string>;
1666
+ }
1667
+ export interface MockResponseCallbackOptions {
1668
+ path: string;
1669
+ method: string;
1670
+ headers?: Headers$1 | Record<string, string>;
1671
+ origin?: string;
1672
+ body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
1673
+ }
1674
+ export type MockResponseDataHandler<TData extends object = object> = (opts: MockResponseCallbackOptions) => TData | Buffer | string;
1675
+ export type MockReplyOptionsCallback<TData extends object = object> = (opts: MockResponseCallbackOptions) => {
1676
+ statusCode: number;
1677
+ data?: TData | Buffer | string;
1678
+ responseOptions?: MockResponseOptions;
1679
+ };
1680
+ }
1681
+ //#endregion
1682
+ //#region ../base/dist/helpers/request.d.ts
1683
+ interface RequestConfig {
1684
+ baseURL?: string;
1685
+ data?: unknown;
1686
+ dispatcher?: Dispatcher;
1687
+ headers?: Record<string, string | null | undefined>;
1688
+ method?: string;
1689
+ params?: Record<string, unknown>;
1690
+ paramsSerializer?: ((params: Record<string, unknown>) => string) | {
1691
+ serialize: (params: Record<string, unknown>) => string;
1692
+ };
1693
+ timeout?: number;
1694
+ url?: string;
1695
+ }
1696
+ interface RequestResponse<T = any> {
1697
+ config: RequestConfig;
1698
+ data: T;
1699
+ headers: Record<string, string>;
1700
+ status: number;
1701
+ statusText: string;
1702
+ }
1703
+ //#endregion
1704
+ //#region ../base/dist/helpers/tags.d.ts
1705
+ declare const CI_PIPELINE_URL = "ci.pipeline.url";
1706
+ declare const CI_PROVIDER_NAME = "ci.provider.name";
1707
+ declare const CI_PIPELINE_ID = "ci.pipeline.id";
1708
+ declare const CI_PIPELINE_NAME = "ci.pipeline.name";
1709
+ declare const CI_PIPELINE_NUMBER = "ci.pipeline.number";
1710
+ declare const CI_WORKSPACE_PATH = "ci.workspace_path";
1711
+ declare const GIT_REPOSITORY_URL = "git.repository_url";
1712
+ declare const CI_JOB_URL = "ci.job.url";
1713
+ declare const CI_JOB_NAME = "ci.job.name";
1714
+ declare const CI_JOB_ID = "ci.job.id";
1715
+ declare const CI_STAGE_NAME = "ci.stage.name";
1716
+ declare const CI_NODE_NAME = "ci.node.name";
1717
+ declare const CI_NODE_LABELS = "ci.node.labels";
1718
+ declare const CI_ENV_VARS = "_dd.ci.env_vars";
1719
+ declare const GIT_BRANCH = "git.branch";
1720
+ declare const GIT_COMMIT_AUTHOR_DATE = "git.commit.author.date";
1721
+ declare const GIT_COMMIT_AUTHOR_EMAIL = "git.commit.author.email";
1722
+ declare const GIT_COMMIT_AUTHOR_NAME = "git.commit.author.name";
1723
+ declare const GIT_COMMIT_COMMITTER_DATE = "git.commit.committer.date";
1724
+ declare const GIT_COMMIT_COMMITTER_EMAIL = "git.commit.committer.email";
1725
+ declare const GIT_COMMIT_COMMITTER_NAME = "git.commit.committer.name";
1726
+ declare const GIT_COMMIT_MESSAGE = "git.commit.message";
1727
+ declare const GIT_SHA = "git.commit.sha";
1728
+ declare const GIT_TAG = "git.tag";
1729
+ declare const GIT_HEAD_SHA = "git.commit.head.sha";
1730
+ declare const GIT_PULL_REQUEST_BASE_BRANCH_SHA = "git.pull_request.base_branch_sha";
1731
+ declare const GIT_PULL_REQUEST_BASE_BRANCH_HEAD_SHA = "git.pull_request.base_branch_head_sha";
1732
+ declare const GIT_PULL_REQUEST_BASE_BRANCH = "git.pull_request.base_branch";
1733
+ declare const PR_NUMBER = "pr.number";
1734
+ declare const SBOM_TOOL_GENERATOR_NAME = "tool.generator.name";
1735
+ declare const SBOM_TOOL_GENERATOR_VERSION = "tool.generator.version";
1736
+ declare const SERVICE = "service";
1737
+ //#endregion
1738
+ //#region ../base/dist/helpers/interfaces.d.ts
1739
+ type SpanTag = typeof CI_JOB_NAME | typeof CI_JOB_URL | typeof CI_JOB_ID | typeof CI_PIPELINE_ID | typeof CI_PIPELINE_NAME | typeof CI_PIPELINE_NUMBER | typeof CI_PIPELINE_URL | typeof CI_PROVIDER_NAME | typeof CI_STAGE_NAME | typeof CI_WORKSPACE_PATH | typeof GIT_BRANCH | typeof GIT_REPOSITORY_URL | typeof GIT_SHA | typeof GIT_TAG | typeof GIT_COMMIT_AUTHOR_EMAIL | typeof GIT_COMMIT_AUTHOR_NAME | typeof GIT_COMMIT_AUTHOR_DATE | typeof GIT_COMMIT_MESSAGE | typeof GIT_COMMIT_COMMITTER_DATE | typeof GIT_COMMIT_COMMITTER_EMAIL | typeof GIT_COMMIT_COMMITTER_NAME | typeof CI_ENV_VARS | typeof CI_NODE_NAME | typeof CI_NODE_LABELS | typeof SERVICE | typeof GIT_HEAD_SHA | typeof GIT_PULL_REQUEST_BASE_BRANCH | typeof GIT_PULL_REQUEST_BASE_BRANCH_SHA | typeof GIT_PULL_REQUEST_BASE_BRANCH_HEAD_SHA | typeof SBOM_TOOL_GENERATOR_NAME | typeof SBOM_TOOL_GENERATOR_VERSION | typeof PR_NUMBER;
1740
+ type SpanTags = Partial<Record<SpanTag, string>>;
1741
+ type RequestBuilder = (args: RequestConfig) => Promise<RequestResponse>;
1742
+ //#endregion
1743
+ //#region ../../node_modules/form-data/index.d.ts
1744
+ // Extracted because @types/node doesn't export interfaces.
1745
+ interface ReadableOptions {
1746
+ highWaterMark?: number;
1747
+ encoding?: string;
1748
+ objectMode?: boolean;
1749
+ read?(this: stream.Readable, size: number): void;
1750
+ destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void;
1751
+ autoDestroy?: boolean;
1752
+ }
1753
+ interface Options$1 extends ReadableOptions {
1754
+ writable?: boolean;
1755
+ readable?: boolean;
1756
+ dataSize?: number;
1757
+ maxDataSize?: number;
1758
+ pauseStreams?: boolean;
1759
+ }
1760
+ declare class FormData extends stream.Readable {
1761
+ constructor(options?: Options$1);
1762
+ append(key: string, value: any, options?: FormData.AppendOptions | string): void;
1763
+ getHeaders(userHeaders?: FormData.Headers): FormData.Headers;
1764
+ submit(params: string | FormData.SubmitOptions, callback?: (error: Error | null, response: http.IncomingMessage) => void): http.ClientRequest;
1765
+ getBuffer(): Buffer;
1766
+ setBoundary(boundary: string): void;
1767
+ getBoundary(): string;
1768
+ getLength(callback: (err: Error | null, length: number) => void): void;
1769
+ getLengthSync(): number;
1770
+ hasKnownLength(): boolean;
1771
+ }
1772
+ declare namespace FormData {
1773
+ interface Headers {
1774
+ [key: string]: any;
1775
+ }
1776
+ interface AppendOptions {
1777
+ header?: string | Headers;
1778
+ knownLength?: number;
1779
+ filename?: string;
1780
+ filepath?: string;
1781
+ contentType?: string;
1782
+ }
1783
+ interface SubmitOptions extends http.RequestOptions {
1784
+ protocol?: 'https:' | 'http:';
1785
+ }
1786
+ }
1787
+ //#endregion
1788
+ //#region ../base/dist/helpers/upload.d.ts
1789
+ /** Multipart payload destined to be sent to Datadog's API
1790
+ */
1791
+ interface MultipartPayload {
1792
+ content: Map<string, MultipartValue>;
1793
+ }
1794
+ type MultipartValue = MultipartStringValue | MultipartFileValue;
1795
+ interface MultipartStringValue {
1796
+ type: 'string';
1797
+ value: string;
1798
+ options: FormData.AppendOptions;
1799
+ }
1800
+ interface MultipartFileValue {
1801
+ type: 'file';
1802
+ path: string;
1803
+ options: FormData.AppendOptions;
1804
+ }
1805
+ interface UploadOptions {
1806
+ /** ApiKeyValidator (optional) throws an InvalidConfigurationException when upload fails because
1807
+ * of an invalid API key. Callers should most likely catch this exception and display it as a
1808
+ * nice error message.
1809
+ */
1810
+ apiKeyValidator?: ApiKeyValidator;
1811
+ /** Retries is the amount of upload retries before giving up. Some requests are never retried
1812
+ * (400, 413).
1813
+ */
1814
+ retries: number;
1815
+ /** Whether to gzip the request */
1816
+ useGzip?: boolean;
1817
+ /** Callback when upload fails (retries are not considered as failure)
1818
+ */
1819
+ onError(error: Error): void;
1820
+ /** Callback to execute before retries
1821
+ */
1822
+ onRetry(error: Error, attempts: number): void;
1823
+ /** Callback to execute before upload.
1824
+ */
1825
+ onUpload(): void;
1826
+ }
1827
+ declare enum UploadStatus {
1828
+ Success = 0,
1829
+ Failure = 1,
1830
+ Skipped = 2
1831
+ }
1832
+ //#endregion
1833
+ //#region ../base/dist/commands/git-metadata/interfaces.d.ts
1834
+ declare class CommitInfo {
1835
+ hash: string;
1836
+ remote: string;
1837
+ trackedFiles: string[];
1838
+ constructor(hash: string, remote: string, trackedFiles: string[]);
1839
+ asMultipartPayload(cliVersion: string): MultipartPayload;
1840
+ private getMetadataPayload;
1841
+ private repositoryPayload;
1842
+ }
1843
+ declare namespace library_d_exports {
1844
+ export { getGitCommitInfo, isGitRepo, uploadGitCommitHash, uploadRepository };
1845
+ }
1846
+ declare const isGitRepo: () => Promise<boolean>;
1847
+ declare const getGitCommitInfo: (filterAndFormatGitRepoUrl?: boolean) => Promise<[string, string]>;
1848
+ declare const uploadGitCommitHash: (apiKey: string, datadogSite: string, repositoryURL?: string) => Promise<[string, string]>;
1849
+ declare const uploadRepository: (requestBuilder: RequestBuilder, libraryVersion: string) => (commitInfo: CommitInfo, opts: UploadOptions) => Promise<UploadStatus>;
1850
+ //#endregion
1851
+ //#region ../../node_modules/proxy-agent/node_modules/lru-cache/index.d.ts
1852
+ // Project: https://github.com/isaacs/node-lru-cache
1853
+ // Based initially on @types/lru-cache
1854
+ // https://github.com/DefinitelyTyped/DefinitelyTyped
1855
+ // used under the terms of the MIT License, shown below.
1856
+ //
1857
+ // DefinitelyTyped license:
1858
+ // ------
1859
+ // MIT License
1860
+ //
1861
+ // Copyright (c) Microsoft Corporation.
1862
+ //
1863
+ // Permission is hereby granted, free of charge, to any person obtaining a
1864
+ // copy of this software and associated documentation files (the "Software"),
1865
+ // to deal in the Software without restriction, including without limitation
1866
+ // the rights to use, copy, modify, merge, publish, distribute, sublicense,
1867
+ // and/or sell copies of the Software, and to permit persons to whom the
1868
+ // Software is furnished to do so, subject to the following conditions:
1869
+ //
1870
+ // The above copyright notice and this permission notice shall be included
1871
+ // in all copies or substantial portions of the Software.
1872
+ //
1873
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1874
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1875
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1876
+ // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
1877
+ // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
1878
+ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1879
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
1880
+ // ------
1881
+ //
1882
+ // Changes by Isaac Z. Schlueter released under the terms found in the
1883
+ // LICENSE file within this project.
1884
+ /**
1885
+ * Integer greater than 0, representing some number of milliseconds, or the
1886
+ * time at which a TTL started counting from.
1887
+ */
1888
+ declare type LRUMilliseconds = number;
1889
+ /**
1890
+ * An integer greater than 0, reflecting the calculated size of items
1891
+ */
1892
+ declare type LRUSize = number;
1893
+ /**
1894
+ * An integer greater than 0, reflecting a number of items
1895
+ */
1896
+ declare type LRUCount = number;
1897
+ declare class LRUCache<K, V> implements Iterable<[K, V]> {
1898
+ constructor(options: LRUCache.Options<K, V>);
1899
+ /**
1900
+ * Number of items in the cache.
1901
+ * Alias for {@link size}
1902
+ *
1903
+ * @deprecated since 7.0 use {@link size} instead
1904
+ */
1905
+ public readonly length: LRUCount;
1906
+ public readonly max: LRUCount;
1907
+ public readonly maxSize: LRUSize;
1908
+ public readonly maxEntrySize: LRUSize;
1909
+ public readonly sizeCalculation: LRUCache.SizeCalculator<K, V> | undefined;
1910
+ public readonly dispose: LRUCache.Disposer<K, V>;
1911
+ /**
1912
+ * @since 7.4.0
1913
+ */
1914
+ public readonly disposeAfter: LRUCache.Disposer<K, V> | null;
1915
+ public readonly noDisposeOnSet: boolean;
1916
+ public readonly ttl: LRUMilliseconds;
1917
+ public readonly ttlResolution: LRUMilliseconds;
1918
+ public readonly ttlAutopurge: boolean;
1919
+ public readonly allowStale: boolean;
1920
+ public readonly updateAgeOnGet: boolean;
1921
+ /**
1922
+ * @since 7.11.0
1923
+ */
1924
+ public readonly noDeleteOnStaleGet: boolean;
1925
+ /**
1926
+ * @since 7.6.0
1927
+ */
1928
+ public readonly fetchMethod: LRUCache.Fetcher<K, V> | null;
1929
+ /**
1930
+ * The total number of items held in the cache at the current moment.
1931
+ */
1932
+ public readonly size: LRUCount;
1933
+ /**
1934
+ * The total size of items in cache when using size tracking.
1935
+ */
1936
+ public readonly calculatedSize: LRUSize;
1937
+ /**
1938
+ * Add a value to the cache.
1939
+ */
1940
+ public set(key: K, value: V, options?: LRUCache.SetOptions<K, V>): this;
1941
+ /**
1942
+ * Return a value from the cache. Will update the recency of the cache entry
1943
+ * found.
1944
+ *
1945
+ * If the key is not found, {@link get} will return `undefined`. This can be
1946
+ * confusing when setting values specifically to `undefined`, as in
1947
+ * `cache.set(key, undefined)`. Use {@link has} to determine whether a key is
1948
+ * present in the cache at all.
1949
+ */
1950
+ public get(key: K, options?: LRUCache.GetOptions<V>): V | undefined;
1951
+ /**
1952
+ * Like {@link get} but doesn't update recency or delete stale items.
1953
+ * Returns `undefined` if the item is stale, unless {@link allowStale} is set
1954
+ * either on the cache or in the options object.
1955
+ */
1956
+ public peek(key: K, options?: LRUCache.PeekOptions): V | undefined;
1957
+ /**
1958
+ * Check if a key is in the cache, without updating the recency of use.
1959
+ * Will return false if the item is stale, even though it is technically
1960
+ * in the cache.
1961
+ *
1962
+ * Will not update item age unless {@link updateAgeOnHas} is set in the
1963
+ * options or constructor.
1964
+ */
1965
+ public has(key: K, options?: LRUCache.HasOptions<V>): boolean;
1966
+ /**
1967
+ * Deletes a key out of the cache.
1968
+ * Returns true if the key was deleted, false otherwise.
1969
+ */
1970
+ public delete(key: K): boolean;
1971
+ /**
1972
+ * Clear the cache entirely, throwing away all values.
1973
+ */
1974
+ public clear(): void;
1975
+ /**
1976
+ * Delete any stale entries. Returns true if anything was removed, false
1977
+ * otherwise.
1978
+ */
1979
+ public purgeStale(): boolean;
1980
+ /**
1981
+ * Find a value for which the supplied fn method returns a truthy value,
1982
+ * similar to Array.find(). fn is called as fn(value, key, cache).
1983
+ */
1984
+ public find(callbackFn: (value: V, key: K, cache: this) => boolean | undefined | void, options?: LRUCache.GetOptions<V>): V | undefined;
1985
+ /**
1986
+ * Call the supplied function on each item in the cache, in order from
1987
+ * most recently used to least recently used. fn is called as
1988
+ * fn(value, key, cache). Does not update age or recenty of use.
1989
+ */
1990
+ public forEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
1991
+ /**
1992
+ * The same as {@link forEach} but items are iterated over in reverse
1993
+ * order. (ie, less recently used items are iterated over first.)
1994
+ */
1995
+ public rforEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
1996
+ /**
1997
+ * Return a generator yielding the keys in the cache,
1998
+ * in order from most recently used to least recently used.
1999
+ */
2000
+ public keys(): Generator<K, void, void>;
2001
+ /**
2002
+ * Inverse order version of {@link keys}
2003
+ *
2004
+ * Return a generator yielding the keys in the cache,
2005
+ * in order from least recently used to most recently used.
2006
+ */
2007
+ public rkeys(): Generator<K, void, void>;
2008
+ /**
2009
+ * Return a generator yielding the values in the cache,
2010
+ * in order from most recently used to least recently used.
2011
+ */
2012
+ public values(): Generator<V, void, void>;
2013
+ /**
2014
+ * Inverse order version of {@link values}
2015
+ *
2016
+ * Return a generator yielding the values in the cache,
2017
+ * in order from least recently used to most recently used.
2018
+ */
2019
+ public rvalues(): Generator<V, void, void>;
2020
+ /**
2021
+ * Return a generator yielding `[key, value]` pairs,
2022
+ * in order from most recently used to least recently used.
2023
+ */
2024
+ public entries(): Generator<[K, V], void, void>;
2025
+ /**
2026
+ * Inverse order version of {@link entries}
2027
+ *
2028
+ * Return a generator yielding `[key, value]` pairs,
2029
+ * in order from least recently used to most recently used.
2030
+ */
2031
+ public rentries(): Generator<[K, V], void, void>;
2032
+ /**
2033
+ * Iterating over the cache itself yields the same results as
2034
+ * {@link entries}
2035
+ */
2036
+ public [Symbol.iterator](): Generator<[K, V], void, void>;
2037
+ /**
2038
+ * Return an array of [key, entry] objects which can be passed to
2039
+ * cache.load()
2040
+ */
2041
+ public dump(): Array<[K, LRUCache.Entry<V>]>;
2042
+ /**
2043
+ * Reset the cache and load in the items in entries in the order listed.
2044
+ * Note that the shape of the resulting cache may be different if the
2045
+ * same options are not used in both caches.
2046
+ */
2047
+ public load(cacheEntries: ReadonlyArray<[K, LRUCache.Entry<V>]>): void;
2048
+ /**
2049
+ * Evict the least recently used item, returning its value or `undefined`
2050
+ * if cache is empty.
2051
+ */
2052
+ public pop(): V | undefined;
2053
+ /**
2054
+ * Deletes a key out of the cache.
2055
+ *
2056
+ * @deprecated since 7.0 use delete() instead
2057
+ */
2058
+ public del(key: K): boolean;
2059
+ /**
2060
+ * Clear the cache entirely, throwing away all values.
2061
+ *
2062
+ * @deprecated since 7.0 use clear() instead
2063
+ */
2064
+ public reset(): void;
2065
+ /**
2066
+ * Manually iterates over the entire cache proactively pruning old entries.
2067
+ *
2068
+ * @deprecated since 7.0 use purgeStale() instead
2069
+ */
2070
+ public prune(): boolean;
2071
+ /**
2072
+ * Make an asynchronous cached fetch using the {@link fetchMethod} function.
2073
+ *
2074
+ * If multiple fetches for the same key are issued, then they will all be
2075
+ * coalesced into a single call to fetchMethod.
2076
+ *
2077
+ * Note that this means that handling options such as
2078
+ * {@link allowStaleOnFetchAbort}, {@link signal}, and
2079
+ * {@link allowStaleOnFetchRejection} will be determined by the FIRST fetch()
2080
+ * call for a given key.
2081
+ *
2082
+ * This is a known (fixable) shortcoming which will be addresed on when
2083
+ * someone complains about it, as the fix would involve added complexity and
2084
+ * may not be worth the costs for this edge case.
2085
+ *
2086
+ * since: 7.6.0
2087
+ */
2088
+ public fetch(key: K, options?: LRUCache.FetchOptions<K, V>): Promise<V>;
2089
+ /**
2090
+ * since: 7.6.0
2091
+ */
2092
+ public getRemainingTTL(key: K): LRUMilliseconds;
2093
+ }
2094
+ declare namespace LRUCache {
2095
+ type DisposeReason = 'evict' | 'set' | 'delete';
2096
+ type SizeCalculator<K, V> = (value: V, key: K) => LRUSize;
2097
+ type Disposer<K, V> = (value: V, key: K, reason: DisposeReason) => void;
2098
+ type Fetcher<K, V> = (key: K, staleValue: V | undefined, options: FetcherOptions<K, V>) => Promise<V | void | undefined> | V | void | undefined;
2099
+ interface DeprecatedOptions<K, V> {
2100
+ /**
2101
+ * alias for ttl
2102
+ *
2103
+ * @deprecated since 7.0 use options.ttl instead
2104
+ */
2105
+ maxAge?: LRUMilliseconds;
2106
+ /**
2107
+ * alias for {@link sizeCalculation}
2108
+ *
2109
+ * @deprecated since 7.0 use {@link sizeCalculation} instead
2110
+ */
2111
+ length?: SizeCalculator<K, V>;
2112
+ /**
2113
+ * alias for allowStale
2114
+ *
2115
+ * @deprecated since 7.0 use options.allowStale instead
2116
+ */
2117
+ stale?: boolean;
2118
+ }
2119
+ interface LimitedByCount {
2120
+ /**
2121
+ * The number of most recently used items to keep.
2122
+ * Note that we may store fewer items than this if maxSize is hit.
2123
+ */
2124
+ max: LRUCount;
2125
+ }
2126
+ type MaybeMaxEntrySizeLimit<K, V> = {
2127
+ /**
2128
+ * The maximum allowed size for any single item in the cache.
2129
+ *
2130
+ * If a larger item is passed to {@link set} or returned by a
2131
+ * {@link fetchMethod}, then it will not be stored in the cache.
2132
+ */
2133
+ maxEntrySize: LRUSize;
2134
+ sizeCalculation?: SizeCalculator<K, V>;
2135
+ } | {};
2136
+ interface LimitedBySize<K, V> {
2137
+ /**
2138
+ * If you wish to track item size, you must provide a maxSize
2139
+ * note that we still will only keep up to max *actual items*,
2140
+ * if max is set, so size tracking may cause fewer than max items
2141
+ * to be stored. At the extreme, a single item of maxSize size
2142
+ * will cause everything else in the cache to be dropped when it
2143
+ * is added. Use with caution!
2144
+ *
2145
+ * Note also that size tracking can negatively impact performance,
2146
+ * though for most cases, only minimally.
2147
+ */
2148
+ maxSize: LRUSize;
2149
+ /**
2150
+ * Function to calculate size of items. Useful if storing strings or
2151
+ * buffers or other items where memory size depends on the object itself.
2152
+ *
2153
+ * Items larger than {@link maxEntrySize} will not be stored in the cache.
2154
+ *
2155
+ * Note that when {@link maxSize} or {@link maxEntrySize} are set, every
2156
+ * item added MUST have a size specified, either via a `sizeCalculation` in
2157
+ * the constructor, or `sizeCalculation` or {@link size} options to
2158
+ * {@link set}.
2159
+ */
2160
+ sizeCalculation?: SizeCalculator<K, V>;
2161
+ }
2162
+ interface LimitedByTTL {
2163
+ /**
2164
+ * Max time in milliseconds for items to live in cache before they are
2165
+ * considered stale. Note that stale items are NOT preemptively removed
2166
+ * by default, and MAY live in the cache, contributing to its LRU max,
2167
+ * long after they have expired.
2168
+ *
2169
+ * Also, as this cache is optimized for LRU/MRU operations, some of
2170
+ * the staleness/TTL checks will reduce performance, as they will incur
2171
+ * overhead by deleting items.
2172
+ *
2173
+ * Must be an integer number of ms, defaults to 0, which means "no TTL"
2174
+ */
2175
+ ttl: LRUMilliseconds;
2176
+ /**
2177
+ * Boolean flag to tell the cache to not update the TTL when
2178
+ * setting a new value for an existing key (ie, when updating a value
2179
+ * rather than inserting a new value). Note that the TTL value is
2180
+ * _always_ set (if provided) when adding a new entry into the cache.
2181
+ *
2182
+ * @default false
2183
+ * @since 7.4.0
2184
+ */
2185
+ noUpdateTTL?: boolean;
2186
+ /**
2187
+ * Minimum amount of time in ms in which to check for staleness.
2188
+ * Defaults to 1, which means that the current time is checked
2189
+ * at most once per millisecond.
2190
+ *
2191
+ * Set to 0 to check the current time every time staleness is tested.
2192
+ * (This reduces performance, and is theoretically unnecessary.)
2193
+ *
2194
+ * Setting this to a higher value will improve performance somewhat
2195
+ * while using ttl tracking, albeit at the expense of keeping stale
2196
+ * items around a bit longer than their TTLs would indicate.
2197
+ *
2198
+ * @default 1
2199
+ * @since 7.1.0
2200
+ */
2201
+ ttlResolution?: LRUMilliseconds;
2202
+ /**
2203
+ * Preemptively remove stale items from the cache.
2204
+ * Note that this may significantly degrade performance,
2205
+ * especially if the cache is storing a large number of items.
2206
+ * It is almost always best to just leave the stale items in
2207
+ * the cache, and let them fall out as new items are added.
2208
+ *
2209
+ * Note that this means that {@link allowStale} is a bit pointless,
2210
+ * as stale items will be deleted almost as soon as they expire.
2211
+ *
2212
+ * Use with caution!
2213
+ *
2214
+ * @default false
2215
+ * @since 7.1.0
2216
+ */
2217
+ ttlAutopurge?: boolean;
2218
+ /**
2219
+ * Return stale items from {@link get} before disposing of them.
2220
+ * Return stale values from {@link fetch} while performing a call
2221
+ * to the {@link fetchMethod} in the background.
2222
+ *
2223
+ * @default false
2224
+ */
2225
+ allowStale?: boolean;
2226
+ /**
2227
+ * Update the age of items on {@link get}, renewing their TTL
2228
+ *
2229
+ * @default false
2230
+ */
2231
+ updateAgeOnGet?: boolean;
2232
+ /**
2233
+ * Do not delete stale items when they are retrieved with {@link get}.
2234
+ * Note that the {@link get} return value will still be `undefined` unless
2235
+ * allowStale is true.
2236
+ *
2237
+ * @default false
2238
+ * @since 7.11.0
2239
+ */
2240
+ noDeleteOnStaleGet?: boolean;
2241
+ /**
2242
+ * Update the age of items on {@link has}, renewing their TTL
2243
+ *
2244
+ * @default false
2245
+ */
2246
+ updateAgeOnHas?: boolean;
2247
+ }
2248
+ type SafetyBounds<K, V> = LimitedByCount | LimitedBySize<K, V> | LimitedByTTL; // options shared by all three of the limiting scenarios
2249
+ interface SharedOptions<K, V> {
2250
+ /**
2251
+ * Function that is called on items when they are dropped from the cache.
2252
+ * This can be handy if you want to close file descriptors or do other
2253
+ * cleanup tasks when items are no longer accessible. Called with `key,
2254
+ * value`. It's called before actually removing the item from the
2255
+ * internal cache, so it is *NOT* safe to re-add them.
2256
+ * Use {@link disposeAfter} if you wish to dispose items after they have
2257
+ * been full removed, when it is safe to add them back to the cache.
2258
+ */
2259
+ dispose?: Disposer<K, V>;
2260
+ /**
2261
+ * The same as dispose, but called *after* the entry is completely
2262
+ * removed and the cache is once again in a clean state. It is safe to
2263
+ * add an item right back into the cache at this point.
2264
+ * However, note that it is *very* easy to inadvertently create infinite
2265
+ * recursion this way.
2266
+ *
2267
+ * @since 7.3.0
2268
+ */
2269
+ disposeAfter?: Disposer<K, V>;
2270
+ /**
2271
+ * Set to true to suppress calling the dispose() function if the entry
2272
+ * key is still accessible within the cache.
2273
+ * This may be overridden by passing an options object to {@link set}.
2274
+ *
2275
+ * @default false
2276
+ */
2277
+ noDisposeOnSet?: boolean;
2278
+ /**
2279
+ * Function that is used to make background asynchronous fetches. Called
2280
+ * with `fetchMethod(key, staleValue, { signal, options, context })`.
2281
+ *
2282
+ * If `fetchMethod` is not provided, then {@link fetch} is
2283
+ * equivalent to `Promise.resolve(cache.get(key))`.
2284
+ *
2285
+ * The `fetchMethod` should ONLY return `undefined` in cases where the
2286
+ * abort controller has sent an abort signal.
2287
+ *
2288
+ * @since 7.6.0
2289
+ */
2290
+ fetchMethod?: LRUCache.Fetcher<K, V>;
2291
+ /**
2292
+ * Set to true to suppress the deletion of stale data when a
2293
+ * {@link fetchMethod} throws an error or returns a rejected promise
2294
+ *
2295
+ * This may be overridden in the {@link fetchMethod}.
2296
+ *
2297
+ * @default false
2298
+ * @since 7.10.0
2299
+ */
2300
+ noDeleteOnFetchRejection?: boolean;
2301
+ /**
2302
+ * Set to true to allow returning stale data when a {@link fetchMethod}
2303
+ * throws an error or returns a rejected promise. Note that this
2304
+ * differs from using {@link allowStale} in that stale data will
2305
+ * ONLY be returned in the case that the fetch fails, not any other
2306
+ * times.
2307
+ *
2308
+ * This may be overridden in the {@link fetchMethod}.
2309
+ *
2310
+ * @default false
2311
+ * @since 7.16.0
2312
+ */
2313
+ allowStaleOnFetchRejection?: boolean;
2314
+ /**
2315
+ *
2316
+ * Set to true to ignore the `abort` event emitted by the `AbortSignal`
2317
+ * object passed to {@link fetchMethod}, and still cache the
2318
+ * resulting resolution value, as long as it is not `undefined`.
2319
+ *
2320
+ * When used on its own, this means aborted {@link fetch} calls are not
2321
+ * immediately resolved or rejected when they are aborted, and instead take
2322
+ * the full time to await.
2323
+ *
2324
+ * When used with {@link allowStaleOnFetchAbort}, aborted {@link fetch}
2325
+ * calls will resolve immediately to their stale cached value or
2326
+ * `undefined`, and will continue to process and eventually update the
2327
+ * cache when they resolve, as long as the resulting value is not
2328
+ * `undefined`, thus supporting a "return stale on timeout while
2329
+ * refreshing" mechanism by passing `AbortSignal.timeout(n)` as the signal.
2330
+ *
2331
+ * **Note**: regardless of this setting, an `abort` event _is still emitted
2332
+ * on the `AbortSignal` object_, so may result in invalid results when
2333
+ * passed to other underlying APIs that use AbortSignals.
2334
+ *
2335
+ * This may be overridden in the {@link fetchMethod} or the call to
2336
+ * {@link fetch}.
2337
+ *
2338
+ * @default false
2339
+ * @since 7.17.0
2340
+ */
2341
+ ignoreFetchAbort?: boolean;
2342
+ /**
2343
+ * Set to true to return a stale value from the cache when the
2344
+ * `AbortSignal` passed to the {@link fetchMethod} dispatches an `'abort'`
2345
+ * event, whether user-triggered, or due to internal cache behavior.
2346
+ *
2347
+ * Unless {@link ignoreFetchAbort} is also set, the underlying
2348
+ * {@link fetchMethod} will still be considered canceled, and its return
2349
+ * value will be ignored and not cached.
2350
+ *
2351
+ * This may be overridden in the {@link fetchMethod} or the call to
2352
+ * {@link fetch}.
2353
+ *
2354
+ * @default false
2355
+ * @since 7.17.0
2356
+ */
2357
+ allowStaleOnFetchAbort?: boolean;
2358
+ /**
2359
+ * Set to any value in the constructor or {@link fetch} options to
2360
+ * pass arbitrary data to the {@link fetchMethod} in the {@link context}
2361
+ * options field.
2362
+ *
2363
+ * @since 7.12.0
2364
+ */
2365
+ fetchContext?: any;
2366
+ }
2367
+ type Options<K, V> = SharedOptions<K, V> & DeprecatedOptions<K, V> & SafetyBounds<K, V> & MaybeMaxEntrySizeLimit<K, V>;
2368
+ /**
2369
+ * options which override the options set in the LRUCache constructor
2370
+ * when making calling {@link set}.
2371
+ */
2372
+ interface SetOptions<K, V> {
2373
+ /**
2374
+ * A value for the size of the entry, prevents calls to
2375
+ * {@link sizeCalculation}.
2376
+ *
2377
+ * Items larger than {@link maxEntrySize} will not be stored in the cache.
2378
+ *
2379
+ * Note that when {@link maxSize} or {@link maxEntrySize} are set, every
2380
+ * item added MUST have a size specified, either via a `sizeCalculation` in
2381
+ * the constructor, or {@link sizeCalculation} or `size` options to
2382
+ * {@link set}.
2383
+ */
2384
+ size?: LRUSize;
2385
+ /**
2386
+ * Overrides the {@link sizeCalculation} method set in the constructor.
2387
+ *
2388
+ * Items larger than {@link maxEntrySize} will not be stored in the cache.
2389
+ *
2390
+ * Note that when {@link maxSize} or {@link maxEntrySize} are set, every
2391
+ * item added MUST have a size specified, either via a `sizeCalculation` in
2392
+ * the constructor, or `sizeCalculation` or {@link size} options to
2393
+ * {@link set}.
2394
+ */
2395
+ sizeCalculation?: SizeCalculator<K, V>;
2396
+ ttl?: LRUMilliseconds;
2397
+ start?: LRUMilliseconds;
2398
+ noDisposeOnSet?: boolean;
2399
+ noUpdateTTL?: boolean;
2400
+ status?: Status<V>;
2401
+ }
2402
+ /**
2403
+ * options which override the options set in the LRUCAche constructor
2404
+ * when calling {@link has}.
2405
+ */
2406
+ interface HasOptions<V> {
2407
+ updateAgeOnHas?: boolean;
2408
+ status: Status<V>;
2409
+ }
2410
+ /**
2411
+ * options which override the options set in the LRUCache constructor
2412
+ * when calling {@link get}.
2413
+ */
2414
+ interface GetOptions<V> {
2415
+ allowStale?: boolean;
2416
+ updateAgeOnGet?: boolean;
2417
+ noDeleteOnStaleGet?: boolean;
2418
+ status?: Status<V>;
2419
+ }
2420
+ /**
2421
+ * options which override the options set in the LRUCache constructor
2422
+ * when calling {@link peek}.
2423
+ */
2424
+ interface PeekOptions {
2425
+ allowStale?: boolean;
2426
+ }
2427
+ /**
2428
+ * Options object passed to the {@link fetchMethod}
2429
+ *
2430
+ * May be mutated by the {@link fetchMethod} to affect the behavior of the
2431
+ * resulting {@link set} operation on resolution, or in the case of
2432
+ * {@link noDeleteOnFetchRejection}, {@link ignoreFetchAbort}, and
2433
+ * {@link allowStaleOnFetchRejection}, the handling of failure.
2434
+ */
2435
+ interface FetcherFetchOptions<K, V> {
2436
+ allowStale?: boolean;
2437
+ updateAgeOnGet?: boolean;
2438
+ noDeleteOnStaleGet?: boolean;
2439
+ size?: LRUSize;
2440
+ sizeCalculation?: SizeCalculator<K, V>;
2441
+ ttl?: LRUMilliseconds;
2442
+ noDisposeOnSet?: boolean;
2443
+ noUpdateTTL?: boolean;
2444
+ noDeleteOnFetchRejection?: boolean;
2445
+ allowStaleOnFetchRejection?: boolean;
2446
+ ignoreFetchAbort?: boolean;
2447
+ allowStaleOnFetchAbort?: boolean;
2448
+ status?: Status<V>;
2449
+ }
2450
+ /**
2451
+ * Status object that may be passed to {@link fetch}, {@link get},
2452
+ * {@link set}, and {@link has}.
2453
+ */
2454
+ interface Status<V> {
2455
+ /**
2456
+ * The status of a set() operation.
2457
+ *
2458
+ * - add: the item was not found in the cache, and was added
2459
+ * - update: the item was in the cache, with the same value provided
2460
+ * - replace: the item was in the cache, and replaced
2461
+ * - miss: the item was not added to the cache for some reason
2462
+ */
2463
+ set?: 'add' | 'update' | 'replace' | 'miss';
2464
+ /**
2465
+ * the ttl stored for the item, or undefined if ttls are not used.
2466
+ */
2467
+ ttl?: LRUMilliseconds;
2468
+ /**
2469
+ * the start time for the item, or undefined if ttls are not used.
2470
+ */
2471
+ start?: LRUMilliseconds;
2472
+ /**
2473
+ * The timestamp used for TTL calculation
2474
+ */
2475
+ now?: LRUMilliseconds;
2476
+ /**
2477
+ * the remaining ttl for the item, or undefined if ttls are not used.
2478
+ */
2479
+ remainingTTL?: LRUMilliseconds;
2480
+ /**
2481
+ * The calculated size for the item, if sizes are used.
2482
+ */
2483
+ size?: LRUSize;
2484
+ /**
2485
+ * A flag indicating that the item was not stored, due to exceeding the
2486
+ * {@link maxEntrySize}
2487
+ */
2488
+ maxEntrySizeExceeded?: true;
2489
+ /**
2490
+ * The old value, specified in the case of `set:'update'` or
2491
+ * `set:'replace'`
2492
+ */
2493
+ oldValue?: V;
2494
+ /**
2495
+ * The results of a {@link has} operation
2496
+ *
2497
+ * - hit: the item was found in the cache
2498
+ * - stale: the item was found in the cache, but is stale
2499
+ * - miss: the item was not found in the cache
2500
+ */
2501
+ has?: 'hit' | 'stale' | 'miss';
2502
+ /**
2503
+ * The status of a {@link fetch} operation.
2504
+ * Note that this can change as the underlying fetch() moves through
2505
+ * various states.
2506
+ *
2507
+ * - inflight: there is another fetch() for this key which is in process
2508
+ * - get: there is no fetchMethod, so {@link get} was called.
2509
+ * - miss: the item is not in cache, and will be fetched.
2510
+ * - hit: the item is in the cache, and was resolved immediately.
2511
+ * - stale: the item is in the cache, but stale.
2512
+ * - refresh: the item is in the cache, and not stale, but
2513
+ * {@link forceRefresh} was specified.
2514
+ */
2515
+ fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh';
2516
+ /**
2517
+ * The {@link fetchMethod} was called
2518
+ */
2519
+ fetchDispatched?: true;
2520
+ /**
2521
+ * The cached value was updated after a successful call to fetchMethod
2522
+ */
2523
+ fetchUpdated?: true;
2524
+ /**
2525
+ * The reason for a fetch() rejection. Either the error raised by the
2526
+ * {@link fetchMethod}, or the reason for an AbortSignal.
2527
+ */
2528
+ fetchError?: Error;
2529
+ /**
2530
+ * The fetch received an abort signal
2531
+ */
2532
+ fetchAborted?: true;
2533
+ /**
2534
+ * The abort signal received was ignored, and the fetch was allowed to
2535
+ * continue.
2536
+ */
2537
+ fetchAbortIgnored?: true;
2538
+ /**
2539
+ * The fetchMethod promise resolved successfully
2540
+ */
2541
+ fetchResolved?: true;
2542
+ /**
2543
+ * The fetchMethod promise was rejected
2544
+ */
2545
+ fetchRejected?: true;
2546
+ /**
2547
+ * The status of a {@link get} operation.
2548
+ *
2549
+ * - fetching: The item is currently being fetched. If a previous value is
2550
+ * present and allowed, that will be returned.
2551
+ * - stale: The item is in the cache, and is stale.
2552
+ * - hit: the item is in the cache
2553
+ * - miss: the item is not in the cache
2554
+ */
2555
+ get?: 'stale' | 'hit' | 'miss';
2556
+ /**
2557
+ * A fetch or get operation returned a stale value.
2558
+ */
2559
+ returnedStale?: true;
2560
+ }
2561
+ /**
2562
+ * options which override the options set in the LRUCache constructor
2563
+ * when calling {@link fetch}.
2564
+ *
2565
+ * This is the union of GetOptions and SetOptions, plus
2566
+ * {@link noDeleteOnFetchRejection}, {@link allowStaleOnFetchRejection},
2567
+ * {@link forceRefresh}, and {@link fetchContext}
2568
+ */
2569
+ interface FetchOptions<K, V> extends FetcherFetchOptions<K, V> {
2570
+ forceRefresh?: boolean;
2571
+ fetchContext?: any;
2572
+ signal?: AbortSignal;
2573
+ status?: Status<V>;
2574
+ }
2575
+ interface FetcherOptions<K, V> {
2576
+ signal: AbortSignal;
2577
+ options: FetcherFetchOptions<K, V>;
2578
+ /**
2579
+ * Object provided in the {@link fetchContext} option
2580
+ */
2581
+ context: any;
2582
+ }
2583
+ interface Entry<V> {
2584
+ value: V;
2585
+ ttl?: LRUMilliseconds;
2586
+ size?: LRUSize;
2587
+ start?: LRUMilliseconds;
2588
+ }
2589
+ }
2590
+ //#endregion
2591
+ //#region ../../node_modules/agent-base/dist/index.d.ts
2592
+ interface HttpConnectOpts extends net.TcpNetConnectOpts {
2593
+ secureEndpoint: false;
2594
+ protocol?: string;
2595
+ }
2596
+ interface HttpsConnectOpts extends tls.ConnectionOptions {
2597
+ secureEndpoint: true;
2598
+ protocol?: string;
2599
+ port: number;
2600
+ }
2601
+ type AgentConnectOpts = HttpConnectOpts | HttpsConnectOpts;
2602
+ declare const INTERNAL: unique symbol;
2603
+ declare abstract class Agent extends http.Agent {
2604
+ private [INTERNAL];
2605
+ options: Partial<net.TcpNetConnectOpts & tls.ConnectionOptions>;
2606
+ keepAlive: boolean;
2607
+ constructor(opts?: http.AgentOptions);
2608
+ abstract connect(req: http.ClientRequest, options: AgentConnectOpts): Promise<Duplex | http.Agent> | Duplex | http.Agent;
2609
+ /**
2610
+ * Determine whether this is an `http` or `https` request.
2611
+ */
2612
+ isSecureEndpoint(options?: AgentConnectOpts): boolean;
2613
+ private incrementSockets;
2614
+ private decrementSockets;
2615
+ getName(options: AgentConnectOpts): string;
2616
+ createSocket(req: http.ClientRequest, options: AgentConnectOpts, cb: (err: Error | null, s?: Duplex) => void): void;
2617
+ createConnection(): Duplex;
2618
+ get defaultPort(): number;
2619
+ set defaultPort(v: number);
2620
+ get protocol(): string;
2621
+ set protocol(v: string);
2622
+ }
2623
+ //#endregion
2624
+ //#region ../../node_modules/http-proxy-agent/dist/index.d.ts
2625
+ type Protocol$3<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
2626
+ type ConnectOptsMap$1 = {
2627
+ http: Omit<net.TcpNetConnectOpts, 'host' | 'port'>;
2628
+ https: Omit<tls.ConnectionOptions, 'host' | 'port'>;
2629
+ };
2630
+ type ConnectOpts$1<T> = { [P in keyof ConnectOptsMap$1]: Protocol$3<T> extends P ? ConnectOptsMap$1[P] : never }[keyof ConnectOptsMap$1];
2631
+ type HttpProxyAgentOptions<T> = ConnectOpts$1<T> & http.AgentOptions & {
2632
+ headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
2633
+ };
2634
+ //#endregion
2635
+ //#region ../../node_modules/https-proxy-agent/dist/index.d.ts
2636
+ type Protocol$2<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
2637
+ type ConnectOptsMap = {
2638
+ http: Omit<net.TcpNetConnectOpts, 'host' | 'port'>;
2639
+ https: Omit<tls.ConnectionOptions, 'host' | 'port'>;
2640
+ };
2641
+ type ConnectOpts<T> = { [P in keyof ConnectOptsMap]: Protocol$2<T> extends P ? ConnectOptsMap[P] : never }[keyof ConnectOptsMap];
2642
+ type HttpsProxyAgentOptions<T> = ConnectOpts<T> & http.AgentOptions & {
2643
+ headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
2644
+ };
2645
+ //#endregion
2646
+ //#region ../../node_modules/socks/typings/common/constants.d.ts
2647
+ type SocksProxyType = 4 | 5;
2648
+ /**
2649
+ * Represents a SocksProxy
2650
+ */
2651
+ interface SocksProxy {
2652
+ ipaddress?: string;
2653
+ host?: string;
2654
+ port: number;
2655
+ type: SocksProxyType;
2656
+ userId?: string;
2657
+ password?: string;
2658
+ custom_auth_method?: number;
2659
+ custom_auth_request_handler?: () => Promise<Buffer>;
2660
+ custom_auth_response_size?: number;
2661
+ custom_auth_response_handler?: (data: Buffer) => Promise<boolean>;
2662
+ }
2663
+ /**
2664
+ * Represents a remote host
2665
+ */
2666
+ //#endregion
2667
+ //#region ../../node_modules/socks-proxy-agent/dist/index.d.ts
2668
+ type SocksSocketOptions = Omit<net.TcpNetConnectOpts, 'port' | 'host'>;
2669
+ type SocksProxyAgentOptions = Omit<SocksProxy, 'ipaddress' | 'host' | 'port' | 'type' | 'userId' | 'password'> & {
2670
+ socketOptions?: SocksSocketOptions;
2671
+ } & http.AgentOptions;
2672
+ //#endregion
2673
+ //#region ../../node_modules/get-uri/dist/data.d.ts
2674
+ declare class DataReadable extends Readable {
2675
+ hash?: string;
2676
+ constructor(hash: string, buf: Buffer);
2677
+ }
2678
+ interface DataOptions {
2679
+ cache?: DataReadable;
2680
+ }
2681
+ //#endregion
2682
+ //#region ../../node_modules/get-uri/dist/file.d.ts
2683
+ type ReadStreamOptions = NonNullable<Exclude<Parameters<typeof createReadStream>[1], string>>;
2684
+ interface FileReadable extends Readable {
2685
+ stat?: Stats;
2686
+ }
2687
+ interface FileOptions extends ReadStreamOptions {
2688
+ cache?: FileReadable;
2689
+ }
2690
+ //#endregion
2691
+ //#region ../../node_modules/basic-ftp/dist/Client.d.ts
2692
+ interface AccessOptions {
2693
+ /** Host the client should connect to. Optional, default is "localhost". */
2694
+ readonly host?: string;
2695
+ /** Port the client should connect to. Optional, default is 21. */
2696
+ readonly port?: number;
2697
+ /** Username to use for login. Optional, default is "anonymous". */
2698
+ readonly user?: string;
2699
+ /** Password to use for login. Optional, default is "guest". */
2700
+ readonly password?: string;
2701
+ /** Use FTPS over TLS. Optional, default is false. True is preferred explicit TLS, "implicit" supports legacy, non-standardized implicit TLS. */
2702
+ readonly secure?: boolean | "implicit";
2703
+ /** TLS options as in [tls.connect(options)](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback), optional. */
2704
+ readonly secureOptions?: ConnectionOptions$1;
2705
+ }
2706
+ //#endregion
2707
+ //#region ../../node_modules/get-uri/dist/ftp.d.ts
2708
+ interface FTPReadable extends Readable {
2709
+ lastModified?: Date;
2710
+ }
2711
+ interface FTPOptions extends AccessOptions {
2712
+ cache?: FTPReadable;
2713
+ }
2714
+ //#endregion
2715
+ //#region ../../node_modules/get-uri/dist/http.d.ts
2716
+ type HttpOrHttpsModule = typeof http_ | typeof https;
2717
+ interface HttpReadableProps {
2718
+ date?: number;
2719
+ parsed?: URL;
2720
+ redirects?: HttpReadable[];
2721
+ }
2722
+ interface HttpReadable extends Readable, HttpReadableProps {}
2723
+ interface HttpOptions extends https.RequestOptions {
2724
+ cache?: HttpReadable;
2725
+ http?: HttpOrHttpsModule;
2726
+ redirects?: HttpReadable[];
2727
+ maxRedirects?: number;
2728
+ }
2729
+ //#endregion
2730
+ //#region ../../node_modules/get-uri/dist/index.d.ts
2731
+ type Protocol$1<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
2732
+ type GetUriProtocol<T> = (parsed: URL, opts?: T) => Promise<Readable>;
2733
+ declare const protocols: {
2734
+ data: GetUriProtocol<DataOptions>;
2735
+ file: GetUriProtocol<FileOptions>;
2736
+ ftp: GetUriProtocol<FTPOptions>;
2737
+ http: GetUriProtocol<HttpOptions>;
2738
+ https: GetUriProtocol<HttpOptions>;
2739
+ };
2740
+ type Protocols = typeof protocols;
2741
+ type ProtocolsOptions = { [P in keyof Protocols]: NonNullable<Parameters<Protocols[P]>[1]> };
2742
+ type ProtocolOpts<T> = { [P in keyof ProtocolsOptions]: Protocol$1<T> extends P ? ProtocolsOptions[P] : never }[keyof Protocols];
2743
+ //#endregion
2744
+ //#region ../../node_modules/degenerator/dist/degenerator.d.ts
2745
+ type DegeneratorName = string | RegExp;
2746
+ type DegeneratorNames = DegeneratorName[];
2747
+ //#endregion
2748
+ //#region ../../node_modules/degenerator/dist/compile.d.ts
2749
+ interface CompileOptions {
2750
+ names?: DegeneratorNames;
2751
+ filename?: string;
2752
+ sandbox?: Context;
2753
+ }
2754
+ //#endregion
2755
+ //#region ../../node_modules/pac-resolver/dist/index.d.ts
2756
+ type PacResolverOptions = CompileOptions;
2757
+ //#endregion
2758
+ //#region ../../node_modules/pac-proxy-agent/dist/index.d.ts
2759
+ type Protocol<T> = T extends `pac+${infer P}:${infer _}` ? P : T extends `${infer P}:${infer _}` ? P : never;
2760
+ type PacProxyAgentOptions<T> = http.AgentOptions & PacResolverOptions & ProtocolOpts<`${Protocol<T>}:`> & HttpProxyAgentOptions<''> & HttpsProxyAgentOptions<''> & SocksProxyAgentOptions & {
2761
+ fallbackToDirect?: boolean;
2762
+ };
2763
+ //#endregion
2764
+ //#region ../../node_modules/proxy-agent/dist/index.d.ts
2765
+ type GetProxyForUrlCallback = (url: string) => string | Promise<string>;
2766
+ /**
2767
+ * Supported proxy types.
2768
+ */
2769
+ type ProxyAgentOptions = HttpProxyAgentOptions<''> & HttpsProxyAgentOptions<''> & SocksProxyAgentOptions & PacProxyAgentOptions<''> & {
2770
+ /**
2771
+ * Default `http.Agent` instance to use when no proxy is
2772
+ * configured for a request. Defaults to a new `http.Agent()`
2773
+ * instance with the proxy agent options passed in.
2774
+ */
2775
+ httpAgent?: http.Agent;
2776
+ /**
2777
+ * Default `http.Agent` instance to use when no proxy is
2778
+ * configured for a request. Defaults to a new `https.Agent()`
2779
+ * instance with the proxy agent options passed in.
2780
+ */
2781
+ httpsAgent?: http.Agent;
2782
+ /**
2783
+ * A callback for dynamic provision of proxy for url.
2784
+ * Defaults to standard proxy environment variables,
2785
+ * see https://www.npmjs.com/package/proxy-from-env for details
2786
+ */
2787
+ getProxyForUrl?: GetProxyForUrlCallback;
2788
+ };
2789
+ /**
2790
+ * Uses the appropriate `Agent` subclass based off of the "proxy"
2791
+ * environment variables that are currently set.
2792
+ *
2793
+ * An LRU cache is used, to prevent unnecessary creation of proxy
2794
+ * `http.Agent` instances.
2795
+ */
2796
+ declare class ProxyAgent extends Agent {
2797
+ /**
2798
+ * Cache for `Agent` instances.
2799
+ */
2800
+ cache: LRUCache<string, Agent>;
2801
+ connectOpts?: ProxyAgentOptions;
2802
+ httpAgent: http.Agent;
2803
+ httpsAgent: http.Agent;
2804
+ getProxyForUrl: GetProxyForUrlCallback;
2805
+ constructor(opts?: ProxyAgentOptions);
2806
+ connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<http.Agent>;
2807
+ destroy(): void;
2808
+ }
2809
+ declare namespace utils_d_exports {
2810
+ export { DEFAULT_CONFIG_PATHS, ProxyConfiguration, RequestOptions$1 as RequestOptions, buildPath, execute, filterAndFormatGithubRemote, filterSensitiveInfoFromRepository, formatBytes, getApiHostForSite, getConfig, getGitHubEventPayload, getProxyAgent, getProxyUrl, getRequestBuilder, isFile, makeTerminalLink, maskString, normalizeRef, performSubCommand, pick, pluralize, recursivelyRemoveUndefinedValues, removeEmptyValues, removeUndefinedValues, resolveConfigFromFile, resolveConfigFromFileAndEnvironment, timedExecAsync };
2811
+ }
2812
+ declare const DEFAULT_CONFIG_PATHS: string[];
2813
+ type TerminalLink<URL extends string> = (strings: TemplateStringsArray) => string & {
2814
+ targetUrl: URL;
2815
+ };
2816
+ declare const makeTerminalLink: <URL_1 extends string>(url: URL_1) => TerminalLink<URL_1>;
2817
+ declare const pick: <T extends Record<any, any>, K extends keyof T>(base: T, keys: K[]) => Partial<T>;
2818
+ declare const getConfig: (configPath: string) => Promise<Record<string, unknown> | undefined>;
2819
+ /**
2820
+ * Applies configurations in this order of priority:
2821
+ * environment > config file > base config
2822
+ */
2823
+ declare const resolveConfigFromFileAndEnvironment: <T extends Record<string, unknown>, U extends Record<string, unknown>>(baseConfig: T, environment: U, params: {
2824
+ configPath?: string | undefined;
2825
+ defaultConfigPaths?: string[] | undefined;
2826
+ configFromFileCallback?: ((configFromFile: any) => void) | undefined;
2827
+ }) => Promise<T & U>;
2828
+ declare const resolveConfigFromFile: <T>(baseConfig: T, params: {
2829
+ configPath?: string;
2830
+ defaultConfigPaths?: string[];
2831
+ }) => Promise<T>;
2832
+ type ProxyType = 'http' | 'https' | 'socks' | 'socks4' | 'socks4a' | 'socks5' | 'socks5h' | 'pac+data' | 'pac+file' | 'pac+ftp' | 'pac+http' | 'pac+https';
2833
+ interface ProxyConfiguration {
2834
+ auth?: {
2835
+ password: string;
2836
+ username: string;
2837
+ };
2838
+ host?: string;
2839
+ port?: number;
2840
+ protocol: ProxyType;
2841
+ }
2842
+ declare const getProxyUrl: (options?: ProxyConfiguration) => string;
2843
+ interface RequestOptions$1 {
2844
+ apiKey: string;
2845
+ appKey?: string;
2846
+ baseUrl: string;
2847
+ headers?: Map<string, string>;
2848
+ overrideUrl?: string;
2849
+ proxyOpts?: ProxyConfiguration;
2850
+ }
2851
+ declare const getRequestBuilder: (options: RequestOptions$1) => RequestBuilder;
2852
+ declare const getProxyAgent: (proxyOpts?: ProxyConfiguration) => ProxyAgent;
2853
+ declare const getApiHostForSite: (site: string) => string;
2854
+ declare const buildPath: (...args: string[]) => string;
2855
+ declare const removeEmptyValues: (tags: SpanTags) => {};
2856
+ declare const removeUndefinedValues: <T extends {
2857
+ [key: string]: unknown;
2858
+ }>(object: T) => T;
2859
+ declare const recursivelyRemoveUndefinedValues: <T extends Record<string, unknown>>(object: T) => Partial<T>;
2860
+ declare const normalizeRef: (ref: string | undefined) => string | undefined;
2861
+ declare const pluralize: (nb: number, singular: string, plural: string) => string;
2862
+ declare const performSubCommand: (command: CommandClass<BaseContext>, commandArgs: string[], context: BaseContext) => Promise<number>;
2863
+ declare const filterSensitiveInfoFromRepository: (repositoryUrl: string | undefined) => string | undefined;
2864
+ declare const filterAndFormatGithubRemote: (rawRemote: string | undefined) => string | undefined;
2865
+ declare const timedExecAsync: <I, O>(f: (input: I) => Promise<O>, input: I) => Promise<number>;
2866
+ /**
2867
+ * Convert bytes to a formatted string in KB, MB, GB, etc.
2868
+ * Note: Lambda documentation uses MB (instead of Mib) to refer to 1024 KB, so we follow that style here
2869
+ * @param bytes
2870
+ * @param decimals
2871
+ */
2872
+ declare const formatBytes: (bytes: number, decimals?: number) => string;
2873
+ declare const maskString: (value?: string) => string;
2874
+ declare const execute: (cmd: string, cwd?: string) => Promise<{
2875
+ stderr: string;
2876
+ stdout: string;
2877
+ }>;
2878
+ type GitHubWebhookPayload = {
2879
+ pull_request?: {
2880
+ head?: {
2881
+ sha: string;
2882
+ };
2883
+ base?: {
2884
+ sha: string;
2885
+ };
2886
+ number?: number;
2887
+ };
2888
+ };
2889
+ declare const getGitHubEventPayload: () => GitHubWebhookPayload | undefined;
2890
+ declare const isFile: (path: string) => boolean;
2891
+ //#endregion
2892
+ //#region ../base/dist/version.d.ts
2893
+ declare const cliVersion: string;
2894
+ /**
2895
+ * Prints version in all commands, except version commands.
2896
+ */
2897
+ declare const printVersion: () => void;
2898
+ //#endregion
2899
+ //#region src/cli.d.ts
2900
+ declare const BETA_COMMANDS: Set<string>;
2901
+ declare const cli: Cli<CommandContext>;
2902
+ //#endregion
2903
+ export { BETA_COMMANDS, cli, cliVersion, library_d_exports as gitMetadata, printVersion, utils_d_exports as utils };
2904
+ //# sourceMappingURL=bundle.d.ts.map