graphql-data-generator 0.4.1-alpha.0 → 0.4.1-alpha.1

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/esm/proxy.js CHANGED
@@ -424,14 +424,12 @@ export const _proxy = (definitions, scalars, path, patches, { prev, resolvedType
424
424
  input: definition.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION,
425
425
  });
426
426
  };
427
- const keys = [
428
- ...(definition.kind === Kind.OBJECT_TYPE_DEFINITION
429
- ? ["__typename"]
430
- : []),
431
- ...(selectionSet
432
- ? selectionSetToKeys(definitions, selectionSet, definition.name.value)
433
- : definition.fields?.map((f) => f.name.value) ?? []),
434
- ];
427
+ const keys = selectionSet
428
+ ? selectionSetToKeys(definitions, selectionSet, definition.name.value)
429
+ : definition.fields?.map((f) => f.name.value) ?? [];
430
+ if (definition.kind === Kind.OBJECT_TYPE_DEFINITION &&
431
+ !keys.includes("__typename"))
432
+ keys.unshift("__typename");
435
433
  return new Proxy({}, {
436
434
  get: getProp,
437
435
  set: (target, prop, value) => {
@@ -458,6 +456,7 @@ export const _proxy = (definitions, scalars, path, patches, { prev, resolvedType
458
456
  return _proxy(definitions, scalars, concreteType.name.value, patches, {
459
457
  prev,
460
458
  selectionSet,
459
+ nonNull: true,
461
460
  });
462
461
  }
463
462
  case Kind.OPERATION_DEFINITION: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql-data-generator",
3
- "version": "0.4.1-alpha.0",
3
+ "version": "0.4.1-alpha.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/voces/graphql-data-generator.git"
package/script/proxy.js CHANGED
@@ -428,14 +428,12 @@ const _proxy = (definitions, scalars, path, patches, { prev, resolvedType = reso
428
428
  input: definition.kind === graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION,
429
429
  });
430
430
  };
431
- const keys = [
432
- ...(definition.kind === graphql_1.Kind.OBJECT_TYPE_DEFINITION
433
- ? ["__typename"]
434
- : []),
435
- ...(selectionSet
436
- ? selectionSetToKeys(definitions, selectionSet, definition.name.value)
437
- : definition.fields?.map((f) => f.name.value) ?? []),
438
- ];
431
+ const keys = selectionSet
432
+ ? selectionSetToKeys(definitions, selectionSet, definition.name.value)
433
+ : definition.fields?.map((f) => f.name.value) ?? [];
434
+ if (definition.kind === graphql_1.Kind.OBJECT_TYPE_DEFINITION &&
435
+ !keys.includes("__typename"))
436
+ keys.unshift("__typename");
439
437
  return new Proxy({}, {
440
438
  get: getProp,
441
439
  set: (target, prop, value) => {
@@ -462,6 +460,7 @@ const _proxy = (definitions, scalars, path, patches, { prev, resolvedType = reso
462
460
  return (0, exports._proxy)(definitions, scalars, concreteType.name.value, patches, {
463
461
  prev,
464
462
  selectionSet,
463
+ nonNull: true,
465
464
  });
466
465
  }
467
466
  case graphql_1.Kind.OPERATION_DEFINITION: {