graphile-schema 1.10.1 → 1.10.3
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 +14 -6
- package/esm/build-schema.js +11 -6
- package/package.json +6 -5
package/build-schema.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.buildSchemaSDL = buildSchemaSDL;
|
|
7
|
+
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
4
8
|
const graphql_1 = require("graphql");
|
|
5
9
|
const graphile_settings_1 = require("graphile-settings");
|
|
6
10
|
const graphile_build_1 = require("graphile-build");
|
|
@@ -15,16 +19,20 @@ async function buildSchemaSDL(opts) {
|
|
|
15
19
|
// Without this, makePgService creates its own internal pool that isn't released,
|
|
16
20
|
// causing "database has active sessions" errors during ephemeral DB teardown.
|
|
17
21
|
const pool = (0, pg_cache_1.getPgPool)(config);
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
+
// Hybrid preset composition: use deepmerge for safe scalar/object keys
|
|
23
|
+
// (plugins, disablePlugins, schema, gather, etc.) but pluck out `extends`
|
|
24
|
+
// and `pgServices` to compose them via Graphile's native mechanism.
|
|
25
|
+
// deepmerge cannot deep-clone `extends` (contains the entire PostGraphile
|
|
26
|
+
// preset tree) or `pgServices` (contains pg Pool / EventEmitter internals)
|
|
27
|
+
// without overflowing the call stack.
|
|
28
|
+
const { extends: callerExtends, pgServices: _pgServices, ...callerRest } = opts.graphile ?? {};
|
|
29
|
+
const baseRest = {};
|
|
22
30
|
const preset = {
|
|
31
|
+
...(0, deepmerge_1.default)(baseRest, callerRest),
|
|
23
32
|
extends: [
|
|
24
33
|
graphile_settings_1.ConstructivePreset,
|
|
25
|
-
...(
|
|
34
|
+
...(callerExtends ?? []),
|
|
26
35
|
],
|
|
27
|
-
plugins: opts.graphile?.plugins ?? [],
|
|
28
36
|
pgServices: [
|
|
29
37
|
(0, graphile_settings_1.makePgService)({
|
|
30
38
|
pool,
|
package/esm/build-schema.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import deepmerge from 'deepmerge';
|
|
1
2
|
import { printSchema } from 'graphql';
|
|
2
3
|
import { ConstructivePreset, makePgService } from 'graphile-settings';
|
|
3
4
|
import { makeSchema } from 'graphile-build';
|
|
@@ -12,16 +13,20 @@ export async function buildSchemaSDL(opts) {
|
|
|
12
13
|
// Without this, makePgService creates its own internal pool that isn't released,
|
|
13
14
|
// causing "database has active sessions" errors during ephemeral DB teardown.
|
|
14
15
|
const pool = getPgPool(config);
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
16
|
+
// Hybrid preset composition: use deepmerge for safe scalar/object keys
|
|
17
|
+
// (plugins, disablePlugins, schema, gather, etc.) but pluck out `extends`
|
|
18
|
+
// and `pgServices` to compose them via Graphile's native mechanism.
|
|
19
|
+
// deepmerge cannot deep-clone `extends` (contains the entire PostGraphile
|
|
20
|
+
// preset tree) or `pgServices` (contains pg Pool / EventEmitter internals)
|
|
21
|
+
// without overflowing the call stack.
|
|
22
|
+
const { extends: callerExtends, pgServices: _pgServices, ...callerRest } = opts.graphile ?? {};
|
|
23
|
+
const baseRest = {};
|
|
19
24
|
const preset = {
|
|
25
|
+
...deepmerge(baseRest, callerRest),
|
|
20
26
|
extends: [
|
|
21
27
|
ConstructivePreset,
|
|
22
|
-
...(
|
|
28
|
+
...(callerExtends ?? []),
|
|
23
29
|
],
|
|
24
|
-
plugins: opts.graphile?.plugins ?? [],
|
|
25
30
|
pgServices: [
|
|
26
31
|
makePgService({
|
|
27
32
|
pool,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-schema",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Build GraphQL SDL from PostgreSQL databases using PostGraphile v5",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
"test:watch": "jest --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"deepmerge": "^4.3.1",
|
|
32
33
|
"graphile-build": "5.0.0-rc.6",
|
|
33
34
|
"graphile-config": "1.0.0-rc.6",
|
|
34
|
-
"graphile-settings": "^4.16.
|
|
35
|
+
"graphile-settings": "^4.16.1",
|
|
35
36
|
"graphql": "16.13.0",
|
|
36
|
-
"pg-cache": "^3.4.
|
|
37
|
-
"pg-env": "^1.8.
|
|
37
|
+
"pg-cache": "^3.4.1",
|
|
38
|
+
"pg-env": "^1.8.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"makage": "^0.1.10",
|
|
@@ -49,5 +50,5 @@
|
|
|
49
50
|
"introspection",
|
|
50
51
|
"constructive"
|
|
51
52
|
],
|
|
52
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e86099de99284e17b6e99ccbe8bb1997f808cec5"
|
|
53
54
|
}
|