sprntrl 0.1.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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -0
  3. package/dist/client.d.ts +33 -0
  4. package/dist/client.js +57 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/core/error.d.ts +46 -0
  7. package/dist/core/error.js +72 -0
  8. package/dist/core/error.js.map +1 -0
  9. package/dist/core/request.d.ts +24 -0
  10. package/dist/core/request.js +107 -0
  11. package/dist/core/request.js.map +1 -0
  12. package/dist/core/resource.d.ts +5 -0
  13. package/dist/core/resource.js +7 -0
  14. package/dist/core/resource.js.map +1 -0
  15. package/dist/index.d.ts +8 -0
  16. package/dist/index.js +4 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/lib/browser.d.ts +7 -0
  19. package/dist/lib/browser.js +56 -0
  20. package/dist/lib/browser.js.map +1 -0
  21. package/dist/resources/api-keys.d.ts +11 -0
  22. package/dist/resources/api-keys.js +28 -0
  23. package/dist/resources/api-keys.js.map +1 -0
  24. package/dist/resources/ip-whitelist.d.ts +10 -0
  25. package/dist/resources/ip-whitelist.js +28 -0
  26. package/dist/resources/ip-whitelist.js.map +1 -0
  27. package/dist/resources/profiles.d.ts +19 -0
  28. package/dist/resources/profiles.js +51 -0
  29. package/dist/resources/profiles.js.map +1 -0
  30. package/dist/resources/session-files.d.ts +10 -0
  31. package/dist/resources/session-files.js +36 -0
  32. package/dist/resources/session-files.js.map +1 -0
  33. package/dist/resources/sessions.d.ts +72 -0
  34. package/dist/resources/sessions.js +195 -0
  35. package/dist/resources/sessions.js.map +1 -0
  36. package/dist/resources/templates.d.ts +5 -0
  37. package/dist/resources/templates.js +11 -0
  38. package/dist/resources/templates.js.map +1 -0
  39. package/dist/resources/usage.d.ts +6 -0
  40. package/dist/resources/usage.js +17 -0
  41. package/dist/resources/usage.js.map +1 -0
  42. package/dist/resources/user.d.ts +26 -0
  43. package/dist/resources/user.js +38 -0
  44. package/dist/resources/user.js.map +1 -0
  45. package/dist/types.d.ts +148 -0
  46. package/dist/types.js +2 -0
  47. package/dist/types.js.map +1 -0
  48. package/package.json +61 -0
