@xuda.io/xuda-worker-bundle-min 1.3.1504 → 1.3.1505

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 (2) hide show
  1. package/index.js +150 -95
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -8095,102 +8095,102 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
8095
8095
  return new_class.get();
8096
8096
  };
8097
8097
 
8098
- // func.expression.parse = function (strP) {
8099
- // var extract_str = function (strP, posP) {
8100
- // if (!posP) posP = 0;
8101
- // var clean_split_str = function (arrP) {
8102
- // var arr = [];
8103
- // if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
8104
- // for (var i = 1; i <= arrP.length; i++) {
8105
- // arr.push(arrP[i]);
8106
- // }
8107
- // return arr;
8108
- // } else return arrP;
8109
- // };
8110
- // var nonLettersPatt = /\W/; // non letters
8111
- // var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
8112
- // var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
8113
- // var validSymbols = validSymbolsNoArray;
8114
- // var splitTmp = strP.replace(/@/g, '^^@').split('^^');
8115
- // var split = clean_split_str(splitTmp);
8116
- // var obj = [];
8117
- // if (split) {
8118
- // for (let val of split) {
8119
- // // run on @ segments
8120
- // if (val) {
8121
- // var pos = strP.indexOf(val);
8122
- // if (val && val.substr(0, 1) === '@') {
8123
- // var tmpStr = '';
8124
- // var word_start_pos = undefined;
8125
- // var word_end_pos = undefined;
8126
- // // run on @ segment string
8127
- // for (var i = 0; i <= val.length; i++) {
8128
- // var key1 = i;
8129
- // var val1 = val.substr(i, 1);
8130
- // if (
8131
- // val1 === '.' &&
8132
- // !word_start_pos // find first dot
8133
- // )
8134
- // word_start_pos = key1;
8135
- // if (
8136
- // word_start_pos &&
8137
- // key1 > word_start_pos &&
8138
- // nonLettersPatt.test(val1) // find any sign character to mark the end of word
8139
- // )
8140
- // word_end_pos = key1;
8141
- // if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
8142
- // // find the word
8143
- // var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
8144
- // // if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
8145
- // // compare with internal properties
8146
- // tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
8147
- // // }
8148
- // if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
8149
- // else word_start_pos = null;
8150
- // word_end_pos = null;
8151
- // }
8152
- // if (val1 === '[') validSymbols = validSymbolsWithArray;
8153
- // if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
8154
- // tmpStr += '^^' + val1;
8155
- // } else tmpStr += val1;
8156
- // }
8157
- // // });
8158
- // if (tmpStr.indexOf('^^') > -1) {
8159
- // var obj1 = extract_str(tmpStr, pos);
8160
- // obj = obj.concat(obj1);
8161
- // } else {
8162
- // // push clean @var
8163
- // var fieldId = undefined;
8164
- // if (val) {
8165
- // fieldId = val.substr(1, val.length);
8166
- // if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
8167
- // if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
8168
- // //
8169
- // // if (val.indexOf("]") > -1)
8170
- // // fieldId = val.substr(1, val.indexOf("]") - 1);
8171
- // }
8172
- // obj.push({
8173
- // value: val,
8174
- // fieldId: fieldId,
8175
- // pos: pos + posP,
8176
- // });
8177
- // }
8178
- // } else {
8179
- // obj.push({
8180
- // value: val,
8181
- // pos: pos + posP,
8182
- // });
8183
- // }
8184
- // }
8185
- // }
8186
- // return obj;
8187
- // }
8188
- // };
8189
- // var res = extract_str(strP);
8190
- // return res;
8191
- // };
8098
+ func.expression.parse_org = function (strP) {
8099
+ var extract_str = function (strP, posP) {
8100
+ if (!posP) posP = 0;
8101
+ var clean_split_str = function (arrP) {
8102
+ var arr = [];
8103
+ if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
8104
+ for (var i = 1; i <= arrP.length; i++) {
8105
+ arr.push(arrP[i]);
8106
+ }
8107
+ return arr;
8108
+ } else return arrP;
8109
+ };
8110
+ var nonLettersPatt = /\W/; // non letters
8111
+ var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
8112
+ var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
8113
+ var validSymbols = validSymbolsNoArray;
8114
+ var splitTmp = strP.replace(/@/g, '^^@').split('^^');
8115
+ var split = clean_split_str(splitTmp);
8116
+ var obj = [];
8117
+ if (split) {
8118
+ for (let val of split) {
8119
+ // run on @ segments
8120
+ if (val) {
8121
+ var pos = strP.indexOf(val);
8122
+ if (val && val.substr(0, 1) === '@') {
8123
+ var tmpStr = '';
8124
+ var word_start_pos = undefined;
8125
+ var word_end_pos = undefined;
8126
+ // run on @ segment string
8127
+ for (var i = 0; i <= val.length; i++) {
8128
+ var key1 = i;
8129
+ var val1 = val.substr(i, 1);
8130
+ if (
8131
+ val1 === '.' &&
8132
+ !word_start_pos // find first dot
8133
+ )
8134
+ word_start_pos = key1;
8135
+ if (
8136
+ word_start_pos &&
8137
+ key1 > word_start_pos &&
8138
+ nonLettersPatt.test(val1) // find any sign character to mark the end of word
8139
+ )
8140
+ word_end_pos = key1;
8141
+ if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
8142
+ // find the word
8143
+ var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
8144
+ // if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
8145
+ // compare with internal properties
8146
+ tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
8147
+ // }
8148
+ if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
8149
+ else word_start_pos = null;
8150
+ word_end_pos = null;
8151
+ }
8152
+ if (val1 === '[') validSymbols = validSymbolsWithArray;
8153
+ if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
8154
+ tmpStr += '^^' + val1;
8155
+ } else tmpStr += val1;
8156
+ }
8157
+ // });
8158
+ if (tmpStr.indexOf('^^') > -1) {
8159
+ var obj1 = extract_str(tmpStr, pos);
8160
+ obj = obj.concat(obj1);
8161
+ } else {
8162
+ // push clean @var
8163
+ var fieldId = undefined;
8164
+ if (val) {
8165
+ fieldId = val.substr(1, val.length);
8166
+ if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
8167
+ if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
8168
+ //
8169
+ // if (val.indexOf("]") > -1)
8170
+ // fieldId = val.substr(1, val.indexOf("]") - 1);
8171
+ }
8172
+ obj.push({
8173
+ value: val,
8174
+ fieldId: fieldId,
8175
+ pos: pos + posP,
8176
+ });
8177
+ }
8178
+ } else {
8179
+ obj.push({
8180
+ value: val,
8181
+ pos: pos + posP,
8182
+ });
8183
+ }
8184
+ }
8185
+ }
8186
+ return obj;
8187
+ }
8188
+ };
8189
+ var res = extract_str(strP);
8190
+ return res;
8191
+ };
8192
8192
 
8193
- func.expression.parse = function (strP) {
8193
+ func.expression.parse_bad = function (strP) {
8194
8194
  const nonLettersPatt = /\W/;
8195
8195
  const validSymbolsNoArray = /[^.@\[]/;
8196
8196
  const validSymbolsWithArray = /[^.@"'\[\]]/;
@@ -8248,6 +8248,61 @@ func.expression.parse = function (strP) {
8248
8248
  return extractStr(strP);
8249
8249
  };
8250
8250
 
8251
+ func.expression.parse = function (input) {
8252
+ if (typeof input !== 'string') return [];
8253
+
8254
+ const segments = [];
8255
+ let pos = 0;
8256
+
8257
+ const parts = input.split(/(@)/).filter(Boolean);
8258
+
8259
+ for (let i = 0; i < parts.length; i++) {
8260
+ const part = parts[i];
8261
+
8262
+ if (part === '@' && i + 1 < parts.length) {
8263
+ const nextPart = parts[i + 1];
8264
+ const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
8265
+ let fieldId, remainder;
8266
+
8267
+ if (varEnd > 0) {
8268
+ fieldId = nextPart.slice(0, varEnd);
8269
+ remainder = nextPart.slice(varEnd);
8270
+ } else {
8271
+ fieldId = nextPart;
8272
+ remainder = '';
8273
+ }
8274
+
8275
+ // Add @variable segment
8276
+ const fullVarValue = `@${fieldId}`;
8277
+ segments.push({
8278
+ value: fullVarValue,
8279
+ fieldId,
8280
+ pos,
8281
+ });
8282
+ pos += fullVarValue.length;
8283
+
8284
+ // Add remainder as a separate segment, if any
8285
+ if (remainder) {
8286
+ segments.push({
8287
+ value: remainder,
8288
+ pos,
8289
+ });
8290
+ pos += remainder.length;
8291
+ }
8292
+
8293
+ i++; // Skip the next part since we consumed it
8294
+ } else if (part !== '@') {
8295
+ segments.push({
8296
+ value: part,
8297
+ pos,
8298
+ });
8299
+ pos += part.length;
8300
+ }
8301
+ }
8302
+
8303
+ return segments;
8304
+ };
8305
+
8251
8306
  func.expression.get_property = async function (valP) {
8252
8307
  async function secure_eval(val) {
8253
8308
  if (typeof IS_PROCESS_SERVER === 'undefined') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.1504",
3
+ "version": "1.3.1505",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {