graphile-schema 1.7.0 → 1.8.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/build-schema.js +6 -2
- package/esm/build-schema.js +7 -3
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/package.json +3 -3
package/build-schema.js
CHANGED
|
@@ -14,12 +14,16 @@ async function buildSchemaSDL(opts) {
|
|
|
14
14
|
const database = opts.database ?? 'constructive';
|
|
15
15
|
const schemas = Array.isArray(opts.schemas) ? opts.schemas : [];
|
|
16
16
|
const config = (0, pg_env_1.getPgEnvOptions)({ database });
|
|
17
|
-
|
|
17
|
+
// Create the pool through pg-cache so it is tracked and can be cleaned up
|
|
18
|
+
// by callers via pgCache.delete(database) before dropping ephemeral databases.
|
|
19
|
+
// Without this, makePgService creates its own internal pool that isn't released,
|
|
20
|
+
// causing "database has active sessions" errors during ephemeral DB teardown.
|
|
21
|
+
const pool = (0, pg_cache_1.getPgPool)(config);
|
|
18
22
|
const basePreset = {
|
|
19
23
|
extends: [graphile_settings_1.ConstructivePreset],
|
|
20
24
|
pgServices: [
|
|
21
25
|
(0, graphile_settings_1.makePgService)({
|
|
22
|
-
|
|
26
|
+
pool,
|
|
23
27
|
schemas,
|
|
24
28
|
}),
|
|
25
29
|
],
|
package/esm/build-schema.js
CHANGED
|
@@ -2,18 +2,22 @@ import deepmerge from 'deepmerge';
|
|
|
2
2
|
import { printSchema } from 'graphql';
|
|
3
3
|
import { ConstructivePreset, makePgService } from 'graphile-settings';
|
|
4
4
|
import { makeSchema } from 'graphile-build';
|
|
5
|
-
import {
|
|
5
|
+
import { getPgPool } from 'pg-cache';
|
|
6
6
|
import { getPgEnvOptions } from 'pg-env';
|
|
7
7
|
export async function buildSchemaSDL(opts) {
|
|
8
8
|
const database = opts.database ?? 'constructive';
|
|
9
9
|
const schemas = Array.isArray(opts.schemas) ? opts.schemas : [];
|
|
10
10
|
const config = getPgEnvOptions({ database });
|
|
11
|
-
|
|
11
|
+
// Create the pool through pg-cache so it is tracked and can be cleaned up
|
|
12
|
+
// by callers via pgCache.delete(database) before dropping ephemeral databases.
|
|
13
|
+
// Without this, makePgService creates its own internal pool that isn't released,
|
|
14
|
+
// causing "database has active sessions" errors during ephemeral DB teardown.
|
|
15
|
+
const pool = getPgPool(config);
|
|
12
16
|
const basePreset = {
|
|
13
17
|
extends: [ConstructivePreset],
|
|
14
18
|
pgServices: [
|
|
15
19
|
makePgService({
|
|
16
|
-
|
|
20
|
+
pool,
|
|
17
21
|
schemas,
|
|
18
22
|
}),
|
|
19
23
|
],
|
package/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { buildSchemaSDL } from './build-schema';
|
|
2
2
|
export type { BuildSchemaOptions } from './build-schema';
|
|
3
|
+
export { _cachedTablesMeta } from 'graphile-settings';
|
|
3
4
|
export { fetchEndpointSchemaSDL } from './fetch-endpoint-schema';
|
|
4
5
|
export type { FetchEndpointSchemaOptions } from './fetch-endpoint-schema';
|
package/esm/index.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { buildSchemaSDL } from './build-schema';
|
|
2
2
|
export type { BuildSchemaOptions } from './build-schema';
|
|
3
|
+
export { _cachedTablesMeta } from 'graphile-settings';
|
|
3
4
|
export { fetchEndpointSchemaSDL } from './fetch-endpoint-schema';
|
|
4
5
|
export type { FetchEndpointSchemaOptions } from './fetch-endpoint-schema';
|
package/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchEndpointSchemaSDL = exports.buildSchemaSDL = void 0;
|
|
3
|
+
exports.fetchEndpointSchemaSDL = exports._cachedTablesMeta = exports.buildSchemaSDL = void 0;
|
|
4
4
|
var build_schema_1 = require("./build-schema");
|
|
5
5
|
Object.defineProperty(exports, "buildSchemaSDL", { enumerable: true, get: function () { return build_schema_1.buildSchemaSDL; } });
|
|
6
|
+
var graphile_settings_1 = require("graphile-settings");
|
|
7
|
+
Object.defineProperty(exports, "_cachedTablesMeta", { enumerable: true, get: function () { return graphile_settings_1._cachedTablesMeta; } });
|
|
6
8
|
var fetch_endpoint_schema_1 = require("./fetch-endpoint-schema");
|
|
7
9
|
Object.defineProperty(exports, "fetchEndpointSchemaSDL", { enumerable: true, get: function () { return fetch_endpoint_schema_1.fetchEndpointSchemaSDL; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-schema",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Build GraphQL SDL from PostgreSQL databases using PostGraphile v5",
|
|
6
6
|
"main": "index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"deepmerge": "^4.3.1",
|
|
33
33
|
"graphile-build": "5.0.0-rc.6",
|
|
34
34
|
"graphile-config": "1.0.0-rc.6",
|
|
35
|
-
"graphile-settings": "^4.
|
|
35
|
+
"graphile-settings": "^4.12.0",
|
|
36
36
|
"graphql": "16.13.0",
|
|
37
37
|
"pg-cache": "^3.3.4",
|
|
38
38
|
"pg-env": "^1.7.3"
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"introspection",
|
|
51
51
|
"constructive"
|
|
52
52
|
],
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "b8d4ae2b36e37e7f3533f858f19ec000febaa04b"
|
|
54
54
|
}
|