@pintahub/shopify-api 2.5.6 → 2.5.8

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.
Files changed (79) hide show
  1. package/dist/classes/ShopAppAPI.d.ts +10 -0
  2. package/dist/classes/ShopAppAPI.js +62 -0
  3. package/dist/classes/admin/metaobjects/GetListFAQs.js +1 -1
  4. package/dist/classes/admin/metaobjects/faqs/_parseFAQs.js +1 -1
  5. package/dist/classes/shop/graphql/StoreReviews.d.ts +1 -0
  6. package/dist/classes/shop/graphql/StoreReviews.js +82 -0
  7. package/dist/fragments/cart.d.ts +1 -1
  8. package/dist/fragments/cart.js +1 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +1 -0
  11. package/dist/input/MediaContentType.js +1 -1
  12. package/dist/input/WeightUnit.js +1 -1
  13. package/dist/interfaces/ShopAppOptions.d.ts +4 -0
  14. package/dist/interfaces/ShopAppOptions.js +2 -0
  15. package/package.json +3 -3
  16. package/dist/actions/admin/GetProduct.d.ts +0 -10
  17. package/dist/actions/admin/GetProduct.js +0 -74
  18. package/dist/actions/admin/SearchProducts.d.ts +0 -12
  19. package/dist/actions/admin/SearchProducts.js +0 -45
  20. package/dist/actions/admin/products/GetProduct.d.ts +0 -10
  21. package/dist/actions/admin/products/GetProduct.js +0 -74
  22. package/dist/actions/admin/products/SearchProducts.d.ts +0 -12
  23. package/dist/actions/admin/products/SearchProducts.js +0 -45
  24. package/dist/actions/storefront/getProductByHandle.d.ts +0 -11
  25. package/dist/actions/storefront/getProductByHandle.js +0 -39
  26. package/dist/classes/ActionBase.d.ts +0 -2
  27. package/dist/classes/ActionBase.js +0 -6
  28. package/dist/classes/ShopifyAPI.d.ts +0 -3
  29. package/dist/classes/ShopifyAPI.js +0 -8
  30. package/dist/classes/admin/files/GetOrder.d.ts +0 -10
  31. package/dist/classes/admin/files/GetOrder.js +0 -52
  32. package/dist/classes/admin/orders/GetProduct.d.ts +0 -10
  33. package/dist/classes/admin/orders/GetProduct.js +0 -80
  34. package/dist/classes/admin/orders-v2/GetOrder.d.ts +0 -10
  35. package/dist/classes/admin/orders-v2/GetOrder.js +0 -52
  36. package/dist/classes/admin/orders-v2/SearchOrders.d.ts +0 -14
  37. package/dist/classes/admin/orders-v2/SearchOrders.js +0 -50
  38. package/dist/classes/admin/orders-v2/index.d.ts +0 -13
  39. package/dist/classes/admin/orders-v2/index.js +0 -34
  40. package/dist/classes/admin/pages/SearchPages.d.ts +0 -11
  41. package/dist/classes/admin/pages/SearchPages.js +0 -24
  42. package/dist/classes/admin/pages/index.d.ts +0 -10
  43. package/dist/classes/admin/pages/index.js +0 -28
  44. package/dist/classes/admin/payments/GetMenu.d.ts +0 -23
  45. package/dist/classes/admin/payments/GetMenu.js +0 -58
  46. package/dist/classes/admin/payments/SearchMenus.d.ts +0 -13
  47. package/dist/classes/admin/payments/SearchMenus.js +0 -47
  48. package/dist/classes/admin/products/CreateVariant.d.ts +0 -12
  49. package/dist/classes/admin/products/CreateVariant.js +0 -56
  50. package/dist/classes/admin/products/GetProductPublications.d.ts +0 -10
  51. package/dist/classes/admin/products/GetProductPublications.js +0 -104
  52. package/dist/classes/admin/products-v2/UpdateVariant.d.ts +0 -15
  53. package/dist/classes/admin/products-v2/UpdateVariant.js +0 -54
  54. package/dist/classes/admin/shop/GetPolicyPage.d.ts +0 -10
  55. package/dist/classes/admin/shop/GetPolicyPage.js +0 -47
  56. package/dist/classes/rest/orders/SearchOrderItems.d.ts +0 -12
  57. package/dist/classes/rest/orders/SearchOrderItems.js +0 -29
  58. package/dist/classes/rest/orders/SearchOrders.d.ts +0 -14
  59. package/dist/classes/rest/orders/SearchOrders.js +0 -49
  60. package/dist/classes/rest/orders/orders/GetOrder.d.ts +0 -10
  61. package/dist/classes/rest/orders/orders/GetOrder.js +0 -52
  62. package/dist/classes/rest/orders/orders/SearchOrders.d.ts +0 -14
  63. package/dist/classes/rest/orders/orders/SearchOrders.js +0 -49
  64. package/dist/classes/rest/orders/orders/index.d.ts +0 -13
  65. package/dist/classes/rest/orders/orders/index.js +0 -34
  66. package/dist/classes/rest/products/GetOrder.d.ts +0 -12
  67. package/dist/classes/rest/products/GetOrder.js +0 -29
  68. package/dist/classes/rest/products/index.d.ts +0 -10
  69. package/dist/classes/rest/products/index.js +0 -28
  70. package/dist/classes/storefront/cart/GetPage.d.ts +0 -10
  71. package/dist/classes/storefront/cart/GetPage.js +0 -43
  72. package/dist/classes/storefront/posts/GetProduct.d.ts +0 -10
  73. package/dist/classes/storefront/posts/GetProduct.js +0 -94
  74. package/dist/classes/storefront/products/SearchProducts.d.ts +0 -12
  75. package/dist/classes/storefront/products/SearchProducts.js +0 -47
  76. package/dist/utils/parseCleanId.d.ts +0 -0
  77. package/dist/utils/parseCleanId.js +0 -1
  78. package/dist/utils.d.ts +0 -0
  79. package/dist/utils.js +0 -1
