Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
417 changes: 8 additions & 409 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/apollo-codegen-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-codegen-core",
"description": "Core generator APIs for Apollo Codegen",
"version": "0.32.10",
"version": "0.32.11-alpha.0",
"author": "Apollo GraphQL <opensource@apollographql.com>",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-codegen-flow/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-codegen-flow",
"description": "Flow generator module for Apollo Codegen",
"version": "0.32.10",
"version": "0.32.11-alpha.0",
"author": "Apollo GraphQL <opensource@apollographql.com>",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-codegen-scala/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-codegen-scala",
"description": "Scala generator module for Apollo Codegen",
"version": "0.33.6",
"version": "0.33.7-alpha.0",
"author": "Apollo GraphQL <opensource@apollographql.com>",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-codegen-swift/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-codegen-swift",
"description": "Swift generator module for Apollo Codegen",
"version": "0.32.10",
"version": "0.32.11-alpha.0",
"author": "Apollo GraphQL <opensource@apollographql.com>",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-codegen-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-codegen-typescript",
"description": "TypeScript generator module for Apollo Codegen",
"version": "0.32.11",
"version": "0.32.12-alpha.0",
"author": "Apollo GraphQL <opensource@apollographql.com>",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-language-server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-language-server",
"description": "A language server for Apollo GraphQL projects",
"version": "1.5.4",
"version": "1.5.5-alpha.0",
"author": "Apollo GraphQL <opensource@apollographql.com>",
"license": "MIT",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ export const REGISTER_OPERATIONS = gql`
$id: ID!
$clientIdentity: RegisteredClientIdentityInput!
$operations: [RegisteredOperationInput!]!
$manifestVersion: Int!
) {
service(id: $id) {
registerOperations(
clientIdentity: $clientIdentity
operations: $operations
manifestVersion: $manifestVersion
)
}
}
Expand Down
16 changes: 1 addition & 15 deletions packages/apollo-language-server/src/graphqlTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export interface RegisterOperationsVariables {
id: string;
clientIdentity: RegisteredClientIdentityInput;
operations: RegisteredOperationInput[];
manifestVersion: number;
}

/* tslint:disable */
Expand Down Expand Up @@ -153,9 +154,6 @@ export interface SchemaTagInfo_service {
}

export interface SchemaTagInfo {
/**
* Service by ID
*/
service: SchemaTagInfo_service | null;
}

Expand Down Expand Up @@ -194,13 +192,7 @@ export interface SchemaTagsAndFieldStats_service_stats_fieldStats_metrics {

export interface SchemaTagsAndFieldStats_service_stats_fieldStats {
__typename: "ServiceFieldStatsRecord";
/**
* Dimensions of ServiceFieldStats that can be grouped by.
*/
groupBy: SchemaTagsAndFieldStats_service_stats_fieldStats_groupBy;
/**
* Metrics of ServiceFieldStats that can be aggregated over.
*/
metrics: SchemaTagsAndFieldStats_service_stats_fieldStats_metrics;
}

Expand All @@ -219,9 +211,6 @@ export interface SchemaTagsAndFieldStats_service {
}

export interface SchemaTagsAndFieldStats {
/**
* Service by ID
*/
service: SchemaTagsAndFieldStats_service | null;
}

Expand Down Expand Up @@ -780,9 +769,6 @@ export interface GetSchemaByTag_service_Service {
export type GetSchemaByTag_service = GetSchemaByTag_service_User | GetSchemaByTag_service_Service;

export interface GetSchemaByTag {
/**
* Current identity, null if not authenticated
*/
service: GetSchemaByTag_service | null;
}

Expand Down
14 changes: 7 additions & 7 deletions packages/apollo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ npm install -g apollo
$ apollo COMMAND
running command...
$ apollo (-v|--version|version)
apollo/2.6.2 darwin-x64 node-v10.14.1
apollo/3.0.0-alpha.2 darwin-x64 node-v8.15.1
$ apollo --help [COMMAND]
USAGE
$ apollo COMMAND
Expand Down Expand Up @@ -96,11 +96,11 @@ 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
- 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
- For all other types, this defines a file (absolute or relative to the current working directory) to which all
generated types are written.

OPTIONS
Expand Down Expand Up @@ -308,15 +308,15 @@ DESCRIPTION

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
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 myplugin
$ apollo plugins:install https://github.com/someuser/someplugin
$ apollo plugins:install someuser/someplugin
```
Expand All @@ -341,7 +341,7 @@ OPTIONS
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'
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
Expand Down
4 changes: 2 additions & 2 deletions packages/apollo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo",
"description": "Command line tool for Apollo GraphQL",
"version": "2.6.2",
"version": "3.0.0-alpha.2",
"referenceID": "21ad0845-c235-422e-be7d-a998310df972",
"author": "Apollo GraphQL <opensource@apollographql.com>",
"license": "MIT",
Expand Down Expand Up @@ -45,8 +45,8 @@
"apollo-codegen-scala": "file:../apollo-codegen-scala",
"apollo-codegen-swift": "file:../apollo-codegen-swift",
"apollo-codegen-typescript": "file:../apollo-codegen-typescript",
"apollo-engine-reporting": "0.2.2",
"apollo-env": "file:../apollo-env",
"apollo-graphql": "file:../apollo-graphql",
"apollo-language-server": "file:../apollo-language-server",
"chalk": "2.4.2",
"cli-ux": "4.9.3",
Expand Down
95 changes: 29 additions & 66 deletions packages/apollo/src/commands/client/extract.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
import { createHash } from "crypto";
import { writeFileSync } from "fs";
import {
printWithReducedWhitespace,
sortAST,
defaultSignature as engineDefaultSignature
} from "apollo-engine-reporting";
import { DocumentNode } from "graphql";

