biz9-logic 4.0.26 → 4.0.30

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.
Files changed (4) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +49 -37
  3. package/package.json +1 -1
  4. package/test.js +66 -84
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='4.2.6'
1
+ VERSION='4.3.0'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -35,31 +35,37 @@ class Template{
35
35
  };
36
36
  }
37
37
  class Page{
38
- static get_test = (title) =>{
38
+ static get_test = (option) =>{
39
+ if(!option){
40
+ option = {item_count:9,page_count:9,get_value:false,get_item:false};
41
+ }
42
+ if(!option.item_count){
43
+ option.item_count=10;
44
+ }
39
45
  let page = DataItem.get_new_full_item(
40
46
  DataItem.get_new(DataType.PAGE,Number.get_id()),
41
47
  DataItem.get_new(DataType.PAGE,0),
42
48
  DataItem.get_new(DataType.PAGE,0),
43
- Field.get_test(title));
44
-
45
- for(let a=0;a<20;a++){
46
- page=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,page,page,page);
49
+ Field.get_test("Page "+ String(Number.get_id()),option));
50
+ if(option.get_item){
51
+ for(let a=0;a<option.item_count;a++){
52
+ page=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,page,page,page);
53
+ }
54
+ page=Sub_Item.get_test_bind_item_sub_item(page);
47
55
  }
48
- page = Sub_Item.get_test_bind_item_sub_item(page);
49
-
50
56
  return page;
51
57
  };
52
58
  }
