@pipedream/shopify_developer_app 0.1.2 → 0.2.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 (50) 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-metafield/create-metafield.mjs +1 -1
  8. package/actions/create-metaobject/create-metaobject.mjs +1 -1
  9. package/actions/create-order/create-order.mjs +1 -1
  10. package/actions/create-page/create-page.mjs +1 -1
  11. package/actions/create-product/create-product.mjs +1 -1
  12. package/actions/create-product-variant/create-product-variant.mjs +1 -1
  13. package/actions/create-smart-collection/create-smart-collection.mjs +1 -1
  14. package/actions/delete-article/delete-article.mjs +1 -1
  15. package/actions/delete-blog/delete-blog.mjs +1 -1
  16. package/actions/delete-metafield/delete-metafield.mjs +1 -1
  17. package/actions/delete-page/delete-page.mjs +1 -1
  18. package/actions/get-articles/get-articles.mjs +1 -1
  19. package/actions/get-metafields/get-metafields.mjs +1 -1
  20. package/actions/get-metaobjects/get-metaobjects.mjs +1 -1
  21. package/actions/get-pages/get-pages.mjs +1 -1
  22. package/actions/search-custom-collection-by-name/search-custom-collection-by-name.mjs +1 -1
  23. package/actions/search-customers/search-customers.mjs +1 -1
  24. package/actions/search-product-variant/search-product-variant.mjs +1 -1
  25. package/actions/search-products/search-products.mjs +1 -1
  26. package/actions/update-article/update-article.mjs +1 -1
  27. package/actions/update-customer/update-customer.mjs +1 -1
  28. package/actions/update-inventory-level/update-inventory-level.mjs +1 -1
  29. package/actions/update-metafield/update-metafield.mjs +1 -1
  30. package/actions/update-metaobject/update-metaobject.mjs +1 -1
  31. package/actions/update-page/update-page.mjs +1 -1
  32. package/actions/update-product/update-product.mjs +1 -1
  33. package/actions/update-product-variant/update-product-variant.mjs +1 -1
  34. package/package.json +1 -1
  35. package/sources/common/constants.mjs +108 -0
  36. package/sources/common/webhook.mjs +96 -0
  37. package/sources/new-abandoned-cart/new-abandoned-cart.mjs +1 -1
  38. package/sources/new-article/new-article.mjs +1 -1
  39. package/sources/new-cancelled-order/new-cancelled-order.mjs +26 -0
  40. package/sources/new-customer-created/new-customer-created.mjs +26 -0
  41. package/sources/new-draft-order/new-draft-order.mjs +26 -0
  42. package/sources/new-event-emitted/new-event-emitted.mjs +35 -0
  43. package/sources/new-order-created/new-order-created.mjs +35 -0
  44. package/sources/new-page/new-page.mjs +1 -1
  45. package/sources/new-paid-order/new-paid-order.mjs +26 -0
  46. package/sources/new-product-created/new-product-created.mjs +26 -0
  47. package/sources/new-shipment/new-shipment.mjs +26 -0
  48. package/sources/new-updated-customer/new-updated-customer.mjs +26 -0
  49. package/sources/new-updated-order/new-updated-order.mjs +26 -0
  50. package/sources/product-added-to-custom-collection/product-added-to-custom-collection.mjs +1 -1
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-add-product-to-custom-collection",
7
7
  name: "Add Products to Custom Collections",
8
8
  description: "Adds a product or products to a custom collection or collections. [See the docs](https://shopify.dev/docs/api/admin-rest/2023-01/resources/collect#post-collects)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -4,7 +4,7 @@ import common from "../../../shopify/actions/add-tags/common.mjs";
