Package Exports
- graphile-query
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graphile-query) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
graphile-query
npm install graphile-queryusage
Use as a particular role, skipping any auth logic
const results = await client.query({
role: 'postgres',
query,
variables
});Or pass a request object to be evaluated based on logic
const results = await client.query({
req: { something: { special: 'e90829ef-1da4-448d-3e44-b3d275702b86' } },
query: MyGraphQLQuery,
variables
});initialization
import { GraphileQuery, getSchema } from 'graphile-query';
// get the pg pool
const pool = getRootPgPool();
// get Graphile Settings
const settings = getGraphileSettings({
schema: [SCHEMA_NAME],
pgSettings (req) {
// custom logic for requests
return { role: 'public' };
}
});
// get schema
const schema = await getSchema(pool, settings);
// initialize client
const client = new GraphileQuery({ schema, pool, settings });