@xuda.io/xuda-worker-bundle-min 1.3.2449 → 1.3.2451
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/index.js +136 -43
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5126,56 +5126,149 @@ func.datasource.get_viewFields_for_update_function = function (SESSION_ID, calli
|
|
|
5126
5126
|
if (!exp) {
|
|
5127
5127
|
return viewFields;
|
|
5128
5128
|
}
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5129
|
+
const trim_wrapping_braces = function (value) {
|
|
5130
|
+
const trimmed = value.trim();
|
|
5131
|
+
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
|
5132
|
+
return trimmed.substring(1, trimmed.length - 1);
|
|
5133
|
+
}
|
|
5134
|
+
return trimmed;
|
|
5135
|
+
};
|
|
5136
|
+
const strip_wrapping_quotes = function (value) {
|
|
5137
|
+
const trimmed = value.trim();
|
|
5138
|
+
const first = trimmed.substring(0, 1);
|
|
5139
|
+
const last = trimmed.substring(trimmed.length - 1);
|
|
5140
|
+
if ((first === "'" || first === '"' || first === '`') && last === first) {
|
|
5141
|
+
return trimmed.substring(1, trimmed.length - 1);
|
|
5142
|
+
}
|
|
5143
|
+
return trimmed;
|
|
5144
|
+
};
|
|
5145
|
+
const split_top_level = function (value) {
|
|
5146
|
+
const parts = [];
|
|
5147
|
+
let current = '';
|
|
5148
|
+
let quote = null;
|
|
5149
|
+
let escape = false;
|
|
5150
|
+
let paren_depth = 0;
|
|
5151
|
+
let bracket_depth = 0;
|
|
5152
|
+
let brace_depth = 0;
|
|
5153
|
+
|
|
5154
|
+
for (let index = 0; index < value.length; index++) {
|
|
5155
|
+
const char = value[index];
|
|
5156
|
+
|
|
5157
|
+
if (escape) {
|
|
5158
|
+
current += char;
|
|
5159
|
+
escape = false;
|
|
5160
|
+
continue;
|
|
5161
|
+
}
|
|
5162
|
+
|
|
5163
|
+
if (quote) {
|
|
5164
|
+
current += char;
|
|
5165
|
+
if (char === '\\') {
|
|
5166
|
+
escape = true;
|
|
5167
|
+
} else if (char === quote) {
|
|
5168
|
+
quote = null;
|
|
5169
|
+
}
|
|
5170
|
+
continue;
|
|
5171
|
+
}
|
|
5172
|
+
|
|
5173
|
+
if (char === "'" || char === '"' || char === '`') {
|
|
5174
|
+
quote = char;
|
|
5175
|
+
current += char;
|
|
5176
|
+
continue;
|
|
5177
|
+
}
|
|
5178
|
+
|
|
5179
|
+
if (char === '(') paren_depth++;
|
|
5180
|
+
if (char === ')') paren_depth = Math.max(0, paren_depth - 1);
|
|
5181
|
+
if (char === '[') bracket_depth++;
|
|
5182
|
+
if (char === ']') bracket_depth = Math.max(0, bracket_depth - 1);
|
|
5183
|
+
if (char === '{') brace_depth++;
|
|
5184
|
+
if (char === '}') brace_depth = Math.max(0, brace_depth - 1);
|
|
5185
|
+
|
|
5186
|
+
if ((char === ',' || char === ';') && !paren_depth && !bracket_depth && !brace_depth) {
|
|
5187
|
+
if (current.trim()) {
|
|
5188
|
+
parts.push(current.trim());
|
|
5189
|
+
}
|
|
5190
|
+
current = '';
|
|
5191
|
+
continue;
|
|
5192
|
+
}
|
|
5193
|
+
|
|
5194
|
+
current += char;
|
|
5139
5195
|
}
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
return;
|
|
5196
|
+
|
|
5197
|
+
if (current.trim()) {
|
|
5198
|
+
parts.push(current.trim());
|
|
5144
5199
|
}
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
source: _ds.viewSourceDesc,
|
|
5169
|
-
json: '',
|
|
5170
|
-
fields: '',
|
|
5171
|
-
dsSession: dsSessionP,
|
|
5172
|
-
});
|
|
5200
|
+
|
|
5201
|
+
return parts;
|
|
5202
|
+
};
|
|
5203
|
+
const find_top_level_colon = function (value) {
|
|
5204
|
+
let quote = null;
|
|
5205
|
+
let escape = false;
|
|
5206
|
+
let paren_depth = 0;
|
|
5207
|
+
let bracket_depth = 0;
|
|
5208
|
+
let brace_depth = 0;
|
|
5209
|
+
|
|
5210
|
+
for (let index = 0; index < value.length; index++) {
|
|
5211
|
+
const char = value[index];
|
|
5212
|
+
|
|
5213
|
+
if (escape) {
|
|
5214
|
+
escape = false;
|
|
5215
|
+
continue;
|
|
5216
|
+
}
|
|
5217
|
+
|
|
5218
|
+
if (quote) {
|
|
5219
|
+
if (char === '\\') {
|
|
5220
|
+
escape = true;
|
|
5221
|
+
} else if (char === quote) {
|
|
5222
|
+
quote = null;
|
|
5173
5223
|
}
|
|
5224
|
+
continue;
|
|
5225
|
+
}
|
|
5226
|
+
|
|
5227
|
+
if (char === "'" || char === '"' || char === '`') {
|
|
5228
|
+
quote = char;
|
|
5229
|
+
continue;
|
|
5230
|
+
}
|
|
5231
|
+
|
|
5232
|
+
if (char === '(') paren_depth++;
|
|
5233
|
+
if (char === ')') paren_depth = Math.max(0, paren_depth - 1);
|
|
5234
|
+
if (char === '[') bracket_depth++;
|
|
5235
|
+
if (char === ']') bracket_depth = Math.max(0, bracket_depth - 1);
|
|
5236
|
+
if (char === '{') brace_depth++;
|
|
5237
|
+
if (char === '}') brace_depth = Math.max(0, brace_depth - 1);
|
|
5238
|
+
|
|
5239
|
+
if (char === ':' && !paren_depth && !bracket_depth && !brace_depth) {
|
|
5240
|
+
return index;
|
|
5174
5241
|
}
|
|
5175
5242
|
}
|
|
5176
5243
|
|
|
5177
|
-
return
|
|
5244
|
+
return -1;
|
|
5245
|
+
};
|
|
5246
|
+
|
|
5247
|
+
exp = trim_wrapping_braces(exp.replace(/\n/gi, ''));
|
|
5248
|
+
const exp_arr = split_top_level(exp);
|
|
5249
|
+
for (let index = 0; index < exp_arr.length; index++) {
|
|
5250
|
+
const segment = exp_arr[index];
|
|
5251
|
+
const pos = find_top_level_colon(segment);
|
|
5252
|
+
if (pos === -1) {
|
|
5253
|
+
continue;
|
|
5254
|
+
}
|
|
5255
|
+
|
|
5256
|
+
let id = strip_wrapping_quotes(segment.substring(0, pos));
|
|
5257
|
+
const val = segment.substring(pos + 1).trim();
|
|
5258
|
+
if (id.substring(0, 1) === '@') {
|
|
5259
|
+
id = id.substring(1);
|
|
5260
|
+
}
|
|
5261
|
+
if (!id || !val) {
|
|
5262
|
+
continue;
|
|
5263
|
+
}
|
|
5264
|
+
|
|
5265
|
+
viewFields.push({
|
|
5266
|
+
id,
|
|
5267
|
+
val,
|
|
5268
|
+
});
|
|
5178
5269
|
}
|
|
5270
|
+
|
|
5271
|
+
return viewFields;
|
|
5179
5272
|
};
|
|
5180
5273
|
func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, rowIdP, org_dsSessionP) {
|
|
5181
5274
|
const return_value = async (field_id, value) => {
|