@retrivora-ai/rag-engine 2.2.9 → 2.3.0
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/handlers/index.js +5 -3
- package/dist/handlers/index.mjs +5 -3
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/dist/server.js +7 -4
- package/dist/server.mjs +7 -4
- package/package.json +1 -1
- package/src/core/LicenseValidator.ts +3 -1
- package/src/core/LicenseVerifier.ts +12 -11
- package/src/handlers/index.ts +4 -2
package/dist/handlers/index.js
CHANGED
|
@@ -2346,7 +2346,8 @@ var LicenseVerifier = class {
|
|
|
2346
2346
|
};
|
|
2347
2347
|
}
|
|
2348
2348
|
try {
|
|
2349
|
-
const
|
|
2349
|
+
const sanitizedKey = (licenseKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
2350
|
+
const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
|
|
2350
2351
|
const parts = rawToken.split(".");
|
|
2351
2352
|
if (parts.length !== 3) {
|
|
2352
2353
|
throw new Error("Malformed token structure (expected 3 parts).");
|
|
@@ -4710,7 +4711,7 @@ var ConfigValidator = class {
|
|
|
4710
4711
|
// package.json
|
|
4711
4712
|
var package_default = {
|
|
4712
4713
|
name: "@retrivora-ai/rag-engine",
|
|
4713
|
-
version: "2.
|
|
4714
|
+
version: "2.3.0",
|
|
4714
4715
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4715
4716
|
author: "Abhinav Alkuchi",
|
|
4716
4717
|
license: "UNLICENSED",
|
|
@@ -10598,7 +10599,8 @@ function createLicenseHandler(configOrPlugin, options) {
|
|
|
10598
10599
|
try {
|
|
10599
10600
|
const body = await req.json().catch(() => ({}));
|
|
10600
10601
|
const config = plugin.getConfig();
|
|
10601
|
-
const
|
|
10602
|
+
const rawKey = req.headers.get("x-license-key") || (body == null ? void 0 : body.licenseKey) || ((_a2 = req.headers.get("authorization")) == null ? void 0 : _a2.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || "";
|
|
10603
|
+
const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
10602
10604
|
const projectId = (body == null ? void 0 : body.projectId) || config.projectId || "my-rag-app";
|
|
10603
10605
|
const payload = LicenseVerifier.verify(licenseKey, projectId);
|
|
10604
10606
|
return import_server.NextResponse.json({
|
package/dist/handlers/index.mjs
CHANGED
|
@@ -2310,7 +2310,8 @@ var LicenseVerifier = class {
|
|
|
2310
2310
|
};
|
|
2311
2311
|
}
|
|
2312
2312
|
try {
|
|
2313
|
-
const
|
|
2313
|
+
const sanitizedKey = (licenseKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
2314
|
+
const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
|
|
2314
2315
|
const parts = rawToken.split(".");
|
|
2315
2316
|
if (parts.length !== 3) {
|
|
2316
2317
|
throw new Error("Malformed token structure (expected 3 parts).");
|
|
@@ -4674,7 +4675,7 @@ var ConfigValidator = class {
|
|
|
4674
4675
|
// package.json
|
|
4675
4676
|
var package_default = {
|
|
4676
4677
|
name: "@retrivora-ai/rag-engine",
|
|
4677
|
-
version: "2.
|
|
4678
|
+
version: "2.3.0",
|
|
4678
4679
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4679
4680
|
author: "Abhinav Alkuchi",
|
|
4680
4681
|
license: "UNLICENSED",
|
|
@@ -10562,7 +10563,8 @@ function createLicenseHandler(configOrPlugin, options) {
|
|
|
10562
10563
|
try {
|
|
10563
10564
|
const body = await req.json().catch(() => ({}));
|
|
10564
10565
|
const config = plugin.getConfig();
|
|
10565
|
-
const
|
|
10566
|
+
const rawKey = req.headers.get("x-license-key") || (body == null ? void 0 : body.licenseKey) || ((_a2 = req.headers.get("authorization")) == null ? void 0 : _a2.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || "";
|
|
10567
|
+
const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
10566
10568
|
const projectId = (body == null ? void 0 : body.projectId) || config.projectId || "my-rag-app";
|
|
10567
10569
|
const payload = LicenseVerifier.verify(licenseKey, projectId);
|
|
10568
10570
|
return NextResponse.json({
|
package/dist/index.js
CHANGED
|
@@ -3044,7 +3044,7 @@ function useRagChat(projectId, options = {}) {
|
|
|
3044
3044
|
// package.json
|
|
3045
3045
|
var package_default = {
|
|
3046
3046
|
name: "@retrivora-ai/rag-engine",
|
|
3047
|
-
version: "2.
|
|
3047
|
+
version: "2.3.0",
|
|
3048
3048
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
3049
3049
|
author: "Abhinav Alkuchi",
|
|
3050
3050
|
license: "UNLICENSED",
|
|
@@ -3276,7 +3276,8 @@ var LicenseVerifier = class {
|
|
|
3276
3276
|
};
|
|
3277
3277
|
}
|
|
3278
3278
|
try {
|
|
3279
|
-
const
|
|
3279
|
+
const sanitizedKey = (licenseKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
3280
|
+
const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
|
|
3280
3281
|
const parts = rawToken.split(".");
|
|
3281
3282
|
if (parts.length !== 3) {
|
|
3282
3283
|
throw new Error("Malformed token structure (expected 3 parts).");
|
|
@@ -3485,7 +3486,8 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3485
3486
|
}
|
|
3486
3487
|
return void 0;
|
|
3487
3488
|
};
|
|
3488
|
-
const
|
|
3489
|
+
const rawKey = licenseKey || getHeader("x-license-key") || ((_a = getHeader("authorization")) == null ? void 0 : _a.replace(/^Bearer\s+/i, "")) || (typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY : "") || "";
|
|
3490
|
+
const effectiveLicenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
3489
3491
|
if (!effectiveLicenseKey) {
|
|
3490
3492
|
this.purgeCache(effectiveLicenseKey);
|
|
3491
3493
|
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.");
|
package/dist/index.mjs
CHANGED
|
@@ -3049,7 +3049,7 @@ function useRagChat(projectId, options = {}) {
|
|
|
3049
3049
|
// package.json
|
|
3050
3050
|
var package_default = {
|
|
3051
3051
|
name: "@retrivora-ai/rag-engine",
|
|
3052
|
-
version: "2.
|
|
3052
|
+
version: "2.3.0",
|
|
3053
3053
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
3054
3054
|
author: "Abhinav Alkuchi",
|
|
3055
3055
|
license: "UNLICENSED",
|
|
@@ -3281,7 +3281,8 @@ var LicenseVerifier = class {
|
|
|
3281
3281
|
};
|
|
3282
3282
|
}
|
|
3283
3283
|
try {
|
|
3284
|
-
const
|
|
3284
|
+
const sanitizedKey = (licenseKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
3285
|
+
const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
|
|
3285
3286
|
const parts = rawToken.split(".");
|
|
3286
3287
|
if (parts.length !== 3) {
|
|
3287
3288
|
throw new Error("Malformed token structure (expected 3 parts).");
|
|
@@ -3490,7 +3491,8 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3490
3491
|
}
|
|
3491
3492
|
return void 0;
|
|
3492
3493
|
};
|
|
3493
|
-
const
|
|
3494
|
+
const rawKey = licenseKey || getHeader("x-license-key") || ((_a = getHeader("authorization")) == null ? void 0 : _a.replace(/^Bearer\s+/i, "")) || (typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY : "") || "";
|
|
3495
|
+
const effectiveLicenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
3494
3496
|
if (!effectiveLicenseKey) {
|
|
3495
3497
|
this.purgeCache(effectiveLicenseKey);
|
|
3496
3498
|
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.");
|
package/dist/server.js
CHANGED
|
@@ -2417,7 +2417,8 @@ var LicenseVerifier = class {
|
|
|
2417
2417
|
};
|
|
2418
2418
|
}
|
|
2419
2419
|
try {
|
|
2420
|
-
const
|
|
2420
|
+
const sanitizedKey = (licenseKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
2421
|
+
const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
|
|
2421
2422
|
const parts = rawToken.split(".");
|
|
2422
2423
|
if (parts.length !== 3) {
|
|
2423
2424
|
throw new Error("Malformed token structure (expected 3 parts).");
|
|
@@ -4823,7 +4824,7 @@ var ConfigValidator = class {
|
|
|
4823
4824
|
// package.json
|
|
4824
4825
|
var package_default = {
|
|
4825
4826
|
name: "@retrivora-ai/rag-engine",
|
|
4826
|
-
version: "2.
|
|
4827
|
+
version: "2.3.0",
|
|
4827
4828
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4828
4829
|
author: "Abhinav Alkuchi",
|
|
4829
4830
|
license: "UNLICENSED",
|
|
@@ -11024,7 +11025,8 @@ function createLicenseHandler(configOrPlugin, options) {
|
|
|
11024
11025
|
try {
|
|
11025
11026
|
const body = await req.json().catch(() => ({}));
|
|
11026
11027
|
const config = plugin.getConfig();
|
|
11027
|
-
const
|
|
11028
|
+
const rawKey = req.headers.get("x-license-key") || (body == null ? void 0 : body.licenseKey) || ((_a2 = req.headers.get("authorization")) == null ? void 0 : _a2.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || "";
|
|
11029
|
+
const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
11028
11030
|
const projectId = (body == null ? void 0 : body.projectId) || config.projectId || "my-rag-app";
|
|
11029
11031
|
const payload = LicenseVerifier.verify(licenseKey, projectId);
|
|
11030
11032
|
return import_server.NextResponse.json({
|
|
@@ -11433,7 +11435,8 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11433
11435
|
}
|
|
11434
11436
|
return void 0;
|
|
11435
11437
|
};
|
|
11436
|
-
const
|
|
11438
|
+
const rawKey = licenseKey || getHeader("x-license-key") || ((_a2 = getHeader("authorization")) == null ? void 0 : _a2.replace(/^Bearer\s+/i, "")) || (typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY : "") || "";
|
|
11439
|
+
const effectiveLicenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
11437
11440
|
if (!effectiveLicenseKey) {
|
|
11438
11441
|
this.purgeCache(effectiveLicenseKey);
|
|
11439
11442
|
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.");
|
package/dist/server.mjs
CHANGED
|
@@ -2317,7 +2317,8 @@ var LicenseVerifier = class {
|
|
|
2317
2317
|
};
|
|
2318
2318
|
}
|
|
2319
2319
|
try {
|
|
2320
|
-
const
|
|
2320
|
+
const sanitizedKey = (licenseKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
2321
|
+
const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
|
|
2321
2322
|
const parts = rawToken.split(".");
|
|
2322
2323
|
if (parts.length !== 3) {
|
|
2323
2324
|
throw new Error("Malformed token structure (expected 3 parts).");
|
|
@@ -4723,7 +4724,7 @@ var ConfigValidator = class {
|
|
|
4723
4724
|
// package.json
|
|
4724
4725
|
var package_default = {
|
|
4725
4726
|
name: "@retrivora-ai/rag-engine",
|
|
4726
|
-
version: "2.
|
|
4727
|
+
version: "2.3.0",
|
|
4727
4728
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4728
4729
|
author: "Abhinav Alkuchi",
|
|
4729
4730
|
license: "UNLICENSED",
|
|
@@ -10924,7 +10925,8 @@ function createLicenseHandler(configOrPlugin, options) {
|
|
|
10924
10925
|
try {
|
|
10925
10926
|
const body = await req.json().catch(() => ({}));
|
|
10926
10927
|
const config = plugin.getConfig();
|
|
10927
|
-
const
|
|
10928
|
+
const rawKey = req.headers.get("x-license-key") || (body == null ? void 0 : body.licenseKey) || ((_a2 = req.headers.get("authorization")) == null ? void 0 : _a2.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || "";
|
|
10929
|
+
const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
10928
10930
|
const projectId = (body == null ? void 0 : body.projectId) || config.projectId || "my-rag-app";
|
|
10929
10931
|
const payload = LicenseVerifier.verify(licenseKey, projectId);
|
|
10930
10932
|
return NextResponse.json({
|
|
@@ -11333,7 +11335,8 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11333
11335
|
}
|
|
11334
11336
|
return void 0;
|
|
11335
11337
|
};
|
|
11336
|
-
const
|
|
11338
|
+
const rawKey = licenseKey || getHeader("x-license-key") || ((_a2 = getHeader("authorization")) == null ? void 0 : _a2.replace(/^Bearer\s+/i, "")) || (typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY : "") || "";
|
|
11339
|
+
const effectiveLicenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
11337
11340
|
if (!effectiveLicenseKey) {
|
|
11338
11341
|
this.purgeCache(effectiveLicenseKey);
|
|
11339
11342
|
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
|
|
5
5
|
"author": "Abhinav Alkuchi",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -75,7 +75,7 @@ export class LicenseValidator {
|
|
|
75
75
|
return undefined;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const
|
|
78
|
+
const rawKey =
|
|
79
79
|
licenseKey ||
|
|
80
80
|
getHeader('x-license-key') ||
|
|
81
81
|
getHeader('authorization')?.replace(/^Bearer\s+/i, '') ||
|
|
@@ -84,6 +84,8 @@ export class LicenseValidator {
|
|
|
84
84
|
: '') ||
|
|
85
85
|
'';
|
|
86
86
|
|
|
87
|
+
const effectiveLicenseKey = (rawKey || '').trim().replace(/^["']|["']$/g, '').trim();
|
|
88
|
+
|
|
87
89
|
if (!effectiveLicenseKey) {
|
|
88
90
|
this.purgeCache(effectiveLicenseKey);
|
|
89
91
|
throw new LicenseValidationError('Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.');
|
|
@@ -80,7 +80,8 @@ MwIDAQAB
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
try {
|
|
83
|
-
const
|
|
83
|
+
const sanitizedKey = (licenseKey || '').trim().replace(/^["']|["']$/g, '').trim();
|
|
84
|
+
const rawToken = sanitizedKey.replace(/^rtv_/i, '').trim();
|
|
84
85
|
const parts = rawToken.split('.');
|
|
85
86
|
if (parts.length !== 3) {
|
|
86
87
|
throw new Error('Malformed token structure (expected 3 parts).');
|
|
@@ -90,7 +91,7 @@ MwIDAQAB
|
|
|
90
91
|
const dataToVerify = `${headerB64}.${payloadB64}`;
|
|
91
92
|
|
|
92
93
|
const publicKey = publicKeyOverride ?? this.PUBLIC_KEY;
|
|
93
|
-
|
|
94
|
+
|
|
94
95
|
// 2. Cryptographic signature check
|
|
95
96
|
const signature = Buffer.from(signatureB64, 'base64url');
|
|
96
97
|
const data = Buffer.from(dataToVerify);
|
|
@@ -123,7 +124,7 @@ MwIDAQAB
|
|
|
123
124
|
if (!isProjectMatch) {
|
|
124
125
|
throw new Error(
|
|
125
126
|
`Project ID mismatch. License is bound to project namespace "${payload.projectId}" ` +
|
|
126
|
-
|
|
127
|
+
`but configuration has "${currentProjectId}".`
|
|
127
128
|
);
|
|
128
129
|
}
|
|
129
130
|
|
|
@@ -206,18 +207,18 @@ MwIDAQAB
|
|
|
206
207
|
if (payload.ipv4 || payload.ipv6) {
|
|
207
208
|
let currentIpv4 = '';
|
|
208
209
|
let currentIpv6 = '';
|
|
209
|
-
|
|
210
|
+
|
|
210
211
|
try {
|
|
211
212
|
const res = await fetch('https://api4.ipify.org?format=json', { signal: AbortSignal.timeout(3000) });
|
|
212
213
|
const data = await res.json();
|
|
213
214
|
currentIpv4 = data.ip;
|
|
214
|
-
} catch (e) {}
|
|
215
|
-
|
|
215
|
+
} catch (e) { }
|
|
216
|
+
|
|
216
217
|
try {
|
|
217
218
|
const res = await fetch('https://api6.ipify.org?format=json', { signal: AbortSignal.timeout(3000) });
|
|
218
219
|
const data = await res.json();
|
|
219
220
|
currentIpv6 = data.ip;
|
|
220
|
-
} catch (e) {}
|
|
221
|
+
} catch (e) { }
|
|
221
222
|
|
|
222
223
|
const localIps: string[] = [];
|
|
223
224
|
try {
|
|
@@ -230,14 +231,14 @@ MwIDAQAB
|
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
|
-
} catch (e) {}
|
|
234
|
-
|
|
234
|
+
} catch (e) { }
|
|
235
|
+
|
|
235
236
|
const isIpv4Match = payload.ipv4 && (
|
|
236
|
-
currentIpv4 === payload.ipv4 ||
|
|
237
|
+
currentIpv4 === payload.ipv4 ||
|
|
237
238
|
localIps.includes(payload.ipv4)
|
|
238
239
|
);
|
|
239
240
|
const isIpv6Match = payload.ipv6 && (
|
|
240
|
-
currentIpv6 === payload.ipv6 ||
|
|
241
|
+
currentIpv6 === payload.ipv6 ||
|
|
241
242
|
localIps.includes(payload.ipv6)
|
|
242
243
|
);
|
|
243
244
|
|
package/src/handlers/index.ts
CHANGED
|
@@ -615,15 +615,17 @@ export function createLicenseHandler(
|
|
|
615
615
|
try {
|
|
616
616
|
const body = await req.json().catch(() => ({}));
|
|
617
617
|
const config = plugin.getConfig();
|
|
618
|
-
const
|
|
618
|
+
const rawKey =
|
|
619
619
|
req.headers.get('x-license-key') ||
|
|
620
620
|
body?.licenseKey ||
|
|
621
621
|
req.headers.get('authorization')?.replace(/^Bearer\s+/i, '') ||
|
|
622
622
|
config.licenseKey ||
|
|
623
|
-
process.env.RETRIVORA_LICENSE_KEY ||
|
|
624
623
|
process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY ||
|
|
624
|
+
process.env.RETRIVORA_LICENSE_KEY ||
|
|
625
625
|
'';
|
|
626
626
|
|
|
627
|
+
const licenseKey = (rawKey || '').trim().replace(/^["']|["']$/g, '').trim();
|
|
628
|
+
|
|
627
629
|
const projectId = body?.projectId || config.projectId || 'my-rag-app';
|
|
628
630
|
|
|
629
631
|
const payload = LicenseVerifier.verify(licenseKey, projectId);
|