graphql-data-generator 0.1.3 → 0.1.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/esm/init.js CHANGED
@@ -85,7 +85,12 @@ export const init = (schema, queries, mutations, subscriptions, types, inputs, s
85
85
  if (transforms[name] && "default" in transforms[name]) {
86
86
  patches = [transforms[name].default, ...patches];
87
87
  }
88
- const result = toObject(operation(doc.definitions, scalars, query, ...patches));
88
+ const { request: { query: parsedQuery, ...request }, ...raw } = operation(doc.definitions, scalars, query, ...patches);
89
+ const result = toObject({
90
+ request: { ...request },
91
+ ...raw,
92
+ });
93
+ result.request.query = parsedQuery;
89
94
  return addOperationTransforms(name, options?.finalizeOperation
90
95
  ? options.finalizeOperation(result)
91
96
  : result);
package/esm/proxy.js CHANGED
@@ -570,7 +570,7 @@ export const operation = (definitions, scalars, query, ...patches) => {
570
570
  throw new Error("Expected operation to be named");
571
571
  const { variables, data, error, errors, ...extra } = _proxy([...definitions, ...document.definitions], scalars, operation.name.value, patches);
572
572
  const mock = {
573
- request: { query },
573
+ request: { query: document },
574
574
  result: {},
575
575
  ...extra,
576
576
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql-data-generator",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/vocesgraphql-data-generator/.git"
@@ -9,6 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/voces/graphql-data-generator/issues"
11
11
  },
12
+ "main": "./esm/index.js",
12
13
  "module": "./esm/index.js",
13
14
  "types": "./types/index.d.ts",
14
15
  "exports": {
package/types/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { GraphQLError } from "graphql";
1
+ import type { DocumentNode, GraphQLError } from "graphql";
2
2
  export type ContravariantEmpty = Record<string, never>;
3
3
  export type CovariantEmpty = object;
4
4
  type ArrayPatch<T> = Patch<T>[] | ({
@@ -19,7 +19,7 @@ export type DeepPartial<T> = T extends (infer U)[] ? DeepPartial<U>[] : T extend
19
19
  } : T;
20
20
  export type OperationMock<Data extends Record<string, unknown> = Record<string, unknown>, Variables = Record<string, unknown> | never> = {
21
21
  request: {
22
- query: string;
22
+ query: DocumentNode;
23
23
  variables?: Variables;
24
24
  };
25
25
  result: {