biz9-logic 10.0.13 → 10.0.18

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/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='10.1.3'
1
+ VERSION='10.1.8'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main'
package/index.js CHANGED
@@ -18,6 +18,7 @@ class Message {
18
18
  static USER_EMAIL_NEW_CONFIRM_BAD="The New and Confirm Email Dont Match.";
19
19
  static USER_PASSWORD_NEW_CONFIRM_BAD="The New and Confirm Password Dont Match.";
20
20
  static USER_PASSWORD_BAD="Please Enter A Valid Password.";
21
+ static USER_PASSWORD_NOT_VALID="Password must be between 7 and 15 characters long, have at least one uppercase and lowercase letter, and also contain at least one digit and one special character.";
21
22
  static USER_EMAIL_NOT_UNIQUE="Email Not Availble. Please Choose Another.";
22
23
  static USER_USERNAME_BAD="Please Enter A Valid Username.";
23
24
  static USER_USERNAME_NOT_UNIQUE="Username Not Availble. Please Choose Another.";
@@ -37,7 +38,16 @@ class Item_Logic {
37
38
  const item = DataItem.get_new(data_type,0,{title:title,title_url:Str.get_title_url(title),setting_visible:"1"});
38
39
  return item;
39
40
  };
40
-
41
+ static copy = (data_type,item)=>{
42
+ let copy_item = DataItem.get_new(data_type,0);
43
+ const keys = Object.keys(item);
44
+ keys.forEach(key => {
45
+ if(key!=Type.ID&&key!=Type.SOURCE&&key!=Type.TITLE&&key!=Type.TITLE_URL){
46
+ copy_item[key]=item[key];
47
+ }
48
+ });
49
+ return copy_item;
50
+ };
41
51
  static bind_child_parent_obj = (child_obj,parent_obj)=>{
42
52
  for(const prop in parent_obj) {
43
53
  child_obj['parent_'+prop] = parent_obj[prop];
@@ -524,6 +534,7 @@ class Type {
524
534
  case DataType.EVENT:
525
535
  case DataType.FAQ:
526
536
  case DataType.FAVORITE:
537
+ case DataType.FILE:
527
538
  case DataType.GALLERY:
528
539
  case DataType.GROUP:
529
540
  case DataType.ITEM_MAP:
@@ -1452,6 +1463,7 @@ class DataType {
1452
1463
  static GROUP='group_biz';
1453
1464
  static FAQ='faq_biz';
1454
1465
  static FAVORITE='favorite_biz';
1466
+ static FILE='file_biz';
1455
1467
  static GALLERY='gallery_biz';
1456
1468
  static IMAGE='image_biz';
1457
1469
  static ITEM='item_biz';
@@ -1960,6 +1972,30 @@ class App_Logic {
1960
1972
  }
1961
1973
  }
1962
1974
  }
1975
+ class File_Logic {
1976
+ static url_post = (app_id,url,param) => {
1977
+ let action_url="main/file/post";
1978
+ return get_cloud_url_main(app_id,url,action_url,param);
1979
+ };
1980
+ static url_post_cdn = (app_id,url,param) => {
1981
+ let action_url="main/file/post_cdn";
1982
+ return get_cloud_url_main(app_id,url,action_url,param);
1983
+ };
1984
+ static url = (host,file_filename,size,param) =>{
1985
+ host = host ? host : "";
1986
+ file_filename = file_filename ? file_filename : "";
1987
+ size = size ? size : "";
1988
+ param = param ? param : "";
1989
+ return host+"/"+size + "_"+file_filename+param;
1990
+ }
1991
+ static get_new_by_base64 = (item_file) =>{
1992
+ let item = DataItem.get_new(DataType.FILE,0,item_file);
1993
+ item.extension = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_file_type_from_base64(item.file_data).extension : 'txt';
1994
+ item.file_filename = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_guid()+ "." + item.extension : 'not_found.txt';
1995
+ item.buffer = !Str.check_is_null(Str.get_file_type_from_base64(item_file.file_data)) ? Buffer.from(item_file.file_data.split(';base64,').pop(), 'base64') : null;
1996
+ return item;
1997
+ };
1998
+ };
1963
1999
  class Image_Logic {
1964
2000
  static url_post = (app_id,url,param) => {
1965
2001
  let action_url="main/image/post";
@@ -2072,6 +2108,9 @@ class Url {
2072
2108
  //field
2073
2109
  static CUSTOM_FIELD="item/custom_field";
2074
2110
  static FIELD_VALUE_POST="item/field_value_post";
2111
+ //file
2112
+ static FILE_POST="main/file/post";
2113
+ static FILE_CDN_POST="main/file/cdn_post";
2075
2114
  //image
2076
2115
  static IMAGE_POST="main/image/post";
2077
2116
  static IMAGE_CDN_POST="main/image/cdn_post";
@@ -2125,6 +2164,7 @@ module.exports = {
2125
2164
  DataType,
2126
2165
  Demo_Logic,
2127
2166
  Event_Logic,
2167
+ File_Logic,
2128
2168
  Field_Logic,
2129
2169
  Favorite_Logic,
2130
2170
  Gallery_Logic,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "10.0.13",
3
+ "version": "10.0.18",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const series = require('async-series');
2
- const {DataItem,DataType,Item_Logic,User_Logic,Page_Logic,Product_Logic,Type,Title,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic,Demo_Logic,Cart_Logic,Order_Logic,App_Logic,Field_Logic,Image_Logic} = require('./index');
2
+ const {DataItem,DataType,Item_Logic,User_Logic,Page_Logic,Product_Logic,Type,Title,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic,Demo_Logic,Cart_Logic,Order_Logic,App_Logic,Field_Logic,Image_Logic,Message} = require('./index');
3
3
  const {Log,Num,Str} = require('biz9-utility');
4
4
  const {Scriptz}= require('biz9-scriptz');
5
5
 
@@ -44,6 +44,7 @@ describe("connect", () => {
44
44
  Log.w('88_image',image);
45
45
  image = Image_Logic.get_new_by_base64(image);
46
46
  Log.w('99_result',image);
47
+ Log.w('error_show',Message.USER_PASSWORD_NOT_VALID);
47
48
 
48
49
  //Log.w('Title',Type.get_title(Type.ORDER_STATUS_NEW));
49
50
  //Log.w('Title 2',Type.get_title(Type.ORDER_STATUS_COMPLETE));