@creator.co/wapi 1.7.5-alpha1 → 1.7.5-alpha2
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/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/src/Database/index.d.ts +1 -2
- package/dist/src/Database/index.js +3 -2
- package/dist/src/Database/index.js.map +1 -1
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.d.ts +2 -3
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.js +1 -2
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.js.map +1 -1
- package/index.ts +2 -1
- package/package.json +1 -1
- package/src/Database/index.ts +2 -2
- package/src/Database/integrations/dynamo/DynamoDatabase.ts +6 -7
- package/src/Server/RouteResolver.ts +7 -2
- package/src/Server/Router.ts +1 -1
- package/src/Database/integrations/dynamo/DynamoTransaction.ts +0 -29
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { HttpMethod } from './src/API/Request.js';
|
|
|
2
2
|
import Response, { ResponseErrorType } from './src/API/Response.js';
|
|
3
3
|
import EventProcessor from './src/BaseEvent/EventProcessor.js';
|
|
4
4
|
import Process from './src/BaseEvent/Process.js';
|
|
5
|
-
import Transaction from './src/BaseEvent/Transaction.js';
|
|
5
|
+
import Transaction, { TransactionConfig } from './src/BaseEvent/Transaction.js';
|
|
6
6
|
import Redis from './src/Cache/Redis.js';
|
|
7
7
|
import Configuration from './src/Config/Configuration.js';
|
|
8
8
|
import Crypto from './src/Crypto/Crypto.js';
|
|
@@ -34,4 +34,4 @@ import Utils from './src/Util/Utils.js';
|
|
|
34
34
|
* Database,
|
|
35
35
|
* }
|
|
36
36
|
*/
|
|
37
|
-
export { Transaction, Process, EventProcessor, Router, Mailer, Crypto, JWT, Configuration, Redis, Response, Utils, AsyncSingleton, Route, ResponseErrorType, HttpMethod, Database, };
|
|
37
|
+
export { Transaction, Process, EventProcessor, Router, Mailer, Crypto, JWT, Configuration, Redis, Response, Utils, AsyncSingleton, Route, TransactionConfig, ResponseErrorType, HttpMethod, Database, };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,OAAO,MAAM,4BAA4B,CAAA;AAChD,OAAO,
|
|
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,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,OAAO,MAAM,4BAA4B,CAAA;AAChD,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,GAAG,MAAM,qBAAqB,CAAA;AACrC,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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO;AACL,cAAc;AACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,MAAM;AACN,iCAAiC;AACjC,MAAM,EACN,MAAM,EACN,GAAG,EACH,aAAa,EACb,KAAK;AACL,MAAM;AACN,QAAQ;AACR,UAAU;AACV,KAAK,EACL,cAAc,EAKd,UAAU,EACV,QAAQ,GACT,CAAA"}
|
|
@@ -2,7 +2,6 @@ import { Database } from './Database.js';
|
|
|
2
2
|
import { DatabaseManager } from './DatabaseManager.js';
|
|
3
3
|
import { DatabaseTransaction } from './DatabaseTransaction.js';
|
|
4
4
|
import { DynamoDatabase } from './integrations/dynamo/DynamoDatabase.js';
|
|
5
|
-
import { DynamoTransaction } from './integrations/dynamo/DynamoTransaction.js';
|
|
6
5
|
import { KnexDatabase } from './integrations/knex/KnexDatabase.js';
|
|
7
6
|
import { KnexTransaction } from './integrations/knex/KnexTransaction.js';
|
|
8
7
|
import { KyselyDatabase } from './integrations/kysely/KyselyDatabase.js';
|
|
@@ -10,4 +9,4 @@ import { KyselyTransaction } from './integrations/kysely/KyselyTransaction.js';
|
|
|
10
9
|
import { PostgresDatabase } from './integrations/pgsql/PostgresDatabase.js';
|
|
11
10
|
import { PostgresTransaction } from './integrations/pgsql/PostgresTransaction.js';
|
|
12
11
|
import { DbConfig } from './types.js';
|
|
13
|
-
export { DatabaseTransaction, Database, DatabaseManager, DbConfig, KnexTransaction, KnexDatabase, PostgresTransaction, PostgresDatabase, KyselyTransaction, KyselyDatabase,
|
|
12
|
+
export { DatabaseTransaction, Database, DatabaseManager, DbConfig, KnexTransaction, KnexDatabase, PostgresTransaction, PostgresDatabase, KyselyTransaction, KyselyDatabase, DynamoDatabase, };
|
|
@@ -2,7 +2,7 @@ import { Database } from './Database.js';
|
|
|
2
2
|
import { DatabaseManager } from './DatabaseManager.js';
|
|
3
3
|
import { DatabaseTransaction } from './DatabaseTransaction.js';
|
|
4
4
|
import { DynamoDatabase } from './integrations/dynamo/DynamoDatabase.js';
|
|
5
|
-
import { DynamoTransaction } from './integrations/dynamo/DynamoTransaction.js'
|
|
5
|
+
// import { DynamoTransaction } from './integrations/dynamo/DynamoTransaction.js'
|
|
6
6
|
import { KnexDatabase } from './integrations/knex/KnexDatabase.js';
|
|
7
7
|
import { KyselyDatabase } from './integrations/kysely/KyselyDatabase.js';
|
|
8
8
|
import { PostgresDatabase } from './integrations/pgsql/PostgresDatabase.js';
|
|
@@ -12,5 +12,6 @@ DatabaseTransaction, Database,
|
|
|
12
12
|
// 'Entrypoints'
|
|
13
13
|
DatabaseManager, KnexDatabase, PostgresDatabase, KyselyDatabase,
|
|
14
14
|
// Dynamo
|
|
15
|
-
DynamoTransaction,
|
|
15
|
+
// DynamoTransaction,
|
|
16
|
+
DynamoDatabase, };
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Database/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AACxE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Database/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AACxE,iFAAiF;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAA;AAI3E,OAAO;AACL,YAAY;AACZ,mBAAmB,EACnB,QAAQ;AACR,gBAAgB;AAChB,eAAe,EAIf,YAAY,EAGZ,gBAAgB,EAGhB,cAAc;AACd,SAAS;AACT,qBAAqB;AACrB,cAAc,GACf,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import { DynamoTransaction } from './DynamoTransaction.js';
|
|
3
2
|
import { Database } from '../../Database.js';
|
|
4
3
|
import type { DbConfig } from '../../types.js';
|
|
5
|
-
export declare class DynamoDatabase extends Database<
|
|
4
|
+
export declare class DynamoDatabase extends Database<any> {
|
|
6
5
|
private static dynamoProvider;
|
|
7
6
|
readonly client: DynamoDBClient;
|
|
8
7
|
constructor(config: DbConfig<'dynamo'>);
|
|
9
|
-
transaction(): Promise<
|
|
8
|
+
transaction(): Promise<any>;
|
|
10
9
|
private providerFactory;
|
|
11
10
|
}
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { Agent } from 'https';
|
|
11
11
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
12
12
|
import { NodeHttpHandler } from '@smithy/node-http-handler';
|
|
13
|
-
import { DynamoTransaction } from './DynamoTransaction.js';
|
|
14
13
|
import { Database } from '../../Database.js';
|
|
15
14
|
export class DynamoDatabase extends Database {
|
|
16
15
|
constructor(config) {
|
|
@@ -19,7 +18,7 @@ export class DynamoDatabase extends Database {
|
|
|
19
18
|
}
|
|
20
19
|
transaction() {
|
|
21
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
return
|
|
21
|
+
return Promise.resolve(null);
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
24
|
providerFactory(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamoDatabase.js","sourceRoot":"","sources":["../../../../../src/Database/integrations/dynamo/DynamoDatabase.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DynamoDatabase.js","sourceRoot":"","sources":["../../../../../src/Database/integrations/dynamo/DynamoDatabase.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG5C,MAAM,OAAO,cAAe,SAAQ,QAAa;IAI/C,YAAmB,MAA0B;QAC3C,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;IAC5C,CAAC;IAEqB,WAAW;;YAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC;KAAA;IAEO,eAAe,CAAC,MAA0B;QAChD,OAAO,IAAI,cAAc,CAAC,cAAc,CAAC;YACvC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,cAAc,EAAE,IAAI,eAAe,CAAC;gBAClC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;gBAC3C,aAAa,EAAE,MAAM,CAAC,iBAAiB;gBACvC,UAAU,EAAE,IAAI,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;aACtF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;;AAtBc,6BAAc,GAAG,cAAc,CAAA"}
|
package/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { HttpMethod } from './src/API/Request.js'
|
|
|
2
2
|
import Response, { ResponseErrorType } from './src/API/Response.js'
|
|
3
3
|
import EventProcessor from './src/BaseEvent/EventProcessor.js'
|
|
4
4
|
import Process from './src/BaseEvent/Process.js'
|
|
5
|
-
import Transaction from './src/BaseEvent/Transaction.js'
|
|
5
|
+
import Transaction, { TransactionConfig } from './src/BaseEvent/Transaction.js'
|
|
6
6
|
import Redis from './src/Cache/Redis.js'
|
|
7
7
|
import Configuration from './src/Config/Configuration.js'
|
|
8
8
|
import Crypto from './src/Crypto/Crypto.js'
|
|
@@ -53,6 +53,7 @@ export {
|
|
|
53
53
|
Utils,
|
|
54
54
|
AsyncSingleton,
|
|
55
55
|
Route,
|
|
56
|
+
TransactionConfig,
|
|
56
57
|
// Misc types
|
|
57
58
|
ResponseErrorType,
|
|
58
59
|
HttpMethod,
|
package/package.json
CHANGED
package/src/Database/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Database } from './Database.js'
|
|
|
2
2
|
import { DatabaseManager } from './DatabaseManager.js'
|
|
3
3
|
import { DatabaseTransaction } from './DatabaseTransaction.js'
|
|
4
4
|
import { DynamoDatabase } from './integrations/dynamo/DynamoDatabase.js'
|
|
5
|
-
import { DynamoTransaction } from './integrations/dynamo/DynamoTransaction.js'
|
|
5
|
+
// import { DynamoTransaction } from './integrations/dynamo/DynamoTransaction.js'
|
|
6
6
|
import { KnexDatabase } from './integrations/knex/KnexDatabase.js'
|
|
7
7
|
import { KnexTransaction } from './integrations/knex/KnexTransaction.js'
|
|
8
8
|
import { KyselyDatabase } from './integrations/kysely/KyselyDatabase.js'
|
|
@@ -28,6 +28,6 @@ export {
|
|
|
28
28
|
KyselyTransaction,
|
|
29
29
|
KyselyDatabase,
|
|
30
30
|
// Dynamo
|
|
31
|
-
DynamoTransaction,
|
|
31
|
+
// DynamoTransaction,
|
|
32
32
|
DynamoDatabase,
|
|
33
33
|
}
|
|
@@ -3,11 +3,10 @@ import { Agent } from 'https'
|
|
|
3
3
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb'
|
|
4
4
|
import { NodeHttpHandler } from '@smithy/node-http-handler'
|
|
5
5
|
|
|
6
|
-
import { DynamoTransaction } from './DynamoTransaction.js'
|
|
7
6
|
import { Database } from '../../Database.js'
|
|
8
7
|
import type { DbConfig } from '../../types.js'
|
|
9
8
|
|
|
10
|
-
export class DynamoDatabase extends Database<
|
|
9
|
+
export class DynamoDatabase extends Database<any> {
|
|
11
10
|
private static dynamoProvider = DynamoDBClient
|
|
12
11
|
public readonly client: DynamoDBClient
|
|
13
12
|
|
|
@@ -16,17 +15,17 @@ export class DynamoDatabase extends Database<DynamoTransaction> {
|
|
|
16
15
|
this.client = this.providerFactory(config)
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
public override async transaction(): Promise<
|
|
20
|
-
return
|
|
18
|
+
public override async transaction(): Promise<any> {
|
|
19
|
+
return Promise.resolve(null)
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
private providerFactory(config: DbConfig<'dynamo'>) {
|
|
24
23
|
return new DynamoDatabase.dynamoProvider({
|
|
25
24
|
region: config.region,
|
|
26
|
-
maxAttempts: config.maxAttempts,
|
|
25
|
+
maxAttempts: config.maxAttempts || 3,
|
|
27
26
|
requestHandler: new NodeHttpHandler({
|
|
28
|
-
connectionTimeout: config.connectionTimeout,
|
|
29
|
-
socketTimeout: config.connectionTimeout,
|
|
27
|
+
connectionTimeout: config.connectionTimeout || 60,
|
|
28
|
+
socketTimeout: config.connectionTimeout || 60,
|
|
30
29
|
httpsAgent: new Agent({ keepAlive: false, maxSockets: 50, rejectUnauthorized: true }),
|
|
31
30
|
}),
|
|
32
31
|
})
|
|
@@ -110,10 +110,15 @@ export default class RouteResolver {
|
|
|
110
110
|
* @returns None
|
|
111
111
|
*/
|
|
112
112
|
private buildRoutes(config: RouterConfig): void {
|
|
113
|
-
|
|
114
|
-
const parts =
|
|
113
|
+
const addRoute = (path: string, route: AnyRoute) => {
|
|
114
|
+
const parts = path.split('/').filter(p => p.length)
|
|
115
115
|
this.routes[route.method] = this.routes[route.method] || new Routes()
|
|
116
116
|
this.routes[route.method]!.addRoute(route, parts)
|
|
117
117
|
}
|
|
118
|
+
for (const route of config.routes) {
|
|
119
|
+
if (Array.isArray(route.path)) {
|
|
120
|
+
for (const path of route.path) addRoute(path, route)
|
|
121
|
+
} else addRoute(route.path, route)
|
|
122
|
+
}
|
|
118
123
|
}
|
|
119
124
|
}
|
package/src/Server/Router.ts
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { DynamoDBClient } from '@aws-sdk/client-dynamodb'
|
|
2
|
-
|
|
3
|
-
import { DynamoDatabase } from './DynamoDatabase.js'
|
|
4
|
-
import { DatabaseTransaction } from '../../DatabaseTransaction.js'
|
|
5
|
-
|
|
6
|
-
export class DynamoTransaction extends DatabaseTransaction {
|
|
7
|
-
public readonly writer: DynamoDBClient
|
|
8
|
-
protected database: DynamoDatabase
|
|
9
|
-
private constructor(writer: DynamoDBClient, database: DynamoDatabase) {
|
|
10
|
-
super(writer, database)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public static async newTransaction(
|
|
14
|
-
writer: DynamoDBClient,
|
|
15
|
-
database: DynamoDatabase
|
|
16
|
-
): Promise<DynamoTransaction> {
|
|
17
|
-
const tx = new DynamoTransaction(writer, database)
|
|
18
|
-
await tx.begin() // defaults to opened
|
|
19
|
-
return DatabaseTransaction.proxyInstance(tx) as any
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
protected doBegin = async () => {}
|
|
23
|
-
protected doCommit = () => {
|
|
24
|
-
return Promise.resolve()
|
|
25
|
-
}
|
|
26
|
-
protected doRollback = () => {
|
|
27
|
-
return Promise.resolve()
|
|
28
|
-
}
|
|
29
|
-
}
|