@pintahub/shopify-api 1.0.1 → 1.0.3

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.
@@ -7,4 +7,5 @@ export declare class AdminAPI {
7
7
  private client;
8
8
  constructor(opts: APIOptions);
9
9
  getProduct(id: string): Promise<any>;
10
+ getProducts(): Promise<any>;
10
11
  }
@@ -74,8 +74,37 @@ class AdminAPI {
74
74
  }
75
75
  `;
76
76
  const { data } = yield this.client.request(query);
77
- console.log('data', data);
78
- return data;
77
+ const { product } = Object.assign({}, data);
78
+ return Object.assign({}, product);
79
+ });
80
+ }
81
+ getProducts() {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const query = `
84
+ {
85
+ products(
86
+ first: 100
87
+ sortKey: UPDATED_AT
88
+ reverse: true
89
+ ) {
90
+ nodes {
91
+ id
92
+ }
93
+ pageInfo {
94
+ hasNextPage
95
+ endCursor
96
+ }
97
+ }
98
+ }
99
+ `;
100
+ const { data } = yield this.client.request(query);
101
+ const { products } = Object.assign({}, data);
102
+ const { nodes, pageInfo } = Object.assign({}, products);
103
+ const items = Array.isArray(nodes) ? nodes : [];
104
+ return {
105
+ items,
106
+ pageInfo
107
+ };
79
108
  });
80
109
  }
81
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/shopify-api",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",