MCPcopy
hub / github.com/FlowiseAI/Flowise / processLoader

Function processLoader

packages/server/src/controllers/documentstore/index.ts:282–327  ·  view source on GitHub ↗
(req: Request, res: Response, next: NextFunction)

Source from the content-addressed store, hash-verified

280}
281
282const processLoader = async (req: Request, res: Response, next: NextFunction) => {
283 try {
284 if (typeof req.params.loaderId === 'undefined' || req.params.loaderId === '') {
285 throw new InternalFlowiseError(
286 StatusCodes.PRECONDITION_FAILED,
287 `Error: documentStoreController.processLoader - loaderId not provided!`
288 )
289 }
290 if (typeof req.body === 'undefined') {
291 throw new InternalFlowiseError(
292 StatusCodes.PRECONDITION_FAILED,
293 `Error: documentStoreController.processLoader - body not provided!`
294 )
295 }
296 const orgId = req.user?.activeOrganizationId
297 if (!orgId) {
298 throw new InternalFlowiseError(
299 StatusCodes.PRECONDITION_FAILED,
300 `Error: documentStoreController.createDocumentStore - organizationId not provided!`
301 )
302 }
303 const workspaceId = req.user?.activeWorkspaceId
304 if (!workspaceId) {
305 throw new InternalFlowiseError(
306 StatusCodes.PRECONDITION_FAILED,
307 `Error: documentStoreController.createDocumentStore - workspaceId not provided!`
308 )
309 }
310 const subscriptionId = req.user?.activeOrganizationSubscriptionId || ''
311 const docLoaderId = req.params.loaderId
312 const body = req.body
313 const isInternalRequest = req.headers['x-request-from'] === 'internal'
314 const apiResponse = await documentStoreService.processLoaderMiddleware(
315 body,
316 docLoaderId,
317 orgId,
318 workspaceId,
319 subscriptionId,
320 getRunningExpressApp().usageCacheManager,
321 isInternalRequest
322 )
323 return res.json(apiResponse)
324 } catch (error) {
325 next(error)
326 }
327}
328
329const updateDocumentStore = async (req: Request, res: Response, next: NextFunction) => {
330 try {

Callers

nothing calls this directly

Calls 1

getRunningExpressAppFunction · 0.90

Tested by

no test coverage detected