@retrivora-ai/rag-engine 2.2.8 → 2.2.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 +2 -2
- package/dist/handlers/index.js +1 -1
- package/dist/handlers/index.mjs +1 -1
- package/dist/index.js +10 -10
- package/dist/index.mjs +10 -10
- package/dist/server.js +10 -10
- package/dist/server.mjs +10 -10
- package/package.json +1 -1
- package/src/core/LicenseValidator.ts +10 -10
package/README.md
CHANGED
|
@@ -76,8 +76,8 @@ npm install @retrivora-ai/rag-engine
|
|
|
76
76
|
Create a `.env.local` file in your application root to supply your keys and provider selections:
|
|
77
77
|
```bash
|
|
78
78
|
# General Setup
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
NEXT_PUBLIC_PROJECT_ID=my-rag-application
|
|
80
|
+
NEXT_PUBLIC_RETRIVORA_LICENSE_KEY=ey... # Required for client & server deployment
|
|
81
81
|
|
|
82
82
|
# Vector Database (MongoDB Atlas Example)
|
|
83
83
|
VECTOR_DB_PROVIDER=mongodb
|
package/dist/handlers/index.js
CHANGED
|
@@ -4710,7 +4710,7 @@ var ConfigValidator = class {
|
|
|
4710
4710
|
// package.json
|
|
4711
4711
|
var package_default = {
|
|
4712
4712
|
name: "@retrivora-ai/rag-engine",
|
|
4713
|
-
version: "2.2.
|
|
4713
|
+
version: "2.2.9",
|
|
4714
4714
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4715
4715
|
author: "Abhinav Alkuchi",
|
|
4716
4716
|
license: "UNLICENSED",
|
package/dist/handlers/index.mjs
CHANGED
|
@@ -4674,7 +4674,7 @@ var ConfigValidator = class {
|
|
|
4674
4674
|
// package.json
|
|
4675
4675
|
var package_default = {
|
|
4676
4676
|
name: "@retrivora-ai/rag-engine",
|
|
4677
|
-
version: "2.2.
|
|
4677
|
+
version: "2.2.9",
|
|
4678
4678
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4679
4679
|
author: "Abhinav Alkuchi",
|
|
4680
4680
|
license: "UNLICENSED",
|
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.2.
|
|
3047
|
+
version: "2.2.9",
|
|
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",
|
|
@@ -3488,7 +3488,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3488
3488
|
const effectiveLicenseKey = 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 : "") || "";
|
|
3489
3489
|
if (!effectiveLicenseKey) {
|
|
3490
3490
|
this.purgeCache(effectiveLicenseKey);
|
|
3491
|
-
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request.");
|
|
3491
|
+
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.");
|
|
3492
3492
|
}
|
|
3493
3493
|
const cached = this.cache.get(effectiveLicenseKey);
|
|
3494
3494
|
if (cached) {
|
|
@@ -3512,7 +3512,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3512
3512
|
"x-sdk-version": sdkVersion
|
|
3513
3513
|
}, customHeaders || {}),
|
|
3514
3514
|
body: JSON.stringify({
|
|
3515
|
-
licenseKey,
|
|
3515
|
+
licenseKey: effectiveLicenseKey,
|
|
3516
3516
|
projectId,
|
|
3517
3517
|
sdkVersion,
|
|
3518
3518
|
sdk,
|
|
@@ -3521,7 +3521,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3521
3521
|
});
|
|
3522
3522
|
} catch (err) {
|
|
3523
3523
|
try {
|
|
3524
|
-
const payload = LicenseVerifier.verify(
|
|
3524
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || "my-rag-app");
|
|
3525
3525
|
const fallbackResp = {
|
|
3526
3526
|
valid: true,
|
|
3527
3527
|
licenseStatus: "ACTIVE",
|
|
@@ -3531,16 +3531,16 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3531
3531
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1e3).toISOString() : null,
|
|
3532
3532
|
message: "Local license verification active."
|
|
3533
3533
|
};
|
|
3534
|
-
this.cache.set(
|
|
3534
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
3535
3535
|
return fallbackResp;
|
|
3536
3536
|
} catch (e) {
|
|
3537
|
-
this.purgeCache(
|
|
3537
|
+
this.purgeCache(effectiveLicenseKey);
|
|
3538
3538
|
throw new LicenseValidationError(`License validation request failed: ${(err == null ? void 0 : err.message) || "Network error"}`);
|
|
3539
3539
|
}
|
|
3540
3540
|
}
|
|
3541
3541
|
if (res && !res.ok) {
|
|
3542
3542
|
try {
|
|
3543
|
-
const payload = LicenseVerifier.verify(
|
|
3543
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || "my-rag-app");
|
|
3544
3544
|
const fallbackResp = {
|
|
3545
3545
|
valid: true,
|
|
3546
3546
|
licenseStatus: "ACTIVE",
|
|
@@ -3550,7 +3550,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3550
3550
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1e3).toISOString() : null,
|
|
3551
3551
|
message: "Local license verification active."
|
|
3552
3552
|
};
|
|
3553
|
-
this.cache.set(
|
|
3553
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
3554
3554
|
return fallbackResp;
|
|
3555
3555
|
} catch (e) {
|
|
3556
3556
|
}
|
|
@@ -3565,7 +3565,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3565
3565
|
message: "Failed to parse license validation response."
|
|
3566
3566
|
}));
|
|
3567
3567
|
if (!res.ok || !data.valid || data.licenseStatus !== "ACTIVE" || data.forceUpgrade) {
|
|
3568
|
-
this.purgeCache(
|
|
3568
|
+
this.purgeCache(effectiveLicenseKey);
|
|
3569
3569
|
if (data.forceUpgrade || res.status === 426) {
|
|
3570
3570
|
throw new SDKVersionUnsupportedError(
|
|
3571
3571
|
data.message || `This SDK version (${sdkVersion}) is no longer supported. Upgrade to version ${data.latestVersion || "2.2.6"} or later.`,
|
|
@@ -3575,7 +3575,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3575
3575
|
const errMsg = data.message || `License validation failed with status: ${data.licenseStatus}. Access denied.`;
|
|
3576
3576
|
throw new LicenseValidationError(errMsg, data);
|
|
3577
3577
|
}
|
|
3578
|
-
this.cache.set(
|
|
3578
|
+
this.cache.set(effectiveLicenseKey, {
|
|
3579
3579
|
response: data,
|
|
3580
3580
|
timestamp: Date.now()
|
|
3581
3581
|
});
|
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.2.
|
|
3052
|
+
version: "2.2.9",
|
|
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",
|
|
@@ -3493,7 +3493,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3493
3493
|
const effectiveLicenseKey = 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 : "") || "";
|
|
3494
3494
|
if (!effectiveLicenseKey) {
|
|
3495
3495
|
this.purgeCache(effectiveLicenseKey);
|
|
3496
|
-
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request.");
|
|
3496
|
+
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.");
|
|
3497
3497
|
}
|
|
3498
3498
|
const cached = this.cache.get(effectiveLicenseKey);
|
|
3499
3499
|
if (cached) {
|
|
@@ -3517,7 +3517,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3517
3517
|
"x-sdk-version": sdkVersion
|
|
3518
3518
|
}, customHeaders || {}),
|
|
3519
3519
|
body: JSON.stringify({
|
|
3520
|
-
licenseKey,
|
|
3520
|
+
licenseKey: effectiveLicenseKey,
|
|
3521
3521
|
projectId,
|
|
3522
3522
|
sdkVersion,
|
|
3523
3523
|
sdk,
|
|
@@ -3526,7 +3526,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3526
3526
|
});
|
|
3527
3527
|
} catch (err) {
|
|
3528
3528
|
try {
|
|
3529
|
-
const payload = LicenseVerifier.verify(
|
|
3529
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || "my-rag-app");
|
|
3530
3530
|
const fallbackResp = {
|
|
3531
3531
|
valid: true,
|
|
3532
3532
|
licenseStatus: "ACTIVE",
|
|
@@ -3536,16 +3536,16 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3536
3536
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1e3).toISOString() : null,
|
|
3537
3537
|
message: "Local license verification active."
|
|
3538
3538
|
};
|
|
3539
|
-
this.cache.set(
|
|
3539
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
3540
3540
|
return fallbackResp;
|
|
3541
3541
|
} catch (e) {
|
|
3542
|
-
this.purgeCache(
|
|
3542
|
+
this.purgeCache(effectiveLicenseKey);
|
|
3543
3543
|
throw new LicenseValidationError(`License validation request failed: ${(err == null ? void 0 : err.message) || "Network error"}`);
|
|
3544
3544
|
}
|
|
3545
3545
|
}
|
|
3546
3546
|
if (res && !res.ok) {
|
|
3547
3547
|
try {
|
|
3548
|
-
const payload = LicenseVerifier.verify(
|
|
3548
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || "my-rag-app");
|
|
3549
3549
|
const fallbackResp = {
|
|
3550
3550
|
valid: true,
|
|
3551
3551
|
licenseStatus: "ACTIVE",
|
|
@@ -3555,7 +3555,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3555
3555
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1e3).toISOString() : null,
|
|
3556
3556
|
message: "Local license verification active."
|
|
3557
3557
|
};
|
|
3558
|
-
this.cache.set(
|
|
3558
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
3559
3559
|
return fallbackResp;
|
|
3560
3560
|
} catch (e) {
|
|
3561
3561
|
}
|
|
@@ -3570,7 +3570,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3570
3570
|
message: "Failed to parse license validation response."
|
|
3571
3571
|
}));
|
|
3572
3572
|
if (!res.ok || !data.valid || data.licenseStatus !== "ACTIVE" || data.forceUpgrade) {
|
|
3573
|
-
this.purgeCache(
|
|
3573
|
+
this.purgeCache(effectiveLicenseKey);
|
|
3574
3574
|
if (data.forceUpgrade || res.status === 426) {
|
|
3575
3575
|
throw new SDKVersionUnsupportedError(
|
|
3576
3576
|
data.message || `This SDK version (${sdkVersion}) is no longer supported. Upgrade to version ${data.latestVersion || "2.2.6"} or later.`,
|
|
@@ -3580,7 +3580,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
3580
3580
|
const errMsg = data.message || `License validation failed with status: ${data.licenseStatus}. Access denied.`;
|
|
3581
3581
|
throw new LicenseValidationError(errMsg, data);
|
|
3582
3582
|
}
|
|
3583
|
-
this.cache.set(
|
|
3583
|
+
this.cache.set(effectiveLicenseKey, {
|
|
3584
3584
|
response: data,
|
|
3585
3585
|
timestamp: Date.now()
|
|
3586
3586
|
});
|
package/dist/server.js
CHANGED
|
@@ -4823,7 +4823,7 @@ var ConfigValidator = class {
|
|
|
4823
4823
|
// package.json
|
|
4824
4824
|
var package_default = {
|
|
4825
4825
|
name: "@retrivora-ai/rag-engine",
|
|
4826
|
-
version: "2.2.
|
|
4826
|
+
version: "2.2.9",
|
|
4827
4827
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4828
4828
|
author: "Abhinav Alkuchi",
|
|
4829
4829
|
license: "UNLICENSED",
|
|
@@ -11436,7 +11436,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11436
11436
|
const effectiveLicenseKey = 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 : "") || "";
|
|
11437
11437
|
if (!effectiveLicenseKey) {
|
|
11438
11438
|
this.purgeCache(effectiveLicenseKey);
|
|
11439
|
-
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request.");
|
|
11439
|
+
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.");
|
|
11440
11440
|
}
|
|
11441
11441
|
const cached = this.cache.get(effectiveLicenseKey);
|
|
11442
11442
|
if (cached) {
|
|
@@ -11460,7 +11460,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11460
11460
|
"x-sdk-version": sdkVersion
|
|
11461
11461
|
}, customHeaders || {}),
|
|
11462
11462
|
body: JSON.stringify({
|
|
11463
|
-
licenseKey,
|
|
11463
|
+
licenseKey: effectiveLicenseKey,
|
|
11464
11464
|
projectId,
|
|
11465
11465
|
sdkVersion,
|
|
11466
11466
|
sdk,
|
|
@@ -11469,7 +11469,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11469
11469
|
});
|
|
11470
11470
|
} catch (err) {
|
|
11471
11471
|
try {
|
|
11472
|
-
const payload = LicenseVerifier.verify(
|
|
11472
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || "my-rag-app");
|
|
11473
11473
|
const fallbackResp = {
|
|
11474
11474
|
valid: true,
|
|
11475
11475
|
licenseStatus: "ACTIVE",
|
|
@@ -11479,16 +11479,16 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11479
11479
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1e3).toISOString() : null,
|
|
11480
11480
|
message: "Local license verification active."
|
|
11481
11481
|
};
|
|
11482
|
-
this.cache.set(
|
|
11482
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
11483
11483
|
return fallbackResp;
|
|
11484
11484
|
} catch (e) {
|
|
11485
|
-
this.purgeCache(
|
|
11485
|
+
this.purgeCache(effectiveLicenseKey);
|
|
11486
11486
|
throw new LicenseValidationError(`License validation request failed: ${(err == null ? void 0 : err.message) || "Network error"}`);
|
|
11487
11487
|
}
|
|
11488
11488
|
}
|
|
11489
11489
|
if (res && !res.ok) {
|
|
11490
11490
|
try {
|
|
11491
|
-
const payload = LicenseVerifier.verify(
|
|
11491
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || "my-rag-app");
|
|
11492
11492
|
const fallbackResp = {
|
|
11493
11493
|
valid: true,
|
|
11494
11494
|
licenseStatus: "ACTIVE",
|
|
@@ -11498,7 +11498,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11498
11498
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1e3).toISOString() : null,
|
|
11499
11499
|
message: "Local license verification active."
|
|
11500
11500
|
};
|
|
11501
|
-
this.cache.set(
|
|
11501
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
11502
11502
|
return fallbackResp;
|
|
11503
11503
|
} catch (e) {
|
|
11504
11504
|
}
|
|
@@ -11513,7 +11513,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11513
11513
|
message: "Failed to parse license validation response."
|
|
11514
11514
|
}));
|
|
11515
11515
|
if (!res.ok || !data.valid || data.licenseStatus !== "ACTIVE" || data.forceUpgrade) {
|
|
11516
|
-
this.purgeCache(
|
|
11516
|
+
this.purgeCache(effectiveLicenseKey);
|
|
11517
11517
|
if (data.forceUpgrade || res.status === 426) {
|
|
11518
11518
|
throw new SDKVersionUnsupportedError(
|
|
11519
11519
|
data.message || `This SDK version (${sdkVersion}) is no longer supported. Upgrade to version ${data.latestVersion || "2.2.6"} or later.`,
|
|
@@ -11523,7 +11523,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11523
11523
|
const errMsg = data.message || `License validation failed with status: ${data.licenseStatus}. Access denied.`;
|
|
11524
11524
|
throw new LicenseValidationError(errMsg, data);
|
|
11525
11525
|
}
|
|
11526
|
-
this.cache.set(
|
|
11526
|
+
this.cache.set(effectiveLicenseKey, {
|
|
11527
11527
|
response: data,
|
|
11528
11528
|
timestamp: Date.now()
|
|
11529
11529
|
});
|
package/dist/server.mjs
CHANGED
|
@@ -4723,7 +4723,7 @@ var ConfigValidator = class {
|
|
|
4723
4723
|
// package.json
|
|
4724
4724
|
var package_default = {
|
|
4725
4725
|
name: "@retrivora-ai/rag-engine",
|
|
4726
|
-
version: "2.2.
|
|
4726
|
+
version: "2.2.9",
|
|
4727
4727
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4728
4728
|
author: "Abhinav Alkuchi",
|
|
4729
4729
|
license: "UNLICENSED",
|
|
@@ -11336,7 +11336,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11336
11336
|
const effectiveLicenseKey = 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 : "") || "";
|
|
11337
11337
|
if (!effectiveLicenseKey) {
|
|
11338
11338
|
this.purgeCache(effectiveLicenseKey);
|
|
11339
|
-
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request.");
|
|
11339
|
+
throw new LicenseValidationError("Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.");
|
|
11340
11340
|
}
|
|
11341
11341
|
const cached = this.cache.get(effectiveLicenseKey);
|
|
11342
11342
|
if (cached) {
|
|
@@ -11360,7 +11360,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11360
11360
|
"x-sdk-version": sdkVersion
|
|
11361
11361
|
}, customHeaders || {}),
|
|
11362
11362
|
body: JSON.stringify({
|
|
11363
|
-
licenseKey,
|
|
11363
|
+
licenseKey: effectiveLicenseKey,
|
|
11364
11364
|
projectId,
|
|
11365
11365
|
sdkVersion,
|
|
11366
11366
|
sdk,
|
|
@@ -11369,7 +11369,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11369
11369
|
});
|
|
11370
11370
|
} catch (err) {
|
|
11371
11371
|
try {
|
|
11372
|
-
const payload = LicenseVerifier.verify(
|
|
11372
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || "my-rag-app");
|
|
11373
11373
|
const fallbackResp = {
|
|
11374
11374
|
valid: true,
|
|
11375
11375
|
licenseStatus: "ACTIVE",
|
|
@@ -11379,16 +11379,16 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11379
11379
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1e3).toISOString() : null,
|
|
11380
11380
|
message: "Local license verification active."
|
|
11381
11381
|
};
|
|
11382
|
-
this.cache.set(
|
|
11382
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
11383
11383
|
return fallbackResp;
|
|
11384
11384
|
} catch (e) {
|
|
11385
|
-
this.purgeCache(
|
|
11385
|
+
this.purgeCache(effectiveLicenseKey);
|
|
11386
11386
|
throw new LicenseValidationError(`License validation request failed: ${(err == null ? void 0 : err.message) || "Network error"}`);
|
|
11387
11387
|
}
|
|
11388
11388
|
}
|
|
11389
11389
|
if (res && !res.ok) {
|
|
11390
11390
|
try {
|
|
11391
|
-
const payload = LicenseVerifier.verify(
|
|
11391
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || "my-rag-app");
|
|
11392
11392
|
const fallbackResp = {
|
|
11393
11393
|
valid: true,
|
|
11394
11394
|
licenseStatus: "ACTIVE",
|
|
@@ -11398,7 +11398,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11398
11398
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1e3).toISOString() : null,
|
|
11399
11399
|
message: "Local license verification active."
|
|
11400
11400
|
};
|
|
11401
|
-
this.cache.set(
|
|
11401
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
11402
11402
|
return fallbackResp;
|
|
11403
11403
|
} catch (e) {
|
|
11404
11404
|
}
|
|
@@ -11413,7 +11413,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11413
11413
|
message: "Failed to parse license validation response."
|
|
11414
11414
|
}));
|
|
11415
11415
|
if (!res.ok || !data.valid || data.licenseStatus !== "ACTIVE" || data.forceUpgrade) {
|
|
11416
|
-
this.purgeCache(
|
|
11416
|
+
this.purgeCache(effectiveLicenseKey);
|
|
11417
11417
|
if (data.forceUpgrade || res.status === 426) {
|
|
11418
11418
|
throw new SDKVersionUnsupportedError(
|
|
11419
11419
|
data.message || `This SDK version (${sdkVersion}) is no longer supported. Upgrade to version ${data.latestVersion || "2.2.6"} or later.`,
|
|
@@ -11423,7 +11423,7 @@ var _LicenseValidator = class _LicenseValidator {
|
|
|
11423
11423
|
const errMsg = data.message || `License validation failed with status: ${data.licenseStatus}. Access denied.`;
|
|
11424
11424
|
throw new LicenseValidationError(errMsg, data);
|
|
11425
11425
|
}
|
|
11426
|
-
this.cache.set(
|
|
11426
|
+
this.cache.set(effectiveLicenseKey, {
|
|
11427
11427
|
response: data,
|
|
11428
11428
|
timestamp: Date.now()
|
|
11429
11429
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.9",
|
|
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",
|
|
@@ -86,7 +86,7 @@ export class LicenseValidator {
|
|
|
86
86
|
|
|
87
87
|
if (!effectiveLicenseKey) {
|
|
88
88
|
this.purgeCache(effectiveLicenseKey);
|
|
89
|
-
throw new LicenseValidationError('Missing RETRIVORA_LICENSE_KEY in request.');
|
|
89
|
+
throw new LicenseValidationError('Missing RETRIVORA_LICENSE_KEY in request. Set NEXT_PUBLIC_RETRIVORA_LICENSE_KEY in your environment or pass licenseKey as a prop.');
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// 1. Check successful 5-minute cache
|
|
@@ -100,7 +100,7 @@ export class LicenseValidator {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
// 2. Fetch live validation from Retrivora backend API
|
|
103
|
+
// 2. Fetch live validation from Retrivora backend API / local catch-all route
|
|
104
104
|
const base = retrivoraApiBase || (typeof process !== 'undefined' ? process.env.NEXT_PUBLIC_RETRIVORA_API_BASE || process.env.RETRIVORA_API_BASE : '') || '/api/retrivora';
|
|
105
105
|
const validateUrl = `${base.replace(/\/$/, '')}/v1/license/validate`;
|
|
106
106
|
|
|
@@ -116,7 +116,7 @@ export class LicenseValidator {
|
|
|
116
116
|
...(customHeaders || {}),
|
|
117
117
|
},
|
|
118
118
|
body: JSON.stringify({
|
|
119
|
-
licenseKey,
|
|
119
|
+
licenseKey: effectiveLicenseKey,
|
|
120
120
|
projectId,
|
|
121
121
|
sdkVersion,
|
|
122
122
|
sdk,
|
|
@@ -126,7 +126,7 @@ export class LicenseValidator {
|
|
|
126
126
|
} catch (err: any) {
|
|
127
127
|
// Fallback: If network error occurs, verify locally via RSA LicenseVerifier
|
|
128
128
|
try {
|
|
129
|
-
const payload = LicenseVerifier.verify(
|
|
129
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || 'my-rag-app');
|
|
130
130
|
const fallbackResp: LicenseValidationResponse = {
|
|
131
131
|
valid: true,
|
|
132
132
|
licenseStatus: 'ACTIVE',
|
|
@@ -136,10 +136,10 @@ export class LicenseValidator {
|
|
|
136
136
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1000).toISOString() : null,
|
|
137
137
|
message: 'Local license verification active.',
|
|
138
138
|
};
|
|
139
|
-
this.cache.set(
|
|
139
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
140
140
|
return fallbackResp;
|
|
141
141
|
} catch {
|
|
142
|
-
this.purgeCache(
|
|
142
|
+
this.purgeCache(effectiveLicenseKey);
|
|
143
143
|
throw new LicenseValidationError(`License validation request failed: ${err?.message || 'Network error'}`);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -147,7 +147,7 @@ export class LicenseValidator {
|
|
|
147
147
|
if (res && !res.ok) {
|
|
148
148
|
// Attempt local verification fallback if API route returned 404 or non-OK response
|
|
149
149
|
try {
|
|
150
|
-
const payload = LicenseVerifier.verify(
|
|
150
|
+
const payload = LicenseVerifier.verify(effectiveLicenseKey, projectId || 'my-rag-app');
|
|
151
151
|
const fallbackResp: LicenseValidationResponse = {
|
|
152
152
|
valid: true,
|
|
153
153
|
licenseStatus: 'ACTIVE',
|
|
@@ -157,7 +157,7 @@ export class LicenseValidator {
|
|
|
157
157
|
expiresAt: payload.expiresAt ? new Date(payload.expiresAt * 1000).toISOString() : null,
|
|
158
158
|
message: 'Local license verification active.',
|
|
159
159
|
};
|
|
160
|
-
this.cache.set(
|
|
160
|
+
this.cache.set(effectiveLicenseKey, { response: fallbackResp, timestamp: Date.now() });
|
|
161
161
|
return fallbackResp;
|
|
162
162
|
} catch { /* proceed to parse error response */ }
|
|
163
163
|
}
|
|
@@ -174,7 +174,7 @@ export class LicenseValidator {
|
|
|
174
174
|
|
|
175
175
|
// 3. Negative validation responses immediately purge any existing cache
|
|
176
176
|
if (!res.ok || !data.valid || data.licenseStatus !== 'ACTIVE' || data.forceUpgrade) {
|
|
177
|
-
this.purgeCache(
|
|
177
|
+
this.purgeCache(effectiveLicenseKey);
|
|
178
178
|
|
|
179
179
|
if (data.forceUpgrade || res.status === 426) {
|
|
180
180
|
throw new SDKVersionUnsupportedError(
|
|
@@ -188,7 +188,7 @@ export class LicenseValidator {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// 4. Cache SUCCESSFUL validation only (TTL = 5 minutes)
|
|
191
|
-
this.cache.set(
|
|
191
|
+
this.cache.set(effectiveLicenseKey, {
|
|
192
192
|
response: data,
|
|
193
193
|
timestamp: Date.now(),
|
|
194
194
|
});
|