@pintahub/shopify-api 1.5.8 → 1.6.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.
@@ -27,6 +27,7 @@ class GetProduct extends ActionBuilder_1.ActionBuilder {
27
27
  updatedAt
28
28
  status
29
29
  featuredImage {
30
+ id
30
31
  altText
31
32
  url(transform: {preferredContentType: PNG, maxWidth: 1200})
32
33
  width
@@ -0,0 +1 @@
1
+ export declare const delay: (timeout: number) => Promise<unknown>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.delay = void 0;
4
+ const delay = (timeout) => {
5
+ return new Promise((resolve) => {
6
+ setTimeout(resolve, timeout);
7
+ });
8
+ };
9
+ exports.delay = delay;
@@ -10,12 +10,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.handleErrors = void 0;
13
+ const delay_1 = require("./delay");
13
14
  const handleErrors = (errors) => __awaiter(void 0, void 0, void 0, function* () {
14
15
  if (!errors)
15
16
  return;
16
17
  const { message, graphQLErrors } = Object.assign({}, errors);
17
18
  if (graphQLErrors) {
18
- console.error('GraphQL Errors:', graphQLErrors);
19
+ if (Array.isArray(graphQLErrors) && graphQLErrors.length > 0) {
20
+ const { extensions } = Object.assign({}, graphQLErrors[0]);
21
+ const { code } = Object.assign({}, extensions);
22
+ if (code === 'THROTTLED') {
23
+ yield (0, delay_1.delay)(5000);
24
+ }
25
+ }
19
26
  }
20
27
  if (message) {
21
28
  throw new Error(message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/shopify-api",
3
- "version": "1.5.8",
3
+ "version": "1.6.0",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",