@creator.co/wapi 1.2.1-beta6 → 1.2.3

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 (129) hide show
  1. package/.eslintrc.cjs +29 -22
  2. package/.github/workflows/npmpublish.yml +11 -19
  3. package/.github/workflows/prs.yml +13 -0
  4. package/index.ts +12 -10
  5. package/jest.config.ts +39 -0
  6. package/package.json +15 -4
  7. package/src/API/Request.ts +136 -44
  8. package/src/API/Response.ts +256 -46
  9. package/src/API/Utils.ts +60 -7
  10. package/src/BaseEvent/EventProcessor.ts +93 -28
  11. package/src/BaseEvent/Process.ts +69 -13
  12. package/src/BaseEvent/Transaction.ts +29 -50
  13. package/src/Config/Configuration.ts +119 -19
  14. package/src/Config/EnvironmentVar.ts +100 -21
  15. package/src/Crypto/Crypto.ts +78 -19
  16. package/src/Crypto/JWT.ts +53 -13
  17. package/src/Globals.ts +159 -27
  18. package/src/Logger/Logger.ts +204 -65
  19. package/src/Mailer/Mailer.ts +114 -31
  20. package/src/Publisher/Publisher.ts +57 -16
  21. package/src/Server/RouteResolver.ts +141 -0
  22. package/src/Server/Router.ts +84 -12
  23. package/src/Server/lib/ContainerServer.ts +53 -6
  24. package/src/Server/lib/Server.ts +82 -54
  25. package/src/Server/lib/container/GenericHandler.ts +15 -18
  26. package/src/Server/lib/container/GenericHandlerEvent.ts +78 -50
  27. package/src/Server/lib/container/HealthHandler.ts +2 -2
  28. package/src/Server/lib/container/Proxy.ts +114 -45
  29. package/src/Server/lib/container/Utils.ts +18 -27
  30. package/src/Validation/Validator.ts +23 -7
  31. package/tests/API/Request.test.ts +259 -0
  32. package/tests/API/Response.test.ts +367 -0
  33. package/tests/API/Utils.test.ts +157 -0
  34. package/tests/BaseEvent/EventProcessor.test.ts +262 -0
  35. package/tests/BaseEvent/Process.test.ts +49 -0
  36. package/tests/BaseEvent/Transaction.test.ts +222 -0
  37. package/tests/Config/Config.test.ts +193 -0
  38. package/tests/Config/EnvironmentVar.test.ts +214 -0
  39. package/tests/Crypto/Crypto.test.ts +88 -0
  40. package/tests/Crypto/JWT.test.ts +92 -0
  41. package/tests/Logger/Logger.test.ts +96 -0
  42. package/tests/Mailer/Mailer.test.ts +59 -0
  43. package/tests/Publisher/Publisher.test.ts +60 -0
  44. package/tests/Server/RouteResolver.test.ts +103 -0
  45. package/tests/Server/Router.test.ts +38 -0
  46. package/tests/Server/lib/ContainerServer.test.ts +327 -0
  47. package/tests/Server/lib/Server.test.ts +12 -0
  48. package/tests/Server/lib/container/GenericHandler.test.ts +131 -0
  49. package/tests/Server/lib/container/GenericHandlerEvent.test.ts +102 -0
  50. package/tests/Server/lib/container/HealthHandler.test.ts +30 -0
  51. package/tests/Server/lib/container/Proxy.test.ts +265 -0
  52. package/tests/Server/lib/container/Utils.test.ts +47 -0
  53. package/tests/Test.utils.ts +95 -0
  54. package/tests/Validation/Validator.test.ts +76 -0
  55. package/tests/main.test.ts +15 -0
  56. package/tsconfig.json +1 -0
  57. package/dist/index.d.ts +0 -11
  58. package/dist/index.js +0 -24
  59. package/dist/index.js.map +0 -1
  60. package/dist/package.json +0 -53
  61. package/dist/src/API/Request.d.ts +0 -21
  62. package/dist/src/API/Request.js +0 -86
  63. package/dist/src/API/Request.js.map +0 -1
  64. package/dist/src/API/Response.d.ts +0 -39
  65. package/dist/src/API/Response.js +0 -232
  66. package/dist/src/API/Response.js.map +0 -1
  67. package/dist/src/API/Utils.d.ts +0 -8
  68. package/dist/src/API/Utils.js +0 -49
  69. package/dist/src/API/Utils.js.map +0 -1
  70. package/dist/src/BaseEvent/EventProcessor.d.ts +0 -13
  71. package/dist/src/BaseEvent/EventProcessor.js +0 -151
  72. package/dist/src/BaseEvent/EventProcessor.js.map +0 -1
  73. package/dist/src/BaseEvent/Process.d.ts +0 -12
  74. package/dist/src/BaseEvent/Process.js +0 -114
  75. package/dist/src/BaseEvent/Process.js.map +0 -1
  76. package/dist/src/BaseEvent/Transaction.d.ts +0 -29
  77. package/dist/src/BaseEvent/Transaction.js +0 -248
  78. package/dist/src/BaseEvent/Transaction.js.map +0 -1
  79. package/dist/src/Config/Configuration.d.ts +0 -34
  80. package/dist/src/Config/Configuration.js +0 -93
  81. package/dist/src/Config/Configuration.js.map +0 -1
  82. package/dist/src/Config/EnvironmentVar.d.ts +0 -17
  83. package/dist/src/Config/EnvironmentVar.js +0 -152
  84. package/dist/src/Config/EnvironmentVar.js.map +0 -1
  85. package/dist/src/Crypto/Crypto.d.ts +0 -8
  86. package/dist/src/Crypto/Crypto.js +0 -84
  87. package/dist/src/Crypto/Crypto.js.map +0 -1
  88. package/dist/src/Crypto/JWT.d.ts +0 -16
  89. package/dist/src/Crypto/JWT.js +0 -49
  90. package/dist/src/Crypto/JWT.js.map +0 -1
  91. package/dist/src/Globals.d.ts +0 -21
  92. package/dist/src/Globals.js +0 -35
  93. package/dist/src/Globals.js.map +0 -1
  94. package/dist/src/Logger/Logger.d.ts +0 -34
  95. package/dist/src/Logger/Logger.js +0 -345
  96. package/dist/src/Logger/Logger.js.map +0 -1
  97. package/dist/src/Mailer/Mailer.d.ts +0 -12
  98. package/dist/src/Mailer/Mailer.js +0 -234
  99. package/dist/src/Mailer/Mailer.js.map +0 -1
  100. package/dist/src/Publisher/Publisher.d.ts +0 -10
  101. package/dist/src/Publisher/Publisher.js +0 -109
  102. package/dist/src/Publisher/Publisher.js.map +0 -1
  103. package/dist/src/Server/Router.d.ts +0 -27
  104. package/dist/src/Server/Router.js +0 -22
  105. package/dist/src/Server/Router.js.map +0 -1
  106. package/dist/src/Server/lib/ContainerServer.d.ts +0 -11
  107. package/dist/src/Server/lib/ContainerServer.js +0 -103
  108. package/dist/src/Server/lib/ContainerServer.js.map +0 -1
  109. package/dist/src/Server/lib/Server.d.ts +0 -9
  110. package/dist/src/Server/lib/Server.js +0 -141
  111. package/dist/src/Server/lib/Server.js.map +0 -1
  112. package/dist/src/Server/lib/container/GenericHandler.d.ts +0 -4
  113. package/dist/src/Server/lib/container/GenericHandler.js +0 -136
  114. package/dist/src/Server/lib/container/GenericHandler.js.map +0 -1
  115. package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +0 -14
  116. package/dist/src/Server/lib/container/GenericHandlerEvent.js +0 -164
  117. package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +0 -1
  118. package/dist/src/Server/lib/container/HealthHandler.d.ts +0 -3
  119. package/dist/src/Server/lib/container/HealthHandler.js +0 -44
  120. package/dist/src/Server/lib/container/HealthHandler.js.map +0 -1
  121. package/dist/src/Server/lib/container/Proxy.d.ts +0 -15
  122. package/dist/src/Server/lib/container/Proxy.js +0 -157
  123. package/dist/src/Server/lib/container/Proxy.js.map +0 -1
  124. package/dist/src/Server/lib/container/Utils.d.ts +0 -6
  125. package/dist/src/Server/lib/container/Utils.js +0 -109
  126. package/dist/src/Server/lib/container/Utils.js.map +0 -1
  127. package/dist/src/Validation/Validator.d.ts +0 -5
  128. package/dist/src/Validation/Validator.js +0 -31
  129. package/dist/src/Validation/Validator.js.map +0 -1
