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

apollo-utilities

Package Overview
Dependencies
Maintainers
4
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-utilities - npm Package Compare versions

Comparing version 1.3.0-beta.0 to 1.3.0-beta.1

lib/util/canUse.d.ts

76

lib/bundle.cjs.js

@@ -748,2 +748,5 @@ 'use strict';

var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
navigator.product === 'ReactNative');
var toString = Object.prototype.toString;

@@ -949,56 +952,57 @@ function cloneDeep(value) {

exports.addTypenameToDocument = addTypenameToDocument;
exports.argumentsObjectFromField = argumentsObjectFromField;
exports.assign = assign;
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
exports.canUseWeakMap = canUseWeakMap;
exports.checkDocument = checkDocument;
exports.cloneDeep = cloneDeep;
exports.createFragmentMap = createFragmentMap;
exports.getDefaultValues = getDefaultValues;
exports.getDirectiveInfoFromField = getDirectiveInfoFromField;
exports.shouldInclude = shouldInclude;
exports.getDirectiveNames = getDirectiveNames;
exports.hasDirectives = hasDirectives;
exports.hasClientExports = hasClientExports;
exports.getDirectivesFromDocument = getDirectivesFromDocument;
exports.getEnv = getEnv;
exports.getFragmentDefinition = getFragmentDefinition;
exports.getFragmentDefinitions = getFragmentDefinitions;
exports.getFragmentQueryDocument = getFragmentQueryDocument;
exports.getMainDefinition = getMainDefinition;
exports.getMutationDefinition = getMutationDefinition;
exports.checkDocument = checkDocument;
exports.getOperationDefinition = getOperationDefinition;
exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie;
exports.getOperationName = getOperationName;
exports.getFragmentDefinitions = getFragmentDefinitions;
exports.getQueryDefinition = getQueryDefinition;
exports.getFragmentDefinition = getFragmentDefinition;
exports.getMainDefinition = getMainDefinition;
exports.createFragmentMap = createFragmentMap;
exports.getDefaultValues = getDefaultValues;
exports.variablesInOperation = variablesInOperation;
exports.removeDirectivesFromDocument = removeDirectivesFromDocument;
exports.addTypenameToDocument = addTypenameToDocument;
exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument;
exports.getDirectivesFromDocument = getDirectivesFromDocument;
exports.removeArgumentsFromDocument = removeArgumentsFromDocument;
exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument;
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
exports.removeClientSetsFromDocument = removeClientSetsFromDocument;
exports.isScalarValue = isScalarValue;
exports.isNumberValue = isNumberValue;
exports.valueToObjectRepresentation = valueToObjectRepresentation;
exports.storeKeyNameFromField = storeKeyNameFromField;
exports.getStoreKeyName = getStoreKeyName;
exports.argumentsObjectFromField = argumentsObjectFromField;
exports.resultKeyNameFromField = resultKeyNameFromField;
exports.graphQLResultHasError = graphQLResultHasError;
exports.hasClientExports = hasClientExports;
exports.hasDirectives = hasDirectives;
exports.isDevelopment = isDevelopment;
exports.isEnv = isEnv;
exports.isEqual = isEqual;
exports.isField = isField;
exports.isIdValue = isIdValue;
exports.isInlineFragment = isInlineFragment;
exports.isIdValue = isIdValue;
exports.toIdValue = toIdValue;
exports.isJsonValue = isJsonValue;
exports.valueFromNode = valueFromNode;
exports.assign = assign;
exports.cloneDeep = cloneDeep;
exports.getEnv = getEnv;
exports.isEnv = isEnv;
exports.isNumberValue = isNumberValue;
exports.isProduction = isProduction;
exports.isDevelopment = isDevelopment;
exports.isScalarValue = isScalarValue;
exports.isTest = isTest;
exports.tryFunctionOrLogError = tryFunctionOrLogError;
exports.graphQLResultHasError = graphQLResultHasError;
exports.isEqual = isEqual;
exports.maybeDeepFreeze = maybeDeepFreeze;
exports.mergeDeep = mergeDeep;
exports.mergeDeepArray = mergeDeepArray;
exports.removeArgumentsFromDocument = removeArgumentsFromDocument;
exports.removeClientSetsFromDocument = removeClientSetsFromDocument;
exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument;
exports.removeDirectivesFromDocument = removeDirectivesFromDocument;
exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument;
exports.resultKeyNameFromField = resultKeyNameFromField;
exports.shouldInclude = shouldInclude;
exports.storeKeyNameFromField = storeKeyNameFromField;
exports.stripSymbols = stripSymbols;
exports.toIdValue = toIdValue;
exports.tryFunctionOrLogError = tryFunctionOrLogError;
exports.valueFromNode = valueFromNode;
exports.valueToObjectRepresentation = valueToObjectRepresentation;
exports.variablesInOperation = variablesInOperation;
exports.warnOnceInDevelopment = warnOnceInDevelopment;
exports.stripSymbols = stripSymbols;
//# sourceMappingURL=bundle.cjs.js.map

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("graphql/language/visitor"),t=require("ts-invariant"),r=require("tslib"),i=e(require("fast-json-stable-stringify"));function o(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1}function u(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1}function a(e){return"StringValue"===e.kind}function c(e){return"BooleanValue"===e.kind}function f(e){return"IntValue"===e.kind}function l(e){return"FloatValue"===e.kind}function s(e){return"Variable"===e.kind}function v(e){return"ObjectValue"===e.kind}function m(e){return"ListValue"===e.kind}function p(e){return"EnumValue"===e.kind}function d(e){return"NullValue"===e.kind}function g(e,n,r,i){if(f(r)||l(r))e[n.value]=Number(r.value);else if(c(r)||a(r))e[n.value]=r.value;else if(v(r)){var o={};r.fields.map(function(e){return g(o,e.name,e.value,i)}),e[n.value]=o}else if(s(r)){var u=(i||{})[r.name.value];e[n.value]=u}else if(m(r))e[n.value]=r.values.map(function(e){var t={};return g(t,n,e,i),t[n.value]});else if(p(r))e[n.value]=r.value;else{if(!d(r))throw new t.InvariantError(17);e[n.value]=null}}function h(e,n){var t=null;e.directives&&(t={},e.directives.forEach(function(e){t[e.name.value]={},e.arguments&&e.arguments.forEach(function(r){var i=r.name,o=r.value;return g(t[e.name.value],i,o,n)})}));var r=null;return e.arguments&&e.arguments.length&&(r={},e.arguments.forEach(function(e){var t=e.name,i=e.value;return g(r,t,i,n)})),b(e.name.value,r,t)}var y=["connection","include","skip","client","rest","export"];function b(e,n,t){if(t&&t.connection&&t.connection.key){if(t.connection.filter&&t.connection.filter.length>0){var r=t.connection.filter?t.connection.filter:[];r.sort();var o=n,u={};return r.forEach(function(e){u[e]=o[e]}),t.connection.key+"("+JSON.stringify(u)+")"}return t.connection.key}var a=e;if(n){var c=i(n);a+="("+c+")"}return t&&Object.keys(t).forEach(function(e){-1===y.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?a+="@"+e+"("+JSON.stringify(t[e])+")":a+="@"+e)}),a}function x(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return g(t,r,i,n)}),t}return null}function O(e){return e.alias?e.alias.value:e.name.value}function D(e){return"Field"===e.kind}function k(e){return"InlineFragment"===e.kind}function F(e){return e&&"id"===e.type&&"boolean"==typeof e.generated}function j(e,n){return void 0===n&&(n=!1),r.__assign({type:"id",generated:n},"string"==typeof e?{id:e,typename:void 0}:e)}function E(e){return null!=e&&"object"==typeof e&&"json"===e.type}function S(e){throw new t.InvariantError(18)}function V(e,n){switch(void 0===n&&(n=S),e.kind){case"Variable":return n(e);case"NullValue":return null;case"IntValue":return parseInt(e.value,10);case"FloatValue":return parseFloat(e.value);case"ListValue":return e.values.map(function(e){return V(e,n)});case"ObjectValue":for(var t={},r=0,i=e.fields;r<i.length;r++){var o=i[r];t[o.name.value]=V(o.value,n)}return t;default:return e.value}}function _(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=x(e,n)}),t}return null}function w(e,n){if(void 0===n&&(n={}),!e.directives)return!0;var r=!0;return e.directives.forEach(function(e){if("skip"===e.name.value||"include"===e.name.value){var i=e.arguments||[],o=e.name.value;t.invariant(1===i.length,1);var u=i[0];t.invariant(u.name&&"if"===u.name.value,2);var a=i[0].value,c=!1;a&&"BooleanValue"===a.kind?c=a.value:(t.invariant("Variable"===a.kind,3),c=n[a.name.value],t.invariant(void 0!==c,4)),"skip"===o&&(c=!c),c||(r=!1)}}),r}function I(e){var t=[];return n.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}function N(e,n){return I(n).some(function(n){return e.indexOf(n)>-1})}function q(e){return e&&N(["client"],e)&&N(["export"],e)}function P(e,n){var i=n,o=[];return e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw new t.InvariantError(5);"FragmentDefinition"===e.kind&&o.push(e)}),void 0===i&&(t.invariant(1===o.length,6),i=o[0].name.value),r.__assign({},e,{definitions:[{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}].concat(e.definitions)})}function A(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.forEach(function(n){null!=n&&Object.keys(n).forEach(function(t){e[t]=n[t]})}),e}function T(e){J(e);var n=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return t.invariant(n,7),n}function J(e){t.invariant(e&&"Document"===e.kind,8);var n=e.definitions.filter(function(e){return"FragmentDefinition"!==e.kind}).map(function(e){if("OperationDefinition"!==e.kind)throw new t.InvariantError(9);return e});return t.invariant(n.length<=1,10),e}function M(e){return J(e),e.definitions.filter(function(e){return"OperationDefinition"===e.kind})[0]}function L(e){var n=M(e);return t.invariant(n,11),n}function Q(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null}function z(e){return e.definitions.filter(function(e){return"FragmentDefinition"===e.kind})}function B(e){var n=M(e);return t.invariant(n&&"query"===n.operation,12),n}function C(e){t.invariant("Document"===e.kind,13),t.invariant(e.definitions.length<=1,14);var n=e.definitions[0];return t.invariant("FragmentDefinition"===n.kind,15),n}function K(e){var n;J(e);for(var r=0,i=e.definitions;r<i.length;r++){var o=i[r];if("OperationDefinition"===o.kind){var u=o.operation;if("query"===u||"mutation"===u||"subscription"===u)return o}"FragmentDefinition"!==o.kind||n||(n=o)}if(n)return n;throw new t.InvariantError(16)}function R(e){void 0===e&&(e=[]);var n={};return e.forEach(function(e){n[e.name.value]=e}),n}function H(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){return e.defaultValue}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return g(r,n.name,t),r});return A.apply(void 0,[{}].concat(n))}return{}}function W(e){var n=new Set;if(e.variableDefinitions)for(var t=0,r=e.variableDefinitions;t<r.length;t++){var i=r[t];n.add(i.variable.name.value)}return n}function G(e,n,t){var r=0;return e.forEach(function(t,i){n.call(this,t,i,e)&&(e[r++]=t)},t),e.length=r,e}var U={kind:"Field",name:{kind:"Name",value:"__typename"}};function X(e,n){return e.selectionSet.selections.every(function(e){return"FragmentSpread"===e.kind&&X(n[e.name.value],n)})}function Y(e){return X(M(e)||C(e),R(z(e)))?null:e}function Z(e){return function(n){return e.some(function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)})}}function $(e,t){var r=Object.create(null),i=[],o=Object.create(null),u=[],a=Y(n.visit(t,{Variable:{enter:function(e,n,t){"VariableDefinition"!==t.kind&&(r[e.name.value]=!0)}},Field:{enter:function(n){if(e&&n.directives&&(e.some(function(e){return e.remove})&&n.directives&&n.directives.some(Z(e))))return n.arguments&&n.arguments.forEach(function(e){"Variable"===e.value.kind&&i.push({name:e.value.name.value})}),n.selectionSet&&fe(n.selectionSet).forEach(function(e){u.push({name:e.name.value})}),null}},FragmentSpread:{enter:function(e){o[e.name.value]=!0}},Directive:{enter:function(n){if(Z(e)(n))return null}}}));return a&&G(i,function(e){return!r[e.name]}).length&&(a=ae(i,a)),a&&G(u,function(e){return!o[e.name]}).length&&(a=ce(u,a)),a}function ee(e){return n.visit(J(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var i=e.selections;if(i)if(!i.some(function(e){return"Field"===e.kind&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))return r.__assign({},e,{selections:i.concat([U])})}}}})}var ne={test:function(e){var n="connection"===e.name.value;return n&&(!e.arguments||e.arguments.some(function(e){return"key"===e.name.value})),n}};function te(e){return $([ne],J(e))}function re(e,n,t){return void 0===t&&(t=!0),n&&n.selections&&n.selections.some(function(n){return ie(e,n,t)})}function ie(e,n,t){return void 0===t&&(t=!0),"Field"!==n.kind||!n||!!n.directives&&(n.directives.some(Z(e))||t&&re(e,n.selectionSet,t))}function oe(e,t){var i;return J(t),Y(n.visit(t,{SelectionSet:{enter:function(n,t,o,u){var a=u.join("-");if(!i||a===i||!a.startsWith(i)){if(n.selections){var c=n.selections.filter(function(n){return ie(e,n)});return re(e,n,!1)&&(i=a),r.__assign({},n,{selections:c})}return null}}}}))}function ue(e){return function(n){return e.some(function(e){return n.value&&"Variable"===n.value.kind&&n.value.name&&(e.name===n.value.name.value||e.test&&e.test(n))})}}function ae(e,t){var i=ue(e);return Y(n.visit(t,{OperationDefinition:{enter:function(n){return r.__assign({},n,{variableDefinitions:n.variableDefinitions.filter(function(n){return!e.some(function(e){return e.name===n.variable.name.value})})})}},Field:{enter:function(n){if(e.some(function(e){return e.remove})){var t=0;if(n.arguments.forEach(function(e){i(e)&&(t+=1)}),1===t)return null}}},Argument:{enter:function(e){if(i(e))return null}}}))}function ce(e,t){function r(n){if(e.some(function(e){return e.name===n.name.value}))return null}return Y(n.visit(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}function fe(e){var n=[];return e.selections.forEach(function(e){"Field"!==e.kind&&"InlineFragment"!==e.kind||!e.selectionSet?"FragmentSpread"===e.kind&&n.push(e):fe(e.selectionSet).forEach(function(e){return n.push(e)})}),n}function le(e){return"query"===K(e).operation?e:n.visit(e,{OperationDefinition:{enter:function(e){return r.__assign({},e,{operation:"query"})}}})}function se(e){J(e);var t=$([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=n.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every(function(e){return"Field"===e.kind&&"__typename"===e.name.value}))return null}}})),t}var ve=Object.prototype.toString;function me(e){return pe(e,new Map)}function pe(e,n){switch(ve.call(e)){case"[object Array]":if(n.has(e))return n.get(e);var t=e.slice(0);return n.set(e,t),t.forEach(function(e,r){t[r]=pe(e,n)}),t;case"[object Object]":if(n.has(e))return n.get(e);var r=Object.create(Object.getPrototypeOf(e));return n.set(e,r),Object.keys(e).forEach(function(t){r[t]=pe(e[t],n)}),r;default:return e}}function de(){return"undefined"!=typeof process?"production":"development"}function ge(e){return de()===e}function he(){return!0===ge("production")}function ye(){return!0===ge("development")}function be(){return!0===ge("test")}function xe(e){try{return e()}catch(e){console.error&&console.error(e)}}function Oe(e){return e.errors&&e.errors.length}function De(e,n){if(e===n)return!0;if(e instanceof Date&&n instanceof Date)return e.getTime()===n.getTime();if(null!=e&&"object"==typeof e&&null!=n&&"object"==typeof n){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(!Object.prototype.hasOwnProperty.call(n,t))return!1;if(!De(e[t],n[t]))return!1}for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&!Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1}function ke(e){return Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(n){null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||ke(e[n])}),e}function Fe(e){if((ye()||be())&&!("function"==typeof Symbol&&"string"==typeof Symbol("")))return ke(e);return e}var je=Object.prototype.hasOwnProperty;function Ee(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Se(e)}function Se(e){var n=e[0]||{},t=e.length;if(t>1){var r=[];n=we(n,r);for(var i=1;i<t;++i)n=_e(n,e[i],r)}return n}function Ve(e){return null!==e&&"object"==typeof e}function _e(e,n,t){return Ve(n)&&Ve(e)?(Object.isExtensible&&!Object.isExtensible(e)&&(e=we(e,t)),Object.keys(n).forEach(function(r){var i=n[r];if(je.call(e,r)){var o=e[r];i!==o&&(e[r]=_e(we(o,t),i,t))}else e[r]=i}),e):n}function we(e,n){return null!==e&&"object"==typeof e&&n.indexOf(e)<0&&(e=Array.isArray(e)?e.slice(0):r.__assign({__proto__:Object.getPrototypeOf(e)},e),n.push(e)),e}var Ie=Object.create({});function Ne(e,n){if(void 0===n&&(n="warn"),!he()&&!Ie[e])switch(be()||(Ie[e]=!0),n){case"error":console.error(e);break;default:console.warn(e)}}function qe(e){return JSON.parse(JSON.stringify(e))}exports.getDirectiveInfoFromField=_,exports.shouldInclude=w,exports.getDirectiveNames=I,exports.hasDirectives=N,exports.hasClientExports=q,exports.getFragmentQueryDocument=P,exports.getMutationDefinition=T,exports.checkDocument=J,exports.getOperationDefinition=M,exports.getOperationDefinitionOrDie=L,exports.getOperationName=Q,exports.getFragmentDefinitions=z,exports.getQueryDefinition=B,exports.getFragmentDefinition=C,exports.getMainDefinition=K,exports.createFragmentMap=R,exports.getDefaultValues=H,exports.variablesInOperation=W,exports.removeDirectivesFromDocument=$,exports.addTypenameToDocument=ee,exports.removeConnectionDirectiveFromDocument=te,exports.getDirectivesFromDocument=oe,exports.removeArgumentsFromDocument=ae,exports.removeFragmentSpreadFromDocument=ce,exports.buildQueryFromSelectionSet=le,exports.removeClientSetsFromDocument=se,exports.isScalarValue=o,exports.isNumberValue=u,exports.valueToObjectRepresentation=g,exports.storeKeyNameFromField=h,exports.getStoreKeyName=b,exports.argumentsObjectFromField=x,exports.resultKeyNameFromField=O,exports.isField=D,exports.isInlineFragment=k,exports.isIdValue=F,exports.toIdValue=j,exports.isJsonValue=E,exports.valueFromNode=V,exports.assign=A,exports.cloneDeep=me,exports.getEnv=de,exports.isEnv=ge,exports.isProduction=he,exports.isDevelopment=ye,exports.isTest=be,exports.tryFunctionOrLogError=xe,exports.graphQLResultHasError=Oe,exports.isEqual=De,exports.maybeDeepFreeze=Fe,exports.mergeDeep=Ee,exports.mergeDeepArray=Se,exports.warnOnceInDevelopment=Ne,exports.stripSymbols=qe;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("graphql/language/visitor"),t=require("ts-invariant"),r=require("tslib"),i=e(require("fast-json-stable-stringify"));function o(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1}function a(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1}function u(e){return"StringValue"===e.kind}function c(e){return"BooleanValue"===e.kind}function f(e){return"IntValue"===e.kind}function l(e){return"FloatValue"===e.kind}function s(e){return"Variable"===e.kind}function v(e){return"ObjectValue"===e.kind}function p(e){return"ListValue"===e.kind}function m(e){return"EnumValue"===e.kind}function d(e){return"NullValue"===e.kind}function g(e,n,r,i){if(f(r)||l(r))e[n.value]=Number(r.value);else if(c(r)||u(r))e[n.value]=r.value;else if(v(r)){var o={};r.fields.map(function(e){return g(o,e.name,e.value,i)}),e[n.value]=o}else if(s(r)){var a=(i||{})[r.name.value];e[n.value]=a}else if(p(r))e[n.value]=r.values.map(function(e){var t={};return g(t,n,e,i),t[n.value]});else if(m(r))e[n.value]=r.value;else{if(!d(r))throw new t.InvariantError(17);e[n.value]=null}}function y(e,n){var t=null;e.directives&&(t={},e.directives.forEach(function(e){t[e.name.value]={},e.arguments&&e.arguments.forEach(function(r){var i=r.name,o=r.value;return g(t[e.name.value],i,o,n)})}));var r=null;return e.arguments&&e.arguments.length&&(r={},e.arguments.forEach(function(e){var t=e.name,i=e.value;return g(r,t,i,n)})),b(e.name.value,r,t)}var h=["connection","include","skip","client","rest","export"];function b(e,n,t){if(t&&t.connection&&t.connection.key){if(t.connection.filter&&t.connection.filter.length>0){var r=t.connection.filter?t.connection.filter:[];r.sort();var o=n,a={};return r.forEach(function(e){a[e]=o[e]}),t.connection.key+"("+JSON.stringify(a)+")"}return t.connection.key}var u=e;if(n){var c=i(n);u+="("+c+")"}return t&&Object.keys(t).forEach(function(e){-1===h.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?u+="@"+e+"("+JSON.stringify(t[e])+")":u+="@"+e)}),u}function x(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return g(t,r,i,n)}),t}return null}function O(e){return e.alias?e.alias.value:e.name.value}function k(e){return"Field"===e.kind}function D(e){return"InlineFragment"===e.kind}function F(e){return e&&"id"===e.type&&"boolean"==typeof e.generated}function j(e,n){return void 0===n&&(n=!1),r.__assign({type:"id",generated:n},"string"==typeof e?{id:e,typename:void 0}:e)}function E(e){return null!=e&&"object"==typeof e&&"json"===e.type}function S(e){throw new t.InvariantError(18)}function V(e,n){switch(void 0===n&&(n=S),e.kind){case"Variable":return n(e);case"NullValue":return null;case"IntValue":return parseInt(e.value,10);case"FloatValue":return parseFloat(e.value);case"ListValue":return e.values.map(function(e){return V(e,n)});case"ObjectValue":for(var t={},r=0,i=e.fields;r<i.length;r++){var o=i[r];t[o.name.value]=V(o.value,n)}return t;default:return e.value}}function _(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=x(e,n)}),t}return null}function w(e,n){if(void 0===n&&(n={}),!e.directives)return!0;var r=!0;return e.directives.forEach(function(e){if("skip"===e.name.value||"include"===e.name.value){var i=e.arguments||[],o=e.name.value;t.invariant(1===i.length,1);var a=i[0];t.invariant(a.name&&"if"===a.name.value,2);var u=i[0].value,c=!1;u&&"BooleanValue"===u.kind?c=u.value:(t.invariant("Variable"===u.kind,3),c=n[u.name.value],t.invariant(void 0!==c,4)),"skip"===o&&(c=!c),c||(r=!1)}}),r}function I(e){var t=[];return n.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}function N(e,n){return I(n).some(function(n){return e.indexOf(n)>-1})}function q(e){return e&&N(["client"],e)&&N(["export"],e)}function P(e,n){var i=n,o=[];return e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw new t.InvariantError(5);"FragmentDefinition"===e.kind&&o.push(e)}),void 0===i&&(t.invariant(1===o.length,6),i=o[0].name.value),r.__assign({},e,{definitions:[{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}].concat(e.definitions)})}function M(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.forEach(function(n){null!=n&&Object.keys(n).forEach(function(t){e[t]=n[t]})}),e}function A(e){T(e);var n=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return t.invariant(n,7),n}function T(e){t.invariant(e&&"Document"===e.kind,8);var n=e.definitions.filter(function(e){return"FragmentDefinition"!==e.kind}).map(function(e){if("OperationDefinition"!==e.kind)throw new t.InvariantError(9);return e});return t.invariant(n.length<=1,10),e}function J(e){return T(e),e.definitions.filter(function(e){return"OperationDefinition"===e.kind})[0]}function L(e){var n=J(e);return t.invariant(n,11),n}function Q(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null}function z(e){return e.definitions.filter(function(e){return"FragmentDefinition"===e.kind})}function B(e){var n=J(e);return t.invariant(n&&"query"===n.operation,12),n}function C(e){t.invariant("Document"===e.kind,13),t.invariant(e.definitions.length<=1,14);var n=e.definitions[0];return t.invariant("FragmentDefinition"===n.kind,15),n}function K(e){var n;T(e);for(var r=0,i=e.definitions;r<i.length;r++){var o=i[r];if("OperationDefinition"===o.kind){var a=o.operation;if("query"===a||"mutation"===a||"subscription"===a)return o}"FragmentDefinition"!==o.kind||n||(n=o)}if(n)return n;throw new t.InvariantError(16)}function R(e){void 0===e&&(e=[]);var n={};return e.forEach(function(e){n[e.name.value]=e}),n}function W(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){return e.defaultValue}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return g(r,n.name,t),r});return M.apply(void 0,[{}].concat(n))}return{}}function H(e){var n=new Set;if(e.variableDefinitions)for(var t=0,r=e.variableDefinitions;t<r.length;t++){var i=r[t];n.add(i.variable.name.value)}return n}function U(e,n,t){var r=0;return e.forEach(function(t,i){n.call(this,t,i,e)&&(e[r++]=t)},t),e.length=r,e}var G={kind:"Field",name:{kind:"Name",value:"__typename"}};function X(e,n){return e.selectionSet.selections.every(function(e){return"FragmentSpread"===e.kind&&X(n[e.name.value],n)})}function Y(e){return X(J(e)||C(e),R(z(e)))?null:e}function Z(e){return function(n){return e.some(function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)})}}function $(e,t){var r=Object.create(null),i=[],o=Object.create(null),a=[],u=Y(n.visit(t,{Variable:{enter:function(e,n,t){"VariableDefinition"!==t.kind&&(r[e.name.value]=!0)}},Field:{enter:function(n){if(e&&n.directives&&(e.some(function(e){return e.remove})&&n.directives&&n.directives.some(Z(e))))return n.arguments&&n.arguments.forEach(function(e){"Variable"===e.value.kind&&i.push({name:e.value.name.value})}),n.selectionSet&&fe(n.selectionSet).forEach(function(e){a.push({name:e.name.value})}),null}},FragmentSpread:{enter:function(e){o[e.name.value]=!0}},Directive:{enter:function(n){if(Z(e)(n))return null}}}));return u&&U(i,function(e){return!r[e.name]}).length&&(u=ue(i,u)),u&&U(a,function(e){return!o[e.name]}).length&&(u=ce(a,u)),u}function ee(e){return n.visit(T(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var i=e.selections;if(i)if(!i.some(function(e){return"Field"===e.kind&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))return r.__assign({},e,{selections:i.concat([G])})}}}})}var ne={test:function(e){var n="connection"===e.name.value;return n&&(!e.arguments||e.arguments.some(function(e){return"key"===e.name.value})),n}};function te(e){return $([ne],T(e))}function re(e,n,t){return void 0===t&&(t=!0),n&&n.selections&&n.selections.some(function(n){return ie(e,n,t)})}function ie(e,n,t){return void 0===t&&(t=!0),"Field"!==n.kind||!n||!!n.directives&&(n.directives.some(Z(e))||t&&re(e,n.selectionSet,t))}function oe(e,t){var i;return T(t),Y(n.visit(t,{SelectionSet:{enter:function(n,t,o,a){var u=a.join("-");if(!i||u===i||!u.startsWith(i)){if(n.selections){var c=n.selections.filter(function(n){return ie(e,n)});return re(e,n,!1)&&(i=u),r.__assign({},n,{selections:c})}return null}}}}))}function ae(e){return function(n){return e.some(function(e){return n.value&&"Variable"===n.value.kind&&n.value.name&&(e.name===n.value.name.value||e.test&&e.test(n))})}}function ue(e,t){var i=ae(e);return Y(n.visit(t,{OperationDefinition:{enter:function(n){return r.__assign({},n,{variableDefinitions:n.variableDefinitions.filter(function(n){return!e.some(function(e){return e.name===n.variable.name.value})})})}},Field:{enter:function(n){if(e.some(function(e){return e.remove})){var t=0;if(n.arguments.forEach(function(e){i(e)&&(t+=1)}),1===t)return null}}},Argument:{enter:function(e){if(i(e))return null}}}))}function ce(e,t){function r(n){if(e.some(function(e){return e.name===n.name.value}))return null}return Y(n.visit(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}function fe(e){var n=[];return e.selections.forEach(function(e){"Field"!==e.kind&&"InlineFragment"!==e.kind||!e.selectionSet?"FragmentSpread"===e.kind&&n.push(e):fe(e.selectionSet).forEach(function(e){return n.push(e)})}),n}function le(e){return"query"===K(e).operation?e:n.visit(e,{OperationDefinition:{enter:function(e){return r.__assign({},e,{operation:"query"})}}})}function se(e){T(e);var t=$([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=n.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every(function(e){return"Field"===e.kind&&"__typename"===e.name.value}))return null}}})),t}var ve="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product),pe=Object.prototype.toString;function me(e){return de(e,new Map)}function de(e,n){switch(pe.call(e)){case"[object Array]":if(n.has(e))return n.get(e);var t=e.slice(0);return n.set(e,t),t.forEach(function(e,r){t[r]=de(e,n)}),t;case"[object Object]":if(n.has(e))return n.get(e);var r=Object.create(Object.getPrototypeOf(e));return n.set(e,r),Object.keys(e).forEach(function(t){r[t]=de(e[t],n)}),r;default:return e}}function ge(){return"undefined"!=typeof process?"production":"development"}function ye(e){return ge()===e}function he(){return!0===ye("production")}function be(){return!0===ye("development")}function xe(){return!0===ye("test")}function Oe(e){try{return e()}catch(e){console.error&&console.error(e)}}function ke(e){return e.errors&&e.errors.length}function De(e,n){if(e===n)return!0;if(e instanceof Date&&n instanceof Date)return e.getTime()===n.getTime();if(null!=e&&"object"==typeof e&&null!=n&&"object"==typeof n){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(!Object.prototype.hasOwnProperty.call(n,t))return!1;if(!De(e[t],n[t]))return!1}for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&!Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1}function Fe(e){return Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(n){null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||Fe(e[n])}),e}function je(e){if((be()||xe())&&!("function"==typeof Symbol&&"string"==typeof Symbol("")))return Fe(e);return e}var Ee=Object.prototype.hasOwnProperty;function Se(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Ve(e)}function Ve(e){var n=e[0]||{},t=e.length;if(t>1){var r=[];n=Ie(n,r);for(var i=1;i<t;++i)n=we(n,e[i],r)}return n}function _e(e){return null!==e&&"object"==typeof e}function we(e,n,t){return _e(n)&&_e(e)?(Object.isExtensible&&!Object.isExtensible(e)&&(e=Ie(e,t)),Object.keys(n).forEach(function(r){var i=n[r];if(Ee.call(e,r)){var o=e[r];i!==o&&(e[r]=we(Ie(o,t),i,t))}else e[r]=i}),e):n}function Ie(e,n){return null!==e&&"object"==typeof e&&n.indexOf(e)<0&&(e=Array.isArray(e)?e.slice(0):r.__assign({__proto__:Object.getPrototypeOf(e)},e),n.push(e)),e}var Ne=Object.create({});function qe(e,n){if(void 0===n&&(n="warn"),!he()&&!Ne[e])switch(xe()||(Ne[e]=!0),n){case"error":console.error(e);break;default:console.warn(e)}}function Pe(e){return JSON.parse(JSON.stringify(e))}exports.addTypenameToDocument=ee,exports.argumentsObjectFromField=x,exports.assign=M,exports.buildQueryFromSelectionSet=le,exports.canUseWeakMap=ve,exports.checkDocument=T,exports.cloneDeep=me,exports.createFragmentMap=R,exports.getDefaultValues=W,exports.getDirectiveInfoFromField=_,exports.getDirectiveNames=I,exports.getDirectivesFromDocument=oe,exports.getEnv=ge,exports.getFragmentDefinition=C,exports.getFragmentDefinitions=z,exports.getFragmentQueryDocument=P,exports.getMainDefinition=K,exports.getMutationDefinition=A,exports.getOperationDefinition=J,exports.getOperationDefinitionOrDie=L,exports.getOperationName=Q,exports.getQueryDefinition=B,exports.getStoreKeyName=b,exports.graphQLResultHasError=ke,exports.hasClientExports=q,exports.hasDirectives=N,exports.isDevelopment=be,exports.isEnv=ye,exports.isEqual=De,exports.isField=k,exports.isIdValue=F,exports.isInlineFragment=D,exports.isJsonValue=E,exports.isNumberValue=a,exports.isProduction=he,exports.isScalarValue=o,exports.isTest=xe,exports.maybeDeepFreeze=je,exports.mergeDeep=Se,exports.mergeDeepArray=Ve,exports.removeArgumentsFromDocument=ue,exports.removeClientSetsFromDocument=se,exports.removeConnectionDirectiveFromDocument=te,exports.removeDirectivesFromDocument=$,exports.removeFragmentSpreadFromDocument=ce,exports.resultKeyNameFromField=O,exports.shouldInclude=w,exports.storeKeyNameFromField=y,exports.stripSymbols=Pe,exports.toIdValue=j,exports.tryFunctionOrLogError=Oe,exports.valueFromNode=V,exports.valueToObjectRepresentation=g,exports.variablesInOperation=H,exports.warnOnceInDevelopment=qe;

