@gen3/core 0.11.44 → 0.11.45

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/dist/cjs/index.js CHANGED
@@ -827,16 +827,26 @@ const cartReducerPath = 'cart';
827
827
  method: 'POST',
828
828
  body: JSON.stringify(query)
829
829
  });
830
+ const data = await response.json();
831
+ // Check the response for GraphQL errors
832
+ if (data && 'errors' in data) {
833
+ // Return an object with an 'error' property if GraphQL errors are present
834
+ return {
835
+ error: {
836
+ message: data.errors[0].message,
837
+ locations: data.errors[0].locations
838
+ }
839
+ };
840
+ }
830
841
  return {
831
- data: await response.json()
842
+ data
832
843
  };
833
844
  } catch (e) {
834
845
  if (e instanceof graphql.GraphQLError) {
835
846
  return {
836
847
  error: {
837
848
  message: e.message,
838
- locations: e.locations,
839
- path: e.path
849
+ locations: e.locations
840
850
  }
841
851
  };
842
852
  }
@@ -2419,7 +2429,7 @@ const explorerTags = guppyApi.enhanceEndpoints({
2419
2429
  const containsDotsUniqueBase = containsDots.reduce((acc, field)=>{
2420
2430
  const partsArr = field.split('.');
2421
2431
  if (partsArr.length < 2) {
2422
- throw new Error('Explorer does not support field with more than one \'.\' separator\'t');
2432
+ throw new Error("Explorer does not support field with more than one '.' separator");
2423
2433
  }
2424
2434
  const basePart = partsArr[0];
2425
2435
  if (!acc.includes(basePart)) {
@@ -2433,7 +2443,7 @@ const explorerTags = guppyApi.enhanceEndpoints({
2433
2443
  // this is to make it easier to work with in the table component
2434
2444
  // currently only supports one level of nesting
2435
2445
  // also puts original into subRows for dropdown viewing
2436
- const tempResponse = response.data[args.type].map((item)=>{
2446
+ const tempResponse = response.data[`${args.indexPrefix}${args.type}`].map((item)=>{
2437
2447
  const tempItem = item;
2438
2448
  for(let i = 0; i < containsDotsUniqueBase.length; i++){
2439
2449
  const basePart = containsDotsUniqueBase[i];
@@ -2458,7 +2468,7 @@ const explorerTags = guppyApi.enhanceEndpoints({
2458
2468
  return {
2459
2469
  data: {
2460
2470
  _aggregation: response.data._aggregation,
2461
- [args.type]: tempResponse
2471
+ [`${args.indexPrefix}${args.type}`]: tempResponse
2462
2472
  }
2463
2473
  };
2464
2474
  }