@mendable/firecrawl-js 0.0.6 → 0.0.8
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/build/index.js +7 -14
- package/package.json +3 -1
- package/src/index.ts +1 -1
- package/tsconfig.json +2 -2
package/build/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,15 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.FirecrawlApp = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
18
|
-
dotenv_1.default.config();
|
|
19
|
-
class FirecrawlApp {
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import dotenv from 'dotenv';
|
|
12
|
+
dotenv.config();
|
|
13
|
+
export default class FirecrawlApp {
|
|
20
14
|
constructor({ apiKey = null }) {
|
|
21
15
|
this.apiKey = apiKey || process.env.FIRECRAWL_API_KEY || '';
|
|
22
16
|
if (!this.apiKey) {
|
|
@@ -34,7 +28,7 @@ class FirecrawlApp {
|
|
|
34
28
|
jsonData = Object.assign(Object.assign({}, jsonData), params);
|
|
35
29
|
}
|
|
36
30
|
try {
|
|
37
|
-
const response = yield
|
|
31
|
+
const response = yield axios.post('https://api.firecrawl.dev/v0/scrape', jsonData, { headers });
|
|
38
32
|
if (response.status === 200) {
|
|
39
33
|
const responseData = response.data;
|
|
40
34
|
if (responseData.success) {
|
|
@@ -105,10 +99,10 @@ class FirecrawlApp {
|
|
|
105
99
|
};
|
|
106
100
|
}
|
|
107
101
|
postRequest(url, data, headers) {
|
|
108
|
-
return
|
|
102
|
+
return axios.post(url, data, { headers });
|
|
109
103
|
}
|
|
110
104
|
getRequest(url, headers) {
|
|
111
|
-
return
|
|
105
|
+
return axios.get(url, { headers });
|
|
112
106
|
}
|
|
113
107
|
monitorJobStatus(jobId, headers, timeout) {
|
|
114
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -150,4 +144,3 @@ class FirecrawlApp {
|
|
|
150
144
|
}
|
|
151
145
|
}
|
|
152
146
|
}
|
|
153
|
-
exports.FirecrawlApp = FirecrawlApp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mendable/firecrawl-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "JavaScript SDK for Firecrawl API",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/mendableai/firecrawl-js#readme",
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@types/axios": "^0.14.0",
|
|
26
|
+
"@types/dotenv": "^8.2.0",
|
|
25
27
|
"@types/node": "^20.12.7",
|
|
26
28
|
"typescript": "^5.4.5"
|
|
27
29
|
},
|
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
26
|
|
|
27
27
|
/* Modules */
|
|
28
|
-
"module": "
|
|
28
|
+
"module": "NodeNext", /* Specify what module code is generated. */
|
|
29
29
|
"rootDir": "./src", /* Specify the root folder within your source files. */
|
|
30
|
-
|
|
30
|
+
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
31
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
32
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
33
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|