Options
All
  • Public
  • Public/Protected
  • All
Menu

Package graphiql-plugin-doc-explorer

Index

References

Argument

Re-exports Argument

Argument

Re-exports Argument

DefaultValue

Re-exports DefaultValue

DefaultValue

Re-exports DefaultValue

DeprecationReason

Re-exports DeprecationReason

DeprecationReason

Re-exports DeprecationReason

Directive

Re-exports Directive

Directive

Re-exports Directive

DocExplorer

Re-exports DocExplorer

DocExplorer

Re-exports DocExplorer

DocExplorerContextProvider

Re-exports DocExplorerContextProvider

DocExplorerContextType

Re-exports DocExplorerContextType

DocExplorerFieldDef

Re-exports DocExplorerFieldDef

DocExplorerNavStack

Re-exports DocExplorerNavStack

DocExplorerNavStackItem

Re-exports DocExplorerNavStackItem

ExplorerSection

Re-exports ExplorerSection

ExplorerSection

Re-exports ExplorerSection

FieldDocumentation

Re-exports FieldDocumentation

FieldDocumentation

Re-exports FieldDocumentation

FieldLink

Re-exports FieldLink

FieldLink

Re-exports FieldLink

SchemaDocumentation

Re-exports SchemaDocumentation

SchemaDocumentation

Re-exports SchemaDocumentation

Search

Re-exports Search

Search

Re-exports Search

TypeDocumentation

Re-exports TypeDocumentation

TypeDocumentation

Re-exports TypeDocumentation

TypeLink

Re-exports TypeLink

TypeLink

Re-exports TypeLink

useDocExplorer

Re-exports useDocExplorer

useDocExplorerActions

Re-exports useDocExplorerActions

Type aliases

DocExplorerContextType

DocExplorerContextType: { actions: { pop: any; push: any; rebuildNavStackWithSchema: any; reset: any; resolveSchemaReferenceToNavItem: any }; explorerNavStack: DocExplorerNavStack }

Type declaration

DocExplorerFieldDef

DocExplorerFieldDef: GraphQLField<unknown, unknown> | GraphQLInputField | GraphQLArgument

DocExplorerNavStack

DocExplorerNavStack: [DocExplorerNavStackItem, { def?: GraphQLNamedType | DocExplorerFieldDef; name: string }]

DocExplorerNavStackItem

DocExplorerNavStackItem: { def?: GraphQLNamedType | DocExplorerFieldDef; name: string }

Type declaration

  • Optional def?: GraphQLNamedType | DocExplorerFieldDef

    The definition object of the item, this can be a named type, a field, an input field or an argument.

  • name: string

    The name of the item.

Variables

Const create

