scrapfly-sdk 0.10.5 → 0.11.0
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/esm/batch.d.ts.map +1 -1
- package/esm/batch.js +6 -0
- package/esm/browserconfig.d.ts +64 -0
- package/esm/browserconfig.d.ts.map +1 -1
- package/esm/browserconfig.js +116 -0
- package/esm/client.d.ts +135 -2
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +454 -12
- package/esm/crawlerconfig.d.ts +6 -2
- package/esm/crawlerconfig.d.ts.map +1 -1
- package/esm/crawlerconfig.js +33 -4
- package/esm/extractionconfig.js +1 -1
- package/esm/main.d.ts +3 -0
- package/esm/main.d.ts.map +1 -1
- package/esm/main.js +1 -0
- package/esm/schedule.d.ts +93 -0
- package/esm/schedule.d.ts.map +1 -0
- package/esm/schedule.js +40 -0
- package/esm/scrapeconfig.d.ts +1 -0
- package/esm/scrapeconfig.d.ts.map +1 -1
- package/esm/scrapeconfig.js +9 -5
- package/esm/types.d.ts +94 -0
- package/esm/types.d.ts.map +1 -1
- package/esm/utils.d.ts +1 -1
- package/esm/utils.d.ts.map +1 -1
- package/esm/webhookserver.d.ts +7 -3
- package/esm/webhookserver.d.ts.map +1 -1
- package/esm/webhookserver.js +13 -6
- package/package.json +1 -1
- package/script/batch.d.ts.map +1 -1
- package/script/batch.js +6 -0
- package/script/browserconfig.d.ts +64 -0
- package/script/browserconfig.d.ts.map +1 -1
- package/script/browserconfig.js +116 -0
- package/script/client.d.ts +135 -2
- package/script/client.d.ts.map +1 -1
- package/script/client.js +454 -12
- package/script/crawlerconfig.d.ts +6 -2
- package/script/crawlerconfig.d.ts.map +1 -1
- package/script/crawlerconfig.js +33 -4
- package/script/extractionconfig.js +1 -1
- package/script/main.d.ts +3 -0
- package/script/main.d.ts.map +1 -1
- package/script/main.js +3 -1
- package/script/schedule.d.ts +93 -0
- package/script/schedule.d.ts.map +1 -0
- package/script/schedule.js +44 -0
- package/script/scrapeconfig.d.ts +1 -0
- package/script/scrapeconfig.d.ts.map +1 -1
- package/script/scrapeconfig.js +9 -5
- package/script/types.d.ts +94 -0
- package/script/types.d.ts.map +1 -1
- package/script/utils.d.ts +1 -1
- package/script/utils.d.ts.map +1 -1
- package/script/webhookserver.d.ts +7 -3
- package/script/webhookserver.d.ts.map +1 -1
- package/script/webhookserver.js +13 -6
- package/src/batch.ts +7 -1
- package/src/browserconfig.ts +99 -0
- package/src/client.ts +592 -13
- package/src/crawlerconfig.ts +27 -6
- package/src/extractionconfig.ts +1 -1
- package/src/main.ts +11 -0
- package/src/schedule.ts +101 -0
- package/src/scrapeconfig.ts +4 -5
- package/src/types.ts +115 -0
- package/src/utils.ts +6 -1
- package/src/webhookserver.ts +13 -6
package/script/client.js
CHANGED
|
@@ -33,6 +33,7 @@ const result_js_1 = require("./result.js");
|
|
|
33
33
|
const logger_js_1 = require("./logger.js");
|
|
34
34
|
const crawlerresult_js_1 = require("./crawlerresult.js");
|
|
35
35
|
const monitoringconfig_js_1 = require("./monitoringconfig.js");
|
|
36
|
+
const schedule_js_1 = require("./schedule.js");
|
|
36
37
|
/**
|
|
37
38
|
* Main entry point for the Scrapfly SDK.
|
|
38
39
|
*
|
|
@@ -901,17 +902,53 @@ class ScrapflyClient {
|
|
|
901
902
|
try {
|
|
902
903
|
const url = new URL(this.HOST + '/crawl');
|
|
903
904
|
url.search = new URLSearchParams({ key: this.key }).toString();
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
905
|
+
// POST /crawl accepts two body formats:
|
|
906
|
+
// - application/json: the entire crawler configuration as JSON.
|
|
907
|
+
// Used for seed-URL crawls and remote_url_list crawls.
|
|
908
|
+
// - multipart/form-data: a 'config' JSON part and a 'urls' text
|
|
909
|
+
// part (one URL per line). Used only when the caller provides
|
|
910
|
+
// an in-memory url_list, so the URLs can be uploaded as a
|
|
911
|
+
// streamed file payload instead of inlined into the JSON body.
|
|
912
|
+
const params = config.toApiParams();
|
|
913
|
+
const urlList = Array.isArray(params.url_list) && params.url_list.length > 0
|
|
914
|
+
? params.url_list
|
|
915
|
+
: undefined;
|
|
916
|
+
if (urlList !== undefined) {
|
|
917
|
+
// Strip url_list from the JSON config — the URLs go through the
|
|
918
|
+
// 'urls' multipart part instead, which the API gateway streams
|
|
919
|
+
// straight through to the scrape engine.
|
|
920
|
+
delete params.url_list;
|
|
921
|
+
const form = new FormData();
|
|
922
|
+
const configBlob = new Blob([JSON.stringify(params)], { type: 'application/json' });
|
|
923
|
+
form.append('config', configBlob, 'config.json');
|
|
924
|
+
const urlsBlob = new Blob([urlList.join('\n')], { type: 'text/plain' });
|
|
925
|
+
form.append('urls', urlsBlob, 'urls.txt');
|
|
926
|
+
response = await this.fetch({
|
|
927
|
+
url: url.toString(),
|
|
928
|
+
method: 'POST',
|
|
929
|
+
headers: {
|
|
930
|
+
'user-agent': this.ua,
|
|
931
|
+
// Intentionally omit content-type — fetch fills in the
|
|
932
|
+
// multipart boundary itself when given a FormData body.
|
|
933
|
+
'accept-encoding': 'gzip, deflate, br',
|
|
934
|
+
accept: 'application/json',
|
|
935
|
+
},
|
|
936
|
+
body: form,
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
response = await this.fetch({
|
|
941
|
+
url: url.toString(),
|
|
942
|
+
method: 'POST',
|
|
943
|
+
headers: {
|
|
944
|
+
'user-agent': this.ua,
|
|
945
|
+
'content-type': 'application/json',
|
|
946
|
+
'accept-encoding': 'gzip, deflate, br',
|
|
947
|
+
accept: 'application/json',
|
|
948
|
+
},
|
|
949
|
+
body: JSON.stringify(params),
|
|
950
|
+
});
|
|
951
|
+
}
|
|
915
952
|
}
|
|
916
953
|
catch (e) {
|
|
917
954
|
logger_js_1.log.error('error', e);
|
|
@@ -1249,11 +1286,23 @@ class ScrapflyClient {
|
|
|
1249
1286
|
// --- Cloud Browser ---
|
|
1250
1287
|
/**
|
|
1251
1288
|
* Get the WebSocket URL for a Cloud Browser session.
|
|
1289
|
+
*
|
|
1290
|
+
* On rejection the server sends a JSON error frame then a close frame
|
|
1291
|
+
* with code 1008/1011/1013 and a "ERR::BROWSER::CODE: reason" string.
|
|
1292
|
+
* See https://scrapfly.io/docs/cloud-browser-api/errors#websocket-close-frame
|
|
1252
1293
|
*/
|
|
1253
1294
|
cloudBrowser(config) {
|
|
1254
1295
|
const browserConfig = config || new browserconfig_js_1.BrowserConfig();
|
|
1255
1296
|
return browserConfig.websocketUrl(this.key, this.cloudBrowserHost);
|
|
1256
1297
|
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Return the deterministic project salt for this client's api_key. Matches
|
|
1300
|
+
* the `X-Browser-Project-Salt` response header returned on a successful
|
|
1301
|
+
* Cloud Browser WebSocket upgrade.
|
|
1302
|
+
*/
|
|
1303
|
+
async cloudBrowserProjectSalt() {
|
|
1304
|
+
return browserconfig_js_1.BrowserConfig.projectSalt(this.key);
|
|
1305
|
+
}
|
|
1257
1306
|
/**
|
|
1258
1307
|
* Call the Cloud Browser Unblock API.
|
|
1259
1308
|
*/
|
|
@@ -1269,6 +1318,8 @@ class ScrapflyClient {
|
|
|
1269
1318
|
jsonBody.country = options.country;
|
|
1270
1319
|
if (options.os)
|
|
1271
1320
|
jsonBody.os = options.os;
|
|
1321
|
+
if (options.browser_brand)
|
|
1322
|
+
jsonBody.browser_brand = options.browser_brand;
|
|
1272
1323
|
if (options.timeout)
|
|
1273
1324
|
jsonBody.timeout = options.timeout;
|
|
1274
1325
|
if (options.browser_timeout)
|
|
@@ -1281,6 +1332,8 @@ class ScrapflyClient {
|
|
|
1281
1332
|
jsonBody.method = options.method;
|
|
1282
1333
|
if (options.enable_mcp !== undefined)
|
|
1283
1334
|
jsonBody.enable_mcp = options.enable_mcp;
|
|
1335
|
+
if (options.debug !== undefined)
|
|
1336
|
+
jsonBody.debug = options.debug;
|
|
1284
1337
|
const url = new URL(this.cloudBrowserApiHost + '/unblock');
|
|
1285
1338
|
url.searchParams.set('key', this.key);
|
|
1286
1339
|
const response = await this.fetch({
|
|
@@ -1412,6 +1465,251 @@ class ScrapflyClient {
|
|
|
1412
1465
|
}
|
|
1413
1466
|
return await response.json();
|
|
1414
1467
|
}
|
|
1468
|
+
// ----- Cloud Browser Credential Vault -------------------------------------
|
|
1469
|
+
// Server contract documented at apps/scrapfly/api/scrapfly-api/pkg/vault/.
|
|
1470
|
+
//
|
|
1471
|
+
// SECURITY: the vault key is the customer-held secret that decrypts every
|
|
1472
|
+
// item in the vault. The server emits it ONCE on POST /vault and POST
|
|
1473
|
+
// /vault/{id}/rotate; never log it, never include it in error messages,
|
|
1474
|
+
// never put it in a breadcrumb. See agent_secret_tokenization_boundary.md.
|
|
1475
|
+
/**
|
|
1476
|
+
* Create a new Cloud Browser Credential Vault. The response contains a
|
|
1477
|
+
* one-time `key` that the caller MUST save locally — the server cannot
|
|
1478
|
+
* recover it. Pair the key with the returned vault id when opening
|
|
1479
|
+
* sessions or creating items.
|
|
1480
|
+
*/
|
|
1481
|
+
async cloudBrowserVaultCreate(opts) {
|
|
1482
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault');
|
|
1483
|
+
url.searchParams.set('key', this.key);
|
|
1484
|
+
const body = { name: opts.name };
|
|
1485
|
+
if (opts.description !== undefined)
|
|
1486
|
+
body.description = opts.description;
|
|
1487
|
+
const response = await this.fetch({
|
|
1488
|
+
url: url.toString(),
|
|
1489
|
+
method: 'POST',
|
|
1490
|
+
headers: {
|
|
1491
|
+
'content-type': 'application/json',
|
|
1492
|
+
'user-agent': this.ua,
|
|
1493
|
+
},
|
|
1494
|
+
body: JSON.stringify(body),
|
|
1495
|
+
});
|
|
1496
|
+
if (!response.ok) {
|
|
1497
|
+
throw new Error(`Vault create failed: ${response.status} ${await response.text()}`);
|
|
1498
|
+
}
|
|
1499
|
+
return await response.json();
|
|
1500
|
+
}
|
|
1501
|
+
/** List every vault on the account. */
|
|
1502
|
+
async cloudBrowserVaultList() {
|
|
1503
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault');
|
|
1504
|
+
url.searchParams.set('key', this.key);
|
|
1505
|
+
const response = await this.fetch({
|
|
1506
|
+
url: url.toString(),
|
|
1507
|
+
method: 'GET',
|
|
1508
|
+
headers: { 'user-agent': this.ua },
|
|
1509
|
+
});
|
|
1510
|
+
if (!response.ok) {
|
|
1511
|
+
throw new Error(`Vault list failed: ${response.status} ${await response.text()}`);
|
|
1512
|
+
}
|
|
1513
|
+
const json = await response.json();
|
|
1514
|
+
return { vaults: json.vaults ?? [] };
|
|
1515
|
+
}
|
|
1516
|
+
/** Get a single vault by id. Does not return any secret material. */
|
|
1517
|
+
async cloudBrowserVaultGet(vaultId) {
|
|
1518
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId));
|
|
1519
|
+
url.searchParams.set('key', this.key);
|
|
1520
|
+
const response = await this.fetch({
|
|
1521
|
+
url: url.toString(),
|
|
1522
|
+
method: 'GET',
|
|
1523
|
+
headers: { 'user-agent': this.ua },
|
|
1524
|
+
});
|
|
1525
|
+
if (!response.ok) {
|
|
1526
|
+
throw new Error(`Vault get failed: ${response.status} ${await response.text()}`);
|
|
1527
|
+
}
|
|
1528
|
+
return await response.json();
|
|
1529
|
+
}
|
|
1530
|
+
/** Update vault metadata (name / description). Does not require the vault key. */
|
|
1531
|
+
async cloudBrowserVaultUpdate(vaultId, opts) {
|
|
1532
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId));
|
|
1533
|
+
url.searchParams.set('key', this.key);
|
|
1534
|
+
const body = {};
|
|
1535
|
+
if (opts.name !== undefined)
|
|
1536
|
+
body.name = opts.name;
|
|
1537
|
+
if (opts.description !== undefined)
|
|
1538
|
+
body.description = opts.description;
|
|
1539
|
+
const response = await this.fetch({
|
|
1540
|
+
url: url.toString(),
|
|
1541
|
+
method: 'PATCH',
|
|
1542
|
+
headers: {
|
|
1543
|
+
'content-type': 'application/json',
|
|
1544
|
+
'user-agent': this.ua,
|
|
1545
|
+
},
|
|
1546
|
+
body: JSON.stringify(body),
|
|
1547
|
+
});
|
|
1548
|
+
if (!response.ok) {
|
|
1549
|
+
throw new Error(`Vault update failed: ${response.status} ${await response.text()}`);
|
|
1550
|
+
}
|
|
1551
|
+
return await response.json();
|
|
1552
|
+
}
|
|
1553
|
+
/** Delete a vault and every item in it. Does not require the vault key. */
|
|
1554
|
+
async cloudBrowserVaultDelete(vaultId) {
|
|
1555
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId));
|
|
1556
|
+
url.searchParams.set('key', this.key);
|
|
1557
|
+
const response = await this.fetch({
|
|
1558
|
+
url: url.toString(),
|
|
1559
|
+
method: 'DELETE',
|
|
1560
|
+
headers: { 'user-agent': this.ua },
|
|
1561
|
+
});
|
|
1562
|
+
if (!response.ok) {
|
|
1563
|
+
throw new Error(`Vault delete failed: ${response.status} ${await response.text()}`);
|
|
1564
|
+
}
|
|
1565
|
+
const body = await response.json();
|
|
1566
|
+
return {
|
|
1567
|
+
success: body.success !== undefined ? Boolean(body.success) : true,
|
|
1568
|
+
message: typeof body.message === 'string' ? body.message : '',
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Rotate the vault key. The caller MUST pass the CURRENT key in
|
|
1573
|
+
* `currentVaultKey`; the server returns a fresh `key` exactly once. After
|
|
1574
|
+
* this call the old key cannot decrypt any row in the vault.
|
|
1575
|
+
*/
|
|
1576
|
+
async cloudBrowserVaultRotate(vaultId, currentVaultKey) {
|
|
1577
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId) + '/rotate');
|
|
1578
|
+
url.searchParams.set('key', this.key);
|
|
1579
|
+
const response = await this.fetch({
|
|
1580
|
+
url: url.toString(),
|
|
1581
|
+
method: 'POST',
|
|
1582
|
+
headers: {
|
|
1583
|
+
'user-agent': this.ua,
|
|
1584
|
+
'X-Vault-Key': currentVaultKey,
|
|
1585
|
+
},
|
|
1586
|
+
});
|
|
1587
|
+
if (!response.ok) {
|
|
1588
|
+
// Body may include the X-Vault-Key error message — safe to surface
|
|
1589
|
+
// because the server message names the header but not its value.
|
|
1590
|
+
throw new Error(`Vault rotate failed: ${response.status} ${await response.text()}`);
|
|
1591
|
+
}
|
|
1592
|
+
return await response.json();
|
|
1593
|
+
}
|
|
1594
|
+
/** List items in a vault. Items carry only opaque ciphertext, no plaintext. */
|
|
1595
|
+
async cloudBrowserVaultItemList(vaultId) {
|
|
1596
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId) + '/item');
|
|
1597
|
+
url.searchParams.set('key', this.key);
|
|
1598
|
+
const response = await this.fetch({
|
|
1599
|
+
url: url.toString(),
|
|
1600
|
+
method: 'GET',
|
|
1601
|
+
headers: { 'user-agent': this.ua },
|
|
1602
|
+
});
|
|
1603
|
+
if (!response.ok) {
|
|
1604
|
+
throw new Error(`Vault item list failed: ${response.status} ${await response.text()}`);
|
|
1605
|
+
}
|
|
1606
|
+
const json = await response.json();
|
|
1607
|
+
return { items: json.items ?? [] };
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Add a credential to a vault. Requires the vault key in the X-Vault-Key
|
|
1611
|
+
* header so the server can encrypt the secret payload at rest.
|
|
1612
|
+
*/
|
|
1613
|
+
async cloudBrowserVaultItemCreate(vaultId, vaultKey, item) {
|
|
1614
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId) + '/item');
|
|
1615
|
+
url.searchParams.set('key', this.key);
|
|
1616
|
+
const body = {
|
|
1617
|
+
type: item.type,
|
|
1618
|
+
label: item.label,
|
|
1619
|
+
origin: item.origin,
|
|
1620
|
+
secret: item.secret,
|
|
1621
|
+
};
|
|
1622
|
+
if (item.username !== undefined)
|
|
1623
|
+
body.username = item.username;
|
|
1624
|
+
if (item.metadata !== undefined)
|
|
1625
|
+
body.metadata = item.metadata;
|
|
1626
|
+
const response = await this.fetch({
|
|
1627
|
+
url: url.toString(),
|
|
1628
|
+
method: 'POST',
|
|
1629
|
+
headers: {
|
|
1630
|
+
'content-type': 'application/json',
|
|
1631
|
+
'user-agent': this.ua,
|
|
1632
|
+
'X-Vault-Key': vaultKey,
|
|
1633
|
+
},
|
|
1634
|
+
body: JSON.stringify(body),
|
|
1635
|
+
});
|
|
1636
|
+
if (!response.ok) {
|
|
1637
|
+
throw new Error(`Vault item create failed: ${response.status} ${await response.text()}`);
|
|
1638
|
+
}
|
|
1639
|
+
return await response.json();
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Patch an item's metadata or rotate its secret. The server only requires
|
|
1643
|
+
* X-Vault-Key when `secret` is supplied (ciphertext rotation). Passing
|
|
1644
|
+
* `vaultKey` without `secret` is a no-op on the server side and is allowed
|
|
1645
|
+
* for caller convenience.
|
|
1646
|
+
*/
|
|
1647
|
+
async cloudBrowserVaultItemUpdate(vaultId, itemId, opts) {
|
|
1648
|
+
if (opts.secret !== undefined && (opts.vaultKey === undefined || opts.vaultKey === '')) {
|
|
1649
|
+
throw new Error('cloudBrowserVaultItemUpdate: vaultKey is required when rotating the item secret');
|
|
1650
|
+
}
|
|
1651
|
+
if (opts.secret !== undefined && opts.type === undefined) {
|
|
1652
|
+
throw new Error('cloudBrowserVaultItemUpdate: type is required when rotating the item secret');
|
|
1653
|
+
}
|
|
1654
|
+
const url = new URL(this.cloudBrowserApiHost +
|
|
1655
|
+
'/vault/' +
|
|
1656
|
+
encodeURIComponent(vaultId) +
|
|
1657
|
+
'/item/' +
|
|
1658
|
+
encodeURIComponent(itemId));
|
|
1659
|
+
url.searchParams.set('key', this.key);
|
|
1660
|
+
const body = {};
|
|
1661
|
+
if (opts.type !== undefined)
|
|
1662
|
+
body.type = opts.type;
|
|
1663
|
+
if (opts.label !== undefined)
|
|
1664
|
+
body.label = opts.label;
|
|
1665
|
+
if (opts.origin !== undefined)
|
|
1666
|
+
body.origin = opts.origin;
|
|
1667
|
+
if (opts.username !== undefined)
|
|
1668
|
+
body.username = opts.username;
|
|
1669
|
+
if (opts.metadata !== undefined)
|
|
1670
|
+
body.metadata = opts.metadata;
|
|
1671
|
+
if (opts.secret !== undefined)
|
|
1672
|
+
body.secret = opts.secret;
|
|
1673
|
+
const headers = {
|
|
1674
|
+
'content-type': 'application/json',
|
|
1675
|
+
'user-agent': this.ua,
|
|
1676
|
+
};
|
|
1677
|
+
if (opts.vaultKey !== undefined && opts.vaultKey !== '') {
|
|
1678
|
+
headers['X-Vault-Key'] = opts.vaultKey;
|
|
1679
|
+
}
|
|
1680
|
+
const response = await this.fetch({
|
|
1681
|
+
url: url.toString(),
|
|
1682
|
+
method: 'PATCH',
|
|
1683
|
+
headers,
|
|
1684
|
+
body: JSON.stringify(body),
|
|
1685
|
+
});
|
|
1686
|
+
if (!response.ok) {
|
|
1687
|
+
throw new Error(`Vault item update failed: ${response.status} ${await response.text()}`);
|
|
1688
|
+
}
|
|
1689
|
+
return await response.json();
|
|
1690
|
+
}
|
|
1691
|
+
/** Delete a single vault item. Does not require the vault key. */
|
|
1692
|
+
async cloudBrowserVaultItemDelete(vaultId, itemId) {
|
|
1693
|
+
const url = new URL(this.cloudBrowserApiHost +
|
|
1694
|
+
'/vault/' +
|
|
1695
|
+
encodeURIComponent(vaultId) +
|
|
1696
|
+
'/item/' +
|
|
1697
|
+
encodeURIComponent(itemId));
|
|
1698
|
+
url.searchParams.set('key', this.key);
|
|
1699
|
+
const response = await this.fetch({
|
|
1700
|
+
url: url.toString(),
|
|
1701
|
+
method: 'DELETE',
|
|
1702
|
+
headers: { 'user-agent': this.ua },
|
|
1703
|
+
});
|
|
1704
|
+
if (!response.ok) {
|
|
1705
|
+
throw new Error(`Vault item delete failed: ${response.status} ${await response.text()}`);
|
|
1706
|
+
}
|
|
1707
|
+
const body = await response.json();
|
|
1708
|
+
return {
|
|
1709
|
+
success: body.success !== undefined ? Boolean(body.success) : true,
|
|
1710
|
+
message: typeof body.message === 'string' ? body.message : '',
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1415
1713
|
/**
|
|
1416
1714
|
* Download a debug session recording video.
|
|
1417
1715
|
* Returns the video as an ArrayBuffer (stream from server).
|
|
@@ -1431,7 +1729,9 @@ class ScrapflyClient {
|
|
|
1431
1729
|
return { data: await response.arrayBuffer(), filename };
|
|
1432
1730
|
}
|
|
1433
1731
|
/**
|
|
1434
|
-
* Get playback info for a debug session recording.
|
|
1732
|
+
* Get playback info for a debug session recording. The returned object
|
|
1733
|
+
* carries `available`, `status` ('ready' | 'uploading' | 'unavailable' |
|
|
1734
|
+
* 'disabled'), `metadata`, `video_url`, and `retry_after_ms`.
|
|
1435
1735
|
*/
|
|
1436
1736
|
async cloudBrowserPlayback(runId) {
|
|
1437
1737
|
const url = new URL(this.cloudBrowserApiHost + '/run/' + runId + '/playback');
|
|
@@ -1446,6 +1746,27 @@ class ScrapflyClient {
|
|
|
1446
1746
|
}
|
|
1447
1747
|
return await response.json();
|
|
1448
1748
|
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Poll the playback endpoint until the recording resolves to a terminal
|
|
1751
|
+
* state ('ready' or 'unavailable') or the timeout elapses. Honours the
|
|
1752
|
+
* server-side retry_after_ms hint when present.
|
|
1753
|
+
*/
|
|
1754
|
+
async cloudBrowserWaitForPlayback(runId, opts = {}) {
|
|
1755
|
+
const timeoutMs = opts.timeoutMs ?? 180_000;
|
|
1756
|
+
const fallbackMs = opts.pollIntervalFallbackMs ?? 3_000;
|
|
1757
|
+
const deadline = Date.now() + timeoutMs;
|
|
1758
|
+
while (true) {
|
|
1759
|
+
const playback = await this.cloudBrowserPlayback(runId);
|
|
1760
|
+
if (playback.status !== 'uploading')
|
|
1761
|
+
return playback;
|
|
1762
|
+
const remaining = deadline - Date.now();
|
|
1763
|
+
if (remaining <= 0)
|
|
1764
|
+
return playback;
|
|
1765
|
+
const retryAfter = Number(playback.retry_after_ms) || fallbackMs;
|
|
1766
|
+
const sleepFor = Math.min(retryAfter, remaining);
|
|
1767
|
+
await new Promise((resolve) => setTimeout(resolve, sleepFor));
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1449
1770
|
/**
|
|
1450
1771
|
* List all running Cloud Browser sessions.
|
|
1451
1772
|
*/
|
|
@@ -1462,6 +1783,127 @@ class ScrapflyClient {
|
|
|
1462
1783
|
}
|
|
1463
1784
|
return await response.json();
|
|
1464
1785
|
}
|
|
1786
|
+
// -------------------------------------------------------------------------
|
|
1787
|
+
// Public schedule endpoints — /scrape/schedules, /screenshot/schedules,
|
|
1788
|
+
// /crawl/schedules, /schedules. The kind-specific config is supplied to the
|
|
1789
|
+
// matching `create*Schedule` method; the cross-kind list/get/update/delete/
|
|
1790
|
+
// pause/resume/execute methods work regardless of kind.
|
|
1791
|
+
// -------------------------------------------------------------------------
|
|
1792
|
+
/** Create a Web Scraping API schedule. `scrape_config` is the same shape
|
|
1793
|
+
* accepted by `/scrape` (e.g. `{ url, render_js, asp, ... }`). */
|
|
1794
|
+
async createScrapeSchedule(scrapeConfig, request) {
|
|
1795
|
+
return await this.scheduleRequest('POST', '/scrape/schedules', undefined, this.buildCreateBody('scrape_config', scrapeConfig, request));
|
|
1796
|
+
}
|
|
1797
|
+
/** Create a Screenshot API schedule. */
|
|
1798
|
+
async createScreenshotSchedule(screenshotConfig, request) {
|
|
1799
|
+
return await this.scheduleRequest('POST', '/screenshot/schedules', undefined, this.buildCreateBody('screenshot_config', screenshotConfig, request));
|
|
1800
|
+
}
|
|
1801
|
+
/** Create a Crawler API schedule. */
|
|
1802
|
+
async createCrawlerSchedule(crawlerConfig, request) {
|
|
1803
|
+
return await this.scheduleRequest('POST', '/crawl/schedules', undefined, this.buildCreateBody('crawler_config', crawlerConfig, request));
|
|
1804
|
+
}
|
|
1805
|
+
/** Return a schedule by id. Works across all kinds. */
|
|
1806
|
+
async getSchedule(id) {
|
|
1807
|
+
return await this.scheduleRequest('GET', `/schedules/${encodeURIComponent(id)}`);
|
|
1808
|
+
}
|
|
1809
|
+
/** List every schedule on the account, optionally filtered by kind/status. */
|
|
1810
|
+
async listSchedules(opts) {
|
|
1811
|
+
return await this.scheduleRequest('GET', '/schedules', opts);
|
|
1812
|
+
}
|
|
1813
|
+
async listScrapeSchedules(opts) {
|
|
1814
|
+
return await this.scheduleRequest('GET', '/scrape/schedules', opts);
|
|
1815
|
+
}
|
|
1816
|
+
async listScreenshotSchedules(opts) {
|
|
1817
|
+
return await this.scheduleRequest('GET', '/screenshot/schedules', opts);
|
|
1818
|
+
}
|
|
1819
|
+
async listCrawlerSchedules(opts) {
|
|
1820
|
+
return await this.scheduleRequest('GET', '/crawl/schedules', opts);
|
|
1821
|
+
}
|
|
1822
|
+
/** Patch an active schedule. Only fields set in `request` change. */
|
|
1823
|
+
async updateSchedule(id, request) {
|
|
1824
|
+
return await this.scheduleRequest('PATCH', `/schedules/${encodeURIComponent(id)}`, undefined, request);
|
|
1825
|
+
}
|
|
1826
|
+
/** Cancel a schedule. Cancellation is terminal (returns no body). */
|
|
1827
|
+
async cancelSchedule(id) {
|
|
1828
|
+
await this.scheduleRequest('DELETE', `/schedules/${encodeURIComponent(id)}`);
|
|
1829
|
+
}
|
|
1830
|
+
async pauseSchedule(id) {
|
|
1831
|
+
return await this.scheduleRequest('POST', `/schedules/${encodeURIComponent(id)}/pause`);
|
|
1832
|
+
}
|
|
1833
|
+
async resumeSchedule(id) {
|
|
1834
|
+
return await this.scheduleRequest('POST', `/schedules/${encodeURIComponent(id)}/resume`);
|
|
1835
|
+
}
|
|
1836
|
+
/** Fire a schedule immediately, regardless of next_scheduled_date. */
|
|
1837
|
+
async executeSchedule(id) {
|
|
1838
|
+
return await this.scheduleRequest('POST', `/schedules/${encodeURIComponent(id)}/execute`);
|
|
1839
|
+
}
|
|
1840
|
+
buildCreateBody(configKey, config, request) {
|
|
1841
|
+
const body = {
|
|
1842
|
+
[configKey]: config,
|
|
1843
|
+
webhook_name: request.webhook_name,
|
|
1844
|
+
allow_concurrency: request.allow_concurrency ?? false,
|
|
1845
|
+
retry_on_failure: request.retry_on_failure ?? false,
|
|
1846
|
+
};
|
|
1847
|
+
if (request.recurrence)
|
|
1848
|
+
body.recurrence = request.recurrence;
|
|
1849
|
+
if (request.scheduled_date)
|
|
1850
|
+
body.scheduled_date = request.scheduled_date;
|
|
1851
|
+
if (typeof request.max_retries === 'number')
|
|
1852
|
+
body.max_retries = request.max_retries;
|
|
1853
|
+
if (request.notes)
|
|
1854
|
+
body.notes = request.notes;
|
|
1855
|
+
return body;
|
|
1856
|
+
}
|
|
1857
|
+
async scheduleRequest(method, path, query, body) {
|
|
1858
|
+
const url = new URL(this.HOST + path);
|
|
1859
|
+
const params = new URLSearchParams();
|
|
1860
|
+
params.set('key', this.key);
|
|
1861
|
+
if (query) {
|
|
1862
|
+
for (const [k, v] of Object.entries(query)) {
|
|
1863
|
+
if (v !== undefined && v !== '')
|
|
1864
|
+
params.set(k, v);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
url.search = params.toString();
|
|
1868
|
+
const init = {
|
|
1869
|
+
url: url.toString(),
|
|
1870
|
+
method,
|
|
1871
|
+
headers: {
|
|
1872
|
+
'user-agent': this.ua,
|
|
1873
|
+
accept: 'application/json',
|
|
1874
|
+
},
|
|
1875
|
+
};
|
|
1876
|
+
if (body !== undefined) {
|
|
1877
|
+
init.body = JSON.stringify(body);
|
|
1878
|
+
init.headers['content-type'] = 'application/json';
|
|
1879
|
+
}
|
|
1880
|
+
const response = await this.fetch(init);
|
|
1881
|
+
if (response.status === 204)
|
|
1882
|
+
return undefined;
|
|
1883
|
+
if (!response.ok) {
|
|
1884
|
+
let envelope = {};
|
|
1885
|
+
try {
|
|
1886
|
+
envelope = await response.json();
|
|
1887
|
+
}
|
|
1888
|
+
catch {
|
|
1889
|
+
// body wasn't JSON; fall through with the empty envelope
|
|
1890
|
+
}
|
|
1891
|
+
const code = envelope.error ?? 'ERR::SCHEDULER::BACKEND_ERROR';
|
|
1892
|
+
let message = envelope.message ?? '';
|
|
1893
|
+
if (envelope.reason) {
|
|
1894
|
+
message = message ? `${message} (${envelope.reason})` : envelope.reason;
|
|
1895
|
+
}
|
|
1896
|
+
if (!message)
|
|
1897
|
+
message = `HTTP ${response.status}`;
|
|
1898
|
+
throw new schedule_js_1.ScheduleAPIError({
|
|
1899
|
+
code,
|
|
1900
|
+
message,
|
|
1901
|
+
httpStatusCode: response.status,
|
|
1902
|
+
details: envelope.details,
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
return await response.json();
|
|
1906
|
+
}
|
|
1465
1907
|
}
|
|
1466
1908
|
exports.ScrapflyClient = ScrapflyClient;
|
|
1467
1909
|
// ---------------------------------------------------------------------------
|
|
@@ -25,7 +25,9 @@ export type CrawlerWebhookEventName = 'crawler_started' | 'crawler_url_visited'
|
|
|
25
25
|
* which lets the server apply its documented defaults (e.g. `respect_robots_txt=true`).
|
|
26
26
|
*/
|
|
27
27
|
export type CrawlerConfigOptions = {
|
|
28
|
-
url
|
|
28
|
+
url?: string;
|
|
29
|
+
url_list?: string[];
|
|
30
|
+
remote_url_list?: string;
|
|
29
31
|
page_limit?: number;
|
|
30
32
|
max_depth?: number;
|
|
31
33
|
max_duration?: number;
|
|
@@ -72,7 +74,9 @@ export type CrawlerConfigOptions = {
|
|
|
72
74
|
* ```
|
|
73
75
|
*/
|
|
74
76
|
export declare class CrawlerConfig {
|
|
75
|
-
url
|
|
77
|
+
url?: string;
|
|
78
|
+
url_list?: string[];
|
|
79
|
+
remote_url_list?: string;
|
|
76
80
|
page_limit?: number;
|
|
77
81
|
max_depth?: number;
|
|
78
82
|
max_duration?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crawlerconfig.d.ts","sourceRoot":"","sources":["../src/crawlerconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,M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
46
46
|
});
|
|
47
|
+
Object.defineProperty(this, "url_list", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
value: void 0
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(this, "remote_url_list", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true,
|
|
57
|
+
value: void 0
|
|
58
|
+
});
|
|
47
59
|
Object.defineProperty(this, "page_limit", {
|
|
48
60
|
enumerable: true,
|
|
49
61
|
configurable: true,
|
|
@@ -219,10 +231,22 @@ class CrawlerConfig {
|
|
|
219
231
|
value: void 0
|
|
220
232
|
});
|
|
221
233
|
this.validateOptions(options);
|
|
222
|
-
|
|
223
|
-
|
|
234
|
+
const hasSeed = typeof options.url === 'string' && options.url.trim() !== '';
|
|
235
|
+
const hasList = Array.isArray(options.url_list) && options.url_list.length > 0;
|
|
236
|
+
const hasRemote = typeof options.remote_url_list === 'string' && options.remote_url_list.trim() !== '';
|
|
237
|
+
const sourceCount = (hasSeed ? 1 : 0) + (hasList ? 1 : 0) + (hasRemote ? 1 : 0);
|
|
238
|
+
if (sourceCount === 0) {
|
|
239
|
+
throw new errors_js_1.CrawlerConfigError('Provide one of: url, url_list, remote_url_list');
|
|
240
|
+
}
|
|
241
|
+
if (sourceCount > 1) {
|
|
242
|
+
throw new errors_js_1.CrawlerConfigError('Only one of url, url_list, remote_url_list can be set');
|
|
224
243
|
}
|
|
225
|
-
|
|
244
|
+
if (hasSeed)
|
|
245
|
+
this.url = options.url;
|
|
246
|
+
if (hasList)
|
|
247
|
+
this.url_list = options.url_list;
|
|
248
|
+
if (hasRemote)
|
|
249
|
+
this.remote_url_list = options.remote_url_list;
|
|
226
250
|
// Mutually exclusive path filters
|
|
227
251
|
if (options.exclude_paths && options.include_only_paths) {
|
|
228
252
|
throw new errors_js_1.CrawlerConfigError('exclude_paths and include_only_paths are mutually exclusive');
|
|
@@ -311,6 +335,8 @@ class CrawlerConfig {
|
|
|
311
335
|
validateOptions(options) {
|
|
312
336
|
const validKeys = new Set([
|
|
313
337
|
'url',
|
|
338
|
+
'url_list',
|
|
339
|
+
'remote_url_list',
|
|
314
340
|
'page_limit',
|
|
315
341
|
'max_depth',
|
|
316
342
|
'max_duration',
|
|
@@ -358,8 +384,11 @@ class CrawlerConfig {
|
|
|
358
384
|
* defaults (e.g. `respect_robots_txt=true`).
|
|
359
385
|
*/
|
|
360
386
|
toApiParams() {
|
|
361
|
-
const params = {
|
|
387
|
+
const params = {};
|
|
362
388
|
const fields = [
|
|
389
|
+
'url',
|
|
390
|
+
'url_list',
|
|
391
|
+
'remote_url_list',
|
|
363
392
|
'page_limit',
|
|
364
393
|
'max_depth',
|
|
365
394
|
'max_duration',
|
|
@@ -209,7 +209,7 @@ class ExtractionConfig {
|
|
|
209
209
|
throw new errors_js_1.ExtractionConfigError('You cannot pass both parameters extraction_template and extraction_ephemeral_template. You must choose');
|
|
210
210
|
}
|
|
211
211
|
if (this.extraction_template) {
|
|
212
|
-
params.extraction_template = this.extraction_template;
|
|
212
|
+
params.extraction_template = 'persistent:' + this.extraction_template;
|
|
213
213
|
}
|
|
214
214
|
if (this.extraction_ephemeral_template) {
|
|
215
215
|
params.extraction_template = 'ephemeral:' + (0, utils_js_1.urlsafe_b64encode)(JSON.stringify(this.extraction_ephemeral_template));
|
package/script/main.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export { Format as ScreenshotFormat, Options as ScreenshotOptions, ScreenshotCon
|
|
|
30
30
|
export { ExtractionConfig } from './extractionconfig.js';
|
|
31
31
|
export { BrowserConfig, ProxyPool, OperatingSystem } from './browserconfig.js';
|
|
32
32
|
export type { BrowserConfigOptions } from './browserconfig.js';
|
|
33
|
+
export type { Vault, VaultItem, VaultItemCreate, VaultItemType, VaultSecret } from './types.js';
|
|
33
34
|
/** Namespace of every error class the SDK can throw. See {@link ScrapflyError}. */
|
|
34
35
|
export * as errors from './errors.js';
|
|
35
36
|
export { ExtractionResult, ScrapeResult, ScreenshotResult } from './result.js';
|
|
@@ -40,6 +41,8 @@ export { Crawl } from './crawl.js';
|
|
|
40
41
|
export { CrawlerArtifact, CrawlerContents, CrawlerStatus, CrawlerUrls, parseCrawlerWebhook, } from './crawlerresult.js';
|
|
41
42
|
export type { CrawlerArtifactType, CrawlerLifecycleWebhook, CrawlerState, CrawlerStatusValue, CrawlerStopReason, CrawlerUrlDiscoveredWebhook, CrawlerUrlEntry, CrawlerUrlFailedWebhook, CrawlerUrlSkippedWebhook, CrawlerUrlVisitedWebhook, CrawlerWebhookCommon, CrawlerWebhookPayload, } from './crawlerresult.js';
|
|
42
43
|
export type { CloudBrowserMonitoringOptions, MonitoringAggregation, MonitoringDataFormat, MonitoringMetricsOptions, MonitoringPeriod, MonitoringTargetMetricsOptions, } from './monitoringconfig.js';
|
|
44
|
+
export { ScheduleAPIError } from './schedule.js';
|
|
45
|
+
export type { CreateScheduleRequest, ListSchedulesOptions, Schedule, ScheduleEnd, ScheduleRecurrence, UpdateScheduleRequest, } from './schedule.js';
|
|
43
46
|
export { log } from './logger.js';
|
|
44
47
|
export { createServer, verifySignature } from './webhookserver.js';
|
|
45
48
|
//# sourceMappingURL=main.d.ts.map
|
package/script/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,MAAM,IAAI,YAAY,EACtB,YAAY,IAAI,mBAAmB,EACnC,YAAY,EACZ,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,MAAM,IAAI,gBAAgB,EAC1B,OAAO,IAAI,iBAAiB,EAC5B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAA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