graphql-ruby-client
Advanced tools
Comparing version 1.7.7 to 1.7.8
# graphql-ruby-client | ||
## 1.7.8 (1 May 2020) | ||
- `sync`: Add support for Apollo-Android's `OperationOutput.json` #2914 | ||
## 1.7.7 (15 Apr 2020) | ||
@@ -4,0 +8,0 @@ |
@@ -12,3 +12,3 @@ #!/usr/bin/env node | ||
if (argv.help || argv.h) { | ||
console.log("usage: graphql-ruby-client sync <options>\n\n Read .graphql files and push the contained\n operations to a GraphQL::Pro::OperationStore\n\nrequired arguments:\n --url=<endpoint-url> URL where data should be POSTed\n --client=<client-name> Identifier for this client application\n\noptional arguments:\n --path=<path> Path to .graphql files (default is \"./**/*.graphql\")\n --outfile=<generated-filename> Target file for generated code\n --outfile-type=<type> Target type for generated code (default is \"js\")\n --key=<key> HMAC authentication key\n --relay-persisted-output=<path> Path to a .json file from \"relay-compiler ... --persist-output\"\n (Outfile generation is skipped by default.)\n --mode=<mode> Treat files like a certain kind of project:\n relay: treat files like relay-compiler output\n project: treat files like a cohesive project (fragments are shared, names must be unique)\n file: treat each file like a stand-alone operation\n\n By default, this flag is set to:\n - \"relay\" if \"__generated__\" in the path\n - otherwise, \"project\"\n --add-typename Automatically adds the \"__typename\" field to your queries\n --quiet Suppress status logging\n --verbose Print debug output\n --help Print this message\n"); | ||
console.log("usage: graphql-ruby-client sync <options>\n\n Read .graphql files and push the contained\n operations to a GraphQL::Pro::OperationStore\n\nrequired arguments:\n --url=<endpoint-url> URL where data should be POSTed\n --client=<client-name> Identifier for this client application\n\noptional arguments:\n --path=<path> Path to .graphql files (default is \"./**/*.graphql\")\n --outfile=<generated-filename> Target file for generated code\n --outfile-type=<type> Target type for generated code (default is \"js\")\n --key=<key> HMAC authentication key\n --relay-persisted-output=<path> Path to a .json file from \"relay-compiler ... --persist-output\"\n (Outfile generation is skipped by default.)\n --apollo-android-operation-output=<path> Path to a .json file from Apollo-Android's \"generateOperationOutput\" feature.\n (Outfile generation is skipped by default.)\n --mode=<mode> Treat files like a certain kind of project:\n relay: treat files like relay-compiler output\n project: treat files like a cohesive project (fragments are shared, names must be unique)\n file: treat each file like a stand-alone operation\n\n By default, this flag is set to:\n - \"relay\" if \"__generated__\" in the path\n - otherwise, \"project\"\n --add-typename Automatically adds the \"__typename\" field to your queries\n --quiet Suppress status logging\n --verbose Print debug output\n --help Print this message\n"); | ||
} | ||
@@ -24,2 +24,3 @@ else { | ||
relayPersistedOutput: argv["relay-persisted-output"], | ||
apolloAndroidOperationOutput: argv["apollo-android-operation-output"], | ||
url: argv.url, | ||
@@ -26,0 +27,0 @@ client: argv.client, |
interface SyncOptions { | ||
path?: string; | ||
relayPersistedOutput?: string; | ||
apolloAndroidOperationOutput?: string; | ||
secret?: string; | ||
@@ -5,0 +6,0 @@ url: string; |
@@ -63,2 +63,17 @@ "use strict"; | ||
} | ||
else if (options.apolloAndroidOperationOutput) { | ||
// Apollo Android has already generated an artifact (https://www.apollographql.com/docs/android/advanced/persisted-queries/#operationoutputjson) | ||
var payload = { operations: [] }; | ||
var apolloAndroidOutputText = fs_1.default.readFileSync(options.apolloAndroidOperationOutput, "utf8"); | ||
var apolloAndroidOutput = JSON.parse(apolloAndroidOutputText); | ||
var operationData; | ||
// Structure is { operationId => { "name" => "...", "source" => "query { ... } " } } | ||
for (var operationId in apolloAndroidOutput) { | ||
operationData = apolloAndroidOutput[operationId]; | ||
payload.operations.push({ | ||
body: operationData.source, | ||
alias: operationId, | ||
}); | ||
} | ||
} | ||
else { | ||
@@ -79,4 +94,4 @@ var payload = generateClient_1.gatherOperations({ | ||
} | ||
else if (options.relayPersistedOutput) { | ||
// relay-compiler has embedded IDs in its generated files, | ||
else if (options.relayPersistedOutput || options.apolloAndroidOperationOutput) { | ||
// These artifacts have embedded IDs in its generated files, | ||
// no need to generate an outfile. | ||
@@ -83,0 +98,0 @@ outfile = null; |
{ | ||
"name": "graphql-ruby-client", | ||
"version": "1.7.7", | ||
"version": "1.7.8", | ||
"description": "JavaScript client for graphql-ruby", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
96483
54
2103