@pipedream/shopify_developer_app 0.10.0 → 0.10.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.
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { MAX_LIMIT } from "@pipedream/shopify/common/constants.mjs";
|
|
2
2
|
import shopify from "../../shopify_developer_app.app.mjs";
|
|
3
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
key: "shopify_developer_app-get-order",
|
|
6
7
|
name: "Get Order",
|
|
7
8
|
description: "Retrieve an order by specifying the order ID. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/queries/order)",
|
|
8
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.10",
|
|
9
10
|
annotations: {
|
|
10
11
|
destructiveHint: false,
|
|
11
12
|
openWorldHint: true,
|
|
@@ -21,12 +22,27 @@ export default {
|
|
|
21
22
|
],
|
|
22
23
|
},
|
|
23
24
|
},
|
|
25
|
+
methods: {
|
|
26
|
+
validateOrderId(orderId) {
|
|
27
|
+
const prefix = "gid://shopify/Order/";
|
|
28
|
+
const value = String(orderId).trim();
|
|
29
|
+
if (value.startsWith(prefix)) {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
if (/^\d+$/.test(value)) {
|
|
33
|
+
return `${prefix}${value}`;
|
|
34
|
+
}
|
|
35
|
+
throw new ConfigurationError(`Invalid order ID: ${orderId}`);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
24
38
|
async run({ $ }) {
|
|
39
|
+
const orderId = this.validateOrderId(this.orderId);
|
|
40
|
+
|
|
25
41
|
const response = await this.shopify.getOrder({
|
|
26
|
-
id:
|
|
42
|
+
id: orderId,
|
|
27
43
|
first: MAX_LIMIT,
|
|
28
44
|
});
|
|
29
|
-
$.export("$summary", `Successfully retrieved order with ID: ${
|
|
45
|
+
$.export("$summary", `Successfully retrieved order with ID: ${orderId}`);
|
|
30
46
|
return response;
|
|
31
47
|
},
|
|
32
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/shopify_developer_app",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Pipedream Shopify (Developer App) Components",
|
|
5
5
|
"main": "shopify_developer_app.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pipedream/platform": "^3.1.
|
|
16
|
+
"@pipedream/platform": "^3.1.1",
|
|
17
17
|
"@pipedream/shopify": "^0.7.0",
|
|
18
18
|
"shopify-api-node": "^3.14.2"
|
|
19
19
|
}
|