@mendable/firecrawl 1.19.0 → 1.19.1
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/dist/index.cjs
CHANGED
|
@@ -618,7 +618,7 @@ var FirecrawlApp = class {
|
|
|
618
618
|
try {
|
|
619
619
|
if (!params?.schema) {
|
|
620
620
|
jsonSchema = void 0;
|
|
621
|
-
} else if (params.schema
|
|
621
|
+
} else if (typeof params.schema === "object" && params.schema !== null && Object.getPrototypeOf(params.schema)?.constructor?.name?.startsWith("Zod")) {
|
|
622
622
|
jsonSchema = (0, import_zod_to_json_schema.zodToJsonSchema)(params.schema);
|
|
623
623
|
} else {
|
|
624
624
|
jsonSchema = params.schema;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -582,7 +582,7 @@ var FirecrawlApp = class {
|
|
|
582
582
|
try {
|
|
583
583
|
if (!params?.schema) {
|
|
584
584
|
jsonSchema = void 0;
|
|
585
|
-
} else if (params.schema
|
|
585
|
+
} else if (typeof params.schema === "object" && params.schema !== null && Object.getPrototypeOf(params.schema)?.constructor?.name?.startsWith("Zod")) {
|
|
586
586
|
jsonSchema = zodToJsonSchema(params.schema);
|
|
587
587
|
} else {
|
|
588
588
|
jsonSchema = params.schema;
|
package/package.json
CHANGED
|
@@ -55,7 +55,7 @@ describe('FirecrawlApp<"v0"> E2E Tests', () => {
|
|
|
55
55
|
"should return successful response with valid preview token",
|
|
56
56
|
async () => {
|
|
57
57
|
const app = new FirecrawlApp<"v0">({
|
|
58
|
-
apiKey:
|
|
58
|
+
apiKey: process.env.PREVIEW_TOKEN,
|
|
59
59
|
apiUrl: API_URL,
|
|
60
60
|
version: "v0",
|
|
61
61
|
});
|
|
@@ -40,7 +40,7 @@ describe('FirecrawlApp E2E Tests', () => {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
test.concurrent('should return successful response with valid preview token', async () => {
|
|
43
|
-
const app = new FirecrawlApp({ apiKey:
|
|
43
|
+
const app = new FirecrawlApp({ apiKey: process.env.PREVIEW_TOKEN, apiUrl: API_URL });
|
|
44
44
|
const response = await app.scrapeUrl('https://roastmywebsite.ai');
|
|
45
45
|
if (!response.success) {
|
|
46
46
|
throw new Error(response.error);
|
|
@@ -365,7 +365,7 @@ describe('FirecrawlApp E2E Tests', () => {
|
|
|
365
365
|
});
|
|
366
366
|
|
|
367
367
|
test.concurrent('should return successful response with valid preview token', async () => {
|
|
368
|
-
const app = new FirecrawlApp({ apiKey:
|
|
368
|
+
const app = new FirecrawlApp({ apiKey: process.env.PREVIEW_TOKEN, apiUrl: API_URL });
|
|
369
369
|
const response = await app.mapUrl('https://roastmywebsite.ai') as MapResponse;
|
|
370
370
|
expect(response).not.toBeNull();
|
|
371
371
|
expect(response.links?.length).toBeGreaterThan(0);
|
package/src/index.ts
CHANGED
|
@@ -173,6 +173,7 @@ export interface CrawlParams {
|
|
|
173
173
|
};
|
|
174
174
|
deduplicateSimilarURLs?: boolean;
|
|
175
175
|
ignoreQueryParameters?: boolean;
|
|
176
|
+
regexOnFullURL?: boolean;
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
/**
|
|
@@ -1129,15 +1130,14 @@ export default class FirecrawlApp {
|
|
|
1129
1130
|
try {
|
|
1130
1131
|
if (!params?.schema) {
|
|
1131
1132
|
jsonSchema = undefined;
|
|
1132
|
-
} else if (params.schema
|
|
1133
|
-
jsonSchema = zodToJsonSchema(params.schema);
|
|
1133
|
+
} else if (typeof params.schema === "object" && params.schema !== null && Object.getPrototypeOf(params.schema)?.constructor?.name?.startsWith("Zod")) {
|
|
1134
|
+
jsonSchema = zodToJsonSchema(params.schema as zt.ZodType);
|
|
1134
1135
|
} else {
|
|
1135
1136
|
jsonSchema = params.schema;
|
|
1136
1137
|
}
|
|
1137
1138
|
} catch (error: any) {
|
|
1138
1139
|
throw new FirecrawlError("Invalid schema. Schema must be either a valid Zod schema or JSON schema object.", 400);
|
|
1139
1140
|
}
|
|
1140
|
-
|
|
1141
1141
|
|
|
1142
1142
|
try {
|
|
1143
1143
|
const response: AxiosResponse = await this.postRequest(
|