How to use the ts-invariant.InvariantError function in ts-invariant

To help you get started, we’ve selected a few ts-invariant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github caioreis123 / market2 / backend2 / node_modules / apollo-utilities / lib / bundle.cjs.js View on Github external
}
    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) {
github caioreis123 / market2 / backend2 / node_modules / apollo-utilities / lib / bundle.esm.js View on Github external
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) {
github apollographql / apollo-client / packages / apollo-utilities / src / storeUtils.ts View on Github external
function defaultValueFromVariable(node: VariableNode) {
  throw new InvariantError(`Variable nodes are not supported by valueFromNode`);
}
github caioreis123 / market2 / backend2 / node_modules / apollo-link / lib / bundle.cjs.js View on Github external
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) {
github apollographql / apollo-client / src / link / core / ApolloLink.ts View on Github external
public request(
    operation: Operation,
    forward?: NextLink,
  ): Observable | null {
    throw new InvariantError('request is not implemented');
  }
github caioreis123 / market2 / backend2 / node_modules / apollo-link / lib / bundle.esm.js View on Github external
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) {
github apollographql / apollo-client / packages / apollo-utilities / src / storeUtils.ts View on Github external
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.',
    );
  }
}
github apollographql / apollo-client / packages / apollo-cache-inmemory / src / readFromStore.ts View on Github external
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}`
    );
  }
}
github caioreis123 / market2 / backend2 / node_modules / apollo-utilities / lib / bundle.cjs.js View on Github external
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) {

ts-invariant

TypeScript implementation of invariant(condition, message)

MIT
Latest version published 2 years ago

Package Health Score

75 / 100
Full package analysis