create: Create = (<T>(stateCreator: StateCreator<T>) => {console.log('zustand create mock');// to support a curried version of createreturn typeof stateCreator === 'function'? createUncurried(stateCreator): createUncurried;}) as typeof originalCreate

Const createStore

createStore: CreateStore = (<T>(stateCreator: StateCreator<T>) => {console.log('zustand createStore mock');// to support a curried version of createStorereturn typeof stateCreator === 'function'? createStoreUncurried(stateCreator): createStoreUncurried;}) as typeof originalCreateStore

Const docExplorerStore

docExplorerStore: StoreApi<DocExplorerContextType> = createStore<DocExplorerContextType>((set, get) => ({explorerNavStack: INITIAL_NAV_STACK,actions: {push(item) {set(state => {const curr = state.explorerNavStack;const lastItem = curr.at(-1)!;const explorerNavStack: DocExplorerNavStack =// Avoid pushing duplicate itemslastItem.def === item.def ? curr : [...curr, item];return { explorerNavStack };});},pop() {set(state => {const curr = state.explorerNavStack;const explorerNavStack =curr.length > 1 ? (curr.slice(0, -1) as DocExplorerNavStack) : curr;return { explorerNavStack };});},reset() {set(state => {const curr = state.explorerNavStack;const explorerNavStack = curr.length === 1 ? curr : INITIAL_NAV_STACK;return { explorerNavStack };});},resolveSchemaReferenceToNavItem(schemaReference) {if (!schemaReference) {return;}const { push } = get().actions;switch (schemaReference.kind) {case 'Type': {push({name: schemaReference.type.name,def: schemaReference.type,});break;}case 'Field': {push({name: schemaReference.field.name,def: schemaReference.field,});break;}case 'Argument': {if (schemaReference.field) {push({name: schemaReference.field.name,def: schemaReference.field,});}break;}case 'EnumValue': {if (schemaReference.type) {push({name: schemaReference.type.name,def: schemaReference.type,});}break;}}},rebuildNavStackWithSchema(schema: GraphQLSchema) {set(state => {const oldNavStack = state.explorerNavStack;if (oldNavStack.length === 1) {return state;}// Spread is neededconst newNavStack: DocExplorerNavStack = [...INITIAL_NAV_STACK];let lastEntity:| GraphQLNamedType| GraphQLField<unknown, unknown>| null = null;for (const item of oldNavStack) {if (item === INITIAL_NAV_STACK[0]) {// No need to copy the initial itemcontinue;}if (item.def) {// If item.def isn't a named type, it must be a field, inputField, or argumentif (isNamedType(item.def)) {// The type needs to be replaced with the new schema type of the same nameconst newType = schema.getType(item.def.name);if (newType) {newNavStack.push({name: item.name,def: newType,});lastEntity = newType;} else {// This type no longer exists; the stack cannot be built beyond herebreak;}} else if (lastEntity === null) {// We can't have a sub-entity if we have no entity; stop rebuilding the nav stackbreak;} else if (isObjectType(lastEntity) ||isInputObjectType(lastEntity)) {// item.def must be a Field / input field; replace with the new field of the same nameconst field = lastEntity.getFields()[item.name];if (field) {newNavStack.push({name: item.name,def: field,});} else {// This field no longer exists; the stack cannot be built beyond herebreak;}} else if (isScalarType(lastEntity) ||isEnumType(lastEntity) ||isInterfaceType(lastEntity) ||isUnionType(lastEntity)) {// These don't (currently) have non-type sub-entries; something has gone wrong.// Handle gracefully by discontinuing rebuilding the stack.break;} else {// lastEntity must be a field (because it's not a named type)const field: GraphQLField<unknown, unknown> = lastEntity;// Thus item.def must be an argument, so find the same named argument in the new schemaif (field.args.some(a => a.name === item.name)) {newNavStack.push({name: item.name,def: field,});} else {// This argument no longer exists; the stack cannot be built beyond herebreak;}}} else {lastEntity = null;newNavStack.push(item);}}return { explorerNavStack: newNavStack };});},},}),)

Const storeResetFns

storeResetFns: Set<() => void> = new Set<() => void>()

Functions

Const Argument

  • Argument(__namedParameters: { arg: GraphQLArgument; inline: undefined | false | true; showDefaultValue: undefined | false | true }): Element

Const DefaultValue

Const DeprecationReason

  • DeprecationReason(props: DeprecationReasonProps): null | Element

Const Directive

  • Directive(__namedParameters: { directive: DirectiveNode }): Element

Const DocExplorer

  • DocExplorer(): Element

Const DocExplorerContextProvider

  • DocExplorerContextProvider(__namedParameters: { children: ReactNode }): ReactElement<unknown, string | ((props: P) => ReactElement<any, any> | null) | {}>

Const ExplorerSection

  • ExplorerSection(__namedParameters: { children: ReactNode; title: "Type" | "Root Types" | "Fields" | "Deprecated Fields" | "Arguments" | "Deprecated Arguments" | "Implements" | "Implementations" | "Possible Types" | "Enum Values" | "Deprecated Enum Values" | "Directives" | "All Schema Types" }): Element
  • Parameters

    • __namedParameters: { children: ReactNode; title: "Type" | "Root Types" | "Fields" | "Deprecated Fields" | "Arguments" | "Deprecated Arguments" | "Implements" | "Implementations" | "Possible Types" | "Enum Values" | "Deprecated Enum Values" | "Directives" | "All Schema Types" }
      • children: ReactNode
      • title: "Type" | "Root Types" | "Fields" | "Deprecated Fields" | "Arguments" | "Deprecated Arguments" | "Implements" | "Implementations" | "Possible Types" | "Enum Values" | "Deprecated Enum Values" | "Directives" | "All Schema Types"

    Returns Element

Const FieldDocumentation

Const FieldLink

Const SchemaDocumentation

  • SchemaDocumentation(__namedParameters: { schema: GraphQLSchema }): Element

Const Search

  • Search(): null | Element

Const TypeDocumentation

  • TypeDocumentation(__namedParameters: { type: GraphQLNamedType }): null | Element

Const TypeLink

  • TypeLink(__namedParameters: { type: GraphQLType }): null | Element

renderType

  • renderType(type: GraphQLType, renderNamedType: (namedType: GraphQLNamedType) => Element): Element

Const useDocExplorer

Const useDocExplorerActions

  • useDocExplorerActions(): { pop: any; push: any; rebuildNavStackWithSchema: any; reset: any; resolveSchemaReferenceToNavItem: any }

useSearchResults

Object literals

Const DOC_EXPLORER_PLUGIN

DOC_EXPLORER_PLUGIN: object

content

content: FC<{}> = DocExplorer

title

title: string = "Documentation Explorer"

icon

  • icon(): Element

Generated using TypeDoc