@pipedream/shopify_developer_app 0.10.0 → 0.10.2
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.2",
|
|
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
|
}
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "Draft Order Updated (Instant)",
|
|
8
8
|
type: "source",
|
|
9
9
|
description: "Emit new event for each draft order updated in a store.",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.2",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -15,10 +15,11 @@ export default {
|
|
|
15
15
|
return "DRAFT_ORDERS_UPDATE";
|
|
16
16
|
},
|
|
17
17
|
generateMeta(resource) {
|
|
18
|
+
const ts = Date.parse(resource.updated_at);
|
|
18
19
|
return {
|
|
19
|
-
id:
|
|
20
|
+
id: ts,
|
|
20
21
|
summary: `Draft order updated ${resource.id}`,
|
|
21
|
-
ts
|
|
22
|
+
ts,
|
|
22
23
|
};
|
|
23
24
|
},
|
|
24
25
|
},
|