Initial Save
This commit is contained in:
8
node_modules/apollo-utilities/.flowconfig
generated
vendored
Normal file
8
node_modules/apollo-utilities/.flowconfig
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
[ignore]
|
||||
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
|
||||
[options]
|
||||
suppress_comment= \\(.\\|\n\\)*\\$ExpectError
|
||||
106
node_modules/apollo-utilities/CHANGELOG.md
generated
vendored
Normal file
106
node_modules/apollo-utilities/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
# CHANGELOG
|
||||
|
||||
----
|
||||
|
||||
**NOTE:** This changelog is no longer maintained. Changes are now tracked in
|
||||
the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md).
|
||||
|
||||
----
|
||||
|
||||
### 1.0.16
|
||||
|
||||
- Removed unnecessary whitespace from error message
|
||||
[Issue #3398](https://github.com/apollographql/apollo-client/issues/3398)
|
||||
[PR #3593](https://github.com/apollographql/apollo-client/pull/3593)
|
||||
|
||||
### 1.0.15
|
||||
|
||||
- No changes
|
||||
|
||||
### 1.0.14
|
||||
|
||||
- Store key names generated by `getStoreKeyName` now leverage a more
|
||||
deterministic approach to handling JSON based strings. This prevents store
|
||||
key names from differing when using `args` like
|
||||
`{ prop1: 'value1', prop2: 'value2' }` and
|
||||
`{ prop2: 'value2', prop1: 'value1' }`.
|
||||
[PR #2869](https://github.com/apollographql/apollo-client/pull/2869)
|
||||
- Avoid needless `hasOwnProperty` check in `deepFreeze`.
|
||||
[PR #3545](https://github.com/apollographql/apollo-client/pull/3545)
|
||||
|
||||
### 1.0.13
|
||||
|
||||
- Make `maybeDeepFreeze` a little more defensive, by always using
|
||||
`Object.prototype.hasOwnProperty` (to avoid cases where the object being
|
||||
frozen doesn't have its own `hasOwnProperty`).
|
||||
[Issue #3426](https://github.com/apollographql/apollo-client/issues/3426)
|
||||
[PR #3418](https://github.com/apollographql/apollo-client/pull/3418)
|
||||
- Remove certain small internal caches to prevent memory leaks when using SSR.
|
||||
[PR #3444](https://github.com/apollographql/apollo-client/pull/3444)
|
||||
|
||||
### 1.0.12
|
||||
|
||||
- Not documented
|
||||
|
||||
### 1.0.11
|
||||
|
||||
- `toIdValue` helper now takes an object with `id` and `typename` properties
|
||||
as the preferred interface
|
||||
[PR #3159](https://github.com/apollographql/apollo-client/pull/3159)
|
||||
- Map coverage to original source
|
||||
- Don't `deepFreeze` in development/test environments if ES6 symbols are
|
||||
polyfilled
|
||||
[PR #3082](https://github.com/apollographql/apollo-client/pull/3082)
|
||||
- Added ability to include or ignore fragments in `getDirectivesFromDocument`
|
||||
[PR #3010](https://github.com/apollographql/apollo-client/pull/3010)
|
||||
|
||||
### 1.0.9
|
||||
|
||||
- Dependency updates
|
||||
- Added getDirectivesFromDocument utility function
|
||||
[PR #2974](https://github.com/apollographql/apollo-client/pull/2974)
|
||||
|
||||
### 1.0.8
|
||||
|
||||
- Add client, rest, and export directives to list of known directives
|
||||
[PR #2949](https://github.com/apollographql/apollo-client/pull/2949)
|
||||
|
||||
### 1.0.7
|
||||
|
||||
- Fix typo in error message for invalid argument being passed to @skip or
|
||||
@include directives
|
||||
[PR #2867](https://github.com/apollographql/apollo-client/pull/2867)
|
||||
|
||||
### 1.0.6
|
||||
|
||||
- Update `getStoreKeyName` to support custom directives
|
||||
|
||||
### 1.0.5
|
||||
|
||||
- Package dependency updates
|
||||
|
||||
### 1.0.4
|
||||
|
||||
- Package dependency updates
|
||||
|
||||
### 1.0.3
|
||||
|
||||
- Package dependency updates
|
||||
|
||||
### 1.0.2
|
||||
|
||||
- Improved rollup builds
|
||||
|
||||
### 1.0.1
|
||||
|
||||
- Added config to remove selection set of directive matches test
|
||||
|
||||
### 1.0.0
|
||||
|
||||
- Added utilities from hermes cache
|
||||
- Added removeDirectivesFromDocument to allow cleaning of client only
|
||||
directives
|
||||
- Added hasDirectives to recurse the AST and return a boolean for an array of
|
||||
directive names
|
||||
- Improved performance of common store actions by memoizing addTypename and
|
||||
removeConnectionDirective
|
||||
22
node_modules/apollo-utilities/LICENSE
generated
vendored
Normal file
22
node_modules/apollo-utilities/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Meteor Development Group, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
3
node_modules/apollo-utilities/jest.config.js
generated
vendored
Normal file
3
node_modules/apollo-utilities/jest.config.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
...require('../../config/jest.config.settings'),
|
||||
};
|
||||
1125
node_modules/apollo-utilities/lib/bundle.cjs.js
generated
vendored
Normal file
1125
node_modules/apollo-utilities/lib/bundle.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/apollo-utilities/lib/bundle.cjs.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/bundle.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/apollo-utilities/lib/bundle.cjs.min.js
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/bundle.cjs.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
915
node_modules/apollo-utilities/lib/bundle.esm.js
generated
vendored
Normal file
915
node_modules/apollo-utilities/lib/bundle.esm.js
generated
vendored
Normal file
@@ -0,0 +1,915 @@
|
||||
import { visit } from 'graphql/language/visitor';
|
||||
import { InvariantError, invariant } from 'ts-invariant';
|
||||
import { __assign, __spreadArrays } from 'tslib';
|
||||
import stringify from 'fast-json-stable-stringify';
|
||||
export { equal as isEqual } from '@wry/equality';
|
||||
|
||||
function isScalarValue(value) {
|
||||
return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;
|
||||
}
|
||||
function isNumberValue(value) {
|
||||
return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;
|
||||
}
|
||||
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 process.env.NODE_ENV === "production" ? new InvariantError(17) : new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
|
||||
'is not supported. Use variables instead of inline arguments to ' +
|
||||
'overcome this limitation.');
|
||||
}
|
||||
}
|
||||
function storeKeyNameFromField(field, variables) {
|
||||
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',
|
||||
];
|
||||
function getStoreKeyName(fieldName, args, directives) {
|
||||
if (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 queryArgs_1 = args;
|
||||
var filteredArgs_1 = {};
|
||||
filterKeys.forEach(function (key) {
|
||||
filteredArgs_1[key] = queryArgs_1[key];
|
||||
});
|
||||
return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")";
|
||||
}
|
||||
else {
|
||||
return directives['connection']['key'];
|
||||
}
|
||||
}
|
||||
var completeFieldName = fieldName;
|
||||
if (args) {
|
||||
var stringifiedArgs = stringify(args);
|
||||
completeFieldName += "(" + 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 += "@" + key + "(" + JSON.stringify(directives[key]) + ")";
|
||||
}
|
||||
else {
|
||||
completeFieldName += "@" + key;
|
||||
}
|
||||
});
|
||||
}
|
||||
return completeFieldName;
|
||||
}
|
||||
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 isField(selection) {
|
||||
return selection.kind === 'Field';
|
||||
}
|
||||
function isInlineFragment(selection) {
|
||||
return selection.kind === 'InlineFragment';
|
||||
}
|
||||
function isIdValue(idObject) {
|
||||
return idObject &&
|
||||
idObject.type === 'id' &&
|
||||
typeof idObject.generated === 'boolean';
|
||||
}
|
||||
function toIdValue(idConfig, generated) {
|
||||
if (generated === void 0) { generated = false; }
|
||||
return __assign({ type: 'id', generated: generated }, (typeof idConfig === 'string'
|
||||
? { id: idConfig, typename: undefined }
|
||||
: idConfig));
|
||||
}
|
||||
function isJsonValue(jsonObject) {
|
||||
return (jsonObject != null &&
|
||||
typeof jsonObject === 'object' &&
|
||||
jsonObject.type === 'json');
|
||||
}
|
||||
function defaultValueFromVariable(node) {
|
||||
throw process.env.NODE_ENV === "production" ? new InvariantError(18) : new InvariantError("Variable nodes are not supported by valueFromNode");
|
||||
}
|
||||
function valueFromNode(node, onVariable) {
|
||||
if (onVariable === void 0) { onVariable = defaultValueFromVariable; }
|
||||
switch (node.kind) {
|
||||
case 'Variable':
|
||||
return onVariable(node);
|
||||
case 'NullValue':
|
||||
return null;
|
||||
case 'IntValue':
|
||||
return parseInt(node.value, 10);
|
||||
case 'FloatValue':
|
||||
return parseFloat(node.value);
|
||||
case 'ListValue':
|
||||
return node.values.map(function (v) { return valueFromNode(v, onVariable); });
|
||||
case 'ObjectValue': {
|
||||
var value = {};
|
||||
for (var _i = 0, _a = node.fields; _i < _a.length; _i++) {
|
||||
var field = _a[_i];
|
||||
value[field.name.value] = valueFromNode(field.value, onVariable);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
default:
|
||||
return node.value;
|
||||
}
|
||||
}
|
||||
|
||||
function getDirectiveInfoFromField(field, variables) {
|
||||
if (field.directives && field.directives.length) {
|
||||
var directiveObj_1 = {};
|
||||
field.directives.forEach(function (directive) {
|
||||
directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables);
|
||||
});
|
||||
return directiveObj_1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function shouldInclude(selection, variables) {
|
||||
if (variables === void 0) { variables = {}; }
|
||||
return getInclusionDirectives(selection.directives).every(function (_a) {
|
||||
var directive = _a.directive, ifArgument = _a.ifArgument;
|
||||
var evaledValue = false;
|
||||
if (ifArgument.value.kind === 'Variable') {
|
||||
evaledValue = variables[ifArgument.value.name.value];
|
||||
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 13) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.");
|
||||
}
|
||||
else {
|
||||
evaledValue = ifArgument.value.value;
|
||||
}
|
||||
return directive.name.value === 'skip' ? !evaledValue : evaledValue;
|
||||
});
|
||||
}
|
||||
function getDirectiveNames(doc) {
|
||||
var names = [];
|
||||
visit(doc, {
|
||||
Directive: function (node) {
|
||||
names.push(node.name.value);
|
||||
},
|
||||
});
|
||||
return names;
|
||||
}
|
||||
function hasDirectives(names, doc) {
|
||||
return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; });
|
||||
}
|
||||
function hasClientExports(document) {
|
||||
return (document &&
|
||||
hasDirectives(['client'], document) &&
|
||||
hasDirectives(['export'], document));
|
||||
}
|
||||
function isInclusionDirective(_a) {
|
||||
var value = _a.name.value;
|
||||
return value === 'skip' || value === 'include';
|
||||
}
|
||||
function getInclusionDirectives(directives) {
|
||||
return directives ? directives.filter(isInclusionDirective).map(function (directive) {
|
||||
var directiveArguments = directive.arguments;
|
||||
var directiveName = directive.name.value;
|
||||
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 14) : 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', 15) : 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'), 16) : invariant(ifValue &&
|
||||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.");
|
||||
return { directive: directive, ifArgument: ifArgument };
|
||||
}) : [];
|
||||
}
|
||||
|
||||
function getFragmentQueryDocument(document, fragmentName) {
|
||||
var actualFragmentName = fragmentName;
|
||||
var fragments = [];
|
||||
document.definitions.forEach(function (definition) {
|
||||
if (definition.kind === 'OperationDefinition') {
|
||||
throw process.env.NODE_ENV === "production" ? new InvariantError(11) : 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.');
|
||||
}
|
||||
if (definition.kind === 'FragmentDefinition') {
|
||||
fragments.push(definition);
|
||||
}
|
||||
});
|
||||
if (typeof actualFragmentName === 'undefined') {
|
||||
process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 12) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.");
|
||||
actualFragmentName = fragments[0].name.value;
|
||||
}
|
||||
var query = __assign(__assign({}, document), { definitions: __spreadArrays([
|
||||
{
|
||||
kind: 'OperationDefinition',
|
||||
operation: 'query',
|
||||
selectionSet: {
|
||||
kind: 'SelectionSet',
|
||||
selections: [
|
||||
{
|
||||
kind: 'FragmentSpread',
|
||||
name: {
|
||||
kind: 'Name',
|
||||
value: actualFragmentName,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
], document.definitions) });
|
||||
return query;
|
||||
}
|
||||
|
||||
function assign(target) {
|
||||
var sources = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
sources[_i - 1] = arguments[_i];
|
||||
}
|
||||
sources.forEach(function (source) {
|
||||
if (typeof source === 'undefined' || source === null) {
|
||||
return;
|
||||
}
|
||||
Object.keys(source).forEach(function (key) {
|
||||
target[key] = source[key];
|
||||
});
|
||||
});
|
||||
return target;
|
||||
}
|
||||
|
||||
function getMutationDefinition(doc) {
|
||||
checkDocument(doc);
|
||||
var mutationDef = doc.definitions.filter(function (definition) {
|
||||
return definition.kind === 'OperationDefinition' &&
|
||||
definition.operation === 'mutation';
|
||||
})[0];
|
||||
process.env.NODE_ENV === "production" ? invariant(mutationDef, 1) : invariant(mutationDef, 'Must contain a mutation definition.');
|
||||
return mutationDef;
|
||||
}
|
||||
function checkDocument(doc) {
|
||||
process.env.NODE_ENV === "production" ? invariant(doc && doc.kind === 'Document', 2) : invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql");
|
||||
var operations = doc.definitions
|
||||
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
||||
.map(function (definition) {
|
||||
if (definition.kind !== 'OperationDefinition') {
|
||||
throw process.env.NODE_ENV === "production" ? new InvariantError(3) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"");
|
||||
}
|
||||
return definition;
|
||||
});
|
||||
process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 4) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations");
|
||||
return doc;
|
||||
}
|
||||
function getOperationDefinition(doc) {
|
||||
checkDocument(doc);
|
||||
return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0];
|
||||
}
|
||||
function getOperationDefinitionOrDie(document) {
|
||||
var def = getOperationDefinition(document);
|
||||
process.env.NODE_ENV === "production" ? invariant(def, 5) : invariant(def, "GraphQL document is missing an operation");
|
||||
return def;
|
||||
}
|
||||
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);
|
||||
process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 6) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.');
|
||||
return queryDef;
|
||||
}
|
||||
function getFragmentDefinition(doc) {
|
||||
process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 7) : invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql");
|
||||
process.env.NODE_ENV === "production" ? invariant(doc.definitions.length <= 1, 8) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.');
|
||||
var fragmentDef = doc.definitions[0];
|
||||
process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 9) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.');
|
||||
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 process.env.NODE_ENV === "production" ? new InvariantError(10) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.');
|
||||
}
|
||||
function createFragmentMap(fragments) {
|
||||
if (fragments === void 0) { fragments = []; }
|
||||
var symTable = {};
|
||||
fragments.forEach(function (fragment) {
|
||||
symTable[fragment.name.value] = fragment;
|
||||
});
|
||||
return symTable;
|
||||
}
|
||||
function getDefaultValues(definition) {
|
||||
if (definition &&
|
||||
definition.variableDefinitions &&
|
||||
definition.variableDefinitions.length) {
|
||||
var defaultValues = definition.variableDefinitions
|
||||
.filter(function (_a) {
|
||||
var defaultValue = _a.defaultValue;
|
||||
return defaultValue;
|
||||
})
|
||||
.map(function (_a) {
|
||||
var variable = _a.variable, defaultValue = _a.defaultValue;
|
||||
var defaultValueObj = {};
|
||||
valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue);
|
||||
return defaultValueObj;
|
||||
});
|
||||
return assign.apply(void 0, __spreadArrays([{}], defaultValues));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
function variablesInOperation(operation) {
|
||||
var names = new Set();
|
||||
if (operation.variableDefinitions) {
|
||||
for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) {
|
||||
var definition = _a[_i];
|
||||
names.add(definition.variable.name.value);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
function filterInPlace(array, test, context) {
|
||||
var target = 0;
|
||||
array.forEach(function (elem, i) {
|
||||
if (test.call(this, elem, i, array)) {
|
||||
array[target++] = elem;
|
||||
}
|
||||
}, context);
|
||||
array.length = target;
|
||||
return array;
|
||||
}
|
||||
|
||||
var TYPENAME_FIELD = {
|
||||
kind: 'Field',
|
||||
name: {
|
||||
kind: 'Name',
|
||||
value: '__typename',
|
||||
},
|
||||
};
|
||||
function isEmpty(op, fragments) {
|
||||
return op.selectionSet.selections.every(function (selection) {
|
||||
return selection.kind === 'FragmentSpread' &&
|
||||
isEmpty(fragments[selection.name.value], fragments);
|
||||
});
|
||||
}
|
||||
function nullIfDocIsEmpty(doc) {
|
||||
return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))
|
||||
? null
|
||||
: doc;
|
||||
}
|
||||
function getDirectiveMatcher(directives) {
|
||||
return function directiveMatcher(directive) {
|
||||
return directives.some(function (dir) {
|
||||
return (dir.name && dir.name === directive.name.value) ||
|
||||
(dir.test && dir.test(directive));
|
||||
});
|
||||
};
|
||||
}
|
||||
function removeDirectivesFromDocument(directives, doc) {
|
||||
var variablesInUse = Object.create(null);
|
||||
var variablesToRemove = [];
|
||||
var fragmentSpreadsInUse = Object.create(null);
|
||||
var fragmentSpreadsToRemove = [];
|
||||
var modifiedDoc = nullIfDocIsEmpty(visit(doc, {
|
||||
Variable: {
|
||||
enter: function (node, _key, parent) {
|
||||
if (parent.kind !== 'VariableDefinition') {
|
||||
variablesInUse[node.name.value] = true;
|
||||
}
|
||||
},
|
||||
},
|
||||
Field: {
|
||||
enter: function (node) {
|
||||
if (directives && node.directives) {
|
||||
var shouldRemoveField = directives.some(function (directive) { return directive.remove; });
|
||||
if (shouldRemoveField &&
|
||||
node.directives &&
|
||||
node.directives.some(getDirectiveMatcher(directives))) {
|
||||
if (node.arguments) {
|
||||
node.arguments.forEach(function (arg) {
|
||||
if (arg.value.kind === 'Variable') {
|
||||
variablesToRemove.push({
|
||||
name: arg.value.name.value,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (node.selectionSet) {
|
||||
getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) {
|
||||
fragmentSpreadsToRemove.push({
|
||||
name: frag.name.value,
|
||||
});
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
FragmentSpread: {
|
||||
enter: function (node) {
|
||||
fragmentSpreadsInUse[node.name.value] = true;
|
||||
},
|
||||
},
|
||||
Directive: {
|
||||
enter: function (node) {
|
||||
if (getDirectiveMatcher(directives)(node)) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
},
|
||||
}));
|
||||
if (modifiedDoc &&
|
||||
filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) {
|
||||
modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);
|
||||
}
|
||||
if (modifiedDoc &&
|
||||
filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; })
|
||||
.length) {
|
||||
modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc);
|
||||
}
|
||||
return modifiedDoc;
|
||||
}
|
||||
function addTypenameToDocument(doc) {
|
||||
return visit(checkDocument(doc), {
|
||||
SelectionSet: {
|
||||
enter: function (node, _key, parent) {
|
||||
if (parent &&
|
||||
parent.kind === 'OperationDefinition') {
|
||||
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 __assign(__assign({}, node), { selections: __spreadArrays(selections, [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'; })) {
|
||||
process.env.NODE_ENV === "production" || invariant.warn('Removing an @connection directive even though it does not have a key. ' +
|
||||
'You may want to use the key parameter to specify a store key.');
|
||||
}
|
||||
}
|
||||
return willRemove;
|
||||
},
|
||||
};
|
||||
function removeConnectionDirectiveFromDocument(doc) {
|
||||
return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));
|
||||
}
|
||||
function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) {
|
||||
if (nestedCheck === void 0) { nestedCheck = true; }
|
||||
return (selectionSet &&
|
||||
selectionSet.selections &&
|
||||
selectionSet.selections.some(function (selection) {
|
||||
return hasDirectivesInSelection(directives, selection, nestedCheck);
|
||||
}));
|
||||
}
|
||||
function hasDirectivesInSelection(directives, selection, nestedCheck) {
|
||||
if (nestedCheck === void 0) { nestedCheck = true; }
|
||||
if (!isField(selection)) {
|
||||
return true;
|
||||
}
|
||||
if (!selection.directives) {
|
||||
return false;
|
||||
}
|
||||
return (selection.directives.some(getDirectiveMatcher(directives)) ||
|
||||
(nestedCheck &&
|
||||
hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck)));
|
||||
}
|
||||
function getDirectivesFromDocument(directives, doc) {
|
||||
checkDocument(doc);
|
||||
var parentPath;
|
||||
return nullIfDocIsEmpty(visit(doc, {
|
||||
SelectionSet: {
|
||||
enter: function (node, _key, _parent, path) {
|
||||
var currentPath = path.join('-');
|
||||
if (!parentPath ||
|
||||
currentPath === parentPath ||
|
||||
!currentPath.startsWith(parentPath)) {
|
||||
if (node.selections) {
|
||||
var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); });
|
||||
if (hasDirectivesInSelectionSet(directives, node, false)) {
|
||||
parentPath = currentPath;
|
||||
}
|
||||
return __assign(__assign({}, node), { selections: selectionsWithDirectives });
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}));
|
||||
}
|
||||
function getArgumentMatcher(config) {
|
||||
return function argumentMatcher(argument) {
|
||||
return config.some(function (aConfig) {
|
||||
return argument.value &&
|
||||
argument.value.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(visit(doc, {
|
||||
OperationDefinition: {
|
||||
enter: function (node) {
|
||||
return __assign(__assign({}, 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;
|
||||
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(visit(doc, {
|
||||
FragmentSpread: { enter: enter },
|
||||
FragmentDefinition: { enter: enter },
|
||||
}));
|
||||
}
|
||||
function getAllFragmentSpreadsFromSelectionSet(selectionSet) {
|
||||
var allFragments = [];
|
||||
selectionSet.selections.forEach(function (selection) {
|
||||
if ((isField(selection) || isInlineFragment(selection)) &&
|
||||
selection.selectionSet) {
|
||||
getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); });
|
||||
}
|
||||
else if (selection.kind === 'FragmentSpread') {
|
||||
allFragments.push(selection);
|
||||
}
|
||||
});
|
||||
return allFragments;
|
||||
}
|
||||
function buildQueryFromSelectionSet(document) {
|
||||
var definition = getMainDefinition(document);
|
||||
var definitionOperation = definition.operation;
|
||||
if (definitionOperation === 'query') {
|
||||
return document;
|
||||
}
|
||||
var modifiedDoc = visit(document, {
|
||||
OperationDefinition: {
|
||||
enter: function (node) {
|
||||
return __assign(__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);
|
||||
if (modifiedDoc) {
|
||||
modifiedDoc = visit(modifiedDoc, {
|
||||
FragmentDefinition: {
|
||||
enter: function (node) {
|
||||
if (node.selectionSet) {
|
||||
var isTypenameOnly = node.selectionSet.selections.every(function (selection) {
|
||||
return isField(selection) && selection.name.value === '__typename';
|
||||
});
|
||||
if (isTypenameOnly) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
return modifiedDoc;
|
||||
}
|
||||
|
||||
var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
|
||||
navigator.product === 'ReactNative');
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
function cloneDeep(value) {
|
||||
return cloneDeepHelper(value, new Map());
|
||||
}
|
||||
function cloneDeepHelper(val, seen) {
|
||||
switch (toString.call(val)) {
|
||||
case "[object Array]": {
|
||||
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]": {
|
||||
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 getEnv() {
|
||||
if (typeof process !== 'undefined' && process.env.NODE_ENV) {
|
||||
return process.env.NODE_ENV;
|
||||
}
|
||||
return 'development';
|
||||
}
|
||||
function isEnv(env) {
|
||||
return getEnv() === env;
|
||||
}
|
||||
function isProduction() {
|
||||
return isEnv('production') === true;
|
||||
}
|
||||
function isDevelopment() {
|
||||
return isEnv('development') === true;
|
||||
}
|
||||
function isTest() {
|
||||
return isEnv('test') === true;
|
||||
}
|
||||
|
||||
function tryFunctionOrLogError(f) {
|
||||
try {
|
||||
return f();
|
||||
}
|
||||
catch (e) {
|
||||
if (console.error) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function graphQLResultHasError(result) {
|
||||
return result.errors && result.errors.length;
|
||||
}
|
||||
|
||||
function deepFreeze(o) {
|
||||
Object.freeze(o);
|
||||
Object.getOwnPropertyNames(o).forEach(function (prop) {
|
||||
if (o[prop] !== null &&
|
||||
(typeof o[prop] === 'object' || typeof o[prop] === 'function') &&
|
||||
!Object.isFrozen(o[prop])) {
|
||||
deepFreeze(o[prop]);
|
||||
}
|
||||
});
|
||||
return o;
|
||||
}
|
||||
function maybeDeepFreeze(obj) {
|
||||
if (isDevelopment() || isTest()) {
|
||||
var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string';
|
||||
if (!symbolIsPolyfilled) {
|
||||
return deepFreeze(obj);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
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 pastCopies = [];
|
||||
target = shallowCopyForMerge(target, pastCopies);
|
||||
for (var i = 1; i < count; ++i) {
|
||||
target = mergeHelper(target, sources[i], pastCopies);
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function isObject(obj) {
|
||||
return obj !== null && typeof obj === 'object';
|
||||
}
|
||||
function mergeHelper(target, source, pastCopies) {
|
||||
if (isObject(source) && isObject(target)) {
|
||||
if (Object.isExtensible && !Object.isExtensible(target)) {
|
||||
target = shallowCopyForMerge(target, pastCopies);
|
||||
}
|
||||
Object.keys(source).forEach(function (sourceKey) {
|
||||
var sourceValue = source[sourceKey];
|
||||
if (hasOwnProperty.call(target, sourceKey)) {
|
||||
var targetValue = target[sourceKey];
|
||||
if (sourceValue !== targetValue) {
|
||||
target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies);
|
||||
}
|
||||
}
|
||||
else {
|
||||
target[sourceKey] = sourceValue;
|
||||
}
|
||||
});
|
||||
return target;
|
||||
}
|
||||
return source;
|
||||
}
|
||||
function shallowCopyForMerge(value, pastCopies) {
|
||||
if (value !== null &&
|
||||
typeof value === 'object' &&
|
||||
pastCopies.indexOf(value) < 0) {
|
||||
if (Array.isArray(value)) {
|
||||
value = value.slice(0);
|
||||
}
|
||||
else {
|
||||
value = __assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
||||
}
|
||||
pastCopies.push(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
var haveWarned = Object.create({});
|
||||
function warnOnceInDevelopment(msg, type) {
|
||||
if (type === void 0) { type = 'warn'; }
|
||||
if (!isProduction() && !haveWarned[msg]) {
|
||||
if (!isTest()) {
|
||||
haveWarned[msg] = true;
|
||||
}
|
||||
if (type === 'error') {
|
||||
console.error(msg);
|
||||
}
|
||||
else {
|
||||
console.warn(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function stripSymbols(data) {
|
||||
return JSON.parse(JSON.stringify(data));
|
||||
}
|
||||
|
||||
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
|
||||
1
node_modules/apollo-utilities/lib/bundle.esm.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/bundle.esm.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1131
node_modules/apollo-utilities/lib/bundle.umd.js
generated
vendored
Normal file
1131
node_modules/apollo-utilities/lib/bundle.umd.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/apollo-utilities/lib/bundle.umd.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/bundle.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
19
node_modules/apollo-utilities/lib/directives.d.ts
generated
vendored
Normal file
19
node_modules/apollo-utilities/lib/directives.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { FieldNode, SelectionNode, DirectiveNode, DocumentNode, ArgumentNode } from 'graphql';
|
||||
export declare type DirectiveInfo = {
|
||||
[fieldName: string]: {
|
||||
[argName: string]: any;
|
||||
};
|
||||
};
|
||||
export declare function getDirectiveInfoFromField(field: FieldNode, variables: Object): DirectiveInfo;
|
||||
export declare function shouldInclude(selection: SelectionNode, variables?: {
|
||||
[name: string]: any;
|
||||
}): boolean;
|
||||
export declare function getDirectiveNames(doc: DocumentNode): string[];
|
||||
export declare function hasDirectives(names: string[], doc: DocumentNode): boolean;
|
||||
export declare function hasClientExports(document: DocumentNode): boolean;
|
||||
export declare type InclusionDirectives = Array<{
|
||||
directive: DirectiveNode;
|
||||
ifArgument: ArgumentNode;
|
||||
}>;
|
||||
export declare function getInclusionDirectives(directives: ReadonlyArray<DirectiveNode>): InclusionDirectives;
|
||||
//# sourceMappingURL=directives.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/directives.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/directives.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["src/directives.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,aAAa,EAGb,aAAa,EACb,YAAY,EACZ,YAAY,EAEb,MAAM,SAAS,CAAC;AAQjB,oBAAY,aAAa,GAAG;IAC1B,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,GAChB,aAAa,CAYf;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,aAAa,EACxB,SAAS,GAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAO,GACtC,OAAO,CAgBT;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,YAUlD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,YAAY,WAI/D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,WAMtD;AAED,oBAAY,mBAAmB,GAAG,KAAK,CAAC;IACtC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;CAC1B,CAAC,CAAC;AAMH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,GACvC,mBAAmB,CA2BrB"}
|
||||
71
node_modules/apollo-utilities/lib/directives.js
generated
vendored
Normal file
71
node_modules/apollo-utilities/lib/directives.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var visitor_1 = require("graphql/language/visitor");
|
||||
var ts_invariant_1 = require("ts-invariant");
|
||||
var storeUtils_1 = require("./storeUtils");
|
||||
function getDirectiveInfoFromField(field, variables) {
|
||||
if (field.directives && field.directives.length) {
|
||||
var directiveObj_1 = {};
|
||||
field.directives.forEach(function (directive) {
|
||||
directiveObj_1[directive.name.value] = storeUtils_1.argumentsObjectFromField(directive, variables);
|
||||
});
|
||||
return directiveObj_1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
exports.getDirectiveInfoFromField = getDirectiveInfoFromField;
|
||||
function shouldInclude(selection, variables) {
|
||||
if (variables === void 0) { variables = {}; }
|
||||
return getInclusionDirectives(selection.directives).every(function (_a) {
|
||||
var directive = _a.directive, ifArgument = _a.ifArgument;
|
||||
var evaledValue = false;
|
||||
if (ifArgument.value.kind === 'Variable') {
|
||||
evaledValue = variables[ifArgument.value.name.value];
|
||||
ts_invariant_1.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.");
|
||||
}
|
||||
else {
|
||||
evaledValue = ifArgument.value.value;
|
||||
}
|
||||
return directive.name.value === 'skip' ? !evaledValue : evaledValue;
|
||||
});
|
||||
}
|
||||
exports.shouldInclude = shouldInclude;
|
||||
function getDirectiveNames(doc) {
|
||||
var names = [];
|
||||
visitor_1.visit(doc, {
|
||||
Directive: function (node) {
|
||||
names.push(node.name.value);
|
||||
},
|
||||
});
|
||||
return names;
|
||||
}
|
||||
exports.getDirectiveNames = getDirectiveNames;
|
||||
function hasDirectives(names, doc) {
|
||||
return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; });
|
||||
}
|
||||
exports.hasDirectives = hasDirectives;
|
||||
function hasClientExports(document) {
|
||||
return (document &&
|
||||
hasDirectives(['client'], document) &&
|
||||
hasDirectives(['export'], document));
|
||||
}
|
||||
exports.hasClientExports = hasClientExports;
|
||||
function isInclusionDirective(_a) {
|
||||
var value = _a.name.value;
|
||||
return value === 'skip' || value === 'include';
|
||||
}
|
||||
function getInclusionDirectives(directives) {
|
||||
return directives ? directives.filter(isInclusionDirective).map(function (directive) {
|
||||
var directiveArguments = directive.arguments;
|
||||
var directiveName = directive.name.value;
|
||||
ts_invariant_1.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.");
|
||||
var ifArgument = directiveArguments[0];
|
||||
ts_invariant_1.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.");
|
||||
var ifValue = ifArgument.value;
|
||||
ts_invariant_1.invariant(ifValue &&
|
||||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.");
|
||||
return { directive: directive, ifArgument: ifArgument };
|
||||
}) : [];
|
||||
}
|
||||
exports.getInclusionDirectives = getInclusionDirectives;
|
||||
//# sourceMappingURL=directives.js.map
|
||||
1
node_modules/apollo-utilities/lib/directives.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/directives.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":";;AAaA,oDAAiD;AAEjD,6CAAyC;AAEzC,2CAAwD;AAMxD,SAAgB,yBAAyB,CACvC,KAAgB,EAChB,SAAiB;IAEjB,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE;QAC/C,IAAM,cAAY,GAAkB,EAAE,CAAC;QACvC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,SAAwB;YAChD,cAAY,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,qCAAwB,CAC3D,SAAS,EACT,SAAS,CACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,cAAY,CAAC;KACrB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAfD,8DAeC;AAED,SAAgB,aAAa,CAC3B,SAAwB,EACxB,SAAuC;IAAvC,0BAAA,EAAA,cAAuC;IAEvC,OAAO,sBAAsB,CAC3B,SAAS,CAAC,UAAU,CACrB,CAAC,KAAK,CAAC,UAAC,EAAyB;YAAvB,wBAAS,EAAE,0BAAU;QAC9B,IAAI,WAAW,GAAY,KAAK,CAAC;QACjC,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;YACxC,WAAW,GAAG,SAAS,CAAE,UAAU,CAAC,KAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvE,wBAAS,CACP,WAAW,KAAK,KAAK,CAAC,EACtB,qCAAmC,SAAS,CAAC,IAAI,CAAC,KAAK,gBAAa,CACrE,CAAC;SACH;aAAM;YACL,WAAW,GAAI,UAAU,CAAC,KAA0B,CAAC,KAAK,CAAC;SAC5D;QACD,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC;AAnBD,sCAmBC;AAED,SAAgB,iBAAiB,CAAC,GAAiB;IACjD,IAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,eAAK,CAAC,GAAG,EAAE;QACT,SAAS,YAAC,IAAI;YACZ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,8CAUC;AAED,SAAgB,aAAa,CAAC,KAAe,EAAE,GAAiB;IAC9D,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,CAChC,UAAC,IAAY,IAAK,OAAA,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAxB,CAAwB,CAC3C,CAAC;AACJ,CAAC;AAJD,sCAIC;AAED,SAAgB,gBAAgB,CAAC,QAAsB;IACrD,OAAO,CACL,QAAQ;QACR,aAAa,CAAC,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACnC,aAAa,CAAC,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CACpC,CAAC;AACJ,CAAC;AAND,4CAMC;AAOD,SAAS,oBAAoB,CAAC,EAAkC;QAAxB,qBAAK;IAC3C,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,SAAgB,sBAAsB,CACpC,UAAwC;IAExC,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,UAAA,SAAS;QACvE,IAAM,kBAAkB,GAAG,SAAS,CAAC,SAAS,CAAC;QAC/C,IAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;QAE3C,wBAAS,CACP,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EACrD,4CAA0C,aAAa,gBAAa,CACrE,CAAC;QAEF,IAAM,UAAU,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACzC,wBAAS,CACP,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,EACjD,+BAA6B,aAAa,gBAAa,CACxD,CAAC;QAEF,IAAM,OAAO,GAAc,UAAU,CAAC,KAAK,CAAC;QAG5C,wBAAS,CACP,OAAO;YACL,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,EAClE,uBAAqB,aAAa,sDAAmD,CACtF,CAAC;QAEF,OAAO,EAAE,SAAS,WAAA,EAAE,UAAU,YAAA,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACV,CAAC;AA7BD,wDA6BC"}
|
||||
3
node_modules/apollo-utilities/lib/fragments.d.ts
generated
vendored
Normal file
3
node_modules/apollo-utilities/lib/fragments.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { DocumentNode } from 'graphql';
|
||||
export declare function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode;
|
||||
//# sourceMappingURL=fragments.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/fragments.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/fragments.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["src/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,SAAS,CAAC;AAyB/D,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,YAAY,CA+Dd"}
|
||||
42
node_modules/apollo-utilities/lib/fragments.js
generated
vendored
Normal file
42
node_modules/apollo-utilities/lib/fragments.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts_invariant_1 = require("ts-invariant");
|
||||
function getFragmentQueryDocument(document, fragmentName) {
|
||||
var actualFragmentName = fragmentName;
|
||||
var fragments = [];
|
||||
document.definitions.forEach(function (definition) {
|
||||
if (definition.kind === 'OperationDefinition') {
|
||||
throw new ts_invariant_1.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.');
|
||||
}
|
||||
if (definition.kind === 'FragmentDefinition') {
|
||||
fragments.push(definition);
|
||||
}
|
||||
});
|
||||
if (typeof actualFragmentName === 'undefined') {
|
||||
ts_invariant_1.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.");
|
||||
actualFragmentName = fragments[0].name.value;
|
||||
}
|
||||
var query = tslib_1.__assign(tslib_1.__assign({}, document), { definitions: tslib_1.__spreadArrays([
|
||||
{
|
||||
kind: 'OperationDefinition',
|
||||
operation: 'query',
|
||||
selectionSet: {
|
||||
kind: 'SelectionSet',
|
||||
selections: [
|
||||
{
|
||||
kind: 'FragmentSpread',
|
||||
name: {
|
||||
kind: 'Name',
|
||||
value: actualFragmentName,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
], document.definitions) });
|
||||
return query;
|
||||
}
|
||||
exports.getFragmentQueryDocument = getFragmentQueryDocument;
|
||||
//# sourceMappingURL=fragments.js.map
|
||||
1
node_modules/apollo-utilities/lib/fragments.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/fragments.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../src/fragments.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAwBzD,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAKtC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,UAAU;QAGrC,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,IAAI,6BAAc,CACtB,aAAW,UAAU,CAAC,SAAS,mBAC7B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,aAAW,UAAU,CAAC,IAAI,CAAC,KAAK,MAAG,CAAC,CAAC,CAAC,EAAE,QACxD;gBACF,yFAAyF,CAC5F,CAAC;SACH;QAGD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC5C,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC5B;IACH,CAAC,CAAC,CAAC;IAIH,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;QAC7C,wBAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,WACE,SAAS,CAAC,MAAM,sFACmE,CACtF,CAAC;QACF,kBAAkB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;KAC9C;IAID,IAAM,KAAK,yCACN,QAAQ,KACX,WAAW;YACT;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,SAAS,EAAE,OAAO;gBAClB,YAAY,EAAE;oBACZ,IAAI,EAAE,cAAc;oBACpB,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,gBAAgB;4BACtB,IAAI,EAAE;gCACJ,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE,kBAAkB;6BAC1B;yBACF;qBACF;iBACF;aACF;WACE,QAAQ,CAAC,WAAW,IAE1B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAlED,4DAkEC"}
|
||||
20
node_modules/apollo-utilities/lib/getFromAST.d.ts
generated
vendored
Normal file
20
node_modules/apollo-utilities/lib/getFromAST.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from 'graphql';
|
||||
import { JsonValue } from './storeUtils';
|
||||
export declare function getMutationDefinition(doc: DocumentNode): OperationDefinitionNode;
|
||||
export declare function checkDocument(doc: DocumentNode): DocumentNode;
|
||||
export declare function getOperationDefinition(doc: DocumentNode): OperationDefinitionNode | undefined;
|
||||
export declare function getOperationDefinitionOrDie(document: DocumentNode): OperationDefinitionNode;
|
||||
export declare function getOperationName(doc: DocumentNode): string | null;
|
||||
export declare function getFragmentDefinitions(doc: DocumentNode): FragmentDefinitionNode[];
|
||||
export declare function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode;
|
||||
export declare function getFragmentDefinition(doc: DocumentNode): FragmentDefinitionNode;
|
||||
export declare function getMainDefinition(queryDoc: DocumentNode): OperationDefinitionNode | FragmentDefinitionNode;
|
||||
export interface FragmentMap {
|
||||
[fragmentName: string]: FragmentDefinitionNode;
|
||||
}
|
||||
export declare function createFragmentMap(fragments?: FragmentDefinitionNode[]): FragmentMap;
|
||||
export declare function getDefaultValues(definition: OperationDefinitionNode | undefined): {
|
||||
[key: string]: JsonValue;
|
||||
};
|
||||
export declare function variablesInOperation(operation: OperationDefinitionNode): Set<string>;
|
||||
//# sourceMappingURL=getFromAST.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/getFromAST.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/getFromAST.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getFromAST.d.ts","sourceRoot":"","sources":["src/getFromAST.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,YAAY,GAChB,uBAAuB,CAYzB;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,gBA0B9C;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,GAChB,uBAAuB,GAAG,SAAS,CAKrC;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,YAAY,GACrB,uBAAuB,CAIzB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CASjE;AAGD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,GAChB,sBAAsB,EAAE,CAI1B;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,GAAG,uBAAuB,CAS7E;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,YAAY,GAChB,sBAAsB,CAoBxB;AAOD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,YAAY,GACrB,uBAAuB,GAAG,sBAAsB,CA8BlD;AAKD,MAAM,WAAW,WAAW;IAC1B,CAAC,YAAY,EAAE,MAAM,GAAG,sBAAsB,CAAC;CAChD;AAID,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,sBAAsB,EAAO,GACvC,WAAW,CAOb;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,uBAAuB,GAAG,SAAS,GAC9C;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAyB9B;AAKD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,uBAAuB,GACjC,GAAG,CAAC,MAAM,CAAC,CASb"}
|
||||
131
node_modules/apollo-utilities/lib/getFromAST.js
generated
vendored
Normal file
131
node_modules/apollo-utilities/lib/getFromAST.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts_invariant_1 = require("ts-invariant");
|
||||
var assign_1 = require("./util/assign");
|
||||
var storeUtils_1 = require("./storeUtils");
|
||||
function getMutationDefinition(doc) {
|
||||
checkDocument(doc);
|
||||
var mutationDef = doc.definitions.filter(function (definition) {
|
||||
return definition.kind === 'OperationDefinition' &&
|
||||
definition.operation === 'mutation';
|
||||
})[0];
|
||||
ts_invariant_1.invariant(mutationDef, 'Must contain a mutation definition.');
|
||||
return mutationDef;
|
||||
}
|
||||
exports.getMutationDefinition = getMutationDefinition;
|
||||
function checkDocument(doc) {
|
||||
ts_invariant_1.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql");
|
||||
var operations = doc.definitions
|
||||
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
||||
.map(function (definition) {
|
||||
if (definition.kind !== 'OperationDefinition') {
|
||||
throw new ts_invariant_1.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"");
|
||||
}
|
||||
return definition;
|
||||
});
|
||||
ts_invariant_1.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations");
|
||||
return doc;
|
||||
}
|
||||
exports.checkDocument = checkDocument;
|
||||
function getOperationDefinition(doc) {
|
||||
checkDocument(doc);
|
||||
return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0];
|
||||
}
|
||||
exports.getOperationDefinition = getOperationDefinition;
|
||||
function getOperationDefinitionOrDie(document) {
|
||||
var def = getOperationDefinition(document);
|
||||
ts_invariant_1.invariant(def, "GraphQL document is missing an operation");
|
||||
return def;
|
||||
}
|
||||
exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie;
|
||||
function getOperationName(doc) {
|
||||
return (doc.definitions
|
||||
.filter(function (definition) {
|
||||
return definition.kind === 'OperationDefinition' && definition.name;
|
||||
})
|
||||
.map(function (x) { return x.name.value; })[0] || null);
|
||||
}
|
||||
exports.getOperationName = getOperationName;
|
||||
function getFragmentDefinitions(doc) {
|
||||
return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; });
|
||||
}
|
||||
exports.getFragmentDefinitions = getFragmentDefinitions;
|
||||
function getQueryDefinition(doc) {
|
||||
var queryDef = getOperationDefinition(doc);
|
||||
ts_invariant_1.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.');
|
||||
return queryDef;
|
||||
}
|
||||
exports.getQueryDefinition = getQueryDefinition;
|
||||
function getFragmentDefinition(doc) {
|
||||
ts_invariant_1.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql");
|
||||
ts_invariant_1.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.');
|
||||
var fragmentDef = doc.definitions[0];
|
||||
ts_invariant_1.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.');
|
||||
return fragmentDef;
|
||||
}
|
||||
exports.getFragmentDefinition = getFragmentDefinition;
|
||||
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 new ts_invariant_1.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.');
|
||||
}
|
||||
exports.getMainDefinition = getMainDefinition;
|
||||
function createFragmentMap(fragments) {
|
||||
if (fragments === void 0) { fragments = []; }
|
||||
var symTable = {};
|
||||
fragments.forEach(function (fragment) {
|
||||
symTable[fragment.name.value] = fragment;
|
||||
});
|
||||
return symTable;
|
||||
}
|
||||
exports.createFragmentMap = createFragmentMap;
|
||||
function getDefaultValues(definition) {
|
||||
if (definition &&
|
||||
definition.variableDefinitions &&
|
||||
definition.variableDefinitions.length) {
|
||||
var defaultValues = definition.variableDefinitions
|
||||
.filter(function (_a) {
|
||||
var defaultValue = _a.defaultValue;
|
||||
return defaultValue;
|
||||
})
|
||||
.map(function (_a) {
|
||||
var variable = _a.variable, defaultValue = _a.defaultValue;
|
||||
var defaultValueObj = {};
|
||||
storeUtils_1.valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue);
|
||||
return defaultValueObj;
|
||||
});
|
||||
return assign_1.assign.apply(void 0, tslib_1.__spreadArrays([{}], defaultValues));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
exports.getDefaultValues = getDefaultValues;
|
||||
function variablesInOperation(operation) {
|
||||
var names = new Set();
|
||||
if (operation.variableDefinitions) {
|
||||
for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) {
|
||||
var definition = _a[_i];
|
||||
names.add(definition.variable.name.value);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
exports.variablesInOperation = variablesInOperation;
|
||||
//# sourceMappingURL=getFromAST.js.map
|
||||
1
node_modules/apollo-utilities/lib/getFromAST.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/getFromAST.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getFromAST.js","sourceRoot":"","sources":["../src/getFromAST.ts"],"names":[],"mappings":";;;AAOA,6CAAyD;AAEzD,wCAAuC;AAEvC,2CAAsE;AAEtE,SAAgB,qBAAqB,CACnC,GAAiB;IAEjB,aAAa,CAAC,GAAG,CAAC,CAAC;IAEnB,IAAI,WAAW,GAAmC,GAAG,CAAC,WAAW,CAAC,MAAM,CACtE,UAAA,UAAU;QACR,OAAA,UAAU,CAAC,IAAI,KAAK,qBAAqB;YACzC,UAAU,CAAC,SAAS,KAAK,UAAU;IADnC,CACmC,CACtC,CAAC,CAAC,CAA4B,CAAC;IAEhC,wBAAS,CAAC,WAAW,EAAE,qCAAqC,CAAC,CAAC;IAE9D,OAAO,WAAW,CAAC;AACrB,CAAC;AAdD,sDAcC;AAGD,SAAgB,aAAa,CAAC,GAAiB;IAC7C,wBAAS,CACP,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAC9B,0JAC2E,CAC5E,CAAC;IAEF,IAAM,UAAU,GAAG,GAAG,CAAC,WAAW;SAC/B,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,oBAAoB,EAA/B,CAA+B,CAAC;SAC5C,GAAG,CAAC,UAAA,UAAU;QACb,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,IAAI,6BAAc,CACtB,8DACE,UAAU,CAAC,IAAI,OACd,CACJ,CAAC;SACH;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC,CAAC;IAEL,wBAAS,CACP,UAAU,CAAC,MAAM,IAAI,CAAC,EACtB,0CAAwC,UAAU,CAAC,MAAM,gBAAa,CACvE,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC;AA1BD,sCA0BC;AAED,SAAgB,sBAAsB,CACpC,GAAiB;IAEjB,aAAa,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,CAC3B,UAAA,UAAU,IAAI,OAAA,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAzC,CAAyC,CACxD,CAAC,CAAC,CAA4B,CAAC;AAClC,CAAC;AAPD,wDAOC;AAED,SAAgB,2BAA2B,CACzC,QAAsB;IAEtB,IAAM,GAAG,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAC7C,wBAAS,CAAC,GAAG,EAAE,0CAA0C,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC;AACb,CAAC;AAND,kEAMC;AAED,SAAgB,gBAAgB,CAAC,GAAiB;IAChD,OAAO,CACL,GAAG,CAAC,WAAW;SACZ,MAAM,CACL,UAAA,UAAU;QACR,OAAA,UAAU,CAAC,IAAI,KAAK,qBAAqB,IAAI,UAAU,CAAC,IAAI;IAA5D,CAA4D,CAC/D;SACA,GAAG,CAAC,UAAC,CAA0B,IAAK,OAAA,CAAC,CAAC,IAAI,CAAC,KAAK,EAAZ,CAAY,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAChE,CAAC;AACJ,CAAC;AATD,4CASC;AAGD,SAAgB,sBAAsB,CACpC,GAAiB;IAEjB,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,CAC3B,UAAA,UAAU,IAAI,OAAA,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAxC,CAAwC,CAC3B,CAAC;AAChC,CAAC;AAND,wDAMC;AAED,SAAgB,kBAAkB,CAAC,GAAiB;IAClD,IAAM,QAAQ,GAAG,sBAAsB,CAAC,GAAG,CAA4B,CAAC;IAExE,wBAAS,CACP,QAAQ,IAAI,QAAQ,CAAC,SAAS,KAAK,OAAO,EAC1C,kCAAkC,CACnC,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AATD,gDASC;AAED,SAAgB,qBAAqB,CACnC,GAAiB;IAEjB,wBAAS,CACP,GAAG,CAAC,IAAI,KAAK,UAAU,EACvB,0JAC2E,CAC5E,CAAC;IAEF,wBAAS,CACP,GAAG,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC,EAC3B,4CAA4C,CAC7C,CAAC;IAEF,IAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAA2B,CAAC;IAEjE,wBAAS,CACP,WAAW,CAAC,IAAI,KAAK,oBAAoB,EACzC,gCAAgC,CACjC,CAAC;IAEF,OAAO,WAAqC,CAAC;AAC/C,CAAC;AAtBD,sDAsBC;AAOD,SAAgB,iBAAiB,CAC/B,QAAsB;IAEtB,aAAa,CAAC,QAAQ,CAAC,CAAC;IAExB,IAAI,kBAAkB,CAAC;IAEvB,KAAuB,UAAoB,EAApB,KAAA,QAAQ,CAAC,WAAW,EAApB,cAAoB,EAApB,IAAoB,EAAE;QAAxC,IAAI,UAAU,SAAA;QACjB,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,IAAM,SAAS,GAAI,UAAsC,CAAC,SAAS,CAAC;YACpE,IACE,SAAS,KAAK,OAAO;gBACrB,SAAS,KAAK,UAAU;gBACxB,SAAS,KAAK,cAAc,EAC5B;gBACA,OAAO,UAAqC,CAAC;aAC9C;SACF;QACD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,IAAI,CAAC,kBAAkB,EAAE;YAGnE,kBAAkB,GAAG,UAAoC,CAAC;SAC3D;KACF;IAED,IAAI,kBAAkB,EAAE;QACtB,OAAO,kBAAkB,CAAC;KAC3B;IAED,MAAM,IAAI,6BAAc,CACtB,sFAAsF,CACvF,CAAC;AACJ,CAAC;AAhCD,8CAgCC;AAWD,SAAgB,iBAAiB,CAC/B,SAAwC;IAAxC,0BAAA,EAAA,cAAwC;IAExC,IAAM,QAAQ,GAAgB,EAAE,CAAC;IACjC,SAAS,CAAC,OAAO,CAAC,UAAA,QAAQ;QACxB,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AATD,8CASC;AAED,SAAgB,gBAAgB,CAC9B,UAA+C;IAE/C,IACE,UAAU;QACV,UAAU,CAAC,mBAAmB;QAC9B,UAAU,CAAC,mBAAmB,CAAC,MAAM,EACrC;QACA,IAAM,aAAa,GAAG,UAAU,CAAC,mBAAmB;aACjD,MAAM,CAAC,UAAC,EAAgB;gBAAd,8BAAY;YAAO,OAAA,YAAY;QAAZ,CAAY,CAAC;aAC1C,GAAG,CACF,UAAC,EAA0B;gBAAxB,sBAAQ,EAAE,8BAAY;YACvB,IAAM,eAAe,GAAiC,EAAE,CAAC;YACzD,wCAA2B,CACzB,eAAe,EACf,QAAQ,CAAC,IAAI,EACb,YAAyB,CAC1B,CAAC;YAEF,OAAO,eAAe,CAAC;QACzB,CAAC,CACF,CAAC;QAEJ,OAAO,eAAM,uCAAC,EAAE,GAAK,aAAa,GAAE;KACrC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AA3BD,4CA2BC;AAKD,SAAgB,oBAAoB,CAClC,SAAkC;IAElC,IAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,IAAI,SAAS,CAAC,mBAAmB,EAAE;QACjC,KAAyB,UAA6B,EAA7B,KAAA,SAAS,CAAC,mBAAmB,EAA7B,cAA6B,EAA7B,IAA6B,EAAE;YAAnD,IAAM,UAAU,SAAA;YACnB,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC3C;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAXD,oDAWC"}
|
||||
17
node_modules/apollo-utilities/lib/index.d.ts
generated
vendored
Normal file
17
node_modules/apollo-utilities/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export * from './directives';
|
||||
export * from './fragments';
|
||||
export * from './getFromAST';
|
||||
export * from './transform';
|
||||
export * from './storeUtils';
|
||||
export * from './util/assign';
|
||||
export * from './util/canUse';
|
||||
export * from './util/cloneDeep';
|
||||
export * from './util/environment';
|
||||
export * from './util/errorHandling';
|
||||
export * from './util/isEqual';
|
||||
export * from './util/maybeDeepFreeze';
|
||||
export * from './util/mergeDeep';
|
||||
export * from './util/warnOnce';
|
||||
export * from './util/stripSymbols';
|
||||
export * from './util/mergeDeep';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
||||
20
node_modules/apollo-utilities/lib/index.js
generated
vendored
Normal file
20
node_modules/apollo-utilities/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./directives"), exports);
|
||||
tslib_1.__exportStar(require("./fragments"), exports);
|
||||
tslib_1.__exportStar(require("./getFromAST"), exports);
|
||||
tslib_1.__exportStar(require("./transform"), exports);
|
||||
tslib_1.__exportStar(require("./storeUtils"), exports);
|
||||
tslib_1.__exportStar(require("./util/assign"), exports);
|
||||
tslib_1.__exportStar(require("./util/canUse"), exports);
|
||||
tslib_1.__exportStar(require("./util/cloneDeep"), exports);
|
||||
tslib_1.__exportStar(require("./util/environment"), exports);
|
||||
tslib_1.__exportStar(require("./util/errorHandling"), exports);
|
||||
tslib_1.__exportStar(require("./util/isEqual"), exports);
|
||||
tslib_1.__exportStar(require("./util/maybeDeepFreeze"), exports);
|
||||
tslib_1.__exportStar(require("./util/mergeDeep"), exports);
|
||||
tslib_1.__exportStar(require("./util/warnOnce"), exports);
|
||||
tslib_1.__exportStar(require("./util/stripSymbols"), exports);
|
||||
tslib_1.__exportStar(require("./util/mergeDeep"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-utilities/lib/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,wDAA8B;AAC9B,wDAA8B;AAC9B,2DAAiC;AACjC,6DAAmC;AACnC,+DAAqC;AACrC,yDAA+B;AAC/B,iEAAuC;AACvC,2DAAiC;AACjC,0DAAgC;AAChC,8DAAoC;AACpC,2DAAiC"}
|
||||
39
node_modules/apollo-utilities/lib/storeUtils.d.ts
generated
vendored
Normal file
39
node_modules/apollo-utilities/lib/storeUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { DirectiveNode, FieldNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, EnumValueNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode } from 'graphql';
|
||||
export interface IdValue {
|
||||
type: 'id';
|
||||
id: string;
|
||||
generated: boolean;
|
||||
typename: string | undefined;
|
||||
}
|
||||
export interface JsonValue {
|
||||
type: 'json';
|
||||
json: any;
|
||||
}
|
||||
export declare type ListValue = Array<null | IdValue>;
|
||||
export declare type StoreValue = number | string | string[] | IdValue | ListValue | JsonValue | null | undefined | void | Object;
|
||||
export declare type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;
|
||||
export declare function isScalarValue(value: ValueNode): value is ScalarValue;
|
||||
export declare type NumberValue = IntValueNode | FloatValueNode;
|
||||
export declare function isNumberValue(value: ValueNode): value is NumberValue;
|
||||
export declare function valueToObjectRepresentation(argObj: any, name: NameNode, value: ValueNode, variables?: Object): void;
|
||||
export declare function storeKeyNameFromField(field: FieldNode, variables?: Object): string;
|
||||
export declare type Directives = {
|
||||
[directiveName: string]: {
|
||||
[argName: string]: any;
|
||||
};
|
||||
};
|
||||
export declare function getStoreKeyName(fieldName: string, args?: Object, directives?: Directives): string;
|
||||
export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables: Object): Object;
|
||||
export declare function resultKeyNameFromField(field: FieldNode): string;
|
||||
export declare function isField(selection: SelectionNode): selection is FieldNode;
|
||||
export declare function isInlineFragment(selection: SelectionNode): selection is InlineFragmentNode;
|
||||
export declare function isIdValue(idObject: StoreValue): idObject is IdValue;
|
||||
export declare type IdConfig = {
|
||||
id: string;
|
||||
typename: string | undefined;
|
||||
};
|
||||
export declare function toIdValue(idConfig: string | IdConfig, generated?: boolean): IdValue;
|
||||
export declare function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue;
|
||||
export declare type VariableValue = (node: VariableNode) => any;
|
||||
export declare function valueFromNode(node: ValueNode, onVariable?: VariableValue): any;
|
||||
//# sourceMappingURL=storeUtils.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/storeUtils.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/storeUtils.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"storeUtils.d.ts","sourceRoot":"","sources":["src/storeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAGhB,aAAa,EAEb,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,SAAS,CAAC;AAKjB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;CACX;AAED,oBAAY,SAAS,GAAG,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;AAE9C,oBAAY,UAAU,GAClB,MAAM,GACN,MAAM,GACN,MAAM,EAAE,GACR,OAAO,GACP,SAAS,GACT,SAAS,GACT,IAAI,GACJ,SAAS,GACT,IAAI,GACJ,MAAM,CAAC;AAEX,oBAAY,WAAW,GAAG,eAAe,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAE7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,WAAW,CAEpE;AAED,oBAAY,WAAW,GAAG,YAAY,GAAG,cAAc,CAAC;AAExD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,WAAW,CAEpE;AAsCD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,SAAS,EAChB,SAAS,CAAC,EAAE,MAAM,QAqCnB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CA6BR;AAED,oBAAY,UAAU,GAAG;IACvB,CAAC,aAAa,EAAE,MAAM,GAAG;QACvB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC;KACxB,CAAC;CACH,CAAC;AAWF,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,UAAU,GACtB,MAAM,CAmDR;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,SAAS,GAAG,aAAa,EAChC,SAAS,EAAE,MAAM,GAChB,MAAM,CAUR;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAE/D;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,IAAI,SAAS,CAExE;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,aAAa,GACvB,SAAS,IAAI,kBAAkB,CAEjC;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,IAAI,OAAO,CAInE;AAED,oBAAY,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAC3B,SAAS,UAAQ,GAChB,OAAO,CAQT;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,SAAS,CAM3E;AAMD,oBAAY,aAAa,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,CAAC;AAKxD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,EACf,UAAU,GAAE,aAAwC,GACnD,GAAG,CAsBL"}
|
||||
225
node_modules/apollo-utilities/lib/storeUtils.js
generated
vendored
Normal file
225
node_modules/apollo-utilities/lib/storeUtils.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var fast_json_stable_stringify_1 = tslib_1.__importDefault(require("fast-json-stable-stringify"));
|
||||
var ts_invariant_1 = require("ts-invariant");
|
||||
function isScalarValue(value) {
|
||||
return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;
|
||||
}
|
||||
exports.isScalarValue = isScalarValue;
|
||||
function isNumberValue(value) {
|
||||
return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;
|
||||
}
|
||||
exports.isNumberValue = isNumberValue;
|
||||
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 new ts_invariant_1.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
|
||||
'is not supported. Use variables instead of inline arguments to ' +
|
||||
'overcome this limitation.');
|
||||
}
|
||||
}
|
||||
exports.valueToObjectRepresentation = valueToObjectRepresentation;
|
||||
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);
|
||||
}
|
||||
exports.storeKeyNameFromField = storeKeyNameFromField;
|
||||
var KNOWN_DIRECTIVES = [
|
||||
'connection',
|
||||
'include',
|
||||
'skip',
|
||||
'client',
|
||||
'rest',
|
||||
'export',
|
||||
];
|
||||
function getStoreKeyName(fieldName, args, directives) {
|
||||
if (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 queryArgs_1 = args;
|
||||
var filteredArgs_1 = {};
|
||||
filterKeys.forEach(function (key) {
|
||||
filteredArgs_1[key] = queryArgs_1[key];
|
||||
});
|
||||
return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")";
|
||||
}
|
||||
else {
|
||||
return directives['connection']['key'];
|
||||
}
|
||||
}
|
||||
var completeFieldName = fieldName;
|
||||
if (args) {
|
||||
var stringifiedArgs = fast_json_stable_stringify_1.default(args);
|
||||
completeFieldName += "(" + 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 += "@" + key + "(" + JSON.stringify(directives[key]) + ")";
|
||||
}
|
||||
else {
|
||||
completeFieldName += "@" + key;
|
||||
}
|
||||
});
|
||||
}
|
||||
return completeFieldName;
|
||||
}
|
||||
exports.getStoreKeyName = getStoreKeyName;
|
||||
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;
|
||||
}
|
||||
exports.argumentsObjectFromField = argumentsObjectFromField;
|
||||
function resultKeyNameFromField(field) {
|
||||
return field.alias ? field.alias.value : field.name.value;
|
||||
}
|
||||
exports.resultKeyNameFromField = resultKeyNameFromField;
|
||||
function isField(selection) {
|
||||
return selection.kind === 'Field';
|
||||
}
|
||||
exports.isField = isField;
|
||||
function isInlineFragment(selection) {
|
||||
return selection.kind === 'InlineFragment';
|
||||
}
|
||||
exports.isInlineFragment = isInlineFragment;
|
||||
function isIdValue(idObject) {
|
||||
return idObject &&
|
||||
idObject.type === 'id' &&
|
||||
typeof idObject.generated === 'boolean';
|
||||
}
|
||||
exports.isIdValue = isIdValue;
|
||||
function toIdValue(idConfig, generated) {
|
||||
if (generated === void 0) { generated = false; }
|
||||
return tslib_1.__assign({ type: 'id', generated: generated }, (typeof idConfig === 'string'
|
||||
? { id: idConfig, typename: undefined }
|
||||
: idConfig));
|
||||
}
|
||||
exports.toIdValue = toIdValue;
|
||||
function isJsonValue(jsonObject) {
|
||||
return (jsonObject != null &&
|
||||
typeof jsonObject === 'object' &&
|
||||
jsonObject.type === 'json');
|
||||
}
|
||||
exports.isJsonValue = isJsonValue;
|
||||
function defaultValueFromVariable(node) {
|
||||
throw new ts_invariant_1.InvariantError("Variable nodes are not supported by valueFromNode");
|
||||
}
|
||||
function valueFromNode(node, onVariable) {
|
||||
if (onVariable === void 0) { onVariable = defaultValueFromVariable; }
|
||||
switch (node.kind) {
|
||||
case 'Variable':
|
||||
return onVariable(node);
|
||||
case 'NullValue':
|
||||
return null;
|
||||
case 'IntValue':
|
||||
return parseInt(node.value, 10);
|
||||
case 'FloatValue':
|
||||
return parseFloat(node.value);
|
||||
case 'ListValue':
|
||||
return node.values.map(function (v) { return valueFromNode(v, onVariable); });
|
||||
case 'ObjectValue': {
|
||||
var value = {};
|
||||
for (var _i = 0, _a = node.fields; _i < _a.length; _i++) {
|
||||
var field = _a[_i];
|
||||
value[field.name.value] = valueFromNode(field.value, onVariable);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
default:
|
||||
return node.value;
|
||||
}
|
||||
}
|
||||
exports.valueFromNode = valueFromNode;
|
||||
//# sourceMappingURL=storeUtils.js.map
|
||||
1
node_modules/apollo-utilities/lib/storeUtils.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/storeUtils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/apollo-utilities/lib/transform.d.ts
generated
vendored
Normal file
26
node_modules/apollo-utilities/lib/transform.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { DocumentNode, DirectiveNode, FragmentDefinitionNode, ArgumentNode, FragmentSpreadNode, VariableDefinitionNode } from 'graphql';
|
||||
export declare type RemoveNodeConfig<N> = {
|
||||
name?: string;
|
||||
test?: (node: N) => boolean;
|
||||
remove?: boolean;
|
||||
};
|
||||
export declare type GetNodeConfig<N> = {
|
||||
name?: string;
|
||||
test?: (node: N) => boolean;
|
||||
};
|
||||
export declare type RemoveDirectiveConfig = RemoveNodeConfig<DirectiveNode>;
|
||||
export declare type GetDirectiveConfig = GetNodeConfig<DirectiveNode>;
|
||||
export declare type RemoveArgumentsConfig = RemoveNodeConfig<ArgumentNode>;
|
||||
export declare type GetFragmentSpreadConfig = GetNodeConfig<FragmentSpreadNode>;
|
||||
export declare type RemoveFragmentSpreadConfig = RemoveNodeConfig<FragmentSpreadNode>;
|
||||
export declare type RemoveFragmentDefinitionConfig = RemoveNodeConfig<FragmentDefinitionNode>;
|
||||
export declare type RemoveVariableDefinitionConfig = RemoveNodeConfig<VariableDefinitionNode>;
|
||||
export declare function removeDirectivesFromDocument(directives: RemoveDirectiveConfig[], doc: DocumentNode): DocumentNode | null;
|
||||
export declare function addTypenameToDocument(doc: DocumentNode): DocumentNode;
|
||||
export declare function removeConnectionDirectiveFromDocument(doc: DocumentNode): DocumentNode;
|
||||
export declare function getDirectivesFromDocument(directives: GetDirectiveConfig[], doc: DocumentNode): DocumentNode;
|
||||
export declare function removeArgumentsFromDocument(config: RemoveArgumentsConfig[], doc: DocumentNode): DocumentNode;
|
||||
export declare function removeFragmentSpreadFromDocument(config: RemoveFragmentSpreadConfig[], doc: DocumentNode): DocumentNode;
|
||||
export declare function buildQueryFromSelectionSet(document: DocumentNode): DocumentNode;
|
||||
export declare function removeClientSetsFromDocument(document: DocumentNode): DocumentNode | null;
|
||||
//# sourceMappingURL=transform.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/transform.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/transform.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAgBjB,oBAAY,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,oBAAY,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;CAC7B,CAAC;AAEF,oBAAY,qBAAqB,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;AACpE,oBAAY,kBAAkB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;AAC9D,oBAAY,qBAAqB,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACnE,oBAAY,uBAAuB,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;AACxE,oBAAY,0BAA0B,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAC9E,oBAAY,8BAA8B,GAAG,gBAAgB,CAC3D,sBAAsB,CACvB,CAAC;AACF,oBAAY,8BAA8B,GAAG,gBAAgB,CAC3D,sBAAsB,CACvB,CAAC;AA0CF,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,qBAAqB,EAAE,EACnC,GAAG,EAAE,YAAY,GAChB,YAAY,GAAG,IAAI,CAiHrB;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,GAAG,YAAY,CAkDrE;AAqBD,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,YAAY,gBAKtE;AAwCD,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,kBAAkB,EAAE,EAChC,GAAG,EAAE,YAAY,GAChB,YAAY,CAqCd;AAeD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,qBAAqB,EAAE,EAC/B,GAAG,EAAE,YAAY,GAChB,YAAY,CAgDd;AAED,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,0BAA0B,EAAE,EACpC,GAAG,EAAE,YAAY,GAChB,YAAY,CAed;AA0BD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,YAAY,GACrB,YAAY,CAqBd;AAGD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,YAAY,GACrB,YAAY,GAAG,IAAI,CAoCrB"}
|
||||
311
node_modules/apollo-utilities/lib/transform.js
generated
vendored
Normal file
311
node_modules/apollo-utilities/lib/transform.js
generated
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var visitor_1 = require("graphql/language/visitor");
|
||||
var getFromAST_1 = require("./getFromAST");
|
||||
var filterInPlace_1 = require("./util/filterInPlace");
|
||||
var ts_invariant_1 = require("ts-invariant");
|
||||
var storeUtils_1 = require("./storeUtils");
|
||||
var TYPENAME_FIELD = {
|
||||
kind: 'Field',
|
||||
name: {
|
||||
kind: 'Name',
|
||||
value: '__typename',
|
||||
},
|
||||
};
|
||||
function isEmpty(op, fragments) {
|
||||
return op.selectionSet.selections.every(function (selection) {
|
||||
return selection.kind === 'FragmentSpread' &&
|
||||
isEmpty(fragments[selection.name.value], fragments);
|
||||
});
|
||||
}
|
||||
function nullIfDocIsEmpty(doc) {
|
||||
return isEmpty(getFromAST_1.getOperationDefinition(doc) || getFromAST_1.getFragmentDefinition(doc), getFromAST_1.createFragmentMap(getFromAST_1.getFragmentDefinitions(doc)))
|
||||
? null
|
||||
: doc;
|
||||
}
|
||||
function getDirectiveMatcher(directives) {
|
||||
return function directiveMatcher(directive) {
|
||||
return directives.some(function (dir) {
|
||||
return (dir.name && dir.name === directive.name.value) ||
|
||||
(dir.test && dir.test(directive));
|
||||
});
|
||||
};
|
||||
}
|
||||
function removeDirectivesFromDocument(directives, doc) {
|
||||
var variablesInUse = Object.create(null);
|
||||
var variablesToRemove = [];
|
||||
var fragmentSpreadsInUse = Object.create(null);
|
||||
var fragmentSpreadsToRemove = [];
|
||||
var modifiedDoc = nullIfDocIsEmpty(visitor_1.visit(doc, {
|
||||
Variable: {
|
||||
enter: function (node, _key, parent) {
|
||||
if (parent.kind !== 'VariableDefinition') {
|
||||
variablesInUse[node.name.value] = true;
|
||||
}
|
||||
},
|
||||
},
|
||||
Field: {
|
||||
enter: function (node) {
|
||||
if (directives && node.directives) {
|
||||
var shouldRemoveField = directives.some(function (directive) { return directive.remove; });
|
||||
if (shouldRemoveField &&
|
||||
node.directives &&
|
||||
node.directives.some(getDirectiveMatcher(directives))) {
|
||||
if (node.arguments) {
|
||||
node.arguments.forEach(function (arg) {
|
||||
if (arg.value.kind === 'Variable') {
|
||||
variablesToRemove.push({
|
||||
name: arg.value.name.value,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (node.selectionSet) {
|
||||
getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) {
|
||||
fragmentSpreadsToRemove.push({
|
||||
name: frag.name.value,
|
||||
});
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
FragmentSpread: {
|
||||
enter: function (node) {
|
||||
fragmentSpreadsInUse[node.name.value] = true;
|
||||
},
|
||||
},
|
||||
Directive: {
|
||||
enter: function (node) {
|
||||
if (getDirectiveMatcher(directives)(node)) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
},
|
||||
}));
|
||||
if (modifiedDoc &&
|
||||
filterInPlace_1.filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) {
|
||||
modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);
|
||||
}
|
||||
if (modifiedDoc &&
|
||||
filterInPlace_1.filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; })
|
||||
.length) {
|
||||
modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc);
|
||||
}
|
||||
return modifiedDoc;
|
||||
}
|
||||
exports.removeDirectivesFromDocument = removeDirectivesFromDocument;
|
||||
function addTypenameToDocument(doc) {
|
||||
return visitor_1.visit(getFromAST_1.checkDocument(doc), {
|
||||
SelectionSet: {
|
||||
enter: function (node, _key, parent) {
|
||||
if (parent &&
|
||||
parent.kind === 'OperationDefinition') {
|
||||
return;
|
||||
}
|
||||
var selections = node.selections;
|
||||
if (!selections) {
|
||||
return;
|
||||
}
|
||||
var skip = selections.some(function (selection) {
|
||||
return (storeUtils_1.isField(selection) &&
|
||||
(selection.name.value === '__typename' ||
|
||||
selection.name.value.lastIndexOf('__', 0) === 0));
|
||||
});
|
||||
if (skip) {
|
||||
return;
|
||||
}
|
||||
var field = parent;
|
||||
if (storeUtils_1.isField(field) &&
|
||||
field.directives &&
|
||||
field.directives.some(function (d) { return d.name.value === 'export'; })) {
|
||||
return;
|
||||
}
|
||||
return tslib_1.__assign(tslib_1.__assign({}, node), { selections: tslib_1.__spreadArrays(selections, [TYPENAME_FIELD]) });
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
exports.addTypenameToDocument = addTypenameToDocument;
|
||||
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'; })) {
|
||||
ts_invariant_1.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
|
||||
'You may want to use the key parameter to specify a store key.');
|
||||
}
|
||||
}
|
||||
return willRemove;
|
||||
},
|
||||
};
|
||||
function removeConnectionDirectiveFromDocument(doc) {
|
||||
return removeDirectivesFromDocument([connectionRemoveConfig], getFromAST_1.checkDocument(doc));
|
||||
}
|
||||
exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument;
|
||||
function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) {
|
||||
if (nestedCheck === void 0) { nestedCheck = true; }
|
||||
return (selectionSet &&
|
||||
selectionSet.selections &&
|
||||
selectionSet.selections.some(function (selection) {
|
||||
return hasDirectivesInSelection(directives, selection, nestedCheck);
|
||||
}));
|
||||
}
|
||||
function hasDirectivesInSelection(directives, selection, nestedCheck) {
|
||||
if (nestedCheck === void 0) { nestedCheck = true; }
|
||||
if (!storeUtils_1.isField(selection)) {
|
||||
return true;
|
||||
}
|
||||
if (!selection.directives) {
|
||||
return false;
|
||||
}
|
||||
return (selection.directives.some(getDirectiveMatcher(directives)) ||
|
||||
(nestedCheck &&
|
||||
hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck)));
|
||||
}
|
||||
function getDirectivesFromDocument(directives, doc) {
|
||||
getFromAST_1.checkDocument(doc);
|
||||
var parentPath;
|
||||
return nullIfDocIsEmpty(visitor_1.visit(doc, {
|
||||
SelectionSet: {
|
||||
enter: function (node, _key, _parent, path) {
|
||||
var currentPath = path.join('-');
|
||||
if (!parentPath ||
|
||||
currentPath === parentPath ||
|
||||
!currentPath.startsWith(parentPath)) {
|
||||
if (node.selections) {
|
||||
var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); });
|
||||
if (hasDirectivesInSelectionSet(directives, node, false)) {
|
||||
parentPath = currentPath;
|
||||
}
|
||||
return tslib_1.__assign(tslib_1.__assign({}, node), { selections: selectionsWithDirectives });
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}));
|
||||
}
|
||||
exports.getDirectivesFromDocument = getDirectivesFromDocument;
|
||||
function getArgumentMatcher(config) {
|
||||
return function argumentMatcher(argument) {
|
||||
return config.some(function (aConfig) {
|
||||
return argument.value &&
|
||||
argument.value.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(visitor_1.visit(doc, {
|
||||
OperationDefinition: {
|
||||
enter: function (node) {
|
||||
return tslib_1.__assign(tslib_1.__assign({}, 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;
|
||||
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;
|
||||
}
|
||||
},
|
||||
},
|
||||
}));
|
||||
}
|
||||
exports.removeArgumentsFromDocument = removeArgumentsFromDocument;
|
||||
function removeFragmentSpreadFromDocument(config, doc) {
|
||||
function enter(node) {
|
||||
if (config.some(function (def) { return def.name === node.name.value; })) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return nullIfDocIsEmpty(visitor_1.visit(doc, {
|
||||
FragmentSpread: { enter: enter },
|
||||
FragmentDefinition: { enter: enter },
|
||||
}));
|
||||
}
|
||||
exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument;
|
||||
function getAllFragmentSpreadsFromSelectionSet(selectionSet) {
|
||||
var allFragments = [];
|
||||
selectionSet.selections.forEach(function (selection) {
|
||||
if ((storeUtils_1.isField(selection) || storeUtils_1.isInlineFragment(selection)) &&
|
||||
selection.selectionSet) {
|
||||
getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); });
|
||||
}
|
||||
else if (selection.kind === 'FragmentSpread') {
|
||||
allFragments.push(selection);
|
||||
}
|
||||
});
|
||||
return allFragments;
|
||||
}
|
||||
function buildQueryFromSelectionSet(document) {
|
||||
var definition = getFromAST_1.getMainDefinition(document);
|
||||
var definitionOperation = definition.operation;
|
||||
if (definitionOperation === 'query') {
|
||||
return document;
|
||||
}
|
||||
var modifiedDoc = visitor_1.visit(document, {
|
||||
OperationDefinition: {
|
||||
enter: function (node) {
|
||||
return tslib_1.__assign(tslib_1.__assign({}, node), { operation: 'query' });
|
||||
},
|
||||
},
|
||||
});
|
||||
return modifiedDoc;
|
||||
}
|
||||
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
|
||||
function removeClientSetsFromDocument(document) {
|
||||
getFromAST_1.checkDocument(document);
|
||||
var modifiedDoc = removeDirectivesFromDocument([
|
||||
{
|
||||
test: function (directive) { return directive.name.value === 'client'; },
|
||||
remove: true,
|
||||
},
|
||||
], document);
|
||||
if (modifiedDoc) {
|
||||
modifiedDoc = visitor_1.visit(modifiedDoc, {
|
||||
FragmentDefinition: {
|
||||
enter: function (node) {
|
||||
if (node.selectionSet) {
|
||||
var isTypenameOnly = node.selectionSet.selections.every(function (selection) {
|
||||
return storeUtils_1.isField(selection) && selection.name.value === '__typename';
|
||||
});
|
||||
if (isTypenameOnly) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
return modifiedDoc;
|
||||
}
|
||||
exports.removeClientSetsFromDocument = removeClientSetsFromDocument;
|
||||
//# sourceMappingURL=transform.js.map
|
||||
1
node_modules/apollo-utilities/lib/transform.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/transform.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/apollo-utilities/lib/util/assign.d.ts
generated
vendored
Normal file
6
node_modules/apollo-utilities/lib/util/assign.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export declare function assign<A, B>(a: A, b: B): A & B;
|
||||
export declare function assign<A, B, C>(a: A, b: B, c: C): A & B & C;
|
||||
export declare function assign<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
|
||||
export declare function assign<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E;
|
||||
export declare function assign(target: any, ...sources: Array<any>): any;
|
||||
//# sourceMappingURL=assign.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/assign.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/assign.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assign.d.ts","sourceRoot":"","sources":["../src/util/assign.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAChD,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1E,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAClC,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACrB,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC"}
|
||||
19
node_modules/apollo-utilities/lib/util/assign.js
generated
vendored
Normal file
19
node_modules/apollo-utilities/lib/util/assign.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function assign(target) {
|
||||
var sources = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
sources[_i - 1] = arguments[_i];
|
||||
}
|
||||
sources.forEach(function (source) {
|
||||
if (typeof source === 'undefined' || source === null) {
|
||||
return;
|
||||
}
|
||||
Object.keys(source).forEach(function (key) {
|
||||
target[key] = source[key];
|
||||
});
|
||||
});
|
||||
return target;
|
||||
}
|
||||
exports.assign = assign;
|
||||
//# sourceMappingURL=assign.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/assign.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/assign.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assign.js","sourceRoot":"","sources":["../../src/util/assign.ts"],"names":[],"mappings":";;AAiBA,SAAgB,MAAM,CACpB,MAA8B;IAC9B,iBAAyC;SAAzC,UAAyC,EAAzC,qBAAyC,EAAzC,IAAyC;QAAzC,gCAAyC;;IAEzC,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM;QACpB,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,IAAI,EAAE;YACpD,OAAO;SACR;QACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC"}
|
||||
2
node_modules/apollo-utilities/lib/util/canUse.d.ts
generated
vendored
Normal file
2
node_modules/apollo-utilities/lib/util/canUse.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const canUseWeakMap: boolean;
|
||||
//# sourceMappingURL=canUse.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/canUse.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/canUse.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"canUse.d.ts","sourceRoot":"","sources":["../src/util/canUse.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,SAGzB,CAAC"}
|
||||
5
node_modules/apollo-utilities/lib/util/canUse.js
generated
vendored
Normal file
5
node_modules/apollo-utilities/lib/util/canUse.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
|
||||
navigator.product === 'ReactNative');
|
||||
//# sourceMappingURL=canUse.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/canUse.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/canUse.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../src/util/canUse.ts"],"names":[],"mappings":";;AAAa,QAAA,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,IAAI,CAAC,CAC7D,OAAO,SAAS,KAAK,QAAQ;IAC7B,SAAS,CAAC,OAAO,KAAK,aAAa,CACpC,CAAC"}
|
||||
2
node_modules/apollo-utilities/lib/util/cloneDeep.d.ts
generated
vendored
Normal file
2
node_modules/apollo-utilities/lib/util/cloneDeep.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function cloneDeep<T>(value: T): T;
|
||||
//# sourceMappingURL=cloneDeep.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cloneDeep.d.ts","sourceRoot":"","sources":["../src/util/cloneDeep.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAExC"}
|
||||
34
node_modules/apollo-utilities/lib/util/cloneDeep.js
generated
vendored
Normal file
34
node_modules/apollo-utilities/lib/util/cloneDeep.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var toString = Object.prototype.toString;
|
||||
function cloneDeep(value) {
|
||||
return cloneDeepHelper(value, new Map());
|
||||
}
|
||||
exports.cloneDeep = cloneDeep;
|
||||
function cloneDeepHelper(val, seen) {
|
||||
switch (toString.call(val)) {
|
||||
case "[object Array]": {
|
||||
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]": {
|
||||
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;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=cloneDeep.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/cloneDeep.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/cloneDeep.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cloneDeep.js","sourceRoot":"","sources":["../../src/util/cloneDeep.ts"],"names":[],"mappings":";;AAAQ,IAAA,oCAAQ,CAAsB;AAKtC,SAAgB,SAAS,CAAI,KAAQ;IACnC,OAAO,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAFD,8BAEC;AAED,SAAS,eAAe,CAAI,GAAM,EAAE,IAAmB;IACrD,QAAQ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC5B,KAAK,gBAAgB,CAAC,CAAC;YACrB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAM,MAAI,GAAe,GAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAI,CAAC,OAAO,CAAC,UAAU,KAAK,EAAE,CAAC;gBAC7B,MAAI,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED,KAAK,iBAAiB,CAAC,CAAC;YACtB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAGxC,IAAM,MAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;gBAC1B,MAAI,CAAC,GAAG,CAAC,GAAG,eAAe,CAAE,GAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED;YACE,OAAO,GAAG,CAAC;KACZ;AACH,CAAC"}
|
||||
6
node_modules/apollo-utilities/lib/util/environment.d.ts
generated
vendored
Normal file
6
node_modules/apollo-utilities/lib/util/environment.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export declare function getEnv(): string | undefined;
|
||||
export declare function isEnv(env: string): boolean;
|
||||
export declare function isProduction(): boolean;
|
||||
export declare function isDevelopment(): boolean;
|
||||
export declare function isTest(): boolean;
|
||||
//# sourceMappingURL=environment.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/environment.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/environment.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/util/environment.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAO3C;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1C;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,wBAAgB,MAAM,IAAI,OAAO,CAEhC"}
|
||||
26
node_modules/apollo-utilities/lib/util/environment.js
generated
vendored
Normal file
26
node_modules/apollo-utilities/lib/util/environment.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function getEnv() {
|
||||
if (typeof process !== 'undefined' && process.env.NODE_ENV) {
|
||||
return process.env.NODE_ENV;
|
||||
}
|
||||
return 'development';
|
||||
}
|
||||
exports.getEnv = getEnv;
|
||||
function isEnv(env) {
|
||||
return getEnv() === env;
|
||||
}
|
||||
exports.isEnv = isEnv;
|
||||
function isProduction() {
|
||||
return isEnv('production') === true;
|
||||
}
|
||||
exports.isProduction = isProduction;
|
||||
function isDevelopment() {
|
||||
return isEnv('development') === true;
|
||||
}
|
||||
exports.isDevelopment = isDevelopment;
|
||||
function isTest() {
|
||||
return isEnv('test') === true;
|
||||
}
|
||||
exports.isTest = isTest;
|
||||
//# sourceMappingURL=environment.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/environment.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/environment.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/util/environment.ts"],"names":[],"mappings":";;AAAA,SAAgB,MAAM;IACpB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;QAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;KAC7B;IAGD,OAAO,aAAa,CAAC;AACvB,CAAC;AAPD,wBAOC;AAED,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,MAAM,EAAE,KAAK,GAAG,CAAC;AAC1B,CAAC;AAFD,sBAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AACtC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAFD,sCAEC;AAED,SAAgB,MAAM;IACpB,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAChC,CAAC;AAFD,wBAEC"}
|
||||
4
node_modules/apollo-utilities/lib/util/errorHandling.d.ts
generated
vendored
Normal file
4
node_modules/apollo-utilities/lib/util/errorHandling.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { ExecutionResult } from 'graphql';
|
||||
export declare function tryFunctionOrLogError(f: Function): any;
|
||||
export declare function graphQLResultHasError(result: ExecutionResult): number;
|
||||
//# sourceMappingURL=errorHandling.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errorHandling.d.ts","sourceRoot":"","sources":["../src/util/errorHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,OAQhD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,UAE5D"}
|
||||
18
node_modules/apollo-utilities/lib/util/errorHandling.js
generated
vendored
Normal file
18
node_modules/apollo-utilities/lib/util/errorHandling.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function tryFunctionOrLogError(f) {
|
||||
try {
|
||||
return f();
|
||||
}
|
||||
catch (e) {
|
||||
if (console.error) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.tryFunctionOrLogError = tryFunctionOrLogError;
|
||||
function graphQLResultHasError(result) {
|
||||
return result.errors && result.errors.length;
|
||||
}
|
||||
exports.graphQLResultHasError = graphQLResultHasError;
|
||||
//# sourceMappingURL=errorHandling.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/errorHandling.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/errorHandling.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../src/util/errorHandling.ts"],"names":[],"mappings":";;AAEA,SAAgB,qBAAqB,CAAC,CAAW;IAC/C,IAAI;QACF,OAAO,CAAC,EAAE,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClB;KACF;AACH,CAAC;AARD,sDAQC;AAED,SAAgB,qBAAqB,CAAC,MAAuB;IAC3D,OAAO,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC/C,CAAC;AAFD,sDAEC"}
|
||||
2
node_modules/apollo-utilities/lib/util/filterInPlace.d.ts
generated
vendored
Normal file
2
node_modules/apollo-utilities/lib/util/filterInPlace.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function filterInPlace<T>(array: T[], test: (elem: T) => boolean, context?: any): T[];
|
||||
//# sourceMappingURL=filterInPlace.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"filterInPlace.d.ts","sourceRoot":"","sources":["../src/util/filterInPlace.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EAC1B,OAAO,CAAC,EAAE,GAAG,GACZ,CAAC,EAAE,CASL"}
|
||||
14
node_modules/apollo-utilities/lib/util/filterInPlace.js
generated
vendored
Normal file
14
node_modules/apollo-utilities/lib/util/filterInPlace.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function filterInPlace(array, test, context) {
|
||||
var target = 0;
|
||||
array.forEach(function (elem, i) {
|
||||
if (test.call(this, elem, i, array)) {
|
||||
array[target++] = elem;
|
||||
}
|
||||
}, context);
|
||||
array.length = target;
|
||||
return array;
|
||||
}
|
||||
exports.filterInPlace = filterInPlace;
|
||||
//# sourceMappingURL=filterInPlace.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/filterInPlace.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/filterInPlace.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"filterInPlace.js","sourceRoot":"","sources":["../../src/util/filterInPlace.ts"],"names":[],"mappings":";;AAAA,SAAgB,aAAa,CAC3B,KAAU,EACV,IAA0B,EAC1B,OAAa;IAEb,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE;YACnC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;SACxB;IACH,CAAC,EAAE,OAAO,CAAC,CAAC;IACZ,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,sCAaC"}
|
||||
2
node_modules/apollo-utilities/lib/util/isEqual.d.ts
generated
vendored
Normal file
2
node_modules/apollo-utilities/lib/util/isEqual.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { equal as isEqual } from '@wry/equality';
|
||||
//# sourceMappingURL=isEqual.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/isEqual.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/isEqual.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isEqual.d.ts","sourceRoot":"","sources":["../src/util/isEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
||||
5
node_modules/apollo-utilities/lib/util/isEqual.js
generated
vendored
Normal file
5
node_modules/apollo-utilities/lib/util/isEqual.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var equality_1 = require("@wry/equality");
|
||||
exports.isEqual = equality_1.equal;
|
||||
//# sourceMappingURL=isEqual.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/isEqual.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/isEqual.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isEqual.js","sourceRoot":"","sources":["../../src/util/isEqual.ts"],"names":[],"mappings":";;AAAA,0CAAiD;AAAxC,6BAAA,KAAK,CAAW"}
|
||||
2
node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts
generated
vendored
Normal file
2
node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function maybeDeepFreeze(obj: any): any;
|
||||
//# sourceMappingURL=maybeDeepFreeze.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"maybeDeepFreeze.d.ts","sourceRoot":"","sources":["../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,OAYvC"}
|
||||
25
node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js
generated
vendored
Normal file
25
node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var environment_1 = require("./environment");
|
||||
function deepFreeze(o) {
|
||||
Object.freeze(o);
|
||||
Object.getOwnPropertyNames(o).forEach(function (prop) {
|
||||
if (o[prop] !== null &&
|
||||
(typeof o[prop] === 'object' || typeof o[prop] === 'function') &&
|
||||
!Object.isFrozen(o[prop])) {
|
||||
deepFreeze(o[prop]);
|
||||
}
|
||||
});
|
||||
return o;
|
||||
}
|
||||
function maybeDeepFreeze(obj) {
|
||||
if (environment_1.isDevelopment() || environment_1.isTest()) {
|
||||
var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string';
|
||||
if (!symbolIsPolyfilled) {
|
||||
return deepFreeze(obj);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
exports.maybeDeepFreeze = maybeDeepFreeze;
|
||||
//# sourceMappingURL=maybeDeepFreeze.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"maybeDeepFreeze.js","sourceRoot":"","sources":["../../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AAItD,SAAS,UAAU,CAAC,CAAM;IACxB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEjB,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;QACjD,IACE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI;YAChB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;YAC9D,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EACzB;YACA,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,eAAe,CAAC,GAAQ;IACtC,IAAI,2BAAa,EAAE,IAAI,oBAAM,EAAE,EAAE;QAG/B,IAAM,kBAAkB,GACtB,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC;QAEjE,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;SACxB;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAZD,0CAYC"}
|
||||
4
node_modules/apollo-utilities/lib/util/mergeDeep.d.ts
generated
vendored
Normal file
4
node_modules/apollo-utilities/lib/util/mergeDeep.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare type TupleToIntersection<T extends any[]> = T extends [infer A] ? A : T extends [infer A, infer B] ? A & B : T extends [infer A, infer B, infer C] ? A & B & C : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : T extends (infer U)[] ? U : any;
|
||||
export declare function mergeDeep<T extends any[]>(...sources: T): TupleToIntersection<T>;
|
||||
export declare function mergeDeepArray<T>(sources: T[]): T;
|
||||
//# sourceMappingURL=mergeDeep.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mergeDeep.d.ts","sourceRoot":"","sources":["../src/util/mergeDeep.ts"],"names":[],"mappings":"AAgBA,oBAAY,mBAAmB,CAAC,CAAC,SAAS,GAAG,EAAE,IAC7C,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GACvB,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GACpC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GACjD,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC9D,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC3E,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;AAElC,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EACvC,GAAG,OAAO,EAAE,CAAC,GACZ,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAQD,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAWjD"}
|
||||
64
node_modules/apollo-utilities/lib/util/mergeDeep.js
generated
vendored
Normal file
64
node_modules/apollo-utilities/lib/util/mergeDeep.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
function mergeDeep() {
|
||||
var sources = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
sources[_i] = arguments[_i];
|
||||
}
|
||||
return mergeDeepArray(sources);
|
||||
}
|
||||
exports.mergeDeep = mergeDeep;
|
||||
function mergeDeepArray(sources) {
|
||||
var target = sources[0] || {};
|
||||
var count = sources.length;
|
||||
if (count > 1) {
|
||||
var pastCopies = [];
|
||||
target = shallowCopyForMerge(target, pastCopies);
|
||||
for (var i = 1; i < count; ++i) {
|
||||
target = mergeHelper(target, sources[i], pastCopies);
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
exports.mergeDeepArray = mergeDeepArray;
|
||||
function isObject(obj) {
|
||||
return obj !== null && typeof obj === 'object';
|
||||
}
|
||||
function mergeHelper(target, source, pastCopies) {
|
||||
if (isObject(source) && isObject(target)) {
|
||||
if (Object.isExtensible && !Object.isExtensible(target)) {
|
||||
target = shallowCopyForMerge(target, pastCopies);
|
||||
}
|
||||
Object.keys(source).forEach(function (sourceKey) {
|
||||
var sourceValue = source[sourceKey];
|
||||
if (hasOwnProperty.call(target, sourceKey)) {
|
||||
var targetValue = target[sourceKey];
|
||||
if (sourceValue !== targetValue) {
|
||||
target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies);
|
||||
}
|
||||
}
|
||||
else {
|
||||
target[sourceKey] = sourceValue;
|
||||
}
|
||||
});
|
||||
return target;
|
||||
}
|
||||
return source;
|
||||
}
|
||||
function shallowCopyForMerge(value, pastCopies) {
|
||||
if (value !== null &&
|
||||
typeof value === 'object' &&
|
||||
pastCopies.indexOf(value) < 0) {
|
||||
if (Array.isArray(value)) {
|
||||
value = value.slice(0);
|
||||
}
|
||||
else {
|
||||
value = tslib_1.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
||||
}
|
||||
pastCopies.push(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
//# sourceMappingURL=mergeDeep.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/mergeDeep.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/mergeDeep.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mergeDeep.js","sourceRoot":"","sources":["../../src/util/mergeDeep.ts"],"names":[],"mappings":";;;AAAQ,IAAA,gDAAc,CAAsB;AAwB5C,SAAgB,SAAS;IACvB,iBAAa;SAAb,UAAa,EAAb,qBAAa,EAAb,IAAa;QAAb,4BAAa;;IAEb,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAJD,8BAIC;AAQD,SAAgB,cAAc,CAAI,OAAY;IAC5C,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAO,CAAC;IACnC,IAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAC7B,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,IAAM,UAAU,GAAU,EAAE,CAAC;QAC7B,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE;YAC9B,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;SACtD;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,wCAWC;AAED,SAAS,QAAQ,CAAC,GAAQ;IACxB,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC;AACjD,CAAC;AAED,SAAS,WAAW,CAClB,MAAW,EACX,MAAW,EACX,UAAiB;IAEjB,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;QAGxC,IAAI,MAAM,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;YACvD,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;SAClD;QAED,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,SAAS;YACnC,IAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE;gBAC1C,IAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;gBACtC,IAAI,WAAW,KAAK,WAAW,EAAE;oBAQ/B,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAC7B,mBAAmB,CAAC,WAAW,EAAE,UAAU,CAAC,EAC5C,WAAW,EACX,UAAU,CACX,CAAC;iBACH;aACF;iBAAM;gBAGL,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;KACf;IAGD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAI,KAAQ,EAAE,UAAiB;IACzD,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAC7B;QACA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,GAAI,KAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjC;aAAM;YACL,KAAK,sBACH,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IACpC,KAAK,CACT,CAAC;SACH;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACxB;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
||||
2
node_modules/apollo-utilities/lib/util/stripSymbols.d.ts
generated
vendored
Normal file
2
node_modules/apollo-utilities/lib/util/stripSymbols.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function stripSymbols<T>(data: T): T;
|
||||
//# sourceMappingURL=stripSymbols.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stripSymbols.d.ts","sourceRoot":"","sources":["../src/util/stripSymbols.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAE1C"}
|
||||
7
node_modules/apollo-utilities/lib/util/stripSymbols.js
generated
vendored
Normal file
7
node_modules/apollo-utilities/lib/util/stripSymbols.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function stripSymbols(data) {
|
||||
return JSON.parse(JSON.stringify(data));
|
||||
}
|
||||
exports.stripSymbols = stripSymbols;
|
||||
//# sourceMappingURL=stripSymbols.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/stripSymbols.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/stripSymbols.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stripSymbols.js","sourceRoot":"","sources":["../../src/util/stripSymbols.ts"],"names":[],"mappings":";;AAWA,SAAgB,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC;AAFD,oCAEC"}
|
||||
2
node_modules/apollo-utilities/lib/util/warnOnce.d.ts
generated
vendored
Normal file
2
node_modules/apollo-utilities/lib/util/warnOnce.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function warnOnceInDevelopment(msg: string, type?: string): void;
|
||||
//# sourceMappingURL=warnOnce.d.ts.map
|
||||
1
node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"warnOnce.d.ts","sourceRoot":"","sources":["../src/util/warnOnce.ts"],"names":[],"mappings":"AAYA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAS,QAW/D"}
|
||||
20
node_modules/apollo-utilities/lib/util/warnOnce.js
generated
vendored
Normal file
20
node_modules/apollo-utilities/lib/util/warnOnce.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var environment_1 = require("./environment");
|
||||
var haveWarned = Object.create({});
|
||||
function warnOnceInDevelopment(msg, type) {
|
||||
if (type === void 0) { type = 'warn'; }
|
||||
if (!environment_1.isProduction() && !haveWarned[msg]) {
|
||||
if (!environment_1.isTest()) {
|
||||
haveWarned[msg] = true;
|
||||
}
|
||||
if (type === 'error') {
|
||||
console.error(msg);
|
||||
}
|
||||
else {
|
||||
console.warn(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.warnOnceInDevelopment = warnOnceInDevelopment;
|
||||
//# sourceMappingURL=warnOnce.js.map
|
||||
1
node_modules/apollo-utilities/lib/util/warnOnce.js.map
generated
vendored
Normal file
1
node_modules/apollo-utilities/lib/util/warnOnce.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"warnOnce.js","sourceRoot":"","sources":["../../src/util/warnOnce.ts"],"names":[],"mappings":";;AAAA,6CAAqD;AAErD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAUrC,SAAgB,qBAAqB,CAAC,GAAW,EAAE,IAAa;IAAb,qBAAA,EAAA,aAAa;IAC9D,IAAI,CAAC,0BAAY,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvC,IAAI,CAAC,oBAAM,EAAE,EAAE;YACb,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;AACH,CAAC;AAXD,sDAWC"}
|
||||
15
node_modules/apollo-utilities/node_modules/tslib/CopyrightNotice.txt
generated
vendored
Normal file
15
node_modules/apollo-utilities/node_modules/tslib/CopyrightNotice.txt
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
12
node_modules/apollo-utilities/node_modules/tslib/LICENSE.txt
generated
vendored
Normal file
12
node_modules/apollo-utilities/node_modules/tslib/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
142
node_modules/apollo-utilities/node_modules/tslib/README.md
generated
vendored
Normal file
142
node_modules/apollo-utilities/node_modules/tslib/README.md
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
# tslib
|
||||
|
||||
This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
|
||||
|
||||
This library is primarily used by the `--importHelpers` flag in TypeScript.
|
||||
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
|
||||
|
||||
```ts
|
||||
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.x = {};
|
||||
exports.y = __assign({}, exports.x);
|
||||
|
||||
```
|
||||
|
||||
will instead be emitted as something like the following:
|
||||
|
||||
```ts
|
||||
var tslib_1 = require("tslib");
|
||||
exports.x = {};
|
||||
exports.y = tslib_1.__assign({}, exports.x);
|
||||
```
|
||||
|
||||
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
|
||||
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
|
||||
|
||||
# Installing
|
||||
|
||||
For the latest stable version, run:
|
||||
|
||||
## npm
|
||||
|
||||
```sh
|
||||
# TypeScript 2.3.3 or later
|
||||
npm install tslib
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
npm install tslib@1.6.1
|
||||
```
|
||||
|
||||
## yarn
|
||||
|
||||
```sh
|
||||
# TypeScript 2.3.3 or later
|
||||
yarn add tslib
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
yarn add tslib@1.6.1
|
||||
```
|
||||
|
||||
## bower
|
||||
|
||||
```sh
|
||||
# TypeScript 2.3.3 or later
|
||||
bower install tslib
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
bower install tslib@1.6.1
|
||||
```
|
||||
|
||||
## JSPM
|
||||
|
||||
```sh
|
||||
# TypeScript 2.3.3 or later
|
||||
jspm install tslib
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
jspm install tslib@1.6.1
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
Set the `importHelpers` compiler option on the command line:
|
||||
|
||||
```
|
||||
tsc --importHelpers file.ts
|
||||
```
|
||||
|
||||
or in your tsconfig.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"importHelpers": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### For bower and JSPM users
|
||||
|
||||
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"importHelpers": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"tslib" : ["bower_components/tslib/tslib.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For JSPM users:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "system",
|
||||
"importHelpers": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"tslib" : ["jspm_packages/npm/tslib@1.[version].0/tslib.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# Contribute
|
||||
|
||||
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
|
||||
|
||||
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
|
||||
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
|
||||
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
|
||||
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
|
||||
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
||||
|
||||
# Documentation
|
||||
|
||||
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
|
||||
* [Programming handbook](http://www.typescriptlang.org/Handbook)
|
||||
* [Homepage](http://www.typescriptlang.org/)
|
||||
51
node_modules/apollo-utilities/node_modules/tslib/modules/index.js
generated
vendored
Normal file
51
node_modules/apollo-utilities/node_modules/tslib/modules/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import tslib from '../tslib.js';
|
||||
const {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
} = tslib;
|
||||
export {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
};
|
||||
3
node_modules/apollo-utilities/node_modules/tslib/modules/package.json
generated
vendored
Normal file
3
node_modules/apollo-utilities/node_modules/tslib/modules/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
37
node_modules/apollo-utilities/node_modules/tslib/package.json
generated
vendored
Normal file
37
node_modules/apollo-utilities/node_modules/tslib/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "tslib",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "https://www.typescriptlang.org/",
|
||||
"version": "1.14.1",
|
||||
"license": "0BSD",
|
||||
"description": "Runtime library for TypeScript helper functions",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Microsoft",
|
||||
"compiler",
|
||||
"language",
|
||||
"javascript",
|
||||
"tslib",
|
||||
"runtime"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/TypeScript/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/tslib.git"
|
||||
},
|
||||
"main": "tslib.js",
|
||||
"module": "tslib.es6.js",
|
||||
"jsnext:main": "tslib.es6.js",
|
||||
"typings": "tslib.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"module": "./tslib.es6.js",
|
||||
"import": "./modules/index.js",
|
||||
"default": "./tslib.js"
|
||||
},
|
||||
"./": "./"
|
||||
}
|
||||
}
|
||||
23
node_modules/apollo-utilities/node_modules/tslib/test/validateModuleExportsMatchCommonJS/index.js
generated
vendored
Normal file
23
node_modules/apollo-utilities/node_modules/tslib/test/validateModuleExportsMatchCommonJS/index.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// When on node 14, it validates that all of the commonjs exports
|
||||
// are correctly re-exported for es modules importers.
|
||||
|
||||
const nodeMajor = Number(process.version.split(".")[0].slice(1))
|
||||
if (nodeMajor < 14) {
|
||||
console.log("Skipping because node does not support module exports.")
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
// ES Modules import via the ./modules folder
|
||||
import * as esTSLib from "../../modules/index.js"
|
||||
|
||||
// Force a commonjs resolve
|
||||
import { createRequire } from "module";
|
||||
const commonJSTSLib = createRequire(import.meta.url)("../../tslib.js");
|
||||
|
||||
for (const key in commonJSTSLib) {
|
||||
if (commonJSTSLib.hasOwnProperty(key)) {
|
||||
if(!esTSLib[key]) throw new Error(`ESModules is missing ${key} - it needs to be re-exported in ./modules/index.js`)
|
||||
}
|
||||
}
|
||||
|
||||
console.log("All exports in commonjs are available for es module consumers.")
|
||||
6
node_modules/apollo-utilities/node_modules/tslib/test/validateModuleExportsMatchCommonJS/package.json
generated
vendored
Normal file
6
node_modules/apollo-utilities/node_modules/tslib/test/validateModuleExportsMatchCommonJS/package.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "node index.js"
|
||||
}
|
||||
}
|
||||
37
node_modules/apollo-utilities/node_modules/tslib/tslib.d.ts
generated
vendored
Normal file
37
node_modules/apollo-utilities/node_modules/tslib/tslib.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
export declare function __generator(thisArg: any, body: Function): any;
|
||||
export declare function __exportStar(m: any, exports: any): void;
|
||||
export declare function __values(o: any): any;
|
||||
export declare function __read(o: any, n?: number): any[];
|
||||
export declare function __spread(...args: any[][]): any[];
|
||||
export declare function __spreadArrays(...args: any[][]): any[];
|
||||
export declare function __await(v: any): any;
|
||||
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
|
||||
export declare function __asyncDelegator(o: any): any;
|
||||
export declare function __asyncValues(o: any): any;
|
||||
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
|
||||
export declare function __importStar<T>(mod: T): T;
|
||||
export declare function __importDefault<T>(mod: T): T | { default: T };
|
||||
export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V;
|
||||
export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V;
|
||||
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;
|
||||
1
node_modules/apollo-utilities/node_modules/tslib/tslib.es6.html
generated
vendored
Normal file
1
node_modules/apollo-utilities/node_modules/tslib/tslib.es6.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<script src="tslib.es6.js"></script>
|
||||
218
node_modules/apollo-utilities/node_modules/tslib/tslib.es6.js
generated
vendored
Normal file
218
node_modules/apollo-utilities/node_modules/tslib/tslib.es6.js
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
export function __extends(d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
export var __assign = function() {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return __assign.apply(this, arguments);
|
||||
}
|
||||
|
||||
export function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
export function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
export function __param(paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
}
|
||||
|
||||
export function __metadata(metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
}
|
||||
|
||||
export function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
export function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
export function __createBinding(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}
|
||||
|
||||
export function __exportStar(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
|
||||
export function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
export function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
export function __spread() {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
}
|
||||
|
||||
export function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
export function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
export function __asyncGenerator(thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
}
|
||||
|
||||
export function __asyncDelegator(o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
}
|
||||
|
||||
export function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
export function __makeTemplateObject(cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
export function __importStar(mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result.default = mod;
|
||||
return result;
|
||||
}
|
||||
|
||||
export function __importDefault(mod) {
|
||||
return (mod && mod.__esModule) ? mod : { default: mod };
|
||||
}
|
||||
|
||||
export function __classPrivateFieldGet(receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
}
|
||||
|
||||
export function __classPrivateFieldSet(receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
}
|
||||
1
node_modules/apollo-utilities/node_modules/tslib/tslib.html
generated
vendored
Normal file
1
node_modules/apollo-utilities/node_modules/tslib/tslib.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<script src="tslib.js"></script>
|
||||
284
node_modules/apollo-utilities/node_modules/tslib/tslib.js
generated
vendored
Normal file
284
node_modules/apollo-utilities/node_modules/tslib/tslib.js
generated
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if (typeof module === "object" && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__createBinding = function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
};
|
||||
|
||||
__exportStar = function (m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
};
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
48
node_modules/apollo-utilities/package.json
generated
vendored
Normal file
48
node_modules/apollo-utilities/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "apollo-utilities",
|
||||
"version": "1.3.4",
|
||||
"description": "Utilities for working with GraphQL ASTs",
|
||||
"author": "James Baxley <james@meteor.com>",
|
||||
"contributors": [
|
||||
"James Baxley <james@meteor.com>",
|
||||
"Jonas Helfer <jonas@helfer.email>",
|
||||
"Sashko Stubailo <sashko@stubailo.com>",
|
||||
"James Burgess <jamesmillerburgess@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/bundle.cjs.js",
|
||||
"module": "./lib/bundle.esm.js",
|
||||
"typings": "./lib/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/apollographql/apollo-client.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-client/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-client#readme",
|
||||
"scripts": {
|
||||
"prepare": "npm run lint && npm run build",
|
||||
"test": "tsc -p tsconfig.json --noEmit && jest",
|
||||
"coverage": "jest --coverage",
|
||||
"lint": "tslint -c \"../../config/tslint.json\" -p tsconfig.json src/*.ts",
|
||||
"prebuild": "npm run clean",
|
||||
"build": "tsc -b .",
|
||||
"postbuild": "npm run bundle",
|
||||
"bundle": "npx rollup -c rollup.config.js",
|
||||
"watch": "../../node_modules/tsc-watch/index.js --onSuccess \"npm run postbuild\"",
|
||||
"clean": "rm -rf coverage/* lib/*",
|
||||
"prepublishOnly": "npm run clean && npm run build"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wry/equality": "^0.1.2",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"ts-invariant": "^0.4.0",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"gitHead": "d22394c419ff7d678afb5e7d4cd1df16ed803ead"
|
||||
}
|
||||
274
node_modules/apollo-utilities/src/__tests__/directives.ts
generated
vendored
Normal file
274
node_modules/apollo-utilities/src/__tests__/directives.ts
generated
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
import gql from 'graphql-tag';
|
||||
import { cloneDeep } from 'lodash';
|
||||
|
||||
import { shouldInclude, hasDirectives } from '../directives';
|
||||
import { getQueryDefinition } from '../getFromAST';
|
||||
|
||||
describe('hasDirective', () => {
|
||||
it('should allow searching the ast for a directive', () => {
|
||||
const query = gql`
|
||||
query Simple {
|
||||
field @live
|
||||
}
|
||||
`;
|
||||
expect(hasDirectives(['live'], query)).toBe(true);
|
||||
expect(hasDirectives(['defer'], query)).toBe(false);
|
||||
});
|
||||
it('works for all operation types', () => {
|
||||
const query = gql`
|
||||
{
|
||||
field @live {
|
||||
subField {
|
||||
hello @live
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const mutation = gql`
|
||||
mutation Directive {
|
||||
mutate {
|
||||
field {
|
||||
subField {
|
||||
hello @live
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const subscription = gql`
|
||||
subscription LiveDirective {
|
||||
sub {
|
||||
field {
|
||||
subField {
|
||||
hello @live
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
[query, mutation, subscription].forEach(x => {
|
||||
expect(hasDirectives(['live'], x)).toBe(true);
|
||||
expect(hasDirectives(['defer'], x)).toBe(false);
|
||||
});
|
||||
});
|
||||
it('works for simple fragments', () => {
|
||||
const query = gql`
|
||||
query Simple {
|
||||
...fieldFragment
|
||||
}
|
||||
|
||||
fragment fieldFragment on Field {
|
||||
foo @live
|
||||
}
|
||||
`;
|
||||
expect(hasDirectives(['live'], query)).toBe(true);
|
||||
expect(hasDirectives(['defer'], query)).toBe(false);
|
||||
});
|
||||
it('works for nested fragments', () => {
|
||||
const query = gql`
|
||||
query Simple {
|
||||
...fieldFragment1
|
||||
}
|
||||
|
||||
fragment fieldFragment1 on Field {
|
||||
bar {
|
||||
baz {
|
||||
...nestedFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment nestedFragment on Field {
|
||||
foo @live
|
||||
}
|
||||
`;
|
||||
expect(hasDirectives(['live'], query)).toBe(true);
|
||||
expect(hasDirectives(['defer'], query)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('shouldInclude', () => {
|
||||
it('should should not include a skipped field', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @skip(if: true)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(!shouldInclude(field, {})).toBe(true);
|
||||
});
|
||||
|
||||
it('should include an included field', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @include(if: true)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(shouldInclude(field, {})).toBe(true);
|
||||
});
|
||||
|
||||
it('should not include a not include: false field', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @include(if: false)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(!shouldInclude(field, {})).toBe(true);
|
||||
});
|
||||
|
||||
it('should include a skip: false field', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @skip(if: false)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(shouldInclude(field, {})).toBe(true);
|
||||
});
|
||||
|
||||
it('should not include a field if skip: true and include: true', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @skip(if: true) @include(if: true)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(!shouldInclude(field, {})).toBe(true);
|
||||
});
|
||||
|
||||
it('should not include a field if skip: true and include: false', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @skip(if: true) @include(if: false)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(!shouldInclude(field, {})).toBe(true);
|
||||
});
|
||||
|
||||
it('should include a field if skip: false and include: true', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @skip(if: false) @include(if: true)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(shouldInclude(field, {})).toBe(true);
|
||||
});
|
||||
|
||||
it('should not include a field if skip: false and include: false', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @skip(if: false) @include(if: false)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(!shouldInclude(field, {})).toBe(true);
|
||||
});
|
||||
|
||||
it('should leave the original query unmodified', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @skip(if: false) @include(if: false)
|
||||
}
|
||||
`;
|
||||
const queryClone = cloneDeep(query);
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
shouldInclude(field, {});
|
||||
expect(query).toEqual(queryClone);
|
||||
});
|
||||
|
||||
it('does not throw an error on an unsupported directive', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @dosomething(if: true)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
|
||||
expect(() => {
|
||||
shouldInclude(field, {});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('throws an error on an invalid argument for the skip directive', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @skip(nothing: true)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
|
||||
expect(() => {
|
||||
shouldInclude(field, {});
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
it('throws an error on an invalid argument for the include directive', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @include(nothing: true)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
|
||||
expect(() => {
|
||||
shouldInclude(field, {});
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
it('throws an error on an invalid variable name within a directive argument', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @include(if: $neverDefined)
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(() => {
|
||||
shouldInclude(field, {});
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
it('evaluates variables on skip fields', () => {
|
||||
const query = gql`
|
||||
query($shouldSkip: Boolean) {
|
||||
fortuneCookie @skip(if: $shouldSkip)
|
||||
}
|
||||
`;
|
||||
const variables = {
|
||||
shouldSkip: true,
|
||||
};
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(!shouldInclude(field, variables)).toBe(true);
|
||||
});
|
||||
|
||||
it('evaluates variables on include fields', () => {
|
||||
const query = gql`
|
||||
query($shouldSkip: Boolean) {
|
||||
fortuneCookie @include(if: $shouldInclude)
|
||||
}
|
||||
`;
|
||||
const variables = {
|
||||
shouldInclude: false,
|
||||
};
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(!shouldInclude(field, variables)).toBe(true);
|
||||
});
|
||||
|
||||
it('throws an error if the value of the argument is not a variable or boolean', () => {
|
||||
const query = gql`
|
||||
query {
|
||||
fortuneCookie @include(if: "string")
|
||||
}
|
||||
`;
|
||||
const field = getQueryDefinition(query).selectionSet.selections[0];
|
||||
expect(() => {
|
||||
shouldInclude(field, {});
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
327
node_modules/apollo-utilities/src/__tests__/fragments.ts
generated
vendored
Normal file
327
node_modules/apollo-utilities/src/__tests__/fragments.ts
generated
vendored
Normal file
@@ -0,0 +1,327 @@
|
||||
import { print } from 'graphql/language/printer';
|
||||
import gql from 'graphql-tag';
|
||||
import { disableFragmentWarnings } from 'graphql-tag';
|
||||
|
||||
// Turn off warnings for repeated fragment names
|
||||
disableFragmentWarnings();
|
||||
|
||||
import { getFragmentQueryDocument } from '../fragments';
|
||||
|
||||
describe('getFragmentQueryDocument', () => {
|
||||
it('will throw an error if there is an operation', () => {
|
||||
expect(() =>
|
||||
getFragmentQueryDocument(
|
||||
gql`
|
||||
{
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
`,
|
||||
),
|
||||
).toThrowError(
|
||||
'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.',
|
||||
);
|
||||
expect(() =>
|
||||
getFragmentQueryDocument(
|
||||
gql`
|
||||
query {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
`,
|
||||
),
|
||||
).toThrowError(
|
||||
'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.',
|
||||
);
|
||||
expect(() =>
|
||||
getFragmentQueryDocument(
|
||||
gql`
|
||||
query Named {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
`,
|
||||
),
|
||||
).toThrowError(
|
||||
"Found a query operation named 'Named'. No operations are allowed when using a fragment as a query. Only fragments are allowed.",
|
||||
);
|
||||
expect(() =>
|
||||
getFragmentQueryDocument(
|
||||
gql`
|
||||
mutation Named {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
`,
|
||||
),
|
||||
).toThrowError(
|
||||
"Found a mutation operation named 'Named'. No operations are allowed when using a fragment as a query. " +
|
||||
'Only fragments are allowed.',
|
||||
);
|
||||
expect(() =>
|
||||
getFragmentQueryDocument(
|
||||
gql`
|
||||
subscription Named {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
`,
|
||||
),
|
||||
).toThrowError(
|
||||
"Found a subscription operation named 'Named'. No operations are allowed when using a fragment as a query. " +
|
||||
'Only fragments are allowed.',
|
||||
);
|
||||
});
|
||||
|
||||
it('will throw an error if there is not exactly one fragment but no `fragmentName`', () => {
|
||||
expect(() => {
|
||||
getFragmentQueryDocument(gql`
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
|
||||
fragment bar on Bar {
|
||||
d
|
||||
e
|
||||
f
|
||||
}
|
||||
`);
|
||||
}).toThrowError(
|
||||
'Found 2 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.',
|
||||
);
|
||||
expect(() => {
|
||||
getFragmentQueryDocument(gql`
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
|
||||
fragment bar on Bar {
|
||||
d
|
||||
e
|
||||
f
|
||||
}
|
||||
|
||||
fragment baz on Baz {
|
||||
g
|
||||
h
|
||||
i
|
||||
}
|
||||
`);
|
||||
}).toThrowError(
|
||||
'Found 3 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.',
|
||||
);
|
||||
expect(() => {
|
||||
getFragmentQueryDocument(gql`
|
||||
scalar Foo
|
||||
`);
|
||||
}).toThrowError(
|
||||
'Found 0 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.',
|
||||
);
|
||||
});
|
||||
|
||||
it('will create a query document where the single fragment is spread in the root query', () => {
|
||||
expect(
|
||||
print(
|
||||
getFragmentQueryDocument(gql`
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
`),
|
||||
),
|
||||
).toEqual(
|
||||
print(gql`
|
||||
{
|
||||
...foo
|
||||
}
|
||||
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
`),
|
||||
);
|
||||
});
|
||||
|
||||
it('will create a query document where the named fragment is spread in the root query', () => {
|
||||
expect(
|
||||
print(
|
||||
getFragmentQueryDocument(
|
||||
gql`
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
|
||||
fragment bar on Bar {
|
||||
d
|
||||
e
|
||||
f
|
||||
...foo
|
||||
}
|
||||
|
||||
fragment baz on Baz {
|
||||
g
|
||||
h
|
||||
i
|
||||
...foo
|
||||
...bar
|
||||
}
|
||||
`,
|
||||
'foo',
|
||||
),
|
||||
),
|
||||
).toEqual(
|
||||
print(gql`
|
||||
{
|
||||
...foo
|
||||
}
|
||||
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
|
||||
fragment bar on Bar {
|
||||
d
|
||||
e
|
||||
f
|
||||
...foo
|
||||
}
|
||||
|
||||
fragment baz on Baz {
|
||||
g
|
||||
h
|
||||
i
|
||||
...foo
|
||||
...bar
|
||||
}
|
||||
`),
|
||||
);
|
||||
expect(
|
||||
print(
|
||||
getFragmentQueryDocument(
|
||||
gql`
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
|
||||
fragment bar on Bar {
|
||||
d
|
||||
e
|
||||
f
|
||||
...foo
|
||||
}
|
||||
|
||||
fragment baz on Baz {
|
||||
g
|
||||
h
|
||||
i
|
||||
...foo
|
||||
...bar
|
||||
}
|
||||
`,
|
||||
'bar',
|
||||
),
|
||||
),
|
||||
).toEqual(
|
||||
print(gql`
|
||||
{
|
||||
...bar
|
||||
}
|
||||
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
|
||||
fragment bar on Bar {
|
||||
d
|
||||
e
|
||||
f
|
||||
...foo
|
||||
}
|
||||
|
||||
fragment baz on Baz {
|
||||
g
|
||||
h
|
||||
i
|
||||
...foo
|
||||
...bar
|
||||
}
|
||||
`),
|
||||
);
|
||||
expect(
|
||||
print(
|
||||
getFragmentQueryDocument(
|
||||
gql`
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
|
||||
fragment bar on Bar {
|
||||
d
|
||||
e
|
||||
f
|
||||
...foo
|
||||
}
|
||||
|
||||
fragment baz on Baz {
|
||||
g
|
||||
h
|
||||
i
|
||||
...foo
|
||||
...bar
|
||||
}
|
||||
`,
|
||||
'baz',
|
||||
),
|
||||
),
|
||||
).toEqual(
|
||||
print(gql`
|
||||
{
|
||||
...baz
|
||||
}
|
||||
|
||||
fragment foo on Foo {
|
||||
a
|
||||
b
|
||||
c
|
||||
}
|
||||
|
||||
fragment bar on Bar {
|
||||
d
|
||||
e
|
||||
f
|
||||
...foo
|
||||
}
|
||||
|
||||
fragment baz on Baz {
|
||||
g
|
||||
h
|
||||
i
|
||||
...foo
|
||||
...bar
|
||||
}
|
||||
`),
|
||||
);
|
||||
});
|
||||
});
|
||||
316
node_modules/apollo-utilities/src/__tests__/getFromAST.ts
generated
vendored
Normal file
316
node_modules/apollo-utilities/src/__tests__/getFromAST.ts
generated
vendored
Normal file
@@ -0,0 +1,316 @@
|
||||
import { print } from 'graphql/language/printer';
|
||||
import gql from 'graphql-tag';
|
||||
import { FragmentDefinitionNode, OperationDefinitionNode } from 'graphql';
|
||||
|
||||
import {
|
||||
checkDocument,
|
||||
getFragmentDefinitions,
|
||||
getQueryDefinition,
|
||||
getMutationDefinition,
|
||||
createFragmentMap,
|
||||
FragmentMap,
|
||||
getDefaultValues,
|
||||
getOperationName,
|
||||
} from '../getFromAST';
|
||||
|
||||
describe('AST utility functions', () => {
|
||||
it('should correctly check a document for correctness', () => {
|
||||
const multipleQueries = gql`
|
||||
query {
|
||||
author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
}
|
||||
|
||||
query {
|
||||
author {
|
||||
address
|
||||
}
|
||||
}
|
||||
`;
|
||||
expect(() => {
|
||||
checkDocument(multipleQueries);
|
||||
}).toThrow();
|
||||
|
||||
const namedFragment = gql`
|
||||
query {
|
||||
author {
|
||||
...authorDetails
|
||||
}
|
||||
}
|
||||
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
`;
|
||||
expect(() => {
|
||||
checkDocument(namedFragment);
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('should get fragment definitions from a document containing a single fragment', () => {
|
||||
const singleFragmentDefinition = gql`
|
||||
query {
|
||||
author {
|
||||
...authorDetails
|
||||
}
|
||||
}
|
||||
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
`;
|
||||
const expectedDoc = gql`
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
`;
|
||||
const expectedResult: FragmentDefinitionNode[] = [
|
||||
expectedDoc.definitions[0] as FragmentDefinitionNode,
|
||||
];
|
||||
const actualResult = getFragmentDefinitions(singleFragmentDefinition);
|
||||
expect(actualResult.length).toEqual(expectedResult.length);
|
||||
expect(print(actualResult[0])).toBe(print(expectedResult[0]));
|
||||
});
|
||||
|
||||
it('should get fragment definitions from a document containing a multiple fragments', () => {
|
||||
const multipleFragmentDefinitions = gql`
|
||||
query {
|
||||
author {
|
||||
...authorDetails
|
||||
...moreAuthorDetails
|
||||
}
|
||||
}
|
||||
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
|
||||
fragment moreAuthorDetails on Author {
|
||||
address
|
||||
}
|
||||
`;
|
||||
const expectedDoc = gql`
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
|
||||
fragment moreAuthorDetails on Author {
|
||||
address
|
||||
}
|
||||
`;
|
||||
const expectedResult: FragmentDefinitionNode[] = [
|
||||
expectedDoc.definitions[0] as FragmentDefinitionNode,
|
||||
expectedDoc.definitions[1] as FragmentDefinitionNode,
|
||||
];
|
||||
const actualResult = getFragmentDefinitions(multipleFragmentDefinitions);
|
||||
expect(actualResult.map(print)).toEqual(expectedResult.map(print));
|
||||
});
|
||||
|
||||
it('should get the correct query definition out of a query containing multiple fragments', () => {
|
||||
const queryWithFragments = gql`
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
|
||||
fragment moreAuthorDetails on Author {
|
||||
address
|
||||
}
|
||||
|
||||
query {
|
||||
author {
|
||||
...authorDetails
|
||||
...moreAuthorDetails
|
||||
}
|
||||
}
|
||||
`;
|
||||
const expectedDoc = gql`
|
||||
query {
|
||||
author {
|
||||
...authorDetails
|
||||
...moreAuthorDetails
|
||||
}
|
||||
}
|
||||
`;
|
||||
const expectedResult: OperationDefinitionNode = expectedDoc
|
||||
.definitions[0] as OperationDefinitionNode;
|
||||
const actualResult = getQueryDefinition(queryWithFragments);
|
||||
|
||||
expect(print(actualResult)).toEqual(print(expectedResult));
|
||||
});
|
||||
|
||||
it('should throw if we try to get the query definition of a document with no query', () => {
|
||||
const mutationWithFragments = gql`
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
|
||||
mutation {
|
||||
createAuthor(firstName: "John", lastName: "Smith") {
|
||||
...authorDetails
|
||||
}
|
||||
}
|
||||
`;
|
||||
expect(() => {
|
||||
getQueryDefinition(mutationWithFragments);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
it('should get the correct mutation definition out of a mutation with multiple fragments', () => {
|
||||
const mutationWithFragments = gql`
|
||||
mutation {
|
||||
createAuthor(firstName: "John", lastName: "Smith") {
|
||||
...authorDetails
|
||||
}
|
||||
}
|
||||
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
`;
|
||||
const expectedDoc = gql`
|
||||
mutation {
|
||||
createAuthor(firstName: "John", lastName: "Smith") {
|
||||
...authorDetails
|
||||
}
|
||||
}
|
||||
`;
|
||||
const expectedResult: OperationDefinitionNode = expectedDoc
|
||||
.definitions[0] as OperationDefinitionNode;
|
||||
const actualResult = getMutationDefinition(mutationWithFragments);
|
||||
expect(print(actualResult)).toEqual(print(expectedResult));
|
||||
});
|
||||
|
||||
it('should create the fragment map correctly', () => {
|
||||
const fragments = getFragmentDefinitions(gql`
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
|
||||
fragment moreAuthorDetails on Author {
|
||||
address
|
||||
}
|
||||
`);
|
||||
const fragmentMap = createFragmentMap(fragments);
|
||||
const expectedTable: FragmentMap = {
|
||||
authorDetails: fragments[0],
|
||||
moreAuthorDetails: fragments[1],
|
||||
};
|
||||
expect(fragmentMap).toEqual(expectedTable);
|
||||
});
|
||||
|
||||
it('should return an empty fragment map if passed undefined argument', () => {
|
||||
expect(createFragmentMap(undefined)).toEqual({});
|
||||
});
|
||||
|
||||
it('should get the operation name out of a query', () => {
|
||||
const query = gql`
|
||||
query nameOfQuery {
|
||||
fortuneCookie
|
||||
}
|
||||
`;
|
||||
const operationName = getOperationName(query);
|
||||
expect(operationName).toEqual('nameOfQuery');
|
||||
});
|
||||
|
||||
it('should get the operation name out of a mutation', () => {
|
||||
const query = gql`
|
||||
mutation nameOfMutation {
|
||||
fortuneCookie
|
||||
}
|
||||
`;
|
||||
const operationName = getOperationName(query);
|
||||
expect(operationName).toEqual('nameOfMutation');
|
||||
});
|
||||
|
||||
it('should return null if the query does not have an operation name', () => {
|
||||
const query = gql`
|
||||
{
|
||||
fortuneCookie
|
||||
}
|
||||
`;
|
||||
const operationName = getOperationName(query);
|
||||
expect(operationName).toEqual(null);
|
||||
});
|
||||
|
||||
it('should throw if type definitions found in document', () => {
|
||||
const queryWithTypeDefination = gql`
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
|
||||
query($search: AuthorSearchInputType) {
|
||||
author(search: $search) {
|
||||
...authorDetails
|
||||
}
|
||||
}
|
||||
|
||||
input AuthorSearchInputType {
|
||||
firstName: String
|
||||
}
|
||||
`;
|
||||
expect(() => {
|
||||
getQueryDefinition(queryWithTypeDefination);
|
||||
}).toThrowError(
|
||||
'Schema type definitions not allowed in queries. Found: "InputObjectTypeDefinition"',
|
||||
);
|
||||
});
|
||||
|
||||
describe('getDefaultValues', () => {
|
||||
it('will create an empty variable object if no default values are provided', () => {
|
||||
const basicQuery = gql`
|
||||
query people($first: Int, $second: String) {
|
||||
allPeople(first: $first) {
|
||||
people {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({});
|
||||
});
|
||||
|
||||
it('will create a variable object based on the definition node with default values', () => {
|
||||
const basicQuery = gql`
|
||||
query people($first: Int = 1, $second: String!) {
|
||||
allPeople(first: $first) {
|
||||
people {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const complexMutation = gql`
|
||||
mutation complexStuff(
|
||||
$test: Input = { key1: ["value", "value2"], key2: { key3: 4 } }
|
||||
) {
|
||||
complexStuff(test: $test) {
|
||||
people {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({
|
||||
first: 1,
|
||||
});
|
||||
expect(getDefaultValues(getMutationDefinition(complexMutation))).toEqual({
|
||||
test: { key1: ['value', 'value2'], key2: { key3: 4 } },
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
23
node_modules/apollo-utilities/src/__tests__/storeUtils.ts
generated
vendored
Normal file
23
node_modules/apollo-utilities/src/__tests__/storeUtils.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { getStoreKeyName } from '../storeUtils';
|
||||
|
||||
describe('getStoreKeyName', () => {
|
||||
it(
|
||||
'should return a deterministic version of the store key name no matter ' +
|
||||
'which order the args object properties are in',
|
||||
() => {
|
||||
const validStoreKeyName =
|
||||
'someField({"prop1":"value1","prop2":"value2"})';
|
||||
let generatedStoreKeyName = getStoreKeyName('someField', {
|
||||
prop1: 'value1',
|
||||
prop2: 'value2',
|
||||
});
|
||||
expect(generatedStoreKeyName).toEqual(validStoreKeyName);
|
||||
|
||||
generatedStoreKeyName = getStoreKeyName('someField', {
|
||||
prop2: 'value2',
|
||||
prop1: 'value1',
|
||||
});
|
||||
expect(generatedStoreKeyName).toEqual(validStoreKeyName);
|
||||
},
|
||||
);
|
||||
});
|
||||
1242
node_modules/apollo-utilities/src/__tests__/transform.ts
generated
vendored
Normal file
1242
node_modules/apollo-utilities/src/__tests__/transform.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/apollo-utilities/src/declarations.d.ts
generated
vendored
Normal file
1
node_modules/apollo-utilities/src/declarations.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare module 'fast-json-stable-stringify';
|
||||
127
node_modules/apollo-utilities/src/directives.ts
generated
vendored
Normal file
127
node_modules/apollo-utilities/src/directives.ts
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
// Provides the methods that allow QueryManager to handle the `skip` and
|
||||
// `include` directives within GraphQL.
|
||||
import {
|
||||
FieldNode,
|
||||
SelectionNode,
|
||||
VariableNode,
|
||||
BooleanValueNode,
|
||||
DirectiveNode,
|
||||
DocumentNode,
|
||||
ArgumentNode,
|
||||
ValueNode,
|
||||
} from 'graphql';
|
||||
|
||||
import { visit } from 'graphql/language/visitor';
|
||||
|
||||
import { invariant } from 'ts-invariant';
|
||||
|
||||
import { argumentsObjectFromField } from './storeUtils';
|
||||
|
||||
export type DirectiveInfo = {
|
||||
[fieldName: string]: { [argName: string]: any };
|
||||
};
|
||||
|
||||
export function getDirectiveInfoFromField(
|
||||
field: FieldNode,
|
||||
variables: Object,
|
||||
): DirectiveInfo {
|
||||
if (field.directives && field.directives.length) {
|
||||
const directiveObj: DirectiveInfo = {};
|
||||
field.directives.forEach((directive: DirectiveNode) => {
|
||||
directiveObj[directive.name.value] = argumentsObjectFromField(
|
||||
directive,
|
||||
variables,
|
||||
);
|
||||
});
|
||||
return directiveObj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function shouldInclude(
|
||||
selection: SelectionNode,
|
||||
variables: { [name: string]: any } = {},
|
||||
): boolean {
|
||||
return getInclusionDirectives(
|
||||
selection.directives,
|
||||
).every(({ directive, ifArgument }) => {
|
||||
let evaledValue: boolean = false;
|
||||
if (ifArgument.value.kind === 'Variable') {
|
||||
evaledValue = variables[(ifArgument.value as VariableNode).name.value];
|
||||
invariant(
|
||||
evaledValue !== void 0,
|
||||
`Invalid variable referenced in @${directive.name.value} directive.`,
|
||||
);
|
||||
} else {
|
||||
evaledValue = (ifArgument.value as BooleanValueNode).value;
|
||||
}
|
||||
return directive.name.value === 'skip' ? !evaledValue : evaledValue;
|
||||
});
|
||||
}
|
||||
|
||||
export function getDirectiveNames(doc: DocumentNode) {
|
||||
const names: string[] = [];
|
||||
|
||||
visit(doc, {
|
||||
Directive(node) {
|
||||
names.push(node.name.value);
|
||||
},
|
||||
});
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
export function hasDirectives(names: string[], doc: DocumentNode) {
|
||||
return getDirectiveNames(doc).some(
|
||||
(name: string) => names.indexOf(name) > -1,
|
||||
);
|
||||
}
|
||||
|
||||
export function hasClientExports(document: DocumentNode) {
|
||||
return (
|
||||
document &&
|
||||
hasDirectives(['client'], document) &&
|
||||
hasDirectives(['export'], document)
|
||||
);
|
||||
}
|
||||
|
||||
export type InclusionDirectives = Array<{
|
||||
directive: DirectiveNode;
|
||||
ifArgument: ArgumentNode;
|
||||
}>;
|
||||
|
||||
function isInclusionDirective({ name: { value } }: DirectiveNode): boolean {
|
||||
return value === 'skip' || value === 'include';
|
||||
}
|
||||
|
||||
export function getInclusionDirectives(
|
||||
directives: ReadonlyArray<DirectiveNode>,
|
||||
): InclusionDirectives {
|
||||
return directives ? directives.filter(isInclusionDirective).map(directive => {
|
||||
const directiveArguments = directive.arguments;
|
||||
const directiveName = directive.name.value;
|
||||
|
||||
invariant(
|
||||
directiveArguments && directiveArguments.length === 1,
|
||||
`Incorrect number of arguments for the @${directiveName} directive.`,
|
||||
);
|
||||
|
||||
const ifArgument = directiveArguments[0];
|
||||
invariant(
|
||||
ifArgument.name && ifArgument.name.value === 'if',
|
||||
`Invalid argument for the @${directiveName} directive.`,
|
||||
);
|
||||
|
||||
const ifValue: ValueNode = ifArgument.value;
|
||||
|
||||
// means it has to be a variable value if this is a valid @skip or @include directive
|
||||
invariant(
|
||||
ifValue &&
|
||||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
||||
`Argument for the @${directiveName} directive must be a variable or a boolean value.`,
|
||||
);
|
||||
|
||||
return { directive, ifArgument };
|
||||
}) : [];
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user