53
59
  class Product{
54
60
  static get_test = (option) =>{
55
61
  if(!option){
56
- option={};
62
+ option = {item_count:9,product_count:9,get_value:false,get_item:false};
57
63
  }
58
64
  let product = DataItem.get_new_full_item(
59
65
  DataItem.get_new(DataType.PRODUCT,Number.get_id()),
60
66
  DataItem.get_new(DataType.PRODUCT,0),
61
67
  DataItem.get_new(DataType.PRODUCT,0),
62
- Field.get_test("Product "+Number.get_id(),{get_value:false}));
68
+ Field.get_test("Product "+Number.get_id(),option));
63
69
  product.cost = String(Number.get_id()) + "." + String(Number.get_id());
64
70
  product.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
65
71
  product.type = "Type "+String(Number.get_id());
@@ -67,14 +73,14 @@ class Product{
67
73
  product.stock = String(Number.get_id(3-1));
68
74
  product.category ="Category " + String(Number.get_id());
69
75
  if(option.get_item){
70
- product = Sub_Item.get_test_bind_new_child(Number.get_id(),"Product "+Number.get_id(),product,product,product);
71
- for(let a=0;a<10;a++){
72
- product=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section " + String(a),product,product,product);
76
+ for(let a=0;a<option.item_count;a++){
77
+ product=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,product,product,product);
73
78
  }
74
- product = Sub_Item.get_test_bind_item_sub_item(product);
79
+ product=Sub_Item.get_test_bind_item_sub_item(product);
75
80
  }
76
81
  return product;
77
82
  };
83
+
78
84
  static get_test_list_by_category = (option) =>{
79
85
  let product_list = [];
80
86
  let category_count = 9;
@@ -95,7 +101,7 @@ class Product{
95
101
  for(let a=0;a<category_list.length;a++){
96
102
  for(let b=0;b<product_count;b++){
97
103
  item_count++;
98
- let product = Product.get_test("Product " + String(item_count));
104
+ let product = Product.get_test({item_count:0,product_count:product_count,get_value:false,get_item:false});
99
105
  product.category = category_list[Number.get_id(category_list.length-1)].title;
100
106
  product_list.push(product);
101
107
  }
@@ -106,13 +112,16 @@ class Product{
106
112
  class Service{
107
113
  static get_test = (option) =>{
108
114
  if(!option){
109
- option = {get_value:false,get_item:false};
115
+ option = {item_count:9,service_count:9,get_value:false,get_item:false};
116
+ }
117
+ if(!option.item_count){
118
+ option.item_count=10;
110
119
  }
111
120
  let service = DataItem.get_new_full_item(
112
121
  DataItem.get_new(DataType.SERVICE,Number.get_id()),
113
122
  DataItem.get_new(DataType.SERVICE,0),
114
123
  DataItem.get_new(DataType.SERVICE,0),
115
- Field.get_test("Service "+Number.get_id(),{get_value:false}));
124
+ Field.get_test("Service "+ String(Number.get_id()),option));
116
125
  service = Sub_Item.get_test_bind_new_child(Number.get_id(),"Service "+Number.get_id(),service,service,service);
117
126
  service.cost = String(Number.get_id()) + "." + String(Number.get_id());
118
127
  service.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
@@ -121,13 +130,12 @@ class Service{
121
130
  service.stock = String(Number.get_id(3-1));
122
131
  service.category ="Category " + String(Number.get_id());
123
132
  if(option.get_item){
124
- service = Sub_Item.get_test_bind_new_child(Number.get_id(),"Service "+Number.get_id(),service,service,service);
125
- for(let a=0;a<10;a++){
126
- service=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section " + String(a),service,service,service);
133
+ for(let a=0;a<option.item_count;a++){
134
+ service=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,service,service,service);
127
135
  }
128
- service = Sub_Item.get_test_bind_item_sub_item(service);
136
+ service=Sub_Item.get_test_bind_item_sub_item(service);
129
137
  }
130
- return service;
138
+ return service;
131
139
  };
132
140
  static get_test_list=(option)=>{
133
141
  if(!option){
@@ -143,13 +151,16 @@ class Service{
143
151
  class Event{
144
152
  static get_test = (option) =>{
145
153
  if(!option){
146
- option = {get_value:false,get_item:false};
154
+ option = {item_count:9,event_count:9,get_value:false,get_item:false};
155
+ }
156
+ if(!option.item_count){
157
+ option.item_count=10;
147
158
  }
148
159
  let event = DataItem.get_new_full_item(
149
160
  DataItem.get_new(DataType.EVENT,Number.get_id()),
150
161
  DataItem.get_new(DataType.EVENT,0),
151
162
  DataItem.get_new(DataType.EVENT,0),
152
- Field.get_test("Event "+Number.get_id(),{get_value:false}));
163
+ Field.get_test("Event "+ String(Number.get_id()),option));
153
164
  event = Sub_Item.get_test_bind_new_child(Number.get_id(),"Event "+Number.get_id(),event,event,event);
154
165
  event.cost = String(Number.get_id()) + "." + String(Number.get_id());
155
166
  event.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
@@ -161,13 +172,12 @@ class Event{
161
172
  event.stock = String(Number.get_id(3-1));
162
173
  event.category ="Category " + String(Number.get_id());
163
174
  if(option.get_item){
164
- event=Sub_Item.get_test_bind_new_child(Number.get_id(),"Event "+Number.get_id(),event,event,event);
165
- for(let a=0;a<10;a++){
166
- event=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section " +String(a),event,event,event);
175
+ for(let a=0;a<option.item_count;a++){
176
+ event=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,event,event,event);
167
177
  }
168
178
  event=Sub_Item.get_test_bind_item_sub_item(event);
169
179
  }
170
- return event;
180
+ return event;
171
181
  };
172
182
  static get_test_list=(option)=>{
173
183
  if(!option){
@@ -325,20 +335,22 @@ class DataType {
325
335
  class Blog_Post{
326
336
  static get_test = (option) =>{
327
337
  if(!option){
328
- option = {get_value:false,get_item:false};
338
+ option = {item_count:9,blog_post_count:9,get_value:false,get_item:false};
339
+ }
340
+ if(!option.item_count){
341
+ option.item_count=10;
329
342
  }
330
343
  let blog_post = DataItem.get_new_full_item(
331
344
  DataItem.get_new(DataType.BLOG_POST,Number.get_id()),
332
345
  DataItem.get_new(DataType.BLOG_POST,0),
333
346
  DataItem.get_new(DataType.BLOG_POST,0),
334
- Field.get_test("Blog Post "+Number.get_id(),{get_value:false}));
347
+ Field.get_test("Blog Post "+Number.get_id(),option));
335
348
  blog_post.author="First Name "+ Number.get_id();
336
349
  blog_post.tag="tag 1,tag 2,tag 3";
337
350
  blog_post.category ="Category " + String(Number.get_id());
338
351
  if(option.get_item){
339
- blog_post=Sub_Item.get_test_bind_new_child(Number.get_id(),"Blog Post "+Number.get_id(),blog_post,blog_post,blog_post);
340
- for(let a=0;a<10;a++){
341
- blog_post=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section " +String(a),blog_post,blog_post,blog_post);
352
+ for(let a=0;a<option.item_count;a++){
353
+ blog_post=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,blog_post,blog_post,blog_post);
342
354
  }
343
355
  blog_post=Sub_Item.get_test_bind_item_sub_item(blog_post);
344
356
  }
@@ -346,11 +358,11 @@ class Blog_Post{
346
358
  };
347
359
  static get_test_list=(option)=>{
348
360
  if(!option){
349
- option={blog_post_count:19};
361
+ option = {item_count:9,blog_post_count:9,get_value:false,get_item:false};
350
362
  }
351
363
  let item_list=[];
352
364
  for(let a=0;a<option.blog_post_count;a++){
353
- item_list.push(Blog_Post.get_test());
365
+ item_list.push(Blog_Post.get_test(option));
354
366
  }
355
367
  return item_list;
356
368
  };
@@ -385,7 +397,7 @@ class Review{
385
397
  };
386
398
  }
387
399
  class Business {
388
- static get_new = (title) =>{
400
+ static get_new = () =>{
389
401
  if(!title){
390
402
  title="";
391
403
  }
@@ -393,7 +405,7 @@ class Business {
393
405
  DataItem.get_new(DataType.BUSINESS,0),
394
406
  DataItem.get_new(DataType.BUSINESS,0),
395
407
  DataItem.get_new(DataType.BUSINESS,0),{
396
- title:title,
408
+ title:"Business " + Number.get_id(),
397
409
  email:"",
398
410
  phone:"",
399
411
  address_1:"",
@@ -417,7 +429,7 @@ class Business {
417
429
  item.address_2="PO Box "+Number.get_id();
418
430
  item.city=city_list[Number.get_id(city_list.length-1)];
419
431
  item.state=state_list[Number.get_id(state_list.length-1)];
420
- item.zip="123"+Number.get_id();
432
+ item.zip=Number.get_id(9999);
421
433
  return item;
422
434
  };
423
435
  static get_full_address(business){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.0.26",
3
+ "version": "4.0.30",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -29,7 +29,7 @@ describe("connect", () => {
29
29
  it("_connect", () => {
30
30
  series([
31
31
 
32
- function(call) {
32
+ function(call) {
33
33
  console.log('CONNECT-START');
34
34
 
35
35
  /* --CONFIG--START */
@@ -37,58 +37,70 @@ describe("connect", () => {
37
37
  //let cloud_url = Url.connect(biz9_config);
38
38
  /* --CONFIG--END */
39
39
 
40
-
41
- /* --DATA_TYPE--START */
42
- //Log.w('data_type_list',DataType.get_item_list());
43
- /* --DATA_TYPE--END */
44
-
45
- /* --REVIEW--START */
46
- //Log.w("Review",Review.get_test());
47
- //Log.w("Review List",Review.get_test_list());
40
+ /* --PAGE--START */
41
+ //let page = Page.get_test("Home",{item_count:20,page_count:2,get_value:true,get_item:true})
48
42
  /*
49
- let review_list = Review.get_test_list({review_count:3,get_item:true})
50
- Log.w("Review List",review_list);
43
+ let page = Page.get_test({item_count:9,page_count:19,get_item:true,get_value:true})
44
+ //let page = Page.get_test()
45
+ Log.w("Page",page);
46
+ Log.w("Page_section_1",page.section_1);
47
+ Log.w("Page_section_1_section_1_section_1",page.section_1.section_1.section_1);
51
48
  */
52
- /* --REVIEW--END */
49
+ /* --PAGE--END */
53
50
 
54
51
  /* --BLOG_POST--START */
55
- /*
56
- let blog_post_list = Blog_Post.get_test_list({blog_post_count:3,get_item:true})
57
- Log.w("Blog Post List",blog_post_list);
58
- */
59
- /*
60
- let blog_post = Blog_Post.get_test({get_item:true})
61
- Log.w("Blog Post",blog_post);
62
- Log.w("Blog Post Section 1",blog_post.section_1);
63
- Log.w("Blog Post Section 1, Section 1",blog_post.section_1.section_1);
64
- */
52
+ //let blog_post = Blog_Post.get_test({item_count:9,blog_post_count:19,get_item:true,get_value:true})
53
+ //let blog_post = Blog_Post.get_test()
54
+ //let blog_post_list=Blog_Post.get_test_list({category_count:5,blog_post_count:9,get_value:true,get_item:true});
55
+ //Log.w('blog_post_list',blog_post_list);
56
+ //Log.w("Blog_Post",blog_post);
57
+ //Log.w("BLog_Post_section_1",blog_post.section_1);
58
+ //Log.w("BLog_Post_section_1_section_1_section_1",blog_post.section_1.section_1.section_1);
65
59
  /* --BLOG_POST--END */
66
60
 
61
+
62
+ /* --PRODUCT--START */
63
+ //let [category_list,product_list]=Product.get_test_list_by_category({category_count:5,product_count:9});
64
+ let product = Product.get_test({item_count:9,product_count:19,get_item:true,get_value:true})
65
+ //let product = Product.get_test()
66
+ //Log.w('product_list',product_list);
67
+ //Log.w('category_list',category_list);
68
+ //Log.w("Product",product);
69
+ Log.w("Product_section_1",product.section_1);
70
+ Log.w("Product_section_1_section_1_section_1",product.section_1.section_1.section_1);
71
+ /* --PRODUCT--END */
72
+
67
73
  /* --SERVICE--START */
68
- let service_list = Service.get_test_list({service_count:3,get_item:true})
69
- Log.w("Service List",service_list);
74
+ /*
75
+ let service = Service.get_test({item_count:9,service_count:19,get_item:true,get_value:true})
76
+ //let service = Service.get_test()
77
+ Log.w("Service",service);
78
+ Log.w("Service_section_1",service.section_1);
79
+ Log.w("Service_section_1_section_1_section_1",service.section_1.section_1.section_1);
80
+ */
70
81
  /* --SERVICE--END */
71
82
 
72
-
73
- /* --EVENT--START */
83
+ /* --SERVICE--START */
74
84
  /*
75
- let event_list = Event.get_test_list({event_count:3,get_item:true})
76
- Log.w("Event List",event_list);
85
+ let event = Event.get_test({item_count:9,event_count:19,get_item:true,get_value:true})
86
+ //let service = Service.get_test()
87
+ Log.w("Event",event);
88
+ Log.w("Event_section_1",event.section_1);
89
+ Log.w("Event_section_1_section_1_section_1",event.section_1.section_1.section_1);
77
90
  */
78
- //let event = Event.get_test({get_item:true})
79
- //Log.w("Event",event);
80
- //Log.w("Event Section 1",event.section_1);
81
- //Log.w("Event Section 1, Section 1",event.section_1.section_1);
82
- /* --EVENT--END */
91
+ /* --SERVICE--END */
83
92
 
84
- /* --PRODUCT--START */
93
+
94
+
95
+ /* --REVIEW--START */
96
+ //Log.w("Review",Review.get_test());
97
+ //Log.w("Review List",Review.get_test_list());
85
98
  /*
86
- let product = Product.get_test({get_item:true})
87
- Log.w("Product",product);
88
- Log.w("Product Section 1",product.section_1);
89
- Log.w("Product Section 1, Section 1",product.section_1.section_1);
99
+ let review_list = Review.get_test_list({review_count:3,get_item:true})
100
+ Log.w("Review List",review_list);
90
101
  */
91
- /* --PRODUCT--END */
102
+ /* --REVIEW--END */
103
+
92
104
 
93
105
 
94
106
 
@@ -99,36 +111,6 @@ describe("connect", () => {
99
111
 
100
112
 
101
113
 
102
- /* --CATEGORY--START */
103
- //Log.w("Category",Category.get_test("Category " + Number.get_id(),{get_items:false}));
104
- //let category = Category.get_test_list_by_category();
105
- /* --CATEGORY--END */
106
-
107
-
108
- /* --PRODUCT--START */
109
- //let product = Product.get_test_list_by_category();
110
- //Log.w('product_test',Product.get_test("Product " + Number.get_id(),{get_items:false}));
111
- //Log.w('product_list_test',Product.get_test_list_by_category({get_items:false,product_count:9,category_count:3}));
112
- //console.log(Product.get_test("Product " + Number.get_id(),{get_items:false}));
113
- /* --PRODUCT--END */
114
-
115
- //console.log(Template.get_test()); //get_template_test
116
- //console.log(Business.get_test()); // get_business_test
117
- // console.log(Page.get_test("Page " +String(Number.get_id()))); // get_page_test
118
- //console.log(Page.get_test("Page " +String("Cool"))); // get_page_test
119
- //console.log(Event.get_test());
120
- //console.log(Product.get_test("Product " +String(Number.get_id()))); // get_product_test
121
- //console.log(Service.get_test("Service " +String(Number.get_id()))); // get_service_test
122
- //console.log(Event.get_test("Event " +String(Number.get_id()))); // get_service_test
123
- //console.log(Category.get_test()); // get_category_test
124
- //console.log(product.section_1);
125
- //get page
126
-
127
- //Log.w('product',product);
128
- //Log.w('product_section_1',product.section_1);
129
-
130
- //console.log(Product.get_test());
131
- //Log.w('connect_url',cloud_url);
132
114
  console.log('CONNECT-SUCCESS');
133
115
  //call()
134
116
  },
@@ -244,10 +226,10 @@ describe("connect", () => {
244
226
  category_list.push({data_type:DataType.BLANK,id:0,title:Number.get_id()});
245
227
  category_list.push({data_type:DataType.BLANK,id:0,title:Number.get_id()});
246
228
  Log.w('cat',Cat.set_category_drop_down_list(category_list));
247
- //let cloud_url = CMS.get_new_query_item_by_item(item);
248
- //Log.w('connect_url',cloud_url);
249
- //console.log('SET_CATEGORY_DROP_DOWN_LIST-END');
250
- //call()
229
+ //let cloud_url = CMS.get_new_query_item_by_item(item);
230
+ //Log.w('connect_url',cloud_url);
231
+ //console.log('SET_CATEGORY_DROP_DOWN_LIST-END');
232
+ //call()
251
233
  },
252
234
 
253
235
 
@@ -262,10 +244,10 @@ describe("connect", () => {
262
244
  item.top_id = Number.get_id();
263
245
  item.top_data_type = DataType.BLANK;
264
246
  Log.w('item',item);
265
- //let cloud_url = CMS.get_new_query_item_by_item(item);
266
- //Log.w('connect_url',cloud_url);
247
+ //let cloud_url = CMS.get_new_query_item_by_item(item);
248
+ //Log.w('connect_url',cloud_url);
267
249
  console.log('GET-NEW-QUERY-ITEM-BY-ITEM-SUCCESS');
268
- //call()
250
+ //call()
269
251
  },
270
252
 
271
253
 
@@ -279,7 +261,7 @@ describe("connect", () => {
279
261
  let cloud_url = BiZ_Url.get_full_item(biz9_config,item,parent_item,top_item);
280
262
  Log.w('connect_url',cloud_url);
281
263
  console.log('GET-BiZ-Full-Url-Item-Get-Item-SUCCESS');
282
- //call()
264
+ //call()
283
265
  },
284
266
 
285
267
 
@@ -395,21 +377,21 @@ describe("connect", () => {
395
377
  console.log('GET_URL-BIZ-ITEM-START');
396
378
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
397
379
  let data_type = 'dt_blank';
398
- //let cloud_url = Url.get_biz_item(biz9_config,data_type,ID);
380
+ //let cloud_url = Url.get_biz_item(biz9_config,data_type,ID);
399
381
  let cloud_url = Url.delete_biz_item(biz9_config,data_type,ID);
400
382
  Log.w('get_url_biz_item',cloud_url);
401
383
  console.log('GET_URL-BIZ-ITEM-SUCCESS');
402
384
  call()
403
385
  },
404
- */
405
- function(call) {
406
- // never happens, because "second thing"
407
- // passed an error to the done() callback
408
- }
386
+ */
387
+ function(call) {
388
+ // never happens, because "second thing"
389
+ // passed an error to the done() callback
390
+ }
409
391
  ], function(err) {
410
392
  console.log(err.message) // "another thing"
411
393
  })
412
- });
394
+ });
413
395
  });
414
396
 
415
397