@magic-xpa/engine 4.1200.0-dev4120.171 → 4.1200.0-dev4120.173

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.
@@ -3,6 +3,7 @@ import { XMLConstants, StorageAttribute, ViewRefreshMode, InternalInterface, Log
3
3
  import { RecordUtils, GuiFieldBase, ExpVal, BlobType, FieldDef, GuiTaskBase, MgControlBase, PropInterface, GuiDataCollection, CommandType, Commands, HtmlProperties, ControlTable, Modifiers, KeyboardItem, TaskDefinitionIdTableSaxHandler, DisplayConvertor, VectorType, PIC, MgTimer, GuiConstants, RuntimeContextBase, UsernamePasswordCredentials, Styles, Manager, NUM_TYPE, GuiExpressionEvaluator, ExpressionInterface, DataModificationTypes, GuiDataViewBase, ObjectReferencesCollection, EMPTY_DCREF, ObjectReferenceBase, PropTable, FieldsTable as FieldsTable$1, DcValuesBuilderBase, MgFormBase, GuiEnvironment, TaskDefinitionId, Events, Helps, FocusManager, EventsProcessor, UIBridge } from '@magic-xpa/gui';
4
4
  import { HttpHeaders, HttpErrorResponse } from '@angular/common/http';
5
5
  import { timer, Subject } from 'rxjs';
6
+ import * as CryptoJS from 'crypto-js';
6
7
 
7
8
  ///
8
9
  /// This class is used to hold references to global objects, using their interfaces/base classes. This allows other objects to access those global objects
@@ -9736,6 +9737,17 @@ class ExpressionDict {
9736
9737
  new ExpDesc('B', 0, 1, 1, 'A', false), /* 703- Delete_Cookie */
9737
9738
  null,
9738
9739
  new ExpDesc('U', 0, 0, 0, '', false), /* 705- RouteGet */
9740
+ null,
9741
+ null,
9742
+ null,
9743
+ null,
9744
+ null,
9745
+ null,
9746
+ null,
9747
+ null,
9748
+ null,
9749
+ null,
9750
+ new ExpDesc('NO', 0, 2, 2, 'A', false), /* 716- Hash */
9739
9751
  ];
9740
9752
  }
9741
9753
 
@@ -13803,6 +13815,9 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
13803
13815
  static PARENT_LEN = 2; // 2 bytes
13804
13816
  static SHORT_OBJECT_LEN = 2; // 2 bytes
13805
13817
  static LONG_OBJECT_LEN = 4; // 4 bytes
13818
+ static MD5_ALGO_NUM = 1;
13819
+ static SHA1_ALGO_NUM = 2;
13820
+ static SHA2_ALGO_NUM = 3;
13806
13821
  static _recursiveExpCalcCount = 0;
13807
13822
  _charsToTrim = [' ', '\0'];
13808
13823
  _expressionLocalJpn = null;
@@ -15426,6 +15441,12 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
15426
15441
  case ExpressionInterface.EXP_OP_ROUTEGET:
15427
15442
  this.eval_op_route_get(resVal);
15428
15443
  break;
15444
+ case ExpressionInterface.EXP_OP_HASH:
15445
+ val2 = valStack.pop();
15446
+ val1 = valStack.pop();
15447
+ this.eval_op_Hash(val1, val2, resVal);
15448
+ expStrTracker.resetNullResult();
15449
+ break;
15429
15450
  default:
15430
15451
  return;
15431
15452
  }
@@ -18489,6 +18510,35 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
18489
18510
  }
18490
18511
  return attr;
18491
18512
  }
18513
+ eval_op_Hash(val1, val2, resVal) {
18514
+ resVal.Attr = StorageAttribute.ALPHA;
18515
+ resVal.StrVal = '';
18516
+ if (val1.IsNull || val2.IsNull)
18517
+ return;
18518
+ let str = '';
18519
+ const byteArray = BlobType.getBytes(val2.StrVal);
18520
+ const wordArray = this.toWordArray(byteArray);
18521
+ if (val1.MgNumVal.NUM_2_LONG() === ExpressionEvaluator.MD5_ALGO_NUM)
18522
+ str = CryptoJS.MD5(wordArray).toString();
18523
+ else if (val1.MgNumVal.NUM_2_LONG() === ExpressionEvaluator.SHA1_ALGO_NUM)
18524
+ str = CryptoJS.SHA1(wordArray).toString();
18525
+ else if (val1.MgNumVal.NUM_2_LONG() === ExpressionEvaluator.SHA2_ALGO_NUM)
18526
+ str = CryptoJS.SHA256(wordArray).toString();
18527
+ else
18528
+ Logger.Instance.WriteErrorToLog(LanguageData.Instance.getConstMessage(MsgInterface.STR_ERR_INVALID_HASH_ALGO_NUMBER));
18529
+ resVal.StrVal = str;
18530
+ }
18531
+ // Convert Uint8Array to WordArray
18532
+ toWordArray(u8) {
18533
+ const words = [];
18534
+ for (let i = 0; i < u8.length; i += 4) {
18535
+ words.push(((u8[i] || 0) << 24) |
18536
+ ((u8[i + 1] || 0) << 16) |
18537
+ ((u8[i + 2] || 0) << 8) |
18538
+ (u8[i + 3] || 0));
18539
+ }
18540
+ return CryptoJS.lib.WordArray.create(words, u8.length);
18541
+ }
18492
18542
  }
18493
18543
  /// <summary>
18494
18544
  /// This exception used when at least one of the operands is null
@@ -39559,7 +39609,7 @@ class CommandsTable {
39559
39609
  }
39560
39610
  }
39561
39611
 
39562
- let CurrentClientVersion = '4.1200.0-dev4120.171';
39612
+ let CurrentClientVersion = '4.1200.0-dev4120.173';
39563
39613
 
39564
39614
  // @dynamic
39565
39615
  class ClientManager {