Skip to content

Commit d7a79e4

Browse files
committed
Merge remote-tracking branch 'upstream/master' into crypto
* upstream/master: Adding app scaffolding for stackby Airtop new components (#18637) Sinch - new components (#18635) Mintlify - new components (#18519) Linear App - updates and new components (#18606) Merging pull request #18622 Adding app scaffolding for airtop
2 parents 71ca7fb + b84340e commit d7a79e4

File tree

53 files changed

+2318
-37
lines changed

Some content is hidden

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

53 files changed

+2318
-37
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import { parseObjectEntries } from "../../common/utils.mjs";
2+
import app from "../../airtop.app.mjs";
3+
import { ConfigurationError } from "@pipedream/platform";
4+
5+
export default {
6+
key: "airtop-create-session",
7+
name: "Create Session",
8+
description: "Create a new cloud browser session. [See the documentation](https://docs.airtop.ai/api-reference/airtop-api/sessions/create)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
app,
13+
profileName: {
14+
type: "string",
15+
label: "Profile Name",
16+
description: "Name of a profile to load into the session. Only letters, numbers and hyphens are allowed. [See the documentation](https://docs.airtop.ai/guides/how-to/saving-a-profile) for more information",
17+
optional: true,
18+
},
19+
saveProfileOnTermination: {
20+
type: "boolean",
21+
label: "Save Profile on Termination",
22+
description: "If enabled, [the profile will be saved when the session terminates](https://docs.airtop.ai/api-reference/airtop-api/sessions/save-profile-on-termination). Only relevant if `Profile Name` is provided",
23+
optional: true,
24+
},
25+
timeoutMinutes: {
26+
type: "integer",
27+
label: "Timeout (Minutes)",
28+
description: "Number of minutes of inactivity (idle timeout) after which the session will terminate",
29+
optional: true,
30+
},
31+
record: {
32+
type: "boolean",
33+
label: "Record",
34+
description: "Whether to enable session recording",
35+
optional: true,
36+
},
37+
solveCaptcha: {
38+
type: "boolean",
39+
label: "Solve Captcha",
40+
description: "Whether to automatically solve captcha challenges",
41+
optional: true,
42+
},
43+
additionalOptions: {
44+
type: "object",
45+
label: "Additional Options",
46+
description: "Additional configuration parameters to send in the request. [See the documentation](https://docs.airtop.ai/api-reference/airtop-api/sessions/create) for available parameters (e.g., `proxy`). Values will be parsed as JSON where applicable.",
47+
optional: true,
48+
},
49+
},
50+
async run({ $ }) {
51+
const {
52+
profileName,
53+
saveProfileOnTermination,
54+
timeoutMinutes,
55+
record,
56+
solveCaptcha,
57+
additionalOptions,
58+
} = this;
59+
60+
if (profileName && !/^[a-zA-Z0-9-]+$/.test(profileName)) {
61+
throw new ConfigurationError(`Profile name \`${profileName}\` must contain only letters, numbers and hyphens`);
62+
}
63+
64+
const data = {
65+
configuration: {
66+
profileName,
67+
timeoutMinutes,
68+
record,
69+
solveCaptcha,
70+
...parseObjectEntries(additionalOptions),
71+
},
72+
};
73+
74+
const response = await this.app.createSession({
75+
$,
76+
data,
77+
});
78+
79+
const sessionId = response.id;
80+
81+
let saveProfileOnTerminationResponse;
82+
if (saveProfileOnTermination && profileName) {
83+
saveProfileOnTerminationResponse = await this.app.saveProfileOnTermination({
84+
$,
85+
sessionId,
86+
profileName,
87+
});
88+
}
89+
90+
$.export("$summary", `Successfully created session \`${sessionId}\` with status: ${response.status}`);
91+
return {
92+
response,
93+
saveProfileOnTerminationResponse,
94+
};
95+
},
96+
};
97+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import app from "../../airtop.app.mjs";
2+
3+
export default {
4+
key: "airtop-create-window",
5+
name: "Create Window",
6+
description: "Create a new browser window in an active session. [See the documentation](https://docs.airtop.ai/api-reference/airtop-api/windows/create)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
sessionId: {
12+
propDefinition: [
13+
app,
14+
"sessionId",
15+
],
16+
},
17+
url: {
18+
type: "string",
19+
label: "Initial URL",
20+
description: "Optional URL to navigate to immediately after creating the window.",
21+
optional: true,
22+
default: "https://www.pipedream.com",
23+
},
24+
screenResolution: {
25+
type: "string",
26+
label: "Screen Resolution",
27+
description: "Affects the live view configuration. By default, a live view will fill the parent frame when initially loaded. This parameter can be used to configure fixed dimensions (e.g. `1280x720`).",
28+
optional: true,
29+
default: "1280x720",
30+
},
31+
waitUntil: {
32+
propDefinition: [
33+
app,
34+
"waitUntil",
35+
],
36+
},
37+
waitUntilTimeoutSeconds: {
38+
propDefinition: [
39+
app,
40+
"waitUntilTimeoutSeconds",
41+
],
42+
},
43+
},
44+
async run({ $ }) {
45+
const {
46+
sessionId,
47+
url,
48+
screenResolution,
49+
waitUntil,
50+
waitUntilTimeoutSeconds,
51+
} = this;
52+
53+
const response = await this.app.createWindow({
54+
$,
55+
sessionId,
56+
data: {
57+
url,
58+
screenResolution,
59+
waitUntil,
60+
waitUntilTimeoutSeconds,
61+
},
62+
});
63+
64+
const windowId = response.id;
65+
66+
$.export("$summary", `Successfully created window ${windowId}`);
67+
return response;
68+
},
69+
};
70+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import app from "../../airtop.app.mjs";
2+
3+
export default {
4+
key: "airtop-end-session",
5+
name: "End Session",
6+
description: "End a browser session. [See the documentation](https://docs.airtop.ai/api-reference/airtop-api/sessions/terminate)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
sessionId: {
12+
propDefinition: [
13+
app,
14+
"sessionId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const { sessionId } = this;
20+
21+
const response = await this.app.endSession({
22+
$,
23+
sessionId,
24+
});
25+
26+
$.export("$summary", `Successfully terminated session ${sessionId}`);
27+
return response;
28+
},
29+
};
30+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import app from "../../airtop.app.mjs";
2+
3+
export default {
4+
key: "airtop-load-url",
5+
name: "Load URL",
6+
description: "Navigate a browser window to a specific URL. [See the documentation](https://docs.airtop.ai/api-reference/airtop-api/windows/load-url)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
sessionId: {
12+
propDefinition: [
13+
app,
14+
"sessionId",
15+
],
16+
},
17+
windowId: {
18+
propDefinition: [
19+
app,
20+
"windowId",
21+
({ sessionId }) => ({
22+
sessionId,
23+
}),
24+
],
25+
},
26+
url: {
27+
type: "string",
28+
label: "URL",
29+
description: "The URL to navigate to (e.g. `https://www.pipedream.com`)",
30+
},
31+
waitUntil: {
32+
propDefinition: [
33+
app,
34+
"waitUntil",
35+
],
36+
},
37+
waitUntilTimeoutSeconds: {
38+
propDefinition: [
39+
app,
40+
"waitUntilTimeoutSeconds",
41+
],
42+
},
43+
},
44+
async run({ $ }) {
45+
const {
46+
sessionId,
47+
windowId,
48+
url,
49+
waitUntil,
50+
waitUntilTimeoutSeconds,
51+
} = this;
52+
53+
const response = await this.app.loadUrl({
54+
$,
55+
sessionId,
56+
windowId,
57+
data: {
58+
url,
59+
waitUntil,
60+
waitUntilTimeoutSeconds,
61+
},
62+
});
63+
64+
$.export("$summary", `Successfully navigated to ${url}`);
65+
return response;
66+
},
67+
};
68+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import app from "../../airtop.app.mjs";
2+
3+
export default {
4+
key: "airtop-query-page",
5+
name: "Query Page",
6+
description: "Extract data or ask questions about page content using AI. [See the documentation](https://docs.airtop.ai/api-reference/airtop-api/windows/page-query)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
sessionId: {
12+
propDefinition: [
13+
app,
14+
"sessionId",
15+
],
16+
},
17+
windowId: {
18+
propDefinition: [
19+
app,
20+
"windowId",
21+
({ sessionId }) => ({
22+
sessionId,
23+
}),
24+
],
25+
},
26+
prompt: {
27+
type: "string",
28+
label: "Prompt",
29+
description: "The prompt to submit about the content in the browser window.",
30+
},
31+
followPaginationLinks: {
32+
propDefinition: [
33+
app,
34+
"followPaginationLinks",
35+
],
36+
},
37+
costThresholdCredits: {
38+
propDefinition: [
39+
app,
40+
"costThresholdCredits",
41+
],
42+
},
43+
timeThresholdSeconds: {
44+
propDefinition: [
45+
app,
46+
"timeThresholdSeconds",
47+
],
48+
},
49+
},
50+
async run({ $ }) {
51+
const {
52+
sessionId,
53+
windowId,
54+
prompt,
55+
followPaginationLinks,
56+
costThresholdCredits,
57+
timeThresholdSeconds,
58+
} = this;
59+
60+
const response = await this.app.queryPage({
61+
$,
62+
sessionId,
63+
windowId,
64+
data: {
65+
prompt,
66+
configuration: {
67+
followPaginationLinks,
68+
costThresholdCredits,
69+
timeThresholdSeconds,
70+
},
71+
},
72+
});
73+
74+
$.export("$summary", "Successfully queried page");
75+
return response;
76+
},
77+
};
78+

0 commit comments

Comments
 (0)