import type { GQLException } from './GQLException' import type { FunctionN } from '@principia/base/function' import type * as Sy from '@principia/base/Sync' import type * as U from '@principia/base/util/types' import type { DirectiveNode, ValueNode } from 'graphql' export interface ScalarConfig { readonly description?: string readonly directives?: Array } export type SerializeF = (u: unknown) => Sy.Sync export type ParseValueF = (u: unknown) => Sy.Sync export type ParseLiteralF = (valueNode: ValueNode) => Sy.Sync export interface ScalarFunctions { parseLiteral: ParseLiteralF parseValue: ParseValueF serialize: SerializeF } export type Scalar = { functions: ScalarFunctions name: Name } export type _I = Fs extends ScalarFunctions ? I : never export type _O = Fs extends ScalarFunctions ? O : never export type ScalarEnv> = U.UnionToIntersection< { [k in keyof S['functions']]: S['functions'][k] extends FunctionN ? Ret extends Sy.Sync ? R : never : never }[keyof S['functions']] > export type SchemaScalars = { [n: string]: Scalar } export type SchemaScalarsEnv = U.UnionToIntersection< { [k in keyof S]: ScalarEnv }[keyof S] >