You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1731 lines
61 KiB
1731 lines
61 KiB
4 months ago
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
|
||
|
var globals = require('./globals');
|
||
|
var graphql = require('graphql');
|
||
|
var trie = require('@wry/trie');
|
||
|
var tslib = require('tslib');
|
||
|
var caches = require('@wry/caches');
|
||
|
var optimism = require('optimism');
|
||
|
var zenObservableTs = require('zen-observable-ts');
|
||
|
require('symbol-observable');
|
||
|
|
||
|
function shouldInclude(_a, variables) {
|
||
|
var directives = _a.directives;
|
||
|
if (!directives || !directives.length) {
|
||
|
return true;
|
||
|
}
|
||
|
return getInclusionDirectives(directives).every(function (_a) {
|
||
|
var directive = _a.directive, ifArgument = _a.ifArgument;
|
||
|
var evaledValue = false;
|
||
|
if (ifArgument.value.kind === "Variable") {
|
||
|
evaledValue =
|
||
|
variables && variables[ifArgument.value.name.value];
|
||
|
globals.invariant(evaledValue !== void 0, 67, directive.name.value);
|
||
|
}
|
||
|
else {
|
||
|
evaledValue = ifArgument.value.value;
|
||
|
}
|
||
|
return directive.name.value === "skip" ? !evaledValue : evaledValue;
|
||
|
});
|
||
|
}
|
||
|
function getDirectiveNames(root) {
|
||
|
var names = [];
|
||
|
graphql.visit(root, {
|
||
|
Directive: function (node) {
|
||
|
names.push(node.name.value);
|
||
|
},
|
||
|
});
|
||
|
return names;
|
||
|
}
|
||
|
var hasAnyDirectives = function (names, root) {
|
||
|
return hasDirectives(names, root, false);
|
||
|
};
|
||
|
var hasAllDirectives = function (names, root) {
|
||
|
return hasDirectives(names, root, true);
|
||
|
};
|
||
|
function hasDirectives(names, root, all) {
|
||
|
var nameSet = new Set(names);
|
||
|
var uniqueCount = nameSet.size;
|
||
|
graphql.visit(root, {
|
||
|
Directive: function (node) {
|
||
|
if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) {
|
||
|
return graphql.BREAK;
|
||
|
}
|
||
|
},
|
||
|
});
|
||
|
return all ? !nameSet.size : nameSet.size < uniqueCount;
|
||
|
}
|
||
|
function hasClientExports(document) {
|
||
|
return document && hasDirectives(["client", "export"], document, true);
|
||
|
}
|
||
|
function isInclusionDirective(_a) {
|
||
|
var value = _a.name.value;
|
||
|
return value === "skip" || value === "include";
|
||
|
}
|
||
|
function getInclusionDirectives(directives) {
|
||
|
var result = [];
|
||
|
if (directives && directives.length) {
|
||
|
directives.forEach(function (directive) {
|
||
|
if (!isInclusionDirective(directive))
|
||
|
return;
|
||
|
var directiveArguments = directive.arguments;
|
||
|
var directiveName = directive.name.value;
|
||
|
globals.invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName);
|
||
|
var ifArgument = directiveArguments[0];
|
||
|
globals.invariant(ifArgument.name && ifArgument.name.value === "if", 69, directiveName);
|
||
|
var ifValue = ifArgument.value;
|
||
|
globals.invariant(ifValue &&
|
||
|
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 70, directiveName);
|
||
|
result.push({ directive: directive, ifArgument: ifArgument });
|
||
|
});
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
var canUseWeakMap = typeof WeakMap === "function" &&
|
||
|
!globals.maybe(function () { return navigator.product == "ReactNative" && !global.HermesInternal; });
|
||
|
var canUseWeakSet = typeof WeakSet === "function";
|
||
|
var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function";
|
||
|
var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
|
||
|
var canUseDOM = typeof globals.maybe(function () { return window.document.createElement; }) === "function";
|
||
|
var usingJSDOM =
|
||
|
globals.maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
|
||
|
var canUseLayoutEffect = canUseDOM && !usingJSDOM;
|
||
|
|
||
|
function isNonNullObject(obj) {
|
||
|
return obj !== null && typeof obj === "object";
|
||
|
}
|
||
|
function isPlainObject(obj) {
|
||
|
return (obj !== null &&
|
||
|
typeof obj === "object" &&
|
||
|
(Object.getPrototypeOf(obj) === Object.prototype ||
|
||
|
Object.getPrototypeOf(obj) === null));
|
||
|
}
|
||
|
|
||
|
function getFragmentQueryDocument(document, fragmentName) {
|
||
|
var actualFragmentName = fragmentName;
|
||
|
var fragments = [];
|
||
|
document.definitions.forEach(function (definition) {
|
||
|
if (definition.kind === "OperationDefinition") {
|
||
|
throw globals.newInvariantError(
|
||
|
71,
|
||
|
definition.operation,
|
||
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
||
|
);
|
||
|
}
|
||
|
if (definition.kind === "FragmentDefinition") {
|
||
|
fragments.push(definition);
|
||
|
}
|
||
|
});
|
||
|
if (typeof actualFragmentName === "undefined") {
|
||
|
globals.invariant(fragments.length === 1, 72, fragments.length);
|
||
|
actualFragmentName = fragments[0].name.value;
|
||
|
}
|
||
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
||
|
{
|
||
|
kind: "OperationDefinition",
|
||
|
operation: "query",
|
||
|
selectionSet: {
|
||
|
kind: "SelectionSet",
|
||
|
selections: [
|
||
|
{
|
||
|
kind: "FragmentSpread",
|
||
|
name: {
|
||
|
kind: "Name",
|
||
|
value: actualFragmentName,
|
||
|
},
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
}
|
||
|
], document.definitions, true) });
|
||
|
return query;
|
||
|
}
|
||
|
function createFragmentMap(fragments) {
|
||
|
if (fragments === void 0) { fragments = []; }
|
||
|
var symTable = {};
|
||
|
fragments.forEach(function (fragment) {
|
||
|
symTable[fragment.name.value] = fragment;
|
||
|
});
|
||
|
return symTable;
|
||
|
}
|
||
|
function getFragmentFromSelection(selection, fragmentMap) {
|
||
|
switch (selection.kind) {
|
||
|
case "InlineFragment":
|
||
|
return selection;
|
||
|
case "FragmentSpread": {
|
||
|
var fragmentName = selection.name.value;
|
||
|
if (typeof fragmentMap === "function") {
|
||
|
return fragmentMap(fragmentName);
|
||
|
}
|
||
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
||
|
globals.invariant(fragment, 73, fragmentName);
|
||
|
return fragment || null;
|
||
|
}
|
||
|
default:
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var scheduledCleanup = new WeakSet();
|
||
|
function schedule(cache) {
|
||
|
if (!scheduledCleanup.has(cache)) {
|
||
|
scheduledCleanup.add(cache);
|
||
|
setTimeout(function () {
|
||
|
cache.clean();
|
||
|
scheduledCleanup.delete(cache);
|
||
|
}, 100);
|
||
|
}
|
||
|
}
|
||
|
var AutoCleanedWeakCache = function (max, dispose) {
|
||
|
var cache = new caches.WeakCache(max, dispose);
|
||
|
cache.set = function (key, value) {
|
||
|
schedule(this);
|
||
|
return caches.WeakCache.prototype.set.call(this, key, value);
|
||
|
};
|
||
|
return cache;
|
||
|
};
|
||
|
var AutoCleanedStrongCache = function (max, dispose) {
|
||
|
var cache = new caches.StrongCache(max, dispose);
|
||
|
cache.set = function (key, value) {
|
||
|
schedule(this);
|
||
|
return caches.StrongCache.prototype.set.call(this, key, value);
|
||
|
};
|
||
|
return cache;
|
||
|
};
|
||
|
|
||
|
var cacheSizeSymbol = Symbol.for("apollo.cacheSize");
|
||
|
var cacheSizes = tslib.__assign({}, globals.global[cacheSizeSymbol]);
|
||
|
|
||
|
var globalCaches = {};
|
||
|
function registerGlobalCache(name, getSize) {
|
||
|
globalCaches[name] = getSize;
|
||
|
}
|
||
|
|
||
|
var canonicalStringify = Object.assign(function canonicalStringify(value) {
|
||
|
return JSON.stringify(value, stableObjectReplacer);
|
||
|
}, {
|
||
|
reset: function () {
|
||
|
sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 );
|
||
|
},
|
||
|
});
|
||
|
if (globalThis.__DEV__ !== false) {
|
||
|
registerGlobalCache("canonicalStringify", function () { return sortingMap.size; });
|
||
|
}
|
||
|
var sortingMap;
|
||
|
canonicalStringify.reset();
|
||
|
function stableObjectReplacer(key, value) {
|
||
|
if (value && typeof value === "object") {
|
||
|
var proto = Object.getPrototypeOf(value);
|
||
|
if (proto === Object.prototype || proto === null) {
|
||
|
var keys = Object.keys(value);
|
||
|
if (keys.every(everyKeyInOrder))
|
||
|
return value;
|
||
|
var unsortedKey = JSON.stringify(keys);
|
||
|
var sortedKeys = sortingMap.get(unsortedKey);
|
||
|
if (!sortedKeys) {
|
||
|
keys.sort();
|
||
|
var sortedKey = JSON.stringify(keys);
|
||
|
sortedKeys = sortingMap.get(sortedKey) || keys;
|
||
|
sortingMap.set(unsortedKey, sortedKeys);
|
||
|
sortingMap.set(sortedKey, sortedKeys);
|
||
|
}
|
||
|
var sortedObject_1 = Object.create(proto);
|
||
|
sortedKeys.forEach(function (key) {
|
||
|
sortedObject_1[key] = value[key];
|
||
|
});
|
||
|
return sortedObject_1;
|
||
|
}
|
||
|
}
|
||
|
return value;
|
||
|
}
|
||
|
function everyKeyInOrder(key, i, keys) {
|
||
|
return i === 0 || keys[i - 1] <= key;
|
||
|
}
|
||
|
|
||
|
function makeReference(id) {
|
||
|
return { __ref: String(id) };
|
||
|
}
|
||
|
function isReference(obj) {
|
||
|
return Boolean(obj && typeof obj === "object" && typeof obj.__ref === "string");
|
||
|
}
|
||
|
function isDocumentNode(value) {
|
||
|
return (isNonNullObject(value) &&
|
||
|
value.kind === "Document" &&
|
||
|
Array.isArray(value.definitions));
|
||
|
}
|
||
|
function isStringValue(value) {
|
||
|
return value.kind === "StringValue";
|
||
|
}
|
||
|
function isBooleanValue(value) {
|
||
|
return value.kind === "BooleanValue";
|
||
|
}
|
||
|
function isIntValue(value) {
|
||
|
return value.kind === "IntValue";
|
||
|
}
|
||
|
function isFloatValue(value) {
|
||
|
return value.kind === "FloatValue";
|
||
|
}
|
||
|
function isVariable(value) {
|
||
|
return value.kind === "Variable";
|
||
|
}
|
||
|
function isObjectValue(value) {
|
||
|
return value.kind === "ObjectValue";
|
||
|
}
|
||
|
function isListValue(value) {
|
||
|
return value.kind === "ListValue";
|
||
|
}
|
||
|
function isEnumValue(value) {
|
||
|
return value.kind === "EnumValue";
|
||
|
}
|
||
|
function isNullValue(value) {
|
||
|
return value.kind === "NullValue";
|
||
|
}
|
||
|
function valueToObjectRepresentation(argObj, name, value, variables) {
|
||
|
if (isIntValue(value) || isFloatValue(value)) {
|
||
|
argObj[name.value] = Number(value.value);
|
||
|
}
|
||
|
else if (isBooleanValue(value) || isStringValue(value)) {
|
||
|
argObj[name.value] = value.value;
|
||
|
}
|
||
|
else if (isObjectValue(value)) {
|
||
|
var nestedArgObj_1 = {};
|
||
|
value.fields.map(function (obj) {
|
||
|
return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables);
|
||
|
});
|
||
|
argObj[name.value] = nestedArgObj_1;
|
||
|
}
|
||
|
else if (isVariable(value)) {
|
||
|
var variableValue = (variables || {})[value.name.value];
|
||
|
argObj[name.value] = variableValue;
|
||
|
}
|
||
|
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 globals.newInvariantError(82, name.value, value.kind);
|
||
|
}
|
||
|
}
|
||
|
function storeKeyNameFromField(field, variables) {
|
||
|
var directivesObj = null;
|
||
|
if (field.directives) {
|
||
|
directivesObj = {};
|
||
|
field.directives.forEach(function (directive) {
|
||
|
directivesObj[directive.name.value] = {};
|
||
|
if (directive.arguments) {
|
||
|
directive.arguments.forEach(function (_a) {
|
||
|
var name = _a.name, value = _a.value;
|
||
|
return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
var argObj = null;
|
||
|
if (field.arguments && field.arguments.length) {
|
||
|
argObj = {};
|
||
|
field.arguments.forEach(function (_a) {
|
||
|
var name = _a.name, value = _a.value;
|
||
|
return valueToObjectRepresentation(argObj, name, value, variables);
|
||
|
});
|
||
|
}
|
||
|
return getStoreKeyName(field.name.value, argObj, directivesObj);
|
||
|
}
|
||
|
var KNOWN_DIRECTIVES = [
|
||
|
"connection",
|
||
|
"include",
|
||
|
"skip",
|
||
|
"client",
|
||
|
"rest",
|
||
|
"export",
|
||
|
"nonreactive",
|
||
|
];
|
||
|
var storeKeyNameStringify = canonicalStringify;
|
||
|
var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
||
|
if (args &&
|
||
|
directives &&
|
||
|
directives["connection"] &&
|
||
|
directives["connection"]["key"]) {
|
||
|
if (directives["connection"]["filter"] &&
|
||
|
directives["connection"]["filter"].length > 0) {
|
||
|
var filterKeys = directives["connection"]["filter"] ?
|
||
|
directives["connection"]["filter"]
|
||
|
: [];
|
||
|
filterKeys.sort();
|
||
|
var filteredArgs_1 = {};
|
||
|
filterKeys.forEach(function (key) {
|
||
|
filteredArgs_1[key] = args[key];
|
||
|
});
|
||
|
return "".concat(directives["connection"]["key"], "(").concat(storeKeyNameStringify(filteredArgs_1), ")");
|
||
|
}
|
||
|
else {
|
||
|
return directives["connection"]["key"];
|
||
|
}
|
||
|
}
|
||
|
var completeFieldName = fieldName;
|
||
|
if (args) {
|
||
|
var stringifiedArgs = storeKeyNameStringify(args);
|
||
|
completeFieldName += "(".concat(stringifiedArgs, ")");
|
||
|
}
|
||
|
if (directives) {
|
||
|
Object.keys(directives).forEach(function (key) {
|
||
|
if (KNOWN_DIRECTIVES.indexOf(key) !== -1)
|
||
|
return;
|
||
|
if (directives[key] && Object.keys(directives[key]).length) {
|
||
|
completeFieldName += "@".concat(key, "(").concat(storeKeyNameStringify(directives[key]), ")");
|
||
|
}
|
||
|
else {
|
||
|
completeFieldName += "@".concat(key);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return completeFieldName;
|
||
|
}, {
|
||
|
setStringify: function (s) {
|
||
|
var previous = storeKeyNameStringify;
|
||
|
storeKeyNameStringify = s;
|
||
|
return previous;
|
||
|
},
|
||
|
});
|
||
|
function argumentsObjectFromField(field, variables) {
|
||
|
if (field.arguments && field.arguments.length) {
|
||
|
var argObj_1 = {};
|
||
|
field.arguments.forEach(function (_a) {
|
||
|
var name = _a.name, value = _a.value;
|
||
|
return valueToObjectRepresentation(argObj_1, name, value, variables);
|
||
|
});
|
||
|
return argObj_1;
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
function resultKeyNameFromField(field) {
|
||
|
return field.alias ? field.alias.value : field.name.value;
|
||
|
}
|
||
|
function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
||
|
var fragments;
|
||
|
for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
|
||
|
var selection = _a[_i];
|
||
|
if (isField(selection)) {
|
||
|
if (selection.name.value === "__typename") {
|
||
|
return result[resultKeyNameFromField(selection)];
|
||
|
}
|
||
|
}
|
||
|
else if (fragments) {
|
||
|
fragments.push(selection);
|
||
|
}
|
||
|
else {
|
||
|
fragments = [selection];
|
||
|
}
|
||
|
}
|
||
|
if (typeof result.__typename === "string") {
|
||
|
return result.__typename;
|
||
|
}
|
||
|
if (fragments) {
|
||
|
for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {
|
||
|
var selection = fragments_1[_b];
|
||
|
var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
|
||
|
if (typeof typename === "string") {
|
||
|
return typename;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
function isField(selection) {
|
||
|
return selection.kind === "Field";
|
||
|
}
|
||
|
function isInlineFragment(selection) {
|
||
|
return selection.kind === "InlineFragment";
|
||
|
}
|
||
|
|
||
|
function checkDocument(doc) {
|
||
|
globals.invariant(doc && doc.kind === "Document", 74);
|
||
|
var operations = doc.definitions
|
||
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
||
|
.map(function (definition) {
|
||
|
if (definition.kind !== "OperationDefinition") {
|
||
|
throw globals.newInvariantError(75, definition.kind);
|
||
|
}
|
||
|
return definition;
|
||
|
});
|
||
|
globals.invariant(operations.length <= 1, 76, operations.length);
|
||
|
return doc;
|
||
|
}
|
||
|
function getOperationDefinition(doc) {
|
||
|
checkDocument(doc);
|
||
|
return doc.definitions.filter(function (definition) {
|
||
|
return definition.kind === "OperationDefinition";
|
||
|
})[0];
|
||
|
}
|
||
|
function getOperationName(doc) {
|
||
|
return (doc.definitions
|
||
|
.filter(function (definition) {
|
||
|
return definition.kind === "OperationDefinition" && !!definition.name;
|
||
|
})
|
||
|
.map(function (x) { return x.name.value; })[0] || null);
|
||
|
}
|
||
|
function getFragmentDefinitions(doc) {
|
||
|
return doc.definitions.filter(function (definition) {
|
||
|
return definition.kind === "FragmentDefinition";
|
||
|
});
|
||
|
}
|
||
|
function getQueryDefinition(doc) {
|
||
|
var queryDef = getOperationDefinition(doc);
|
||
|
globals.invariant(queryDef && queryDef.operation === "query", 77);
|
||
|
return queryDef;
|
||
|
}
|
||
|
function getFragmentDefinition(doc) {
|
||
|
globals.invariant(doc.kind === "Document", 78);
|
||
|
globals.invariant(doc.definitions.length <= 1, 79);
|
||
|
var fragmentDef = doc.definitions[0];
|
||
|
globals.invariant(fragmentDef.kind === "FragmentDefinition", 80);
|
||
|
return fragmentDef;
|
||
|
}
|
||
|
function getMainDefinition(queryDoc) {
|
||
|
checkDocument(queryDoc);
|
||
|
var fragmentDefinition;
|
||
|
for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) {
|
||
|
var definition = _a[_i];
|
||
|
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 globals.newInvariantError(81);
|
||
|
}
|
||
|
function getDefaultValues(definition) {
|
||
|
var defaultValues = Object.create(null);
|
||
|
var defs = definition && definition.variableDefinitions;
|
||
|
if (defs && defs.length) {
|
||
|
defs.forEach(function (def) {
|
||
|
if (def.defaultValue) {
|
||
|
valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return defaultValues;
|
||
|
}
|
||
|
|
||
|
function identity(document) {
|
||
|
return document;
|
||
|
}
|
||
|
var DocumentTransform = (function () {
|
||
|
function DocumentTransform(transform, options) {
|
||
|
if (options === void 0) { options = Object.create(null); }
|
||
|
this.resultCache = canUseWeakSet ? new WeakSet() : new Set();
|
||
|
this.transform = transform;
|
||
|
if (options.getCacheKey) {
|
||
|
this.getCacheKey = options.getCacheKey;
|
||
|
}
|
||
|
this.cached = options.cache !== false;
|
||
|
this.resetCache();
|
||
|
}
|
||
|
DocumentTransform.prototype.getCacheKey = function (document) {
|
||
|
return [document];
|
||
|
};
|
||
|
DocumentTransform.identity = function () {
|
||
|
return new DocumentTransform(identity, { cache: false });
|
||
|
};
|
||
|
DocumentTransform.split = function (predicate, left, right) {
|
||
|
if (right === void 0) { right = DocumentTransform.identity(); }
|
||
|
return Object.assign(new DocumentTransform(function (document) {
|
||
|
var documentTransform = predicate(document) ? left : right;
|
||
|
return documentTransform.transformDocument(document);
|
||
|
},
|
||
|
{ cache: false }), { left: left, right: right });
|
||
|
};
|
||
|
DocumentTransform.prototype.resetCache = function () {
|
||
|
var _this = this;
|
||
|
if (this.cached) {
|
||
|
var stableCacheKeys_1 = new trie.Trie(canUseWeakMap);
|
||
|
this.performWork = optimism.wrap(DocumentTransform.prototype.performWork.bind(this), {
|
||
|
makeCacheKey: function (document) {
|
||
|
var cacheKeys = _this.getCacheKey(document);
|
||
|
if (cacheKeys) {
|
||
|
globals.invariant(Array.isArray(cacheKeys), 66);
|
||
|
return stableCacheKeys_1.lookupArray(cacheKeys);
|
||
|
}
|
||
|
},
|
||
|
max: cacheSizes["documentTransform.cache"],
|
||
|
cache: (caches.WeakCache),
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
DocumentTransform.prototype.performWork = function (document) {
|
||
|
checkDocument(document);
|
||
|
return this.transform(document);
|
||
|
};
|
||
|
DocumentTransform.prototype.transformDocument = function (document) {
|
||
|
if (this.resultCache.has(document)) {
|
||
|
return document;
|
||
|
}
|
||
|
var transformedDocument = this.performWork(document);
|
||
|
this.resultCache.add(transformedDocument);
|
||
|
return transformedDocument;
|
||
|
};
|
||
|
DocumentTransform.prototype.concat = function (otherTransform) {
|
||
|
var _this = this;
|
||
|
return Object.assign(new DocumentTransform(function (document) {
|
||
|
return otherTransform.transformDocument(_this.transformDocument(document));
|
||
|
},
|
||
|
{ cache: false }), {
|
||
|
left: this,
|
||
|
right: otherTransform,
|
||
|
});
|
||
|
};
|
||
|
return DocumentTransform;
|
||
|
}());
|
||
|
|
||
|
var printCache;
|
||
|
var print = Object.assign(function (ast) {
|
||
|
var result = printCache.get(ast);
|
||
|
if (!result) {
|
||
|
result = graphql.print(ast);
|
||
|
printCache.set(ast, result);
|
||
|
}
|
||
|
return result;
|
||
|
}, {
|
||
|
reset: function () {
|
||
|
printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 );
|
||
|
},
|
||
|
});
|
||
|
print.reset();
|
||
|
if (globalThis.__DEV__ !== false) {
|
||
|
registerGlobalCache("print", function () { return (printCache ? printCache.size : 0); });
|
||
|
}
|
||
|
|
||
|
var isArray = Array.isArray;
|
||
|
function isNonEmptyArray(value) {
|
||
|
return Array.isArray(value) && value.length > 0;
|
||
|
}
|
||
|
|
||
|
var TYPENAME_FIELD = {
|
||
|
kind: graphql.Kind.FIELD,
|
||
|
name: {
|
||
|
kind: graphql.Kind.NAME,
|
||
|
value: "__typename",
|
||
|
},
|
||
|
};
|
||
|
function isEmpty(op, fragmentMap) {
|
||
|
return (!op ||
|
||
|
op.selectionSet.selections.every(function (selection) {
|
||
|
return selection.kind === graphql.Kind.FRAGMENT_SPREAD &&
|
||
|
isEmpty(fragmentMap[selection.name.value], fragmentMap);
|
||
|
}));
|
||
|
}
|
||
|
function nullIfDocIsEmpty(doc) {
|
||
|
return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ?
|
||
|
null
|
||
|
: doc;
|
||
|
}
|
||
|
function getDirectiveMatcher(configs) {
|
||
|
var names = new Map();
|
||
|
var tests = new Map();
|
||
|
configs.forEach(function (directive) {
|
||
|
if (directive) {
|
||
|
if (directive.name) {
|
||
|
names.set(directive.name, directive);
|
||
|
}
|
||
|
else if (directive.test) {
|
||
|
tests.set(directive.test, directive);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
return function (directive) {
|
||
|
var config = names.get(directive.name.value);
|
||
|
if (!config && tests.size) {
|
||
|
tests.forEach(function (testConfig, test) {
|
||
|
if (test(directive)) {
|
||
|
config = testConfig;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return config;
|
||
|
};
|
||
|
}
|
||
|
function makeInUseGetterFunction(defaultKey) {
|
||
|
var map = new Map();
|
||
|
return function inUseGetterFunction(key) {
|
||
|
if (key === void 0) { key = defaultKey; }
|
||
|
var inUse = map.get(key);
|
||
|
if (!inUse) {
|
||
|
map.set(key, (inUse = {
|
||
|
variables: new Set(),
|
||
|
fragmentSpreads: new Set(),
|
||
|
}));
|
||
|
}
|
||
|
return inUse;
|
||
|
};
|
||
|
}
|
||
|
function removeDirectivesFromDocument(directives, doc) {
|
||
|
checkDocument(doc);
|
||
|
var getInUseByOperationName = makeInUseGetterFunction("");
|
||
|
var getInUseByFragmentName = makeInUseGetterFunction("");
|
||
|
var getInUse = function (ancestors) {
|
||
|
for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) {
|
||
|
if (isArray(ancestor))
|
||
|
continue;
|
||
|
if (ancestor.kind === graphql.Kind.OPERATION_DEFINITION) {
|
||
|
return getInUseByOperationName(ancestor.name && ancestor.name.value);
|
||
|
}
|
||
|
if (ancestor.kind === graphql.Kind.FRAGMENT_DEFINITION) {
|
||
|
return getInUseByFragmentName(ancestor.name.value);
|
||
|
}
|
||
|
}
|
||
|
globalThis.__DEV__ !== false && globals.invariant.error(83);
|
||
|
return null;
|
||
|
};
|
||
|
var operationCount = 0;
|
||
|
for (var i = doc.definitions.length - 1; i >= 0; --i) {
|
||
|
if (doc.definitions[i].kind === graphql.Kind.OPERATION_DEFINITION) {
|
||
|
++operationCount;
|
||
|
}
|
||
|
}
|
||
|
var directiveMatcher = getDirectiveMatcher(directives);
|
||
|
var shouldRemoveField = function (nodeDirectives) {
|
||
|
return isNonEmptyArray(nodeDirectives) &&
|
||
|
nodeDirectives
|
||
|
.map(directiveMatcher)
|
||
|
.some(function (config) { return config && config.remove; });
|
||
|
};
|
||
|
var originalFragmentDefsByPath = new Map();
|
||
|
var firstVisitMadeChanges = false;
|
||
|
var fieldOrInlineFragmentVisitor = {
|
||
|
enter: function (node) {
|
||
|
if (shouldRemoveField(node.directives)) {
|
||
|
firstVisitMadeChanges = true;
|
||
|
return null;
|
||
|
}
|
||
|
},
|
||
|
};
|
||
|
var docWithoutDirectiveSubtrees = graphql.visit(doc, {
|
||
|
Field: fieldOrInlineFragmentVisitor,
|
||
|
InlineFragment: fieldOrInlineFragmentVisitor,
|
||
|
VariableDefinition: {
|
||
|
enter: function () {
|
||
|
return false;
|
||
|
},
|
||
|
},
|
||
|
Variable: {
|
||
|
enter: function (node, _key, _parent, _path, ancestors) {
|
||
|
var inUse = getInUse(ancestors);
|
||
|
if (inUse) {
|
||
|
inUse.variables.add(node.name.value);
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
FragmentSpread: {
|
||
|
enter: function (node, _key, _parent, _path, ancestors) {
|
||
|
if (shouldRemoveField(node.directives)) {
|
||
|
firstVisitMadeChanges = true;
|
||
|
return null;
|
||
|
}
|
||
|
var inUse = getInUse(ancestors);
|
||
|
if (inUse) {
|
||
|
inUse.fragmentSpreads.add(node.name.value);
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
FragmentDefinition: {
|
||
|
enter: function (node, _key, _parent, path) {
|
||
|
originalFragmentDefsByPath.set(JSON.stringify(path), node);
|
||
|
},
|
||
|
leave: function (node, _key, _parent, path) {
|
||
|
var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path));
|
||
|
if (node === originalNode) {
|
||
|
return node;
|
||
|
}
|
||
|
if (
|
||
|
operationCount > 0 &&
|
||
|
node.selectionSet.selections.every(function (selection) {
|
||
|
return selection.kind === graphql.Kind.FIELD &&
|
||
|
selection.name.value === "__typename";
|
||
|
})) {
|
||
|
getInUseByFragmentName(node.name.value).removed = true;
|
||
|
firstVisitMadeChanges = true;
|
||
|
return null;
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
Directive: {
|
||
|
leave: function (node) {
|
||
|
if (directiveMatcher(node)) {
|
||
|
firstVisitMadeChanges = true;
|
||
|
return null;
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
if (!firstVisitMadeChanges) {
|
||
|
return doc;
|
||
|
}
|
||
|
var populateTransitiveVars = function (inUse) {
|
||
|
if (!inUse.transitiveVars) {
|
||
|
inUse.transitiveVars = new Set(inUse.variables);
|
||
|
if (!inUse.removed) {
|
||
|
inUse.fragmentSpreads.forEach(function (childFragmentName) {
|
||
|
populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) {
|
||
|
inUse.transitiveVars.add(varName);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
return inUse;
|
||
|
};
|
||
|
var allFragmentNamesUsed = new Set();
|
||
|
docWithoutDirectiveSubtrees.definitions.forEach(function (def) {
|
||
|
if (def.kind === graphql.Kind.OPERATION_DEFINITION) {
|
||
|
populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) {
|
||
|
allFragmentNamesUsed.add(childFragmentName);
|
||
|
});
|
||
|
}
|
||
|
else if (def.kind === graphql.Kind.FRAGMENT_DEFINITION &&
|
||
|
operationCount === 0 &&
|
||
|
!getInUseByFragmentName(def.name.value).removed) {
|
||
|
allFragmentNamesUsed.add(def.name.value);
|
||
|
}
|
||
|
});
|
||
|
allFragmentNamesUsed.forEach(function (fragmentName) {
|
||
|
populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) {
|
||
|
allFragmentNamesUsed.add(childFragmentName);
|
||
|
});
|
||
|
});
|
||
|
var fragmentWillBeRemoved = function (fragmentName) {
|
||
|
return !!(
|
||
|
(!allFragmentNamesUsed.has(fragmentName) ||
|
||
|
getInUseByFragmentName(fragmentName).removed));
|
||
|
};
|
||
|
var enterVisitor = {
|
||
|
enter: function (node) {
|
||
|
if (fragmentWillBeRemoved(node.name.value)) {
|
||
|
return null;
|
||
|
}
|
||
|
},
|
||
|
};
|
||
|
return nullIfDocIsEmpty(graphql.visit(docWithoutDirectiveSubtrees, {
|
||
|
FragmentSpread: enterVisitor,
|
||
|
FragmentDefinition: enterVisitor,
|
||
|
OperationDefinition: {
|
||
|
leave: function (node) {
|
||
|
if (node.variableDefinitions) {
|
||
|
var usedVariableNames_1 = populateTransitiveVars(
|
||
|
getInUseByOperationName(node.name && node.name.value)).transitiveVars;
|
||
|
if (usedVariableNames_1.size < node.variableDefinitions.length) {
|
||
|
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) {
|
||
|
return usedVariableNames_1.has(varDef.variable.name.value);
|
||
|
}) });
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
}));
|
||
|
}
|
||
|
var addTypenameToDocument = Object.assign(function (doc) {
|
||
|
return graphql.visit(doc, {
|
||
|
SelectionSet: {
|
||
|
enter: function (node, _key, parent) {
|
||
|
if (parent &&
|
||
|
parent.kind ===
|
||
|
graphql.Kind.OPERATION_DEFINITION) {
|
||
|
return;
|
||
|
}
|
||
|
var selections = node.selections;
|
||
|
if (!selections) {
|
||
|
return;
|
||
|
}
|
||
|
var skip = selections.some(function (selection) {
|
||
|
return (isField(selection) &&
|
||
|
(selection.name.value === "__typename" ||
|
||
|
selection.name.value.lastIndexOf("__", 0) === 0));
|
||
|
});
|
||
|
if (skip) {
|
||
|
return;
|
||
|
}
|
||
|
var field = parent;
|
||
|
if (isField(field) &&
|
||
|
field.directives &&
|
||
|
field.directives.some(function (d) { return d.name.value === "export"; })) {
|
||
|
return;
|
||
|
}
|
||
|
return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) });
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
}, {
|
||
|
added: function (field) {
|
||
|
return field === TYPENAME_FIELD;
|
||
|
},
|
||
|
});
|
||
|
var connectionRemoveConfig = {
|
||
|
test: function (directive) {
|
||
|
var willRemove = directive.name.value === "connection";
|
||
|
if (willRemove) {
|
||
|
if (!directive.arguments ||
|
||
|
!directive.arguments.some(function (arg) { return arg.name.value === "key"; })) {
|
||
|
globalThis.__DEV__ !== false && globals.invariant.warn(84);
|
||
|
}
|
||
|
}
|
||
|
return willRemove;
|
||
|
},
|
||
|
};
|
||
|
function removeConnectionDirectiveFromDocument(doc) {
|
||
|
return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));
|
||
|
}
|
||
|
function getArgumentMatcher(config) {
|
||
|
return function argumentMatcher(argument) {
|
||
|
return config.some(function (aConfig) {
|
||
|
return argument.value &&
|
||
|
argument.value.kind === graphql.Kind.VARIABLE &&
|
||
|
argument.value.name &&
|
||
|
(aConfig.name === argument.value.name.value ||
|
||
|
(aConfig.test && aConfig.test(argument)));
|
||
|
});
|
||
|
};
|
||
|
}
|
||
|
function removeArgumentsFromDocument(config, doc) {
|
||
|
var argMatcher = getArgumentMatcher(config);
|
||
|
return nullIfDocIsEmpty(graphql.visit(doc, {
|
||
|
OperationDefinition: {
|
||
|
enter: function (node) {
|
||
|
return tslib.__assign(tslib.__assign({}, node), {
|
||
|
variableDefinitions: node.variableDefinitions ?
|
||
|
node.variableDefinitions.filter(function (varDef) {
|
||
|
return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });
|
||
|
})
|
||
|
: [] });
|
||
|
},
|
||
|
},
|
||
|
Field: {
|
||
|
enter: function (node) {
|
||
|
var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; });
|
||
|
if (shouldRemoveField) {
|
||
|
var argMatchCount_1 = 0;
|
||
|
if (node.arguments) {
|
||
|
node.arguments.forEach(function (arg) {
|
||
|
if (argMatcher(arg)) {
|
||
|
argMatchCount_1 += 1;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (argMatchCount_1 === 1) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
Argument: {
|
||
|
enter: function (node) {
|
||
|
if (argMatcher(node)) {
|
||
|
return null;
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
}));
|
||
|
}
|
||
|
function removeFragmentSpreadFromDocument(config, doc) {
|
||
|
function enter(node) {
|
||
|
if (config.some(function (def) { return def.name === node.name.value; })) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
return nullIfDocIsEmpty(graphql.visit(doc, {
|
||
|
FragmentSpread: { enter: enter },
|
||
|
FragmentDefinition: { enter: enter },
|
||
|
}));
|
||
|
}
|
||
|
function buildQueryFromSelectionSet(document) {
|
||
|
var definition = getMainDefinition(document);
|
||
|
var definitionOperation = definition.operation;
|
||
|
if (definitionOperation === "query") {
|
||
|
return document;
|
||
|
}
|
||
|
var modifiedDoc = graphql.visit(document, {
|
||
|
OperationDefinition: {
|
||
|
enter: function (node) {
|
||
|
return tslib.__assign(tslib.__assign({}, node), { operation: "query" });
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
return modifiedDoc;
|
||
|
}
|
||
|
function removeClientSetsFromDocument(document) {
|
||
|
checkDocument(document);
|
||
|
var modifiedDoc = removeDirectivesFromDocument([
|
||
|
{
|
||
|
test: function (directive) { return directive.name.value === "client"; },
|
||
|
remove: true,
|
||
|
},
|
||
|
], document);
|
||
|
return modifiedDoc;
|
||
|
}
|
||
|
|
||
|
function isOperation(document, operation) {
|
||
|
var _a;
|
||
|
return ((_a = getOperationDefinition(document)) === null || _a === void 0 ? void 0 : _a.operation) === operation;
|
||
|
}
|
||
|
function isMutationOperation(document) {
|
||
|
return isOperation(document, "mutation");
|
||
|
}
|
||
|
function isQueryOperation(document) {
|
||
|
return isOperation(document, "query");
|
||
|
}
|
||
|
function isSubscriptionOperation(document) {
|
||
|
return isOperation(document, "subscription");
|
||
|
}
|
||
|
|
||
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
|
function mergeDeep() {
|
||
|
var sources = [];
|
||
|
for (var _i = 0; _i < arguments.length; _i++) {
|
||
|
sources[_i] = arguments[_i];
|
||
|
}
|
||
|
return mergeDeepArray(sources);
|
||
|
}
|
||
|
function mergeDeepArray(sources) {
|
||
|
var target = sources[0] || {};
|
||
|
var count = sources.length;
|
||
|
if (count > 1) {
|
||
|
var merger = new DeepMerger();
|
||
|
for (var i = 1; i < count; ++i) {
|
||
|
target = merger.merge(target, sources[i]);
|
||
|
}
|
||
|
}
|
||
|
return target;
|
||
|
}
|
||
|
var defaultReconciler = function (target, source, property) {
|
||
|
return this.merge(target[property], source[property]);
|
||
|
};
|
||
|
var DeepMerger = (function () {
|
||
|
function DeepMerger(reconciler) {
|
||
|
if (reconciler === void 0) { reconciler = defaultReconciler; }
|
||
|
this.reconciler = reconciler;
|
||
|
this.isObject = isNonNullObject;
|
||
|
this.pastCopies = new Set();
|
||
|
}
|
||
|
DeepMerger.prototype.merge = function (target, source) {
|
||
|
var _this = this;
|
||
|
var context = [];
|
||
|
for (var _i = 2; _i < arguments.length; _i++) {
|
||
|
context[_i - 2] = arguments[_i];
|
||
|
}
|
||
|
if (isNonNullObject(source) && isNonNullObject(target)) {
|
||
|
Object.keys(source).forEach(function (sourceKey) {
|
||
|
if (hasOwnProperty.call(target, sourceKey)) {
|
||
|
var targetValue = target[sourceKey];
|
||
|
if (source[sourceKey] !== targetValue) {
|
||
|
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target,
|
||
|
source,
|
||
|
sourceKey], context, false));
|
||
|
if (result !== targetValue) {
|
||
|
target = _this.shallowCopyForMerge(target);
|
||
|
target[sourceKey] = result;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
target = _this.shallowCopyForMerge(target);
|
||
|
target[sourceKey] = source[sourceKey];
|
||
|
}
|
||
|
});
|
||
|
return target;
|
||
|
}
|
||
|
return source;
|
||
|
};
|
||
|
DeepMerger.prototype.shallowCopyForMerge = function (value) {
|
||
|
if (isNonNullObject(value)) {
|
||
|
if (!this.pastCopies.has(value)) {
|
||
|
if (Array.isArray(value)) {
|
||
|
value = value.slice(0);
|
||
|
}
|
||
|
else {
|
||
|
value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
||
|
}
|
||
|
this.pastCopies.add(value);
|
||
|
}
|
||
|
}
|
||
|
return value;
|
||
|
};
|
||
|
return DeepMerger;
|
||
|
}());
|
||
|
|
||
|
function concatPagination(keyArgs) {
|
||
|
if (keyArgs === void 0) { keyArgs = false; }
|
||
|
return {
|
||
|
keyArgs: keyArgs,
|
||
|
merge: function (existing, incoming) {
|
||
|
return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing, true), incoming, true) : incoming;
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
function offsetLimitPagination(keyArgs) {
|
||
|
if (keyArgs === void 0) { keyArgs = false; }
|
||
|
return {
|
||
|
keyArgs: keyArgs,
|
||
|
merge: function (existing, incoming, _a) {
|
||
|
var args = _a.args;
|
||
|
var merged = existing ? existing.slice(0) : [];
|
||
|
if (incoming) {
|
||
|
if (args) {
|
||
|
var _b = args.offset, offset = _b === void 0 ? 0 : _b;
|
||
|
for (var i = 0; i < incoming.length; ++i) {
|
||
|
merged[offset + i] = incoming[i];
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
merged.push.apply(merged, incoming);
|
||
|
}
|
||
|
}
|
||
|
return merged;
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
function relayStylePagination(keyArgs) {
|
||
|
if (keyArgs === void 0) { keyArgs = false; }
|
||
|
return {
|
||
|
keyArgs: keyArgs,
|
||
|
read: function (existing, _a) {
|
||
|
var canRead = _a.canRead, readField = _a.readField;
|
||
|
if (!existing)
|
||
|
return existing;
|
||
|
var edges = [];
|
||
|
var firstEdgeCursor = "";
|
||
|
var lastEdgeCursor = "";
|
||
|
existing.edges.forEach(function (edge) {
|
||
|
if (canRead(readField("node", edge))) {
|
||
|
edges.push(edge);
|
||
|
if (edge.cursor) {
|
||
|
firstEdgeCursor = firstEdgeCursor || edge.cursor || "";
|
||
|
lastEdgeCursor = edge.cursor || lastEdgeCursor;
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) {
|
||
|
firstEdgeCursor = "";
|
||
|
}
|
||
|
var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor;
|
||
|
return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), {
|
||
|
startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) });
|
||
|
},
|
||
|
merge: function (existing, incoming, _a) {
|
||
|
var args = _a.args, isReference = _a.isReference, readField = _a.readField;
|
||
|
if (!existing) {
|
||
|
existing = makeEmptyData();
|
||
|
}
|
||
|
if (!incoming) {
|
||
|
return existing;
|
||
|
}
|
||
|
var incomingEdges = incoming.edges ?
|
||
|
incoming.edges.map(function (edge) {
|
||
|
if (isReference((edge = tslib.__assign({}, edge)))) {
|
||
|
edge.cursor = readField("cursor", edge);
|
||
|
}
|
||
|
return edge;
|
||
|
})
|
||
|
: [];
|
||
|
if (incoming.pageInfo) {
|
||
|
var pageInfo_1 = incoming.pageInfo;
|
||
|
var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor;
|
||
|
var firstEdge = incomingEdges[0];
|
||
|
var lastEdge = incomingEdges[incomingEdges.length - 1];
|
||
|
if (firstEdge && startCursor) {
|
||
|
firstEdge.cursor = startCursor;
|
||
|
}
|
||
|
if (lastEdge && endCursor) {
|
||
|
lastEdge.cursor = endCursor;
|
||
|
}
|
||
|
var firstCursor = firstEdge && firstEdge.cursor;
|
||
|
if (firstCursor && !startCursor) {
|
||
|
incoming = mergeDeep(incoming, {
|
||
|
pageInfo: {
|
||
|
startCursor: firstCursor,
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
var lastCursor = lastEdge && lastEdge.cursor;
|
||
|
if (lastCursor && !endCursor) {
|
||
|
incoming = mergeDeep(incoming, {
|
||
|
pageInfo: {
|
||
|
endCursor: lastCursor,
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
var prefix = existing.edges;
|
||
|
var suffix = [];
|
||
|
if (args && args.after) {
|
||
|
var index = prefix.findIndex(function (edge) { return edge.cursor === args.after; });
|
||
|
if (index >= 0) {
|
||
|
prefix = prefix.slice(0, index + 1);
|
||
|
}
|
||
|
}
|
||
|
else if (args && args.before) {
|
||
|
var index = prefix.findIndex(function (edge) { return edge.cursor === args.before; });
|
||
|
suffix = index < 0 ? prefix : prefix.slice(index);
|
||
|
prefix = [];
|
||
|
}
|
||
|
else if (incoming.edges) {
|
||
|
prefix = [];
|
||
|
}
|
||
|
var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix, true), incomingEdges, true), suffix, true);
|
||
|
var pageInfo = tslib.__assign(tslib.__assign({}, incoming.pageInfo), existing.pageInfo);
|
||
|
if (incoming.pageInfo) {
|
||
|
var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = tslib.__rest(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]);
|
||
|
Object.assign(pageInfo, extras);
|
||
|
if (!prefix.length) {
|
||
|
if (void 0 !== hasPreviousPage)
|
||
|
pageInfo.hasPreviousPage = hasPreviousPage;
|
||
|
if (void 0 !== startCursor)
|
||
|
pageInfo.startCursor = startCursor;
|
||
|
}
|
||
|
if (!suffix.length) {
|
||
|
if (void 0 !== hasNextPage)
|
||
|
pageInfo.hasNextPage = hasNextPage;
|
||
|
if (void 0 !== endCursor)
|
||
|
pageInfo.endCursor = endCursor;
|
||
|
}
|
||
|
}
|
||
|
return tslib.__assign(tslib.__assign(tslib.__assign({}, getExtras(existing)), getExtras(incoming)), { edges: edges, pageInfo: pageInfo });
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
var getExtras = function (obj) { return tslib.__rest(obj, notExtras); };
|
||
|
var notExtras = ["edges", "pageInfo"];
|
||
|
function makeEmptyData() {
|
||
|
return {
|
||
|
edges: [],
|
||
|
pageInfo: {
|
||
|
hasPreviousPage: false,
|
||
|
hasNextPage: true,
|
||
|
startCursor: "",
|
||
|
endCursor: "",
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function createFulfilledPromise(value) {
|
||
|
var promise = Promise.resolve(value);
|
||
|
promise.status = "fulfilled";
|
||
|
promise.value = value;
|
||
|
return promise;
|
||
|
}
|
||
|
function createRejectedPromise(reason) {
|
||
|
var promise = Promise.reject(reason);
|
||
|
promise.catch(function () { });
|
||
|
promise.status = "rejected";
|
||
|
promise.reason = reason;
|
||
|
return promise;
|
||
|
}
|
||
|
function isStatefulPromise(promise) {
|
||
|
return "status" in promise;
|
||
|
}
|
||
|
function wrapPromiseWithState(promise) {
|
||
|
if (isStatefulPromise(promise)) {
|
||
|
return promise;
|
||
|
}
|
||
|
var pendingPromise = promise;
|
||
|
pendingPromise.status = "pending";
|
||
|
pendingPromise.then(function (value) {
|
||
|
if (pendingPromise.status === "pending") {
|
||
|
var fulfilledPromise = pendingPromise;
|
||
|
fulfilledPromise.status = "fulfilled";
|
||
|
fulfilledPromise.value = value;
|
||
|
}
|
||
|
}, function (reason) {
|
||
|
if (pendingPromise.status === "pending") {
|
||
|
var rejectedPromise = pendingPromise;
|
||
|
rejectedPromise.status = "rejected";
|
||
|
rejectedPromise.reason = reason;
|
||
|
}
|
||
|
});
|
||
|
return promise;
|
||
|
}
|
||
|
|
||
|
var toString = Object.prototype.toString;
|
||
|
function cloneDeep(value) {
|
||
|
return cloneDeepHelper(value);
|
||
|
}
|
||
|
function cloneDeepHelper(val, seen) {
|
||
|
switch (toString.call(val)) {
|
||
|
case "[object Array]": {
|
||
|
seen = seen || new Map();
|
||
|
if (seen.has(val))
|
||
|
return seen.get(val);
|
||
|
var copy_1 = val.slice(0);
|
||
|
seen.set(val, copy_1);
|
||
|
copy_1.forEach(function (child, i) {
|
||
|
copy_1[i] = cloneDeepHelper(child, seen);
|
||
|
});
|
||
|
return copy_1;
|
||
|
}
|
||
|
case "[object Object]": {
|
||
|
seen = seen || new Map();
|
||
|
if (seen.has(val))
|
||
|
return seen.get(val);
|
||
|
var copy_2 = Object.create(Object.getPrototypeOf(val));
|
||
|
seen.set(val, copy_2);
|
||
|
Object.keys(val).forEach(function (key) {
|
||
|
copy_2[key] = cloneDeepHelper(val[key], seen);
|
||
|
});
|
||
|
return copy_2;
|
||
|
}
|
||
|
default:
|
||
|
return val;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function deepFreeze(value) {
|
||
|
var workSet = new Set([value]);
|
||
|
workSet.forEach(function (obj) {
|
||
|
if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {
|
||
|
Object.getOwnPropertyNames(obj).forEach(function (name) {
|
||
|
if (isNonNullObject(obj[name]))
|
||
|
workSet.add(obj[name]);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
return value;
|
||
|
}
|
||
|
function shallowFreeze(obj) {
|
||
|
if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) {
|
||
|
try {
|
||
|
Object.freeze(obj);
|
||
|
}
|
||
|
catch (e) {
|
||
|
if (e instanceof TypeError)
|
||
|
return null;
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
return obj;
|
||
|
}
|
||
|
function maybeDeepFreeze(obj) {
|
||
|
if (globalThis.__DEV__ !== false) {
|
||
|
deepFreeze(obj);
|
||
|
}
|
||
|
return obj;
|
||
|
}
|
||
|
|
||
|
function iterateObserversSafely(observers, method, argument) {
|
||
|
var observersWithMethod = [];
|
||
|
observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); });
|
||
|
observersWithMethod.forEach(function (obs) { return obs[method](argument); });
|
||
|
}
|
||
|
|
||
|
function asyncMap(observable, mapFn, catchFn) {
|
||
|
return new zenObservableTs.Observable(function (observer) {
|
||
|
var promiseQueue = {
|
||
|
then: function (callback) {
|
||
|
return new Promise(function (resolve) { return resolve(callback()); });
|
||
|
},
|
||
|
};
|
||
|
function makeCallback(examiner, key) {
|
||
|
return function (arg) {
|
||
|
if (examiner) {
|
||
|
var both = function () {
|
||
|
return observer.closed ?
|
||
|
0
|
||
|
: examiner(arg);
|
||
|
};
|
||
|
promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });
|
||
|
}
|
||
|
else {
|
||
|
observer[key](arg);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
var handler = {
|
||
|
next: makeCallback(mapFn, "next"),
|
||
|
error: makeCallback(catchFn, "error"),
|
||
|
complete: function () {
|
||
|
promiseQueue.then(function () { return observer.complete(); });
|
||
|
},
|
||
|
};
|
||
|
var sub = observable.subscribe(handler);
|
||
|
return function () { return sub.unsubscribe(); };
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function fixObservableSubclass(subclass) {
|
||
|
function set(key) {
|
||
|
Object.defineProperty(subclass, key, { value: zenObservableTs.Observable });
|
||
|
}
|
||
|
if (canUseSymbol && Symbol.species) {
|
||
|
set(Symbol.species);
|
||
|
}
|
||
|
set("@@species");
|
||
|
return subclass;
|
||
|
}
|
||
|
|
||
|
function isPromiseLike(value) {
|
||
|
return value && typeof value.then === "function";
|
||
|
}
|
||
|
var Concast = (function (_super) {
|
||
|
tslib.__extends(Concast, _super);
|
||
|
function Concast(sources) {
|
||
|
var _this = _super.call(this, function (observer) {
|
||
|
_this.addObserver(observer);
|
||
|
return function () { return _this.removeObserver(observer); };
|
||
|
}) || this;
|
||
|
_this.observers = new Set();
|
||
|
_this.promise = new Promise(function (resolve, reject) {
|
||
|
_this.resolve = resolve;
|
||
|
_this.reject = reject;
|
||
|
});
|
||
|
_this.handlers = {
|
||
|
next: function (result) {
|
||
|
if (_this.sub !== null) {
|
||
|
_this.latest = ["next", result];
|
||
|
_this.notify("next", result);
|
||
|
iterateObserversSafely(_this.observers, "next", result);
|
||
|
}
|
||
|
},
|
||
|
error: function (error) {
|
||
|
var sub = _this.sub;
|
||
|
if (sub !== null) {
|
||
|
if (sub)
|
||
|
setTimeout(function () { return sub.unsubscribe(); });
|
||
|
_this.sub = null;
|
||
|
_this.latest = ["error", error];
|
||
|
_this.reject(error);
|
||
|
_this.notify("error", error);
|
||
|
iterateObserversSafely(_this.observers, "error", error);
|
||
|
}
|
||
|
},
|
||
|
complete: function () {
|
||
|
var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b;
|
||
|
if (sub !== null) {
|
||
|
var value = sources.shift();
|
||
|
if (!value) {
|
||
|
if (sub)
|
||
|
setTimeout(function () { return sub.unsubscribe(); });
|
||
|
_this.sub = null;
|
||
|
if (_this.latest && _this.latest[0] === "next") {
|
||
|
_this.resolve(_this.latest[1]);
|
||
|
}
|
||
|
else {
|
||
|
_this.resolve();
|
||
|
}
|
||
|
_this.notify("complete");
|
||
|
iterateObserversSafely(_this.observers, "complete");
|
||
|
}
|
||
|
else if (isPromiseLike(value)) {
|
||
|
value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error);
|
||
|
}
|
||
|
else {
|
||
|
_this.sub = value.subscribe(_this.handlers);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
};
|
||
|
_this.nextResultListeners = new Set();
|
||
|
_this.cancel = function (reason) {
|
||
|
_this.reject(reason);
|
||
|
_this.sources = [];
|
||
|
_this.handlers.complete();
|
||
|
};
|
||
|
_this.promise.catch(function (_) { });
|
||
|
if (typeof sources === "function") {
|
||
|
sources = [new zenObservableTs.Observable(sources)];
|
||
|
}
|
||
|
if (isPromiseLike(sources)) {
|
||
|
sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error);
|
||
|
}
|
||
|
else {
|
||
|
_this.start(sources);
|
||
|
}
|
||
|
return _this;
|
||
|
}
|
||
|
Concast.prototype.start = function (sources) {
|
||
|
if (this.sub !== void 0)
|
||
|
return;
|
||
|
this.sources = Array.from(sources);
|
||
|
this.handlers.complete();
|
||
|
};
|
||
|
Concast.prototype.deliverLastMessage = function (observer) {
|
||
|
if (this.latest) {
|
||
|
var nextOrError = this.latest[0];
|
||
|
var method = observer[nextOrError];
|
||
|
if (method) {
|
||
|
method.call(observer, this.latest[1]);
|
||
|
}
|
||
|
if (this.sub === null && nextOrError === "next" && observer.complete) {
|
||
|
observer.complete();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
Concast.prototype.addObserver = function (observer) {
|
||
|
if (!this.observers.has(observer)) {
|
||
|
this.deliverLastMessage(observer);
|
||
|
this.observers.add(observer);
|
||
|
}
|
||
|
};
|
||
|
Concast.prototype.removeObserver = function (observer) {
|
||
|
if (this.observers.delete(observer) && this.observers.size < 1) {
|
||
|
this.handlers.complete();
|
||
|
}
|
||
|
};
|
||
|
Concast.prototype.notify = function (method, arg) {
|
||
|
var nextResultListeners = this.nextResultListeners;
|
||
|
if (nextResultListeners.size) {
|
||
|
this.nextResultListeners = new Set();
|
||
|
nextResultListeners.forEach(function (listener) { return listener(method, arg); });
|
||
|
}
|
||
|
};
|
||
|
Concast.prototype.beforeNext = function (callback) {
|
||
|
var called = false;
|
||
|
this.nextResultListeners.add(function (method, arg) {
|
||
|
if (!called) {
|
||
|
called = true;
|
||
|
callback(method, arg);
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
return Concast;
|
||
|
}(zenObservableTs.Observable));
|
||
|
fixObservableSubclass(Concast);
|
||
|
|
||
|
function isExecutionPatchIncrementalResult(value) {
|
||
|
return "incremental" in value;
|
||
|
}
|
||
|
function isExecutionPatchInitialResult(value) {
|
||
|
return "hasNext" in value && "data" in value;
|
||
|
}
|
||
|
function isExecutionPatchResult(value) {
|
||
|
return (isExecutionPatchIncrementalResult(value) ||
|
||
|
isExecutionPatchInitialResult(value));
|
||
|
}
|
||
|
function isApolloPayloadResult(value) {
|
||
|
return isNonNullObject(value) && "payload" in value;
|
||
|
}
|
||
|
function mergeIncrementalData(prevResult, result) {
|
||
|
var mergedData = prevResult;
|
||
|
var merger = new DeepMerger();
|
||
|
if (isExecutionPatchIncrementalResult(result) &&
|
||
|
isNonEmptyArray(result.incremental)) {
|
||
|
result.incremental.forEach(function (_a) {
|
||
|
var data = _a.data, path = _a.path;
|
||
|
for (var i = path.length - 1; i >= 0; --i) {
|
||
|
var key = path[i];
|
||
|
var isNumericKey = !isNaN(+key);
|
||
|
var parent_1 = isNumericKey ? [] : {};
|
||
|
parent_1[key] = data;
|
||
|
data = parent_1;
|
||
|
}
|
||
|
mergedData = merger.merge(mergedData, data);
|
||
|
});
|
||
|
}
|
||
|
return mergedData;
|
||
|
}
|
||
|
|
||
|
function graphQLResultHasError(result) {
|
||
|
var errors = getGraphQLErrorsFromResult(result);
|
||
|
return isNonEmptyArray(errors);
|
||
|
}
|
||
|
function getGraphQLErrorsFromResult(result) {
|
||
|
var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
||
|
if (isExecutionPatchIncrementalResult(result) &&
|
||
|
isNonEmptyArray(result.incremental)) {
|
||
|
result.incremental.forEach(function (incrementalResult) {
|
||
|
if (incrementalResult.errors) {
|
||
|
graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return graphQLErrors;
|
||
|
}
|
||
|
|
||
|
function compact() {
|
||
|
var objects = [];
|
||
|
for (var _i = 0; _i < arguments.length; _i++) {
|
||
|
objects[_i] = arguments[_i];
|
||
|
}
|
||
|
var result = Object.create(null);
|
||
|
objects.forEach(function (obj) {
|
||
|
if (!obj)
|
||
|
return;
|
||
|
Object.keys(obj).forEach(function (key) {
|
||
|
var value = obj[key];
|
||
|
if (value !== void 0) {
|
||
|
result[key] = value;
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
var prefixCounts = new Map();
|
||
|
function makeUniqueId(prefix) {
|
||
|
var count = prefixCounts.get(prefix) || 1;
|
||
|
prefixCounts.set(prefix, count + 1);
|
||
|
return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
|
||
|
}
|
||
|
|
||
|
function stringifyForDisplay(value, space) {
|
||
|
if (space === void 0) { space = 0; }
|
||
|
var undefId = makeUniqueId("stringifyForDisplay");
|
||
|
return JSON.stringify(value, function (key, value) {
|
||
|
return value === void 0 ? undefId : value;
|
||
|
}, space)
|
||
|
.split(JSON.stringify(undefId))
|
||
|
.join("<undefined>");
|
||
|
}
|
||
|
|
||
|
function mergeOptions(defaults, options) {
|
||
|
return compact(defaults, options, options.variables && {
|
||
|
variables: compact(tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables)),
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function omitDeep(value, key) {
|
||
|
return __omitDeep(value, key);
|
||
|
}
|
||
|
function __omitDeep(value, key, known) {
|
||
|
if (known === void 0) { known = new Map(); }
|
||
|
if (known.has(value)) {
|
||
|
return known.get(value);
|
||
|
}
|
||
|
var modified = false;
|
||
|
if (Array.isArray(value)) {
|
||
|
var array_1 = [];
|
||
|
known.set(value, array_1);
|
||
|
value.forEach(function (value, index) {
|
||
|
var result = __omitDeep(value, key, known);
|
||
|
modified || (modified = result !== value);
|
||
|
array_1[index] = result;
|
||
|
});
|
||
|
if (modified) {
|
||
|
return array_1;
|
||
|
}
|
||
|
}
|
||
|
else if (isPlainObject(value)) {
|
||
|
var obj_1 = Object.create(Object.getPrototypeOf(value));
|
||
|
known.set(value, obj_1);
|
||
|
Object.keys(value).forEach(function (k) {
|
||
|
if (k === key) {
|
||
|
modified = true;
|
||
|
return;
|
||
|
}
|
||
|
var result = __omitDeep(value[k], key, known);
|
||
|
modified || (modified = result !== value[k]);
|
||
|
obj_1[k] = result;
|
||
|
});
|
||
|
if (modified) {
|
||
|
return obj_1;
|
||
|
}
|
||
|
}
|
||
|
return value;
|
||
|
}
|
||
|
|
||
|
function stripTypename(value) {
|
||
|
return omitDeep(value, "__typename");
|
||
|
}
|
||
|
|
||
|
exports.DEV = globals.DEV;
|
||
|
exports.maybe = globals.maybe;
|
||
|
exports.Observable = zenObservableTs.Observable;
|
||
|
exports.AutoCleanedStrongCache = AutoCleanedStrongCache;
|
||
|
exports.AutoCleanedWeakCache = AutoCleanedWeakCache;
|
||
|
exports.Concast = Concast;
|
||
|
exports.DeepMerger = DeepMerger;
|
||
|
exports.DocumentTransform = DocumentTransform;
|
||
|
exports.addTypenameToDocument = addTypenameToDocument;
|
||
|
exports.argumentsObjectFromField = argumentsObjectFromField;
|
||
|
exports.asyncMap = asyncMap;
|
||
|
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
|
||
|
exports.cacheSizes = cacheSizes;
|
||
|
exports.canUseAsyncIteratorSymbol = canUseAsyncIteratorSymbol;
|
||
|
exports.canUseDOM = canUseDOM;
|
||
|
exports.canUseLayoutEffect = canUseLayoutEffect;
|
||
|
exports.canUseSymbol = canUseSymbol;
|
||
|
exports.canUseWeakMap = canUseWeakMap;
|
||
|
exports.canUseWeakSet = canUseWeakSet;
|
||
|
exports.canonicalStringify = canonicalStringify;
|
||
|
exports.checkDocument = checkDocument;
|
||
|
exports.cloneDeep = cloneDeep;
|
||
|
exports.compact = compact;
|
||
|
exports.concatPagination = concatPagination;
|
||
|
exports.createFragmentMap = createFragmentMap;
|
||
|
exports.createFulfilledPromise = createFulfilledPromise;
|
||
|
exports.createRejectedPromise = createRejectedPromise;
|
||
|
exports.fixObservableSubclass = fixObservableSubclass;
|
||
|
exports.getDefaultValues = getDefaultValues;
|
||
|
exports.getDirectiveNames = getDirectiveNames;
|
||
|
exports.getFragmentDefinition = getFragmentDefinition;
|
||
|
exports.getFragmentDefinitions = getFragmentDefinitions;
|
||
|
exports.getFragmentFromSelection = getFragmentFromSelection;
|
||
|
exports.getFragmentQueryDocument = getFragmentQueryDocument;
|
||
|
exports.getGraphQLErrorsFromResult = getGraphQLErrorsFromResult;
|
||
|
exports.getInclusionDirectives = getInclusionDirectives;
|
||
|
exports.getMainDefinition = getMainDefinition;
|
||
|
exports.getOperationDefinition = getOperationDefinition;
|
||
|
exports.getOperationName = getOperationName;
|
||
|
exports.getQueryDefinition = getQueryDefinition;
|
||
|
exports.getStoreKeyName = getStoreKeyName;
|
||
|
exports.getTypenameFromResult = getTypenameFromResult;
|
||
|
exports.graphQLResultHasError = graphQLResultHasError;
|
||
|
exports.hasAllDirectives = hasAllDirectives;
|
||
|
exports.hasAnyDirectives = hasAnyDirectives;
|
||
|
exports.hasClientExports = hasClientExports;
|
||
|
exports.hasDirectives = hasDirectives;
|
||
|
exports.isApolloPayloadResult = isApolloPayloadResult;
|
||
|
exports.isArray = isArray;
|
||
|
exports.isDocumentNode = isDocumentNode;
|
||
|
exports.isExecutionPatchIncrementalResult = isExecutionPatchIncrementalResult;
|
||
|
exports.isExecutionPatchInitialResult = isExecutionPatchInitialResult;
|
||
|
exports.isExecutionPatchResult = isExecutionPatchResult;
|
||
|
exports.isField = isField;
|
||
|
exports.isInlineFragment = isInlineFragment;
|
||
|
exports.isMutationOperation = isMutationOperation;
|
||
|
exports.isNonEmptyArray = isNonEmptyArray;
|
||
|
exports.isNonNullObject = isNonNullObject;
|
||
|
exports.isPlainObject = isPlainObject;
|
||
|
exports.isQueryOperation = isQueryOperation;
|
||
|
exports.isReference = isReference;
|
||
|
exports.isStatefulPromise = isStatefulPromise;
|
||
|
exports.isSubscriptionOperation = isSubscriptionOperation;
|
||
|
exports.iterateObserversSafely = iterateObserversSafely;
|
||
|
exports.makeReference = makeReference;
|
||
|
exports.makeUniqueId = makeUniqueId;
|
||
|
exports.maybeDeepFreeze = maybeDeepFreeze;
|
||
|
exports.mergeDeep = mergeDeep;
|
||
|
exports.mergeDeepArray = mergeDeepArray;
|
||
|
exports.mergeIncrementalData = mergeIncrementalData;
|
||
|
exports.mergeOptions = mergeOptions;
|
||
|
exports.offsetLimitPagination = offsetLimitPagination;
|
||
|
exports.omitDeep = omitDeep;
|
||
|
exports.print = print;
|
||
|
exports.relayStylePagination = relayStylePagination;
|
||
|
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.stringifyForDisplay = stringifyForDisplay;
|
||
|
exports.stripTypename = stripTypename;
|
||
|
exports.valueToObjectRepresentation = valueToObjectRepresentation;
|
||
|
exports.wrapPromiseWithState = wrapPromiseWithState;
|
||
|
//# sourceMappingURL=utilities.cjs.map
|