@datadog/datadog-ci 2.1.0 → 2.2.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.
Files changed (54) hide show
  1. package/dist/commands/lambda/__tests__/functions/commons.test.js +0 -21
  2. package/dist/commands/lambda/__tests__/functions/commons.test.js.map +1 -1
  3. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +1 -0
  4. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +1 -1
  5. package/dist/commands/lambda/__tests__/instrument.test.js +113 -59
  6. package/dist/commands/lambda/__tests__/instrument.test.js.map +1 -1
  7. package/dist/commands/lambda/__tests__/uninstrument.test.js +40 -16
  8. package/dist/commands/lambda/__tests__/uninstrument.test.js.map +1 -1
  9. package/dist/commands/lambda/constants.d.ts +1 -0
  10. package/dist/commands/lambda/constants.js +3 -2
  11. package/dist/commands/lambda/constants.js.map +1 -1
  12. package/dist/commands/lambda/functions/commons.d.ts +3 -1
  13. package/dist/commands/lambda/functions/commons.js +43 -10
  14. package/dist/commands/lambda/functions/commons.js.map +1 -1
  15. package/dist/commands/lambda/instrument.d.ts +1 -0
  16. package/dist/commands/lambda/instrument.js +98 -50
  17. package/dist/commands/lambda/instrument.js.map +1 -1
  18. package/dist/commands/lambda/interfaces.d.ts +1 -0
  19. package/dist/commands/lambda/prompt.d.ts +1 -0
  20. package/dist/commands/lambda/prompt.js +32 -9
  21. package/dist/commands/lambda/prompt.js.map +1 -1
  22. package/dist/commands/lambda/renderer.d.ts +366 -0
  23. package/dist/commands/lambda/renderer.js +450 -0
  24. package/dist/commands/lambda/renderer.js.map +1 -0
  25. package/dist/commands/lambda/uninstrument.d.ts +1 -0
  26. package/dist/commands/lambda/uninstrument.js +76 -30
  27. package/dist/commands/lambda/uninstrument.js.map +1 -1
  28. package/dist/commands/metric/__tests__/metric.test.js +1 -1
  29. package/dist/commands/metric/__tests__/metric.test.js.map +1 -1
  30. package/dist/commands/react-native/xcode.js +1 -1
  31. package/dist/commands/react-native/xcode.js.map +1 -1
  32. package/dist/commands/synthetics/__tests__/fixtures.d.ts +1 -1
  33. package/dist/commands/synthetics/__tests__/fixtures.js +3 -0
  34. package/dist/commands/synthetics/__tests__/fixtures.js.map +1 -1
  35. package/dist/commands/synthetics/command.js +5 -1
  36. package/dist/commands/synthetics/command.js.map +1 -1
  37. package/dist/commands/synthetics/reporters/default.js +6 -0
  38. package/dist/commands/synthetics/reporters/default.js.map +1 -1
  39. package/dist/commands/synthetics/tunnel/crypto.d.ts +1 -1
  40. package/dist/commands/synthetics/tunnel/crypto.js.map +1 -1
  41. package/dist/commands/synthetics/tunnel/tunnel.js +1 -1
  42. package/dist/commands/synthetics/tunnel/tunnel.js.map +1 -1
  43. package/dist/commands/tag/__tests__/tag.test.js +1 -1
  44. package/dist/commands/tag/__tests__/tag.test.js.map +1 -1
  45. package/dist/helpers/__tests__/ci.test.js +12 -1
  46. package/dist/helpers/__tests__/ci.test.js.map +1 -1
  47. package/dist/helpers/__tests__/validation.test.js +2 -0
  48. package/dist/helpers/__tests__/validation.test.js.map +1 -1
  49. package/dist/helpers/ci.js +7 -1
  50. package/dist/helpers/ci.js.map +1 -1
  51. package/dist/helpers/validation.d.ts +10 -1
  52. package/dist/helpers/validation.js +12 -0
  53. package/dist/helpers/validation.js.map +1 -1
  54. package/package.json +7 -7
