@creator.co/wapi 1.2.1-beta5 → 1.2.2

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 (127) hide show
  1. package/.github/workflows/npmpublish.yml +11 -19
  2. package/.github/workflows/prs.yml +13 -0
  3. package/jest.config.ts +39 -0
  4. package/package.json +15 -4
  5. package/src/API/Request.ts +120 -10
  6. package/src/API/Response.ts +236 -8
  7. package/src/API/Utils.ts +56 -1
  8. package/src/BaseEvent/EventProcessor.ts +84 -11
  9. package/src/BaseEvent/Process.ts +62 -1
  10. package/src/BaseEvent/Transaction.ts +5 -8
  11. package/src/Config/Configuration.ts +111 -5
  12. package/src/Config/EnvironmentVar.ts +90 -1
  13. package/src/Crypto/Crypto.ts +77 -18
  14. package/src/Crypto/JWT.ts +49 -3
  15. package/src/Globals.ts +141 -3
  16. package/src/Logger/Logger.ts +173 -19
  17. package/src/Mailer/Mailer.ts +95 -0
  18. package/src/Publisher/Publisher.ts +50 -4
  19. package/src/Server/RouteResolver.ts +142 -0
  20. package/src/Server/Router.ts +77 -0
  21. package/src/Server/lib/ContainerServer.ts +48 -1
  22. package/src/Server/lib/Server.ts +78 -38
  23. package/src/Server/lib/container/GenericHandler.ts +7 -5
  24. package/src/Server/lib/container/GenericHandlerEvent.ts +59 -17
  25. package/src/Server/lib/container/HealthHandler.ts +1 -1
  26. package/src/Server/lib/container/Proxy.ts +92 -11
  27. package/src/Server/lib/container/Utils.ts +16 -25
  28. package/src/Validation/Validator.ts +18 -2
  29. package/tests/API/Request.test.ts +263 -0
  30. package/tests/API/Response.test.ts +372 -0
  31. package/tests/API/Utils.test.ts +157 -0
  32. package/tests/BaseEvent/EventProcessor.test.ts +278 -0
  33. package/tests/BaseEvent/Process.test.ts +49 -0
  34. package/tests/BaseEvent/Transaction.test.ts +231 -0
  35. package/tests/Config/Config.test.ts +193 -0
  36. package/tests/Config/EnvironmentVar.test.ts +223 -0
  37. package/tests/Crypto/Crypto.test.ts +90 -0
  38. package/tests/Crypto/JWT.test.ts +92 -0
  39. package/tests/Logger/Logger.test.ts +108 -0
  40. package/tests/Mailer/Mailer.test.ts +67 -0
  41. package/tests/Publisher/Publisher.test.ts +60 -0
  42. package/tests/Server/RouteResolver.test.ts +106 -0
  43. package/tests/Server/Router.test.ts +38 -0
  44. package/tests/Server/lib/ContainerServer.test.ts +329 -0
  45. package/tests/Server/lib/Server.test.ts +12 -0
  46. package/tests/Server/lib/container/GenericHandler.test.ts +141 -0
  47. package/tests/Server/lib/container/GenericHandlerEvent.test.ts +103 -0
  48. package/tests/Server/lib/container/HealthHandler.test.ts +30 -0
  49. package/tests/Server/lib/container/Proxy.test.ts +278 -0
  50. package/tests/Server/lib/container/Utils.test.ts +48 -0
  51. package/tests/Test.utils.ts +95 -0
  52. package/tests/Validation/Validator.test.ts +88 -0
  53. package/tests/main.test.ts +15 -0
  54. package/tsconfig.json +1 -0
  55. package/dist/index.d.ts +0 -11
  56. package/dist/index.js +0 -24
  57. package/dist/index.js.map +0 -1
  58. package/dist/package.json +0 -53
  59. package/dist/src/API/Request.d.ts +0 -21
  60. package/dist/src/API/Request.js +0 -86
  61. package/dist/src/API/Request.js.map +0 -1
  62. package/dist/src/API/Response.d.ts +0 -39
  63. package/dist/src/API/Response.js +0 -232
  64. package/dist/src/API/Response.js.map +0 -1
  65. package/dist/src/API/Utils.d.ts +0 -8
  66. package/dist/src/API/Utils.js +0 -49
  67. package/dist/src/API/Utils.js.map +0 -1
  68. package/dist/src/BaseEvent/EventProcessor.d.ts +0 -13
  69. package/dist/src/BaseEvent/EventProcessor.js +0 -151
  70. package/dist/src/BaseEvent/EventProcessor.js.map +0 -1
  71. package/dist/src/BaseEvent/Process.d.ts +0 -12
  72. package/dist/src/BaseEvent/Process.js +0 -114
  73. package/dist/src/BaseEvent/Process.js.map +0 -1
  74. package/dist/src/BaseEvent/Transaction.d.ts +0 -29
  75. package/dist/src/BaseEvent/Transaction.js +0 -248
  76. package/dist/src/BaseEvent/Transaction.js.map +0 -1
  77. package/dist/src/Config/Configuration.d.ts +0 -34
  78. package/dist/src/Config/Configuration.js +0 -93
  79. package/dist/src/Config/Configuration.js.map +0 -1
  80. package/dist/src/Config/EnvironmentVar.d.ts +0 -17
  81. package/dist/src/Config/EnvironmentVar.js +0 -152
  82. package/dist/src/Config/EnvironmentVar.js.map +0 -1
  83. package/dist/src/Crypto/Crypto.d.ts +0 -8
  84. package/dist/src/Crypto/Crypto.js +0 -84
  85. package/dist/src/Crypto/Crypto.js.map +0 -1
  86. package/dist/src/Crypto/JWT.d.ts +0 -16
  87. package/dist/src/Crypto/JWT.js +0 -49
  88. package/dist/src/Crypto/JWT.js.map +0 -1
  89. package/dist/src/Globals.d.ts +0 -21
  90. package/dist/src/Globals.js +0 -35
  91. package/dist/src/Globals.js.map +0 -1
  92. package/dist/src/Logger/Logger.d.ts +0 -34
  93. package/dist/src/Logger/Logger.js +0 -345
  94. package/dist/src/Logger/Logger.js.map +0 -1
  95. package/dist/src/Mailer/Mailer.d.ts +0 -12
  96. package/dist/src/Mailer/Mailer.js +0 -234
  97. package/dist/src/Mailer/Mailer.js.map +0 -1
  98. package/dist/src/Publisher/Publisher.d.ts +0 -10
  99. package/dist/src/Publisher/Publisher.js +0 -109
  100. package/dist/src/Publisher/Publisher.js.map +0 -1
  101. package/dist/src/Server/Router.d.ts +0 -27
  102. package/dist/src/Server/Router.js +0 -22
  103. package/dist/src/Server/Router.js.map +0 -1
  104. package/dist/src/Server/lib/ContainerServer.d.ts +0 -11
  105. package/dist/src/Server/lib/ContainerServer.js +0 -103
  106. package/dist/src/Server/lib/ContainerServer.js.map +0 -1
  107. package/dist/src/Server/lib/Server.d.ts +0 -9
  108. package/dist/src/Server/lib/Server.js +0 -141
  109. package/dist/src/Server/lib/Server.js.map +0 -1
  110. package/dist/src/Server/lib/container/GenericHandler.d.ts +0 -4
  111. package/dist/src/Server/lib/container/GenericHandler.js +0 -136
  112. package/dist/src/Server/lib/container/GenericHandler.js.map +0 -1
  113. package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +0 -14
  114. package/dist/src/Server/lib/container/GenericHandlerEvent.js +0 -164
  115. package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +0 -1
  116. package/dist/src/Server/lib/container/HealthHandler.d.ts +0 -3
  117. package/dist/src/Server/lib/container/HealthHandler.js +0 -44
  118. package/dist/src/Server/lib/container/HealthHandler.js.map +0 -1
  119. package/dist/src/Server/lib/container/Proxy.d.ts +0 -15
  120. package/dist/src/Server/lib/container/Proxy.js +0 -157
  121. package/dist/src/Server/lib/container/Proxy.js.map +0 -1
  122. package/dist/src/Server/lib/container/Utils.d.ts +0 -6
  123. package/dist/src/Server/lib/container/Utils.js +0 -109
  124. package/dist/src/Server/lib/container/Utils.js.map +0 -1
  125. package/dist/src/Validation/Validator.d.ts +0 -5
  126. package/dist/src/Validation/Validator.js +0 -31
  127. package/dist/src/Validation/Validator.js.map +0 -1
