@strapi/plugin-graphql 4.1.1 → 4.2.0-alpha.O
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-graphql",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0-alpha.O",
|
|
4
4
|
"description": "Adds GraphQL endpoint with default API methods.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@apollo/federation": "^0.28.0",
|
|
31
31
|
"@graphql-tools/schema": "8.1.2",
|
|
32
32
|
"@graphql-tools/utils": "^8.0.2",
|
|
33
|
-
"@strapi/utils": "4.
|
|
33
|
+
"@strapi/utils": "4.2.0-alpha.O",
|
|
34
34
|
"apollo-server-core": "3.1.2",
|
|
35
35
|
"apollo-server-koa": "3.1.2",
|
|
36
36
|
"glob": "^7.1.7",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"description": "Adds GraphQL endpoint with default API methods.",
|
|
65
65
|
"kind": "plugin"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "0e1f1ae08565a5f2427753582f37645a43c00cb2"
|
|
68
68
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { enumType } = require('nexus');
|
|
4
4
|
const { set } = require('lodash/fp');
|
|
5
|
+
const { toRegressedEnumValue } = require('@strapi/utils');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Build a Nexus enum type from a Strapi enum attribute
|
|
@@ -13,9 +14,10 @@ const { set } = require('lodash/fp');
|
|
|
13
14
|
const buildEnumTypeDefinition = (definition, name) => {
|
|
14
15
|
return enumType({
|
|
15
16
|
name,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
members: definition.enum.reduce(
|
|
18
|
+
(acc, value) => set(toRegressedEnumValue(value), value, acc),
|
|
19
|
+
{}
|
|
20
|
+
),
|
|
19
21
|
});
|
|
20
22
|
};
|
|
21
23
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { GraphQLDate } = require('graphql-iso-date/dist');
|
|
4
|
+
|
|
5
|
+
const parseAndCast = parseFn => (...args) => {
|
|
6
|
+
const parsedValue = parseFn(...args);
|
|
7
|
+
|
|
8
|
+
if (parsedValue instanceof Date) {
|
|
9
|
+
return parsedValue.toISOString().split('T')[0];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return parsedValue;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// GraphQLDate casts the date string to new Date, we want to keep it as a string so we cast it back to a string
|
|
16
|
+
// see https://github.com/excitement-engineer/graphql-iso-date/issues/106
|
|
17
|
+
GraphQLDate.parseValue = parseAndCast(GraphQLDate.parseValue);
|
|
18
|
+
GraphQLDate.parseLiteral = parseAndCast(GraphQLDate.parseLiteral);
|
|
19
|
+
|
|
20
|
+
module.exports = GraphQLDate;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const GraphQLJSON = require('graphql-type-json');
|
|
4
4
|
const GraphQLLong = require('graphql-type-long');
|
|
5
|
-
const { GraphQLDateTime
|
|
5
|
+
const { GraphQLDateTime } = require('graphql-iso-date/dist');
|
|
6
6
|
const { GraphQLUpload } = require('graphql-upload');
|
|
7
7
|
const { asNexusMethod } = require('nexus');
|
|
8
8
|
|
|
9
9
|
const TimeScalar = require('./time');
|
|
10
|
+
const GraphQLDate = require('./date');
|
|
10
11
|
|
|
11
12
|
module.exports = () => ({
|
|
12
13
|
JSON: asNexusMethod(GraphQLJSON, 'json'),
|