@datadog/datadog-ci-plugin-sarif 5.12.1 → 5.13.1

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,345 @@
1
+ /// <reference types="node" />
2
+ import { Readable, Writable } from "stream";
3
+
4
+ //#region ../../node_modules/typanion/lib/types.d.ts
5
+ declare type BoundCoercionFn = () => BoundCoercionFn;
6
+ declare type CoercionFn = (v: any) => BoundCoercionFn;
7
+ declare type Coercion = [string, BoundCoercionFn];
8
+ declare type LooseTest<U> = (value: U, test?: ValidationState) => boolean;
9
+ declare type ValidationState = {
10
+ p?: string;
11
+ errors?: string[];
12
+ coercions?: Coercion[];
13
+ coercion?: CoercionFn;
14
+ };
15
+ //#endregion
16
+ //#region ../../node_modules/clipanion/lib/format.d.ts
17
+ interface ColorFormat {
18
+ header(str: string): string;
19
+ bold(str: string): string;
20
+ error(str: string): string;
21
+ code(str: string): string;
22
+ }
23
+ //#endregion
24
+ //#region ../../node_modules/clipanion/lib/advanced/options/utils.d.ts
25
+ declare const isOptionSymbol: unique symbol;
26
+ //#endregion
27
+ //#region ../../node_modules/clipanion/lib/advanced/Cli.d.ts
28
+ /**
29
+ * The base context of the CLI.
30
+ *
31
+ * All Contexts have to extend it.
32
+ */
33
+ declare type BaseContext = {
34
+ /**
35
+ * Environment variables.
36
+ *
37
+ * @default
38
+ * process.env
39
+ */
40
+ env: Record<string, string | undefined>;
41
+ /**
42
+ * The input stream of the CLI.
43
+ *
44
+ * @default
45
+ * process.stdin
46
+ */
47
+ stdin: Readable;
48
+ /**
49
+ * The output stream of the CLI.
50
+ *
51
+ * @default
52
+ * process.stdout
53
+ */
54
+ stdout: Writable;
55
+ /**
56
+ * The error stream of the CLI.
57
+ *
58
+ * @default
59
+ * process.stderr
60
+ */
61
+ stderr: Writable;
62
+ /**
63
+ * Whether colors should be enabled.
64
+ */
65
+ colorDepth: number;
66
+ };
67
+ declare type CliOptions = Readonly<{
68
+ /**
69
+ * The label of the binary.
70
+ *
71
+ * Shown at the top of the usage information.
72
+ */
73
+ binaryLabel?: string;
74
+ /**
75
+ * The name of the binary.
76
+ *
77
+ * Included in the path and the examples of the definitions.
78
+ */
79
+ binaryName: string;
80
+ /**
81
+ * The version of the binary.
82
+ *
83
+ * Shown at the top of the usage information.
84
+ */
85
+ binaryVersion?: string;
86
+ /**
87
+ * If `true`, the Cli will hook into the process standard streams to catch
88
+ * the output produced by console.log and redirect them into the context
89
+ * streams. Note: stdin isn't captured at the moment.
90
+ *
91
+ * @default
92
+ * false
93
+ */
94
+ enableCapture: boolean;
95
+ /**
96
+ * If `true`, the Cli will use colors in the output. If `false`, it won't.
97
+ * If `undefined`, Clipanion will infer the correct value from the env.
98
+ */
99
+ enableColors?: boolean;
100
+ }>;
101
+ declare type MiniCli<Context extends BaseContext> = CliOptions & {
102
+ /**
103
+ * Returns an Array representing the definitions of all registered commands.
104
+ */
105
+ definitions(): Array<Definition>;
106
+ /**
107
+ * Formats errors using colors.
108
+ *
109
+ * @param error The error to format. If `error.name` is `'Error'`, it is replaced with `'Internal Error'`.
110
+ * @param opts.command The command whose usage will be included in the formatted error.
111
+ */
112
+ error(error: Error, opts?: {
113
+ command?: Command<Context> | null;
114
+ }): string;
115
+ /**
116
+ * Returns a rich color format if colors are enabled, or a plain text format otherwise.
117
+ *
118
+ * @param colored Forcefully enable or disable colors.
119
+ */
120
+ format(colored?: boolean): ColorFormat;
121
+ /**
122
+ * Compiles a command and its arguments using the `CommandBuilder`.
123
+ *
124
+ * @param input An array containing the name of the command and its arguments
125
+ *
126
+ * @returns The compiled `Command`, with its properties populated with the arguments.
127
+ */
128
+ process(input: Array<string>, context?: Partial<Context>): Command<Context>;
129
+ /**
130
+ * Runs a command.
131
+ *
132
+ * @param input An array containing the name of the command and its arguments
133
+ * @param context Overrides the Context of the main `Cli` instance
134
+ *
135
+ * @returns The exit code of the command
136
+ */
137
+ run(input: Array<string>, context?: Partial<Context>): Promise<number>;
138
+ /**
139
+ * Returns the usage of a command.
140
+ *
141
+ * @param command The `Command` whose usage will be returned or `null` to return the usage of all commands.
142
+ * @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.
143
+ * @param opts.prefix The prefix displayed before each command. Defaults to `$`.
144
+ */
145
+ usage(command?: CommandClass<Context> | Command<Context> | null, opts?: {
146
+ detailed?: boolean;
147
+ prefix?: string;
148
+ }): string;
149
+ };
150
+ //#endregion
151
+ //#region ../../node_modules/clipanion/lib/advanced/Command.d.ts
152
+ /**
153
+ * The usage of a Command.
154
+ */
155
+ declare type Usage = {
156
+ /**
157
+ * The category of the command.
158
+ *
159
+ * Included in the detailed usage.
160
+ */
161
+ category?: string;
162
+ /**
163
+ * The short description of the command, formatted as Markdown.
164
+ *
165
+ * Included in the detailed usage.
166
+ */
167
+ description?: string;
168
+ /**
169
+ * The extended details of the command, formatted as Markdown.
170
+ *
171
+ * Included in the detailed usage.
172
+ */
173
+ details?: string;
174
+ /**
175
+ * Examples of the command represented as an Array of tuples.
176
+ *
177
+ * The first element of the tuple represents the description of the example.
178
+ *
179
+ * The second element of the tuple represents the command of the example.
180
+ * If present, the leading `$0` is replaced with `cli.binaryName`.
181
+ */
182
+ examples?: Array<[string, string]>;
183
+ };
184
+ /**
185
+ * The definition of a Command.
186
+ */
187
+ declare type Definition = Usage & {
188
+ /**
189
+ * The path of the command, starting with `cli.binaryName`.
190
+ */
191
+ path: string;
192
+ /**
193
+ * The detailed usage of the command.
194
+ */
195
+ usage: string;
196
+ /**
197
+ * The various options registered on the command.
198
+ */
199
+ options: Array<{
200
+ definition: string;
201
+ description?: string;
202
+ required: boolean;
203
+ }>;
204
+ };
205
+ declare type CommandClass<Context extends BaseContext = BaseContext> = {
206
+ new (): Command<Context>;
207
+ paths?: Array<Array<string>>;
208
+ schema?: Array<LooseTest<{
209
+ [key: string]: unknown;
210
+ }>>;
211
+ usage?: Usage;
212
+ };
213
+ /**
214
+ * Base abstract class for CLI commands. The main thing to remember is to
215
+ * declare an async `execute` member function that will be called when the
216
+ * command is invoked from the CLI, and optionally a `paths` property to
217
+ * declare the set of paths under which the command should be exposed.
218
+ */
219
+ declare abstract class Command<Context extends BaseContext = BaseContext> {
220
+ /**
221
+ * @deprecated Do not use this; prefer the static `paths` property instead.
222
+ */
223
+ paths?: undefined;
224
+ /**
225
+ * Defined to prevent a common typo.
226
+ */
227
+ static path: never;
228
+ /**
229
+ * Paths under which the command should be exposed.
230
+ */
231
+ static paths?: Array<Array<string>>;
232
+ /**
233
+ * Defines the usage information for the given command.
234
+ */
235
+ static Usage(usage: Usage): Usage;
236
+ /**
237
+ * Contains the usage information for the command. If undefined, the
238
+ * command will be hidden from the general listing.
239
+ */
240
+ static usage?: Usage;
241
+ /**
242
+ * Defines a schema to apply before running the `execute` method. The
243
+ * schema is expected to be generated by Typanion.
244
+ *
245
+ * @see https://github.com/arcanis/typanion
246
+ */
247
+ static schema?: Array<LooseTest<{
248
+ [key: string]: unknown;
249
+ }>>;
250
+ /**
251
+ * Standard function that'll get executed by `Cli#run` and `Cli#runExit`.
252
+ *
253
+ * Expected to return an exit code or nothing (which Clipanion will treat
254
+ * as if 0 had been returned).
255
+ */
256
+ abstract execute(): Promise<number | void>;
257
+ /**
258
+ * Standard error handler which will simply rethrow the error. Can be used
259
+ * to add custom logic to handle errors from the command or simply return
260
+ * the parent class error handling.
261
+ */
262
+ catch(error: any): Promise<void>;
263
+ /**
264
+ * Predefined that will be set to true if `-h,--help` has been used, in
265
+ * which case `Command#execute` won't be called.
266
+ */
267
+ help: boolean;
268
+ /**
269
+ * Predefined variable that will be populated with a miniature API that can
270
+ * be used to query Clipanion and forward commands.
271
+ */
272
+ cli: MiniCli<Context>;
273
+ /**
274
+ * Predefined variable that will be populated with the context of the
275
+ * application.
276
+ */
277
+ context: Context;
278
+ /**
279
+ * Predefined variable that will be populated with the path that got used
280
+ * to access the command currently being executed.
281
+ */
282
+ path: Array<string>;
283
+ validateAndExecute(): Promise<number>;
284
+ /**
285
+ * Used to detect option definitions.
286
+ */
287
+ static isOption: typeof isOptionSymbol;
288
+ /**
289
+ * Just an helper to use along with the `paths` fields, to make it
290
+ * clearer that a command is the default one.
291
+ *
292
+ * @example
293
+ * class MyCommand extends Command {
294
+ * static paths = [Command.Default];
295
+ * }
296
+ */
297
+ static Default: never[];
298
+ }
299
+ //#endregion
300
+ //#region ../base/dist/index.d.ts
301
+ type CommandContext = BaseContext & {
302
+ builtinPlugins: string[];
303
+ };
304
+ /**
305
+ * This command should be extended by **every** command in the monorepo.
306
+ */
307
+ declare abstract class BaseCommand extends Command<CommandContext> {}
308
+ //#endregion
309
+ //#region ../base/dist/commands/sarif/upload.d.ts
310
+ declare class SarifUploadCommand extends BaseCommand {
311
+ static paths: string[][];
312
+ static usage: Usage;
313
+ protected fips: boolean;
314
+ protected fipsIgnoreError: boolean;
315
+ protected basePaths: string[];
316
+ protected dryRun: boolean;
317
+ protected env: string;
318
+ protected maxConcurrency: number;
319
+ protected serviceFromCli: string | undefined;
320
+ protected tags: string[] | undefined;
321
+ protected gitPath: string | undefined;
322
+ protected noVerify: boolean;
323
+ protected noCiTags: boolean;
324
+ execute(): Promise<number | void>;
325
+ }
326
+ //#endregion
327
+ //#region src/commands/upload.d.ts
328
+ declare class PluginCommand extends SarifUploadCommand {
329
+ private config;
330
+ private fipsConfig;
331
+ execute(): Promise<1 | undefined>;
332
+ private uploadSarifReport;
333
+ private getApiHelper;
334
+ private getMatchingSarifReports;
335
+ }
336
+ //#endregion
337
+ //#region dist/.bundle-entry.d.ts
338
+ declare const commands: {
339
+ upload: {
340
+ PluginCommand: typeof PluginCommand;
341
+ };
342
+ };
343
+ //#endregion
344
+ export { commands };
345
+ //# sourceMappingURL=bundle.d.ts.map