@pulzar/core
Version:
Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support
81 lines • 2.4 kB
TypeScript
import { GraphQLSchema } from "graphql";
import { IResolvers } from "@graphql-tools/utils";
export interface GraphQLModule {
name: string;
typeDefs: string;
resolvers: IResolvers;
directives?: Record<string, any>;
schemaTransforms?: Array<(schema: GraphQLSchema) => GraphQLSchema>;
}
export interface GraphQLConfig {
modules: GraphQLModule[];
scalars?: Record<string, any>;
directives?: Record<string, any>;
schemaDirectives?: Record<string, any>;
introspection?: boolean;
playground?: boolean;
debug?: boolean;
}
export declare class GraphQLSchemaManager {
private config;
private schema?;
private modules;
constructor(config?: Partial<GraphQLConfig>);
/**
* Add a GraphQL module
*/
addModule(module: GraphQLModule): void;
/**
* Remove a GraphQL module
*/
removeModule(name: string): boolean;
/**
* Get a GraphQL module by name
*/
getModule(name: string): GraphQLModule | undefined;
/**
* Get all registered modules
*/
getModules(): GraphQLModule[];
/**
* Build executable schema
*/
buildSchema(): GraphQLSchema;
/**
* Get built schema
*/
getSchema(): GraphQLSchema;
/**
* Invalidate cached schema
*/
invalidateSchema(): void;
/**
* Get configuration
*/
getConfig(): GraphQLConfig;
/**
* Update configuration
*/
updateConfig(config: Partial<GraphQLConfig>): void;
/**
* Create core GraphQL module with basic queries
*/
private createCoreModule;
/**
* Create GraphQL module from string schema
*/
static createModuleFromString(name: string, schema: string): GraphQLModule;
/**
* Validate GraphQL module
*/
static validateModule(module: GraphQLModule): boolean;
}
export declare const schemaManager: GraphQLSchemaManager;
export declare function addGraphQLModule(module: GraphQLModule): void;
export declare function removeGraphQLModule(name: string): boolean;
export declare function getGraphQLSchema(): GraphQLSchema;
export declare function buildGraphQLSchema(): GraphQLSchema;
export declare function getGraphQLModule(name: string): GraphQLModule | undefined;
export declare function getAllGraphQLModules(): GraphQLModule[];
export declare function invalidateGraphQLSchema(): void;
//# sourceMappingURL=schema.d.ts.map