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/main.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.verifySignature = exports.createServer = exports.log = exports.parseCrawlerWebhook = exports.CrawlerUrls = exports.CrawlerStatus = exports.CrawlerContents = exports.CrawlerArtifact = exports.Crawl = exports.CrawlerConfig = exports.ScreenshotResult = exports.ScrapeResult = exports.ExtractionResult = exports.errors = exports.OperatingSystem = exports.ProxyPool = exports.BrowserConfig = exports.ExtractionConfig = exports.VisionDeficiency = exports.ScreenshotConfig = exports.ScreenshotOptions = exports.ScreenshotFormat = exports.ScreenshotFlags = exports.ScrapeConfig = exports.ScrapeFormatOptions = exports.ScrapeFormat = exports.ScrapflyClient = void 0;
|
|
26
|
+
exports.verifySignature = exports.createServer = exports.log = exports.ScheduleAPIError = exports.parseCrawlerWebhook = exports.CrawlerUrls = exports.CrawlerStatus = exports.CrawlerContents = exports.CrawlerArtifact = exports.Crawl = exports.CrawlerConfig = exports.ScreenshotResult = exports.ScrapeResult = exports.ExtractionResult = exports.errors = exports.OperatingSystem = exports.ProxyPool = exports.BrowserConfig = exports.ExtractionConfig = exports.VisionDeficiency = exports.ScreenshotConfig = exports.ScreenshotOptions = exports.ScreenshotFormat = exports.ScreenshotFlags = exports.ScrapeConfig = exports.ScrapeFormatOptions = exports.ScrapeFormat = exports.ScrapflyClient = void 0;
|
|
27
27
|
/**
|
|
28
28
|
* # Scrapfly SDK for TypeScript / JavaScript
|
|
29
29
|
*
|
|
@@ -85,6 +85,8 @@ Object.defineProperty(exports, "CrawlerContents", { enumerable: true, get: funct
|
|
|
85
85
|
Object.defineProperty(exports, "CrawlerStatus", { enumerable: true, get: function () { return crawlerresult_js_1.CrawlerStatus; } });
|
|
86
86
|
Object.defineProperty(exports, "CrawlerUrls", { enumerable: true, get: function () { return crawlerresult_js_1.CrawlerUrls; } });
|
|
87
87
|
Object.defineProperty(exports, "parseCrawlerWebhook", { enumerable: true, get: function () { return crawlerresult_js_1.parseCrawlerWebhook; } });
|
|
88
|
+
var schedule_js_1 = require("./schedule.js");
|
|
89
|
+
Object.defineProperty(exports, "ScheduleAPIError", { enumerable: true, get: function () { return schedule_js_1.ScheduleAPIError; } });
|
|
88
90
|
var logger_js_1 = require("./logger.js");
|
|
89
91
|
Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logger_js_1.log; } });
|
|
90
92
|
var webhookserver_js_1 = require("./webhookserver.js");
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public schedule client for the Scrapfly API.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `/scrape/schedules`, `/screenshot/schedules`, `/crawl/schedules`
|
|
5
|
+
* and the cross-kind `/schedules` endpoints. The server returns fully-formed
|
|
6
|
+
* Schedule objects; we surface them as-is so callers always see the live
|
|
7
|
+
* server shape.
|
|
8
|
+
*/
|
|
9
|
+
/** Bounds a recurring schedule by either a date or a fire count. */
|
|
10
|
+
export interface ScheduleEnd {
|
|
11
|
+
type: 'date' | 'count';
|
|
12
|
+
date?: string;
|
|
13
|
+
count?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* When a schedule fires next. Cron mode wins when `cron` is set; otherwise
|
|
17
|
+
* `interval` + `unit` drive the cadence.
|
|
18
|
+
*/
|
|
19
|
+
export interface ScheduleRecurrence {
|
|
20
|
+
cron?: string;
|
|
21
|
+
interval?: number;
|
|
22
|
+
unit?: 'minute' | 'hour' | 'day' | 'week' | 'month';
|
|
23
|
+
days?: string[];
|
|
24
|
+
ends?: ScheduleEnd;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Public-facing request envelope for creating a schedule. The kind-specific
|
|
28
|
+
* config (`scrape_config` / `screenshot_config` / `crawler_config`) is
|
|
29
|
+
* supplied as a separate argument by the matching `create*Schedule` method.
|
|
30
|
+
*/
|
|
31
|
+
export interface CreateScheduleRequest {
|
|
32
|
+
webhook_name: string;
|
|
33
|
+
recurrence?: ScheduleRecurrence;
|
|
34
|
+
scheduled_date?: string;
|
|
35
|
+
allow_concurrency?: boolean;
|
|
36
|
+
retry_on_failure?: boolean;
|
|
37
|
+
max_retries?: number;
|
|
38
|
+
notes?: string;
|
|
39
|
+
}
|
|
40
|
+
/** PATCH payload. Only fields explicitly set are forwarded. */
|
|
41
|
+
export interface UpdateScheduleRequest {
|
|
42
|
+
recurrence?: ScheduleRecurrence;
|
|
43
|
+
scheduled_date?: string;
|
|
44
|
+
allow_concurrency?: boolean;
|
|
45
|
+
retry_on_failure?: boolean;
|
|
46
|
+
max_retries?: number;
|
|
47
|
+
notes?: string;
|
|
48
|
+
scrape_config?: Record<string, unknown>;
|
|
49
|
+
screenshot_config?: Record<string, unknown>;
|
|
50
|
+
crawler_config?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
/** Server-side schedule record. Returned by every read or mutation endpoint. */
|
|
53
|
+
export interface Schedule {
|
|
54
|
+
id: string;
|
|
55
|
+
kind: string;
|
|
56
|
+
status: string;
|
|
57
|
+
next_scheduled_date?: string;
|
|
58
|
+
scheduled_date?: string;
|
|
59
|
+
recurrence?: ScheduleRecurrence;
|
|
60
|
+
metadata?: Record<string, unknown>;
|
|
61
|
+
notes?: string | null;
|
|
62
|
+
created_by?: string | null;
|
|
63
|
+
created_at: string;
|
|
64
|
+
updated_at: string;
|
|
65
|
+
cancelled_at?: string | null;
|
|
66
|
+
allow_concurrency: boolean;
|
|
67
|
+
retry_on_failure: boolean;
|
|
68
|
+
max_retries: number;
|
|
69
|
+
webhook_uuid?: string | null;
|
|
70
|
+
user_uuid?: string | null;
|
|
71
|
+
consecutive_failures?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface ListSchedulesOptions {
|
|
74
|
+
status?: string;
|
|
75
|
+
kind?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Raised on any non-2xx response from a `/schedules/*` endpoint. The
|
|
79
|
+
* `code` property carries the public `ERR::SCHEDULER::*` identifier so
|
|
80
|
+
* callers can branch on it without parsing the message string.
|
|
81
|
+
*/
|
|
82
|
+
export declare class ScheduleAPIError extends Error {
|
|
83
|
+
code: string;
|
|
84
|
+
httpStatusCode: number;
|
|
85
|
+
details: unknown;
|
|
86
|
+
constructor(args: {
|
|
87
|
+
code: string;
|
|
88
|
+
message: string;
|
|
89
|
+
httpStatusCode: number;
|
|
90
|
+
details?: unknown;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=schedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../src/schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oEAAoE;AACpE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM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AAM,EAAE,OAAO,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;gBAEL,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;CAO/F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Public schedule client for the Scrapfly API.
|
|
4
|
+
*
|
|
5
|
+
* Wraps `/scrape/schedules`, `/screenshot/schedules`, `/crawl/schedules`
|
|
6
|
+
* and the cross-kind `/schedules` endpoints. The server returns fully-formed
|
|
7
|
+
* Schedule objects; we surface them as-is so callers always see the live
|
|
8
|
+
* server shape.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.ScheduleAPIError = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Raised on any non-2xx response from a `/schedules/*` endpoint. The
|
|
14
|
+
* `code` property carries the public `ERR::SCHEDULER::*` identifier so
|
|
15
|
+
* callers can branch on it without parsing the message string.
|
|
16
|
+
*/
|
|
17
|
+
class ScheduleAPIError extends Error {
|
|
18
|
+
constructor(args) {
|
|
19
|
+
super(args.message);
|
|
20
|
+
Object.defineProperty(this, "code", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "httpStatusCode", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(this, "details", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: void 0
|
|
37
|
+
});
|
|
38
|
+
this.name = 'ScheduleAPIError';
|
|
39
|
+
this.code = args.code;
|
|
40
|
+
this.httpStatusCode = args.httpStatusCode;
|
|
41
|
+
this.details = args.details;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ScheduleAPIError = ScheduleAPIError;
|
package/script/scrapeconfig.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrapeconfig.d.ts","sourceRoot":"","sources":["../src/scrapeconfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGlD,oBAAY,eAAe;IACzB;;;;;;;QAOI;IACJ,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;CAC9B;AAED,uDAAuD;AACvD,oBAAY,MAAM;IAChB,uBAAuB;IACvB,IAAI,SAAS;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AChB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,UAAQ;IAC5B,WAAW,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,gBAAgB,CAAC,EACf,CAAC,aAAa,GAAG,WAAW,GAAG,eAAe,GAAG,oBAAoB,GAAG,cAAc,GAAG,eAAe,CAAC,EAAE,CAAC;IAC9G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,UAAU,GAAG,kBAAkB,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;gBAET,OAAO,EAAE,mBAAmB;IA+FxC,OAAO,CAAC,eAAe;IASvB,WAAW,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAqL3D"}
|
package/script/scrapeconfig.js
CHANGED
|
@@ -236,7 +236,7 @@ class ScrapeConfig {
|
|
|
236
236
|
enumerable: true,
|
|
237
237
|
configurable: true,
|
|
238
238
|
writable: true,
|
|
239
|
-
value:
|
|
239
|
+
value: true
|
|
240
240
|
});
|
|
241
241
|
Object.defineProperty(this, "screenshots", {
|
|
242
242
|
enumerable: true,
|
|
@@ -547,7 +547,7 @@ class ScrapeConfig {
|
|
|
547
547
|
throw new errors_js_1.ScrapeConfigError('You cannot pass both parameters extraction_template and extraction_ephemeral_template. You must choose');
|
|
548
548
|
}
|
|
549
549
|
if (this.extraction_template) {
|
|
550
|
-
params.extraction_template = this.extraction_template;
|
|
550
|
+
params.extraction_template = 'persistent:' + this.extraction_template;
|
|
551
551
|
}
|
|
552
552
|
if (this.extraction_ephemeral_template) {
|
|
553
553
|
params.extraction_template = 'ephemeral:' + (0, utils_js_1.urlsafe_b64encode)(JSON.stringify(this.extraction_ephemeral_template));
|
|
@@ -563,9 +563,7 @@ class ScrapeConfig {
|
|
|
563
563
|
}
|
|
564
564
|
if (this.session) {
|
|
565
565
|
params.session = this.session;
|
|
566
|
-
|
|
567
|
-
params.session_sticky_proxy = true;
|
|
568
|
-
}
|
|
566
|
+
params.session_sticky_proxy = this.session_sticky_proxy;
|
|
569
567
|
}
|
|
570
568
|
else {
|
|
571
569
|
if (this.session_sticky_proxy) {
|
|
@@ -603,3 +601,9 @@ Object.defineProperty(ScrapeConfig, "PUBLIC_RESIDENTIAL_POOL", {
|
|
|
603
601
|
writable: true,
|
|
604
602
|
value: 'public_residential_pool'
|
|
605
603
|
});
|
|
604
|
+
Object.defineProperty(ScrapeConfig, "PUBLIC_TOR_POOL", {
|
|
605
|
+
enumerable: true,
|
|
606
|
+
configurable: true,
|
|
607
|
+
writable: true,
|
|
608
|
+
value: 'public_tor_pool'
|
|
609
|
+
});
|
package/script/types.d.ts
CHANGED
|
@@ -1,3 +1,97 @@
|
|
|
1
1
|
export type Rec<T> = Record<string, T>;
|
|
2
2
|
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'HEAD';
|
|
3
|
+
/** Vault metadata returned by the server (no secret material). */
|
|
4
|
+
export type Vault = {
|
|
5
|
+
id: string;
|
|
6
|
+
user_uuid?: string;
|
|
7
|
+
project?: string;
|
|
8
|
+
env?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
item_count?: number;
|
|
12
|
+
created_at?: string;
|
|
13
|
+
updated_at?: string;
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
/** Discriminator for the secret payload of a {@link VaultItem}. */
|
|
17
|
+
export type VaultItemType = 'password' | 'passkey' | 'cookie' | 'totp';
|
|
18
|
+
/**
|
|
19
|
+
* Plaintext secret payload used when creating or rotating an item.
|
|
20
|
+
*
|
|
21
|
+
* Only one variant should be set, matching the item's `type`. The flat shape
|
|
22
|
+
* mirrors the dashboard form ergonomics; the API also accepts a typed form
|
|
23
|
+
* (e.g. `{ password: { password: 'hunter2' } }`).
|
|
24
|
+
*/
|
|
25
|
+
export type VaultSecret = {
|
|
26
|
+
password?: string | {
|
|
27
|
+
password: string;
|
|
28
|
+
};
|
|
29
|
+
credentialId?: string;
|
|
30
|
+
privateKey?: string;
|
|
31
|
+
userHandle?: string;
|
|
32
|
+
signCount?: number;
|
|
33
|
+
passkey?: {
|
|
34
|
+
credentialId: string;
|
|
35
|
+
privateKey: string;
|
|
36
|
+
userHandle?: string;
|
|
37
|
+
signCount?: number;
|
|
38
|
+
};
|
|
39
|
+
name?: string;
|
|
40
|
+
value?: string;
|
|
41
|
+
domain?: string;
|
|
42
|
+
path?: string;
|
|
43
|
+
secure?: boolean;
|
|
44
|
+
httpOnly?: boolean;
|
|
45
|
+
sameSite?: 'Strict' | 'Lax' | 'None' | string;
|
|
46
|
+
expires?: number;
|
|
47
|
+
cookie?: {
|
|
48
|
+
name: string;
|
|
49
|
+
value?: string;
|
|
50
|
+
domain: string;
|
|
51
|
+
path?: string;
|
|
52
|
+
secure?: boolean;
|
|
53
|
+
httpOnly?: boolean;
|
|
54
|
+
sameSite?: 'Strict' | 'Lax' | 'None' | string;
|
|
55
|
+
expires?: number;
|
|
56
|
+
};
|
|
57
|
+
seed?: string;
|
|
58
|
+
issuer?: string;
|
|
59
|
+
account?: string;
|
|
60
|
+
algorithm?: 'SHA1' | 'SHA256' | 'SHA512' | string;
|
|
61
|
+
digits?: number;
|
|
62
|
+
period?: number;
|
|
63
|
+
totp?: {
|
|
64
|
+
secret: string;
|
|
65
|
+
issuer?: string;
|
|
66
|
+
account?: string;
|
|
67
|
+
algorithm?: 'SHA1' | 'SHA256' | 'SHA512' | string;
|
|
68
|
+
digits?: number;
|
|
69
|
+
period?: number;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/** Server-stored vault item (secret_blob is opaque ciphertext). */
|
|
73
|
+
export type VaultItem = {
|
|
74
|
+
id: string;
|
|
75
|
+
vault_id: string;
|
|
76
|
+
type: VaultItemType;
|
|
77
|
+
label: string;
|
|
78
|
+
origin: string;
|
|
79
|
+
username?: string;
|
|
80
|
+
/** Base64-encoded envelope ciphertext; useless without the vault key. */
|
|
81
|
+
secret_blob?: string;
|
|
82
|
+
master_key_version?: number;
|
|
83
|
+
metadata?: Record<string, unknown>;
|
|
84
|
+
created_at?: string;
|
|
85
|
+
updated_at?: string;
|
|
86
|
+
[k: string]: unknown;
|
|
87
|
+
};
|
|
88
|
+
/** Payload accepted by `cloudBrowserVaultItemCreate`. */
|
|
89
|
+
export type VaultItemCreate = {
|
|
90
|
+
type: VaultItemType;
|
|
91
|
+
label: string;
|
|
92
|
+
origin: string;
|
|
93
|
+
username?: string;
|
|
94
|
+
secret: VaultSecret;
|
|
95
|
+
metadata?: Record<string, unknown>;
|
|
96
|
+
};
|
|
3
97
|
//# sourceMappingURL=types.d.ts.map
|
package/script/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AACvC,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,M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E,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC"}
|
package/script/utils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type RequestOptions = {
|
|
|
4
4
|
url: string;
|
|
5
5
|
method?: string;
|
|
6
6
|
headers?: any;
|
|
7
|
-
body?: string | Uint8Array;
|
|
7
|
+
body?: string | Uint8Array | any;
|
|
8
8
|
};
|
|
9
9
|
export declare function fetchRetry(config: RequestOptions, retries?: number, retryDelay?: number): Promise<Response>;
|
|
10
10
|
export declare function normalizeHeaders(headers: Rec<string> | Headers): Rec<string>;
|
package/script/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQtD;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQtD;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IAMd,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,GAAG,CAAC;CAClC,CAAC;AAEF,wBAAsB,UAAU,CAC9B,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAa,GACxB,OAAO,CAAC,QAAQ,CAAC,CA6CnB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAc5E"}
|
|
@@ -8,9 +8,13 @@ export declare enum ResourceType {
|
|
|
8
8
|
* HMAC-SHA256 signature on the request body against the configured
|
|
9
9
|
* signing secret.
|
|
10
10
|
*
|
|
11
|
-
* @param body Raw request body as received (
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* @param body Raw request body as received (verify BEFORE any decompression
|
|
12
|
+
* or JSON parsing — the signature is computed on the bytes
|
|
13
|
+
* Scrapfly sent on the wire).
|
|
14
|
+
* @param signature Value of the `X-Scrapfly-Webhook-Signature` header
|
|
15
|
+
* (uppercase hex digest).
|
|
16
|
+
* @param signingSecret Webhook signing secret from the dashboard, passed as-is
|
|
17
|
+
* (UTF-8 string; not hex-encoded).
|
|
14
18
|
* @returns `true` if the signature matches.
|
|
15
19
|
*/
|
|
16
20
|
export declare function verifySignature(body: Buffer, signature: string, signingSecret: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhookserver.d.ts","sourceRoot":"","sources":["../src/webhookserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED
|
|
1
|
+
{"version":3,"file":"webhookserver.d.ts","sourceRoot":"","sources":["../src/webhookserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAS/F;AAGD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,EACjE,GAAG,CAAC,EAAE,GAAG,GACR,OAAO,CAAC,GAAG,CAAC,CA4Cd"}
|
package/script/webhookserver.js
CHANGED
|
@@ -42,17 +42,24 @@ var ResourceType;
|
|
|
42
42
|
* HMAC-SHA256 signature on the request body against the configured
|
|
43
43
|
* signing secret.
|
|
44
44
|
*
|
|
45
|
-
* @param body Raw request body as received (
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* @param body Raw request body as received (verify BEFORE any decompression
|
|
46
|
+
* or JSON parsing — the signature is computed on the bytes
|
|
47
|
+
* Scrapfly sent on the wire).
|
|
48
|
+
* @param signature Value of the `X-Scrapfly-Webhook-Signature` header
|
|
49
|
+
* (uppercase hex digest).
|
|
50
|
+
* @param signingSecret Webhook signing secret from the dashboard, passed as-is
|
|
51
|
+
* (UTF-8 string; not hex-encoded).
|
|
48
52
|
* @returns `true` if the signature matches.
|
|
49
53
|
*/
|
|
50
54
|
function verifySignature(body, signature, signingSecret) {
|
|
51
|
-
const
|
|
52
|
-
const hmac = node_crypto_1.default.createHmac('sha256', secret);
|
|
55
|
+
const hmac = node_crypto_1.default.createHmac('sha256', node_buffer_1.Buffer.from(signingSecret, 'utf8'));
|
|
53
56
|
hmac.update(body);
|
|
54
57
|
const computed = hmac.digest('hex').toUpperCase();
|
|
55
|
-
|
|
58
|
+
const received = signature.toUpperCase();
|
|
59
|
+
if (computed.length !== received.length) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return node_crypto_1.default.timingSafeEqual(node_buffer_1.Buffer.from(computed), node_buffer_1.Buffer.from(received));
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
58
65
|
* Start a tiny Express server that receives Scrapfly webhook callbacks
|
package/src/batch.ts
CHANGED
|
@@ -26,7 +26,13 @@ function indexOf(buf: Uint8Array, needle: Uint8Array, start = 0): number {
|
|
|
26
26
|
return -1;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// concat sidesteps the TS 5.7+ generic-Uint8Array vs dnt-Node legacy
|
|
30
|
+
// Uint8Array mismatch by accepting `any` and returning a freshly
|
|
31
|
+
// allocated buffer. The fresh allocation guarantees the result is a
|
|
32
|
+
// `Uint8Array<ArrayBuffer>` at runtime under TS 5.7+ and a plain
|
|
33
|
+
// non-generic `Uint8Array` under dnt's Node target.
|
|
34
|
+
// deno-lint-ignore no-explicit-any
|
|
35
|
+
function concat(a: any, b: any): any {
|
|
30
36
|
const out = new Uint8Array(a.length + b.length);
|
|
31
37
|
out.set(a, 0);
|
|
32
38
|
out.set(b, a.length);
|
package/src/browserconfig.ts
CHANGED
|
@@ -64,6 +64,43 @@ export type BrowserConfigOptions = {
|
|
|
64
64
|
browser_brand?: string;
|
|
65
65
|
/** Enable the MCP (Model Context Protocol) bridge. */
|
|
66
66
|
enable_mcp?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Arm Scrapium's built-in captcha detector + solver on the first page attach.
|
|
69
|
+
* Turnstile, DataDome slider, reCAPTCHA, GeeTest, PerimeterX hold, and
|
|
70
|
+
* puzzle captchas are handled automatically — no extra CDP calls from the
|
|
71
|
+
* client. Billed per solve; failures cost nothing.
|
|
72
|
+
* See https://scrapfly.io/docs/cloud-browser-api/captcha-solver
|
|
73
|
+
*/
|
|
74
|
+
solve_captcha?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Attach a Cloud Browser Credential Vault to the session by NAME — the
|
|
77
|
+
* alphanumeric name you gave it at `cloudBrowserVaultCreate`. The server
|
|
78
|
+
* resolves the name to the vault scoped to your api-key's project and
|
|
79
|
+
* environment. Pair with `vault_key`.
|
|
80
|
+
*/
|
|
81
|
+
vault?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Customer-held vault key (base64). Forwarded as a query parameter so the
|
|
84
|
+
* server can decrypt vault items at injection time. Treat as a secret —
|
|
85
|
+
* never log or expose in error messages.
|
|
86
|
+
*/
|
|
87
|
+
vault_key?: string;
|
|
88
|
+
/** Enable the human-in-the-loop VNC channel (operator attach via Scrapfly's VNC mux). */
|
|
89
|
+
enable_vnc?: boolean;
|
|
90
|
+
/** Customer-chosen VNC password. Required when `enable_vnc` is true and `hitl_allowed_networks` is empty. */
|
|
91
|
+
vnc_password?: string;
|
|
92
|
+
/** Enable the human-in-the-loop WebRTC channel. */
|
|
93
|
+
enable_rtc?: boolean;
|
|
94
|
+
/** Optional WebRTC username. Defaults to "scrapfly" server-side. */
|
|
95
|
+
rtc_username?: string;
|
|
96
|
+
/** Customer-chosen WebRTC password. Required when `enable_rtc` is true and `hitl_allowed_networks` is empty. */
|
|
97
|
+
rtc_password?: string;
|
|
98
|
+
/**
|
|
99
|
+
* IP allow-list for credential-free HITL attach. Source IPs in this list
|
|
100
|
+
* skip password verification for VNC/WebRTC/downloads. Pass either a
|
|
101
|
+
* comma-separated string or an array of bare IPs / CIDRs.
|
|
102
|
+
*/
|
|
103
|
+
hitl_allowed_networks?: string | string[];
|
|
67
104
|
};
|
|
68
105
|
|
|
69
106
|
/**
|
|
@@ -114,6 +151,24 @@ export class BrowserConfig {
|
|
|
114
151
|
browser_brand?: string;
|
|
115
152
|
/** See {@link BrowserConfigOptions.enable_mcp}. */
|
|
116
153
|
enable_mcp?: boolean;
|
|
154
|
+
/** See {@link BrowserConfigOptions.solve_captcha}. */
|
|
155
|
+
solve_captcha?: boolean;
|
|
156
|
+
/** See {@link BrowserConfigOptions.vault}. */
|
|
157
|
+
vault?: string;
|
|
158
|
+
/** See {@link BrowserConfigOptions.vault_key}. */
|
|
159
|
+
vault_key?: string;
|
|
160
|
+
/** See {@link BrowserConfigOptions.enable_vnc}. */
|
|
161
|
+
enable_vnc?: boolean;
|
|
162
|
+
/** See {@link BrowserConfigOptions.vnc_password}. */
|
|
163
|
+
vnc_password?: string;
|
|
164
|
+
/** See {@link BrowserConfigOptions.enable_rtc}. */
|
|
165
|
+
enable_rtc?: boolean;
|
|
166
|
+
/** See {@link BrowserConfigOptions.rtc_username}. */
|
|
167
|
+
rtc_username?: string;
|
|
168
|
+
/** See {@link BrowserConfigOptions.rtc_password}. */
|
|
169
|
+
rtc_password?: string;
|
|
170
|
+
/** See {@link BrowserConfigOptions.hitl_allowed_networks}. */
|
|
171
|
+
hitl_allowed_networks?: string;
|
|
117
172
|
|
|
118
173
|
/**
|
|
119
174
|
* @param options Session options. See {@link BrowserConfigOptions}.
|
|
@@ -144,6 +199,41 @@ export class BrowserConfig {
|
|
|
144
199
|
this.unblock_timeout = options.unblock_timeout;
|
|
145
200
|
this.browser_brand = options.browser_brand;
|
|
146
201
|
this.enable_mcp = options.enable_mcp;
|
|
202
|
+
this.solve_captcha = options.solve_captcha;
|
|
203
|
+
this.vault = options.vault;
|
|
204
|
+
this.vault_key = options.vault_key;
|
|
205
|
+
this.enable_vnc = options.enable_vnc;
|
|
206
|
+
this.vnc_password = options.vnc_password;
|
|
207
|
+
this.enable_rtc = options.enable_rtc;
|
|
208
|
+
this.rtc_username = options.rtc_username;
|
|
209
|
+
this.rtc_password = options.rtc_password;
|
|
210
|
+
if (Array.isArray(options.hitl_allowed_networks)) {
|
|
211
|
+
const cleaned = options.hitl_allowed_networks
|
|
212
|
+
.map((s) => s.trim())
|
|
213
|
+
.filter((s) => s.length > 0);
|
|
214
|
+
this.hitl_allowed_networks = cleaned.length > 0 ? cleaned.join(',') : undefined;
|
|
215
|
+
} else {
|
|
216
|
+
this.hitl_allowed_networks = options.hitl_allowed_networks || undefined;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Return the deterministic project salt for an api_key (`sha256(api_key)[:8]`).
|
|
222
|
+
* Matches the `X-Browser-Project-Salt` response header returned on a
|
|
223
|
+
* successful Cloud Browser WebSocket upgrade. Useful for verifying that
|
|
224
|
+
* an attach link belongs to your project before sharing it.
|
|
225
|
+
*
|
|
226
|
+
* Uses the Web Crypto API where available (modern Node and browsers).
|
|
227
|
+
*/
|
|
228
|
+
static async projectSalt(apiKey: string): Promise<string> {
|
|
229
|
+
const data = new TextEncoder().encode(apiKey);
|
|
230
|
+
const digest = await crypto.subtle.digest('SHA-256', data);
|
|
231
|
+
const bytes = new Uint8Array(digest);
|
|
232
|
+
let hex = '';
|
|
233
|
+
for (let i = 0; i < 4; i++) {
|
|
234
|
+
hex += bytes[i].toString(16).padStart(2, '0');
|
|
235
|
+
}
|
|
236
|
+
return hex;
|
|
147
237
|
}
|
|
148
238
|
|
|
149
239
|
/**
|
|
@@ -180,6 +270,15 @@ export class BrowserConfig {
|
|
|
180
270
|
if (this.unblock_timeout !== undefined) params.set('unblock_timeout', String(this.unblock_timeout));
|
|
181
271
|
if (this.browser_brand !== undefined) params.set('browser_brand', this.browser_brand);
|
|
182
272
|
if (this.enable_mcp !== undefined) params.set('enable_mcp', String(this.enable_mcp));
|
|
273
|
+
if (this.solve_captcha !== undefined) params.set('solve_captcha', String(this.solve_captcha));
|
|
274
|
+
if (this.vault !== undefined) params.set('vault', this.vault);
|
|
275
|
+
if (this.vault_key !== undefined) params.set('vault_key', this.vault_key);
|
|
276
|
+
if (this.enable_vnc !== undefined) params.set('enable_vnc', String(this.enable_vnc));
|
|
277
|
+
if (this.vnc_password !== undefined) params.set('vnc_password', this.vnc_password);
|
|
278
|
+
if (this.enable_rtc !== undefined) params.set('enable_rtc', String(this.enable_rtc));
|
|
279
|
+
if (this.rtc_username !== undefined) params.set('rtc_username', this.rtc_username);
|
|
280
|
+
if (this.rtc_password !== undefined) params.set('rtc_password', this.rtc_password);
|
|
281
|
+
if (this.hitl_allowed_networks !== undefined) params.set('hitl_allowed_networks', this.hitl_allowed_networks);
|
|
183
282
|
|
|
184
283
|
const baseHost = host || 'wss://browser.scrapfly.io';
|
|
185
284
|
return `${baseHost}?${params.toString()}`;
|