import { Plugin, PromiseOrValue } from "graphql-yoga";

//#region src/index.d.ts
declare function hashSHA256(text: string, api?: {
  crypto: Crypto;
  TextEncoder: (typeof globalThis)['TextEncoder'];
}): PromiseOrValue<string>;
interface APQStoreOptions {
  max?: number;
  ttl?: number;
}
declare function createInMemoryAPQStore(options?: APQStoreOptions): APQStore;
interface APQOptions {
  store?: APQStore;
  hash?: (str: string, api: {
    crypto: Crypto;
    TextEncoder: typeof TextEncoder;
  }) => PromiseOrValue<string>;
  responseConfig?: {
    /**
     * If set true, status code of the response (if the query
     * is not found or mismatched) will be 200.
     */
    forceStatusCodeOk?: boolean;
  };
}
interface APQStore {
  get(key: string): PromiseOrValue<string | null | undefined>;
  set(key: string, query: string): PromiseOrValue<any>;
}
interface APQExtension {
  version: 1;
  sha256Hash: string;
}
declare function useAPQ(options?: APQOptions): Plugin;
//#endregion
export { APQExtension, APQOptions, APQStore, APQStoreOptions, createInMemoryAPQStore, hashSHA256, useAPQ };