@creator.co/wapi 1.7.10-alpha.2 → 1.7.11-alpha.1
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/.eslintignore +3 -1
- package/README.md +2 -0
- package/dist/index.d.ts +25 -23
- package/dist/index.js +25 -23
- package/dist/index.js.map +1 -1
- package/dist/package-lock.json +1517 -1826
- package/dist/package.json +33 -32
- package/dist/src/BaseEvent/DynamoTransaction.js +7 -7
- package/dist/src/BaseEvent/Process.d.ts +0 -1
- package/dist/src/Cache/Redis.js +4 -1
- package/dist/src/Cache/Redis.js.map +1 -1
- package/dist/src/Cache/types.d.ts +1 -0
- package/dist/src/Database/integrations/kysely/KyselyTransaction.d.ts +1 -1
- package/dist/src/Server/Router.d.ts +0 -1
- package/dist/src/Server/lib/Server.js +3 -3
- package/dist/src/Server/lib/Server.js.map +1 -1
- package/dist/src/Server/lib/container/GenericHandler.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.ts +25 -23
- package/package.json +33 -32
- package/src/Cache/Redis.ts +2 -1
- package/src/Cache/types.ts +1 -0
- package/src/Database/integrations/kysely/KyselyTransaction.ts +1 -1
- package/src/Server/lib/Server.ts +3 -3
- package/taskfile.yml +65 -0
- package/tests/Cache/Redis-client.test.ts +1 -0
package/dist/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creator.co/wapi",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.11-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "
|
|
10
|
-
"clean": "
|
|
11
|
-
"lint-fix": "
|
|
12
|
-
"lint": "
|
|
13
|
-
"docs": "
|
|
14
|
-
"test": "
|
|
15
|
-
"test-ts": "
|
|
16
|
-
"test-js": "
|
|
17
|
-
"test-dev": "
|
|
9
|
+
"build": "task build",
|
|
10
|
+
"clean": "task clean",
|
|
11
|
+
"lint-fix": "task lint-fix",
|
|
12
|
+
"lint": "task lint",
|
|
13
|
+
"docs": "task docs",
|
|
14
|
+
"test": "task test",
|
|
15
|
+
"test-ts": "task test-ts",
|
|
16
|
+
"test-js": "task test-js",
|
|
17
|
+
"test-dev": "task test-dev"
|
|
18
18
|
},
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
23
|
-
"@aws-sdk/client-kms": "^3.
|
|
24
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
25
|
-
"@aws-sdk/client-ses": "^3.
|
|
26
|
-
"@aws-sdk/client-sns": "^3.
|
|
27
|
-
"@aws-sdk/client-ssm": "^3.
|
|
28
|
-
"@aws-sdk/credential-provider-node": "^3.
|
|
29
|
-
"@aws-sdk/util-dynamodb": "^3.
|
|
30
|
-
"@smithy/node-http-handler": "^3.
|
|
22
|
+
"@aws-sdk/client-dynamodb": "^3.651.1",
|
|
23
|
+
"@aws-sdk/client-kms": "^3.651.1",
|
|
24
|
+
"@aws-sdk/client-secrets-manager": "^3.651.1",
|
|
25
|
+
"@aws-sdk/client-ses": "^3.651.1",
|
|
26
|
+
"@aws-sdk/client-sns": "^3.651.1",
|
|
27
|
+
"@aws-sdk/client-ssm": "^3.651.1",
|
|
28
|
+
"@aws-sdk/credential-provider-node": "^3.651.1",
|
|
29
|
+
"@aws-sdk/util-dynamodb": "^3.651.1",
|
|
30
|
+
"@smithy/node-http-handler": "^3.2.2",
|
|
31
31
|
"@types/email-templates": "^10.0.1",
|
|
32
32
|
"@types/nodemailer": "^6.4.10",
|
|
33
33
|
"@types/object-hash": "^3.0.4",
|
|
@@ -36,33 +36,34 @@
|
|
|
36
36
|
"cuid": "^3.0.0",
|
|
37
37
|
"dotenv": "^16.4.1",
|
|
38
38
|
"email-templates": "^11.1.1",
|
|
39
|
-
"express": "^4.
|
|
39
|
+
"express": "^4.21.0",
|
|
40
40
|
"json-stringify-safe": "^5.0.1",
|
|
41
41
|
"jsonwebtoken": "^9.0.2",
|
|
42
42
|
"knex": "^3.0.1",
|
|
43
43
|
"knex-stringcase": "^1.4.6",
|
|
44
|
-
"kysely": "^0.27.
|
|
44
|
+
"kysely": "^0.27.4",
|
|
45
45
|
"node-cache": "^5.1.2",
|
|
46
46
|
"object-hash": "^3.0.0",
|
|
47
47
|
"parse-duration": "^1.1.0",
|
|
48
|
-
"path-to-regexp": "^
|
|
48
|
+
"path-to-regexp": "^8.1.0",
|
|
49
49
|
"pg": "^8.11.3",
|
|
50
|
-
"redis": "^4.
|
|
50
|
+
"redis": "^4.7.0",
|
|
51
51
|
"sha1": "^1.1.1",
|
|
52
52
|
"stack-trace": "0.0.10",
|
|
53
53
|
"zod": "^3.23.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@go-task/cli": "^3.39.0",
|
|
56
57
|
"@jest/globals": "^29.7.0",
|
|
57
|
-
"@types/aws-lambda": "^8.10.
|
|
58
|
-
"@types/chai": "^4.3.
|
|
58
|
+
"@types/aws-lambda": "^8.10.145",
|
|
59
|
+
"@types/chai": "^4.3.19",
|
|
59
60
|
"@types/cors": "^2.8.15",
|
|
60
61
|
"@types/express": "^4.17.19",
|
|
61
|
-
"@types/jest": "^29.5.
|
|
62
|
+
"@types/jest": "^29.5.13",
|
|
62
63
|
"@types/jsonwebtoken": "^9.0.3",
|
|
63
64
|
"@types/node": "^20.12.7",
|
|
64
65
|
"@types/path-to-regexp": "^1.7.0",
|
|
65
|
-
"@types/pg": "^8.11.
|
|
66
|
+
"@types/pg": "^8.11.10",
|
|
66
67
|
"@types/supertest": "^6.0.2",
|
|
67
68
|
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
68
69
|
"@typescript-eslint/parser": "^7.7.1",
|
|
@@ -71,15 +72,15 @@
|
|
|
71
72
|
"chai": "^4.4.1",
|
|
72
73
|
"eslint": "^8.48.0",
|
|
73
74
|
"eslint-config-prettier": "^9.0.0",
|
|
74
|
-
"eslint-plugin-import": "^2.
|
|
75
|
-
"eslint-plugin-prettier": "^5.
|
|
75
|
+
"eslint-plugin-import": "^2.30.0",
|
|
76
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
76
77
|
"eslint-plugin-require-extensions": "^0.1.3",
|
|
77
78
|
"jest": "^29.7.0",
|
|
78
79
|
"jest-junit": "^16.0.0",
|
|
79
|
-
"prettier": "^3.
|
|
80
|
+
"prettier": "^3.3.3",
|
|
80
81
|
"supertest": "^6.3.3",
|
|
81
|
-
"ts-jest": "^29.
|
|
82
|
+
"ts-jest": "^29.2.5",
|
|
82
83
|
"ts-node": "^10.9.1",
|
|
83
|
-
"typescript": "^5.
|
|
84
|
+
"typescript": "^5.5.0"
|
|
84
85
|
}
|
|
85
86
|
}
|
|
@@ -64,17 +64,17 @@ export default class DynamoTransaction {
|
|
|
64
64
|
yield Utils.cleanTemporaryFolder();
|
|
65
65
|
// init transaction for all records
|
|
66
66
|
return yield new Transaction(this.event, this.context, Object.assign(Object.assign({}, this.config), { syncReturn: true })).execute((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
var _b, _c, _d, _e, _f
|
|
67
|
+
var _a, _b, _c, _d, _e, _f;
|
|
68
68
|
// for each available event
|
|
69
69
|
const failureIDs = [];
|
|
70
70
|
for (const eventRecordIdx in this.event.Records) {
|
|
71
71
|
const eventRecord = this.event.Records[eventRecordIdx];
|
|
72
|
-
const record = Object.assign(Object.assign({}, eventRecord), { marshalled: Object.assign(Object.assign(Object.assign({}, (((
|
|
73
|
-
? { Keys: Utils.ddbUnmarshall((
|
|
74
|
-
: {})), (((
|
|
75
|
-
? { OldImage: Utils.ddbUnmarshall((
|
|
76
|
-
: {})), (((
|
|
77
|
-
? { NewImage: Utils.ddbUnmarshall((
|
|
72
|
+
const record = Object.assign(Object.assign({}, eventRecord), { marshalled: Object.assign(Object.assign(Object.assign({}, (((_a = eventRecord.dynamodb) === null || _a === void 0 ? void 0 : _a.Keys)
|
|
73
|
+
? { Keys: Utils.ddbUnmarshall((_b = eventRecord.dynamodb) === null || _b === void 0 ? void 0 : _b.Keys) }
|
|
74
|
+
: {})), (((_c = eventRecord.dynamodb) === null || _c === void 0 ? void 0 : _c.OldImage)
|
|
75
|
+
? { OldImage: Utils.ddbUnmarshall((_d = eventRecord.dynamodb) === null || _d === void 0 ? void 0 : _d.OldImage) }
|
|
76
|
+
: {})), (((_e = eventRecord.dynamodb) === null || _e === void 0 ? void 0 : _e.NewImage)
|
|
77
|
+
? { NewImage: Utils.ddbUnmarshall((_f = eventRecord.dynamodb) === null || _f === void 0 ? void 0 : _f.NewImage) }
|
|
78
78
|
: {})) });
|
|
79
79
|
// Call execution with marshalled item
|
|
80
80
|
const resp = yield execution(transaction, record);
|
package/dist/src/Cache/Redis.js
CHANGED
|
@@ -34,8 +34,10 @@ class Redis {
|
|
|
34
34
|
*/
|
|
35
35
|
static redisClientConnection(config) {
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
var _b;
|
|
37
38
|
console.debug('Starting remote client cache connection');
|
|
38
39
|
const connection = _a.ClientFactory(Object.assign(Object.assign({ username: config.username }, (config.password ? { password: config.password } : {})), { disableOfflineQueue: true, socket: {
|
|
40
|
+
port: Number((_b = config.port) !== null && _b !== void 0 ? _b : 6379),
|
|
39
41
|
host: config.hostname,
|
|
40
42
|
tls: config.enableTLS,
|
|
41
43
|
connectTimeout: 10000,
|
|
@@ -46,6 +48,7 @@ class Redis {
|
|
|
46
48
|
}
|
|
47
49
|
static redisClusterConnection(config) {
|
|
48
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
var _b;
|
|
49
52
|
console.debug('Starting remote cluster cache connection');
|
|
50
53
|
const connection = _a.ClusterFactory({
|
|
51
54
|
defaults: Object.assign(Object.assign({ username: config.username }, (config.password ? { password: config.password } : {})), { socket: {
|
|
@@ -54,7 +57,7 @@ class Redis {
|
|
|
54
57
|
} }),
|
|
55
58
|
rootNodes: [
|
|
56
59
|
{
|
|
57
|
-
url: `redis://${config.username}:${config.username}@${config.hostname}:6379`,
|
|
60
|
+
url: `redis://${config.username}:${config.username}@${config.hostname}:${Number((_b = config.port) !== null && _b !== void 0 ? _b : 6379)}`,
|
|
58
61
|
disableOfflineQueue: true,
|
|
59
62
|
},
|
|
60
63
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Redis.js","sourceRoot":"","sources":["../../../src/Cache/Redis.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAqC,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGtF,OAAO,cAAc,MAAM,2BAA2B,CAAA;AACtD;;GAEG;AACH,MAAqB,KAAK;IAkBjB,MAAM,CAAC,UAAU,CACtB,MAA4B;QAE5B,OAAO,EAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;IAEO,MAAM,CAAO,iBAAiB,CACpC,MAA4B;;YAE5B,IAAI,MAAM,CAAC,WAAW;gBAAE,OAAO,EAAK,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAA;;gBAC9D,OAAO,EAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAA;QACjD,CAAC;KAAA;IAED;;;;;;OAMG;IACK,MAAM,CAAO,qBAAqB,CACxC,MAA4B
|
|
1
|
+
{"version":3,"file":"Redis.js","sourceRoot":"","sources":["../../../src/Cache/Redis.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAqC,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGtF,OAAO,cAAc,MAAM,2BAA2B,CAAA;AACtD;;GAEG;AACH,MAAqB,KAAK;IAkBjB,MAAM,CAAC,UAAU,CACtB,MAA4B;QAE5B,OAAO,EAAK,CAAC,SAAS,C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wBACN,GAAG,EAAE,MAAM,CAAC,SAAS;wBACrB,cAAc,EAAE,KAAK;qBACtB,GACF;gBACD,SAAS,EAAE;oBACT;wBACE,GAAG,EAAE,WAAW,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,MAAA,MAAM,CAAC,IAAI,mCAAI,IAAI,CAAC,EAAE;wBACtG,mBAAmB,EAAE,IAAI;qBAC1B;iBACF;aACF,CAAC,CAAA;YACF,MAAM,UAAU,CAAC,OAAO,EAAE,CAAA;YAE1B,OAAO,UAAiB,CAAA;QAC1B,CAAC;KAAA;;;AAhFc,eAAS,GAAG,IAAI,cAAc,CAG3C,EAAK,CAAC,iBAAiB,EAAE,CAAM,CAAC,EAAC,EAAE,kDAAC,OAAA,CAAC,CAAC,MAAM,CAAA,GAAA,CAAC,AAHvB,CAGuB;AAE/C;;;GAGG;AACY,mBAAa,GAAG,YAAY,AAAf,CAAe;AAE3C;;;GAGG;AACY,oBAAc,GAAG,aAAa,AAAhB,CAAgB;eAhB1B,KAAK"}
|
|
@@ -4,7 +4,7 @@ import { Database } from '../../Database.js';
|
|
|
4
4
|
import { DatabaseTransaction } from '../../DatabaseTransaction.js';
|
|
5
5
|
/**
|
|
6
6
|
* Represents a transaction for querying a database with a specific schema.
|
|
7
|
-
* @
|
|
7
|
+
* @param DBSchema - The schema of the database.
|
|
8
8
|
* @type {KyselyTransactionImpl<DBSchema> & Transaction<DBSchema>}
|
|
9
9
|
*/
|
|
10
10
|
export type KyselyTransaction<DBSchema> = KyselyTransactionImpl<DBSchema> & Transaction<DBSchema>;
|
|
@@ -84,10 +84,10 @@ export default class Server {
|
|
|
84
84
|
*/
|
|
85
85
|
parsePathParams(req, routePath) {
|
|
86
86
|
const path = req.getPath();
|
|
87
|
-
const
|
|
88
|
-
const result =
|
|
87
|
+
const regex = pathToRegexp(routePath);
|
|
88
|
+
const result = regex.regexp.exec(path);
|
|
89
89
|
if (result)
|
|
90
|
-
req.setFixedPathParams(keys, result);
|
|
90
|
+
req.setFixedPathParams(regex.keys, result);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
//# sourceMappingURL=Server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.js","sourceRoot":"","sources":["../../../../src/Server/lib/Server.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,OAAO,QAA+B,MAAM,uBAAuB,CAAA;AACnE,OAAO,WAA0B,MAAM,gCAAgC,CAAA;AACvE,OAAO,SAAS,MAAM,+BAA+B,CAAA;AAErD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IAczB;;;;OAIG;IACH,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;IAChD,CAAC;IAED;;;OAGG;IACI,SAAS;QACd,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC9C,CAAC;IAED;;;;;OAKG;IACU,qBAAqB,CAAC,KAA2B,EAAE,OAAgB;;YAC9E,mBAAmB;YACnB,MAAM,IAAI,WAAW,CACnB,KAAK,EACL,OAAO,EACP,IAAI,CAAC,MAAM,CACZ,CAAC,OAAO,CAAC,CAAM,WAAW,EAAC,EAAE;gBAC5B,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAA;gBACnC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;gBACrF,IAAI,KAAK,EAAE,CAAC;oBACV,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,EAAE,KAAK,CAAC,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,CAAC,CAAA;YACvD,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC;KAAA;IAED;;;;;OAKG;IACK,eAAe,CAAC,GAA2B,EAAE,SAAiB;QACpE,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAA;QAC1B,MAAM,KAAK,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;QACrC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,MAAM;YAAE,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACxD,CAAC;CACF"}
|
|
@@ -5,5 +5,5 @@ import Server from '../Server.js';
|
|
|
5
5
|
* @param {Server['handleServerlessEvent']} serverlessHandler - The serverless handler function.
|
|
6
6
|
* @returns {Function} - An async function that handles the request and sends a response.
|
|
7
7
|
*/
|
|
8
|
-
declare const _default: (serverlessHandler: Server[
|
|
8
|
+
declare const _default: (serverlessHandler: Server["handleServerlessEvent"]) => (request: Request, res: Response) => Promise<void>;
|
|
9
9
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../index.ts","../src/globals.ts","../src/api/request.ts","../src/api/response.ts","../src/baseevent/dynamotransaction.ts","../src/baseevent/eventprocessor.ts","../src/baseevent/process.ts","../src/baseevent/transaction.ts","../src/cache/redis.ts","../src/cache/types.ts","../src/config/configuration.ts","../src/config/environmentvar.ts","../src/crypto/crypto.ts","../src/crypto/jwt.ts","../src/database/database.ts","../src/database/databasemanager.ts","../src/database/databasetransaction.ts","../src/database/index.ts","../src/database/types.ts","../src/database/integrations/dynamo/dynamodatabase.ts","../src/database/integrations/knex/knexdatabase.ts","../src/database/integrations/knex/knextransaction.ts","../src/database/integrations/kysely/kyselydatabase.ts","../src/database/integrations/kysely/kyselytransaction.ts","../src/database/integrations/pgsql/postgresdatabase.ts","../src/database/integrations/pgsql/postgrestransaction.ts","../src/logger/logger.ts","../src/mailer/mailer.ts","../src/publisher/publisher.ts","../src/server/routeresolver.ts","../src/server/router.ts","../src/server/lib/containerserver.ts","../src/server/lib/server.ts","../src/server/lib/container/generichandler.ts","../src/server/lib/container/generichandlerevent.ts","../src/server/lib/container/healthhandler.ts","../src/server/lib/container/proxy.ts","../src/server/lib/container/utils.ts","../src/util/asyncsingleton.ts","../src/util/utils.ts","../src/validation/validator.ts","../package-lock.json","../package.json"],"version":"5.6.2"}
|
package/index.ts
CHANGED
|
@@ -15,30 +15,32 @@ import AsyncSingleton from './src/Util/AsyncSingleton.js'
|
|
|
15
15
|
import Utils from './src/Util/Utils.js'
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* This module exports various classes and utilities for handling transactions, processes,
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* response error types, HTTP methods, and database operations.
|
|
23
|
-
* @exports {
|
|
24
|
-
* Transaction,
|
|
25
|
-
* Process,
|
|
26
|
-
* EventProcessor,
|
|
27
|
-
* DynamoTransaction,
|
|
28
|
-
* Router,
|
|
29
|
-
* Mailer,
|
|
30
|
-
* Crypto,
|
|
31
|
-
* JWT,
|
|
32
|
-
* Configuration,
|
|
33
|
-
* Redis,
|
|
34
|
-
* Response,
|
|
35
|
-
* Utils,
|
|
36
|
-
* AsyncSingleton,
|
|
37
|
-
* Route,
|
|
38
|
-
* TransactionConfig,
|
|
39
|
-
* ResponseErrorType,
|
|
40
|
-
* HttpMethod,
|
|
18
|
+
* This module exports various classes and utilities for handling transactions, processes, events,
|
|
19
|
+
* DynamoDB transactions, routing, mailing, cryptography, JWT, configuration, Redis, responses,
|
|
20
|
+
* utilities, asynchronous singletons, routes, transaction configurations, response error types,
|
|
21
|
+
* HTTP methods, and database operations.
|
|
41
22
|
*
|
|
23
|
+
* Classes:
|
|
24
|
+
* - Transaction
|
|
25
|
+
* - Process
|
|
26
|
+
* - EventProcessor
|
|
27
|
+
* - DynamoTransaction
|
|
28
|
+
* - Router
|
|
29
|
+
* - Mailer
|
|
30
|
+
* - Crypto
|
|
31
|
+
* - JWT
|
|
32
|
+
* - Configuration
|
|
33
|
+
* - Redis
|
|
34
|
+
* - Response
|
|
35
|
+
* - Utils
|
|
36
|
+
* - AsyncSingleton
|
|
37
|
+
* - Route
|
|
38
|
+
* - TransactionConfig
|
|
39
|
+
* - Database
|
|
40
|
+
*
|
|
41
|
+
* Enums:
|
|
42
|
+
* - ResponseErrorType
|
|
43
|
+
* -
|
|
42
44
|
*/
|
|
43
45
|
export {
|
|
44
46
|
// Base Events
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creator.co/wapi",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.11-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "
|
|
10
|
-
"clean": "
|
|
11
|
-
"lint-fix": "
|
|
12
|
-
"lint": "
|
|
13
|
-
"docs": "
|
|
14
|
-
"test": "
|
|
15
|
-
"test-ts": "
|
|
16
|
-
"test-js": "
|
|
17
|
-
"test-dev": "
|
|
9
|
+
"build": "task build",
|
|
10
|
+
"clean": "task clean",
|
|
11
|
+
"lint-fix": "task lint-fix",
|
|
12
|
+
"lint": "task lint",
|
|
13
|
+
"docs": "task docs",
|
|
14
|
+
"test": "task test",
|
|
15
|
+
"test-ts": "task test-ts",
|
|
16
|
+
"test-js": "task test-js",
|
|
17
|
+
"test-dev": "task test-dev"
|
|
18
18
|
},
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
23
|
-
"@aws-sdk/client-kms": "^3.
|
|
24
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
25
|
-
"@aws-sdk/client-ses": "^3.
|
|
26
|
-
"@aws-sdk/client-sns": "^3.
|
|
27
|
-
"@aws-sdk/client-ssm": "^3.
|
|
28
|
-
"@aws-sdk/credential-provider-node": "^3.
|
|
29
|
-
"@aws-sdk/util-dynamodb": "^3.
|
|
30
|
-
"@smithy/node-http-handler": "^3.
|
|
22
|
+
"@aws-sdk/client-dynamodb": "^3.651.1",
|
|
23
|
+
"@aws-sdk/client-kms": "^3.651.1",
|
|
24
|
+
"@aws-sdk/client-secrets-manager": "^3.651.1",
|
|
25
|
+
"@aws-sdk/client-ses": "^3.651.1",
|
|
26
|
+
"@aws-sdk/client-sns": "^3.651.1",
|
|
27
|
+
"@aws-sdk/client-ssm": "^3.651.1",
|
|
28
|
+
"@aws-sdk/credential-provider-node": "^3.651.1",
|
|
29
|
+
"@aws-sdk/util-dynamodb": "^3.651.1",
|
|
30
|
+
"@smithy/node-http-handler": "^3.2.2",
|
|
31
31
|
"@types/email-templates": "^10.0.1",
|
|
32
32
|
"@types/nodemailer": "^6.4.10",
|
|
33
33
|
"@types/object-hash": "^3.0.4",
|
|
@@ -36,33 +36,34 @@
|
|
|
36
36
|
"cuid": "^3.0.0",
|
|
37
37
|
"dotenv": "^16.4.1",
|
|
38
38
|
"email-templates": "^11.1.1",
|
|
39
|
-
"express": "^4.
|
|
39
|
+
"express": "^4.21.0",
|
|
40
40
|
"json-stringify-safe": "^5.0.1",
|
|
41
41
|
"jsonwebtoken": "^9.0.2",
|
|
42
42
|
"knex": "^3.0.1",
|
|
43
43
|
"knex-stringcase": "^1.4.6",
|
|
44
|
-
"kysely": "^0.27.
|
|
44
|
+
"kysely": "^0.27.4",
|
|
45
45
|
"node-cache": "^5.1.2",
|
|
46
46
|
"object-hash": "^3.0.0",
|
|
47
47
|
"parse-duration": "^1.1.0",
|
|
48
|
-
"path-to-regexp": "^
|
|
48
|
+
"path-to-regexp": "^8.1.0",
|
|
49
49
|
"pg": "^8.11.3",
|
|
50
|
-
"redis": "^4.
|
|
50
|
+
"redis": "^4.7.0",
|
|
51
51
|
"sha1": "^1.1.1",
|
|
52
52
|
"stack-trace": "0.0.10",
|
|
53
53
|
"zod": "^3.23.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@go-task/cli": "^3.39.0",
|
|
56
57
|
"@jest/globals": "^29.7.0",
|
|
57
|
-
"@types/aws-lambda": "^8.10.
|
|
58
|
-
"@types/chai": "^4.3.
|
|
58
|
+
"@types/aws-lambda": "^8.10.145",
|
|
59
|
+
"@types/chai": "^4.3.19",
|
|
59
60
|
"@types/cors": "^2.8.15",
|
|
60
61
|
"@types/express": "^4.17.19",
|
|
61
|
-
"@types/jest": "^29.5.
|
|
62
|
+
"@types/jest": "^29.5.13",
|
|
62
63
|
"@types/jsonwebtoken": "^9.0.3",
|
|
63
64
|
"@types/node": "^20.12.7",
|
|
64
65
|
"@types/path-to-regexp": "^1.7.0",
|
|
65
|
-
"@types/pg": "^8.11.
|
|
66
|
+
"@types/pg": "^8.11.10",
|
|
66
67
|
"@types/supertest": "^6.0.2",
|
|
67
68
|
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
68
69
|
"@typescript-eslint/parser": "^7.7.1",
|
|
@@ -71,15 +72,15 @@
|
|
|
71
72
|
"chai": "^4.4.1",
|
|
72
73
|
"eslint": "^8.48.0",
|
|
73
74
|
"eslint-config-prettier": "^9.0.0",
|
|
74
|
-
"eslint-plugin-import": "^2.
|
|
75
|
-
"eslint-plugin-prettier": "^5.
|
|
75
|
+
"eslint-plugin-import": "^2.30.0",
|
|
76
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
76
77
|
"eslint-plugin-require-extensions": "^0.1.3",
|
|
77
78
|
"jest": "^29.7.0",
|
|
78
79
|
"jest-junit": "^16.0.0",
|
|
79
|
-
"prettier": "^3.
|
|
80
|
+
"prettier": "^3.3.3",
|
|
80
81
|
"supertest": "^6.3.3",
|
|
81
|
-
"ts-jest": "^29.
|
|
82
|
+
"ts-jest": "^29.2.5",
|
|
82
83
|
"ts-node": "^10.9.1",
|
|
83
|
-
"typescript": "^5.
|
|
84
|
+
"typescript": "^5.5.0"
|
|
84
85
|
}
|
|
85
86
|
}
|
package/src/Cache/Redis.ts
CHANGED
|
@@ -52,6 +52,7 @@ export default class Redis {
|
|
|
52
52
|
...(config.password ? { password: config.password } : {}),
|
|
53
53
|
disableOfflineQueue: true,
|
|
54
54
|
socket: {
|
|
55
|
+
port: Number(config.port ?? 6379),
|
|
55
56
|
host: config.hostname,
|
|
56
57
|
tls: config.enableTLS,
|
|
57
58
|
connectTimeout: 10000,
|
|
@@ -77,7 +78,7 @@ export default class Redis {
|
|
|
77
78
|
},
|
|
78
79
|
rootNodes: [
|
|
79
80
|
{
|
|
80
|
-
url: `redis://${config.username}:${config.username}@${config.hostname}
|
|
81
|
+
url: `redis://${config.username}:${config.username}@${config.hostname}:${Number(config.port ?? 6379)}`,
|
|
81
82
|
disableOfflineQueue: true,
|
|
82
83
|
},
|
|
83
84
|
],
|
package/src/Cache/types.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { DatabaseTransaction } from '../../DatabaseTransaction.js'
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents a transaction for querying a database with a specific schema.
|
|
9
|
-
* @
|
|
9
|
+
* @param DBSchema - The schema of the database.
|
|
10
10
|
* @type {KyselyTransactionImpl<DBSchema> & Transaction<DBSchema>}
|
|
11
11
|
*/
|
|
12
12
|
export type KyselyTransaction<DBSchema> = KyselyTransactionImpl<DBSchema> & Transaction<DBSchema>
|
package/src/Server/lib/Server.ts
CHANGED
|
@@ -102,8 +102,8 @@ export default class Server {
|
|
|
102
102
|
*/
|
|
103
103
|
private parsePathParams(req: Request<any, any, any>, routePath: string) {
|
|
104
104
|
const path = req.getPath()
|
|
105
|
-
const
|
|
106
|
-
const result =
|
|
107
|
-
if (result) req.setFixedPathParams(keys, result)
|
|
105
|
+
const regex = pathToRegexp(routePath)
|
|
106
|
+
const result = regex.regexp.exec(path)
|
|
107
|
+
if (result) req.setFixedPathParams(regex.keys, result)
|
|
108
108
|
}
|
|
109
109
|
}
|
package/taskfile.yml
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
version: '3'
|
|
2
|
+
|
|
3
|
+
vars:
|
|
4
|
+
test_node_options: '--experimental-vm-modules'
|
|
5
|
+
coverage_file: 'coverage/coverage.txt'
|
|
6
|
+
|
|
7
|
+
tasks:
|
|
8
|
+
build:
|
|
9
|
+
desc: Build the project
|
|
10
|
+
cmds:
|
|
11
|
+
- tsc --build
|
|
12
|
+
|
|
13
|
+
clean:
|
|
14
|
+
desc: Clean the build artifacts
|
|
15
|
+
cmds:
|
|
16
|
+
- tsc --build --clean
|
|
17
|
+
|
|
18
|
+
lint:
|
|
19
|
+
desc: Run ESLint
|
|
20
|
+
cmds:
|
|
21
|
+
- eslint .
|
|
22
|
+
|
|
23
|
+
lint-fix:
|
|
24
|
+
desc: Run ESLint and fix issues
|
|
25
|
+
cmds:
|
|
26
|
+
- eslint . --fix
|
|
27
|
+
|
|
28
|
+
docs:
|
|
29
|
+
desc: Generate documentation
|
|
30
|
+
cmds:
|
|
31
|
+
- npx typedoc --tsconfig tsconfig.json index.ts src/**/* --includeVersion --entryPointStrategy expand
|
|
32
|
+
|
|
33
|
+
test:
|
|
34
|
+
desc: Run all tests
|
|
35
|
+
cmds:
|
|
36
|
+
- task test-ts
|
|
37
|
+
- task test-js
|
|
38
|
+
|
|
39
|
+
test-ts:
|
|
40
|
+
desc: Run TypeScript tests
|
|
41
|
+
cmds:
|
|
42
|
+
- jest --coverage --silent --runInBand --logHeapUsage
|
|
43
|
+
- cat {{.coverage_file}}
|
|
44
|
+
|
|
45
|
+
test-js:
|
|
46
|
+
desc: Run JavaScript smoke tests
|
|
47
|
+
cmds:
|
|
48
|
+
- rm -rf ./smoke-tests
|
|
49
|
+
- tsc -p tsconfig.smoke.json
|
|
50
|
+
- task test-js-inner
|
|
51
|
+
|
|
52
|
+
test-js-inner:
|
|
53
|
+
desc: Run smoke tests in the smoke-tests directory
|
|
54
|
+
dir: smoke-tests
|
|
55
|
+
cmds:
|
|
56
|
+
- cp -R ../node_modules node_modules
|
|
57
|
+
- npm i
|
|
58
|
+
- NODE_OPTIONS="$NODE_OPTIONS {{.test_node_options}}" jest --config=./jest.smoke.config.js --coverage --silent --runInBand --logHeapUsage
|
|
59
|
+
- cat ../{{.coverage_file}}
|
|
60
|
+
|
|
61
|
+
test-dev:
|
|
62
|
+
desc: Run tests in development mode
|
|
63
|
+
cmds:
|
|
64
|
+
- jest --coverage --runInBand
|
|
65
|
+
- cat {{.coverage_file}}
|
|
@@ -34,6 +34,7 @@ async function simpleRedisTest(config: any, concurrent?: boolean) {
|
|
|
34
34
|
...(config.password ? { password: config.password } : {}),
|
|
35
35
|
disableOfflineQueue: true,
|
|
36
36
|
socket: {
|
|
37
|
+
port: 6379,
|
|
37
38
|
host: config.hostname,
|
|
38
39
|
tls: config.enableTLS,
|
|
39
40
|
connectTimeout: 10000,
|