graphile-utils 5.0.0-beta.15 → 5.0.0-beta.17
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/CHANGELOG.md +42 -0
- package/README.md +1 -2
- package/dist/makeWrapPlansPlugin.js +21 -7
- package/dist/makeWrapPlansPlugin.js.map +1 -1
- package/package.json +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# graphile-utils
|
|
2
2
|
|
|
3
|
+
## 5.0.0-beta.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
[[`0df5511ac`](https://github.com/graphile/crystal/commit/0df5511ac8b79ea34f8d12ebf8feeb421f8fe971)]:
|
|
9
|
+
- graphile-config@0.0.1-beta.6
|
|
10
|
+
- @dataplan/pg@0.0.1-beta.14
|
|
11
|
+
- grafast@0.1.1-beta.3
|
|
12
|
+
- graphile-build@5.0.0-beta.13
|
|
13
|
+
- graphile-build-pg@5.0.0-beta.17
|
|
14
|
+
|
|
15
|
+
## 5.0.0-beta.16
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1886](https://github.com/graphile/crystal/pull/1886)
|
|
20
|
+
[`8a76db07f`](https://github.com/graphile/crystal/commit/8a76db07f4c110cecc6225504f9a05ccbcbc7b92)
|
|
21
|
+
Thanks [@benjie](https://github.com/benjie)! - Attempt to catch invalid plan
|
|
22
|
+
resolvers (e.g. those returning `undefined`) sooner.
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
[[`3fdc2bce4`](https://github.com/graphile/crystal/commit/3fdc2bce42418773f808c5b8309dfb361cd95ce9),
|
|
25
|
+
[`aeef362b5`](https://github.com/graphile/crystal/commit/aeef362b5744816f01e4a6f714bbd77f92332bc5),
|
|
26
|
+
[`8a76db07f`](https://github.com/graphile/crystal/commit/8a76db07f4c110cecc6225504f9a05ccbcbc7b92),
|
|
27
|
+
[`bce0636d4`](https://github.com/graphile/crystal/commit/bce0636d424476664672166193a181c83476423a),
|
|
28
|
+
[`f305c3278`](https://github.com/graphile/crystal/commit/f305c327848eb7baef46c5384a7cc5af6f79db8d),
|
|
29
|
+
[`3b558e0c1`](https://github.com/graphile/crystal/commit/3b558e0c110dd49e5d51e49a5ad6463a9ed68ecb),
|
|
30
|
+
[`2ae8d33aa`](https://github.com/graphile/crystal/commit/2ae8d33aa83955649dcd6e7489604b059ed2daf4),
|
|
31
|
+
[`9e1df08b7`](https://github.com/graphile/crystal/commit/9e1df08b702ae32870a8f1324bab37f447cba868),
|
|
32
|
+
[`8a0cdb95f`](https://github.com/graphile/crystal/commit/8a0cdb95f200b28b0ea1ab5caa12b23dce5f374f),
|
|
33
|
+
[`dbd91fdd8`](https://github.com/graphile/crystal/commit/dbd91fdd836f041b6e2ff9d358c6a6f521f43914),
|
|
34
|
+
[`f1d5ad18e`](https://github.com/graphile/crystal/commit/f1d5ad18e1cd0d59b9e74f619ec6b0de57f07b17),
|
|
35
|
+
[`c66c3527c`](https://github.com/graphile/crystal/commit/c66c3527ce2bb38afa37242ecb5a22247efd6db9),
|
|
36
|
+
[`f66cc40b3`](https://github.com/graphile/crystal/commit/f66cc40b3bc5bf2e7f92fe5a6bd5638e2a51ac2b),
|
|
37
|
+
[`f18635a5c`](https://github.com/graphile/crystal/commit/f18635a5cf55845c9534d82bb483e5fbb9ed179e),
|
|
38
|
+
[`1c9f1c0ed`](https://github.com/graphile/crystal/commit/1c9f1c0edf4e621a5b6345d3a41527a18143c6ae),
|
|
39
|
+
[`9fb5cc06e`](https://github.com/graphile/crystal/commit/9fb5cc06ee52165378392969172e6ee8128833f6)]:
|
|
40
|
+
- grafast@0.1.1-beta.2
|
|
41
|
+
- graphile-build-pg@5.0.0-beta.16
|
|
42
|
+
- graphile-build@5.0.0-beta.12
|
|
43
|
+
- graphile-config@0.0.1-beta.5
|
|
44
|
+
|
|
3
45
|
## 5.0.0-beta.15
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -33,9 +33,8 @@ And please give some love to our featured sponsors 🤩:
|
|
|
33
33
|
<td align="center"><a href="https://www.the-guild.dev/"><img src="https://graphile.org/images/sponsors/theguild.png" width="90" height="90" alt="The Guild" /><br />The Guild</a> *</td>
|
|
34
34
|
<td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
|
|
35
35
|
<td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
|
|
36
|
-
<td align="center"><a href=""><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
|
|
37
|
-
</tr><tr>
|
|
38
36
|
<td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>
|
|
37
|
+
</tr><tr>
|
|
39
38
|
<td align="center"><a href="https://www.accenture.com/"><img src="https://graphile.org/images/sponsors/accenture.svg" width="90" height="90" alt="Accenture" /><br />Accenture</a> *</td>
|
|
40
39
|
<td align="center"><a href="https://microteam.io/"><img src="https://graphile.org/images/sponsors/micro.png" width="90" height="90" alt="We Love Micro" /><br />We Love Micro</a> *</td>
|
|
41
40
|
</tr></table>
|
|
@@ -31,7 +31,7 @@ function makeWrapPlansPlugin(rulesOrGeneratorOrFilter, rule) {
|
|
|
31
31
|
},
|
|
32
32
|
GraphQLObjectType_fields_field(field, build, context) {
|
|
33
33
|
const rules = build[symbol].rules;
|
|
34
|
-
const { access, ExecutableStep } = build
|
|
34
|
+
const { EXPORTABLE, grafast: { access, ExecutableStep, isExecutableStep }, } = build;
|
|
35
35
|
const filter = build[symbol]
|
|
36
36
|
.filter;
|
|
37
37
|
const { Self, scope: { fieldName }, } = context;
|
|
@@ -67,26 +67,40 @@ function makeWrapPlansPlugin(rulesOrGeneratorOrFilter, rule) {
|
|
|
67
67
|
if (!planWrapper) {
|
|
68
68
|
return field;
|
|
69
69
|
}
|
|
70
|
-
const {
|
|
70
|
+
const { plan: oldPlan = EXPORTABLE((access, fieldName) =>
|
|
71
71
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
72
|
-
|
|
72
|
+
($obj) => access($obj, fieldName), [access, fieldName]), } = field;
|
|
73
73
|
return {
|
|
74
74
|
...field,
|
|
75
|
-
plan(...planParams) {
|
|
75
|
+
plan: EXPORTABLE((ExecutableStep, field, inspect, isExecutableStep, oldPlan, planWrapper) => (...planParams) => {
|
|
76
76
|
// A replacement for `oldPlan` that automatically passes through arguments that weren't replaced
|
|
77
77
|
const smartPlan = (...overrideParams) => {
|
|
78
78
|
const $prev = oldPlan(
|
|
79
79
|
// @ts-ignore We're calling it dynamically, allowing the parent to override args.
|
|
80
80
|
...overrideParams.concat(planParams.slice(overrideParams.length)));
|
|
81
81
|
if (!($prev instanceof ExecutableStep)) {
|
|
82
|
-
console.error(`Wrapped a plan function, but that function did not return a step!\n${String(oldPlan)}\n${
|
|
82
|
+
console.error(`Wrapped a plan function, but that function did not return a step!\n${String(oldPlan)}\n${inspect(field)}`);
|
|
83
83
|
throw new Error("Wrapped a plan function, but that function did not return a step!");
|
|
84
84
|
}
|
|
85
85
|
return $prev;
|
|
86
86
|
};
|
|
87
87
|
const [$source, fieldArgs, info] = planParams;
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const $newPlan = planWrapper(smartPlan, $source, fieldArgs, info);
|
|
89
|
+
if ($newPlan === undefined) {
|
|
90
|
+
throw new Error("Your plan wrapper didn't return anything; it must return a step or null!");
|
|
91
|
+
}
|
|
92
|
+
if ($newPlan !== null && !isExecutableStep($newPlan)) {
|
|
93
|
+
throw new Error(`Your plan wrapper returned something other than a step... It must return a step (or null). (Returned: ${inspect($newPlan)})`);
|
|
94
|
+
}
|
|
95
|
+
return $newPlan;
|
|
96
|
+
}, [
|
|
97
|
+
ExecutableStep,
|
|
98
|
+
field,
|
|
99
|
+
node_util_1.inspect,
|
|
100
|
+
isExecutableStep,
|
|
101
|
+
oldPlan,
|
|
102
|
+
planWrapper,
|
|
103
|
+
]),
|
|
90
104
|
};
|
|
91
105
|
},
|
|
92
106
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeWrapPlansPlugin.js","sourceRoot":"","sources":["../src/makeWrapPlansPlugin.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAgDpC,IAAI,OAAO,GAAG,CAAC,CAAC;AAShB,SAAgB,mBAAmB,CACjC,wBAGwB,EACxB,IAA+B;IAE/B,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;QACtC,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;KACH;IACD,MAAM,IAAI,GAAG,mBAAmB,EAAE,OAAO,EAAE,CAAC;IAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,KAAK,CAAC,KAAK;oBACT,8BAA8B;oBAC9B,MAAM,gBAAgB,GAGX,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,wBAAgC,CAAC;oBAC3D,MAAM,MAAM,GAAgC,IAAI;wBAC9C,CAAC,CAAE,wBAAgC;wBACnC,CAAC,CAAC,IAAI,CAAC;oBAET,MAAM,KAAK,GACT,OAAO,gBAAgB,KAAK,UAAU;wBACpC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC;wBACzB,CAAC,CAAC,gBAAgB,CAAC;oBACtB,KAAa,CAAC,MAAM,CAAC,GAAG;wBACvB,KAAK;wBACL,MAAM;qBACP,CAAC;oBACF,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,8BAA8B,CA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CACb,yGAAyG,OAAO,CAC9G,QAAQ,CACT,GAAG,CACL,CAAC;6BACH;4BACD,OAAO,QAAQ,CAAC;wBAClB,CAAC,EACH;4BACE,cAAc;4BACd,KAAK;4BACL,mBAAO;4BACP,gBAAgB;4BAChB,OAAO;4BACP,WAAW;yBACZ,CACF;qBACF,CAAC;gBACJ,CAAC;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAnKD,kDAmKC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-utils",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.17",
|
|
4
4
|
"description": "Utilities to help with building graphile-build plugins",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,25 +46,29 @@
|
|
|
46
46
|
"node": ">=14.17"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"graphile-build
|
|
52
|
-
"graphile-
|
|
49
|
+
"@dataplan/pg": "^0.0.1-beta.14",
|
|
50
|
+
"grafast": "^0.1.1-beta.3",
|
|
51
|
+
"graphile-build": "^5.0.0-beta.13",
|
|
52
|
+
"graphile-build-pg": "^5.0.0-beta.17",
|
|
53
|
+
"graphile-config": "^0.0.1-beta.6",
|
|
53
54
|
"graphql": "^16.1.0-experimental-stream-defer.6",
|
|
54
55
|
"tamedevil": "^0.0.0-beta.3"
|
|
55
56
|
},
|
|
56
57
|
"peerDependenciesMeta": {
|
|
58
|
+
"@dataplan/pg": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
57
61
|
"graphile-build-pg": {
|
|
58
62
|
"optional": true
|
|
59
63
|
}
|
|
60
64
|
},
|
|
61
65
|
"devDependencies": {
|
|
62
|
-
"graphile-build": "^5.0.0-beta.
|
|
63
|
-
"graphile-build-pg": "^5.0.0-beta.
|
|
66
|
+
"graphile-build": "^5.0.0-beta.13",
|
|
67
|
+
"graphile-build-pg": "^5.0.0-beta.17",
|
|
64
68
|
"jest": "^29.6.4",
|
|
65
69
|
"jest-serializer-graphql-schema": "^5.0.0-beta.3",
|
|
66
70
|
"nodemon": "^3.0.1",
|
|
67
|
-
"postgraphile": "^5.0.0-beta.
|
|
71
|
+
"postgraphile": "^5.0.0-beta.18",
|
|
68
72
|
"ts-node": "^10.9.1",
|
|
69
73
|
"typescript": "^5.2.2"
|
|
70
74
|
},
|