File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 },
1717 "overrides" : [
1818 {
19- "include" : [" tests/**" ],
19+ "include" : [" tests/**" , " src/commands/** " ],
2020 "linter" : {
2121 "rules" : {
2222 "suspicious" : {
Original file line number Diff line number Diff line change 11import { defineCommand } from "citty" ;
2- import type { ApiCrawlOptions } from "scrapegraph-js" ;
32import { createClient } from "../lib/client.js" ;
43import * as log from "../lib/log.js" ;
54
@@ -39,7 +38,7 @@ export default defineCommand({
3938 out . docs ( "https://docs.scrapegraphai.com/api-reference/crawl" ) ;
4039 const sgai = await createClient ( ! ! args . json ) ;
4140
42- const crawlOptions : ApiCrawlOptions = { } ;
41+ const crawlOptions : Record < string , unknown > = { } ;
4342 if ( args [ "max-pages" ] ) crawlOptions . maxPages = Number ( args [ "max-pages" ] ) ;
4443 if ( args [ "max-depth" ] ) crawlOptions . maxDepth = Number ( args [ "max-depth" ] ) ;
4544 if ( args [ "max-links-per-page" ] )
@@ -54,7 +53,7 @@ export default defineCommand({
5453 out . start ( "Crawling" ) ;
5554 const t0 = performance . now ( ) ;
5655 try {
57- const job = await sgai . crawl . start ( args . url , crawlOptions ) ;
56+ const job = await sgai . crawl . start ( args . url , crawlOptions as any ) ;
5857 const jobId = ( job . data as { id : string } ) . id ;
5958
6059 if ( ! jobId ) {
Original file line number Diff line number Diff line change 11import { defineCommand } from "citty" ;
2- import type { ApiExtractOptions } from "scrapegraph-js" ;
32import { createClient } from "../lib/client.js" ;
43import * as log from "../lib/log.js" ;
54
@@ -42,14 +41,14 @@ export default defineCommand({
4241 if ( args . headers ) fetchConfig . headers = JSON . parse ( args . headers ) ;
4342 if ( args . country ) fetchConfig . country = args . country ;
4443
45- const extractOptions : ApiExtractOptions = { prompt : args . prompt } ;
44+ const extractOptions : Record < string , unknown > = { prompt : args . prompt } ;
4645 if ( args . schema ) extractOptions . schema = JSON . parse ( args . schema ) ;
4746 if ( Object . keys ( fetchConfig ) . length > 0 ) extractOptions . fetchConfig = fetchConfig ;
4847
4948 out . start ( "Extracting" ) ;
5049 const t0 = performance . now ( ) ;
5150 try {
52- const result = await sgai . extract ( args . url , extractOptions ) ;
51+ const result = await sgai . extract ( args . url , extractOptions as any ) ;
5352 out . stop ( Math . round ( performance . now ( ) - t0 ) ) ;
5453 out . result ( result . data ) ;
5554 } catch ( err ) {
Original file line number Diff line number Diff line change 11import { defineCommand } from "citty" ;
2- import type { ApiScrapeOptions } from "scrapegraph-js" ;
32import { createClient } from "../lib/client.js" ;
43import * as log from "../lib/log.js" ;
54
@@ -29,13 +28,13 @@ export default defineCommand({
2928 if ( args . stealth ) fetchConfig . stealth = true ;
3029 if ( args . headers ) fetchConfig . headers = JSON . parse ( args . headers ) ;
3130
32- const scrapeOptions : ApiScrapeOptions = { format : "markdown" } ;
31+ const scrapeOptions : Record < string , unknown > = { format : "markdown" } ;
3332 if ( Object . keys ( fetchConfig ) . length > 0 ) scrapeOptions . fetchConfig = fetchConfig ;
3433
3534 out . start ( "Converting to markdown" ) ;
3635 const t0 = performance . now ( ) ;
3736 try {
38- const result = await sgai . scrape ( args . url , scrapeOptions ) ;
37+ const result = await sgai . scrape ( args . url , scrapeOptions as any ) ;
3938 out . stop ( Math . round ( performance . now ( ) - t0 ) ) ;
4039 out . result ( result . data ) ;
4140 } catch ( err ) {
Original file line number Diff line number Diff line change 11import { defineCommand } from "citty" ;
2- import type { ApiScrapeOptions } from "scrapegraph-js" ;
32import { createClient } from "../lib/client.js" ;
43import * as log from "../lib/log.js" ;
54
@@ -106,13 +105,13 @@ export default defineCommand({
106105 }
107106 } ) ;
108107
109- const scrapeOptions : ApiScrapeOptions = { formats } ;
108+ const scrapeOptions : Record < string , unknown > = { formats } ;
110109 if ( Object . keys ( fetchConfig ) . length > 0 ) scrapeOptions . fetchConfig = fetchConfig ;
111110
112111 out . start ( "Scraping" ) ;
113112 const t0 = performance . now ( ) ;
114113 try {
115- const result = await sgai . scrape ( args . url , scrapeOptions ) ;
114+ const result = await sgai . scrape ( args . url , scrapeOptions as any ) ;
116115 out . stop ( Math . round ( performance . now ( ) - t0 ) ) ;
117116 out . result ( result . data ) ;
118117 } catch ( err ) {
Original file line number Diff line number Diff line change 11import { defineCommand } from "citty" ;
2- import type { ApiSearchOptions } from "scrapegraph-js" ;
32import { createClient } from "../lib/client.js" ;
43import * as log from "../lib/log.js" ;
54
@@ -49,7 +48,7 @@ export default defineCommand({
4948 out . docs ( "https://docs.scrapegraphai.com/api-reference/search" ) ;
5049 const sgai = await createClient ( ! ! args . json ) ;
5150
52- const searchOptions : ApiSearchOptions = { } ;
51+ const searchOptions : Record < string , unknown > = { } ;
5352 if ( args [ "num-results" ] ) searchOptions . numResults = Number ( args [ "num-results" ] ) ;
5453 if ( args . schema ) searchOptions . schema = JSON . parse ( args . schema ) ;
5554 if ( args . prompt ) searchOptions . prompt = args . prompt ;
@@ -62,7 +61,7 @@ export default defineCommand({
6261 out . start ( "Searching" ) ;
6362 const t0 = performance . now ( ) ;
6463 try {
65- const result = await sgai . search ( args . query , searchOptions ) ;
64+ const result = await sgai . search ( args . query , searchOptions as any ) ;
6665 out . stop ( Math . round ( performance . now ( ) - t0 ) ) ;
6766 out . result ( result . data ) ;
6867 } catch ( err ) {
You can’t perform that action at this time.
0 commit comments