@pintahub/shopify-api 1.6.5 → 1.6.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.
- package/dist/classes/admin/menus/GetMenu.js +2 -0
- package/dist/classes/admin/menus/SearchMenus.js +2 -2
- package/dist/classes/admin/menus/index.d.ts +2 -2
- package/dist/classes/admin/menus/index.js +1 -1
- package/dist/classes/admin/products/DeleteProduct.d.ts +11 -0
- package/dist/classes/admin/products/DeleteProduct.js +44 -0
- package/dist/classes/admin/products/index.d.ts +3 -0
- package/dist/classes/admin/products/index.js +6 -0
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ class GetMenu extends ActionBuilder_1.ActionBuilder {
|
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const { id } = args;
|
|
20
20
|
const globalId = (0, getGlobalID_1.getGlobalID)(id, 'Menu');
|
|
21
|
+
console.log('globalId', globalId);
|
|
21
22
|
const query = `
|
|
22
23
|
{
|
|
23
24
|
menu(id: "${globalId}") {
|
|
@@ -47,6 +48,7 @@ class GetMenu extends ActionBuilder_1.ActionBuilder {
|
|
|
47
48
|
}
|
|
48
49
|
`;
|
|
49
50
|
const { data, errors, extensions } = yield this.client.request(query);
|
|
51
|
+
console.log('data', data);
|
|
50
52
|
yield (0, handleErrors_1.handleErrors)(errors);
|
|
51
53
|
const { menu } = Object.assign({}, data);
|
|
52
54
|
return Object.assign({}, menu);
|
|
@@ -15,11 +15,11 @@ const handleErrors_1 = require("../../../utils/handleErrors");
|
|
|
15
15
|
class SearchMenus extends ActionBuilder_1.ActionBuilder {
|
|
16
16
|
run(args) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const {
|
|
18
|
+
const { limit } = Object.assign({}, args);
|
|
19
19
|
const vLimit = limit || 10;
|
|
20
20
|
const query = `
|
|
21
21
|
{
|
|
22
|
-
menus(first:
|
|
22
|
+
menus(first: ${vLimit}) {
|
|
23
23
|
nodes {
|
|
24
24
|
handle
|
|
25
25
|
id
|
|
@@ -3,11 +3,11 @@ import { APIBase } from "../../APIBase";
|
|
|
3
3
|
import { SearchMenusInput, SearchMenusOutput } from "./SearchMenus";
|
|
4
4
|
import { GetMenuInput, GetMenuOutput } from "./GetMenu";
|
|
5
5
|
export interface AdminMenuAPIInterface {
|
|
6
|
-
|
|
6
|
+
search(args: SearchMenusInput): Promise<SearchMenusOutput>;
|
|
7
7
|
get(args: GetMenuInput): Promise<GetMenuOutput>;
|
|
8
8
|
}
|
|
9
9
|
export declare class AdminMenuAPI extends APIBase<AdminApiClient> implements AdminMenuAPIInterface {
|
|
10
10
|
private _runAction;
|
|
11
|
-
|
|
11
|
+
search(args?: SearchMenusInput): Promise<SearchMenusOutput>;
|
|
12
12
|
get(args?: GetMenuInput): Promise<GetMenuOutput>;
|
|
13
13
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
|
|
2
|
+
import { ActionBuilder } from "../../ActionBuilder";
|
|
3
|
+
export interface DeleteProductInput extends Record<string, any> {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DeleteProductOutput extends Record<string, any> {
|
|
7
|
+
id: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class DeleteProduct extends ActionBuilder<AdminApiClient, DeleteProductInput, DeleteProductOutput> {
|
|
10
|
+
run(args: DeleteProductInput): Promise<DeleteProductOutput>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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.DeleteProduct = void 0;
|
|
13
|
+
const ActionBuilder_1 = require("../../ActionBuilder");
|
|
14
|
+
const getGlobalID_1 = require("../../../utils/getGlobalID");
|
|
15
|
+
class DeleteProduct extends ActionBuilder_1.ActionBuilder {
|
|
16
|
+
run(args) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const query = `
|
|
19
|
+
mutation productDelete($input: ProductDeleteInput!) {
|
|
20
|
+
productDelete(input: $input) {
|
|
21
|
+
deletedProductId
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const { id } = Object.assign({}, args);
|
|
26
|
+
const globalId = (0, getGlobalID_1.getGlobalID)(id);
|
|
27
|
+
const newArgs = {
|
|
28
|
+
id: globalId
|
|
29
|
+
};
|
|
30
|
+
const result = yield this.client.request(query, {
|
|
31
|
+
variables: {
|
|
32
|
+
input: newArgs
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const { data } = Object.assign({}, result);
|
|
36
|
+
const { productDelete } = Object.assign({}, data);
|
|
37
|
+
const { deletedProductId } = Object.assign({}, productDelete);
|
|
38
|
+
return Object.assign({}, {
|
|
39
|
+
id: deletedProductId
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.DeleteProduct = DeleteProduct;
|
|
@@ -8,10 +8,12 @@ import { CreateProductInput, CreateProductOutput } from "./CreateProduct";
|
|
|
8
8
|
import { CreateProductMediaInput, CreateProductMediaOutput } from "./CreateProductMedia";
|
|
9
9
|
import { UpdateProductInput, UpdateProductOutput } from "./UpdateProduct";
|
|
10
10
|
import { PublishProductInput, PublishProductOutput } from "./PublishProduct";
|
|
11
|
+
import { DeleteProductInput, DeleteProductOutput } from "./DeleteProduct";
|
|
11
12
|
export interface AdminProductAPIInterface {
|
|
12
13
|
get(args: GetProductInput): Promise<GetProductOutput>;
|
|
13
14
|
create(args: CreateProductInput): Promise<CreateProductOutput>;
|
|
14
15
|
update(args: UpdateProductInput): Promise<UpdateProductOutput>;
|
|
16
|
+
delete(args: DeleteProductInput): Promise<DeleteProductOutput>;
|
|
15
17
|
publish(args: PublishProductInput): Promise<PublishProductOutput>;
|
|
16
18
|
getPublications(args: GetPublicationsInput): Promise<GetPublicationsOutput>;
|
|
17
19
|
search(args?: SearchProductsInput): Promise<SearchProductsOutput>;
|
|
@@ -23,6 +25,7 @@ export declare class AdminProductAPI extends APIBase<AdminApiClient> implements
|
|
|
23
25
|
get(args: GetProductInput): Promise<GetProductOutput>;
|
|
24
26
|
create(args: CreateProductInput): Promise<CreateProductOutput>;
|
|
25
27
|
update(args: UpdateProductInput): Promise<UpdateProductOutput>;
|
|
28
|
+
delete(args: DeleteProductInput): Promise<DeleteProductOutput>;
|
|
26
29
|
publish(args: PublishProductInput): Promise<PublishProductOutput>;
|
|
27
30
|
getPublications(args: GetPublicationsInput): Promise<GetPublicationsOutput>;
|
|
28
31
|
search(args?: SearchProductsInput): Promise<SearchProductsOutput>;
|
|
@@ -19,6 +19,7 @@ const CreateProduct_1 = require("./CreateProduct");
|
|
|
19
19
|
const CreateProductMedia_1 = require("./CreateProductMedia");
|
|
20
20
|
const UpdateProduct_1 = require("./UpdateProduct");
|
|
21
21
|
const PublishProduct_1 = require("./PublishProduct");
|
|
22
|
+
const DeleteProduct_1 = require("./DeleteProduct");
|
|
22
23
|
class AdminProductAPI extends APIBase_1.APIBase {
|
|
23
24
|
_runAction(Action, args) {
|
|
24
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41,6 +42,11 @@ class AdminProductAPI extends APIBase_1.APIBase {
|
|
|
41
42
|
return this._runAction(UpdateProduct_1.UpdateProduct, args);
|
|
42
43
|
});
|
|
43
44
|
}
|
|
45
|
+
delete(args) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return this._runAction(DeleteProduct_1.DeleteProduct, args);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
44
50
|
publish(args) {
|
|
45
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
52
|
return this._runAction(PublishProduct_1.PublishProduct, args);
|