@@ -1,34 +0,0 @@
1
- export type ConfigurationSchema = {
2
- [name: string]: {
3
- isLocal?: boolean;
4
- isRemote?: boolean;
5
- required?: boolean;
6
- cachingPolicy?: string;
7
- };
8
- };
9
- type ExtractRemote<Type> = {
10
- [Property in keyof Type]-?: Type[Property] extends {
11
- isRemote: true;
12
- } ? Property : null;
13
- };
14
- type ExtractLocal<Type> = {
15
- [Property in keyof Type]-?: Type[Property] extends {
16
- isLocal: true;
17
- } ? Property : null;
18
- };
19
- type OmitKeysByValueType<T, U> = {
20
- [P in keyof T]: T[P] extends U ? never : P;
21
- }[keyof T];
22
- type OmitByValueType<T, V> = T extends infer _ ? {
23
- [key in OmitKeysByValueType<T, V>]: T[key];
24
- } : never;
25
- export default class Configuration<T extends ConfigurationSchema> {
26
- private readonly schema;
27
- private readonly remotePrefix;
28
- constructor(schema: T, remotePrefix: string);
29
- get(propName: keyof OmitByValueType<ExtractLocal<T>, null>): any;
30
- asyncGet(propName: keyof OmitByValueType<ExtractRemote<T>, null>): Promise<any>;
31
- private getCachedValue;
32
- private cacheValue;
33
- }
34
- export {};
@@ -1,93 +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
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var MemCache = require("node-cache");
40
- var DurationParser = require("parse-duration");
41
- var EnvironmentVar_1 = require("./EnvironmentVar");
42
- // Hold cached values at nodeVM level
43
- var cacheStore = new MemCache();
44
- var Configuration = /** @class */ (function () {
45
- function Configuration(schema, remotePrefix) {
46
- this.schema = schema;
47
- this.remotePrefix = remotePrefix;
48
- }
49
- Configuration.prototype.get = function (propName) {
50
- var propString = propName;
51
- var propSchema = this.schema[propString];
52
- var v = this.getCachedValue(propString);
53
- v =
54
- v ||
55
- new EnvironmentVar_1.default(propString, EnvironmentVar_1.EnvironmentType.Local, propSchema.required, this.remotePrefix).syncResolve();
56
- this.cacheValue(propString, v, propSchema.cachingPolicy);
57
- return v;
58
- };
59
- Configuration.prototype.asyncGet = function (propName) {
60
- return __awaiter(this, void 0, void 0, function () {
61
- var propString, propSchema, v, _a;
62
- return __generator(this, function (_b) {
63
- switch (_b.label) {
64
- case 0:
65
- propString = propName;
66
- propSchema = this.schema[propString];
67
- v = this.getCachedValue(propString);
68
- _a = v;
69
- if (_a) return [3 /*break*/, 2];
70
- return [4 /*yield*/, new EnvironmentVar_1.default(propString, EnvironmentVar_1.EnvironmentType.PlainRemote, propSchema.required, this.remotePrefix).resolve()];
71
- case 1:
72
- _a = (_b.sent());
73
- _b.label = 2;
74
- case 2:
75
- v = _a;
76
- this.cacheValue(propString, v, propSchema.cachingPolicy);
77
- return [2 /*return*/, v];
78
- }
79
- });
80
- });
81
- };
82
- // caching layer
83
- Configuration.prototype.getCachedValue = function (valueKey) {
84
- return cacheStore.get(valueKey);
85
- };
86
- Configuration.prototype.cacheValue = function (valueKey, value, policy) {
87
- if (policy === void 0) { policy = "1d"; }
88
- cacheStore.set(valueKey, value, DurationParser(policy, "s"));
89
- };
90
- return Configuration;
91
- }());
92
- exports.default = Configuration;
93
- //# sourceMappingURL=Configuration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../src/Config/Configuration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAsC;AACtC,+CAAgD;AAEhD,mDAAkE;AAElE,qCAAqC;AACrC,IAAM,UAAU,GAAG,IAAI,QAAQ,EAAE,CAAA;AAwCjC;IAGE,uBAAY,MAAS,EAAE,YAAoB;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAEM,2BAAG,GAAV,UAAW,QAAsD;QAC/D,IAAM,UAAU,GAAG,QAAkB,CAAA;QACrC,IAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QAC1C,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;QACvC,CAAC;YACC,CAAC;gBACD,IAAI,wBAAc,CAChB,UAAU,EACV,gCAAe,CAAC,KAAK,EACrB,UAAU,CAAC,QAAQ,EACnB,IAAI,CAAC,YAAY,CAClB,CAAC,WAAW,EAAE,CAAA;QACjB,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;QACxD,OAAO,CAAC,CAAA;IACV,CAAC;IACY,gCAAQ,GAArB,UACE,QAAuD;;;;;;wBAEjD,UAAU,GAAG,QAAkB,CAAA;wBAC/B,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;wBACtC,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;wBAErC,KAAA,CAAC,CAAA;gCAAD,wBAAC;wBACA,qBAAM,IAAI,wBAAc,CACvB,UAAU,EACV,gCAAe,CAAC,WAAW,EAC3B,UAAU,CAAC,QAAQ,EACnB,IAAI,CAAC,YAAY,CAClB,CAAC,OAAO,EAAE,EAAA;;wBALX,KAAA,CAAC,SAKU,CAAC,CAAA;;;wBAPd,CAAC,KAOa,CAAA;wBACd,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;wBACxD,sBAAO,CAAC,EAAA;;;;KACT;IACD,gBAAgB;IACR,sCAAc,GAAtB,UAAuB,QAAgB;QACrC,OAAO,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;IACO,kCAAU,GAAlB,UACE,QAAgB,EAChB,KAAU,EACV,MAAqB;QAArB,uBAAA,EAAA,aAAqB;QAErB,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;IAC9D,CAAC;IACH,oBAAC;AAAD,CAAC,AAnDD,IAmDC"}
@@ -1,17 +0,0 @@
1
- export declare enum EnvironmentType {
2
- PlainRemote = 0,
3
- SecureRemote = 1,
4
- Local = 2
5
- }
6
- export default class EnvironmentVar<T> {
7
- private readonly paramName;
8
- private readonly type;
9
- private readonly optional;
10
- private readonly paramPrefix;
11
- constructor(paramName: string, type: EnvironmentType, optional?: boolean, paramPrefix?: string);
12
- syncResolve(): T;
13
- resolve(): Promise<T>;
14
- private getLocalValue;
15
- private getPlainValue;
16
- private getSecureValue;
17
- }
@@ -1,152 +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
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.EnvironmentType = void 0;
40
- var client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
41
- var client_ssm_1 = require("@aws-sdk/client-ssm");
42
- // Explicity setting VM level variables in order to persist
43
- // client across different important and instances.
44
- // eslint-disable-next-line no-var
45
- var ssmClient = null, secretsClient = null;
46
- var EnvironmentType;
47
- (function (EnvironmentType) {
48
- EnvironmentType[EnvironmentType["PlainRemote"] = 0] = "PlainRemote";
49
- EnvironmentType[EnvironmentType["SecureRemote"] = 1] = "SecureRemote";
50
- EnvironmentType[EnvironmentType["Local"] = 2] = "Local";
51
- })(EnvironmentType || (exports.EnvironmentType = EnvironmentType = {}));
52
- var EnvironmentVar = /** @class */ (function () {
53
- function EnvironmentVar(paramName, type, optional, paramPrefix /* only allowed process.env */) {
54
- if (paramPrefix === void 0) { paramPrefix = "/creatorco-api-".concat(process.env.STAGE, "/env/"); }
55
- this.paramName = paramName;
56
- this.type = type;
57
- this.optional = !!optional;
58
- this.paramPrefix = paramPrefix;
59
- }
60
- EnvironmentVar.prototype.syncResolve = function () {
61
- if (this.type == EnvironmentType.Local)
62
- return this.getLocalValue();
63
- else {
64
- throw new Error("EnvironmentVar syncResolve method can only be called for environments of type 'Local'");
65
- }
66
- };
67
- EnvironmentVar.prototype.resolve = function () {
68
- return __awaiter(this, void 0, void 0, function () {
69
- return __generator(this, function (_a) {
70
- if (this.type == EnvironmentType.Local)
71
- return [2 /*return*/, this.getLocalValue()];
72
- else if (this.type == EnvironmentType.SecureRemote)
73
- return [2 /*return*/, this.getSecureValue()];
74
- else
75
- return [2 /*return*/, this.getPlainValue()];
76
- return [2 /*return*/];
77
- });
78
- });
79
- };
80
- EnvironmentVar.prototype.getLocalValue = function () {
81
- var value = process.env[this.paramName];
82
- if (!value && !this.optional) {
83
- throw new Error("Local environment ".concat(this.paramName, " is not defined, please reconfigure the application and redeploy!"));
84
- }
85
- return value;
86
- };
87
- EnvironmentVar.prototype.getPlainValue = function () {
88
- return __awaiter(this, void 0, void 0, function () {
89
- var pName, data, error_1;
90
- return __generator(this, function (_a) {
91
- switch (_a.label) {
92
- case 0:
93
- if (!ssmClient)
94
- ssmClient = new client_ssm_1.SSMClient();
95
- pName = "".concat(this.paramPrefix).concat(this.paramName);
96
- _a.label = 1;
97
- case 1:
98
- _a.trys.push([1, 3, , 4]);
99
- return [4 /*yield*/, ssmClient.send(new client_ssm_1.GetParameterCommand({ Name: pName }))];
100
- case 2:
101
- data = _a.sent();
102
- if (data.Parameter && data.Parameter.Value)
103
- return [2 /*return*/, data.Parameter.Value];
104
- return [3 /*break*/, 4];
105
- case 3:
106
- error_1 = _a.sent();
107
- console.error(error_1);
108
- return [3 /*break*/, 4];
109
- case 4:
110
- if (!this.optional) {
111
- throw new Error("Unable to retrieve plain remote env value: ".concat(pName));
112
- }
113
- return [2 /*return*/];
114
- }
115
- });
116
- });
117
- };
118
- EnvironmentVar.prototype.getSecureValue = function () {
119
- return __awaiter(this, void 0, void 0, function () {
120
- var pName, data, error_2;
121
- return __generator(this, function (_a) {
122
- switch (_a.label) {
123
- case 0:
124
- if (!secretsClient)
125
- secretsClient = new client_secrets_manager_1.SecretsManagerClient();
126
- pName = "".concat(this.paramPrefix).concat(this.paramName);
127
- _a.label = 1;
128
- case 1:
129
- _a.trys.push([1, 3, , 4]);
130
- return [4 /*yield*/, secretsClient.send(new client_secrets_manager_1.GetSecretValueCommand({ SecretId: pName }))];
131
- case 2:
132
- data = _a.sent();
133
- if (data.Parameter && data.Parameter.Value)
134
- return [2 /*return*/, data.Parameter.Value];
135
- return [3 /*break*/, 4];
136
- case 3:
137
- error_2 = _a.sent();
138
- console.error(error_2);
139
- return [3 /*break*/, 4];
140
- case 4:
141
- if (!this.optional) {
142
- throw new Error("Unable to retrieve secure remote env: ".concat(pName));
143
- }
144
- return [2 /*return*/];
145
- }
146
- });
147
- });
148
- };
149
- return EnvironmentVar;
150
- }());
151
- exports.default = EnvironmentVar;
152
- //# sourceMappingURL=EnvironmentVar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EnvironmentVar.js","sourceRoot":"","sources":["../../../src/Config/EnvironmentVar.ts"],"names":[],"mappings":"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"}
@@ -1,8 +0,0 @@
1
- export default class Crypto {
2
- private readonly client;
3
- private readonly region;
4
- private readonly keyId;
5
- constructor(region: string, keyId: string);
6
- encryptData(data: string | any): Promise<string>;
7
- decryptData(data: string): Promise<string>;
8
- }
@@ -1,84 +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
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var client_kms_1 = require("@aws-sdk/client-kms");
40
- var Crypto = /** @class */ (function () {
41
- function Crypto(region, keyId) {
42
- this.region = region;
43
- this.keyId = keyId;
44
- this.client = new client_kms_1.KMSClient({ region: this.region });
45
- }
46
- //
47
- Crypto.prototype.encryptData = function (data) {
48
- return __awaiter(this, void 0, void 0, function () {
49
- var resp;
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0: return [4 /*yield*/, this.client.send(new client_kms_1.EncryptCommand({
53
- KeyId: this.keyId,
54
- EncryptionAlgorithm: "RSAES_OAEP_SHA_256",
55
- Plaintext: new TextEncoder().encode(typeof data === "string" ? data : JSON.stringify(data)),
56
- }))];
57
- case 1:
58
- resp = _a.sent();
59
- return [2 /*return*/, Buffer.from(resp.CiphertextBlob, "utf8").toString("hex")];
60
- }
61
- });
62
- });
63
- };
64
- Crypto.prototype.decryptData = function (data) {
65
- return __awaiter(this, void 0, void 0, function () {
66
- var resp;
67
- return __generator(this, function (_a) {
68
- switch (_a.label) {
69
- case 0: return [4 /*yield*/, this.client.send(new client_kms_1.DecryptCommand({
70
- KeyId: this.keyId,
71
- CiphertextBlob: Buffer.from(data, "hex"),
72
- EncryptionAlgorithm: "RSAES_OAEP_SHA_256",
73
- }))];
74
- case 1:
75
- resp = _a.sent();
76
- return [2 /*return*/, new TextDecoder().decode(resp.Plaintext)];
77
- }
78
- });
79
- });
80
- };
81
- return Crypto;
82
- }());
83
- exports.default = Crypto;
84
- //# sourceMappingURL=Crypto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Crypto.js","sourceRoot":"","sources":["../../../src/Crypto/Crypto.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA+E;AAE/E;IAIE,gBAAY,MAAc,EAAE,KAAa;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,sBAAS,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACtD,CAAC;IACD,EAAE;IACI,4BAAW,GAAjB,UAAkB,IAAkB;;;;;4BACrB,qBAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,IAAI,2BAAc,CAAC;4BACjB,KAAK,EAAE,IAAI,CAAC,KAAK;4BACjB,mBAAmB,EAAE,oBAAoB;4BACzC,SAAS,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CACjC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CACvD;yBACF,CAAC,CACH,EAAA;;wBARK,IAAI,GAAG,SAQZ;wBACD,sBAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAqB,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAA;;;;KACvE;IACK,4BAAW,GAAjB,UAAkB,IAAY;;;;;4BACf,qBAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,IAAI,2BAAc,CAAC;4BACjB,KAAK,EAAE,IAAI,CAAC,KAAK;4BACjB,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;4BACxC,mBAAmB,EAAE,oBAAoB;yBAC1C,CAAC,CACH,EAAA;;wBANK,IAAI,GAAG,SAMZ;wBACD,sBAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAA;;;;KAChD;IACH,aAAC;AAAD,CAAC,AAhCD,IAgCC"}
@@ -1,16 +0,0 @@
1
- import * as jwt from "jsonwebtoken";
2
- type JWTValidationResponse = {
3
- isValid: true;
4
- decodedToken: jwt.JwtPayload;
5
- } | {
6
- isValid: false;
7
- isExpired?: boolean;
8
- };
9
- export default class JWT {
10
- private readonly tokenSecret;
11
- private readonly defaultExpiration;
12
- constructor(tokenSecret: string, defaultExpiration?: string);
13
- createToken(data: object, expiration?: string, overrideToken?: string, opts?: any): string;
14
- validateToken(token: string): JWTValidationResponse;
15
- }
16
- export {};
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- var jwt = require("jsonwebtoken");
15
- var JWT = /** @class */ (function () {
16
- function JWT(tokenSecret, defaultExpiration) {
17
- this.tokenSecret = tokenSecret;
18
- this.defaultExpiration = defaultExpiration;
19
- }
20
- //
21
- JWT.prototype.createToken = function (data, expiration, overrideToken, opts) {
22
- var exp = expiration || this.defaultExpiration;
23
- return jwt.sign(data, overrideToken || this.tokenSecret, exp ? __assign({ expiresIn: exp }, (opts || {})) : opts || {});
24
- };
25
- JWT.prototype.validateToken = function (token) {
26
- try {
27
- // Check if is valid
28
- var isValid = jwt.verify(token, this.tokenSecret);
29
- if (!isValid)
30
- throw new Error("Issue with token validation!");
31
- else {
32
- var payload = jwt.decode(token, { json: true });
33
- if (payload)
34
- return { isValid: true, decodedToken: payload };
35
- else
36
- throw new Error("Issue while decoding token!");
37
- }
38
- }
39
- catch (err) {
40
- console.error(err);
41
- if (err instanceof jwt.TokenExpiredError)
42
- return { isValid: false, isExpired: true };
43
- }
44
- return { isValid: false };
45
- };
46
- return JWT;
47
- }());
48
- exports.default = JWT;
49
- //# sourceMappingURL=JWT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JWT.js","sourceRoot":"","sources":["../../../src/Crypto/JWT.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,kCAAmC;AASnC;IAGE,aAAY,WAAmB,EAAE,iBAA0B;QACzD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;IAC5C,CAAC;IACD,EAAE;IACF,yBAAW,GAAX,UACE,IAAY,EACZ,UAAmB,EACnB,aAAsB,EACtB,IAAU;QAEV,IAAM,GAAG,GAAG,UAAU,IAAI,IAAI,CAAC,iBAAiB,CAAA;QAChD,OAAO,GAAG,CAAC,IAAI,CACb,IAAI,EACJ,aAAa,IAAI,IAAI,CAAC,WAAW,EACjC,GAAG,CAAC,CAAC,YAAG,SAAS,EAAE,GAAG,IAAK,CAAC,IAAI,IAAI,EAAE,CAAC,EAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CACvD,CAAA;IACH,CAAC;IACD,2BAAa,GAAb,UAAc,KAAa;QACzB,IAAI;YACF,oBAAoB;YACpB,IAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;YACnD,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;iBACxD;gBACH,IAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;gBACjD,IAAI,OAAO;oBAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAA;;oBACvD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;aACpD;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,IAAI,GAAG,YAAY,GAAG,CAAC,iBAAiB;gBACtC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;SAC7C;QACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IAC3B,CAAC;IACH,UAAC;AAAD,CAAC,AAtCD,IAsCC"}
@@ -1,21 +0,0 @@
1
- export default class Globals {
2
- static ErrorResponseValidationFail: string;
3
- static ErrorResponseInvalidServerResponse: string;
4
- static ErrorResponseUnhandledError: string;
5
- static ErrorResponseNoRecords: string;
6
- static ErrorCode_MissingParam: string;
7
- static ErrorCode_InvalidInput: string;
8
- static ErrorCode_APIError: string;
9
- static ErrorCode_NoRecords: string;
10
- static Listener_HTTP_DefaultPort: number;
11
- static Listener_HTTP_DefaultHost: string;
12
- static Listener_HTTP_ProxyRoute: string;
13
- static Listener_HTTP_DefaultTimeout: number;
14
- static Listener_HTTP_DefaultHealthCheckRoute: string;
15
- static Resp_MSG_EXCEPTION: string;
16
- static Resp_CODE_EXCEPTION: string;
17
- static Resp_STATUSCODE_EXCEPTION: number;
18
- static Resp_MSG_INVALIDRESP: string;
19
- static Resp_CODE_INVALIDRESP: string;
20
- static Resp_STATUSCODE_INVALIDRESP: number;
21
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var dotenv = require("dotenv");
4
- var Utils_1 = require("./API/Utils");
5
- // important for dev env to load .env file
6
- dotenv.config();
7
- var Globals = /** @class */ (function () {
8
- function Globals() {
9
- }
10
- //Error messages
11
- Globals.ErrorResponseValidationFail = "Input validation failed: "; //400
12
- Globals.ErrorResponseInvalidServerResponse = "No valid response, this is a system error."; //400
13
- Globals.ErrorResponseUnhandledError = "Unhandled error when processing request."; //400
14
- Globals.ErrorResponseNoRecords = "No events to be processed."; //400
15
- //Error Codes
16
- Globals.ErrorCode_MissingParam = "MISSING_PARAM";
17
- Globals.ErrorCode_InvalidInput = "INVALID_INPUT";
18
- Globals.ErrorCode_APIError = "API_ERROR";
19
- Globals.ErrorCode_NoRecords = "EMPTY_EVENT";
20
- Globals.Listener_HTTP_DefaultPort = Utils_1.default.parseIntNullIfNaN(process.env.PORT) || 80;
21
- Globals.Listener_HTTP_DefaultHost = "localhost";
22
- Globals.Listener_HTTP_ProxyRoute = "*";
23
- Globals.Listener_HTTP_DefaultTimeout = Utils_1.default.parseIntNullIfNaN(process.env.TIMEOUT) || 30000;
24
- Globals.Listener_HTTP_DefaultHealthCheckRoute = process.env.HEALTH_ROUTE || "/health";
25
- //Resps
26
- Globals.Resp_MSG_EXCEPTION = "[Proxy]: Exception during request execution!";
27
- Globals.Resp_CODE_EXCEPTION = "EXEC_EXCEPTION";
28
- Globals.Resp_STATUSCODE_EXCEPTION = 502;
29
- Globals.Resp_MSG_INVALIDRESP = "[Proxy]: Invalid response from server!";
30
- Globals.Resp_CODE_INVALIDRESP = "EMPTY_RESPONSE";
31
- Globals.Resp_STATUSCODE_INVALIDRESP = 400;
32
- return Globals;
33
- }());
34
- exports.default = Globals;
35
- //# sourceMappingURL=Globals.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Globals.js","sourceRoot":"","sources":["../../src/Globals.ts"],"names":[],"mappings":";;AAAA,+BAAgC;AAEhC,qCAA+B;AAE/B,0CAA0C;AAC1C,MAAM,CAAC,MAAM,EAAE,CAAA;AACf;IAAA;IAgCA,CAAC;IA/BC,gBAAgB;IACF,mCAA2B,GAAG,2BAA2B,CAAA,CAAC,KAAK;IAC/D,0CAAkC,GAC9C,4CAA4C,CAAA,CAAC,KAAK;IACtC,mCAA2B,GACvC,0CAA0C,CAAA,CAAC,KAAK;IACpC,8BAAsB,GAAG,4BAA4B,CAAA,CAAC,KAAK;IACzE,aAAa;IACC,8BAAsB,GAAG,eAAe,CAAA;IACxC,8BAAsB,GAAG,eAAe,CAAA;IACxC,0BAAkB,GAAG,WAAW,CAAA;IAChC,2BAAmB,GAAG,aAAa,CAAA;IAEnC,iCAAyB,GACrC,eAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IAEnC,iCAAyB,GAAG,WAAW,CAAA;IACvC,gCAAwB,GAAG,GAAG,CAAA;IAC9B,oCAA4B,GACxC,eAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAA;IACzC,6CAAqC,GACjD,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,SAAS,CAAA;IACvC,OAAO;IACO,0BAAkB,GAC9B,8CAA8C,CAAA;IAClC,2BAAmB,GAAG,gBAAgB,CAAA;IACtC,iCAAyB,GAAG,GAAG,CAAA;IAE/B,4BAAoB,GAAG,wCAAwC,CAAA;IAC/D,6BAAqB,GAAG,gBAAgB,CAAA;IACxC,mCAA2B,GAAG,GAAG,CAAA;IACjD,cAAC;CAAA,AAhCD,IAgCC;kBAhCoB,OAAO"}
@@ -1,34 +0,0 @@
1
- export declare enum LOG_LEVELS {
2
- DEBUG = "DEBUG",
3
- INFO = "INFO",
4
- WARN = "WARN",
5
- ERROR = "ERROR"
6
- }
7
- export type LoggerConfig = {
8
- sensitiveFilteringKeywords?: boolean | Array<string>;
9
- logLevel?: LOG_LEVELS | string;
10
- };
11
- export default class Logger {
12
- private _config?;
13
- private _transactionID;
14
- private _filterBlacklist;
15
- private _LOG_LEVEL;
16
- private origin;
17
- constructor(_config: LoggerConfig | undefined, transactionID: string);
18
- debug(...args: any[]): void;
19
- log(...args: any[]): void;
20
- info(...args: any[]): void;
21
- warning(...args: any[]): void;
22
- warn(...args: any[]): void;
23
- error(...args: any[]): void;
24
- exception(exception: any, ...args: any[]): void;
25
- cleanUp(): void;
26
- flushLogs(): Promise<void>;
27
- private _setupBindings;
28
- private _formattedLog;
29
- private _callerName;
30
- private _processLog;
31
- private _exception;
32
- private _pushLog;
33
- private _suppressSensitiveInfo;
34
- }