postgraphile
Version:
Automatic, high performance, and highly customizable GraphQL API for PostgreSQL
96 lines • 4.24 kB
TypeScript
import "../index.ts";
import type { GraphQLError } from "grafast/graphql";
import type { IncomingMessage, ServerResponse } from "http";
import { PgV4BehaviorPlugin } from "../plugins/PgV4BehaviorPlugin.ts";
import { PgV4BuildPlugin } from "../plugins/PgV4BuildPlugin.ts";
import { PgV4InflectionPlugin } from "../plugins/PgV4InflectionPlugin.ts";
import { PgV4SimpleSubscriptionsPlugin } from "../plugins/PgV4SimpleSubscriptionsPlugin.ts";
import { PgV4SmartTagsPlugin } from "../plugins/PgV4SmartTagsPlugin.ts";
export { PgV4BehaviorPlugin, PgV4BuildPlugin, PgV4InflectionPlugin, PgV4SimpleSubscriptionsPlugin, PgV4SmartTagsPlugin, };
type PromiseOrDirect<T> = T | Promise<T>;
type DirectOrCallback<Request, T> = T | ((req: Request) => PromiseOrDirect<T>);
export interface V4GraphileBuildOptions {
pgUseCustomNetworkScalars?: boolean;
pgStrictFunctions?: boolean;
orderByNullsLast?: boolean;
}
export interface V4ErrorOutputOptions {
handleErrors?: (error: readonly GraphQLError[]) => readonly GraphQLError[];
extendedErrors?: string[];
showErrorStack?: boolean | "json";
}
export interface V4Options<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse> extends GraphileBuild.SchemaOptions, V4ErrorOutputOptions {
/**
* - 'only': connections will be avoided, preferring lists
* - 'omit': lists will be avoided, preferring connections
* - 'both': both lists and connections will be generated
*/
simpleCollections?: "only" | "both" | "omit";
classicIds?: boolean;
setofFunctionsContainNulls?: boolean;
dynamicJson?: boolean;
jwtPgTypeIdentifier?: string;
jwtSecret?: string;
disableDefaultMutations?: boolean;
ignoreIndexes?: boolean;
appendPlugins?: GraphileConfig.Plugin[];
skipPlugins?: GraphileConfig.Plugin[];
/** @deprecated Please use grafast.context 'pgSettings' key instead */
pgSettings?: DirectOrCallback<Request | undefined, {
[key: string]: string | null | undefined;
}>;
/** @deprecated Please use grafast.context callback instead */
additionalGraphQLContextFromRequest?: (req: Request | undefined, res: Response | undefined) => Promise<Record<string, any>>;
subscriptions?: boolean;
ignoreRBAC?: boolean;
graphileBuildOptions?: V4GraphileBuildOptions;
retryOnInitFail?: boolean | ((error: Error, attempts: number) => boolean | Promise<boolean>);
graphqlRoute?: string;
graphiqlRoute?: string;
eventStreamRoute?: string;
graphiql?: boolean;
/**
* preset.grafserv.maxRequestLength: the length, in bytes, for the largest
* request body that grafserv will accept. String values no longer supported.
*/
bodySizeLimit?: number;
/** Always ignored, ruru is always enhanced. */
enhanceGraphiql?: boolean;
allowExplain?: boolean;
/**
* As of PostGraphile v5, query batching is no longer supported. Query batching
* has not been standardized as part of the GraphQL-over-HTTP specification
* efforts, and the need for it has been significantly reduced with the ubiquity
* of HTTP2+ servers. Further, with incremental delivery (`@stream`/`@defer`)
* on the horizon, query batching will develop a lot of unnecessary complexity
* that handling at the network layer would bypass.
*
* @deprecated Use HTTP2+ instead
*/
enableQueryBatching?: never;
sortExport?: boolean;
exportGqlSchemaPath?: string;
exportJsonSchemaPath?: string;
watchPg?: boolean;
/** @deprecated Use 'preset.grafast.context' callback instead */
defaultRole?: never;
simpleSubscriptions?: boolean;
}
export type GraphQLErrorExtended = GraphQLError & {
extensions: {
exception: {
hint?: string;
detail?: string;
code: string;
};
};
};
export declare function makeV4ErrorOutputPreset(options: V4ErrorOutputOptions): {
grafserv: {
maskError?: GraphileConfig.GrafservOptions["maskError"];
};
};
export declare const makeV4Preset: (options?: V4Options) => GraphileConfig.Preset;
export declare const V4Preset: GraphileConfig.Preset;
export default V4Preset;
//# sourceMappingURL=v4.d.ts.map