Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphitation/supermassive

Package Overview
Dependencies
Maintainers
5
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphitation/supermassive - npm Package Compare versions

Comparing version 2.4.5 to 2.4.6

10

CHANGELOG.md
# Change Log - @graphitation/supermassive
This log was last generated on Tue, 02 May 2023 10:22:49 GMT and should not be manually modified.
This log was last generated on Tue, 30 May 2023 15:52:10 GMT and should not be manually modified.
<!-- Start content -->
## 2.4.6
Tue, 30 May 2023 15:52:10 GMT
### Patches
- Fix supermassive not supporting unpassed default arguments (mnovikov@microsoft.com)
## 2.4.2

@@ -8,0 +16,0 @@

94

lib/ast/addTypesToRequestDocument.js

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

Argument: {
leave(node) {
leave(node, _key, _parent, _path, ancestors) {
const argument = typeInfo.getArgument();

@@ -56,7 +56,16 @@ if (argument) {

const newNode = __spreadProps(__spreadValues({}, node), {
__type: typeNode,
__defaultValue: argument.defaultValue ? (0, import_graphql.parseValue)(JSON.stringify(argument.defaultValue)) : void 0
__type: typeNode
});
if (argument.defaultValue && node.value.kind === import_graphql.Kind.VARIABLE) {
newNode.__defaultValue = (0, import_graphql.astFromValue)(
argument.defaultValue,
argument.type
);
}
return newNode;
}
const errorPath = makeReadableErrorPath(ancestors);
throw new Error(
`Cannot find type for argument: ${errorPath.join(".")}.${node.name.value}`
);
}

@@ -66,30 +75,40 @@ },

leave(node, _key, _parent, _path, ancestors) {
const type = typeInfo.getType();
if (type) {
const typeNode = generateTypeNode(type);
const newNode = __spreadProps(__spreadValues({}, node), {
__type: typeNode
});
return newNode;
}
const path = [];
ancestors.forEach((ancestorOrArray) => {
let ancestor;
if (!Array.isArray(ancestorOrArray)) {
ancestor = ancestorOrArray;
if (ancestor && ancestor.kind === import_graphql.Kind.FIELD) {
path.push(ancestor.name.value);
} else if (ancestor && ancestor.kind === import_graphql.Kind.OPERATION_DEFINITION) {
let name;
if (ancestor.name) {
name = `${ancestor.operation} ${ancestor.name.value}`;
} else {
name = ancestor.operation;
const fieldDef = typeInfo.getFieldDef();
if (fieldDef) {
const type = fieldDef.type;
if (type) {
const typeNode = generateTypeNode(type);
const missingArgs = fieldDef.args.filter(
(argDef) => {
var _a;
return argDef.defaultValue != null && ((_a = node.arguments) == null ? void 0 : _a.findIndex(
(arg) => arg.name.value === argDef.name
)) === -1;
}
path.push(name);
);
const newNode = __spreadProps(__spreadValues({}, node), {
__type: typeNode
});
if (missingArgs) {
newNode.arguments = (newNode.arguments || []).concat(
missingArgs.map((arg) => ({
__type: generateTypeNode(arg.type),
kind: import_graphql.Kind.ARGUMENT,
name: {
kind: import_graphql.Kind.NAME,
value: arg.name
},
value: (0, import_graphql.astFromValue)(
arg.defaultValue,
arg.type
)
}))
);
}
return newNode;
}
});
}
const errorPath = makeReadableErrorPath(ancestors);
throw new Error(
`Cannot find type for field: ${path.join(".")}.${node.name.value}`
`Cannot find type for field: ${errorPath.join(".")}.${node.name.value}`
);

@@ -125,1 +144,22 @@ }

}
function makeReadableErrorPath(ancestors) {
const path = [];
ancestors.forEach((ancestorOrArray) => {
let ancestor;
if (!Array.isArray(ancestorOrArray)) {
ancestor = ancestorOrArray;
if (ancestor && ancestor.kind === import_graphql.Kind.FIELD) {
path.push(ancestor.name.value);
} else if (ancestor && ancestor.kind === import_graphql.Kind.OPERATION_DEFINITION) {
let name;
if (ancestor.name) {
name = `${ancestor.operation} ${ancestor.name.value}`;
} else {
name = ancestor.operation;
}
path.push(name);
}
}
});
return path;
}

@@ -120,3 +120,3 @@ /**

readonly __type: TypeNode;
readonly __defaultValue: Maybe<ValueNode>;
readonly __defaultValue?: Maybe<ValueNode>;
readonly kind: "Argument";

@@ -123,0 +123,0 @@ readonly loc?: Location;

@@ -248,2 +248,8 @@ "use strict";

return models.getData("/transport");
},
advancedDefaultInput(parent, args) {
return JSON.stringify(args);
},
multiArger(parent, args) {
return JSON.stringify(args);
}

@@ -250,0 +256,0 @@ },

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

var import_inspect = require("./jsutils/inspect");
var import_keyMap = require("./jsutils/keyMap");
var import_printPathArray = require("./jsutils/printPathArray");

@@ -128,6 +127,2 @@ function getVariableValues(resolvers, varDefNodes, inputs, options) {

const argumentNodes = (_a = node.arguments) != null ? _a : [];
const argNodeMap = (0, import_keyMap.keyMap)(
argumentNodes,
(arg) => arg.name.value
);
for (const argumentNode of argumentNodes) {

@@ -138,3 +133,2 @@ const name = argumentNode.name.value;

if (!(0, import_graphql.isInputType)(argType)) {
console.log(argType, (0, import_graphql.isInputType)(argType));
throw new import_graphql.GraphQLError(

@@ -148,7 +142,6 @@ `Argument "$${name}" expected value of type "${(0, import_inspect.inspect)(

let valueNode = argumentNode.value;
let isNull = valueNode.kind === import_graphql.Kind.NULL;
if (valueNode.kind === import_graphql.Kind.VARIABLE) {
const variableName = valueNode.name.value;
if (variableValues == null || !hasOwnProperty(variableValues, variableName)) {
if (argumentNode.__defaultValue != void 0) {
if (argumentNode.__defaultValue) {
valueNode = argumentNode.__defaultValue;

@@ -163,3 +156,2 @@ } else if ((0, import_graphql.isNonNullType)(argType)) {

}
isNull = !variableValues || variableValues[variableName] == null;
}

@@ -166,0 +158,0 @@ const coercedValue = (0, import_graphql.valueFromAST)(

{
"name": "@graphitation/supermassive",
"license": "MIT",
"version": "2.4.5",
"version": "2.4.6",
"main": "./lib/index",

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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