@pipedream/shopify_developer_app 0.6.4 → 0.7.1
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 +27 -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 +147 -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 +32 -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 +92 -41
- 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/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 +3 -4
- package/sources/new-customer-created/new-customer-created.mjs +3 -4
- package/sources/new-draft-order/new-draft-order.mjs +3 -4
- package/sources/new-event-emitted/new-event-emitted.mjs +10 -4
- package/sources/new-fulfillment-event/new-fulfillment-event.mjs +3 -4
- package/sources/new-order-created/new-order-created.mjs +3 -13
- package/sources/new-order-fulfilled/new-order-fulfilled.mjs +3 -4
- package/sources/new-page/new-page.mjs +15 -9
- package/sources/new-paid-order/new-paid-order.mjs +3 -4
- package/sources/new-product-created/new-product-created.mjs +3 -4
- package/sources/new-product-updated/new-product-updated.mjs +3 -4
- package/sources/new-refund-created/new-refund-created.mjs +2 -3
- package/sources/new-updated-customer/new-updated-customer.mjs +3 -4
- package/sources/new-updated-order/new-updated-order.mjs +3 -4
- package/sources/product-added-to-custom-collection/product-added-to-custom-collection.mjs +15 -9
- 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
|
};
|
|
@@ -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.7",
|
|
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.6",
|
|
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.10",
|
|
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
17
|
const ts = Date.parse(resource.updated_at);
|
|
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.10",
|
|
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
17
|
const ts = Date.parse(resource.created_at);
|
|
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.10",
|
|
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
17
|
const ts = Date.parse(resource.created_at);
|
|
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.11",
|
|
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.8",
|
|
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
17
|
const ts = Date.parse(resource.updated_at);
|
|
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,29 +6,20 @@ 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.10",
|
|
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
17
|
const ts = Date.parse(resource.created_at);
|
|
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
|
},
|
|
25
24
|
},
|
|
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
25
|
};
|
|
@@ -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.7",
|
|
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
17
|
const ts = Date.parse(resource.updated_at);
|
|
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.6",
|
|
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.10",
|
|
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
17
|
const ts = Date.parse(resource.updated_at);
|
|
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.10",
|
|
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
17
|
const ts = Date.parse(resource.created_at);
|
|
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
|
},
|
|
@@ -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 {
|
|
@@ -6,7 +5,7 @@ export default {
|
|
|
6
5
|
key: "shopify_developer_app-new-product-updated",
|
|
7
6
|
name: "New Product Updated (Instant)",
|
|
8
7
|
description: "Emit new event for each product updated in a store.",
|
|
9
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
10
9
|
type: "source",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
props: {
|
|
@@ -27,11 +26,11 @@ export default {
|
|
|
27
26
|
methods: {
|
|
28
27
|
...common.methods,
|
|
29
28
|
getTopic() {
|
|
30
|
-
return
|
|
29
|
+
return "PRODUCTS_UPDATE";
|
|
31
30
|
},
|
|
32
31
|
isRelevant(resource) {
|
|
33
32
|
let relevant = true;
|
|
34
|
-
if (this.productType && resource.
|
|
33
|
+
if (this.productType && resource.productType !== this.productType) {
|
|
35
34
|
relevant = false;
|
|
36
35
|
}
|
|
37
36
|
if (this.tags?.length) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import constants from "../common/constants.mjs";
|
|
2
1
|
import common from "../common/webhook.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
@@ -6,13 +5,13 @@ export default {
|
|
|
6
5
|
key: "shopify_developer_app-new-refund-created",
|
|
7
6
|
name: "New Refund Created (Instant)",
|
|
8
7
|
description: "Emit new event when a new refund is created.",
|
|
9
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.7",
|
|
10
9
|
type: "source",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "REFUNDS_CREATE";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
17
|
const ts = Date.parse(resource.created_at);
|
|
@@ -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 Updated Customer (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event each time a customer's information is updated.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.10",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "CUSTOMERS_UPDATE";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
17
|
const ts = Date.parse(resource.updated_at);
|
|
19
18
|
return {
|
|
20
19
|
id: ts,
|
|
21
|
-
summary: `Customer Updated ${resource.id}
|
|
20
|
+
summary: `Customer Updated ${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 Updated Order (Instant)",
|
|
8
7
|
type: "source",
|
|
9
8
|
description: "Emit new event each time an order is updated.",
|
|
10
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.10",
|
|
11
10
|
dedupe: "unique",
|
|
12
11
|
methods: {
|
|
13
12
|
...common.methods,
|
|
14
13
|
getTopic() {
|
|
15
|
-
return
|
|
14
|
+
return "ORDERS_UPDATED";
|
|
16
15
|
},
|
|
17
16
|
generateMeta(resource) {
|
|
18
17
|
const ts = Date.parse(resource.updated_at);
|
|
19
18
|
return {
|
|
20
19
|
id: ts,
|
|
21
|
-
summary: `Order Updated ${resource.id}
|
|
20
|
+
summary: `Order Updated ${resource.id}`,
|
|
22
21
|
ts,
|
|
23
22
|
};
|
|
24
23
|
},
|