@pintahub/shopify-api 2.5.4 → 2.5.7

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 (72) hide show
  1. package/dist/classes/AdminAPI.js +2 -2
  2. package/dist/classes/admin/metaobjects/GetListFAQs.js +1 -1
  3. package/dist/classes/admin/metaobjects/faqs/_parseFAQs.js +1 -1
  4. package/dist/fragments/cart.d.ts +1 -1
  5. package/dist/fragments/cart.js +1 -0
  6. package/dist/input/MediaContentType.js +1 -1
  7. package/dist/input/WeightUnit.js +1 -1
  8. package/package.json +2 -2
  9. package/dist/actions/admin/GetProduct.d.ts +0 -10
  10. package/dist/actions/admin/GetProduct.js +0 -74
  11. package/dist/actions/admin/SearchProducts.d.ts +0 -12
  12. package/dist/actions/admin/SearchProducts.js +0 -45
  13. package/dist/actions/admin/products/GetProduct.d.ts +0 -10
  14. package/dist/actions/admin/products/GetProduct.js +0 -74
  15. package/dist/actions/admin/products/SearchProducts.d.ts +0 -12
  16. package/dist/actions/admin/products/SearchProducts.js +0 -45
  17. package/dist/actions/storefront/getProductByHandle.d.ts +0 -11
  18. package/dist/actions/storefront/getProductByHandle.js +0 -39
  19. package/dist/classes/ActionBase.d.ts +0 -2
  20. package/dist/classes/ActionBase.js +0 -6
  21. package/dist/classes/ShopifyAPI.d.ts +0 -3
  22. package/dist/classes/ShopifyAPI.js +0 -8
  23. package/dist/classes/admin/files/GetOrder.d.ts +0 -10
  24. package/dist/classes/admin/files/GetOrder.js +0 -52
  25. package/dist/classes/admin/orders/GetProduct.d.ts +0 -10
  26. package/dist/classes/admin/orders/GetProduct.js +0 -80
  27. package/dist/classes/admin/orders-v2/GetOrder.d.ts +0 -10
  28. package/dist/classes/admin/orders-v2/GetOrder.js +0 -52
  29. package/dist/classes/admin/orders-v2/SearchOrders.d.ts +0 -14
  30. package/dist/classes/admin/orders-v2/SearchOrders.js +0 -50
  31. package/dist/classes/admin/orders-v2/index.d.ts +0 -13
  32. package/dist/classes/admin/orders-v2/index.js +0 -34
  33. package/dist/classes/admin/pages/SearchPages.d.ts +0 -11
  34. package/dist/classes/admin/pages/SearchPages.js +0 -24
  35. package/dist/classes/admin/pages/index.d.ts +0 -10
  36. package/dist/classes/admin/pages/index.js +0 -28
  37. package/dist/classes/admin/payments/GetMenu.d.ts +0 -23
  38. package/dist/classes/admin/payments/GetMenu.js +0 -58
  39. package/dist/classes/admin/payments/SearchMenus.d.ts +0 -13
  40. package/dist/classes/admin/payments/SearchMenus.js +0 -47
  41. package/dist/classes/admin/products/CreateVariant.d.ts +0 -12
  42. package/dist/classes/admin/products/CreateVariant.js +0 -56
  43. package/dist/classes/admin/products/GetProductPublications.d.ts +0 -10
  44. package/dist/classes/admin/products/GetProductPublications.js +0 -104
  45. package/dist/classes/admin/products-v2/UpdateVariant.d.ts +0 -15
  46. package/dist/classes/admin/products-v2/UpdateVariant.js +0 -54
  47. package/dist/classes/admin/shop/GetPolicyPage.d.ts +0 -10
  48. package/dist/classes/admin/shop/GetPolicyPage.js +0 -47
  49. package/dist/classes/rest/orders/SearchOrderItems.d.ts +0 -12
  50. package/dist/classes/rest/orders/SearchOrderItems.js +0 -29
  51. package/dist/classes/rest/orders/SearchOrders.d.ts +0 -14
  52. package/dist/classes/rest/orders/SearchOrders.js +0 -49
  53. package/dist/classes/rest/orders/orders/GetOrder.d.ts +0 -10
  54. package/dist/classes/rest/orders/orders/GetOrder.js +0 -52
  55. package/dist/classes/rest/orders/orders/SearchOrders.d.ts +0 -14
  56. package/dist/classes/rest/orders/orders/SearchOrders.js +0 -49
  57. package/dist/classes/rest/orders/orders/index.d.ts +0 -13
  58. package/dist/classes/rest/orders/orders/index.js +0 -34
  59. package/dist/classes/rest/products/GetOrder.d.ts +0 -12
  60. package/dist/classes/rest/products/GetOrder.js +0 -29
  61. package/dist/classes/rest/products/index.d.ts +0 -10
  62. package/dist/classes/rest/products/index.js +0 -28
  63. package/dist/classes/storefront/cart/GetPage.d.ts +0 -10
  64. package/dist/classes/storefront/cart/GetPage.js +0 -43
  65. package/dist/classes/storefront/posts/GetProduct.d.ts +0 -10
  66. package/dist/classes/storefront/posts/GetProduct.js +0 -94
  67. package/dist/classes/storefront/products/SearchProducts.d.ts +0 -12
  68. package/dist/classes/storefront/products/SearchProducts.js +0 -47
  69. package/dist/utils/parseCleanId.d.ts +0 -0
  70. package/dist/utils/parseCleanId.js +0 -1
  71. package/dist/utils.d.ts +0 -0
  72. 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,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
