Skip to content

Commit cf79b9c

Browse files
ctrlaltdylanluancazarinemichelle0927
authored
Updating to latest Shopify Partner API Version (#12768)
* Updating to latest Shopify Partner API Version * Symver updates * Update components/shopify_partner/actions/verify-webhook/verify-webhook.mjs Co-authored-by: Luan Cazarine <[email protected]> * Update components/shopify_partner/sources/new-app-charges/new-app-charges.mjs Co-authored-by: Luan Cazarine <[email protected]> --------- Co-authored-by: Luan Cazarine <[email protected]> Co-authored-by: michelle0927 <[email protected]>
1 parent 870de65 commit cf79b9c

File tree

7 files changed

+31
-29
lines changed

7 files changed

+31
-29
lines changed

components/shopify_partner/actions/verify-webhook/verify-webhook.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import crypto from "crypto";
33

44
export default {
55
name: "Verify Webhook",
6-
version: "0.0.4",
6+
version: "0.0.5",
77
key: "shopify_partner-verify-webhook",
88
description:
99
"Verify an incoming webhook from Shopify. Exits the workflow if the signature is not valid, otherwise returns `true`",

components/shopify_partner/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/shopify_partner",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Pipedream Shopify Partner Components",
55
"main": "shopify_partner.app.js",
66
"keywords": [

components/shopify_partner/shopify_partner.app.mjs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import "graphql/language/index.js";
22
import { GraphQLClient } from "graphql-request";
33

4+
export const PARTNER_API_VERSION = "2024-10";
5+
46
export default {
57
type: "app",
68
app: "shopify_partner",
79
propDefinitions: {
810
appId: {
911
type: "string",
10-
description: "Open your app in the partner portal, and look at the URL to find its ID. If your URL is *https://partners.shopify.com/3027494/apps/51358007297/overview*, enter `51358007297` here.",
12+
description:
13+
"Open your app in the partner portal, and look at the URL to find its ID. If your URL is *https://partners.shopify.com/3027494/apps/51358007297/overview*, enter `51358007297` here.",
1114
label: "Shopify App ID",
1215
reloadProps: true,
1316
},
@@ -45,7 +48,8 @@ export default {
4548
value: "backward",
4649
},
4750
],
48-
description: "Which direction to paginate through records. Forwards will only look into the future, whereas backwards will comb through all records.",
51+
description:
52+
"Which direction to paginate through records. Forwards will only look into the future, whereas backwards will comb through all records.",
4953
default: "forward",
5054
},
5155
},
@@ -74,7 +78,7 @@ export default {
7478
paginationDirection = "forward",
7579
recordsPerRun = 50,
7680
}) {
77-
const endpoint = `https://partners.shopify.com/${this.$auth.organization_id}/api/2024-04/graphql.json`;
81+
const endpoint = `https://partners.shopify.com/${this.$auth.organization_id}/api/${PARTNER_API_VERSION}/graphql.json`;
7882
const client = new GraphQLClient(endpoint, {
7983
headers: {
8084
"Content-Type": "application/json",

components/shopify_partner/sources/new-app-charges/new-app-charges.mjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "shopify_partner-new-app-charges",
66
name: "New App Charges",
77
type: "source",
8-
version: "0.0.17",
8+
version: "0.0.18",
99
description:
1010
"Emit new events when new app charges made to your partner account.",
1111
...common,
@@ -28,9 +28,7 @@ export default {
2828
},
2929
async run() {
3030
const {
31-
createdAtMin,
32-
createdAtMax,
33-
db,
31+
createdAtMin, createdAtMax, db,
3432
} = this;
3533

3634
const variables = {};
@@ -51,7 +49,9 @@ export default {
5149
return null;
5250
},
5351
handleEmit: (data) => {
54-
console.log(data.transactions.edges.map(({ node: { ...txn } }) => txn.id));
52+
console.log(
53+
data.transactions.edges.map(({ node: { ...txn } }) => txn.id),
54+
);
5555

5656
data.transactions.edges.map(({ node: { ...txn } }) => {
5757
this.$emit(txn, {

components/shopify_partner/sources/new-app-installs/new-app-installs.mjs

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "shopify_partner-new-app-installs",
77
name: "New App Installs",
88
type: "source",
9-
version: "0.1.2",
9+
version: "0.1.3",
1010
description: "Emit new events when new shops install your app.",
1111
...common,
1212
props: {
@@ -33,10 +33,7 @@ export default {
3333
},
3434
async run() {
3535
const {
36-
appId,
37-
occurredAtMin,
38-
occurredAtMax,
39-
db,
36+
appId, occurredAtMin, occurredAtMax, db,
4037
} = this;
4138

4239
const variables = {

components/shopify_partner/sources/new-app-relationship-events/new-app-relationship-events.mjs

+13-9
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ export default {
77
key: "shopify_partner-new-app-relationship-events",
88
name: "New App Relationship Events",
99
type: "source",
10-
version: "0.1.2",
11-
description: "Emit new events when new shops installs, uninstalls, subscribes or unsubscribes your app.",
10+
version: "0.1.3",
11+
description:
12+
"Emit new events when new shops installs, uninstalls, subscribes or unsubscribes your app.",
1213
...common,
1314
props: {
1415
...common.props,
@@ -69,9 +70,11 @@ export default {
6970
await this.shopify.query({
7071
db,
7172
key: "shopify_partner-relationship-events",
72-
query: this.paginationDirection === "backward" || !this.db.get("shopify_partner-relationship-events") // on the first run, pull records from present day
73-
? getAppRelationshipEventsBackwards
74-
: getAppRelationshipEventsForwards,
73+
query:
74+
this.paginationDirection === "backward" ||
75+
!this.db.get("shopify_partner-relationship-events") // on the first run, pull records from present day
76+
? getAppRelationshipEventsBackwards
77+
: getAppRelationshipEventsForwards,
7578
variables,
7679
handleEmit: (data) => {
7780
data.app.events.edges.map(({ node: { ...event } }) => {
@@ -94,11 +97,12 @@ export default {
9497
console.log("First event in batch: ", first);
9598
return first?.cursor;
9699
}
97-
98100
},
99-
hasNextPagePath: this.paginationDirection === "forward" || !this.db.get("shopify_partner-relationship-events")
100-
? "app.events.pageInfo.hasNextPage"
101-
: "app.events.pageInfo.hasPreviousPage",
101+
hasNextPagePath:
102+
this.paginationDirection === "forward" ||
103+
!this.db.get("shopify_partner-relationship-events")
104+
? "app.events.pageInfo.hasNextPage"
105+
: "app.events.pageInfo.hasPreviousPage",
102106
paginationDirection,
103107
recordsPerRun,
104108
});

components/shopify_partner/sources/new-app-uninstalls/new-app-uninstalls.mjs

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "shopify_partner-new-app-uninstalls",
77
name: "New App Uninstalls",
88
type: "source",
9-
version: "0.1.2",
9+
version: "0.1.3",
1010
description: "Emit new events when new shops uninstall your app.",
1111
...common,
1212
props: {
@@ -32,10 +32,7 @@ export default {
3232
},
3333
async run() {
3434
const {
35-
appId,
36-
occurredAtMin,
37-
occurredAtMax,
38-
db,
35+
appId, occurredAtMin, occurredAtMax, db,
3936
} = this;
4037

4138
const variables = {

0 commit comments

Comments
 (0)