@@ -742,2 +742,5 @@ import { visit } from 'graphql/language/visitor';

var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
navigator.product === 'ReactNative');
var toString = Object.prototype.toString;

@@ -943,3 +946,3 @@ function cloneDeep(value) {

export { getDirectiveInfoFromField, shouldInclude, getDirectiveNames, hasDirectives, hasClientExports, getFragmentQueryDocument, getMutationDefinition, checkDocument, getOperationDefinition, getOperationDefinitionOrDie, getOperationName, getFragmentDefinitions, getQueryDefinition, getFragmentDefinition, getMainDefinition, createFragmentMap, getDefaultValues, variablesInOperation, removeDirectivesFromDocument, addTypenameToDocument, removeConnectionDirectiveFromDocument, getDirectivesFromDocument, removeArgumentsFromDocument, removeFragmentSpreadFromDocument, buildQueryFromSelectionSet, removeClientSetsFromDocument, isScalarValue, isNumberValue, valueToObjectRepresentation, storeKeyNameFromField, getStoreKeyName, argumentsObjectFromField, resultKeyNameFromField, isField, isInlineFragment, isIdValue, toIdValue, isJsonValue, valueFromNode, assign, cloneDeep, getEnv, isEnv, isProduction, isDevelopment, isTest, tryFunctionOrLogError, graphQLResultHasError, isEqual, maybeDeepFreeze, mergeDeep, mergeDeepArray, warnOnceInDevelopment, stripSymbols };
export { addTypenameToDocument, argumentsObjectFromField, assign, buildQueryFromSelectionSet, canUseWeakMap, checkDocument, cloneDeep, createFragmentMap, getDefaultValues, getDirectiveInfoFromField, getDirectiveNames, getDirectivesFromDocument, getEnv, getFragmentDefinition, getFragmentDefinitions, getFragmentQueryDocument, getMainDefinition, getMutationDefinition, getOperationDefinition, getOperationDefinitionOrDie, getOperationName, getQueryDefinition, getStoreKeyName, graphQLResultHasError, hasClientExports, hasDirectives, isDevelopment, isEnv, isEqual, isField, isIdValue, isInlineFragment, isJsonValue, isNumberValue, isProduction, isScalarValue, isTest, maybeDeepFreeze, mergeDeep, mergeDeepArray, removeArgumentsFromDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, removeDirectivesFromDocument, removeFragmentSpreadFromDocument, resultKeyNameFromField, shouldInclude, storeKeyNameFromField, stripSymbols, toIdValue, tryFunctionOrLogError, valueFromNode, valueToObjectRepresentation, variablesInOperation, warnOnceInDevelopment };
//# sourceMappingURL=bundle.esm.js.map

@@ -745,2 +745,5 @@ (function (global, factory) {

var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
navigator.product === 'ReactNative');
var toString = Object.prototype.toString;

@@ -946,56 +949,57 @@ function cloneDeep(value) {

exports.addTypenameToDocument = addTypenameToDocument;
exports.argumentsObjectFromField = argumentsObjectFromField;
exports.assign = assign;
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
exports.canUseWeakMap = canUseWeakMap;
exports.checkDocument = checkDocument;
exports.cloneDeep = cloneDeep;
exports.createFragmentMap = createFragmentMap;
exports.getDefaultValues = getDefaultValues;
exports.getDirectiveInfoFromField = getDirectiveInfoFromField;
exports.shouldInclude = shouldInclude;
exports.getDirectiveNames = getDirectiveNames;
exports.hasDirectives = hasDirectives;
exports.hasClientExports = hasClientExports;
exports.getDirectivesFromDocument = getDirectivesFromDocument;
exports.getEnv = getEnv;
exports.getFragmentDefinition = getFragmentDefinition;
exports.getFragmentDefinitions = getFragmentDefinitions;
exports.getFragmentQueryDocument = getFragmentQueryDocument;
exports.getMainDefinition = getMainDefinition;
exports.getMutationDefinition = getMutationDefinition;
exports.checkDocument = checkDocument;
exports.getOperationDefinition = getOperationDefinition;
exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie;
exports.getOperationName = getOperationName;
exports.getFragmentDefinitions = getFragmentDefinitions;
exports.getQueryDefinition = getQueryDefinition;
exports.getFragmentDefinition = getFragmentDefinition;
exports.getMainDefinition = getMainDefinition;
exports.createFragmentMap = createFragmentMap;
exports.getDefaultValues = getDefaultValues;
exports.variablesInOperation = variablesInOperation;
exports.removeDirectivesFromDocument = removeDirectivesFromDocument;
exports.addTypenameToDocument = addTypenameToDocument;
exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument;
exports.getDirectivesFromDocument = getDirectivesFromDocument;
exports.removeArgumentsFromDocument = removeArgumentsFromDocument;
exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument;
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
exports.removeClientSetsFromDocument = removeClientSetsFromDocument;
exports.isScalarValue = isScalarValue;
exports.isNumberValue = isNumberValue;
exports.valueToObjectRepresentation = valueToObjectRepresentation;
exports.storeKeyNameFromField = storeKeyNameFromField;
exports.getStoreKeyName = getStoreKeyName;
exports.argumentsObjectFromField = argumentsObjectFromField;
exports.resultKeyNameFromField = resultKeyNameFromField;
exports.graphQLResultHasError = graphQLResultHasError;
exports.hasClientExports = hasClientExports;
exports.hasDirectives = hasDirectives;
exports.isDevelopment = isDevelopment;
exports.isEnv = isEnv;
exports.isEqual = isEqual;
exports.isField = isField;
exports.isIdValue = isIdValue;
exports.isInlineFragment = isInlineFragment;
exports.isIdValue = isIdValue;
exports.toIdValue = toIdValue;
exports.isJsonValue = isJsonValue;
exports.valueFromNode = valueFromNode;
exports.assign = assign;
exports.cloneDeep = cloneDeep;
exports.getEnv = getEnv;
exports.isEnv = isEnv;
exports.isNumberValue = isNumberValue;
exports.isProduction = isProduction;
exports.isDevelopment = isDevelopment;
exports.isScalarValue = isScalarValue;
exports.isTest = isTest;
exports.tryFunctionOrLogError = tryFunctionOrLogError;
exports.graphQLResultHasError = graphQLResultHasError;
exports.isEqual = isEqual;
exports.maybeDeepFreeze = maybeDeepFreeze;
exports.mergeDeep = mergeDeep;
exports.mergeDeepArray = mergeDeepArray;
exports.removeArgumentsFromDocument = removeArgumentsFromDocument;
exports.removeClientSetsFromDocument = removeClientSetsFromDocument;
exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument;
exports.removeDirectivesFromDocument = removeDirectivesFromDocument;
exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument;
exports.resultKeyNameFromField = resultKeyNameFromField;
exports.shouldInclude = shouldInclude;
exports.storeKeyNameFromField = storeKeyNameFromField;
exports.stripSymbols = stripSymbols;
exports.toIdValue = toIdValue;
exports.tryFunctionOrLogError = tryFunctionOrLogError;
exports.valueFromNode = valueFromNode;
exports.valueToObjectRepresentation = valueToObjectRepresentation;
exports.variablesInOperation = variablesInOperation;
exports.warnOnceInDevelopment = warnOnceInDevelopment;
exports.stripSymbols = stripSymbols;

@@ -1002,0 +1006,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

@@ -7,2 +7,3 @@ export * from './directives';

export * from './util/assign';
export * from './util/canUse';
export * from './util/cloneDeep';

@@ -9,0 +10,0 @@ export * from './util/environment';

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

tslib_1.__exportStar(require("./util/assign"), exports);
tslib_1.__exportStar(require("./util/canUse"), exports);
tslib_1.__exportStar(require("./util/cloneDeep"), exports);

@@ -12,0 +13,0 @@ tslib_1.__exportStar(require("./util/environment"), exports);

{
"name": "apollo-utilities",
"version": "1.3.0-beta.0",
"version": "1.3.0-beta.1",
"description": "Utilities for working with GraphQL ASTs",

@@ -46,3 +46,3 @@ "author": "James Baxley <james@meteor.com>",

},
"gitHead": "bd691bc247621084b953ad0ca36f056b4e0ce845"
"gitHead": "68169f31a4d4d41af9a90ae1fed4414255e829a3"
}

@@ -7,2 +7,3 @@ export * from './directives';

export * from './util/assign';
export * from './util/canUse';
export * from './util/cloneDeep';

@@ -9,0 +10,0 @@ export * from './util/environment';

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