Package detail

apollo

apollographql532.4kMIT2.34.0

Command line tool for Apollo GraphQL

readme

Apollo CLI

GitHub license npm Get on Slack


[2022-01-21] Note - Upcoming Deprecation Plans: We (Apollo) are working towards fully deprecating this repository and its related projects. Most of the functionality in this repository has been replaced by newer projects and the rest will be soon. We'll share detailed migration documentation when everything here is ready to be officially deprecated, but just a heads up in case you're planning on adopting anything here for a new project (which you still can of course if the tooling here works for you - support for this tooling will be minimal however).


[2021-07-23] Note - Housekeeping: Apollo's GraphQL VSCode extension is no longer housed in this repository. It is now maintained separately in this repo.


Apollo CLI brings together your GraphQL clients and servers with tools for validating your schema, linting your operations for compatibility with your server, and generating static types for improved client-side type safety.

Usage

Disclaimer: The following API documentation is only for the latest version released on NPM, and may not be accurate for previous or future versions.

$ npm install -g apollo
$ apollo COMMAND
running command...
$ apollo (-v|--version|version)
apollo/2.34.0 linux-x64 node-v16.15.0
$ apollo --help [COMMAND]
USAGE
  $ apollo COMMAND
...

Commands

apollo client:check

Check a client project against a pushed service

USAGE
  $ apollo client:check

OPTIONS
  -c, --config=config                    Path to your Apollo config file

  -g, --graph=graph                      The ID for the graph in Apollo to operate client commands with. Overrides
                                         config file if set.

  -v, --variant=variant                  The variant of the graph in Apollo to associate this client to

  --clientName=clientName                Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId  Reference id for the client which will match ids from client traces, will use
                                         clientName if not provided

  --clientVersion=clientVersion          The version of the client that the queries will be attached to

  --endpoint=endpoint                    The URL for the CLI use to introspect your service

  --excludes=excludes                    Glob of files to exclude for GraphQL operations. Caveat: this doesn't currently
                                         work in watch mode

  --header=header                        Additional header to send during introspection. May be used multiple times to
                                         add multiple headers. NOTE: The `--endpoint` flag is REQUIRED if using the
                                         `--header` flag.

  --includes=includes                    Glob of files to search for GraphQL operations. This should be used to find
                                         queries *and* any client schema extensions

  --key=key                              The API key to use for authentication to Apollo

  --queries=queries                      Deprecated in favor of the includes flag

  --tagName=tagName                      Name of the template literal tag used to identify template literals containing
                                         GraphQL queries in Javascript/Typescript code

See code: src/commands/client/check.ts

apollo client:codegen [OUTPUT]

[DEPRECATED] Generate static types for GraphQL queries. Can use the published schema in the Apollo registry or a downloaded schema.

USAGE
  $ apollo client:codegen [OUTPUT]

ARGUMENTS
  OUTPUT
      Directory to which generated files will be written.
      - For TypeScript/Flow generators, this specifies a directory relative to each source file by default.
      - For TypeScript/Flow generators with the "outputFlat" flag is set, and for the Swift generator, this specifies a
      file or directory (absolute or relative to the current working directory) to which:
      - a file will be written for each query (if "output" is a directory)
      - all generated types will be written
      - For all other types, this defines a file (absolute or relative to the current working directory) to which all
      generated types are written.

OPTIONS
  -c, --config=config                        Path to your Apollo config file

  -g, --graph=graph                          The ID for the graph in Apollo to operate client commands with. Overrides
                                             config file if set.

  -v, --variant=variant                      The variant of the graph in Apollo to associate this client to

  --[no-]addTypename                         [default: true] Automatically add __typename to your queries, can be unset
                                             with --no-addTypename

  --clientName=clientName                    Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId      Reference id for the client which will match ids from client traces, will
                                             use clientName if not provided

  --clientVersion=clientVersion              The version of the client that the queries will be attached to

  --customScalarsPrefix=customScalarsPrefix  Include a prefix when using provided types for custom scalars

  --endpoint=endpoint                        The URL for the CLI use to introspect your service

  --excludes=excludes                        Glob of files to exclude for GraphQL operations. Caveat: this doesn't
                                             currently work in watch mode

  --globalTypesFile=globalTypesFile          By default, TypeScript will put a file named "globalTypes.ts" inside the
                                             "output" directory. Set "globalTypesFile" to specify a different path.
                                             Alternatively, set "tsFileExtension" to modify the extension of the file,
                                             for example "d.ts" will output "globalTypes.d.ts"

  --header=header                            Additional header to send during introspection. May be used multiple times
                                             to add multiple headers. NOTE: The `--endpoint` flag is REQUIRED if using
                                             the `--header` flag.

  --includes=includes                        Glob of files to search for GraphQL operations. This should be used to find
                                             queries *and* any client schema extensions

  --key=key                                  The API key to use for authentication to Apollo

  --localSchemaFile=localSchemaFile          Path to one or more local GraphQL schema file(s), as introspection result
                                             or SDL. Supports comma-separated list of paths (ex.
                                             `--localSchemaFile=schema.graphql,extensions.graphql`)

  --mergeInFieldsFromFragmentSpreads         Merge fragment fields onto its enclosing type

  --namespace=namespace                      The namespace to emit generated code into.

  --omitDeprecatedEnumCases                  Omit deprecated enum cases from generated code [Swift only]

  --only=only                                Parse all input files, but only output generated code for the specified
                                             file [Swift only]

  --operationIdsPath=operationIdsPath        Path to an operation id JSON map file. If specified, also stores the
                                             operation ids (hashes) as properties on operation types [currently
                                             Swift-only]

  --outputFlat                               By default, TypeScript/Flow will put each generated file in a directory
                                             next to its source file using the value of the "output" as the directory
                                             name. Set "outputFlat" to put all generated files in the directory relative
                                             to the current working directory defined by "output".

  --passthroughCustomScalars                 Use your own types for custom scalars

  --queries=queries                          Deprecated in favor of the includes flag

  --suppressDeprecationWarning               Silence the deprecation warning output by the codegen command

  --suppressSwiftMultilineStringLiterals     Prevents operations from being rendered as multiline strings [Swift only]

  --tagName=tagName                          Name of the template literal tag used to identify template literals
                                             containing GraphQL queries in Javascript/Typescript code

  --target=target                            (required) Type of code generator to use (swift | typescript | flow | scala
                                             | json | json-modern (exposes raw json types))

  --tsFileExtension=tsFileExtension          By default, TypeScript will output "ts" files. Set "tsFileExtension" to
                                             specify a different file extension, for example "d.ts"

  --useFlowExactObjects                      Use Flow exact objects for generated types [flow only]

  --useFlowReadOnlyTypes                     Use read only types for generated types [flow only]. **Deprecated in favor
                                             of `useReadOnlyTypes`.**

  --useReadOnlyTypes                         Use read only types for generated types [flow | typescript]

  --watch                                    Watch for file changes and reload codegen

ALIASES
  $ apollo codegen:generate

See code: src/commands/client/codegen.ts

apollo client:download-schema OUTPUT

Download a schema from Apollo or a GraphQL endpoint in JSON or SDL format

USAGE
  $ apollo client:download-schema OUTPUT

ARGUMENTS
  OUTPUT  [default: schema.json] Path to write the introspection result to. Can be `.graphql`, `.gql`, `.graphqls`, or
          `.json`

OPTIONS
  -c, --config=config                    Path to your Apollo config file

  -g, --graph=graph                      The ID for the graph in Apollo to operate client commands with. Overrides
                                         config file if set.

  -v, --variant=variant                  The variant of the graph in Apollo to associate this client to

  --clientName=clientName                Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId  Reference id for the client which will match ids from client traces, will use
                                         clientName if not provided

  --clientVersion=clientVersion          The version of the client that the queries will be attached to

  --endpoint=endpoint                    The URL for the CLI use to introspect your service

  --excludes=excludes                    Glob of files to exclude for GraphQL operations. Caveat: this doesn't currently
                                         work in watch mode

  --header=header                        Additional header to send during introspection. May be used multiple times to
                                         add multiple headers. NOTE: The `--endpoint` flag is REQUIRED if using the
                                         `--header` flag.

  --includes=includes                    Glob of files to search for GraphQL operations. This should be used to find
                                         queries *and* any client schema extensions

  --key=key                              The API key to use for authentication to Apollo

  --queries=queries                      Deprecated in favor of the includes flag

  --tagName=tagName                      Name of the template literal tag used to identify template literals containing
                                         GraphQL queries in Javascript/Typescript code

See code: src/commands/client/download-schema.ts

apollo client:extract OUTPUT

Extract queries from a client

USAGE
  $ apollo client:extract OUTPUT

ARGUMENTS
  OUTPUT  [default: manifest.json] Path to write the extracted queries to

OPTIONS
  -c, --config=config                    Path to your Apollo config file

  -g, --graph=graph                      The ID for the graph in Apollo to operate client commands with. Overrides
                                         config file if set.

  -v, --variant=variant                  The variant of the graph in Apollo to associate this client to

  --clientName=clientName                Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId  Reference id for the client which will match ids from client traces, will use
                                         clientName if not provided

  --clientVersion=clientVersion          The version of the client that the queries will be attached to

  --endpoint=endpoint                    The URL for the CLI use to introspect your service

  --excludes=excludes                    Glob of files to exclude for GraphQL operations. Caveat: this doesn't currently
                                         work in watch mode

  --header=header                        Additional header to send during introspection. May be used multiple times to
                                         add multiple headers. NOTE: The `--endpoint` flag is REQUIRED if using the
                                         `--header` flag.

  --includes=includes                    Glob of files to search for GraphQL operations. This should be used to find
                                         queries *and* any client schema extensions

  --key=key                              The API key to use for authentication to Apollo

  --preserveStringAndNumericLiterals     Disable redaction of string and numerical literals.  Without this flag, these
                                         values will be replaced with empty strings (`''`) and zeroes (`0`)
                                         respectively.  This redaction is intended to avoid  inadvertently outputting
                                         potentially personally identifiable information (e.g. embedded passwords  or
                                         API keys) into operation manifests

  --queries=queries                      Deprecated in favor of the includes flag

  --tagName=tagName                      Name of the template literal tag used to identify template literals containing
                                         GraphQL queries in Javascript/Typescript code

See code: src/commands/client/extract.ts

apollo client:push

Register operations with Apollo, adding them to the safelist

USAGE
  $ apollo client:push

OPTIONS
  -c, --config=config                    Path to your Apollo config file

  -g, --graph=graph                      The ID for the graph in Apollo to operate client commands with. Overrides
                                         config file if set.

  -v, --variant=variant                  The variant of the graph in Apollo to associate this client to

  --clientName=clientName                Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId  Reference id for the client which will match ids from client traces, will use
                                         clientName if not provided

  --clientVersion=clientVersion          The version of the client that the queries will be attached to

  --endpoint=endpoint                    The URL for the CLI use to introspect your service

  --excludes=excludes                    Glob of files to exclude for GraphQL operations. Caveat: this doesn't currently
                                         work in watch mode

  --header=header                        Additional header to send during introspection. May be used multiple times to
                                         add multiple headers. NOTE: The `--endpoint` flag is REQUIRED if using the
                                         `--header` flag.

  --includes=includes                    Glob of files to search for GraphQL operations. This should be used to find
                                         queries *and* any client schema extensions

  --key=key                              The API key to use for authentication to Apollo

  --queries=queries                      Deprecated in favor of the includes flag

  --tagName=tagName                      Name of the template literal tag used to identify template literals containing
                                         GraphQL queries in Javascript/Typescript code

See code: src/commands/client/push.ts

apollo help [COMMAND]

display help for apollo

USAGE
  $ apollo help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

apollo plugins

List installed plugins.

USAGE
  $ apollo plugins

OPTIONS
  --core  Show core plugins.

EXAMPLE
  $ apollo plugins

See code: @oclif/plugin-plugins

apollo plugins:inspect PLUGIN...

Displays installation properties of a plugin.

USAGE
  $ apollo plugins:inspect PLUGIN...

ARGUMENTS
  PLUGIN  [default: .] Plugin to inspect.

OPTIONS
  -h, --help     Show CLI help.
  -v, --verbose

EXAMPLE
  $ apollo plugins:inspect myplugin

See code: @oclif/plugin-plugins

apollo plugins:install PLUGIN...

Installs a plugin into the CLI.

USAGE
  $ apollo plugins:install PLUGIN...

ARGUMENTS
  PLUGIN  Plugin to install.

OPTIONS
  -f, --force    Run yarn install with force flag.
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Can be installed from npm or a git url.

  Installation of a user-installed plugin will override a core plugin.

  e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command 
  will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in 
  the CLI without the need to patch and update the whole CLI.

ALIASES
  $ apollo plugins:add

EXAMPLES
  $ apollo plugins:install myplugin 
  $ apollo plugins:install https://github.com/someuser/someplugin
  $ apollo plugins:install someuser/someplugin

See code: @oclif/plugin-plugins

apollo plugins:link PLUGIN

Links a plugin into the CLI for development.

USAGE
  $ apollo plugins:link PLUGIN

ARGUMENTS
  PATH  [default: .] path to plugin

OPTIONS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Installation of a linked plugin will override a user-installed or core plugin.

  e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
   command will override the user-installed or core plugin implementation. This is useful for development work.

EXAMPLE
  $ apollo plugins:link myplugin

See code: @oclif/plugin-plugins

apollo plugins:uninstall PLUGIN...

Removes a plugin from the CLI.

USAGE
  $ apollo plugins:uninstall PLUGIN...

ARGUMENTS
  PLUGIN  plugin to uninstall

OPTIONS
  -h, --help     Show CLI help.
  -v, --verbose

ALIASES
  $ apollo plugins:unlink
  $ apollo plugins:remove

See code: @oclif/plugin-plugins

apollo plugins:update

Update installed plugins.

USAGE
  $ apollo plugins:update

OPTIONS
  -h, --help     Show CLI help.
  -v, --verbose

See code: @oclif/plugin-plugins

apollo service:check

[DEPRECATED] Check a service against known operation workloads to find breaking changes

USAGE
  $ apollo service:check

