MCPcopy Index your code
hub / github.com/parse-community/parse-server / extractKeysAndInclude

Function extractKeysAndInclude

src/GraphQL/parseGraphQLUtils.js:27–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27export const extractKeysAndInclude = selectedFields => {
28 selectedFields = selectedFields.filter(field => !field.includes('__typename'));
29 // Handles "id" field for both current and included objects
30 selectedFields = selectedFields.map(field => {
31 if (field === 'id') { return 'objectId'; }
32 return field.endsWith('.id')
33 ? `${field.substring(0, field.lastIndexOf('.id'))}.objectId`
34 : field;
35 });
36 let keys = undefined;
37 let include = undefined;
38
39 if (selectedFields.length > 0) {
40 keys = [...new Set(selectedFields)].join(',');
41 // We can use this shortcut since optimization is handled
42 // later on RestQuery, avoid overhead here.
43 include = keys;
44 }
45
46 return {
47 // If authData is detected keys will not work properly
48 // since authData has a special storage behavior
49 // so we need to skip keys currently
50 keys: keys && keys.indexOf('authData') === -1 ? keys : undefined,
51 include,
52 };
53};
54
55export const getParseClassMutationConfig = function (parseClassConfig) {
56 return (parseClassConfig && parseClassConfig.mutation) || {};

Callers 6

getQueryFunction · 0.90
resolveFunction · 0.90
loadFunction · 0.90
resolveFunction · 0.90
loadFunction · 0.85
getUserFromSessionTokenFunction · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected