@magic-xpa/engine 4.1200.0-dev4120.99 → 4.1200.0
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/fesm2022/magic-xpa-engine.mjs +357 -65
- package/fesm2022/magic-xpa-engine.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +4 -4
- package/src/ClientManager.d.ts +1 -0
- package/src/CommandsProcessorBase.d.ts +2 -1
- package/src/CommandsProcessorManager.d.ts +2 -1
- package/src/ConstInterface.d.ts +6 -0
- package/src/bridge/MagicBridge.d.ts +1 -0
- package/src/commands/ClientToServer/CachedFileQueryCommand.d.ts +9 -0
- package/src/commands/ClientToServer/CommandFactory.d.ts +4 -2
- package/src/commands/ClientToServer/ControlItemsRefreshCommand.d.ts +1 -0
- package/src/commands/ClientToServer/FetchDataControlValuesEventCommand.d.ts +1 -0
- package/src/event/EventHandler.d.ts +5 -0
- package/src/exp/ExpressionEvaluator.d.ts +5 -0
- package/src/http/HttpManager.d.ts +2 -1
- package/src/http/client/HttpClientAsync.d.ts +2 -2
- package/src/http/client/HttpClientBase.d.ts +3 -3
- package/src/http/client/HttpClientSync.d.ts +2 -2
- package/src/remote/RemoteCommandsProcessor.d.ts +7 -2
- package/src/remote/RemoteControlItemsRefreshCommand.d.ts +1 -0
- package/src/rt/Operation.d.ts +3 -1
@@ -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
|
@@ -288,6 +289,9 @@ class ConstInterface {
|
|
288
289
|
static MG_ATTR_CPY_GLB_PRMS = "copy_global_params";
|
289
290
|
static MG_TAG_GLOBALPARAMS = "globalparams";
|
290
291
|
static MG_TAG_GLOBALPARAMSCHANGES = "globalParamChanges";
|
292
|
+
static MG_ATTR_FILE_PATH = "filepath";
|
293
|
+
static MG_TAG_CACHED_FILE = "cachedFile";
|
294
|
+
static MG_ATTR_CACHE_URL = "cacheUrl";
|
291
295
|
static MG_TAG_PARAM = "param";
|
292
296
|
static MG_ATTR_IME_AUTO_OFF = "imeAutoOff";
|
293
297
|
static MG_ATTR_LOCAL_AS400SET = "local_as400set";
|
@@ -312,6 +316,7 @@ class ConstInterface {
|
|
312
316
|
static MG_ATTR_HANDLER_ONFORM = "HandlerOnForm";
|
313
317
|
static MG_ATTR_DROP_USERFORMATS = "dropuserformats";
|
314
318
|
static MG_ATTR_CONTROL_NAME = "ControlName";
|
319
|
+
static MG_ATTR_SEARCH_STR = "searchStr";
|
315
320
|
static MG_TAG_HIDDEN_CONTOLS = "HiddenControls";
|
316
321
|
static MG_ATTR_ISNS = "Isns";
|
317
322
|
static MG_ATTR_SPECIAL_CANCEL_ON_CREATE = "SpecialCancelOnCreate";
|
@@ -583,6 +588,7 @@ class ConstInterface {
|
|
583
588
|
static MG_ATTR_VAL_EVENT = "event";
|
584
589
|
static MG_ATTR_VAL_EXEC_OPER = "execoper";
|
585
590
|
static MG_ATTR_VAL_QUERY = "query";
|
591
|
+
static MG_ATTR_VAL_QUERY_CACHED_FILE = "cachedFile";
|
586
592
|
static MG_ATTR_VAL_QUERY_GLOBAL_PARAMS = "globalparams";
|
587
593
|
static MG_ATTR_VAL_QUERY_TYPE = "query_type";
|
588
594
|
static MG_ATTR_VAL_RECOMP = "recompute";
|
@@ -599,6 +605,7 @@ class ConstInterface {
|
|
599
605
|
static MG_ATTR_SPECIAL_DOTNET_ALLOW_ZERO_DATE = "SpecialDotNetAllowZeroDate";
|
600
606
|
static MG_ATTR_SPECIAL_REUSE_TABLE_EDITOR = "SpecialReuseTableEditor";
|
601
607
|
static MG_TAG_LAST_ROUTE = "LastRoute";
|
608
|
+
static RC_TOKEN_CACHED_FILE = "CACHE=";
|
602
609
|
}
|
603
610
|
|
604
611
|
/// <summary>
|
@@ -5467,6 +5474,12 @@ class CommandsProcessorBase {
|
|
5467
5474
|
/// <param name="requestedURL">URL to be accessed.</param>
|
5468
5475
|
/// <returns>response (from the server).</returns>
|
5469
5476
|
async GetContent(requestedURL, useCache) {
|
5477
|
+
return Promise.resolve(null);
|
5478
|
+
}
|
5479
|
+
/// <summary> Invoke the request URL & return the response.</summary>
|
5480
|
+
/// <param name="requestedURL">URL to be accessed.</param>
|
5481
|
+
/// <returns>response (from the server).</returns>
|
5482
|
+
async GetContentAsString(requestedURL, useCache) {
|
5470
5483
|
return Promise.resolve('');
|
5471
5484
|
}
|
5472
5485
|
/// <summary> unscramble servers response</summary>
|
@@ -5788,12 +5801,7 @@ class HttpClientAsync extends HttpClientBase {
|
|
5788
5801
|
return httpHeaders;
|
5789
5802
|
}
|
5790
5803
|
async sendRequestToServer(httpMethod, urlString, httpHeaders, requestContent, contentFromServer) {
|
5791
|
-
let
|
5792
|
-
let responseType = "text";
|
5793
|
-
if (requestContent instanceof ArrayBuffer) {
|
5794
|
-
responseType = "arraybuffer";
|
5795
|
-
}
|
5796
|
-
let httpResponse = await this.httpClient.request(RequestMethod[httpMethod], urlString, { headers: httpHeaders, responseType: responseType, observe: "response", body: contents }).toPromise();
|
5804
|
+
let httpResponse = await this.httpClient.request(RequestMethod[httpMethod], urlString, { headers: httpHeaders, responseType: "arraybuffer", observe: "response", body: requestContent }).toPromise();
|
5797
5805
|
contentFromServer.value = httpResponse.body;
|
5798
5806
|
return httpResponse;
|
5799
5807
|
}
|
@@ -5933,10 +5941,19 @@ class HttpManager {
|
|
5933
5941
|
/// <returns>if the response contains the error indicator - the error indicator is truncated and the remaining is returned.
|
5934
5942
|
/// otherwise - null (indicating that the 'http Response' didn't contain an error).</returns>
|
5935
5943
|
static CheckAndGetErrorResponse(httpResponse) {
|
5944
|
+
const errorResponseIndicator = Encoding.UTF8.GetBytes(ConstInterface.V24_RIA_ERROR_PREFIX);
|
5936
5945
|
let errorResponse = null;
|
5937
|
-
|
5938
|
-
|
5939
|
-
|
5946
|
+
const httpResponseBytes = new Uint8Array(httpResponse);
|
5947
|
+
// Find 'errorResponseIndicator' in 'httpResponse', starting from the start index
|
5948
|
+
let i;
|
5949
|
+
for (i = 0; i < errorResponseIndicator.length; i++) {
|
5950
|
+
if (httpResponseBytes[i] !== errorResponseIndicator[i]) {
|
5951
|
+
break;
|
5952
|
+
}
|
5953
|
+
}
|
5954
|
+
if (i === errorResponseIndicator.length) {
|
5955
|
+
errorResponse = httpResponse.slice(errorResponseIndicator.length);
|
5956
|
+
}
|
5940
5957
|
return errorResponse;
|
5941
5958
|
}
|
5942
5959
|
static LogAccessToServer(msg, requestContent) {
|
@@ -5944,7 +5961,6 @@ class HttpManager {
|
|
5944
5961
|
if (!NString.IsNullOrEmpty(msg)) {
|
5945
5962
|
msg = msg + "; accessing server ...";
|
5946
5963
|
}
|
5947
|
-
requestContent = requestContent instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(requestContent) : requestContent;
|
5948
5964
|
if (requestContent === null) {
|
5949
5965
|
if (!NString.IsNullOrEmpty(msg)) {
|
5950
5966
|
Logger.Instance.WriteServerToLog(msg);
|
@@ -5954,11 +5970,24 @@ class HttpManager {
|
|
5954
5970
|
if (!NString.IsNullOrEmpty(msg)) {
|
5955
5971
|
msg = msg + " ";
|
5956
5972
|
}
|
5957
|
-
msg = msg + "uploading " + requestContent
|
5973
|
+
msg = msg + "uploading " + HttpManager.GetRequestContentLength(requestContent) + " bytes";
|
5958
5974
|
Logger.Instance.WriteServerToLog(msg);
|
5959
5975
|
}
|
5960
5976
|
}
|
5961
5977
|
}
|
5978
|
+
/// <summary>
|
5979
|
+
/// <returns>the length of 'requestContent'.</returns>
|
5980
|
+
/// <summary>
|
5981
|
+
static GetRequestContentLength(requestContent) {
|
5982
|
+
let length = 0;
|
5983
|
+
if (requestContent instanceof ArrayBuffer) {
|
5984
|
+
length = requestContent.byteLength;
|
5985
|
+
}
|
5986
|
+
else {
|
5987
|
+
length = requestContent.length;
|
5988
|
+
}
|
5989
|
+
return length;
|
5990
|
+
}
|
5962
5991
|
}
|
5963
5992
|
|
5964
5993
|
class ServerConfig {
|
@@ -6614,6 +6643,12 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
6614
6643
|
SessionId;
|
6615
6644
|
DelayCommandExecution = false;
|
6616
6645
|
_requestInfo = new RequestInfo();
|
6646
|
+
// After the expression is evaluated, we obtain local file path. But to fetch this resource from server,
|
6647
|
+
// cache path is needed. If cache path isn't found in cachedFilesMap, then query server for cachedFile.
|
6648
|
+
// Later again if the expression is evaluated to the same path, no need to query server for cache path.
|
6649
|
+
// e.g. for server-file path = "C:\\Blue_hills.jpg"
|
6650
|
+
// cache path = "/MagicScripts/mgrqispi.dll?CTX=10430335172368&CACHE=agent_3572_C__Blue_hills.jpg|06/10/2009%2016:36:16"
|
6651
|
+
serverFilesToClientFiles = new Map(); // Map between server-file path and cachedFileUrl
|
6617
6652
|
static GetInstance() {
|
6618
6653
|
if (RemoteCommandsProcessor._instance === null) {
|
6619
6654
|
RemoteCommandsProcessor._instance = new RemoteCommandsProcessor();
|
@@ -7279,6 +7314,45 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7279
7314
|
}
|
7280
7315
|
return response;
|
7281
7316
|
}
|
7317
|
+
async DownloadFileFromServer(serverFileName) {
|
7318
|
+
let fileContent = new ArrayBuffer(0);
|
7319
|
+
let cmd = CommandFactory.CreateQueryCachedFileCommand(serverFileName);
|
7320
|
+
AccessHelper.mgDataTable.getCurrMGData().CmdsToServer.Add(cmd);
|
7321
|
+
this.serverFilesToClientFiles.delete(serverFileName);
|
7322
|
+
await this.Execute(CommandsProcessorBase_SendingInstruction.ONLY_COMMANDS);
|
7323
|
+
//Check what url value is getting in the below line.(file path or the url starts with ?)
|
7324
|
+
let serverCachedFilePath = this.serverFilesToClientFiles.has(serverFileName) ? this.serverFilesToClientFiles.get(serverFileName) : null;
|
7325
|
+
if (serverCachedFilePath) {
|
7326
|
+
// let url: string = serverCachedFilePath;
|
7327
|
+
fileContent = await this.GetContent(serverCachedFilePath, false);
|
7328
|
+
}
|
7329
|
+
return fileContent;
|
7330
|
+
}
|
7331
|
+
fillCacheFilesMap(parser) {
|
7332
|
+
const xmlData = parser.getXMLdata();
|
7333
|
+
let endContext = xmlData.indexOf(XMLConstants.TAG_TERM, parser.getCurrIndex());
|
7334
|
+
if (endContext !== -1 && endContext < xmlData.length) {
|
7335
|
+
// Find last position of its tag
|
7336
|
+
const tag = parser.getXMLsubstring(endContext);
|
7337
|
+
parser.add2CurrIndex(tag.indexOf(ConstInterface.MG_TAG_CACHED_FILE) + ConstInterface.MG_TAG_CACHED_FILE.length);
|
7338
|
+
const tokensVector = XmlParser.getTokens(parser.getXMLsubstring(endContext), XMLConstants.XML_ATTR_DELIM);
|
7339
|
+
// Verify token names
|
7340
|
+
console.assert(tokensVector[0] === ConstInterface.MG_ATTR_FILE_PATH, 'Invalid token for file path');
|
7341
|
+
console.assert(tokensVector[2] === ConstInterface.MG_ATTR_CACHE_URL, 'Invalid token for cache URL');
|
7342
|
+
// Get token values
|
7343
|
+
const fileName = tokensVector[1];
|
7344
|
+
const fileUrl = tokensVector[3];
|
7345
|
+
if (fileUrl.trim() !== '') {
|
7346
|
+
// Store file path and cache retrieval URL in dictionary
|
7347
|
+
this.serverFilesToClientFiles.set(fileName, fileUrl);
|
7348
|
+
}
|
7349
|
+
endContext = xmlData.indexOf(XMLConstants.TAG_OPEN, endContext);
|
7350
|
+
if (endContext === -1) {
|
7351
|
+
endContext = xmlData.length;
|
7352
|
+
}
|
7353
|
+
parser.setCurrIndex(endContext);
|
7354
|
+
}
|
7355
|
+
}
|
7282
7356
|
// <summary> If any items are stored on local storage clear it now as session cannot continued.
|
7283
7357
|
// Clearing only the local storage items which are stored by magic library.
|
7284
7358
|
clearLocalStorage() {
|
@@ -7296,30 +7370,28 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7296
7370
|
/// an xml/html error</summary>
|
7297
7371
|
/// <param name="response"></param>
|
7298
7372
|
HandleErrorResponse(response) {
|
7299
|
-
|
7300
|
-
response = this.ArrayBufferToString(response);
|
7373
|
+
let responseStr = this.ArrayBufferToString(response);
|
7301
7374
|
try {
|
7302
7375
|
// error responses are always scrambled by the web server.
|
7303
|
-
Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " +
|
7304
|
-
|
7305
|
-
Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + StrUtil.getConsoleErorString(
|
7376
|
+
Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + responseStr);
|
7377
|
+
responseStr = CommandsProcessorBase.UnScramble(responseStr);
|
7378
|
+
Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + StrUtil.getConsoleErorString(responseStr));
|
7306
7379
|
}
|
7307
7380
|
catch (ex) {
|
7308
7381
|
}
|
7309
|
-
if (
|
7310
|
-
let errorMessageXml = new ErrorMessageXml(
|
7382
|
+
if (responseStr.startsWith("<xmlerr")) {
|
7383
|
+
let errorMessageXml = new ErrorMessageXml(responseStr, this._lastRequestTime, AccessHelper.environment.getContextInactivityTimeout());
|
7311
7384
|
throw new ServerError(errorMessageXml.GetMessage(), errorMessageXml.GetCode());
|
7312
7385
|
}
|
7313
|
-
else if (
|
7314
|
-
throw new ServerError(
|
7386
|
+
else if (responseStr.toUpperCase().startsWith("<HTML")) {
|
7387
|
+
throw new ServerError(responseStr);
|
7315
7388
|
}
|
7316
7389
|
}
|
7317
7390
|
// <summary>
|
7318
7391
|
// Converts an ArrayBuffer to a UTF-8 encoded string.
|
7319
7392
|
// </summary>
|
7320
7393
|
ArrayBufferToString(arrayBuffer) {
|
7321
|
-
|
7322
|
-
return decoder.decode(arrayBuffer);
|
7394
|
+
return Encoding.UTF8.GetString(new Uint8Array(arrayBuffer), 0, arrayBuffer.byteLength);
|
7323
7395
|
}
|
7324
7396
|
/// <summary>send 'encodedBody' to 'url' and receive a response.
|
7325
7397
|
/// </summary>
|
@@ -7327,29 +7399,36 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7327
7399
|
/// <param name="encodedBody">In case of POST, content to be sent to server. For other methods, null.</param>
|
7328
7400
|
/// <returns>the response from the server</returns>
|
7329
7401
|
async ExecuteRequest(url, encodedBody) {
|
7330
|
-
|
7331
|
-
|
7402
|
+
return await this.GetContentAsString(url, false, encodedBody);
|
7403
|
+
}
|
7404
|
+
async GetContentAsString(requestedURL, useCache, requestContent, requestContentType) {
|
7405
|
+
let response = await this.GetContent(requestedURL, useCache, requestContent, requestContentType);
|
7406
|
+
return this.ArrayBufferToString(response);
|
7332
7407
|
}
|
7333
7408
|
async GetContent(requestedURL, useCache, requestContent, requestContentType) {
|
7334
7409
|
if (isUndefined(requestContent))
|
7335
7410
|
requestContent = null;
|
7336
7411
|
if (isUndefined(requestContentType))
|
7337
7412
|
requestContentType = null;
|
7338
|
-
let
|
7413
|
+
let response;
|
7339
7414
|
try {
|
7340
7415
|
// if relative, prefix with the 'protocol://server/' from which the rich-client was activated
|
7341
7416
|
if (requestedURL.startsWith("/"))
|
7342
7417
|
requestedURL = ServerConfig.Instance.getProtocol() + "://" + ServerConfig.Instance.getServer() + requestedURL;
|
7418
|
+
else if (requestedURL.startsWith("?")) {
|
7419
|
+
requestedURL = this.ServerUrl + requestedURL;
|
7420
|
+
requestedURL = this.validateURL(requestedURL, this._sessionCounter, this.SessionId);
|
7421
|
+
}
|
7343
7422
|
var spinnerTimer = timer(50, 50);
|
7344
7423
|
var spinnerTimerSubscription = spinnerTimer.subscribe(() => {
|
7345
7424
|
AccessHelper.eventsManager.CheckAndShowSpinner(true);
|
7346
7425
|
});
|
7347
7426
|
let isError = new RefParam(false);
|
7348
|
-
|
7427
|
+
response = await HttpManager.GetInstance().GetContent(requestedURL, requestContent, requestContentType, useCache, isError);
|
7349
7428
|
spinnerTimerSubscription.unsubscribe();
|
7350
7429
|
spinnerTimerSubscription = null;
|
7351
7430
|
if (isError.value) {
|
7352
|
-
this.HandleErrorResponse(
|
7431
|
+
this.HandleErrorResponse(response);
|
7353
7432
|
}
|
7354
7433
|
}
|
7355
7434
|
catch (ex) {
|
@@ -7367,7 +7446,75 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7367
7446
|
if (spinnerTimerSubscription != null)
|
7368
7447
|
spinnerTimerSubscription.unsubscribe();
|
7369
7448
|
}
|
7370
|
-
return
|
7449
|
+
return response;
|
7450
|
+
}
|
7451
|
+
validateURL(url, sessionCounter, sessionId) {
|
7452
|
+
// const utf8Encoding = 'utf-8'; // UTF-8 encoding is used in the context of web APIs, but not directly needed in JavaScript/TypeScript
|
7453
|
+
// Create URL object from string
|
7454
|
+
const u = new URL(url);
|
7455
|
+
// Assert protocol (http, https, or file)
|
7456
|
+
if (!(u.protocol === "http:" || u.protocol === "https:" || u.protocol === "file:")) {
|
7457
|
+
throw new Error("Invalid protocol. Expected http, https, or file.");
|
7458
|
+
}
|
7459
|
+
// Add protocol as is
|
7460
|
+
let validURL = u.protocol + "//";
|
7461
|
+
// Encode host
|
7462
|
+
validURL += encodeURIComponent(u.hostname);
|
7463
|
+
// If port is specified, append it
|
7464
|
+
const port = u.port;
|
7465
|
+
if (port) {
|
7466
|
+
validURL += `:${port}`;
|
7467
|
+
}
|
7468
|
+
// Get path (e.g., alias/dir1/dir2/file)
|
7469
|
+
let path = u.pathname;
|
7470
|
+
if (!path.startsWith("/")) {
|
7471
|
+
validURL += "/";
|
7472
|
+
}
|
7473
|
+
// Tokenize the path and encode each part
|
7474
|
+
const pathParts = path.split("/");
|
7475
|
+
// Recompose the URL (path is already encoded by `encodeURIComponent`)
|
7476
|
+
for (let i = 0; i < pathParts.length; i++) {
|
7477
|
+
validURL += encodeURIComponent(pathParts[i]) + "/";
|
7478
|
+
}
|
7479
|
+
// Remove last "/"
|
7480
|
+
if (validURL.endsWith("/")) {
|
7481
|
+
validURL = validURL.slice(0, validURL.length - 1);
|
7482
|
+
}
|
7483
|
+
// Replace "+" with "%20" (standard for spaces in URLs)
|
7484
|
+
validURL = validURL.replace(/\+/g, "%20");
|
7485
|
+
// Add the query string
|
7486
|
+
if (u.search) {
|
7487
|
+
let modifiedQuery = u.search;
|
7488
|
+
const CTX_ID_PLACEHOLDER = "CTX=&";
|
7489
|
+
const ctxIdIdx = u.search.indexOf(CTX_ID_PLACEHOLDER);
|
7490
|
+
if (ctxIdIdx > -1) {
|
7491
|
+
// Add context ID
|
7492
|
+
// const queryString = `${ClientManager.Instance.RuntimeCtx.ContextID}`;
|
7493
|
+
// Append session ID if provided
|
7494
|
+
let queryParams = `${ClientManager.Instance.GetRuntimeCtxID()}`;
|
7495
|
+
if (sessionId) {
|
7496
|
+
queryParams += `&${ConstInterface.RC_TOKEN_SESSION_ID}=${sessionId}`;
|
7497
|
+
}
|
7498
|
+
queryParams += `&${ConstInterface.RC_TOKEN_SESSION_COUNT}${sessionCounter}`;
|
7499
|
+
// Insert query parameters in the query string
|
7500
|
+
modifiedQuery = u.search.substring(0, ctxIdIdx + CTX_ID_PLACEHOLDER.length - 1) + queryParams + u.search.substring(ctxIdIdx + CTX_ID_PLACEHOLDER.length - 1);
|
7501
|
+
// modifiedQuery is updated with file name with base64 encoded.
|
7502
|
+
let indexOfCacheToken = modifiedQuery.indexOf(ConstInterface.RC_TOKEN_CACHED_FILE);
|
7503
|
+
if (indexOfCacheToken !== -1) {
|
7504
|
+
let url = modifiedQuery;
|
7505
|
+
const cacheRegex = /CACHE=([^&]+)/;
|
7506
|
+
const match = url.match(cacheRegex);
|
7507
|
+
if (match && match[1]) {
|
7508
|
+
const cacheFileName = match[1].split('|')[0];
|
7509
|
+
const base64CacheFileName = btoa(cacheFileName);
|
7510
|
+
modifiedQuery = url.replace(`CACHE=${match[1]}`, `CACHE=${base64CacheFileName}`);
|
7511
|
+
}
|
7512
|
+
}
|
7513
|
+
}
|
7514
|
+
validURL += modifiedQuery;
|
7515
|
+
validURL = validURL.replace(/\|/g, "%7C");
|
7516
|
+
}
|
7517
|
+
return validURL;
|
7371
7518
|
}
|
7372
7519
|
// <summary> Upload contents to a file on server </summary>
|
7373
7520
|
// <param name="serverFileName">filename to be saved on the server.</param>
|
@@ -7383,11 +7530,8 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7383
7530
|
queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_TARGET_FILE}${encodedName}`;
|
7384
7531
|
const url = ServerConfig.Instance.getServerURL() + queryStr;
|
7385
7532
|
let response = await this.GetContent(url, false, fileContent, contentType);
|
7386
|
-
|
7387
|
-
|
7388
|
-
return uInt8Array[0];
|
7389
|
-
}
|
7390
|
-
return response;
|
7533
|
+
let uInt8Array = new Uint8Array(response);
|
7534
|
+
return uInt8Array[0];
|
7391
7535
|
}
|
7392
7536
|
ClientActivated() {
|
7393
7537
|
// log the values as client is active again
|
@@ -8032,8 +8176,15 @@ class CommandsProcessorManager {
|
|
8032
8176
|
/// <param name="requestedURL"></param>
|
8033
8177
|
/// <returns></returns>
|
8034
8178
|
static async GetContent(requestedURL, useCache) {
|
8035
|
-
|
8036
|
-
|
8179
|
+
return await (CommandsProcessorManager.GetCommandsProcessor().GetContent(requestedURL, useCache));
|
8180
|
+
}
|
8181
|
+
/// <summary>
|
8182
|
+
/// get the URL content according to the active commands processor
|
8183
|
+
/// </summary>
|
8184
|
+
/// <param name="requestedURL"></param>
|
8185
|
+
/// <returns></returns>
|
8186
|
+
static async GetContentString(requestedURL, useCache) {
|
8187
|
+
return await (CommandsProcessorManager.GetCommandsProcessor().GetContentAsString(requestedURL, useCache));
|
8037
8188
|
}
|
8038
8189
|
/// <summary>
|
8039
8190
|
/// Start session
|
@@ -8187,7 +8338,7 @@ class LanguageData {
|
|
8187
8338
|
if (this._constMessagesUrl != null) {
|
8188
8339
|
try {
|
8189
8340
|
// get the content from the server
|
8190
|
-
msgsInCommentString = await CommandsProcessorManager.
|
8341
|
+
msgsInCommentString = await CommandsProcessorManager.GetContentString(this._constMessagesUrl, true);
|
8191
8342
|
}
|
8192
8343
|
catch (err) {
|
8193
8344
|
Logger.Instance.WriteExceptionToLogWithMsg(NString.Format("Unknown message file: \"{0}\"", this._constMessagesUrl));
|
@@ -8198,7 +8349,6 @@ class LanguageData {
|
|
8198
8349
|
msgsInCommentString = this._constMessagesContent;
|
8199
8350
|
}
|
8200
8351
|
if (msgsInCommentString != null) {
|
8201
|
-
msgsInCommentString = msgsInCommentString instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(msgsInCommentString) : msgsInCommentString;
|
8202
8352
|
// ignore the comment wrapper
|
8203
8353
|
let startData = msgsInCommentString.indexOf(START_TAG);
|
8204
8354
|
let endData = msgsInCommentString.indexOf(END_TAG) + END_TAG.length;
|
@@ -8288,9 +8438,9 @@ class LanguageData {
|
|
8288
8438
|
else if (this._mlsFileUrl != null) {
|
8289
8439
|
if (this._mlsFileUrl.startsWith("./"))
|
8290
8440
|
this._mlsFileUrl = NString.Replace(this._mlsFileUrl, './', ClientManager.GetAssetsURL() + '/cache/');
|
8291
|
-
let
|
8292
|
-
|
8293
|
-
|
8441
|
+
let arrayBuffer = await CommandsProcessorManager.GetContent(this._mlsFileUrl, true);
|
8442
|
+
if (arrayBuffer != null && arrayBuffer.byteLength > 0) {
|
8443
|
+
let buffer = Encoding.Unicode.GetString(new Uint8Array(arrayBuffer), 0, arrayBuffer.byteLength);
|
8294
8444
|
let contentLen = buffer.length;
|
8295
8445
|
this._mlsStrings = new Hashtable();
|
8296
8446
|
// read the last line
|
@@ -9587,6 +9737,17 @@ class ExpressionDict {
|
|
9587
9737
|
new ExpDesc('B', 0, 1, 1, 'A', false), /* 703- Delete_Cookie */
|
9588
9738
|
null,
|
9589
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 */
|
9590
9751
|
];
|
9591
9752
|
}
|
9592
9753
|
|
@@ -9953,6 +10114,7 @@ class RefreshEventCommand extends EventCommand {
|
|
9953
10114
|
/// </summary>
|
9954
10115
|
class FetchDataControlValuesEventCommand extends EventCommand {
|
9955
10116
|
ControlName = null;
|
10117
|
+
FilterData = null;
|
9956
10118
|
constructor() {
|
9957
10119
|
super(InternalInterface.MG_ACT_FETCH_DATA_CONTROL_VALUES);
|
9958
10120
|
}
|
@@ -9961,6 +10123,8 @@ class FetchDataControlValuesEventCommand extends EventCommand {
|
|
9961
10123
|
helper.SerializeTaskTag(this.TaskTag);
|
9962
10124
|
helper.SerializeMagicEvent(this.MagicEvent);
|
9963
10125
|
helper.SerializeAttribute(ConstInterface.MG_ATTR_CONTROL_NAME, this.ControlName);
|
10126
|
+
if (this.FilterData != null && this.FilterData != "")
|
10127
|
+
helper.SerializeAttribute(ConstInterface.MG_ATTR_SEARCH_STR, this.FilterData);
|
9964
10128
|
return helper.GetString();
|
9965
10129
|
}
|
9966
10130
|
getCommandInfo() {
|
@@ -10409,11 +10573,30 @@ class SelectProgramCommand extends ExecOperCommand {
|
|
10409
10573
|
/// </summary>
|
10410
10574
|
class ControlItemsRefreshCommand extends DataviewCommand {
|
10411
10575
|
Control = null;
|
10576
|
+
FilterData = null;
|
10412
10577
|
constructor() {
|
10413
10578
|
super();
|
10414
10579
|
}
|
10415
10580
|
}
|
10416
10581
|
|
10582
|
+
class CachedFileQueryCommand extends QueryCommand {
|
10583
|
+
text;
|
10584
|
+
constructor(text) {
|
10585
|
+
super();
|
10586
|
+
this.text = text;
|
10587
|
+
}
|
10588
|
+
/**
|
10589
|
+
* Serializes the query command data
|
10590
|
+
*/
|
10591
|
+
SerializeQueryCommandData() {
|
10592
|
+
let message = ConstInterface.MG_ATTR_VAL_QUERY_CACHED_FILE + '"';
|
10593
|
+
let helper = new CommandSerializationHelper();
|
10594
|
+
helper.SerializeAttribute(ConstInterface.MG_ATTR_FILE_PATH, this.text);
|
10595
|
+
message += helper.GetString();
|
10596
|
+
return message;
|
10597
|
+
}
|
10598
|
+
}
|
10599
|
+
|
10417
10600
|
/// <summary>
|
10418
10601
|
/// factory class for creating commands
|
10419
10602
|
/// </summary>
|
@@ -10461,11 +10644,12 @@ class CommandFactory {
|
|
10461
10644
|
/// <param name="taskId"></param>
|
10462
10645
|
/// <param name="control"></param>
|
10463
10646
|
/// <returns></returns>
|
10464
|
-
static CreateControlItemsRefreshCommand(taskId, control) {
|
10647
|
+
static CreateControlItemsRefreshCommand(taskId, control, filterData) {
|
10465
10648
|
let command = new ControlItemsRefreshCommand();
|
10466
10649
|
command.CommandType = DataViewCommandType.ControlItemsRefresh;
|
10467
10650
|
command.TaskTag = taskId;
|
10468
10651
|
command.Control = control;
|
10652
|
+
command.FilterData = filterData;
|
10469
10653
|
return command;
|
10470
10654
|
}
|
10471
10655
|
/// <summary>
|
@@ -10570,10 +10754,11 @@ class CommandFactory {
|
|
10570
10754
|
/// <param name="controlName"></param>
|
10571
10755
|
/// <param name="generationParam"></param>
|
10572
10756
|
/// <returns></returns>
|
10573
|
-
static CreatecFetchDataControlValuesCommand(taskTag, controlName) {
|
10757
|
+
static CreatecFetchDataControlValuesCommand(taskTag, controlName, filterData) {
|
10574
10758
|
let fetchDataControlValuesEventCommand = new FetchDataControlValuesEventCommand();
|
10575
10759
|
fetchDataControlValuesEventCommand.TaskTag = taskTag;
|
10576
10760
|
fetchDataControlValuesEventCommand.ControlName = controlName;
|
10761
|
+
fetchDataControlValuesEventCommand.FilterData = filterData;
|
10577
10762
|
return fetchDataControlValuesEventCommand;
|
10578
10763
|
}
|
10579
10764
|
static CreateSubformRefreshCommand(taskTag, subformTaskTag, explicitSubformRefresh) {
|
@@ -10810,6 +10995,9 @@ class CommandFactory {
|
|
10810
10995
|
iniputForceWriteCommand.Text = param;
|
10811
10996
|
return iniputForceWriteCommand;
|
10812
10997
|
}
|
10998
|
+
static CreateQueryCachedFileCommand(cachedFileName) {
|
10999
|
+
return new CachedFileQueryCommand(cachedFileName);
|
11000
|
+
}
|
10813
11001
|
}
|
10814
11002
|
|
10815
11003
|
var ParamParseResult;
|
@@ -11306,13 +11494,12 @@ class Environment {
|
|
11306
11494
|
// in which case the current error message will be matched with an error in the xpa server's log file (GeneralErrorLog=)).
|
11307
11495
|
Logger.Instance.WriteErrorToLog(NString.Format("Empty cached file URL: '{0}'", tagAndAttributes.trim()));
|
11308
11496
|
else {
|
11309
|
-
let Content = await CommandsProcessorManager.
|
11497
|
+
let Content = await CommandsProcessorManager.GetContentString(cachedFileUrl, true);
|
11310
11498
|
try {
|
11311
11499
|
switch (tagName) {
|
11312
11500
|
case ConstInterface.MG_TAG_KBDMAP_URL:
|
11313
11501
|
break;
|
11314
11502
|
case ConstInterface.MG_TAG_ENV_PARAM_URL:
|
11315
|
-
Content = Content instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(Content) : Content;
|
11316
11503
|
let innerXmlParser = new XmlParser(Content);
|
11317
11504
|
while (AccessHelper.envParamsTable.mirrorFromXML(innerXmlParser.getNextTag(), innerXmlParser)) {
|
11318
11505
|
}
|
@@ -12047,6 +12234,7 @@ class Operation {
|
|
12047
12234
|
_undo = true;
|
12048
12235
|
_isRoute = false;
|
12049
12236
|
_routerPath = null;
|
12237
|
+
_subformExp = null;
|
12050
12238
|
_originalRouterOutletName = null;
|
12051
12239
|
_routeParams = null;
|
12052
12240
|
constructor() {
|
@@ -12250,6 +12438,10 @@ class Operation {
|
|
12250
12438
|
case XMLConstants.MG_ATTR_ROUTER_PATH:
|
12251
12439
|
this._routerPath = XmlParser.unescape(valueStr);
|
12252
12440
|
break;
|
12441
|
+
case XMLConstants.MG_ATTR_SUBFORM_EXP:
|
12442
|
+
expId = XmlParser.getInt(valueStr);
|
12443
|
+
this._subformExp = taskRef.getExpById(expId);
|
12444
|
+
break;
|
12253
12445
|
default:
|
12254
12446
|
Logger.Instance.WriteExceptionToLogWithMsg("There is no such tag in Operation class. Insert case to Operation.initElements for " + attribute);
|
12255
12447
|
break;
|
@@ -12312,7 +12504,7 @@ class Operation {
|
|
12312
12504
|
/// </param>
|
12313
12505
|
/// <param name = "returnedFromServer">true if the server returned the execution to this operation</param>
|
12314
12506
|
/// <returns> boolean for verify and block operations</returns>
|
12315
|
-
async execute(returnedFromServer) {
|
12507
|
+
async execute(returnedFromServer, desiredRouteName = null) {
|
12316
12508
|
let lastRtEvent = AccessHelper.eventsManager.getLastRtEvent();
|
12317
12509
|
let mprgCreator = null;
|
12318
12510
|
let flowMonitor = FlowMonitorQueue.Instance;
|
@@ -12357,6 +12549,17 @@ class Operation {
|
|
12357
12549
|
await this.operServer(mprgCreator);
|
12358
12550
|
break;
|
12359
12551
|
case ConstInterface.MG_OPER_CALL:
|
12552
|
+
if (this._subformExp != null) {
|
12553
|
+
const subformName = await this._subformExp.evaluateWithResultTypeAndLength(StorageAttribute.ALPHA, 30);
|
12554
|
+
if (!subformName || subformName.length > 30) {
|
12555
|
+
const messageKey = !subformName ? MsgInterface.STR_ERR_BLANK_SUBFORM_NAME : MsgInterface.STR_ERR_SUBFORM_NAME_EXCEEDS_LIMIT;
|
12556
|
+
let message = LanguageData.Instance.getConstMessage(messageKey);
|
12557
|
+
message = LanguageData.Instance.translate(message);
|
12558
|
+
this._task.WriteToMessagePane(message);
|
12559
|
+
return false;
|
12560
|
+
}
|
12561
|
+
this._subformCtrlName = subformName;
|
12562
|
+
}
|
12360
12563
|
if (this._publicName != null) {
|
12361
12564
|
this.operCallParallel();
|
12362
12565
|
}
|
@@ -12386,8 +12589,16 @@ class Operation {
|
|
12386
12589
|
let canRoute = false;
|
12387
12590
|
let rtEvnt = AccessHelper.eventsManager.getLastRtEvent();
|
12388
12591
|
if (rtEvnt !== null) {
|
12389
|
-
|
12390
|
-
if (
|
12592
|
+
// If we are here for default route path, set the routeParams as null because those are relevant only for the original route.
|
12593
|
+
if (!this._evtHandler.isExecutingDefaultRoute()) {
|
12594
|
+
desiredRouteName = (await rtEvnt.getArgList().getArg(0).getValue(StorageAttribute.ALPHA, 0)).trim();
|
12595
|
+
this._routeParams = rtEvnt.getRouteParamList();
|
12596
|
+
}
|
12597
|
+
else {
|
12598
|
+
desiredRouteName = this._evtHandler.getDefaultRouteName();
|
12599
|
+
this._routeParams = null;
|
12600
|
+
}
|
12601
|
+
if (desiredRouteName === this._routerPath &&
|
12391
12602
|
((rtEvnt.getArgList().getArg(1).skipArg() && destSubForm === this._task.getForm().DefaultRouterOutlet) ||
|
12392
12603
|
(!rtEvnt.getArgList().getArg(1).skipArg() && (await rtEvnt.getArgList().getArg(1).getValue(StorageAttribute.ALPHA, 0)).trim() === this._originalRouterOutletName)))
|
12393
12604
|
canRoute = true;
|
@@ -12895,7 +13106,18 @@ class Operation {
|
|
12895
13106
|
/// </summary>
|
12896
13107
|
/// <returns></returns>
|
12897
13108
|
async canExecute() {
|
12898
|
-
return await this.getCondVal();
|
13109
|
+
return (this.isOperationAllowedWhileExecutingDefaultRoute() && await this.getCondVal());
|
13110
|
+
}
|
13111
|
+
isOperationAllowedWhileExecutingDefaultRoute() {
|
13112
|
+
let isAllowed = true;
|
13113
|
+
if (this._evtHandler.isExecutingDefaultRoute()) {
|
13114
|
+
if (this._type == ConstInterface.MG_OPER_BLOCK || this._type == ConstInterface.MG_OPER_ELSE ||
|
13115
|
+
(this._type == ConstInterface.MG_OPER_CALL && this._isRoute))
|
13116
|
+
return true;
|
13117
|
+
else
|
13118
|
+
return false;
|
13119
|
+
}
|
13120
|
+
return isAllowed;
|
12899
13121
|
}
|
12900
13122
|
/// <summary>
|
12901
13123
|
/// </summary>
|
@@ -13607,6 +13829,9 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
13607
13829
|
static PARENT_LEN = 2; // 2 bytes
|
13608
13830
|
static SHORT_OBJECT_LEN = 2; // 2 bytes
|
13609
13831
|
static LONG_OBJECT_LEN = 4; // 4 bytes
|
13832
|
+
static MD5_ALGO_NUM = 1;
|
13833
|
+
static SHA1_ALGO_NUM = 2;
|
13834
|
+
static SHA2_ALGO_NUM = 3;
|
13610
13835
|
static _recursiveExpCalcCount = 0;
|
13611
13836
|
_charsToTrim = [' ', '\0'];
|
13612
13837
|
_expressionLocalJpn = null;
|
@@ -15230,6 +15455,12 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
15230
15455
|
case ExpressionInterface.EXP_OP_ROUTEGET:
|
15231
15456
|
this.eval_op_route_get(resVal);
|
15232
15457
|
break;
|
15458
|
+
case ExpressionInterface.EXP_OP_HASH:
|
15459
|
+
val2 = valStack.pop();
|
15460
|
+
val1 = valStack.pop();
|
15461
|
+
this.eval_op_Hash(val1, val2, resVal);
|
15462
|
+
expStrTracker.resetNullResult();
|
15463
|
+
break;
|
15233
15464
|
default:
|
15234
15465
|
return;
|
15235
15466
|
}
|
@@ -16681,7 +16912,7 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
16681
16912
|
let control = tsk.getForm().GetCtrl(val1.StrVal);
|
16682
16913
|
//This function is applicable only for Combo box, List box etc. i.e. for choice controls. Also it will refresh items only if Source table is attached to the data control.
|
16683
16914
|
if (control != null && control.isChoiceControl() && control.isDataCtrl()) {
|
16684
|
-
let command = CommandFactory.CreateControlItemsRefreshCommand(tsk.getTaskTag(), control);
|
16915
|
+
let command = CommandFactory.CreateControlItemsRefreshCommand(tsk.getTaskTag(), control, "");
|
16685
16916
|
await tsk.DataviewManager.CurrentDataviewManager.Execute(command);
|
16686
16917
|
success = true;
|
16687
16918
|
}
|
@@ -18196,7 +18427,7 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
18196
18427
|
if (!isNullOrUndefined(args)) {
|
18197
18428
|
// TODO: This is a patch fix put for MXPA-30360. Problem is that the lazy loading components are not loaded in an async way.
|
18198
18429
|
// Hence for the first record cycle the CallJS operation was not working. So, async loading of lazy loaded comps should be
|
18199
|
-
// handled.
|
18430
|
+
// handled.
|
18200
18431
|
resVal.StrVal = Commands.addCallJS(form, form.UniqueName, methodName, args);
|
18201
18432
|
resVal.Attr = StorageAttribute.ALPHA;
|
18202
18433
|
}
|
@@ -18293,6 +18524,35 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
18293
18524
|
}
|
18294
18525
|
return attr;
|
18295
18526
|
}
|
18527
|
+
eval_op_Hash(val1, val2, resVal) {
|
18528
|
+
resVal.Attr = StorageAttribute.ALPHA;
|
18529
|
+
resVal.StrVal = '';
|
18530
|
+
if (val1.IsNull || val2.IsNull)
|
18531
|
+
return;
|
18532
|
+
let str = '';
|
18533
|
+
const byteArray = BlobType.getBytes(val2.StrVal);
|
18534
|
+
const wordArray = this.toWordArray(byteArray);
|
18535
|
+
if (val1.MgNumVal.NUM_2_LONG() === ExpressionEvaluator.MD5_ALGO_NUM)
|
18536
|
+
str = CryptoJS.MD5(wordArray).toString();
|
18537
|
+
else if (val1.MgNumVal.NUM_2_LONG() === ExpressionEvaluator.SHA1_ALGO_NUM)
|
18538
|
+
str = CryptoJS.SHA1(wordArray).toString();
|
18539
|
+
else if (val1.MgNumVal.NUM_2_LONG() === ExpressionEvaluator.SHA2_ALGO_NUM)
|
18540
|
+
str = CryptoJS.SHA256(wordArray).toString();
|
18541
|
+
else
|
18542
|
+
Logger.Instance.WriteErrorToLog(LanguageData.Instance.getConstMessage(MsgInterface.STR_ERR_INVALID_HASH_ALGO_NUMBER));
|
18543
|
+
resVal.StrVal = str;
|
18544
|
+
}
|
18545
|
+
// Convert Uint8Array to WordArray
|
18546
|
+
toWordArray(u8) {
|
18547
|
+
const words = [];
|
18548
|
+
for (let i = 0; i < u8.length; i += 4) {
|
18549
|
+
words.push(((u8[i] || 0) << 24) |
|
18550
|
+
((u8[i + 1] || 0) << 16) |
|
18551
|
+
((u8[i + 2] || 0) << 8) |
|
18552
|
+
(u8[i + 3] || 0));
|
18553
|
+
}
|
18554
|
+
return CryptoJS.lib.WordArray.create(words, u8.length);
|
18555
|
+
}
|
18296
18556
|
}
|
18297
18557
|
/// <summary>
|
18298
18558
|
/// This exception used when at least one of the operands is null
|
@@ -24979,13 +25239,15 @@ class ResultValue {
|
|
24979
25239
|
|
24980
25240
|
class RemoteControlItemsRefreshCommand extends RemoteDataViewCommandBase {
|
24981
25241
|
control = null;
|
25242
|
+
filterData = null;
|
24982
25243
|
constructor(command) {
|
24983
25244
|
super(command);
|
24984
25245
|
this.control = command.Control;
|
25246
|
+
this.filterData = command.FilterData;
|
24985
25247
|
}
|
24986
25248
|
async Execute() {
|
24987
25249
|
let res = new ResultValue();
|
24988
|
-
let cmd = CommandFactory.CreatecFetchDataControlValuesCommand(this.Task.getTaskTag(), this.control.getName());
|
25250
|
+
let cmd = CommandFactory.CreatecFetchDataControlValuesCommand(this.Task.getTaskTag(), this.control.getName(), this.filterData);
|
24989
25251
|
this.Task.getMGData().CmdsToServer.Add(cmd);
|
24990
25252
|
// Fetch data control values from server.
|
24991
25253
|
await RemoteCommandsProcessor.GetInstance().Execute_1(CommandsProcessorBase_SendingInstruction.TASKS_AND_COMMANDS, CommandsProcessorBase_SessionStage.NORMAL, res);
|
@@ -27202,9 +27464,8 @@ class TableCacheManager {
|
|
27202
27464
|
// get the table
|
27203
27465
|
let current = this._tables.get_Item(tableUId);
|
27204
27466
|
try {
|
27205
|
-
let residentTableContentStr = await server.
|
27467
|
+
let residentTableContentStr = await server.GetContentAsString(tableUId, true);
|
27206
27468
|
try {
|
27207
|
-
residentTableContentStr = residentTableContentStr instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(residentTableContentStr) : residentTableContentStr;
|
27208
27469
|
RuntimeContextBase.Instance.Parser.loadTableCacheData(residentTableContentStr);
|
27209
27470
|
}
|
27210
27471
|
catch (innerException) {
|
@@ -27870,6 +28131,8 @@ class EventHandler {
|
|
27870
28131
|
_scope = null; // Task|Subtask|Global
|
27871
28132
|
_task = null;
|
27872
28133
|
_taskMgdID = -1;
|
28134
|
+
_defRouteName = null;
|
28135
|
+
_isExecutingDefaultRoute = false;
|
27873
28136
|
/// <summary>
|
27874
28137
|
/// CTOR
|
27875
28138
|
/// </summary>
|
@@ -27998,6 +28261,9 @@ class EventHandler {
|
|
27998
28261
|
case ConstInterface.MG_ATTR_HANDLER_ONFORM:
|
27999
28262
|
this._isHandlerOnForm = XmlParser.getBoolean(valueStr);
|
28000
28263
|
break;
|
28264
|
+
case XMLConstants.MG_ATTR_DEF_ROUTER_NAME:
|
28265
|
+
this._defRouteName = XmlParser.unescape(valueStr);
|
28266
|
+
break;
|
28001
28267
|
default:
|
28002
28268
|
Logger.Instance.WriteExceptionToLogWithMsg("There is no such tag in EventHandler class. Insert case to EventHandler.initElements for " + attribute);
|
28003
28269
|
break;
|
@@ -28226,8 +28492,15 @@ class EventHandler {
|
|
28226
28492
|
await this.resetLocalVariables(args);
|
28227
28493
|
initialLoopStackSize = this._task.getLoopStackSize();
|
28228
28494
|
let retVals = null;
|
28229
|
-
if (this._operationTab.getSize() > 0)
|
28495
|
+
if (this._operationTab.getSize() > 0) {
|
28230
28496
|
retVals = await this.executeOperations(0, this._operationTab.getSize() - 1, taskEnd, mgdID, depth, isChangedCurrWndRef, false, false, -1);
|
28497
|
+
if (retVals == null && this.isRouteHandler() && this.getDefaultRouteName() != null) {
|
28498
|
+
this._isExecutingDefaultRoute = true;
|
28499
|
+
// call again with an additional param Default Route Name
|
28500
|
+
retVals = await this.executeOperations(0, this._operationTab.getSize() - 1, taskEnd, mgdID, depth, isChangedCurrWndRef, false, false, -1);
|
28501
|
+
this._isExecutingDefaultRoute = false;
|
28502
|
+
}
|
28503
|
+
}
|
28231
28504
|
isChangedCurrWnd = isChangedCurrWndRef.value;
|
28232
28505
|
if (retVals !== null)
|
28233
28506
|
return retVals;
|
@@ -28307,6 +28580,9 @@ class EventHandler {
|
|
28307
28580
|
}
|
28308
28581
|
return new RetVals(retVal, true);
|
28309
28582
|
}
|
28583
|
+
isExecutingDefaultRoute() {
|
28584
|
+
return this._isExecutingDefaultRoute;
|
28585
|
+
}
|
28310
28586
|
/// <summary>
|
28311
28587
|
/// execute the operations starting from fromIdx and ending at endIdx.
|
28312
28588
|
/// </summary>
|
@@ -28646,6 +28922,12 @@ class EventHandler {
|
|
28646
28922
|
getEvent() {
|
28647
28923
|
return this._evt;
|
28648
28924
|
}
|
28925
|
+
isRouteHandler() {
|
28926
|
+
return (this._evt.getType() == ConstInterface.EVENT_TYPE_INTERNAL && this._evt.getInternalCode() === InternalInterface.MG_ACT_WEBCLIENT_ROUTE);
|
28927
|
+
}
|
28928
|
+
getDefaultRouteName() {
|
28929
|
+
return this._defRouteName;
|
28930
|
+
}
|
28649
28931
|
/// <summary>
|
28650
28932
|
/// get the Id of the event handler
|
28651
28933
|
/// </summary>
|
@@ -32839,8 +33121,7 @@ class Task extends TaskBase {
|
|
32839
33121
|
// bring the data
|
32840
33122
|
if (taskCacheURL.startsWith("./"))
|
32841
33123
|
taskCacheURL = NString.Replace(taskCacheURL, './', ClientManager.GetAssetsURL() + '/cache/');
|
32842
|
-
taskContentOriginal = await Task.CommandsProcessor.
|
32843
|
-
taskContentOriginal = taskContentOriginal instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(taskContentOriginal) : taskContentOriginal;
|
33124
|
+
taskContentOriginal = await Task.CommandsProcessor.GetContentAsString(taskCacheURL, true);
|
32844
33125
|
}
|
32845
33126
|
// prefix the original data till the start of the current <taskURL>
|
32846
33127
|
let taskContentFinal = new StringBuilder(xmlData.substr(0, RuntimeContextBase.Instance.Parser.getCurrIndex() - (ConstInterface.MG_TAG_TASKURL.length + 1)), taskContentOriginal.length);
|
@@ -33358,6 +33639,9 @@ class MGData {
|
|
33358
33639
|
Logger.Instance.WriteDevToLog("processing base64 encoded image of all global params from the server");
|
33359
33640
|
this.fillGlobalParams(parser);
|
33360
33641
|
break;
|
33642
|
+
case ConstInterface.MG_TAG_CACHED_FILE:
|
33643
|
+
RemoteCommandsProcessor.GetInstance().fillCacheFilesMap(parser);
|
33644
|
+
break;
|
33361
33645
|
case ConstInterface.MG_TAG_ENV_PARAM_URL:
|
33362
33646
|
Logger.Instance.WriteDevToLog("goes to env params name ");
|
33363
33647
|
await Environment.Instance.fillFromUrl(foundTagName, parser);
|
@@ -37164,6 +37448,13 @@ class EventsManager {
|
|
37164
37448
|
case InternalInterface.MG_ACT_SET_EXTERNAL_VALUE:
|
37165
37449
|
let refreshDisplay = await evt.getArgList().getArgValue(1, StorageAttribute.BOOLEAN, 0) === '1' ? true : false;
|
37166
37450
|
await ctrl.validateAndSetValueIfAllowed(evt.getValue(), refreshDisplay);
|
37451
|
+
//We will be here if we type in character(s)
|
37452
|
+
//And if the control has Autocomplete Mode and On Demand property set to true, we need to display the autocomplete list
|
37453
|
+
//based on whatever value user has typed. So, excute ControlItemsRefresh command to fetch the data control's values.
|
37454
|
+
if (ctrl.isOnDemandSelectionList()) {
|
37455
|
+
let command = CommandFactory.CreateControlItemsRefreshCommand(task.getTaskTag(), ctrl, evt.getValue());
|
37456
|
+
await task.DataviewManager.CurrentDataviewManager.Execute(command);
|
37457
|
+
}
|
37167
37458
|
break;
|
37168
37459
|
}
|
37169
37460
|
}
|
@@ -39338,7 +39629,7 @@ class CommandsTable {
|
|
39338
39629
|
}
|
39339
39630
|
}
|
39340
39631
|
|
39341
|
-
let CurrentClientVersion = '4.1200.0
|
39632
|
+
let CurrentClientVersion = '4.1200.0';
|
39342
39633
|
|
39343
39634
|
// @dynamic
|
39344
39635
|
class ClientManager {
|
@@ -39692,13 +39983,8 @@ class ClientManager {
|
|
39692
39983
|
// isError cannot be true here, because it is returned by runtime engine and to read execution properties, we do not reach the engine.
|
39693
39984
|
let isError = new RefParam(false);
|
39694
39985
|
response = await HttpManager.GetInstance().GetContent(ClientManager._executionPropertiesFileName, null, null, false, isError);
|
39695
|
-
|
39696
|
-
|
39697
|
-
ServerConfig.Instance.Init(JSON.parse(decoder.decode(response)));
|
39698
|
-
}
|
39699
|
-
else {
|
39700
|
-
ServerConfig.Instance.Init(JSON.parse(response));
|
39701
|
-
}
|
39986
|
+
const responseStr = Encoding.UTF8.GetString((new Uint8Array(response)), 0, response.byteLength);
|
39987
|
+
ServerConfig.Instance.Init(JSON.parse(responseStr));
|
39702
39988
|
let assetsURL = ServerConfig.Instance.getAssetsURL();
|
39703
39989
|
if (assetsURL !== null) {
|
39704
39990
|
ClientManager.assetsURL = assetsURL;
|
@@ -39735,6 +40021,9 @@ class ClientManager {
|
|
39735
40021
|
static UploadFileToServer(fileContent, serverFileName) {
|
39736
40022
|
return RemoteCommandsProcessor.GetInstance().UploadFileToServer(fileContent, serverFileName);
|
39737
40023
|
}
|
40024
|
+
static async DownloadFileFromServer(serverFileName) {
|
40025
|
+
return await RemoteCommandsProcessor.GetInstance().DownloadFileFromServer(serverFileName);
|
40026
|
+
}
|
39738
40027
|
/// <summary>
|
39739
40028
|
/// Get formatted value
|
39740
40029
|
/// </summary>
|
@@ -39885,6 +40174,9 @@ class MagicBridge {
|
|
39885
40174
|
static UploadFileToServer(fileContent, serverFileName) {
|
39886
40175
|
return ClientManager.UploadFileToServer(fileContent, serverFileName);
|
39887
40176
|
}
|
40177
|
+
static async DownloadFileFromServer(serverFileName) {
|
40178
|
+
return await ClientManager.DownloadFileFromServer(serverFileName);
|
40179
|
+
}
|
39888
40180
|
static GetFormattedValue(taskId, controlName, value, rowId) {
|
39889
40181
|
return ClientManager.GetFormattedValue(taskId, controlName, value, rowId);
|
39890
40182
|
}
|
@@ -39951,5 +40243,5 @@ class DataSourceIdKey {
|
|
39951
40243
|
* Generated bundle index. Do not edit.
|
39952
40244
|
*/
|
39953
40245
|
|
39954
|
-
export { AbortCommand, AccessHelper, ActionManager, AddLocateCommand, AddRangeCommand, AddSortCommand, AddUserLocateDataViewCommand, AddUserLocateRemoteDataViewCommand, AddUserRangeDataviewCommand, AddUserRangeRemoteDataViewCommand, AddUserSortDataViewCommand, AddUserSortRemoteDataViewCommand, Argument, ArgumentsList, Boundary, BrowserEscEventCommand, ClearEventsOnStopExecution, ClientManager, ClientOriginatedCommand, ClientOriginatedCommandSerializer, ClientOriginatedCommandTaskTag, ClientRefreshCommand, ClientTargetedCommandBase, ClientTargetedCommandType, ColumnSortEventCommand, CommandFactory, CommandSerializationHelper, CommandsProcessorBase, CommandsProcessorBase_SendingInstruction, CommandsProcessorBase_SessionStage, CommandsProcessorManager, CommandsTable, CompMainPrgTable, ComputeEventCommand, ConstInterface, ConstUtils, ContextTerminationEventCommand, ContextTimeoutResetCommand, ControlItemsRefreshCommand, CookieService, CreatedFormVector, CurrentClientVersion, DataSourceIdKey, DataView, DataViewBase, DataViewCommandBase, DataViewCommandType, DataViewOutputCommand, DataviewCommand, DataviewHeaderBase, DataviewHeaderFactory, DataviewHeaders, DataviewHeadersSaxHandler, DataviewManager, DataviewManagerBase, DcValuesReference, DummyDataViewCommand, DvCache, EnhancedVerifyCommand, EnvParamsTable, Environment, EnvironmentDetails, EvaluateCommand, Event, EventCommand, EventHandler, EventHandlerPosition, EventSubType, EventsAllowedType, EventsManager, ExecOperCommand, ExecutionStack, ExecutionStackEntry, ExpDesc, ExpStrTracker, ExpTable, Expression, ExpressionDict, ExpressionEvaluator, ExpressionLocalJpn, Expression_ReturnValue, FetchDataControlValuesEventCommand, Field, FieldBase, FieldsTable as FieldsTableExt, FlowMonitorInterface, FlowMonitorQueue, FormsTable, GUIManager, GlobalCommandsManager, GlobalParams, GlobalParamsQueryCommand, GuiEventsProcessor, HandlersTable, HeapSort, HttpClientAsync, HttpClientBase, HttpClientEvents, HttpClientSync, HttpManager, HttpUtility, IClientTargetedCommand, IndexChangeEventCommand, IniputForceWriteCommand, InteractiveCommunicationsFailureHandler, Key, LanguageData, LastFocusedManager, MGData, MGDataCollection, MagicBridge, MgControl, MgForm, MgPriorityBlockingQueue, MgPriorityQueue, MirrorExpVal, MirrorPrmMap, MirrorString, NonReversibleExitEventCommand, NullValueException, OpenURLCommand, OpeningTaskDetails, Operation, OperationTable, ParamParseResult, PrmMap, QueryCommand, RCTimer, Recompute, RecomputeCommand, RecomputeTable, Recompute_RcmpBy, Record, RecordOutOfDataViewException, RecordOutOfDataViewException_ExceptionType, RecordsTable, RefreshEventCommand, RefreshScreenEventCommand, RemoteCommandsProcessor, RemoteControlItemsRefreshCommand, RemoteDataViewCommandBase, RemoteDataViewCommandFactory, RemoteDataViewCommandUpdateNonModifiable, RemoteDataviewHeader, RemoteDataviewManager, RemoteTaskService, RequestMethod, ResetLocateCommand, ResetRangeCommand, ResetSortCommand, ResetUserLocateRemoteDataviewCommand, ResetUserRangeRemoteDataviewCommand, ResetUserSortRemoteDataviewCommand, ResultCommand, ResultValue, RetVals, ReturnResult, ReturnResultBase, RollbackEventCommand, RollbackEventCommand_RollbackType, RunTimeEvent, RunTimeEventBase, SET_DISPLAYLINE_BY_DV, Scrambler, SelectProgramCommand, ServerConfig, ServerError, SetTransactionStateDataviewCommand, SetTransactionStateRemoteDataViewCommand, Sort, SortCollection, SubformOpenEventCommand, SubformRefreshEventCommand, TableCache, TableCacheManager, Task, TaskBase, TaskServiceBase, TaskTransactionManager, Task_Direction, Task_Flow, Task_SubformExecModeEnum, TasksTable, Transaction, TransactionCommand, UniqueIDUtils, UnloadCommand, UserDetails, UserEventsTable, UserRange, VerifyCommand, WriteMessageToServerLogCommand, XMLBasedCommandBuilder, XMLBasedDcValuesBuilder, YesNoExp, getGuiEventObj };
|
40246
|
+
export { AbortCommand, AccessHelper, ActionManager, AddLocateCommand, AddRangeCommand, AddSortCommand, AddUserLocateDataViewCommand, AddUserLocateRemoteDataViewCommand, AddUserRangeDataviewCommand, AddUserRangeRemoteDataViewCommand, AddUserSortDataViewCommand, AddUserSortRemoteDataViewCommand, Argument, ArgumentsList, Boundary, BrowserEscEventCommand, CachedFileQueryCommand, ClearEventsOnStopExecution, ClientManager, ClientOriginatedCommand, ClientOriginatedCommandSerializer, ClientOriginatedCommandTaskTag, ClientRefreshCommand, ClientTargetedCommandBase, ClientTargetedCommandType, ColumnSortEventCommand, CommandFactory, CommandSerializationHelper, CommandsProcessorBase, CommandsProcessorBase_SendingInstruction, CommandsProcessorBase_SessionStage, CommandsProcessorManager, CommandsTable, CompMainPrgTable, ComputeEventCommand, ConstInterface, ConstUtils, ContextTerminationEventCommand, ContextTimeoutResetCommand, ControlItemsRefreshCommand, CookieService, CreatedFormVector, CurrentClientVersion, DataSourceIdKey, DataView, DataViewBase, DataViewCommandBase, DataViewCommandType, DataViewOutputCommand, DataviewCommand, DataviewHeaderBase, DataviewHeaderFactory, DataviewHeaders, DataviewHeadersSaxHandler, DataviewManager, DataviewManagerBase, DcValuesReference, DummyDataViewCommand, DvCache, EnhancedVerifyCommand, EnvParamsTable, Environment, EnvironmentDetails, EvaluateCommand, Event, EventCommand, EventHandler, EventHandlerPosition, EventSubType, EventsAllowedType, EventsManager, ExecOperCommand, ExecutionStack, ExecutionStackEntry, ExpDesc, ExpStrTracker, ExpTable, Expression, ExpressionDict, ExpressionEvaluator, ExpressionLocalJpn, Expression_ReturnValue, FetchDataControlValuesEventCommand, Field, FieldBase, FieldsTable as FieldsTableExt, FlowMonitorInterface, FlowMonitorQueue, FormsTable, GUIManager, GlobalCommandsManager, GlobalParams, GlobalParamsQueryCommand, GuiEventsProcessor, HandlersTable, HeapSort, HttpClientAsync, HttpClientBase, HttpClientEvents, HttpClientSync, HttpManager, HttpUtility, IClientTargetedCommand, IndexChangeEventCommand, IniputForceWriteCommand, InteractiveCommunicationsFailureHandler, Key, LanguageData, LastFocusedManager, MGData, MGDataCollection, MagicBridge, MgControl, MgForm, MgPriorityBlockingQueue, MgPriorityQueue, MirrorExpVal, MirrorPrmMap, MirrorString, NonReversibleExitEventCommand, NullValueException, OpenURLCommand, OpeningTaskDetails, Operation, OperationTable, ParamParseResult, PrmMap, QueryCommand, RCTimer, Recompute, RecomputeCommand, RecomputeTable, Recompute_RcmpBy, Record, RecordOutOfDataViewException, RecordOutOfDataViewException_ExceptionType, RecordsTable, RefreshEventCommand, RefreshScreenEventCommand, RemoteCommandsProcessor, RemoteControlItemsRefreshCommand, RemoteDataViewCommandBase, RemoteDataViewCommandFactory, RemoteDataViewCommandUpdateNonModifiable, RemoteDataviewHeader, RemoteDataviewManager, RemoteTaskService, RequestMethod, ResetLocateCommand, ResetRangeCommand, ResetSortCommand, ResetUserLocateRemoteDataviewCommand, ResetUserRangeRemoteDataviewCommand, ResetUserSortRemoteDataviewCommand, ResultCommand, ResultValue, RetVals, ReturnResult, ReturnResultBase, RollbackEventCommand, RollbackEventCommand_RollbackType, RunTimeEvent, RunTimeEventBase, SET_DISPLAYLINE_BY_DV, Scrambler, SelectProgramCommand, ServerConfig, ServerError, SetTransactionStateDataviewCommand, SetTransactionStateRemoteDataViewCommand, Sort, SortCollection, SubformOpenEventCommand, SubformRefreshEventCommand, TableCache, TableCacheManager, Task, TaskBase, TaskServiceBase, TaskTransactionManager, Task_Direction, Task_Flow, Task_SubformExecModeEnum, TasksTable, Transaction, TransactionCommand, UniqueIDUtils, UnloadCommand, UserDetails, UserEventsTable, UserRange, VerifyCommand, WriteMessageToServerLogCommand, XMLBasedCommandBuilder, XMLBasedDcValuesBuilder, YesNoExp, getGuiEventObj };
|
39955
40247
|
//# sourceMappingURL=magic-xpa-engine.mjs.map
|