@creator.co/wapi 1.2.2 → 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.
- package/.eslintrc.cjs +29 -22
- package/.github/workflows/npmpublish.yml +1 -1
- package/.github/workflows/prs.yml +1 -1
- package/index.ts +12 -10
- package/jest.config.ts +19 -19
- package/package.json +1 -1
- package/src/API/Request.ts +17 -35
- package/src/API/Response.ts +24 -42
- package/src/API/Utils.ts +5 -7
- package/src/BaseEvent/EventProcessor.ts +16 -24
- package/src/BaseEvent/Process.ts +7 -12
- package/src/BaseEvent/Transaction.ts +25 -43
- package/src/Config/Configuration.ts +8 -14
- package/src/Config/EnvironmentVar.ts +10 -20
- package/src/Crypto/Crypto.ts +10 -10
- package/src/Crypto/JWT.ts +4 -10
- package/src/Globals.ts +19 -25
- package/src/Logger/Logger.ts +36 -51
- package/src/Mailer/Mailer.ts +19 -31
- package/src/Publisher/Publisher.ts +7 -12
- package/src/Server/RouteResolver.ts +5 -6
- package/src/Server/Router.ts +7 -12
- package/src/Server/lib/ContainerServer.ts +5 -5
- package/src/Server/lib/Server.ts +26 -38
- package/src/Server/lib/container/GenericHandler.ts +8 -13
- package/src/Server/lib/container/GenericHandlerEvent.ts +21 -35
- package/src/Server/lib/container/HealthHandler.ts +2 -2
- package/src/Server/lib/container/Proxy.ts +26 -38
- package/src/Server/lib/container/Utils.ts +2 -2
- package/src/Validation/Validator.ts +6 -6
- package/tests/API/Request.test.ts +107 -111
- package/tests/API/Response.test.ts +86 -91
- package/tests/API/Utils.test.ts +64 -64
- package/tests/BaseEvent/EventProcessor.test.ts +68 -84
- package/tests/BaseEvent/Process.test.ts +11 -11
- package/tests/BaseEvent/Transaction.test.ts +44 -53
- package/tests/Config/Config.test.ts +50 -50
- package/tests/Config/EnvironmentVar.test.ts +50 -59
- package/tests/Crypto/Crypto.test.ts +20 -22
- package/tests/Crypto/JWT.test.ts +40 -40
- package/tests/Logger/Logger.test.ts +24 -36
- package/tests/Mailer/Mailer.test.ts +21 -29
- package/tests/Publisher/Publisher.test.ts +18 -18
- package/tests/Server/RouteResolver.test.ts +56 -59
- package/tests/Server/Router.test.ts +16 -16
- package/tests/Server/lib/ContainerServer.test.ts +83 -85
- package/tests/Server/lib/Server.test.ts +4 -4
- package/tests/Server/lib/container/GenericHandler.test.ts +31 -41
- package/tests/Server/lib/container/GenericHandlerEvent.test.ts +35 -36
- package/tests/Server/lib/container/HealthHandler.test.ts +7 -7
- package/tests/Server/lib/container/Proxy.test.ts +66 -79
- package/tests/Server/lib/container/Utils.test.ts +16 -17
- package/tests/Test.utils.ts +9 -9
- package/tests/Validation/Validator.test.ts +28 -40
- package/tests/main.test.ts +2 -2
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import type { APIGatewayEvent, Context, SQSEvent } from
|
|
1
|
+
import type { APIGatewayEvent, Context, SQSEvent } from 'aws-lambda'
|
|
2
2
|
|
|
3
|
-
import Request from
|
|
4
|
-
import Response, { ResponseErrorType } from
|
|
5
|
-
import Globals from
|
|
6
|
-
import Logger, { LoggerConfig } from
|
|
7
|
-
import Publisher, { PublisherConfig } from
|
|
3
|
+
import Request from '../API/Request'
|
|
4
|
+
import Response, { ResponseErrorType } from '../API/Response'
|
|
5
|
+
import Globals from '../Globals'
|
|
6
|
+
import Logger, { LoggerConfig } from '../Logger/Logger'
|
|
7
|
+
import Publisher, { PublisherConfig } from '../Publisher/Publisher'
|
|
8
8
|
|
|
9
9
|
// Request
|
|
10
|
-
export type TransactionExecution<
|
|
11
|
-
TransactionType
|
|
12
|
-
|
|
13
|
-
MiscRespType = null,
|
|
14
|
-
> = (
|
|
15
|
-
transaction: TransactionType,
|
|
16
|
-
) => Promise<
|
|
17
|
-
Response<ResponseInnerType> | Response<ResponseErrorType> | MiscRespType
|
|
18
|
-
>
|
|
10
|
+
export type TransactionExecution<TransactionType, ResponseInnerType, MiscRespType = null> = (
|
|
11
|
+
transaction: TransactionType
|
|
12
|
+
) => Promise<Response<ResponseInnerType> | Response<ResponseErrorType> | MiscRespType>
|
|
19
13
|
// Config
|
|
20
14
|
export type TransactionConfig = {
|
|
21
15
|
throwOnErrors?: boolean
|
|
@@ -32,10 +26,7 @@ export default class Transaction<
|
|
|
32
26
|
> {
|
|
33
27
|
private event: any
|
|
34
28
|
private context: Context
|
|
35
|
-
private response:
|
|
36
|
-
| Response<ResponseInnerType | ResponseErrorType>
|
|
37
|
-
| MiscRespType
|
|
38
|
-
| null
|
|
29
|
+
private response: Response<ResponseInnerType | ResponseErrorType> | MiscRespType | null
|
|
39
30
|
private syncReturn: boolean
|
|
40
31
|
private retrowErrors: boolean
|
|
41
32
|
//
|
|
@@ -44,16 +35,12 @@ export default class Transaction<
|
|
|
44
35
|
public readonly publisher: Publisher
|
|
45
36
|
public responseProxy: (response: Response<ResponseInnerType>) => Promise<void>
|
|
46
37
|
//
|
|
47
|
-
constructor(
|
|
48
|
-
event: APIGatewayEvent | SQSEvent,
|
|
49
|
-
context: Context,
|
|
50
|
-
config?: TransactionConfig,
|
|
51
|
-
) {
|
|
38
|
+
constructor(event: APIGatewayEvent | SQSEvent, context: Context, config?: TransactionConfig) {
|
|
52
39
|
const transactionId = context.awsRequestId
|
|
53
40
|
? context.awsRequestId
|
|
54
41
|
: (<APIGatewayEvent>event).requestContext
|
|
55
42
|
? (<APIGatewayEvent>event).requestContext.requestId
|
|
56
|
-
:
|
|
43
|
+
: 'unknown'
|
|
57
44
|
// transaction ctx
|
|
58
45
|
this.event = event
|
|
59
46
|
this.context = context
|
|
@@ -75,7 +62,7 @@ export default class Transaction<
|
|
|
75
62
|
Transaction<InputType, ResponseInnerType, MiscRespType>,
|
|
76
63
|
ResponseInnerType,
|
|
77
64
|
MiscRespType
|
|
78
|
-
|
|
65
|
+
>
|
|
79
66
|
): Promise<Response<ResponseInnerType | ResponseErrorType> | MiscRespType> {
|
|
80
67
|
await this.executeLoggerFlush(async () => {
|
|
81
68
|
await this.executeDBTransactions(async () => {
|
|
@@ -93,42 +80,40 @@ export default class Transaction<
|
|
|
93
80
|
Transaction<InputType, ResponseInnerType, MiscRespType>,
|
|
94
81
|
ResponseInnerType,
|
|
95
82
|
MiscRespType
|
|
96
|
-
|
|
83
|
+
>
|
|
97
84
|
): Promise<boolean> {
|
|
98
85
|
let executionFailed = true //failed til we say no!
|
|
99
86
|
//safe execution handler
|
|
100
87
|
try {
|
|
101
88
|
//Execute
|
|
102
|
-
this.logger.debug(
|
|
89
|
+
this.logger.debug('Starting main request code')
|
|
103
90
|
this.response = await executionFunc(this)
|
|
104
91
|
//Answer client
|
|
105
92
|
if (this.response && this.response instanceof Response) {
|
|
106
93
|
await this.response.build(this.context, this, this.syncReturn)
|
|
107
|
-
executionFailed = !!(
|
|
108
|
-
this.response.getBody() && this.response.getBody()["rollback"]
|
|
109
|
-
)
|
|
94
|
+
executionFailed = !!(this.response.getBody() && this.response.getBody()['rollback'])
|
|
110
95
|
} else if (this.syncReturn && this.response) {
|
|
111
|
-
this.logger.log(
|
|
96
|
+
this.logger.log('Sync return with different response object')
|
|
112
97
|
this.logger.debug(this.response)
|
|
113
98
|
executionFailed = false
|
|
114
99
|
} else {
|
|
115
100
|
this.response = this.getErrorResponse(
|
|
116
101
|
Globals.ErrorResponseInvalidServerResponse,
|
|
117
|
-
Globals.ErrorCode_APIError
|
|
102
|
+
Globals.ErrorCode_APIError
|
|
118
103
|
)
|
|
119
104
|
await this.response.build(this.context, this, this.syncReturn)
|
|
120
|
-
this.logger.error(
|
|
105
|
+
this.logger.error('Invalid response object from main request code.')
|
|
121
106
|
}
|
|
122
107
|
} catch (e) {
|
|
123
108
|
/*EXECUTION FAIL*/
|
|
124
|
-
this.logger.error(
|
|
109
|
+
this.logger.error('Exception when executing main request code.')
|
|
125
110
|
this.logger.exception(e)
|
|
126
111
|
//retrow?
|
|
127
112
|
if (this.retrowErrors) throw e
|
|
128
113
|
//envelope exception?
|
|
129
114
|
this.response = this.getErrorResponse(
|
|
130
115
|
Globals.ErrorResponseUnhandledError,
|
|
131
|
-
Globals.ErrorCode_APIError
|
|
116
|
+
Globals.ErrorCode_APIError
|
|
132
117
|
)
|
|
133
118
|
await this.response.build(this.context, this, this.syncReturn)
|
|
134
119
|
}
|
|
@@ -153,7 +138,7 @@ export default class Transaction<
|
|
|
153
138
|
// //Cleanup DB after execution
|
|
154
139
|
// if (this.db) await this.db.cleanup();
|
|
155
140
|
} catch (e) {
|
|
156
|
-
this.logger.error(
|
|
141
|
+
this.logger.error('Exception when executing DB transactions.')
|
|
157
142
|
this.logger.log(e.stack)
|
|
158
143
|
//retrow?
|
|
159
144
|
if (this.retrowErrors) throw e
|
|
@@ -163,19 +148,16 @@ export default class Transaction<
|
|
|
163
148
|
try {
|
|
164
149
|
await safeExecution()
|
|
165
150
|
} catch (e) {
|
|
166
|
-
this.logger.error(
|
|
151
|
+
this.logger.error('Exception when flushing logs.')
|
|
167
152
|
this.logger.exception(e)
|
|
168
153
|
//retrow?
|
|
169
154
|
if (this.retrowErrors) throw e
|
|
170
155
|
} finally {
|
|
171
|
-
this.logger.debug(
|
|
156
|
+
this.logger.debug('Transaction ended')
|
|
172
157
|
}
|
|
173
158
|
}
|
|
174
159
|
/* Response support */
|
|
175
|
-
private getErrorResponse(
|
|
176
|
-
error: string,
|
|
177
|
-
code: string,
|
|
178
|
-
): Response<ResponseErrorType> {
|
|
160
|
+
private getErrorResponse(error: string, code: string): Response<ResponseErrorType> {
|
|
179
161
|
return Response.BadRequestResponseWithRollback(error, code)
|
|
180
162
|
}
|
|
181
163
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as MemCache from
|
|
2
|
-
import * as DurationParser from
|
|
1
|
+
import * as MemCache from 'node-cache'
|
|
2
|
+
import * as DurationParser from 'parse-duration'
|
|
3
3
|
|
|
4
|
-
import EnvironmentVar, { EnvironmentType } from
|
|
4
|
+
import EnvironmentVar, { EnvironmentType } from './EnvironmentVar'
|
|
5
5
|
|
|
6
6
|
// Hold cached values at nodeVM level
|
|
7
7
|
// eslint-disable-next-line no-var
|
|
@@ -136,7 +136,7 @@ export default class Configuration<T extends ConfigurationSchema> {
|
|
|
136
136
|
propString,
|
|
137
137
|
EnvironmentType.Local,
|
|
138
138
|
!propSchema.required,
|
|
139
|
-
this.remotePrefix
|
|
139
|
+
this.remotePrefix
|
|
140
140
|
).syncResolve()
|
|
141
141
|
this.cacheValue(propString, v, propSchema.cachingPolicy)
|
|
142
142
|
return v
|
|
@@ -149,9 +149,7 @@ export default class Configuration<T extends ConfigurationSchema> {
|
|
|
149
149
|
* @param {keyof OmitByValueType<ExtractRemote<T>, null>} propName
|
|
150
150
|
* @returns {Promise<any>}
|
|
151
151
|
*/
|
|
152
|
-
public async asyncGet(
|
|
153
|
-
propName: keyof OmitByValueType<ExtractRemote<T>, null>,
|
|
154
|
-
): Promise<any> {
|
|
152
|
+
public async asyncGet(propName: keyof OmitByValueType<ExtractRemote<T>, null>): Promise<any> {
|
|
155
153
|
const propString = propName as string
|
|
156
154
|
const propSchema = this.schema[propString]
|
|
157
155
|
let v = this.getCachedValue(propString)
|
|
@@ -161,7 +159,7 @@ export default class Configuration<T extends ConfigurationSchema> {
|
|
|
161
159
|
propString,
|
|
162
160
|
EnvironmentType.PlainRemote,
|
|
163
161
|
!propSchema.required,
|
|
164
|
-
this.remotePrefix
|
|
162
|
+
this.remotePrefix
|
|
165
163
|
).resolve())
|
|
166
164
|
this.cacheValue(propString, v, propSchema.cachingPolicy)
|
|
167
165
|
return v
|
|
@@ -185,12 +183,8 @@ export default class Configuration<T extends ConfigurationSchema> {
|
|
|
185
183
|
* @param {*} value
|
|
186
184
|
* @param {string} [policy="1d"]
|
|
187
185
|
*/
|
|
188
|
-
private cacheValue(
|
|
189
|
-
valueKey
|
|
190
|
-
value: any,
|
|
191
|
-
policy: string = "1d",
|
|
192
|
-
): void {
|
|
193
|
-
cacheStore.set(valueKey, value, DurationParser(policy, "s"))
|
|
186
|
+
private cacheValue(valueKey: string, value: any, policy: string = '1d'): void {
|
|
187
|
+
cacheStore.set(valueKey, value, DurationParser(policy, 's'))
|
|
194
188
|
}
|
|
195
189
|
// unit-test support
|
|
196
190
|
/**
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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.
|
|
@@ -80,7 +77,7 @@ export default class EnvironmentVar<T> {
|
|
|
80
77
|
paramName: string,
|
|
81
78
|
type: EnvironmentType,
|
|
82
79
|
optional?: boolean,
|
|
83
|
-
paramPrefix = `/creatorco-api-${process.env.STAGE}/env/` /* only allowed process.env
|
|
80
|
+
paramPrefix = `/creatorco-api-${process.env.STAGE}/env/` /* only allowed process.env */
|
|
84
81
|
) {
|
|
85
82
|
this.paramName = paramName
|
|
86
83
|
this.type = type
|
|
@@ -98,7 +95,7 @@ export default class EnvironmentVar<T> {
|
|
|
98
95
|
if (this.type == EnvironmentType.Local) return this.getLocalValue()
|
|
99
96
|
else {
|
|
100
97
|
throw new Error(
|
|
101
|
-
"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'"
|
|
102
99
|
)
|
|
103
100
|
}
|
|
104
101
|
}
|
|
@@ -111,8 +108,7 @@ export default class EnvironmentVar<T> {
|
|
|
111
108
|
*/
|
|
112
109
|
public async resolve() {
|
|
113
110
|
if (this.type == EnvironmentType.Local) return this.getLocalValue()
|
|
114
|
-
else if (this.type == EnvironmentType.SecureRemote)
|
|
115
|
-
return this.getSecureValue()
|
|
111
|
+
else if (this.type == EnvironmentType.SecureRemote) return this.getSecureValue()
|
|
116
112
|
else return this.getPlainValue()
|
|
117
113
|
}
|
|
118
114
|
|
|
@@ -126,7 +122,7 @@ export default class EnvironmentVar<T> {
|
|
|
126
122
|
const value = process.env[this.paramName]
|
|
127
123
|
if (!value && !this.optional) {
|
|
128
124
|
throw new Error(
|
|
129
|
-
`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!`
|
|
130
126
|
)
|
|
131
127
|
}
|
|
132
128
|
return value as T
|
|
@@ -142,11 +138,8 @@ export default class EnvironmentVar<T> {
|
|
|
142
138
|
if (!ssmClient) ssmClient = new SSMClient()
|
|
143
139
|
const pName = `${this.paramPrefix}${this.paramName}`
|
|
144
140
|
try {
|
|
145
|
-
const data = await ssmClient.send(
|
|
146
|
-
|
|
147
|
-
)
|
|
148
|
-
if (data.Parameter && data.Parameter.Value)
|
|
149
|
-
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
|
|
150
143
|
} catch (error) {
|
|
151
144
|
console.error(error)
|
|
152
145
|
}
|
|
@@ -165,11 +158,8 @@ export default class EnvironmentVar<T> {
|
|
|
165
158
|
if (!secretsClient) secretsClient = new SecretsManagerClient()
|
|
166
159
|
const pName = `${this.paramPrefix}${this.paramName}`
|
|
167
160
|
try {
|
|
168
|
-
const data = await secretsClient.send(
|
|
169
|
-
|
|
170
|
-
)
|
|
171
|
-
if (data.Parameter && data.Parameter.Value)
|
|
172
|
-
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
|
|
173
163
|
} catch (error) {
|
|
174
164
|
console.error(error)
|
|
175
165
|
}
|
package/src/Crypto/Crypto.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KMSClient, EncryptCommand, DecryptCommand } from
|
|
1
|
+
import { KMSClient, EncryptCommand, DecryptCommand } from '@aws-sdk/client-kms'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ${1:Description placeholder}
|
|
@@ -57,15 +57,15 @@ export default class Crypto {
|
|
|
57
57
|
const resp = await this.client.send(
|
|
58
58
|
new EncryptCommand({
|
|
59
59
|
KeyId: this.keyId,
|
|
60
|
-
EncryptionAlgorithm:
|
|
60
|
+
EncryptionAlgorithm: 'RSAES_OAEP_SHA_256',
|
|
61
61
|
Plaintext: new TextEncoder().encode(
|
|
62
|
-
typeof data ===
|
|
62
|
+
typeof data === 'string' ? data : JSON.stringify(data)
|
|
63
63
|
),
|
|
64
|
-
})
|
|
64
|
+
})
|
|
65
65
|
)
|
|
66
|
-
return Buffer.from(resp.CiphertextBlob as any,
|
|
66
|
+
return Buffer.from(resp.CiphertextBlob as any, 'utf8').toString('hex')
|
|
67
67
|
} catch (e) {
|
|
68
|
-
console.error(
|
|
68
|
+
console.error('Encryption failure', e)
|
|
69
69
|
return null
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -81,13 +81,13 @@ export default class Crypto {
|
|
|
81
81
|
const resp = await this.client.send(
|
|
82
82
|
new DecryptCommand({
|
|
83
83
|
KeyId: this.keyId,
|
|
84
|
-
CiphertextBlob: Buffer.from(data,
|
|
85
|
-
EncryptionAlgorithm:
|
|
86
|
-
})
|
|
84
|
+
CiphertextBlob: Buffer.from(data, 'hex'),
|
|
85
|
+
EncryptionAlgorithm: 'RSAES_OAEP_SHA_256',
|
|
86
|
+
})
|
|
87
87
|
)
|
|
88
88
|
return new TextDecoder().decode(resp.Plaintext)
|
|
89
89
|
} catch (e) {
|
|
90
|
-
console.error(
|
|
90
|
+
console.error('Decryption failure', e)
|
|
91
91
|
return null
|
|
92
92
|
}
|
|
93
93
|
}
|
package/src/Crypto/JWT.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as jwt from
|
|
1
|
+
import * as jwt from 'jsonwebtoken'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ${1:Description placeholder}
|
|
@@ -57,17 +57,12 @@ export default class JWT {
|
|
|
57
57
|
* @param {?*} [opts]
|
|
58
58
|
* @returns {string}
|
|
59
59
|
*/
|
|
60
|
-
createToken(
|
|
61
|
-
data: object,
|
|
62
|
-
expiration?: string,
|
|
63
|
-
overrideToken?: string,
|
|
64
|
-
opts?: any,
|
|
65
|
-
): string {
|
|
60
|
+
createToken(data: object, expiration?: string, overrideToken?: string, opts?: any): string {
|
|
66
61
|
const exp = expiration || this.defaultExpiration
|
|
67
62
|
return jwt.sign(
|
|
68
63
|
data,
|
|
69
64
|
overrideToken || this.tokenSecret,
|
|
70
|
-
exp ? { expiresIn: exp, ...(opts || {}) } : opts || {}
|
|
65
|
+
exp ? { expiresIn: exp, ...(opts || {}) } : opts || {}
|
|
71
66
|
)
|
|
72
67
|
}
|
|
73
68
|
/**
|
|
@@ -86,8 +81,7 @@ export default class JWT {
|
|
|
86
81
|
}
|
|
87
82
|
} catch (err) {
|
|
88
83
|
console.error(err)
|
|
89
|
-
if (err instanceof jwt.TokenExpiredError)
|
|
90
|
-
return { isValid: false, isExpired: true }
|
|
84
|
+
if (err instanceof jwt.TokenExpiredError) return { isValid: false, isExpired: true }
|
|
91
85
|
}
|
|
92
86
|
return { isValid: false }
|
|
93
87
|
}
|
package/src/Globals.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as dotenv from
|
|
1
|
+
import * as dotenv from 'dotenv'
|
|
2
2
|
|
|
3
|
-
import Utils from
|
|
3
|
+
import Utils from './API/Utils'
|
|
4
4
|
|
|
5
5
|
// important for dev env to load .env file
|
|
6
6
|
dotenv.config()
|
|
@@ -19,7 +19,7 @@ export default class Globals {
|
|
|
19
19
|
* @static
|
|
20
20
|
* @type {string}
|
|
21
21
|
*/
|
|
22
|
-
public static ErrorResponseValidationFail =
|
|
22
|
+
public static ErrorResponseValidationFail = 'Input validation failed: ' //400
|
|
23
23
|
/**
|
|
24
24
|
* Description placeholder
|
|
25
25
|
*
|
|
@@ -27,8 +27,7 @@ export default class Globals {
|
|
|
27
27
|
* @static
|
|
28
28
|
* @type {string}
|
|
29
29
|
*/
|
|
30
|
-
public static ErrorResponseInvalidServerResponse =
|
|
31
|
-
"No valid response, this is a system error." //400
|
|
30
|
+
public static ErrorResponseInvalidServerResponse = 'No valid response, this is a system error.' //400
|
|
32
31
|
/**
|
|
33
32
|
* Description placeholder
|
|
34
33
|
*
|
|
@@ -36,8 +35,7 @@ export default class Globals {
|
|
|
36
35
|
* @static
|
|
37
36
|
* @type {string}
|
|
38
37
|
*/
|
|
39
|
-
public static ErrorResponseUnhandledError =
|
|
40
|
-
"Unhandled error when processing request." //400
|
|
38
|
+
public static ErrorResponseUnhandledError = 'Unhandled error when processing request.' //400
|
|
41
39
|
/**
|
|
42
40
|
* Description placeholder
|
|
43
41
|
*
|
|
@@ -45,7 +43,7 @@ export default class Globals {
|
|
|
45
43
|
* @static
|
|
46
44
|
* @type {string}
|
|
47
45
|
*/
|
|
48
|
-
public static ErrorResponseNoRecords =
|
|
46
|
+
public static ErrorResponseNoRecords = 'No events to be processed.' //400
|
|
49
47
|
/**
|
|
50
48
|
* Description placeholder
|
|
51
49
|
*
|
|
@@ -53,7 +51,7 @@ export default class Globals {
|
|
|
53
51
|
* @static
|
|
54
52
|
* @type {string}
|
|
55
53
|
*/
|
|
56
|
-
public static ErrorCode_MissingParam =
|
|
54
|
+
public static ErrorCode_MissingParam = 'MISSING_PARAM'
|
|
57
55
|
/**
|
|
58
56
|
* Description placeholder
|
|
59
57
|
*
|
|
@@ -61,7 +59,7 @@ export default class Globals {
|
|
|
61
59
|
* @static
|
|
62
60
|
* @type {string}
|
|
63
61
|
*/
|
|
64
|
-
public static ErrorCode_InvalidInput =
|
|
62
|
+
public static ErrorCode_InvalidInput = 'INVALID_INPUT'
|
|
65
63
|
/**
|
|
66
64
|
* Description placeholder
|
|
67
65
|
*
|
|
@@ -69,7 +67,7 @@ export default class Globals {
|
|
|
69
67
|
* @static
|
|
70
68
|
* @type {string}
|
|
71
69
|
*/
|
|
72
|
-
public static ErrorCode_APIError =
|
|
70
|
+
public static ErrorCode_APIError = 'API_ERROR'
|
|
73
71
|
/**
|
|
74
72
|
* Description placeholder
|
|
75
73
|
*
|
|
@@ -77,7 +75,7 @@ export default class Globals {
|
|
|
77
75
|
* @static
|
|
78
76
|
* @type {string}
|
|
79
77
|
*/
|
|
80
|
-
public static ErrorCode_NoRecords =
|
|
78
|
+
public static ErrorCode_NoRecords = 'EMPTY_EVENT'
|
|
81
79
|
|
|
82
80
|
/**
|
|
83
81
|
* Description placeholder
|
|
@@ -86,8 +84,7 @@ export default class Globals {
|
|
|
86
84
|
* @static
|
|
87
85
|
* @type {*}
|
|
88
86
|
*/
|
|
89
|
-
public static Listener_HTTP_DefaultPort =
|
|
90
|
-
Utils.parseIntNullIfNaN(process.env.PORT) || 9000
|
|
87
|
+
public static Listener_HTTP_DefaultPort = Utils.parseIntNullIfNaN(process.env.PORT) || 9000
|
|
91
88
|
|
|
92
89
|
/**
|
|
93
90
|
* Description placeholder
|
|
@@ -96,7 +93,7 @@ export default class Globals {
|
|
|
96
93
|
* @static
|
|
97
94
|
* @type {string}
|
|
98
95
|
*/
|
|
99
|
-
public static Listener_HTTP_DefaultHost =
|
|
96
|
+
public static Listener_HTTP_DefaultHost = 'localhost'
|
|
100
97
|
/**
|
|
101
98
|
* Description placeholder
|
|
102
99
|
*
|
|
@@ -104,7 +101,7 @@ export default class Globals {
|
|
|
104
101
|
* @static
|
|
105
102
|
* @type {string}
|
|
106
103
|
*/
|
|
107
|
-
public static Listener_HTTP_ProxyRoute =
|
|
104
|
+
public static Listener_HTTP_ProxyRoute = '*'
|
|
108
105
|
/**
|
|
109
106
|
* Description placeholder
|
|
110
107
|
*
|
|
@@ -112,8 +109,7 @@ export default class Globals {
|
|
|
112
109
|
* @static
|
|
113
110
|
* @type {*}
|
|
114
111
|
*/
|
|
115
|
-
public static Listener_HTTP_DefaultTimeout =
|
|
116
|
-
Utils.parseIntNullIfNaN(process.env.TIMEOUT) || 30000
|
|
112
|
+
public static Listener_HTTP_DefaultTimeout = Utils.parseIntNullIfNaN(process.env.TIMEOUT) || 30000
|
|
117
113
|
/**
|
|
118
114
|
* Description placeholder
|
|
119
115
|
*
|
|
@@ -121,8 +117,7 @@ export default class Globals {
|
|
|
121
117
|
* @static
|
|
122
118
|
* @type {*}
|
|
123
119
|
*/
|
|
124
|
-
public static Listener_HTTP_DefaultHealthCheckRoute =
|
|
125
|
-
process.env.HEALTH_ROUTE || "/health"
|
|
120
|
+
public static Listener_HTTP_DefaultHealthCheckRoute = process.env.HEALTH_ROUTE || '/health'
|
|
126
121
|
//Resps
|
|
127
122
|
/**
|
|
128
123
|
* Description placeholder
|
|
@@ -131,8 +126,7 @@ export default class Globals {
|
|
|
131
126
|
* @static
|
|
132
127
|
* @type {string}
|
|
133
128
|
*/
|
|
134
|
-
public static Resp_MSG_EXCEPTION =
|
|
135
|
-
"[Proxy]: Exception during request execution!"
|
|
129
|
+
public static Resp_MSG_EXCEPTION = '[Proxy]: Exception during request execution!'
|
|
136
130
|
/**
|
|
137
131
|
* Description placeholder
|
|
138
132
|
*
|
|
@@ -140,7 +134,7 @@ export default class Globals {
|
|
|
140
134
|
* @static
|
|
141
135
|
* @type {string}
|
|
142
136
|
*/
|
|
143
|
-
public static Resp_CODE_EXCEPTION =
|
|
137
|
+
public static Resp_CODE_EXCEPTION = 'EXEC_EXCEPTION'
|
|
144
138
|
/**
|
|
145
139
|
* Description placeholder
|
|
146
140
|
*
|
|
@@ -157,7 +151,7 @@ export default class Globals {
|
|
|
157
151
|
* @static
|
|
158
152
|
* @type {string}
|
|
159
153
|
*/
|
|
160
|
-
public static Resp_MSG_INVALIDRESP =
|
|
154
|
+
public static Resp_MSG_INVALIDRESP = '[Proxy]: Invalid response from server!'
|
|
161
155
|
/**
|
|
162
156
|
* Description placeholder
|
|
163
157
|
*
|
|
@@ -165,7 +159,7 @@ export default class Globals {
|
|
|
165
159
|
* @static
|
|
166
160
|
* @type {string}
|
|
167
161
|
*/
|
|
168
|
-
public static Resp_CODE_INVALIDRESP =
|
|
162
|
+
public static Resp_CODE_INVALIDRESP = 'EMPTY_RESPONSE'
|
|
169
163
|
/**
|
|
170
164
|
* Description placeholder
|
|
171
165
|
*
|