@@ -0,0 +1,366 @@
1
+ import ora from 'ora';
2
+ import { InstrumentCommand } from './instrument';
3
+ import { UninstrumentCommand } from './uninstrument';
4
+ /**
5
+ * @returns a header indicating which `lambda` subcommand is running.
6
+ * @param command current selected lambda subcommand.
7
+ *
8
+ * ```txt
9
+ * [Dry Run] 🐶 Instrumenting Lambda function
10
+ * ```
11
+ */
12
+ export declare const renderLambdaHeader: (commandType: InstrumentCommand | UninstrumentCommand, isDryRun: boolean) => string;
13
+ /**
14
+ * @param commandType the type of command being used.
15
+ * @returns a message indicating that no functions are specified depending on the given command.
16
+ *
17
+ * ```txt
18
+ * [Error] No functions specified for instrumentation.
19
+ * or
20
+ * [Error] No functions specified for uninstrumentation.
21
+ * ```
22
+ */
23
+ export declare const renderNoFunctionsSpecifiedError: (commandType: InstrumentCommand | UninstrumentCommand) => string;
24
+ /**
25
+ * @returns a message indicating that both options `--extensionVersion` and `--forwarder` are set.
26
+ *
27
+ * ```txt
28
+ * [Error] "extensionVersion" and "forwarder" should not be used at the same time.
29
+ * ```
30
+ */
31
+ export declare const renderExtensionAndForwarderOptionsBothSetError: () => string;
32
+ /**
33
+ * @returns a message indicating that the environment variable `DATADOG_API_KEY` is missing.
34
+ *
35
+ * ```txt
36
+ * [Error] Missing DATADOG_API_KEY in your environment.
37
+ * ```
38
+ */
39
+ export declare const renderMissingDatadogApiKeyError: () => string;
40
+ /**
41
+ * @param functionsCommandUsed a boolean indicating which command was used for the specified functions.
42
+ * @returns a message indicating that option `--functions-regex`
43
+ * is being used along with either `--functions` or the parameter
44
+ * `functions` in a config file.
45
+ *
46
+ * ```txt
47
+ * [Error] "--functions" and "--functions-regex" should not be used at the same time.
48
+ * or
49
+ * [Error] Functions in config file and "--functions-regex" should not be used at the same time.
50
+ * ```
51
+ */
52
+ export declare const renderFunctionsAndFunctionsRegexOptionsBothSetError: (functionsCommandUsed: boolean) => string;
53
+ /**
54
+ * @returns a message indicating that `--functions-regex` argument contains `:` which is mainly used with ARNs.
55
+ *
56
+ * ```txt
57
+ * [Error] "--functions-regex" isn't meant to be used with ARNs.
58
+ * ```
59
+ */
60
+ export declare const renderRegexSetWithARNError: () => string;
61
+ /**
62
+ * @returns a message indicating that no default region has been specified.
63
+ *
64
+ * ```txt
65
+ * [Error] No default region specified. Use `-r`, `--region`.'
66
+ * ```
67
+ */
68
+ export declare const renderNoDefaultRegionSpecifiedError: () => string;
69
+ /**
70
+ * @param error an error message or an object of type `unknown`*.
71
+ * @returns a message indicating that an error occurred while grouping functions.
72
+ *
73
+ * * Using unknown since we're not type guarding.
74
+ *
75
+ * ```txt
76
+ * [Error] Couldn't group functions. The provided error goes here!
77
+ * ```
78
+ */
79
+ export declare const renderCouldntGroupFunctionsError: (error: unknown) => string;
80
+ /**
81
+ * @param error an error message or an object of type `unknown`*.
82
+ * @returns a message indicating that an error occurred while updating.
83
+ *
84
+ * * Using unknown since we're not type guarding.
85
+ *
86
+ * ```txt
87
+ * [Error] Failure during update. The provided error goes here!
88
+ * ```
89
+ */
90
+ export declare const renderFailureDuringUpdateError: (error: unknown) => string;
91
+ /**
92
+ * @param error an error message or an object of type `unknown`*.
93
+ * @returns the provided error prefixed by {@link errorTag}.
94
+ *
95
+ * * Using unknown since we're not type guarding.
96
+ *
97
+ * ```txt
98
+ * [Error] The provided error goes here!
99
+ * ```
100
+ */
101
+ export declare const renderError: (error: unknown) => string;
102
+ /**
103
+ * @param warning the message to warn about
104
+ * @returns the provided warning prefixed by {@link warningTag}.
105
+ *
106
+ * ```txt
107
+ * [Warning] The provided warning goes here!
108
+ * ```
109
+ */
110
+ export declare const renderWarning: (warning: string) => string;
111
+ /**
112
+ * @param warning the message to warn about
113
+ * @returns the provided warning prefixed by {@link warningExclamationSignTag}.
114
+ *
115
+ * ```txt
116
+ * [!] The provided warning goes here!
117
+ * ```
118
+ */
119
+ export declare const renderSoftWarning: (warning: string) => string;
120
+ /**
121
+ * @returns a message suggesting to instrument in dev or staging environment first.
122
+ *
123
+ * ```txt
124
+ * [Warning] Instrument your Lambda functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run `uninstrument` with the same arguments to revert the changes.
125
+ * ```
126
+ */
127
+ export declare const renderInstrumentInStagingFirst: () => string;
128
+ /**
129
+ * @returns a soft warning message indicating that functions are going to be updated.
130
+ *
131
+ * ```txt
132
+ * Functions to be updated:
133
+ * ```
134
+ */
135
+ export declare const renderFunctionsToBeUpdated: () => string;
136
+ /**
137
+ * @returns a warning message reminding the user to lock versions for production.
138
+ *
139
+ * ```txt
140
+ * [Warning] At least one latest layer version is being used. Ensure to lock in versions for production applications using `--layerVersion` and `--extensionVersion`.
141
+ * ```
142
+ */
143
+ export declare const renderEnsureToLockLayerVersionsWarning: () => string;
144
+ /**
145
+ * @returns a message indicating that no AWS credentials where found.
146
+ *
147
+ * ```txt
148
+ * [!] No AWS credentials found, lets set them up! Or you can re-run the command and supply the AWS credentials in the same way when you invoke the AWS CLI.
149
+ * ```
150
+ */
151
+ export declare const renderNoAWSCredentialsFound: () => string;
152
+ /**
153
+ * @returns a message indicating to configure AWS region.
154
+ *
155
+ * ```txt
156
+ * [!] Configure AWS region.
157
+ * ```
158
+ */
159
+ export declare const renderConfigureAWSRegion: () => string;
160
+ /**
161
+ * @returns a message indicating to configure Datadog settings.
162
+ *
163
+ * ```txt
164
+ * [!] Configure Datadog settings.
165
+ * ```
166
+ */
167
+ export declare const renderConfigureDatadog: () => string;
168
+ /**
169
+ * @returns a message indicating that no Lambda functions were found
170
+ * in the specified region.
171
+ *
172
+ * ```txt
173
+ * [Error] Couldn't find any Lambda functions in the specified region.
174
+ * ```
175
+ */
176
+ export declare const renderCouldntFindLambdaFunctionsInRegionError: () => string;
177
+ /**
178
+ * @param error an error message or an object of type `unknown`*.
179
+ * @returns a message indicating that no Lambda functions were fetched.
180
+ *
181
+ * * Using unknown since we're not type guarding.
182
+ *
183
+ * ```txt
184
+ * [Error] Couldn't fetch Lambda functions. The provided error goes here!
185
+ * ```
186
+ */
187
+ export declare const renderCouldntFetchLambdaFunctionsError: (error: unknown) => string;
188
+ /**
189
+ * @param tagsMissing an array containing the tags that are not configured
190
+ * @returns a message indicating which tags are not configured and where to
191
+ * learn more about Datadog's unified service tagging.
192
+ *
193
+ * ```txt
194
+ * [Warning] The service tag has not been configures. Learn more about Datadog unified service tagging: https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/#serverless-environment.
195
+ * ```
196
+ */
197
+ export declare const renderTagsNotConfiguredWarning: (tagsMissing: string[]) => string;
198
+ /**
199
+ * @returns a message indicating that the extra tags provided do not comply
200
+ * with the <key>:<value> array standard.
201
+ *
202
+ * ```txt
203
+ * [Error] Extra tags do not comply with the <key>:<value> array.
204
+ * ```
205
+ */
206
+ export declare const renderExtraTagsDontComplyError: () => string;
207
+ /**
208
+ * @returns a message indicating that the `--layerVersion` argument provided is invalid.
209
+ *
210
+ * ```txt
211
+ * [Error] Invalid layer version "provided value".
212
+ * ```
213
+ */
214
+ export declare const renderInvalidLayerVersionError: (layerVersion?: string | undefined) => string;
215
+ /**
216
+ * @returns a message indicating that the `--extensionVersion` argument provided is invalid.
217
+ *
218
+ * ```txt
219
+ * [Error] Invalid extension version "provided value".
220
+ * ```
221
+ */
222
+ export declare const renderInvalidExtensionVersionError: (extensionVersion?: string | undefined) => string;
223
+ /**
224
+ * @returns a message indicating that the provided argument for a specific string boolean
225
+ * field was invalid.
226
+ *
227
+ * ```txt
228
+ * [Error] Invalid boolean specified for "string boolean field".
229
+ * ```
230
+ */
231
+ export declare const renderInvalidStringBooleanSpecifiedError: (stringBoolean: string) => string;
232
+ /**
233
+ * @param isDryRun a boolean to define if a prefix should be added.
234
+ * @returns a message indicating that no updates will be applied.
235
+ *
236
+ * ```txt
237
+ * [Dry Run] No updates will be applied.
238
+ * or
239
+ * No updates will be applied.
240
+ * ```
241
+ */
242
+ export declare const renderNoUpdatesApplied: (isDryRun: boolean) => string;
243
+ /**
244
+ * @param isDryRun a boolean to define if a prefix should be added.
245
+ * @returns a message indicating that updates will be applied.
246
+ *
247
+ * ```txt
248
+ * [Dry Run] Will apply the following updates:
249
+ * or
250
+ * Will apply the following updates:
251
+ * ```
252
+ */
253
+ export declare const renderWillApplyUpdates: (isDryRun: boolean) => string;
254
+ /**
255
+ * @returns a soft warning message indicating that confirmation is needed.
256
+ *
257
+ * ```txt
258
+ * [!] Confirmation needed.
259
+ * ```
260
+ */
261
+ export declare const renderConfirmationNeededSoftWarning: () => string;
262
+ /**
263
+ * @returns a soft warning message indicating that functions are being instrumented.
264
+ *
265
+ * ```txt
266
+ * [!] Instrumenting functions.
267
+ * ```
268
+ */
269
+ export declare const renderInstrumentingFunctionsSoftWarning: () => string;
270
+ /**
271
+ * @returns a soft warning message indicating the removal of instrumentation
272
+ * for functions.
273
+ *
274
+ * ```txt
275
+ * [!] Uninstrumenting functions.
276
+ * ```
277
+ */
278
+ export declare const renderUninstrumentingFunctionsSoftWarning: () => string;
279
+ /**
280
+ * @param functionsLength the number of Lambda functions that were fetched.
281
+ * @returns a message indicating that it fetched Lambda functions.
282
+ *
283
+ * ```txt
284
+ * Fetched 42 Lambda functions.
285
+ * ```
286
+ */
287
+ export declare const renderFetchedLambdaFunctions: (functionsLength: number) => string;
288
+ /**
289
+ * @param region the AWS region where the Lambda configs belong to.
290
+ * @param configsLength the number of Lambda configuration that were fetched.
291
+ * @returns a message indicating that it updated Lambda functions.
292
+ *
293
+ * ```txt
294
+ * [us-east-1] Fetched 42 Lambda configurations.
295
+ * ```
296
+ */
297
+ export declare const renderFetchedLambdaConfigurationsFromRegion: (region: string, configsLength: number) => string;
298
+ /**
299
+ * @param functionsLength the number of Lambda functions that were updated.
300
+ * @returns a message indicating that it updated Lambda functions.
301
+ *
302
+ * ```txt
303
+ * Updated 42 Lambda functions.
304
+ * ```
305
+ */
306
+ export declare const renderUpdatedLambdaFunctions: (functionsLength: number) => string;
307
+ /**
308
+ * @returns a message indicating that it failed to fetch Lambda functions.
309
+ *
310
+ * ```txt
311
+ * Failed fetching Lambda functions.
312
+ * ```
313
+ */
314
+ export declare const renderFailedFetchingLambdaFunctions: () => string;
315
+ /**
316
+ * @param region the AWS region where the Lambda configs belong to.
317
+ * @returns a message indicating that it failed to fetch Lambda configurations.
318
+ * from a region.
319
+ *
320
+ * ```txt
321
+ * [us-east-1] Failed fetching Lambda configurations.
322
+ * ```
323
+ */
324
+ export declare const renderFailedFetchingLambdaConfigurationsFromRegion: (region: string) => string;
325
+ /**
326
+ * @returns a message indicating that it failed to update Lambda functions.
327
+ *
328
+ * ```txt
329
+ * Failed updating Lambda functions.
330
+ * ```
331
+ */
332
+ export declare const renderFailedUpdatingLambdaFunctions: () => string;
333
+ /**
334
+ * Returns a spinner instance with text for lambda functions fetching.
335
+ *
336
+ * @returns an instance of an {@link ora} spinner.
337
+ *
338
+ * ```txt
339
+ * ⠋ Fetching Lambda functions.
340
+ * ```
341
+ */
342
+ export declare const fetchingFunctionsSpinner: () => ora.Ora;
343
+ /**
344
+ * Returns a spinner instance with text for lambda configurations fetching.
345
+ *
346
+ * @returns an instance of {@link ora} spinner.
347
+ *
348
+ * ```txt
349
+ * ⠋ [us-east-1] Fetching Lambda configurations.
350
+ * ```
351
+ */
352
+ export declare const fetchingFunctionsConfigSpinner: (region: string) => ora.Ora;
353
+ /**
354
+ * Returns a spinner instance with text for lambda functions updating.
355
+ *
356
+ * @returns an instance of an {@link ora} spinner.
357
+ *
358
+ * ```txt
359
+ * ⠋ Updating 5 Lambda functions.
360
+ * ```
361
+ */
362
+ export declare const updatingFunctionsSpinner: (functions: number) => ora.Ora;
363
+ export declare const dryRunTag: string;
364
+ export declare const errorTag: string;
365
+ export declare const warningTag: string;
366
+ export declare const warningExclamationSignTag: string;