@ruiapp/rapid-core 0.7.3 → 0.7.4
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.d.ts +1 -0
- package/dist/index.js +26 -14
- package/package.json +1 -1
- package/src/index.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./utilities/accessControlUtility";
|
|
|
11
11
|
export * from "./utilities/entityUtility";
|
|
12
12
|
export * from "./utilities/jwtUtility";
|
|
13
13
|
export * from "./utilities/timeUtility";
|
|
14
|
+
export * from "./helpers/licenseHelper";
|
|
14
15
|
export * from "./deno-std/http/cookie";
|
|
15
16
|
export { mapDbRowToEntity } from "./dataAccess/entityMapper";
|
|
16
17
|
export * as bootstrapApplicationConfig from "./bootstrapApplicationConfig";
|
package/dist/index.js
CHANGED
|
@@ -4843,6 +4843,30 @@ async function generateJwtSecretKey() {
|
|
|
4843
4843
|
return encode(exportedKey);
|
|
4844
4844
|
}
|
|
4845
4845
|
|
|
4846
|
+
function validateLicense(server) {
|
|
4847
|
+
const licenseService = server.getService("licenseService");
|
|
4848
|
+
const license = licenseService.getLicense();
|
|
4849
|
+
if (!license) {
|
|
4850
|
+
const errorMessage = `无法获取系统授权信息。`;
|
|
4851
|
+
throw new Error(errorMessage);
|
|
4852
|
+
}
|
|
4853
|
+
if (licenseService.isExpired()) {
|
|
4854
|
+
const expireDate = lodash.get(license.authority, "expireDate");
|
|
4855
|
+
const errorMessage = `您的系统授权已于${expireDate}过期。`;
|
|
4856
|
+
throw new Error(errorMessage);
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
function tryValidateLicense(logger, server) {
|
|
4860
|
+
try {
|
|
4861
|
+
validateLicense(server);
|
|
4862
|
+
return true;
|
|
4863
|
+
}
|
|
4864
|
+
catch (err) {
|
|
4865
|
+
logger.error("授权验证失败:%s", err.message || "");
|
|
4866
|
+
}
|
|
4867
|
+
return false;
|
|
4868
|
+
}
|
|
4869
|
+
|
|
4846
4870
|
const values = new Map();
|
|
4847
4871
|
async function set(key, value, options) {
|
|
4848
4872
|
let expireAt = -1;
|
|
@@ -6652,20 +6676,6 @@ var changePassword$1 = /*#__PURE__*/Object.freeze({
|
|
|
6652
6676
|
handler: handler$e
|
|
6653
6677
|
});
|
|
6654
6678
|
|
|
6655
|
-
function validateLicense(server) {
|
|
6656
|
-
const licenseService = server.getService("licenseService");
|
|
6657
|
-
const license = licenseService.getLicense();
|
|
6658
|
-
if (!license) {
|
|
6659
|
-
const errorMessage = `无法获取系统授权信息。`;
|
|
6660
|
-
throw new Error(errorMessage);
|
|
6661
|
-
}
|
|
6662
|
-
if (licenseService.isExpired()) {
|
|
6663
|
-
const expireDate = lodash.get(license.authority, "expireDate");
|
|
6664
|
-
const errorMessage = `您的系统授权已于${expireDate}过期。`;
|
|
6665
|
-
throw new Error(errorMessage);
|
|
6666
|
-
}
|
|
6667
|
-
}
|
|
6668
|
-
|
|
6669
6679
|
const code$d = "createSession";
|
|
6670
6680
|
async function handler$d(plugin, ctx, options) {
|
|
6671
6681
|
const { server, input, routerContext: routeContext, logger } = ctx;
|
|
@@ -8955,4 +8965,6 @@ exports.getSetCookies = getSetCookies;
|
|
|
8955
8965
|
exports.isAccessAllowed = isAccessAllowed;
|
|
8956
8966
|
exports.mapDbRowToEntity = mapDbRowToEntity;
|
|
8957
8967
|
exports.setCookie = setCookie;
|
|
8968
|
+
exports.tryValidateLicense = tryValidateLicense;
|
|
8969
|
+
exports.validateLicense = validateLicense;
|
|
8958
8970
|
exports.verifyJwt = verifyJwt;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -17,6 +17,8 @@ export * from "./utilities/entityUtility";
|
|
|
17
17
|
export * from "./utilities/jwtUtility";
|
|
18
18
|
export * from "./utilities/timeUtility";
|
|
19
19
|
|
|
20
|
+
export * from "./helpers/licenseHelper";
|
|
21
|
+
|
|
20
22
|
export * from "./deno-std/http/cookie";
|
|
21
23
|
|
|
22
24
|
export { mapDbRowToEntity } from "./dataAccess/entityMapper";
|