@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,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.8",
|
|
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,12 @@
|
|
|
1
1
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
2
|
-
import
|
|
3
|
-
import common from "@pipedream/shopify/actions/update-product/common.mjs";
|
|
2
|
+
import common from "../common/metafield-actions.mjs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
...common,
|
|
7
|
-
...metafieldActions,
|
|
8
6
|
key: "shopify_developer_app-update-product",
|
|
9
7
|
name: "Update Product",
|
|
10
|
-
description: "Update an existing product. [See the
|
|
11
|
-
version: "0.0.
|
|
8
|
+
description: "Update an existing product. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productupdate)",
|
|
9
|
+
version: "0.0.7",
|
|
12
10
|
type: "action",
|
|
13
11
|
props: {
|
|
14
12
|
shopify,
|
|
@@ -19,59 +17,52 @@ export default {
|
|
|
19
17
|
],
|
|
20
18
|
},
|
|
21
19
|
title: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
],
|
|
20
|
+
type: "string",
|
|
21
|
+
label: "Title",
|
|
22
|
+
description: "Title of the new product",
|
|
26
23
|
optional: true,
|
|
27
24
|
},
|
|
28
25
|
productDescription: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
type: "string",
|
|
27
|
+
label: "Product Description",
|
|
28
|
+
description: "A description of the product. Supports HTML formatting. Example: `<strong>Good snowboard!</strong>`",
|
|
29
|
+
optional: true,
|
|
33
30
|
},
|
|
34
31
|
vendor: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
type: "string",
|
|
33
|
+
label: "Vendor",
|
|
34
|
+
description: "The name of the product's vendor",
|
|
35
|
+
optional: true,
|
|
39
36
|
},
|
|
40
37
|
productType: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
type: "string",
|
|
39
|
+
label: "Product Type",
|
|
40
|
+
description: "A categorization for the product used for filtering and searching products",
|
|
41
|
+
optional: true,
|
|
45
42
|
},
|
|
46
43
|
status: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
type: "string",
|
|
45
|
+
label: "Status",
|
|
46
|
+
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",
|
|
47
|
+
optional: true,
|
|
48
|
+
options: [
|
|
49
|
+
"ACTIVE",
|
|
50
|
+
"ARCHIVED",
|
|
51
|
+
"DRAFT",
|
|
50
52
|
],
|
|
51
53
|
},
|
|
52
54
|
images: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
options: {
|
|
59
|
-
propDefinition: [
|
|
60
|
-
shopify,
|
|
61
|
-
"options",
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
variants: {
|
|
65
|
-
propDefinition: [
|
|
66
|
-
shopify,
|
|
67
|
-
"variants",
|
|
68
|
-
],
|
|
55
|
+
type: "string[]",
|
|
56
|
+
label: "Images",
|
|
57
|
+
description: "A list of URLs of images to associate with the new product",
|
|
58
|
+
optional: true,
|
|
69
59
|
},
|
|
70
60
|
tags: {
|
|
71
61
|
propDefinition: [
|
|
72
62
|
shopify,
|
|
73
63
|
"tags",
|
|
74
64
|
],
|
|
65
|
+
optional: true,
|
|
75
66
|
},
|
|
76
67
|
metafields: {
|
|
77
68
|
propDefinition: [
|
|
@@ -79,6 +70,66 @@ export default {
|
|
|
79
70
|
"metafields",
|
|
80
71
|
],
|
|
81
72
|
},
|
|
82
|
-
|
|
73
|
+
handle: {
|
|
74
|
+
type: "string",
|
|
75
|
+
label: "Handle",
|
|
76
|
+
description: "A unique human-friendly string for the product that serves as the URL handle. Automatically generated from the product's title.",
|
|
77
|
+
optional: true,
|
|
78
|
+
},
|
|
79
|
+
seoTitle: {
|
|
80
|
+
type: "string",
|
|
81
|
+
label: "SEO Title",
|
|
82
|
+
description: "The product title used for search engine optimization",
|
|
83
|
+
optional: true,
|
|
84
|
+
},
|
|
85
|
+
seoDescription: {
|
|
86
|
+
type: "string",
|
|
87
|
+
label: "SEO Description",
|
|
88
|
+
description: "The product description used for search engine optimization",
|
|
89
|
+
optional: true,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
async run({ $ }) {
|
|
93
|
+
const metafields = await this.createMetafieldsArray(this.metafields, this.productId, "product");
|
|
94
|
+
|
|
95
|
+
const args = {
|
|
96
|
+
input: {
|
|
97
|
+
id: this.productId,
|
|
98
|
+
title: this.title,
|
|
99
|
+
descriptionHtml: this.productDescription,
|
|
100
|
+
vendor: this.vendor,
|
|
101
|
+
productType: this.productType,
|
|
102
|
+
status: this.status,
|
|
103
|
+
tags: this.tags,
|
|
104
|
+
metafields,
|
|
105
|
+
handle: this.handle,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
if (this.seoTitle) {
|
|
110
|
+
args.input.seo = {
|
|
111
|
+
title: this.seoTitle,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (this.seoDescription) {
|
|
115
|
+
args.input.seo = {
|
|
116
|
+
...args.input?.seo,
|
|
117
|
+
description: this.seoDescription,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (this.images?.length) {
|
|
122
|
+
args.media = this.images.map((originalSource) => ({
|
|
123
|
+
originalSource,
|
|
124
|
+
mediaContentType: "IMAGE",
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const response = await this.shopify.updateProduct(args);
|
|
129
|
+
if (response.productUpdate.userErrors.length > 0) {
|
|
130
|
+
throw new Error(response.productUpdate.userErrors[0].message);
|
|
131
|
+
}
|
|
132
|
+
$.export("$summary", `Updated product \`${response.productUpdate.product.title}\` with id \`${response.productUpdate.product.id}\``);
|
|
133
|
+
return response;
|
|
83
134
|
},
|
|
84
135
|
};
|
|
@@ -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.8",
|
|
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) {
|
|
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) {
|
|
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) {
|
|
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.1",
|
|
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
|
}
|