graphile-utils 5.0.0-beta.2 → 5.0.0-beta.21
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 +362 -0
- package/README.md +6 -7
- package/dist/exportable.d.ts +1 -1
- package/dist/exportable.d.ts.map +1 -1
- package/dist/exportable.js +2 -1
- package/dist/exportable.js.map +1 -1
- package/dist/makeAddInflectorsPlugin.js +1 -1
- package/dist/makeAddPgTableOrderByPlugin.d.ts +6 -0
- package/dist/makeAddPgTableOrderByPlugin.d.ts.map +1 -1
- package/dist/makeAddPgTableOrderByPlugin.js +15 -9
- package/dist/makeAddPgTableOrderByPlugin.js.map +1 -1
- package/dist/makeChangeNullabilityPlugin.js.map +1 -1
- package/dist/makeExtendSchemaPlugin.d.ts +25 -8
- package/dist/makeExtendSchemaPlugin.d.ts.map +1 -1
- package/dist/makeExtendSchemaPlugin.js +113 -43
- package/dist/makeExtendSchemaPlugin.js.map +1 -1
- package/dist/makePgSmartTagsPlugin.d.ts.map +1 -1
- package/dist/makePgSmartTagsPlugin.js +2 -2
- package/dist/makePgSmartTagsPlugin.js.map +1 -1
- package/dist/makeWrapPlansPlugin.d.ts.map +1 -1
- package/dist/makeWrapPlansPlugin.js +21 -7
- package/dist/makeWrapPlansPlugin.js.map +1 -1
- package/package.json +23 -20
|
@@ -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":";;;
|
|
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,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BACH;4BACD,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE;gCACpD,MAAM,IAAI,KAAK,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.21",
|
|
4
4
|
"description": "Utilities to help with building graphile-build plugins",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"test": "jest -i",
|
|
16
|
-
"prepack": "tsc -b"
|
|
17
|
-
"watch": "mkdir -p node8plus && tsc --watch"
|
|
16
|
+
"prepack": "tsc -b tsconfig.build.json"
|
|
18
17
|
},
|
|
19
18
|
"repository": {
|
|
20
19
|
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/graphile/
|
|
20
|
+
"url": "git+https://github.com/graphile/crystal.git"
|
|
22
21
|
},
|
|
23
22
|
"keywords": [
|
|
24
23
|
"graphile",
|
|
@@ -34,39 +33,43 @@
|
|
|
34
33
|
"author": "Benjie Gillam <code@benjiegillam.com>",
|
|
35
34
|
"license": "MIT",
|
|
36
35
|
"bugs": {
|
|
37
|
-
"url": "https://github.com/graphile/
|
|
36
|
+
"url": "https://github.com/graphile/crystal/issues"
|
|
38
37
|
},
|
|
39
|
-
"homepage": "https://github.com/graphile/
|
|
38
|
+
"homepage": "https://github.com/graphile/crystal/tree/main/graphile-build/graphile-utils",
|
|
40
39
|
"dependencies": {
|
|
41
|
-
"debug": "^4.
|
|
40
|
+
"debug": "^4.3.4",
|
|
42
41
|
"json5": "^2.2.3",
|
|
43
|
-
"tslib": "^2.
|
|
42
|
+
"tslib": "^2.6.2"
|
|
44
43
|
},
|
|
45
44
|
"engines": {
|
|
46
45
|
"node": ">=14.17"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"graphile-build
|
|
52
|
-
"graphile-
|
|
48
|
+
"@dataplan/pg": "^0.0.1-beta.18",
|
|
49
|
+
"grafast": "^0.1.1-beta.7",
|
|
50
|
+
"graphile-build": "^5.0.0-beta.17",
|
|
51
|
+
"graphile-build-pg": "^5.0.0-beta.21",
|
|
52
|
+
"graphile-config": "^0.0.1-beta.8",
|
|
53
53
|
"graphql": "^16.1.0-experimental-stream-defer.6",
|
|
54
|
-
"tamedevil": "^0.0.0-beta.
|
|
54
|
+
"tamedevil": "^0.0.0-beta.7"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
|
+
"@dataplan/pg": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
57
60
|
"graphile-build-pg": {
|
|
58
61
|
"optional": true
|
|
59
62
|
}
|
|
60
63
|
},
|
|
61
64
|
"devDependencies": {
|
|
62
|
-
"graphile-build": "^5.0.0-beta.
|
|
63
|
-
"graphile-build-pg": "^5.0.0-beta.
|
|
64
|
-
"jest": "^
|
|
65
|
-
"jest-serializer-graphql-schema": "^5.0.0-beta.
|
|
66
|
-
"nodemon": "^
|
|
67
|
-
"postgraphile": "^5.0.0-beta.
|
|
65
|
+
"graphile-build": "^5.0.0-beta.17",
|
|
66
|
+
"graphile-build-pg": "^5.0.0-beta.21",
|
|
67
|
+
"jest": "^29.6.4",
|
|
68
|
+
"jest-serializer-graphql-schema": "^5.0.0-beta.3",
|
|
69
|
+
"nodemon": "^3.0.1",
|
|
70
|
+
"postgraphile": "^5.0.0-beta.22",
|
|
68
71
|
"ts-node": "^10.9.1",
|
|
69
|
-
"typescript": "^5.
|
|
72
|
+
"typescript": "^5.2.2"
|
|
70
73
|
},
|
|
71
74
|
"files": [
|
|
72
75
|
"dist",
|