nothing-browser 0.1.3 → 0.1.4
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/package.json +14 -26
- package/piggy/cache/{memory.ts → memory.js} +5 -10
- package/piggy/captcha/{index.ts → index.js} +19 -28
- package/piggy/capture/index.js +40 -0
- package/piggy/client/{index.ts → index.js} +133 -154
- package/piggy/dialog/{index.ts → index.js} +15 -31
- package/piggy/export/index.js +105 -0
- package/piggy/expose/index.js +24 -0
- package/piggy/find/{index.ts → index.js} +24 -39
- package/piggy/http/{index.ts → index.js} +7 -16
- package/piggy/human/{index.ts → index.js} +18 -49
- package/piggy/iframe/index.js +56 -0
- package/piggy/interactions/{index.ts → index.js} +20 -23
- package/piggy/intercept/{scripts.ts → scripts.js} +4 -13
- package/piggy/launch/{detect.ts → detect.js} +4 -6
- package/piggy/launch/{spawn.ts → spawn.js} +17 -22
- package/piggy/media/{index.ts → index.js} +13 -11
- package/piggy/navigation/{index.ts → index.js} +16 -14
- package/piggy/pool/index.js +76 -0
- package/piggy/provide/index.js +97 -0
- package/piggy/proxy/index.js +95 -0
- package/piggy/register/index.js +543 -0
- package/piggy/router/index.js +44 -0
- package/piggy/server/{index.ts → index.js} +16 -64
- package/piggy/session/index.js +69 -0
- package/piggy/store/{index.ts → index.js} +22 -62
- package/piggy/tabs/index.js +24 -0
- package/piggy/wait/index.js +77 -0
- package/{piggy.ts → piggy.js} +122 -146
- package/dist/cache/memory.js +0 -35
- package/dist/client/index.js +0 -1284
- package/dist/human/index.js +0 -82
- package/dist/launch/detect.js +0 -782
- package/dist/launch/spawn.js +0 -915
- package/dist/logger/index.js +0 -733
- package/dist/piggy/cache/memory.d.ts +0 -7
- package/dist/piggy/cache/memory.d.ts.map +0 -1
- package/dist/piggy/captcha/index.d.ts +0 -39
- package/dist/piggy/captcha/index.d.ts.map +0 -1
- package/dist/piggy/capture/index.d.ts +0 -48
- package/dist/piggy/capture/index.d.ts.map +0 -1
- package/dist/piggy/client/index.d.ts +0 -146
- package/dist/piggy/client/index.d.ts.map +0 -1
- package/dist/piggy/dialog/index.d.ts +0 -28
- package/dist/piggy/dialog/index.d.ts.map +0 -1
- package/dist/piggy/export/index.d.ts +0 -62
- package/dist/piggy/export/index.d.ts.map +0 -1
- package/dist/piggy/expose/index.d.ts +0 -6
- package/dist/piggy/expose/index.d.ts.map +0 -1
- package/dist/piggy/find/index.d.ts +0 -52
- package/dist/piggy/find/index.d.ts.map +0 -1
- package/dist/piggy/http/index.d.ts +0 -14
- package/dist/piggy/http/index.d.ts.map +0 -1
- package/dist/piggy/human/index.d.ts +0 -39
- package/dist/piggy/human/index.d.ts.map +0 -1
- package/dist/piggy/iframe/index.d.ts +0 -53
- package/dist/piggy/iframe/index.d.ts.map +0 -1
- package/dist/piggy/interactions/index.d.ts +0 -24
- package/dist/piggy/interactions/index.d.ts.map +0 -1
- package/dist/piggy/intercept/scripts.d.ts +0 -13
- package/dist/piggy/intercept/scripts.d.ts.map +0 -1
- package/dist/piggy/launch/detect.d.ts +0 -3
- package/dist/piggy/launch/detect.d.ts.map +0 -1
- package/dist/piggy/launch/spawn.d.ts +0 -6
- package/dist/piggy/launch/spawn.d.ts.map +0 -1
- package/dist/piggy/logger/index.d.ts +0 -3
- package/dist/piggy/logger/index.d.ts.map +0 -1
- package/dist/piggy/media/index.d.ts +0 -11
- package/dist/piggy/media/index.d.ts.map +0 -1
- package/dist/piggy/navigation/index.d.ts +0 -16
- package/dist/piggy/navigation/index.d.ts.map +0 -1
- package/dist/piggy/pool/index.d.ts +0 -23
- package/dist/piggy/pool/index.d.ts.map +0 -1
- package/dist/piggy/provide/index.d.ts +0 -98
- package/dist/piggy/provide/index.d.ts.map +0 -1
- package/dist/piggy/proxy/index.d.ts +0 -94
- package/dist/piggy/proxy/index.d.ts.map +0 -1
- package/dist/piggy/register/index.d.ts +0 -9
- package/dist/piggy/register/index.d.ts.map +0 -1
- package/dist/piggy/router/index.d.ts +0 -38
- package/dist/piggy/router/index.d.ts.map +0 -1
- package/dist/piggy/server/index.d.ts +0 -42
- package/dist/piggy/server/index.d.ts.map +0 -1
- package/dist/piggy/session/index.d.ts +0 -27
- package/dist/piggy/session/index.d.ts.map +0 -1
- package/dist/piggy/store/index.d.ts +0 -22
- package/dist/piggy/store/index.d.ts.map +0 -1
- package/dist/piggy/tabs/index.d.ts +0 -12
- package/dist/piggy/tabs/index.d.ts.map +0 -1
- package/dist/piggy/wait/index.d.ts +0 -28
- package/dist/piggy/wait/index.d.ts.map +0 -1
- package/dist/piggy.d.ts +0 -10
- package/dist/piggy.d.ts.map +0 -1
- package/dist/piggy.js +0 -30223
- package/dist/register/index.js +0 -23710
- package/dist/server/index.js +0 -26831
- package/piggy/capture/index.ts +0 -76
- package/piggy/export/index.d.ts +0 -117
- package/piggy/export/index.ts +0 -147
- package/piggy/expose/index.ts +0 -42
- package/piggy/iframe/index.ts +0 -79
- package/piggy/intercept/scripts.d.ts +0 -13
- package/piggy/intercept/scripts.d.ts.map +0 -1
- package/piggy/launch/detect.d.ts +0 -3
- package/piggy/launch/detect.d.ts.map +0 -1
- package/piggy/launch/spawn.d.ts +0 -6
- package/piggy/launch/spawn.d.ts.map +0 -1
- package/piggy/logger/index.d.ts +0 -3
- package/piggy/logger/index.d.ts.map +0 -1
- package/piggy/pool/index.d.ts +0 -12
- package/piggy/pool/index.ts +0 -75
- package/piggy/provide/index.ts +0 -170
- package/piggy/proxy/index.ts +0 -154
- package/piggy/register/index.ts +0 -575
- package/piggy/router/index.ts +0 -69
- package/piggy/session/index.ts +0 -76
- package/piggy/store/index.d.ts +0 -26
- package/piggy/tabs/index.ts +0 -23
- package/piggy/wait/index.ts +0 -90
- /package/piggy/logger/{index.ts → index.js} +0 -0
package/piggy/session/index.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// piggy/session/index.ts
|
|
2
|
-
import { PiggyClient } from "../client";
|
|
3
|
-
import type { CookieSetOptions, CookieDeleteOptions } from "../export";
|
|
4
|
-
|
|
5
|
-
export interface SessionPaths {
|
|
6
|
-
workDir: string;
|
|
7
|
-
cookies: string;
|
|
8
|
-
profile: string;
|
|
9
|
-
ws: string;
|
|
10
|
-
pings: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class SessionClient {
|
|
14
|
-
constructor(private client: PiggyClient) {}
|
|
15
|
-
|
|
16
|
-
// Session lifecycle
|
|
17
|
-
reload(tabId = "default"): Promise<void> {
|
|
18
|
-
return this.client.send("session.reload", { tabId });
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Paths
|
|
22
|
-
paths(): Promise<SessionPaths> {
|
|
23
|
-
return this.client.send("session.paths", {});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
cookiesPath(): Promise<string> {
|
|
27
|
-
return this.client.send("session.cookies.path", {});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
profilePath(): Promise<string> {
|
|
31
|
-
return this.client.send("session.profile.path", {});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
wsPath(): Promise<string> {
|
|
35
|
-
return this.client.send("session.ws.path", {});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
pingsPath(): Promise<string> {
|
|
39
|
-
return this.client.send("session.pings.path", {});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Opt-in persistence
|
|
43
|
-
setWsSave(enabled: boolean): Promise<void> {
|
|
44
|
-
return this.client.send("session.ws.save", { enabled });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
setPingsSave(enabled: boolean): Promise<void> {
|
|
48
|
-
return this.client.send("session.pings.save", { enabled });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Export / import
|
|
52
|
-
async export(tabId = "default"): Promise<any> {
|
|
53
|
-
const raw = await this.client.send<string>("session.export", { tabId });
|
|
54
|
-
return typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
import(data: any, tabId = "default"): Promise<void> {
|
|
58
|
-
return this.client.send("session.import", {
|
|
59
|
-
data: JSON.stringify(data),
|
|
60
|
-
tabId,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Cookies (using imported types from export)
|
|
65
|
-
setCookie(opts: CookieSetOptions, tabId = "default"): Promise<void> {
|
|
66
|
-
return this.client.send("cookie.set", { ...opts, tabId });
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
deleteCookie(opts: CookieDeleteOptions, tabId = "default"): Promise<void> {
|
|
70
|
-
return this.client.send("cookie.delete", { ...opts, tabId });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function createSessionAPI(client: PiggyClient): SessionClient {
|
|
75
|
-
return new SessionClient(client);
|
|
76
|
-
}
|
package/piggy/store/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// piggy/store/index.d.ts
|
|
2
|
-
export type FieldType = "string" | "number" | "boolean" | "object" | "array";
|
|
3
|
-
|
|
4
|
-
export interface FieldSchema {
|
|
5
|
-
type: FieldType;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
default?: any;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface StoreSchema {
|
|
11
|
-
name: string;
|
|
12
|
-
destination: string;
|
|
13
|
-
fields: Record<string, FieldSchema>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface PiggyStoreConfig {
|
|
17
|
-
stores: StoreSchema[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export declare function loadStoreConfig(configPath?: string): PiggyStoreConfig;
|
|
21
|
-
export declare function getSchema(storeName: string): StoreSchema | null;
|
|
22
|
-
export declare function shapeRecord(data: Record<string, any>, schema: StoreSchema): Record<string, any>;
|
|
23
|
-
export declare function storeRecord(
|
|
24
|
-
storeName: string,
|
|
25
|
-
data: Record<string, any> | Record<string, any>[]
|
|
26
|
-
): Promise<{ stored: number; skipped: number }>;
|
package/piggy/tabs/index.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// piggy/tabs/index.ts
|
|
2
|
-
import { PiggyClient } from "../client";
|
|
3
|
-
|
|
4
|
-
export class TabsClient {
|
|
5
|
-
constructor(private client: PiggyClient) {}
|
|
6
|
-
|
|
7
|
-
new(): Promise<string> {
|
|
8
|
-
return this.client.send("tab.new", {});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
close(opts: string | { tabId: string }): Promise<void> {
|
|
12
|
-
const tabId = typeof opts === "string" ? opts : opts.tabId;
|
|
13
|
-
return this.client.send("tab.close", { tabId });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
list(): Promise<string[]> {
|
|
17
|
-
return this.client.send("tab.list", {});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function createTabsAPI(client: PiggyClient): TabsClient {
|
|
22
|
-
return new TabsClient(client);
|
|
23
|
-
}
|
package/piggy/wait/index.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// piggy/wait/index.ts
|
|
2
|
-
import { PiggyClient } from "../client";
|
|
3
|
-
|
|
4
|
-
export type WaitSelectorState = "attached" | "detached" | "visible" | "hidden";
|
|
5
|
-
|
|
6
|
-
// ─── WaitClient ───────────────────────────────────────────────────────────────
|
|
7
|
-
// Maps to PiggyWait.cpp
|
|
8
|
-
|
|
9
|
-
export class WaitClient {
|
|
10
|
-
constructor(private client: PiggyClient) {}
|
|
11
|
-
|
|
12
|
-
// wait.function — poll every 100ms until JS expr is truthy
|
|
13
|
-
function(js: string, timeout = 10000, tabId = "default"): Promise<void> {
|
|
14
|
-
return this.client.send("wait.function", { js, timeout, tabId });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// wait.selector — with full state support (attached|detached|visible|hidden)
|
|
18
|
-
selector(
|
|
19
|
-
selector: string,
|
|
20
|
-
state: WaitSelectorState = "attached",
|
|
21
|
-
timeout = 10000,
|
|
22
|
-
tabId = "default"
|
|
23
|
-
): Promise<void> {
|
|
24
|
-
return this.client.send("wait.selector", { selector, state, timeout, tabId });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ─── EvaluateClient ───────────────────────────────────────────────────────────
|
|
29
|
-
// Maps to the evaluate command in PiggyWait.cpp (with timeout support)
|
|
30
|
-
// and PiggyInteractions.cpp (without timeout)
|
|
31
|
-
|
|
32
|
-
export class EvaluateClient {
|
|
33
|
-
constructor(private client: PiggyClient) {}
|
|
34
|
-
|
|
35
|
-
// evaluate with optional wall-clock timeout
|
|
36
|
-
run(js: string, timeout?: number, tabId = "default"): Promise<unknown> {
|
|
37
|
-
return this.client.send("evaluate", {
|
|
38
|
-
js,
|
|
39
|
-
tabId,
|
|
40
|
-
...(timeout !== undefined ? { timeout } : {}),
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ─── FetchClient ──────────────────────────────────────────────────────────────
|
|
46
|
-
// Maps to fetch.textAll / fetch.attr / fetch.attrAll in PiggyWait.cpp
|
|
47
|
-
// and fetch.text / fetch.links / fetch.image in PiggyExport.cpp
|
|
48
|
-
|
|
49
|
-
export class FetchClient {
|
|
50
|
-
constructor(private client: PiggyClient) {}
|
|
51
|
-
|
|
52
|
-
// fetch.text — single element innerText
|
|
53
|
-
text(selector: string, tabId = "default"): Promise<string | null> {
|
|
54
|
-
return this.client.send("fetch.text", { query: selector, tabId });
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// fetch.textAll — all matching elements innerText
|
|
58
|
-
textAll(selector: string, tabId = "default"): Promise<string[]> {
|
|
59
|
-
return this.client.send("fetch.textAll", { selector, tabId });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// fetch.attr — single attribute from first match
|
|
63
|
-
attr(selector: string, attr: string, tabId = "default"): Promise<string | null> {
|
|
64
|
-
return this.client.send("fetch.attr", { selector, attr, tabId });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// fetch.attrAll — attribute from all matches
|
|
68
|
-
attrAll(selector: string, attr: string, tabId = "default"): Promise<string[]> {
|
|
69
|
-
return this.client.send("fetch.attrAll", { selector, attr, tabId });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// fetch.links — links inside a selector
|
|
73
|
-
links(selector: string, tabId = "default"): Promise<string[]> {
|
|
74
|
-
return this.client.send("fetch.links", { query: selector, tabId });
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// fetch.links.all — all links on page
|
|
78
|
-
linksAll(tabId = "default"): Promise<string[]> {
|
|
79
|
-
return this.client.send("fetch.links.all", { tabId });
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// fetch.image — images inside a selector
|
|
83
|
-
images(selector: string, tabId = "default"): Promise<string[]> {
|
|
84
|
-
return this.client.send("fetch.image", { query: selector, tabId });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function createWaitAPI(client: PiggyClient): WaitClient { return new WaitClient(client); }
|
|
89
|
-
export function createEvaluateAPI(client: PiggyClient): EvaluateClient { return new EvaluateClient(client); }
|
|
90
|
-
export function createFetchAPI(client: PiggyClient): FetchClient { return new FetchClient(client); }
|
|
File without changes
|