@@ -1,30 +1,83 @@
1
- import {
2
- SecretsManagerClient,
3
- GetSecretValueCommand,
4
- } from "@aws-sdk/client-secrets-manager"
5
- import { SSMClient, GetParameterCommand } from "@aws-sdk/client-ssm"
1
+ import { SecretsManagerClient, GetSecretValueCommand } from '@aws-sdk/client-secrets-manager'
2
+ import { SSMClient, GetParameterCommand } from '@aws-sdk/client-ssm'
6
3
 
7
4
  // Explicity setting VM level variables in order to persist
8
5
  // client across different important and instances.
9
6
  // eslint-disable-next-line no-var
10
- var ssmClient = null,
7
+ /**
8
+ * ${1:Description placeholder}
9
+ *
10
+ * @type {*}
11
+ */
12
+ let ssmClient = null,
11
13
  secretsClient = null
12
14
 
15
+ /**
16
+ * ${1:Description placeholder}
17
+ *
18
+ * @export
19
+ * @enum {number}
20
+ */
13
21
  export enum EnvironmentType {
14
22
  PlainRemote,
15
23
  SecureRemote,
16
24
  Local,
17
25
  }
26
+ /**
27
+ * ${1:Description placeholder}
28
+ *
29
+ * @export
30
+ * @class EnvironmentVar
31
+ * @typedef {EnvironmentVar}
32
+ * @template T
33
+ */
18
34
  export default class EnvironmentVar<T> {
35
+ /**
36
+ * ${1:Description placeholder}
37
+ *
38
+ * @private
39
+ * @readonly
40
+ * @type {string}
41
+ */
19
42
  private readonly paramName: string
43
+ /**
44
+ * ${1:Description placeholder}
45
+ *
46
+ * @private
47
+ * @readonly
48
+ * @type {EnvironmentType}
49
+ */
20
50
  private readonly type: EnvironmentType
51
+ /**
52
+ * ${1:Description placeholder}
53
+ *
54
+ * @private
55
+ * @readonly
56
+ * @type {boolean}
57
+ */
21
58
  private readonly optional: boolean
59
+ /**
60
+ * ${1:Description placeholder}
61
+ *
62
+ * @private
63
+ * @readonly
64
+ * @type {string}
65
+ */
22
66
  private readonly paramPrefix: string
67
+ /**
68
+ * Creates an instance of EnvironmentVar.
69
+ *
70
+ * @constructor
71
+ * @param {string} paramName
72
+ * @param {EnvironmentType} type
73
+ * @param {?boolean} [optional]
74
+ * @param {string} [paramPrefix=`/creatorco-api-\${process.env.STAGE\}/env/`]
75
+ */
23
76
  constructor(
24
77
  paramName: string,
25
78
  type: EnvironmentType,
26
79
  optional?: boolean,
27
- paramPrefix = `/creatorco-api-${process.env.STAGE}/env/` /* only allowed process.env */,
80
+ paramPrefix = `/creatorco-api-${process.env.STAGE}/env/` /* only allowed process.env */
28
81
  ) {
29
82
  this.paramName = paramName
30
83
  this.type = type
@@ -32,39 +85,61 @@ export default class EnvironmentVar<T> {
32
85
  this.paramPrefix = paramPrefix
33
86
  }
34
87
 
88
+ /**
89
+ * ${1:Description placeholder}
90
+ *
91
+ * @public
92
+ * @returns {T}
93
+ */
35
94
  public syncResolve(): T {
36
95
  if (this.type == EnvironmentType.Local) return this.getLocalValue()
37
96
  else {
38
97
  throw new Error(
39
- "EnvironmentVar syncResolve method can only be called for environments of type 'Local'",
98
+ "EnvironmentVar syncResolve method can only be called for environments of type 'Local'"
40
99
  )
41
100
  }
42
101
  }
102
+ /**
103
+ * ${1:Description placeholder}
104
+ *
105
+ * @public
106
+ * @async
107
+ * @returns {unknown}
108
+ */
43
109
  public async resolve() {
44
110
  if (this.type == EnvironmentType.Local) return this.getLocalValue()
45
- else if (this.type == EnvironmentType.SecureRemote)
46
- return this.getSecureValue()
111
+ else if (this.type == EnvironmentType.SecureRemote) return this.getSecureValue()
47
112
  else return this.getPlainValue()
48
113
  }
49
114
 
115
+ /**
116
+ * ${1:Description placeholder}
117
+ *
118
+ * @private
119
+ * @returns {T}
120
+ */
50
121
  private getLocalValue(): T {
51
122
  const value = process.env[this.paramName]
52
123
  if (!value && !this.optional) {
53
124
  throw new Error(
54
- `Local environment ${this.paramName} is not defined, please reconfigure the application and redeploy!`,
125
+ `Local environment ${this.paramName} is not defined, please reconfigure the application and redeploy!`
55
126
  )
56
127
  }
57
128
  return value as T
58
129
  }
130
+ /**
131
+ * ${1:Description placeholder}
132
+ *
133
+ * @private
134
+ * @async
135
+ * @returns {Promise<T>}
136
+ */
59
137
  private async getPlainValue(): Promise<T> {
60
138
  if (!ssmClient) ssmClient = new SSMClient()
61
139
  const pName = `${this.paramPrefix}${this.paramName}`
62
140
  try {
63
- const data = await ssmClient.send(
64
- new GetParameterCommand({ Name: pName }),
65
- )
66
- if (data.Parameter && data.Parameter.Value)
67
- return data.Parameter.Value as T
141
+ const data = await ssmClient.send(new GetParameterCommand({ Name: pName }))
142
+ if (data.Parameter && data.Parameter.Value) return data.Parameter.Value as T
68
143
  } catch (error) {
69
144
  console.error(error)
70
145
  }
@@ -72,15 +147,19 @@ export default class EnvironmentVar<T> {
72
147
  throw new Error(`Unable to retrieve plain remote env value: ${pName}`)
73
148
  }
74
149
  }
150
+ /**
151
+ * ${1:Description placeholder}
152
+ *
153
+ * @private
154
+ * @async
155
+ * @returns {Promise<T>}
156
+ */
75
157
  private async getSecureValue(): Promise<T> {
76
158
  if (!secretsClient) secretsClient = new SecretsManagerClient()
77
159
  const pName = `${this.paramPrefix}${this.paramName}`
78
160
  try {
79
- const data = await secretsClient.send(
80
- new GetSecretValueCommand({ SecretId: pName }),
81
- )
82
- if (data.Parameter && data.Parameter.Value)
83
- return data.Parameter.Value as T
161
+ const data = await secretsClient.send(new GetSecretValueCommand({ SecretId: pName }))
162
+ if (data.Parameter && data.Parameter.Value) return data.Parameter.Value as T
84
163
  } catch (error) {
85
164
  console.error(error)
86
165
  }
@@ -1,35 +1,94 @@
1
- import { KMSClient, EncryptCommand, DecryptCommand } from "@aws-sdk/client-kms"
1
+ import { KMSClient, EncryptCommand, DecryptCommand } from '@aws-sdk/client-kms'
2
2
 
3
+ /**
4
+ * ${1:Description placeholder}
5
+ *
6
+ * @export
7
+ * @class Crypto
8
+ * @typedef {Crypto}
9
+ */
3
10
  export default class Crypto {
11
+ /**
12
+ * ${1:Description placeholder}
13
+ *
14
+ * @private
15
+ * @readonly
16
+ * @type {KMSClient}
17
+ */
4
18
  private readonly client: KMSClient
19
+ /**
20
+ * ${1:Description placeholder}
21
+ *
22
+ * @private
23
+ * @readonly
24
+ * @type {string}
25
+ */
5
26
  private readonly region: string
27
+ /**
28
+ * ${1:Description placeholder}
29
+ *
30
+ * @private
31
+ * @readonly
32
+ * @type {string}
33
+ */
6
34
  private readonly keyId: string
35
+ /**
36
+ * Creates an instance of Crypto.
37
+ *
38
+ * @constructor
39
+ * @param {string} region
40
+ * @param {string} keyId
41
+ */
7
42
  constructor(region: string, keyId: string) {
8
43
  this.region = region
9
44
  this.keyId = keyId
10
45
  this.client = new KMSClient({ region: this.region })
11
46
  }
12
47
  //
48
+ /**
49
+ * ${1:Description placeholder}
50
+ *
51
+ * @async
52
+ * @param {(string | any)} data
53
+ * @returns {Promise<string>}
54
+ */
13
55
  async encryptData(data: string | any): Promise<string> {
14
- const resp = await this.client.send(
15
- new EncryptCommand({
16
- KeyId: this.keyId,
17
- EncryptionAlgorithm: "RSAES_OAEP_SHA_256",
18
- Plaintext: new TextEncoder().encode(
19
- typeof data === "string" ? data : JSON.stringify(data),
20
- ),
21
- }),
22
- )
23
- return Buffer.from(resp.CiphertextBlob as any, "utf8").toString("hex")
56
+ try {
57
+ const resp = await this.client.send(
58
+ new EncryptCommand({
59
+ KeyId: this.keyId,
60
+ EncryptionAlgorithm: 'RSAES_OAEP_SHA_256',
61
+ Plaintext: new TextEncoder().encode(
62
+ typeof data === 'string' ? data : JSON.stringify(data)
63
+ ),
64
+ })
65
+ )
66
+ return Buffer.from(resp.CiphertextBlob as any, 'utf8').toString('hex')
67
+ } catch (e) {
68
+ console.error('Encryption failure', e)
69
+ return null
70
+ }
24
71
  }
72
+ /**
73
+ * ${1:Description placeholder}
74
+ *
75
+ * @async
76
+ * @param {string} data
77
+ * @returns {Promise<string>}
78
+ */
25
79
  async decryptData(data: string): Promise<string> {
26
- const resp = await this.client.send(
27
- new DecryptCommand({
28
- KeyId: this.keyId,
29
- CiphertextBlob: Buffer.from(data, "hex"),
30
- EncryptionAlgorithm: "RSAES_OAEP_SHA_256",
31
- }),
32
- )
33
- return new TextDecoder().decode(resp.Plaintext)
80
+ try {
81
+ const resp = await this.client.send(
82
+ new DecryptCommand({
83
+ KeyId: this.keyId,
84
+ CiphertextBlob: Buffer.from(data, 'hex'),
85
+ EncryptionAlgorithm: 'RSAES_OAEP_SHA_256',
86
+ })
87
+ )
88
+ return new TextDecoder().decode(resp.Plaintext)
89
+ } catch (e) {
90
+ console.error('Decryption failure', e)
91
+ return null
92
+ }
34
93
  }
35
94
  }
package/src/Crypto/JWT.ts CHANGED
@@ -1,5 +1,10 @@
1
- import * as jwt from "jsonwebtoken"
1
+ import * as jwt from 'jsonwebtoken'
2
2
 
3
+ /**
4
+ * ${1:Description placeholder}
5
+ *
6
+ * @typedef {JWTValidationResponse}
7
+ */
3
8
  type JWTValidationResponse =
4
9
  | { isValid: true; decodedToken: jwt.JwtPayload }
5
10
  | {
@@ -7,41 +12,76 @@ type JWTValidationResponse =
7
12
  isExpired?: boolean
8
13
  }
9
14
 
15
+ /**
16
+ * ${1:Description placeholder}
17
+ *
18
+ * @export
19
+ * @class JWT
20
+ * @typedef {JWT}
21
+ */
10
22
  export default class JWT {
23
+ /**
24
+ * ${1:Description placeholder}
25
+ *
26
+ * @private
27
+ * @readonly
28
+ * @type {string}
29
+ */
11
30
  private readonly tokenSecret: string
31
+ /**
32
+ * ${1:Description placeholder}
33
+ *
34
+ * @private
35
+ * @readonly
36
+ * @type {string}
37
+ */
12
38
  private readonly defaultExpiration: string
39
+ /**
40
+ * Creates an instance of JWT.
41
+ *
42
+ * @constructor
43
+ * @param {string} tokenSecret
44
+ * @param {?string} [defaultExpiration]
45
+ */
13
46
  constructor(tokenSecret: string, defaultExpiration?: string) {
14
47
  this.tokenSecret = tokenSecret
15
48
  this.defaultExpiration = defaultExpiration
16
49
  }
17
50
  //
18
- createToken(
19
- data: object,
20
- expiration?: string,
21
- overrideToken?: string,
22
- opts?: any,
23
- ): string {
51
+ /**
52
+ * ${1:Description placeholder}
53
+ *
54
+ * @param {object} data
55
+ * @param {?string} [expiration]
56
+ * @param {?string} [overrideToken]
57
+ * @param {?*} [opts]
58
+ * @returns {string}
59
+ */
60
+ createToken(data: object, expiration?: string, overrideToken?: string, opts?: any): string {
24
61
  const exp = expiration || this.defaultExpiration
25
62
  return jwt.sign(
26
63
  data,
27
64
  overrideToken || this.tokenSecret,
28
- exp ? { expiresIn: exp, ...(opts || {}) } : opts || {},
65
+ exp ? { expiresIn: exp, ...(opts || {}) } : opts || {}
29
66
  )
30
67
  }
68
+ /**
69
+ * ${1:Description placeholder}
70
+ *
71
+ * @param {string} token
72
+ * @returns {JWTValidationResponse}
73
+ */
31
74
  validateToken(token: string): JWTValidationResponse {
32
75
  try {
33
76
  // Check if is valid
34
77
  const isValid = jwt.verify(token, this.tokenSecret)
35
- if (!isValid) throw new Error("Issue with token validation!")
36
- else {
78
+ if (isValid) {
37
79
  const payload = jwt.decode(token, { json: true })
38
80
  if (payload) return { isValid: true, decodedToken: payload }
39
- else throw new Error("Issue while decoding token!")
40
81
  }
41
82
  } catch (err) {
42
83
  console.error(err)
43
- if (err instanceof jwt.TokenExpiredError)
44
- return { isValid: false, isExpired: true }
84
+ if (err instanceof jwt.TokenExpiredError) return { isValid: false, isExpired: true }
45
85
  }
46
86
  return { isValid: false }
47
87
  }
package/src/Globals.ts CHANGED
@@ -1,39 +1,171 @@
1
- import * as dotenv from "dotenv"
1
+ import * as dotenv from 'dotenv'
2
2
 
3
- import Utils from "./API/Utils"
3
+ import Utils from './API/Utils'
4
4
 
5
5
  // important for dev env to load .env file
6
6
  dotenv.config()
7
+ /**
8
+ * Description placeholder
9
+ *
10
+ * @export
11
+ * @class Globals
12
+ * @typedef {Globals}
13
+ */
7
14
  export default class Globals {
8
- //Error messages
9
- public static ErrorResponseValidationFail = "Input validation failed: " //400
10
- public static ErrorResponseInvalidServerResponse =
11
- "No valid response, this is a system error." //400
12
- public static ErrorResponseUnhandledError =
13
- "Unhandled error when processing request." //400
14
- public static ErrorResponseNoRecords = "No events to be processed." //400
15
- //Error Codes
16
- public static ErrorCode_MissingParam = "MISSING_PARAM"
17
- public static ErrorCode_InvalidInput = "INVALID_INPUT"
18
- public static ErrorCode_APIError = "API_ERROR"
19
- public static ErrorCode_NoRecords = "EMPTY_EVENT"
15
+ /**
16
+ * Description placeholder
17
+ *
18
+ * @public
19
+ * @static
20
+ * @type {string}
21
+ */
22
+ public static ErrorResponseValidationFail = 'Input validation failed: ' //400
23
+ /**
24
+ * Description placeholder
25
+ *
26
+ * @public
27
+ * @static
28
+ * @type {string}
29
+ */
30
+ public static ErrorResponseInvalidServerResponse = 'No valid response, this is a system error.' //400
31
+ /**
32
+ * Description placeholder
33
+ *
34
+ * @public
35
+ * @static
36
+ * @type {string}
37
+ */
38
+ public static ErrorResponseUnhandledError = 'Unhandled error when processing request.' //400
39
+ /**
40
+ * Description placeholder
41
+ *
42
+ * @public
43
+ * @static
44
+ * @type {string}
45
+ */
46
+ public static ErrorResponseNoRecords = 'No events to be processed.' //400
47
+ /**
48
+ * Description placeholder
49
+ *
50
+ * @public
51
+ * @static
52
+ * @type {string}
53
+ */
54
+ public static ErrorCode_MissingParam = 'MISSING_PARAM'
55
+ /**
56
+ * Description placeholder
57
+ *
58
+ * @public
59
+ * @static
60
+ * @type {string}
61
+ */
62
+ public static ErrorCode_InvalidInput = 'INVALID_INPUT'
63
+ /**
64
+ * Description placeholder
65
+ *
66
+ * @public
67
+ * @static
68
+ * @type {string}
69
+ */
70
+ public static ErrorCode_APIError = 'API_ERROR'
71
+ /**
72
+ * Description placeholder
73
+ *
74
+ * @public
75
+ * @static
76
+ * @type {string}
77
+ */
78
+ public static ErrorCode_NoRecords = 'EMPTY_EVENT'
20
79
 
21
- public static Listener_HTTP_DefaultPort =
22
- Utils.parseIntNullIfNaN(process.env.PORT) || 80
80
+ /**
81
+ * Description placeholder
82
+ *
83
+ * @public
84
+ * @static
85
+ * @type {*}
86
+ */
87
+ public static Listener_HTTP_DefaultPort = Utils.parseIntNullIfNaN(process.env.PORT) || 9000
23
88
 
24
- public static Listener_HTTP_DefaultHost = "localhost"
25
- public static Listener_HTTP_ProxyRoute = "*"
26
- public static Listener_HTTP_DefaultTimeout =
27
- Utils.parseIntNullIfNaN(process.env.TIMEOUT) || 30000
28
- public static Listener_HTTP_DefaultHealthCheckRoute =
29
- process.env.HEALTH_ROUTE || "/health"
89
+ /**
90
+ * Description placeholder
91
+ *
92
+ * @public
93
+ * @static
94
+ * @type {string}
95
+ */
96
+ public static Listener_HTTP_DefaultHost = 'localhost'
97
+ /**
98
+ * Description placeholder
99
+ *
100
+ * @public
101
+ * @static
102
+ * @type {string}
103
+ */
104
+ public static Listener_HTTP_ProxyRoute = '*'
105
+ /**
106
+ * Description placeholder
107
+ *
108
+ * @public
109
+ * @static
110
+ * @type {*}
111
+ */
112
+ public static Listener_HTTP_DefaultTimeout = Utils.parseIntNullIfNaN(process.env.TIMEOUT) || 30000
113
+ /**
114
+ * Description placeholder
115
+ *
116
+ * @public
117
+ * @static
118
+ * @type {*}
119
+ */
120
+ public static Listener_HTTP_DefaultHealthCheckRoute = process.env.HEALTH_ROUTE || '/health'
30
121
  //Resps
31
- public static Resp_MSG_EXCEPTION =
32
- "[Proxy]: Exception during request execution!"
33
- public static Resp_CODE_EXCEPTION = "EXEC_EXCEPTION"
122
+ /**
123
+ * Description placeholder
124
+ *
125
+ * @public
126
+ * @static
127
+ * @type {string}
128
+ */
129
+ public static Resp_MSG_EXCEPTION = '[Proxy]: Exception during request execution!'
130
+ /**
131
+ * Description placeholder
132
+ *
133
+ * @public
134
+ * @static
135
+ * @type {string}
136
+ */
137
+ public static Resp_CODE_EXCEPTION = 'EXEC_EXCEPTION'
138
+ /**
139
+ * Description placeholder
140
+ *
141
+ * @public
142
+ * @static
143
+ * @type {number}
144
+ */
34
145
  public static Resp_STATUSCODE_EXCEPTION = 502
35
146
 
36
- public static Resp_MSG_INVALIDRESP = "[Proxy]: Invalid response from server!"
37
- public static Resp_CODE_INVALIDRESP = "EMPTY_RESPONSE"
147
+ /**
148
+ * Description placeholder
149
+ *
150
+ * @public
151
+ * @static
152
+ * @type {string}
153
+ */
154
+ public static Resp_MSG_INVALIDRESP = '[Proxy]: Invalid response from server!'
155
+ /**
156
+ * Description placeholder
157
+ *
158
+ * @public
159
+ * @static
160
+ * @type {string}
161
+ */
162
+ public static Resp_CODE_INVALIDRESP = 'EMPTY_RESPONSE'
163
+ /**
164
+ * Description placeholder
165
+ *
166
+ * @public
167
+ * @static
168
+ * @type {number}
169
+ */
38
170
  public static Resp_STATUSCODE_INVALIDRESP = 400
39
171
  }