@pipedream/shopify_developer_app 0.8.1 → 0.9.0
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/actions/add-product-to-custom-collection/add-product-to-custom-collection.mjs +1 -1
- package/actions/add-tags/add-tags.mjs +1 -1
- package/actions/create-article/create-article.mjs +1 -1
- package/actions/create-blog/create-blog.mjs +1 -1
- package/actions/create-custom-collection/create-custom-collection.mjs +1 -1
- package/actions/create-customer/create-customer.mjs +1 -1
- package/actions/create-fulfillment/create-fulfillment.mjs +77 -0
- package/actions/create-metafield/create-metafield.mjs +1 -1
- package/actions/create-metaobject/create-metaobject.mjs +1 -1
- package/actions/create-order/create-order.mjs +1 -1
- package/actions/create-page/create-page.mjs +1 -1
- package/actions/create-product/create-product.mjs +1 -1
- package/actions/create-product-variant/create-product-variant.mjs +1 -1
- package/actions/create-smart-collection/create-smart-collection.mjs +1 -1
- package/actions/delete-article/delete-article.mjs +1 -1
- package/actions/delete-blog/delete-blog.mjs +1 -1
- package/actions/delete-metafield/delete-metafield.mjs +1 -1
- package/actions/delete-page/delete-page.mjs +1 -1
- package/actions/get-articles/get-articles.mjs +1 -1
- package/actions/get-metafields/get-metafields.mjs +1 -1
- package/actions/get-metaobjects/get-metaobjects.mjs +1 -1
- package/actions/get-order/get-order.mjs +1 -1
- package/actions/get-pages/get-pages.mjs +1 -1
- package/actions/refund-order/refund-order.mjs +100 -0
- package/actions/search-custom-collection-by-name/search-custom-collection-by-name.mjs +1 -1
- package/actions/search-customers/search-customers.mjs +1 -1
- package/actions/search-fulfillment-orders/search-fulfillment-orders.mjs +40 -0
- package/actions/search-orders/search-orders.mjs +1 -1
- package/actions/search-product-variant/search-product-variant.mjs +1 -1
- package/actions/search-products/search-products.mjs +1 -1
- package/actions/update-article/update-article.mjs +1 -1
- package/actions/update-customer/update-customer.mjs +1 -1
- package/actions/update-fulfillment-tracking-info/update-fulfillment-tracking-info.mjs +68 -0
- package/actions/update-inventory-level/update-inventory-level.mjs +1 -1
- package/actions/update-metafield/update-metafield.mjs +1 -1
- package/actions/update-metaobject/update-metaobject.mjs +1 -1
- package/actions/update-page/update-page.mjs +1 -1
- package/actions/update-product/update-product.mjs +1 -1
- package/actions/update-product-variant/update-product-variant.mjs +1 -1
- package/common/mutations.mjs +88 -0
- package/common/queries.mjs +47 -0
- package/package.json +1 -1
- package/shopify_developer_app.app.mjs +72 -1
- package/sources/cart-updated/cart-updated.mjs +25 -0
- package/sources/inventory-level-updated/inventory-level-updated.mjs +25 -0
- package/sources/new-abandoned-cart/new-abandoned-cart.mjs +1 -1
- package/sources/new-article/new-article.mjs +1 -1
- package/sources/new-cancelled-order/new-cancelled-order.mjs +1 -1
- package/sources/new-cart-created/new-cart-created.mjs +25 -0
- package/sources/new-customer-created/new-customer-created.mjs +1 -1
- package/sources/new-draft-order/new-draft-order.mjs +1 -1
- package/sources/new-event-emitted/new-event-emitted.mjs +1 -1
- package/sources/new-fulfillment-event/new-fulfillment-event.mjs +1 -1
- package/sources/new-order-created/new-order-created.mjs +1 -1
- package/sources/new-order-fulfilled/new-order-fulfilled.mjs +1 -1
- package/sources/new-page/new-page.mjs +1 -1
- package/sources/new-paid-order/new-paid-order.mjs +1 -1
- package/sources/new-product-created/new-product-created.mjs +1 -1
- package/sources/new-product-updated/new-product-updated.mjs +1 -1
- package/sources/new-refund-created/new-refund-created.mjs +1 -1
- package/sources/new-updated-customer/new-updated-customer.mjs +1 -1
- package/sources/new-updated-order/new-updated-order.mjs +1 -1
- package/sources/product-added-to-custom-collection/product-added-to-custom-collection.mjs +1 -1
- package/sources/shop-update/shop-update.mjs +25 -0
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "shopify_developer_app-create-customer",
|
|
5
5
|
name: "Create Customer",
|
|
6
6
|
description: "Create a new customer. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customercreate)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
shopify,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "shopify_developer_app-create-fulfillment",
|
|
5
|
+
name: "Create Fulfillment",
|
|
6
|
+
description: "Create a fulfillment. [See the documentation](https://shopify.dev/docs/api/admin-graphql/unstable/mutations/fulfillmentcreate)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
shopify,
|
|
11
|
+
fulfillmentOrderId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
shopify,
|
|
14
|
+
"fulfillmentOrderId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
fulfillmentOrderLineItemIds: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
shopify,
|
|
20
|
+
"fulfillmentOrderLineItemIds",
|
|
21
|
+
(c) => ({
|
|
22
|
+
fulfillmentOrderId: c.fulfillmentOrderId,
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
reloadProps: true,
|
|
26
|
+
},
|
|
27
|
+
notifyCustomer: {
|
|
28
|
+
type: "boolean",
|
|
29
|
+
label: "Notify Customer",
|
|
30
|
+
description: "Whether to notify the customer",
|
|
31
|
+
optional: true,
|
|
32
|
+
},
|
|
33
|
+
message: {
|
|
34
|
+
type: "string",
|
|
35
|
+
label: "Message",
|
|
36
|
+
description: "An optional message for the fulfillment request.",
|
|
37
|
+
optional: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
async additionalProps() {
|
|
41
|
+
const props = {};
|
|
42
|
+
if (!this.fulfillmentOrderLineItemIds) {
|
|
43
|
+
return props;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const id of this.fulfillmentOrderLineItemIds) {
|
|
47
|
+
props[`quantity_${id}`] = {
|
|
48
|
+
type: "integer",
|
|
49
|
+
label: `Quantity for Line Item - ${id}`,
|
|
50
|
+
description: "The quantity of the line item to fulfill",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return props;
|
|
54
|
+
},
|
|
55
|
+
async run({ $ }) {
|
|
56
|
+
const fulfillment = await this.shopify.createFulfillment({
|
|
57
|
+
fulfillment: {
|
|
58
|
+
lineItemsByFulfillmentOrder: [
|
|
59
|
+
{
|
|
60
|
+
fulfillmentOrderId: this.fulfillmentOrderId,
|
|
61
|
+
fulfillmentOrderLineItems: this.fulfillmentOrderLineItemIds.map((id) => ({
|
|
62
|
+
id,
|
|
63
|
+
quantity: this[`quantity_${id}`],
|
|
64
|
+
})),
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
notifyCustomer: this.notifyCustomer,
|
|
68
|
+
},
|
|
69
|
+
message: this.message,
|
|
70
|
+
});
|
|
71
|
+
if (fulfillment.fulfillmentCreate.userErrors.length > 0) {
|
|
72
|
+
throw new Error(fulfillment.fulfillmentCreate.userErrors[0].message);
|
|
73
|
+
}
|
|
74
|
+
$.export("$summary", `Created fulfillment with ID: ${fulfillment.fulfillmentCreate.fulfillment.id}`);
|
|
75
|
+
return fulfillment;
|
|
76
|
+
},
|
|
77
|
+
};
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "shopify_developer_app-create-order",
|
|
6
6
|
name: "Create Order",
|
|
7
7
|
description: "Creates a new order. For full order object details [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/ordercreate)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.9",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
shopify,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "shopify_developer_app-get-order",
|
|
6
6
|
name: "Get Order",
|
|
7
7
|
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.
|
|
8
|
+
version: "0.0.7",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
shopify,
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
+
import { MAX_LIMIT } from "@pipedream/shopify/common/constants.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "shopify_developer_app-refund-order",
|
|
6
|
+
name: "Refund Order",
|
|
7
|
+
description: "Refund an order. [See the documentation](https://shopify.dev/docs/api/admin-graphql/unstable/mutations/refundcreate)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
shopify,
|
|
12
|
+
orderId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
shopify,
|
|
15
|
+
"orderId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
note: {
|
|
19
|
+
type: "string",
|
|
20
|
+
label: "Note",
|
|
21
|
+
description: "An optional note that's attached to the refund",
|
|
22
|
+
optional: true,
|
|
23
|
+
},
|
|
24
|
+
lineItemIds: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
shopify,
|
|
27
|
+
"lineItemIds",
|
|
28
|
+
(c) => ({
|
|
29
|
+
orderId: c.orderId,
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
reloadProps: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
async additionalProps() {
|
|
36
|
+
const props = {};
|
|
37
|
+
if (!this.lineItemIds) {
|
|
38
|
+
return props;
|
|
39
|
+
}
|
|
40
|
+
const order = await this.shopify.getOrder({
|
|
41
|
+
id: this.orderId,
|
|
42
|
+
first: MAX_LIMIT,
|
|
43
|
+
});
|
|
44
|
+
for (const id of this.lineItemIds) {
|
|
45
|
+
const lineItem = order.order.lineItems.edges.find((item) => item.node.id === id);
|
|
46
|
+
props[`quantity_${id}`] = {
|
|
47
|
+
type: "integer",
|
|
48
|
+
label: `Quantity for line item - ${lineItem.node.title}`,
|
|
49
|
+
description: "The quantity of the line item to refund",
|
|
50
|
+
};
|
|
51
|
+
props[`restockType_${id}`] = {
|
|
52
|
+
type: "string",
|
|
53
|
+
label: `Restock type for line item - ${lineItem.node.title}`,
|
|
54
|
+
description: "The restock type for the line item",
|
|
55
|
+
options: [
|
|
56
|
+
"CANCEL",
|
|
57
|
+
"NO_RESTOCK",
|
|
58
|
+
"RETURN",
|
|
59
|
+
],
|
|
60
|
+
default: "RETURN",
|
|
61
|
+
};
|
|
62
|
+
props[`locationId_${id}`] = {
|
|
63
|
+
type: "string",
|
|
64
|
+
label: `Location ID for line item - ${lineItem.node.title}`,
|
|
65
|
+
description: "The location ID for the line item",
|
|
66
|
+
options: async ({ prevContext }) => {
|
|
67
|
+
return this.shopify.getPropOptions({
|
|
68
|
+
resourceFn: this.shopify.listLocations,
|
|
69
|
+
resourceKeys: [
|
|
70
|
+
"locations",
|
|
71
|
+
],
|
|
72
|
+
labelKey: "name",
|
|
73
|
+
prevContext,
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return props;
|
|
79
|
+
},
|
|
80
|
+
async run({ $ }) {
|
|
81
|
+
const response = await this.shopify.refundOrder({
|
|
82
|
+
input: {
|
|
83
|
+
note: this.note,
|
|
84
|
+
orderId: this.orderId,
|
|
85
|
+
refundLineItems: this.lineItemIds.map((id) => ({
|
|
86
|
+
lineItemId: id,
|
|
87
|
+
quantity: this[`quantity_${id}`],
|
|
88
|
+
locationId: this[`locationId_${id}`],
|
|
89
|
+
restockType: this[`restockType_${id}`],
|
|
90
|
+
})),
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (response.refundCreate.userErrors.length > 0) {
|
|
95
|
+
throw new Error(response.refundCreate.userErrors[0].message);
|
|
96
|
+
}
|
|
97
|
+
$.export("$summary", `Refunded order with ID: ${this.orderId}`);
|
|
98
|
+
return response;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "shopify_developer_app-search-customers",
|
|
5
5
|
name: "Search for Customers",
|
|
6
6
|
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.
|
|
7
|
+
version: "0.0.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
shopify,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "shopify_developer_app-search-fulfillment-orders",
|
|
5
|
+
name: "Search for Fulfillment Orders",
|
|
6
|
+
description: "Search for a fulfillment order or a list of fulfillment orders. [See the documentation](https://shopify.dev/docs/api/admin-graphql/unstable/queries/fulfillmentorders)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
shopify,
|
|
11
|
+
query: {
|
|
12
|
+
type: "string",
|
|
13
|
+
label: "Query",
|
|
14
|
+
description: "A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).",
|
|
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.listFulfillmentOrders,
|
|
27
|
+
resourceKeys: [
|
|
28
|
+
"fulfillmentOrders",
|
|
29
|
+
],
|
|
30
|
+
variables: {
|
|
31
|
+
query: this.query,
|
|
32
|
+
},
|
|
33
|
+
max: this.max,
|
|
34
|
+
});
|
|
35
|
+
$.export("$summary", `Found ${orders.length} fulfillment order${orders.length === 1
|
|
36
|
+
? ""
|
|
37
|
+
: "s"}`);
|
|
38
|
+
return orders;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "shopify_developer_app-search-orders",
|
|
5
5
|
name: "Search for Orders",
|
|
6
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.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
shopify,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "shopify_developer_app-update-customer",
|
|
7
7
|
name: "Update Customer",
|
|
8
8
|
description: "Update a existing customer. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerupdate)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.10",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
shopify,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "shopify_developer_app-update-fulfillment-tracking-info",
|
|
5
|
+
name: "Update Fulfillment Tracking Info",
|
|
6
|
+
description: "Update the tracking info for a fulfillment. [See the documentation](https://shopify.dev/docs/api/admin-graphql/unstable/mutations/fulfillmenttrackinginfoupdate)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
shopify,
|
|
11
|
+
orderId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
shopify,
|
|
14
|
+
"orderId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
fulfillmentId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
shopify,
|
|
20
|
+
"fulfillmentId",
|
|
21
|
+
(c) => ({
|
|
22
|
+
orderId: c.orderId,
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
company: {
|
|
27
|
+
type: "string",
|
|
28
|
+
label: "Company",
|
|
29
|
+
description: "The name of the tracking company",
|
|
30
|
+
optional: true,
|
|
31
|
+
},
|
|
32
|
+
number: {
|
|
33
|
+
type: "string",
|
|
34
|
+
label: "Tracking Number",
|
|
35
|
+
description: "The tracking number for the fulfillment",
|
|
36
|
+
optional: true,
|
|
37
|
+
},
|
|
38
|
+
url: {
|
|
39
|
+
type: "string",
|
|
40
|
+
label: "Tracking URL",
|
|
41
|
+
description: "The URL for the tracking information",
|
|
42
|
+
optional: true,
|
|
43
|
+
},
|
|
44
|
+
notifyCustomer: {
|
|
45
|
+
type: "boolean",
|
|
46
|
+
label: "Notify Customer",
|
|
47
|
+
description: "Whether to notify the customer",
|
|
48
|
+
optional: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
async run({ $ }) {
|
|
52
|
+
const response = await this.shopify.updateFulfillmentTrackingInfo({
|
|
53
|
+
fulfillmentId: this.fulfillmentId,
|
|
54
|
+
trackingInfoInput: {
|
|
55
|
+
company: this.company,
|
|
56
|
+
number: this.number,
|
|
57
|
+
url: this.url,
|
|
58
|
+
},
|
|
59
|
+
notifyCustomer: this.notifyCustomer,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (response.fulfillmentTrackingInfoUpdate.userErrors.length > 0) {
|
|
63
|
+
throw new Error(response.fulfillmentTrackingInfoUpdate.userErrors[0].message);
|
|
64
|
+
}
|
|
65
|
+
$.export("$summary", `Updated fulfillment tracking info for fulfillment with ID: ${this.fulfillmentId}`);
|
|
66
|
+
return response;
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "shopify_developer_app-update-product",
|
|
7
7
|
name: "Update Product",
|
|
8
8
|
description: "Update an existing product. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productupdate)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.10",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
shopify,
|
package/common/mutations.mjs
CHANGED
|
@@ -116,9 +116,97 @@ const UPDATE_PRODUCT = `
|
|
|
116
116
|
}
|
|
117
117
|
`;
|
|
118
118
|
|
|
119
|
+
const REFUND_ORDER = `
|
|
120
|
+
mutation RefundLineItem($input: RefundInput!) {
|
|
121
|
+
refundCreate(input: $input) {
|
|
122
|
+
refund {
|
|
123
|
+
id
|
|
124
|
+
totalRefundedSet {
|
|
125
|
+
presentmentMoney {
|
|
126
|
+
amount
|
|
127
|
+
currencyCode
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
order {
|
|
131
|
+
id
|
|
132
|
+
totalPriceSet {
|
|
133
|
+
presentmentMoney {
|
|
134
|
+
amount
|
|
135
|
+
currencyCode
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
refundLineItems(first: 10) {
|
|
140
|
+
nodes {
|
|
141
|
+
id
|
|
142
|
+
lineItem {
|
|
143
|
+
id
|
|
144
|
+
title
|
|
145
|
+
quantity
|
|
146
|
+
product {
|
|
147
|
+
id
|
|
148
|
+
title
|
|
149
|
+
}
|
|
150
|
+
variant {
|
|
151
|
+
id
|
|
152
|
+
title
|
|
153
|
+
price
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
userErrors {
|
|
160
|
+
field
|
|
161
|
+
message
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
|
|
167
|
+
const UPDATE_FULFILLMENT_TRACKING_INFO = `
|
|
168
|
+
mutation FulfillmentTrackingInfoUpdate($fulfillmentId: ID!, $trackingInfoInput: FulfillmentTrackingInput!, $notifyCustomer: Boolean) {
|
|
169
|
+
fulfillmentTrackingInfoUpdate(fulfillmentId: $fulfillmentId, trackingInfoInput: $trackingInfoInput, notifyCustomer: $notifyCustomer) {
|
|
170
|
+
fulfillment {
|
|
171
|
+
id
|
|
172
|
+
status
|
|
173
|
+
trackingInfo {
|
|
174
|
+
company
|
|
175
|
+
number
|
|
176
|
+
url
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
userErrors {
|
|
180
|
+
field
|
|
181
|
+
message
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
const CREATE_FULFILLMENT = `
|
|
188
|
+
mutation fulfillmentCreate($fulfillment: FulfillmentInput!, $message: String) {
|
|
189
|
+
fulfillmentCreate(fulfillment: $fulfillment, message: $message) {
|
|
190
|
+
fulfillment {
|
|
191
|
+
id
|
|
192
|
+
name
|
|
193
|
+
status
|
|
194
|
+
createdAt
|
|
195
|
+
}
|
|
196
|
+
userErrors {
|
|
197
|
+
field
|
|
198
|
+
message
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
`;
|
|
203
|
+
|
|
119
204
|
export default {
|
|
120
205
|
CREATE_ORDER,
|
|
121
206
|
CREATE_CUSTOMER,
|
|
122
207
|
UPDATE_CUSTOMER,
|
|
123
208
|
UPDATE_PRODUCT,
|
|
209
|
+
REFUND_ORDER,
|
|
210
|
+
UPDATE_FULFILLMENT_TRACKING_INFO,
|
|
211
|
+
CREATE_FULFILLMENT,
|
|
124
212
|
};
|
package/common/queries.mjs
CHANGED
|
@@ -543,6 +543,18 @@ const GET_DRAFT_ORDER = `
|
|
|
543
543
|
}
|
|
544
544
|
`;
|
|
545
545
|
|
|
546
|
+
const GET_FULFILLMENT_ORDER = `
|
|
547
|
+
query LocationsForMoveList($fulfillmentOrderId: ID!, $first: Int) {
|
|
548
|
+
fulfillmentOrder(id: $fulfillmentOrderId) {
|
|
549
|
+
lineItems (first: $first) {
|
|
550
|
+
nodes {
|
|
551
|
+
id
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
`;
|
|
557
|
+
|
|
546
558
|
const LIST_ORDERS = `
|
|
547
559
|
query ($first: Int, $after: String, $reverse: Boolean, $query: String){
|
|
548
560
|
orders(first: $first, after: $after, reverse: $reverse, query: $query) {
|
|
@@ -759,11 +771,46 @@ const LIST_CUSTOMERS = `
|
|
|
759
771
|
}
|
|
760
772
|
`;
|
|
761
773
|
|
|
774
|
+
const LIST_FULFILLMENT_ORDERS = `
|
|
775
|
+
query ($first: Int, $after: String, $query: String) {
|
|
776
|
+
fulfillmentOrders(first: $first, after: $after, query: $query) {
|
|
777
|
+
nodes {
|
|
778
|
+
id
|
|
779
|
+
status
|
|
780
|
+
createdAt
|
|
781
|
+
updatedAt
|
|
782
|
+
fulfillAt
|
|
783
|
+
orderId
|
|
784
|
+
orderName
|
|
785
|
+
fulfillments (first: $first) {
|
|
786
|
+
nodes {
|
|
787
|
+
id
|
|
788
|
+
name
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
lineItems (first: $first) {
|
|
792
|
+
nodes {
|
|
793
|
+
id
|
|
794
|
+
productTitle
|
|
795
|
+
totalQuantity
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
pageInfo {
|
|
800
|
+
endCursor
|
|
801
|
+
hasNextPage
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
`;
|
|
806
|
+
|
|
762
807
|
export default {
|
|
763
808
|
GET_ORDER,
|
|
764
809
|
GET_CUSTOMER,
|
|
765
810
|
GET_DRAFT_ORDER,
|
|
811
|
+
GET_FULFILLMENT_ORDER,
|
|
766
812
|
LIST_ORDERS,
|
|
767
813
|
LIST_DRAFT_ORDERS,
|
|
768
814
|
LIST_CUSTOMERS,
|
|
815
|
+
LIST_FULFILLMENT_ORDERS,
|
|
769
816
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,9 @@ import commonApp from "@pipedream/shopify";
|
|
|
2
2
|
import Shopify from "shopify-api-node";
|
|
3
3
|
import queries from "./common/queries.mjs";
|
|
4
4
|
import mutations from "./common/mutations.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
API_VERSION, MAX_LIMIT,
|
|
7
|
+
} from "@pipedream/shopify/common/constants.mjs";
|
|
6
8
|
|
|
7
9
|
export default {
|
|
8
10
|
...commonApp,
|
|
@@ -40,6 +42,60 @@ export default {
|
|
|
40
42
|
});
|
|
41
43
|
},
|
|
42
44
|
},
|
|
45
|
+
lineItemIds: {
|
|
46
|
+
type: "string[]",
|
|
47
|
+
label: "Line Item IDs",
|
|
48
|
+
description: "An array of line item IDs",
|
|
49
|
+
async options({ orderId }) {
|
|
50
|
+
const order = await this.getOrder({
|
|
51
|
+
id: orderId,
|
|
52
|
+
first: MAX_LIMIT,
|
|
53
|
+
});
|
|
54
|
+
return order.order.lineItems.edges.map(({ node }) => ({
|
|
55
|
+
label: node.title,
|
|
56
|
+
value: node.id,
|
|
57
|
+
}));
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
fulfillmentId: {
|
|
61
|
+
type: "string",
|
|
62
|
+
label: "Fulfillment ID",
|
|
63
|
+
description: "The identifier of a fulfillment",
|
|
64
|
+
async options({ orderId }) {
|
|
65
|
+
const order = await this.getOrder({
|
|
66
|
+
id: orderId,
|
|
67
|
+
first: MAX_LIMIT,
|
|
68
|
+
});
|
|
69
|
+
return order.order.fulfillments?.map(({ id }) => id) ?? [];
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
fulfillmentOrderId: {
|
|
73
|
+
type: "string",
|
|
74
|
+
label: "Fulfillment Order ID",
|
|
75
|
+
description: "The identifier of a fulfillment order",
|
|
76
|
+
async options({ prevContext }) {
|
|
77
|
+
return this.getPropOptions({
|
|
78
|
+
resourceFn: this.listFulfillmentOrders,
|
|
79
|
+
resourceKeys: [
|
|
80
|
+
"fulfillmentOrders",
|
|
81
|
+
],
|
|
82
|
+
labelKey: "id",
|
|
83
|
+
prevContext,
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
fulfillmentOrderLineItemIds: {
|
|
88
|
+
type: "string[]",
|
|
89
|
+
label: "Fulfillment Order Line Item IDs",
|
|
90
|
+
description: "An array of fulfillment order line item IDs",
|
|
91
|
+
async options({ fulfillmentOrderId }) {
|
|
92
|
+
const fulfillmentOrder = await this.getFulfillmentOrder({
|
|
93
|
+
fulfillmentOrderId,
|
|
94
|
+
first: MAX_LIMIT,
|
|
95
|
+
});
|
|
96
|
+
return fulfillmentOrder.fulfillmentOrder.lineItems.nodes.map(({ id }) => id);
|
|
97
|
+
},
|
|
98
|
+
},
|
|
43
99
|
firstName: {
|
|
44
100
|
type: "string",
|
|
45
101
|
label: "First Name",
|
|
@@ -122,6 +178,9 @@ export default {
|
|
|
122
178
|
getDraftOrder(variables) {
|
|
123
179
|
return this._makeGraphQlRequest(queries.GET_DRAFT_ORDER, variables);
|
|
124
180
|
},
|
|
181
|
+
getFulfillmentOrder(variables) {
|
|
182
|
+
return this._makeGraphQlRequest(queries.GET_FULFILLMENT_ORDER, variables);
|
|
183
|
+
},
|
|
125
184
|
getCustomer(variables) {
|
|
126
185
|
return this._makeGraphQlRequest(queries.GET_CUSTOMER, variables);
|
|
127
186
|
},
|
|
@@ -134,14 +193,26 @@ export default {
|
|
|
134
193
|
listCustomers(variables) {
|
|
135
194
|
return this._makeGraphQlRequest(queries.LIST_CUSTOMERS, variables);
|
|
136
195
|
},
|
|
196
|
+
listFulfillmentOrders(variables) {
|
|
197
|
+
return this._makeGraphQlRequest(queries.LIST_FULFILLMENT_ORDERS, variables);
|
|
198
|
+
},
|
|
137
199
|
createOrder(variables) {
|
|
138
200
|
return this._makeGraphQlRequest(mutations.CREATE_ORDER, variables);
|
|
139
201
|
},
|
|
140
202
|
createCustomer(variables) {
|
|
141
203
|
return this._makeGraphQlRequest(mutations.CREATE_CUSTOMER, variables);
|
|
142
204
|
},
|
|
205
|
+
createFulfillment(variables) {
|
|
206
|
+
return this._makeGraphQlRequest(mutations.CREATE_FULFILLMENT, variables);
|
|
207
|
+
},
|
|
143
208
|
updateCustomer(variables) {
|
|
144
209
|
return this._makeGraphQlRequest(mutations.UPDATE_CUSTOMER, variables);
|
|
145
210
|
},
|
|
211
|
+
refundOrder(variables) {
|
|
212
|
+
return this._makeGraphQlRequest(mutations.REFUND_ORDER, variables);
|
|
213
|
+
},
|
|
214
|
+
updateFulfillmentTrackingInfo(variables) {
|
|
215
|
+
return this._makeGraphQlRequest(mutations.UPDATE_FULFILLMENT_TRACKING_INFO, variables);
|
|
216
|
+
},
|
|
146
217
|
},
|
|
147
218
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import common from "../common/webhook.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "shopify_developer_app-cart-updated",
|
|
6
|
+
name: "Cart Updated (Instant)",
|
|
7
|
+
description: "Emit new event when a cart is updated.",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getTopic() {
|
|
14
|
+
return "CARTS_UPDATE";
|
|
15
|
+
},
|
|
16
|
+
generateMeta(resource) {
|
|
17
|
+
const ts = Date.parse(resource.updated_at);
|
|
18
|
+
return {
|
|
19
|
+
id: `${resource.id}-${ts}`,
|
|
20
|
+
summary: `Cart Updated ${resource.id}`,
|
|
21
|
+
ts,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import common from "../common/webhook.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "shopify_developer_app-inventory-level-updated",
|
|
6
|
+
name: "Inventory Level Updated (Instant)",
|
|
7
|
+
description: "Emit new event when an inventory level is updated.",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getTopic() {
|
|
14
|
+
return "INVENTORY_LEVELS_UPDATE";
|
|
15
|
+
},
|
|
16
|
+
generateMeta(resource) {
|
|
17
|
+
const ts = Date.parse(resource.updated_at);
|
|
18
|
+
return {
|
|
19
|
+
id: `${resource.inventory_item_id}-${ts}`,
|
|
20
|
+
summary: `Inventory Level Updated ${resource.inventory_item_id}`,
|
|
21
|
+
ts,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import common from "../common/webhook.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "shopify_developer_app-new-cart-created",
|
|
6
|
+
name: "New Cart Created (Instant)",
|
|
7
|
+
description: "Emit new event when a new cart is created.",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getTopic() {
|
|
14
|
+
return "CARTS_CREATE";
|
|
15
|
+
},
|
|
16
|
+
generateMeta(resource) {
|
|
17
|
+
const ts = Date.parse(resource.created_at);
|
|
18
|
+
return {
|
|
19
|
+
id: `${resource.id}-${ts}`,
|
|
20
|
+
summary: `Cart Created ${resource.id}`,
|
|
21
|
+
ts,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "shopify_developer_app-new-product-updated",
|
|
6
6
|
name: "New Product Updated (Instant)",
|
|
7
7
|
description: "Emit new event for each product updated in a store.",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.11",
|
|
9
9
|
type: "source",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import common from "../common/webhook.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "shopify_developer_app-shop-update",
|
|
6
|
+
name: "Shop Updated (Instant)",
|
|
7
|
+
description: "Emit new event when a shop is updated.",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getTopic() {
|
|
14
|
+
return "SHOP_UPDATE";
|
|
15
|
+
},
|
|
16
|
+
generateMeta(resource) {
|
|
17
|
+
const ts = Date.parse(resource.updated_at);
|
|
18
|
+
return {
|
|
19
|
+
id: `${resource.id}-${ts}`,
|
|
20
|
+
summary: `Shop Updated ${resource.id}`,
|
|
21
|
+
ts,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|