@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,33 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import common from "@pipedream/shopify/actions/update-page/
|
|
1
|
+
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
+
import common from "@pipedream/shopify/actions/update-page/update-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-update-page",
|
|
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
|
-
"pageId",
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
title: {
|
|
20
|
-
description: "The title of the page.",
|
|
21
|
-
propDefinition: [
|
|
22
|
-
app,
|
|
23
|
-
"title",
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
bodyHtml: {
|
|
27
|
-
propDefinition: [
|
|
28
|
-
app,
|
|
29
|
-
"bodyHtml",
|
|
30
|
-
],
|
|
31
|
-
},
|
|
19
|
+
shopify,
|
|
20
|
+
...props,
|
|
32
21
|
},
|
|
33
22
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import common from "../common/metafield-actions.mjs";
|
|
3
|
+
import utils from "@pipedream/shopify/common/utils.mjs";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
...common,
|
|
7
|
-
...metafieldActions,
|
|
8
7
|
key: "shopify_developer_app-update-product",
|
|
9
8
|
name: "Update Product",
|
|
10
|
-
description: "Update an existing product. [See the
|
|
11
|
-
version: "0.0.
|
|
9
|
+
description: "Update an existing product. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productupdate)",
|
|
10
|
+
version: "0.0.6",
|
|
12
11
|
type: "action",
|
|
13
12
|
props: {
|
|
14
13
|
shopify,
|
|
@@ -19,59 +18,64 @@ export default {
|
|
|
19
18
|
],
|
|
20
19
|
},
|
|
21
20
|
title: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
],
|
|
21
|
+
type: "string",
|
|
22
|
+
label: "Title",
|
|
23
|
+
description: "Title of the new product",
|
|
26
24
|
optional: true,
|
|
27
25
|
},
|
|
28
26
|
productDescription: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
type: "string",
|
|
28
|
+
label: "Product Description",
|
|
29
|
+
description: "A description of the product. Supports HTML formatting. Example: `<strong>Good snowboard!</strong>`",
|
|
30
|
+
optional: true,
|
|
33
31
|
},
|
|
34
32
|
vendor: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
type: "string",
|
|
34
|
+
label: "Vendor",
|
|
35
|
+
description: "The name of the product's vendor",
|
|
36
|
+
optional: true,
|
|
39
37
|
},
|
|
40
38
|
productType: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
type: "string",
|
|
40
|
+
label: "Product Type",
|
|
41
|
+
description: "A categorization for the product used for filtering and searching products",
|
|
42
|
+
optional: true,
|
|
45
43
|
},
|
|
46
44
|
status: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
type: "string",
|
|
46
|
+
label: "Status",
|
|
47
|
+
description: "The status of the product. `active`: The product is ready to sell and is available to customers on the online store, sales channels, and apps. By default, existing products are set to active. `archived`: The product is no longer being sold and isn't available to customers on sales channels and apps. `draft`: The product isn't ready to sell and is unavailable to customers on sales channels and apps. By default, duplicated and unarchived products are set to draft",
|
|
48
|
+
optional: true,
|
|
49
|
+
options: [
|
|
50
|
+
"ACTIVE",
|
|
51
|
+
"ARCHIVED",
|
|
52
|
+
"DRAFT",
|
|
50
53
|
],
|
|
51
54
|
},
|
|
52
55
|
images: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
type: "string[]",
|
|
57
|
+
label: "Images",
|
|
58
|
+
description: "A list of URLs of images to associate with the new product",
|
|
59
|
+
optional: true,
|
|
57
60
|
},
|
|
58
61
|
options: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
type: "string[]",
|
|
63
|
+
label: "Options",
|
|
64
|
+
description: "The custom product properties. For example, Size, Color, and Material. Each product can have up to 3 options and each option value can be up to 255 characters. Product variants are made of up combinations of option values. Options cannot be created without values. To create new options, a variant with an associated option value also needs to be created. Example: `[{\"name\":\"Color\",\"values\":[{\"name\": \"Blue\"},{\"name\": \"Black\"}]},{\"name\":\"Size\",\"values\":[{\"name\": \"155\"},{\"name\": \"159\"}]}]`",
|
|
65
|
+
optional: true,
|
|
63
66
|
},
|
|
64
67
|
variants: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
type: "string[]",
|
|
69
|
+
label: "Product Variants",
|
|
70
|
+
description: "An array of product variants, each representing a different version of the product. The position property is read-only. The position of variants is indicated by the order in which they are listed. Example: `[{\"option1\":\"First\",\"price\":\"10.00\",\"sku\":\"123\"},{\"option1\":\"Second\",\"price\":\"20.00\",\"sku\":\"123\"}]`",
|
|
71
|
+
optional: true,
|
|
69
72
|
},
|
|
70
73
|
tags: {
|
|
71
74
|
propDefinition: [
|
|
72
75
|
shopify,
|
|
73
76
|
"tags",
|
|
74
77
|
],
|
|
78
|
+
optional: true,
|
|
75
79
|
},
|
|
76
80
|
metafields: {
|
|
77
81
|
propDefinition: [
|
|
@@ -79,6 +83,61 @@ export default {
|
|
|
79
83
|
"metafields",
|
|
80
84
|
],
|
|
81
85
|
},
|
|
82
|
-
|
|
86
|
+
handle: {
|
|
87
|
+
type: "string",
|
|
88
|
+
label: "Handle",
|
|
89
|
+
description: "A unique human-friendly string for the product that serves as the URL handle. Automatically generated from the product's title.",
|
|
90
|
+
optional: true,
|
|
91
|
+
},
|
|
92
|
+
seoTitle: {
|
|
93
|
+
type: "string",
|
|
94
|
+
label: "SEO Title",
|
|
95
|
+
description: "The product title used for search engine optimization",
|
|
96
|
+
optional: true,
|
|
97
|
+
},
|
|
98
|
+
seoDescription: {
|
|
99
|
+
type: "string",
|
|
100
|
+
label: "SEO Description",
|
|
101
|
+
description: "The product description used for search engine optimization",
|
|
102
|
+
optional: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
async run({ $ }) {
|
|
106
|
+
const metafields = await this.createMetafieldsArray(this.metafields, this.productId, "product");
|
|
107
|
+
|
|
108
|
+
const variants = [];
|
|
109
|
+
const variantsArray = this.shopify.parseArrayOfJSONStrings(this.variants);
|
|
110
|
+
for (const variant of variantsArray) {
|
|
111
|
+
if (variant.metafields) {
|
|
112
|
+
const variantMetafields = await this.createMetafieldsArray(variant.metafields, variant.id, "variants");
|
|
113
|
+
variants.push({
|
|
114
|
+
...variant,
|
|
115
|
+
metafields: variantMetafields,
|
|
116
|
+
});
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
variants.push(variant);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const response = await this.shopify.updateProduct({
|
|
123
|
+
input: {
|
|
124
|
+
title: this.title,
|
|
125
|
+
descriptionHtml: this.productDescription,
|
|
126
|
+
vendor: this.vendor,
|
|
127
|
+
productType: this.productType,
|
|
128
|
+
status: this.status,
|
|
129
|
+
images: utils.parseJson(this.images),
|
|
130
|
+
options: utils.parseJson(this.options),
|
|
131
|
+
variants,
|
|
132
|
+
tags: this.tags,
|
|
133
|
+
metafields,
|
|
134
|
+
metafields_global_title_tag: this.seoTitle,
|
|
135
|
+
metafields_global_description_tag: this.seoDescription,
|
|
136
|
+
handle: this.handle,
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
$.export("$summary", `Updated product \`${response.title}\` with id \`${response.id}\``);
|
|
141
|
+
return response;
|
|
83
142
|
},
|
|
84
143
|
};
|
|
@@ -1,79 +1,22 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import common from "@pipedream/shopify/actions/update-product-variant/update-product-variant.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);
|
|
4
10
|
|
|
5
11
|
export default {
|
|
6
|
-
...
|
|
7
|
-
...metafieldActions,
|
|
12
|
+
...others,
|
|
8
13
|
key: "shopify_developer_app-update-product-variant",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type
|
|
14
|
+
version: "0.0.7",
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
type,
|
|
13
18
|
props: {
|
|
14
19
|
shopify,
|
|
15
|
-
|
|
16
|
-
propDefinition: [
|
|
17
|
-
shopify,
|
|
18
|
-
"productId",
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
productVariantId: {
|
|
22
|
-
propDefinition: [
|
|
23
|
-
shopify,
|
|
24
|
-
"productVariantId",
|
|
25
|
-
(c) => c,
|
|
26
|
-
],
|
|
27
|
-
description: `${shopify.propDefinitions.productVariantId.description}
|
|
28
|
-
Option displayed here as the title of the product variant`,
|
|
29
|
-
},
|
|
30
|
-
option: {
|
|
31
|
-
propDefinition: [
|
|
32
|
-
shopify,
|
|
33
|
-
"option",
|
|
34
|
-
],
|
|
35
|
-
optional: true,
|
|
36
|
-
},
|
|
37
|
-
price: {
|
|
38
|
-
propDefinition: [
|
|
39
|
-
shopify,
|
|
40
|
-
"price",
|
|
41
|
-
],
|
|
42
|
-
description: "The price of the product variant",
|
|
43
|
-
},
|
|
44
|
-
imageId: {
|
|
45
|
-
propDefinition: [
|
|
46
|
-
shopify,
|
|
47
|
-
"imageId",
|
|
48
|
-
(c) => c,
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
metafields: {
|
|
52
|
-
propDefinition: [
|
|
53
|
-
shopify,
|
|
54
|
-
"metafields",
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
sku: {
|
|
58
|
-
propDefinition: [
|
|
59
|
-
shopify,
|
|
60
|
-
"sku",
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
countryCodeOfOrigin: {
|
|
64
|
-
propDefinition: [
|
|
65
|
-
shopify,
|
|
66
|
-
"country",
|
|
67
|
-
],
|
|
68
|
-
description: "The country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of where the item came from",
|
|
69
|
-
},
|
|
70
|
-
locationId: {
|
|
71
|
-
propDefinition: [
|
|
72
|
-
shopify,
|
|
73
|
-
"locationId",
|
|
74
|
-
],
|
|
75
|
-
optional: true,
|
|
76
|
-
},
|
|
77
|
-
...common.props,
|
|
20
|
+
...props,
|
|
78
21
|
},
|
|
79
22
|
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const CREATE_ORDER = `
|
|
2
|
+
mutation OrderCreate($order: OrderCreateOrderInput!, $options: OrderCreateOptionsInput) {
|
|
3
|
+
orderCreate(order: $order, options: $options) {
|
|
4
|
+
userErrors {
|
|
5
|
+
field
|
|
6
|
+
message
|
|
7
|
+
}
|
|
8
|
+
order {
|
|
9
|
+
id
|
|
10
|
+
totalTaxSet {
|
|
11
|
+
shopMoney {
|
|
12
|
+
amount
|
|
13
|
+
currencyCode
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
lineItems(first: 5) {
|
|
17
|
+
nodes {
|
|
18
|
+
variant {
|
|
19
|
+
id
|
|
20
|
+
}
|
|
21
|
+
id
|
|
22
|
+
title
|
|
23
|
+
quantity
|
|
24
|
+
taxLines {
|
|
25
|
+
title
|
|
26
|
+
rate
|
|
27
|
+
priceSet {
|
|
28
|
+
shopMoney {
|
|
29
|
+
amount
|
|
30
|
+
currencyCode
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const CREATE_CUSTOMER = `
|
|
42
|
+
mutation customerCreate($input: CustomerInput!) {
|
|
43
|
+
customerCreate(input: $input) {
|
|
44
|
+
userErrors {
|
|
45
|
+
field
|
|
46
|
+
message
|
|
47
|
+
}
|
|
48
|
+
customer {
|
|
49
|
+
id
|
|
50
|
+
email
|
|
51
|
+
phone
|
|
52
|
+
taxExempt
|
|
53
|
+
firstName
|
|
54
|
+
lastName
|
|
55
|
+
amountSpent {
|
|
56
|
+
amount
|
|
57
|
+
currencyCode
|
|
58
|
+
}
|
|
59
|
+
smsMarketingConsent {
|
|
60
|
+
marketingState
|
|
61
|
+
marketingOptInLevel
|
|
62
|
+
consentUpdatedAt
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
const UPDATE_CUSTOMER = `
|
|
70
|
+
mutation updateCustomerMetafields($input: CustomerInput!) {
|
|
71
|
+
customerUpdate(input: $input) {
|
|
72
|
+
customer {
|
|
73
|
+
id
|
|
74
|
+
email
|
|
75
|
+
firstName
|
|
76
|
+
lastName
|
|
77
|
+
metafields(first: 3) {
|
|
78
|
+
edges {
|
|
79
|
+
node {
|
|
80
|
+
id
|
|
81
|
+
namespace
|
|
82
|
+
key
|
|
83
|
+
value
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
userErrors {
|
|
89
|
+
message
|
|
90
|
+
field
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
const UPDATE_PRODUCT = `
|
|
97
|
+
mutation UpdateProductWithNewMedia($input: ProductInput!, $media: [CreateMediaInput!]) {
|
|
98
|
+
productUpdate(input: $input, media: $media) {
|
|
99
|
+
product {
|
|
100
|
+
id
|
|
101
|
+
media(first: 10) {
|
|
102
|
+
nodes {
|
|
103
|
+
alt
|
|
104
|
+
mediaContentType
|
|
105
|
+
preview {
|
|
106
|
+
status
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
userErrors {
|
|
112
|
+
field
|
|
113
|
+
message
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
export default {
|
|
120
|
+
CREATE_ORDER,
|
|
121
|
+
CREATE_CUSTOMER,
|
|
122
|
+
UPDATE_CUSTOMER,
|
|
123
|
+
UPDATE_PRODUCT,
|
|
124
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
const GET_ORDER = `
|
|
2
|
+
query SuggestedRefund($id: ID!, $refundLineItems: [RefundLineItemInput!], $first: Int, $after: String) {
|
|
3
|
+
order(id: $id) {
|
|
4
|
+
id
|
|
5
|
+
metafields (first: $first, after: $after) {
|
|
6
|
+
nodes {
|
|
7
|
+
id
|
|
8
|
+
key
|
|
9
|
+
namespace
|
|
10
|
+
value
|
|
11
|
+
type
|
|
12
|
+
}
|
|
13
|
+
pageInfo {
|
|
14
|
+
endCursor
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
suggestedRefund(refundLineItems: $refundLineItems) {
|
|
18
|
+
subtotalSet {
|
|
19
|
+
shopMoney {
|
|
20
|
+
amount
|
|
21
|
+
currencyCode
|
|
22
|
+
}
|
|
23
|
+
presentmentMoney {
|
|
24
|
+
amount
|
|
25
|
+
currencyCode
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
refundLineItems {
|
|
29
|
+
lineItem {
|
|
30
|
+
id
|
|
31
|
+
}
|
|
32
|
+
quantity
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const GET_CUSTOMER = `
|
|
40
|
+
query ($id: ID!, $first: Int, $after: String) {
|
|
41
|
+
customer(id: $id) {
|
|
42
|
+
id
|
|
43
|
+
firstName
|
|
44
|
+
lastName
|
|
45
|
+
email
|
|
46
|
+
phone
|
|
47
|
+
numberOfOrders
|
|
48
|
+
amountSpent {
|
|
49
|
+
amount
|
|
50
|
+
currencyCode
|
|
51
|
+
}
|
|
52
|
+
createdAt
|
|
53
|
+
updatedAt
|
|
54
|
+
note
|
|
55
|
+
verifiedEmail
|
|
56
|
+
validEmailAddress
|
|
57
|
+
tags
|
|
58
|
+
lifetimeDuration
|
|
59
|
+
defaultAddress {
|
|
60
|
+
formattedArea
|
|
61
|
+
address1
|
|
62
|
+
}
|
|
63
|
+
addresses {
|
|
64
|
+
address1
|
|
65
|
+
}
|
|
66
|
+
image {
|
|
67
|
+
src
|
|
68
|
+
}
|
|
69
|
+
canDelete
|
|
70
|
+
metafields (first: $first, after: $after) {
|
|
71
|
+
nodes {
|
|
72
|
+
id
|
|
73
|
+
key
|
|
74
|
+
namespace
|
|
75
|
+
value
|
|
76
|
+
type
|
|
77
|
+
}
|
|
78
|
+
pageInfo {
|
|
79
|
+
endCursor
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
const GET_DRAFT_ORDER = `
|
|
87
|
+
query ($id: ID!, $first: Int, $after: String) {
|
|
88
|
+
draftOrder(id: $id) {
|
|
89
|
+
name
|
|
90
|
+
metafields (first: $first, after: $after) {
|
|
91
|
+
nodes {
|
|
92
|
+
id
|
|
93
|
+
key
|
|
94
|
+
namespace
|
|
95
|
+
value
|
|
96
|
+
type
|
|
97
|
+
}
|
|
98
|
+
pageInfo {
|
|
99
|
+
endCursor
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const LIST_ORDERS = `
|
|
107
|
+
query ($first: Int, $after: String, $reverse: Boolean){
|
|
108
|
+
orders(first: $first, after: $after, reverse: $reverse) {
|
|
109
|
+
nodes {
|
|
110
|
+
id
|
|
111
|
+
updatedAt
|
|
112
|
+
metafields (first: $first, after: $after) {
|
|
113
|
+
nodes {
|
|
114
|
+
id
|
|
115
|
+
key
|
|
116
|
+
namespace
|
|
117
|
+
value
|
|
118
|
+
type
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
pageInfo {
|
|
123
|
+
endCursor
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
const LIST_DRAFT_ORDERS = `
|
|
130
|
+
query ($first: Int, $after: String){
|
|
131
|
+
draftOrders(first: $first, after: $after) {
|
|
132
|
+
nodes {
|
|
133
|
+
id
|
|
134
|
+
metafields (first: $first, after: $after) {
|
|
135
|
+
nodes {
|
|
136
|
+
id
|
|
137
|
+
key
|
|
138
|
+
namespace
|
|
139
|
+
value
|
|
140
|
+
type
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
pageInfo {
|
|
145
|
+
endCursor
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
|
|
151
|
+
const LIST_CUSTOMERS = `
|
|
152
|
+
query ($first: Int, $after: String, $query: String) {
|
|
153
|
+
customers(first: $first, after: $after, query: $query) {
|
|
154
|
+
nodes {
|
|
155
|
+
id
|
|
156
|
+
displayName
|
|
157
|
+
metafields (first: $first, after: $after) {
|
|
158
|
+
nodes {
|
|
159
|
+
id
|
|
160
|
+
key
|
|
161
|
+
namespace
|
|
162
|
+
value
|
|
163
|
+
type
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
pageInfo {
|
|
168
|
+
endCursor
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
|
|
174
|
+
export default {
|
|
175
|
+
GET_ORDER,
|
|
176
|
+
GET_CUSTOMER,
|
|
177
|
+
GET_DRAFT_ORDER,
|
|
178
|
+
LIST_ORDERS,
|
|
179
|
+
LIST_DRAFT_ORDERS,
|
|
180
|
+
LIST_CUSTOMERS,
|
|
181
|
+
};
|
package/common/utils.mjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export function adjustPropDefinitions(props, app) {
|
|
2
|
+
return Object.fromEntries(
|
|
3
|
+
Object.entries(props).map(([
|
|
4
|
+
key,
|
|
5
|
+
prop,
|
|
6
|
+
]) => {
|
|
7
|
+
if (typeof prop === "string") return [
|
|
8
|
+
key,
|
|
9
|
+
prop,
|
|
10
|
+
];
|
|
11
|
+
const {
|
|
12
|
+
propDefinition, ...otherValues
|
|
13
|
+
} = prop;
|
|
14
|
+
if (propDefinition) {
|
|
15
|
+
const [
|
|
16
|
+
, ...otherDefs
|
|
17
|
+
] = propDefinition;
|
|
18
|
+
return [
|
|
19
|
+
key,
|
|
20
|
+
{
|
|
21
|
+
propDefinition: [
|
|
22
|
+
app,
|
|
23
|
+
...otherDefs,
|
|
24
|
+
],
|
|
25
|
+
...otherValues,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
return [
|
|
30
|
+
key,
|
|
31
|
+
otherValues.type === "app"
|
|
32
|
+
? null
|
|
33
|
+
: otherValues,
|
|
34
|
+
];
|
|
35
|
+
})
|
|
36
|
+
.filter(([
|
|
37
|
+
, value,
|
|
38
|
+
]) => value),
|
|
39
|
+
);
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/shopify_developer_app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Pipedream Shopify (Developer App) Components",
|
|
5
5
|
"main": "shopify_developer_app.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@pipedream/platform": "^3.0.3",
|
|
17
|
-
"@pipedream/shopify": "^0.
|
|
17
|
+
"@pipedream/shopify": "^0.7.0",
|
|
18
18
|
"shopify-api-node": "^3.14.2"
|
|
19
19
|
}
|
|
20
20
|
}
|