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 +7 -8
- package/package.json +1 -1
- package/script/proxy.js +7 -8
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
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
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
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
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
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: {
|