Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
else if (isListValue(value)) {
argObj[name.value] = value.values.map(function (listValue) {
var nestedArgArrayObj = {};
valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables);
return nestedArgArrayObj[name.value];
});
}
else if (isEnumValue(value)) {
argObj[name.value] = value.value;
}
else if (isNullValue(value)) {
argObj[name.value] = null;
}
else {
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError() : new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
'is not supported. Use variables instead of inline arguments to ' +
'overcome this limitation.');
}
}
function storeKeyNameFromField(field, variables) {
if (definition.kind === 'OperationDefinition') {
var operation = definition.operation;
if (operation === 'query' ||
operation === 'mutation' ||
operation === 'subscription') {
return definition;
}
}
if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {
fragmentDefinition = definition;
}
}
if (fragmentDefinition) {
return fragmentDefinition;
}
throw process.env.NODE_ENV === "production" ? new InvariantError() : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.');
}
function createFragmentMap(fragments) {
function defaultValueFromVariable(node: VariableNode) {
throw new InvariantError(`Variable nodes are not supported by valueFromNode`);
}
function validateOperation(operation) {
var OPERATION_FIELDS = [
'query',
'operationName',
'variables',
'extensions',
'context',
];
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
var key = _a[_i];
if (OPERATION_FIELDS.indexOf(key) < 0) {
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(2) : new tsInvariant.InvariantError("illegal argument: " + key);
}
}
return operation;
}
var LinkError = (function (_super) {
public request(
operation: Operation,
forward?: NextLink,
): Observable | null {
throw new InvariantError('request is not implemented');
}
function validateOperation(operation) {
var OPERATION_FIELDS = [
'query',
'operationName',
'variables',
'extensions',
'context',
];
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
var key = _a[_i];
if (OPERATION_FIELDS.indexOf(key) < 0) {
throw process.env.NODE_ENV === "production" ? new InvariantError(2) : new InvariantError("illegal argument: " + key);
}
}
return operation;
}
var LinkError = (function (_super) {
argObj[name.value] = value.values.map(listValue => {
const nestedArgArrayObj = {};
valueToObjectRepresentation(
nestedArgArrayObj,
name,
listValue,
variables,
);
return (nestedArgArrayObj as any)[name.value];
});
} else if (isEnumValue(value)) {
argObj[name.value] = (value as EnumValueNode).value;
} else if (isNullValue(value)) {
argObj[name.value] = null;
} else {
throw new InvariantError(
`The inline argument "${name.value}" of kind "${(value as any).kind}"` +
'is not supported. Use variables instead of inline arguments to ' +
'overcome this limitation.',
);
}
}
function assertSelectionSetForIdValue(
field: FieldNode,
value: any,
) {
if (!field.selectionSet && isIdValue(value)) {
throw new InvariantError(
`Missing selection set for object of type ${
value.typename
} returned for query field ${field.name.value}`
);
}
}
if (definition.kind === 'OperationDefinition') {
var operation = definition.operation;
if (operation === 'query' ||
operation === 'mutation' ||
operation === 'subscription') {
return definition;
}
}
if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {
fragmentDefinition = definition;
}
}
if (fragmentDefinition) {
return fragmentDefinition;
}
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError() : new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.');
}
function createFragmentMap(fragments) {