@ikonintegration/ikapi 5.0.9 → 5.0.10
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/package.json +3 -2
- package/src/Publisher/Publisher.ts +74 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/package-lock.json +0 -11907
- package/dist/package.json +0 -82
- package/dist/src/API/Request.d.ts +0 -125
- package/dist/src/API/Request.js +0 -185
- package/dist/src/API/Request.js.map +0 -1
- package/dist/src/API/Response.d.ts +0 -188
- package/dist/src/API/Response.js +0 -270
- package/dist/src/API/Response.js.map +0 -1
- package/dist/src/BaseEvent/DynamoTransaction.d.ts +0 -70
- package/dist/src/BaseEvent/DynamoTransaction.js +0 -104
- package/dist/src/BaseEvent/DynamoTransaction.js.map +0 -1
- package/dist/src/BaseEvent/EventProcessor.d.ts +0 -58
- package/dist/src/BaseEvent/EventProcessor.js +0 -101
- package/dist/src/BaseEvent/EventProcessor.js.map +0 -1
- package/dist/src/BaseEvent/Launchable/ContainerExec.d.ts +0 -42
- package/dist/src/BaseEvent/Launchable/ContainerExec.js +0 -104
- package/dist/src/BaseEvent/Launchable/ContainerExec.js.map +0 -1
- package/dist/src/BaseEvent/Launchable/index.d.ts +0 -34
- package/dist/src/BaseEvent/Launchable/index.js +0 -43
- package/dist/src/BaseEvent/Launchable/index.js.map +0 -1
- package/dist/src/BaseEvent/Launchable/types.d.ts +0 -10
- package/dist/src/BaseEvent/Launchable/types.js +0 -2
- package/dist/src/BaseEvent/Launchable/types.js.map +0 -1
- package/dist/src/BaseEvent/Process.d.ts +0 -50
- package/dist/src/BaseEvent/Process.js +0 -64
- package/dist/src/BaseEvent/Process.js.map +0 -1
- package/dist/src/BaseEvent/StepTransaction.d.ts +0 -23
- package/dist/src/BaseEvent/StepTransaction.js +0 -27
- package/dist/src/BaseEvent/StepTransaction.js.map +0 -1
- package/dist/src/BaseEvent/Transaction.d.ts +0 -149
- package/dist/src/BaseEvent/Transaction.js +0 -224
- package/dist/src/BaseEvent/Transaction.js.map +0 -1
- package/dist/src/Cache/Redis.d.ts +0 -29
- package/dist/src/Cache/Redis.js +0 -80
- package/dist/src/Cache/Redis.js.map +0 -1
- package/dist/src/Cache/types.d.ts +0 -31
- package/dist/src/Cache/types.js +0 -2
- package/dist/src/Cache/types.js.map +0 -1
- package/dist/src/Config/Configuration.d.ts +0 -123
- package/dist/src/Config/Configuration.js +0 -109
- package/dist/src/Config/Configuration.js.map +0 -1
- package/dist/src/Config/EnvironmentVar.d.ts +0 -74
- package/dist/src/Config/EnvironmentVar.js +0 -138
- package/dist/src/Config/EnvironmentVar.js.map +0 -1
- package/dist/src/Crypto/Crypto.d.ts +0 -45
- package/dist/src/Crypto/Crypto.js +0 -72
- package/dist/src/Crypto/Crypto.js.map +0 -1
- package/dist/src/Database/Database.d.ts +0 -21
- package/dist/src/Database/Database.js +0 -15
- package/dist/src/Database/Database.js.map +0 -1
- package/dist/src/Database/DatabaseManager.d.ts +0 -47
- package/dist/src/Database/DatabaseManager.js +0 -60
- package/dist/src/Database/DatabaseManager.js.map +0 -1
- package/dist/src/Database/DatabaseTransaction.d.ts +0 -101
- package/dist/src/Database/DatabaseTransaction.js +0 -126
- package/dist/src/Database/DatabaseTransaction.js.map +0 -1
- package/dist/src/Database/index.d.ts +0 -10
- package/dist/src/Database/index.js +0 -15
- package/dist/src/Database/index.js.map +0 -1
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.d.ts +0 -35
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.js +0 -59
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.js.map +0 -1
- package/dist/src/Database/integrations/kysely/KyselyDatabase.d.ts +0 -66
- package/dist/src/Database/integrations/kysely/KyselyDatabase.js +0 -86
- package/dist/src/Database/integrations/kysely/KyselyDatabase.js.map +0 -1
- package/dist/src/Database/integrations/kysely/KyselyTransaction.d.ts +0 -70
- package/dist/src/Database/integrations/kysely/KyselyTransaction.js +0 -118
- package/dist/src/Database/integrations/kysely/KyselyTransaction.js.map +0 -1
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.d.ts +0 -36
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.js +0 -54
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.js.map +0 -1
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.d.ts +0 -63
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.js +0 -61
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.js.map +0 -1
- package/dist/src/Database/types.d.ts +0 -76
- package/dist/src/Database/types.js +0 -2
- package/dist/src/Database/types.js.map +0 -1
- package/dist/src/Globals.d.ts +0 -93
- package/dist/src/Globals.js +0 -99
- package/dist/src/Globals.js.map +0 -1
- package/dist/src/Logger/Logger.d.ts +0 -161
- package/dist/src/Logger/Logger.js +0 -299
- package/dist/src/Logger/Logger.js.map +0 -1
- package/dist/src/Mailer/Mailer.d.ts +0 -79
- package/dist/src/Mailer/Mailer.js +0 -184
- package/dist/src/Mailer/Mailer.js.map +0 -1
- package/dist/src/Publisher/Publisher.d.ts +0 -39
- package/dist/src/Publisher/Publisher.js +0 -77
- package/dist/src/Publisher/Publisher.js.map +0 -1
- package/dist/src/Server/RouteResolver.d.ts +0 -33
- package/dist/src/Server/RouteResolver.js +0 -100
- package/dist/src/Server/RouteResolver.js.map +0 -1
- package/dist/src/Server/Router.d.ts +0 -157
- package/dist/src/Server/Router.js +0 -32
- package/dist/src/Server/Router.js.map +0 -1
- package/dist/src/Server/lib/ContainerServer.d.ts +0 -42
- package/dist/src/Server/lib/ContainerServer.js +0 -66
- package/dist/src/Server/lib/ContainerServer.js.map +0 -1
- package/dist/src/Server/lib/Server.d.ts +0 -45
- package/dist/src/Server/lib/Server.js +0 -93
- package/dist/src/Server/lib/Server.js.map +0 -1
- package/dist/src/Server/lib/container/GenericHandler.d.ts +0 -9
- package/dist/src/Server/lib/container/GenericHandler.js +0 -82
- package/dist/src/Server/lib/container/GenericHandler.js.map +0 -1
- package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +0 -52
- package/dist/src/Server/lib/container/GenericHandlerEvent.js +0 -132
- package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +0 -1
- package/dist/src/Server/lib/container/HealthHandler.d.ts +0 -9
- package/dist/src/Server/lib/container/HealthHandler.js +0 -19
- package/dist/src/Server/lib/container/HealthHandler.js.map +0 -1
- package/dist/src/Server/lib/container/Proxy.d.ts +0 -67
- package/dist/src/Server/lib/container/Proxy.js +0 -143
- package/dist/src/Server/lib/container/Proxy.js.map +0 -1
- package/dist/src/Server/lib/container/Utils.d.ts +0 -14
- package/dist/src/Server/lib/container/Utils.js +0 -37
- package/dist/src/Server/lib/container/Utils.js.map +0 -1
- package/dist/src/Util/AsyncSingleton.d.ts +0 -31
- package/dist/src/Util/AsyncSingleton.js +0 -83
- package/dist/src/Util/AsyncSingleton.js.map +0 -1
- package/dist/src/Util/Utils.d.ts +0 -61
- package/dist/src/Util/Utils.js +0 -147
- package/dist/src/Util/Utils.js.map +0 -1
- package/dist/src/Validation/Validator.d.ts +0 -17
- package/dist/src/Validation/Validator.js +0 -39
- package/dist/src/Validation/Validator.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikonintegration/ikapi",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@aws-sdk/client-dynamodb": "^3.650.0",
|
|
23
|
+
"@aws-sdk/client-eventbridge": "^3.916.0",
|
|
23
24
|
"@aws-sdk/client-kms": "^3.650.0",
|
|
24
25
|
"@aws-sdk/client-secrets-manager": "^3.650.0",
|
|
25
26
|
"@aws-sdk/client-ses": "^3.650.0",
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"cors": "^2.8.5",
|
|
36
37
|
"cuid": "^3.0.0",
|
|
37
38
|
"dotenv": "^16.4.1",
|
|
38
|
-
"email-templates": "^12.0.
|
|
39
|
+
"email-templates": "^12.0.3",
|
|
39
40
|
"express": "^4.21.1",
|
|
40
41
|
"json-stringify-safe": "^5.0.1",
|
|
41
42
|
"kysely": "^0.27.2",
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EventBridgeClient,
|
|
3
|
+
PutEventsCommand,
|
|
4
|
+
PutEventsCommandInput,
|
|
5
|
+
PutEventsCommandOutput,
|
|
6
|
+
} from '@aws-sdk/client-eventbridge'
|
|
1
7
|
import {
|
|
2
8
|
SNSClient,
|
|
3
9
|
PublishCommand,
|
|
@@ -5,7 +11,7 @@ import {
|
|
|
5
11
|
PublishCommandInput,
|
|
6
12
|
} from '@aws-sdk/client-sns'
|
|
7
13
|
import sha1 from 'sha1'
|
|
8
|
-
//reusable client
|
|
14
|
+
//reusable client - sns
|
|
9
15
|
/**
|
|
10
16
|
* A variable that holds the connection to the SNS client for publishing messages.
|
|
11
17
|
* @type {SNSClient | null}
|
|
@@ -19,6 +25,20 @@ let PUBLISHER_CONN: SNSClient | null = null
|
|
|
19
25
|
// eslint-disable-next-line no-var
|
|
20
26
|
let PUBLISHER_CONN_HASH: string | null = null
|
|
21
27
|
|
|
28
|
+
//reusable client - event bridge
|
|
29
|
+
/**
|
|
30
|
+
* A variable that holds the connection to the EventBridge client for publishing events.
|
|
31
|
+
* @type {EventBridgeClient | null}
|
|
32
|
+
*/
|
|
33
|
+
// eslint-disable-next-line no-var
|
|
34
|
+
let EVENT_BRIDGE_CONN: EventBridgeClient | null = null
|
|
35
|
+
/**
|
|
36
|
+
* The connection hash for the event bridge publisher. It is initially set to null.
|
|
37
|
+
* @type {string | null}
|
|
38
|
+
*/
|
|
39
|
+
// eslint-disable-next-line no-var
|
|
40
|
+
let EVENT_BRIDGE_CONN_HASH: string | null = null
|
|
41
|
+
|
|
22
42
|
/**
|
|
23
43
|
* Represents the configuration options for a publisher.
|
|
24
44
|
* @typedef {Object} PublisherConfig
|
|
@@ -93,4 +113,57 @@ export default class Publisher {
|
|
|
93
113
|
PUBLISHER_CONN_HASH = sha1(this.region).toString()
|
|
94
114
|
}
|
|
95
115
|
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Publishes a message on EventBridge.
|
|
119
|
+
* @param {any} messageObject - The message object to be published.
|
|
120
|
+
* @param {string} eventBusName - The name of the event bus to publish to.
|
|
121
|
+
* @param {string} source - The source of the event.
|
|
122
|
+
* @param {string} detailType - The detail-type of the event.
|
|
123
|
+
* @returns {Promise<PutEventsCommandOutput>} - A promise that resolves to the response from the publish command.
|
|
124
|
+
*/
|
|
125
|
+
public async publishOnEventBridge(
|
|
126
|
+
messageObject: any,
|
|
127
|
+
eventBusName: string,
|
|
128
|
+
source: string,
|
|
129
|
+
detailType: string
|
|
130
|
+
): Promise<PutEventsCommandOutput | undefined> {
|
|
131
|
+
let resp: undefined | PutEventsCommandOutput = undefined
|
|
132
|
+
try {
|
|
133
|
+
this.connectEventBridge()
|
|
134
|
+
const params: PutEventsCommandInput = {
|
|
135
|
+
Entries: [
|
|
136
|
+
{
|
|
137
|
+
Source: source,
|
|
138
|
+
EventBusName: eventBusName,
|
|
139
|
+
DetailType: detailType,
|
|
140
|
+
Detail: JSON.stringify(messageObject),
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
}
|
|
144
|
+
resp = await EVENT_BRIDGE_CONN!.send(new PutEventsCommand(params))
|
|
145
|
+
} catch (e) {
|
|
146
|
+
console.error(
|
|
147
|
+
`Error while publishing into event bus ${eventBusName} - ${source} - ${detailType} with error: ${e}`
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
console.debug('Publisher event resp', resp)
|
|
151
|
+
return resp
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Establishes a connection to the EventBridge client if it does not already exist or if the region has changed.
|
|
156
|
+
* @returns None
|
|
157
|
+
*/
|
|
158
|
+
private connectEventBridge(): void {
|
|
159
|
+
if (
|
|
160
|
+
(!EVENT_BRIDGE_CONN && !EVENT_BRIDGE_CONN_HASH) ||
|
|
161
|
+
EVENT_BRIDGE_CONN_HASH != sha1(this.region)
|
|
162
|
+
) {
|
|
163
|
+
EVENT_BRIDGE_CONN = new EventBridgeClient({
|
|
164
|
+
region: this.region,
|
|
165
|
+
})
|
|
166
|
+
EVENT_BRIDGE_CONN_HASH = sha1(this.region).toString()
|
|
167
|
+
}
|
|
168
|
+
}
|
|
96
169
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { HttpMethod } from './src/API/Request.js';
|
|
2
|
-
import Response, { ResponseErrorType } from './src/API/Response.js';
|
|
3
|
-
import DynamoTransaction from './src/BaseEvent/DynamoTransaction.js';
|
|
4
|
-
import EventProcessor from './src/BaseEvent/EventProcessor.js';
|
|
5
|
-
import Launchable from './src/BaseEvent/Launchable/index.js';
|
|
6
|
-
import Process from './src/BaseEvent/Process.js';
|
|
7
|
-
import StepTransaction from './src/BaseEvent/StepTransaction.js';
|
|
8
|
-
import Transaction, { TransactionConfig } from './src/BaseEvent/Transaction.js';
|
|
9
|
-
import Redis from './src/Cache/Redis.js';
|
|
10
|
-
import Configuration from './src/Config/Configuration.js';
|
|
11
|
-
import Crypto from './src/Crypto/Crypto.js';
|
|
12
|
-
import * as Database from './src/Database/index.js';
|
|
13
|
-
import Mailer from './src/Mailer/Mailer.js';
|
|
14
|
-
import Router, { Route } from './src/Server/Router.js';
|
|
15
|
-
import AsyncSingleton from './src/Util/AsyncSingleton.js';
|
|
16
|
-
import Utils from './src/Util/Utils.js';
|
|
17
|
-
export { Transaction, Process, EventProcessor, DynamoTransaction, StepTransaction, Launchable, Router, Route, HttpMethod, Mailer, Crypto, Configuration, Redis, Database, Response, ResponseErrorType, Utils, AsyncSingleton, TransactionConfig, };
|
package/dist/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { HttpMethod } from './src/API/Request.js';
|
|
2
|
-
import Response from './src/API/Response.js';
|
|
3
|
-
import DynamoTransaction from './src/BaseEvent/DynamoTransaction.js';
|
|
4
|
-
import EventProcessor from './src/BaseEvent/EventProcessor.js';
|
|
5
|
-
import Launchable from './src/BaseEvent/Launchable/index.js';
|
|
6
|
-
import Process from './src/BaseEvent/Process.js';
|
|
7
|
-
import StepTransaction from './src/BaseEvent/StepTransaction.js';
|
|
8
|
-
import Transaction from './src/BaseEvent/Transaction.js';
|
|
9
|
-
import Redis from './src/Cache/Redis.js';
|
|
10
|
-
import Configuration from './src/Config/Configuration.js';
|
|
11
|
-
import Crypto from './src/Crypto/Crypto.js';
|
|
12
|
-
import * as Database from './src/Database/index.js';
|
|
13
|
-
import Mailer from './src/Mailer/Mailer.js';
|
|
14
|
-
import Router from './src/Server/Router.js';
|
|
15
|
-
import AsyncSingleton from './src/Util/AsyncSingleton.js';
|
|
16
|
-
import Utils from './src/Util/Utils.js';
|
|
17
|
-
export {
|
|
18
|
-
// Base Events
|
|
19
|
-
Transaction, Process, EventProcessor, DynamoTransaction, StepTransaction, Launchable,
|
|
20
|
-
// Http
|
|
21
|
-
Router, HttpMethod,
|
|
22
|
-
// Modules
|
|
23
|
-
Mailer, Crypto, Configuration, Redis, Database,
|
|
24
|
-
// API
|
|
25
|
-
Response,
|
|
26
|
-
// Helpers
|
|
27
|
-
Utils, AsyncSingleton, };
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,QAA+B,MAAM,uBAAuB,CAAA;AACnE,OAAO,iBAAiB,MAAM,sCAAsC,CAAA;AACpE,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,UAAU,MAAM,qCAAqC,CAAA;AAC5D,OAAO,OAAO,MAAM,4BAA4B,CAAA;AAChD,OAAO,eAAe,MAAM,oCAAoC,CAAA;AAChE,OAAO,WAAkC,MAAM,gCAAgC,CAAA;AAC/E,OAAO,KAAK,MAAM,sBAAsB,CAAA;AACxC,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,MAAM,MAAM,wBAAwB,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AACnD,OAAO,MAAM,MAAM,wBAAwB,CAAA;AAC3C,OAAO,MAAiB,MAAM,wBAAwB,CAAA;AACtD,OAAO,cAAc,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,MAAM,qBAAqB,CAAA;AAEvC,OAAO;AACL,cAAc;AACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,UAAU;AACV,OAAO;AACP,MAAM,EAEN,UAAU;AACV,UAAU;AACV,MAAM,EACN,MAAM,EACN,aAAa,EACb,KAAK,EACL,QAAQ;AACR,MAAM;AACN,QAAQ;AAER,UAAU;AACV,KAAK,EACL,cAAc,GAEf,CAAA"}
|