- }
@@ -1,104 +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
- 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
- descriptionHtml
37
- priceRangeV2 {
38
- maxVariantPrice {
39
- amount
40
- currencyCode
41
- }
42
- minVariantPrice {
43
- amount
44
- currencyCode
45
- }
46
- }
47
- tags
48
- productCategory {
49
- productTaxonomyNode {
50
- fullName
51
- name
52
- }
53
- }
54
- collections(first: 100) {
55
- nodes {
56
- id
57
- }
58
- }
59
- options {
60
- values
61
- name
62
- }
63
- metafields(first: 100) {
64
- nodes {
65
- key
66
- value
67
- type
68
- }
69
- }
70
- images(first: 20) {
71
- nodes {
72
- id
73
- url(transform: {maxWidth: 1000, crop: CENTER, preferredContentType: WEBP})
74
- height
75
- altText
76
- width
77
- }
78
- }
79
- variants(first: 250) {
80
- nodes {
81
- id
82
- availableForSale
83
- selectedOptions {
84
- name
85
- value
86
- }
87
- price
88
- compareAtPrice
89
- image {
90
- id
91
- }
92
- }
93
- }
94
- }
95
- }
96
- `;
97
- const { data } = yield this.client.request(query);
98
- console.log('data', data);
99
- const { product } = Object.assign({}, data);
100
- return Object.assign({}, product);
101
- });
102
- }
103
- }
104
- exports.GetProduct = GetProduct;
@@ -1,15 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types";
2
- import { ActionBuilder } from "../../ActionBuilder";
3
- import { InventoryItemInput } from "../../../input/InventoryItemInput";
4
- export interface UpdateVariantInput extends Record<string, any> {
5
- id: string;
6
- compareAtPrice?: string;
7
- price?: string;
8
- inventoryItem?: InventoryItemInput;
9
- }
10
- export interface UpdateVariantOutput extends Record<string, any> {
11
- id: string;
12
- }
13
- export declare class UpdateVariant extends ActionBuilder<AdminApiClient, UpdateVariantInput, UpdateVariantOutput> {
14
- run(args: UpdateVariantInput): Promise<UpdateVariantOutput>;
15
- }
@@ -1,54 +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.UpdateVariant = void 0;
13
- const ActionBuilder_1 = require("../../ActionBuilder");
14
- const getGlobalID_1 = require("../../../utils/getGlobalID");
15
- const handleErrors_1 = require("../../../utils/handleErrors");
16
- class UpdateVariant 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, 'ProductVariant');
21
- const vArgs = Object.assign({}, args, { id: globalId });
22
- const query = `
23
- mutation productVariantUpdate($input: ProductVariantInput!) {
24
- productVariantUpdate(input: $input) {
25
- productVariant {
26
- id
27
- productId
28
- compareAtPrice
29
- price
30
- mediaId
31
- options
32
- position
33
- taxable
34
- }
35
- userErrors {
36
- message
37
- field
38
- }
39
- }
40
- }
41
- `;
42
- const { data, errors } = yield this.client.request(query, {
43
- variables: {
44
- input: vArgs
45
- }
46
- });
47
- yield (0, handleErrors_1.handleErrors)(errors);
48
- const { productVariantUpdate } = Object.assign({}, data);
49
- const { productVariant } = Object.assign({}, productVariantUpdate);
50
- return Object.assign({}, productVariant);
51
- });
52
- }
53
- }
54
- exports.UpdateVariant = UpdateVariant;
@@ -1,10 +0,0 @@
1
- import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
- import { ActionBuilder } from "../../ActionBuilder";
3
- export interface GetPolicyPageInput extends Record<string, any> {
4
- handle: string;
5
- }
6
- export interface GetPolicyPageOutput extends Record<string, any> {
7
- }
8
- export declare class GetPolicyPage extends ActionBuilder<AdminApiClient, GetPolicyPageInput, GetPolicyPageOutput> {
9
- run(args: GetPolicyPageInput): Promise<GetPolicyPageOutput>;
10
- }