@fctc/interface-logic 2.8.2 → 2.8.3

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/utils.js CHANGED
@@ -2560,30 +2560,34 @@ var matchDomains = (context, domains) => {
2560
2560
  var import_react = require("react");
2561
2561
  var evalJSONContext = (_context, context = {}) => {
2562
2562
  try {
2563
- return evalPartialContext(_context, context);
2563
+ return evalPartialContext(
2564
+ _context,
2565
+ JSON.parse(JSON.stringify(context))
2566
+ );
2564
2567
  } catch (err) {
2565
2568
  return null;
2566
2569
  }
2567
2570
  };
2568
2571
  var evalJSONDomain = (domain, context) => {
2572
+ const cloneContext = JSON.parse(JSON.stringify(context));
2569
2573
  try {
2570
- if (context) {
2571
- Object.keys(context)?.forEach((key) => {
2572
- if (Array.isArray(context[key])) {
2573
- const isTypeObject = context[key]?.every(
2574
+ if (cloneContext) {
2575
+ Object.keys(cloneContext)?.forEach((key) => {
2576
+ if (Array.isArray(cloneContext[key])) {
2577
+ const isTypeObject = cloneContext[key]?.every(
2574
2578
  (item) => typeof item === "object" && item !== null && item?.id !== void 0
2575
2579
  );
2576
2580
  if (isTypeObject) {
2577
- context[key] = context[key]?.map((item) => item?.id);
2581
+ cloneContext[key] = cloneContext[key]?.map((item) => item?.id);
2578
2582
  }
2579
2583
  }
2580
2584
  });
2581
2585
  }
2582
- const value = evaluateExpr(domain, context);
2586
+ const value = evaluateExpr(domain, cloneContext);
2583
2587
  return value;
2584
2588
  } catch (err) {
2585
2589
  try {
2586
- const domainObject = new Domain(domain).toList(context);
2590
+ const domainObject = new Domain(domain).toList(cloneContext);
2587
2591
  return domainObject;
2588
2592
  } catch (err2) {
2589
2593
  return [];
package/dist/utils.mjs CHANGED
@@ -2495,30 +2495,34 @@ var matchDomains = (context, domains) => {
2495
2495
  import { useEffect, useState } from "react";
2496
2496
  var evalJSONContext = (_context, context = {}) => {
2497
2497
  try {
2498
- return evalPartialContext(_context, context);
2498
+ return evalPartialContext(
2499
+ _context,
2500
+ JSON.parse(JSON.stringify(context))
2501
+ );
2499
2502
  } catch (err) {
2500
2503
  return null;
2501
2504
  }
2502
2505
  };
2503
2506
  var evalJSONDomain = (domain, context) => {
2507
+ const cloneContext = JSON.parse(JSON.stringify(context));
2504
2508
  try {
2505
- if (context) {
2506
- Object.keys(context)?.forEach((key) => {
2507
- if (Array.isArray(context[key])) {
2508
- const isTypeObject = context[key]?.every(
2509
+ if (cloneContext) {
2510
+ Object.keys(cloneContext)?.forEach((key) => {
2511
+ if (Array.isArray(cloneContext[key])) {
2512
+ const isTypeObject = cloneContext[key]?.every(
2509
2513
  (item) => typeof item === "object" && item !== null && item?.id !== void 0
2510
2514
  );
2511
2515
  if (isTypeObject) {
2512
- context[key] = context[key]?.map((item) => item?.id);
2516
+ cloneContext[key] = cloneContext[key]?.map((item) => item?.id);
2513
2517
  }
2514
2518
  }
2515
2519
  });
2516
2520
  }
2517
- const value = evaluateExpr(domain, context);
2521
+ const value = evaluateExpr(domain, cloneContext);
2518
2522
  return value;
2519
2523
  } catch (err) {
2520
2524
  try {
2521
- const domainObject = new Domain(domain).toList(context);
2525
+ const domainObject = new Domain(domain).toList(cloneContext);
2522
2526
  return domainObject;
2523
2527
  } catch (err2) {
2524
2528
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",