@constructive-io/graphql-server 5.16.10 → 5.16.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/esm/server.js +24 -9
- package/package.json +14 -14
- package/server.d.ts +1 -0
- package/server.js +24 -9
package/esm/server.js
CHANGED
|
@@ -225,24 +225,39 @@ class Server {
|
|
|
225
225
|
}
|
|
226
226
|
this.listenClient = client;
|
|
227
227
|
this.listenRelease = release;
|
|
228
|
+
// Attached before any query is issued: an 'error' event on a Client with no
|
|
229
|
+
// listener is rethrown by Node and takes the whole process down.
|
|
230
|
+
client.on('error', (e) => {
|
|
231
|
+
this.dropListener(client, 'Error with database notify listener', e);
|
|
232
|
+
});
|
|
228
233
|
client.on('notification', ({ channel, payload }) => {
|
|
229
234
|
if (channel === 'schema:update' && payload) {
|
|
230
235
|
log.info('schema:update', payload);
|
|
231
236
|
this.flush(payload);
|
|
232
237
|
}
|
|
233
238
|
});
|
|
234
|
-
client.query('LISTEN "schema:update"')
|
|
235
|
-
|
|
236
|
-
if (this.shuttingDown) {
|
|
237
|
-
release();
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
this.error('Error with database notify listener', e);
|
|
241
|
-
release();
|
|
242
|
-
this.addEventListener();
|
|
239
|
+
client.query('LISTEN "schema:update"').catch((e) => {
|
|
240
|
+
this.dropListener(client, 'Failed to LISTEN for schema:update', e);
|
|
243
241
|
});
|
|
244
242
|
this.log('connected and listening for changes...');
|
|
245
243
|
}
|
|
244
|
+
dropListener(client, message, err) {
|
|
245
|
+
// Another path (shutdown, an earlier failure) already tore this client down.
|
|
246
|
+
if (this.listenClient !== client)
|
|
247
|
+
return;
|
|
248
|
+
const release = this.listenRelease;
|
|
249
|
+
this.listenClient = null;
|
|
250
|
+
this.listenRelease = null;
|
|
251
|
+
client.removeAllListeners('notification');
|
|
252
|
+
client.removeAllListeners('error');
|
|
253
|
+
if (this.shuttingDown) {
|
|
254
|
+
release?.();
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
this.error(message, err);
|
|
258
|
+
release?.();
|
|
259
|
+
this.addEventListener();
|
|
260
|
+
}
|
|
246
261
|
async removeEventListener() {
|
|
247
262
|
if (!this.listenClient || !this.listenRelease) {
|
|
248
263
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-server",
|
|
3
|
-
"version": "5.16.
|
|
3
|
+
"version": "5.16.12",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Constructive GraphQL Server",
|
|
6
6
|
"main": "index.js",
|
|
@@ -44,18 +44,18 @@
|
|
|
44
44
|
"@agentic-kit/ollama": "2.13.0",
|
|
45
45
|
"@constructive-io/csrf": "^0.27.0",
|
|
46
46
|
"@constructive-io/errors": "^0.10.0",
|
|
47
|
-
"@constructive-io/express-context": "^0.24.
|
|
48
|
-
"@constructive-io/graphql-env": "^3.29.
|
|
49
|
-
"@constructive-io/graphql-types": "^3.28.
|
|
47
|
+
"@constructive-io/express-context": "^0.24.5",
|
|
48
|
+
"@constructive-io/graphql-env": "^3.29.4",
|
|
49
|
+
"@constructive-io/graphql-types": "^3.28.4",
|
|
50
50
|
"@constructive-io/llm-env": "^0.13.0",
|
|
51
51
|
"@constructive-io/query-builder": "^3.10.4",
|
|
52
52
|
"@constructive-io/s3-utils": "^2.30.0",
|
|
53
53
|
"@constructive-io/url-domains": "^2.29.0",
|
|
54
54
|
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.2",
|
|
55
|
-
"@pgpmjs/env": "^2.41.
|
|
55
|
+
"@pgpmjs/env": "^2.41.4",
|
|
56
56
|
"@pgpmjs/logger": "^2.24.1",
|
|
57
|
-
"@pgpmjs/server-utils": "^3.25.
|
|
58
|
-
"@pgpmjs/types": "^2.50.
|
|
57
|
+
"@pgpmjs/server-utils": "^3.25.5",
|
|
58
|
+
"@pgpmjs/types": "^2.50.4",
|
|
59
59
|
"cors": "^2.8.6",
|
|
60
60
|
"deepmerge": "^4.3.1",
|
|
61
61
|
"express": "^5.2.1",
|
|
@@ -64,17 +64,17 @@
|
|
|
64
64
|
"grafserv": "1.0.1",
|
|
65
65
|
"graphile-build": "5.1.1",
|
|
66
66
|
"graphile-build-pg": "5.1.3",
|
|
67
|
-
"graphile-cache": "^4.10.
|
|
67
|
+
"graphile-cache": "^4.10.7",
|
|
68
68
|
"graphile-config": "1.1.0",
|
|
69
|
-
"graphile-function-bindings": "^1.11.
|
|
70
|
-
"graphile-settings": "^6.15.
|
|
69
|
+
"graphile-function-bindings": "^1.11.10",
|
|
70
|
+
"graphile-settings": "^6.15.1",
|
|
71
71
|
"graphile-utils": "5.0.3",
|
|
72
72
|
"graphql": "16.13.0",
|
|
73
73
|
"graphql-upload": "^13.0.0",
|
|
74
74
|
"lru-cache": "^11.2.7",
|
|
75
75
|
"pg": "^8.21.0",
|
|
76
|
-
"pg-cache": "^3.25.
|
|
77
|
-
"pg-env": "^1.29.
|
|
76
|
+
"pg-cache": "^3.25.5",
|
|
77
|
+
"pg-env": "^1.29.2",
|
|
78
78
|
"pg-query-context": "^2.29.1",
|
|
79
79
|
"pg-sql2": "5.0.1",
|
|
80
80
|
"postgraphile": "5.1.4",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"@types/request-ip": "^0.0.41",
|
|
91
91
|
"@types/supertest": "^7.2.1",
|
|
92
92
|
"cookie-parser": "^1.4.7",
|
|
93
|
-
"graphile-test": "5.11.
|
|
93
|
+
"graphile-test": "5.11.9",
|
|
94
94
|
"makage": "^0.3.0",
|
|
95
95
|
"nodemon": "^3.1.14",
|
|
96
96
|
"supertest": "^7.2.2",
|
|
97
97
|
"ts-node": "^10.9.2"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "eacbe10ce544848c93a4c17fc8a8474d1a788a18"
|
|
100
100
|
}
|
package/server.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ declare class Server {
|
|
|
39
39
|
getPool(): Pool;
|
|
40
40
|
addEventListener(): void;
|
|
41
41
|
listenForChanges(err: Error | null, client: PoolClient, release: () => void): void;
|
|
42
|
+
private dropListener;
|
|
42
43
|
removeEventListener(): Promise<void>;
|
|
43
44
|
close(opts?: {
|
|
44
45
|
closeCaches?: boolean;
|
package/server.js
CHANGED
|
@@ -232,24 +232,39 @@ class Server {
|
|
|
232
232
|
}
|
|
233
233
|
this.listenClient = client;
|
|
234
234
|
this.listenRelease = release;
|
|
235
|
+
// Attached before any query is issued: an 'error' event on a Client with no
|
|
236
|
+
// listener is rethrown by Node and takes the whole process down.
|
|
237
|
+
client.on('error', (e) => {
|
|
238
|
+
this.dropListener(client, 'Error with database notify listener', e);
|
|
239
|
+
});
|
|
235
240
|
client.on('notification', ({ channel, payload }) => {
|
|
236
241
|
if (channel === 'schema:update' && payload) {
|
|
237
242
|
log.info('schema:update', payload);
|
|
238
243
|
this.flush(payload);
|
|
239
244
|
}
|
|
240
245
|
});
|
|
241
|
-
client.query('LISTEN "schema:update"')
|
|
242
|
-
|
|
243
|
-
if (this.shuttingDown) {
|
|
244
|
-
release();
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
this.error('Error with database notify listener', e);
|
|
248
|
-
release();
|
|
249
|
-
this.addEventListener();
|
|
246
|
+
client.query('LISTEN "schema:update"').catch((e) => {
|
|
247
|
+
this.dropListener(client, 'Failed to LISTEN for schema:update', e);
|
|
250
248
|
});
|
|
251
249
|
this.log('connected and listening for changes...');
|
|
252
250
|
}
|
|
251
|
+
dropListener(client, message, err) {
|
|
252
|
+
// Another path (shutdown, an earlier failure) already tore this client down.
|
|
253
|
+
if (this.listenClient !== client)
|
|
254
|
+
return;
|
|
255
|
+
const release = this.listenRelease;
|
|
256
|
+
this.listenClient = null;
|
|
257
|
+
this.listenRelease = null;
|
|
258
|
+
client.removeAllListeners('notification');
|
|
259
|
+
client.removeAllListeners('error');
|
|
260
|
+
if (this.shuttingDown) {
|
|
261
|
+
release?.();
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
this.error(message, err);
|
|
265
|
+
release?.();
|
|
266
|
+
this.addEventListener();
|
|
267
|
+
}
|
|
253
268
|
async removeEventListener() {
|
|
254
269
|
if (!this.listenClient || !this.listenRelease) {
|
|
255
270
|
return;
|