@xuda.io/runtime-bundle 1.0.480 → 1.0.481

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.
@@ -1696,7 +1696,7 @@ func.datasource.create = async function (
1696
1696
  }
1697
1697
  }
1698
1698
 
1699
- var datasource_changes = {
1699
+ const datasource_changes = {
1700
1700
  [dsSessionP]: {
1701
1701
  ['datasource_main']: {
1702
1702
  stat: 'idle',
@@ -8095,99 +8095,157 @@ 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
+ // };
8192
+
8098
8193
  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
- });
8194
+ const nonLettersPatt = /\W/;
8195
+ const validSymbolsNoArray = /[^.@\[]/;
8196
+ const validSymbolsWithArray = /[^.@"'\[\]]/;
8197
+
8198
+ function extractStr(str, startPos = 0) {
8199
+ const cleanSplit = (arr) => (arr?.length > 1 && arr[0] === '' && arr[1].includes('@') ? arr.slice(1) : arr);
8200
+
8201
+ const segments = cleanSplit(str.replace(/@/g, '^^@').split('^^'));
8202
+ const result = [];
8203
+
8204
+ for (const val of segments || []) {
8205
+ if (!val) continue;
8206
+ const pos = str.indexOf(val) + startPos;
8207
+
8208
+ if (val.startsWith('@')) {
8209
+ let tmpStr = '';
8210
+ let wordStart = null;
8211
+ let wordEnd = null;
8212
+ let validSymbols = validSymbolsNoArray;
8213
+
8214
+ for (let i = 0; i < val.length; i++) {
8215
+ const char = val[i];
8216
+
8217
+ if (char === '[') validSymbols = validSymbolsWithArray;
8218
+ if (char === '.' && wordStart === null) wordStart = i;
8219
+ else if (wordStart !== null && nonLettersPatt.test(char)) wordEnd = i;
8220
+
8221
+ if (wordStart !== null && wordEnd !== null) {
8222
+ const word = val.slice(wordStart + 1, wordEnd);
8223
+ tmpStr = tmpStr.slice(0, wordStart) + '^^' + tmpStr.slice(wordStart, wordEnd);
8224
+ wordStart = char === '.' ? wordEnd : null;
8225
+ wordEnd = null;
8183
8226
  }
8227
+
8228
+ tmpStr += nonLettersPatt.test(char) && validSymbols.test(char) && !tmpStr.includes('^^') ? '^^' + char : char;
8229
+ }
8230
+
8231
+ if (tmpStr.includes('^^')) {
8232
+ result.push(...extractStr(tmpStr, pos));
8233
+ } else {
8234
+ const fieldIdMatch = val.match(/^@([^.\[]+)/);
8235
+ result.push({
8236
+ value: val,
8237
+ fieldId: fieldIdMatch ? fieldIdMatch[1] : undefined,
8238
+ pos,
8239
+ });
8184
8240
  }
8241
+ } else {
8242
+ result.push({ value: val, pos });
8185
8243
  }
8186
- return obj;
8187
8244
  }
8188
- };
8189
- var res = extract_str(strP);
8190
- return res;
8245
+ return result;
8246
+ }
8247
+
8248
+ return extractStr(strP);
8191
8249
  };
8192
8250
 
8193
8251
  func.expression.get_property = async function (valP) {
@@ -1696,7 +1696,7 @@ func.datasource.create = async function (
1696
1696
  }
1697
1697
  }
1698
1698
 
1699
- var datasource_changes = {
1699
+ const datasource_changes = {
1700
1700
  [dsSessionP]: {
1701
1701
  ['datasource_main']: {
1702
1702
  stat: 'idle',
@@ -8095,99 +8095,157 @@ 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
+ // };
8192
+
8098
8193
  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
- });
8194
+ const nonLettersPatt = /\W/;
8195
+ const validSymbolsNoArray = /[^.@\[]/;
8196
+ const validSymbolsWithArray = /[^.@"'\[\]]/;
8197
+
8198
+ function extractStr(str, startPos = 0) {
8199
+ const cleanSplit = (arr) => (arr?.length > 1 && arr[0] === '' && arr[1].includes('@') ? arr.slice(1) : arr);
8200
+
8201
+ const segments = cleanSplit(str.replace(/@/g, '^^@').split('^^'));
8202
+ const result = [];
8203
+
8204
+ for (const val of segments || []) {
8205
+ if (!val) continue;
8206
+ const pos = str.indexOf(val) + startPos;
8207
+
8208
+ if (val.startsWith('@')) {
8209
+ let tmpStr = '';
8210
+ let wordStart = null;
8211
+ let wordEnd = null;
8212
+ let validSymbols = validSymbolsNoArray;
8213
+
8214
+ for (let i = 0; i < val.length; i++) {
8215
+ const char = val[i];
8216
+
8217
+ if (char === '[') validSymbols = validSymbolsWithArray;
8218
+ if (char === '.' && wordStart === null) wordStart = i;
8219
+ else if (wordStart !== null && nonLettersPatt.test(char)) wordEnd = i;
8220
+
8221
+ if (wordStart !== null && wordEnd !== null) {
8222
+ const word = val.slice(wordStart + 1, wordEnd);
8223
+ tmpStr = tmpStr.slice(0, wordStart) + '^^' + tmpStr.slice(wordStart, wordEnd);
8224
+ wordStart = char === '.' ? wordEnd : null;
8225
+ wordEnd = null;
8183
8226
  }
8227
+
8228
+ tmpStr += nonLettersPatt.test(char) && validSymbols.test(char) && !tmpStr.includes('^^') ? '^^' + char : char;
8229
+ }
8230
+
8231
+ if (tmpStr.includes('^^')) {
8232
+ result.push(...extractStr(tmpStr, pos));
8233
+ } else {
8234
+ const fieldIdMatch = val.match(/^@([^.\[]+)/);
8235
+ result.push({
8236
+ value: val,
8237
+ fieldId: fieldIdMatch ? fieldIdMatch[1] : undefined,
8238
+ pos,
8239
+ });
8184
8240
  }
8241
+ } else {
8242
+ result.push({ value: val, pos });
8185
8243
  }
8186
- return obj;
8187
8244
  }
8188
- };
8189
- var res = extract_str(strP);
8190
- return res;
8245
+ return result;
8246
+ }
8247
+
8248
+ return extractStr(strP);
8191
8249
  };
8192
8250
 
8193
8251
  func.expression.get_property = async function (valP) {