@datadog/datadog-ci 2.1.0 → 2.3.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 (74) hide show
  1. package/README.md +6 -6
  2. package/dist/commands/lambda/__tests__/functions/commons.test.js +8 -21
  3. package/dist/commands/lambda/__tests__/functions/commons.test.js.map +1 -1
  4. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +71 -0
  5. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +1 -1
  6. package/dist/commands/lambda/__tests__/instrument.test.js +165 -75
  7. package/dist/commands/lambda/__tests__/instrument.test.js.map +1 -1
  8. package/dist/commands/lambda/__tests__/uninstrument.test.js +40 -16
  9. package/dist/commands/lambda/__tests__/uninstrument.test.js.map +1 -1
  10. package/dist/commands/lambda/constants.d.ts +3 -0
  11. package/dist/commands/lambda/constants.js +5 -2
  12. package/dist/commands/lambda/constants.js.map +1 -1
  13. package/dist/commands/lambda/functions/commons.d.ts +5 -3
  14. package/dist/commands/lambda/functions/commons.js +43 -10
  15. package/dist/commands/lambda/functions/commons.js.map +1 -1
  16. package/dist/commands/lambda/functions/uninstrument.js +10 -2
  17. package/dist/commands/lambda/functions/uninstrument.js.map +1 -1
  18. package/dist/commands/lambda/instrument.d.ts +3 -2
  19. package/dist/commands/lambda/instrument.js +123 -81
  20. package/dist/commands/lambda/instrument.js.map +1 -1
  21. package/dist/commands/lambda/interfaces.d.ts +1 -0
  22. package/dist/commands/lambda/prompt.d.ts +1 -0
  23. package/dist/commands/lambda/prompt.js +32 -9
  24. package/dist/commands/lambda/prompt.js.map +1 -1
  25. package/dist/commands/lambda/renderer.d.ts +366 -0
  26. package/dist/commands/lambda/renderer.js +450 -0
  27. package/dist/commands/lambda/renderer.js.map +1 -0
  28. package/dist/commands/lambda/uninstrument.d.ts +1 -0
  29. package/dist/commands/lambda/uninstrument.js +76 -30
  30. package/dist/commands/lambda/uninstrument.js.map +1 -1
  31. package/dist/commands/metric/__tests__/metric.test.js +1 -1
  32. package/dist/commands/metric/__tests__/metric.test.js.map +1 -1
  33. package/dist/commands/react-native/xcode.js +1 -1
  34. package/dist/commands/react-native/xcode.js.map +1 -1
  35. package/dist/commands/synthetics/__tests__/fixtures.d.ts +1 -1
  36. package/dist/commands/synthetics/__tests__/fixtures.js +3 -0
  37. package/dist/commands/synthetics/__tests__/fixtures.js.map +1 -1
  38. package/dist/commands/synthetics/__tests__/run-test.test.js +4 -4
  39. package/dist/commands/synthetics/__tests__/run-test.test.js.map +1 -1
  40. package/dist/commands/synthetics/__tests__/utils.test.js +25 -3
  41. package/dist/commands/synthetics/__tests__/utils.test.js.map +1 -1
  42. package/dist/commands/synthetics/command.js +5 -1
  43. package/dist/commands/synthetics/command.js.map +1 -1
  44. package/dist/commands/synthetics/errors.d.ts +1 -1
  45. package/dist/commands/synthetics/errors.js +1 -0
  46. package/dist/commands/synthetics/errors.js.map +1 -1
  47. package/dist/commands/synthetics/reporters/default.js +6 -0
  48. package/dist/commands/synthetics/reporters/default.js.map +1 -1
  49. package/dist/commands/synthetics/run-test.js +1 -1
  50. package/dist/commands/synthetics/run-test.js.map +1 -1
  51. package/dist/commands/synthetics/tunnel/crypto.d.ts +1 -1
  52. package/dist/commands/synthetics/tunnel/crypto.js.map +1 -1
  53. package/dist/commands/synthetics/tunnel/tunnel.js +1 -1
  54. package/dist/commands/synthetics/tunnel/tunnel.js.map +1 -1
  55. package/dist/commands/synthetics/utils.d.ts +4 -4
  56. package/dist/commands/synthetics/utils.js +8 -7
  57. package/dist/commands/synthetics/utils.js.map +1 -1
  58. package/dist/commands/tag/__tests__/tag.test.js +1 -1
  59. package/dist/commands/tag/__tests__/tag.test.js.map +1 -1
  60. package/dist/helpers/__tests__/ci.test.js +12 -1
  61. package/dist/helpers/__tests__/ci.test.js.map +1 -1
  62. package/dist/helpers/__tests__/validation.test.js +2 -0
  63. package/dist/helpers/__tests__/validation.test.js.map +1 -1
  64. package/dist/helpers/ci.js +19 -23
  65. package/dist/helpers/ci.js.map +1 -1
  66. package/dist/helpers/user-provided-git.js +1 -1
  67. package/dist/helpers/user-provided-git.js.map +1 -1
  68. package/dist/helpers/utils.d.ts +1 -0
  69. package/dist/helpers/utils.js +20 -1
  70. package/dist/helpers/utils.js.map +1 -1
  71. package/dist/helpers/validation.d.ts +10 -1
  72. package/dist/helpers/validation.js +12 -0
  73. package/dist/helpers/validation.js.map +1 -1
  74. package/package.json +7 -7
