/** * PostGraphile v5 Function Bindings Plugin * * Exposes API-bound compute functions as GraphQL mutations. At gather time * the plugin queries the bindings table joined to the definitions table * (schema/table names resolved from the constructive metaschema via the * express-context compute module loader — never guessed or hard-coded) * for the configured api_id and emits one mutation per graphql-enabled * binding: * * (input: Input!): Payload * * The input type is derived from the function's payload metadata (JSON Schema * on the binding config, else payload_args, else a raw `payload: JSON` * field — see derive.ts). The payload returns the created invocation row * (id/status), reusing the FunctionInvocation type when the table is exposed. * * Invoking = a plain, RLS-enforced INSERT into function_invocations on the * normal authenticated connection. pgSettings (including jwt.claims.api_id * provenance) are supplied by the server layer — this plugin never sets * claims or bypasses RLS. No runtime payload validation is performed. * * Bindings are loaded once per schema build (gather phase). New or changed * bindings appear after the next schema rebuild — the server's existing * schema cache invalidation (LISTEN/NOTIFY via graphile-cache) or a restart. * TODO: emit a cache invalidation NOTIFY on function_api_bindings changes so * rebuilds happen automatically. */ import 'graphile-build'; import 'graphile-build-pg'; import type { GraphileConfig } from 'graphile-config'; import type { FunctionBindingsPluginOptions } from './types'; declare global { namespace GraphileConfig { interface Plugins { FunctionBindingsPlugin: true; } interface GatherHelpers { functionBindings: Record; } } } export declare function createFunctionBindingsPlugin(options: FunctionBindingsPluginOptions): GraphileConfig.Plugin;