@devmoods/express-extras 0.57.2 → 0.58.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/README.md +6 -0
- package/dist/listen.js +5 -1
- package/dist/postgres.d.ts +4 -4
- package/package.json +24 -24
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
> Express evolved: Type-safe routing, elegant transactions, and production-ready patterns for modern Node.js
|
|
4
4
|
|
|
5
|
+
## ⚠️ Express v5 ⚠️
|
|
6
|
+
|
|
7
|
+
Due to [internal changes in the router](https://github.com/pillarjs/router/issues/122) used in Express v5 that breaks the ability to generate a full set of routes using the `routes` management command and to generate the OpenAPI spec, this library doesn't officially support Express v5. But in most cases if will work just fine as long as you don't rely on these features.
|
|
8
|
+
|
|
9
|
+
## Get ready
|
|
10
|
+
|
|
5
11
|
_Extremely opinionated_ set of utilities for cranking out production-ready Node.js apps in a timely manner. We assume you are using PostgreSQL as the main database, Redis for data you don't want in Postgres and [Faktory](https://contribsys.com/faktory/) for background jobs.
|
|
6
12
|
|
|
7
13
|
- Only works with [ECMAScript Modules (ESM)](https://nodejs.org/api/esm.html)
|
package/dist/listen.js
CHANGED
|
@@ -10,6 +10,7 @@ import { route } from './middleware.js';
|
|
|
10
10
|
import { envPort, startTimer } from './utils.js';
|
|
11
11
|
import { validateQuery } from './validate.js';
|
|
12
12
|
const logger = getLogger('http');
|
|
13
|
+
const appTimer = startTimer();
|
|
13
14
|
const READINESS_PERIOD = config.value.READINESS_PERIOD_MS;
|
|
14
15
|
const GRACE_PERIOD = config.value.GRACE_PERIOD_MS;
|
|
15
16
|
export function stoppable(server, grace = Infinity) {
|
|
@@ -136,7 +137,10 @@ export function createExpressServer(app, options = {}) {
|
|
|
136
137
|
const port = app.get('port') ?? envPort(0);
|
|
137
138
|
return new Promise((resolve) => {
|
|
138
139
|
server.listen(port, () => {
|
|
139
|
-
logger.info('app listening', {
|
|
140
|
+
logger.info('app listening', {
|
|
141
|
+
port: this.port,
|
|
142
|
+
duration: appTimer.getDuration(),
|
|
143
|
+
});
|
|
140
144
|
resolve();
|
|
141
145
|
});
|
|
142
146
|
});
|
package/dist/postgres.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import { type RequestHandler } from 'express';
|
|
3
|
-
import
|
|
3
|
+
import { type PoolClient, type PoolConfig, type QueryResult, type QueryResultRow } from 'pg';
|
|
4
4
|
import { type SqlStatement } from './sql.js';
|
|
5
|
-
export declare const escapePostgresIdentifier: typeof pg.escapeIdentifier;
|
|
6
|
-
export declare const escapePostgresLiteral: typeof pg.escapeLiteral;
|
|
5
|
+
export declare const escapePostgresIdentifier: typeof import("pg").escapeIdentifier;
|
|
6
|
+
export declare const escapePostgresLiteral: typeof import("pg").escapeLiteral;
|
|
7
7
|
export interface PostgresOptions extends PoolConfig, ConnectionOptions {
|
|
8
8
|
onError?: (error: Error, client: any) => void;
|
|
9
9
|
url?: PoolConfig['connectionString'];
|
|
@@ -63,7 +63,7 @@ export declare function createPostgres({ onError, url, ...postgresOptions }?: Po
|
|
|
63
63
|
withConnection: <T>(callback: (connection: Connection) => Promise<T>) => Promise<T>;
|
|
64
64
|
transaction: <T>(callback: () => Promise<T> | T) => Promise<T>;
|
|
65
65
|
getCurrentTransaction: () => Transaction | null;
|
|
66
|
-
instance: pg.Pool;
|
|
66
|
+
instance: import("pg").Pool;
|
|
67
67
|
clear: (force?: boolean) => Promise<void>;
|
|
68
68
|
end(): Promise<void>;
|
|
69
69
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devmoods/express-extras",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.0",
|
|
4
4
|
"description": "Kubernetes-ready utilities for rapid Node.js application development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,55 +44,55 @@
|
|
|
44
44
|
],
|
|
45
45
|
"license": "ISC",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@devmoods/eslint-config": "^2.
|
|
47
|
+
"@devmoods/eslint-config": "^2.9.0",
|
|
48
48
|
"@types/koa-compose": "^3.2.8",
|
|
49
|
-
"@types/node": "22.
|
|
49
|
+
"@types/node": "22.15.24",
|
|
50
50
|
"@types/supertest": "^6.0.3",
|
|
51
|
-
"@vitejs/plugin-react": "^4.
|
|
52
|
-
"@vitest/coverage-v8": "^3.1.
|
|
53
|
-
"arktype": "^2.1.
|
|
51
|
+
"@vitejs/plugin-react": "^4.5.0",
|
|
52
|
+
"@vitest/coverage-v8": "^3.1.4",
|
|
53
|
+
"arktype": "^2.1.20",
|
|
54
54
|
"cookiejar": "^2.1.4",
|
|
55
|
-
"eslint": "^9.
|
|
55
|
+
"eslint": "^9.27.0",
|
|
56
56
|
"faktory-worker": "^4.7.0",
|
|
57
57
|
"prettier": "3.5.3",
|
|
58
|
-
"supertest": "7.1.
|
|
58
|
+
"supertest": "7.1.1",
|
|
59
59
|
"ts-node": "10.9.2",
|
|
60
|
-
"tsx": "^4.19.
|
|
60
|
+
"tsx": "^4.19.4",
|
|
61
61
|
"typescript": "5.8.3",
|
|
62
|
-
"vite": "^6.
|
|
63
|
-
"vitest": "^3.1.
|
|
62
|
+
"vite": "^6.3.5",
|
|
63
|
+
"vitest": "^3.1.4",
|
|
64
64
|
"vitest-fail-on-console": "^0.7.1"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@devmoods/fetch": "^4.1.0",
|
|
68
|
-
"@sentry/node": "^9.
|
|
69
|
-
"@sentry/profiling-node": "^9.
|
|
68
|
+
"@sentry/node": "^9.23.0",
|
|
69
|
+
"@sentry/profiling-node": "^9.23.0",
|
|
70
70
|
"@standard-schema/spec": "^1.0.0",
|
|
71
71
|
"@types/bcrypt": "^5.0.2",
|
|
72
72
|
"@types/cookie-parser": "^1.4.8",
|
|
73
|
-
"@types/express": "^5.0.
|
|
73
|
+
"@types/express": "^5.0.2",
|
|
74
74
|
"@types/jsonwebtoken": "^9.0.9",
|
|
75
75
|
"@types/nodemailer": "^6.4.17",
|
|
76
|
-
"@types/pg": "^8.
|
|
77
|
-
"@types/qs": "^6.
|
|
76
|
+
"@types/pg": "^8.15.2",
|
|
77
|
+
"@types/qs": "^6.14.0",
|
|
78
78
|
"@types/superagent": "^8.1.9",
|
|
79
79
|
"@types/uuid": "^10.0.0",
|
|
80
80
|
"ajv": "^8.17.1",
|
|
81
|
-
"argon2": "^0.
|
|
82
|
-
"bcrypt": "^
|
|
81
|
+
"argon2": "^0.43.0",
|
|
82
|
+
"bcrypt": "^6.0.0",
|
|
83
83
|
"chalk": "^5.4.1",
|
|
84
|
-
"commander": "^
|
|
84
|
+
"commander": "^14.0.0",
|
|
85
85
|
"compose-middleware": "^5.0.1",
|
|
86
86
|
"cookie-parser": "^1.4.7",
|
|
87
|
-
"dotenv": "^16.
|
|
87
|
+
"dotenv": "^16.5.0",
|
|
88
88
|
"express": "^4.21.2",
|
|
89
89
|
"helmet": "^8.1.0",
|
|
90
90
|
"jsonwebtoken": "^9.0.2",
|
|
91
|
-
"nodemailer": "^
|
|
92
|
-
"pg": "^8.
|
|
93
|
-
"redis": "^
|
|
91
|
+
"nodemailer": "^7.0.3",
|
|
92
|
+
"pg": "^8.16.0",
|
|
93
|
+
"redis": "^5.1.1",
|
|
94
94
|
"sonda": "^0.7.1",
|
|
95
|
-
"sql-formatter": "^15.
|
|
95
|
+
"sql-formatter": "^15.6.2",
|
|
96
96
|
"uuid": "^11.1.0"
|
|
97
97
|
},
|
|
98
98
|
"prettier": {
|