@simtlix/simfinity-js-client 1.0.1 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simtlix/simfinity-js-client",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Introspection-driven GraphQL client for simfinity-js APIs",
5
5
  "type": "module",
6
6
  "main": "src/SimfinityClient.js",
@@ -268,6 +268,12 @@ class QueryBuilder {
268
268
  return this;
269
269
  }
270
270
 
271
+ clearSort() {
272
+ this._sortTerms = [];
273
+ delete this._variables.sort;
274
+ return this;
275
+ }
276
+
271
277
  autoSelect() {
272
278
  const result = this._client.buildSelectionSet(this._typeName);
273
279
  this._hasExplicitFields = true;
@@ -312,7 +318,7 @@ class QueryBuilder {
312
318
  const query = `query${varDefsStr} { ${queryInfo.name}${argsBlock} { ${selectionSet} } }`;
313
319
 
314
320
  const response = await this._client._sendRequest(query, variables);
315
- if (response.errors) {
321
+ if (response.errors && !response.data?.[queryInfo.name]) {
316
322
  const error = new Error(`GraphQL errors: ${JSON.stringify(response.errors)}`);
317
323
  error.graphQLErrors = response.errors;
318
324
  throw error;
@@ -361,7 +367,7 @@ class QueryBuilder {
361
367
  const query = `query${varDefsStr} { ${queryInfo.name}${argsBlock} { ${selectionSet} } }`;
362
368
 
363
369
  const response = await this._client._sendRequest(query, variables);
364
- if (response.errors) {
370
+ if (response.errors && !response.data?.[queryInfo.name]) {
365
371
  const error = new Error(`GraphQL errors: ${JSON.stringify(response.errors)}`);
366
372
  error.graphQLErrors = response.errors;
367
373
  throw error;
@@ -750,7 +756,7 @@ export default class SimfinityClient {
750
756
  const query = `query($id: ${idType}) { ${queryInfo.name}(id: $id) { ${selectionSet} } }`;
751
757
  const response = await this._sendRequest(query, { id });
752
758
 
753
- if (response.errors) {
759
+ if (response.errors && !response.data?.[queryInfo.name]) {
754
760
  const error = new Error(`GraphQL errors: ${JSON.stringify(response.errors)}`);
755
761
  error.graphQLErrors = response.errors;
756
762
  throw error;