@mendable/firecrawl-js 0.0.7 → 0.0.9
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/README.md +1 -1
- package/build/index.js +7 -13
- package/package.json +3 -1
- package/tsconfig.json +2 -2
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ npm install @mendable/firecrawl-js
|
|
|
19
19
|
Here's an example of how to use the SDK with error handling:
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
|
-
import
|
|
22
|
+
import FirecrawlApp from '@mendable/firecrawl-js';
|
|
23
23
|
|
|
24
24
|
async function main() {
|
|
25
25
|
try {
|
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,14 +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
|
-
const axios_1 = __importDefault(require("axios"));
|
|
16
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
17
|
-
dotenv_1.default.config();
|
|
18
|
-
class FirecrawlApp {
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import dotenv from 'dotenv';
|
|
12
|
+
dotenv.config();
|
|
13
|
+
export default class FirecrawlApp {
|
|
19
14
|
constructor({ apiKey = null }) {
|
|
20
15
|
this.apiKey = apiKey || process.env.FIRECRAWL_API_KEY || '';
|
|
21
16
|
if (!this.apiKey) {
|
|
@@ -33,7 +28,7 @@ class FirecrawlApp {
|
|
|
33
28
|
jsonData = Object.assign(Object.assign({}, jsonData), params);
|
|
34
29
|
}
|
|
35
30
|
try {
|
|
36
|
-
const response = yield
|
|
31
|
+
const response = yield axios.post('https://api.firecrawl.dev/v0/scrape', jsonData, { headers });
|
|
37
32
|
if (response.status === 200) {
|
|
38
33
|
const responseData = response.data;
|
|
39
34
|
if (responseData.success) {
|
|
@@ -104,10 +99,10 @@ class FirecrawlApp {
|
|
|
104
99
|
};
|
|
105
100
|
}
|
|
106
101
|
postRequest(url, data, headers) {
|
|
107
|
-
return
|
|
102
|
+
return axios.post(url, data, { headers });
|
|
108
103
|
}
|
|
109
104
|
getRequest(url, headers) {
|
|
110
|
-
return
|
|
105
|
+
return axios.get(url, { headers });
|
|
111
106
|
}
|
|
112
107
|
monitorJobStatus(jobId, headers, timeout) {
|
|
113
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -149,4 +144,3 @@ class FirecrawlApp {
|
|
|
149
144
|
}
|
|
150
145
|
}
|
|
151
146
|
}
|
|
152
|
-
exports.default = 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.9",
|
|
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/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. */
|