MCPcopy Create free account
hub / github.com/parse-community/parse-server / load

Method load

src/GraphQL/ParseGraphQLSchema.js:96–301  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94 }
95
96 async load() {
97 const { parseGraphQLConfig } = await this._initializeSchemaAndConfig();
98 const parseClassesArray = await this._getClassesForSchema(parseGraphQLConfig);
99 const functionNames = await this._getFunctionNames();
100 const functionNamesString = functionNames.join();
101
102 const parseClasses = parseClassesArray.reduce((acc, clazz) => {
103 acc[clazz.className] = clazz;
104 return acc;
105 }, {});
106 if (
107 !this._hasSchemaInputChanged({
108 parseClasses,
109 parseGraphQLConfig,
110 functionNamesString,
111 })
112 ) {
113 return this.graphQLSchema;
114 }
115
116 this.parseClasses = parseClasses;
117 this.parseGraphQLConfig = parseGraphQLConfig;
118 this.functionNames = functionNames;
119 this.functionNamesString = functionNamesString;
120 this.parseClassTypes = {};
121 this.viewerType = null;
122 this.cloudConfigType = null;
123 this.graphQLAutoSchema = null;
124 this.graphQLSchema = null;
125 this.graphQLTypes = [];
126 this.graphQLQueries = {};
127 this.graphQLMutations = {};
128 this.graphQLSubscriptions = {};
129 this.graphQLSchemaDirectivesDefinitions = null;
130 this.graphQLSchemaDirectives = {};
131 this.relayNodeInterface = null;
132
133 defaultGraphQLTypes.load(this);
134 defaultRelaySchema.load(this);
135 schemaTypes.load(this);
136
137 this._getParseClassesWithConfig(parseClassesArray, parseGraphQLConfig).forEach(
138 ([parseClass, parseClassConfig]) => {
139 // Some times schema return the _auth_data_ field
140 // it will lead to unstable graphql generation order
141 if (parseClass.className === '_User') {
142 Object.keys(parseClass.fields).forEach(fieldName => {
143 if (fieldName.startsWith('_auth_data_')) {
144 delete parseClass.fields[fieldName];
145 }
146 });
147 }
148
149 // Fields order inside the schema seems to not be consistent across
150 // restart so we need to ensure an alphabetical order
151 // also it's better for the playground documentation
152 const orderedFields = {};
153 Object.keys(parseClass.fields)

Callers 4

_getGraphQLOptionsMethod · 0.45
_getServerMethod · 0.45
loadFunction · 0.45
loadFunction · 0.45

Calls 6

_getClassesForSchemaMethod · 0.95
_getFunctionNamesMethod · 0.95
addGraphQLTypeMethod · 0.95

Tested by

no test coverage detected