@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
@@ -1,52 +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.GetOrder = void 0;
13
- const ActionBuilder_1 = require("../../ActionBuilder");
14
- const getGlobalID_1 = require("../../../utils/getGlobalID");
15
- const handleErrors_1 = require("../../../utils/handleErrors");
16
- class GetOrder 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, 'Order');
21
- const query = `
22
- {
23
- order(id: "${globalId}") {
24
- id
25
- createdAt
26
- updatedAt
27
- name
28
- email
29
- phone
30
- shippingAddress {
31
- name
32
- countryCodeV2
33
- }
34
- displayFulfillmentStatus
35
- displayFinancialStatus
36
- totalPriceSet {
37
- shopMoney {
38
- amount
39
- currencyCode
40
- }
41
- }
42
- }
43
- }
44
- `;
45
- const { data, errors, extensions } = yield this.client.request(query);
46
- yield (0, handleErrors_1.handleErrors)(errors);
47
- const { order } = Object.assign({}, data);
48
- return Object.assign({}, order);
49
- });
50
- }
51
- }
52
- exports.GetOrder = GetOrder;
@@ -1,10 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/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
- }
@@ -1,80 +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("../../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
- altText
31
- url(transform: {preferredContentType: PNG, maxWidth: 1200})
32
- width
33
- height
34
- }
35
- priceRangeV2 {
36
- maxVariantPrice {
37
- amount
38
- currencyCode
39
- }
40
- minVariantPrice {
41
- amount
42
- currencyCode
43
- }
44
- }
45
- productType
46
- title
47
- description
48
- descriptionHtml
49
- tags
50
- productCategory {
51
- productTaxonomyNode {
52
- fullName
53
- name
54
- }
55
- }
56
- collections(first: 100) {
57
- nodes {
58
- id
59
- }
60
- }
61
- metafields(first: 100) {
62
- nodes {
63
- key
64
- value
65
- type
66
- }
67
- }
68
- }
69
- }
70
- `;
71
- const { data, errors, extensions } = yield this.client.request(query);
72
- yield (0, handleErrors_1.handleErrors)(errors);
73
- const { product } = Object.assign({}, data);
74
- return Object.assign({
75
- status: 'DELETED'
76
- }, product);
77
- });
78
- }
79
- }
80
- exports.GetProduct = GetProduct;
@@ -1,10 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/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
- }
@@ -1,52 +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.GetOrder = void 0;
13
- const ActionBuilder_1 = require("../../ActionBuilder");
14
- const getGlobalID_1 = require("../../../utils/getGlobalID");
15
- const handleErrors_1 = require("../../../utils/handleErrors");
16
- class GetOrder 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, 'Order');
21
- const query = `
22
- {
23
- order(id: "${globalId}") {
24
- id
25
- createdAt
26
- updatedAt
27
- name
28
- email
29
- phone
30
- shippingAddress {
31
- name
32
- countryCodeV2
33
- }
34
- displayFulfillmentStatus
35
- displayFinancialStatus
36
- totalPriceSet {
37
- shopMoney {
38
- amount
39
- currencyCode
40
- }
41
- }
42
- }
43
- }
44
- `;
45
- const { data, errors, extensions } = yield this.client.request(query);
46
- yield (0, handleErrors_1.handleErrors)(errors);
47
- const { order } = Object.assign({}, data);
48
- return Object.assign({}, order);
49
- });
50
- }
51
- }
52
- exports.GetOrder = GetOrder;
@@ -1,14 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types";
2
- import { ActionBuilder } from "../../ActionBuilder";
3
- import { PageInfo } from "../../../interfaces/PageInfo";
4
- export interface SearchOrdersInput extends Record<string, any> {
5
- after?: string;
6
- limit?: number;
7
- }
8
- export interface SearchOrdersOutput extends Record<string, any> {
9
- items: any[];
10
- pageInfo: PageInfo;
11
- }
12
- export declare class SearchOrders extends ActionBuilder<AdminApiClient, SearchOrdersInput, SearchOrdersOutput> {
13
- run(args?: SearchOrdersInput): Promise<SearchOrdersOutput>;
14
- }
@@ -1,50 +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.SearchOrders = void 0;
13
- const ActionBuilder_1 = require("../../ActionBuilder");
14
- const handleErrors_1 = require("../../../utils/handleErrors");
15
- class SearchOrders extends ActionBuilder_1.ActionBuilder {
16
- run(args) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const { after, limit } = Object.assign({}, args);
19
- const vLimit = !!limit ? parseInt(limit + '', 10) : 10;
20
- const query = `
21
- {
22
- orders(
23
- first: ${vLimit},
24
- reverse: true,
25
- ${after ? `after: "${after}"` : ''}
26
- ) {
27
- nodes {
28
- id
29
- name
30
- }
31
- pageInfo {
32
- hasNextPage
33
- endCursor
34
- }
35
- }
36
- }
37
- `;
38
- const { data, errors } = yield this.client.request(query);
39
- yield (0, handleErrors_1.handleErrors)(errors);
40
- const { orders } = Object.assign({}, data);
41
- const { nodes, pageInfo } = Object.assign({}, orders);
42
- const items = Array.isArray(nodes) ? nodes : [];
43
- return {
44
- items,
45
- pageInfo
46
- };
47
- });
48
- }
49
- }
50
- exports.SearchOrders = SearchOrders;
@@ -1,13 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types";
2
- import { APIBase } from "../../APIBase";
3
- import { SearchOrdersInput, SearchOrdersOutput } from "./SearchOrders";
4
- import { GetOrderInput, GetOrderOutput } from "./GetOrder";
5
- export interface AdminOrderAPIInterface {
6
- search(args?: SearchOrdersInput): Promise<SearchOrdersOutput>;
7
- get(args: GetOrderInput): Promise<GetOrderOutput>;
8
- }
9
- export declare class AdminOrderAPI extends APIBase<AdminApiClient> implements AdminOrderAPIInterface {
10
- private _runAction;
11
- search(args?: SearchOrdersInput): Promise<SearchOrdersOutput>;
12
- get(args?: GetOrderInput): Promise<GetOrderOutput>;
13
- }
@@ -1,34 +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.AdminOrderAPI = void 0;
13
- const APIBase_1 = require("../../APIBase");
14
- const SearchOrders_1 = require("./SearchOrders");
15
- const GetOrder_1 = require("./GetOrder");
16
- class AdminOrderAPI extends APIBase_1.APIBase {
17
- _runAction(Action, args) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const action = new Action(this.client);
20
- return action.run(args);
21
- });
22
- }
23
- search(args) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- return this._runAction(SearchOrders_1.SearchOrders, args);
26
- });
27
- }
28
- get(args) {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- return this._runAction(GetOrder_1.GetOrder, args);
31
- });
32
- }
33
- }
34
- exports.AdminOrderAPI = AdminOrderAPI;
@@ -1,11 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { ActionBuilder } from "../../ActionBuilder";
3
- export interface SearchPagesInput extends Record<string, any> {
4
- }
5
- export interface SearchPagesOutput extends Record<string, any> {
6
- items: any[];
7
- pageInfo: any;
8
- }
9
- export declare class SearchPages extends ActionBuilder<AdminApiClient, SearchPagesInput, SearchPagesOutput> {
10
- run(args?: SearchPagesInput): Promise<SearchPagesOutput>;
11
- }
@@ -1,24 +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.SearchPages = void 0;
13
- const ActionBuilder_1 = require("../../ActionBuilder");
14
- class SearchPages extends ActionBuilder_1.ActionBuilder {
15
- run(args) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- return {
18
- items: [],
19
- pageInfo: ''
20
- };
21
- });
22
- }
23
- }
24
- exports.SearchPages = SearchPages;
@@ -1,10 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { APIBase } from "../../APIBase";
3
- import { SearchPagesInput, SearchPagesOutput } from "./SearchPages";
4
- export interface AdminPageAPIInterface {
5
- searchPages(args?: SearchPagesInput): Promise<SearchPagesOutput>;
6
- }
7
- export declare class AdminPageAPI extends APIBase<AdminApiClient> implements AdminPageAPIInterface {
8
- private _runAction;
9
- searchPages(args?: SearchPagesInput): Promise<SearchPagesOutput>;
10
- }
@@ -1,28 +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.AdminPageAPI = void 0;
13
- const APIBase_1 = require("../../APIBase");
14
- const SearchPages_1 = require("./SearchPages");
15
- class AdminPageAPI extends APIBase_1.APIBase {
16
- _runAction(Action, args) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const action = new Action(this.client);
19
- return action.run(args);
20
- });
21
- }
22
- searchPages(args) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- return this._runAction(SearchPages_1.SearchPages, args);
25
- });
26
- }
27
- }
28
- exports.AdminPageAPI = AdminPageAPI;
@@ -1,23 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types";
2
- import { ActionBuilder } from "../../ActionBuilder";
3
- export interface GetMenuInput extends Record<string, any> {
4
- id: string;
5
- }
6
- interface MenuItem extends Record<string, any> {
7
- id: string;
8
- title: string;
9
- url: string;
10
- type: string;
11
- items: MenuItem[];
12
- }
13
- export interface GetMenuOutput extends Record<string, any> {
14
- handle: string;
15
- id: string;
16
- isDefault: boolean;
17
- title: string;
18
- items: MenuItem[];
19
- }
20
- export declare class GetMenu extends ActionBuilder<AdminApiClient, GetMenuInput, GetMenuOutput> {
21
- run(args: GetMenuInput): Promise<GetMenuOutput>;
22
- }
23
- export {};
@@ -1,58 +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.GetMenu = void 0;
13
- const ActionBuilder_1 = require("../../ActionBuilder");
14
- const getGlobalID_1 = require("../../../utils/getGlobalID");
15
- const handleErrors_1 = require("../../../utils/handleErrors");
16
- class GetMenu 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, 'Menu');
21
- console.log('globalId', globalId);
22
- const query = `
23
- {
24
- menu(id: "${globalId}") {
25
- handle
26
- id
27
- isDefault
28
- title
29
- items(limit: 250) {
30
- id
31
- title
32
- url
33
- type
34
- items {
35
- id
36
- title
37
- url
38
- type
39
- items {
40
- id
41
- title
42
- url
43
- type
44
- }
45
- }
46
- }
47
- }
48
- }
49
- `;
50
- const { data, errors, extensions } = yield this.client.request(query);
51
- console.log('data', data);
52
- yield (0, handleErrors_1.handleErrors)(errors);
53
- const { menu } = Object.assign({}, data);
54
- return Object.assign({}, menu);
55
- });
56
- }
57
- }
58
- exports.GetMenu = GetMenu;
@@ -1,13 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types";
2
- import { ActionBuilder } from "../../ActionBuilder";
3
- export interface SearchMenusInput extends Record<string, any> {
4
- after?: string;
5
- limit?: number;
6
- }
7
- export interface SearchMenusOutput extends Record<string, any> {
8
- items: any[];
9
- pageInfo: any;
10
- }
11
- export declare class SearchMenus extends ActionBuilder<AdminApiClient, SearchMenusInput, SearchMenusOutput> {
12
- run(args?: SearchMenusInput): Promise<SearchMenusOutput>;
13
- }
@@ -1,47 +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.SearchMenus = void 0;
13
- const ActionBuilder_1 = require("../../ActionBuilder");
14
- const handleErrors_1 = require("../../../utils/handleErrors");
15
- class SearchMenus extends ActionBuilder_1.ActionBuilder {
16
- run(args) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const { limit } = Object.assign({}, args);
19
- const vLimit = limit || 10;
20
- const query = `
21
- {
22
- menus(first: ${vLimit}) {
23
- nodes {
24
- handle
25
- id
26
- title
27
- }
28
- pageInfo {
29
- hasNextPage
30
- endCursor
31
- }
32
- }
33
- }
34
- `;
35
- const { data, errors } = yield this.client.request(query);
36
- yield (0, handleErrors_1.handleErrors)(errors);
37
- const { menus } = Object.assign({}, data);
38
- const { nodes, pageInfo } = Object.assign({}, menus);
39
- const items = Array.isArray(nodes) ? nodes : [];
40
- return {
41
- items,
42
- pageInfo
43
- };
44
- });
45
- }
46
- }
47
- exports.SearchMenus = SearchMenus;
@@ -1,12 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { ActionBuilder } from "../../ActionBuilder";
3
- export interface CreateVariantInput extends Record<string, any> {
4
- productId: string;
5
- price?: string;
6
- options?: string[] | string;
7
- }
8
- export interface CreateVariantOutput extends Record<string, any> {
9
- }
10
- export declare class CreateVariant extends ActionBuilder<AdminApiClient, CreateVariantInput, CreateVariantOutput> {
11
- run(args: CreateVariantInput): Promise<CreateVariantOutput>;
12
- }
@@ -1,56 +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.CreateVariant = void 0;
13
- const ActionBuilder_1 = require("../../ActionBuilder");
14
- const getGlobalID_1 = require("../../../utils/getGlobalID");
15
- const handleErrors_1 = require("../../../utils/handleErrors");
16
- class CreateVariant extends ActionBuilder_1.ActionBuilder {
17
- run(args) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const { productId } = args;
20
- const globalId = (0, getGlobalID_1.getGlobalID)(productId, 'Product');
21
- const input = Object.assign(Object.assign({}, args), { productId: globalId });
22
- const query = `
23
- mutation productVariantCreate($input: ProductVariantInput!) {
24
- productVariantCreate(input: $input) {
25
- product {
26
- id
27
- title
28
- }
29
- productVariant {
30
- id
31
- createdAt
32
- displayName
33
- price
34
- title
35
- }
36
- userErrors {
37
- field
38
- message
39
- }
40
- }
41
- }
42
- `;
43
- const { data, errors } = yield this.client.request(query, {
44
- variables: {
45
- input
46
- }
47
- });
48
- console.log('data', JSON.stringify(data, null, 2));
49
- yield (0, handleErrors_1.handleErrors)(errors);
50
- const { productVariantCreate } = Object.assign({}, data);
51
- const { productVariant } = Object.assign({}, productVariantCreate);
52
- return Object.assign({}, productVariant);
53
- });
54
- }
55
- }
56
- exports.CreateVariant = CreateVariant;
@@ -1,10 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/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
- }