Skip to content

Instantly share code, notes, and snippets.

@devuxer
Last active May 5, 2018 23:01
Show Gist options
  • Save devuxer/1ad747ce8a1a2c5863e3414e3a48752c to your computer and use it in GitHub Desktop.
Save devuxer/1ad747ce8a1a2c5863e3414e3a48752c to your computer and use it in GitHub Desktop.
postgraphile-core typings file proposal
declare module "postgraphile-core" {
import { Client, Pool } from "pg";
import { Build, Context, Options, Plugin } from "graphile-build";
type PostGraphileOptions = {
dynamicJson?: boolean;
classicIds?: boolean;
disableDefaultMutations?: string;
nodeIdFieldName?: string;
graphileBuildOptions?: Options;
graphqlBuildOptions?: Options; // DEPRECATED!
replaceAllPlugins?: Array<Plugin>;
appendPlugins?: Array<Plugin>;
prependPlugins?: Array<Plugin>;
skipPlugins?: Array<Plugin>;
jwtPgTypeIdentifier?: string;
jwtSecret?: string;
inflector?: any; // NO LONGER SUPPORTED!
pgColumnFilter?: (mixed: any, Build: Build, Context: Context) => boolean; //
viewUniqueKey?: string;
enableTags?: boolean;
readCache?: string;
writeCache?: string;
setWriteCacheCallback?: (fn: () => Promise<void>) => void;
legacyRelations?: "only" | "deprecated";
setofFunctionsContainNulls?: boolean;
legacyJsonUuid?: boolean;
};
type PgConfig = Client | Pool | string;
export const createPostGraphileSchema: (
pgConfig: PgConfig,
schemas: string | string[],
options?: PostGraphileOptions
) => Promise<any>;
export const watchPostGraphileSchema: (
pgConfig: PgConfig,
schemas: string | string[],
options: PostGraphileOptions | undefined,
onNewSchema: any
) => Promise<() => Promise<void>>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment