@pintahub/shopify-api 1.9.3 → 1.9.5

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,10 @@
1
+ import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types";
2
+ import { ActionBuilder } from "../../ActionBuilder";
3
+ export interface GetProductInput extends Record<string, any> {
4
+ id: string;
5
+ }
6
+ export interface GetProductOutput extends Record<string, any> {
7
+ }
8
+ export declare class GetProduct extends ActionBuilder<AdminApiClient, GetProductInput, GetProductOutput> {
9
+ run(args: GetProductInput): Promise<GetProductOutput>;
10
+ }
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GetProduct = void 0;
13
+ const ActionBuilder_1 = require("../../ActionBuilder");
14
+ const getGlobalID_1 = require("../../../utils/getGlobalID");
15
+ const handleErrors_1 = require("../../../utils/handleErrors");
16
+ class GetProduct extends ActionBuilder_1.ActionBuilder {
17
+ run(args) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const { id } = args;
20
+ const globalId = (0, getGlobalID_1.getGlobalID)(id, 'Product');
21
+ const query = `
22
+ {
23
+ product(id: "${globalId}") {
24
+ id
25
+ handle
26
+ publishedAt
27
+ updatedAt
28
+ status
29
+ featuredImage {
30
+ id
31
+ altText
32
+ url
33
+ width
34
+ height
35
+ }
36
+ priceRangeV2 {
37
+ maxVariantPrice {
38
+ amount
39
+ currencyCode
40
+ }
41
+ minVariantPrice {
42
+ amount
43
+ currencyCode
44
+ }
45
+ }
46
+ productType
47
+ title
48
+ description
49
+ descriptionHtml
50
+ tags
51
+ productCategory {
52
+ productTaxonomyNode {
53
+ fullName
54
+ name
55
+ }
56
+ }
57
+ collections(first: 100) {
58
+ nodes {
59
+ id
60
+ }
61
+ }
62
+ metafields(first: 100) {
63
+ nodes {
64
+ key
65
+ value
66
+ type
67
+ }
68
+ }
69
+ images(first: 100) {
70
+ nodes {
71
+ id
72
+ url
73
+ height
74
+ altText
75
+ width
76
+ }
77
+ }
78
+ }
79
+ }
80
+ `;
81
+ const { data, errors, extensions } = yield this.client.request(query);
82
+ yield (0, handleErrors_1.handleErrors)(errors);
83
+ const { product } = Object.assign({}, data);
84
+ return Object.assign({
85
+ status: 'DELETED'
86
+ }, product);
87
+ });
88
+ }
89
+ }
90
+ exports.GetProduct = GetProduct;
@@ -2,12 +2,15 @@ import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types"
2
2
  import { APIBase } from "../../APIBase";
3
3
  import { UpdateVariantsInput, UpdateVariantsOutput } from "./UpdateVariants";
4
4
  import { UpdateProductInput, UpdateProductOutput } from "./UpdateProduct";
5
+ import { GetProductInput, GetProductOutput } from "./GetProduct";
5
6
  export interface AdminProductsAPIInterface {
7
+ get(args: GetProductInput): Promise<GetProductOutput>;
6
8
  update(args: UpdateProductInput): Promise<UpdateProductOutput>;
7
9
  updateVariants(args: UpdateVariantsInput): Promise<UpdateVariantsOutput>;
8
10
  }
9
11
  export declare class AdminProductsAPI extends APIBase<AdminApiClient> implements AdminProductsAPIInterface {
10
12
  private _runAction;
13
+ get(args: GetProductInput): Promise<GetProductOutput>;
11
14
  update(args: UpdateProductInput): Promise<UpdateProductOutput>;
12
15
  updateVariants(args: UpdateVariantsInput): Promise<UpdateVariantsOutput>;
13
16
  }
@@ -13,6 +13,7 @@ exports.AdminProductsAPI = void 0;
13
13
  const APIBase_1 = require("../../APIBase");
14
14
  const UpdateVariants_1 = require("./UpdateVariants");
15
15
  const UpdateProduct_1 = require("./UpdateProduct");
16
+ const GetProduct_1 = require("./GetProduct");
16
17
  class AdminProductsAPI extends APIBase_1.APIBase {
17
18
  _runAction(Action, args) {
18
19
  return __awaiter(this, void 0, void 0, function* () {
@@ -20,6 +21,11 @@ class AdminProductsAPI extends APIBase_1.APIBase {
20
21
  return action.run(args);
21
22
  });
22
23
  }
24
+ get(args) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ return this._runAction(GetProduct_1.GetProduct, args);
27
+ });
28
+ }
23
29
  update(args) {
24
30
  return __awaiter(this, void 0, void 0, function* () {
25
31
  return this._runAction(UpdateProduct_1.UpdateProduct, args);
@@ -3,4 +3,5 @@ export interface CustomerInput extends Record<string, any> {
3
3
  email?: string;
4
4
  phone?: string;
5
5
  emailMarketingConsent?: CustomerEmailMarketingConsentInput;
6
+ tags?: Array<string>;
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/shopify-api",
3
- "version": "1.9.3",
3
+ "version": "1.9.5",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@shopify/admin-api-client": "^1.0.0",
19
19
  "@shopify/storefront-api-client": "^1.0.0",
20
- "axios": "^1.7.2",
20
+ "axios": "^1.7.7",
21
21
  "p-map": "^4"
22
22
  }
23
23
  }