@absolutejs/rag 0.22.13 → 0.22.14
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/CHANGELOG.md +6 -0
- package/changelog.json +15 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +3 -3
- package/dist/research/index.js +7 -4
- package/dist/research/index.js.map +5 -5
- package/dist/src/web/index.d.ts +1 -1
- package/dist/src/web/transport.d.ts +4 -0
- package/dist/web/index.js +7 -3
- package/dist/web/index.js.map +4 -4
- package/dist/web/playwright.js +4 -1
- package/dist/web/playwright.js.map +3 -3
- package/dist/web-index/index.js +7 -4
- package/dist/web-index/index.js.map +5 -5
- package/package.json +1 -1
package/dist/research/index.js
CHANGED
|
@@ -114902,15 +114902,18 @@ import {
|
|
|
114902
114902
|
import { lookup } from "dns/promises";
|
|
114903
114903
|
import { isIP } from "net";
|
|
114904
114904
|
import { brotliDecompressSync, gunzipSync, inflateSync } from "zlib";
|
|
114905
|
+
var WEB_READ_ERROR = Symbol.for("@absolutejs/rag/WebReadError");
|
|
114905
114906
|
|
|
114906
114907
|
class WebReadError extends Error {
|
|
114907
114908
|
code;
|
|
114909
|
+
[WEB_READ_ERROR] = true;
|
|
114908
114910
|
constructor(code, message) {
|
|
114909
114911
|
super(message);
|
|
114910
114912
|
this.code = code;
|
|
114911
114913
|
this.name = "WebReadError";
|
|
114912
114914
|
}
|
|
114913
114915
|
}
|
|
114916
|
+
var isWebReadError = (error) => error instanceof Error && Reflect.get(error, WEB_READ_ERROR) === true && typeof Reflect.get(error, "code") === "string";
|
|
114914
114917
|
var isPublicWebAddress = (address) => isPublicNetworkAddress(address);
|
|
114915
114918
|
var validatePublicWebUrl = (raw) => {
|
|
114916
114919
|
let url;
|
|
@@ -121814,7 +121817,7 @@ var createWebpageReaderClient = (options) => {
|
|
|
121814
121817
|
|
|
121815
121818
|
// src/web/index.ts
|
|
121816
121819
|
var messageFor = (error) => error instanceof Error ? error.message : "Website retrieval failed.";
|
|
121817
|
-
var codeFor = (error) => error
|
|
121820
|
+
var codeFor = (error) => isWebReadError(error) ? error.code : error instanceof Error && /^(?:AbortError|TimeoutError)$/u.test(error.name) ? "timeout" : "fetch_failed";
|
|
121818
121821
|
var cleanHtml = websiteHtmlText;
|
|
121819
121822
|
var titleOf = (html) => {
|
|
121820
121823
|
const title = /<title\b[^>]*>([\s\S]*?)<\/title>/iu.exec(html)?.[1];
|
|
@@ -121861,7 +121864,7 @@ var readRAGWebpage = async (options) => {
|
|
|
121861
121864
|
response = await (options.fetchResource ?? fetchPublicWebResource)(options.url, { signal, maxBytes: 5000000 });
|
|
121862
121865
|
} catch (error) {
|
|
121863
121866
|
attempts.push({ method: "http", status: codeFor(error) });
|
|
121864
|
-
if (error
|
|
121867
|
+
if (isWebReadError(error) && error.code === "blocked_url")
|
|
121865
121868
|
throw error;
|
|
121866
121869
|
if (!options.render)
|
|
121867
121870
|
throw error;
|
|
@@ -122332,7 +122335,7 @@ Correct the previous schema-invalid response using the validation diagnostics. T
|
|
|
122332
122335
|
fetch_failed: "Page could not be retrieved",
|
|
122333
122336
|
timeout: "Page retrieval timed out"
|
|
122334
122337
|
};
|
|
122335
|
-
if (!(error
|
|
122338
|
+
if (!isWebReadError(error) || !messages[error.code])
|
|
122336
122339
|
throw error;
|
|
122337
122340
|
return {
|
|
122338
122341
|
status: "error",
|
|
@@ -123379,5 +123382,5 @@ export {
|
|
|
123379
123382
|
selectResearchMonitorEvents
|
|
123380
123383
|
};
|
|
123381
123384
|
|
|
123382
|
-
//# debugId=
|
|
123385
|
+
//# debugId=7CFBFAA05587CF8964756E2164756E21
|
|
123383
123386
|
//# sourceMappingURL=index.js.map
|