Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions components/proxy_spider/actions/list-proxies/list-proxies.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import app from "../../proxy_spider.app.mjs";

export default {
key: "proxy_spider-list-proxies",
name: "List Proxies",
description: "List proxies from Proxy Spider. [See the documentation](https://proxy-spider.com/docs/api/public-proxies)",
version: "0.0.1",
annotations: {
openWorldHint: true,
destructiveHint: false,
readOnlyHint: true,
},
type: "action",
props: {
app,
limit: {
propDefinition: [
app,
"limit",
],
},
countryCode: {
propDefinition: [
app,
"countryCode",
],
},
responseTime: {
propDefinition: [
app,
"responseTime",
],
},
protocols: {
propDefinition: [
app,
"protocols",
],
},
type: {
propDefinition: [
app,
"type",
],
},
},
async run({ $ }) {
const response = await this.app.listProxies({
$,
params: {
limit: this.limit,
country_code: this.countryCode?.join(","),
response_time: this.responseTime?.join(","),
protocols: this.protocols?.join(","),
type: this.type?.join(","),
},
});
$.export("$summary", "Successfully sent the request. Retrieved " + response.data.proxies.length + " proxies");
return response;
},
};
24 changes: 24 additions & 0 deletions components/proxy_spider/actions/ping-server/ping-server.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import app from "../../proxy_spider.app.mjs";

export default {
key: "proxy_spider-ping-server",
name: "Ping Server",
description: "Ping Proxy Spider. [See the documentation](https://proxy-spider.com/docs/api/public-proxies)",
version: "0.0.1",
annotations: {
openWorldHint: true,
destructiveHint: false,
readOnlyHint: true,
},
type: "action",
props: {
app,
},
async run({ $ }) {
const response = await this.app.pingServer({
$,
});
$.export("$summary", "Successfully sent the request. Status: " + response.status);
return response;
},
};
18 changes: 18 additions & 0 deletions components/proxy_spider/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default {
TIME_OPTIONS: [
"slow",
"medium",
"fast",
],
PROTOCOLS: [
"http",
"https",
"socks4",
"socks5",
],
TYPES: [
"anonymous",
"elite",
"transparent",
],
};
5 changes: 4 additions & 1 deletion components/proxy_spider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/proxy_spider",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Proxy Spider Components",
"main": "proxy_spider.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
76 changes: 71 additions & 5 deletions components/proxy_spider/proxy_spider.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,77 @@
import { axios } from "@pipedream/platform";
import constants from "./common/constants.mjs";

export default {
type: "app",
app: "proxy_spider",
propDefinitions: {},
propDefinitions: {
limit: {
type: "integer",
label: "Limit",
description: "The number of proxies to retrieve, between 1 and 1000",
optional: true,
},
Comment on lines +8 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add min/max validation constraints.

The description states the limit should be "between 1 and 1000", but the prop definition lacks validation to enforce this range.

Apply this diff to add the constraints:

 limit: {
   type: "integer",
   label: "Limit",
   description: "The number of proxies to retrieve, between 1 and 1000",
   optional: true,
+  min: 1,
+  max: 1000,
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
limit: {
type: "integer",
label: "Limit",
description: "The number of proxies to retrieve, between 1 and 1000",
optional: true,
},
limit: {
type: "integer",
label: "Limit",
description: "The number of proxies to retrieve, between 1 and 1000",
optional: true,
min: 1,
max: 1000,
},
🤖 Prompt for AI Agents
In components/proxy_spider/proxy_spider.app.mjs around lines 8 to 13, the
"limit" integer prop describes a range of 1–1000 but has no validation; add min:
1 and max: 1000 to the prop definition (and keep optional: true) so the schema
enforces the allowed range for the limit value.

countryCode: {
type: "string[]",
label: "Country Code",
description: "Add this to retrieve only proxies at this location, i.e.: `US`",
optional: true,
},
responseTime: {
type: "string[]",
label: "Response Time",
description: "Add this to retrieve only proxies with a specific response time",
optional: true,
options: constants.TIME_OPTIONS,
},
protocols: {
type: "string[]",
label: "Protocols",
description: "Add this to retrieve only proxies with a specific protocol",
optional: true,
options: constants.PROTOCOLS,
},
type: {
type: "string[]",
label: "Type",
description: "Add this to retrieve only proxies with a type",
optional: true,
options: constants.TYPES,
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://proxy-spider.com/api";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
params,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
params: {
api_key: `${this.$auth.api_key}`,
...params,
},
});
},

async listProxies(args = {}) {
return this._makeRequest({
path: "/proxies.json",
...args,
});
},

async pingServer(args = {}) {
return this._makeRequest({
path: "/ping.json",
...args,
});
},
},
};
};
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading