graphile-test 5.19.5 → 5.19.7
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/context.js +6 -0
- package/esm/context.js +7 -1
- package/package.json +3 -3
package/context.js
CHANGED
|
@@ -158,6 +158,12 @@ const runGraphQLInContext = async ({ input, conn, schema, resolvedPreset, pgServ
|
|
|
158
158
|
const source = (0, graphql_1.print)(query);
|
|
159
159
|
document = (0, graphql_1.parse)(source);
|
|
160
160
|
}
|
|
161
|
+
// grafserv validates before it plans; grafast's execute() alone does not,
|
|
162
|
+
// so without this a test could pass a document the server would reject.
|
|
163
|
+
const validationErrors = (0, graphql_1.validate)(schema, document);
|
|
164
|
+
if (validationErrors.length > 0) {
|
|
165
|
+
return normalizeResult({ errors: validationErrors }, document);
|
|
166
|
+
}
|
|
161
167
|
// Build context with pgSettings and withPgClient
|
|
162
168
|
// This is the v5 pattern used by executor.ts and api.ts
|
|
163
169
|
const contextValue = {
|
package/esm/context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execute } from 'grafast';
|
|
2
|
-
import { Kind, parse, print } from 'graphql';
|
|
2
|
+
import { Kind, parse, print, validate } from 'graphql';
|
|
3
3
|
/**
|
|
4
4
|
* Find a field node in the document by following the path.
|
|
5
5
|
* This is used to derive locations when grafast doesn't provide them.
|
|
@@ -154,6 +154,12 @@ export const runGraphQLInContext = async ({ input, conn, schema, resolvedPreset,
|
|
|
154
154
|
const source = print(query);
|
|
155
155
|
document = parse(source);
|
|
156
156
|
}
|
|
157
|
+
// grafserv validates before it plans; grafast's execute() alone does not,
|
|
158
|
+
// so without this a test could pass a document the server would reject.
|
|
159
|
+
const validationErrors = validate(schema, document);
|
|
160
|
+
if (validationErrors.length > 0) {
|
|
161
|
+
return normalizeResult({ errors: validationErrors }, document);
|
|
162
|
+
}
|
|
157
163
|
// Build context with pgSettings and withPgClient
|
|
158
164
|
// This is the v5 pattern used by executor.ts and api.ts
|
|
159
165
|
const contextValue = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-test",
|
|
3
|
-
"version": "5.19.
|
|
3
|
+
"version": "5.19.7",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PostGraphile Testing",
|
|
6
6
|
"main": "index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"graphql": "16.13.0",
|
|
45
45
|
"mock-req": "^0.2.0",
|
|
46
46
|
"pg": "^8.21.0",
|
|
47
|
-
"pgsql-test": "^5.20.
|
|
47
|
+
"pgsql-test": "^5.20.6",
|
|
48
48
|
"postgraphile": "5.1.4"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"pgpm",
|
|
56
56
|
"test"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "f1f197863b6fd5f691cfc650dc1698fbcc5968ff"
|
|
59
59
|
}
|