@creator.co/wapi 1.7.11 → 1.7.12

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/dist/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@creator.co/wapi",
3
- "version": "1.7.11",
3
+ "version": "1.7.12",
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": "tsc --build",
10
- "clean": "tsc --build --clean",
11
- "lint-fix": "eslint . --fix",
12
- "lint": "eslint .",
13
- "docs": "npx typedoc --tsconfig tsconfig.json index.ts src/**/* --includeVersion --entryPointStrategy expand",
14
- "test": "npm run test-ts && npm run test-js",
15
- "test-ts": "jest --coverage --silent --runInBand --logHeapUsage && cat coverage/coverage.txt",
16
- "test-js": "rm -rf ./smoke-tests; tsc -p tsconfig.smoke.json && cd smoke-tests && npm i && NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --config=./jest.smoke.config.js --coverage --silent --runInBand --logHeapUsage && cat coverage/coverage.txt",
17
- "test-dev": "jest --coverage --runInBand && cat coverage/coverage.txt"
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",
@@ -53,6 +53,7 @@
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
58
  "@types/aws-lambda": "^8.10.145",
58
59
  "@types/chai": "^4.3.19",
@@ -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,MAA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"}
@@ -16,6 +16,7 @@ export type CacheClass = {
16
16
  export type CacheBaseConfig = {
17
17
  hostname: string;
18
18
  username: string;
19
+ port?: string | number;
19
20
  password?: string;
20
21
  enableTLS: boolean;
21
22
  clusterMode?: boolean;
@@ -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
- * @typeparam DBSchema - The schema of the database.
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>;
@@ -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
- * event processing, DynamoDB transactions, routing, mailing, cryptography, JWT handling,
20
- * configuration management, Redis operations, response handling, utility functions,
21
- * asynchronous singleton pattern, route definitions, transaction configurations,
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,20 +1,20 @@
1
1
  {
2
2
  "name": "@creator.co/wapi",
3
- "version": "1.7.11",
3
+ "version": "1.7.12",
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": "tsc --build",
10
- "clean": "tsc --build --clean",
11
- "lint-fix": "eslint . --fix",
12
- "lint": "eslint .",
13
- "docs": "npx typedoc --tsconfig tsconfig.json index.ts src/**/* --includeVersion --entryPointStrategy expand",
14
- "test": "npm run test-ts && npm run test-js",
15
- "test-ts": "jest --coverage --silent --runInBand --logHeapUsage && cat coverage/coverage.txt",
16
- "test-js": "rm -rf ./smoke-tests; tsc -p tsconfig.smoke.json && cd smoke-tests && npm i && NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --config=./jest.smoke.config.js --coverage --silent --runInBand --logHeapUsage && cat coverage/coverage.txt",
17
- "test-dev": "jest --coverage --runInBand && cat coverage/coverage.txt"
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",
@@ -53,6 +53,7 @@
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
58
  "@types/aws-lambda": "^8.10.145",
58
59
  "@types/chai": "^4.3.19",
@@ -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}:6379`,
81
+ url: `redis://${config.username}:${config.username}@${config.hostname}:${Number(config.port ?? 6379)}`,
81
82
  disableOfflineQueue: true,
82
83
  },
83
84
  ],
@@ -19,6 +19,7 @@ export type CacheClass = {
19
19
  export type CacheBaseConfig = {
20
20
  hostname: string
21
21
  username: string
22
+ port?: string | number
22
23
  password?: string
23
24
  enableTLS: boolean
24
25
  clusterMode?: boolean
@@ -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
- * @typeparam DBSchema - The schema of the database.
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/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 --workerIdleMemoryLimit=1024 --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 --workerIdleMemoryLimit=1024 --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,