Flow Operations

Flow Operations plugin. This plugin allows you to create and manage operations in your Flow blockchain.

Version
3.0.2
Weekly downloads
11k
License
MIT
Updated
May 26, 2025

Installation

          npm i -D @graphql-codegen/flow-operations
        

Config API Reference

useFlowExactObjects

type: boolean

Generates Flow types as Exact types. Default value: “true”

useFlowReadOnlyTypes

type: boolean

Generates read-only Flow types Default value: “false”

flattenGeneratedTypes

type: boolean

Flatten fragment spread and inline fragments into a simple selection set before generating. Default value: “false”

avoidOptionals

type: object

This will cause the generator to avoid using TypeScript optionals (?) on types, so the following definition: type A { myField: String } will output myField: Maybe<string> instead of myField?: Maybe<string>. Default value: “false”

skipTypeNameForRoot

type: boolean

Avoid adding __typename for root types. This is ignored when a selection explicitly specifies __typename. Default value: “false”

nonOptionalTypename

type: boolean

Automatically adds __typename field to the generated types, even when they are not specified in the selection set, and makes it non-optional Default value: “false”

globalNamespace

type: boolean

Puts all generated code under global namespace. Useful for Stencil integration. Default value: “false”

operationResultSuffix

type: string

Adds a suffix to generated operation result type names Default value: ""

dedupeOperationSuffix

type: boolean

Set this configuration to true if you wish to make sure to remove duplicate operation name suffix. Default value: “false”

omitOperationSuffix

type: boolean

Set this configuration to true if you wish to disable auto add suffix of operation name, like Query, Mutation, Subscription, Fragment. Default value: “false”

exportFragmentSpreadSubTypes

type: boolean

If set to true, it will export the sub-types created in order to make it easier to access fields declared under fragment spread. Default value: “false”

experimentalFragmentVariables

type: boolean

If set to true, it will enable support for parsing variables on fragments. Default value: “false”

mergeFragmentTypes

type: boolean

If set to true, merge equal fragment interfaces. Default value: “false”

namespacedImportName

type: string

Prefixes all GraphQL related generated types with that value, as namespaces import. You can use this feature to allow separation of plugins to different files (See importSchemaTypesFrom) Default value: “‘Types’ (if importSchemaTypesFrom is set)“

customDirectives

type: object

Configures behavior for use with custom directives from various GraphQL libraries.

generateOperationTypes

type: boolean

Whether to generate operation types such as Variables, Query/Mutation/Subscription selection set, and Fragment types This can be used with importSchemaTypesFrom to generate shared used Enums and Input. Default value: “true”

importSchemaTypesFrom

type: string

The absolute (prefixed with ~) or relative path from cwd to the shared used Enums and Input (See generateOperationTypes). Default value: “true”

extractAllFieldsToTypes

type: boolean

Extract all field types to their own types, instead of inlining them. This helps to reduce type duplication, and makes type errors more readable. It can also significantly reduce the size of the generated code, the generation time, and the typechecking time. Default value: “false”

extractAllFieldsToTypesCompact

type: boolean

Generates type names using only field names, omitting GraphQL type names. This matches the naming convention used by Apollo Tooling. For example, instead of Query_company_Company_office_Office_location_Location, it generates Query_company_office_location.

When this option is enabled, extractAllFieldsToTypes is automatically enabled as well. Default value: “false”

declarationKind

type: object

Overrides the default output for various GraphQL types. Default value: “‘type‘“

strictScalars

type: boolean

Makes scalars strict.

If scalars are found in the schema that are not defined in scalars an error will be thrown during codegen. Default value: “false”

defaultScalarType

type: string

Allows you to override the type that unknown scalars will have. Default value: “unknown”

scalars

type: object

Extends or overrides the built-in scalars and custom GraphQL scalars to a custom type.

namingConvention

type: object

Allow you to override the naming convention of the output. You can either override all namings, or specify an object with specific custom naming convention per output. The format of the converter must be a valid module#method. Allowed values for specific output are: typeNames, enumValues. You can also use “keep” to keep all GraphQL names as-is. Additionally, you can set transformUnderscore to true if you want to override the default behavior, which is to preserve underscores.

Available case functions in change-case-all are camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, lowerCase, localeLowerCase, lowerCaseFirst, spongeCase, titleCase, upperCase, localeUpperCase and upperCaseFirst See more Default value: “change-case-all#pascalCase”

typesPrefix

type: string

Prefixes all the generated types. Default value: ""

typesSuffix

type: string

Suffixes all the generated types. Default value: ""

enumPrefix

type: boolean

Allow you to disable prefixing for generated enums, works in combination with typesPrefix. Default value: “true”

enumSuffix

type: boolean

Allow you to disable suffixing for generated enums, works in combination with typesSuffix. Default value: “true”

useTypeImports

type: boolean

Will use import type {} rather than import {} when importing only types. This gives compatibility with TypeScript’s “importsNotUsedAsValues”: “error” option Default value: “false”

inlineFragmentTypes

type: string

Whether fragment types should be inlined into other operations. “inline” is the default behavior and will perform deep inlining fragment types within operation type definitions. “combine” is the previous behavior that uses fragment type references without inlining the types (and might cause issues with deeply nested fragment that uses list types). “mask” transforms the types for use with fragment masking. Useful when masked types are needed when not using the “client” preset e.g. such as combining it with Apollo Client’s data masking feature. Default value: “inline”

emitLegacyCommonJSImports

type: boolean

Emit legacy common js imports. Default it will be true this way it ensure that generated code works with non-compliant bundlers. Default value: “true”

importExtension

type: object

Append this extension to all imports. Useful for ESM environments that require file extensions in import statements.

printFieldsOnNewLines

type: boolean

If you prefer to have each field in generated types printed on a new line, set this to true. This can be useful for improving readability of the resulting types, without resorting to running tools like Prettier on the output. Default value: “false”

includeExternalFragments

type: boolean

Whether to include external fragments in the generated code. External fragments are not defined in the same location as the operation definition. Default value: “false”