drapcode-utility 1.2.4 → 1.2.5

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.
@@ -488,7 +488,20 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
488
488
  if (fieldType &&
489
489
  !requiredExternal &&
490
490
  ["dynamic_option", "reference", "static_option", "belongsTo"].includes(fieldType)) {
491
- return value === drapcode_constant_1.CURRENT_USER ? currentUser["uuid"] : value;
491
+ var refCollection = query.refCollection, refField = query.refField;
492
+ var finalValue = "";
493
+ if (refCollection === drapcode_constant_1.CURRENT_USER) {
494
+ finalValue = currentUser[refField];
495
+ }
496
+ if (refCollection === drapcode_constant_1.CURRENT_TENANT) {
497
+ finalValue = currentTenant[refField];
498
+ }
499
+ if (value === drapcode_constant_1.CURRENT_USER) {
500
+ finalValue = currentUser["uuid"];
501
+ }
502
+ else
503
+ finalValue = value;
504
+ return finalValue;
492
505
  }
493
506
  if (fieldType &&
494
507
  fieldType === "boolean" &&
@@ -544,8 +557,6 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
544
557
  else
545
558
  return startValue_1 + "---" + endValue_1;
546
559
  }
547
- console.log("==> value", value);
548
- console.log("==> currentUser", currentUser);
549
560
  if (value.includes(drapcode_constant_1.CURRENT_USER)) {
550
561
  if (value === drapcode_constant_1.CURRENT_USER) {
551
562
  return currentUser["uuid"];
@@ -612,8 +623,6 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
612
623
  refCollection = splitValues[0];
613
624
  refCollectionField = "";
614
625
  }
615
- console.log("\n refCollection", refCollection);
616
- console.log("\n refCollectionField", refCollectionField);
617
626
  if (refCollection && refCollectionField) {
618
627
  console.log("I have refCollection and Field");
619
628
  if (refCollection === "CURRENT_TENANT") {
@@ -621,7 +630,6 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
621
630
  }
622
631
  else {
623
632
  var refCollectionData = currentTenant[refCollection];
624
- console.log("\n refCollectionData", refCollectionData);
625
633
  if (!refCollectionData)
626
634
  return "";
627
635
  if (refCollectionData.length > 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drapcode-utility",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",