4
4
  export default {
5
5
  ...common,
6
6
  name: "Add Tags",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  key: "shopify_developer_app-add-tags",
9
9
  description: "Add tags. [See the documentation](https://shopify.dev/api/admin-graphql/2022-07/mutations/tagsadd)",
10
10
  type: "action",
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-create-article",
7
7
  name: "Create Article",
8
8
  description: "Create a new blog article. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/article#post-blogs-blog-id-articles)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-create-blog",
7
7
  name: "Create Blog",
8
8
  description: "Create a new blog. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/blog#post-blogs)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-create-custom-collection",
7
7
  name: "Create Custom Collection",
8
8
  description: "Create a new custom collection. [See the documentation](https://shopify.dev/docs/api/admin-rest/2023-01/resources/customcollection#post-custom-collections)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-create-customer",
7
7
  name: "Create Customer",
8
8
  description: "Create a new customer. [See the documentation](https://shopify.dev/api/admin-rest/2022-01/resources/customer#[post]/admin/api/2022-01/customers.json)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-create-metafield",
7
7
  name: "Create Metafield",
8
8
  description: "Creates a metafield belonging to a resource. [See the docs](https://shopify.dev/api/admin-rest/2023-01/resources/metafield#post-blogs-blog-id-metafields)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  ...metafieldActions.props,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "shopify_developer_app-create-metaobject",
9
9
  name: "Create Metaobject",
10
10
  description: "Creates a metaobject. [See the documentation](https://shopify.dev/docs/api/admin-graphql/2023-04/mutations/metaobjectCreate)",
11
- version: "0.0.2",
11
+ version: "0.0.3",
12
12
  type: "action",
13
13
  props: {
14
14
  shopify,
@@ -10,7 +10,7 @@ export default {
10
10
  For full order object details [see the docs](https://shopify.dev/api/admin-rest/2022-01/resources/order#[post]/admin/api/2022-01/orders.json)
11
11
  or [see examples](https://shopify.dev/api/admin-rest/2022-01/resources/order#[post]/admin/api/#{api_version}/orders.json_examples)
12
12
  `),
13
- version: "0.0.1",
13
+ version: "0.0.2",
14
14
  type: "action",
15
15
  props: {
16
16
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-create-page",
7
7
  name: "Create Page",
8
8
  description: "Create a new page. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/page#post-pages)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-create-product",
7
7
  name: "Create Product",
8
8
  description: "Create a new product. [See the documentation](https://shopify.dev/api/admin-rest/2022-01/resources/product#[post]/admin/api/2022-01/products.json)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-create-product-variant",
7
7
  name: "Create Product Variant",
8
8
  description: "Create a new product variant. [See the documentation](https://shopify.dev/api/admin-rest/2022-01/resources/product-variant#[post]/admin/api/2022-01/products/{product_id}/variants.json)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -11,7 +11,7 @@ export default {
11
11
  You can fill in any number of rules by selecting more than one option in each prop.
12
12
  [See documentation](https://shopify.dev/api/admin-rest/2021-10/resources/smartcollection#post-smart-collections)
13
13
  `),
14
- version: "0.0.1",
14
+ version: "0.0.2",
15
15
  type: "action",
16
16
  props: {
17
17
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-delete-article",
7
7
  name: "Delete Article",
8
8
  description: "Delete an existing blog article. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/article#delete-blogs-blog-id-articles-article-id)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-delete-blog",
7
7
  name: "Delete Blog",
8
8
  description: "Delete an existing blog. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/blog#delete-blogs-blog-id)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-delete-metafield",
7
7
  name: "Delete Metafield",
8
8
  description: "Deletes a metafield belonging to a resource. [See the documentation](https://shopify.dev/docs/api/admin-rest/2023-01/resources/metafield#delete-blogs-blog-id-metafields-metafield-id)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  ...metafieldActions.props,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-delete-page",
7
7
  name: "Delete Page",
8
8
  description: "Delete an existing page. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/page#delete-pages-page-id)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-get-articles",
7
7
  name: "Get Articles",
8
8
  description: "Retrieve a list of all articles from a blog. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/article#get-blogs-blog-id-articles)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-get-metafields",
7
7
  name: "Get Metafields",
8
8
  description: "Retrieves a list of metafields that belong to a resource. [See the docs](https://shopify.dev/api/admin-rest/2023-01/resources/metafield#get-metafields?metafield[owner-id]=382285388&metafield[owner-resource]=blog)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  ...metafieldActions.props,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "shopify_developer_app-get-metaobjects",
9
9
  name: "Get Metaobjects",
10
10
  description: "Retrieves a list of metaobjects. [See the documentation](https://shopify.dev/docs/api/admin-graphql/2023-04/queries/metaobjects)",
11
- version: "0.0.1",
11
+ version: "0.0.2",
12
12
  type: "action",
13
13
  props: {
14
14
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-get-pages",
7
7
  name: "Get Pages",
8
8
  description: "Retrieve a list of all pages. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/page#get-pages)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-search-custom-collection-by-name",
7
7
  name: "Search Custom Collection by Name",
8
8
  description: "Search for a custom collection by name/title. [See the documentation](https://shopify.dev/docs/api/admin-rest/2023-01/resources/customcollection#get-custom-collections)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-search-customers",
7
7
  name: "Search for Customers",
8
8
  description: "Search for a customer or a list of customers. [See the documentation](https://shopify.dev/api/admin-rest/2022-01/resources/customer#[get]/admin/api/2022-01/customers.json)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-search-product-variant",
7
7
  name: "Search for Product Variant",
8
8
  description: "Search for product variants or create one if not found. [See the documentation](https://shopify.dev/api/admin-rest/2022-01/resources/product-variant#top)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-search-products",
7
7
  name: "Search for Products",
8
8
  description: "Search for products. [See the documentation](https://shopify.dev/api/admin-rest/2022-01/resources/product#[get]/admin/api/2022-01/products.json)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-update-article",
7
7
  name: "Update Article",
8
8
  description: "Update a blog article. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/article#put-blogs-blog-id-articles-article-id)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "shopify_developer_app-update-customer",
9
9
  name: "Update Customer",
10
10
  description: "Update a existing customer. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/customer#[put]/admin/api/2022-01/customers/{customer_id}.json)",
11
- version: "0.0.1",
11
+ version: "0.0.2",
12
12
  type: "action",
13
13
  props: {
14
14
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-update-inventory-level",
7
7
  name: "Update Inventory Level",
8
8
  description: "Sets the inventory level for an inventory item at a location. [See the documenation](https://shopify.dev/api/admin-rest/2022-01/resources/inventorylevel#[post]/admin/api/2022-01/inventory_levels/set.json)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-update-metafield",
7
7
  name: "Update Metafield",
8
8
  description: "Updates a metafield belonging to a resource. [See the docs](https://shopify.dev/api/admin-rest/2023-01/resources/metafield#put-blogs-blog-id-metafields-metafield-id)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  ...metafieldActions.props,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "shopify_developer_app-update-metaobject",
9
9
  name: "Update Metaobject",
10
10
  description: "Updates a metaobject. [See the documentation](https://shopify.dev/docs/api/admin-graphql/2023-04/mutations/metaobjectUpdate)",
11
- version: "0.0.2",
11
+ version: "0.0.3",
12
12
  type: "action",
13
13
  props: {
14
14
  shopify,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-update-page",
7
7
  name: "Update Page",
8
8
  description: "Update an existing page. [See The Documentation](https://shopify.dev/docs/api/admin-rest/2023-04/resources/page#put-pages-page-id)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  app,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "shopify_developer_app-update-product",
9
9
  name: "Update Product",
10
10
  description: "Update an existing product. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/product#[put]/admin/api/2022-01/products/{product_id}.json)",
11
- version: "0.0.1",
11
+ version: "0.0.2",
12
12
  type: "action",
13
13
  props: {
14
14
  shopify,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "shopify_developer_app-update-product-variant",
9
9
  name: "Update Product Variant",
10
10
  description: "Update an existing product variant. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/product-variant#[put]/admin/api/2022-01/variants/{variant_id}.json)",
11
- version: "0.0.1",
11
+ version: "0.0.2",
12
12
  type: "action",
13
13
  props: {
14
14
  shopify,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/shopify_developer_app",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Pipedream Shopify (Developer App) Components",
5
5
  "main": "shopify_developer_app.app.mjs",
6
6
  "keywords": [
@@ -0,0 +1,108 @@
1
+ const DOMAIN_SUFFIX = ".myshopify.com";
2
+ const WEBHOOK_ID = "webhookId";
3
+
4
+ const HEADER = {
5
+ SHOP_DOMAIN: "x-shopify-shop-domain",
6
+ TOPIC: "x-shopify-topic",
7
+ };
8
+
9
+ const EVENT_TOPIC = {
10
+ APP_UNINSTALLED: "app/uninstalled",
11
+ BULK_OPERATIONS_FINISH: "bulk_operations/finish",
12
+ CARTS_CREATE: "carts/create",
13
+ CARTS_UPDATE: "carts/update",
14
+ CHECKOUTS_CREATE: "checkouts/create",
15
+ CHECKOUTS_DELETE: "checkouts/delete",
16
+ CHECKOUTS_UPDATE: "checkouts/update",
17
+ COLLECTION_LISTINGS_ADD: "collection_listings/add",
18
+ COLLECTION_LISTINGS_REMOVE: "collection_listings/remove",
19
+ COLLECTION_LISTINGS_UPDATE: "collection_listings/update",
20
+ COLLECTIONS_CREATE: "collections/create",
21
+ COLLECTIONS_DELETE: "collections/delete",
22
+ COLLECTIONS_UPDATE: "collections/update",
23
+ CUSTOMER_GROUPS_CREATE: "customer_groups/create",
24
+ CUSTOMER_GROUPS_DELETE: "customer_groups/delete",
25
+ CUSTOMER_GROUPS_UPDATE: "customer_groups/update",
26
+ CUSTOMER_PAYMENT_METHODS_CREATE: "customer_payment_methods/create",
27
+ CUSTOMER_PAYMENT_METHODS_REVOKE: "customer_payment_methods/revoke",
28
+ CUSTOMER_PAYMENT_METHODS_UPDATE: "customer_payment_methods/update",
29
+ CUSTOMERS_MARKETING_CONSENT_UPDATE: "customers_marketing_consent/update",
30
+ CUSTOMERS_CREATE: "customers/create",
31
+ CUSTOMERS_DELETE: "customers/delete",
32
+ CUSTOMERS_DISABLE: "customers/disable",
33
+ CUSTOMERS_ENABLE: "customers/enable",
34
+ CUSTOMERS_UPDATE: "customers/update",
35
+ DISPUTES_CREATE: "disputes/create",
36
+ DISPUTES_UPDATE: "disputes/update",
37
+ DOMAINS_CREATE: "domains/create",
38
+ DOMAINS_DESTROY: "domains/destroy",
39
+ DOMAINS_UPDATE: "domains/update",
40
+ DRAFT_ORDERS_CREATE: "draft_orders/create",
41
+ DRAFT_ORDERS_DELETE: "draft_orders/delete",
42
+ DRAFT_ORDERS_UPDATE: "draft_orders/update",
43
+ FULFILLMENT_EVENTS_CREATE: "fulfillment_events/create",
44
+ FULFILLMENT_EVENTS_DELETE: "fulfillment_events/delete",
45
+ FULFILLMENTS_CREATE: "fulfillments/create",
46
+ FULFILLMENTS_UPDATE: "fulfillments/update",
47
+ INVENTORY_ITEMS_CREATE: "inventory_items/create",
48
+ INVENTORY_ITEMS_DELETE: "inventory_items/delete",
49
+ INVENTORY_ITEMS_UPDATE: "inventory_items/update",
50
+ INVENTORY_LEVELS_CONNECT: "inventory_levels/connect",
51
+ INVENTORY_LEVELS_DISCONNECT: "inventory_levels/disconnect",
52
+ INVENTORY_LEVELS_UPDATE: "inventory_levels/update",
53
+ LOCALES_CREATE: "locales/create",
54
+ LOCALES_UPDATE: "locales/update",
55
+ LOCATIONS_CREATE: "locations/create",
56
+ LOCATIONS_DELETE: "locations/delete",
57
+ LOCATIONS_UPDATE: "locations/update",
58
+ MARKETS_CREATE: "markets/create",
59
+ MARKETS_DELETE: "markets/delete",
60
+ MARKETS_UPDATE: "markets/update",
61
+ ORDER_TRANSACTIONS_CREATE: "order_transactions/create",
62
+ ORDERS_CANCELLED: "orders/cancelled",
63
+ ORDERS_CREATE: "orders/create",
64
+ ORDERS_DELETE: "orders/delete",
65
+ ORDERS_EDITED: "orders/edited",
66
+ ORDERS_FULFILLED: "orders/fulfilled",
67
+ ORDERS_PAID: "orders/paid",
68
+ ORDERS_PARTIALLY_FULFILLED: "orders/partially_fulfilled",
69
+ ORDERS_UPDATED: "orders/updated",
70
+ PRODUCT_LISTINGS_ADD: "product_listings/add",
71
+ PRODUCT_LISTINGS_REMOVE: "product_listings/remove",
72
+ PRODUCT_LISTINGS_UPDATE: "product_listings/update",
73
+ PRODUCTS_CREATE: "products/create",
74
+ PRODUCTS_DELETE: "products/delete",
75
+ PRODUCTS_UPDATE: "products/update",
76
+ PROFILES_CREATE: "profiles/create",
77
+ PROFILES_DELETE: "profiles/delete",
78
+ PROFILES_UPDATE: "profiles/update",
79
+ REFUNDS_CREATE: "refunds/create",
80
+ SCHEDULED_PRODUCT_LISTINGS_ADD: "scheduled_product_listings/add",
81
+ SCHEDULED_PRODUCT_LISTINGS_REMOVE: "scheduled_product_listings/remove",
82
+ SCHEDULED_PRODUCT_LISTINGS_UPDATE: "scheduled_product_listings/update",
83
+ SELLING_PLAN_GROUPS_CREATE: "selling_plan_groups/create",
84
+ SELLING_PLAN_GROUPS_DELETE: "selling_plan_groups/delete",
85
+ SELLING_PLAN_GROUPS_UPDATE: "selling_plan_groups/update",
86
+ SHOP_UPDATE: "shop/update",
87
+ SUBSCRIPTION_BILLING_ATTEMPTS_CHALLENGED: "subscription_billing_attempts/challenged",
88
+ SUBSCRIPTION_BILLING_ATTEMPTS_FAILURE: "subscription_billing_attempts/failure",
89
+ SUBSCRIPTION_BILLING_ATTEMPTS_SUCCESS: "subscription_billing_attempts/success",
90
+ SUBSCRIPTION_CONTRACTS_CREATE: "subscription_contracts/create",
91
+ SUBSCRIPTION_CONTRACTS_UPDATE: "subscription_contracts/update",
92
+ TENDER_TRANSACTIONS_CREATE: "tender_transactions/create",
93
+ THEMES_CREATE: "themes/create",
94
+ THEMES_DELETE: "themes/delete",
95
+ THEMES_PUBLISH: "themes/publish",
96
+ EVENT_TOPICS_THEMES_UPDATE: "event-topics-themes-update",
97
+ THEMES_UPDATE: "themes/update",
98
+ };
99
+
100
+ const EVENT_TOPICS = Object.values(EVENT_TOPIC);
101
+
102
+ export default {
103
+ DOMAIN_SUFFIX,
104
+ WEBHOOK_ID,
105
+ HEADER,
106
+ EVENT_TOPIC,
107
+ EVENT_TOPICS,
108
+ };
@@ -0,0 +1,96 @@
1
+ import app from "../../shopify_developer_app.app.mjs";
2
+ import constants from "./constants.mjs";
3
+
4
+ export default {
5
+ props: {
6
+ app,
7
+ db: "$.service.db",
8
+ http: {
9
+ type: "$.interface.http",
10
+ customResponse: true,
11
+ },
12
+ metafieldNamespaces: {
13
+ type: "string[]",
14
+ label: "Metafield Namespaces",
15
+ description: "Array of namespaces for any metafields that should be included with each webhook",
16
+ optional: true,
17
+ },
18
+ privateMetafieldNamespaces: {
19
+ type: "string[]",
20
+ label: "Private Metafield Namespaces",
21
+ description: "Array of namespaces for any private metafields that should be included with each webhook",
22
+ optional: true,
23
+ },
24
+ },
25
+ hooks: {
26
+ async activate() {
27
+ const { result: webhook } = await this.app.createWebhook({
28
+ address: this.http.endpoint,
29
+ topic: this.getTopic(),
30
+ metafield_namespaces: this.metafieldNamespaces,
31
+ private_metafield_namespaces: this.privateMetafieldNamespaces,
32
+ });
33
+ this.setWebhookId(webhook.id);
34
+ },
35
+ async deactivate() {
36
+ const webhookId = this.getWebhookId();
37
+ await this.app.deleteWebhook(webhookId);
38
+ },
39
+ },
40
+ methods: {
41
+ getWebhookId() {
42
+ return this.db.get(constants.WEBHOOK_ID);
43
+ },
44
+ setWebhookId(webhookId) {
45
+ this.db.set(constants.WEBHOOK_ID, webhookId);
46
+ },
47
+ getTopic() {
48
+ throw new Error("getTopic is not implemented");
49
+ },
50
+ generateMeta() {
51
+ throw new Error("generateMeta is not implemented");
52
+ },
53
+ isWebhookEventValid({
54
+ domain, topic,
55
+ } = {}) {
56
+ const [
57
+ shopId,
58
+ ] = domain.split(constants.DOMAIN_SUFFIX);
59
+ return this.app.getShopId() === shopId
60
+ && this.getTopic() === topic;
61
+ },
62
+ isRelevant() {
63
+ return true;
64
+ },
65
+ },
66
+ async run(event) {
67
+ const {
68
+ headers, body: resource,
69
+ } = event;
70
+ const {
71
+ [constants.HEADER.SHOP_DOMAIN]: domain,
72
+ [constants.HEADER.TOPIC]: topic,
73
+ } = headers;
74
+
75
+ const isValid = this.isWebhookEventValid({
76
+ domain,
77
+ topic,
78
+ });
79
+
80
+ if (!isValid) {
81
+ this.http.respond({
82
+ status: 401,
83
+ });
84
+ console.log(`Ignoring webhook event with domain: ${domain} and topic: ${topic}`);
85
+ return;
86
+ }
87
+
88
+ this.http.respond({
89
+ status: 200,
90
+ });
91
+
92
+ if (this.isRelevant(resource)) {
93
+ this.$emit(resource, this.generateMeta(resource));
94
+ }
95
+ },
96
+ };
@@ -7,7 +7,7 @@ export default {
7
7
  name: "New Abandoned Cart",
8
8
  type: "source",
9
9
  description: "Emit new event each time a user abandons their cart.",
10
- version: "0.0.1",
10
+ version: "0.0.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  shopify,
@@ -7,7 +7,7 @@ export default {
7
7
  name: "New Article",
8
8
  type: "source",
9
9
  description: "Emit new event for each new article in a blog.",
10
- version: "0.0.1",
10
+ version: "0.0.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  shopify,
@@ -0,0 +1,26 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-cancelled-order",
7
+ name: "New Cancelled Order (Instant)",
8
+ type: "source",
9
+ description: "Emit new event each time a new order is cancelled.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.ORDERS_CANCELLED;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.updated_at);
19
+ return {
20
+ id: ts,
21
+ summary: `Order Cancelled ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,26 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-customer-created",
7
+ name: "New Customer Created (Instant)",
8
+ type: "source",
9
+ description: "Emit new event for each new customer added to a store.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.CUSTOMERS_CREATE;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.created_at);
19
+ return {
20
+ id: resource.id,
21
+ summary: `New Customer ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,26 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-draft-order",
7
+ name: "New Draft Order (Instant)",
8
+ type: "source",
9
+ description: "Emit new event for each new draft order submitted to a store.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.DRAFT_ORDERS_CREATE;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.created_at);
19
+ return {
20
+ id: resource.id,
21
+ summary: `New Draft Order ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,35 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-event-emitted",
7
+ name: "New Event Emitted (Instant)",
8
+ type: "source",
9
+ description: "Emit new event for each new Shopify event.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ props: {
13
+ ...common.props,
14
+ topic: {
15
+ type: "string",
16
+ label: "Event Topic",
17
+ description: "Event topic that triggers the webhook.",
18
+ options: constants.EVENT_TOPICS,
19
+ },
20
+ },
21
+ methods: {
22
+ ...common.methods,
23
+ getTopic() {
24
+ return this.topic;
25
+ },
26
+ generateMeta() {
27
+ const ts = Date.now();
28
+ return {
29
+ id: ts,
30
+ summary: `New Event Emitted at ${new Date(ts)}.`,
31
+ ts,
32
+ };
33
+ },
34
+ },
35
+ };
@@ -0,0 +1,35 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-order-created",
7
+ name: "New Order Created (Instant)",
8
+ type: "source",
9
+ description: "Emit new event for each new order submitted to a store.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.ORDERS_CREATE;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.created_at);
19
+ return {
20
+ id: resource.id,
21
+ summary: `New Order ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ hooks: {
27
+ ...common.hooks,
28
+ async deploy() {
29
+ let results = await this.app.getOrders("any", false, null, null, "any", 5, 1);
30
+ for (const order of results) {
31
+ this.$emit(order, this.generateMeta(order));
32
+ }
33
+ },
34
+ },
35
+ };
@@ -7,7 +7,7 @@ export default {
7
7
  name: "New Page",
8
8
  type: "source",
9
9
  description: "Emit new event for each new page published.",
10
- version: "0.0.1",
10
+ version: "0.0.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  shopify,
@@ -0,0 +1,26 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-paid-order",
7
+ name: "New Paid Order (Instant)",
8
+ type: "source",
9
+ description: "Emit new event each time a new order is paid.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.ORDERS_PAID;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.updated_at);
19
+ return {
20
+ id: ts,
21
+ summary: `Order Paid ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,26 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-product-created",
7
+ name: "New Product Created (Instant)",
8
+ type: "source",
9
+ description: "Emit new event for each product added to a store.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.PRODUCTS_CREATE;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.created_at);
19
+ return {
20
+ id: resource.id,
21
+ summary: `New Product ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,26 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-shipment",
7
+ name: "New Shipment (Instant)",
8
+ type: "source",
9
+ description: "Emit new event for each new fulfillment event for a store.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.ORDERS_FULFILLED;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.updated_at);
19
+ return {
20
+ id: ts,
21
+ summary: `New Shipped Order ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,26 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-updated-customer",
7
+ name: "New Updated Customer (Instant)",
8
+ type: "source",
9
+ description: "Emit new event each time a customer's information is updated.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.CUSTOMERS_UPDATE;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.updated_at);
19
+ return {
20
+ id: ts,
21
+ summary: `Customer Updated ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,26 @@
1
+ import common from "../common/webhook.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "shopify_developer_app-new-updated-order",
7
+ name: "New Updated Order (Instant)",
8
+ type: "source",
9
+ description: "Emit new event each time an order is updated.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ methods: {
13
+ ...common.methods,
14
+ getTopic() {
15
+ return constants.EVENT_TOPIC.ORDERS_UPDATED;
16
+ },
17
+ generateMeta(resource) {
18
+ const ts = Date.parse(resource.updated_at);
19
+ return {
20
+ id: ts,
21
+ summary: `Order Updated ${resource.id}.`,
22
+ ts,
23
+ };
24
+ },
25
+ },
26
+ };
@@ -6,7 +6,7 @@ export default {
6
6
  key: "shopify_developer_app-product-added-to-custom-collection",
7
7
  name: "New product added to custom collection",
8
8
  description: "Emit new event each time a product is added to a custom collection.",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "source",
11
11
  dedupe: "unique",
12
12
  props: {