@spider-cloud/spider-client 0.1.70 → 0.1.72

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 (2) hide show
  1. package/dist/config.d.ts +88 -31
  2. package/package.json +1 -1
package/dist/config.d.ts CHANGED
@@ -103,7 +103,7 @@ interface Delay {
103
103
  * @property {Delay} [delay] - Configuration to wait for a delay.
104
104
  * @property {boolean} [page_navigations] - Whether to wait for page navigations.
105
105
  */
106
- interface WaitFor {
106
+ export interface WaitForConfiguration {
107
107
  idle_network?: IdleNetwork;
108
108
  selector?: Selector;
109
109
  dom?: Selector;
@@ -134,30 +134,85 @@ type CSSSelector = {
134
134
  type CSSExtractionMap = {
135
135
  [path: string]: CSSSelector[];
136
136
  };
137
- export type WebAutomation = {
138
- Evaluate: string;
139
- } | {
140
- Click: string;
141
- } | {
142
- Wait: number;
143
- } | {
144
- WaitForNavigation: boolean;
145
- } | {
146
- WaitFor: string;
147
- } | {
148
- WaitForAndClick: string;
149
- } | {
150
- ScrollX: number;
151
- } | {
152
- ScrollY: number;
153
- } | {
154
- Fill: {
155
- selector: string;
156
- value?: string;
157
- };
158
- } | {
159
- InfiniteScroll: number;
137
+ export type Evaluate = {
138
+ type: "Evaluate";
139
+ /** Rust: Evaluate(String) */
140
+ code: string;
141
+ };
142
+ export type Click = {
143
+ type: "Click";
144
+ /** Rust: Click(String) */
145
+ selector: string;
146
+ };
147
+ export type ClickAll = {
148
+ type: "ClickAll";
149
+ /** Rust: ClickAll(String) */
150
+ selector: string;
151
+ };
152
+ export type ClickAllClickable = {
153
+ type: "ClickAllClickable";
154
+ };
155
+ export type Wait = {
156
+ type: "Wait";
157
+ /** Rust: u64 (milliseconds) */
158
+ ms: number;
159
+ };
160
+ export type WaitForNavigation = {
161
+ type: "WaitForNavigation";
162
+ };
163
+ export type WaitForDom = {
164
+ type: "WaitForDom";
165
+ /** Rust: Option<String> */
166
+ selector?: string | null;
167
+ /** Rust: u32 (milliseconds) */
168
+ timeout: number;
169
+ };
170
+ export type WaitFor = {
171
+ type: "WaitFor";
172
+ /** Rust: String */
173
+ selector: string;
174
+ };
175
+ export type WaitForWithTimeout = {
176
+ type: "WaitForWithTimeout";
177
+ selector: string;
178
+ /** Rust: u64 (milliseconds) */
179
+ timeout: number;
180
+ };
181
+ export type WaitForAndClick = {
182
+ type: "WaitForAndClick";
183
+ selector: string;
184
+ };
185
+ export type ScrollX = {
186
+ type: "ScrollX";
187
+ /** Rust: i32 (pixels) */
188
+ dx: number;
189
+ };
190
+ export type ScrollY = {
191
+ type: "ScrollY";
192
+ /** Rust: i32 (pixels) */
193
+ dy: number;
194
+ };
195
+ export type Fill = {
196
+ type: "Fill";
197
+ selector: string;
198
+ value: string;
199
+ };
200
+ export type InfiniteScroll = {
201
+ type: "InfiniteScroll";
202
+ /** Rust: u32 (pixels/step or count—match your semantics) */
203
+ step_px: number;
204
+ };
205
+ export type Screenshot = {
206
+ type: "Screenshot";
207
+ /** Keep snake_case to match Rust JSON if interop is needed */
208
+ full_page: boolean;
209
+ omit_background: boolean;
210
+ output: string;
160
211
  };
212
+ export type ValidateChain = {
213
+ type: "ValidateChain";
214
+ };
215
+ export type WebAutomation = Evaluate | Click | ClickAll | ClickAllClickable | Wait | WaitForNavigation | WaitForDom | WaitFor | WaitForWithTimeout | WaitForAndClick | ScrollX | ScrollY | Fill | InfiniteScroll | Screenshot | ValidateChain;
161
216
  export type ReturnFormat = "markdown" | "commonmark" | "raw" | "screenshot" | "text" | "html2text" | "bytes" | "xml" | "empty";
162
217
  export type WebAutomationMap = Record<string, WebAutomation[]>;
163
218
  export type ExecutionScriptsMap = Record<string, string>;
@@ -165,6 +220,11 @@ export declare enum RedirectPolicy {
165
220
  Loose = "Loose",
166
221
  Strict = "Strict"
167
222
  }
223
+ export type EventTracker = {
224
+ responses?: true;
225
+ requests?: true;
226
+ automation?: boolean;
227
+ };
168
228
  /**
169
229
  * Proxy pool selection for outbound request routing.
170
230
  * Choose a pool based on your use case (e.g., stealth, speed, or stability).
@@ -354,7 +414,7 @@ export interface SpiderParams {
354
414
  /**
355
415
  * The wait for events on the page. You need to make your `request` `chrome` or `smart`.
356
416
  */
357
- wait_for?: WaitFor;
417
+ wait_for?: WaitForConfiguration;
358
418
  /**
359
419
  * Disable request interception when running 'request' as 'chrome' or 'smart'. This can help when the page uses 3rd party or external scripts to load content.
360
420
  */
@@ -374,10 +434,7 @@ export interface SpiderParams {
374
434
  /**
375
435
  * Track the request sent and responses received for `chrome` or `smart`. The responses will track the bytes used and the requests will have the monotime sent.
376
436
  */
377
- event_tracker?: {
378
- responses?: true;
379
- requests?: true;
380
- };
437
+ event_tracker?: EventTracker;
381
438
  /**
382
439
  * The timeout to stop the crawl.
383
440
  */
@@ -387,7 +444,7 @@ export interface SpiderParams {
387
444
  */
388
445
  evaluate_on_new_document?: string;
389
446
  /**
390
- * Runs the request using lite_mode:Lite mode reduces data transfer costs by 70%, with trade-offs in speed, accuracy,
447
+ * Runs the request using lite_mode:Lite mode reduces data transfer costs by 50%, with trade-offs in speed, accuracy,
391
448
  * geo-targeting, and reliability. It’s best suited for non-urgent data collection or when
392
449
  * targeting websites with minimal anti-bot protections.
393
450
  */
@@ -413,7 +470,7 @@ export interface SpiderParams {
413
470
  */
414
471
  proxy?: Proxy;
415
472
  /**
416
- * Use a remote proxy at ~70% reduced cost for file downloads.
473
+ * Use a remote proxy at ~50% reduced cost for file downloads.
417
474
  * This requires bringing your own proxy (e.g., static IP tunnel).
418
475
  */
419
476
  remote_proxy?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spider-cloud/spider-client",
3
- "version": "0.1.70",
3
+ "version": "0.1.72",
4
4
  "description": "Isomorphic Javascript SDK for Spider Cloud services",
5
5
  "scripts": {
6
6
  "test": "node --import tsx --test __tests__/*test.ts",