MCPcopy
hub / github.com/parse-community/parse-server / getPushController

Function getPushController

src/Controllers/index.js:172–208  ·  view source on GitHub ↗
(options: ParseServerOptions)

Source from the content-addressed store, hash-verified

170}
171
172export async function getPushController(options: ParseServerOptions): PushControlling {
173 const { scheduledPush, push } = options;
174
175 const pushOptions = Object.assign({}, push);
176 const pushQueueOptions = pushOptions.queueOptions || {};
177 if (pushOptions.queueOptions) {
178 delete pushOptions.queueOptions;
179 }
180
181 // Pass the push options too as it works with the default
182 const ParsePushAdapter = await loadModule('@parse/push-adapter');
183 const pushAdapter = loadAdapter(
184 pushOptions && pushOptions.adapter,
185 ParsePushAdapter,
186 pushOptions
187 );
188 // We pass the options and the base class for the adatper,
189 // Note that passing an instance would work too
190 const pushController = new PushController();
191 const hasPushSupport = !!(pushAdapter && push);
192 const hasPushScheduledSupport = hasPushSupport && scheduledPush === true;
193
194 const { disablePushWorker } = pushQueueOptions;
195
196 const pushControllerQueue = new PushQueue(pushQueueOptions);
197 let pushWorker;
198 if (!disablePushWorker) {
199 pushWorker = new PushWorker(pushAdapter, pushQueueOptions);
200 }
201 return {
202 pushController,
203 hasPushSupport,
204 hasPushScheduledSupport,
205 pushControllerQueue,
206 pushWorker,
207 };
208}
209
210export function getAuthDataManager(options: ParseServerOptions) {
211 const { auth, enableAnonymousUsers } = options;

Callers

nothing calls this directly

Calls 2

loadModuleFunction · 0.90
loadAdapterFunction · 0.90

Tested by

no test coverage detected