@gaias/basenode 1.0.59 → 1.0.60

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.
@@ -1,3 +1,3 @@
1
1
  import { BootstrapLoader } from '../../server/BootstrapLoader';
2
- export declare const casbinLoader: (modelPath?: string) => BootstrapLoader;
2
+ export declare const casbinLoader: BootstrapLoader;
3
3
  //# sourceMappingURL=CasbinLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CasbinLoader.d.ts","sourceRoot":"","sources":["../../../../src/libs/casbin/CasbinLoader.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAyB/D,eAAO,MAAM,YAAY,GAAI,YAAW,MAA6C,KAAG,eA6CvF,CAAC"}
1
+ {"version":3,"file":"CasbinLoader.d.ts","sourceRoot":"","sources":["../../../../src/libs/casbin/CasbinLoader.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAyE/D,eAAO,MAAM,YAAY,EAAE,eA0B1B,CAAC"}
@@ -8,37 +8,24 @@ const typedi_1 = require("typedi");
8
8
  const typeorm_1 = require("typeorm");
9
9
  const casbin_1 = require("casbin");
10
10
  const redis_watcher_1 = require("redis-watcher");
11
- const fs_1 = require("fs");
12
- const path_1 = require("path");
13
11
  const configure_1 = require("../configure");
14
12
  const CasbinAdapter_1 = __importDefault(require("./CasbinAdapter"));
15
13
  const logger_1 = require("../logger");
16
- const casbinLoader = (modelPath = './cfg/rbac_with_domains_model.conf') => {
17
- return async (settings) => {
18
- const logger = logger_1.Logger.getLogger('CasbinLoader');
19
- const absoluteModelPath = (0, path_1.resolve)(modelPath);
20
- if (!(0, fs_1.existsSync)(absoluteModelPath)) {
21
- const errorMsg = `Casbin model file not found: ${absoluteModelPath}\n` +
22
- `Please ensure the model configuration file exists at the specified path.\n` +
23
- `Original path: ${modelPath}`;
24
- logger.error(errorMsg);
25
- throw new Error(errorMsg);
26
- }
27
- logger.info(`Loading Casbin model from: ${absoluteModelPath}`);
28
- const redis = configure_1.ConfigManager.getConfig('redis');
29
- const dataSource = typedi_1.Container.get(typeorm_1.DataSource);
30
- const adapter = await CasbinAdapter_1.default.newAdapter(Object.assign({}, dataSource.options, { synchronize: false, logging: 'error' }));
31
- const enforcer = await (0, casbin_1.newEnforcer)(absoluteModelPath, adapter);
32
- const watcher = await redis_watcher_1.RedisWatcher.newWatcher(redis.redis);
33
- enforcer.setWatcher(watcher);
34
- typedi_1.Container.set(casbin_1.Enforcer, enforcer);
35
- await enforcer.loadPolicy();
36
- settings?.onShutdown(async () => {
37
- logger.info('Shutting down Casbin adapter...');
38
- await adapter.close();
39
- });
40
- logger.info('✅ Casbin RBAC module loaded successfully');
41
- };
14
+ const casbinLoader = async (settings) => {
15
+ const logger = logger_1.Logger.getLogger('CasbinLoader');
16
+ const redis = configure_1.ConfigManager.getConfig('redis');
17
+ const dataSource = typedi_1.Container.get(typeorm_1.DataSource);
18
+ const adapter = await CasbinAdapter_1.default.newAdapter(Object.assign({}, dataSource.options, { synchronize: false, logging: 'error' }));
19
+ const enforcer = await (0, casbin_1.newEnforcer)('./cfg/rbac_with_domains_model.conf', adapter);
20
+ const watcher = await redis_watcher_1.RedisWatcher.newWatcher(redis.redis);
21
+ enforcer.setWatcher(watcher);
22
+ typedi_1.Container.set(casbin_1.Enforcer, enforcer);
23
+ await enforcer.loadPolicy();
24
+ settings?.onShutdown(async () => {
25
+ logger.info('Shutting down Casbin adapter...');
26
+ await adapter.close();
27
+ });
28
+ logger.info(' Casbin RBAC module loaded successfully');
42
29
  };
43
30
  exports.casbinLoader = casbinLoader;
44
31
  //# sourceMappingURL=CasbinLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CasbinLoader.js","sourceRoot":"","sources":["../../../../src/libs/casbin/CasbinLoader.ts"],"names":[],"mappings":";;;;;;AACA,mCAAmC;AACnC,qCAAqC;AACrC,mCAA+C;AAC/C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O,CAAC,CAAC;IAG7B,kBAAS,CAAC,GAAG,CAAC,iBAAQ,EAAE,QAAQ,CAAC,CAAC;IAGlC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;IAG5B,QAAQ,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE;QAC9B,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC/C,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;AAC7D,CAAC,CAAC;AA1BW,QAAA,YAAY,gBA0BvB"}
@@ -1,3 +1,3 @@
1
1
  import { BootstrapLoader } from '../../server/BootstrapLoader';
2
- export declare const restClientLoader: () => BootstrapLoader;
2
+ export declare const restClientLoader: BootstrapLoader;
3
3
  //# sourceMappingURL=RestClientLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RestClientLoader.d.ts","sourceRoot":"","sources":["../../../../src/libs/restful/RestClientLoader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAI/D,eAAO,MAAM,gBAAgB,QAAO,eAWnC,CAAC"}
1
+ {"version":3,"file":"RestClientLoader.d.ts","sourceRoot":"","sources":["../../../../src/libs/restful/RestClientLoader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAiB/D,eAAO,MAAM,gBAAgB,EAAE,eAU9B,CAAC"}
@@ -5,15 +5,14 @@ const typedi_1 = require("typedi");
5
5
  const client_node_1 = require("@sight-saber/client_node");
6
6
  const configure_1 = require("../configure");
7
7
  const logger_1 = require("../logger");
8
- const restClientLoader = () => {
9
- return async (settings) => {
10
- const app = configure_1.ConfigManager.getConfig('application');
11
- const api = configure_1.ConfigManager.getConfig('CommonApiParam');
12
- const rc = new client_node_1.RestClient(new client_node_1.FSBackend(['API'], app.proxy), api);
13
- await rc.preload();
14
- typedi_1.Container.set(client_node_1.RestClient, rc);
15
- logger_1.Logger.getLogger('RestClient@bootstrap').info(`✅RestClient APIs loaded. Proxy: ${app.proxy}`);
16
- };
8
+ const restClientLoader = async (settings) => {
9
+ const app = configure_1.ConfigManager.getConfig('application');
10
+ const api = configure_1.ConfigManager.getConfig('CommonApiParam');
11
+ const rc = new client_node_1.RestClient(new client_node_1.FSBackend(['API'], app.proxy), api);
12
+ await rc.preload();
13
+ typedi_1.Container.set(client_node_1.RestClient, rc);
14
+ logger_1.Logger.getLogger('RestClient@bootstrap').info(` ✅ RestClientLoader. settings: ${settings?.config}`);
15
+ logger_1.Logger.getLogger('RestClient@bootstrap').info(` ✅ RestClient APIs loaded. Proxy: ${app.proxy}`);
17
16
  };
18
17
  exports.restClientLoader = restClientLoader;
19
18
  //# sourceMappingURL=RestClientLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RestClientLoader.js","sourceRoot":"","sources":["../../../../src/libs/restful/RestClientLoader.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AACnC,0DAAiE;AACjE,4CAA6C;AAE7C,sCAAmC;AAG5B,MAAM,gBAAgB,GAAG,GAAoB,EAAE;IACpD,OAAO,KAAK,EAAE,QAAiC,EAAE,EAAE;QAEjD,MAAM,GAAG,GAAG,yBAAa,CAAC,SAAS,CAAmB,aAAa,CAAC,CAAC;QACrE,MAAM,GAAG,GAAG,yBAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,EAAE,GAAG,IAAI,wBAAU,CAAC,IAAI,uBAAS,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;QAClE,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;QAEnB,kBAAS,CAAC,GAAG,CAAC,wBAAU,EAAE,EAAE,CAAC,CAAC;QAC9B,eAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,mCAAmC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IAChG,CAAC,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,gBAAgB,oBAW3B"}
1
+ {"version":3,"file":"RestClientLoader.js","sourceRoot":"","sources":["../../../../src/libs/restful/RestClientLoader.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AACnC,0DAAiE;AACjE,4CAA6C;AAE7C,sCAAmC;AAgB5B,MAAM,gBAAgB,GAAoB,KAAK,EAAE,QAAiC,EAAE,EAAE;IAE1F,MAAM,GAAG,GAAG,yBAAa,CAAC,SAAS,CAAmB,aAAa,CAAC,CAAC;IACrE,MAAM,GAAG,GAAG,yBAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACtD,MAAM,EAAE,GAAG,IAAI,wBAAU,CAAC,IAAI,uBAAS,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;IACjE,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IAEnB,kBAAS,CAAC,GAAG,CAAC,wBAAU,EAAE,EAAE,CAAC,CAAC;IAC9B,eAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,kCAAkC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACpG,eAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,qCAAqC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;AACpG,CAAC,CAAC;AAVW,QAAA,gBAAgB,oBAU3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaias/basenode",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "buildNumber": 251025471,
5
5
  "description": "API development framework for NodeJs",
6
6
  "author": "FOT",