Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Instances, Options } from 'graphql-zeus';
import { EditorNodeDefinition } from '../../Models';
import { help } from './help';
export const ArgumentInstance: Partial & Pick = {
node: {
notEditable: true,
name: undefined,
},
data: {
type: Instances.Argument,
},
options: [
{
name: Options.array,
help: help.array,
},
],
};
export const reason = (): EditorNodeDefinition => ({
data: {
type: Instances.Argument,
},
type: 'reason',
acceptsInputs: (d, defs, _, nodes) => {
return defs
.filter((d) => d.data && d.data.type === Value.StringValue)
.map(Utils.nodeDefinitionToAcceptedEditorNodeDefinition);
},
node: {
name: undefined,
notEditable: true,
},
});
}
if (type in TypeDefinition) {
return TypeDefinitionsTemplates.resolve(f);
}
switch (type) {
case TypeSystemDefinition.FieldDefinition:
return FieldTemplate.resolve(f);
case TypeSystemDefinition.DirectiveDefinition:
return TypeDefinitionsTemplates.resolveDirective(f);
case TypeSystemDefinition.UnionMemberDefinition:
return UnionMemberTemplate.resolve(f);
case ValueDefinition.EnumValueDefinition:
return EnumValueDefinitionTemplate.resolve(f);
case ValueDefinition.InputValueDefinition:
return InputValueTemplate.resolve(f);
case Instances.Argument:
return ArgumentTemplate.resolve(f);
case Instances.Directive:
return DirectiveTemplate.resolve(f);
default:
return '';
}
}
return '';
}
}