GraphQL: Allow true GraphQL Schema Customization (#6360)

* Allow real GraphQL Schema via ParseServer.start

* wip

* working

* tests ok

* add tests about enum/input use case

* Add async function based merge

* Better naming

* remove useless condition
This commit is contained in:
Antoine Cormouls
2020-02-22 00:12:49 +01:00
committed by GitHub
parent d4690ca425
commit c7f96c92cd
8 changed files with 411 additions and 141 deletions

View File

@@ -112,8 +112,12 @@ const load = function(
include,
['id', 'objectId', 'createdAt', 'updatedAt']
);
const needToGetAllKeys = objectsQueries.needToGetAllKeys(
parseClass.fields,
keys
);
let optimizedObject = {};
if (needGet) {
if (needGet && !needToGetAllKeys) {
optimizedObject = await objectsQueries.getObject(
className,
createdObject.objectId,
@@ -123,7 +127,21 @@ const load = function(
undefined,
config,
auth,
info
info,
parseClass
);
} else if (needToGetAllKeys) {
optimizedObject = await objectsQueries.getObject(
className,
createdObject.objectId,
undefined,
include,
undefined,
undefined,
config,
auth,
info,
parseClass
);
}
return {
@@ -212,9 +230,12 @@ const load = function(
include,
['id', 'objectId', 'updatedAt']
);
const needToGetAllKeys = objectsQueries.needToGetAllKeys(
parseClass.fields,
keys
);
let optimizedObject = {};
if (needGet) {
if (needGet && !needToGetAllKeys) {
optimizedObject = await objectsQueries.getObject(
className,
id,
@@ -224,7 +245,21 @@ const load = function(
undefined,
config,
auth,
info
info,
parseClass
);
} else if (needToGetAllKeys) {
optimizedObject = await objectsQueries.getObject(
className,
id,
undefined,
include,
undefined,
undefined,
config,
auth,
info,
parseClass
);
}
return {
@@ -301,7 +336,8 @@ const load = function(
undefined,
config,
auth,
info
info,
parseClass
);
}
await objectsMutations.deleteObject(