@avantstay/graphql-ts-client 11.0.0 → 12.0.0

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/README.md CHANGED
@@ -33,10 +33,10 @@ import { myAwesomeApi, AssetType, Granularity, OnBoardingStage } from './myAweso
33
33
  async function somewhereOverTheRainbow() {
34
34
  // Set an specific header if needed
35
35
  myAwesomeApi.setHeader('Authorization', 'Bearer 010101010101')
36
-
36
+
37
37
  // You can also change the API url
38
38
  myAwesomeApi.setUrl('https://my-runtime-url.com/graphql')
39
-
39
+
40
40
  // And configure how retrials should work
41
41
  myAwesomeApi.setRetryConfig({
42
42
  max: 3,
@@ -44,12 +44,12 @@ async function somewhereOverTheRainbow() {
44
44
  // do something before retrying
45
45
  },
46
46
  })
47
-
47
+
48
48
  // Adding response listeners is also possible
49
49
  myAwesomeApi.addResponseListener(({ queryName, query, variables, response }) => {
50
50
  // do something whenever a request is responded
51
51
  })
52
-
52
+
53
53
  const response = await myAwesomeApi.queries.globalIndicators({
54
54
  // Optionally you can define an alias for this request
55
55
  __alias: 'myCustomGlobalIndicators',
@@ -0,0 +1,27 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw new Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ // src/types.ts
10
+ var GraphQLClientError = class extends Error {
11
+ constructor(responseData) {
12
+ super();
13
+ this.responseData = responseData;
14
+ Object.setPrototypeOf(this, GraphQLClientError.prototype);
15
+ }
16
+ get message() {
17
+ return this.response.errors.map((it) => it.message).join(";\n");
18
+ }
19
+ get response() {
20
+ return this.responseData;
21
+ }
22
+ };
23
+
24
+ export {
25
+ __require,
26
+ GraphQLClientError
27
+ };
@@ -1,4 +1,4 @@
1
- import { C as ClientConfig, I as IResponseListener, E as Endpoint } from './types-4ada662b.js';
1
+ import { C as ClientConfig, I as IResponseListener, E as Endpoint } from './types-23d2d6aa.js';
2
2
 
3
3
  declare const getApiEndpointCreator: (apiConfig: {
4
4
  getClient: () => ClientConfig;
@@ -0,0 +1,275 @@
1
+ import {
2
+ GraphQLClientError,
3
+ __require
4
+ } from "./chunk-I4QOADOI.mjs";
5
+
6
+ // src/endpoint.ts
7
+ import memoize from "moize";
8
+
9
+ // src/graphqlRequest.ts
10
+ import _axios from "axios";
11
+ var sleep = (ms = 0) => new Promise((resolve) => {
12
+ setTimeout(() => resolve(), ms);
13
+ });
14
+ async function graphqlRequest({
15
+ shouldRetry = true,
16
+ axios = _axios,
17
+ queryName,
18
+ client,
19
+ query,
20
+ requestHeaders = {},
21
+ variables,
22
+ failureMode,
23
+ errorsParser
24
+ }) {
25
+ let lastResponse;
26
+ const maxRetrials = shouldRetry ? client.retryConfig.max : 0;
27
+ for (let trial = 0; true; trial++) {
28
+ const infoParams = {
29
+ _q: queryName,
30
+ ...trial > 0 ? { _retrial: trial + 1 } : {}
31
+ };
32
+ const {
33
+ data: responseData = {},
34
+ headers,
35
+ status
36
+ } = await axios.post(
37
+ client.url,
38
+ { query, variables, operationName: queryName },
39
+ {
40
+ params: infoParams,
41
+ headers: {
42
+ "Content-Type": "application/json",
43
+ ...client.headers,
44
+ ...requestHeaders
45
+ },
46
+ validateStatus: () => true
47
+ }
48
+ );
49
+ let { data, errors, warnings } = responseData;
50
+ if (status >= 400 && !errors?.length) {
51
+ errors = [{ message: `Request "${queryName}" failed with status ${status}` }];
52
+ }
53
+ lastResponse = {
54
+ errors: errorsParser ? errorsParser(errors) : errors,
55
+ data,
56
+ warnings,
57
+ headers,
58
+ status
59
+ };
60
+ if (!errors?.length) {
61
+ break;
62
+ } else if (trial < maxRetrials && typeof client.retryConfig?.before === "function") {
63
+ await client.retryConfig?.before({
64
+ queryName,
65
+ query,
66
+ variables,
67
+ response: lastResponse
68
+ });
69
+ if (client.retryConfig.waitBeforeRetry) {
70
+ await sleep(client.retryConfig.waitBeforeRetry);
71
+ }
72
+ } else if (trial >= maxRetrials) {
73
+ break;
74
+ }
75
+ }
76
+ if (failureMode === "loud" && lastResponse.errors && lastResponse.errors?.length) {
77
+ throw new GraphQLClientError(lastResponse);
78
+ }
79
+ return lastResponse;
80
+ }
81
+
82
+ // src/jsonToGraphQLQuery.ts
83
+ import omit from "lodash/omit";
84
+ var VAR_PREFIX = "@@VAR@@";
85
+ var VAR_PREFIX_LENGTH = VAR_PREFIX.length;
86
+ var fromEntries = __require("lodash/fromPairs");
87
+ var entries = __require("lodash/toPairs");
88
+ var cloneDeep = __require("lodash/cloneDeep");
89
+ function jsonToGraphQLQuery({
90
+ kind,
91
+ queryName,
92
+ jsonQuery = {},
93
+ typesTree
94
+ }) {
95
+ const variablesData = {};
96
+ const alias = jsonQuery.__alias;
97
+ const newJsonQuery = cloneDeep(omit(jsonQuery, ["__alias", "__headers", "__url"]));
98
+ extractVariables({
99
+ jsonQuery: { [queryName]: newJsonQuery },
100
+ variables: variablesData,
101
+ parentType: kind === "query" ? typesTree.Query : typesTree.Mutation
102
+ });
103
+ const variableItems = Object.values(variablesData).reduce(
104
+ (variablesObj, variables2) => {
105
+ variables2.forEach((variable, index) => {
106
+ const name = variable.update(variables2.length > 1 ? index : void 0);
107
+ variablesObj[name] = { type: variable.type, value: variable.value };
108
+ });
109
+ return variablesObj;
110
+ },
111
+ {}
112
+ );
113
+ const variablesQuery = Object.keys(variableItems).length ? `(${entries(variableItems).map(([queryName2, { type }]) => `$${queryName2}: ${type}`).join(", ")})` : "";
114
+ const query = `${kind} ${alias || queryName}${variablesQuery} { ${alias ? `${alias}:` : ""}${queryName}${toGraphql(
115
+ newJsonQuery
116
+ )} }`;
117
+ const variables = fromEntries(entries(variableItems).map(([k, v]) => [k, v.value]));
118
+ return {
119
+ query,
120
+ variables
121
+ };
122
+ }
123
+ function extractVariables({
124
+ jsonQuery,
125
+ variables,
126
+ parentType
127
+ }) {
128
+ if (!parentType)
129
+ return;
130
+ if (jsonQuery.__args) {
131
+ Object.keys(jsonQuery.__args).forEach((k) => {
132
+ if (typeof jsonQuery.__args[k] === "string" && jsonQuery.__args[k].startsWith(VAR_PREFIX))
133
+ return;
134
+ if (jsonQuery.__args[k] === void 0)
135
+ return;
136
+ const variableName = k;
137
+ if (!variables[variableName]) {
138
+ variables[variableName] = [];
139
+ }
140
+ variables[variableName].push({
141
+ name: variableName,
142
+ type: parentType.__args[k],
143
+ value: jsonQuery.__args[k],
144
+ update: (index) => {
145
+ const name = `${variableName}${index !== void 0 ? `_${index}` : ""}`;
146
+ jsonQuery.__args[k] = `${VAR_PREFIX}$${name}`;
147
+ return name;
148
+ }
149
+ });
150
+ jsonQuery.__args[k] = VAR_PREFIX;
151
+ });
152
+ }
153
+ Object.keys(jsonQuery).filter((k) => k !== "__args" && typeof jsonQuery[k] === "object").forEach(
154
+ (k) => extractVariables({
155
+ jsonQuery: jsonQuery[k],
156
+ variables,
157
+ parentType: parentType.hasOwnProperty(k) ? parentType[k] : parentType.__fields ? parentType.__fields[k] : void 0
158
+ })
159
+ );
160
+ }
161
+ function toGraphql(jsonQuery) {
162
+ const fields = entries(jsonQuery).filter(([k, v]) => k !== "__args" && v !== false && v !== void 0).map(([k, v]) => typeof v === "object" ? `${k}${toGraphql(v)}` : k).join(" ");
163
+ const validArgs = jsonQuery.__args ? entries(jsonQuery.__args).filter(([_, v]) => v !== void 0) : [];
164
+ const argsQuery = validArgs.length ? `(${validArgs.map(([k, v]) => `${k}:${v.substr(VAR_PREFIX_LENGTH)}`).join(",")})` : "";
165
+ return `${argsQuery} ${fields ? `{ ${fields} }` : ""}`;
166
+ }
167
+
168
+ // src/logging.ts
169
+ function logRequest(logInfo) {
170
+ let identifier = `%c#graphql-ts-client ${logInfo.kind} ${logInfo.queryName}`;
171
+ let identifierStyles = "color: transparent; font-size: 0px";
172
+ console.groupCollapsed(
173
+ `%c#graphql-ts-client %c${logInfo.kind} %c${logInfo.queryName} %c(${logInfo.duration.toFixed(2)}ms)`,
174
+ "color: #f90",
175
+ "color: #999",
176
+ `color: ${logInfo.response ? "unset" : "#f00"}; font-weight: bold`,
177
+ "color: #999"
178
+ );
179
+ console.groupCollapsed(`%cQuery ${identifier}`, "color: #999", identifierStyles);
180
+ console.log(logInfo.formatGraphQL(logInfo.query) + identifier, identifierStyles);
181
+ console.groupEnd();
182
+ console.groupCollapsed(`%cVariables ${identifier}`, "color: #999", identifierStyles);
183
+ console.log(JSON.stringify(logInfo.variables, null, " ") + identifier, identifierStyles);
184
+ console.groupEnd();
185
+ console.groupCollapsed(`%cTrace ${identifier}`, "color: #999", identifierStyles);
186
+ console.trace(identifier, identifierStyles);
187
+ console.groupEnd();
188
+ if (logInfo.response) {
189
+ console.log("%cResponse".padEnd(15, " ") + identifier, "color: #999", identifierStyles, logInfo.response);
190
+ }
191
+ if (logInfo.error) {
192
+ console.log("%cError".padEnd(15, " ") + identifier, "color: #999", identifierStyles, logInfo.error);
193
+ }
194
+ console.groupEnd();
195
+ }
196
+
197
+ // src/endpoint.ts
198
+ var executeListeners = (listeners, data) => setTimeout(() => listeners.forEach((runResponseListener) => runResponseListener(data)));
199
+ var getApiEndpointCreator = (apiConfig) => (kind, queryName) => {
200
+ const rawEndpoint = async (failureMode, jsonQuery) => {
201
+ const clientConfig = apiConfig.getClient();
202
+ const alias = jsonQuery?.__alias ?? queryName;
203
+ const url = jsonQuery?.__url ?? clientConfig.url;
204
+ const shouldRetry = jsonQuery?.__retry ?? true;
205
+ const requestHeaders = jsonQuery?.__headers ?? {};
206
+ const { query, variables } = jsonToGraphQLQuery({ kind, queryName, jsonQuery, typesTree: apiConfig.typesTree });
207
+ const start = +new Date();
208
+ const logOptions = {
209
+ kind,
210
+ queryName: alias,
211
+ formatGraphQL: apiConfig.formatGraphQL,
212
+ requestHeaders,
213
+ query,
214
+ variables
215
+ };
216
+ const responseListenerData = {
217
+ queryName: alias,
218
+ query: apiConfig.formatGraphQL(query),
219
+ variables
220
+ };
221
+ try {
222
+ const { data, errors, warnings, headers, status } = await graphqlRequest({
223
+ shouldRetry,
224
+ failureMode,
225
+ queryName: alias,
226
+ client: { ...clientConfig, url },
227
+ requestHeaders,
228
+ query,
229
+ variables,
230
+ errorsParser: apiConfig.errorsParser
231
+ });
232
+ const response = { data, warnings, headers, status, errors };
233
+ if (apiConfig.verbose && globalThis.document) {
234
+ logRequest({
235
+ ...logOptions,
236
+ response,
237
+ duration: +new Date() - start
238
+ });
239
+ }
240
+ executeListeners(apiConfig.responseListeners, {
241
+ ...responseListenerData,
242
+ response
243
+ });
244
+ return { data: data?.[alias], errors, warnings, headers, status };
245
+ } catch (error) {
246
+ if (apiConfig.verbose && globalThis.document) {
247
+ logRequest({
248
+ ...logOptions,
249
+ error,
250
+ duration: +new Date() - start
251
+ });
252
+ }
253
+ executeListeners(apiConfig.responseListeners, {
254
+ ...responseListenerData,
255
+ response: error.response
256
+ });
257
+ throw error;
258
+ }
259
+ };
260
+ const endpoint = async (jsonQuery) => {
261
+ const { data } = await rawEndpoint("loud", jsonQuery);
262
+ return data;
263
+ };
264
+ const memoizeeOptions = {
265
+ maxAge: apiConfig.maxAge,
266
+ isSerialized: true
267
+ };
268
+ endpoint.raw = rawEndpoint.bind(null, "silent");
269
+ endpoint.memo = memoize(endpoint, memoizeeOptions);
270
+ endpoint.memoRaw = memoize(endpoint.raw, memoizeeOptions);
271
+ return endpoint;
272
+ };
273
+ export {
274
+ getApiEndpointCreator
275
+ };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { PathLike } from 'fs';
2
- export { C as ClientConfig, c as DeepReplace, D as Defined, E as Endpoint, G as GraphQLClientError, I as IResponseListener, J as JsonOutput, L as LogInfo, M as Maybe, P as Projection, d as RawEndpoint, b as Replacement, R as ResponseData, a as ResponseListenerInfo, U as Unpacked } from './types-4ada662b.js';
2
+ import { T as TypescriptClientOutput } from './types-23d2d6aa.js';
3
+ export { C as ClientConfig, c as DeepReplace, D as Defined, E as Endpoint, G as GraphQLClientError, I as IResponseListener, J as JsonOutput, L as LogInfo, M as Maybe, P as Projection, d as RawEndpoint, b as Replacement, R as ResponseData, a as ResponseListenerInfo, T as TypescriptClientOutput, U as Unpacked } from './types-23d2d6aa.js';
3
4
 
4
5
  type IClientOptions = {
5
6
  output?: PathLike;
@@ -14,11 +15,7 @@ type IClientOptions = {
14
15
  skipCache?: boolean;
15
16
  errorsParser?: (errors: any[]) => any;
16
17
  };
17
- type Client = {
18
- typings: string;
19
- js: string;
20
- };
21
- declare function generateTypescriptClient({ introspectionEndpoint, ...options }: IClientOptions): Promise<Client>;
22
- declare function generateTypescriptClientFromSDL(SDL: string, options: IClientOptions): Client;
18
+ declare function generateTypescriptClient({ introspectionEndpoint, ...options }: IClientOptions): Promise<TypescriptClientOutput>;
19
+ declare function generateTypescriptClientFromSDL(SDL: string, options: IClientOptions): TypescriptClientOutput;
23
20
 
24
21
  export { generateTypescriptClient, generateTypescriptClientFromSDL };
package/dist/index.js CHANGED
@@ -487,65 +487,52 @@ var prettier = __toESM(require("prettier"));
487
487
  // package.json
488
488
  var package_default = {
489
489
  name: "@avantstay/graphql-ts-client",
490
- version: "11.0.0",
490
+ version: "12.0.0",
491
491
  description: "GraphQL Typescript Client Generator",
492
- author: "Wellington Guimaraes",
493
- license: "MIT",
494
- main: "dist/index.js",
495
- typings: "dist/index.d.ts",
496
- scripts: {
497
- build: "tsup src/index.ts src/endpoint.ts --dts",
498
- test: "cross-env GQL_CLIENT_DIST_PATH='.' jest --watch",
499
- prepublishOnly: "yarn build"
500
- },
501
- files: [
502
- "dist",
503
- "src"
504
- ],
505
- engines: {
506
- node: ">=12"
507
- },
492
+ homepage: "https://github.com/avantstay/graphql-ts-client",
508
493
  bugs: {
509
494
  url: "https://github.com/avantstay/graphql-ts-client/issues"
510
495
  },
511
- homepage: "https://github.com/avantstay/graphql-ts-client#readme",
512
496
  repository: {
513
497
  type: "git",
514
498
  url: "git+https://github.com/avantstay/graphql-ts-client.git"
515
499
  },
516
- peerDependencies: {},
517
- prettier: {
518
- trailingComma: "es5",
519
- tabWidth: 2,
520
- proseWrap: "always",
521
- bracketSpacing: true,
522
- jsxBracketSameLine: false,
523
- semi: false,
524
- singleQuote: true,
525
- arrowParens: "avoid",
526
- endOfLine: "lf",
527
- printWidth: 130,
528
- htmlWhitespaceSensitivity: "ignore",
529
- jsxSingleQuote: false
530
- },
531
- module: "dist/graphql-ts-client.esm.js",
532
- "size-limit": [
533
- {
534
- path: "dist/graphql-ts-client.cjs.production.min.js",
535
- limit: "10 KB"
500
+ license: "MIT",
501
+ author: "Wellington Guimaraes",
502
+ contributors: [
503
+ "Felipe Pinheiro <felipe.pinheiro.90@hotmail.com>"
504
+ ],
505
+ exports: {
506
+ ".": {
507
+ import: "./dist/index.mjs",
508
+ require: "./dist/index.js",
509
+ types: "./dist/index.d.ts"
536
510
  },
537
- {
538
- path: "dist/graphql-ts-client.esm.js",
539
- limit: "10 KB"
511
+ "./dist/endpoint": {
512
+ import: "./dist/endpoint.mjs",
513
+ require: "./dist/endpoint.js",
514
+ types: "./dist/endpoint.d.ts"
540
515
  }
516
+ },
517
+ main: "dist/index.js",
518
+ module: "dist/index.mjs",
519
+ typings: "dist/index.d.ts",
520
+ files: [
521
+ "dist",
522
+ "src"
541
523
  ],
524
+ scripts: {
525
+ build: "yarn tsup src/index.ts src/endpoint.ts --dts --format cjs,esm",
526
+ prepublishOnly: "yarn build",
527
+ test: "cross-env GQL_CLIENT_DIST_PATH='.' jest --watch"
528
+ },
542
529
  dependencies: {
543
530
  "@types/md5": "^2.3.2",
544
531
  axios: "^0.24.0",
545
532
  "axios-retry": "^3.2.4",
546
533
  case: "^1.6.3",
547
534
  esbuild: "^0.13.14",
548
- graphql: "^15.6.0",
535
+ graphql: "^16.13.2",
549
536
  lodash: "^4.17.21",
550
537
  md5: "^2.3.0",
551
538
  moize: "^6.1.0",
@@ -574,9 +561,23 @@ var package_default = {
574
561
  tsup: "^6.5.0",
575
562
  typescript: "^4.9.4"
576
563
  },
564
+ peerDependencies: {},
565
+ engines: {
566
+ node: ">=12"
567
+ },
577
568
  publishConfig: {
578
569
  "@avantstay:registry": "https://registry.npmjs.org/"
579
- }
570
+ },
571
+ "size-limit": [
572
+ {
573
+ path: "dist/graphql-ts-client.cjs.production.min.js",
574
+ limit: "10 KB"
575
+ },
576
+ {
577
+ path: "dist/graphql-ts-client.esm.js",
578
+ limit: "10 KB"
579
+ }
580
+ ]
580
581
  };
581
582
  // src/generateTypescriptClient.ts
582
583
  var tempDir = fs.realpathSync(import_os.default.tmpdir());
@@ -773,9 +774,12 @@ function generateClientCode(types, options) {
773
774
  var clientCacheFileName = "gql-ts-client__client__".concat(typesHash, "__").concat(package_default.version, ".json");
774
775
  var clientCacheFilePath = import_path.default.resolve(tempDir, clientCacheFileName);
775
776
  if (!options.skipCache && fs.existsSync(clientCacheFilePath)) {
776
- return JSON.parse(fs.readFileSync(clientCacheFilePath, {
777
+ var output2 = JSON.parse(fs.readFileSync(clientCacheFilePath, {
777
778
  encoding: "utf8"
778
779
  }));
780
+ if (output2.js && output2.mjs && output2.typings) {
781
+ return output2;
782
+ }
779
783
  }
780
784
  var queries = ((_types_find = types.find(function(it) {
781
785
  return it.name === "Query";
@@ -848,6 +852,10 @@ function generateClientCode(types, options) {
848
852
  format: "cjs",
849
853
  loader: "js"
850
854
  }).code,
855
+ mjs: esbuild.transformSync(jsCode, {
856
+ format: "esm",
857
+ loader: "js"
858
+ }).code,
851
859
  typings: prettier.format(typingsCode, {
852
860
  semi: false,
853
861
  parser: "typescript"
@@ -876,21 +884,21 @@ function _fetchIntrospection() {
876
884
  }, {
877
885
  headers: _objectSpread({
878
886
  "Content-Type": "application/json"
879
- }, headers)
887
+ }, headers),
888
+ timeout: 5e3
880
889
  }).catch(function(e) {
881
- var errorMessage = "The GraphQL introspection request failed (".concat(endpoint, ")");
882
890
  if (fs.existsSync(introspectionCacheFilePath)) {
883
891
  var cachedSchema = JSON.parse(fs.readFileSync(introspectionCacheFilePath, {
884
892
  encoding: "utf8"
885
893
  }));
886
894
  loadedFromCache = true;
887
- console.warn("Successfully restored from local cache.");
895
+ console.warn("Successfully restored (".concat(endpoint, ") from local cache."));
888
896
  return {
889
897
  data: cachedSchema
890
898
  };
891
899
  } else {
892
900
  console.error(e);
893
- return Promise.reject(errorMessage);
901
+ return Promise.reject("The GraphQL introspection request failed (".concat(endpoint, ")"));
894
902
  }
895
903
  })
896
904
  ];
@@ -916,7 +924,7 @@ function generateClient(introspectionTypes, _param) {
916
924
  var output = _param.output, restOptions = _objectWithoutProperties(_param, [
917
925
  "output"
918
926
  ]);
919
- var _generateClientCode = generateClientCode(introspectionTypes, restOptions), js = _generateClientCode.js, typings = _generateClientCode.typings;
927
+ var _generateClientCode = generateClientCode(introspectionTypes, restOptions), js = _generateClientCode.js, mjs = _generateClientCode.mjs, typings = _generateClientCode.typings;
920
928
  if (output && typeof output === "string") {
921
929
  var outputDir = import_path.default.dirname(output);
922
930
  if (!fs.existsSync(outputDir)) {
@@ -930,9 +938,13 @@ function generateClient(introspectionTypes, _param) {
930
938
  fs.writeFileSync(output.replace(/(\.(ts|js))?$/, ".js"), js, {
931
939
  encoding: "utf8"
932
940
  });
941
+ fs.writeFileSync(output.replace(/(\.(ts|js))?$/, ".mjs"), mjs, {
942
+ encoding: "utf8"
943
+ });
933
944
  }
934
945
  return {
935
946
  js: js,
947
+ mjs: mjs,
936
948
  typings: typings
937
949
  };
938
950
  }
@@ -973,11 +985,15 @@ function _generateTypescriptClient() {
973
985
  return _generateTypescriptClient.apply(this, arguments);
974
986
  }
975
987
  function generateTypescriptClientFromSDL(SDL, options) {
976
- var _data;
988
+ var _introspectionResult_data;
977
989
  var _options_clientName;
978
990
  console.log("Generating TypeScript client from SDL (name: ".concat((_options_clientName = options.clientName) !== null && _options_clientName !== void 0 ? _options_clientName : "n/a", ")"));
979
991
  var graphqlSchemaObj = (0, import_graphql.buildSchema)(SDL);
980
- var introspectionTypes = (_data = (0, import_graphql.graphqlSync)(graphqlSchemaObj, new import_graphql.Source((0, import_graphql.getIntrospectionQuery)())).data) === null || _data === void 0 ? void 0 : _data.__schema.types;
992
+ var introspectionResult = (0, import_graphql.graphqlSync)({
993
+ schema: graphqlSchemaObj,
994
+ source: (0, import_graphql.getIntrospectionQuery)()
995
+ });
996
+ var introspectionTypes = (_introspectionResult_data = introspectionResult.data) === null || _introspectionResult_data === void 0 ? void 0 : _introspectionResult_data.__schema.types;
981
997
  return generateClient(introspectionTypes, options);
982
998
  }
983
999
  // src/types.ts