@greenwood/plugin-graphql
Version:
A plugin for using GraphQL for querying your content.
29 lines (22 loc) • 658 B
TypeScript
import type { ResourcePlugin, ServerPlugin } from "@greenwood/cli";
import "../queries/queries.d.ts";
import "../core/client.d.ts";
export type GraphQLPlugin = () => [ServerPlugin, ResourcePlugin];
export type CollectionVariables = {
name: string;
orderBy?: number;
};
export type ChildrenVariables = {
parent?: string;
};
export type Params = {
query: string;
variables: CollectionVariables | ChildrenVariables;
};
// this could probably be better fleshed out for all query types...
export type Client = () => {
query(params: Params);
};
declare module "@greenwood/plugin-graphql" {
export const greenwoodPluginGraphQL: GraphQLPlugin;
}