UNPKG

@graphql-codegen/flutter-freezed

Version:

GraphQL Code Generator plugin to generate Freezed models from your GraphQL schema

38 lines (37 loc) 1.96 kB
import { DefinitionNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql'; import { FieldName, TypeName } from './config/pattern.js'; import { AppliesOn, DartIdentifierCasing, FlutterFreezedPluginConfig } from './config/plugin-config.js'; export declare const strToList: (str: string) => string[]; export declare const arrayWrap: <T>(value: T | T[]) => T[]; export declare const resetIndex: (regexp: RegExp) => number; export declare const nodeIsObjectType: (node: DefinitionNode) => node is ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode; export declare const appliesOnBlock: <T extends AppliesOn>(configAppliesOn: T[], blockAppliesOn: readonly T[]) => boolean; export declare const dartCasing: (name: string, casing?: DartIdentifierCasing) => string; /** * checks whether name is a Dart Language keyword * @param identifier The name or identifier to be checked * @returns `true` if name is a Dart Language keyword, otherwise `false` */ export declare const isDartKeyword: (identifier: string) => boolean; /** * Ensures that the blockName isn't a valid Dart language reserved keyword. * It wraps the identifier with the prefix and suffix then transforms the casing as specified in the config * @param config * @param name * @param typeName * @returns */ export declare const escapeDartKeyword: (config: FlutterFreezedPluginConfig, blockAppliesOn: readonly AppliesOn[], identifier: string, typeName?: TypeName, fieldName?: FieldName) => string; type JsonKeyOptions = { defaultValue?: string; disallowNullValue?: boolean; fromJson?: string; ignore?: boolean; includeIfNull?: boolean; name?: string; required?: boolean; toJson?: string; }; export declare const atJsonKeyDecorator: ({ defaultValue, disallowNullValue, fromJson, ignore, includeIfNull, name, required, toJson, }: JsonKeyOptions) => string; export declare const stringIsNotEmpty: (str: string) => boolean; export {};