From e537a93c31e706fcdcbca8d118b94e9489796e50 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 18 Jun 2024 14:52:51 -0400 Subject: [PATCH 1/2] new-product-updated --- components/shopify_developer_app/package.json | 2 +- .../new-product-updated.mjs | 55 ++++++++++++++++ .../new-product-updated/test-event.mjs | 64 +++++++++++++++++++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 components/shopify_developer_app/sources/new-product-updated/new-product-updated.mjs create mode 100644 components/shopify_developer_app/sources/new-product-updated/test-event.mjs diff --git a/components/shopify_developer_app/package.json b/components/shopify_developer_app/package.json index f8d531bc7ac61..4bccbe8e6509a 100644 --- a/components/shopify_developer_app/package.json +++ b/components/shopify_developer_app/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/shopify_developer_app", - "version": "0.2.4", + "version": "0.3.0", "description": "Pipedream Shopify (Developer App) Components", "main": "shopify_developer_app.app.mjs", "keywords": [ diff --git a/components/shopify_developer_app/sources/new-product-updated/new-product-updated.mjs b/components/shopify_developer_app/sources/new-product-updated/new-product-updated.mjs new file mode 100644 index 0000000000000..4c753d825a17b --- /dev/null +++ b/components/shopify_developer_app/sources/new-product-updated/new-product-updated.mjs @@ -0,0 +1,55 @@ +import common from "../common/webhook.mjs"; +import constants from "../common/constants.mjs"; + +export default { + ...common, + key: "shopify_developer_app-new-product-updated", + name: "New Product Updated (Instant)", + description: "Emit new event for each product updated in a store.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + productType: { + type: "string", + label: "Product Type", + description: "Filter results by product type", + optional: true, + }, + tags: { + type: "string[]", + label: "Tags", + description: "Filter results by product tag(s)", + optional: true, + }, + }, + methods: { + ...common.methods, + getTopic() { + return constants.EVENT_TOPIC.PRODUCTS_UPDATE; + }, + isRelevant(resource) { + let relevant = true; + if (this.productType && resource.product_type !== this.productType) { + relevant = false; + } + if (this.tags?.length) { + this.tags.forEach((tag) => { + if (!resource.tags?.includes(tag)) { + relevant = false; + } + }); + } + return relevant; + }, + generateMeta(resource) { + const ts = Date.parse(resource.updated_at); + return { + id: `${resource.id}-${ts}`, + summary: `Product Updated ${resource.id}`, + ts, + }; + }, + }, +}; diff --git a/components/shopify_developer_app/sources/new-product-updated/test-event.mjs b/components/shopify_developer_app/sources/new-product-updated/test-event.mjs new file mode 100644 index 0000000000000..465572db40b94 --- /dev/null +++ b/components/shopify_developer_app/sources/new-product-updated/test-event.mjs @@ -0,0 +1,64 @@ +export default { + "admin_graphql_api_id": "gid://shopify/Product/8416570474776", + "body_html": null, + "created_at": "2023-06-30T13:38:03-04:00", + "handle": "best-product-ever", + "id": 8416570474776, + "product_type": "", + "published_at": "2023-06-30T13:38:03-04:00", + "template_suffix": null, + "title": "product", + "updated_at": "2024-06-18T14:37:58-04:00", + "vendor": "Testing", + "status": "active", + "published_scope": "web", + "tags": "abc, def", + "variants": [ + { + "admin_graphql_api_id": "gid://shopify/ProductVariant/45612961333528", + "barcode": null, + "compare_at_price": null, + "created_at": "2023-06-30T13:38:03-04:00", + "fulfillment_service": "manual", + "id": 45612961333528, + "inventory_management": null, + "inventory_policy": "deny", + "position": 1, + "price": "0.00", + "product_id": 8416570474776, + "sku": "", + "taxable": true, + "title": "Default Title", + "updated_at": "2023-10-27T10:08:17-04:00", + "option1": "Default Title", + "option2": null, + "option3": null, + "grams": 0, + "image_id": null, + "weight": 0, + "weight_unit": "lb", + "inventory_item_id": 47661178487064, + "inventory_quantity": 0, + "old_inventory_quantity": 0, + "requires_shipping": true + }, + ], + "options": [ + { + "name": "Title", + "id": 10664239726872, + "product_id": 8416570474776, + "position": 1, + "values": [ + "Default Title", + ] + } + ], + "images": [], + "image": null, + "variant_ids": [ + { + "id": 45612961333528 + } + ] +} \ No newline at end of file From 06f466aad4f1d7e57c79a0db8f0ab0dba6e4098b Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Fri, 21 Jun 2024 12:36:21 -0400 Subject: [PATCH 2/2] update metafieldNamespaces descriptions --- components/shopify_developer_app/sources/common/webhook.mjs | 4 ++-- .../sources/new-cancelled-order/new-cancelled-order.mjs | 2 +- .../sources/new-customer-created/new-customer-created.mjs | 2 +- .../sources/new-draft-order/new-draft-order.mjs | 2 +- .../sources/new-event-emitted/new-event-emitted.mjs | 2 +- .../sources/new-order-created/new-order-created.mjs | 2 +- .../sources/new-paid-order/new-paid-order.mjs | 2 +- .../sources/new-product-created/new-product-created.mjs | 2 +- .../sources/new-shipment/new-shipment.mjs | 2 +- .../sources/new-updated-customer/new-updated-customer.mjs | 2 +- .../sources/new-updated-order/new-updated-order.mjs | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/components/shopify_developer_app/sources/common/webhook.mjs b/components/shopify_developer_app/sources/common/webhook.mjs index 31ded4fc14e16..7ba57793b7ab0 100644 --- a/components/shopify_developer_app/sources/common/webhook.mjs +++ b/components/shopify_developer_app/sources/common/webhook.mjs @@ -12,13 +12,13 @@ export default { metafieldNamespaces: { type: "string[]", label: "Metafield Namespaces", - description: "Array of namespaces for any metafields that should be included with each webhook", + description: "Array of namespaces for any metafields that should be included with each webhook. Metafield definitions can be found in your store's Settings -> Custom Data. Select a metafield to view its namespace under \"Namespace and key\". For example, if the value is `custom.test_metafield`, the namespace is `custom`.", optional: true, }, privateMetafieldNamespaces: { type: "string[]", label: "Private Metafield Namespaces", - description: "Array of namespaces for any private metafields that should be included with each webhook", + description: "Array of namespaces for any private metafields that should be included with each webhook. Metafield definitions can be found in your store's Settings -> Custom Data. Select a metafield to view its namespace under \"Namespace and key\". For example, if the value is `custom.test_metafield`, the namespace is `custom`.", optional: true, }, }, diff --git a/components/shopify_developer_app/sources/new-cancelled-order/new-cancelled-order.mjs b/components/shopify_developer_app/sources/new-cancelled-order/new-cancelled-order.mjs index d08e341af7fec..a1319dc71c2ed 100644 --- a/components/shopify_developer_app/sources/new-cancelled-order/new-cancelled-order.mjs +++ b/components/shopify_developer_app/sources/new-cancelled-order/new-cancelled-order.mjs @@ -7,7 +7,7 @@ export default { name: "New Cancelled Order (Instant)", type: "source", description: "Emit new event each time a new order is cancelled.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/shopify_developer_app/sources/new-customer-created/new-customer-created.mjs b/components/shopify_developer_app/sources/new-customer-created/new-customer-created.mjs index 05c3e3d8d12eb..2d3dab13075a2 100644 --- a/components/shopify_developer_app/sources/new-customer-created/new-customer-created.mjs +++ b/components/shopify_developer_app/sources/new-customer-created/new-customer-created.mjs @@ -7,7 +7,7 @@ export default { name: "New Customer Created (Instant)", type: "source", description: "Emit new event for each new customer added to a store.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/shopify_developer_app/sources/new-draft-order/new-draft-order.mjs b/components/shopify_developer_app/sources/new-draft-order/new-draft-order.mjs index 5beab5df34efa..1357565220a0e 100644 --- a/components/shopify_developer_app/sources/new-draft-order/new-draft-order.mjs +++ b/components/shopify_developer_app/sources/new-draft-order/new-draft-order.mjs @@ -7,7 +7,7 @@ export default { name: "New Draft Order (Instant)", type: "source", description: "Emit new event for each new draft order submitted to a store.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/shopify_developer_app/sources/new-event-emitted/new-event-emitted.mjs b/components/shopify_developer_app/sources/new-event-emitted/new-event-emitted.mjs index 3fc638dd5f5f2..db5d2b7df5d96 100644 --- a/components/shopify_developer_app/sources/new-event-emitted/new-event-emitted.mjs +++ b/components/shopify_developer_app/sources/new-event-emitted/new-event-emitted.mjs @@ -7,7 +7,7 @@ export default { name: "New Event Emitted (Instant)", type: "source", description: "Emit new event for each new Shopify event.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", props: { ...common.props, diff --git a/components/shopify_developer_app/sources/new-order-created/new-order-created.mjs b/components/shopify_developer_app/sources/new-order-created/new-order-created.mjs index 2f58fd6df5f74..e6c88ab63f62c 100644 --- a/components/shopify_developer_app/sources/new-order-created/new-order-created.mjs +++ b/components/shopify_developer_app/sources/new-order-created/new-order-created.mjs @@ -7,7 +7,7 @@ export default { name: "New Order Created (Instant)", type: "source", description: "Emit new event for each new order submitted to a store.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/shopify_developer_app/sources/new-paid-order/new-paid-order.mjs b/components/shopify_developer_app/sources/new-paid-order/new-paid-order.mjs index 0c2e34496549a..b69b3ebaa3b12 100644 --- a/components/shopify_developer_app/sources/new-paid-order/new-paid-order.mjs +++ b/components/shopify_developer_app/sources/new-paid-order/new-paid-order.mjs @@ -7,7 +7,7 @@ export default { name: "New Paid Order (Instant)", type: "source", description: "Emit new event each time a new order is paid.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/shopify_developer_app/sources/new-product-created/new-product-created.mjs b/components/shopify_developer_app/sources/new-product-created/new-product-created.mjs index b02ae484ae544..bcdbea7d6f364 100644 --- a/components/shopify_developer_app/sources/new-product-created/new-product-created.mjs +++ b/components/shopify_developer_app/sources/new-product-created/new-product-created.mjs @@ -7,7 +7,7 @@ export default { name: "New Product Created (Instant)", type: "source", description: "Emit new event for each product added to a store.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/shopify_developer_app/sources/new-shipment/new-shipment.mjs b/components/shopify_developer_app/sources/new-shipment/new-shipment.mjs index 8dfe3790dd350..4981507384187 100644 --- a/components/shopify_developer_app/sources/new-shipment/new-shipment.mjs +++ b/components/shopify_developer_app/sources/new-shipment/new-shipment.mjs @@ -7,7 +7,7 @@ export default { name: "New Shipment (Instant)", type: "source", description: "Emit new event for each new fulfillment event for a store.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/shopify_developer_app/sources/new-updated-customer/new-updated-customer.mjs b/components/shopify_developer_app/sources/new-updated-customer/new-updated-customer.mjs index b5058612f8bef..76c23e8bfd284 100644 --- a/components/shopify_developer_app/sources/new-updated-customer/new-updated-customer.mjs +++ b/components/shopify_developer_app/sources/new-updated-customer/new-updated-customer.mjs @@ -7,7 +7,7 @@ export default { name: "New Updated Customer (Instant)", type: "source", description: "Emit new event each time a customer's information is updated.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/shopify_developer_app/sources/new-updated-order/new-updated-order.mjs b/components/shopify_developer_app/sources/new-updated-order/new-updated-order.mjs index 8e0544d3d1ff9..af105ba7de7b0 100644 --- a/components/shopify_developer_app/sources/new-updated-order/new-updated-order.mjs +++ b/components/shopify_developer_app/sources/new-updated-order/new-updated-order.mjs @@ -7,7 +7,7 @@ export default { name: "New Updated Order (Instant)", type: "source", description: "Emit new event each time an order is updated.", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods,