biz9-logic 1.0.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/babel.config.json +9 -0
- package/biz9_config +4 -0
- package/index.js +23 -0
- package/main.js +29 -0
- package/package.json +24 -0
- package/test.js +64 -0
- package/test_run +5 -0
package/biz9_config
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Certified CoderZ
|
|
3
|
+
Author: certifiedcoderz@gmail.com (Certified CoderZ)
|
|
4
|
+
License GNU General Public License v3.0
|
|
5
|
+
Description: BiZ9 Framework: Logic
|
|
6
|
+
*/
|
|
7
|
+
const { get_new_item_main,get_data_config_main,get_cloud_url_main } = require('./main.js');
|
|
8
|
+
|
|
9
|
+
const get_new_item = (data_type,id) => {
|
|
10
|
+
return get_new_item_main(data_type,id);
|
|
11
|
+
};
|
|
12
|
+
const get_data_config = (biz9_config,params) => {
|
|
13
|
+
return get_data_config_main(biz9_config,params);
|
|
14
|
+
};
|
|
15
|
+
const get_cloud_url = (app_title_id,domain_url,action_url)=>{
|
|
16
|
+
return get_cloud_url_main(app_title_id,domain_url,action_url);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
get_data_config,
|
|
21
|
+
get_cloud_url,
|
|
22
|
+
get_new_item,
|
|
23
|
+
};
|
package/main.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Certified CoderZ
|
|
3
|
+
Author: certifiedcoderz@gmail.com (Certified CoderZ)
|
|
4
|
+
License GNU General Public License v3.0
|
|
5
|
+
Description: BiZ9 Framework: Logic - Main
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const get_new_item_main = (data_type,id) => {
|
|
9
|
+
if(!id){
|
|
10
|
+
id=0;
|
|
11
|
+
}
|
|
12
|
+
return {data_type:data_type,id:id};
|
|
13
|
+
}
|
|
14
|
+
const get_cloud_url_main = (app_title_id,domain_url,action_url) =>{
|
|
15
|
+
var app_title_id_url='?app_title_id='+app_title_id;
|
|
16
|
+
return domain_url+action_url+app_title_id_url;
|
|
17
|
+
}
|
|
18
|
+
const get_data_config_main = (biz9_config,query) =>{
|
|
19
|
+
if(biz9_config.SERVICE_HOST_TYPE == 'multiple'){
|
|
20
|
+
biz9_config.APP_TITLE_ID=query.app_title_id;
|
|
21
|
+
}
|
|
22
|
+
return biz9_config;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
get_data_config_main,
|
|
27
|
+
get_new_item_main,
|
|
28
|
+
get_cloud_url_main,
|
|
29
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "biz9-logic",
|
|
3
|
+
"version": "1.0.14",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
+
},
|
|
8
|
+
"author": "Certified Coderz",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"async": "^3.2.6",
|
|
12
|
+
"biz9-scriptz": "^5.2.14"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/biz9framework/biz9-logic.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/biz9framework/biz9-logic/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/biz9framework/biz9-logic#readme",
|
|
22
|
+
"devDependencies": {},
|
|
23
|
+
"description": ""
|
|
24
|
+
}
|
package/test.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const async = require('async');
|
|
2
|
+
const { get_data_config, get_new_item, get_cloud_url } = require('./');
|
|
3
|
+
/* --- TEST CONFIG START --- */
|
|
4
|
+
//const ID='0';
|
|
5
|
+
const ID='f23c2372-df8e-4c09-a919-677fe32ba0bb';
|
|
6
|
+
const APP_TITLE_ID='cool_bean';
|
|
7
|
+
const DATA_TYPE='dt_blank';
|
|
8
|
+
const PORT_ID="1901";
|
|
9
|
+
const CLOUD_URL="http://localhost:"+PORT_ID;
|
|
10
|
+
/* --- TEST CONFIG END --- */
|
|
11
|
+
/* --- TEST DATA CONFIG START --- */
|
|
12
|
+
const biz9_config ={
|
|
13
|
+
SERVICE_HOST_TYPE:'multiple',
|
|
14
|
+
APP_TITLE_ID:APP_TITLE_ID,
|
|
15
|
+
MONGO_IP:'0.0.0.0',
|
|
16
|
+
MONGO_USERNAME_PASSWORD:'',
|
|
17
|
+
MONGO_PORT_ID:"27019",
|
|
18
|
+
MONGO_SERVER_USER:'admin',
|
|
19
|
+
MONGO_CONFIG_FILE_PATH:'/etc/mongod.conf',
|
|
20
|
+
SSH_KEY:"",
|
|
21
|
+
REDIS_URL:"0.0.0.0",
|
|
22
|
+
REDIS_PORT_ID:"27019"
|
|
23
|
+
};
|
|
24
|
+
/* --- TEST DATA CONFIG END --- */
|
|
25
|
+
|
|
26
|
+
describe("connect", () => {
|
|
27
|
+
it("_connect", () => {
|
|
28
|
+
async.series([
|
|
29
|
+
function(call) {
|
|
30
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-CONNECT-START');
|
|
31
|
+
call();
|
|
32
|
+
},
|
|
33
|
+
function(call) {
|
|
34
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-NEW-ITEM-START');
|
|
35
|
+
var _new_item = get_new_item(DATA_TYPE,0);
|
|
36
|
+
console.log(_new_item);
|
|
37
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-NEW-ITEM-SUCCESS');
|
|
38
|
+
call();
|
|
39
|
+
},
|
|
40
|
+
function(call) {
|
|
41
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-DATA-CONFIG-START');
|
|
42
|
+
var _data_config = get_data_config(biz9_config,{app_title_id:'local_app_title_id'});
|
|
43
|
+
console.log(_data_config);
|
|
44
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-DATA-CONFIG-SUCCESS');
|
|
45
|
+
call();
|
|
46
|
+
},
|
|
47
|
+
function(call) {
|
|
48
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-CLOUD-URL-START');
|
|
49
|
+
var _cloud_url = get_cloud_url(biz9_config.APP_TITLE_ID,CLOUD_URL,'/get/test/');
|
|
50
|
+
console.log(_cloud_url);
|
|
51
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-CLOUD-URL-SUCCESS');
|
|
52
|
+
call();
|
|
53
|
+
},
|
|
54
|
+
], function(err, results) {
|
|
55
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-CONNECT-SUCCESS');
|
|
56
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-DATA-CONFIG-SUCCESS');
|
|
57
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-NEW-ITEM-SUCCESS');
|
|
58
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-GET-CLOUD-URL-SUCCESS');
|
|
59
|
+
console.log('TEST-BIZ9-ADAPTER-SERVER-CONNECT-DONE');
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
|