enonic-types
Advanced tools
Comparing version 0.2.12 to 0.2.13
@@ -0,1 +1,2 @@ | ||
import type { Content } from "./content"; | ||
export interface GraphQlPlaygroundLibrary { | ||
@@ -16,7 +17,22 @@ render(): string; | ||
LocalTime: GraphQLLocalTime; | ||
/** | ||
* Create an instance of SchemaGenerator | ||
*/ | ||
newSchemaGenerator(): SchemaGenerator; | ||
/** | ||
* Returns a modified type that indicates a list of the underlying wrapped type | ||
*/ | ||
list(type: GraphQLScalarType): GraphQLListType; | ||
/** | ||
* Returns a modified type that indicates the underlying wrapped type will not be null | ||
*/ | ||
nonNull(type: GraphQLScalarType): GraphQLNonNullType; | ||
/** | ||
* Returns a special type that allows an object/interface type to reference a type by its key. Necessary for self reference. | ||
*/ | ||
reference(typeKey: string): GraphQLScalarType; | ||
execute<T>(schema: GraphQLSchema, query: string, variables: object, context?: object): T; | ||
/** | ||
* Executes a GraphQL query and variables against a schema | ||
*/ | ||
execute<ExecuteContext = undefined, Result = any>(schema: GraphQLSchema, query: string, variables: object, context?: ExecuteContext): Result; | ||
} | ||
@@ -100,8 +116,29 @@ export declare type GraphQLSchema = unknown & { | ||
export interface SchemaGenerator { | ||
/** | ||
* Creates a GraphQL schema | ||
*/ | ||
createSchema(params: CreateSchemaParams): GraphQLSchema; | ||
createPageInfoObjectType(params: CreatePageInfoObjectTypeParams): GraphQLInfoObjectType; | ||
createObjectType(params: CreateObjectTypeParams): GraphQLObjectType; | ||
createInputObjectType(params: CreateInputObjectTypeParams): GraphQLInputObjectType; | ||
createInterfaceType(params: CreateInterfaceTypeParams): GraphQLInterfaceType; | ||
createUnionType(params: CreateUnionTypeParams): GraphQLUnionType; | ||
/** | ||
* Creates a GraphQL page info object type | ||
*/ | ||
createPageInfoObjectType<ExecuteContext = undefined>(params: CreatePageInfoObjectTypeParams<ExecuteContext>): GraphQLInfoObjectType; | ||
/** | ||
* Creates a GraphQL object type | ||
*/ | ||
createObjectType<ExecuteContext = undefined>(params: CreateObjectTypeParams<ExecuteContext>): GraphQLObjectType; | ||
/** | ||
* createInputObjectType | ||
*/ | ||
createInputObjectType<ExecuteContext = undefined>(params: CreateInputObjectTypeParams<ExecuteContext>): GraphQLInputObjectType; | ||
/** | ||
* Creates a GraphQL interface type | ||
*/ | ||
createInterfaceType<ExecuteContext = undefined>(params: CreateInterfaceTypeParams<ExecuteContext>): GraphQLInterfaceType; | ||
/** | ||
* Creates a GraphQL union type | ||
*/ | ||
createUnionType<ExecuteContext = undefined>(params: CreateUnionTypeParams<ExecuteContext>): GraphQLUnionType; | ||
/** | ||
* Creates a GraphQL enum type | ||
*/ | ||
createEnumType(params: CreateEnumTypeParams): GraphQLEnumType; | ||
@@ -120,35 +157,40 @@ } | ||
} | ||
export interface GraphQLResolver { | ||
export interface GraphQLResolver<ExecuteContext> { | ||
type: GraphQLType; | ||
args?: Record<string, GraphQLType>; | ||
resolve?: (env: any) => unknown; | ||
resolve?: <Data extends object>(env: GraphQLResolverEnvironment<Data, ExecuteContext>) => unknown; | ||
} | ||
export interface CreateInterfaceTypeParams { | ||
export interface GraphQLResolverEnvironment<Data extends object, ExecuteContext> { | ||
source: Content<Data>; | ||
args: Record<string, any>; | ||
context: ExecuteContext; | ||
} | ||
export interface CreateInterfaceTypeParams<ExecuteContext> { | ||
readonly name: string; | ||
readonly fields: Record<string, GraphQLResolver>; | ||
readonly fields: Record<string, GraphQLResolver<ExecuteContext>>; | ||
readonly typeResolver: (env: any) => any; | ||
readonly description?: string; | ||
} | ||
export interface CreateUnionTypeParams { | ||
export interface CreateUnionTypeParams<ExecuteContext> { | ||
readonly name: string; | ||
readonly fields: Record<string, GraphQLResolver>; | ||
readonly fields: Record<string, GraphQLResolver<ExecuteContext>>; | ||
readonly typeResolver: (env: any) => any; | ||
} | ||
export interface CreatePageInfoObjectTypeParams { | ||
export interface CreatePageInfoObjectTypeParams<ExecuteContext> { | ||
readonly name: string; | ||
readonly fields: Record<string, GraphQLResolver>; | ||
readonly fields: Record<string, GraphQLResolver<ExecuteContext>>; | ||
readonly interfaces: Array<GraphQLInterfaceType | GraphQLTypeReference>; | ||
description: string; | ||
} | ||
export interface CreateObjectTypeParams { | ||
export interface CreateObjectTypeParams<ExecuteContext> { | ||
readonly name: string; | ||
readonly description: string; | ||
readonly fields: Record<string, GraphQLResolver>; | ||
readonly fields: Record<string, GraphQLResolver<ExecuteContext>>; | ||
readonly interfaces: Array<GraphQLInterfaceType | GraphQLTypeReference>; | ||
} | ||
export interface CreateInputObjectTypeParams { | ||
export interface CreateInputObjectTypeParams<ExecuteContext> { | ||
readonly name: string; | ||
readonly description: string; | ||
readonly fields: Record<string, GraphQLResolver>; | ||
readonly fields: Record<string, GraphQLResolver<ExecuteContext>>; | ||
readonly interfaces: Array<GraphQLInterfaceType | GraphQLTypeReference>; | ||
} |
@@ -5,5 +5,5 @@ import { WebSocketEvent } from "./controller"; | ||
export interface LibGuillotine { | ||
createSchema(params?: ContextOptions): GraphQLSchema; | ||
createSchema<ExecuteContext = undefined>(params?: ContextOptions<ExecuteContext>): GraphQLSchema; | ||
createHeadlessCmsType(): GraphQLType; | ||
createContext(options?: ContextOptions): Context; | ||
createContext<ExecuteContext = undefined>(options?: ContextOptions<ExecuteContext>): Context<ExecuteContext>; | ||
initWebSockets(schema: GraphQLSchema): (event: WebSocketEvent) => void; | ||
@@ -13,10 +13,10 @@ createWebSocketData(req: CreateWebSocketDataParams): WebSocketData; | ||
} | ||
export interface ContextOptions { | ||
export interface ContextOptions<ExecuteContext> { | ||
applications?: Array<string>; | ||
allowPaths?: Array<string>; | ||
subscriptionEventTypes?: Array<string>; | ||
creationCallbacks: Record<string, (context: Context, params: CreateObjectTypeParams) => void>; | ||
creationCallbacks: Record<string, (context: Context<ExecuteContext>, params: CreateObjectTypeParams<ExecuteContext>) => void>; | ||
[key: string]: unknown; | ||
} | ||
export interface Context { | ||
export interface Context<ExecuteContext> { | ||
types: Record<string, GraphQLType>; | ||
@@ -26,8 +26,8 @@ dictionary: Array<unknown>; | ||
contentTypeMap: Record<string, unknown>; | ||
options: ContextOptions; | ||
options: ContextOptions<ExecuteContext>; | ||
addDictionaryType(objectType: unknown): void; | ||
putContentTypeType(name: string, objectType: unknown): void; | ||
uniqueName(name: string): string; | ||
getOption(name: string): ContextOptions; | ||
putOption(name: string, value: unknown): ContextOptions; | ||
getOption(name: string): ContextOptions<ExecuteContext>; | ||
putOption(name: string, value: unknown): ContextOptions<ExecuteContext>; | ||
schemaGenerator: SchemaGenerator; | ||
@@ -34,0 +34,0 @@ } |
{ | ||
"name": "enonic-types", | ||
"sideEffects": false, | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"description": "TypeScript types for Enonic XP", | ||
@@ -6,0 +6,0 @@ "typings": "index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129339
4104