@graphql-tools/mock
Advanced tools
Comparing version 9.0.3 to 9.0.4-rc-20240723101709-7374a9d9c11352b0604840741d382f77ba09b510
@@ -22,2 +22,4 @@ "use strict"; | ||
class MockList { | ||
len; | ||
wrappedFunction; | ||
/** | ||
@@ -24,0 +26,0 @@ * @param length Either the exact length of items to return or an inclusive |
@@ -19,4 +19,7 @@ "use strict"; | ||
class MockStore { | ||
schema; | ||
mocks; | ||
typePolicies; | ||
store = {}; | ||
constructor({ schema, mocks, typePolicies, }) { | ||
this.store = {}; | ||
this.schema = schema; | ||
@@ -116,7 +119,7 @@ this.mocks = { ...exports.defaultMocks, ...mocks }; | ||
const entity = this.store[key]; | ||
return Object.values(entity).filter(predicate); | ||
return entity ? Object.values(entity).filter(predicate) : []; | ||
} | ||
find(key, predicate) { | ||
const entity = this.store[key]; | ||
return Object.values(entity).find(predicate); | ||
return entity ? Object.values(entity).find(predicate) : undefined; | ||
} | ||
@@ -123,0 +126,0 @@ getImpl(args) { |
@@ -18,2 +18,4 @@ /** | ||
export class MockList { | ||
len; | ||
wrappedFunction; | ||
/** | ||
@@ -20,0 +22,0 @@ * @param length Either the exact length of items to return or an inclusive |
@@ -15,4 +15,7 @@ import stringify from 'fast-json-stable-stringify'; | ||
export class MockStore { | ||
schema; | ||
mocks; | ||
typePolicies; | ||
store = {}; | ||
constructor({ schema, mocks, typePolicies, }) { | ||
this.store = {}; | ||
this.schema = schema; | ||
@@ -112,7 +115,7 @@ this.mocks = { ...defaultMocks, ...mocks }; | ||
const entity = this.store[key]; | ||
return Object.values(entity).filter(predicate); | ||
return entity ? Object.values(entity).filter(predicate) : []; | ||
} | ||
find(key, predicate) { | ||
const entity = this.store[key]; | ||
return Object.values(entity).find(predicate); | ||
return entity ? Object.values(entity).find(predicate) : undefined; | ||
} | ||
@@ -119,0 +122,0 @@ getImpl(args) { |
{ | ||
"name": "@graphql-tools/mock", | ||
"version": "9.0.3", | ||
"version": "9.0.4-rc-20240723101709-7374a9d9c11352b0604840741d382f77ba09b510", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112110
2453
2