Excluding keys that have trailing "edges.node" on them (#7273)
* Excluding keys that have trailing "edges.node" on them as they will not be selectable anyway * Updated CHANGELOG and added test case * Forgot to change fit back to it
This commit is contained in:
@@ -118,6 +118,7 @@ ___
|
|||||||
- Randomize test suite (Diamond Lewis) [#7265](https://github.com/parse-community/parse-server/pull/7265)
|
- Randomize test suite (Diamond Lewis) [#7265](https://github.com/parse-community/parse-server/pull/7265)
|
||||||
- LDAP: Properly unbind client on group search error (Diamond Lewis) [#7265](https://github.com/parse-community/parse-server/pull/7265)
|
- LDAP: Properly unbind client on group search error (Diamond Lewis) [#7265](https://github.com/parse-community/parse-server/pull/7265)
|
||||||
- Improve data consistency in Push and Job Status update (Diamond Lewis) [#7267](https://github.com/parse-community/parse-server/pull/7267)
|
- Improve data consistency in Push and Job Status update (Diamond Lewis) [#7267](https://github.com/parse-community/parse-server/pull/7267)
|
||||||
|
- Excluding keys that have trailing edges.node when performing GraphQL resolver (Chris Bland) [#7273](https://github.com/parse-community/parse-server/pull/7273)
|
||||||
___
|
___
|
||||||
## 4.5.0
|
## 4.5.0
|
||||||
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.4.0...4.5.0)
|
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.4.0...4.5.0)
|
||||||
|
|||||||
@@ -5703,6 +5703,67 @@ describe('ParseGraphQLServer', () => {
|
|||||||
result.data.parentClass.graphQLClasses.edges.map(edge => edge.node.objectId)
|
result.data.parentClass.graphQLClasses.edges.map(edge => edge.node.objectId)
|
||||||
).toEqual([object3.id, object1.id, object2.id]);
|
).toEqual([object3.id, object1.id, object2.id]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should support including relation', async () => {
|
||||||
|
await prepareData();
|
||||||
|
|
||||||
|
await parseGraphQLServer.parseGraphQLSchema.schemaCache.clear();
|
||||||
|
|
||||||
|
const result1 = await apolloClient.query({
|
||||||
|
query: gql`
|
||||||
|
query FindRoles {
|
||||||
|
roles {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
variables: {},
|
||||||
|
context: {
|
||||||
|
headers: {
|
||||||
|
'X-Parse-Session-Token': user1.getSessionToken(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const result2 = await apolloClient.query({
|
||||||
|
query: gql`
|
||||||
|
query FindRoles {
|
||||||
|
roles {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
name
|
||||||
|
users {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
username
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
variables: {},
|
||||||
|
context: {
|
||||||
|
headers: {
|
||||||
|
'X-Parse-Session-Token': user1.getSessionToken(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result1.data.roles.edges[0].node.name).toBeDefined();
|
||||||
|
expect(result1.data.roles.edges[0].node.users).toBeUndefined();
|
||||||
|
expect(result1.data.roles.edges[0].node.roles).toBeUndefined();
|
||||||
|
expect(result2.data.roles.edges[0].node.name).toBeDefined();
|
||||||
|
expect(result2.data.roles.edges[0].node.users).toBeDefined();
|
||||||
|
expect(result2.data.roles.edges[0].node.users.edges[0].node.username).toBeDefined();
|
||||||
|
expect(result2.data.roles.edges[0].node.roles).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ const load = function (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseG
|
|||||||
selectedFields
|
selectedFields
|
||||||
.filter(field => field.startsWith('edges.node.'))
|
.filter(field => field.startsWith('edges.node.'))
|
||||||
.map(field => field.replace('edges.node.', ''))
|
.map(field => field.replace('edges.node.', ''))
|
||||||
|
.filter(field => field.indexOf('edges.node') < 0)
|
||||||
);
|
);
|
||||||
const parseOrder = order && order.join(',');
|
const parseOrder = order && order.join(',');
|
||||||
|
|
||||||
|
|||||||
@@ -382,6 +382,7 @@ const load = (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseGraphQLCla
|
|||||||
selectedFields
|
selectedFields
|
||||||
.filter(field => field.startsWith('edges.node.'))
|
.filter(field => field.startsWith('edges.node.'))
|
||||||
.map(field => field.replace('edges.node.', ''))
|
.map(field => field.replace('edges.node.', ''))
|
||||||
|
.filter(field => field.indexOf('edges.node') < 0)
|
||||||
);
|
);
|
||||||
const parseOrder = order && order.join(',');
|
const parseOrder = order && order.join(',');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user