graphile-schema 1.10.0 → 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 CHANGED
@@ -19,8 +19,20 @@ async function buildSchemaSDL(opts) {
19
19
  // Without this, makePgService creates its own internal pool that isn't released,
20
20
  // causing "database has active sessions" errors during ephemeral DB teardown.
21
21
  const pool = (0, pg_cache_1.getPgPool)(config);
22
- const basePreset = {
23
- extends: [graphile_settings_1.ConstructivePreset],
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 = {};
30
+ const preset = {
31
+ ...(0, deepmerge_1.default)(baseRest, callerRest),
32
+ extends: [
33
+ graphile_settings_1.ConstructivePreset,
34
+ ...(callerExtends ?? []),
35
+ ],
24
36
  pgServices: [
25
37
  (0, graphile_settings_1.makePgService)({
26
38
  pool,
@@ -28,9 +40,6 @@ async function buildSchemaSDL(opts) {
28
40
  }),
29
41
  ],
30
42
  };
31
- const preset = opts.graphile
32
- ? (0, deepmerge_1.default)(basePreset, opts.graphile)
33
- : basePreset;
34
43
  const { schema } = await (0, graphile_build_1.makeSchema)(preset);
35
44
  return (0, graphql_1.printSchema)(schema);
36
45
  }
@@ -13,8 +13,20 @@ export async function buildSchemaSDL(opts) {
13
13
  // Without this, makePgService creates its own internal pool that isn't released,
14
14
  // causing "database has active sessions" errors during ephemeral DB teardown.
15
15
  const pool = getPgPool(config);
16
- const basePreset = {
17
- extends: [ConstructivePreset],
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 = {};
24
+ const preset = {
25
+ ...deepmerge(baseRest, callerRest),
26
+ extends: [
27
+ ConstructivePreset,
28
+ ...(callerExtends ?? []),
29
+ ],
18
30
  pgServices: [
19
31
  makePgService({
20
32
  pool,
@@ -22,9 +34,6 @@ export async function buildSchemaSDL(opts) {
22
34
  }),
23
35
  ],
24
36
  };
25
- const preset = opts.graphile
26
- ? deepmerge(basePreset, opts.graphile)
27
- : basePreset;
28
37
  const { schema } = await makeSchema(preset);
29
38
  return printSchema(schema);
30
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-schema",
3
- "version": "1.10.0",
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",
@@ -32,10 +32,10 @@
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.16.0",
35
+ "graphile-settings": "^4.16.1",
36
36
  "graphql": "16.13.0",
37
- "pg-cache": "^3.4.0",
38
- "pg-env": "^1.8.0"
37
+ "pg-cache": "^3.4.1",
38
+ "pg-env": "^1.8.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "makage": "^0.1.10",
@@ -50,5 +50,5 @@
50
50
  "introspection",
51
51
  "constructive"
52
52
  ],
53
- "gitHead": "b8ed57a447cd71b93094edf362e72b94801e5f3a"
53
+ "gitHead": "e86099de99284e17b6e99ccbe8bb1997f808cec5"
54
54
  }