@agnocon/piece-browserless 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/capture-screenshot.d.ts +20 -0
- package/dist/lib/actions/capture-screenshot.d.ts.map +1 -0
- package/dist/lib/actions/capture-screenshot.js +176 -0
- package/dist/lib/actions/capture-screenshot.js.map +1 -0
- package/dist/lib/actions/generate-pdf.d.ts +38 -0
- package/dist/lib/actions/generate-pdf.d.ts.map +1 -0
- package/dist/lib/actions/generate-pdf.js +346 -0
- package/dist/lib/actions/generate-pdf.js.map +1 -0
- package/dist/lib/actions/get-website-performance.d.ts +20 -0
- package/dist/lib/actions/get-website-performance.d.ts.map +1 -0
- package/dist/lib/actions/get-website-performance.js +306 -0
- package/dist/lib/actions/get-website-performance.js.map +1 -0
- package/dist/lib/actions/run-bql-query.d.ts +26 -0
- package/dist/lib/actions/run-bql-query.d.ts.map +1 -0
- package/dist/lib/actions/run-bql-query.js +273 -0
- package/dist/lib/actions/run-bql-query.js.map +1 -0
- package/dist/lib/actions/scrape-url.d.ts +27 -0
- package/dist/lib/actions/scrape-url.d.ts.map +1 -0
- package/dist/lib/actions/scrape-url.js +277 -0
- package/dist/lib/actions/scrape-url.js.map +1 -0
- package/dist/lib/common/auth.d.ts +6 -0
- package/dist/lib/common/auth.d.ts.map +1 -0
- package/dist/lib/common/auth.js +62 -0
- package/dist/lib/common/auth.js.map +1 -0
- package/dist/lib/common/client.d.ts +18 -0
- package/dist/lib/common/client.d.ts.map +1 -0
- package/dist/lib/common/client.js +56 -0
- package/dist/lib/common/client.js.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +26 -0
- package/src/lib/actions/capture-screenshot.ts +176 -0
- package/src/lib/actions/generate-pdf.ts +364 -0
- package/src/lib/actions/get-website-performance.ts +321 -0
- package/src/lib/actions/run-bql-query.ts +295 -0
- package/src/lib/actions/scrape-url.ts +291 -0
- package/src/lib/common/auth.ts +57 -0
- package/src/lib/common/client.ts +72 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const scrapeUrl: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
region: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
customBaseUrl: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>, {
|
|
6
|
+
url: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
elements: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
8
|
+
waitForSelector: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
waitForSelectorTimeout: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
10
|
+
waitForSelectorVisible: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
11
|
+
waitForSelectorHidden: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
12
|
+
waitForTimeout: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
13
|
+
waitForEvent: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
waitForEventTimeout: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
15
|
+
debugConsole: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
16
|
+
debugCookies: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
17
|
+
debugNetwork: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
18
|
+
bestAttempt: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
19
|
+
userAgent: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
cookies: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
21
|
+
timeout: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
22
|
+
waitUntil: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
23
|
+
waitForFunction: import("@agnocon/pieces-framework").LongTextProperty<false>;
|
|
24
|
+
viewportWidth: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
25
|
+
viewportHeight: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=scrape-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrape-url.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/scrape-url.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;EA6RpB,CAAC"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scrapeUrl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/browserless/src/lib/actions/scrape-url.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
const client_1 = require("../common/client");
|
|
11
|
+
exports.scrapeUrl = (0, pieces_framework_1.createAction)({
|
|
12
|
+
name: 'scrape_url',
|
|
13
|
+
displayName: 'Scrape URL',
|
|
14
|
+
description: 'Extract content from a web page',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Loads a web page in a headless browser and extracts the elements matched by the CSS selectors you supply. Use to pull specific text or attributes from a page rather than capturing an image; both the page URL and at least one element selector are required. Read-only: re-running with the same input re-scrapes the page and returns equivalent data without side effects.', idempotent: true },
|
|
17
|
+
auth: auth_1.browserlessAuth,
|
|
18
|
+
props: {
|
|
19
|
+
url: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'URL',
|
|
21
|
+
description: 'The URL of the page to scrape',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
elements: pieces_framework_1.Property.Array({
|
|
25
|
+
displayName: 'Elements to Extract',
|
|
26
|
+
description: 'CSS selectors for elements to extract',
|
|
27
|
+
required: true,
|
|
28
|
+
properties: {
|
|
29
|
+
selector: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'CSS Selector',
|
|
31
|
+
description: 'CSS selector for the element',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
timeout: pieces_framework_1.Property.Number({
|
|
35
|
+
displayName: 'Timeout (ms)',
|
|
36
|
+
description: 'Timeout in milliseconds for this specific selector',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
waitForSelector: pieces_framework_1.Property.ShortText({
|
|
42
|
+
displayName: 'Wait for Selector',
|
|
43
|
+
description: 'CSS selector to wait for before scraping',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
46
|
+
waitForSelectorTimeout: pieces_framework_1.Property.Number({
|
|
47
|
+
displayName: 'Wait for Selector Timeout',
|
|
48
|
+
description: 'Timeout in milliseconds for waiting for selector',
|
|
49
|
+
required: false,
|
|
50
|
+
}),
|
|
51
|
+
waitForSelectorVisible: pieces_framework_1.Property.Checkbox({
|
|
52
|
+
displayName: 'Wait for Selector Visible',
|
|
53
|
+
description: 'Wait for selector to be visible',
|
|
54
|
+
required: false,
|
|
55
|
+
defaultValue: true,
|
|
56
|
+
}),
|
|
57
|
+
waitForSelectorHidden: pieces_framework_1.Property.Checkbox({
|
|
58
|
+
displayName: 'Wait for Selector Hidden',
|
|
59
|
+
description: 'Wait for selector to be hidden',
|
|
60
|
+
required: false,
|
|
61
|
+
defaultValue: false,
|
|
62
|
+
}),
|
|
63
|
+
waitForTimeout: pieces_framework_1.Property.Number({
|
|
64
|
+
displayName: 'Wait Timeout (ms)',
|
|
65
|
+
description: 'Timeout in milliseconds to wait before scraping',
|
|
66
|
+
required: false,
|
|
67
|
+
}),
|
|
68
|
+
waitForEvent: pieces_framework_1.Property.ShortText({
|
|
69
|
+
displayName: 'Wait for Event',
|
|
70
|
+
description: 'Event name to wait for before scraping',
|
|
71
|
+
required: false,
|
|
72
|
+
}),
|
|
73
|
+
waitForEventTimeout: pieces_framework_1.Property.Number({
|
|
74
|
+
displayName: 'Wait for Event Timeout',
|
|
75
|
+
description: 'Timeout in milliseconds for wait event',
|
|
76
|
+
required: false,
|
|
77
|
+
}),
|
|
78
|
+
debugConsole: pieces_framework_1.Property.Checkbox({
|
|
79
|
+
displayName: 'Debug Console',
|
|
80
|
+
description: 'Include console logs in debug output',
|
|
81
|
+
required: false,
|
|
82
|
+
defaultValue: false,
|
|
83
|
+
}),
|
|
84
|
+
debugCookies: pieces_framework_1.Property.Checkbox({
|
|
85
|
+
displayName: 'Debug Cookies',
|
|
86
|
+
description: 'Include cookies in debug output',
|
|
87
|
+
required: false,
|
|
88
|
+
defaultValue: false,
|
|
89
|
+
}),
|
|
90
|
+
debugNetwork: pieces_framework_1.Property.Checkbox({
|
|
91
|
+
displayName: 'Debug Network',
|
|
92
|
+
description: 'Include network requests in debug output',
|
|
93
|
+
required: false,
|
|
94
|
+
defaultValue: false,
|
|
95
|
+
}),
|
|
96
|
+
bestAttempt: pieces_framework_1.Property.Checkbox({
|
|
97
|
+
displayName: 'Best Attempt',
|
|
98
|
+
description: 'Attempt to proceed when awaited events fail or timeout',
|
|
99
|
+
required: false,
|
|
100
|
+
defaultValue: false,
|
|
101
|
+
}),
|
|
102
|
+
userAgent: pieces_framework_1.Property.ShortText({
|
|
103
|
+
displayName: 'User Agent',
|
|
104
|
+
description: 'Custom user agent string',
|
|
105
|
+
required: false,
|
|
106
|
+
}),
|
|
107
|
+
cookies: pieces_framework_1.Property.Array({
|
|
108
|
+
displayName: 'Cookies',
|
|
109
|
+
description: 'Cookies to set before scraping',
|
|
110
|
+
required: false,
|
|
111
|
+
properties: {
|
|
112
|
+
name: pieces_framework_1.Property.ShortText({
|
|
113
|
+
displayName: 'Cookie Name',
|
|
114
|
+
required: true,
|
|
115
|
+
}),
|
|
116
|
+
value: pieces_framework_1.Property.ShortText({
|
|
117
|
+
displayName: 'Cookie Value',
|
|
118
|
+
required: true,
|
|
119
|
+
}),
|
|
120
|
+
domain: pieces_framework_1.Property.ShortText({
|
|
121
|
+
displayName: 'Domain',
|
|
122
|
+
required: false,
|
|
123
|
+
}),
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
timeout: pieces_framework_1.Property.Number({
|
|
127
|
+
displayName: 'Timeout (ms)',
|
|
128
|
+
description: 'Maximum time to wait for the page to load',
|
|
129
|
+
required: false,
|
|
130
|
+
defaultValue: 30000,
|
|
131
|
+
}),
|
|
132
|
+
waitUntil: pieces_framework_1.Property.StaticDropdown({
|
|
133
|
+
displayName: 'Wait Until',
|
|
134
|
+
description: 'When to consider navigation complete',
|
|
135
|
+
required: false,
|
|
136
|
+
defaultValue: 'networkidle2',
|
|
137
|
+
options: {
|
|
138
|
+
options: [
|
|
139
|
+
{ label: 'Load Event', value: 'load' },
|
|
140
|
+
{ label: 'DOM Content Loaded', value: 'domcontentloaded' },
|
|
141
|
+
{ label: 'Network Idle 0', value: 'networkidle0' },
|
|
142
|
+
{ label: 'Network Idle 2', value: 'networkidle2' }
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
}),
|
|
146
|
+
waitForFunction: pieces_framework_1.Property.LongText({
|
|
147
|
+
displayName: 'Wait for Function',
|
|
148
|
+
description: 'JavaScript function to wait for before scraping (should return true when ready)',
|
|
149
|
+
required: false,
|
|
150
|
+
}),
|
|
151
|
+
viewportWidth: pieces_framework_1.Property.Number({
|
|
152
|
+
displayName: 'Viewport Width',
|
|
153
|
+
description: 'Browser viewport width in pixels',
|
|
154
|
+
required: false,
|
|
155
|
+
defaultValue: 1920,
|
|
156
|
+
}),
|
|
157
|
+
viewportHeight: pieces_framework_1.Property.Number({
|
|
158
|
+
displayName: 'Viewport Height',
|
|
159
|
+
description: 'Browser viewport height in pixels',
|
|
160
|
+
required: false,
|
|
161
|
+
defaultValue: 1080,
|
|
162
|
+
}),
|
|
163
|
+
},
|
|
164
|
+
run(context) {
|
|
165
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const requestBody = {
|
|
167
|
+
url: context.propsValue.url,
|
|
168
|
+
elements: (context.propsValue.elements || []).map((element) => {
|
|
169
|
+
let selector = element.selector;
|
|
170
|
+
if (typeof selector === 'string') {
|
|
171
|
+
try {
|
|
172
|
+
const parsed = JSON.parse(selector);
|
|
173
|
+
if (parsed.selector) {
|
|
174
|
+
selector = parsed.selector;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (e) {
|
|
178
|
+
console.error('Error parsing selector:', e);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else if (typeof selector === 'object' && selector.selector) {
|
|
182
|
+
selector = selector.selector;
|
|
183
|
+
}
|
|
184
|
+
const elementConfig = {
|
|
185
|
+
selector: selector,
|
|
186
|
+
};
|
|
187
|
+
if (element.timeout !== undefined) {
|
|
188
|
+
elementConfig.timeout = element.timeout;
|
|
189
|
+
}
|
|
190
|
+
return elementConfig;
|
|
191
|
+
})
|
|
192
|
+
};
|
|
193
|
+
if (context.propsValue.timeout || context.propsValue.waitUntil) {
|
|
194
|
+
requestBody.gotoOptions = {};
|
|
195
|
+
if (context.propsValue.timeout) {
|
|
196
|
+
requestBody.gotoOptions.timeout = context.propsValue.timeout;
|
|
197
|
+
}
|
|
198
|
+
if (context.propsValue.waitUntil) {
|
|
199
|
+
requestBody.gotoOptions.waitUntil = context.propsValue.waitUntil;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (context.propsValue.waitForSelector) {
|
|
203
|
+
const waitForSelectorObj = {
|
|
204
|
+
selector: context.propsValue.waitForSelector,
|
|
205
|
+
};
|
|
206
|
+
if (context.propsValue.waitForSelectorTimeout !== undefined) {
|
|
207
|
+
waitForSelectorObj.timeout = context.propsValue.waitForSelectorTimeout;
|
|
208
|
+
}
|
|
209
|
+
if (context.propsValue.waitForSelectorVisible !== undefined) {
|
|
210
|
+
waitForSelectorObj.visible = context.propsValue.waitForSelectorVisible;
|
|
211
|
+
}
|
|
212
|
+
if (context.propsValue.waitForSelectorHidden !== undefined) {
|
|
213
|
+
waitForSelectorObj.hidden = context.propsValue.waitForSelectorHidden;
|
|
214
|
+
}
|
|
215
|
+
requestBody.waitForSelector = waitForSelectorObj;
|
|
216
|
+
}
|
|
217
|
+
if (context.propsValue.waitForTimeout) {
|
|
218
|
+
requestBody.waitForTimeout = context.propsValue.waitForTimeout;
|
|
219
|
+
}
|
|
220
|
+
if (context.propsValue.waitForEvent) {
|
|
221
|
+
const waitForEventObj = {
|
|
222
|
+
event: context.propsValue.waitForEvent,
|
|
223
|
+
};
|
|
224
|
+
if (context.propsValue.waitForEventTimeout !== undefined) {
|
|
225
|
+
waitForEventObj.timeout = context.propsValue.waitForEventTimeout;
|
|
226
|
+
}
|
|
227
|
+
requestBody.waitForEvent = waitForEventObj;
|
|
228
|
+
}
|
|
229
|
+
const debugOpts = {};
|
|
230
|
+
if (context.propsValue.debugConsole)
|
|
231
|
+
debugOpts.console = true;
|
|
232
|
+
if (context.propsValue.debugCookies)
|
|
233
|
+
debugOpts.cookies = true;
|
|
234
|
+
if (context.propsValue.debugNetwork)
|
|
235
|
+
debugOpts.network = true;
|
|
236
|
+
if (Object.keys(debugOpts).length > 0) {
|
|
237
|
+
requestBody.debugOpts = debugOpts;
|
|
238
|
+
}
|
|
239
|
+
if (context.propsValue.bestAttempt) {
|
|
240
|
+
requestBody.bestAttempt = context.propsValue.bestAttempt;
|
|
241
|
+
}
|
|
242
|
+
if (context.propsValue.waitForFunction) {
|
|
243
|
+
requestBody.waitForFunction = {
|
|
244
|
+
fn: context.propsValue.waitForFunction
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
if (context.propsValue.userAgent) {
|
|
248
|
+
requestBody.userAgent = context.propsValue.userAgent;
|
|
249
|
+
}
|
|
250
|
+
if (context.propsValue.viewportWidth && context.propsValue.viewportHeight) {
|
|
251
|
+
requestBody.viewport = {
|
|
252
|
+
width: context.propsValue.viewportWidth,
|
|
253
|
+
height: context.propsValue.viewportHeight,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
if (context.propsValue.cookies && context.propsValue.cookies.length > 0) {
|
|
257
|
+
requestBody.cookies = context.propsValue.cookies.map((cookie) => (Object.assign({ name: cookie.name, value: cookie.value }, (cookie.domain && { domain: cookie.domain }))));
|
|
258
|
+
}
|
|
259
|
+
const response = yield client_1.browserlessCommon.apiCall({
|
|
260
|
+
auth: context.auth.props,
|
|
261
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
262
|
+
resourceUri: '/scrape',
|
|
263
|
+
body: requestBody,
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
success: true,
|
|
267
|
+
data: response.body,
|
|
268
|
+
metadata: {
|
|
269
|
+
url: context.propsValue.url,
|
|
270
|
+
elementsCount: (context.propsValue.elements || []).length,
|
|
271
|
+
timestamp: new Date().toISOString(),
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
//# sourceMappingURL=scrape-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrape-url.js","sourceRoot":"","sources":["../../../src/lib/actions/scrape-url.ts"],"names":[],"mappings":";;;;AAAA,wGAAwG;AACxG,qEAAqE;AACrE,gEAAmE;AACnE,0DAAoD;AACpD,yCAAiD;AACjD,6CAAqD;AAExC,QAAA,SAAS,GAAG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,CAAC,GAAG;oBAC3B,aAAa,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM;oBACzD,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACtC;aACJ,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const browserlessAuth: import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
region: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
customBaseUrl: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe;;;;EAsD1B,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.browserlessAuth = void 0;
|
|
4
|
+
// Vendored from Activepieces packages/pieces/community/browserless/src/lib/common/auth.ts (MIT).
|
|
5
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
6
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
7
|
+
exports.browserlessAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
8
|
+
description: `
|
|
9
|
+
To obtain your API credentials:
|
|
10
|
+
|
|
11
|
+
1. Sign up for a free Browserless account at https://www.browserless.io
|
|
12
|
+
2. Navigate to your dashboard
|
|
13
|
+
3. Find your API Key/Token in the account settings
|
|
14
|
+
4. Choose your preferred regional endpoint for optimal performance
|
|
15
|
+
|
|
16
|
+
Regional Endpoints:
|
|
17
|
+
• US West (SFO): https://production-sfo.browserless.io
|
|
18
|
+
• Europe UK (London): https://production-lon.browserless.io
|
|
19
|
+
• Europe (Amsterdam): https://production-ams.browserless.io
|
|
20
|
+
|
|
21
|
+
For custom/dedicated instances, select "Custom" and enter your specific endpoint URL.
|
|
22
|
+
`,
|
|
23
|
+
props: {
|
|
24
|
+
apiToken: pieces_framework_1.PieceAuth.SecretText({
|
|
25
|
+
displayName: 'API Token',
|
|
26
|
+
description: 'Your Browserless API token (found in your dashboard)',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
region: pieces_framework_1.Property.StaticDropdown({
|
|
30
|
+
displayName: 'Region',
|
|
31
|
+
description: 'Choose the regional endpoint closest to you for optimal performance',
|
|
32
|
+
required: true,
|
|
33
|
+
options: {
|
|
34
|
+
options: [
|
|
35
|
+
{
|
|
36
|
+
label: 'US West (San Francisco)',
|
|
37
|
+
value: 'https://production-sfo.browserless.io'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Europe UK (London)',
|
|
41
|
+
value: 'https://production-lon.browserless.io'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Europe (Amsterdam)',
|
|
45
|
+
value: 'https://production-ams.browserless.io'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'Custom Endpoint',
|
|
49
|
+
value: 'custom'
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
customBaseUrl: pieces_framework_1.Property.ShortText({
|
|
55
|
+
displayName: 'Custom Base URL',
|
|
56
|
+
description: 'Enter your custom Browserless endpoint URL',
|
|
57
|
+
required: false,
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
required: true,
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,iGAAiG;AACjG,qEAAqE;AACrE,gEAAgE;AAEnD,QAAA,eAAe,GAAG,4BAAS,CAAC,UAAU,CAAC;IAChD,WAAW,EAAE;;;;;;;;;;;;;;KAcZ;IACD,KAAK,EAAE;QACH,QAAQ,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,qEAAqE;YAClF,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL;wBACI,KAAK,EAAE,yBAAyB;wBAChC,KAAK,EAAE,uCAAuC;qBACjD;oBACD;wBACI,KAAK,EAAE,oBAAoB;wBAC3B,KAAK,EAAE,uCAAuC;qBACjD;oBACD;wBACI,KAAK,EAAE,oBAAoB;wBAC3B,KAAK,EAAE,uCAAuC;qBACjD;oBACD;wBACI,KAAK,EAAE,iBAAiB;wBACxB,KAAK,EAAE,QAAQ;qBAClB;iBACJ;aACJ;SACJ,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,KAAK;SAClB,CAAC;KACL;IACD,QAAQ,EAAE,IAAI;CACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpMethod } from '@agnocon/pieces-common';
|
|
2
|
+
export interface BrowserlessAuth {
|
|
3
|
+
apiToken: string;
|
|
4
|
+
region: string;
|
|
5
|
+
customBaseUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function convertBinaryToBase64(binaryData: any): string;
|
|
8
|
+
export declare function isBinaryResponse(headers: any): boolean;
|
|
9
|
+
export declare const browserlessCommon: {
|
|
10
|
+
apiCall({ auth, method, resourceUri, body, headers, }: {
|
|
11
|
+
auth: BrowserlessAuth;
|
|
12
|
+
method: HttpMethod;
|
|
13
|
+
resourceUri: string;
|
|
14
|
+
body?: any;
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
}): Promise<import("@agnocon/pieces-common").HttpResponse<any>>;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAc,MAAM,wBAAwB,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,GAAG,GAAG,MAAM,CAU7D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAKtD;AAED,eAAO,MAAM,iBAAiB;2DAOvB;QACC,IAAI,EAAE,eAAe,CAAC;QACtB,MAAM,EAAE,UAAU,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC;CA+BJ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.browserlessCommon = void 0;
|
|
4
|
+
exports.convertBinaryToBase64 = convertBinaryToBase64;
|
|
5
|
+
exports.isBinaryResponse = isBinaryResponse;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
// Vendored from Activepieces packages/pieces/community/browserless/src/lib/common/client.ts (MIT).
|
|
8
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
9
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
10
|
+
function convertBinaryToBase64(binaryData) {
|
|
11
|
+
if (typeof binaryData === 'string') {
|
|
12
|
+
return Buffer.from(binaryData, 'binary').toString('base64');
|
|
13
|
+
}
|
|
14
|
+
else if (binaryData instanceof ArrayBuffer) {
|
|
15
|
+
return Buffer.from(binaryData).toString('base64');
|
|
16
|
+
}
|
|
17
|
+
else if (Buffer.isBuffer(binaryData)) {
|
|
18
|
+
return binaryData.toString('base64');
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return Buffer.from(String(binaryData), 'binary').toString('base64');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function isBinaryResponse(headers) {
|
|
25
|
+
var _a;
|
|
26
|
+
const contentType = ((_a = headers === null || headers === void 0 ? void 0 : headers.get) === null || _a === void 0 ? void 0 : _a.call(headers, 'content-type')) || (headers === null || headers === void 0 ? void 0 : headers['content-type']) || '';
|
|
27
|
+
return contentType.includes('image/') ||
|
|
28
|
+
contentType.includes('application/pdf') ||
|
|
29
|
+
contentType.includes('application/octet-stream');
|
|
30
|
+
}
|
|
31
|
+
exports.browserlessCommon = {
|
|
32
|
+
apiCall(_a) {
|
|
33
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, method, resourceUri, body, headers = {}, }) {
|
|
34
|
+
const baseUrl = auth.region === 'custom' ? auth.customBaseUrl : auth.region;
|
|
35
|
+
if (!baseUrl) {
|
|
36
|
+
throw new Error('Base URL is required. Please configure your Browserless endpoint.');
|
|
37
|
+
}
|
|
38
|
+
const url = `${baseUrl}${resourceUri}`;
|
|
39
|
+
const requestHeaders = Object.assign({ 'Content-Type': 'application/json', 'Accept': '*/*' }, headers);
|
|
40
|
+
let responseType = 'json';
|
|
41
|
+
if (resourceUri.includes('/screenshot') || resourceUri.includes('/pdf')) {
|
|
42
|
+
responseType = 'arraybuffer';
|
|
43
|
+
}
|
|
44
|
+
const requestConfig = {
|
|
45
|
+
method,
|
|
46
|
+
url,
|
|
47
|
+
headers: requestHeaders,
|
|
48
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
49
|
+
queryParams: { token: auth.apiToken },
|
|
50
|
+
responseType,
|
|
51
|
+
};
|
|
52
|
+
return yield pieces_common_1.httpClient.sendRequest(requestConfig);
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":";;;AAUA,sDAUC;AAED,4CAKC;;AA3BD,mGAAmG;AACnG,qEAAqE;AACrE,0DAAgE;AAQhE,SAAgB,qBAAqB,CAAC,UAAe;IACjD,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAChE,CAAC;SAAM,IAAI,UAAU,YAAY,WAAW,EAAE,CAAC;QAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;SAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACrC,OAAO,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACJ,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;AACL,CAAC;AAED,SAAgB,gBAAgB,CAAC,OAAY;;IACzC,MAAM,WAAW,GAAG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,wDAAG,cAAc,CAAC,M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W,CAAC,aAAa,CAAC,CAAC;QACvD,CAAC;KAAA;CACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agnocon/piece-browserless",
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "AgnoCon browserless connector",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src",
|
|
17
|
+
"LICENSE.MIT-AP"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"vendor": "node ../scripts/vendor-ap.mjs piece-browserless"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@agnocon/core-utils": "0.2.0",
|
|
25
|
+
"@agnocon/piece-types": "0.3.1",
|
|
26
|
+
"@agnocon/pieces-common": "0.12.8",
|
|
27
|
+
"@agnocon/pieces-framework": "0.36.0",
|
|
28
|
+
"tslib": "2.6.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "20.17.6",
|
|
32
|
+
"typescript": "5.5.4"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"agnocon": {
|
|
36
|
+
"originVersion": "0.1.7"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "restricted",
|
|
40
|
+
"tag": "latest"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"agnocon",
|
|
44
|
+
"connector"
|
|
45
|
+
]
|
|
46
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createPiece } from '@agnocon/pieces-framework';
|
|
2
|
+
import { PieceCategory } from '@agnocon/pieces-framework';
|
|
3
|
+
import { browserlessAuth } from './lib/common/auth';
|
|
4
|
+
import { captureScreenshot } from './lib/actions/capture-screenshot';
|
|
5
|
+
import { generatePdf } from './lib/actions/generate-pdf';
|
|
6
|
+
import { scrapeUrl } from './lib/actions/scrape-url';
|
|
7
|
+
import { runBqlQuery } from './lib/actions/run-bql-query';
|
|
8
|
+
import { getWebsitePerformance } from './lib/actions/get-website-performance';
|
|
9
|
+
|
|
10
|
+
export const browserless = createPiece({
|
|
11
|
+
displayName: 'Browserless',
|
|
12
|
+
minimumSupportedRelease: '0.36.1',
|
|
13
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/browserless.png',
|
|
14
|
+
categories: [PieceCategory.DEVELOPER_TOOLS],
|
|
15
|
+
description: 'Browserless is a headless browser automation tool that allows you to scrape websites, take screenshots, and more.',
|
|
16
|
+
authors: ['owuzo', 'onyedikachi-david'],
|
|
17
|
+
auth: browserlessAuth,
|
|
18
|
+
actions: [
|
|
19
|
+
captureScreenshot,
|
|
20
|
+
generatePdf,
|
|
21
|
+
scrapeUrl,
|
|
22
|
+
runBqlQuery,
|
|
23
|
+
getWebsitePerformance,
|
|
24
|
+
],
|
|
25
|
+
triggers: [],
|
|
26
|
+
});
|