polen
Version:
A framework for delightful GraphQL developer portals
51 lines • 1.34 kB
TypeScript
import type { Schema } from '../../schema.js';
/**
* Configuration for defining schemas programmatically in memory.
*
* Useful for demos, testing, or when schemas are generated dynamically.
*/
export interface ConfigInput {
/**
* Schema versions defined as SDL strings.
*
* Can be:
* - A single SDL string (no changelog)
* - Array of SDL strings (uses current date for all)
* - Array of objects with date and SDL (full changelog support)
*
* @example
* ```ts
* // Single schema
* versions: `
* type Query {
* hello: String
* }
* `
*
* // Multiple versions with explicit dates
* versions: [
* {
* date: new Date('2024-01-15'),
* value: `type Query { users: [User] }`
* },
* {
* date: new Date('2024-03-20'),
* value: `type Query { users: [User], posts: [Post] }`
* }
* ]
* ```
*/
versions: string | string[] | {
date: Date;
value: string;
}[];
}
export interface Config {
versions: {
date: Date;
value: string;
}[];
}
export declare const normalize: (configInput: ConfigInput) => Config;
export declare const read: (configInput: ConfigInput) => Promise<null | Schema>;
//# sourceMappingURL=memory.d.ts.map