postgraphile-plugin-connection-filter
Version:
Filtering on PostGraphile connections
29 lines (28 loc) • 1.56 kB
TypeScript
import type { PgCondition, PgCodec, PgConditionCapableParent } from "@dataplan/pg";
import type { InputObjectFieldApplyResolver } from "grafast";
import type { GraphQLInputType } from "graphql";
import type { SQL } from "pg-sql2";
declare global {
namespace GraphileBuild {
interface Build {
pgAggregatesForceTextTypesInsensitive: PgCodec[];
pgAggregatesForceTextTypesSensitive: PgCodec[];
}
}
}
export declare const PgConnectionArgFilterOperatorsPlugin: GraphileConfig.Plugin;
export interface OperatorSpec {
name?: string;
description: string;
resolveSqlIdentifier?: (sqlIdentifier: SQL, codec: PgCodec<any, any, any, any, any, any, any>) => readonly [SQL, PgCodec<any, any, any, any, any, any, any>];
resolveInput?: (input: unknown) => unknown;
resolveInputCodec?: (expressionCodec: PgCodec<any, any, any, any, any, any, any>) => PgCodec<any, any, any, any, any, any, any>;
resolveSql?: any;
resolveSqlValue?: (_unused: PgConditionCapableParent, value: any, codec: PgCodec<any, any, any, any, any, any, any>) => SQL;
resolve: (sqlIdentifier: SQL, sqlValue: SQL, input: unknown, _unused: PgConditionCapableParent, details: {
fieldName: string | null;
operatorName: string;
}) => SQL;
resolveType?: (type: GraphQLInputType) => GraphQLInputType;
}
export declare function makeApplyFromOperatorSpec(build: GraphileBuild.Build, typeName: string, fieldName: string, spec: OperatorSpec, type: GraphQLInputType): InputObjectFieldApplyResolver<PgCondition>;