@graphql-tools/mock 9.0.3 → 9.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/MockList.js CHANGED
@@ -19,6 +19,8 @@ exports.isMockList = isMockList;
19
19
  * provided `mockFunction` once for each list item.
20
20
  */
21
21
  class MockList {
22
+ len;
23
+ wrappedFunction;
22
24
  /**
23
25
  * @param length Either the exact length of items to return or an inclusive
24
26
  * range of possible lengths.
package/cjs/MockStore.js CHANGED
@@ -16,8 +16,11 @@ exports.defaultMocks = {
16
16
  };
17
17
  const defaultKeyFieldNames = ['id', '_id'];
18
18
  class MockStore {
19
+ schema;
20
+ mocks;
21
+ typePolicies;
22
+ store = {};
19
23
  constructor({ schema, mocks, typePolicies, }) {
20
- this.store = {};
21
24
  this.schema = schema;
22
25
  this.mocks = { ...exports.defaultMocks, ...mocks };
23
26
  this.typePolicies = typePolicies || {};
@@ -112,11 +115,11 @@ class MockStore {
112
115
  }
113
116
  filter(key, predicate) {
114
117
  const entity = this.store[key];
115
- return Object.values(entity).filter(predicate);
118
+ return entity ? Object.values(entity).filter(predicate) : [];
116
119
  }
117
120
  find(key, predicate) {
118
121
  const entity = this.store[key];
119
- return Object.values(entity).find(predicate);
122
+ return entity ? Object.values(entity).find(predicate) : undefined;
120
123
  }
121
124
  getImpl(args) {
122
125
  const { typeName, key, fieldName, fieldArgs, defaultValue } = args;
package/esm/MockList.js CHANGED
@@ -15,6 +15,8 @@ export function isMockList(obj) {
15
15
  * provided `mockFunction` once for each list item.
16
16
  */
17
17
  export class MockList {
18
+ len;
19
+ wrappedFunction;
18
20
  /**
19
21
  * @param length Either the exact length of items to return or an inclusive
20
22
  * range of possible lengths.
package/esm/MockStore.js CHANGED
@@ -12,8 +12,11 @@ export const defaultMocks = {
12
12
  };
13
13
  const defaultKeyFieldNames = ['id', '_id'];
14
14
  export class MockStore {
15
+ schema;
16
+ mocks;
17
+ typePolicies;
18
+ store = {};
15
19
  constructor({ schema, mocks, typePolicies, }) {
16
- this.store = {};
17
20
  this.schema = schema;
18
21
  this.mocks = { ...defaultMocks, ...mocks };
19
22
  this.typePolicies = typePolicies || {};
@@ -108,11 +111,11 @@ export class MockStore {
108
111
  }
109
112
  filter(key, predicate) {
110
113
  const entity = this.store[key];
111
- return Object.values(entity).filter(predicate);
114
+ return entity ? Object.values(entity).filter(predicate) : [];
112
115
  }
113
116
  find(key, predicate) {
114
117
  const entity = this.store[key];
115
- return Object.values(entity).find(predicate);
118
+ return entity ? Object.values(entity).find(predicate) : undefined;
116
119
  }
117
120
  getImpl(args) {
118
121
  const { typeName, key, fieldName, fieldArgs, defaultValue } = args;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/mock",
3
- "version": "9.0.3",
3
+ "version": "9.0.4",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {