serverless-plugin-datadog 5.7.1 → 5.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/index.js +9 -8
  3. package/dist/src/index.js.map +1 -1
  4. package/dist/src/layers-gov.json +12 -12
  5. package/dist/src/layers.json +133 -130
  6. package/dist/src/output.d.ts +1 -1
  7. package/dist/src/output.d.ts.map +1 -1
  8. package/dist/src/output.js +1 -3
  9. package/dist/src/output.js.map +1 -1
  10. package/package.json +2 -2
  11. package/dist/src/git-metadata/interfaces.d.ts +0 -10
  12. package/dist/src/git-metadata/interfaces.d.ts.map +0 -1
  13. package/dist/src/git-metadata/interfaces.js +0 -43
  14. package/dist/src/git-metadata/interfaces.js.map +0 -1
  15. package/dist/src/helpers/apikey.d.ts +0 -13
  16. package/dist/src/helpers/apikey.d.ts.map +0 -1
  17. package/dist/src/helpers/apikey.js +0 -74
  18. package/dist/src/helpers/apikey.js.map +0 -1
  19. package/dist/src/helpers/errors.d.ts +0 -3
  20. package/dist/src/helpers/errors.d.ts.map +0 -1
  21. package/dist/src/helpers/errors.js +0 -7
  22. package/dist/src/helpers/errors.js.map +0 -1
  23. package/dist/src/helpers/interfaces.d.ts +0 -20
  24. package/dist/src/helpers/interfaces.d.ts.map +0 -1
  25. package/dist/src/helpers/interfaces.js +0 -3
  26. package/dist/src/helpers/interfaces.js.map +0 -1
  27. package/dist/src/helpers/retry.d.ts +0 -3
  28. package/dist/src/helpers/retry.d.ts.map +0 -1
  29. package/dist/src/helpers/retry.js +0 -39
  30. package/dist/src/helpers/retry.js.map +0 -1
  31. package/dist/src/helpers/tags.d.ts +0 -29
  32. package/dist/src/helpers/tags.d.ts.map +0 -1
  33. package/dist/src/helpers/tags.js +0 -50
  34. package/dist/src/helpers/tags.js.map +0 -1
  35. package/dist/src/helpers/upload.d.ts +0 -45
  36. package/dist/src/helpers/upload.d.ts.map +0 -1
  37. package/dist/src/helpers/upload.js +0 -70
  38. package/dist/src/helpers/upload.js.map +0 -1
  39. package/dist/src/helpers/utils.d.ts +0 -31
  40. package/dist/src/helpers/utils.d.ts.map +0 -1
  41. package/dist/src/helpers/utils.js +0 -115
  42. package/dist/src/helpers/utils.js.map +0 -1
  43. package/dist/src/source-code-integration.d.ts +0 -15
  44. package/dist/src/source-code-integration.d.ts.map +0 -1
  45. package/dist/src/source-code-integration.js +0 -76
  46. package/dist/src/source-code-integration.js.map +0 -1
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SourceCodeIntegration = void 0;
13
- const package_json_1 = require("../package.json");
14
- const git_1 = require("./git");
15
- const apikey_1 = require("./helpers/apikey");
16
- const errors_1 = require("./helpers/errors");
17
- const upload_1 = require("./helpers/upload");
18
- const utils_1 = require("./helpers/utils");
19
- class SourceCodeIntegration {
20
- constructor(apiKey, datadogSite, simpleGit, repositoryURL) {
21
- this.apiKey = apiKey;
22
- this.datadogSite = datadogSite;
23
- this.simpleGit = simpleGit;
24
- this.repositoryURL = repositoryURL;
25
- }
26
- uploadGitMetadata() {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- const apiKeyValidator = (0, apikey_1.newApiKeyValidator)({
29
- apiKey: this.apiKey,
30
- datadogSite: this.datadogSite,
31
- });
32
- const payload = yield (0, git_1.getCommitInfo)(this.simpleGit, this.repositoryURL);
33
- if (payload === undefined) {
34
- throw Error("Couldn't get git commit information.");
35
- }
36
- try {
37
- const requestBuilder = this.getRequestBuilder();
38
- const status = yield this.uploadRepository(requestBuilder)(payload, {
39
- apiKeyValidator,
40
- onError: (e) => {
41
- throw e;
42
- },
43
- onRetry: (_) => { },
44
- onUpload: () => {
45
- return;
46
- },
47
- retries: 5,
48
- });
49
- if (status !== upload_1.UploadStatus.Success) {
50
- throw new Error("Error uploading commit information.");
51
- }
52
- return { hash: payload.hash, remote: payload.remote };
53
- }
54
- catch (error) {
55
- throw error;
56
- }
57
- });
58
- }
59
- getRequestBuilder() {
60
- if (!this.apiKey) {
61
- throw new errors_1.InvalidConfigurationError("Missing DATADOG_API_KEY in your environment.");
62
- }
63
- return (0, utils_1.getRequestBuilder)({
64
- apiKey: this.apiKey,
65
- baseUrl: "https://sourcemap-intake." + this.datadogSite,
66
- });
67
- }
68
- uploadRepository(requestBuilder) {
69
- return (commitInfo, opts) => __awaiter(this, void 0, void 0, function* () {
70
- const payload = commitInfo.asMultipartPayload(`serverless-plugin-datadog-${package_json_1.version}`);
71
- return (0, upload_1.upload)(requestBuilder)(payload, opts);
72
- });
73
- }
74
- }
75
- exports.SourceCodeIntegration = SourceCodeIntegration;
76
- //# sourceMappingURL=source-code-integration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-code-integration.js","sourceRoot":"","sources":["../../src/source-code-integration.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kDAA0C;AAC1C,+BAAsC;AAEtC,6CAAsD;AACtD,6CAA6D;AAE7D,6CAAuE;AACvE,2CAAoD;AAEpD,MAAa,qBAAqB;IAMhC,YAAY,MAAc,EAAE,WAAmB,EAAE,SAAoB,EAAE,aAAsB;QAC3F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAEY,iBAAiB;;YAC5B,MAAM,eAAe,GAAG,IAAA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