biz9-logic 10.0.13 → 10.0.16

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 (3) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +30 -0
  3. package/package.json +1 -1
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='10.1.3'
1
+ VERSION='10.1.6'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main'
package/index.js CHANGED
@@ -524,6 +524,7 @@ class Type {
524
524
  case DataType.EVENT:
525
525
  case DataType.FAQ:
526
526
  case DataType.FAVORITE:
527
+ case DataType.FILE:
527
528
  case DataType.GALLERY:
528
529
  case DataType.GROUP:
529
530
  case DataType.ITEM_MAP:
@@ -1452,6 +1453,7 @@ class DataType {
1452
1453
  static GROUP='group_biz';
1453
1454
  static FAQ='faq_biz';
1454
1455
  static FAVORITE='favorite_biz';
1456
+ static FILE='file_biz';
1455
1457
  static GALLERY='gallery_biz';
1456
1458
  static IMAGE='image_biz';
1457
1459
  static ITEM='item_biz';
@@ -1960,6 +1962,30 @@ class App_Logic {
1960
1962
  }
1961
1963
  }
1962
1964
  }
1965
+ class File_Logic {
1966
+ static url_post = (app_id,url,param) => {
1967
+ let action_url="main/file/post";
1968
+ return get_cloud_url_main(app_id,url,action_url,param);
1969
+ };
1970
+ static url_post_cdn = (app_id,url,param) => {
1971
+ let action_url="main/file/post_cdn";
1972
+ return get_cloud_url_main(app_id,url,action_url,param);
1973
+ };
1974
+ static url = (host,file_filename,size,param) =>{
1975
+ host = host ? host : "";
1976
+ file_filename = file_filename ? file_filename : "";
1977
+ size = size ? size : "";
1978
+ param = param ? param : "";
1979
+ return host+"/"+size + "_"+file_filename+param;
1980
+ }
1981
+ static get_new_by_base64 = (item_file) =>{
1982
+ let item = DataItem.get_new(DataType.FILE,0,item_file);
1983
+ 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';
1984
+ item.file_filename = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_guid()+ "." + item.extension : 'not_found.txt';
1985
+ 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;
1986
+ return item;
1987
+ };
1988
+ };
1963
1989
  class Image_Logic {
1964
1990
  static url_post = (app_id,url,param) => {
1965
1991
  let action_url="main/image/post";
@@ -2072,6 +2098,9 @@ class Url {
2072
2098
  //field
2073
2099
  static CUSTOM_FIELD="item/custom_field";
2074
2100
  static FIELD_VALUE_POST="item/field_value_post";
2101
+ //file
2102
+ static FILE_POST="main/file/post";
2103
+ static FILE_CDN_POST="main/file/cdn_post";
2075
2104
  //image
2076
2105
  static IMAGE_POST="main/image/post";
2077
2106
  static IMAGE_CDN_POST="main/image/cdn_post";
@@ -2125,6 +2154,7 @@ module.exports = {
2125
2154
  DataType,
2126
2155
  Demo_Logic,
2127
2156
  Event_Logic,
2157
+ File_Logic,
2128
2158
  Field_Logic,
2129
2159
  Favorite_Logic,
2130
2160
  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.16",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"