OPTIONS
  -c, --config=config                                            Path to your Apollo config file

  -g, --graph=graph                                              The ID of the graph in Apollo to check your proposed
                                                                 schema changes against. Overrides config file if set.

  -v, --variant=variant                                          The variant to check the proposed schema against

  --author=author                                                The author to associate with this proposed schema

  --branch=branch                                                The branch name to associate with this check

  --commitId=commitId                                            The SHA-1 hash of the commit to associate with this
                                                                 check

  --endpoint=endpoint                                            The URL for the CLI use to introspect your service

  --header=header                                                Additional header to send during introspection. May be
                                                                 used multiple times to add multiple headers. NOTE: The
                                                                 `--endpoint` flag is REQUIRED if using the `--header`
                                                                 flag.

  --ignoreFailures                                               Exit with status 0 when the check completes, even if
                                                                 errors are found

  --json                                                         Output result in json, which can then be parsed by CLI
                                                                 tools such as jq.

  --key=key                                                      The API key to use for authentication to Apollo

  --localSchemaFile=localSchemaFile                              Path to one or more local GraphQL schema file(s), as
                                                                 introspection result or SDL. Supports comma-separated
                                                                 list of paths (ex.
                                                                 `--localSchemaFile=schema.graphql,extensions.graphql`)

  --markdown                                                     Output result in markdown.

  --queryCountThreshold=queryCountThreshold                      Minimum number of requests within the requested time
                                                                 window for a query to be considered.

  --queryCountThresholdPercentage=queryCountThresholdPercentage  Number of requests within the requested time window for
                                                                 a query to be considered, relative to total request
                                                                 count. Expected values are between 0 and 0.05 (minimum
                                                                 5% of total request volume)

  --serviceName=serviceName                                      Provides the name of the implementing service for a
                                                                 federated graph. This flag will indicate that the
                                                                 schema is a partial schema from a federated service

  --validationPeriod=validationPeriod                            The size of the time window with which to validate the
                                                                 schema against. You may provide a number (in seconds),
                                                                 or an ISO8601 format duration for more granularity
                                                                 (see: https://en.wikipedia.org/wiki/ISO_8601#Durations)

DESCRIPTION
  -----------------------------------------------------------------
  DEPRECATED: This command will be removed from the `apollo` CLI in 
  its next major version. Replacement functionality is available in 
  the new Apollo Rover CLI: https://go.apollo.dev/t/migration
  -----------------------------------------------------------------

ALIASES
  $ apollo schema:check

See code: src/commands/service/check.ts

apollo service:delete

[DEPRECATED] Delete a federated service from Apollo and recompose remaining services

USAGE
  $ apollo service:delete

OPTIONS
  -c, --config=config        Path to your Apollo config file

  -g, --graph=graph          The ID of the graph in Apollo for which to delete an implementing service. Overrides config
                             file if set.

  -v, --variant=variant      The variant to delete the implementing service from

  -y, --yes                  Bypass confirmation when deleting a service

  --endpoint=endpoint        The URL for the CLI use to introspect your service

  --header=header            Additional header to send during introspection. May be used multiple times to add multiple
                             headers. NOTE: The `--endpoint` flag is REQUIRED if using the `--header` flag.

  --key=key                  The API key to use for authentication to Apollo

  --serviceName=serviceName  (required) Provides the name of the implementing service for a federated graph

DESCRIPTION
  -----------------------------------------------------------------
  DEPRECATED: This command will be removed from the `apollo` CLI in 
  its next major version. Replacement functionality is available in 
  the new Apollo Rover CLI: https://go.apollo.dev/t/migration
  -----------------------------------------------------------------

See code: src/commands/service/delete.ts

apollo service:download OUTPUT

[DEPRECATED] Download the schema from your GraphQL endpoint.

USAGE
  $ apollo service:download OUTPUT

ARGUMENTS
  OUTPUT  [default: schema.json] Path to write the introspection result to. Supports .json output only.

OPTIONS
  -c, --config=config      Path to your Apollo config file

  -g, --graph=graph        The ID of the graph in the Apollo registry for which to download the schema for. Overrides
                           config file if provided.

  -k, --skipSSLValidation  Allow connections to an SSL site without certs

  -v, --variant=variant    The variant to download the schema of

  --endpoint=endpoint      The URL for the CLI use to introspect your service

  --header=header          Additional header to send during introspection. May be used multiple times to add multiple
                           headers. NOTE: The `--endpoint` flag is REQUIRED if using the `--header` flag.

  --key=key                The API key to use for authentication to Apollo

DESCRIPTION
  -----------------------------------------------------------------
  DEPRECATED: This command will be removed from the `apollo` CLI in 
  its next major version. Replacement functionality is available in 
  the new Apollo Rover CLI: https://go.apollo.dev/t/migration
  -----------------------------------------------------------------

ALIASES
  $ apollo schema:download

See code: src/commands/service/download.ts

apollo service:list

[DEPRECATED] List the services in a graph

USAGE
  $ apollo service:list

OPTIONS
  -c, --config=config    Path to your Apollo config file

  -g, --graph=graph      The ID of the graph in the Apollo registry for which to list implementing services. Overrides
                         config file if set.

  -v, --variant=variant  The variant to list implementing services for

  --endpoint=endpoint    The URL for the CLI use to introspect your service

  --header=header        Additional header to send during introspection. May be used multiple times to add multiple
                         headers. NOTE: The `--endpoint` flag is REQUIRED if using the `--header` flag.

  --key=key              The API key to use for authentication to Apollo

DESCRIPTION
  -----------------------------------------------------------------
  DEPRECATED: This command will be removed from the `apollo` CLI in 
  its next major version. Replacement functionality is available in 
  the new Apollo Rover CLI: https://go.apollo.dev/t/migration
  -----------------------------------------------------------------

See code: src/commands/service/list.ts

apollo service:push

[DEPRECATED] Push a service definition to Apollo

USAGE
  $ apollo service:push

OPTIONS
  -c, --config=config                Path to your Apollo config file

  -g, --graph=graph                  The ID of the graph in Apollo to publish your service to. Overrides config file if
                                     set.

  -v, --variant=variant              The variant to publish your service to in Apollo

  --author=author                    The author to associate with this publication

  --branch=branch                    The branch name to associate with this publication

  --commitId=commitId                The SHA-1 hash of the commit to associate with this publication

  --endpoint=endpoint                The URL for the CLI use to introspect your service

  --header=header                    Additional header to send during introspection. May be used multiple times to add
                                     multiple headers. NOTE: The `--endpoint` flag is REQUIRED if using the `--header`
                                     flag.

  --key=key                          The API key to use for authentication to Apollo

  --localSchemaFile=localSchemaFile  Path to one or more local GraphQL schema file(s), as introspection result or SDL.
                                     Supports comma-separated list of paths (ex.
                                     `--localSchemaFile=schema.graphql,extensions.graphql`)

  --serviceName=serviceName          Provides the name of the implementing service for a federated graph

  --serviceRevision=serviceRevision  Provides a unique revision identifier for a change to an implementing service on a
                                     federated service push. The default of this is a git sha

  --serviceURL=serviceURL            Provides the url to the location of the implementing service for a federated graph

DESCRIPTION
  -----------------------------------------------------------------
  DEPRECATED: This command will be removed from the `apollo` CLI in 
  its next major version. Replacement functionality is available in 
  the new Apollo Rover CLI: https://go.apollo.dev/t/migration
  -----------------------------------------------------------------

ALIASES
  $ apollo schema:publish

See code: src/commands/service/push.ts

Configuration

The Apollo CLI and VS Code extension can be configured with an Apollo config file. Apollo configuration is stored as a plain object in an apollo.config.js file which exports the configuration. For more information about configuring an Apollo project, see: https://www.apollographql.com/docs/devtools/apollo-config/.

Note: the use of the apollo key in the project's package.json file for configuration is deprecated, and will no longer be supported in Apollo v3

You'll need to set up your Apollo configuration for all the features of the Apollo CLI and VS Code extension to work correctly. For full details on how to do that, visit our docs. A basic configuration (apollo.config.js style) looks something like this:

module.exports = {
  client: {
    name: "My Client Project",
    service: "my-service-name"
  }
};

Code Generation

Accompanying Libraries

See Apollo iOS for details on the mapping from GraphQL results to Swift types, as well as runtime support for executing queries and mutations. For Scala, see React Apollo Scala.js for details on how to use generated Scala code in a Scala.js app with Apollo Client.

gql template support

If the source file for generation is a JavaScript or TypeScript file, the codegen will try to extrapolate the queries inside the gql tag templates.

The tag name is configurable using the CLI --tagName option.

Typescript and Flow

When using the codegen command with Typescript or Flow, make sure to add the __typename introspection field to every selection set within your graphql operations.

If you're using a client like apollo-client that does this automatically for your GraphQL operations, pass in the --addTypename option to apollo codegen:generate to make sure the generated Typescript and Flow types have the __typename field as well. This is required to ensure proper type generation support for GraphQLUnionType and GraphQLInterfaceType fields.

Why is the __typename field required?

Using the type information from the GraphQL schema, we can infer the possible types for fields. However, in the case of a GraphQLUnionType or GraphQLInterfaceType, there are multiple types that are possible for that field. This is best modeled using a disjoint union with the __typename as the discriminant.

For example, given a schema:

...

interface Character {
  name: String!
}

type Human implements Character {
  homePlanet: String
}

type Droid implements Character {
  primaryFunction: String
}

...

Whenever a field of type Character is encountered, it could be either a Human or Droid. Human and Droid objects will have a different set of fields. Within your application code, when interacting with a Character you'll want to make sure to handle both of these cases.

Given this query:

query Characters {
  characters(episode: NEW_HOPE) {
    name

    ... on Human {
      homePlanet
    }

    ... on Droid {
      primaryFunction
    }
  }
}

Apollo Codegen will generate a union type for Character.

export type CharactersQuery = {
  characters: Array<
    | {
        __typename: "Human",
        name: string,
        homePlanet: ?string
      }
    | {
        __typename: "Droid",
        name: string,
        primaryFunction: ?string
      }
  >
};

This type can then be used as follows to ensure that all possible types are handled:

function CharacterFigures({ characters }: CharactersQuery) {
  return characters.map(character => {
    switch (character.__typename) {
      case "Human":
        return (
          <HumanFigure
            homePlanet={character.homePlanet}
            name={character.name}
          />
        );
      case "Droid":
        return (
          <DroidFigure
            primaryFunction={character.primaryFunction}
            name={character.name}
          />
        );
    }
  });
}

Contributing

Build Status

This repo is composed of multiple packages. The apollo-cli contains the core CLI commands. The apollo-codegen-core package contains all the compiler APIs needed to implement code generation support for new languages. The other apollo-codegen-* packages implement code generation support for individual languages.

Running tests locally:

npm install
npm test

You can also run npm commands within package folders after you have bootstrapped the repository (part of npm install).

Note: if you have issues, try npm run clean && npm i to get a fresh install of the packages. Occasionally problems arise when removed dependencies stay around

Nock tests

To display the debugging messages for nock, run the following command:

DEBUG=nock.* npm test

It can also be helpful to print standard out during testing. To enable logging, add the following configuration to the stdout function call during test creation:

.stdout({ print: true })

Active Development / Debugging

To simplify the development process, you may want to step through and debug commands whose behavior you're modifying. To do this, run the executable with node in debug mode like so, where <command> is a valid CLI command like client:check or service:push:

node --inspect-brk=9002 packages/apollo/bin/run <command>

If you're using VS Code, you can run the included "Attach to CLI Debugger" launch task and debug right from VS Code! Otherwise, you may use the Chrome inspector or other Node debugger of your choice.

Regenerating Mocked Network Data

Some integration tests rely on mocked server data (service:check for example). Mock data is generated by making real network requests and recording those requests with nock's recording feature. Stop mocking network calls and add nock.recorder.rec() before network calls are made. For service:check, change apiKey to a real Apollo API key. Then run the tests and nock will output code to mock requests to the console. You can (and probably should) pare down the request to be less brittle (by only checking for an operation name, for example). See src/commands/service/__tests__/check.test.ts for an example of how a mocked network request will look.

Publishing

  1. Make sure the CHANGELOG.md is updated with all changes committed since the last release. Make sure the versions for each package to update are correct.
  2. Run npm run release:version-bump -- <bumpish>
    • Can use major, minor, patch, prepatch, etc for the bump type. If not used, the command will prompt and ask for the bump type.
    • This command updates git tags locally and on GitHub
  3. Run npm run release:start-ci-publish locally
    • IMPORTANT: If publishing a prerelease (like alpha/beta/rc), set the tag that NPM will use to publish with the APOLLO_DIST_TAG environment variable. By default, if this isn't set, NPM will publish the prerelease to the latest tag (which isn't what we'd want).
    • Pushes a publish/XXXXXXXXXX tag to GitHub to trigger circle CI build
  4. Circle will notify the appropriate Apollo team slack channel when ready to release
    • Slack channel member will confirm through the Apollo Deploy Bot
    • Circle will release to all channels (npm, cli binary to s3, vscode marketplace)
    • Another slack bot notification will confirm success of release.

Maintainers

changelog

CHANGELOG

Note: Apollo's GraphQL VSCode extension is no longer housed in this repository. It is now maintained separately in this repo.

vNEXT

  • Nothing yet! Stay tuned.

apollo@2.33.11

  • This release includes a number of updates for dependencies within this repo's projects. Behavior changes aren't expected and should be considered reportable issues.

  • apollo-language-server

    • Remove moment as a dependency #2595

apollo@2.33.10

  • This release includes a number of patch updates for dependencies within the following packages. Behavior changes aren't expected and should be considered reportable issues.

    • apollo-codegen-core@0.40.8
    • apollo-codegen-flow@0.38.8
    • apollo-codegen-scala@0.39.8
    • apollo-codegen-swift@0.40.8
    • apollo-codegen-typescript@0.40.8
    • apollo-graphql@0.9.6
    • apollo-language-server@1.26.8
    • @apollographql/apollo-tools@0.5.3
    • apollo@2.33.10
  • apollo-tools@0.5.3

    • Add undeclared peer dependency graphql #2049

apollo@2.33.9

  • apollo-language-server@1.26.7 / apollo-codegen-core@0.40.7
    • Adjust apollo-codegen-core to use the same withTypenameFieldAddedWhereNeeded utility as apollo-language-server, to make sure modified operations align between codegen and anything leveraging the language server utility functions (like the client:push command).
      @hwillson in #2473

apollo@2.33.8

  • apollo-graphql@0.9.5
    • Export useful operation sanitization transforms PR #2057
    • Preserve directive usages on SchemaDefinition nodes in buildSchemaFromSDL PR #2457

apollo@2.33.7

  • apollo-graphql@0.9.4
    • Add support for interface on interfaces to transformSchema. PR #2456

apollo@2.33.6

  • apollo@2.33.6

apollo@2.33.5

  • apollo@2.33.5

    • Adds support for àpollo.config.cjsfiles allowingpackage.jsonfiles withtype: "module"` Issue #2342 PR #2381
  • apollo-tools@0.5.1

    • Remove dependency on apollo-env, so using this package no longer installs polyfills.
  • apollo-graphql@0.9.3

    • Complex directive arguments don't break transformSchema (Fixes #2162) PR #2335

apollo@2.33.2

  • apollo@2.33.2

  • apollo-env@0.10.0

    • deps: Updated node-fetch to v2.6.1
  • apollo-graphql@0.9.2

    • Add missing sha.js dependency PR #2283
  • apollo-env@0.9.0

    • The following utility functions are no longer exported from apollo-env and can now be found in the apollo-graphql library:
      • createHash
      • isNodeLike
      • mapValues
      • isNotNullOrDefined
  • apollo-graphql@0.9.0

    • This package no longer depends on apollo-env to avoid the side-effects of its polyfills.

apollo@2.32.5

  • apollo@2.32.5

    • Bump version of env-ci #1754 Issue #2219

      Due to human error during the release process, the following packages also had their versions bumped, despite having no known significant changes. (Apologies, from that human.)

      • apollo-codegen-core@0.39.3
      • apollo-codegen-flow@0.37.3
      • apollo-codegen-scala@0.38.3
      • apollo-codegen-swift@0.39.3
      • apollo-codegen-typescript@0.39.3
      • apollo-env@0.6.6
      • apollo-graphql@0.6.1
      • apollo-language-server@1.25.2
      • @apollographql/apollo-tools@0.4.9
      • vscode-apollo@1.18.2

apollo@2.32.4

  • This version should not be used as it was published without depended-on packages. Please use apollo@2.32.5 instead.

apollo@2.32.3

  • This version was not actually published.

apollo@2.32.3

  • This version was not actually published.

apollo@2.32.1

  • apollo-codegen-swift
    • Fix issue where a query referencing many fragments caused type checking for queryDocument to time out #2198

apollo@2.32.0

  • apollo@2.32.0
    • Support the standard HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables for using an HTTP proxy. #2181

apollo@2.31.2

  • apollo-codegen-swift
    • Fix bug in generated compound type names that lead to structName being inconsistent throughout codegen #2170

apollo@2.31.1

  • Update CLI default API domain from engine-graphql.apollographql.com to graphql.api.apollographql.com. Users that have set up support for corporate proxies or firewalls may need to update configurations.
  • Accept GitLab remote URLs when fetching git info for service:check and service:push #2104
  • --commitId in service:check and service:push overrides the current commit ID otherwise read through env-ci.
  • service:push now takes --author and --branch matching service:check.

apollo-graphql@0.6.0

  • Rename defaultEngineReportingSignature to defaultUsageReportingSignature; the old name continues to be exported as well.

apollo@2.30.2

  • apollo-codegen-core
    • Add new unionTypes and interfaceTypes properties to the exported IR JSON (when using the json-modern target), that list all unions and their types, as well as all interfaces and their implementing types #2050.

apollo@2.30.1

  • apollo-codegen-swift@0.37.7
    • Generate JSON file including fragments when --operationIds option is provided #2017

apollo@2.30.0

  • apollo@2.30.0
    • Allow flags for --branch and --author in service:check command. This will permit users to group changes using the --branch flag and indicate an author, via a string value using the --author flag.

apollo@2.29.1

Note: this release is an immediate follow-up to the previous release. apollo-graphql should've been updated but it was unfortunately missed.

  • apollo-graphql@0.5.0
    • Add support for graphql version ^15 #1743

apollo@2.29.0

  • apollo@2.29.0
    • Add support for graphql version ^15 #1743
  • apollo-language-server@1.23.0
    • Fix definition navigation for vscode using localSchemaFile #1996
    • Add support for graphql version ^15 #1743
  • vscode-apollo@1.16.4
    • Fix definition navigation for vscode using localSchemaFile #1996
    • Fix 'Apollo: Show Status' command. #2004

apollo@2.28.3

  • apollo@2.28.3
    • Don't send a user-specified frontend URL to Apollo's servers; fetch one when needed. Drop --frontend flag. #1990
  • apollo-language-server@1.22.3
    • Don't send a user-specified frontend URL to Apollo's servers; fetch one when needed. #1990

apollo@2.28.2

  • apollo@2.28.2
    • Prevent cli from sending some git credentials #1988

apollo@2.28.1

  • apollo@2.28.1
    • Fix silent codegen errors on syntax errors #1899
  • apollo-language-server@1.22.1
    • Remove error from the case with old and new api keys present #1893
    • Add Elixir support for vscode #1971
  • vscode-apollo@1.61.1
    • Add Elixir support for vscode #1971

apollo@2.27.3

  • apollo@2.27.4
    • Change json-modern target to use legacy IR as base, similar to json target #1916.
    • Update json-modern IR to expose typeNodes on typesUsed #1916
  • apollo-codegen-core@0.36.9
    • Change json-modern target to use legacy IR as base, similar to json target #1916.
    • Update json-modern IR to expose typeNodes on typesUsed #1916

apollo@2.27.2

  • apollo@2.27.2
    • Setup automatically creating a GitHub release #1876

apollo@2.27.0

  • apollo@2.27.0
    • downgrade mkdirp to keep node 8 working as expected 63f0773
    • Remove "hidden: true" from --variant in service:push #1865
    • update ENGINE_API_KEY deprecation message to give alternative #1866
    • Add json-modern codegen target which adds typeNodes (ast type nodes) to codegen output #1846
  • apollo-codegen-core@0.36.6
    • Add json-modern target which adds typeNodes (ast type nodes) to codegen output #1846

apollo@2.26.0

  • apollo@2.26.0
    • Support APOLLO_KEY and deprecate ENGINE_API_KEY for .env support #1851
    • Support --graph/-v flag for specifying graph manager id without requiring a config file #1858
    • Support graph@variant parsing under the service.name key in config files, similar to client configs #1858
    • Update all commands that supported --tag to prefer --variant and indicate a deprecation warning for --tag #1849
    • Updates of --help messages #1849
    • Bug fix of some apollo commands that did not work with graph@variant parsing within the apollo.config.js #1849
    • Improved error messaging when a graph is not specified in either apollo.config.js or within the API key. #1849
    • Added --ignoreFailures flag to service:check to exit with code 0 with check failures #1856
    • Make Update "no service found to link..." error more consistent #1847
    • Fix non-existent service message to use the actual service name that's being looked up #1834
  • apollo-language-server@1.21.0
    • Support APOLLO_KEY and deprecate ENGINE_API_KEY for .env support #1851
    • Support graph@variant parsing under the service.name key in config files, similar to client configs #1858
    • Improved error messaging when a graph is not specified in either apollo.config.js or within the API key. #1849
    • Make Update "no service found to link..." error more consistent #1847
    • Fix non-existent service message to use the actual service name that's being looked up #1834

apollo@2.25.0

  • apollo@2.25.0
    • Add confirmation check when deleting services #1826

apollo@2.24.0

  • apollo@2.24.0
    • Correctly fail on duplicate operations in client projects #1812
  • apollo-language-server@1.20.0
    • Correctly fail on duplicate operations in client projects #1812

apollo@2.23.0

  • apollo
    • Fix rendering of unexpected composition errors throwing a table cell error #1806
    • Add ability to define schema download output path that doesn't exist yet #1807

apollo@2.22.1

  • apollo@2.22.1
    • Update shortlinks to use go.apollo.dev instead of bitly #1790
  • apollo-codegen-flow@0.34.1
    • Add @generated comment
  • apollo-codegen-scala@0.35.1
    • Add @generated comment
  • apollo-codegen-swift@0.36.1
    • Add @generated comment
  • apollo-codegen-typescript@0.36.1
    • Add @generated comment

apollo@2.22.0

  • apollo@2.22.0
    • Support disabling literal stripping when extracting queries. 1703

apollo@2.21.3

  • apollo-codegen-swift@0.35.10
    • Add documentation to input structs' constructors #1619
  • apollo-env@0.6.1
    • Add @types/node-fetch to apollo-env deps since they are exported #1749
  • apollo-language-server@1.18.0
    • Adds support for ReasonML to the language server #1488
  • vscode-apollo@1.13.0
    • Adds syntax highlighting for ReasonML #1488

apollo@2.21.2

  • apollo@2.21.2
    • Rename "Engine" to "Apollo Graph Manager" in ouput #1705
  • apollo-codegen-swift@0.35.14
    • Add additional type annotations to improve compile times. 1638
  • apollo-graphql@0.3.6
  • apollo-language-server@1.17.2
    • Rename "Engine" to "Apollo Graph Manager" in ouput #1705
    • Add helpful messages for common errors when introspecting schemas #1713

apollo@2.21.1

  • apollo@2.21.1
    • Add sdl download ability to client:download-schema #1470
    • colors: use cyan instead of blue for text highlighting #1598
    • Fix codegen --watch breaking out of watch mode on validation errors #1627
  • apollo-env@0.6.0
    • POTENTIALLY BREAKING: Make apollo-env a standard TS package #1611 This PR likely warrants a pre-major version bump so that it isn't accidentally upgraded to for dependents using the ^ range. If this breaks your project, please don't hesitate to let us know and revert back to v0.5.1. This PR removes the handwritten node-fetch types and instead just re-exports them. Internally, this drastically simplifies the existence of apollo-env within this monorepo, as it no longer requires a special build step that forces lerna and TS to work around it.
  • vscode-apollo@1.12.1
    • Fix client localSchemaFile for vscode stats command #1634

apollo@2.21.0

  • apollo@2.21.0
    • Add flag to omit deprecated enum cases for swift codegen #1595
  • apollo-codegen-swift@0.35.7
    • Add flag to omit deprecated enum cases #1595
    • Fix code generation for input fields with the value null #1596

apollo@2.20.0

  • apollo@2.20.0
    • Fix codegen --watch mode not writing changes for files #1591
    • Fix service:check not outputing url
  • apollo-codegen-swift@0.35.11
    • Fix code generation for empty input objects / arrays #1589
  • apollo-language-server@1.17.0
    • Improve autocomplete performance by fixing leading option and debounce threshold #1593
    • Load ENV variables from both .env and .env.local for Vue CLI compatibility #1525
  • vscode-apollo@1.12.0
    • Fix ctrl+space autocomplete with language-server imrovements #1593
    • Watch both .env and .env.local for changes #1525

apollo@2.19.1

  • apollo@2.19.1
    • Support custom frontend and historic parameters for federated service:check
  • apollo-codegen-swift@0.35.10
    • Ensure fields named self don't cause compilation errors in the generated code #1533
    • Preserve leading/trailing underscores on field names #1533
    • Allow generated code to be compiled without a module umbrella header #1248

apollo@2.19.0

  • apollo@2.19.0
    • Improve performance of CLI when running projects by delaying or not calling validation unnecessarily #1559
    • Use "table" package for tabular output and word wrap support #1524
    • Use new single step mutation for checking federated service schemas #1539
    • Add support for localSchemaFile for federated service commands #1489
  • apollo-codegen-core@0.35.4
    • Improve performance of validation when client fields are present or not #1559
  • apollo-codegen-swift@0.35.9
    • Switch operations and fragments to default to printing queries as multiline strings rather than including queries as multiline comments
    • Add --suppressSwiftMultilineStringLiterals flag to allow a version which strips unnecessary whitespace.
  • apollo-graphql@0.3.4
    • Use reference-equality, rather than Function.prototype.name string comparison, when omitting validation rules within buildSchemaFromSDL. #1551
  • apollo-language-server@1.16.0
    • Replace old mutation used for checking partial service schemas to use checkPartialSchema #1539
    • Remove old federation-info provider #1489
    • Support using local schema files for checks/pushes of federated services #1489
  • vscode-apollo@1.11.0
    • Improve performance of validation when client fields are present or not #1559

apollo@2.18.3

  • apollo
    • fix bad parsing of multiple localSchemaFiles #1529

apollo@2.18.2

  • apollo-codegen-core@0.35.2
  • apollo-codegen-flow@0.33.27
  • apollo-codegen-scala@0.34.27
  • apollo-codegen-swift@0.35.7
  • apollo-codegen-typescript@0.35.2
  • apollo-language-server@1.15.2
  • apollo@2.18.2

  • apollo

    • Support multiple localSchemaFiles #1500
  • apollo-codegen-core
    • Replace instanceof checks with their respective predicates #1518
  • apollo-codegen-flow
    • Replace instanceof checks with their respective predicates #1518
  • apollo-codegen-scala
    • Replace instanceof checks with their respective predicates #1518
  • apollo-codegen-swift
    • Replace instanceof checks with their respective predicates #1518
    • Ensure types and strings are properly escaped in all generated code #1515
    • Fix warning in Xcode 11 when enums have a none case #1482
  • apollo-codegen-typescript
    • Replace instanceof checks with their respective predicates #1518
  • apollo-language-server
    • Replace instanceof checks with their respective predicates #1518
    • Support multiple localSchemaFiles #1500

apollo@2.18.1

  • apollo-codegen-core@0.35.1
  • apollo-codegen-flow@0.33.26
  • apollo-codegen-scala@0.34.26
  • apollo-codegen-swift@0.35.6
  • apollo-codegen-typescript@0.35.1
  • apollo-language-server@1.15.1
  • vscode-apollo@1.10.1
  • apollo@2.18.1
    • Shorten client:check and service:check output in CI #1404
    • service:check add null check for validation config #1471

apollo@2.18.0, apollo-language-server@1.15.0, apollo-codegen-core@0.35.0, apollo-codegen-typescript@0.35.0, vscode-apollo@1.10.0

  • apollo-codegen-core@0.35.0
    • Add tsFileExtension option to allow custom file extension in ts (like d.ts) #1130
  • apollo-codegen-typescript@0.35.0
    • Add tsFileExtension option to allow custom file extension in ts (like d.ts) #1130
  • apollo-language-server@1.15.0
    • Add debugging util classes for better error/warning handling #1429
    • Add error for duplicate client operation names #1466
    • Add client schema support through autocomplete, hover information, validation rules, and code actions. #1433
  • apollo@2.18.0
    • Add tsFileExtension flag to allow custom file extension in ts (like d.ts) #1130
  • vscode-apollo@1.10.0
    • Improve the syntax highlighting of directives and their definitions. #1433
    • Add debugging util class for better logging in vs code #1429

apollo-language-server@1.14.3

  • apollo-language-server@1.14.3

apollo-language-server@1.14.2

  • apollo-language-server@1.14.2
    • Fix #735 caused #928 error implement #1461
    • Fix dirname parsing for ts config files #1463

apollo-codegen-swift@0.35.2

  • apollo-codegen-swift@0.35.2
    • Revert changes from #656 due to build issues not caught by tests.

apollo@2.17.1, apollo-codegen-swift@0.35.1

  • apollo-codegen-swift@0.35.1
    • Fixes issue where a server adding a new type the client doesn't know about can cause a crash

apollo@2.17.0, apollo-codegen-swift@0.35.0

  • apollo-codegen-swift@0.35.0
    • Fix issue where type names were not being properly escaped iOS 193
    • Fix overcorrection on removing redundant modifiers #1449
    • Added CaseIterable conformance so all known cases can be easily iterated.
    • Added comment to operationDefinition to show the original query
    • Stripped excess whitespace out of operationDefinition
    • Removed force-unwrap when the thing being unwrapped is a double optional

vscode-apollo@1.9.1, apollo-language-server@1.14.1

  • apollo-language-server@1.14.1
    • Fix cache invalidation bug for reload schema which caused outdated results in autocomplete #1446

vscode-apollo@1.9.0, apollo-language-server@1.14.0, apollo-codegen-swift@0.34.2

  • vscode-apollo@1.9.0
    • Add Dart support for vscode #1385
  • apollo-language-server@1.14.0
    • Add Dart operation extraction #1385
  • apollo-codegen-swift@0.34.2
    • Prevent compiler warnings for redundant access-level modifiers when using --namespace 1241

apollo@2.16.1, apollo-language-server@1.13.1, vscode-apollo@1.8.1

  • apollo@2.16.1
    • Add ApolloConfig type to exports from apollo #1413
  • apollo-language-server@1.13.1
    • Add error message for service lookup failure #1413
  • vscode-apollo@1.8.1
    • Only activate extension on apollo.config.js/ts #1411
    • Changed the status bar title to be "Apollo" to save space. #1415

apollo@2.16.0, apollo-codegen-swift@0.34.0, apollo-language-server@1.13.0, apollo-tools@0.4.0, vscode-apollo@1.8.0

  • apollo@2.16.0
    • Add service:list and tests #1358 and header #1377
    • Update service:list test to use a simulated time to prevent relative dates causing snapshot failures #1374
    • Update service:check to support --markdown and --json flags for federated schema #1378
    • Exit status code 1 after composition errors in service:push #1403
    • Update service:check to include graphCompositionId in query params for UI #1401
  • apollo-codegen-swift@0.34.0
    • Update Swift codegen to add operation name to generated query classes #1386
    • Append terminating newline character to generated files #531
  • apollo-language-server@1.13.0
    • Allow template literal placeholders that span multiple rows#1299
    • Add support for extracting GraphQL documents from Ruby source files using <<-GRAPHQL...GRAPHQL heredoc. #1304
  • apollo-tools@0.4.0
    • Handle subscribe in buildServiceDefinition and add type in resolverMap #1047
  • vscode-apollo@1.8.0
    • Add support for Ruby source files using <<-GRAPHQL...GRAPHQL heredoc. #1304

apollo@2.15.0, apollo-language-server@1.12.0

  • apollo@2.15.0
    • Relax graphql version, resolve missing types "Boolean", "String" #1355
  • apollo-language-server@1.12.0
    • Relax graphql version, resolve missing types "Boolean", "String" #1355

apollo-graphql@0.3.3

  • apollo-graphql@0.3.3
    • buildSchemaFromSDL - Add support for merging Scalar and Enum resolvers to schema #1345

apollo@2.14.0, apollo-language-server@1.11.0, vscode-apollo@1.7.4

  • apollo@2.14.0
    • Add integration tests to service:check #1308
    • Add support for federated service to service:check #1308
  • apollo-language-server@1.11.0
    • Add support for federated service to service:check #1308
  • vscode-apollo@1.7.4
    • Fix bug causing some editor features to sometimes give stale results #1361

apollo@2.13.1, apollo-graphql@0.3.2

  • apollo@2.13.1
    • Remove federation warnings and update types #1332
  • apollo-graphql@0.3.2
    • buildSchemaFromSDL - support meta fields on abstract types #1330

apollo@2.13.0, apollo-language-server@1.10.0

  • apollo@2.13.0
    • update client:push to pass the tag / graphVariant #1307
  • apollo-language-server@1.10.0
    • Use offset equal to length of tagname when parsing JS documents#1050
    • Allow template literal placeholders that span multiple rows#1299

apollo@2.12.4, apollo-language-server@1.9.0, vscode-apollo@1.7.0

  • apollo@2.12.4
    • Update client:push command with new resolver and more output #1290
  • apollo-language-server@1.9.0
    • update stats window types #1292
    • Allow configuration of validation rules #1288
  • vscode-apollo@1.7.0
    • Allow configuration of validation rules #1288

apollo@2.12.3, apollo-language-server@1.8.4

apollo@2.12.1, apollo-language-server@1.8.3

  • apollo@2.12.1
    • Add debugging logs to apollo client:push and apollo service:push # 1273
    • remove apollo service:info command, since it's undocumented and unused #1274
  • apollo-language-server@1.8.3
    • Fix __typename addition for InlineFragments #1286

apollo-codegen-flow@0.33.10, apollo-codegen-typescript@0.34.0, vscode-apollo@1.6.10

  • apollo-codegen-flow@0.33.10
    • Renamed useFlowReadOnlyTypes option to useReadOnlyTypes #1205
  • apollo-codegen-typescript@0.34.0
    • Added useReadOnlyTypes option to use readonly types #1205
  • vscode-apollo@1.6.10
    • Fix defaultValue syntax highlighting #1269
    • Fix single quote syntax highlighting #1270

apollo@2.11.1, apollo-language-server@1.8.1, vscode-apollo@1.6.9

  • apollo@2.11.1
    • Document engine requirements in client:check and client:push #1077
  • apollo-language-server@1.8.1
    • Fix windows file paths by normalizing all URIs to a consistent format #1213.
    • Fix positionToOffset to consider windows line endings #1213.
  • vscode-apollo@1.6.9
    • Add env variable to silence TLS errors #1212

apollo@2.11.0, apollo-language-server@1.8.0, apollo-graphql@0.3.0, apollo-language-server@1.8.0, apollo-env@0.5.0

  • apollo@2.11.0
    • Leverage updates to apollo-language-server to support federated services #1251
    • Add service:delete command for deleting federated services #1251
  • apollo-env@0.5.0
    • Add new utils and predicates #1251
  • apollo-graphql@0.3.0
    • Require graphql@^14.2.1 #1251
    • Add buildSchemaFromSDL and related utilities for constructing partial schemas #1251
    • Add transformSchema and related utilities for easily transforming schemas #1251
  • apollo-language-server@1.8.0
    • Fix windows file paths by normalizing all URIs to a consistent format #1213.
    • Fix positionToOffset to consider windows line endings #1213.
    • Extend Engine API for federated schema uploads and checks #1251
    • Reorganize files and exports #1251

apollo@2.10.3

  • apollo@2.10.3
    • Add service:check debuggability #1250

apollo@2.10.2

  • apollo@2.10.2
    • Relocate debug statements #1245

apollo@2.10.1

  • apollo@2.10.1
    • Add service:push debuggability #1244

apollo@2.10.0

  • apollo@2.10.0
    • Add client:download-schema command to download schemas from engine to an output file #1108

apollo@2.9.0, apollo-language-server@1.7.0

  • apollo@2.9.0
    • Support local schema files in service:check #1118
  • apollo-language-server@1.7.0
    • Fix on-hover bugs introduced by replacing visitWithTypeInfo #1196
    • Add gql extension to the default includes configuration #1176
    • Simple perf improvements (debouncer + cache) #1206

apollo@2.8.3

  • apollo@2.8.3
    • Update service:check output for errors and correct pluralization #1178

apollo@2.8.2

  • apollo@2.8.2
    • Update service:check's --markdown output to include clients affected, number of operations checked, pluralization improvements, and backticks around service and schema variant #1164
    • Update service:check output to show failures before passes #1168

apollo@2.8.1

  • apollo@2.8.1
    • Add git info back to checkSchema to fix detail links#1165
  • apollo-language-server@1.6.2

apollo@2.8.0

  • apollo@2.8.0
    • Add --markdown output option to service:check #1072
    • Enhance formatting for service:check output #1146
  • apollo-language-server@1.6.1

apollo@2.7.0, apollo-vscode@1.6.0

  • apollo@2.7.0
    • Update operation normalization technique to deterministically order fragments within operations. This update affects those users of the operation registry feature of the Apollo Platform. Anyone using the operation registry should re-register their operations with this new version of the apollo CLI via the apollo client:push command. Once all client operations are re-registered, the apollo-server-plugin-operation-manifest plugin within Apollo Server (which reads the manifest published with apollo client:push) should be updated to 0.1.0-alpha.1. #1158
  • apollo-language-server@1.6.0
    • Stop loadConfig from looking up the tree when a --config location is defined #1059
    • Refactored/documented/tested loadConfig #1059
    • Add .vue file support for codegen:generate #1160

apollo-codegen-flow@0.32.11

  • apollo-codegen-flow@0.32.11
    • remove leading empty lines from generated code #1127

apollo@2.6.2

  • apollo@2.6.2
    • fix remoteUrl(remove slug) for service:check #1121

apollo-graphql@0.2.0

  • apollo-graphql@0.2.0
    • Change the sortAST algorithm to sort fragments at the top-level of the DocumentNode, providing a more deterministic normalization of the operation for use by apollo-engine-reporting (which consumes this package's defaultOperationRegistrySignature function). This will more correctly combine operations for Engine reporting. This also adds a defaultOperationRegistrySignature function for use by the apollo-server-plugin-operation-registry plugin to eventually consume. #1112

apollo@2.6.1, apollo-env@0.4.0

  • apollo@2.6.1
    • JSON flag for service:check output #1079
  • apollo-env@0.4.0
    • Add environment-aware createHash function to apollo-env #1110

apollo@2.6.0, apollo-env@0.3.4, apollo-language-server@1.5.3, apollo-codegen-flow@0.32.9, apollo-codegen-scala@0.33.5, apollo-codegen-swift@0.32.9, apollo-codegen-typescript@0.32.10, apollo-graphql@0.1.2

  • apollo@2.6.0
    • Use generated Typescript types via client:codegen #1016
    • Remove default --tag=current for some client commands that used it #1062
    • Add missing dependency @oclif/errors #1068
    • Include targetUrl in the output of the service:check command #1072
    • Import apollo-env utility types directly instead of treating them as globals #1074
  • apollo-env@0.3.4
    • Import apollo-env utility types directly instead of treating them as globals #1074
  • apollo-language-server@1.5.3
    • Import apollo-env utility types directly instead of treating them as globals #1074
  • apollo-codegen-flow@0.32.9
    • Add missing dependencies @babel/generator, common-tags #1071
  • apollo-codegen-scala@0.33.5
    • The keyword "type" is escaped when generating scala.js via client:codegen #1066
    • Add missing dependencies @babel/generator, common-tags #1071
  • apollo-codegen-swift@0.32.9
    • Add missing dependencies @babel/generator, common-tags #1071
  • apollo-codegen-typescript@0.32.10
    • Add missing dependencies @babel/generator, common-tags #1071
  • apollo-graphql@0.1.2
    • Expand the graphql peer dependency range of apollo-graphql to also include 0.13.x and 0.12.x in addition to 14.x, since the apollo-graphql package is relied upon by apollo-server-core which specifies those requirements itself. #1076

apollo-language-server@1.5.2, vscode-apollo@1.5.2

  • apollo-language-server@1.5.2
    • fix single apollo.config breaking others loaded at the same time #1055
    • Fix broken fileSet.includesFile to use full filepath #1055
  • vscode-apollo@1.5.2

apollo@2.5.2, apollo-language-server@1.5.1, vscode-apollo@1.5.1

  • apollo@2.5.2
    • Fix a bug where tagging a build will cause the tool to not be able to figure out where the git repo is #944
    • Re-enable logging for codegen when in watch mode #1039
  • apollo-language-server@1.5.1
    • Added a warning when there are 0 files found in a project #1007
    • Allow relative paths in includes/excludes globs #1007
  • vscode-apollo@1.5.1
    • Updated marketplace readme, color schemes, and icon to be prettier #942

apollo-codegen-typescript@0.32.7, apollo-codegen-scala@0.33.2, apollo-graphql@1.0.2

  • apollo-codegen-typescript@0.32.7
    • Add /* eslint-disable */ in generated files header #1017
  • apollo-codegen-scala@0.33.2
    • Fix types sometimes being emitted with fields that don't match the underlying data #1008
  • apollo-graphql@1.0.2
    • Move apollo-graphql package from apollo-server to apollo-tooling

apollo@2.5.0, apollo-language-server@1.5.0, vscode-apollo@1.5.0

  • apollo@2.5.0
    • Support validation parameters for service:check #953
    • Leverage nullability of validation parameters #1006
    • Unpin graphql version #1010
  • apollo-language-server@1.5.0
    • Better error handling in ApolloEngineClient #953
    • Fix language server mis-reporting client identity for schema loading operation #940
    • Unpin graphql version #1010
  • vscode-apollo@1.5.0
    • Fix inline graphql highlighting in Vue <script> tags #981
    • Fix graphql comments not being highlighted correctly #907

apollo@2.4.4, apollo-codegen-scala@0.33.0

  • apollo@2.4.4
    • remove schemaDiff and change types from code/exports #967
  • apollo-codegen-scala@0.33.0
    • Generate additional case-class like APIs for data containers #943

apollo-env@0.3.1

  • apollo-env@0.3.1
    • Fix core-js dependency by pinning to 3.0.0-beta.3 #961

apollo-language-server@1.4.1

  • apollo-language-server 1.4.1
    • Fix edge case for empty operations #959

apollo@2.4.1

  • apollo 2.4.1
    • Bump the apollo-engine-reporting version #950

apollo@2.4.0, apollo-language-server@1.4.0, vscode-apollo@1.4.1

  • apollo 2.4.0
    • Fix configuration loading and schema tag support #925
    • Improve client:check output #934
  • apollo-language-server 1.4.0
    • Replace checkOperations mutation with new validateOperations mutation #934
    • Include config files into a project's fileSet #897
    • Add hook into workspace for communicating out when configs are loaded or when errors are found #897
    • Add fn to workspace for reloading a project with a given config URI #897
    • Reload project when config file is changed #897
    • Update error handling from within the server (send as message). This message can be listened for and handled by the consumer #897
  • vscode-apollo 1.4.1
    • Update statusBar to reflect new possible "warning" states #897

apollo@2.3.1

  • apollo@2.3.1
    • Fixed path building issues on Windows #917

apollo@2.3.0

  • apollo@2.3.0
    • Fixed filesystem issues on Windows #810
    • Fixed codegen for Scala users #686
  • vscode-apollo@1.4.0
    • Added a status bar action to show service stats in client projects #840
    • Added monorepo support for multiple projects open at once #840
  • apollo-language-server@1.3.0
    • Added listener for getStats to provide service stats for extensions #840

apollo@2.1.9

  • apollo@2.1.9
    • Add fallback for git branch calculation #871

apollo@2.1.8

  • apollo@2.1.8
    • Pass correct headers to Client Project #790
    • Fix header parsing #790
    • Added --tagName flag #793
  • apollo-language-server@1.1.8
    • Load the env file earlier during configuration in order to infer the service name before it's required #815
  • vscode-apollo@1.2.8
  • @apollographql/apollo-tools@0.2.9 Pass directives from schema modules through buildServiceDefinition #715

apollo@2.1.7

  • apollo@2.1.7
    • Allow --no-addTypename #758
  • apollo-language-server@1.1.7
    • Use tagName from config to extract documents. #769
    • Fix --key flag/env variable precendece to prefer env variable when present #770
  • vscode-apollo@1.2.7

apollo@2.1.6

  • apollo@2.1.6
  • apollo-language-server@1.1.6
    • Associate *.gql files with graphql language in GraphQLProject #740
  • vscode-apollo@1.2.6
    • Pin event-stream version to 3.3.4 within vscode-apollo commit

apollo@2.1.5

  • apollo@2.1.5
  • apollo-language-server@1.1.5
    • Fix Empty 'errors' list in introspection #741
  • vscode-apollo@1.2.5

apollo@2.1.4

  • apollo@2.1.4
    • Restore skipSSLValidation flag #735
    • Stop excluding object and list literals from operation manifests. #738
  • apollo-language-server@1.1.4
    • Fix go to definition when a local schema file is provided #727
  • vscode-apollo@1.2.4

apollo@2.1.3

  • apollo@2.1.3
    • Support localSchemaFile flag to push to a service from local schema #710
    • Fix to allow fragment-only documents in codegen #707
    • Add support for queries, includes, and excludes flags for codegen #733
  • vscode-apollo@1.2.3
    • Create Apollo output channel commit
  • apollo-language-server@1.1.3
    • Fix edge case when no config is provided #734

apollo@2.1.1

  • apollo@2.1.1
  • vscode-apollo@1.2.1
  • apollo-language-server@1.1.1
    • Allow custom config locations #699
    • Fix swallowing of errors from Engine #705
  • apollo-codegen-core@0.30.1
    • Warn on GraphQL parser exceptions #642

apollo@2.1.0

  • apollo@2.1.0
    • Fix incorrect error code in cli #691
  • apollo-language-server@1.1.0
    • Added Python operation extraction #693
    • Fix column offset for editor error annotations #692
  • vscode-apollo@1.2.0
    • Added Python support for vscode #694

apollo@2.0.17

  • apollo@2.0.17
  • apollo-language-server@1.0.14
    • Updated code comments commit -vscode-apollo@1.1.12

apollo@2.0.16

  • apollo@2.0.16
    • Fixed codegen message printing number of generated files #682
  • apollo-language-server@1.0.13
  • vscode-apollo@1.1.11
    • Updated readme with correct links #689
    • Updated package.json with correct name and description commmit

apollo@2.0.15

  • apollo@2.0.15
  • apollo-language-server@2.0.15
    • Fixed incorrect client identifier commit -vscode-apollo@1.1.9

apollo@2.0.14

  • apollo@2.0.14
  • apollo-language-server@1.0.11
    • Add apollo config for CI checks commit
  • vscode-apollo@1.1.8
    • Add watch command before launching extension in dev mode commit

apollo@2.0.13

  • apollo@2.0.13
    • add alias to service:download from schema:download commit

apollo@2.0.12

  • apollo@2.0.12
    • added alias to service:check from schema:check commit
    • Add support for localSchemaFile in client config #676
  • apollo-language-server@1.0.10
  • vscode-apollo@1.1.7

apollo@2.0.11

  • apollo@2.0.11
  • apollo-language-server@1.0.9
  • vscode-apollo@1.1.6

apollo@2.0.10

  • apollo@2.0.10
  • vscode-apollo@1.1.5
  • @apollographql/apollo-tools
    • Add apollo-env dependency

apollo@2.0.9

  • apollo@2.0.9
    • Respect --endpoint and --headers flags for client:* commands commit
  • apollo-language-server@1.0.7
    • Fixed handling of missing client or client.service config key commit
    • Fixed issue of trying to load engine data when there's no API key commit
  • vscode-apollo@1.1.4

apollo@2.0.8

  • apollo@2.0.8
    • Fixed issue with package lockfile commit

apollo@2.0.7

  • apollo@2.0.7
  • apollo-language-server@1.0.5
    • Fix mutations to engine for schema uploads & operation registration commit
  • vscode-apollo@1.1.2

apollo@2.0.6

  • apollo@2.0.6
  • apollo-language-server@1.0.4
    • Changed engine queries to use me field instead of service to look up services commit
  • vscode-apollo@1.1.1

apollo@2.0.5

  • apollo@2.0.5
    • Fix schema tag diagnostics
    • Provide ability to go from sdl to operations via references commit
  • vscode-apollo@1.1.0

apollo@2.0.4

  • apollo@2.0.4
    • Fixed config to only use service name from the correct key types commit
    • Adjust priority of engine api key parsing to prefer flag over env key commit

apollo@2.0.3

  • apollo@2.0.3
    • Fallback to using the engine service from the api key if not specified in configs commit
  • vscode-apollo@1.0.3

apollo@2.0.2

  • apollo@2.0.2
    • fixed missing dotenv dependency #663
  • vscode-apollo@1.0.2

apollo@2.0.1

  • apollo@2.0.1
    • Added better errors around missing services
    • Updated config documentation
    • Fixed failures with missing service name

:tada: apollo@2.0.0 :tada:

NOTE: Many of the updates and changes in this release came from a complete rebuild of the Apollo CLI in preparation for GraphQL summit. Many of these changes can be traced to this commit but aren't tied to a specific pull request, and won't be linked.

  • apollo@2.0.0
    • :rocket: Features
      • queries:register to register operations with the apollo platform #621
      • Update graphql to version 14 #624
      • Supports a .env file for engine API keys commit
    • :bug: Fixes & Changes
      • Fixed config file resolution #591
    • :boom: Breaking Changes
      • Introduced a new apollo.config.js format commit
      • Changed format of queries:extract manifest to be more extensible #611
      • Changed manifest hash encoding to SHA-256 instead of SHA-512 #611
      • Deprecated apollo schema:*, and codegen:* commands and aliased usage to new commands
        • apollo codegen:generate aliases to apollo client:codegen
        • apollo schema:check aliases to apollo service:check
        • apollo schema:download aliases to apollo service:download (added 2.0.13)
        • apollo schema:publish aliases to apollo service:push
        • apollo plugins:add aliases to apollo plugins:install
        • apollo plugins:unlink and apollo plugins:remove aliases to apollo plugins:uninstall
      • Removed apollo queries:* commands
        • apollo client:check should be used in place of apollo queries:check
        • apollo client:extract should be used in place of apollo queries:extract
      • Deprecated --queries flag in client commands in place of the --includes flag
  • apollo-language-server@1.0.0
    • Initial release of apollo-language-server to support vscode-apollo, and apollo
    • Supports editor features for...
      • Autocompletion of GraphQL documents
      • Hover information for fields anr arguments
      • Type definitions and references
      • Code lenses for open files
  • vscode-apollo@1.0.0
    • Initial Release of vscode-apollo
    • Switching of schema tags #632
    • Supports all of the editor features exposed by apollo-language-server

apollo@1.9.2

  • apollo@1.9.2
    • Fixed codegen issues listed below
  • apollo-language-server@0.1.10
    • Fixed version of vscode-languageserver to follow a stable version instead of next
  • apollo-codegen-swift@0.28.1
    • Fixed swift enums to conform to Hashable #578
  • apollo-codegen-core@0.28.1
    • Fixed mergeInFieldsFromFragmentSpreads when flag isn't specified #537

apollo@1.9.1

  • apollo@1.9.1
    • Fixes formatting of the schema:download response to match previous codegen schemas #573

apollo@1.9.0

  • apollo@1.9.0
    • Added queries:extract command to write a manifest of client queries #553

v1.8.3

  • apollo
  • apollo-codegen-swift
    • Treat mergeInFieldsFromFragmentSpreads as false in Swift codegen when flag isn't specified. Fixes #537. @martijnwalraven)

v1.7.1

:rocket: Feature

  • apollo-codegen-typescript
    • #535 [TS] Sort global types so order is not determined by order of appearance (@danilobuerger)

:bug: Bug Fix

  • apollo-codegen-typescript
    • #544 Prepend ./ to TS relative paths to make them valid, Closes #543 (@shadaj)
  • apollo-cli
    • #534 Allow to run apollo codegen:generate --watch on non tty devices (@trojanowski)

Committers: 3

v1.7.0

:rocket: Feature

  • apollo-language-server, apollo-vscode
    • #536 Display status of loading tasks for config and Engine stats (@shadaj)
  • apollo-cli
    • #533 Fall back to other methods of schema loading when one fails (@shadaj)
  • apollo-cli, apollo-codegen-typescript
    • #525 [TS] Elimate newlines at beginning of file and add newline at end of file (@danilobuerger)
  • apollo-cli, apollo-codegen-core
    • #526 Scan all files for queries and reduce use of default endpoints (@shadaj)
  • apollo-cli, apollo-codegen-typescript, common-test
  • apollo-codegen-typescript

:bug: Bug Fix

  • apollo-cli, apollo-language-server, apollo-vscode
    • #519 [VSCode] Fix detection of projects inside folders (@shadaj)
  • apollo-cli

:memo: Documentation

Committers: 3

v1.6.0

:rocket: Feature

  • apollo-language-server
  • apollo-language-server, apollo-vscode
    • #515 Fix missing descriptions and add more hover information for arguments (@shadaj)
  • apollo-cli, apollo-codegen-core, apollo-language-server, apollo-vscode-webview, apollo-vscode
    • #512 React UI for webviews, fix file tracking and fragment spreads (@shadaj)
  • apollo-cli, apollo-language-server, apollo-vscode
    • #508 Support jumping to definitions in schema (@shadaj)

:memo: Documentation

:house: Internal

  • apollo-cli, apollo-language-server
    • #506 Share validation logic between CLI and language server (@shadaj)

Committers: 2

v1.5.0

:rocket: Feature

  • apollo-language-server, apollo-vscode
  • apollo-cli, apollo-codegen-core
    • #497 Load config from apollo.config.js or package.json (@shadaj)

:house: Internal

  • apollo-cli
    • #492 Make TypeScript options more consistent across packages (@shadaj)

Committers: 1

v1.4.0

:rocket: Feature

  • apollo-cli
    • #484 Support file watching for codegen:generate (@shadaj)
    • #490 Assume the output is a directory when it has no extension (@shadaj)
    • #485 Support loading server-side schema from JS/TS files (@shadaj)
    • #483 Support generating based on .graphql schema files (@shadaj)

:bug: Bug Fix

  • apollo-cli, apollo-codegen-core
    • #488 Handle cases when storing server-defined models in local state (@shadaj)

:house: Internal

  • apollo-cli

Committers: 1

v1.3.0

:rocket: Feature

  • apollo-cli, apollo-codegen-core
    • #480 Initial support for client-side schemas (@shadaj)

:house: Internal

  • apollo-cli, apollo-codegen-core, apollo-codegen-flow-legacy, apollo-codegen-flow, apollo-codegen-scala, apollo-codegen-swift, apollo-codegen-typescript-legacy, apollo-codegen-typescript
    • #479 Run build before publishing to prevent uploading stale code (@shadaj)

Committers: 1

v1.2.0

:rocket: Feature

:bug: Bug Fix

  • apollo-cli, apollo-codegen-core
    • #465 Improve typing of options and add more codegen tests (@shadaj)
    • #464 Command-level unit tests for codegen (@shadaj)
  • apollo-cli
    • #470 Restore ability to put generated files in a directory relative to source (@mike-marcacci)
    • #457 Allow legacy targets to be used when manually specified (@shadaj)
  • apollo-codegen-flow
    • #461 Change generated flow files extension to .js instead of .ts (@TLadd)

:memo: Documentation

  • apollo-cli

:house: Internal

  • Other
    • #477 Add lerna-changelog to manage generating changelogs (@shadaj)
  • apollo-cli, apollo-codegen-core
    • #465 Improve typing of options and add more codegen tests (@shadaj)
    • #464 Command-level unit tests for codegen (@shadaj)

Committers: 5

Legacy Apollo Codegen Changelog

v0.20.2

  • The TypeScript and Flow targets now use block comments to better handle multiline comments in schemas
  • Fix crash when running on a version of Node that already supports Array.flatMap

v0.20.1

  • Fix issue with flow-legacy target being unusable

v0.20.0

  • BREAKING: The typescript and flow targets now refer to the modern implementations. The deprecated legacy targets are available under typescript-legacy and flow-legacy.
  • BREAKING: The --output parameter to the CLI is now required for all targets.
  • The TypeScript and Flow targets now support outputting types to either a single file or a directory, where types for each query will be separated