@pintahub/shopify-api 1.8.2 → 1.8.4

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.
@@ -3,6 +3,7 @@ import { ActionBuilder } from "../../ActionBuilder";
3
3
  export interface UpdateVariantInput extends Record<string, any> {
4
4
  id: string;
5
5
  compareAtPrice?: string;
6
+ price?: string;
6
7
  }
7
8
  export interface UpdateVariantOutput extends Record<string, any> {
8
9
  }
@@ -12,28 +12,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UpdateVariant = void 0;
13
13
  const ActionBuilder_1 = require("../../ActionBuilder");
14
14
  const getGlobalID_1 = require("../../../utils/getGlobalID");
15
+ const handleErrors_1 = require("../../../utils/handleErrors");
15
16
  class UpdateVariant extends ActionBuilder_1.ActionBuilder {
16
17
  run(args) {
17
18
  return __awaiter(this, void 0, void 0, function* () {
18
- const { id, compareAtPrice } = args;
19
+ const { id, compareAtPrice, price } = args;
19
20
  const globalId = (0, getGlobalID_1.getGlobalID)(id, 'ProductVariant');
21
+ const vArgs = Object.assign({}, args, { id: globalId });
20
22
  const input = `
21
23
  input: {
22
24
  id: "${globalId}",
23
- ${compareAtPrice && `compareAtPrice: "${compareAtPrice}"`}
25
+ ${compareAtPrice && `compareAtPrice: "${compareAtPrice}",`}
26
+ ${price && `price: "${price}",`}
24
27
  }
25
28
  `;
26
29
  const query = `
27
- mutation {
28
- productVariantUpdate(${input}) {
30
+ mutation productVariantUpdate($input: ProductVariantInput!) {
31
+ productVariantUpdate(input: $input) {
29
32
  productVariant {
30
33
  id
31
34
  compareAtPrice
35
+ price
32
36
  }
33
37
  }
34
38
  }
35
39
  `;
36
- const { data } = yield this.client.request(query);
40
+ const { data, errors } = yield this.client.request(query, {
41
+ variables: {
42
+ input: vArgs,
43
+ }
44
+ });
45
+ yield (0, handleErrors_1.handleErrors)(errors);
37
46
  const { productVariantUpdate } = Object.assign({}, data);
38
47
  const { productVariant } = Object.assign({}, productVariantUpdate);
39
48
  return Object.assign({}, productVariant);
@@ -44,8 +44,6 @@ class GetProduct extends ActionBuilder_1.ActionBuilder {
44
44
  currencyCode
45
45
  }
46
46
  }
47
- description(truncateAt: 300)
48
- descriptionHtml
49
47
  options {
50
48
  values
51
49
  name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/shopify-api",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",