@@ -0,0 +1,10 @@
1
+ import { ShopAppOptions } from "../interfaces/ShopAppOptions";
2
+ export declare class ShopAppAPI {
3
+ private readonly options;
4
+ private readonly client;
5
+ constructor(options: ShopAppOptions);
6
+ private _createClient;
7
+ getReviews(): Promise<{
8
+ items: any[];
9
+ }>;
10
+ }
@@ -0,0 +1,62 @@
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.ShopAppAPI = void 0;
13
+ const axios_1 = require("axios");
14
+ const StoreReviews_1 = require("./shop/graphql/StoreReviews");
15
+ class ShopAppAPI {
16
+ constructor(options) {
17
+ this.options = options;
18
+ this.client = this._createClient();
19
+ }
20
+ _createClient() {
21
+ const { cookies } = this.options;
22
+ const url = `https://shop.app`;
23
+ return axios_1.default.create({
24
+ baseURL: url,
25
+ headers: {
26
+ cookie: cookies,
27
+ 'x-user-agent': 'ShopWeb desktop',
28
+ 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36',
29
+ },
30
+ responseType: 'json',
31
+ });
32
+ }
33
+ getReviews() {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ var _a, _b;
36
+ const variables = {
37
+ "first": 10,
38
+ "shopId": this.options.shop_id,
39
+ "sortBy": "DATE_DESC"
40
+ };
41
+ const { data } = yield this.client({
42
+ url: '/web/api/graphql',
43
+ method: 'POST',
44
+ headers: {
45
+ 'x-graphql-operation-name': 'StoreReviews',
46
+ },
47
+ data: {
48
+ operationName: 'StoreReviews',
49
+ query: StoreReviews_1.StoreReviewsQuery,
50
+ variables
51
+ }
52
+ });
53
+ const reviewsData = Object.assign({}, (_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.shop) === null || _b === void 0 ? void 0 : _b.productReviews);
54
+ const items = reviewsData === null || reviewsData === void 0 ? void 0 : reviewsData.nodes;
55
+ const vItems = Array.isArray(items) ? items : [];
56
+ return {
57
+ items: vItems,
58
+ };
59
+ });
60
+ }
61
+ }
62
+ exports.ShopAppAPI = ShopAppAPI;
@@ -15,8 +15,8 @@ const _parseFAQs_1 = require("./faqs/_parseFAQs");
15
15
  const handleErrors_1 = require("../../../utils/handleErrors");