import { ClientCommand } from "../../Command";
import { hideCertainLiterals } from "./push";

// XXX this is duplicated code
const manifestOperationHash = (str: string): string =>
createHash("sha256")
.update(str)
.digest("hex");

const engineSignature = (_TODO_operationAST: DocumentNode): string => {
// TODO. We don't currently have access to the operation name since it's
// currently omitted by the `apollo-codegen-core` package logic.
return engineDefaultSignature(_TODO_operationAST, "TODO");
};
import {
getOperationManifestFromProject,
ManifestEntry
} from "../../utils/getOperationManifestFromProject";
import { ClientIdentity } from "apollo-language-server";

export default class ClientExtract extends ClientCommand {
static description = "Extract queries from a client";
Expand All @@ -38,52 +22,31 @@ export default class ClientExtract extends ClientCommand {
];

async run() {
const { clientIdentity, operations, filename }: any = await this.runTasks(
({ flags, project, config, args }) => [
{
title: "Extracting operations from project",
task: async ctx => {
const operations = Object.values(
this.project.mergedOperationsAndFragmentsForService
).map(operationAST => {
// While this could include dropping unused definitions, they are
// kept because the registered operations should mirror those in the
// client bundle minus any PII which lives within string literals.
const printed = printWithReducedWhitespace(
sortAST(hideCertainLiterals(operationAST))
);

return {
signature: manifestOperationHash(printed),
document: printed,
metadata: {
engineSignature: engineSignature(operationAST)
}
};
});

ctx.operations = operations;
ctx.clientIdentity = config.client;
}
},
{
title: "Outputing extracted queries",
task: (ctx, task) => {
const filename = args.output;
task.title = "Outputing extracted queries to " + filename;
ctx.filename = filename;
writeFileSync(
filename,
JSON.stringify(
{ version: 1, operations: ctx.operations },
null,
2
)
);
}
const { clientIdentity, operations, filename } = await this.runTasks<{
clientIdentity: ClientIdentity;
operations: ManifestEntry[];
filename: string;
}>(({ flags, project, config, args }) => [
{
title: "Extracting operations from project",
task: async ctx => {
ctx.operations = getOperationManifestFromProject(this.project);
ctx.clientIdentity = config.client;
}
]
);
},
{
title: "Outputing extracted queries",
task: (ctx, task) => {
const filename = args.output;
task.title = "Outputing extracted queries to " + filename;
ctx.filename = filename;
writeFileSync(
filename,
JSON.stringify({ version: 2, operations: ctx.operations }, null, 2)
);
}
}
]);

this.log(
`Successfully wrote ${operations.length} operations from the ${
Expand Down
Loading