Skip to content

Commit 4ab27e7

Browse files
committed
improve queries, search-orders
1 parent 857c7da commit 4ab27e7

File tree

5 files changed

+108
-5
lines changed

5 files changed

+108
-5
lines changed

components/shopify_developer_app/actions/get-order/get-order.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "shopify_developer_app-get-order",
66
name: "Get Order",
77
description: "Retrieve an order by specifying the order ID. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/queries/order)",
8-
version: "0.0.4",
8+
version: "0.0.5",
99
type: "action",
1010
props: {
1111
shopify,

components/shopify_developer_app/actions/search-customers/search-customers.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "shopify_developer_app-search-customers",
55
name: "Search for Customers",
66
description: "Search for a customer or a list of customers. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/queries/customers)",
7-
version: "0.0.6",
7+
version: "0.0.7",
88
type: "action",
99
props: {
1010
shopify,
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import shopify from "../../shopify_developer_app.app.mjs";
2+
3+
export default {
4+
key: "shopify_developer_app-search-orders",
5+
name: "Search for Orders",
6+
description: "Search for an order or a list of orders. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/queries/orders)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
shopify,
11+
query: {
12+
type: "string",
13+
label: "Query",
14+
description: "The search query",
15+
optional: true,
16+
},
17+
max: {
18+
type: "integer",
19+
label: "Max Records",
20+
description: "Optionally limit the maximum number of records to return. Leave blank to retrieve all records.",
21+
optional: true,
22+
},
23+
},
24+
async run({ $ }) {
25+
const orders = await this.shopify.getPaginated({
26+
resourceFn: this.shopify.listOrders,
27+
resourceKeys: [
28+
"orders",
29+
],
30+
variables: {
31+
query: this.query,
32+
},
33+
max: this.max,
34+
});
35+
$.export("$summary", `Found ${orders.length} order${orders.length === 1
36+
? ""
37+
: "s"}`);
38+
return orders;
39+
},
40+
};

components/shopify_developer_app/common/queries.mjs

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,30 @@ const GET_ORDER = `
1414
endCursor
1515
}
1616
}
17+
customer {
18+
id
19+
displayName
20+
email
21+
phone
22+
addresses (first: $first) {
23+
address1
24+
address2
25+
city
26+
zip
27+
country
28+
company
29+
}
30+
}
31+
totalPriceSet {
32+
shopMoney {
33+
amount
34+
currencyCode
35+
}
36+
presentmentMoney {
37+
amount
38+
currencyCode
39+
}
40+
}
1741
suggestedRefund(refundLineItems: $refundLineItems) {
1842
subtotalSet {
1943
shopMoney {
@@ -104,11 +128,35 @@ const GET_DRAFT_ORDER = `
104128
`;
105129

106130
const LIST_ORDERS = `
107-
query ($first: Int, $after: String, $reverse: Boolean){
108-
orders(first: $first, after: $after, reverse: $reverse) {
131+
query ($first: Int, $after: String, $reverse: Boolean, $query: String){
132+
orders(first: $first, after: $after, reverse: $reverse, query: $query) {
109133
nodes {
110134
id
111135
updatedAt
136+
customer {
137+
id
138+
displayName
139+
email
140+
phone
141+
addresses (first: $first) {
142+
address1
143+
address2
144+
city
145+
zip
146+
country
147+
company
148+
}
149+
}
150+
totalPriceSet {
151+
shopMoney {
152+
amount
153+
currencyCode
154+
}
155+
presentmentMoney {
156+
amount
157+
currencyCode
158+
}
159+
}
112160
metafields (first: $first) {
113161
nodes {
114162
id
@@ -154,6 +202,21 @@ const LIST_CUSTOMERS = `
154202
nodes {
155203
id
156204
displayName
205+
email
206+
phone
207+
addresses (first: $first) {
208+
address1
209+
address2
210+
city
211+
country
212+
company
213+
}
214+
orders (first: $first) {
215+
nodes {
216+
id
217+
createdAt
218+
}
219+
}
157220
metafields (first: $first) {
158221
nodes {
159222
id

components/shopify_developer_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/shopify_developer_app",
3-
"version": "0.7.1",
3+
"version": "0.8.0",
44
"description": "Pipedream Shopify (Developer App) Components",
55
"main": "shopify_developer_app.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)