@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.
Files changed (64) hide show
  1. package/actions/add-product-to-custom-collection/add-product-to-custom-collection.mjs +1 -1
  2. package/actions/add-tags/add-tags.mjs +1 -1
  3. package/actions/create-article/create-article.mjs +1 -1
  4. package/actions/create-blog/create-blog.mjs +1 -1
  5. package/actions/create-custom-collection/create-custom-collection.mjs +1 -1
  6. package/actions/create-customer/create-customer.mjs +1 -1
  7. package/actions/create-fulfillment/create-fulfillment.mjs +77 -0
  8. package/actions/create-metafield/create-metafield.mjs +1 -1
  9. package/actions/create-metaobject/create-metaobject.mjs +1 -1
  10. package/actions/create-order/create-order.mjs +1 -1
  11. package/actions/create-page/create-page.mjs +1 -1
  12. package/actions/create-product/create-product.mjs +1 -1
  13. package/actions/create-product-variant/create-product-variant.mjs +1 -1
  14. package/actions/create-smart-collection/create-smart-collection.mjs +1 -1
  15. package/actions/delete-article/delete-article.mjs +1 -1
  16. package/actions/delete-blog/delete-blog.mjs +1 -1
  17. package/actions/delete-metafield/delete-metafield.mjs +1 -1
  18. package/actions/delete-page/delete-page.mjs +1 -1
  19. package/actions/get-articles/get-articles.mjs +1 -1
  20. package/actions/get-metafields/get-metafields.mjs +1 -1
  21. package/actions/get-metaobjects/get-metaobjects.mjs +1 -1
  22. package/actions/get-order/get-order.mjs +1 -1
  23. package/actions/get-pages/get-pages.mjs +1 -1
  24. package/actions/refund-order/refund-order.mjs +100 -0
  25. package/actions/search-custom-collection-by-name/search-custom-collection-by-name.mjs +1 -1
  26. package/actions/search-customers/search-customers.mjs +1 -1
  27. package/actions/search-fulfillment-orders/search-fulfillment-orders.mjs +40 -0
  28. package/actions/search-orders/search-orders.mjs +1 -1
  29. package/actions/search-product-variant/search-product-variant.mjs +1 -1
  30. package/actions/search-products/search-products.mjs +1 -1
  31. package/actions/update-article/update-article.mjs +1 -1
  32. package/actions/update-customer/update-customer.mjs +1 -1
  33. package/actions/update-fulfillment-tracking-info/update-fulfillment-tracking-info.mjs +68 -0
  34. package/actions/update-inventory-level/update-inventory-level.mjs +1 -1
  35. package/actions/update-metafield/update-metafield.mjs +1 -1
  36. package/actions/update-metaobject/update-metaobject.mjs +1 -1
  37. package/actions/update-page/update-page.mjs +1 -1
  38. package/actions/update-product/update-product.mjs +1 -1
  39. package/actions/update-product-variant/update-product-variant.mjs +1 -1
  40. package/common/mutations.mjs +88 -0
  41. package/common/queries.mjs +47 -0
  42. package/package.json +1 -1
  43. package/shopify_developer_app.app.mjs +72 -1
  44. package/sources/cart-updated/cart-updated.mjs +25 -0
  45. package/sources/inventory-level-updated/inventory-level-updated.mjs +25 -0
  46. package/sources/new-abandoned-cart/new-abandoned-cart.mjs +1 -1
  47. package/sources/new-article/new-article.mjs +1 -1
  48. package/sources/new-cancelled-order/new-cancelled-order.mjs +1 -1
  49. package/sources/new-cart-created/new-cart-created.mjs +25 -0
  50. package/sources/new-customer-created/new-customer-created.mjs +1 -1
  51. package/sources/new-draft-order/new-draft-order.mjs +1 -1
  52. package/sources/new-event-emitted/new-event-emitted.mjs +1 -1
  53. package/sources/new-fulfillment-event/new-fulfillment-event.mjs +1 -1
  54. package/sources/new-order-created/new-order-created.mjs +1 -1
  55. package/sources/new-order-fulfilled/new-order-fulfilled.mjs +1 -1
  56. package/sources/new-page/new-page.mjs +1 -1
  57. package/sources/new-paid-order/new-paid-order.mjs +1 -1
  58. package/sources/new-product-created/new-product-created.mjs +1 -1
  59. package/sources/new-product-updated/new-product-updated.mjs +1 -1
  60. package/sources/new-refund-created/new-refund-created.mjs +1 -1
  61. package/sources/new-updated-customer/new-updated-customer.mjs +1 -1
  62. package/sources/new-updated-order/new-updated-order.mjs +1 -1
  63. package/sources/product-added-to-custom-collection/product-added-to-custom-collection.mjs +1 -1
  64. package/sources/shop-update/shop-update.mjs +25 -0
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-add-product-to-custom-collection",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-add-tags",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-create-article",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-create-blog",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-create-custom-collection",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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.8",
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
+ };
@@ -10,7 +10,7 @@ const {
10
10
  export default {
11
11
  ...others,
12
12
  key: "shopify_developer_app-create-metafield",
13
- version: "0.0.9",
13
+ version: "0.0.10",
14
14
  name,
15
15
  description,
16
16
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-create-metaobject",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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",
8
+ version: "0.0.9",
9
9
  type: "action",
10
10
  props: {
11
11
  shopify,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-create-page",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-create-product",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-create-product-variant",
14
- version: "0.0.9",
14
+ version: "0.0.10",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-create-smart-collection",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-delete-article",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-delete-blog",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -9,7 +9,7 @@ const {
9
9
  export default {
10
10
  ...others,
11
11
  key: "shopify_developer_app-delete-metafield",
12
- version: "0.0.9",
12
+ version: "0.0.10",
13
13
  name,
14
14
  description,
15
15
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-delete-page",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-get-articles",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -8,7 +8,7 @@ const {
8
8
 
9
9
  export default {
10
10
  key: "shopify_developer_app-get-metafields",
11
- version: "0.0.9",
11
+ version: "0.0.10",
12
12
  name,
13
13
  description,
14
14
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-get-metaobjects",
14
- version: "0.0.9",
14
+ version: "0.0.10",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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.6",
8
+ version: "0.0.7",
9
9
  type: "action",
10
10
  props: {
11
11
  shopify,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-get-pages",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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
+ };
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-search-custom-collection-by-name",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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.8",
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.2",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  props: {
10
10
  shopify,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-search-product-variant",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-search-products",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-update-article",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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",
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
+ };
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-update-inventory-level",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -9,7 +9,7 @@ const {
9
9
  export default {
10
10
  ...others,
11
11
  key: "shopify_developer_app-update-metafield",
12
- version: "0.0.9",
12
+ version: "0.0.10",
13
13
  name,
14
14
  description,
15
15
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-update-metaobject",
14
- version: "0.0.11",
14
+ version: "0.0.12",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-update-page",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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",
9
+ version: "0.0.10",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-update-product-variant",
14
- version: "0.0.10",
14
+ version: "0.0.11",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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
  };
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/shopify_developer_app",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Pipedream Shopify (Developer App) Components",
5
5
  "main": "shopify_developer_app.app.mjs",
6
6
  "keywords": [
@@ -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 { API_VERSION } from "@pipedream/shopify/common/constants.mjs";
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
+ };
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-new-abandoned-cart",
14
- version: "0.0.9",
14
+ version: "0.0.10",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-new-article",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Cancelled Order (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event each time a new order is cancelled.",
9
- version: "0.0.12",
9
+ version: "0.0.13",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -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
+ };
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Customer Created (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event for each new customer added to a store.",
9
- version: "0.0.12",
9
+ version: "0.0.13",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Draft Order (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event for each new draft order submitted to a store.",
9
- version: "0.0.12",
9
+ version: "0.0.13",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -7,7 +7,7 @@ export default {
7
7
  name: "New Event Emitted (Instant)",
8
8
  type: "source",
9
9
  description: "Emit new event for each new Shopify event.",
10
- version: "0.0.13",
10
+ version: "0.0.14",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Fulfillment Event (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event for each new fulfillment event for a store.",
9
- version: "0.0.10",
9
+ version: "0.0.11",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Order Created (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event for each new order submitted to a store.",
9
- version: "0.0.12",
9
+ version: "0.0.13",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Order Fulfilled (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event whenever an order is fulfilled.",
9
- version: "0.0.9",
9
+ version: "0.0.10",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-new-page",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Paid Order (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event each time a new order is paid.",
9
- version: "0.0.12",
9
+ version: "0.0.13",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Product Created (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event for each product added to a store.",
9
- version: "0.0.12",
9
+ version: "0.0.13",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -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.10",
8
+ version: "0.0.11",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "shopify_developer_app-new-refund-created",
6
6
  name: "New Refund Created (Instant)",
7
7
  description: "Emit new event when a new refund is created.",
8
- version: "0.0.9",
8
+ version: "0.0.10",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Updated Customer (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event each time a customer's information is updated.",
9
- version: "0.0.12",
9
+ version: "0.0.13",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Updated Order (Instant)",
7
7
  type: "source",
8
8
  description: "Emit new event each time an order is updated.",
9
- version: "0.0.12",
9
+ version: "0.0.13",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
11
11
  export default {
12
12
  ...others,
13
13
  key: "shopify_developer_app-product-added-to-custom-collection",
14
- version: "0.0.8",
14
+ version: "0.0.9",
15
15
  name,
16
16
  description,
17
17
  type,
@@ -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
+ };