@@ -0,0 +1,148 @@
1
+ export type ProxyProtocol = "HTTP" | "HTTPS" | "SOCKS5";
2
+ export type SessionStatus = "creating" | "running" | "stopping" | "stopped" | "failed" | "archiving";
3
+ export type OS = "macos" | "windows";
4
+ export interface ProxyConfig {
5
+ protocol?: ProxyProtocol;
6
+ host?: string;
7
+ port?: number;
8
+ username?: string;
9
+ password?: string;
10
+ }
11
+ /**
12
+ * Flattened, display-friendly view of the proxy attached to a session.
13
+ * Only present for BYO (bring-your-own) proxies — pool proxies are shared
14
+ * infra and the API deliberately hides their host/port. The password is
15
+ * never returned.
16
+ */
17
+ export interface ProxySummary {
18
+ protocol: string;
19
+ host: string;
20
+ port: number;
21
+ username?: string;
22
+ /** Convenience form: `protocol://host:port`. */
23
+ address: string;
24
+ }
25
+ export interface Session {
26
+ id: string;
27
+ user_id: string;
28
+ profile_id?: string | null;
29
+ container_id?: string | null;
30
+ chrome_port?: number | null;
31
+ status: SessionStatus;
32
+ persistent: boolean;
33
+ captcha_solver: boolean;
34
+ session_name?: string | null;
35
+ data_dir_path?: string | null;
36
+ data_dir_size: number;
37
+ storage_status: string;
38
+ os: OS;
39
+ location: string;
40
+ started_at?: string | null;
41
+ stopped_at?: string | null;
42
+ created_at: string;
43
+ cdp_url?: string;
44
+ uptime_seconds: number;
45
+ sidecar_port?: number;
46
+ /** Present only for BYO-proxy sessions. */
47
+ proxy?: ProxySummary;
48
+ }
49
+ export interface PaginatedSessions {
50
+ sessions: Session[];
51
+ total: number;
52
+ page: number;
53
+ per_page: number;
54
+ }
55
+ export interface Profile {
56
+ id: string;
57
+ user_id: string;
58
+ name: string;
59
+ description?: string | null;
60
+ os?: string | null;
61
+ location?: string | null;
62
+ persona?: string | null;
63
+ config_json: unknown;
64
+ template_id?: string | null;
65
+ created_at: string;
66
+ updated_at: string;
67
+ }
68
+ export interface Template {
69
+ id: string;
70
+ name: string;
71
+ os: string;
72
+ config: unknown;
73
+ }
74
+ export interface IPWhitelistEntry {
75
+ id: string;
76
+ user_id: string;
77
+ ip_address: string;
78
+ label?: string | null;
79
+ created_at: string;
80
+ }
81
+ export interface APIKey {
82
+ id: string;
83
+ name: string;
84
+ key_prefix: string;
85
+ last_used_at?: string | null;
86
+ created_at: string;
87
+ revoked_at?: string | null;
88
+ }
89
+ export interface APIKeyCreated extends APIKey {
90
+ /** Returned ONLY once at creation time. Store it immediately. */
91
+ key: string;
92
+ }
93
+ export interface Usage {
94
+ total_minutes: number;
95
+ plan_minutes: number;
96
+ overage_minutes: number;
97
+ month: string;
98
+ plan: string;
99
+ usage_percentage: number;
100
+ allow_hours_overage: boolean;
101
+ /** Present when the plan exposes a profile cap. */
102
+ profile_count?: number;
103
+ max_profiles?: number;
104
+ /** Pool-proxy bandwidth, cents per GB. */
105
+ bandwidth_rate_cents?: number;
106
+ /** Charge per hour over the plan's included minutes, in cents. */
107
+ hours_overage_rate_cents?: number;
108
+ /** Bytes of pool-proxy bandwidth consumed this period. */
109
+ bandwidth_bytes?: number;
110
+ /** Accrued bandwidth overage charge this period, in cents. */
111
+ bandwidth_charge_amount_cents?: number;
112
+ /** Minutes used beyond the plan allowance this period. */
113
+ hours_overage_minutes?: number;
114
+ /** Accrued hours-overage charge this period, in cents. */
115
+ hours_overage_amount_cents?: number;
116
+ }
117
+ export interface UsageMonth {
118
+ month: string;
119
+ total_minutes: number;
120
+ plan_minutes: number;
121
+ overage_minutes: number;
122
+ }
123
+ export type AccountStatus = "pending_verification" | "pending_payment" | "active";
124
+ export interface User {
125
+ id: string;
126
+ email: string;
127
+ name?: string | null;
128
+ plan: string;
129
+ role: string;
130
+ allow_hours_overage: boolean;
131
+ /** When true, the account may only use BYO proxies (no pool proxy). */
132
+ byo_proxy_only: boolean;
133
+ /** Pool-proxy bandwidth, cents per GB. */
134
+ bandwidth_rate_cents: number;
135
+ /** Charge per hour over the plan's included minutes, in cents. */
136
+ hours_overage_rate_cents: number;
137
+ must_change_password: boolean;
138
+ email_verified: boolean;
139
+ account_status: AccountStatus;
140
+ /** Set for OAuth signups ("google" | "github"); absent for password accounts. */
141
+ oauth_provider?: string;
142
+ created_at: string;
143
+ }
144
+ export interface FileInfo {
145
+ name: string;
146
+ size: number;
147
+ modified?: string;
148
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "sprntrl",
3
+ "version": "0.1.0",
4
+ "description": "Supernatural Node SDK — stealth browser-as-a-service client.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "typecheck": "tsc --noEmit",
25
+ "clean": "rm -rf dist",
26
+ "prepublishOnly": "npm run clean && npm run build"
27
+ },
28
+ "keywords": [
29
+ "browser",
30
+ "automation",
31
+ "playwright",
32
+ "puppeteer",
33
+ "cdp",
34
+ "stealth",
35
+ "scraping"
36
+ ],
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/supernatural-browser/sprntrl-node.git"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/supernatural-browser/sprntrl-node/issues"
43
+ },
44
+ "homepage": "https://supernatural.sh",
45
+ "author": "Supernatural",
46
+ "license": "MIT",
47
+ "peerDependencies": {
48
+ "playwright": "^1.40.0",
49
+ "puppeteer": "^22.0.0",
50
+ "puppeteer-core": "^22.0.0"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "playwright": { "optional": true },
54
+ "puppeteer": { "optional": true },
55
+ "puppeteer-core": { "optional": true }
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^20.0.0",
59
+ "typescript": "^5.4.0"
60
+ }
61
+ }