Socket
Socket
Sign inDemoInstall

apollo-utilities

Package Overview
Dependencies
Maintainers
2
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-utilities - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

13

CHANGELOG.md
# Change log
### vNext
### vNext
### 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.1.3
### 1.0.9
- dependency updates

@@ -13,9 +16,9 @@ - Added getDirectivesFromDocument utility function

### 1.1.2
### 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.1.1
### 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.1.0
### 1.0.6
- update `getStoreKeyName` to support custom directives

@@ -22,0 +25,0 @@

@@ -7,2 +7,10 @@ (function (global, factory) {

var __assign = (undefined && undefined.__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;
};
function isScalarValue(value) {

@@ -171,9 +179,7 @@ return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;

}
function toIdValue(id, generated) {
function toIdValue(idConfig, generated) {
if (generated === void 0) { generated = false; }
return {
type: 'id',
id: id,
generated: generated,
};
return __assign({ type: 'id', generated: generated }, (typeof idConfig === 'string'
? { id: idConfig, typename: undefined }
: idConfig));
}

@@ -188,2 +194,5 @@ function isJsonValue(jsonObject) {

}
/**
* Evaluate a ValueNode and yield its value in its natural JS form.
*/
function valueFromNode(node, onVariable) {

@@ -232,5 +241,8 @@ if (onVariable === void 0) { onVariable = defaultValueFromVariable; }

selection.directives.forEach(function (directive) {
// TODO should move this validation to GraphQL validation once that's implemented.
if (directive.name.value !== 'skip' && directive.name.value !== 'include') {
// Just don't worry about directives we don't understand
return;
}
//evaluate the "if" argument and skip (i.e. return undefined) if it evaluates to true.
var directiveArguments = directive.arguments || [];

@@ -248,2 +260,3 @@ var directiveName = directive.name.value;

if (!ifValue || ifValue.kind !== 'BooleanValue') {
// means it has to be a variable value if this is a valid @skip or @include directive
if (ifValue.kind !== 'Variable') {

@@ -286,2 +299,3 @@ throw new Error("Argument for the @" + directiveName + " directive must be a variable or a boolean value.");

return cached;
// operation => [names of directives];
var directives = doc.definitions

@@ -306,3 +320,3 @@ .filter(function (definition) {

var __assign = (undefined && undefined.__assign) || Object.assign || function(t) {
var __assign$1 = (undefined && undefined.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {

@@ -315,6 +329,33 @@ s = arguments[i];

};
/**
* Returns a query document which adds a single query operation that only
* spreads the target fragment inside of it.
*
* So for example a document of:
*
* ```graphql
* fragment foo on Foo { a b c }
* ```
*
* Turns into:
*
* ```graphql
* { ...foo }
*
* fragment foo on Foo { a b c }
* ```
*
* The target fragment will either be the only fragment in the document, or a
* fragment specified by the provided `fragmentName`. If there is more then one
* fragment, but a `fragmentName` was not defined then an error will be thrown.
*/
function getFragmentQueryDocument(document, fragmentName) {
var actualFragmentName = fragmentName;
// Build an array of all our fragment definitions that will be used for
// validations. We also do some validations on the other definitions in the
// document while building this list.
var fragments = [];
document.definitions.forEach(function (definition) {
// Throw an error if we encounter an operation definition because we will
// define our own operation definition later on.
if (definition.kind === 'OperationDefinition') {

@@ -324,2 +365,4 @@ throw new Error("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +

}
// Add our definition to the fragments array if it is a fragment
// definition.
if (definition.kind === 'FragmentDefinition') {

@@ -329,2 +372,4 @@ fragments.push(definition);

});
// If the user did not give us a fragment name then let us try to get a
// name from a single fragment in the definition.
if (typeof actualFragmentName === 'undefined') {

@@ -336,3 +381,5 @@ if (fragments.length !== 1) {

}
var query = __assign({}, document, { definitions: [
// Generate a query document with an operation that simply spreads the
// fragment inside of it.
var query = __assign$1({}, document, { definitions: [
{

@@ -385,2 +432,3 @@ kind: 'OperationDefinition',

}
// Checks the document for errors and throws an exception if there is an error.
function checkDocument(doc) {

@@ -420,2 +468,3 @@ if (doc.kind !== 'Document') {

}
// Returns the FragmentDefinitions from a particular document as an array
function getFragmentDefinitions(doc) {

@@ -444,2 +493,7 @@ return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; });

}
/**
* Returns the first operation definition found in this document.
* If no operation definition is found, the first fragment definition will be returned.
* If no definitions are found, an error will be thrown.
*/
function getMainDefinition(queryDoc) {

@@ -459,2 +513,4 @@ checkDocument(queryDoc);

if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {
// we do this because we want to allow multiple fragment definitions
// to precede an operation definition.
fragmentDefinition = definition;

@@ -468,2 +524,4 @@ }

}
// Utility function that takes a list of fragment definitions and makes a hash out of them
// that maps the name of the fragment to the fragment definition.
function createFragmentMap(fragments) {

@@ -496,2 +554,5 @@ if (fragments === void 0) { fragments = []; }

}
/**
* Returns the names of all variables declared by the operation.
*/
function variablesInOperation(operation) {

@@ -508,6 +569,12 @@ var names = new Set();

/**
* Deeply clones a value to create a new instance.
*/
function cloneDeep(value) {
// If the value is an array, create a new array where every item has been cloned.
if (Array.isArray(value)) {
return value.map(function (item) { return cloneDeep(item); });
}
// If the value is an object, go through all of the object’s properties and add them to a new
// object.
if (value !== null && typeof value === 'object') {

@@ -522,2 +589,4 @@ var nextValue = {};

}
// Otherwise this is some primitive value and it is therefore immutable so we can just return it
// directly.
return value;

@@ -534,5 +603,9 @@ }

function isNotEmpty(op, fragments) {
// keep selections that are still valid
return (op.selectionSet.selections.filter(function (selectionSet) {
// anything that doesn't match the compound filter is okay
return !(selectionSet &&
// look into fragments to verify they should stay
selectionSet.kind === 'FragmentSpread' &&
// see if the fragment in the map is valid (recursively)
!isNotEmpty(fragments[selectionSet.name.value], fragments));

@@ -565,2 +638,3 @@ }).length > 0);

selectionSet.selections.forEach(function (selection) {
// Must not add __typename if we're inside an introspection query
if (selection.kind === 'Field') {

@@ -583,2 +657,3 @@ if (selection.name.value.lastIndexOf('__', 0) !== 0 &&

return selectionSet;
// if any of the directives are set to remove this selectionSet, remove it
var agressiveRemove = directives.some(function (dir) { return dir.remove; });

@@ -718,2 +793,3 @@ selectionSet.selections = selectionSet.selections

}
// default environment
return 'development';

@@ -748,9 +824,16 @@ }

/**
* Performs a deep equality check on two JavaScript values.
*/
function isEqual(a, b) {
// If the two values are strictly equal, we are good.
if (a === b) {
return true;
}
// Dates are equivalent if their time values are equal.
if (a instanceof Date && b instanceof Date) {
return a.getTime() === b.getTime();
}
// If a and b are both objects, we will compare their properties. This will compare arrays as
// well.
if (a != null &&

@@ -760,2 +843,4 @@ typeof a === 'object' &&

typeof b === 'object') {
// Compare all of the keys in `a`. If one of the keys has a different value, or that key does
// not exist in `b` return false immediately.
for (var key in a) {

@@ -771,2 +856,3 @@ if (Object.prototype.hasOwnProperty.call(a, key)) {

}
// Look through all the keys in `b`. If `b` has a key that `a` does not, return false.
for (var key in b) {

@@ -777,7 +863,10 @@ if (!Object.prototype.hasOwnProperty.call(a, key)) {

}
// If we made it this far the objects are equal!
return true;
}
// Otherwise the values are not equal.
return false;
}
// taken straight from https://github.com/substack/deep-freeze to avoid import hassles with rollup
function deepFreeze(o) {

@@ -797,3 +886,8 @@ Object.freeze(o);

if (isDevelopment() || isTest()) {
return deepFreeze(obj);
// Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing
// which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).
var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string';
if (!symbolIsPolyfilled) {
return deepFreeze(obj);
}
}

@@ -804,2 +898,10 @@ return obj;

var haveWarned = Object.create({});
/**
* Print a warning only once in development.
* In production no warnings are printed.
* In test all warnings are printed.
*
* @param msg The warning message
* @param type warn or error (will call console.warn or console.error)
*/
function warnOnceInDevelopment(msg, type) {

@@ -806,0 +908,0 @@ if (type === void 0) { type = 'warn'; }

@@ -19,5 +19,8 @@ import { argumentsObjectFromField } from './storeUtils';

selection.directives.forEach(function (directive) {
// TODO should move this validation to GraphQL validation once that's implemented.
if (directive.name.value !== 'skip' && directive.name.value !== 'include') {
// Just don't worry about directives we don't understand
return;
}
//evaluate the "if" argument and skip (i.e. return undefined) if it evaluates to true.
var directiveArguments = directive.arguments || [];

@@ -35,2 +38,3 @@ var directiveName = directive.name.value;

if (!ifValue || ifValue.kind !== 'BooleanValue') {
// means it has to be a variable value if this is a valid @skip or @include directive
if (ifValue.kind !== 'Variable') {

@@ -73,2 +77,3 @@ throw new Error("Argument for the @" + directiveName + " directive must be a variable or a boolean value.");

return cached;
// operation => [names of directives];
var directives = doc.definitions

@@ -75,0 +80,0 @@ .filter(function (definition) {

import { DocumentNode } from 'graphql';
/**
* Returns a query document which adds a single query operation that only
* spreads the target fragment inside of it.
*
* So for example a document of:
*
* ```graphql
* fragment foo on Foo { a b c }
* ```
*
* Turns into:
*
* ```graphql
* { ...foo }
*
* fragment foo on Foo { a b c }
* ```
*
* The target fragment will either be the only fragment in the document, or a
* fragment specified by the provided `fragmentName`. If there is more then one
* fragment, but a `fragmentName` was not defined then an error will be thrown.
*/
export declare function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode;

@@ -9,6 +9,33 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {

};
/**
* Returns a query document which adds a single query operation that only
* spreads the target fragment inside of it.
*
* So for example a document of:
*
* ```graphql
* fragment foo on Foo { a b c }
* ```
*
* Turns into:
*
* ```graphql
* { ...foo }
*
* fragment foo on Foo { a b c }
* ```
*
* The target fragment will either be the only fragment in the document, or a
* fragment specified by the provided `fragmentName`. If there is more then one
* fragment, but a `fragmentName` was not defined then an error will be thrown.
*/
export function getFragmentQueryDocument(document, fragmentName) {
var actualFragmentName = fragmentName;
// Build an array of all our fragment definitions that will be used for
// validations. We also do some validations on the other definitions in the
// document while building this list.
var fragments = [];
document.definitions.forEach(function (definition) {
// Throw an error if we encounter an operation definition because we will
// define our own operation definition later on.
if (definition.kind === 'OperationDefinition') {

@@ -18,2 +45,4 @@ throw new Error("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +

}
// Add our definition to the fragments array if it is a fragment
// definition.
if (definition.kind === 'FragmentDefinition') {

@@ -23,2 +52,4 @@ fragments.push(definition);

});
// If the user did not give us a fragment name then let us try to get a
// name from a single fragment in the definition.
if (typeof actualFragmentName === 'undefined') {

@@ -30,2 +61,4 @@ if (fragments.length !== 1) {

}
// Generate a query document with an operation that simply spreads the
// fragment inside of it.
var query = __assign({}, document, { definitions: [

@@ -32,0 +65,0 @@ {

@@ -11,3 +11,11 @@ import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from 'graphql';

export declare function getFragmentDefinition(doc: DocumentNode): FragmentDefinitionNode;
/**
* Returns the first operation definition found in this document.
* If no operation definition is found, the first fragment definition will be returned.
* If no definitions are found, an error will be thrown.
*/
export declare function getMainDefinition(queryDoc: DocumentNode): OperationDefinitionNode | FragmentDefinitionNode;
/**
* This is an interface that describes a map from fragment names to fragment definitions.
*/
export interface FragmentMap {

@@ -20,2 +28,5 @@ [fragmentName: string]: FragmentDefinitionNode;

};
/**
* Returns the names of all variables declared by the operation.
*/
export declare function variablesInOperation(operation: OperationDefinitionNode): Set<string>;

@@ -14,2 +14,3 @@ import { assign } from './util/assign';

}
// Checks the document for errors and throws an exception if there is an error.
export function checkDocument(doc) {

@@ -49,2 +50,3 @@ if (doc.kind !== 'Document') {

}
// Returns the FragmentDefinitions from a particular document as an array
export function getFragmentDefinitions(doc) {

@@ -73,2 +75,7 @@ return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; });

}
/**
* Returns the first operation definition found in this document.
* If no operation definition is found, the first fragment definition will be returned.
* If no definitions are found, an error will be thrown.
*/
export function getMainDefinition(queryDoc) {

@@ -88,2 +95,4 @@ checkDocument(queryDoc);

if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {
// we do this because we want to allow multiple fragment definitions
// to precede an operation definition.
fragmentDefinition = definition;

@@ -97,2 +106,4 @@ }

}
// Utility function that takes a list of fragment definitions and makes a hash out of them
// that maps the name of the fragment to the fragment definition.
export function createFragmentMap(fragments) {

@@ -125,2 +136,5 @@ if (fragments === void 0) { fragments = []; }

}
/**
* Returns the names of all variables declared by the operation.
*/
export function variablesInOperation(operation) {

@@ -127,0 +141,0 @@ var names = new Set();

@@ -6,2 +6,3 @@ import { DirectiveNode, FieldNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, EnumValueNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode } from 'graphql';

generated: boolean;
typename: string | undefined;
}

@@ -31,5 +32,12 @@ export interface JsonValue {

export declare function isIdValue(idObject: StoreValue): idObject is IdValue;
export declare function toIdValue(id: string, generated?: boolean): 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;
/**
* Evaluate a ValueNode and yield its value in its natural JS form.
*/
export declare function valueFromNode(node: ValueNode, onVariable?: VariableValue): any;

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

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;
};
export function isScalarValue(value) {

@@ -164,9 +172,7 @@ return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;

}
export function toIdValue(id, generated) {
export function toIdValue(idConfig, generated) {
if (generated === void 0) { generated = false; }
return {
type: 'id',
id: id,
generated: generated,
};
return __assign({ type: 'id', generated: generated }, (typeof idConfig === 'string'
? { id: idConfig, typename: undefined }
: idConfig));
}

@@ -181,2 +187,5 @@ export function isJsonValue(jsonObject) {

}
/**
* Evaluate a ValueNode and yield its value in its natural JS form.
*/
export function valueFromNode(node, onVariable) {

@@ -183,0 +192,0 @@ if (onVariable === void 0) { onVariable = defaultValueFromVariable; }

@@ -11,5 +11,9 @@ import { cloneDeep } from './util/cloneDeep';

function isNotEmpty(op, fragments) {
// keep selections that are still valid
return (op.selectionSet.selections.filter(function (selectionSet) {
// anything that doesn't match the compound filter is okay
return !(selectionSet &&
// look into fragments to verify they should stay
selectionSet.kind === 'FragmentSpread' &&
// see if the fragment in the map is valid (recursively)
!isNotEmpty(fragments[selectionSet.name.value], fragments));

@@ -42,2 +46,3 @@ }).length > 0);

selectionSet.selections.forEach(function (selection) {
// Must not add __typename if we're inside an introspection query
if (selection.kind === 'Field') {

@@ -60,2 +65,3 @@ if (selection.name.value.lastIndexOf('__', 0) !== 0 &&

return selectionSet;
// if any of the directives are set to remove this selectionSet, remove it
var agressiveRemove = directives.some(function (dir) { return dir.remove; });

@@ -62,0 +68,0 @@ selectionSet.selections = selectionSet.selections

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

/**
* Adds the properties of one or more source objects to a target object. Works exactly like
* `Object.assign`, but as a utility to maintain support for IE 11.
*
* @see https://github.com/apollostack/apollo-client/pull/1009
*/
export declare function assign<A, B>(a: A, b: B): A & B;

@@ -2,0 +8,0 @@ export declare function assign<A, B, C>(a: A, b: B, c: C): A & B & C;

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

/**
* Deeply clones a value to create a new instance.
*/
export declare function cloneDeep<T>(value: T): T;

@@ -0,5 +1,11 @@

/**
* Deeply clones a value to create a new instance.
*/
export function cloneDeep(value) {
// If the value is an array, create a new array where every item has been cloned.
if (Array.isArray(value)) {
return value.map(function (item) { return cloneDeep(item); });
}
// If the value is an object, go through all of the object’s properties and add them to a new
// object.
if (value !== null && typeof value === 'object') {

@@ -14,4 +20,6 @@ var nextValue = {};

}
// Otherwise this is some primitive value and it is therefore immutable so we can just return it
// directly.
return value;
}
//# sourceMappingURL=cloneDeep.js.map

@@ -5,2 +5,3 @@ export function getEnv() {

}
// default environment
return 'development';

@@ -7,0 +8,0 @@ }

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

/**
* Performs a deep equality check on two JavaScript values.
*/
export declare function isEqual(a: any, b: any): boolean;

@@ -0,8 +1,15 @@

/**
* Performs a deep equality check on two JavaScript values.
*/
export function isEqual(a, b) {
// If the two values are strictly equal, we are good.
if (a === b) {
return true;
}
// Dates are equivalent if their time values are equal.
if (a instanceof Date && b instanceof Date) {
return a.getTime() === b.getTime();
}
// If a and b are both objects, we will compare their properties. This will compare arrays as
// well.
if (a != null &&

@@ -12,2 +19,4 @@ typeof a === 'object' &&

typeof b === 'object') {
// Compare all of the keys in `a`. If one of the keys has a different value, or that key does
// not exist in `b` return false immediately.
for (var key in a) {

@@ -23,2 +32,3 @@ if (Object.prototype.hasOwnProperty.call(a, key)) {

}
// Look through all the keys in `b`. If `b` has a key that `a` does not, return false.
for (var key in b) {

@@ -29,6 +39,8 @@ if (!Object.prototype.hasOwnProperty.call(a, key)) {

}
// If we made it this far the objects are equal!
return true;
}
// Otherwise the values are not equal.
return false;
}
//# sourceMappingURL=isEqual.js.map
import { isDevelopment, isTest } from './environment';
// taken straight from https://github.com/substack/deep-freeze to avoid import hassles with rollup
function deepFreeze(o) {

@@ -16,3 +17,8 @@ Object.freeze(o);

if (isDevelopment() || isTest()) {
return deepFreeze(obj);
// Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing
// which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).
var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string';
if (!symbolIsPolyfilled) {
return deepFreeze(obj);
}
}

@@ -19,0 +25,0 @@ return obj;

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

/**
* Print a warning only once in development.
* In production no warnings are printed.
* In test all warnings are printed.
*
* @param msg The warning message
* @param type warn or error (will call console.warn or console.error)
*/
export declare function warnOnceInDevelopment(msg: string, type?: string): void;
import { isProduction, isTest } from './environment';
var haveWarned = Object.create({});
/**
* Print a warning only once in development.
* In production no warnings are printed.
* In test all warnings are printed.
*
* @param msg The warning message
* @param type warn or error (will call console.warn or console.error)
*/
export function warnOnceInDevelopment(msg, type) {

@@ -4,0 +12,0 @@ if (type === void 0) { type = 'warn'; }

{
"name": "apollo-utilities",
"version": "1.0.10",
"version": "1.0.11",
"description": "Utilities for working with GraphQL ASTs",

@@ -41,9 +41,9 @@ "author": "James Baxley <james@meteor.com>",

"devDependencies": {
"@types/graphql": "0.12.4",
"@types/graphql": "0.12.5",
"@types/jest": "21.1.10",
"@types/lodash": "4.14.102",
"@types/node": "8.5.9",
"@types/lodash": "4.14.105",
"@types/node": "8.9.5",
"browserify": "15.2.0",
"flow-bin": "0.67.1",
"graphql": "0.13.1",
"flow-bin": "0.68.0",
"graphql": "0.13.2",
"graphql-tag": "2.8.0",

@@ -69,5 +69,4 @@ "jest": "20.0.4",

"json"
],
"mapCoverage": true
]
}
}

@@ -885,3 +885,34 @@ import { print } from 'graphql/language/printer';

});
it('should get mutation with client fields', () => {
const query = gql`
mutation {
login @client
}
`;
const expected = gql`
mutation {
login @client
}
`;
const doc = getDirectivesFromDocument([{ name: 'client' }], query);
expect(print(doc)).toBe(print(expected));
});
it('should get mutation fields of client only', () => {
const query = gql`
mutation {
login @client
updateUser
}
`;
const expected = gql`
mutation {
login @client
}
`;
const doc = getDirectivesFromDocument([{ name: 'client' }], query);
expect(print(doc)).toBe(print(expected));
});
describe('includeAllFragments', () => {

@@ -955,3 +986,2 @@ it('= false: should remove the values without a client in fragment', () => {

});
});
});

@@ -23,2 +23,3 @@ import {

generated: boolean;
typename: string | undefined;
}

@@ -271,7 +272,17 @@

export function toIdValue(id: string, generated = false): IdValue {
export type IdConfig = {
id: string;
typename: string | undefined;
};
export function toIdValue(
idConfig: string | IdConfig,
generated = false,
): IdValue {
return {
type: 'id',
id,
generated,
...(typeof idConfig === 'string'
? { id: idConfig, typename: undefined }
: idConfig),
};

@@ -278,0 +289,0 @@ }

@@ -23,5 +23,12 @@ import { isDevelopment, isTest } from './environment';

if (isDevelopment() || isTest()) {
return deepFreeze(obj);
// Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing
// which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).
const symbolIsPolyfilled =
typeof Symbol === 'function' && typeof Symbol('') === 'string';
if (!symbolIsPolyfilled) {
return deepFreeze(obj);
}
}
return obj;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc