@avantstay/graphql-ts-client 12.0.0 → 12.0.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.
@@ -0,0 +1,18 @@
1
+ // src/types.ts
2
+ var GraphQLClientError = class extends Error {
3
+ constructor(responseData) {
4
+ super();
5
+ this.responseData = responseData;
6
+ Object.setPrototypeOf(this, GraphQLClientError.prototype);
7
+ }
8
+ get message() {
9
+ return this.response.errors.map((it) => it.message).join(";\n");
10
+ }
11
+ get response() {
12
+ return this.responseData;
13
+ }
14
+ };
15
+
16
+ export {
17
+ GraphQLClientError
18
+ };
package/dist/endpoint.js CHANGED
@@ -591,17 +591,14 @@ function _graphqlRequest() {
591
591
  return _graphqlRequest.apply(this, arguments);
592
592
  }
593
593
  // src/jsonToGraphQLQuery.ts
594
- var import_omit = __toESM(require("lodash/omit"));
594
+ var import_lodash = require("lodash");
595
595
  var VAR_PREFIX = "@@VAR@@";
596
596
  var VAR_PREFIX_LENGTH = VAR_PREFIX.length;
597
- var fromEntries = require("lodash/fromPairs");
598
- var entries = require("lodash/toPairs");
599
- var cloneDeep = require("lodash/cloneDeep");
600
597
  function jsonToGraphQLQuery(param) {
601
598
  var kind = param.kind, queryName = param.queryName, _param_jsonQuery = param.jsonQuery, jsonQuery = _param_jsonQuery === void 0 ? {} : _param_jsonQuery, typesTree = param.typesTree;
602
599
  var variablesData = {};
603
600
  var alias = jsonQuery.__alias;
604
- var newJsonQuery = cloneDeep((0, import_omit.default)(jsonQuery, [
601
+ var newJsonQuery = (0, import_lodash.cloneDeep)((0, import_lodash.omit)(jsonQuery, [
605
602
  "__alias",
606
603
  "__headers",
607
604
  "__url"
@@ -621,12 +618,12 @@ function jsonToGraphQLQuery(param) {
621
618
  });
622
619
  return variablesObj;
623
620
  }, {});
624
- var variablesQuery = Object.keys(variableItems).length ? "(".concat(entries(variableItems).map(function(param) {
621
+ var variablesQuery = Object.keys(variableItems).length ? "(".concat((0, import_lodash.toPairs)(variableItems).map(function(param) {
625
622
  var _param = _slicedToArray(param, 2), queryName2 = _param[0], type = _param[1].type;
626
623
  return "$".concat(queryName2, ": ").concat(type);
627
624
  }).join(", "), ")") : "";
628
625
  var query = "".concat(kind, " ").concat(alias || queryName).concat(variablesQuery, " { ").concat(alias ? "".concat(alias, ":") : "").concat(queryName).concat(toGraphql(newJsonQuery), " }");
629
- var variables = fromEntries(entries(variableItems).map(function(param) {
626
+ var variables = (0, import_lodash.fromPairs)((0, import_lodash.toPairs)(variableItems).map(function(param) {
630
627
  var _param = _slicedToArray(param, 2), k = _param[0], v = _param[1];
631
628
  return [
632
629
  k,
@@ -673,14 +670,14 @@ function extractVariables(param) {
673
670
  });
674
671
  }
675
672
  function toGraphql(jsonQuery) {
676
- var fields = entries(jsonQuery).filter(function(param) {
673
+ var fields = (0, import_lodash.toPairs)(jsonQuery).filter(function(param) {
677
674
  var _param = _slicedToArray(param, 2), k = _param[0], v = _param[1];
678
675
  return k !== "__args" && v !== false && v !== void 0;
679
676
  }).map(function(param) {
680
677
  var _param = _slicedToArray(param, 2), k = _param[0], v = _param[1];
681
678
  return typeof v === "object" ? "".concat(k).concat(toGraphql(v)) : k;
682
679
  }).join(" ");
683
- var validArgs = jsonQuery.__args ? entries(jsonQuery.__args).filter(function(param) {
680
+ var validArgs = jsonQuery.__args ? (0, import_lodash.toPairs)(jsonQuery.__args).filter(function(param) {
684
681
  var _param = _slicedToArray(param, 2), _ = _param[0], v = _param[1];
685
682
  return v !== void 0;
686
683
  }) : [];
package/dist/endpoint.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import {
2
- GraphQLClientError,
3
- __require
4
- } from "./chunk-I4QOADOI.mjs";
2
+ GraphQLClientError
3
+ } from "./chunk-2VJ7JZPA.mjs";
5
4
 
6
5
  // src/endpoint.ts
7
6
  import memoize from "moize";
@@ -80,12 +79,9 @@ async function graphqlRequest({
80
79
  }
81
80
 
82
81
  // src/jsonToGraphQLQuery.ts
83
- import omit from "lodash/omit";
82
+ import { cloneDeep, fromPairs as fromEntries, omit, toPairs as entries } from "lodash";
84
83
  var VAR_PREFIX = "@@VAR@@";
85
84
  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
85
  function jsonToGraphQLQuery({
90
86
  kind,
91
87
  queryName,
package/dist/index.js CHANGED
@@ -477,9 +477,7 @@ var import_case = __toESM(require("case"));
477
477
  var esbuild = __toESM(require("esbuild"));
478
478
  var fs = __toESM(require("fs"));
479
479
  var import_graphql = require("graphql");
480
- var import_kebabCase = __toESM(require("lodash/kebabCase"));
481
- var import_orderBy = __toESM(require("lodash/orderBy"));
482
- var import_set = __toESM(require("lodash/set"));
480
+ var import_lodash = require("lodash");
483
481
  var import_md5 = __toESM(require("md5"));
484
482
  var import_os = __toESM(require("os"));
485
483
  var import_path = __toESM(require("path"));
@@ -487,7 +485,7 @@ var prettier = __toESM(require("prettier"));
487
485
  // package.json
488
486
  var package_default = {
489
487
  name: "@avantstay/graphql-ts-client",
490
- version: "12.0.0",
488
+ version: "12.0.1",
491
489
  description: "GraphQL Typescript Client Generator",
492
490
  homepage: "https://github.com/avantstay/graphql-ts-client",
493
491
  bugs: {
@@ -692,9 +690,9 @@ function gqlSchemaToCode(gqlType, param) {
692
690
  if (rawKind === "SCALAR") {
693
691
  return outputType === "ts" ? "export declare type ".concat(gqlType.name, " = ").concat(/date/i.test(gqlType.name) ? "IDate" : "string") : "";
694
692
  }
695
- if (rawKind === "ENUM") return outputType === "ts" ? "\n export declare enum ".concat(gqlType.name, " {\n ").concat((0, import_orderBy.default)(gqlType.enumValues, "name").map(function(_) {
693
+ if (rawKind === "ENUM") return outputType === "ts" ? "\n export declare enum ".concat(gqlType.name, " {\n ").concat((0, import_lodash.orderBy)(gqlType.enumValues, "name").map(function(_) {
696
694
  return "".concat(import_case.default.camel(_.name), " = '").concat(_.name, "'");
697
- }).join(",\n "), "\n }") : "export const ".concat(gqlType.name, " = {").concat((0, import_orderBy.default)(gqlType.enumValues, "name").map(function(_) {
695
+ }).join(",\n "), "\n }") : "export const ".concat(gqlType.name, " = {").concat((0, import_lodash.orderBy)(gqlType.enumValues, "name").map(function(_) {
698
696
  return "".concat(import_case.default.camel(_.name), ": '").concat(_.name, "'");
699
697
  }).join(",\n "), "}");
700
698
  var fields = gqlType.fields && gqlType.fields || gqlType.inputFields && gqlType.inputFields || [];
@@ -740,7 +738,7 @@ function getTypesTreeCode(types) {
740
738
  return _.args.forEach(function(a) {
741
739
  var inputType = getGraphQLInputType(a.type);
742
740
  if (inputType) {
743
- (0, import_set.default)(typesTree, "".concat(type.name, ".").concat(_.name, ".__args.").concat(a.name), inputType);
741
+ (0, import_lodash.set)(typesTree, "".concat(type.name, ".").concat(_.name, ".__args.").concat(a.name), inputType);
744
742
  }
745
743
  });
746
744
  });
@@ -749,7 +747,7 @@ function getTypesTreeCode(types) {
749
747
  return t.fields.forEach(function(f) {
750
748
  var outputType = getGraphQLOutputType(f.type);
751
749
  if (outputType) {
752
- (0, import_set.default)(typesTree, "".concat(t.name, ".").concat(f.name, ".__shape"), outputType);
750
+ (0, import_lodash.set)(typesTree, "".concat(t.name, ".").concat(f.name, ".__shape"), outputType);
753
751
  }
754
752
  });
755
753
  });
@@ -874,7 +872,7 @@ function _fetchIntrospection() {
874
872
  switch(_state.label){
875
873
  case 0:
876
874
  endpoint = param.endpoint, headers = param.headers;
877
- introspectionCacheFileName = "gql-ts-client__introspection__".concat((0, import_kebabCase.default)(endpoint), ".json");
875
+ introspectionCacheFileName = "gql-ts-client__introspection__".concat((0, import_lodash.kebabCase)(endpoint), ".json");
878
876
  introspectionCacheFilePath = import_path.default.resolve(tempDir, introspectionCacheFileName);
879
877
  loadedFromCache = false;
880
878
  return [
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GraphQLClientError
3
- } from "./chunk-I4QOADOI.mjs";
3
+ } from "./chunk-2VJ7JZPA.mjs";
4
4
 
5
5
  // src/generateTypescriptClient.ts
6
6
  import axios from "axios";
@@ -13,9 +13,7 @@ import {
13
13
  getIntrospectionQuery,
14
14
  graphqlSync
15
15
  } from "graphql";
16
- import kebabCase from "lodash/kebabCase";
17
- import orderBy from "lodash/orderBy";
18
- import set from "lodash/set";
16
+ import { kebabCase, orderBy, set } from "lodash";
19
17
  import md5 from "md5";
20
18
  import os from "os";
21
19
  import path from "path";
@@ -24,7 +22,7 @@ import * as prettier from "prettier";
24
22
  // package.json
25
23
  var package_default = {
26
24
  name: "@avantstay/graphql-ts-client",
27
- version: "12.0.0",
25
+ version: "12.0.1",
28
26
  description: "GraphQL Typescript Client Generator",
29
27
  homepage: "https://github.com/avantstay/graphql-ts-client",
30
28
  bugs: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avantstay/graphql-ts-client",
3
- "version": "12.0.0",
3
+ "version": "12.0.1",
4
4
  "description": "GraphQL Typescript Client Generator",
5
5
  "homepage": "https://github.com/avantstay/graphql-ts-client",
6
6
  "bugs": {
@@ -16,9 +16,7 @@ import {
16
16
  IntrospectionOutputTypeRef,
17
17
  IntrospectionType,
18
18
  } from 'graphql'
19
- import kebabCase from 'lodash/kebabCase'
20
- import orderBy from 'lodash/orderBy'
21
- import set from 'lodash/set'
19
+ import { kebabCase, orderBy, set } from 'lodash'
22
20
  import md5 from 'md5'
23
21
  import os from 'os'
24
22
  import path from 'path'
@@ -1,12 +1,8 @@
1
- import omit from 'lodash/omit'
1
+ import { cloneDeep, fromPairs as fromEntries, omit, toPairs as entries } from 'lodash'
2
2
 
3
3
  const VAR_PREFIX = '@@VAR@@'
4
4
  const VAR_PREFIX_LENGTH = VAR_PREFIX.length
5
5
 
6
- const fromEntries: (arr: [string, any][]) => { [key: string]: any } = require('lodash/fromPairs')
7
- const entries: (obj: { [key: string]: any }) => [string, any][] = require('lodash/toPairs')
8
- const cloneDeep = require('lodash/cloneDeep')
9
-
10
6
  type ExtractedVariables = Record<string, (Variable & { name: string; update: (index?: number) => string })[]>
11
7
  type Variable = { type: any; value: any }
12
8