From 7b22548165a9c3450cd64538230447537a2ef061 Mon Sep 17 00:00:00 2001 From: Evans Hauser Date: Mon, 20 May 2019 12:23:28 -0700 Subject: [PATCH] remove service:info command (#1274) * service:info remove command This removes the `apollo service:info` command. Currently `apollo service:info` is not in the documentation. Additionally the information for a service is inside of the Apollo UI, so this command adds unnecessary noise. Additionally, the command has only been called [once in the last year](https://engine-staging.apollographql.com/service/engine/metrics?from=2018-04-17T23%3A25%3A00.000Z&query=5b4a5cb5ae6ed5af6c3b0422a31bda82cd12ca20&queryName=SchemaTagInfo&range=custom&schemaTag=prod&search=SchemaTagInfo&to=2019-05-17T23%3A25%3A00.000Z), so I suggest we make this a non-breaking change. * update changelog * update graphql types --- CHANGELOG.md | 1 + .../src/engine/index.ts | 10 --- .../src/engine/operations/schemaTagInfo.ts | 18 ------ .../src/graphqlTypes.ts | 49 --------------- packages/apollo/src/commands/service/info.ts | 62 ------------------- 5 files changed, 1 insertion(+), 139 deletions(-) delete mode 100644 packages/apollo-language-server/src/engine/operations/schemaTagInfo.ts delete mode 100644 packages/apollo/src/commands/service/info.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 79bf0628a2..ca7cb14852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - `apollo` - Add debugging logs to `apollo client:push` and `apollo service:push` [# 1273](https://github.com/apollographql/apollo-tooling/pull/1273) + - remove `apollo service:info` command, since it's undocumented and unused [#1274](https://github.com/apollographql/apollo-tooling/pull/1274) - `apollo-codegen-core` - - `apollo-codegen-flow` diff --git a/packages/apollo-language-server/src/engine/index.ts b/packages/apollo-language-server/src/engine/index.ts index d06ca06120..0cdd900be0 100644 --- a/packages/apollo-language-server/src/engine/index.ts +++ b/packages/apollo-language-server/src/engine/index.ts @@ -20,14 +20,11 @@ import { ValidateOperations, ValidateOperationsVariables, SchemaTagsAndFieldStats, - SchemaTagInfo, - SchemaTagInfoVariables, CheckPartialSchema, CheckPartialSchemaVariables, RemoveServiceAndCompose, RemoveServiceAndComposeVariables } from "../graphqlTypes"; -import { SCHEMA_TAG_INFO_QUERY } from "./operations/schemaTagInfo"; export interface ClientIdentity { name?: string; @@ -278,11 +275,4 @@ export class ApolloEngineClient extends GraphQLDataSource { return { schemaTags, fieldStats }; } - - public async schemaTagInfo(variables: SchemaTagInfoVariables) { - return this.execute({ - query: SCHEMA_TAG_INFO_QUERY, - variables - }); - } } diff --git a/packages/apollo-language-server/src/engine/operations/schemaTagInfo.ts b/packages/apollo-language-server/src/engine/operations/schemaTagInfo.ts deleted file mode 100644 index 18e17fb78f..0000000000 --- a/packages/apollo-language-server/src/engine/operations/schemaTagInfo.ts +++ /dev/null @@ -1,18 +0,0 @@ -import gql from "graphql-tag"; - -export const SCHEMA_TAG_INFO_QUERY = gql` - query SchemaTagInfo($service: ID!, $tag: String = "current") { - service(id: $service) { - schema(tag: $tag) { - hash - gitContext { - committer - commit - } - fieldCount - typeCount - createdAt - } - } - } -`; diff --git a/packages/apollo-language-server/src/graphqlTypes.ts b/packages/apollo-language-server/src/graphqlTypes.ts index 3575a8c258..deb4a185c9 100644 --- a/packages/apollo-language-server/src/graphqlTypes.ts +++ b/packages/apollo-language-server/src/graphqlTypes.ts @@ -327,55 +327,6 @@ export interface RemoveServiceAndComposeVariables { /* eslint-disable */ // This file was automatically generated and should not be edited. -// ==================================================== -// GraphQL query operation: SchemaTagInfo -// ==================================================== - -export interface SchemaTagInfo_service_schema_gitContext { - __typename: "GitContext"; - committer: string | null; - commit: string; -} - -export interface SchemaTagInfo_service_schema { - __typename: "Schema"; - hash: string; - gitContext: SchemaTagInfo_service_schema_gitContext | null; - /** - * The number of fields; this includes user defined fields only, excluding built-in types and fields - */ - fieldCount: number; - /** - * The number of types; this includes user defined types only, excluding built-in types - */ - typeCount: number; - createdAt: any; -} - -export interface SchemaTagInfo_service { - __typename: "Service"; - /** - * Get a schema by hash OR current tag - */ - schema: SchemaTagInfo_service_schema | null; -} - -export interface SchemaTagInfo { - /** - * Service by ID - */ - service: SchemaTagInfo_service | null; -} - -export interface SchemaTagInfoVariables { - service: string; - tag?: string | null; -} - -/* tslint:disable */ -/* eslint-disable */ -// This file was automatically generated and should not be edited. - // ==================================================== // GraphQL query operation: SchemaTagsAndFieldStats // ==================================================== diff --git a/packages/apollo/src/commands/service/info.ts b/packages/apollo/src/commands/service/info.ts deleted file mode 100644 index 9e26c30338..0000000000 --- a/packages/apollo/src/commands/service/info.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { flags } from "@oclif/command"; -import { table } from "heroku-cli-util"; -import { ProjectCommand } from "../../Command"; -import { SchemaTagInfo_service_schema } from "apollo-language-server/lib/graphqlTypes"; - -export default class ServiceDownload extends ProjectCommand { - static description = "Download the info of your service from Engine"; - static hidden = true; - static flags = { - ...ProjectCommand.flags, - tag: flags.string({ - char: "t", - description: "The published tag of the schema", - default: "current" - }) - }; - - async run() { - const { schema } = await this.runTasks<{ - schema: SchemaTagInfo_service_schema; - }>(({ args, project, flags }) => [ - { - title: `Getting information about service`, - task: async ctx => { - if (!project.config.name) { - throw new Error("A service name is required but wasn't found"); - } - - const { data, errors } = await project.engine.schemaTagInfo({ - tag: flags.tag, - service: project.config.name - }); - - if (errors) { - throw new Error(errors.map(error => error.message).join("\n")); - } - - if (!(data && data.service)) { - throw new Error(`Error loading service information`); - } - - ctx.schema = data.service.schema; - } - } - ]); - const { hash, fieldCount, typeCount, createdAt } = schema; - this.log("\n"); - table([{ hash, types: typeCount, fields: fieldCount, createdAt }], { - columns: [ - { - key: "hash", - label: "id", - format: (hash: string) => hash.slice(0, 6) - }, - { key: "types" }, - { key: "fields" }, - { key: "createdAt", label: "created date" } - ] - }); - this.log("\n"); - } -}