@xuda.io/xuda-worker-bundle 1.3.2699 → 1.3.2701

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 +182 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -66,6 +66,175 @@ var xu_set = function (obj, path, value) {
66
66
  return obj;
67
67
  };
68
68
 
69
+ var xu_clone = function (value) {
70
+ if (Array.isArray(value)) return value.slice();
71
+ if (value && typeof value === 'object') return { ...value };
72
+ return value;
73
+ };
74
+
75
+ var xu_cloneDeep = function (value) {
76
+ if (typeof structuredClone === 'function') {
77
+ try {
78
+ return structuredClone(value);
79
+ } catch (error) {}
80
+ }
81
+
82
+ if (Array.isArray(value)) {
83
+ return value.map(function (item) {
84
+ return xu_cloneDeep(item);
85
+ });
86
+ }
87
+
88
+ if (value && typeof value === 'object') {
89
+ var ret = {};
90
+ Object.keys(value).forEach(function (key) {
91
+ ret[key] = xu_cloneDeep(value[key]);
92
+ });
93
+ return ret;
94
+ }
95
+
96
+ return value;
97
+ };
98
+
99
+ var xu_map = function (collection, iteratee) {
100
+ if (!collection) return [];
101
+
102
+ if (Array.isArray(collection)) {
103
+ return collection.map(function (value, index) {
104
+ return iteratee ? iteratee(value, index) : value;
105
+ });
106
+ }
107
+
108
+ return Object.keys(collection).map(function (key) {
109
+ return iteratee ? iteratee(collection[key], key) : collection[key];
110
+ });
111
+ };
112
+
113
+ var xu_forEach = function (collection, iteratee) {
114
+ if (!collection || typeof iteratee !== 'function') return collection;
115
+
116
+ if (Array.isArray(collection)) {
117
+ collection.forEach(function (value, index) {
118
+ iteratee(value, index);
119
+ });
120
+ return collection;
121
+ }
122
+
123
+ Object.keys(collection).forEach(function (key) {
124
+ iteratee(collection[key], key);
125
+ });
126
+ return collection;
127
+ };
128
+
129
+ var xu_find = function (collection, predicate) {
130
+ if (!collection || typeof predicate !== 'function') return undefined;
131
+
132
+ var values = Array.isArray(collection)
133
+ ? collection
134
+ : Object.keys(collection).map(function (key) {
135
+ return collection[key];
136
+ });
137
+
138
+ for (var i = 0; i < values.length; i++) {
139
+ if (predicate(values[i], i)) return values[i];
140
+ }
141
+ };
142
+
143
+ var xu_findIndex = function (collection, predicate) {
144
+ if (!Array.isArray(collection) || typeof predicate !== 'function') return -1;
145
+
146
+ for (var i = 0; i < collection.length; i++) {
147
+ if (predicate(collection[i], i)) return i;
148
+ }
149
+ return -1;
150
+ };
151
+
152
+ var xu_reduce = function (collection, iteratee, accumulator) {
153
+ if (!collection || typeof iteratee !== 'function') return accumulator;
154
+
155
+ var keys = Array.isArray(collection) ? collection.map(function (_value, index) { return index; }) : Object.keys(collection);
156
+ var has_accumulator = arguments.length > 2;
157
+ var result = accumulator;
158
+
159
+ for (var i = 0; i < keys.length; i++) {
160
+ var key = keys[i];
161
+ var value = Array.isArray(collection) ? collection[key] : collection[key];
162
+
163
+ if (!has_accumulator) {
164
+ result = value;
165
+ has_accumulator = true;
166
+ continue;
167
+ }
168
+
169
+ result = iteratee(result, value, key);
170
+ }
171
+
172
+ return result;
173
+ };
174
+
175
+ var xu_debounce = function (callback, wait) {
176
+ var timeout_id = null;
177
+ return function () {
178
+ var args = arguments;
179
+ var context = this;
180
+ clearTimeout(timeout_id);
181
+ timeout_id = setTimeout(function () {
182
+ callback.apply(context, args);
183
+ }, wait || 0);
184
+ };
185
+ };
186
+
187
+ var xu_toStringSafe = function (value) {
188
+ if (typeof value === 'string') return value;
189
+ if (value == null) return '';
190
+ return String(value);
191
+ };
192
+
193
+ var xu_some = function (collection, predicate) {
194
+ if (!collection || typeof predicate !== 'function') return false;
195
+
196
+ var values = Array.isArray(collection)
197
+ ? collection
198
+ : Object.keys(collection).map(function (key) {
199
+ return collection[key];
200
+ });
201
+
202
+ for (var i = 0; i < values.length; i++) {
203
+ if (predicate(values[i], i)) return true;
204
+ }
205
+ return false;
206
+ };
207
+
208
+ var xu_has = function (obj, key) {
209
+ return !!obj && Object.prototype.hasOwnProperty.call(obj, key);
210
+ };
211
+
212
+ var xu_runtime_global = typeof globalThis !== 'undefined' ? globalThis : {};
213
+
214
+ if (typeof xu_runtime_global._ === 'undefined') {
215
+ xu_runtime_global._ = {
216
+ clone: xu_clone,
217
+ cloneDeep: xu_cloneDeep,
218
+ debounce: xu_debounce,
219
+ each: xu_forEach,
220
+ find: xu_find,
221
+ findIndex: xu_findIndex,
222
+ forEach: xu_forEach,
223
+ get: xu_get,
224
+ has: xu_has,
225
+ isArray: Array.isArray,
226
+ isEmpty: xu_isEmpty,
227
+ map: xu_map,
228
+ reduce: xu_reduce,
229
+ some: xu_some,
230
+ toString: xu_toStringSafe,
231
+ };
232
+ }
233
+
234
+ if (typeof _ === 'undefined') {
235
+ var _ = xu_runtime_global._;
236
+ }
237
+
69
238
  var PROJECT_OBJ = {};
70
239
 
71
240
  var APP_OBJ = {};
@@ -9167,8 +9336,18 @@ func.utils.get_plugin_resource = function (SESSION_ID, plugin_name, plugin_resou
9167
9336
  const plugin_resource_res = await import(`${get_path(plugin_resource)}`);
9168
9337
  resolve(plugin_resource_res);
9169
9338
  } catch (err) {
9170
- console.error(err);
9171
- reject();
9339
+ await func.utils.report_issue(SESSION_ID, {
9340
+ code: 'RUN_MSG_GUI_020',
9341
+ source: 'func.utils.get_plugin_resource',
9342
+ message: 'plugin setup import failed',
9343
+ err,
9344
+ details: {
9345
+ plugin_name,
9346
+ plugin_resource,
9347
+ plugin_path: get_path(plugin_resource),
9348
+ },
9349
+ });
9350
+ reject(err);
9172
9351
  }
9173
9352
  });
9174
9353
  };
@@ -11424,7 +11603,7 @@ func.expression.get_property = async function (valP) {
11424
11603
  });
11425
11604
  return await vm.run(val);
11426
11605
  } catch (err) {
11427
- throw '';
11606
+ throw err;
11428
11607
  }
11429
11608
  }
11430
11609
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle",
3
- "version": "1.3.2699",
3
+ "version": "1.3.2701",
4
4
  "description": "xuda framework",
5
5
  "main": "index.js",
6
6
  "scripts": {