Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
method = p[0].toLowerCase();
routePath = p[1];
delete def.$path;
}
_.set(res.paths, [routePath, method], def);
}
}
});
});
return res;
} catch(err) {
throw new MoleculerServerError("Unable to compile OpenAPI schema", 500, "UNABLE_COMPILE_OPENAPI_SCHEMA", { err });
}
}
},
if (route.logging)
this.logger.info(` Call custom function in '${alias.toString()}' alias`);
await new this.Promise((resolve, reject) => {
alias.handler.call(this, req, res, err => {
if (err)
reject(err);
else
resolve();
});
});
if (alias.action)
return this.callAction(route, alias.action, req, res, alias.type == "stream" ? req : req.$params);
else
throw new MoleculerServerError("No alias handler", 500, "NO_ALIAS_HANDLER", { path: req.originalUrl, alias: _.pick(alias, ["method", "path"]) });
} else if (alias.action) {
return this.callAction(route, alias.action, req, res, alias.type == "stream" ? req : req.$params);
}
},
if (mutations.length > 0) {
str += `
type Mutation {
${mutations.join("\n")}
}
`;
}
typeDefs.push(str);
}
return makeExecutableSchema({ typeDefs, resolvers });
} catch(err) {
throw new MoleculerServerError("Unable to compile GraphQL schema", 500, "UNABLE_COMPILE_GRAPHQL_SCHEMA", { err });
}
}
},
${enums.join("\n")}
`;
}
if (inputs.length > 0) {
str += `
${inputs.join("\n")}
`;
}
typeDefs.push(str);
}
return makeExecutableSchema({ typeDefs, resolvers, schemaDirectives });
} catch (err) {
throw new MoleculerServerError(
"Unable to compile GraphQL schema",
500,
"UNABLE_COMPILE_GRAPHQL_SCHEMA",
{ err }
);
}
},