File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
components/shopify_developer_app Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 11import { MAX_LIMIT } from "@pipedream/shopify/common/constants.mjs" ;
22import shopify from "../../shopify_developer_app.app.mjs" ;
3+ import { ConfigurationError } from "@pipedream/platform" ;
34
45export default {
56 key : "shopify_developer_app-get-order" ,
67 name : "Get Order" ,
78 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 " ,
9+ version : "0.0.10 " ,
910 annotations : {
1011 destructiveHint : false ,
1112 openWorldHint : true ,
@@ -21,12 +22,27 @@ export default {
2122 ] ,
2223 } ,
2324 } ,
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+ } ,
2438 async run ( { $ } ) {
39+ const orderId = this . validateOrderId ( this . orderId ) ;
40+
2541 const response = await this . shopify . getOrder ( {
26- id : this . orderId ,
42+ id : orderId ,
2743 first : MAX_LIMIT ,
2844 } ) ;
29- $ . export ( "$summary" , `Successfully retrieved order with ID: ${ this . orderId } ` ) ;
45+ $ . export ( "$summary" , `Successfully retrieved order with ID: ${ orderId } ` ) ;
3046 return response ;
3147 } ,
3248} ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/shopify_developer_app" ,
3- "version" : " 0.10.0 " ,
3+ "version" : " 0.10.1 " ,
44 "description" : " Pipedream Shopify (Developer App) Components" ,
55 "main" : " shopify_developer_app.app.mjs" ,
66 "keywords" : [
You can’t perform that action at this time.
0 commit comments