@spider-cloud/spider-client 0.0.64 → 0.0.66

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 +45 -0
  2. package/package.json +3 -3
package/dist/config.d.ts CHANGED
@@ -102,6 +102,39 @@ type CSSSelector = {
102
102
  type CSSExtractionMap = {
103
103
  [path: string]: CSSSelector[];
104
104
  };
105
+ export type WebAutomation = {
106
+ type: "Evaluate";
107
+ code: string;
108
+ } | {
109
+ type: "Click";
110
+ selector: string;
111
+ } | {
112
+ type: "Wait";
113
+ duration: number;
114
+ } | {
115
+ type: "WaitForNavigation";
116
+ } | {
117
+ type: "WaitFor";
118
+ selector: string;
119
+ } | {
120
+ type: "WaitForAndClick";
121
+ selector: string;
122
+ } | {
123
+ type: "ScrollX";
124
+ pixels: number;
125
+ } | {
126
+ type: "ScrollY";
127
+ pixels: number;
128
+ } | {
129
+ type: "Fill";
130
+ selector: string;
131
+ value: string;
132
+ } | {
133
+ type: "InfiniteScroll";
134
+ times: number;
135
+ };
136
+ export type WebAutomationMap = Record<string, WebAutomation[]>;
137
+ export type ExecutionScriptsMap = Record<string, string>;
105
138
  /**
106
139
  * Represents the options available for making a spider request.
107
140
  */
@@ -246,6 +279,10 @@ export interface SpiderParams {
246
279
  * Specifies whether to run the request in the background.
247
280
  */
248
281
  run_in_background?: boolean;
282
+ /**
283
+ * Perform an infinite scroll on the page as new content arises. The request param also needs to be set to 'chrome' or 'smart'.
284
+ */
285
+ scroll?: number;
249
286
  /**
250
287
  * Specifies whether to skip configuration checks.
251
288
  */
@@ -262,6 +299,14 @@ export interface SpiderParams {
262
299
  * 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.
263
300
  */
264
301
  disable_intercept?: boolean;
302
+ /**
303
+ * Perform custom web automated tasks on a url or url path. You need to make your `request` `chrome` or `smart`.
304
+ */
305
+ automation_scripts?: WebAutomationMap;
306
+ /**
307
+ * Perform custom Javascript tasks on a url or url path. You need to make your `request` `chrome` or `smart`.
308
+ */
309
+ execution_scripts?: ExecutionScriptsMap;
265
310
  }
266
311
  export type SpiderCoreResponse = {
267
312
  content?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spider-cloud/spider-client",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "description": "Isomorphic Javascript SDK for Spider Cloud services",
5
5
  "scripts": {
6
6
  "test": "node --import tsx --test __tests__/*test.ts",
@@ -23,10 +23,10 @@
23
23
  "author": "Jeff Mendez<jeff@a11ywatch.com>",
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@supabase/supabase-js": "^2.44.3",
26
+ "@supabase/supabase-js": "^2.45.0",
27
27
  "@types/node": "20.14.2",
28
28
  "dotenv": "^16.4.5",
29
- "tsx": "^4.16.2",
29
+ "tsx": "^4.16.5",
30
30
  "typescript": "5.4.5"
31
31
  }
32
32
  }