apollo-utilities
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -30,3 +30,2 @@ exports.__esModule = true; | ||
exports.isEnv = isEnv; | ||
exports.isEqual = isEqual; | ||
exports.isField = isField; | ||
@@ -58,3 +57,3 @@ exports.isIdValue = isIdValue; | ||
exports.warnOnceInDevelopment = warnOnceInDevelopment; | ||
exports.canUseWeakMap = void 0; | ||
exports.canUseWeakMap = exports.isEqual = void 0; | ||
@@ -69,4 +68,6 @@ var _visitor = require("graphql/language/visitor"); | ||
var _lodash = _interopRequireDefault(require("lodash.isequal")); | ||
var _equality = require("@wry/equality"); | ||
exports.isEqual = _equality.equal; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -335,3 +336,3 @@ | ||
evaledValue = variables[ifArgument.value.name.value]; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 1) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 3) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
} else { | ||
@@ -374,7 +375,7 @@ evaledValue = ifArgument.value.value; | ||
var directiveName = directive.name.value; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 2) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 4) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
var ifArgument = directiveArguments[0]; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 3) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 5) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
var ifValue = ifArgument.value; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 4) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 6) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); | ||
return { | ||
@@ -392,3 +393,3 @@ directive: directive, | ||
if (definition.kind === 'OperationDefinition') { | ||
throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(5) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); | ||
throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(1) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); | ||
} | ||
@@ -402,3 +403,3 @@ | ||
if (typeof actualFragmentName === 'undefined') { | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 6) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 2) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
actualFragmentName = fragments[0].name.value; | ||
@@ -1014,6 +1015,2 @@ } | ||
function isEqual(a, b) { | ||
return (0, _lodash.default)(a, b); | ||
} | ||
function deepFreeze(o) { | ||
@@ -1020,0 +1017,0 @@ Object.freeze(o); |
@@ -1,1 +0,1 @@ | ||
exports.__esModule=!0,exports.addTypenameToDocument=function(n){return(0,e.visit)(h(n),{SelectionSet:{enter:function(e,n,r){if(!r||"OperationDefinition"!==r.kind){var i=e.selections;if(i){var o=i.some(function(e){return l(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))});if(!o){var u=r;if(!(l(u)&&u.directives&&u.directives.some(function(e){return"export"===e.name.value})))return(0,t.__assign)({},e,{selections:i.concat([S])})}}}}}})},exports.argumentsObjectFromField=f,exports.assign=x,exports.buildQueryFromSelectionSet=function(n){if("query"===k(n).operation)return n;return(0,e.visit)(n,{OperationDefinition:{enter:function(e){return(0,t.__assign)({},e,{operation:"query"})}}})},exports.checkDocument=h,exports.cloneDeep=function(e){return function e(n,t){switch(A.call(n)){case"[object Array]":if(t.has(n))return t.get(n);var r=n.slice(0);return t.set(n,r),r.forEach(function(n,i){r[i]=e(n,t)}),r;case"[object Object]":if(t.has(n))return t.get(n);var i=Object.create(Object.getPrototypeOf(n));return t.set(n,i),Object.keys(n).forEach(function(r){i[r]=e(n[r],t)}),i;default:return n}}(e,new Map)},exports.createFragmentMap=O,exports.getDefaultValues=function(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){var n=e.defaultValue;return n}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return u(r,n.name,t),r});return x.apply(void 0,[{}].concat(n))}return{}},exports.getDirectiveInfoFromField=function(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=f(e,n)}),t}return null},exports.getDirectiveNames=m,exports.getDirectivesFromDocument=function(n,r){var i;return h(r),E((0,e.visit)(r,{SelectionSet:{enter:function(e,r,o,u){var a=u.join("-");if(!i||a===i||!a.startsWith(i)){if(e.selections){var c=e.selections.filter(function(e){return I(n,e)});return w(n,e,!1)&&(i=a),(0,t.__assign)({},e,{selections:c})}return null}}}}))},exports.getEnv=J,exports.getFragmentDefinition=D,exports.getFragmentDefinitions=b,exports.getFragmentQueryDocument=function(e,r){var i=r,o=[];e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw new n.InvariantError(5);"FragmentDefinition"===e.kind&&o.push(e)}),void 0===i&&((0,n.invariant)(1===o.length,6),i=o[0].name.value);return(0,t.__assign)({},e,{definitions:[{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}].concat(e.definitions)})},exports.getInclusionDirectives=g,exports.getMainDefinition=k,exports.getMutationDefinition=function(e){h(e);var t=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return(0,n.invariant)(t,7),t},exports.getOperationDefinition=y,exports.getOperationDefinitionOrDie=function(e){var t=y(e);return(0,n.invariant)(t,11),t},exports.getOperationName=function(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null},exports.getQueryDefinition=function(e){var t=y(e);return(0,n.invariant)(t&&"query"===t.operation,12),t},exports.getStoreKeyName=c,exports.graphQLResultHasError=function(e){return e.errors&&e.errors.length},exports.hasClientExports=function(e){return e&&p(["client"],e)&&p(["export"],e)},exports.hasDirectives=p,exports.isDevelopment=Q,exports.isEnv=P,exports.isEqual=function(e,n){return(0,i.default)(e,n)},exports.isField=l,exports.isIdValue=function(e){return e&&"id"===e.type&&"boolean"==typeof e.generated},exports.isInlineFragment=s,exports.isJsonValue=function(e){return null!=e&&"object"==typeof e&&"json"===e.type},exports.isNumberValue=function(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1},exports.isProduction=L,exports.isScalarValue=function(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1},exports.isTest=T,exports.maybeDeepFreeze=function(e){if(Q()||T()){var n="function"==typeof Symbol&&"string"==typeof Symbol("");if(!n)return function e(n){Object.freeze(n);Object.getOwnPropertyNames(n).forEach(function(t){null===n[t]||"object"!=typeof n[t]&&"function"!=typeof n[t]||Object.isFrozen(n[t])||e(n[t])});return n}(e)}return e},exports.mergeDeep=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z(e)},exports.mergeDeepArray=z,exports.removeArgumentsFromDocument=N,exports.removeClientSetsFromDocument=function(n){h(n);var t=j([{test:function(e){return"client"===e.name.value},remove:!0}],n);t&&(t=(0,e.visit)(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet){var n=e.selectionSet.selections.every(function(e){return l(e)&&"__typename"===e.name.value});if(n)return null}}}}));return t},exports.removeConnectionDirectiveFromDocument=function(e){return j([_],h(e))},exports.removeDirectivesFromDocument=j,exports.removeFragmentSpreadFromDocument=q,exports.resultKeyNameFromField=function(e){return e.alias?e.alias.value:e.name.value},exports.shouldInclude=function(e,t){void 0===t&&(t={});return g(e.directives).every(function(e){var r=e.directive,i=e.ifArgument,o=!1;return"Variable"===i.value.kind?(o=t[i.value.name.value],(0,n.invariant)(void 0!==o,1)):o=i.value.value,"skip"===r.name.value?!o:o})},exports.storeKeyNameFromField=function(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 u(t[e.name.value],i,o,n)})}));var r=null;e.arguments&&e.arguments.length&&(r={},e.arguments.forEach(function(e){var t=e.name,i=e.value;return u(r,t,i,n)}));return c(e.name.value,r,t)},exports.stripSymbols=function(e){return JSON.parse(JSON.stringify(e))},exports.toIdValue=function(e,n){void 0===n&&(n=!1);return(0,t.__assign)({type:"id",generated:n},"string"==typeof e?{id:e,typename:void 0}:e)},exports.tryFunctionOrLogError=function(e){try{return e()}catch(e){console.error&&console.error(e)}},exports.valueFromNode=function e(n,t){void 0===t&&(t=v);switch(n.kind){case"Variable":return t(n);case"NullValue":return null;case"IntValue":return parseInt(n.value,10);case"FloatValue":return parseFloat(n.value);case"ListValue":return n.values.map(function(n){return e(n,t)});case"ObjectValue":for(var r={},i=0,o=n.fields;i<o.length;i++){var u=o[i];r[u.name.value]=e(u.value,t)}return r;default:return n.value}},exports.valueToObjectRepresentation=u,exports.variablesInOperation=function(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},exports.warnOnceInDevelopment=function(e,n){void 0===n&&(n="warn");L()||R[e]||(T()||(R[e]=!0),"error"===n?console.error(e):console.warn(e))},exports.canUseWeakMap=void 0;var e=require("graphql/language/visitor"),n=require("ts-invariant"),t=require("tslib"),r=o(require("fast-json-stable-stringify")),i=o(require("lodash.isequal"));function o(e){return e&&e.__esModule?e:{default:e}}function u(e,t,r,i){if(function(e){return"IntValue"===e.kind}(r)||function(e){return"FloatValue"===e.kind}(r))e[t.value]=Number(r.value);else if(function(e){return"BooleanValue"===e.kind}(r)||function(e){return"StringValue"===e.kind}(r))e[t.value]=r.value;else if(function(e){return"ObjectValue"===e.kind}(r)){var o={};r.fields.map(function(e){return u(o,e.name,e.value,i)}),e[t.value]=o}else if(function(e){return"Variable"===e.kind}(r)){var a=(i||{})[r.name.value];e[t.value]=a}else if(function(e){return"ListValue"===e.kind}(r))e[t.value]=r.values.map(function(e){var n={};return u(n,t,e,i),n[t.value]});else if(function(e){return"EnumValue"===e.kind}(r))e[t.value]=r.value;else{if(!function(e){return"NullValue"===e.kind}(r))throw new n.InvariantError(17);e[t.value]=null}}var a=["connection","include","skip","client","rest","export"];function c(e,n,t){if(t&&t.connection&&t.connection.key){if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var o=n,u={};return i.forEach(function(e){u[e]=o[e]}),t.connection.key+"("+JSON.stringify(u)+")"}return t.connection.key}var c=e;if(n){var f=(0,r.default)(n);c+="("+f+")"}return t&&Object.keys(t).forEach(function(e){-1===a.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?c+="@"+e+"("+JSON.stringify(t[e])+")":c+="@"+e)}),c}function f(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return u(t,r,i,n)}),t}return null}function l(e){return"Field"===e.kind}function s(e){return"InlineFragment"===e.kind}function v(e){throw new n.InvariantError(18)}function m(n){var t=[];return(0,e.visit)(n,{Directive:function(e){t.push(e.name.value)}}),t}function p(e,n){return m(n).some(function(n){return e.indexOf(n)>-1})}function d(e){var n=e.name.value;return"skip"===n||"include"===n}function g(e){return e?e.filter(d).map(function(e){var t=e.arguments;e.name.value;(0,n.invariant)(t&&1===t.length,2);var r=t[0];(0,n.invariant)(r.name&&"if"===r.name.value,3);var i=r.value;return(0,n.invariant)(i&&("Variable"===i.kind||"BooleanValue"===i.kind),4),{directive:e,ifArgument:r}}):[]}function x(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 h(e){(0,n.invariant)(e&&"Document"===e.kind,8);var t=e.definitions.filter(function(e){return"FragmentDefinition"!==e.kind}).map(function(e){if("OperationDefinition"!==e.kind)throw new n.InvariantError(9);return e});return(0,n.invariant)(t.length<=1,10),e}function y(e){return h(e),e.definitions.filter(function(e){return"OperationDefinition"===e.kind})[0]}function b(e){return e.definitions.filter(function(e){return"FragmentDefinition"===e.kind})}function D(e){(0,n.invariant)("Document"===e.kind,13),(0,n.invariant)(e.definitions.length<=1,14);var t=e.definitions[0];return(0,n.invariant)("FragmentDefinition"===t.kind,15),t}function k(e){var t;h(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||t||(t=o)}if(t)return t;throw new n.InvariantError(16)}function O(e){void 0===e&&(e=[]);var n={};return e.forEach(function(e){n[e.name.value]=e}),n}function F(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 S={kind:"Field",name:{kind:"Name",value:"__typename"}};function E(e){return function e(n,t){return n.selectionSet.selections.every(function(n){return"FragmentSpread"===n.kind&&e(t[n.name.value],t)})}(y(e)||D(e),O(b(e)))?null:e}function V(e){return function(n){return e.some(function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)})}}function j(n,t){var r=Object.create(null),i=[],o=Object.create(null),u=[],a=E((0,e.visit)(t,{Variable:{enter:function(e,n,t){"VariableDefinition"!==t.kind&&(r[e.name.value]=!0)}},Field:{enter:function(e){if(n&&e.directives&&(n.some(function(e){return e.remove})&&e.directives&&e.directives.some(V(n))))return e.arguments&&e.arguments.forEach(function(e){"Variable"===e.value.kind&&i.push({name:e.value.name.value})}),e.selectionSet&&function e(n){var t=[];n.selections.forEach(function(n){(l(n)||s(n))&&n.selectionSet?e(n.selectionSet).forEach(function(e){return t.push(e)}):"FragmentSpread"===n.kind&&t.push(n)});return t}(e.selectionSet).forEach(function(e){u.push({name:e.name.value})}),null}},FragmentSpread:{enter:function(e){o[e.name.value]=!0}},Directive:{enter:function(e){if(V(n)(e))return null}}}));return a&&F(i,function(e){return!r[e.name]}).length&&(a=N(i,a)),a&&F(u,function(e){return!o[e.name]}).length&&(a=q(u,a)),a}var _={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 w(e,n,t){return void 0===t&&(t=!0),n&&n.selections&&n.selections.some(function(n){return I(e,n,t)})}function I(e,n,t){return void 0===t&&(t=!0),!l(n)||!!n.directives&&(n.directives.some(V(e))||t&&w(e,n.selectionSet,t))}function N(n,r){var i=function(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))})}}(n);return E((0,e.visit)(r,{OperationDefinition:{enter:function(e){return(0,t.__assign)({},e,{variableDefinitions:e.variableDefinitions.filter(function(e){return!n.some(function(n){return n.name===e.variable.name.value})})})}},Field:{enter:function(e){if(n.some(function(e){return e.remove})){var t=0;if(e.arguments.forEach(function(e){i(e)&&(t+=1)}),1===t)return null}}},Argument:{enter:function(e){if(i(e))return null}}}))}function q(n,t){function r(e){if(n.some(function(n){return n.name===e.name.value}))return null}return E((0,e.visit)(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}var M="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product);exports.canUseWeakMap=M;var A=Object.prototype.toString;function J(){return"undefined"!=typeof process?"production":"development"}function P(e){return J()===e}function L(){return!0===P("production")}function Q(){return!0===P("development")}function T(){return!0===P("test")}var W=Object.prototype.hasOwnProperty;function z(e){var n=e[0]||{},t=e.length;if(t>1){var r=[];n=K(n,r);for(var i=1;i<t;++i)n=C(n,e[i],r)}return n}function B(e){return null!==e&&"object"==typeof e}function C(e,n,t){return B(n)&&B(e)?(Object.isExtensible&&!Object.isExtensible(e)&&(e=K(e,t)),Object.keys(n).forEach(function(r){var i=n[r];if(W.call(e,r)){var o=e[r];i!==o&&(e[r]=C(K(o,t),i,t))}else e[r]=i}),e):n}function K(e,n){return null!==e&&"object"==typeof e&&n.indexOf(e)<0&&(e=Array.isArray(e)?e.slice(0):(0,t.__assign)({__proto__:Object.getPrototypeOf(e)},e),n.push(e)),e}var R=Object.create({}); | ||
exports.__esModule=!0,exports.addTypenameToDocument=function(e){return(0,n.visit)(h(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var i=e.selections;if(i){var o=i.some(function(e){return l(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))});if(!o){var a=t;if(!(l(a)&&a.directives&&a.directives.some(function(e){return"export"===e.name.value})))return(0,r.__assign)({},e,{selections:i.concat([E])})}}}}}})},exports.argumentsObjectFromField=f,exports.assign=x,exports.buildQueryFromSelectionSet=function(e){if("query"===k(e).operation)return e;return(0,n.visit)(e,{OperationDefinition:{enter:function(e){return(0,r.__assign)({},e,{operation:"query"})}}})},exports.checkDocument=h,exports.cloneDeep=function(e){return function e(n,t){switch(A.call(n)){case"[object Array]":if(t.has(n))return t.get(n);var r=n.slice(0);return t.set(n,r),r.forEach(function(n,i){r[i]=e(n,t)}),r;case"[object Object]":if(t.has(n))return t.get(n);var i=Object.create(Object.getPrototypeOf(n));return t.set(n,i),Object.keys(n).forEach(function(r){i[r]=e(n[r],t)}),i;default:return n}}(e,new Map)},exports.createFragmentMap=O,exports.getDefaultValues=function(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){var n=e.defaultValue;return n}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return a(r,n.name,t),r});return x.apply(void 0,[{}].concat(n))}return{}},exports.getDirectiveInfoFromField=function(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=f(e,n)}),t}return null},exports.getDirectiveNames=m,exports.getDirectivesFromDocument=function(e,t){var i;return h(t),S((0,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 I(e,n)});return w(e,n,!1)&&(i=u),(0,r.__assign)({},n,{selections:c})}return null}}}}))},exports.getEnv=J,exports.getFragmentDefinition=D,exports.getFragmentDefinitions=b,exports.getFragmentQueryDocument=function(e,n){var i=n,o=[];e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw new t.InvariantError(1);"FragmentDefinition"===e.kind&&o.push(e)}),void 0===i&&((0,t.invariant)(1===o.length,2),i=o[0].name.value);return(0,r.__assign)({},e,{definitions:[{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}].concat(e.definitions)})},exports.getInclusionDirectives=g,exports.getMainDefinition=k,exports.getMutationDefinition=function(e){h(e);var n=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return(0,t.invariant)(n,7),n},exports.getOperationDefinition=y,exports.getOperationDefinitionOrDie=function(e){var n=y(e);return(0,t.invariant)(n,11),n},exports.getOperationName=function(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null},exports.getQueryDefinition=function(e){var n=y(e);return(0,t.invariant)(n&&"query"===n.operation,12),n},exports.getStoreKeyName=c,exports.graphQLResultHasError=function(e){return e.errors&&e.errors.length},exports.hasClientExports=function(e){return e&&p(["client"],e)&&p(["export"],e)},exports.hasDirectives=p,exports.isDevelopment=Q,exports.isEnv=P,exports.isField=l,exports.isIdValue=function(e){return e&&"id"===e.type&&"boolean"==typeof e.generated},exports.isInlineFragment=s,exports.isJsonValue=function(e){return null!=e&&"object"==typeof e&&"json"===e.type},exports.isNumberValue=function(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1},exports.isProduction=L,exports.isScalarValue=function(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1},exports.isTest=T,exports.maybeDeepFreeze=function(e){if(Q()||T()){var n="function"==typeof Symbol&&"string"==typeof Symbol("");if(!n)return function e(n){Object.freeze(n);Object.getOwnPropertyNames(n).forEach(function(t){null===n[t]||"object"!=typeof n[t]&&"function"!=typeof n[t]||Object.isFrozen(n[t])||e(n[t])});return n}(e)}return e},exports.mergeDeep=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return z(e)},exports.mergeDeepArray=z,exports.removeArgumentsFromDocument=N,exports.removeClientSetsFromDocument=function(e){h(e);var t=j([{test:function(e){return"client"===e.name.value},remove:!0}],e);t&&(t=(0,n.visit)(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet){var n=e.selectionSet.selections.every(function(e){return l(e)&&"__typename"===e.name.value});if(n)return null}}}}));return t},exports.removeConnectionDirectiveFromDocument=function(e){return j([_],h(e))},exports.removeDirectivesFromDocument=j,exports.removeFragmentSpreadFromDocument=q,exports.resultKeyNameFromField=function(e){return e.alias?e.alias.value:e.name.value},exports.shouldInclude=function(e,n){void 0===n&&(n={});return g(e.directives).every(function(e){var r=e.directive,i=e.ifArgument,o=!1;return"Variable"===i.value.kind?(o=n[i.value.name.value],(0,t.invariant)(void 0!==o,3)):o=i.value.value,"skip"===r.name.value?!o:o})},exports.storeKeyNameFromField=function(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 a(t[e.name.value],i,o,n)})}));var r=null;e.arguments&&e.arguments.length&&(r={},e.arguments.forEach(function(e){var t=e.name,i=e.value;return a(r,t,i,n)}));return c(e.name.value,r,t)},exports.stripSymbols=function(e){return JSON.parse(JSON.stringify(e))},exports.toIdValue=function(e,n){void 0===n&&(n=!1);return(0,r.__assign)({type:"id",generated:n},"string"==typeof e?{id:e,typename:void 0}:e)},exports.tryFunctionOrLogError=function(e){try{return e()}catch(e){console.error&&console.error(e)}},exports.valueFromNode=function e(n,t){void 0===t&&(t=v);switch(n.kind){case"Variable":return t(n);case"NullValue":return null;case"IntValue":return parseInt(n.value,10);case"FloatValue":return parseFloat(n.value);case"ListValue":return n.values.map(function(n){return e(n,t)});case"ObjectValue":for(var r={},i=0,o=n.fields;i<o.length;i++){var a=o[i];r[a.name.value]=e(a.value,t)}return r;default:return n.value}},exports.valueToObjectRepresentation=a,exports.variablesInOperation=function(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},exports.warnOnceInDevelopment=function(e,n){void 0===n&&(n="warn");L()||R[e]||(T()||(R[e]=!0),"error"===n?console.error(e):console.warn(e))},exports.canUseWeakMap=exports.isEqual=void 0;var e,n=require("graphql/language/visitor"),t=require("ts-invariant"),r=require("tslib"),i=(e=require("fast-json-stable-stringify"))&&e.__esModule?e:{default:e},o=require("@wry/equality");function a(e,n,r,i){if(function(e){return"IntValue"===e.kind}(r)||function(e){return"FloatValue"===e.kind}(r))e[n.value]=Number(r.value);else if(function(e){return"BooleanValue"===e.kind}(r)||function(e){return"StringValue"===e.kind}(r))e[n.value]=r.value;else if(function(e){return"ObjectValue"===e.kind}(r)){var o={};r.fields.map(function(e){return a(o,e.name,e.value,i)}),e[n.value]=o}else if(function(e){return"Variable"===e.kind}(r)){var u=(i||{})[r.name.value];e[n.value]=u}else if(function(e){return"ListValue"===e.kind}(r))e[n.value]=r.values.map(function(e){var t={};return a(t,n,e,i),t[n.value]});else if(function(e){return"EnumValue"===e.kind}(r))e[n.value]=r.value;else{if(!function(e){return"NullValue"===e.kind}(r))throw new t.InvariantError(17);e[n.value]=null}}exports.isEqual=o.equal;var u=["connection","include","skip","client","rest","export"];function c(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 c=e;if(n){var f=(0,i.default)(n);c+="("+f+")"}return t&&Object.keys(t).forEach(function(e){-1===u.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?c+="@"+e+"("+JSON.stringify(t[e])+")":c+="@"+e)}),c}function f(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return a(t,r,i,n)}),t}return null}function l(e){return"Field"===e.kind}function s(e){return"InlineFragment"===e.kind}function v(e){throw new t.InvariantError(18)}function m(e){var t=[];return(0,n.visit)(e,{Directive:function(e){t.push(e.name.value)}}),t}function p(e,n){return m(n).some(function(n){return e.indexOf(n)>-1})}function d(e){var n=e.name.value;return"skip"===n||"include"===n}function g(e){return e?e.filter(d).map(function(e){var n=e.arguments;e.name.value;(0,t.invariant)(n&&1===n.length,4);var r=n[0];(0,t.invariant)(r.name&&"if"===r.name.value,5);var i=r.value;return(0,t.invariant)(i&&("Variable"===i.kind||"BooleanValue"===i.kind),6),{directive:e,ifArgument:r}}):[]}function x(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 h(e){(0,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(0,t.invariant)(n.length<=1,10),e}function y(e){return h(e),e.definitions.filter(function(e){return"OperationDefinition"===e.kind})[0]}function b(e){return e.definitions.filter(function(e){return"FragmentDefinition"===e.kind})}function D(e){(0,t.invariant)("Document"===e.kind,13),(0,t.invariant)(e.definitions.length<=1,14);var n=e.definitions[0];return(0,t.invariant)("FragmentDefinition"===n.kind,15),n}function k(e){var n;h(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 O(e){void 0===e&&(e=[]);var n={};return e.forEach(function(e){n[e.name.value]=e}),n}function F(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 E={kind:"Field",name:{kind:"Name",value:"__typename"}};function S(e){return function e(n,t){return n.selectionSet.selections.every(function(n){return"FragmentSpread"===n.kind&&e(t[n.name.value],t)})}(y(e)||D(e),O(b(e)))?null:e}function V(e){return function(n){return e.some(function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)})}}function j(e,t){var r=Object.create(null),i=[],o=Object.create(null),a=[],u=S((0,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(V(e))))return n.arguments&&n.arguments.forEach(function(e){"Variable"===e.value.kind&&i.push({name:e.value.name.value})}),n.selectionSet&&function e(n){var t=[];n.selections.forEach(function(n){(l(n)||s(n))&&n.selectionSet?e(n.selectionSet).forEach(function(e){return t.push(e)}):"FragmentSpread"===n.kind&&t.push(n)});return t}(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(V(e)(n))return null}}}));return u&&F(i,function(e){return!r[e.name]}).length&&(u=N(i,u)),u&&F(a,function(e){return!o[e.name]}).length&&(u=q(a,u)),u}var _={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 w(e,n,t){return void 0===t&&(t=!0),n&&n.selections&&n.selections.some(function(n){return I(e,n,t)})}function I(e,n,t){return void 0===t&&(t=!0),!l(n)||!!n.directives&&(n.directives.some(V(e))||t&&w(e,n.selectionSet,t))}function N(e,t){var i=function(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))})}}(e);return S((0,n.visit)(t,{OperationDefinition:{enter:function(n){return(0,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 q(e,t){function r(n){if(e.some(function(e){return e.name===n.name.value}))return null}return S((0,n.visit)(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}var M="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product);exports.canUseWeakMap=M;var A=Object.prototype.toString;function J(){return"undefined"!=typeof process?"production":"development"}function P(e){return J()===e}function L(){return!0===P("production")}function Q(){return!0===P("development")}function T(){return!0===P("test")}var W=Object.prototype.hasOwnProperty;function z(e){var n=e[0]||{},t=e.length;if(t>1){var r=[];n=K(n,r);for(var i=1;i<t;++i)n=C(n,e[i],r)}return n}function B(e){return null!==e&&"object"==typeof e}function C(e,n,t){return B(n)&&B(e)?(Object.isExtensible&&!Object.isExtensible(e)&&(e=K(e,t)),Object.keys(n).forEach(function(r){var i=n[r];if(W.call(e,r)){var o=e[r];i!==o&&(e[r]=C(K(o,t),i,t))}else e[r]=i}),e):n}function K(e,n){return null!==e&&"object"==typeof e&&n.indexOf(e)<0&&(e=Array.isArray(e)?e.slice(0):(0,r.__assign)({__proto__:Object.getPrototypeOf(e)},e),n.push(e)),e}var R=Object.create({}); |
@@ -5,3 +5,3 @@ import { visit } from 'graphql/language/visitor'; | ||
import stringify from 'fast-json-stable-stringify'; | ||
import isEqualLodash from 'lodash.isequal'; | ||
export { equal as isEqual } from '@wry/equality'; | ||
@@ -232,3 +232,3 @@ function isScalarValue(value) { | ||
evaledValue = variables[ifArgument.value.name.value]; | ||
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 1) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 3) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
} | ||
@@ -266,8 +266,8 @@ else { | ||
var directiveName = directive.name.value; | ||
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 2) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 4) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
var ifArgument = directiveArguments[0]; | ||
process.env.NODE_ENV === "production" ? invariant(ifArgument.name && ifArgument.name.value === 'if', 3) : invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? invariant(ifArgument.name && ifArgument.name.value === 'if', 5) : invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
var ifValue = ifArgument.value; | ||
process.env.NODE_ENV === "production" ? invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 4) : invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 6) : invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); | ||
@@ -283,3 +283,3 @@ return { directive: directive, ifArgument: ifArgument }; | ||
if (definition.kind === 'OperationDefinition') { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(5) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(1) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + | ||
'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); | ||
@@ -292,3 +292,3 @@ } | ||
if (typeof actualFragmentName === 'undefined') { | ||
process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 6) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 2) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
actualFragmentName = fragments[0].name.value; | ||
@@ -819,6 +819,2 @@ } | ||
function isEqual(a, b) { | ||
return isEqualLodash(a, b); | ||
} | ||
function deepFreeze(o) { | ||
@@ -924,3 +920,3 @@ Object.freeze(o); | ||
export { addTypenameToDocument, argumentsObjectFromField, assign, buildQueryFromSelectionSet, canUseWeakMap, checkDocument, cloneDeep, createFragmentMap, getDefaultValues, getDirectiveInfoFromField, getDirectiveNames, getDirectivesFromDocument, getEnv, getFragmentDefinition, getFragmentDefinitions, getFragmentQueryDocument, getInclusionDirectives, 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 }; | ||
export { addTypenameToDocument, argumentsObjectFromField, assign, buildQueryFromSelectionSet, canUseWeakMap, checkDocument, cloneDeep, createFragmentMap, getDefaultValues, getDirectiveInfoFromField, getDirectiveNames, getDirectivesFromDocument, getEnv, getFragmentDefinition, getFragmentDefinitions, getFragmentQueryDocument, getInclusionDirectives, getMainDefinition, getMutationDefinition, getOperationDefinition, getOperationDefinitionOrDie, getOperationName, getQueryDefinition, getStoreKeyName, graphQLResultHasError, hasClientExports, hasDirectives, isDevelopment, isEnv, 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 |
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(["exports", "graphql/language/visitor", "ts-invariant", "tslib", "fast-json-stable-stringify", "lodash.isequal"], factory); | ||
define(["exports", "graphql/language/visitor", "ts-invariant", "tslib", "fast-json-stable-stringify", "@wry/equality"], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require("graphql/language/visitor"), require("ts-invariant"), require("tslib"), require("fast-json-stable-stringify"), require("lodash.isequal")); | ||
factory(exports, require("graphql/language/visitor"), require("ts-invariant"), require("tslib"), require("fast-json-stable-stringify"), require("@wry/equality")); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod.exports, global.visitor, global.tsInvariant, global.tslib, global.fastJsonStableStringify, global.lodash); | ||
factory(mod.exports, global.visitor, global.tsInvariant, global.tslib, global.fastJsonStableStringify, global.equality); | ||
global.unknown = mod.exports; | ||
} | ||
})(this, function (_exports, _visitor, _tsInvariant, _tslib, _fastJsonStableStringify, _lodash) { | ||
})(this, function (_exports, _visitor, _tsInvariant, _tslib, _fastJsonStableStringify, _equality) { | ||
@@ -45,3 +45,2 @@ _exports.__esModule = true; | ||
_exports.isEnv = isEnv; | ||
_exports.isEqual = isEqual; | ||
_exports.isField = isField; | ||
@@ -73,5 +72,5 @@ _exports.isIdValue = isIdValue; | ||
_exports.warnOnceInDevelopment = warnOnceInDevelopment; | ||
_exports.canUseWeakMap = void 0; | ||
_exports.canUseWeakMap = _exports.isEqual = void 0; | ||
_fastJsonStableStringify = _interopRequireDefault(_fastJsonStableStringify); | ||
_lodash = _interopRequireDefault(_lodash); | ||
_exports.isEqual = _equality.equal; | ||
@@ -341,3 +340,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
evaledValue = variables[ifArgument.value.name.value]; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 1) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 3) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
} else { | ||
@@ -380,7 +379,7 @@ evaledValue = ifArgument.value.value; | ||
var directiveName = directive.name.value; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 2) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 4) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
var ifArgument = directiveArguments[0]; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 3) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 5) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
var ifValue = ifArgument.value; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 4) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 6) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); | ||
return { | ||
@@ -398,3 +397,3 @@ directive: directive, | ||
if (definition.kind === 'OperationDefinition') { | ||
throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(5) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); | ||
throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(1) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); | ||
} | ||
@@ -408,3 +407,3 @@ | ||
if (typeof actualFragmentName === 'undefined') { | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 6) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 2) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
actualFragmentName = fragments[0].name.value; | ||
@@ -1020,6 +1019,2 @@ } | ||
function isEqual(a, b) { | ||
return (0, _lodash.default)(a, b); | ||
} | ||
function deepFreeze(o) { | ||
@@ -1026,0 +1021,0 @@ Object.freeze(o); |
@@ -1,2 +0,2 @@ | ||
export declare function isEqual(a: any, b: any): boolean; | ||
export { equal as isEqual } from '@wry/equality'; | ||
//# sourceMappingURL=isEqual.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var lodash_isequal_1 = tslib_1.__importDefault(require("lodash.isequal")); | ||
function isEqual(a, b) { | ||
return lodash_isequal_1.default(a, b); | ||
} | ||
exports.isEqual = isEqual; | ||
var equality_1 = require("@wry/equality"); | ||
exports.isEqual = equality_1.equal; | ||
//# sourceMappingURL=isEqual.js.map |
{ | ||
"name": "apollo-utilities", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Utilities for working with GraphQL ASTs", | ||
@@ -42,11 +42,8 @@ "author": "James Baxley <james@meteor.com>", | ||
"dependencies": { | ||
"@wry/equality": "^0.1.2", | ||
"fast-json-stable-stringify": "^2.0.0", | ||
"lodash.isequal": "^4.5.0", | ||
"ts-invariant": "^0.4.0", | ||
"tslib": "^1.9.3" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash.isequal": "^4.5.5" | ||
}, | ||
"gitHead": "4db0a7394649d8b21eaa8d5ba06dc2c3b9ee2b3a" | ||
"gitHead": "656fd9fbcf82df5cd6b9512e4c9b90b808e300ad" | ||
} |
@@ -1,8 +0,1 @@ | ||
import isEqualLodash from 'lodash.isequal'; | ||
/** | ||
* Performs a deep equality check on two JavaScript values. | ||
*/ | ||
export function isEqual(a: any, b: any): boolean { | ||
return isEqualLodash(a, b); | ||
} | ||
export { equal as isEqual } from '@wry/equality'; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
566542
7961
+ Added@wry/equality@^0.1.2
+ Added@wry/equality@0.1.11(transitive)
- Removedlodash.isequal@^4.5.0
- Removedlodash.isequal@4.5.0(transitive)