@pipedream/shopify_developer_app 0.6.3 → 0.7.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 +14 -24
- package/actions/add-tags/add-tags.mjs +14 -7
- package/actions/common/constants.mjs +86 -0
- package/actions/common/metafield-actions.mjs +264 -3
- package/actions/create-article/create-article.mjs +16 -28
- package/actions/create-blog/create-blog.mjs +16 -15
- package/actions/create-custom-collection/create-custom-collection.mjs +14 -28
- package/actions/create-customer/create-customer.mjs +24 -5
- package/actions/create-metafield/create-metafield.mjs +50 -8
- package/actions/create-metaobject/create-metaobject.mjs +14 -19
- package/actions/create-order/create-order.mjs +144 -10
- package/actions/create-page/create-page.mjs +16 -21
- package/actions/create-product/create-product.mjs +14 -61
- package/actions/create-product-variant/create-product-variant.mjs +14 -48
- package/actions/create-smart-collection/create-smart-collection.mjs +14 -19
- package/actions/delete-article/delete-article.mjs +16 -23
- package/actions/delete-blog/delete-blog.mjs +16 -14
- package/actions/delete-metafield/delete-metafield.mjs +41 -8
- package/actions/delete-page/delete-page.mjs +16 -14
- package/actions/get-articles/get-articles.mjs +16 -14
- package/actions/get-metafields/get-metafields.mjs +40 -8
- package/actions/get-metaobjects/get-metaobjects.mjs +14 -18
- package/actions/get-order/get-order.mjs +9 -7
- package/actions/get-pages/get-pages.mjs +16 -8
- package/actions/search-custom-collection-by-name/search-custom-collection-by-name.mjs +14 -14
- package/actions/search-customers/search-customers.mjs +23 -13
- package/actions/search-product-variant/search-product-variant.mjs +14 -30
- package/actions/search-products/search-products.mjs +14 -40
- package/actions/update-article/update-article.mjs +16 -37
- package/actions/update-customer/update-customer.mjs +29 -5
- package/actions/update-inventory-level/update-inventory-level.mjs +14 -28
- package/actions/update-metafield/update-metafield.mjs +18 -15
- package/actions/update-metaobject/update-metaobject.mjs +14 -24
- package/actions/update-page/update-page.mjs +16 -27
- package/actions/update-product/update-product.mjs +96 -37
- package/actions/update-product-variant/update-product-variant.mjs +14 -71
- package/common/mutations.mjs +124 -0
- package/common/queries.mjs +181 -0
- package/common/utils.mjs +40 -0
- package/package.json +2 -2
- package/shopify_developer_app.app.mjs +130 -1
- package/sources/common/constants.mjs +107 -2
- package/sources/common/webhook.mjs +17 -9
- package/sources/new-abandoned-cart/new-abandoned-cart.mjs +14 -8
- package/sources/new-article/new-article.mjs +15 -9
- package/sources/new-cancelled-order/new-cancelled-order.mjs +4 -5
- package/sources/new-customer-created/new-customer-created.mjs +4 -5
- package/sources/new-draft-order/new-draft-order.mjs +4 -5
- package/sources/new-event-emitted/new-event-emitted.mjs +10 -4
- package/sources/new-fulfillment-event/new-fulfillment-event.mjs +4 -5
- package/sources/new-order-created/new-order-created.mjs +8 -6
- package/sources/new-order-fulfilled/new-order-fulfilled.mjs +4 -5
- package/sources/new-page/new-page.mjs +15 -9
- package/sources/new-paid-order/new-paid-order.mjs +4 -5
- package/sources/new-product-created/new-product-created.mjs +4 -5
- package/sources/new-product-updated/new-product-updated.mjs +4 -5
- package/sources/new-refund-created/new-refund-created.mjs +3 -4
- package/sources/new-updated-customer/new-updated-customer.mjs +4 -5
- package/sources/new-updated-order/new-updated-order.mjs +4 -5
- package/sources/product-added-to-custom-collection/product-added-to-custom-collection.mjs +14 -8
- package/actions/common/metaobjects.mjs +0 -21
- package/common/rest-admin.mjs +0 -97
|
@@ -1,10 +1,111 @@
|
|
|
1
|
-
import commonApp from "@pipedream/shopify
|
|
1
|
+
import commonApp from "@pipedream/shopify";
|
|
2
2
|
import Shopify from "shopify-api-node";
|
|
3
|
+
import queries from "./common/queries.mjs";
|
|
4
|
+
import mutations from "./common/mutations.mjs";
|
|
5
|
+
import { API_VERSION } from "@pipedream/shopify/common/constants.mjs";
|
|
3
6
|
|
|
4
7
|
export default {
|
|
5
8
|
...commonApp,
|
|
6
9
|
type: "app",
|
|
7
10
|
app: "shopify_developer_app",
|
|
11
|
+
propDefinitions: {
|
|
12
|
+
...commonApp.propDefinitions,
|
|
13
|
+
orderId: {
|
|
14
|
+
type: "string",
|
|
15
|
+
label: "Order ID",
|
|
16
|
+
description: "The identifier of an order",
|
|
17
|
+
async options({ prevContext }) {
|
|
18
|
+
return this.getPropOptions({
|
|
19
|
+
resourceFn: this.listOrders,
|
|
20
|
+
resourceKeys: [
|
|
21
|
+
"orders",
|
|
22
|
+
],
|
|
23
|
+
labelKey: "id",
|
|
24
|
+
prevContext,
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
customerId: {
|
|
29
|
+
type: "string",
|
|
30
|
+
label: "Customer ID",
|
|
31
|
+
description: "The identifier of a customer",
|
|
32
|
+
async options({ prevContext }) {
|
|
33
|
+
return this.getPropOptions({
|
|
34
|
+
resourceFn: this.listCustomers,
|
|
35
|
+
resourceKeys: [
|
|
36
|
+
"customers",
|
|
37
|
+
],
|
|
38
|
+
labelKey: "displayName",
|
|
39
|
+
prevContext,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
firstName: {
|
|
44
|
+
type: "string",
|
|
45
|
+
label: "First Name",
|
|
46
|
+
description: "The customer's first name",
|
|
47
|
+
optional: true,
|
|
48
|
+
},
|
|
49
|
+
lastName: {
|
|
50
|
+
type: "string",
|
|
51
|
+
label: "Last Name",
|
|
52
|
+
description: "The customer's last name",
|
|
53
|
+
optional: true,
|
|
54
|
+
},
|
|
55
|
+
email: {
|
|
56
|
+
type: "string",
|
|
57
|
+
label: "Email",
|
|
58
|
+
description: "The unique email address of the customer",
|
|
59
|
+
},
|
|
60
|
+
phone: {
|
|
61
|
+
type: "string",
|
|
62
|
+
label: "Phone Number",
|
|
63
|
+
description: "The unique phone number (E.164 format) for this customer. Check out [Shopify Customer API](https://shopify.dev/api/admin-rest/2022-01/resources/customer#[post]/admin/api/#{api_version}/customers.json_examples) for more details on valid formats",
|
|
64
|
+
optional: true,
|
|
65
|
+
},
|
|
66
|
+
address: {
|
|
67
|
+
type: "string",
|
|
68
|
+
label: "Street Address",
|
|
69
|
+
description: "The customer's mailing address",
|
|
70
|
+
optional: true,
|
|
71
|
+
},
|
|
72
|
+
company: {
|
|
73
|
+
type: "string",
|
|
74
|
+
label: "Company",
|
|
75
|
+
description: "The customer's company",
|
|
76
|
+
optional: true,
|
|
77
|
+
},
|
|
78
|
+
city: {
|
|
79
|
+
type: "string",
|
|
80
|
+
label: "City",
|
|
81
|
+
description: "The customer's city, town, or village",
|
|
82
|
+
optional: true,
|
|
83
|
+
},
|
|
84
|
+
province: {
|
|
85
|
+
type: "string",
|
|
86
|
+
label: "Province",
|
|
87
|
+
description: "The customer's region name. Typically a province, a state, or a prefecture",
|
|
88
|
+
optional: true,
|
|
89
|
+
},
|
|
90
|
+
country: {
|
|
91
|
+
type: "string",
|
|
92
|
+
label: "Country",
|
|
93
|
+
description: "The customer's country",
|
|
94
|
+
optional: true,
|
|
95
|
+
},
|
|
96
|
+
zip: {
|
|
97
|
+
type: "string",
|
|
98
|
+
label: "Zip Code",
|
|
99
|
+
description: "The customer's postal code",
|
|
100
|
+
optional: true,
|
|
101
|
+
},
|
|
102
|
+
metafields: {
|
|
103
|
+
type: "string[]",
|
|
104
|
+
label: "Metafields",
|
|
105
|
+
description: "An array of objects, each one representing a metafield. If adding a new metafield, the object should contain `key`, `value`, `type`, and `namespace`. Example: `{{ [{ \"key\": \"new\", \"value\": \"newvalue\", \"type\": \"single_line_text_field\", \"namespace\": \"global\" }] }}`. To update an existing metafield, use the `id` and `value`. Example: `{{ [{ \"id\": \"28408051400984\", \"value\": \"updatedvalue\" }] }}`",
|
|
106
|
+
optional: true,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
8
109
|
methods: {
|
|
9
110
|
...commonApp.methods,
|
|
10
111
|
getShopifyInstance() {
|
|
@@ -12,7 +113,35 @@ export default {
|
|
|
12
113
|
shopName: this.getShopId(),
|
|
13
114
|
accessToken: this.$auth.access_token,
|
|
14
115
|
autoLimit: true,
|
|
116
|
+
apiVersion: API_VERSION,
|
|
15
117
|
});
|
|
16
118
|
},
|
|
119
|
+
getOrder(variables) {
|
|
120
|
+
return this._makeGraphQlRequest(queries.GET_ORDER, variables);
|
|
121
|
+
},
|
|
122
|
+
getDraftOrder(variables) {
|
|
123
|
+
return this._makeGraphQlRequest(queries.GET_DRAFT_ORDER, variables);
|
|
124
|
+
},
|
|
125
|
+
getCustomer(variables) {
|
|
126
|
+
return this._makeGraphQlRequest(queries.GET_CUSTOMER, variables);
|
|
127
|
+
},
|
|
128
|
+
listOrders(variables) {
|
|
129
|
+
return this._makeGraphQlRequest(queries.LIST_ORDERS, variables);
|
|
130
|
+
},
|
|
131
|
+
listDraftOrders(variables) {
|
|
132
|
+
return this._makeGraphQlRequest(queries.LIST_DRAFT_ORDERS, variables);
|
|
133
|
+
},
|
|
134
|
+
listCustomers(variables) {
|
|
135
|
+
return this._makeGraphQlRequest(queries.LIST_CUSTOMERS, variables);
|
|
136
|
+
},
|
|
137
|
+
createOrder(variables) {
|
|
138
|
+
return this._makeGraphQlRequest(mutations.CREATE_ORDER, variables);
|
|
139
|
+
},
|
|
140
|
+
createCustomer(variables) {
|
|
141
|
+
return this._makeGraphQlRequest(mutations.CREATE_CUSTOMER, variables);
|
|
142
|
+
},
|
|
143
|
+
updateCustomer(variables) {
|
|
144
|
+
return this._makeGraphQlRequest(mutations.UPDATE_CUSTOMER, variables);
|
|
145
|
+
},
|
|
17
146
|
},
|
|
18
147
|
};
|
|
@@ -1,3 +1,108 @@
|
|
|
1
|
-
|
|
1
|
+
const DOMAIN_SUFFIX = ".myshopify.com";
|
|
2
|
+
const WEBHOOK_ID = "webhookId";
|
|
2
3
|
|
|
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
|
+
};
|
|
@@ -12,17 +12,25 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
hooks: {
|
|
14
14
|
async activate() {
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const { webhookSubscriptionCreate: { webhookSubscription: { id } } }
|
|
16
|
+
= await this.app.createWebhook({
|
|
17
|
+
topic: this.getTopic(),
|
|
18
|
+
webhookSubscription: {
|
|
19
|
+
callbackUrl: this.http.endpoint,
|
|
20
|
+
format: "JSON",
|
|
21
|
+
metafieldNamespaces: [
|
|
22
|
+
...(this.metafieldNamespaces || []),
|
|
23
|
+
...(this.privateMetafieldNamespaces || []),
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
this.setWebhookId(id);
|
|
22
28
|
},
|
|
23
29
|
async deactivate() {
|
|
24
30
|
const webhookId = this.getWebhookId();
|
|
25
|
-
|
|
31
|
+
if (webhookId) {
|
|
32
|
+
await this.app.deleteWebhook(webhookId);
|
|
33
|
+
}
|
|
26
34
|
},
|
|
27
35
|
},
|
|
28
36
|
methods: {
|
|
@@ -45,7 +53,7 @@ export default {
|
|
|
45
53
|
shopId,
|
|
46
54
|
] = domain.split(constants.DOMAIN_SUFFIX);
|
|
47
55
|
return this.app.getShopId() === shopId
|
|
48
|
-
&& this.getTopic() === topic;
|
|
56
|
+
&& constants.EVENT_TOPIC[this.getTopic()] === topic;
|
|
49
57
|
},
|
|
50
58
|
checkMetaFields({
|
|
51
59
|
metafields = [], private_metafields: privateMetafields = [],
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import common from "@pipedream/shopify/sources/new-abandoned-cart/
|
|
2
|
+
import common from "@pipedream/shopify/sources/new-abandoned-cart/new-abandoned-cart.mjs";
|
|
3
|
+
|
|
4
|
+
import { adjustPropDefinitions } from "../../common/utils.mjs";
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
name, description, type, ...others
|
|
8
|
+
} = common;
|
|
9
|
+
const props = adjustPropDefinitions(others.props, shopify);
|
|
3
10
|
|
|
4
11
|
export default {
|
|
5
|
-
...
|
|
12
|
+
...others,
|
|
6
13
|
key: "shopify_developer_app-new-abandoned-cart",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
description
|
|
10
|
-
|
|
11
|
-
dedupe: "unique",
|
|
14
|
+
version: "0.0.6",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
12
18
|
props: {
|
|
13
19
|
shopify,
|
|
14
|
-
...
|
|
20
|
+
...props,
|
|
15
21
|
},
|
|
16
22
|
};
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import common from "@pipedream/shopify/sources/new-article/
|
|
2
|
+
import common from "@pipedream/shopify/sources/new-article/new-article.mjs";
|
|
3
|
+
|
|
4
|
+
import { adjustPropDefinitions } from "../../common/utils.mjs";
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
name, description, type, ...others
|
|
8
|
+
} = common;
|
|
9
|
+
const props = adjustPropDefinitions(others.props, shopify);
|
|
3
10
|
|
|
4
11
|
export default {
|
|
5
|
-
...
|
|
12
|
+
...others,
|
|
6
13
|
key: "shopify_developer_app-new-article",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
description
|
|
10
|
-
|
|
11
|
-
dedupe: "unique",
|
|
14
|
+
version: "0.0.5",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
12
18
|
props: {
|
|
13
|
-
shopify,
|
|
14
|
-
...
|
|
19
|
+
app: shopify,
|
|
20
|
+
...props,
|
|
15
21
|
},
|
|
16
22
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -7,18 +6,18 @@ export default {
|
|
|
7
6
|
name: "New Cancelled Order (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event each time a new order is cancelled.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.9",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "ORDERS_CANCELLED";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
|
-
const ts = Date.parse(resource.
|
|
17
|
+
const ts = Date.parse(resource.updatedAt);
|
|
19
18
|
return {
|
|
20
19
|
id: ts,
|
|
21
|
-
summary: `Order Cancelled ${resource.id}
|
|
20
|
+
summary: `Order Cancelled ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -7,18 +6,18 @@ export default {
|
|
|
7
6
|
name: "New Customer Created (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event for each new customer added to a store.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.9",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "CUSTOMERS_CREATE";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
|
-
const ts = Date.parse(resource.
|
|
17
|
+
const ts = Date.parse(resource.createdAt);
|
|
19
18
|
return {
|
|
20
19
|
id: resource.id,
|
|
21
|
-
summary: `New Customer ${resource.id}
|
|
20
|
+
summary: `New Customer ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -7,18 +6,18 @@ export default {
|
|
|
7
6
|
name: "New Draft Order (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event for each new draft order submitted to a store.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.9",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "DRAFT_ORDERS_CREATE";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
|
-
const ts = Date.parse(resource.
|
|
17
|
+
const ts = Date.parse(resource.createdAt);
|
|
19
18
|
return {
|
|
20
19
|
id: resource.id,
|
|
21
|
-
summary: `New Draft Order ${resource.id}
|
|
20
|
+
summary: `New Draft Order ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
2
|
+
import constants from "../common/constants.mjs";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
...common,
|
|
@@ -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.
|
|
10
|
+
version: "0.0.10",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
props: {
|
|
13
13
|
...common.props,
|
|
@@ -15,7 +15,13 @@ export default {
|
|
|
15
15
|
type: "string",
|
|
16
16
|
label: "Event Topic",
|
|
17
17
|
description: "Event topic that triggers the webhook.",
|
|
18
|
-
options: constants.
|
|
18
|
+
options: Object.entries(constants.EVENT_TOPIC).map(([
|
|
19
|
+
key,
|
|
20
|
+
value,
|
|
21
|
+
]) => ({
|
|
22
|
+
value: key,
|
|
23
|
+
label: value,
|
|
24
|
+
})),
|
|
19
25
|
},
|
|
20
26
|
},
|
|
21
27
|
methods: {
|
|
@@ -27,7 +33,7 @@ export default {
|
|
|
27
33
|
const ts = Date.now();
|
|
28
34
|
return {
|
|
29
35
|
id: ts,
|
|
30
|
-
summary: `New Event Emitted at ${new Date(ts)}
|
|
36
|
+
summary: `New Event Emitted at ${new Date(ts)}`,
|
|
31
37
|
ts,
|
|
32
38
|
};
|
|
33
39
|
},
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -7,18 +6,18 @@ export default {
|
|
|
7
6
|
name: "New Fulfillment Event (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event for each new fulfillment event for a store.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.7",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "FULFILLMENT_EVENTS_CREATE";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
|
-
const ts = Date.parse(resource.
|
|
17
|
+
const ts = Date.parse(resource.updatedAt);
|
|
19
18
|
return {
|
|
20
19
|
id: ts,
|
|
21
|
-
summary: `New Fulfillment Event ${resource.id}
|
|
20
|
+
summary: `New Fulfillment Event ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -7,18 +6,18 @@ export default {
|
|
|
7
6
|
name: "New Order Created (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event for each new order submitted to a store.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.9",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "ORDERS_CREATE";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
|
-
const ts = Date.parse(resource.
|
|
17
|
+
const ts = Date.parse(resource.createdAt);
|
|
19
18
|
return {
|
|
20
19
|
id: resource.id,
|
|
21
|
-
summary: `New Order ${resource.id}
|
|
20
|
+
summary: `New Order ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|
|
@@ -26,7 +25,10 @@ export default {
|
|
|
26
25
|
hooks: {
|
|
27
26
|
...common.hooks,
|
|
28
27
|
async deploy() {
|
|
29
|
-
|
|
28
|
+
const { orders: { nodes: results } } = await this.app.listOrders({
|
|
29
|
+
first: 5,
|
|
30
|
+
reverse: true,
|
|
31
|
+
});
|
|
30
32
|
for (const order of results) {
|
|
31
33
|
this.$emit(order, this.generateMeta(order));
|
|
32
34
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -7,18 +6,18 @@ export default {
|
|
|
7
6
|
name: "New Order Fulfilled (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event whenever an order is fulfilled.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.6",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "ORDERS_FULFILLED";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
|
-
const ts = Date.parse(resource.
|
|
17
|
+
const ts = Date.parse(resource.updatedAt);
|
|
19
18
|
return {
|
|
20
19
|
id: ts,
|
|
21
|
-
summary: `New Fulfilled Order ${resource.id}
|
|
20
|
+
summary: `New Fulfilled Order ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import common from "@pipedream/shopify/sources/new-page/
|
|
2
|
+
import common from "@pipedream/shopify/sources/new-page/new-page.mjs";
|
|
3
|
+
|
|
4
|
+
import { adjustPropDefinitions } from "../../common/utils.mjs";
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
name, description, type, ...others
|
|
8
|
+
} = common;
|
|
9
|
+
const props = adjustPropDefinitions(others.props, shopify);
|
|
3
10
|
|
|
4
11
|
export default {
|
|
5
|
-
...
|
|
12
|
+
...others,
|
|
6
13
|
key: "shopify_developer_app-new-page",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
description
|
|
10
|
-
|
|
11
|
-
dedupe: "unique",
|
|
14
|
+
version: "0.0.5",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
12
18
|
props: {
|
|
13
|
-
shopify,
|
|
14
|
-
...
|
|
19
|
+
app: shopify,
|
|
20
|
+
...props,
|
|
15
21
|
},
|
|
16
22
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -7,18 +6,18 @@ export default {
|
|
|
7
6
|
name: "New Paid Order (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event each time a new order is paid.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.9",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "ORDERS_PAID";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
|
-
const ts = Date.parse(resource.
|
|
17
|
+
const ts = Date.parse(resource.updatedAt);
|
|
19
18
|
return {
|
|
20
19
|
id: ts,
|
|
21
|
-
summary: `Order Paid ${resource.id}
|
|
20
|
+
summary: `Order Paid ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook-metafields.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -7,18 +6,18 @@ export default {
|
|
|
7
6
|
name: "New Product Created (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event for each product added to a store.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.9",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "PRODUCTS_CREATE";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
|
-
const ts = Date.parse(resource.
|
|
17
|
+
const ts = Date.parse(resource.createdAt);
|
|
19
18
|
return {
|
|
20
19
|
id: resource.id,
|
|
21
|
-
summary: `New Product ${resource.id}
|
|
20
|
+
summary: `New Product ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|