16
16
  class GetListFAQs extends ActionBuilder_1.ActionBuilder {
17
17
  run(args) {
18
- var _a;
19
18
  return __awaiter(this, void 0, void 0, function* () {
19
+ var _a;
20
20
  const query = `
21
21
  {
22
22
  metaobjects(type: "faq", first: 100) {
@@ -40,7 +40,7 @@ const _parsePage = (page) => __awaiter(void 0, void 0, void 0, function* () {
40
40
  const body = yield (0, _parseContentObjToHTML_1._parseContentObjToHTML)(vContent, type);
41
41
  return Object.assign(Object.assign({}, rest), { title: vTitle, body });
42
42
  });
43
- const _parseFAQs = (pages = []) => __awaiter(void 0, void 0, void 0, function* () {
43
+ const _parseFAQs = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (pages = []) {
44
44
  if (!pages || !pages.length)
45
45
  return [];
46
46
  const vPages = yield pMap(pages, (page) => __awaiter(void 0, void 0, void 0, function* () {
@@ -0,0 +1 @@
1
+ export declare const StoreReviewsQuery = "\nquery StoreReviews($shopId: ID!, $first: Int!, $after: String, $filter: ShopProductReviewsFilterInput, $sortBy: ProductReviewsSortBy) {\n shop(id: $shopId) {\n id\n name\n websiteUrl\n productReviews(filter: $filter, first: $first, after: $after, sortBy: $sortBy) {\n nodes {\n ...StoreProductReview\n __typename\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n __typename\n }\n __typename\n }\n __typename\n }\n}\n\nfragment StoreProductReview on ProductReview {\n id\n syndicated\n reviewer {\n id\n displayName\n __typename\n }\n title\n body\n rating\n product {\n id\n image {\n ...ReducedImage\n __typename\n }\n title\n variantTitle\n slug\n __typename\n }\n submittedAt\n helpfulnessCount\n markedAsHelpfulByMe\n reportedByMe\n publishedVersion {\n id\n merchantReply\n merchantReplySubmittedAt\n createdAt\n __typename\n }\n discoveryProduct {\n id\n url\n title\n images {\n ...ReducedImage\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment ReducedImage on Image {\n __typename\n url\n altText\n height\n width\n sensitive\n thumbhash\n}\n";
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StoreReviewsQuery = void 0;
4
+ exports.StoreReviewsQuery = `
5
+ query StoreReviews($shopId: ID!, $first: Int!, $after: String, $filter: ShopProductReviewsFilterInput, $sortBy: ProductReviewsSortBy) {
6
+ shop(id: $shopId) {
7
+ id
8
+ name
9
+ websiteUrl
10
+ productReviews(filter: $filter, first: $first, after: $after, sortBy: $sortBy) {
11
+ nodes {
12
+ ...StoreProductReview
13
+ __typename
14
+ }
15
+ totalCount
16
+ pageInfo {
17
+ hasNextPage
18
+ endCursor
19
+ __typename
20
+ }
21
+ __typename
22
+ }
23
+ __typename
24
+ }
25
+ }
26
+
27
+ fragment StoreProductReview on ProductReview {
28
+ id
29
+ syndicated
30
+ reviewer {
31
+ id
32
+ displayName
33
+ __typename
34
+ }
35
+ title
36
+ body
37
+ rating
38
+ product {
39
+ id
40
+ image {
41
+ ...ReducedImage
42
+ __typename
43
+ }
44
+ title
45
+ variantTitle
46
+ slug
47
+ __typename
48
+ }
49
+ submittedAt
50
+ helpfulnessCount
51
+ markedAsHelpfulByMe
52
+ reportedByMe
53
+ publishedVersion {
54
+ id
55
+ merchantReply
56
+ merchantReplySubmittedAt
57
+ createdAt
58
+ __typename
59
+ }
60
+ discoveryProduct {
61
+ id
62
+ url
63
+ title
64
+ images {
65
+ ...ReducedImage
66
+ __typename
67
+ }
68
+ __typename
69
+ }
70
+ __typename
71
+ }
72
+
73
+ fragment ReducedImage on Image {
74
+ __typename
75
+ url
76
+ altText
77
+ height
78
+ width
79
+ sensitive
80
+ thumbhash
81
+ }
82
+ `;
@@ -1 +1 @@
1
- export declare const cartFragment = "\nfragment cart on Cart {\n id\n cost {\n subtotalAmount {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n }\n totalQuantity\n lines(first: 250, reverse: false) {\n nodes {\n id\n quantity\n attributes {\n value\n key\n }\n merchandise {\n ... on ProductVariant {\n title\n selectedOptions {\n name\n value\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n url(transform: {maxWidth: 300})\n altText\n width\n height\n }\n product {\n id\n title\n handle\n }\n id\n }\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n title\n }\n }\n }\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n title\n }\n }\n buyerIdentity {\n countryCode\n }\n checkoutUrl\n}\n";
1
+ export declare const cartFragment = "\nfragment cart on Cart {\n id\n cost {\n subtotalAmount {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n }\n totalQuantity\n lines(first: 250, reverse: false) {\n nodes {\n id\n quantity\n attributes {\n value\n key\n }\n merchandise {\n ... on ProductVariant {\n title\n selectedOptions {\n name\n value\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n id\n url(transform: {maxWidth: 300})\n altText\n width\n height\n }\n product {\n id\n title\n handle\n }\n id\n }\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n title\n }\n }\n }\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n title\n }\n }\n buyerIdentity {\n countryCode\n }\n checkoutUrl\n}\n";
@@ -39,6 +39,7 @@ fragment cart on Cart {
39
39
  currencyCode
40
40
  }
41
41
  image {
42
+ id
42
43
  url(transform: {maxWidth: 300})
43
44
  altText
44
45
  width
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './classes/StorefrontAPI';
2
2
  export * from './classes/AdminAPI';
3
3
  export * from './classes/RestAPI';
4
+ export * from './classes/ShopAppAPI';
package/dist/index.js CHANGED
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./classes/StorefrontAPI"), exports);
18
18
  __exportStar(require("./classes/AdminAPI"), exports);
19
19
  __exportStar(require("./classes/RestAPI"), exports);
20
+ __exportStar(require("./classes/ShopAppAPI"), exports);
@@ -7,4 +7,4 @@ var MediaContentType;
7
7
  MediaContentType["IMAGE"] = "IMAGE";
8
8
  MediaContentType["MODEL_3D"] = "MODEL_3D";
9
9
  MediaContentType["VIDEO"] = "VIDEO";
10
- })(MediaContentType = exports.MediaContentType || (exports.MediaContentType = {}));
10
+ })(MediaContentType || (exports.MediaContentType = MediaContentType = {}));
@@ -7,4 +7,4 @@ var WeightUnit;
7
7
  WeightUnit["KILOGRAMS"] = "KILOGRAMS";
8
8
  WeightUnit["OUNCES"] = "OUNCES";
9
9
  WeightUnit["POUNDS"] = "POUNDS";
10
- })(WeightUnit = exports.WeightUnit || (exports.WeightUnit = {}));
10
+ })(WeightUnit || (exports.WeightUnit = WeightUnit = {}));
@@ -0,0 +1,4 @@
1
+ export interface ShopAppOptions extends Record<string, any> {
2
+ shop_id: string;
3
+ cookies: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/shopify-api",
3
- "version": "2.5.6",
3
+ "version": "2.5.8",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
@@ -10,14 +10,14 @@
10
10
  "license": "ISC",
11
11
  "devDependencies": {
12
12
  "@types/bluebird": "^3.5.42",
13
- "@types/node": "^20.10.4",
13
+ "@types/node": "^20",
14
14
  "bluebird": "^3.7.2",
15
15
  "dotenv": "^16.3.1"
16
16
  },
17
17
  "dependencies": {
18
18
  "@shopify/admin-api-client": "^1.0.0",
19
19
  "@shopify/storefront-api-client": "^1.0.0",
20
- "axios": "^1.13.2",
20
+ "axios": "^1.13.5",
21
21
  "p-map": "^4"
22
22
  }
23
23
  }
@@ -1,10 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { ActionBuilder } from "../../classes/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
- }
@@ -1,74 +0,0 @@
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("../../classes/ActionBuilder");
14
- const getGlobalID_1 = require("../../utils/getGlobalID");
15
- class GetProduct extends ActionBuilder_1.ActionBuilder {
16
- run(args) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const { id } = args;
19
- const globalId = (0, getGlobalID_1.getGlobalID)(id, 'Product');
20
- const query = `
21
- {
22
- product(id: "${globalId}") {
23
- id
24
- handle
25
- publishedAt
26
- updatedAt
27
- status
28
- featuredImage {
29
- altText
30
- url(transform: {preferredContentType: PNG, maxWidth: 1024})
31
- width
32
- height
33
- }
34
- productType
35
- title
36
- priceRangeV2 {
37
- maxVariantPrice {
38
- amount
39
- currencyCode
40
- }
41
- minVariantPrice {
42
- amount
43
- currencyCode
44
- }
45
- }
46
- tags
47
- productCategory {
48
- productTaxonomyNode {
49
- fullName
50
- name
51
- }
52
- }
53
- collections(first: 100) {
54
- nodes {
55
- id
56
- }
57
- }
58
- metafields(first: 100) {
59
- nodes {
60
- key
61
- value
62
- type
63
- }
64
- }
65
- }
66
- }
67
- `;
68
- const { data } = yield this.client.request(query);
69
- const { product } = Object.assign({}, data);
70
- return Object.assign({}, product);
71
- });
72
- }
73
- }
74
- exports.GetProduct = GetProduct;
@@ -1,12 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { ActionBuilder } from "../../classes/ActionBuilder";
3
- export interface SearchProductsInput extends Record<string, any> {
4
- id: string;
5
- }
6
- export interface SearchProductsOutput extends Record<string, any> {
7
- items: any[];
8
- pageInfo: any;
9
- }
10
- export declare class SearchProducts extends ActionBuilder<AdminApiClient, SearchProductsInput, SearchProductsOutput> {
11
- run(args?: SearchProductsInput): Promise<SearchProductsOutput>;
12
- }
@@ -1,45 +0,0 @@
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.SearchProducts = void 0;
13
- const ActionBuilder_1 = require("../../classes/ActionBuilder");
14
- class SearchProducts extends ActionBuilder_1.ActionBuilder {
15
- run(args) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const query = `
18
- {
19
- products(
20
- first: 100
21
- sortKey: UPDATED_AT
22
- reverse: true
23
- ) {
24
- nodes {
25
- id
26
- }
27
- pageInfo {
28
- hasNextPage
29
- endCursor
30
- }
31
- }
32
- }
33
- `;
34
- const { data } = yield this.client.request(query);
35
- const { products } = Object.assign({}, data);
36
- const { nodes, pageInfo } = Object.assign({}, products);
37
- const items = Array.isArray(nodes) ? nodes : [];
38
- return {
39
- items,
40
- pageInfo
41
- };
42
- });
43
- }
44
- }
45
- exports.SearchProducts = SearchProducts;
@@ -1,10 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { ActionBuilder } from "../../../classes/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
- }
@@ -1,74 +0,0 @@
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("../../../classes/ActionBuilder");
14
- const getGlobalID_1 = require("../../../utils/getGlobalID");
15
- class GetProduct extends ActionBuilder_1.ActionBuilder {
16
- run(args) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const { id } = args;
19
- const globalId = (0, getGlobalID_1.getGlobalID)(id, 'Product');
20
- const query = `
21
- {
22
- product(id: "${globalId}") {
23
- id
24
- handle
25
- publishedAt
26
- updatedAt
27
- status
28
- featuredImage {
29
- altText
30
- url(transform: {preferredContentType: PNG, maxWidth: 1024})
31
- width
32
- height
33
- }
34
- productType
35
- title
36
- priceRangeV2 {
37
- maxVariantPrice {
38
- amount
39
- currencyCode
40
- }
41
- minVariantPrice {
42
- amount
43
- currencyCode
44
- }
45
- }
46
- tags
47
- productCategory {
48
- productTaxonomyNode {
49
- fullName
50
- name
51
- }
52
- }
53
- collections(first: 100) {
54
- nodes {
55
- id
56
- }
57
- }
58
- metafields(first: 100) {
59
- nodes {
60
- key
61
- value
62
- type
63
- }
64
- }
65
- }
66
- }
67
- `;
68
- const { data } = yield this.client.request(query);
69
- const { product } = Object.assign({}, data);
70
- return Object.assign({}, product);
71
- });
72
- }
73
- }
74
- exports.GetProduct = GetProduct;
@@ -1,12 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { ActionBuilder } from "../../../classes/ActionBuilder";
3
- export interface SearchProductsInput extends Record<string, any> {
4
- id: string;
5
- }
6
- export interface SearchProductsOutput extends Record<string, any> {
7
- items: any[];
8
- pageInfo: any;
9
- }
10
- export declare class SearchProducts extends ActionBuilder<AdminApiClient, SearchProductsInput, SearchProductsOutput> {
11
- run(args?: SearchProductsInput): Promise<SearchProductsOutput>;
12
- }
@@ -1,45 +0,0 @@
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.SearchProducts = void 0;
13
- const ActionBuilder_1 = require("../../../classes/ActionBuilder");
14
- class SearchProducts extends ActionBuilder_1.ActionBuilder {
15
- run(args) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const query = `
18
- {
19
- products(
20
- first: 100
21
- sortKey: UPDATED_AT
22
- reverse: true
23
- ) {
24
- nodes {
25
- id
26
- }
27
- pageInfo {
28
- hasNextPage
29
- endCursor
30
- }
31
- }
32
- }
33
- `;
34
- const { data } = yield this.client.request(query);
35
- const { products } = Object.assign({}, data);
36
- const { nodes, pageInfo } = Object.assign({}, products);
37
- const items = Array.isArray(nodes) ? nodes : [];
38
- return {
39
- items,
40
- pageInfo
41
- };
42
- });
43
- }
44
- }
45
- exports.SearchProducts = SearchProducts;
@@ -1,11 +0,0 @@
1
- import { ActionBuilder } from "../../classes/ActionBuilder";
2
- import { StorefrontApiClient } from "@shopify/storefront-api-client/dist/ts/types";
3
- export interface GetProductInput extends Record<string, any> {
4
- handle: string;
5
- }
6
- export interface GetProductOutput extends Record<string, any> {
7
- product: any;
8
- }
9
- export declare class GetProductByHandle extends ActionBuilder<StorefrontApiClient, GetProductInput, GetProductOutput> {
10
- run(args: GetProductInput): Promise<GetProductOutput>;
11
- }
@@ -1,39 +0,0 @@
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.GetProductByHandle = void 0;
13
- const ActionBuilder_1 = require("../../classes/ActionBuilder");
14
- class GetProductByHandle extends ActionBuilder_1.ActionBuilder {
15
- run(args) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const productQuery = `
18
- query ($handle: String) {
19
- product(handle: $handle) {
20
- id
21
- title
22
- handle
23
- }
24
- }
25
- `;
26
- const { handle } = args;
27
- const { data } = yield this.client.request(productQuery, {
28
- variables: {
29
- handle
30
- }
31
- });
32
- const { product } = Object.assign({}, data);
33
- return {
34
- product,
35
- };
36
- });
37
- }
38
- }
39
- exports.GetProductByHandle = GetProductByHandle;
@@ -1,2 +0,0 @@
1
- export declare abstract class ActionBase {
2
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionBase = void 0;
4
- class ActionBase {
5
- }
6
- exports.ActionBase = ActionBase;
@@ -1,3 +0,0 @@
1
- export declare class ShopifyAPI {
2
- constructor();
3
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShopifyAPI = void 0;
4
- class ShopifyAPI {
5
- constructor() {
6
- }
7
- }
8
- exports.ShopifyAPI = ShopifyAPI;
@@ -1,10 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { ActionBuilder } from "../../ActionBuilder";
3
- export interface GetOrderInput extends Record<string, any> {
4
- id: string;
5
- }
6
- export interface GetOrderOutput extends Record<string, any> {
7
- }
8
- export declare class GetOrder extends ActionBuilder<AdminApiClient, GetOrderInput, GetOrderOutput> {
9
- run(args: GetOrderInput): Promise<GetOrderOutput>;
10
- }