@mendable/firecrawl-js 0.0.17 → 0.0.19
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 +6 -1
- package/package.json +1 -1
- package/src/index.ts +5 -3
package/build/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import axios from "axios";
|
|
11
|
+
import { z } from "zod";
|
|
11
12
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
12
13
|
/**
|
|
13
14
|
* Main class for interacting with the Firecrawl API.
|
|
@@ -38,7 +39,11 @@ export default class FirecrawlApp {
|
|
|
38
39
|
};
|
|
39
40
|
let jsonData = Object.assign({ url }, params);
|
|
40
41
|
if ((_a = params === null || params === void 0 ? void 0 : params.extractorOptions) === null || _a === void 0 ? void 0 : _a.extractionSchema) {
|
|
41
|
-
|
|
42
|
+
let schema = params.extractorOptions.extractionSchema;
|
|
43
|
+
// Check if schema is an instance of ZodSchema to correctly identify Zod schemas
|
|
44
|
+
if (schema instanceof z.ZodSchema) {
|
|
45
|
+
schema = zodToJsonSchema(schema);
|
|
46
|
+
}
|
|
42
47
|
jsonData = Object.assign(Object.assign({}, jsonData), { extractorOptions: Object.assign(Object.assign({}, params.extractorOptions), { extractionSchema: schema, mode: params.extractorOptions.mode || "llm-extraction" }) });
|
|
43
48
|
}
|
|
44
49
|
try {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -91,9 +91,11 @@ export default class FirecrawlApp {
|
|
|
91
91
|
} as AxiosRequestHeaders;
|
|
92
92
|
let jsonData: Params = { url, ...params };
|
|
93
93
|
if (params?.extractorOptions?.extractionSchema) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
)
|
|
94
|
+
let schema = params.extractorOptions.extractionSchema;
|
|
95
|
+
// Check if schema is an instance of ZodSchema to correctly identify Zod schemas
|
|
96
|
+
if (schema instanceof z.ZodSchema) {
|
|
97
|
+
schema = zodToJsonSchema(schema);
|
|
98
|
+
}
|
|
97
99
|
jsonData = {
|
|
98
100
|
...jsonData,
|
|
99
101
|
extractorOptions: {
|