Skip to content

Commit 5c1160c

Browse files
committed
Merge remote-tracking branch 'origin/master' into connect/workflow-sdk-docs
2 parents ce0bdeb + 7060440 commit 5c1160c

File tree

49 files changed

+1986
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1986
-68
lines changed

components/alchemy/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

components/alchemy/alchemy.app.mjs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { axios } from "@pipedream/platform";
2+
import constants from "./common/constants.mjs";
3+
4+
export default {
5+
type: "app",
6+
app: "alchemy",
7+
propDefinitions: {
8+
network: {
9+
type: "string",
10+
label: "Network",
11+
description: "Network of the webhook",
12+
options: constants.NETWORKS,
13+
},
14+
query: {
15+
type: "string",
16+
label: "GraphQL Query",
17+
description: "Create a custom GraphQL query or select `Full Block Receipts` to get all log events for every new block",
18+
options: [
19+
{
20+
label: "Full Block Receipts",
21+
value: constants.FULL_BLOCK_RECEIPTS,
22+
},
23+
],
24+
},
25+
},
26+
methods: {
27+
_baseUrl() {
28+
return "https://dashboard.alchemy.com/api";
29+
},
30+
_makeRequest({
31+
$ = this,
32+
path,
33+
...opts
34+
}) {
35+
return axios($, {
36+
url: `${this._baseUrl()}${path}`,
37+
headers: {
38+
"X-Alchemy-Token": this.$auth.auth_token,
39+
},
40+
...opts,
41+
});
42+
},
43+
createWebhook(opts = {}) {
44+
return this._makeRequest({
45+
method: "POST",
46+
path: "/create-webhook",
47+
...opts,
48+
});
49+
},
50+
deleteWebhook(opts = {}) {
51+
return this._makeRequest({
52+
method: "DELETE",
53+
path: "/delete-webhook",
54+
...opts,
55+
});
56+
},
57+
},
58+
};
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
const NETWORKS = [
2+
"ETH_MAINNET",
3+
"ETH_SEPOLIA",
4+
"ETH_HOLESKY",
5+
"ARBMAINNET",
6+
"ARBSEPOLIA",
7+
"ARBNOVA_MAINNET",
8+
"MATICMAINNET",
9+
"MATICMUMBAI",
10+
"OPTMAINNET",
11+
"OPTGOERLI",
12+
"BASE_MAINNET",
13+
"BASE_SEPOLIA",
14+
"ZKSYNC_MAINNET",
15+
"ZKSYNC_SEPOLIA",
16+
"LINEA_MAINNET",
17+
"LINEA_SEPOLIA",
18+
"GNOSIS_MAINNET",
19+
"GNOSIS_CHIADO",
20+
"FANTOM_MAINNET",
21+
"FANTOM_TESTNET",
22+
"METIS_MAINNET",
23+
"BLAST_MAINNET",
24+
"BLAST_SEPOLIA",
25+
"SHAPE_SEPOLIA",
26+
"ZETACHAIN_MAINNET",
27+
"ZETACHAIN_TESTNET",
28+
"WORLDCHAIN_MAINNET",
29+
"WORLDCHAIN_SEPOLIA",
30+
"BNB_MAINNET",
31+
"BNB_TESTNET",
32+
"AVAX_MAINNET",
33+
"AVAX_FUJI",
34+
"SONEIUM_MINATO",
35+
"GEIST_POLTER",
36+
];
37+
38+
const FULL_BLOCK_RECEIPTS = `
39+
{
40+
block {
41+
hash,
42+
number,
43+
timestamp,
44+
logs(filter: {addresses: [], topics: []}) {
45+
data,
46+
topics,
47+
index,
48+
account {
49+
address
50+
},
51+
transaction {
52+
hash,
53+
nonce,
54+
index,
55+
from {
56+
address
57+
},
58+
to {
59+
address
60+
},
61+
value,
62+
gasPrice,
63+
maxFeePerGas,
64+
maxPriorityFeePerGas,
65+
gas,
66+
status,
67+
gasUsed,
68+
cumulativeGasUsed,
69+
effectiveGasPrice,
70+
createdContract {
71+
address
72+
}
73+
}
74+
}
75+
}
76+
}
77+
`;
78+
79+
export default {
80+
NETWORKS,
81+
FULL_BLOCK_RECEIPTS,
82+
};

