New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphql-ruby-client

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-ruby-client - npm Package Compare versions

Comparing version 1.10.6 to 1.10.7

4

CHANGELOG.md
# graphql-ruby-client
# 1.10.7 (29 Mar 2022)
- Dependencies: loosen apollo client and graphql version requirements to accept newer versions #4008
# 1.10.6 (10 Jan 2022)

@@ -4,0 +8,0 @@

4

cli.js

@@ -9,3 +9,3 @@ #!/usr/bin/env node

var index_1 = __importDefault(require("./sync/index"));
var argv = minimist_1.default(process.argv.slice(2));
var argv = (0, minimist_1.default)(process.argv.slice(2));
if (argv.help || argv.h) {

@@ -20,3 +20,3 @@ 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-codegen-json-output=<path> Path to a .json file from \"apollo client:codegen ... --target json\"\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");

else {
var result = index_1.default({
var result = (0, index_1.default)({
path: argv.path,

@@ -23,0 +23,0 @@ relayPersistedOutput: argv["relay-persisted-output"],

{
"name": "graphql-ruby-client",
"version": "1.10.6",
"version": "1.10.7",
"description": "JavaScript client for graphql-ruby",

@@ -12,4 +12,3 @@ "main": "index.js",

"devDependencies": {
"@apollo/client": "^3.3.13",
"@types/rails__actioncable": "^6.1.6",
"@apollo/client": ">=3.3.13",
"@types/glob": "^7.1.1",

@@ -21,2 +20,3 @@ "@types/jest": "^25.1.2",

"@types/pusher-js": "^4.2.2",
"@types/rails__actioncable": "^6.1.6",
"@types/react": "^17.0.0",

@@ -26,3 +26,3 @@ "@types/relay-runtime": "11.0.3",

"ably": "1.2.6",
"graphql": "^15.0.0",
"graphql": ">=15.0.0",
"jest": "^25.0.0",

@@ -35,3 +35,3 @@ "nock": "^11.0.0",

"ts-jest": "^25.2.0",
"typescript": "^3.7.5"
"typescript": ">=3.7.5"
},

@@ -47,4 +47,4 @@ "scripts": {

"peerDependencies": {
"@apollo/client": "^3.3.6",
"graphql": "^14.3.1 || ^15.0.0"
"@apollo/client": ">=3.3.6",
"graphql": ">=14.3.1"
},

@@ -51,0 +51,0 @@ "prettier": {

@@ -1,2 +0,1 @@

/// <reference types="zen-observable" />
import { ApolloLink, Observable, FetchResult, NextLink, Operation } from "@apollo/client/core";

@@ -3,0 +2,0 @@ import { Realtime } from "ably";

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -12,0 +14,0 @@ function __() { this.constructor = d; }

@@ -1,2 +0,1 @@

/// <reference types="zen-observable" />
import { ApolloLink, Observable, FetchResult, Operation, NextLink } from "@apollo/client/core";

@@ -3,0 +2,0 @@ import type { Consumer } from "@rails/actioncable";

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -44,3 +46,3 @@ function __() { this.constructor = d; }

channel.perform(actionName, {
query: operation.query ? graphql_1.print(operation.query) : null,
query: operation.query ? (0, graphql_1.print)(operation.query) : null,
variables: operation.variables,

@@ -47,0 +49,0 @@ // This is added for persisted operation support:

@@ -11,9 +11,9 @@ "use strict";

if (options.cable) {
handler = createActionCableHandler_1.createActionCableHandler(options);
handler = (0, createActionCableHandler_1.createActionCableHandler)(options);
}
else if (options.pusher) {
handler = createPusherHandler_1.createPusherHandler(options);
handler = (0, createPusherHandler_1.createPusherHandler)(options);
}
else if (options.ably) {
handler = createAblyHandler_1.createAblyHandler(options);
handler = (0, createAblyHandler_1.createAblyHandler)(options);
}

@@ -20,0 +20,0 @@ else {

@@ -1,2 +0,1 @@

/// <reference types="zen-observable" />
import { ApolloLink, Observable, Operation, NextLink, FetchResult } from "@apollo/client/core";

@@ -3,0 +2,0 @@ import Pusher from "pusher-js";

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -109,3 +111,6 @@ function __() { this.constructor = d; }

}
}, error: observer.error, });
},
error: observer.error,
// complete: observer.complete Don't pass this because Apollo unsubscribes if you do
});
// Return an object that will unsubscribe _if_ the query was a subscription.

@@ -112,0 +117,0 @@ return {

import { ASTNode, FieldNode, InlineFragmentNode } from "graphql";
declare function addTypenameIfAbsent(node: FieldNode | InlineFragmentNode): undefined | FieldNode | InlineFragmentNode;
declare function addTypenameToSelectionSet(node: ASTNode): any;
declare function addTypenameToSelectionSet(node: ASTNode): ASTNode;
export { addTypenameToSelectionSet, addTypenameIfAbsent };

@@ -13,8 +13,10 @@ "use strict";

};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -25,9 +27,9 @@ Object.defineProperty(exports, "__esModule", { value: true });

var TYPENAME_FIELD = {
kind: "Field",
kind: graphql_1.Kind.FIELD,
name: {
kind: "Name",
kind: graphql_1.Kind.NAME,
value: "__typename",
},
selectionSet: {
kind: "SelectionSet",
kind: graphql_1.Kind.SELECTION_SET,
selections: []

@@ -42,3 +44,3 @@ }

if (!alreadyHasThisField) {
return __assign(__assign({}, node), { selectionSet: __assign(__assign({}, node.selectionSet), { selections: __spreadArrays(node.selectionSet.selections, [TYPENAME_FIELD]) }) });
return __assign(__assign({}, node), { selectionSet: __assign(__assign({}, node.selectionSet), { selections: __spreadArray(__spreadArray([], node.selectionSet.selections, true), [TYPENAME_FIELD], false) }) });
}

@@ -63,5 +65,5 @@ else {

};
var newNode = graphql_1.visit(node, visitor);
var newNode = (0, graphql_1.visit)(node, visitor);
return newNode;
}
exports.addTypenameToSelectionSet = addTypenameToSelectionSet;

@@ -31,2 +31,3 @@ "use strict";

var payload = gatherOperations(options);
console.log(options, payload);
var generatedCode = generateClientCode(options.client, payload.operations, options.clientType);

@@ -58,10 +59,10 @@ return generatedCode;

if (filesMode == "relay") {
operations = prepareRelay_1.default(filenames);
operations = (0, prepareRelay_1.default)(filenames);
}
else {
if (filesMode === "file") {
operations = prepareIsolatedFiles_1.default(filenames, addTypename);
operations = (0, prepareIsolatedFiles_1.default)(filenames, addTypename);
}
else if (filesMode === "project") {
operations = prepareProject_1.default(filenames, addTypename);
operations = (0, prepareProject_1.default)(filenames, addTypename);
}

@@ -74,2 +75,3 @@ else {

op.alias = hashFunc(op.body);
// console.log("operation", op.alias, op.body)
});

@@ -76,0 +78,0 @@ }

@@ -74,3 +74,3 @@ "use strict";

operationData = apolloAndroidOutput[operationId];
var bodyWithoutClientFields = removeClientFields_1.removeClientFieldsFromString(operationData.source);
var bodyWithoutClientFields = (0, removeClientFields_1.removeClientFieldsFromString)(operationData.source);
payload.operations.push({

@@ -87,3 +87,3 @@ body: bodyWithoutClientFields,

jsonData.operations.map(function (operation) {
var bodyWithoutClientFields = removeClientFields_1.removeClientFieldsFromString(operation.sourceWithFragments);
var bodyWithoutClientFields = (0, removeClientFields_1.removeClientFieldsFromString)(operation.sourceWithFragments);
payload.operations.push({

@@ -97,3 +97,3 @@ alias: operation.operationId,

else {
var payload = generateClient_1.gatherOperations({
var payload = (0, generateClient_1.gatherOperations)({
path: graphqlGlob,

@@ -207,3 +207,3 @@ hash: hashFunc,

if (_payload && outfile) {
var generatedCode = generateClient_1.generateClientCode(clientName, payload.operations, clientType);
var generatedCode = (0, generateClient_1.generateClientCode)(clientName, payload.operations, clientType);
var finishedPayload = {

@@ -210,0 +210,0 @@ operations: payload.operations,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function generateOutfile(_type, clientName, keyValuePairs) {
return "\n /**\n * Generated by graphql-ruby-client\n *\n */\n\n /**\n * Map local operation names to persisted keys on the server\n * @return {Object}\n * @private\n */\n var _aliases = " + keyValuePairs + "\n\n /**\n * The client who synced these operations with the server\n * @return {String}\n * @private\n */\n var _client = \"" + clientName + "\"\n\n var OperationStoreClient = {\n /**\n * Build a string for `params[:operationId]`\n * @param {String} operationName\n * @return {String} stored operation ID\n */\n getOperationId: function(operationName) {\n return _client + \"/\" + OperationStoreClient.getPersistedQueryAlias(operationName)\n },\n\n /**\n * Fetch a persisted alias from a local operation name\n * @param {String} operationName\n * @return {String} persisted alias\n */\n getPersistedQueryAlias: function(operationName) {\n var persistedAlias = _aliases[operationName]\n if (!persistedAlias) {\n throw new Error(\"Failed to find persisted alias for operation name: \" + operationName)\n } else {\n return persistedAlias\n }\n },\n\n /**\n * Satisfy the Apollo Link API.\n * This link checks for an operation name, and if it's present,\n * sets the HTTP context to _not_ include the query,\n * and instead, include `extensions.operationId`.\n * (This is inspired by apollo-link-persisted-queries.)\n */\n apolloLink: function(operation, forward) {\n if (operation.operationName) {\n const operationId = OperationStoreClient.getOperationId(operation.operationName)\n operation.setContext({\n http: {\n includeQuery: false,\n includeExtensions: true,\n }\n })\n operation.extensions.operationId = operationId\n }\n return forward(operation)\n },\n /**\n * Satisfy the Apollo middleware API.\n * Replace the query with an operationId\n */\n apolloMiddleware: {\n applyBatchMiddleware: function(options, next) {\n options.requests.forEach(function(req) {\n // Fetch the persisted alias for this operation\n req.operationId = OperationStoreClient.getOperationId(req.operationName)\n // Remove the now-unused query string\n delete req.query\n return req\n })\n // Continue the request\n next()\n },\n\n applyMiddleware: function(options, next) {\n var req = options.request\n // Fetch the persisted alias for this operation\n req.operationId = OperationStoreClient.getOperationId(req.operationName)\n // Remove the now-unused query string\n delete req.query\n // Continue the request\n next()\n }\n }\n }\n\n module.exports = OperationStoreClient\n ";
return "\n /**\n * Generated by graphql-ruby-client\n *\n */\n\n /**\n * Map local operation names to persisted keys on the server\n * @return {Object}\n * @private\n */\n var _aliases = ".concat(keyValuePairs, "\n\n /**\n * The client who synced these operations with the server\n * @return {String}\n * @private\n */\n var _client = \"").concat(clientName, "\"\n\n var OperationStoreClient = {\n /**\n * Build a string for `params[:operationId]`\n * @param {String} operationName\n * @return {String} stored operation ID\n */\n getOperationId: function(operationName) {\n return _client + \"/\" + OperationStoreClient.getPersistedQueryAlias(operationName)\n },\n\n /**\n * Fetch a persisted alias from a local operation name\n * @param {String} operationName\n * @return {String} persisted alias\n */\n getPersistedQueryAlias: function(operationName) {\n var persistedAlias = _aliases[operationName]\n if (!persistedAlias) {\n throw new Error(\"Failed to find persisted alias for operation name: \" + operationName)\n } else {\n return persistedAlias\n }\n },\n\n /**\n * Satisfy the Apollo Link API.\n * This link checks for an operation name, and if it's present,\n * sets the HTTP context to _not_ include the query,\n * and instead, include `extensions.operationId`.\n * (This is inspired by apollo-link-persisted-queries.)\n */\n apolloLink: function(operation, forward) {\n if (operation.operationName) {\n const operationId = OperationStoreClient.getOperationId(operation.operationName)\n operation.setContext({\n http: {\n includeQuery: false,\n includeExtensions: true,\n }\n })\n operation.extensions.operationId = operationId\n }\n return forward(operation)\n },\n /**\n * Satisfy the Apollo middleware API.\n * Replace the query with an operationId\n */\n apolloMiddleware: {\n applyBatchMiddleware: function(options, next) {\n options.requests.forEach(function(req) {\n // Fetch the persisted alias for this operation\n req.operationId = OperationStoreClient.getOperationId(req.operationName)\n // Remove the now-unused query string\n delete req.query\n return req\n })\n // Continue the request\n next()\n },\n\n applyMiddleware: function(options, next) {\n var req = options.request\n // Fetch the persisted alias for this operation\n req.operationId = OperationStoreClient.getOperationId(req.operationName)\n // Remove the now-unused query string\n delete req.query\n // Continue the request\n next()\n }\n }\n }\n\n module.exports = OperationStoreClient\n ");
}
exports.default = generateOutfile;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function generateOutfile(_type, _clientName, keyValuePairs) {
return "" + keyValuePairs;
return "".concat(keyValuePairs);
}
exports.default = generateOutfile;

@@ -20,3 +20,3 @@ "use strict";

var fileOperationName = "";
var ast = graphql_1.parse(fileOperationBody);
var ast = (0, graphql_1.parse)(fileOperationBody);
var visitor = {

@@ -40,4 +40,4 @@ OperationDefinition: {

};
ast = graphql_1.visit(ast, visitor);
ast = removeClientFields_1.removeClientFields(ast);
ast = (0, graphql_1.visit)(ast, visitor);
ast = (0, removeClientFields_1.removeClientFields)(ast);
return {

@@ -47,3 +47,3 @@ // populate alias later, when hashFunc is available

name: fileOperationName,
body: graphql_1.print(ast),
body: (0, graphql_1.print)(ast),
};

@@ -50,0 +50,0 @@ });

@@ -28,3 +28,3 @@ "use strict";

});
var ast = graphql_1.parse(allGraphQL);
var ast = (0, graphql_1.parse)(allGraphQL);
// This will contain { name: [name, name] } pairs

@@ -73,4 +73,4 @@ var definitionDependencyNames = {};

// Find the dependencies, build the accumulator
ast = graphql_1.visit(ast, visitor);
ast = removeClientFields_1.removeClientFields(ast);
ast = (0, graphql_1.visit)(ast, visitor);
ast = (0, removeClientFields_1.removeClientFields)(ast);
// For each operation, build a separate document of that operation and its deps

@@ -96,4 +96,4 @@ // then print the new document to a string

name: operationName,
body: graphql_1.print(newAST),
alias: "",
body: (0, graphql_1.print)(newAST),
alias: "", // will be filled in later, when hashFunc is available
};

@@ -117,5 +117,5 @@ });

};
var newAST = graphql_1.visit(ast, visitor);
var newAST = (0, graphql_1.visit)(ast, visitor);
return newAST;
}
exports.default = prepareProject;
import { DocumentNode } from "graphql";
declare function removeClientFields(node: DocumentNode): any;
declare function removeClientFields(node: DocumentNode): DocumentNode;
declare function removeClientFieldsFromString(body: string): string;
export { removeClientFields, removeClientFieldsFromString };

@@ -18,3 +18,3 @@ "use strict";

// - remove fragment definitions that become empty
var newDoc = graphql_1.visit(node, {
var newDoc = (0, graphql_1.visit)(node, {
Field: {

@@ -62,3 +62,3 @@ enter: function (node) {

// At this point, we can remove variables that aren't used.
newDoc = graphql_1.visit(newDoc, {
newDoc = (0, graphql_1.visit)(newDoc, {
VariableDefinition: {

@@ -81,3 +81,3 @@ enter: function (node) {

anythingWasRemoved = false;
newDoc = graphql_1.visit(newDoc, {
newDoc = (0, graphql_1.visit)(newDoc, {
FragmentSpread: {

@@ -120,5 +120,5 @@ enter: function (node) {

if (body.includes("@client")) {
var ast = graphql_1.parse(body);
var ast = (0, graphql_1.parse)(body);
var newAst = removeClientFields(ast);
return graphql_1.print(newAst);
return (0, graphql_1.print)(newAst);
}

@@ -125,0 +125,0 @@ else {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc