@pintahub/shopify-api 1.5.2 → 1.5.4

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.
@@ -3,6 +3,7 @@ import { AdminCollectionAPIInterface } from "./admin/collections";
3
3
  import { AdminMetaObjectAPIInterface } from "./admin/metaobjects";
4
4
  import { AdminOrderAPIInterface } from "./admin/orders";
5
5
  import { APIOptions } from "../interfaces/APIOptions";
6
+ import { AdminFileAPIInterface } from "./admin/files";
6
7
  export declare class AdminAPI {
7
8
  private readonly options;
8
9
  private readonly client;
@@ -10,6 +11,7 @@ export declare class AdminAPI {
10
11
  readonly collection: AdminCollectionAPIInterface;
11
12
  readonly metaobject: AdminMetaObjectAPIInterface;
12
13
  readonly order: AdminOrderAPIInterface;
14
+ readonly files: AdminFileAPIInterface;
13
15
  constructor(options: APIOptions);
14
16
  private _createClient;
15
17
  }
@@ -6,6 +6,7 @@ const products_1 = require("./admin/products");
6
6
  const collections_1 = require("./admin/collections");
7
7
  const metaobjects_1 = require("./admin/metaobjects");
8
8
  const orders_1 = require("./admin/orders");
9
+ const files_1 = require("./admin/files");
9
10
  class AdminAPI {
10
11
  constructor(options) {
11
12
  this.options = options;
@@ -14,6 +15,7 @@ class AdminAPI {
14
15
  this.collection = new collections_1.AdminCollectionAPI(this.client);
15
16
  this.metaobject = new metaobjects_1.AdminMetaObjectAPI(this.client);
16
17
  this.order = new orders_1.AdminOrderAPI(this.client);
18
+ this.files = new files_1.AdminFileAPI(this.client); //Start migration with plurality
17
19
  }
18
20
  _createClient() {
19
21
  const { shop, accessToken } = this.options;
@@ -0,0 +1,10 @@
1
+ import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
+ import { ActionBuilder } from "../../ActionBuilder";
3
+ export interface GetImageInput extends Record<string, any> {
4
+ id: string;
5
+ }
6
+ export interface GetImageOutput extends Record<string, any> {
7
+ }
8
+ export declare class GetImage extends ActionBuilder<AdminApiClient, GetImageInput, GetImageOutput> {
9
+ run(args: GetImageInput): Promise<GetImageOutput>;
10
+ }
@@ -0,0 +1,51 @@
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.GetImage = void 0;
13
+ const ActionBuilder_1 = require("../../ActionBuilder");
14
+ const getGlobalID_1 = require("../../../utils/getGlobalID");
15
+ const handleErrors_1 = require("../../../utils/handleErrors");
16
+ class GetImage 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, 'MediaImage');
21
+ const query = `
22
+ {
23
+ node(id: "${globalId}") {
24
+ id
25
+ ... on MediaImage {
26
+ id
27
+ alt
28
+ fileStatus
29
+ image {
30
+ altText
31
+ height
32
+ url
33
+ width
34
+ }
35
+ mediaContentType
36
+ mimeType
37
+ status
38
+ createdAt
39
+ updatedAt
40
+ }
41
+ }
42
+ }
43
+ `;
44
+ const { data, errors, extensions } = yield this.client.request(query);
45
+ yield (0, handleErrors_1.handleErrors)(errors);
46
+ const { node } = Object.assign({}, data);
47
+ return Object.assign({}, node);
48
+ });
49
+ }
50
+ }
51
+ exports.GetImage = GetImage;
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,52 @@
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;
@@ -0,0 +1,10 @@
1
+ import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
+ import { APIBase } from "../../APIBase";
3
+ import { GetImageInput, GetImageOutput } from "./GetImage";
4
+ export interface AdminFileAPIInterface {
5
+ getImage(args: GetImageInput): Promise<GetImageOutput>;
6
+ }
7
+ export declare class AdminFileAPI extends APIBase<AdminApiClient> implements AdminFileAPIInterface {
8
+ private _runAction;
9
+ getImage(args?: GetImageInput): Promise<GetImageOutput>;
10
+ }
@@ -0,0 +1,28 @@
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.AdminFileAPI = void 0;
13
+ const APIBase_1 = require("../../APIBase");
14
+ const GetImage_1 = require("./GetImage");
15
+ class AdminFileAPI 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
+ getImage(args) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ return this._runAction(GetImage_1.GetImage, args);
25
+ });
26
+ }
27
+ }
28
+ exports.AdminFileAPI = AdminFileAPI;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/shopify-api",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",