@creator.co/wapi 1.6.1 → 1.7.1-alpha1
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 +2 -1
- package/.github/workflows/npmpublish.yml +1 -1
- package/.github/workflows/prs.yml +1 -1
- package/dist/index.js +45 -31
- package/dist/index.js.map +1 -1
- package/dist/package-lock.json +11786 -0
- package/dist/package.json +24 -22
- package/dist/src/API/Request.js +53 -59
- package/dist/src/API/Request.js.map +1 -1
- package/dist/src/API/Response.js +81 -156
- package/dist/src/API/Response.js.map +1 -1
- package/dist/src/BaseEvent/EventProcessor.js +54 -132
- package/dist/src/BaseEvent/EventProcessor.js.map +1 -1
- package/dist/src/BaseEvent/Process.js +40 -98
- package/dist/src/BaseEvent/Process.js.map +1 -1
- package/dist/src/BaseEvent/Transaction.js +122 -310
- package/dist/src/BaseEvent/Transaction.js.map +1 -1
- package/dist/src/Cache/Redis.js +55 -119
- package/dist/src/Cache/Redis.js.map +1 -1
- package/dist/src/Cache/types.js +1 -2
- package/dist/src/Config/Configuration.js +46 -86
- package/dist/src/Config/Configuration.js.map +1 -1
- package/dist/src/Config/EnvironmentVar.js +57 -119
- package/dist/src/Config/EnvironmentVar.js.map +1 -1
- package/dist/src/Crypto/Crypto.js +35 -82
- package/dist/src/Crypto/Crypto.js.map +1 -1
- package/dist/src/Crypto/JWT.d.ts +1 -1
- package/dist/src/Crypto/JWT.js +12 -27
- package/dist/src/Crypto/JWT.js.map +1 -1
- package/dist/src/Database/Database.js +3 -8
- package/dist/src/Database/Database.js.map +1 -1
- package/dist/src/Database/DatabaseManager.js +23 -28
- package/dist/src/Database/DatabaseManager.js.map +1 -1
- package/dist/src/Database/DatabaseTransaction.js +50 -166
- package/dist/src/Database/DatabaseTransaction.js.map +1 -1
- package/dist/src/Database/index.js +11 -15
- package/dist/src/Database/index.js.map +1 -1
- package/dist/src/Database/integrations/knex/KnexDatabase.js +22 -76
- package/dist/src/Database/integrations/knex/KnexDatabase.js.map +1 -1
- package/dist/src/Database/integrations/knex/KnexTransaction.js +19 -85
- package/dist/src/Database/integrations/knex/KnexTransaction.js.map +1 -1
- package/dist/src/Database/integrations/kysely/KyselyDatabase.js +37 -88
- package/dist/src/Database/integrations/kysely/KyselyDatabase.js.map +1 -1
- package/dist/src/Database/integrations/kysely/KyselyTransaction.js +46 -114
- package/dist/src/Database/integrations/kysely/KyselyTransaction.js.map +1 -1
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.d.ts +3 -3
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.js +20 -71
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.js.map +1 -1
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.d.ts +9 -9
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.js +19 -85
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.js.map +1 -1
- package/dist/src/Database/types.js +1 -2
- package/dist/src/Globals.js +93 -98
- package/dist/src/Globals.js.map +1 -1
- package/dist/src/Logger/Logger.js +88 -222
- package/dist/src/Logger/Logger.js.map +1 -1
- package/dist/src/Mailer/Mailer.d.ts +1 -1
- package/dist/src/Mailer/Mailer.js +83 -204
- package/dist/src/Mailer/Mailer.js.map +1 -1
- package/dist/src/Publisher/Publisher.js +43 -107
- package/dist/src/Publisher/Publisher.js.map +1 -1
- package/dist/src/Server/RouteResolver.js +22 -49
- package/dist/src/Server/RouteResolver.js.map +1 -1
- package/dist/src/Server/Router.d.ts +1 -1
- package/dist/src/Server/Router.js +12 -16
- package/dist/src/Server/Router.js.map +1 -1
- package/dist/src/Server/lib/ContainerServer.js +21 -83
- package/dist/src/Server/lib/ContainerServer.js.map +1 -1
- package/dist/src/Server/lib/Server.js +50 -99
- package/dist/src/Server/lib/Server.js.map +1 -1
- package/dist/src/Server/lib/container/GenericHandler.js +32 -107
- package/dist/src/Server/lib/container/GenericHandler.js.map +1 -1
- package/dist/src/Server/lib/container/GenericHandlerEvent.js +37 -81
- package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +1 -1
- package/dist/src/Server/lib/container/HealthHandler.js +3 -35
- package/dist/src/Server/lib/container/HealthHandler.js.map +1 -1
- package/dist/src/Server/lib/container/Proxy.js +66 -127
- package/dist/src/Server/lib/container/Proxy.js.map +1 -1
- package/dist/src/Server/lib/container/Utils.js +12 -55
- package/dist/src/Server/lib/container/Utils.js.map +1 -1
- package/dist/src/Util/AsyncSingleton.js +40 -164
- package/dist/src/Util/AsyncSingleton.js.map +1 -1
- package/dist/src/Util/Utils.js +18 -24
- package/dist/src/Util/Utils.js.map +1 -1
- package/dist/src/Validation/Validator.js +10 -16
- package/dist/src/Validation/Validator.js.map +1 -1
- package/jest.config.ts +1 -0
- package/jest.smoke.config.ts +35 -0
- package/package.json +24 -22
- package/src/Config/Configuration.ts +2 -2
- package/src/Crypto/JWT.ts +1 -1
- package/src/Database/DatabaseManager.ts +1 -1
- package/src/Database/integrations/knex/KnexDatabase.ts +1 -1
- package/src/Database/integrations/kysely/KyselyDatabase.ts +2 -2
- package/src/Database/integrations/pgsql/PostgresDatabase.ts +4 -4
- package/src/Database/integrations/pgsql/PostgresTransaction.ts +8 -8
- package/src/Globals.ts +1 -1
- package/src/Logger/Logger.ts +3 -3
- package/src/Mailer/Mailer.ts +3 -3
- package/src/Publisher/Publisher.ts +1 -1
- package/src/Server/Router.ts +1 -1
- package/src/Server/lib/container/GenericHandlerEvent.ts +1 -1
- package/src/Server/lib/container/Proxy.ts +6 -3
- package/tests/API/Response.test.ts +1 -0
- package/tests/BaseEvent/Transaction.test.ts +1 -0
- package/tests/Cache/Redis-client.test.ts +2 -0
- package/tests/Cache/Redis-cluster.test.ts +2 -0
- package/tests/Database/DatabaseManager.test.ts +4 -3
- package/tests/Database/integrations/knex/KnexDatabase.test.ts +1 -0
- package/tests/Database/integrations/knex/KnexTransaction.test.ts +1 -0
- package/tests/Database/integrations/kysely/KyselyDatabase.test.ts +4 -3
- package/tests/Database/integrations/kysely/KyselyTransaction.test.ts +2 -1
- package/tests/Database/integrations/pg/PostgresDatabase.test.ts +3 -2
- package/tests/Database/integrations/pg/PostgresTransaction.test.ts +4 -3
- package/tests/Logger/Logger.test.ts +6 -3
- package/tests/Server/Router.test.ts +1 -0
- package/tests/Server/lib/ContainerServer.test.ts +2 -1
- package/tests/Server/lib/container/GenericHandler.test.ts +1 -0
- package/tests/Server/lib/container/HealthHandler.test.ts +1 -0
- package/tests/Server/lib/container/Proxy.test.ts +2 -1
- package/tests/Test.utils.ts +2 -1
- package/tsconfig.json +6 -2
- package/tsconfig.smoke.json +26 -0
- package/dist/jest.config.d.ts +0 -3
- package/dist/jest.config.js +0 -34
- package/dist/jest.config.js.map +0 -1
- package/tests/main.test.ts +0 -15
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jest } from '@jest/globals'
|
|
2
|
+
import * as pg from 'pg'
|
|
2
3
|
|
|
3
4
|
import type { DbConfig } from '../../../../src/Database'
|
|
4
5
|
import { PostgresDatabase } from '../../../../src/Database/integrations/pgsql/PostgresDatabase'
|
|
@@ -18,13 +19,13 @@ const testResources = async (config: Partial<DbConfig<'pg'>>) => {
|
|
|
18
19
|
rollback: jest.fn(),
|
|
19
20
|
query: jest.fn(),
|
|
20
21
|
}
|
|
21
|
-
})() as any as PoolClient
|
|
22
|
+
})() as any as pg.PoolClient
|
|
22
23
|
|
|
23
24
|
const writer = jest.fn().mockImplementation(() => {
|
|
24
25
|
return {
|
|
25
26
|
connect: jest.fn(() => transaction),
|
|
26
27
|
}
|
|
27
|
-
})() as any as Pool
|
|
28
|
+
})() as any as pg.Pool
|
|
28
29
|
|
|
29
30
|
return {
|
|
30
31
|
transaction,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jest } from '@jest/globals'
|
|
1
2
|
import { expect as c_expect } from 'chai'
|
|
2
3
|
|
|
3
4
|
// get console ref and mock before logger import
|
|
@@ -166,9 +167,11 @@ function testLogs(isContainer: boolean, provider?: Logger) {
|
|
|
166
167
|
)
|
|
167
168
|
expect(consoleProxy.log).toHaveBeenNthCalledWith(
|
|
168
169
|
1,
|
|
169
|
-
expect.stringContaining(
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
expect.stringContaining('[INFO] [Logger.test.ts:')
|
|
171
|
+
)
|
|
172
|
+
expect(consoleProxy.log).toHaveBeenNthCalledWith(
|
|
173
|
+
1,
|
|
174
|
+
expect.stringContaining('] {\n' + ' "self": "[Circular ~]"\n' + '}')
|
|
172
175
|
)
|
|
173
176
|
})
|
|
174
177
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { jest } from '@jest/globals'
|
|
1
2
|
import { APIGatewayProxyEvent, Context } from 'aws-lambda'
|
|
2
3
|
import { expect as c_expect } from 'chai'
|
|
3
|
-
import
|
|
4
|
+
import request from 'supertest'
|
|
4
5
|
|
|
5
6
|
import Globals from '../../../../src/Globals'
|
|
6
7
|
import Proxy from '../../../../src/Server/lib/container/Proxy'
|
package/tests/Test.utils.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jest } from '@jest/globals'
|
|
1
2
|
import { APIGatewayEvent, Context, SQSEvent } from 'aws-lambda'
|
|
2
3
|
import { z } from 'zod'
|
|
3
4
|
|
|
@@ -68,6 +69,6 @@ export function emptyQueueEvent(data?: any) {
|
|
|
68
69
|
|
|
69
70
|
export function observableTransaction() {
|
|
70
71
|
const t = new Transaction(emptyEvent(), observableContext())
|
|
71
|
-
t.responseProxy = jest.fn()
|
|
72
|
+
t.responseProxy = jest.fn() as any
|
|
72
73
|
return t
|
|
73
74
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"exclude": ["**/*.test.*", "**/__mocks__/*", "**/__tests__/*", "**/tests/*", "./dist/**/*"],
|
|
2
|
+
"exclude": ["**/*.test.*", "**/__mocks__/*", "**/__tests__/*", "**/tests/*", "./dist/**/*", "./smoke-tests/**/*", "./jest*", "./node_modules"],
|
|
3
|
+
"include": ["./**/*", "./package.json", "./package-lock.json"],
|
|
3
4
|
"compilerOptions": {
|
|
4
5
|
"lib": [
|
|
5
6
|
"es5",
|
|
6
7
|
"es6",
|
|
7
8
|
"dom"
|
|
8
9
|
],
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"target": "es6",
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"esModuleInterop": true,
|
|
9
14
|
"noImplicitAny": false,
|
|
10
15
|
"noEmitOnError": true,
|
|
11
16
|
"removeComments": false,
|
|
12
17
|
"downlevelIteration": true,
|
|
13
18
|
"resolveJsonModule": true,
|
|
14
19
|
"sourceMap": true,
|
|
15
|
-
"target": "es5",
|
|
16
20
|
"outDir": "dist",
|
|
17
21
|
"declaration": true,
|
|
18
22
|
"skipLibCheck": true,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"exclude": ["./dist/**/*", "./smoke-tests/**/*", "./node_modules", "./**/Logger.test.*"],
|
|
3
|
+
"include": ["./**/*", "./package.json", "./package-lock.json"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"lib": [
|
|
6
|
+
"es5",
|
|
7
|
+
"es6",
|
|
8
|
+
"dom"
|
|
9
|
+
],
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"target": "es6",
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"noImplicitAny": false,
|
|
14
|
+
"noEmitOnError": true,
|
|
15
|
+
"removeComments": false,
|
|
16
|
+
"downlevelIteration": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"sourceMap": true,
|
|
19
|
+
"esModuleInterop": true,
|
|
20
|
+
"outDir": "smoke-tests",
|
|
21
|
+
"declaration": true,
|
|
22
|
+
"skipLibCheck": true,
|
|
23
|
+
"strictNullChecks": true,
|
|
24
|
+
"noErrorTruncation": true
|
|
25
|
+
}
|
|
26
|
+
}
|
package/dist/jest.config.d.ts
DELETED
package/dist/jest.config.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* eslint-env node */
|
|
4
|
-
var config = {
|
|
5
|
-
preset: 'ts-jest',
|
|
6
|
-
testEnvironment: 'node',
|
|
7
|
-
reporters: [
|
|
8
|
-
'default',
|
|
9
|
-
[
|
|
10
|
-
'jest-junit',
|
|
11
|
-
{
|
|
12
|
-
outputDirectory: 'coverage',
|
|
13
|
-
outputName: 'jest-junit.xml',
|
|
14
|
-
ancestorSeparator: ' › ',
|
|
15
|
-
uniqueOutputName: 'false',
|
|
16
|
-
suiteNameTemplate: '{filepath}',
|
|
17
|
-
classNameTemplate: '{classname}',
|
|
18
|
-
titleTemplate: '{title}',
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
],
|
|
22
|
-
coverageReporters: ['clover', 'json', 'lcov', ['text', { file: 'coverage.txt' }], 'json-summary'],
|
|
23
|
-
collectCoverageFrom: ['src/**/*.(t|j)s', '!src/**/*.d.(t|j)s'],
|
|
24
|
-
coverageThreshold: {
|
|
25
|
-
global: {
|
|
26
|
-
branches: 80,
|
|
27
|
-
functions: 80,
|
|
28
|
-
lines: 80,
|
|
29
|
-
statements: 80,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
exports.default = config;
|
|
34
|
-
//# sourceMappingURL=jest.config.js.map
|
package/dist/jest.config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":";;AACA,qBAAqB;AACrB,IAAM,MAAM,GAA0B;IACpC,MAAM,EAAE,SAAS;IACjB,eAAe,EAAE,MAAM;IACvB,SAAS,EAAE;QACT,SAAS;QACT;YACE,YAAY;YACZ;gBACE,eAAe,EAAE,UAAU;gBAC3B,UAAU,EAAE,gBAAgB;gBAC5B,iBAAiB,EAAE,KAAK;gBACxB,gBAAgB,EAAE,OAAO;gBACzB,iBAAiB,EAAE,YAAY;gBAC/B,iBAAiB,EAAE,aAAa;gBAChC,aAAa,EAAE,SAAS;aACzB;SACF;KACF;IACD,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,CAAC;IACjG,mBAAmB,EAAE,CAAC,iBAAiB,EAAE,oBAAoB,CAAC;IAC9D,iBAAiB,EAAE;QACjB,MAAM,EAAE;YACN,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,EAAE;YACb,KAAK,EAAE,EAAE;YACT,UAAU,EAAE,EAAE;SACf;KACF;CACF,CAAA;AACD,kBAAe,MAAM,CAAA"}
|
package/tests/main.test.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// requireActual ensures you get the real file
|
|
2
|
-
// instead of an automock
|
|
3
|
-
// we use import type and <typeof ...> to still get types
|
|
4
|
-
// import type * as Silly from "../silly"
|
|
5
|
-
// const { sillyFunction } = jest.requireActual<typeof Silly>("../silly")
|
|
6
|
-
|
|
7
|
-
describe('silly function', () => {
|
|
8
|
-
test('guaranteed random', () => {
|
|
9
|
-
expect(4).toBe(4)
|
|
10
|
-
})
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
// required with this small example
|
|
14
|
-
// to make the isolatedModules config happy
|
|
15
|
-
export {}
|