@@ -0,0 +1,450 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.warningExclamationSignTag = exports.warningTag = exports.errorTag = exports.dryRunTag = exports.updatingFunctionsSpinner = exports.fetchingFunctionsConfigSpinner = exports.fetchingFunctionsSpinner = exports.renderFailedUpdatingLambdaFunctions = exports.renderFailedFetchingLambdaConfigurationsFromRegion = exports.renderFailedFetchingLambdaFunctions = exports.renderUpdatedLambdaFunctions = exports.renderFetchedLambdaConfigurationsFromRegion = exports.renderFetchedLambdaFunctions = exports.renderUninstrumentingFunctionsSoftWarning = exports.renderInstrumentingFunctionsSoftWarning = exports.renderConfirmationNeededSoftWarning = exports.renderWillApplyUpdates = exports.renderNoUpdatesApplied = exports.renderInvalidStringBooleanSpecifiedError = exports.renderInvalidExtensionVersionError = exports.renderInvalidLayerVersionError = exports.renderExtraTagsDontComplyError = exports.renderTagsNotConfiguredWarning = exports.renderCouldntFetchLambdaFunctionsError = exports.renderCouldntFindLambdaFunctionsInRegionError = exports.renderConfigureDatadog = exports.renderConfigureAWSRegion = exports.renderNoAWSCredentialsFound = exports.renderEnsureToLockLayerVersionsWarning = exports.renderFunctionsToBeUpdated = exports.renderInstrumentInStagingFirst = exports.renderSoftWarning = exports.renderWarning = exports.renderError = exports.renderFailureDuringUpdateError = exports.renderCouldntGroupFunctionsError = exports.renderNoDefaultRegionSpecifiedError = exports.renderRegexSetWithARNError = exports.renderFunctionsAndFunctionsRegexOptionsBothSetError = exports.renderMissingDatadogApiKeyError = exports.renderExtensionAndForwarderOptionsBothSetError = exports.renderNoFunctionsSpecifiedError = exports.renderLambdaHeader = void 0;
7
+ const chalk_1 = require("chalk");
8
+ const ora_1 = __importDefault(require("ora"));
9
+ const uninstrument_1 = require("./uninstrument");
10
+ /**
11
+ * @returns a header indicating which `lambda` subcommand is running.
12
+ * @param command current selected lambda subcommand.
13
+ *
14
+ * ```txt
15
+ * [Dry Run] 🐶 Instrumenting Lambda function
16
+ * ```
17
+ */
18
+ const renderLambdaHeader = (commandType, isDryRun) => {
19
+ const prefix = isDryRun ? `${exports.dryRunTag} ` : '';
20
+ let commandVerb = 'Instrumenting';
21
+ if (commandType === uninstrument_1.UninstrumentCommand.prototype) {
22
+ commandVerb = 'Uninstrumenting';
23
+ }
24
+ return `\n${prefix}🐶 ${commandVerb} Lambda function\n`;
25
+ };
26
+ exports.renderLambdaHeader = renderLambdaHeader;
27
+ /**
28
+ * @param commandType the type of command being used.
29
+ * @returns a message indicating that no functions are specified depending on the given command.
30
+ *
31
+ * ```txt
32
+ * [Error] No functions specified for instrumentation.
33
+ * or
34
+ * [Error] No functions specified for uninstrumentation.
35
+ * ```
36
+ */
37
+ const renderNoFunctionsSpecifiedError = (commandType) => {
38
+ let commandWords = 'instrument';
39
+ if (commandType === uninstrument_1.UninstrumentCommand.prototype) {
40
+ commandWords = 'remove instrumentation';
41
+ }
42
+ return exports.renderError(`No functions specified to ${commandWords}.`);
43
+ };
44
+ exports.renderNoFunctionsSpecifiedError = renderNoFunctionsSpecifiedError;
45
+ /**
46
+ * @returns a message indicating that both options `--extensionVersion` and `--forwarder` are set.
47
+ *
48
+ * ```txt
49
+ * [Error] "extensionVersion" and "forwarder" should not be used at the same time.
50
+ * ```
51
+ */
52
+ const renderExtensionAndForwarderOptionsBothSetError = () => exports.renderError('"extensionVersion" and "forwarder" should not be used at the same time.');
53
+ exports.renderExtensionAndForwarderOptionsBothSetError = renderExtensionAndForwarderOptionsBothSetError;
54
+ /**
55
+ * @returns a message indicating that the environment variable `DATADOG_API_KEY` is missing.
56
+ *
57
+ * ```txt
58
+ * [Error] Missing DATADOG_API_KEY in your environment.
59
+ * ```
60
+ */
61
+ const renderMissingDatadogApiKeyError = () => exports.renderError('Missing DATADOG_API_KEY in your environment.');
62
+ exports.renderMissingDatadogApiKeyError = renderMissingDatadogApiKeyError;
63
+ /**
64
+ * @param functionsCommandUsed a boolean indicating which command was used for the specified functions.
65
+ * @returns a message indicating that option `--functions-regex`
66
+ * is being used along with either `--functions` or the parameter
67
+ * `functions` in a config file.
68
+ *
69
+ * ```txt
70
+ * [Error] "--functions" and "--functions-regex" should not be used at the same time.
71
+ * or
72
+ * [Error] Functions in config file and "--functions-regex" should not be used at the same time.
73
+ * ```
74
+ */
75
+ const renderFunctionsAndFunctionsRegexOptionsBothSetError = (functionsCommandUsed) => {
76
+ const usedCommand = functionsCommandUsed ? '"--functions"' : 'Functions in config file';
77
+ return exports.renderError(`${usedCommand} and "--functions-regex" should not be used at the same time.`);
78
+ };
79
+ exports.renderFunctionsAndFunctionsRegexOptionsBothSetError = renderFunctionsAndFunctionsRegexOptionsBothSetError;
80
+ /**
81
+ * @returns a message indicating that `--functions-regex` argument contains `:` which is mainly used with ARNs.
82
+ *
83
+ * ```txt
84
+ * [Error] "--functions-regex" isn't meant to be used with ARNs.
85
+ * ```
86
+ */
87
+ const renderRegexSetWithARNError = () => exports.renderError(`"--functions-regex" isn't meant to be used with ARNs.`);
88
+ exports.renderRegexSetWithARNError = renderRegexSetWithARNError;
89
+ /**
90
+ * @returns a message indicating that no default region has been specified.
91
+ *
92
+ * ```txt
93
+ * [Error] No default region specified. Use `-r`, `--region`.'
94
+ * ```
95
+ */
96
+ const renderNoDefaultRegionSpecifiedError = () => exports.renderError('No default region specified. Use `-r`, `--region`.');
97
+ exports.renderNoDefaultRegionSpecifiedError = renderNoDefaultRegionSpecifiedError;
98
+ /**
99
+ * @param error an error message or an object of type `unknown`*.
100
+ * @returns a message indicating that an error occurred while grouping functions.
101
+ *
102
+ * * Using unknown since we're not type guarding.
103
+ *
104
+ * ```txt
105
+ * [Error] Couldn't group functions. The provided error goes here!
106
+ * ```
107
+ */
108
+ const renderCouldntGroupFunctionsError = (error) => exports.renderError(`Couldn't group functions. ${error}`);
109
+ exports.renderCouldntGroupFunctionsError = renderCouldntGroupFunctionsError;
110
+ /**
111
+ * @param error an error message or an object of type `unknown`*.
112
+ * @returns a message indicating that an error occurred while updating.
113
+ *
114
+ * * Using unknown since we're not type guarding.
115
+ *
116
+ * ```txt
117
+ * [Error] Failure during update. The provided error goes here!
118
+ * ```
119
+ */
120
+ const renderFailureDuringUpdateError = (error) => exports.renderError(`Failure during update. ${error}`);
121
+ exports.renderFailureDuringUpdateError = renderFailureDuringUpdateError;
122
+ /**
123
+ * @param error an error message or an object of type `unknown`*.
124
+ * @returns the provided error prefixed by {@link errorTag}.
125
+ *
126
+ * * Using unknown since we're not type guarding.
127
+ *
128
+ * ```txt
129
+ * [Error] The provided error goes here!
130
+ * ```
131
+ */
132
+ const renderError = (error) => `${exports.errorTag} ${error}\n`;
133
+ exports.renderError = renderError;
134
+ /**
135
+ * @param warning the message to warn about
136
+ * @returns the provided warning prefixed by {@link warningTag}.
137
+ *
138
+ * ```txt
139
+ * [Warning] The provided warning goes here!
140
+ * ```
141
+ */
142
+ const renderWarning = (warning) => `${exports.warningTag} ${warning}\n`;
143
+ exports.renderWarning = renderWarning;
144
+ /**
145
+ * @param warning the message to warn about
146
+ * @returns the provided warning prefixed by {@link warningExclamationSignTag}.
147
+ *
148
+ * ```txt
149
+ * [!] The provided warning goes here!
150
+ * ```
151
+ */
152
+ const renderSoftWarning = (warning) => `${exports.warningExclamationSignTag} ${warning}\n`;
153
+ exports.renderSoftWarning = renderSoftWarning;
154
+ /**
155
+ * @returns a message suggesting to instrument in dev or staging environment first.
156
+ *
157
+ * ```txt
158
+ * [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.
159
+ * ```
160
+ */
161
+ const renderInstrumentInStagingFirst = () => `\n${exports.renderWarning(`Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.`)}`;
162
+ exports.renderInstrumentInStagingFirst = renderInstrumentInStagingFirst;
163
+ /**
164
+ * @returns a soft warning message indicating that functions are going to be updated.
165
+ *
166
+ * ```txt
167
+ * Functions to be updated:
168
+ * ```
169
+ */
170
+ const renderFunctionsToBeUpdated = () => `\n${exports.renderSoftWarning('Functions to be updated:')}`;
171
+ exports.renderFunctionsToBeUpdated = renderFunctionsToBeUpdated;
172
+ /**
173
+ * @returns a warning message reminding the user to lock versions for production.
174
+ *
175
+ * ```txt
176
+ * [Warning] At least one latest layer version is being used. Ensure to lock in versions for production applications using `--layerVersion` and `--extensionVersion`.
177
+ * ```
178
+ */
179
+ const renderEnsureToLockLayerVersionsWarning = () => `\t${exports.renderWarning('At least one latest layer version is being used. Ensure to lock in versions for production applications using `--layerVersion` and `--extensionVersion`.')}`;
180
+ exports.renderEnsureToLockLayerVersionsWarning = renderEnsureToLockLayerVersionsWarning;
181
+ /**
182
+ * @returns a message indicating that no AWS credentials where found.
183
+ *
184
+ * ```txt
185
+ * [!] 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.
186
+ * ```
187
+ */
188
+ const renderNoAWSCredentialsFound = () => `${exports.renderSoftWarning("No AWS credentials found, let's 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.")}`;
189
+ exports.renderNoAWSCredentialsFound = renderNoAWSCredentialsFound;
190
+ /**
191
+ * @returns a message indicating to configure AWS region.
192
+ *
193
+ * ```txt
194
+ * [!] Configure AWS region.
195
+ * ```
196
+ */
197
+ const renderConfigureAWSRegion = () => `\n${exports.renderSoftWarning('Configure AWS region.')}`;
198
+ exports.renderConfigureAWSRegion = renderConfigureAWSRegion;
199
+ /**
200
+ * @returns a message indicating to configure Datadog settings.
201
+ *
202
+ * ```txt
203
+ * [!] Configure Datadog settings.
204
+ * ```
205
+ */
206
+ const renderConfigureDatadog = () => `\n${exports.renderSoftWarning('Configure Datadog settings.')}`;
207
+ exports.renderConfigureDatadog = renderConfigureDatadog;
208
+ /**
209
+ * @returns a message indicating that no Lambda functions were found
210
+ * in the specified region.
211
+ *
212
+ * ```txt
213
+ * [Error] Couldn't find any Lambda functions in the specified region.
214
+ * ```
215
+ */
216
+ const renderCouldntFindLambdaFunctionsInRegionError = () => exports.renderError("Couldn't find any Lambda functions in the specified region.");
217
+ exports.renderCouldntFindLambdaFunctionsInRegionError = renderCouldntFindLambdaFunctionsInRegionError;
218
+ /**
219
+ * @param error an error message or an object of type `unknown`*.
220
+ * @returns a message indicating that no Lambda functions were fetched.
221
+ *
222
+ * * Using unknown since we're not type guarding.
223
+ *
224
+ * ```txt
225
+ * [Error] Couldn't fetch Lambda functions. The provided error goes here!
226
+ * ```
227
+ */
228
+ const renderCouldntFetchLambdaFunctionsError = (error) => exports.renderError(`Couldn't fetch Lambda functions. ${error}`);
229
+ exports.renderCouldntFetchLambdaFunctionsError = renderCouldntFetchLambdaFunctionsError;
230
+ /**
231
+ * @param tagsMissing an array containing the tags that are not configured
232
+ * @returns a message indicating which tags are not configured and where to
233
+ * learn more about Datadog's unified service tagging.
234
+ *
235
+ * ```txt
236
+ * [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.
237
+ * ```
238
+ */
239
+ const renderTagsNotConfiguredWarning = (tagsMissing) => {
240
+ const tags = tagsMissing.join(', ').replace(/, ([^,]*)$/, ' and $1');
241
+ const plural = tagsMissing.length > 1;
242
+ return `\n${exports.renderWarning(`The ${tags} tag${plural ? 's have' : ' has'} not been configured. Learn more about Datadog unified service tagging: ${chalk_1.underline(chalk_1.blueBright('https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/#serverless-environment'))}.`)}`;
243
+ };
244
+ exports.renderTagsNotConfiguredWarning = renderTagsNotConfiguredWarning;
245
+ /**
246
+ * @returns a message indicating that the extra tags provided do not comply
247
+ * with the <key>:<value> array standard.
248
+ *
249
+ * ```txt
250
+ * [Error] Extra tags do not comply with the <key>:<value> array.
251
+ * ```
252
+ */
253
+ const renderExtraTagsDontComplyError = () => exports.renderError('Extra tags do not comply with the <key>:<value> array.');
254
+ exports.renderExtraTagsDontComplyError = renderExtraTagsDontComplyError;
255
+ /**
256
+ * @returns a message indicating that the `--layerVersion` argument provided is invalid.
257
+ *
258
+ * ```txt
259
+ * [Error] Invalid layer version "provided value".
260
+ * ```
261
+ */
262
+ const renderInvalidLayerVersionError = (layerVersion) => exports.renderError(`Invalid layer version "${layerVersion}".`);
263
+ exports.renderInvalidLayerVersionError = renderInvalidLayerVersionError;
264
+ /**
265
+ * @returns a message indicating that the `--extensionVersion` argument provided is invalid.
266
+ *
267
+ * ```txt
268
+ * [Error] Invalid extension version "provided value".
269
+ * ```
270
+ */
271
+ const renderInvalidExtensionVersionError = (extensionVersion) => exports.renderError(`Invalid extension version "${extensionVersion}".`);
272
+ exports.renderInvalidExtensionVersionError = renderInvalidExtensionVersionError;
273
+ /**
274
+ * @returns a message indicating that the provided argument for a specific string boolean
275
+ * field was invalid.
276
+ *
277
+ * ```txt
278
+ * [Error] Invalid boolean specified for "string boolean field".
279
+ * ```
280
+ */
281
+ const renderInvalidStringBooleanSpecifiedError = (stringBoolean) => exports.renderError(`Invalid boolean specified for ${stringBoolean}.`);
282
+ exports.renderInvalidStringBooleanSpecifiedError = renderInvalidStringBooleanSpecifiedError;
283
+ /**
284
+ * @param isDryRun a boolean to define if a prefix should be added.
285
+ * @returns a message indicating that no updates will be applied.
286
+ *
287
+ * ```txt
288
+ * [Dry Run] No updates will be applied.
289
+ * or
290
+ * No updates will be applied.
291
+ * ```
292
+ */
293
+ const renderNoUpdatesApplied = (isDryRun) => {
294
+ const prefix = isDryRun ? `${exports.dryRunTag} ` : '';
295
+ return `\n${prefix}No updates will be applied.\n`;
296
+ };
297
+ exports.renderNoUpdatesApplied = renderNoUpdatesApplied;
298
+ /**
299
+ * @param isDryRun a boolean to define if a prefix should be added.
300
+ * @returns a message indicating that updates will be applied.
301
+ *
302
+ * ```txt
303
+ * [Dry Run] Will apply the following updates:
304
+ * or
305
+ * Will apply the following updates:
306
+ * ```
307
+ */
308
+ const renderWillApplyUpdates = (isDryRun) => {
309
+ const prefix = isDryRun ? `${exports.dryRunTag} ` : '';
310
+ return `\n${prefix}Will apply the following updates:\n`;
311
+ };
312
+ exports.renderWillApplyUpdates = renderWillApplyUpdates;
313
+ /**
314
+ * @returns a soft warning message indicating that confirmation is needed.
315
+ *
316
+ * ```txt
317
+ * [!] Confirmation needed.
318
+ * ```
319
+ */
320
+ const renderConfirmationNeededSoftWarning = () => exports.renderSoftWarning('Confirmation needed.');
321
+ exports.renderConfirmationNeededSoftWarning = renderConfirmationNeededSoftWarning;
322
+ /**
323
+ * @returns a soft warning message indicating that functions are being instrumented.
324
+ *
325
+ * ```txt
326
+ * [!] Instrumenting functions.
327
+ * ```
328
+ */
329
+ const renderInstrumentingFunctionsSoftWarning = () => exports.renderSoftWarning('Instrumenting functions.');
330
+ exports.renderInstrumentingFunctionsSoftWarning = renderInstrumentingFunctionsSoftWarning;
331
+ /**
332
+ * @returns a soft warning message indicating the removal of instrumentation
333
+ * for functions.
334
+ *
335
+ * ```txt
336
+ * [!] Uninstrumenting functions.
337
+ * ```
338
+ */
339
+ const renderUninstrumentingFunctionsSoftWarning = () => exports.renderSoftWarning('Uninstrumenting functions.');
340
+ exports.renderUninstrumentingFunctionsSoftWarning = renderUninstrumentingFunctionsSoftWarning;
341
+ /**
342
+ * @param functionsLength the number of Lambda functions that were fetched.
343
+ * @returns a message indicating that it fetched Lambda functions.
344
+ *
345
+ * ```txt
346
+ * Fetched 42 Lambda functions.
347
+ * ```
348
+ */
349
+ const renderFetchedLambdaFunctions = (functionsLength) => `Fetched ${chalk_1.bold(functionsLength)} ${chalk_1.hex('#FF9900').bold('Lambda')} functions.\n`;
350
+ exports.renderFetchedLambdaFunctions = renderFetchedLambdaFunctions;
351
+ /**
352
+ * @param region the AWS region where the Lambda configs belong to.
353
+ * @param configsLength the number of Lambda configuration that were fetched.
354
+ * @returns a message indicating that it updated Lambda functions.
355
+ *
356
+ * ```txt
357
+ * [us-east-1] Fetched 42 Lambda configurations.
358
+ * ```
359
+ */
360
+ const renderFetchedLambdaConfigurationsFromRegion = (region, configsLength) => `${chalk_1.bold(`[${region}]`)} Fetched ${chalk_1.bold(configsLength)} ${chalk_1.hex('#FF9900').bold('Lambda')} configurations.\n`;
361
+ exports.renderFetchedLambdaConfigurationsFromRegion = renderFetchedLambdaConfigurationsFromRegion;
362
+ /**
363
+ * @param functionsLength the number of Lambda functions that were updated.
364
+ * @returns a message indicating that it updated Lambda functions.
365
+ *
366
+ * ```txt
367
+ * Updated 42 Lambda functions.
368
+ * ```
369
+ */
370
+ const renderUpdatedLambdaFunctions = (functionsLength) => `Updated ${chalk_1.bold(functionsLength)} ${chalk_1.hex('#FF9900').bold('Lambda')} functions.\n`;
371
+ exports.renderUpdatedLambdaFunctions = renderUpdatedLambdaFunctions;
372
+ /**
373
+ * @returns a message indicating that it failed to fetch Lambda functions.
374
+ *
375
+ * ```txt
376
+ * Failed fetching Lambda functions.
377
+ * ```
378
+ */
379
+ const renderFailedFetchingLambdaFunctions = () => `Failed fetching ${chalk_1.hex('#FF9900').bold('Lambda')} configurations.\n`;
380
+ exports.renderFailedFetchingLambdaFunctions = renderFailedFetchingLambdaFunctions;
381
+ /**
382
+ * @param region the AWS region where the Lambda configs belong to.
383
+ * @returns a message indicating that it failed to fetch Lambda configurations.
384
+ * from a region.
385
+ *
386
+ * ```txt
387
+ * [us-east-1] Failed fetching Lambda configurations.
388
+ * ```
389
+ */
390
+ const renderFailedFetchingLambdaConfigurationsFromRegion = (region) => `${chalk_1.bold(`[${region}]`)} Failed fetching ${chalk_1.hex('#FF9900').bold('Lambda')} configurations.\n`;
391
+ exports.renderFailedFetchingLambdaConfigurationsFromRegion = renderFailedFetchingLambdaConfigurationsFromRegion;
392
+ /**
393
+ * @returns a message indicating that it failed to update Lambda functions.
394
+ *
395
+ * ```txt
396
+ * Failed updating Lambda functions.
397
+ * ```
398
+ */
399
+ const renderFailedUpdatingLambdaFunctions = () => `Failed updating ${chalk_1.hex('#FF9900').bold('Lambda')} functions.\n`;
400
+ exports.renderFailedUpdatingLambdaFunctions = renderFailedUpdatingLambdaFunctions;
401
+ /**
402
+ * Returns a spinner instance with text for lambda functions fetching.
403
+ *
404
+ * @returns an instance of an {@link ora} spinner.
405
+ *
406
+ * ```txt
407
+ * ⠋ Fetching Lambda functions.
408
+ * ```
409
+ */
410
+ const fetchingFunctionsSpinner = () => ora_1.default({
411
+ color: 'magenta',
412
+ discardStdin: false,
413
+ text: `Fetching ${chalk_1.hex('#FF9900').bold('Lambda')} functions.\n`,
414
+ });
415
+ exports.fetchingFunctionsSpinner = fetchingFunctionsSpinner;
416
+ /**
417
+ * Returns a spinner instance with text for lambda configurations fetching.
418
+ *
419
+ * @returns an instance of {@link ora} spinner.
420
+ *
421
+ * ```txt
422
+ * ⠋ [us-east-1] Fetching Lambda configurations.
423
+ * ```
424
+ */
425
+ const fetchingFunctionsConfigSpinner = (region) => ora_1.default({
426
+ color: 'magenta',
427
+ discardStdin: false,
428
+ text: `${chalk_1.bold(`[${region}]`)} Fetching ${chalk_1.hex('#FF9900').bold('Lambda')} configurations.\n`,
429
+ });
430
+ exports.fetchingFunctionsConfigSpinner = fetchingFunctionsConfigSpinner;
431
+ /**
432
+ * Returns a spinner instance with text for lambda functions updating.
433
+ *
434
+ * @returns an instance of an {@link ora} spinner.
435
+ *
436
+ * ```txt
437
+ * ⠋ Updating 5 Lambda functions.
438
+ * ```
439
+ */
440
+ const updatingFunctionsSpinner = (functions) => ora_1.default({
441
+ color: 'magenta',
442
+ discardStdin: false,
443
+ text: `Updating ${chalk_1.bold(functions)} ${chalk_1.hex('#FF9900').bold('Lambda')} functions.\n`,
444
+ });
445
+ exports.updatingFunctionsSpinner = updatingFunctionsSpinner;
446
+ exports.dryRunTag = chalk_1.bold(chalk_1.cyan('[Dry Run]'));
447
+ exports.errorTag = chalk_1.bold(chalk_1.red('[Error]'));
448
+ exports.warningTag = chalk_1.bold(chalk_1.yellow('[Warning]'));
449
+ exports.warningExclamationSignTag = chalk_1.bold(chalk_1.yellow('[!]'));
450
+ //# sourceMappingURL=renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/commands/lambda/renderer.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAyE;AACzE,8CAAqB;AAGrB,iDAAkD;AAElD;;;;;;;GAOG;AACI,MAAM,kBAAkB,GAAG,CAAC,WAAoD,EAAE,QAAiB,EAAE,EAAE;IAC5G,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,iBAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAE9C,IAAI,WAAW,GAAG,eAAe,CAAA;IACjC,IAAI,WAAW,KAAK,kCAAmB,CAAC,SAAS,EAAE;QACjD,WAAW,GAAG,iBAAiB,CAAA;KAChC;IAED,OAAO,KAAK,MAAM,MAAM,WAAW,oBAAoB,CAAA;AACzD,CAAC,CAAA;AATY,QAAA,kBAAkB,sBAS9B;AAED;;;;;;;;;GASG;AACI,MAAM,+BAA+B,GAAG,CAAC,WAAoD,EAAE,EAAE;IACtG,IAAI,YAAY,GAAG,YAAY,CAAA;IAC/B,IAAI,WAAW,KAAK,kCAAmB,CAAC,SAAS,EAAE;QACjD,YAAY,GAAG,wBAAwB,CAAA;KACxC;IAED,OAAO,mBAAW,CAAC,6BAA6B,YAAY,GAAG,CAAC,CAAA;AAClE,CAAC,CAAA;AAPY,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jC;AAEJ;;;;;;;;GAQG;AACI,MAAM,8BAA8B,GAAG,CAAC,MAAc,EAAE,EAAE,CAC/D,aAAG,CAAC;IACF,KAAK,EAAE,SAAS;IAChB,YAAY,EAAE,KAAK;IACnB,IAAI,EAAE,GAAG,YAAI,CAAC,IAAI,MAAM,GAAG,CAAC,aAAa,WAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB;CAC3F,CAAC,CAAA;AALS,QAAA,8BAA8B,kCAKvC;AAEJ;;;;;;;;GAQG;AACI,MAAM,wBAAwB,GAAG,CAAC,SAAiB,EAAE,EAAE,CAC5D,aAAG,CAAC;IACF,KAAK,EAAE,SAAS;IAChB,YAAY,EAAE,KAAK;IACnB,IAAI,EAAE,YAAY,YAAI,CAAC,SAAS,CAAC,IAAI,WAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe;CAClF,CAAC,CAAA;AALS,QAAA,wBAAwB,4BAKjC;AAES,QAAA,SAAS,GAAG,YAAI,CAAC,YAAI,CAAC,WAAW,CAAC,CAAC,CAAA;AACnC,QAAA,QAAQ,GAAG,YAAI,CAAC,WAAG,CAAC,SAAS,CAAC,CAAC,CAAA;AAC/B,QAAA,UAAU,GAAG,YAAI,CAAC,cAAM,CAAC,WAAW,CAAC,CAAC,CAAA;AAEtC,QAAA,yBAAyB,GAAG,YAAI,CAAC,cAAM,CAAC,KAAK,CAAC,CAAC,CAAA"}
@@ -6,6 +6,7 @@ export declare class UninstrumentCommand extends Command {
6
6
  private forwarder?;
7
7
  private functions;
8
8
  private interactive;
9
+ private profile?;
9
10
  private regExPattern?;
10
11
  private region?;
11
12
  execute(): Promise<1 | 0>;