components/alchemy/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"name": "@pipedream/alchemy",
3-
"version": "0.0.3",
3+
"version": "0.1.0",
44
"description": "Pipedream Alchemy Components",
5-
"main": "dist/app/alchemy.app.mjs",
5+
"main": "alchemy.app.mjs",
66
"keywords": [
77
"pipedream",
88
"alchemy"
99
],
10-
"files": [
11-
"dist"
12-
],
1310
"homepage": "https://pipedream.com/apps/alchemy",
1411
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1512
"publishConfig": {
1613
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1717
}
1818
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import alchemy from "../../alchemy.app.mjs";
2+
3+
export default {
4+
key: "alchemy-new-graphql-query-instant",
5+
name: "New GraphQL Query (Instant)",
6+
description: "Emit new event when a new GraphQL query is uploaded to Alchemy's Custom Webhook service. [See the documentation](https://docs.alchemy.com/reference/create-webhook)",
7+
version: "0.0.1",
8+
type: "source",
9+
dedupe: "unique",
10+
props: {
11+
alchemy,
12+
db: "$.service.db",
13+
http: {
14+
type: "$.interface.http",
15+
customResponse: true,
16+
},
17+
network: {
18+
propDefinition: [
19+
alchemy,
20+
"network",
21+
],
22+
},
23+
query: {
24+
propDefinition: [
25+
alchemy,
26+
"query",
27+
],
28+
},
29+
},
30+
hooks: {
31+
async activate() {
32+
const { data: { id } } = await this.alchemy.createWebhook({
33+
data: {
34+
network: this.network,
35+
webhook_type: "GRAPHQL",
36+
webhook_url: this.http.endpoint,
37+
graphql_query: this.query,
38+
},
39+
});
40+
this._setHookId(id);
41+
},
42+
async deactivate() {
43+
const hookId = this._getHookId();
44+
if (hookId) {
45+
await this.alchemy.deleteWebhook({
46+
params: {
47+
webhook_id: hookId,
48+
},
49+
});
50+
}
51+
},
52+
},
53+
methods: {
54+
_getHookId() {
55+
return this.db.get("hookId");
56+
},
57+
_setHookId(hookId) {
58+
this.db.set("hookId", hookId);
59+
},
60+
generateMeta(body) {
61+
return {
62+
id: body.id,
63+
summary: `New Event ID: ${body.id}`,
64+
ts: Date.parse(body.createdAt),
65+
};
66+
},
67+
},
68+
async run(event) {
69+
this.http.respond({
70+
status: 200,
71+
});
72+
73+
const { body } = event;
74+
const meta = this.generateMeta(body);
75+
this.$emit(body, meta);
76+
},
77+
};
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { defineApp } from "@pipedream/types";
2-
3-
export default defineApp({
1+
export default {
42
type: "app",
5-
app: "alchemy",
3+
app: "cats",
64
propDefinitions: {},
75
methods: {
86
// this.$auth contains connected account data
97
authKeys() {
108
console.log(Object.keys(this.$auth));
119
},
1210
},
13-
});
11+
};

components/cats/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/cats",
3+
"version": "0.0.1",
4+
"description": "Pipedream CATS Components",
5+
"main": "cats.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"cats"
9+
],
10+
"homepage": "https://pipedream.com/apps/cats",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import checkvist from "../../checkvist.app.mjs";
2+
import { STATUS_OPTIONS } from "../../common/constants.mjs";
3+
import { parseObject } from "../../common/utils.mjs";
4+
5+
export default {
6+
key: "checkvist-create-list-item",
7+
name: "Create List Item",
8+
description: "Creates a new list item within a specified list. [See the documentation](https://checkvist.com/auth/api)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
checkvist,
13+
listId: {
14+
propDefinition: [
15+
checkvist,
16+
"listId",
17+
],
18+
},
19+
content: {
20+
type: "string",
21+
label: "Content",
22+
description: "Block of text containing items to add. Indentations indicate nested list items.",
23+
},
24+
parentId: {
25+
propDefinition: [
26+
checkvist,
27+
"parentId",
28+
({ listId }) => ({
29+
listId,
30+
}),
31+
],
32+
optional: true,
33+
},
34+
tags: {
35+
type: "string[]",
36+
label: "Tags",
37+
description: "An array of tags.",
38+
optional: true,
39+
},
40+
dueDate: {
41+
type: "string",
42+
label: "Due Date",
43+
description: "Due for the task, in Checkvist's smart syntax format.",
44+
optional: true,
45+
},
46+
position: {
47+
type: "integer",
48+
label: "Position",
49+
description: "1-based position of the task (omit to add to the end of the list).",
50+
optional: true,
51+
},
52+
status: {
53+
type: "string",
54+
label: "Status",
55+
description: "Task status",
56+
options: STATUS_OPTIONS,
57+
optional: true,
58+
},
59+
},
60+
async run({ $ }) {
61+
const response = await this.checkvist.createListItem({
62+
$,
63+
listId: this.listId,
64+
data: {
65+
task: {
66+
content: this.content,
67+
parent_id: this.parentId || 0,
68+
tags: parseObject(this.tags)?.join(","),
69+
due_date: this.dueDate,
70+
position: this.position,
71+
status: this.status,
72+
},
73+
},
74+
});
75+
76+
$.export("$summary", `Successfully created a new list item in list with ID ${this.listId}`);
77+
return response;
78+
},
79+
};

0 commit comments

Comments
 (0)