@devmoods/express-extras 0.29.0 → 0.31.0
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/faktory.d.ts +1 -1
- package/dist/listen.js +7 -4
- package/dist/middleware.js +1 -0
- package/dist/validate.js +9 -5
- package/package.json +15 -15
package/dist/faktory.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function createJobs({ queueName, faktory: createFactory, }: JobsO
|
|
|
8
8
|
$job: boolean;
|
|
9
9
|
jobName: string;
|
|
10
10
|
readonly executionCount: number;
|
|
11
|
-
delay(args?: Parameters<T>[0]
|
|
11
|
+
delay(args?: Parameters<T>[0]): Promise<`${string}-${string}-${string}-${string}-${string}`>;
|
|
12
12
|
execute(args: Parameters<T>[0]): Promise<any>;
|
|
13
13
|
};
|
|
14
14
|
queueName: string;
|
package/dist/listen.js
CHANGED
|
@@ -61,9 +61,9 @@ export function stoppable(server, grace = Infinity) {
|
|
|
61
61
|
}
|
|
62
62
|
server.on('connection', onConnection);
|
|
63
63
|
server.on('request', onRequest);
|
|
64
|
-
// @ts-expect-error
|
|
64
|
+
// @ts-expect-error attach stop
|
|
65
65
|
server.stop = stop;
|
|
66
|
-
// @ts-expect-error
|
|
66
|
+
// @ts-expect-error attach inspect
|
|
67
67
|
server.inspect = () => {
|
|
68
68
|
return {
|
|
69
69
|
sockets: requestsPerSocket.size,
|
|
@@ -125,8 +125,11 @@ export function createExpressServer(app, options = {}) {
|
|
|
125
125
|
return onSignal('SIGTERM');
|
|
126
126
|
},
|
|
127
127
|
get port() {
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
const address = server.address();
|
|
129
|
+
if (address == null || typeof address === 'string') {
|
|
130
|
+
throw new Error('address was a string, should not happen');
|
|
131
|
+
}
|
|
132
|
+
return address.port;
|
|
130
133
|
},
|
|
131
134
|
};
|
|
132
135
|
}
|
package/dist/middleware.js
CHANGED
package/dist/validate.js
CHANGED
|
@@ -32,11 +32,18 @@ export function validateParams(schema) {
|
|
|
32
32
|
next();
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
function createAjv(options) {
|
|
36
36
|
const ajv = new Ajv({
|
|
37
37
|
allErrors: true,
|
|
38
|
+
validateFormats: false,
|
|
38
39
|
...options,
|
|
39
40
|
});
|
|
41
|
+
ajv.addKeyword('$enumNames');
|
|
42
|
+
ajv.addKeyword('$bitiforms');
|
|
43
|
+
return ajv;
|
|
44
|
+
}
|
|
45
|
+
export function compileValidateSchema(schema, options = {}) {
|
|
46
|
+
const ajv = createAjv(options);
|
|
40
47
|
const validate = ajv.compile(schema);
|
|
41
48
|
return (data) => {
|
|
42
49
|
const valid = validate(data);
|
|
@@ -55,10 +62,7 @@ export function compileValidateSchema(schema, options = {}) {
|
|
|
55
62
|
};
|
|
56
63
|
}
|
|
57
64
|
export function validateSchema(data, schema, options = {}) {
|
|
58
|
-
const ajv =
|
|
59
|
-
allErrors: true,
|
|
60
|
-
...options,
|
|
61
|
-
});
|
|
65
|
+
const ajv = createAjv(options);
|
|
62
66
|
const valid = ajv.validate(schema, data);
|
|
63
67
|
if (valid) {
|
|
64
68
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devmoods/express-extras",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Kubernetes-ready utilities for rapid Node.js application development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@devmoods/eslint-config": "^1.
|
|
26
|
+
"@devmoods/eslint-config": "^1.13.1",
|
|
27
27
|
"@types/koa-compose": "^3.2.8",
|
|
28
|
-
"@types/node": "20.
|
|
28
|
+
"@types/node": "20.14.2",
|
|
29
29
|
"@types/supertest": "^6.0.2",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
31
|
-
"@typescript-eslint/parser": "^7.
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
|
31
|
+
"@typescript-eslint/parser": "^7.12.0",
|
|
32
32
|
"@vitest/coverage-v8": "^1.3.1",
|
|
33
33
|
"chalk": "^5.3.0",
|
|
34
34
|
"eslint": "^8.57.0",
|
|
35
35
|
"eslint-plugin-import": "^2.29.1",
|
|
36
36
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
37
37
|
"eslint-plugin-prettier": "^5.1.3",
|
|
38
|
-
"eslint-plugin-react": "^7.
|
|
38
|
+
"eslint-plugin-react": "^7.34.2",
|
|
39
39
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
40
40
|
"faktory-worker": "^4.5.1",
|
|
41
|
-
"prettier": "3.
|
|
42
|
-
"supertest": "
|
|
41
|
+
"prettier": "3.3.1",
|
|
42
|
+
"supertest": "7.0.0",
|
|
43
43
|
"ts-node": "10.9.2",
|
|
44
|
-
"typescript": "5.
|
|
44
|
+
"typescript": "5.4.5",
|
|
45
45
|
"vitest": "^1.3.1"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@devmoods/fetch": "^4.0.1",
|
|
49
|
-
"@sentry/node": "^7.
|
|
49
|
+
"@sentry/node": "^7.116.0",
|
|
50
50
|
"@types/bcrypt": "^5.0.2",
|
|
51
51
|
"@types/body-parser": "^1.19.5",
|
|
52
52
|
"@types/cookie-parser": "^1.4.7",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"@types/pg": "^8.11.2",
|
|
57
57
|
"@types/superagent": "^8.1.4",
|
|
58
58
|
"@types/uuid": "^9.0.8",
|
|
59
|
-
"ajv": "^8.
|
|
59
|
+
"ajv": "^8.16.0",
|
|
60
60
|
"bcrypt": "^5.1.1",
|
|
61
61
|
"body-parser": "^1.20.2",
|
|
62
|
-
"commander": "^12.
|
|
62
|
+
"commander": "^12.1.0",
|
|
63
63
|
"compose-middleware": "^5.0.1",
|
|
64
64
|
"cookie-parser": "^1.4.6",
|
|
65
65
|
"dotenv": "^16.4.5",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"jsonwebtoken": "^9.0.2",
|
|
70
70
|
"meow": "^13.2.0",
|
|
71
71
|
"nodemailer": "^6.9.11",
|
|
72
|
-
"pg": "^8.
|
|
72
|
+
"pg": "^8.12.0",
|
|
73
73
|
"redis": "^4.6.13",
|
|
74
74
|
"sql-template-strings": "^2.2.2",
|
|
75
75
|
"uuid": "^9.0.1",
|
|
76
|
-
"vitest-fail-on-console": "^0.
|
|
76
|
+
"vitest-fail-on-console": "^0.7.0"
|
|
77
77
|
},
|
|
78
78
|
"prettier": {
|
|
79
79
|
"singleQuote": true
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"faktory-worker": "^4.5.1"
|
|
94
94
|
},
|
|
95
95
|
"engines": {
|
|
96
|
-
"node": ">=20.3.0 <
|
|
96
|
+
"node": ">=20.3.0 <23"
|
|
97
97
|
},
|
|
98
98
|
"scripts": {
|
|
99
99
|
"start": "ts-node --esm example/index.ts",
|