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/esm/client.js
CHANGED
|
@@ -7,6 +7,7 @@ import { ExtractionResult, ScrapeResult, ScreenshotResult } from './result.js';
|
|
|
7
7
|
import { log } from './logger.js';
|
|
8
8
|
import { CrawlerArtifact, CrawlerContents, CrawlerStatus, CrawlerUrls } from './crawlerresult.js';
|
|
9
9
|
import { formatMonitoringDate, } from './monitoringconfig.js';
|
|
10
|
+
import { ScheduleAPIError, } from './schedule.js';
|
|
10
11
|
/**
|
|
11
12
|
* Main entry point for the Scrapfly SDK.
|
|
12
13
|
*
|
|
@@ -875,17 +876,53 @@ export class ScrapflyClient {
|
|
|
875
876
|
try {
|
|
876
877
|
const url = new URL(this.HOST + '/crawl');
|
|
877
878
|
url.search = new URLSearchParams({ key: this.key }).toString();
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
879
|
+
// POST /crawl accepts two body formats:
|
|
880
|
+
// - application/json: the entire crawler configuration as JSON.
|
|
881
|
+
// Used for seed-URL crawls and remote_url_list crawls.
|
|
882
|
+
// - multipart/form-data: a 'config' JSON part and a 'urls' text
|
|
883
|
+
// part (one URL per line). Used only when the caller provides
|
|
884
|
+
// an in-memory url_list, so the URLs can be uploaded as a
|
|
885
|
+
// streamed file payload instead of inlined into the JSON body.
|
|
886
|
+
const params = config.toApiParams();
|
|
887
|
+
const urlList = Array.isArray(params.url_list) && params.url_list.length > 0
|
|
888
|
+
? params.url_list
|
|
889
|
+
: undefined;
|
|
890
|
+
if (urlList !== undefined) {
|
|
891
|
+
// Strip url_list from the JSON config — the URLs go through the
|
|
892
|
+
// 'urls' multipart part instead, which the API gateway streams
|
|
893
|
+
// straight through to the scrape engine.
|
|
894
|
+
delete params.url_list;
|
|
895
|
+
const form = new FormData();
|
|
896
|
+
const configBlob = new Blob([JSON.stringify(params)], { type: 'application/json' });
|
|
897
|
+
form.append('config', configBlob, 'config.json');
|
|
898
|
+
const urlsBlob = new Blob([urlList.join('\n')], { type: 'text/plain' });
|
|
899
|
+
form.append('urls', urlsBlob, 'urls.txt');
|
|
900
|
+
response = await this.fetch({
|
|
901
|
+
url: url.toString(),
|
|
902
|
+
method: 'POST',
|
|
903
|
+
headers: {
|
|
904
|
+
'user-agent': this.ua,
|
|
905
|
+
// Intentionally omit content-type — fetch fills in the
|
|
906
|
+
// multipart boundary itself when given a FormData body.
|
|
907
|
+
'accept-encoding': 'gzip, deflate, br',
|
|
908
|
+
accept: 'application/json',
|
|
909
|
+
},
|
|
910
|
+
body: form,
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
response = await this.fetch({
|
|
915
|
+
url: url.toString(),
|
|
916
|
+
method: 'POST',
|
|
917
|
+
headers: {
|
|
918
|
+
'user-agent': this.ua,
|
|
919
|
+
'content-type': 'application/json',
|
|
920
|
+
'accept-encoding': 'gzip, deflate, br',
|
|
921
|
+
accept: 'application/json',
|
|
922
|
+
},
|
|
923
|
+
body: JSON.stringify(params),
|
|
924
|
+
});
|
|
925
|
+
}
|
|
889
926
|
}
|
|
890
927
|
catch (e) {
|
|
891
928
|
log.error('error', e);
|
|
@@ -1223,11 +1260,23 @@ export class ScrapflyClient {
|
|
|
1223
1260
|
// --- Cloud Browser ---
|
|
1224
1261
|
/**
|
|
1225
1262
|
* Get the WebSocket URL for a Cloud Browser session.
|
|
1263
|
+
*
|
|
1264
|
+
* On rejection the server sends a JSON error frame then a close frame
|
|
1265
|
+
* with code 1008/1011/1013 and a "ERR::BROWSER::CODE: reason" string.
|
|
1266
|
+
* See https://scrapfly.io/docs/cloud-browser-api/errors#websocket-close-frame
|
|
1226
1267
|
*/
|
|
1227
1268
|
cloudBrowser(config) {
|
|
1228
1269
|
const browserConfig = config || new BrowserConfig();
|
|
1229
1270
|
return browserConfig.websocketUrl(this.key, this.cloudBrowserHost);
|
|
1230
1271
|
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Return the deterministic project salt for this client's api_key. Matches
|
|
1274
|
+
* the `X-Browser-Project-Salt` response header returned on a successful
|
|
1275
|
+
* Cloud Browser WebSocket upgrade.
|
|
1276
|
+
*/
|
|
1277
|
+
async cloudBrowserProjectSalt() {
|
|
1278
|
+
return BrowserConfig.projectSalt(this.key);
|
|
1279
|
+
}
|
|
1231
1280
|
/**
|
|
1232
1281
|
* Call the Cloud Browser Unblock API.
|
|
1233
1282
|
*/
|
|
@@ -1243,6 +1292,8 @@ export class ScrapflyClient {
|
|
|
1243
1292
|
jsonBody.country = options.country;
|
|
1244
1293
|
if (options.os)
|
|
1245
1294
|
jsonBody.os = options.os;
|
|
1295
|
+
if (options.browser_brand)
|
|
1296
|
+
jsonBody.browser_brand = options.browser_brand;
|
|
1246
1297
|
if (options.timeout)
|
|
1247
1298
|
jsonBody.timeout = options.timeout;
|
|
1248
1299
|
if (options.browser_timeout)
|
|
@@ -1255,6 +1306,8 @@ export class ScrapflyClient {
|
|
|
1255
1306
|
jsonBody.method = options.method;
|
|
1256
1307
|
if (options.enable_mcp !== undefined)
|
|
1257
1308
|
jsonBody.enable_mcp = options.enable_mcp;
|
|
1309
|
+
if (options.debug !== undefined)
|
|
1310
|
+
jsonBody.debug = options.debug;
|
|
1258
1311
|
const url = new URL(this.cloudBrowserApiHost + '/unblock');
|
|
1259
1312
|
url.searchParams.set('key', this.key);
|
|
1260
1313
|
const response = await this.fetch({
|
|
@@ -1386,6 +1439,251 @@ export class ScrapflyClient {
|
|
|
1386
1439
|
}
|
|
1387
1440
|
return await response.json();
|
|
1388
1441
|
}
|
|
1442
|
+
// ----- Cloud Browser Credential Vault -------------------------------------
|
|
1443
|
+
// Server contract documented at apps/scrapfly/api/scrapfly-api/pkg/vault/.
|
|
1444
|
+
//
|
|
1445
|
+
// SECURITY: the vault key is the customer-held secret that decrypts every
|
|
1446
|
+
// item in the vault. The server emits it ONCE on POST /vault and POST
|
|
1447
|
+
// /vault/{id}/rotate; never log it, never include it in error messages,
|
|
1448
|
+
// never put it in a breadcrumb. See agent_secret_tokenization_boundary.md.
|
|
1449
|
+
/**
|
|
1450
|
+
* Create a new Cloud Browser Credential Vault. The response contains a
|
|
1451
|
+
* one-time `key` that the caller MUST save locally — the server cannot
|
|
1452
|
+
* recover it. Pair the key with the returned vault id when opening
|
|
1453
|
+
* sessions or creating items.
|
|
1454
|
+
*/
|
|
1455
|
+
async cloudBrowserVaultCreate(opts) {
|
|
1456
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault');
|
|
1457
|
+
url.searchParams.set('key', this.key);
|
|
1458
|
+
const body = { name: opts.name };
|
|
1459
|
+
if (opts.description !== undefined)
|
|
1460
|
+
body.description = opts.description;
|
|
1461
|
+
const response = await this.fetch({
|
|
1462
|
+
url: url.toString(),
|
|
1463
|
+
method: 'POST',
|
|
1464
|
+
headers: {
|
|
1465
|
+
'content-type': 'application/json',
|
|
1466
|
+
'user-agent': this.ua,
|
|
1467
|
+
},
|
|
1468
|
+
body: JSON.stringify(body),
|
|
1469
|
+
});
|
|
1470
|
+
if (!response.ok) {
|
|
1471
|
+
throw new Error(`Vault create failed: ${response.status} ${await response.text()}`);
|
|
1472
|
+
}
|
|
1473
|
+
return await response.json();
|
|
1474
|
+
}
|
|
1475
|
+
/** List every vault on the account. */
|
|
1476
|
+
async cloudBrowserVaultList() {
|
|
1477
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault');
|
|
1478
|
+
url.searchParams.set('key', this.key);
|
|
1479
|
+
const response = await this.fetch({
|
|
1480
|
+
url: url.toString(),
|
|
1481
|
+
method: 'GET',
|
|
1482
|
+
headers: { 'user-agent': this.ua },
|
|
1483
|
+
});
|
|
1484
|
+
if (!response.ok) {
|
|
1485
|
+
throw new Error(`Vault list failed: ${response.status} ${await response.text()}`);
|
|
1486
|
+
}
|
|
1487
|
+
const json = await response.json();
|
|
1488
|
+
return { vaults: json.vaults ?? [] };
|
|
1489
|
+
}
|
|
1490
|
+
/** Get a single vault by id. Does not return any secret material. */
|
|
1491
|
+
async cloudBrowserVaultGet(vaultId) {
|
|
1492
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId));
|
|
1493
|
+
url.searchParams.set('key', this.key);
|
|
1494
|
+
const response = await this.fetch({
|
|
1495
|
+
url: url.toString(),
|
|
1496
|
+
method: 'GET',
|
|
1497
|
+
headers: { 'user-agent': this.ua },
|
|
1498
|
+
});
|
|
1499
|
+
if (!response.ok) {
|
|
1500
|
+
throw new Error(`Vault get failed: ${response.status} ${await response.text()}`);
|
|
1501
|
+
}
|
|
1502
|
+
return await response.json();
|
|
1503
|
+
}
|
|
1504
|
+
/** Update vault metadata (name / description). Does not require the vault key. */
|
|
1505
|
+
async cloudBrowserVaultUpdate(vaultId, opts) {
|
|
1506
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId));
|
|
1507
|
+
url.searchParams.set('key', this.key);
|
|
1508
|
+
const body = {};
|
|
1509
|
+
if (opts.name !== undefined)
|
|
1510
|
+
body.name = opts.name;
|
|
1511
|
+
if (opts.description !== undefined)
|
|
1512
|
+
body.description = opts.description;
|
|
1513
|
+
const response = await this.fetch({
|
|
1514
|
+
url: url.toString(),
|
|
1515
|
+
method: 'PATCH',
|
|
1516
|
+
headers: {
|
|
1517
|
+
'content-type': 'application/json',
|
|
1518
|
+
'user-agent': this.ua,
|
|
1519
|
+
},
|
|
1520
|
+
body: JSON.stringify(body),
|
|
1521
|
+
});
|
|
1522
|
+
if (!response.ok) {
|
|
1523
|
+
throw new Error(`Vault update failed: ${response.status} ${await response.text()}`);
|
|
1524
|
+
}
|
|
1525
|
+
return await response.json();
|
|
1526
|
+
}
|
|
1527
|
+
/** Delete a vault and every item in it. Does not require the vault key. */
|
|
1528
|
+
async cloudBrowserVaultDelete(vaultId) {
|
|
1529
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId));
|
|
1530
|
+
url.searchParams.set('key', this.key);
|
|
1531
|
+
const response = await this.fetch({
|
|
1532
|
+
url: url.toString(),
|
|
1533
|
+
method: 'DELETE',
|
|
1534
|
+
headers: { 'user-agent': this.ua },
|
|
1535
|
+
});
|
|
1536
|
+
if (!response.ok) {
|
|
1537
|
+
throw new Error(`Vault delete failed: ${response.status} ${await response.text()}`);
|
|
1538
|
+
}
|
|
1539
|
+
const body = await response.json();
|
|
1540
|
+
return {
|
|
1541
|
+
success: body.success !== undefined ? Boolean(body.success) : true,
|
|
1542
|
+
message: typeof body.message === 'string' ? body.message : '',
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Rotate the vault key. The caller MUST pass the CURRENT key in
|
|
1547
|
+
* `currentVaultKey`; the server returns a fresh `key` exactly once. After
|
|
1548
|
+
* this call the old key cannot decrypt any row in the vault.
|
|
1549
|
+
*/
|
|
1550
|
+
async cloudBrowserVaultRotate(vaultId, currentVaultKey) {
|
|
1551
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId) + '/rotate');
|
|
1552
|
+
url.searchParams.set('key', this.key);
|
|
1553
|
+
const response = await this.fetch({
|
|
1554
|
+
url: url.toString(),
|
|
1555
|
+
method: 'POST',
|
|
1556
|
+
headers: {
|
|
1557
|
+
'user-agent': this.ua,
|
|
1558
|
+
'X-Vault-Key': currentVaultKey,
|
|
1559
|
+
},
|
|
1560
|
+
});
|
|
1561
|
+
if (!response.ok) {
|
|
1562
|
+
// Body may include the X-Vault-Key error message — safe to surface
|
|
1563
|
+
// because the server message names the header but not its value.
|
|
1564
|
+
throw new Error(`Vault rotate failed: ${response.status} ${await response.text()}`);
|
|
1565
|
+
}
|
|
1566
|
+
return await response.json();
|
|
1567
|
+
}
|
|
1568
|
+
/** List items in a vault. Items carry only opaque ciphertext, no plaintext. */
|
|
1569
|
+
async cloudBrowserVaultItemList(vaultId) {
|
|
1570
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId) + '/item');
|
|
1571
|
+
url.searchParams.set('key', this.key);
|
|
1572
|
+
const response = await this.fetch({
|
|
1573
|
+
url: url.toString(),
|
|
1574
|
+
method: 'GET',
|
|
1575
|
+
headers: { 'user-agent': this.ua },
|
|
1576
|
+
});
|
|
1577
|
+
if (!response.ok) {
|
|
1578
|
+
throw new Error(`Vault item list failed: ${response.status} ${await response.text()}`);
|
|
1579
|
+
}
|
|
1580
|
+
const json = await response.json();
|
|
1581
|
+
return { items: json.items ?? [] };
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Add a credential to a vault. Requires the vault key in the X-Vault-Key
|
|
1585
|
+
* header so the server can encrypt the secret payload at rest.
|
|
1586
|
+
*/
|
|
1587
|
+
async cloudBrowserVaultItemCreate(vaultId, vaultKey, item) {
|
|
1588
|
+
const url = new URL(this.cloudBrowserApiHost + '/vault/' + encodeURIComponent(vaultId) + '/item');
|
|
1589
|
+
url.searchParams.set('key', this.key);
|
|
1590
|
+
const body = {
|
|
1591
|
+
type: item.type,
|
|
1592
|
+
label: item.label,
|
|
1593
|
+
origin: item.origin,
|
|
1594
|
+
secret: item.secret,
|
|
1595
|
+
};
|
|
1596
|
+
if (item.username !== undefined)
|
|
1597
|
+
body.username = item.username;
|
|
1598
|
+
if (item.metadata !== undefined)
|
|
1599
|
+
body.metadata = item.metadata;
|
|
1600
|
+
const response = await this.fetch({
|
|
1601
|
+
url: url.toString(),
|
|
1602
|
+
method: 'POST',
|
|
1603
|
+
headers: {
|
|
1604
|
+
'content-type': 'application/json',
|
|
1605
|
+
'user-agent': this.ua,
|
|
1606
|
+
'X-Vault-Key': vaultKey,
|
|
1607
|
+
},
|
|
1608
|
+
body: JSON.stringify(body),
|
|
1609
|
+
});
|
|
1610
|
+
if (!response.ok) {
|
|
1611
|
+
throw new Error(`Vault item create failed: ${response.status} ${await response.text()}`);
|
|
1612
|
+
}
|
|
1613
|
+
return await response.json();
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Patch an item's metadata or rotate its secret. The server only requires
|
|
1617
|
+
* X-Vault-Key when `secret` is supplied (ciphertext rotation). Passing
|
|
1618
|
+
* `vaultKey` without `secret` is a no-op on the server side and is allowed
|
|
1619
|
+
* for caller convenience.
|
|
1620
|
+
*/
|
|
1621
|
+
async cloudBrowserVaultItemUpdate(vaultId, itemId, opts) {
|
|
1622
|
+
if (opts.secret !== undefined && (opts.vaultKey === undefined || opts.vaultKey === '')) {
|
|
1623
|
+
throw new Error('cloudBrowserVaultItemUpdate: vaultKey is required when rotating the item secret');
|
|
1624
|
+
}
|
|
1625
|
+
if (opts.secret !== undefined && opts.type === undefined) {
|
|
1626
|
+
throw new Error('cloudBrowserVaultItemUpdate: type is required when rotating the item secret');
|
|
1627
|
+
}
|
|
1628
|
+
const url = new URL(this.cloudBrowserApiHost +
|
|
1629
|
+
'/vault/' +
|
|
1630
|
+
encodeURIComponent(vaultId) +
|
|
1631
|
+
'/item/' +
|
|
1632
|
+
encodeURIComponent(itemId));
|
|
1633
|
+
url.searchParams.set('key', this.key);
|
|
1634
|
+
const body = {};
|
|
1635
|
+
if (opts.type !== undefined)
|
|
1636
|
+
body.type = opts.type;
|
|
1637
|
+
if (opts.label !== undefined)
|
|
1638
|
+
body.label = opts.label;
|
|
1639
|
+
if (opts.origin !== undefined)
|
|
1640
|
+
body.origin = opts.origin;
|
|
1641
|
+
if (opts.username !== undefined)
|
|
1642
|
+
body.username = opts.username;
|
|
1643
|
+
if (opts.metadata !== undefined)
|
|
1644
|
+
body.metadata = opts.metadata;
|
|
1645
|
+
if (opts.secret !== undefined)
|
|
1646
|
+
body.secret = opts.secret;
|
|
1647
|
+
const headers = {
|
|
1648
|
+
'content-type': 'application/json',
|
|
1649
|
+
'user-agent': this.ua,
|
|
1650
|
+
};
|
|
1651
|
+
if (opts.vaultKey !== undefined && opts.vaultKey !== '') {
|
|
1652
|
+
headers['X-Vault-Key'] = opts.vaultKey;
|
|
1653
|
+
}
|
|
1654
|
+
const response = await this.fetch({
|
|
1655
|
+
url: url.toString(),
|
|
1656
|
+
method: 'PATCH',
|
|
1657
|
+
headers,
|
|
1658
|
+
body: JSON.stringify(body),
|
|
1659
|
+
});
|
|
1660
|
+
if (!response.ok) {
|
|
1661
|
+
throw new Error(`Vault item update failed: ${response.status} ${await response.text()}`);
|
|
1662
|
+
}
|
|
1663
|
+
return await response.json();
|
|
1664
|
+
}
|
|
1665
|
+
/** Delete a single vault item. Does not require the vault key. */
|
|
1666
|
+
async cloudBrowserVaultItemDelete(vaultId, itemId) {
|
|
1667
|
+
const url = new URL(this.cloudBrowserApiHost +
|
|
1668
|
+
'/vault/' +
|
|
1669
|
+
encodeURIComponent(vaultId) +
|
|
1670
|
+
'/item/' +
|
|
1671
|
+
encodeURIComponent(itemId));
|
|
1672
|
+
url.searchParams.set('key', this.key);
|
|
1673
|
+
const response = await this.fetch({
|
|
1674
|
+
url: url.toString(),
|
|
1675
|
+
method: 'DELETE',
|
|
1676
|
+
headers: { 'user-agent': this.ua },
|
|
1677
|
+
});
|
|
1678
|
+
if (!response.ok) {
|
|
1679
|
+
throw new Error(`Vault item delete failed: ${response.status} ${await response.text()}`);
|
|
1680
|
+
}
|
|
1681
|
+
const body = await response.json();
|
|
1682
|
+
return {
|
|
1683
|
+
success: body.success !== undefined ? Boolean(body.success) : true,
|
|
1684
|
+
message: typeof body.message === 'string' ? body.message : '',
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1389
1687
|
/**
|
|
1390
1688
|
* Download a debug session recording video.
|
|
1391
1689
|
* Returns the video as an ArrayBuffer (stream from server).
|
|
@@ -1405,7 +1703,9 @@ export class ScrapflyClient {
|
|
|
1405
1703
|
return { data: await response.arrayBuffer(), filename };
|
|
1406
1704
|
}
|
|
1407
1705
|
/**
|
|
1408
|
-
* Get playback info for a debug session recording.
|
|
1706
|
+
* Get playback info for a debug session recording. The returned object
|
|
1707
|
+
* carries `available`, `status` ('ready' | 'uploading' | 'unavailable' |
|
|
1708
|
+
* 'disabled'), `metadata`, `video_url`, and `retry_after_ms`.
|
|
1409
1709
|
*/
|
|
1410
1710
|
async cloudBrowserPlayback(runId) {
|
|
1411
1711
|
const url = new URL(this.cloudBrowserApiHost + '/run/' + runId + '/playback');
|
|
@@ -1420,6 +1720,27 @@ export class ScrapflyClient {
|
|
|
1420
1720
|
}
|
|
1421
1721
|
return await response.json();
|
|
1422
1722
|
}
|
|
1723
|
+
/**
|
|
1724
|
+
* Poll the playback endpoint until the recording resolves to a terminal
|
|
1725
|
+
* state ('ready' or 'unavailable') or the timeout elapses. Honours the
|
|
1726
|
+
* server-side retry_after_ms hint when present.
|
|
1727
|
+
*/
|
|
1728
|
+
async cloudBrowserWaitForPlayback(runId, opts = {}) {
|
|
1729
|
+
const timeoutMs = opts.timeoutMs ?? 180_000;
|
|
1730
|
+
const fallbackMs = opts.pollIntervalFallbackMs ?? 3_000;
|
|
1731
|
+
const deadline = Date.now() + timeoutMs;
|
|
1732
|
+
while (true) {
|
|
1733
|
+
const playback = await this.cloudBrowserPlayback(runId);
|
|
1734
|
+
if (playback.status !== 'uploading')
|
|
1735
|
+
return playback;
|
|
1736
|
+
const remaining = deadline - Date.now();
|
|
1737
|
+
if (remaining <= 0)
|
|
1738
|
+
return playback;
|
|
1739
|
+
const retryAfter = Number(playback.retry_after_ms) || fallbackMs;
|
|
1740
|
+
const sleepFor = Math.min(retryAfter, remaining);
|
|
1741
|
+
await new Promise((resolve) => setTimeout(resolve, sleepFor));
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1423
1744
|
/**
|
|
1424
1745
|
* List all running Cloud Browser sessions.
|
|
1425
1746
|
*/
|
|
@@ -1436,6 +1757,127 @@ export class ScrapflyClient {
|
|
|
1436
1757
|
}
|
|
1437
1758
|
return await response.json();
|
|
1438
1759
|
}
|
|
1760
|
+
// -------------------------------------------------------------------------
|
|
1761
|
+
// Public schedule endpoints — /scrape/schedules, /screenshot/schedules,
|
|
1762
|
+
// /crawl/schedules, /schedules. The kind-specific config is supplied to the
|
|
1763
|
+
// matching `create*Schedule` method; the cross-kind list/get/update/delete/
|
|
1764
|
+
// pause/resume/execute methods work regardless of kind.
|
|
1765
|
+
// -------------------------------------------------------------------------
|
|
1766
|
+
/** Create a Web Scraping API schedule. `scrape_config` is the same shape
|
|
1767
|
+
* accepted by `/scrape` (e.g. `{ url, render_js, asp, ... }`). */
|
|
1768
|
+
async createScrapeSchedule(scrapeConfig, request) {
|
|
1769
|
+
return await this.scheduleRequest('POST', '/scrape/schedules', undefined, this.buildCreateBody('scrape_config', scrapeConfig, request));
|
|
1770
|
+
}
|
|
1771
|
+
/** Create a Screenshot API schedule. */
|
|
1772
|
+
async createScreenshotSchedule(screenshotConfig, request) {
|
|
1773
|
+
return await this.scheduleRequest('POST', '/screenshot/schedules', undefined, this.buildCreateBody('screenshot_config', screenshotConfig, request));
|
|
1774
|
+
}
|
|
1775
|
+
/** Create a Crawler API schedule. */
|
|
1776
|
+
async createCrawlerSchedule(crawlerConfig, request) {
|
|
1777
|
+
return await this.scheduleRequest('POST', '/crawl/schedules', undefined, this.buildCreateBody('crawler_config', crawlerConfig, request));
|
|
1778
|
+
}
|
|
1779
|
+
/** Return a schedule by id. Works across all kinds. */
|
|
1780
|
+
async getSchedule(id) {
|
|
1781
|
+
return await this.scheduleRequest('GET', `/schedules/${encodeURIComponent(id)}`);
|
|
1782
|
+
}
|
|
1783
|
+
/** List every schedule on the account, optionally filtered by kind/status. */
|
|
1784
|
+
async listSchedules(opts) {
|
|
1785
|
+
return await this.scheduleRequest('GET', '/schedules', opts);
|
|
1786
|
+
}
|
|
1787
|
+
async listScrapeSchedules(opts) {
|
|
1788
|
+
return await this.scheduleRequest('GET', '/scrape/schedules', opts);
|
|
1789
|
+
}
|
|
1790
|
+
async listScreenshotSchedules(opts) {
|
|
1791
|
+
return await this.scheduleRequest('GET', '/screenshot/schedules', opts);
|
|
1792
|
+
}
|
|
1793
|
+
async listCrawlerSchedules(opts) {
|
|
1794
|
+
return await this.scheduleRequest('GET', '/crawl/schedules', opts);
|
|
1795
|
+
}
|
|
1796
|
+
/** Patch an active schedule. Only fields set in `request` change. */
|
|
1797
|
+
async updateSchedule(id, request) {
|
|
1798
|
+
return await this.scheduleRequest('PATCH', `/schedules/${encodeURIComponent(id)}`, undefined, request);
|
|
1799
|
+
}
|
|
1800
|
+
/** Cancel a schedule. Cancellation is terminal (returns no body). */
|
|
1801
|
+
async cancelSchedule(id) {
|
|
1802
|
+
await this.scheduleRequest('DELETE', `/schedules/${encodeURIComponent(id)}`);
|
|
1803
|
+
}
|
|
1804
|
+
async pauseSchedule(id) {
|
|
1805
|
+
return await this.scheduleRequest('POST', `/schedules/${encodeURIComponent(id)}/pause`);
|
|
1806
|
+
}
|
|
1807
|
+
async resumeSchedule(id) {
|
|
1808
|
+
return await this.scheduleRequest('POST', `/schedules/${encodeURIComponent(id)}/resume`);
|
|
1809
|
+
}
|
|
1810
|
+
/** Fire a schedule immediately, regardless of next_scheduled_date. */
|
|
1811
|
+
async executeSchedule(id) {
|
|
1812
|
+
return await this.scheduleRequest('POST', `/schedules/${encodeURIComponent(id)}/execute`);
|
|
1813
|
+
}
|
|
1814
|
+
buildCreateBody(configKey, config, request) {
|
|
1815
|
+
const body = {
|
|
1816
|
+
[configKey]: config,
|
|
1817
|
+
webhook_name: request.webhook_name,
|
|
1818
|
+
allow_concurrency: request.allow_concurrency ?? false,
|
|
1819
|
+
retry_on_failure: request.retry_on_failure ?? false,
|
|
1820
|
+
};
|
|
1821
|
+
if (request.recurrence)
|
|
1822
|
+
body.recurrence = request.recurrence;
|
|
1823
|
+
if (request.scheduled_date)
|
|
1824
|
+
body.scheduled_date = request.scheduled_date;
|
|
1825
|
+
if (typeof request.max_retries === 'number')
|
|
1826
|
+
body.max_retries = request.max_retries;
|
|
1827
|
+
if (request.notes)
|
|
1828
|
+
body.notes = request.notes;
|
|
1829
|
+
return body;
|
|
1830
|
+
}
|
|
1831
|
+
async scheduleRequest(method, path, query, body) {
|
|
1832
|
+
const url = new URL(this.HOST + path);
|
|
1833
|
+
const params = new URLSearchParams();
|
|
1834
|
+
params.set('key', this.key);
|
|
1835
|
+
if (query) {
|
|
1836
|
+
for (const [k, v] of Object.entries(query)) {
|
|
1837
|
+
if (v !== undefined && v !== '')
|
|
1838
|
+
params.set(k, v);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
url.search = params.toString();
|
|
1842
|
+
const init = {
|
|
1843
|
+
url: url.toString(),
|
|
1844
|
+
method,
|
|
1845
|
+
headers: {
|
|
1846
|
+
'user-agent': this.ua,
|
|
1847
|
+
accept: 'application/json',
|
|
1848
|
+
},
|
|
1849
|
+
};
|
|
1850
|
+
if (body !== undefined) {
|
|
1851
|
+
init.body = JSON.stringify(body);
|
|
1852
|
+
init.headers['content-type'] = 'application/json';
|
|
1853
|
+
}
|
|
1854
|
+
const response = await this.fetch(init);
|
|
1855
|
+
if (response.status === 204)
|
|
1856
|
+
return undefined;
|
|
1857
|
+
if (!response.ok) {
|
|
1858
|
+
let envelope = {};
|
|
1859
|
+
try {
|
|
1860
|
+
envelope = await response.json();
|
|
1861
|
+
}
|
|
1862
|
+
catch {
|
|
1863
|
+
// body wasn't JSON; fall through with the empty envelope
|
|
1864
|
+
}
|
|
1865
|
+
const code = envelope.error ?? 'ERR::SCHEDULER::BACKEND_ERROR';
|
|
1866
|
+
let message = envelope.message ?? '';
|
|
1867
|
+
if (envelope.reason) {
|
|
1868
|
+
message = message ? `${message} (${envelope.reason})` : envelope.reason;
|
|
1869
|
+
}
|
|
1870
|
+
if (!message)
|
|
1871
|
+
message = `HTTP ${response.status}`;
|
|
1872
|
+
throw new ScheduleAPIError({
|
|
1873
|
+
code,
|
|
1874
|
+
message,
|
|
1875
|
+
httpStatusCode: response.status,
|
|
1876
|
+
details: envelope.details,
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
return await response.json();
|
|
1880
|
+
}
|
|
1439
1881
|
}
|
|
1440
1882
|
// ---------------------------------------------------------------------------
|
|
1441
1883
|
// multipart/related parser
|
package/esm/crawlerconfig.d.ts
CHANGED
|
@@ -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,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: true,
|
|
42
42
|
value: void 0
|
|
43
43
|
});
|
|
44
|
+
Object.defineProperty(this, "url_list", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
value: void 0
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(this, "remote_url_list", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true,
|
|
54
|
+
value: void 0
|
|
55
|
+
});
|
|
44
56
|
Object.defineProperty(this, "page_limit", {
|
|
45
57
|
enumerable: true,
|
|
46
58
|
configurable: true,
|
|
@@ -216,10 +228,22 @@ export class CrawlerConfig {
|
|
|
216
228
|
value: void 0
|
|
217
229
|
});
|
|
218
230
|
this.validateOptions(options);
|
|
219
|
-
|
|
220
|
-
|
|
231
|
+
const hasSeed = typeof options.url === 'string' && options.url.trim() !== '';
|
|
232
|
+
const hasList = Array.isArray(options.url_list) && options.url_list.length > 0;
|
|
233
|
+
const hasRemote = typeof options.remote_url_list === 'string' && options.remote_url_list.trim() !== '';
|
|
234
|
+
const sourceCount = (hasSeed ? 1 : 0) + (hasList ? 1 : 0) + (hasRemote ? 1 : 0);
|
|
235
|
+
if (sourceCount === 0) {
|
|
236
|
+
throw new CrawlerConfigError('Provide one of: url, url_list, remote_url_list');
|
|
237
|
+
}
|
|
238
|
+
if (sourceCount > 1) {
|
|
239
|
+
throw new CrawlerConfigError('Only one of url, url_list, remote_url_list can be set');
|
|
221
240
|
}
|
|
222
|
-
|
|
241
|
+
if (hasSeed)
|
|
242
|
+
this.url = options.url;
|
|
243
|
+
if (hasList)
|
|
244
|
+
this.url_list = options.url_list;
|
|
245
|
+
if (hasRemote)
|
|
246
|
+
this.remote_url_list = options.remote_url_list;
|
|
223
247
|
// Mutually exclusive path filters
|
|
224
248
|
if (options.exclude_paths && options.include_only_paths) {
|
|
225
249
|
throw new CrawlerConfigError('exclude_paths and include_only_paths are mutually exclusive');
|
|
@@ -308,6 +332,8 @@ export class CrawlerConfig {
|
|
|
308
332
|
validateOptions(options) {
|
|
309
333
|
const validKeys = new Set([
|
|
310
334
|
'url',
|
|
335
|
+
'url_list',
|
|
336
|
+
'remote_url_list',
|
|
311
337
|
'page_limit',
|
|
312
338
|
'max_depth',
|
|
313
339
|
'max_duration',
|
|
@@ -355,8 +381,11 @@ export class CrawlerConfig {
|
|
|
355
381
|
* defaults (e.g. `respect_robots_txt=true`).
|
|
356
382
|
*/
|
|
357
383
|
toApiParams() {
|
|
358
|
-
const params = {
|
|
384
|
+
const params = {};
|
|
359
385
|
const fields = [
|
|
386
|
+
'url',
|
|
387
|
+
'url_list',
|
|
388
|
+
'remote_url_list',
|
|
360
389
|
'page_limit',
|
|
361
390
|
'max_depth',
|
|
362
391
|
'max_duration',
|
package/esm/extractionconfig.js
CHANGED
|
@@ -183,7 +183,7 @@ export class ExtractionConfig {
|
|
|
183
183
|
throw new ExtractionConfigError('You cannot pass both parameters extraction_template and extraction_ephemeral_template. You must choose');
|
|
184
184
|
}
|
|
185
185
|
if (this.extraction_template) {
|
|
186
|
-
params.extraction_template = this.extraction_template;
|
|
186
|
+
params.extraction_template = 'persistent:' + this.extraction_template;
|
|
187
187
|
}
|
|
188
188
|
if (this.extraction_ephemeral_template) {
|
|
189
189
|
params.extraction_template = 'ephemeral:' + urlsafe_b64encode(JSON.stringify(this.extraction_ephemeral_template));
|
package/esm/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/esm/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,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