@servlyadmin/runtime-core 0.1.33 → 0.1.35

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/dist/index.cjs CHANGED
@@ -2235,6 +2235,40 @@ var builtInPlugins = {
2235
2235
  }
2236
2236
  return { success: true };
2237
2237
  },
2238
+ /**
2239
+ * Execute arbitrary JavaScript code
2240
+ * Mirrors: executeCode from builder's FunctionPropExecutor
2241
+ * WARNING: This executes arbitrary code - use with caution in production
2242
+ */
2243
+ "executeCode": (action, ctx) => {
2244
+ const code = action.code || action.config?.code;
2245
+ if (!code) return { success: false, error: "No code provided" };
2246
+ try {
2247
+ const fn = new Function(
2248
+ "event",
2249
+ "props",
2250
+ "state",
2251
+ "context",
2252
+ "stateManager",
2253
+ "currentItem",
2254
+ "currentIndex",
2255
+ code
2256
+ );
2257
+ const result = fn(
2258
+ ctx.event,
2259
+ ctx.context.props || {},
2260
+ ctx.context.state || {},
2261
+ ctx.context.context || {},
2262
+ ctx.stateManager,
2263
+ ctx.currentItem,
2264
+ ctx.currentIndex
2265
+ );
2266
+ return { success: true, result };
2267
+ } catch (error) {
2268
+ console.error("[EventSystem] executeCode error:", error);
2269
+ return { success: false, error };
2270
+ }
2271
+ },
2238
2272
  /**
2239
2273
  * Copy to clipboard
2240
2274
  */
@@ -2429,7 +2463,8 @@ var EventSystem = class {
2429
2463
  const results = [];
2430
2464
  for (const action of plugins) {
2431
2465
  try {
2432
- const executor = this.pluginExecutors[action.key];
2466
+ const pluginKey = action.key || action.type;
2467
+ const executor = this.pluginExecutors[pluginKey];
2433
2468
  if (executor) {
2434
2469
  const result = await executor(action, eventContext);
2435
2470
  results.push(result);
@@ -2437,11 +2472,12 @@ var EventSystem = class {
2437
2472
  this.config.onPluginExecute(action, result);
2438
2473
  }
2439
2474
  } else {
2440
- console.warn(`[EventSystem] Unknown plugin: ${action.key}`);
2441
- results.push({ error: `Unknown plugin: ${action.key}` });
2475
+ console.warn(`[EventSystem] Unknown plugin: ${pluginKey}`);
2476
+ results.push({ error: `Unknown plugin: ${pluginKey}` });
2442
2477
  }
2443
2478
  } catch (error) {
2444
- console.error(`[EventSystem] Plugin error (${action.key}):`, error);
2479
+ const pluginKey = action.key || action.type;
2480
+ console.error(`[EventSystem] Plugin error (${pluginKey}):`, error);
2445
2481
  results.push({ error });
2446
2482
  }
2447
2483
  }
package/dist/index.js CHANGED
@@ -1745,6 +1745,40 @@ var builtInPlugins = {
1745
1745
  }
1746
1746
  return { success: true };
1747
1747
  },
1748
+ /**
1749
+ * Execute arbitrary JavaScript code
1750
+ * Mirrors: executeCode from builder's FunctionPropExecutor
1751
+ * WARNING: This executes arbitrary code - use with caution in production
1752
+ */
1753
+ "executeCode": (action, ctx) => {
1754
+ const code = action.code || action.config?.code;
1755
+ if (!code) return { success: false, error: "No code provided" };
1756
+ try {
1757
+ const fn = new Function(
1758
+ "event",
1759
+ "props",
1760
+ "state",
1761
+ "context",
1762
+ "stateManager",
1763
+ "currentItem",
1764
+ "currentIndex",
1765
+ code
1766
+ );
1767
+ const result = fn(
1768
+ ctx.event,
1769
+ ctx.context.props || {},
1770
+ ctx.context.state || {},
1771
+ ctx.context.context || {},
1772
+ ctx.stateManager,
1773
+ ctx.currentItem,
1774
+ ctx.currentIndex
1775
+ );
1776
+ return { success: true, result };
1777
+ } catch (error) {
1778
+ console.error("[EventSystem] executeCode error:", error);
1779
+ return { success: false, error };
1780
+ }
1781
+ },
1748
1782
  /**
1749
1783
  * Copy to clipboard
1750
1784
  */
@@ -1939,7 +1973,8 @@ var EventSystem = class {
1939
1973
  const results = [];
1940
1974
  for (const action of plugins) {
1941
1975
  try {
1942
- const executor = this.pluginExecutors[action.key];
1976
+ const pluginKey = action.key || action.type;
1977
+ const executor = this.pluginExecutors[pluginKey];
1943
1978
  if (executor) {
1944
1979
  const result = await executor(action, eventContext);
1945
1980
  results.push(result);
@@ -1947,11 +1982,12 @@ var EventSystem = class {
1947
1982
  this.config.onPluginExecute(action, result);
1948
1983
  }
1949
1984
  } else {
1950
- console.warn(`[EventSystem] Unknown plugin: ${action.key}`);
1951
- results.push({ error: `Unknown plugin: ${action.key}` });
1985
+ console.warn(`[EventSystem] Unknown plugin: ${pluginKey}`);
1986
+ results.push({ error: `Unknown plugin: ${pluginKey}` });
1952
1987
  }
1953
1988
  } catch (error) {
1954
- console.error(`[EventSystem] Plugin error (${action.key}):`, error);
1989
+ const pluginKey = action.key || action.type;
1990
+ console.error(`[EventSystem] Plugin error (${pluginKey}):`, error);
1955
1991
  results.push({ error });
1956
1992
  }
1957
1993
  }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@servlyadmin/runtime-core",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "description": "Framework-agnostic core renderer for Servly components",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
- "import": "./dist/index.mjs",
13
- "require": "./dist/index.js",
14
- "default": "./dist/index.mjs"
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs",
14
+ "default": "./dist/index.js"
15
15
  }
16
16
  },
17
17
  "files": [