@pipedream/shopify_developer_app 0.6.4 → 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/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,32 +1,22 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import common from "@pipedream/shopify/actions/add-product-to-custom-collection/
|
|
2
|
+
import common from "@pipedream/shopify/actions/add-product-to-custom-collection/add-product-to-custom-collection.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-add-product-to-custom-collection",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type
|
|
14
|
+
version: "0.0.5",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
11
18
|
props: {
|
|
12
19
|
shopify,
|
|
13
|
-
|
|
14
|
-
propDefinition: [
|
|
15
|
-
shopify,
|
|
16
|
-
"productId",
|
|
17
|
-
],
|
|
18
|
-
type: "string[]",
|
|
19
|
-
label: "Product IDs",
|
|
20
|
-
},
|
|
21
|
-
collectionIds: {
|
|
22
|
-
propDefinition: [
|
|
23
|
-
shopify,
|
|
24
|
-
"collectionId",
|
|
25
|
-
],
|
|
26
|
-
type: "string[]",
|
|
27
|
-
label: "Collection IDs",
|
|
28
|
-
description: "IDs of the collections that the product will be added to",
|
|
29
|
-
optional: false,
|
|
30
|
-
},
|
|
20
|
+
...props,
|
|
31
21
|
},
|
|
32
22
|
};
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import common from "@pipedream/shopify/actions/add-tags/
|
|
2
|
+
import common from "@pipedream/shopify/actions/add-tags/add-tags.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
|
-
...
|
|
6
|
-
name: "Add Tags",
|
|
7
|
-
version: "0.0.4",
|
|
12
|
+
...others,
|
|
8
13
|
key: "shopify_developer_app-add-tags",
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
version: "0.0.5",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
11
18
|
props: {
|
|
12
19
|
shopify,
|
|
13
|
-
...
|
|
20
|
+
...props,
|
|
14
21
|
},
|
|
15
22
|
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const RESOURCE_TYPES = [
|
|
2
|
+
{
|
|
3
|
+
label: "Blog",
|
|
4
|
+
value: "blog",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: "Collection",
|
|
8
|
+
value: "collection",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: "Customer",
|
|
12
|
+
value: "customer",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "Draft Order",
|
|
16
|
+
value: "draftOrder",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Page",
|
|
20
|
+
value: "page",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Product",
|
|
24
|
+
value: "product",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Product Variant",
|
|
28
|
+
value: "variants",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Article",
|
|
32
|
+
value: "article",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "Order",
|
|
36
|
+
value: "order",
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const METAFIELD_TYPES = {
|
|
41
|
+
"boolean": "boolean",
|
|
42
|
+
"collection_reference": "string",
|
|
43
|
+
"color": "string",
|
|
44
|
+
"date": "string",
|
|
45
|
+
"date_time": "string",
|
|
46
|
+
"dimension": "object",
|
|
47
|
+
"file_reference": "string",
|
|
48
|
+
"json": "object",
|
|
49
|
+
"metaobject_reference": "string",
|
|
50
|
+
"mixed_reference": "string",
|
|
51
|
+
"money": "object",
|
|
52
|
+
"multi_line_text_field": "string",
|
|
53
|
+
"number_decimal": "string",
|
|
54
|
+
"number_integer": "integer",
|
|
55
|
+
"page_reference": "string",
|
|
56
|
+
"product_reference": "string",
|
|
57
|
+
"rating": "object",
|
|
58
|
+
"single_line_text_field": "string",
|
|
59
|
+
"url": "string",
|
|
60
|
+
"variant_reference": "string",
|
|
61
|
+
"volume": "object",
|
|
62
|
+
"weight": "object",
|
|
63
|
+
"list.collection_reference": "string[]",
|
|
64
|
+
"list.color": "string[]",
|
|
65
|
+
"list.date": "string[]",
|
|
66
|
+
"list.date_time": "string[]",
|
|
67
|
+
"list.dimension": "string[]",
|
|
68
|
+
"list.file_reference": "string[]",
|
|
69
|
+
"list.metaobject_reference": "string[]",
|
|
70
|
+
"list.mixed_reference": "string[]",
|
|
71
|
+
"list.number_integer": "string[]",
|
|
72
|
+
"list.number_decimal": "string[]",
|
|
73
|
+
"list.page_reference": "string[]",
|
|
74
|
+
"list.product_reference": "string[]",
|
|
75
|
+
"list.rating": "string[]",
|
|
76
|
+
"list.single_line_text_field": "string[]",
|
|
77
|
+
"list.url": "string[]",
|
|
78
|
+
"list.variant_reference": "string[]",
|
|
79
|
+
"list.volume": "string[]",
|
|
80
|
+
"list.weight": "string[]",
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default {
|
|
84
|
+
RESOURCE_TYPES,
|
|
85
|
+
METAFIELD_TYPES,
|
|
86
|
+
};
|
|
@@ -1,10 +1,271 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import
|
|
2
|
+
import constants from "./constants.mjs";
|
|
3
|
+
import utils from "@pipedream/shopify/common/utils.mjs";
|
|
4
|
+
import { MAX_LIMIT } from "@pipedream/shopify/common/constants.mjs";
|
|
3
5
|
|
|
4
6
|
export default {
|
|
5
|
-
...metafieldActions,
|
|
6
7
|
props: {
|
|
7
|
-
...metafieldActions.props,
|
|
8
8
|
shopify,
|
|
9
|
+
ownerResource: {
|
|
10
|
+
type: "string",
|
|
11
|
+
label: "Resource Type",
|
|
12
|
+
description: "Filter by the resource type on which the metafield is attached to",
|
|
13
|
+
options: constants.RESOURCE_TYPES,
|
|
14
|
+
reloadProps: true,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
async getOwnerIdProp(ownerResource) {
|
|
19
|
+
const resources = {
|
|
20
|
+
product: {
|
|
21
|
+
...shopify.propDefinitions.productId,
|
|
22
|
+
options: async ({ prevContext }) => {
|
|
23
|
+
return this.shopify.getPropOptions({
|
|
24
|
+
resourceFn: this.shopify.listProducts,
|
|
25
|
+
resourceKeys: [
|
|
26
|
+
"products",
|
|
27
|
+
],
|
|
28
|
+
prevContext,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
variants: {
|
|
33
|
+
...shopify.propDefinitions.productVariantId,
|
|
34
|
+
options: async ({ prevContext }) => {
|
|
35
|
+
return this.shopify.getPropOptions({
|
|
36
|
+
resourceFn: this.shopify.listProductVariants,
|
|
37
|
+
resourceKeys: [
|
|
38
|
+
"productVariants",
|
|
39
|
+
],
|
|
40
|
+
variables: {
|
|
41
|
+
query: `product_id:${this.productId.split("/").pop()}`,
|
|
42
|
+
},
|
|
43
|
+
prevContext,
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
collection: {
|
|
48
|
+
...shopify.propDefinitions.collectionId,
|
|
49
|
+
options: async ({ prevContext }) => {
|
|
50
|
+
return this.shopify.getPropOptions({
|
|
51
|
+
resourceFn: this.shopify.listCollections,
|
|
52
|
+
resourceKeys: [
|
|
53
|
+
"collections",
|
|
54
|
+
],
|
|
55
|
+
prevContext,
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
optional: false,
|
|
59
|
+
},
|
|
60
|
+
blog: {
|
|
61
|
+
...shopify.propDefinitions.blogId,
|
|
62
|
+
options: async ({ prevContext }) => {
|
|
63
|
+
return this.shopify.getPropOptions({
|
|
64
|
+
resourceFn: this.shopify.listBlogs,
|
|
65
|
+
resourceKeys: [
|
|
66
|
+
"blogs",
|
|
67
|
+
],
|
|
68
|
+
prevContext,
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
article: {
|
|
73
|
+
...shopify.propDefinitions.articleId,
|
|
74
|
+
options: async ({ prevContext }) => {
|
|
75
|
+
return this.shopify.getPropOptions({
|
|
76
|
+
resourceFn: this.shopify.listBlogArticles,
|
|
77
|
+
resourceKeys: [
|
|
78
|
+
"blog",
|
|
79
|
+
"articles",
|
|
80
|
+
],
|
|
81
|
+
variables: {
|
|
82
|
+
id: this.blogId,
|
|
83
|
+
},
|
|
84
|
+
prevContext,
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
page: {
|
|
89
|
+
...shopify.propDefinitions.pageId,
|
|
90
|
+
options: async ({ prevContext }) => {
|
|
91
|
+
return this.shopify.getPropOptions({
|
|
92
|
+
resourceFn: this.shopify.listPages,
|
|
93
|
+
resourceKeys: [
|
|
94
|
+
"pages",
|
|
95
|
+
],
|
|
96
|
+
prevContext,
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
customer: {
|
|
101
|
+
...shopify.propDefinitions.customerId,
|
|
102
|
+
options: async ({ prevContext }) => {
|
|
103
|
+
return this.shopify.getPropOptions({
|
|
104
|
+
resourceFn: this.shopify.listCustomers,
|
|
105
|
+
resourceKeys: [
|
|
106
|
+
"customers",
|
|
107
|
+
],
|
|
108
|
+
labelKey: "displayName",
|
|
109
|
+
prevContext,
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
draftOrder: {
|
|
114
|
+
type: "string",
|
|
115
|
+
label: "Draft Order ID",
|
|
116
|
+
description: "The identifier of a draft order",
|
|
117
|
+
options: async ({ prevContext }) => {
|
|
118
|
+
return this.shopify.getPropOptions({
|
|
119
|
+
resourceFn: this.shopify.listDraftOrders,
|
|
120
|
+
resourceKeys: [
|
|
121
|
+
"draftOrders",
|
|
122
|
+
],
|
|
123
|
+
labelKey: "id",
|
|
124
|
+
prevContext,
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
order: {
|
|
129
|
+
...shopify.propDefinitions.orderId,
|
|
130
|
+
options: async ({ prevContext }) => {
|
|
131
|
+
return this.shopify.getPropOptions({
|
|
132
|
+
resourceFn: this.shopify.listOrders,
|
|
133
|
+
resourceKeys: [
|
|
134
|
+
"orders",
|
|
135
|
+
],
|
|
136
|
+
labelKey: "id",
|
|
137
|
+
prevContext,
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const props = {};
|
|
144
|
+
|
|
145
|
+
if (ownerResource === "variants") {
|
|
146
|
+
props.productId = resources.product;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (ownerResource === "article") {
|
|
150
|
+
props.blogId = resources.blog;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
...props,
|
|
155
|
+
ownerId: resources[ownerResource],
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
async getMetafields({
|
|
159
|
+
resourceFn, resourceKeys = [], variables,
|
|
160
|
+
}) {
|
|
161
|
+
let results = await resourceFn(variables);
|
|
162
|
+
for (const key of resourceKeys) {
|
|
163
|
+
results = results[key];
|
|
164
|
+
}
|
|
165
|
+
return results.metafields.nodes;
|
|
166
|
+
},
|
|
167
|
+
async listMetafields(ownerResource, ownerId) {
|
|
168
|
+
const variables = {
|
|
169
|
+
id: ownerId,
|
|
170
|
+
first: MAX_LIMIT,
|
|
171
|
+
};
|
|
172
|
+
let resourceFn, resourceKeys;
|
|
173
|
+
if (ownerResource === "product") {
|
|
174
|
+
resourceFn = this.shopify.getProduct;
|
|
175
|
+
resourceKeys = [
|
|
176
|
+
"product",
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
if (ownerResource === "variants") {
|
|
180
|
+
resourceFn = this.shopify.getProductVariant;
|
|
181
|
+
resourceKeys = [
|
|
182
|
+
"productVariant",
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
if (ownerResource === "collection") {
|
|
186
|
+
resourceFn = this.shopify.getCollection;
|
|
187
|
+
resourceKeys = [
|
|
188
|
+
"collection",
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
if (ownerResource === "blog") {
|
|
192
|
+
resourceFn = this.shopify.getBlog;
|
|
193
|
+
resourceKeys = [
|
|
194
|
+
"blog",
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
if (ownerResource === "article") {
|
|
198
|
+
resourceFn = this.shopify.getArticle;
|
|
199
|
+
resourceKeys = [
|
|
200
|
+
"article",
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
if (ownerResource === "page") {
|
|
204
|
+
resourceFn = this.shopify.getPage;
|
|
205
|
+
resourceKeys = [
|
|
206
|
+
"page",
|
|
207
|
+
];
|
|
208
|
+
}
|
|
209
|
+
if (ownerResource === "customer") {
|
|
210
|
+
resourceFn = this.shopify.getCustomer;
|
|
211
|
+
resourceKeys = [
|
|
212
|
+
"customer",
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
if (ownerResource === "draftOrder") {
|
|
216
|
+
resourceFn = this.shopify.getDraftOrder;
|
|
217
|
+
resourceKeys = [
|
|
218
|
+
"draftOrder",
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
if (ownerResource === "order") {
|
|
222
|
+
resourceFn = this.shopify.getOrder;
|
|
223
|
+
resourceKeys = [
|
|
224
|
+
"order",
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return this.getMetafields({
|
|
229
|
+
resourceFn,
|
|
230
|
+
resourceKeys,
|
|
231
|
+
variables,
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
async getMetafieldIdByKey(key, namespace, ownerId, ownerResource) {
|
|
235
|
+
const results = await this.listMetafields(ownerResource, ownerId);
|
|
236
|
+
|
|
237
|
+
const metafield = results?.filter(
|
|
238
|
+
(field) => field.key === key && field.namespace === namespace,
|
|
239
|
+
);
|
|
240
|
+
if (!metafield || metafield.length === 0) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
return metafield[0].id;
|
|
244
|
+
},
|
|
245
|
+
async createMetafieldsArray(metafieldsOriginal, ownerId, ownerResource) {
|
|
246
|
+
if (!metafieldsOriginal) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const metafields = [];
|
|
250
|
+
const metafieldsArray = utils.parseJson(metafieldsOriginal);
|
|
251
|
+
for (const meta of metafieldsArray) {
|
|
252
|
+
if (meta.id) {
|
|
253
|
+
metafields.push(meta);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const metafieldId = await this.getMetafieldIdByKey(
|
|
257
|
+
meta.key, meta.namespace, ownerId, ownerResource,
|
|
258
|
+
);
|
|
259
|
+
if (!metafieldId) {
|
|
260
|
+
metafields.push(meta);
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
metafields.push({
|
|
264
|
+
id: `${metafieldId}`,
|
|
265
|
+
value: meta.value,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
return metafields;
|
|
269
|
+
},
|
|
9
270
|
},
|
|
10
271
|
};
|
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import common from "@pipedream/shopify/actions/create-article/
|
|
1
|
+
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
+
import common from "@pipedream/shopify/actions/create-article/create-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-create-article",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type
|
|
14
|
+
version: "0.0.7",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
11
18
|
props: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
propDefinition: [
|
|
15
|
-
app,
|
|
16
|
-
"blogId",
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
title: {
|
|
20
|
-
description: "The title of the article.",
|
|
21
|
-
propDefinition: [
|
|
22
|
-
app,
|
|
23
|
-
"title",
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
bodyHtml: {
|
|
27
|
-
description: "The text content of the article, complete with HTML markup.",
|
|
28
|
-
propDefinition: [
|
|
29
|
-
app,
|
|
30
|
-
"bodyHtml",
|
|
31
|
-
],
|
|
32
|
-
},
|
|
19
|
+
shopify,
|
|
20
|
+
...props,
|
|
33
21
|
},
|
|
34
22
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import common from "@pipedream/shopify/actions/create-blog/
|
|
1
|
+
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
+
import common from "@pipedream/shopify/actions/create-blog/create-blog.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-create-blog",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type
|
|
14
|
+
version: "0.0.7",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
11
18
|
props: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description: "The title of the blog.",
|
|
15
|
-
propDefinition: [
|
|
16
|
-
app,
|
|
17
|
-
"title",
|
|
18
|
-
],
|
|
19
|
-
},
|
|
19
|
+
shopify,
|
|
20
|
+
...props,
|
|
20
21
|
},
|
|
21
22
|
};
|
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import common from "@pipedream/shopify/actions/create-custom-collection/
|
|
2
|
+
import common from "@pipedream/shopify/actions/create-custom-collection/create-custom-collection.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-create-custom-collection",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type
|
|
14
|
+
version: "0.0.5",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
11
18
|
props: {
|
|
12
19
|
shopify,
|
|
13
|
-
|
|
14
|
-
propDefinition: [
|
|
15
|
-
shopify,
|
|
16
|
-
"title",
|
|
17
|
-
],
|
|
18
|
-
description: "The name of the custom collection",
|
|
19
|
-
},
|
|
20
|
-
products: {
|
|
21
|
-
propDefinition: [
|
|
22
|
-
shopify,
|
|
23
|
-
"productId",
|
|
24
|
-
],
|
|
25
|
-
type: "string[]",
|
|
26
|
-
optional: true,
|
|
27
|
-
},
|
|
28
|
-
metafields: {
|
|
29
|
-
propDefinition: [
|
|
30
|
-
shopify,
|
|
31
|
-
"metafields",
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
...common.props,
|
|
20
|
+
...props,
|
|
35
21
|
},
|
|
36
22
|
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import common from "@pipedream/shopify/actions/create-customer/common.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
|
-
...common,
|
|
6
4
|
key: "shopify_developer_app-create-customer",
|
|
7
5
|
name: "Create Customer",
|
|
8
|
-
description: "Create a new customer. [See the documentation](https://shopify.dev/api/admin-
|
|
9
|
-
version: "0.0.
|
|
6
|
+
description: "Create a new customer. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customercreate)",
|
|
7
|
+
version: "0.0.5",
|
|
10
8
|
type: "action",
|
|
11
9
|
props: {
|
|
12
10
|
shopify,
|
|
@@ -70,6 +68,27 @@ export default {
|
|
|
70
68
|
"zip",
|
|
71
69
|
],
|
|
72
70
|
},
|
|
73
|
-
|
|
71
|
+
},
|
|
72
|
+
async run({ $ }) {
|
|
73
|
+
const response = await this.shopify.createCustomer({
|
|
74
|
+
input: {
|
|
75
|
+
firstName: this.firstName,
|
|
76
|
+
lastName: this.lastName,
|
|
77
|
+
email: this.email,
|
|
78
|
+
phone: this.phone,
|
|
79
|
+
addresses: [
|
|
80
|
+
{
|
|
81
|
+
address1: this.address,
|
|
82
|
+
company: this.company,
|
|
83
|
+
city: this.city,
|
|
84
|
+
province: this.province,
|
|
85
|
+
country: this.country,
|
|
86
|
+
zip: this.zip,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
$.export("$summary", `Created new customer with ID \`${response.customerCreate.customer.id}\``);
|
|
92
|
+
return response;
|
|
74
93
|
},
|
|
75
94
|
};
|
|
@@ -1,16 +1,58 @@
|
|
|
1
1
|
import metafieldActions from "../common/metafield-actions.mjs";
|
|
2
|
-
import common from "@pipedream/shopify/actions/create-metafield/
|
|
2
|
+
import common from "@pipedream/shopify/actions/create-metafield/create-metafield.mjs";
|
|
3
|
+
import shopify from "../../shopify_developer_app.app.mjs";
|
|
4
|
+
import constants from "../common/constants.mjs";
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
name, description, type, ...others
|
|
8
|
+
} = common;
|
|
3
9
|
|
|
4
10
|
export default {
|
|
5
|
-
...
|
|
11
|
+
...others,
|
|
6
12
|
key: "shopify_developer_app-create-metafield",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type
|
|
13
|
+
version: "0.0.6",
|
|
14
|
+
name,
|
|
15
|
+
description,
|
|
16
|
+
type,
|
|
11
17
|
props: {
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
shopify,
|
|
19
|
+
ownerResource: {
|
|
20
|
+
type: "string",
|
|
21
|
+
label: "Resource Type",
|
|
22
|
+
description: "Filter by the resource type on which the metafield is attached to",
|
|
23
|
+
options: constants.RESOURCE_TYPES.map((type) => ({
|
|
24
|
+
...type,
|
|
25
|
+
value: type.value.toUpperCase(),
|
|
26
|
+
})),
|
|
27
|
+
},
|
|
28
|
+
name: {
|
|
29
|
+
type: "string",
|
|
30
|
+
label: "Name",
|
|
31
|
+
description: "The human-readable name for the metafield definition",
|
|
32
|
+
},
|
|
33
|
+
namespace: {
|
|
34
|
+
type: "string",
|
|
35
|
+
label: "Namespace",
|
|
36
|
+
description: "A container for a group of metafields. Grouping metafields within a namespace prevents your metafields from conflicting with other metafields with the same key name. Must have between 3-255 characters.",
|
|
37
|
+
},
|
|
38
|
+
key: {
|
|
39
|
+
type: "string",
|
|
40
|
+
label: "Key",
|
|
41
|
+
description: "The key of the metafield. Keys can be up to 64 characters long and can contain alphanumeric characters, hyphens, underscores, and periods.",
|
|
42
|
+
},
|
|
43
|
+
type: {
|
|
44
|
+
type: "string",
|
|
45
|
+
label: "Type",
|
|
46
|
+
description: "The type of data that the metafield stores in the `value` field. Refer to the list of [supported types](https://shopify.dev/apps/custom-data/metafields/types).",
|
|
47
|
+
options: Object.keys(constants.METAFIELD_TYPES),
|
|
48
|
+
},
|
|
49
|
+
pin: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
label: "Pin",
|
|
52
|
+
description: "Whether to pin the metafield definition",
|
|
53
|
+
default: false,
|
|
54
|
+
optional: true,
|
|
55
|
+
},
|
|
14
56
|
},
|
|
15
57
|
methods: {
|
|
16
58
|
...metafieldActions.methods,
|