scrapfly-sdk 0.10.6 → 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/browserconfig.d.ts +54 -0
- package/esm/browserconfig.d.ts.map +1 -1
- package/esm/browserconfig.js +106 -0
- package/esm/client.d.ts +104 -3
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +332 -14
- 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 +1 -0
- package/esm/main.d.ts.map +1 -1
- 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/package.json +1 -1
- package/script/browserconfig.d.ts +54 -0
- package/script/browserconfig.d.ts.map +1 -1
- package/script/browserconfig.js +106 -0
- package/script/client.d.ts +104 -3
- package/script/client.d.ts.map +1 -1
- package/script/client.js +332 -14
- 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 +1 -0
- package/script/main.d.ts.map +1 -1
- 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/src/browserconfig.ts +87 -0
- package/src/client.ts +402 -15
- package/src/crawlerconfig.ts +27 -6
- package/src/extractionconfig.ts +1 -1
- package/src/main.ts +1 -0
- package/src/scrapeconfig.ts +4 -5
- package/src/types.ts +115 -0
- package/src/utils.ts +6 -1
package/src/types.ts
CHANGED
|
@@ -1,2 +1,117 @@
|
|
|
1
1
|
export type Rec<T> = Record<string, T>;
|
|
2
2
|
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'HEAD';
|
|
3
|
+
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Cloud Browser Credential Vault types.
|
|
6
|
+
//
|
|
7
|
+
// Vaults store browser credentials (passwords, passkeys, cookies, TOTP seeds)
|
|
8
|
+
// encrypted server-side under a customer-held vault key. The server emits the
|
|
9
|
+
// raw vault key exactly once on POST /vault and POST /vault/{id}/rotate; the
|
|
10
|
+
// SDK MUST never log, print, or include it in error messages.
|
|
11
|
+
// See compliance memory at agent_secret_tokenization_boundary.md.
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
/** Vault metadata returned by the server (no secret material). */
|
|
15
|
+
export type Vault = {
|
|
16
|
+
id: string;
|
|
17
|
+
user_uuid?: string;
|
|
18
|
+
project?: string;
|
|
19
|
+
env?: string;
|
|
20
|
+
name: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
item_count?: number;
|
|
23
|
+
created_at?: string;
|
|
24
|
+
updated_at?: string;
|
|
25
|
+
// Allow forward-compat fields the server may add.
|
|
26
|
+
[k: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** Discriminator for the secret payload of a {@link VaultItem}. */
|
|
30
|
+
export type VaultItemType = 'password' | 'passkey' | 'cookie' | 'totp';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Plaintext secret payload used when creating or rotating an item.
|
|
34
|
+
*
|
|
35
|
+
* Only one variant should be set, matching the item's `type`. The flat shape
|
|
36
|
+
* mirrors the dashboard form ergonomics; the API also accepts a typed form
|
|
37
|
+
* (e.g. `{ password: { password: 'hunter2' } }`).
|
|
38
|
+
*/
|
|
39
|
+
export type VaultSecret = {
|
|
40
|
+
// password
|
|
41
|
+
password?: string | { password: string };
|
|
42
|
+
// passkey (flat)
|
|
43
|
+
credentialId?: string;
|
|
44
|
+
privateKey?: string;
|
|
45
|
+
userHandle?: string;
|
|
46
|
+
signCount?: number;
|
|
47
|
+
// passkey (typed)
|
|
48
|
+
passkey?: {
|
|
49
|
+
credentialId: string;
|
|
50
|
+
privateKey: string;
|
|
51
|
+
userHandle?: string;
|
|
52
|
+
signCount?: number;
|
|
53
|
+
};
|
|
54
|
+
// cookie (flat)
|
|
55
|
+
name?: string;
|
|
56
|
+
value?: string;
|
|
57
|
+
domain?: string;
|
|
58
|
+
path?: string;
|
|
59
|
+
secure?: boolean;
|
|
60
|
+
httpOnly?: boolean;
|
|
61
|
+
sameSite?: 'Strict' | 'Lax' | 'None' | string;
|
|
62
|
+
expires?: number;
|
|
63
|
+
// cookie (typed)
|
|
64
|
+
cookie?: {
|
|
65
|
+
name: string;
|
|
66
|
+
value?: string;
|
|
67
|
+
domain: string;
|
|
68
|
+
path?: string;
|
|
69
|
+
secure?: boolean;
|
|
70
|
+
httpOnly?: boolean;
|
|
71
|
+
sameSite?: 'Strict' | 'Lax' | 'None' | string;
|
|
72
|
+
expires?: number;
|
|
73
|
+
};
|
|
74
|
+
// totp (flat — `seed` to avoid colliding with the envelope's `secret` key)
|
|
75
|
+
seed?: string;
|
|
76
|
+
issuer?: string;
|
|
77
|
+
account?: string;
|
|
78
|
+
algorithm?: 'SHA1' | 'SHA256' | 'SHA512' | string;
|
|
79
|
+
digits?: number;
|
|
80
|
+
period?: number;
|
|
81
|
+
// totp (typed)
|
|
82
|
+
totp?: {
|
|
83
|
+
secret: string;
|
|
84
|
+
issuer?: string;
|
|
85
|
+
account?: string;
|
|
86
|
+
algorithm?: 'SHA1' | 'SHA256' | 'SHA512' | string;
|
|
87
|
+
digits?: number;
|
|
88
|
+
period?: number;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/** Server-stored vault item (secret_blob is opaque ciphertext). */
|
|
93
|
+
export type VaultItem = {
|
|
94
|
+
id: string;
|
|
95
|
+
vault_id: string;
|
|
96
|
+
type: VaultItemType;
|
|
97
|
+
label: string;
|
|
98
|
+
origin: string;
|
|
99
|
+
username?: string;
|
|
100
|
+
/** Base64-encoded envelope ciphertext; useless without the vault key. */
|
|
101
|
+
secret_blob?: string;
|
|
102
|
+
master_key_version?: number;
|
|
103
|
+
metadata?: Record<string, unknown>;
|
|
104
|
+
created_at?: string;
|
|
105
|
+
updated_at?: string;
|
|
106
|
+
[k: string]: unknown;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** Payload accepted by `cloudBrowserVaultItemCreate`. */
|
|
110
|
+
export type VaultItemCreate = {
|
|
111
|
+
type: VaultItemType;
|
|
112
|
+
label: string;
|
|
113
|
+
origin: string;
|
|
114
|
+
username?: string;
|
|
115
|
+
secret: VaultSecret;
|
|
116
|
+
metadata?: Record<string, unknown>;
|
|
117
|
+
};
|
package/src/utils.ts
CHANGED
|
@@ -15,7 +15,12 @@ export type RequestOptions = {
|
|
|
15
15
|
url: string;
|
|
16
16
|
method?: string;
|
|
17
17
|
headers?: any;
|
|
18
|
-
|
|
18
|
+
// Body accepts strings, raw bytes, or any FormData-like value. The latter
|
|
19
|
+
// is used by the Crawler client to upload an in-memory URL list as a
|
|
20
|
+
// multipart 'urls' part; fetch() fills in the multipart boundary header
|
|
21
|
+
// automatically when given a FormData instance.
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
body?: string | Uint8Array | any;
|
|
19
24
|
};
|
|
20
25
|
|
|
21
26
|
export async function fetchRetry(
|