@magic-xpa/engine 4.1200.0-dev4120.99 → 4.1200.0-ec.131.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 +225 -55
- 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 +5 -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 +2 -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
@@ -288,6 +288,9 @@ class ConstInterface {
|
|
288
288
|
static MG_ATTR_CPY_GLB_PRMS = "copy_global_params";
|
289
289
|
static MG_TAG_GLOBALPARAMS = "globalparams";
|
290
290
|
static MG_TAG_GLOBALPARAMSCHANGES = "globalParamChanges";
|
291
|
+
static MG_ATTR_FILE_PATH = "filepath";
|
292
|
+
static MG_TAG_CACHED_FILE = "cachedFile";
|
293
|
+
static MG_ATTR_CACHE_URL = "cacheUrl";
|
291
294
|
static MG_TAG_PARAM = "param";
|
292
295
|
static MG_ATTR_IME_AUTO_OFF = "imeAutoOff";
|
293
296
|
static MG_ATTR_LOCAL_AS400SET = "local_as400set";
|
@@ -583,6 +586,7 @@ class ConstInterface {
|
|
583
586
|
static MG_ATTR_VAL_EVENT = "event";
|
584
587
|
static MG_ATTR_VAL_EXEC_OPER = "execoper";
|
585
588
|
static MG_ATTR_VAL_QUERY = "query";
|
589
|
+
static MG_ATTR_VAL_QUERY_CACHED_FILE = "cachedFile";
|
586
590
|
static MG_ATTR_VAL_QUERY_GLOBAL_PARAMS = "globalparams";
|
587
591
|
static MG_ATTR_VAL_QUERY_TYPE = "query_type";
|
588
592
|
static MG_ATTR_VAL_RECOMP = "recompute";
|
@@ -599,6 +603,7 @@ class ConstInterface {
|
|
599
603
|
static MG_ATTR_SPECIAL_DOTNET_ALLOW_ZERO_DATE = "SpecialDotNetAllowZeroDate";
|
600
604
|
static MG_ATTR_SPECIAL_REUSE_TABLE_EDITOR = "SpecialReuseTableEditor";
|
601
605
|
static MG_TAG_LAST_ROUTE = "LastRoute";
|
606
|
+
static RC_TOKEN_CACHED_FILE = "CACHE=";
|
602
607
|
}
|
603
608
|
|
604
609
|
/// <summary>
|
@@ -5467,6 +5472,12 @@ class CommandsProcessorBase {
|
|
5467
5472
|
/// <param name="requestedURL">URL to be accessed.</param>
|
5468
5473
|
/// <returns>response (from the server).</returns>
|
5469
5474
|
async GetContent(requestedURL, useCache) {
|
5475
|
+
return Promise.resolve(null);
|
5476
|
+
}
|
5477
|
+
/// <summary> Invoke the request URL & return the response.</summary>
|
5478
|
+
/// <param name="requestedURL">URL to be accessed.</param>
|
5479
|
+
/// <returns>response (from the server).</returns>
|
5480
|
+
async GetContentAsString(requestedURL, useCache) {
|
5470
5481
|
return Promise.resolve('');
|
5471
5482
|
}
|
5472
5483
|
/// <summary> unscramble servers response</summary>
|
@@ -5788,12 +5799,7 @@ class HttpClientAsync extends HttpClientBase {
|
|
5788
5799
|
return httpHeaders;
|
5789
5800
|
}
|
5790
5801
|
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();
|
5802
|
+
let httpResponse = await this.httpClient.request(RequestMethod[httpMethod], urlString, { headers: httpHeaders, responseType: "arraybuffer", observe: "response", body: requestContent }).toPromise();
|
5797
5803
|
contentFromServer.value = httpResponse.body;
|
5798
5804
|
return httpResponse;
|
5799
5805
|
}
|
@@ -5933,10 +5939,19 @@ class HttpManager {
|
|
5933
5939
|
/// <returns>if the response contains the error indicator - the error indicator is truncated and the remaining is returned.
|
5934
5940
|
/// otherwise - null (indicating that the 'http Response' didn't contain an error).</returns>
|
5935
5941
|
static CheckAndGetErrorResponse(httpResponse) {
|
5942
|
+
const errorResponseIndicator = Encoding.UTF8.GetBytes(ConstInterface.V24_RIA_ERROR_PREFIX);
|
5936
5943
|
let errorResponse = null;
|
5937
|
-
|
5938
|
-
|
5939
|
-
|
5944
|
+
const httpResponseBytes = new Uint8Array(httpResponse);
|
5945
|
+
// Find 'errorResponseIndicator' in 'httpResponse', starting from the start index
|
5946
|
+
let i;
|
5947
|
+
for (i = 0; i < errorResponseIndicator.length; i++) {
|
5948
|
+
if (httpResponseBytes[i] !== errorResponseIndicator[i]) {
|
5949
|
+
break;
|
5950
|
+
}
|
5951
|
+
}
|
5952
|
+
if (i === errorResponseIndicator.length) {
|
5953
|
+
errorResponse = httpResponse.slice(errorResponseIndicator.length);
|
5954
|
+
}
|
5940
5955
|
return errorResponse;
|
5941
5956
|
}
|
5942
5957
|
static LogAccessToServer(msg, requestContent) {
|
@@ -5944,7 +5959,6 @@ class HttpManager {
|
|
5944
5959
|
if (!NString.IsNullOrEmpty(msg)) {
|
5945
5960
|
msg = msg + "; accessing server ...";
|
5946
5961
|
}
|
5947
|
-
requestContent = requestContent instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(requestContent) : requestContent;
|
5948
5962
|
if (requestContent === null) {
|
5949
5963
|
if (!NString.IsNullOrEmpty(msg)) {
|
5950
5964
|
Logger.Instance.WriteServerToLog(msg);
|
@@ -5954,11 +5968,24 @@ class HttpManager {
|
|
5954
5968
|
if (!NString.IsNullOrEmpty(msg)) {
|
5955
5969
|
msg = msg + " ";
|
5956
5970
|
}
|
5957
|
-
msg = msg + "uploading " + requestContent
|
5971
|
+
msg = msg + "uploading " + HttpManager.GetRequestContentLength(requestContent) + " bytes";
|
5958
5972
|
Logger.Instance.WriteServerToLog(msg);
|
5959
5973
|
}
|
5960
5974
|
}
|
5961
5975
|
}
|
5976
|
+
/// <summary>
|
5977
|
+
/// <returns>the length of 'requestContent'.</returns>
|
5978
|
+
/// <summary>
|
5979
|
+
static GetRequestContentLength(requestContent) {
|
5980
|
+
let length = 0;
|
5981
|
+
if (requestContent instanceof ArrayBuffer) {
|
5982
|
+
length = requestContent.byteLength;
|
5983
|
+
}
|
5984
|
+
else {
|
5985
|
+
length = requestContent.length;
|
5986
|
+
}
|
5987
|
+
return length;
|
5988
|
+
}
|
5962
5989
|
}
|
5963
5990
|
|
5964
5991
|
class ServerConfig {
|
@@ -6614,6 +6641,12 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
6614
6641
|
SessionId;
|
6615
6642
|
DelayCommandExecution = false;
|
6616
6643
|
_requestInfo = new RequestInfo();
|
6644
|
+
// After the expression is evaluated, we obtain local file path. But to fetch this resource from server,
|
6645
|
+
// cache path is needed. If cache path isn't found in cachedFilesMap, then query server for cachedFile.
|
6646
|
+
// Later again if the expression is evaluated to the same path, no need to query server for cache path.
|
6647
|
+
// e.g. for server-file path = "C:\\Blue_hills.jpg"
|
6648
|
+
// cache path = "/MagicScripts/mgrqispi.dll?CTX=10430335172368&CACHE=agent_3572_C__Blue_hills.jpg|06/10/2009%2016:36:16"
|
6649
|
+
serverFilesToClientFiles = new Map(); // Map between server-file path and cachedFileUrl
|
6617
6650
|
static GetInstance() {
|
6618
6651
|
if (RemoteCommandsProcessor._instance === null) {
|
6619
6652
|
RemoteCommandsProcessor._instance = new RemoteCommandsProcessor();
|
@@ -7279,6 +7312,45 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7279
7312
|
}
|
7280
7313
|
return response;
|
7281
7314
|
}
|
7315
|
+
async DownloadFileFromServer(serverFileName) {
|
7316
|
+
let fileContent = new ArrayBuffer(0);
|
7317
|
+
let cmd = CommandFactory.CreateQueryCachedFileCommand(serverFileName);
|
7318
|
+
AccessHelper.mgDataTable.getCurrMGData().CmdsToServer.Add(cmd);
|
7319
|
+
this.serverFilesToClientFiles.delete(serverFileName);
|
7320
|
+
await this.Execute(CommandsProcessorBase_SendingInstruction.ONLY_COMMANDS);
|
7321
|
+
//Check what url value is getting in the below line.(file path or the url starts with ?)
|
7322
|
+
let serverCachedFilePath = this.serverFilesToClientFiles.has(serverFileName) ? this.serverFilesToClientFiles.get(serverFileName) : null;
|
7323
|
+
if (serverCachedFilePath) {
|
7324
|
+
// let url: string = serverCachedFilePath;
|
7325
|
+
fileContent = await this.GetContent(serverCachedFilePath, false);
|
7326
|
+
}
|
7327
|
+
return fileContent;
|
7328
|
+
}
|
7329
|
+
fillCacheFilesMap(parser) {
|
7330
|
+
const xmlData = parser.getXMLdata();
|
7331
|
+
let endContext = xmlData.indexOf(XMLConstants.TAG_TERM, parser.getCurrIndex());
|
7332
|
+
if (endContext !== -1 && endContext < xmlData.length) {
|
7333
|
+
// Find last position of its tag
|
7334
|
+
const tag = parser.getXMLsubstring(endContext);
|
7335
|
+
parser.add2CurrIndex(tag.indexOf(ConstInterface.MG_TAG_CACHED_FILE) + ConstInterface.MG_TAG_CACHED_FILE.length);
|
7336
|
+
const tokensVector = XmlParser.getTokens(parser.getXMLsubstring(endContext), XMLConstants.XML_ATTR_DELIM);
|
7337
|
+
// Verify token names
|
7338
|
+
console.assert(tokensVector[0] === ConstInterface.MG_ATTR_FILE_PATH, 'Invalid token for file path');
|
7339
|
+
console.assert(tokensVector[2] === ConstInterface.MG_ATTR_CACHE_URL, 'Invalid token for cache URL');
|
7340
|
+
// Get token values
|
7341
|
+
const fileName = tokensVector[1];
|
7342
|
+
const fileUrl = tokensVector[3];
|
7343
|
+
if (fileUrl.trim() !== '') {
|
7344
|
+
// Store file path and cache retrieval URL in dictionary
|
7345
|
+
this.serverFilesToClientFiles.set(fileName, fileUrl);
|
7346
|
+
}
|
7347
|
+
endContext = xmlData.indexOf(XMLConstants.TAG_OPEN, endContext);
|
7348
|
+
if (endContext === -1) {
|
7349
|
+
endContext = xmlData.length;
|
7350
|
+
}
|
7351
|
+
parser.setCurrIndex(endContext);
|
7352
|
+
}
|
7353
|
+
}
|
7282
7354
|
// <summary> If any items are stored on local storage clear it now as session cannot continued.
|
7283
7355
|
// Clearing only the local storage items which are stored by magic library.
|
7284
7356
|
clearLocalStorage() {
|
@@ -7296,30 +7368,28 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7296
7368
|
/// an xml/html error</summary>
|
7297
7369
|
/// <param name="response"></param>
|
7298
7370
|
HandleErrorResponse(response) {
|
7299
|
-
|
7300
|
-
response = this.ArrayBufferToString(response);
|
7371
|
+
let responseStr = this.ArrayBufferToString(response);
|
7301
7372
|
try {
|
7302
7373
|
// 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(
|
7374
|
+
Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + responseStr);
|
7375
|
+
responseStr = CommandsProcessorBase.UnScramble(responseStr);
|
7376
|
+
Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + StrUtil.getConsoleErorString(responseStr));
|
7306
7377
|
}
|
7307
7378
|
catch (ex) {
|
7308
7379
|
}
|
7309
|
-
if (
|
7310
|
-
let errorMessageXml = new ErrorMessageXml(
|
7380
|
+
if (responseStr.startsWith("<xmlerr")) {
|
7381
|
+
let errorMessageXml = new ErrorMessageXml(responseStr, this._lastRequestTime, AccessHelper.environment.getContextInactivityTimeout());
|
7311
7382
|
throw new ServerError(errorMessageXml.GetMessage(), errorMessageXml.GetCode());
|
7312
7383
|
}
|
7313
|
-
else if (
|
7314
|
-
throw new ServerError(
|
7384
|
+
else if (responseStr.toUpperCase().startsWith("<HTML")) {
|
7385
|
+
throw new ServerError(responseStr);
|
7315
7386
|
}
|
7316
7387
|
}
|
7317
7388
|
// <summary>
|
7318
7389
|
// Converts an ArrayBuffer to a UTF-8 encoded string.
|
7319
7390
|
// </summary>
|
7320
7391
|
ArrayBufferToString(arrayBuffer) {
|
7321
|
-
|
7322
|
-
return decoder.decode(arrayBuffer);
|
7392
|
+
return Encoding.UTF8.GetString(new Uint8Array(arrayBuffer), 0, arrayBuffer.byteLength);
|
7323
7393
|
}
|
7324
7394
|
/// <summary>send 'encodedBody' to 'url' and receive a response.
|
7325
7395
|
/// </summary>
|
@@ -7327,29 +7397,36 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7327
7397
|
/// <param name="encodedBody">In case of POST, content to be sent to server. For other methods, null.</param>
|
7328
7398
|
/// <returns>the response from the server</returns>
|
7329
7399
|
async ExecuteRequest(url, encodedBody) {
|
7330
|
-
|
7331
|
-
|
7400
|
+
return await this.GetContentAsString(url, false, encodedBody);
|
7401
|
+
}
|
7402
|
+
async GetContentAsString(requestedURL, useCache, requestContent, requestContentType) {
|
7403
|
+
let response = await this.GetContent(requestedURL, useCache, requestContent, requestContentType);
|
7404
|
+
return this.ArrayBufferToString(response);
|
7332
7405
|
}
|
7333
7406
|
async GetContent(requestedURL, useCache, requestContent, requestContentType) {
|
7334
7407
|
if (isUndefined(requestContent))
|
7335
7408
|
requestContent = null;
|
7336
7409
|
if (isUndefined(requestContentType))
|
7337
7410
|
requestContentType = null;
|
7338
|
-
let
|
7411
|
+
let response;
|
7339
7412
|
try {
|
7340
7413
|
// if relative, prefix with the 'protocol://server/' from which the rich-client was activated
|
7341
7414
|
if (requestedURL.startsWith("/"))
|
7342
7415
|
requestedURL = ServerConfig.Instance.getProtocol() + "://" + ServerConfig.Instance.getServer() + requestedURL;
|
7416
|
+
else if (requestedURL.startsWith("?")) {
|
7417
|
+
requestedURL = this.ServerUrl + requestedURL;
|
7418
|
+
requestedURL = this.validateURL(requestedURL, this._sessionCounter, this.SessionId);
|
7419
|
+
}
|
7343
7420
|
var spinnerTimer = timer(50, 50);
|
7344
7421
|
var spinnerTimerSubscription = spinnerTimer.subscribe(() => {
|
7345
7422
|
AccessHelper.eventsManager.CheckAndShowSpinner(true);
|
7346
7423
|
});
|
7347
7424
|
let isError = new RefParam(false);
|
7348
|
-
|
7425
|
+
response = await HttpManager.GetInstance().GetContent(requestedURL, requestContent, requestContentType, useCache, isError);
|
7349
7426
|
spinnerTimerSubscription.unsubscribe();
|
7350
7427
|
spinnerTimerSubscription = null;
|
7351
7428
|
if (isError.value) {
|
7352
|
-
this.HandleErrorResponse(
|
7429
|
+
this.HandleErrorResponse(response);
|
7353
7430
|
}
|
7354
7431
|
}
|
7355
7432
|
catch (ex) {
|
@@ -7367,7 +7444,75 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7367
7444
|
if (spinnerTimerSubscription != null)
|
7368
7445
|
spinnerTimerSubscription.unsubscribe();
|
7369
7446
|
}
|
7370
|
-
return
|
7447
|
+
return response;
|
7448
|
+
}
|
7449
|
+
validateURL(url, sessionCounter, sessionId) {
|
7450
|
+
// const utf8Encoding = 'utf-8'; // UTF-8 encoding is used in the context of web APIs, but not directly needed in JavaScript/TypeScript
|
7451
|
+
// Create URL object from string
|
7452
|
+
const u = new URL(url);
|
7453
|
+
// Assert protocol (http, https, or file)
|
7454
|
+
if (!(u.protocol === "http:" || u.protocol === "https:" || u.protocol === "file:")) {
|
7455
|
+
throw new Error("Invalid protocol. Expected http, https, or file.");
|
7456
|
+
}
|
7457
|
+
// Add protocol as is
|
7458
|
+
let validURL = u.protocol + "//";
|
7459
|
+
// Encode host
|
7460
|
+
validURL += encodeURIComponent(u.hostname);
|
7461
|
+
// If port is specified, append it
|
7462
|
+
const port = u.port;
|
7463
|
+
if (port) {
|
7464
|
+
validURL += `:${port}`;
|
7465
|
+
}
|
7466
|
+
// Get path (e.g., alias/dir1/dir2/file)
|
7467
|
+
let path = u.pathname;
|
7468
|
+
if (!path.startsWith("/")) {
|
7469
|
+
validURL += "/";
|
7470
|
+
}
|
7471
|
+
// Tokenize the path and encode each part
|
7472
|
+
const pathParts = path.split("/");
|
7473
|
+
// Recompose the URL (path is already encoded by `encodeURIComponent`)
|
7474
|
+
for (let i = 0; i < pathParts.length; i++) {
|
7475
|
+
validURL += encodeURIComponent(pathParts[i]) + "/";
|
7476
|
+
}
|
7477
|
+
// Remove last "/"
|
7478
|
+
if (validURL.endsWith("/")) {
|
7479
|
+
validURL = validURL.slice(0, validURL.length - 1);
|
7480
|
+
}
|
7481
|
+
// Replace "+" with "%20" (standard for spaces in URLs)
|
7482
|
+
validURL = validURL.replace(/\+/g, "%20");
|
7483
|
+
// Add the query string
|
7484
|
+
if (u.search) {
|
7485
|
+
let modifiedQuery = u.search;
|
7486
|
+
const CTX_ID_PLACEHOLDER = "CTX=&";
|
7487
|
+
const ctxIdIdx = u.search.indexOf(CTX_ID_PLACEHOLDER);
|
7488
|
+
if (ctxIdIdx > -1) {
|
7489
|
+
// Add context ID
|
7490
|
+
// const queryString = `${ClientManager.Instance.RuntimeCtx.ContextID}`;
|
7491
|
+
// Append session ID if provided
|
7492
|
+
let queryParams = `${ClientManager.Instance.GetRuntimeCtxID()}`;
|
7493
|
+
if (sessionId) {
|
7494
|
+
queryParams += `&${ConstInterface.RC_TOKEN_SESSION_ID}=${sessionId}`;
|
7495
|
+
}
|
7496
|
+
queryParams += `&${ConstInterface.RC_TOKEN_SESSION_COUNT}${sessionCounter}`;
|
7497
|
+
// Insert query parameters in the query string
|
7498
|
+
modifiedQuery = u.search.substring(0, ctxIdIdx + CTX_ID_PLACEHOLDER.length - 1) + queryParams + u.search.substring(ctxIdIdx + CTX_ID_PLACEHOLDER.length - 1);
|
7499
|
+
// modifiedQuery is updated with file name with base64 encoded.
|
7500
|
+
let indexOfCacheToken = modifiedQuery.indexOf(ConstInterface.RC_TOKEN_CACHED_FILE);
|
7501
|
+
if (indexOfCacheToken !== -1) {
|
7502
|
+
let url = modifiedQuery;
|
7503
|
+
const cacheRegex = /CACHE=([^&]+)/;
|
7504
|
+
const match = url.match(cacheRegex);
|
7505
|
+
if (match && match[1]) {
|
7506
|
+
const cacheFileName = match[1].split('|')[0];
|
7507
|
+
const base64CacheFileName = btoa(cacheFileName);
|
7508
|
+
modifiedQuery = url.replace(`CACHE=${match[1]}`, `CACHE=${base64CacheFileName}`);
|
7509
|
+
}
|
7510
|
+
}
|
7511
|
+
}
|
7512
|
+
validURL += modifiedQuery;
|
7513
|
+
validURL = validURL.replace(/\|/g, "%7C");
|
7514
|
+
}
|
7515
|
+
return validURL;
|
7371
7516
|
}
|
7372
7517
|
// <summary> Upload contents to a file on server </summary>
|
7373
7518
|
// <param name="serverFileName">filename to be saved on the server.</param>
|
@@ -7383,11 +7528,8 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7383
7528
|
queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_TARGET_FILE}${encodedName}`;
|
7384
7529
|
const url = ServerConfig.Instance.getServerURL() + queryStr;
|
7385
7530
|
let response = await this.GetContent(url, false, fileContent, contentType);
|
7386
|
-
|
7387
|
-
|
7388
|
-
return uInt8Array[0];
|
7389
|
-
}
|
7390
|
-
return response;
|
7531
|
+
let uInt8Array = new Uint8Array(response);
|
7532
|
+
return uInt8Array[0];
|
7391
7533
|
}
|
7392
7534
|
ClientActivated() {
|
7393
7535
|
// log the values as client is active again
|
@@ -8032,8 +8174,15 @@ class CommandsProcessorManager {
|
|
8032
8174
|
/// <param name="requestedURL"></param>
|
8033
8175
|
/// <returns></returns>
|
8034
8176
|
static async GetContent(requestedURL, useCache) {
|
8035
|
-
|
8036
|
-
|
8177
|
+
return await (CommandsProcessorManager.GetCommandsProcessor().GetContent(requestedURL, useCache));
|
8178
|
+
}
|
8179
|
+
/// <summary>
|
8180
|
+
/// get the URL content according to the active commands processor
|
8181
|
+
/// </summary>
|
8182
|
+
/// <param name="requestedURL"></param>
|
8183
|
+
/// <returns></returns>
|
8184
|
+
static async GetContentString(requestedURL, useCache) {
|
8185
|
+
return await (CommandsProcessorManager.GetCommandsProcessor().GetContentAsString(requestedURL, useCache));
|
8037
8186
|
}
|
8038
8187
|
/// <summary>
|
8039
8188
|
/// Start session
|
@@ -8187,7 +8336,7 @@ class LanguageData {
|
|
8187
8336
|
if (this._constMessagesUrl != null) {
|
8188
8337
|
try {
|
8189
8338
|
// get the content from the server
|
8190
|
-
msgsInCommentString = await CommandsProcessorManager.
|
8339
|
+
msgsInCommentString = await CommandsProcessorManager.GetContentString(this._constMessagesUrl, true);
|
8191
8340
|
}
|
8192
8341
|
catch (err) {
|
8193
8342
|
Logger.Instance.WriteExceptionToLogWithMsg(NString.Format("Unknown message file: \"{0}\"", this._constMessagesUrl));
|
@@ -8198,7 +8347,6 @@ class LanguageData {
|
|
8198
8347
|
msgsInCommentString = this._constMessagesContent;
|
8199
8348
|
}
|
8200
8349
|
if (msgsInCommentString != null) {
|
8201
|
-
msgsInCommentString = msgsInCommentString instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(msgsInCommentString) : msgsInCommentString;
|
8202
8350
|
// ignore the comment wrapper
|
8203
8351
|
let startData = msgsInCommentString.indexOf(START_TAG);
|
8204
8352
|
let endData = msgsInCommentString.indexOf(END_TAG) + END_TAG.length;
|
@@ -8288,9 +8436,9 @@ class LanguageData {
|
|
8288
8436
|
else if (this._mlsFileUrl != null) {
|
8289
8437
|
if (this._mlsFileUrl.startsWith("./"))
|
8290
8438
|
this._mlsFileUrl = NString.Replace(this._mlsFileUrl, './', ClientManager.GetAssetsURL() + '/cache/');
|
8291
|
-
let
|
8292
|
-
|
8293
|
-
|
8439
|
+
let arrayBuffer = await CommandsProcessorManager.GetContent(this._mlsFileUrl, true);
|
8440
|
+
if (arrayBuffer != null && arrayBuffer.byteLength > 0) {
|
8441
|
+
let buffer = Encoding.Unicode.GetString(new Uint8Array(arrayBuffer), 0, arrayBuffer.byteLength);
|
8294
8442
|
let contentLen = buffer.length;
|
8295
8443
|
this._mlsStrings = new Hashtable();
|
8296
8444
|
// read the last line
|
@@ -10414,6 +10562,24 @@ class ControlItemsRefreshCommand extends DataviewCommand {
|
|
10414
10562
|
}
|
10415
10563
|
}
|
10416
10564
|
|
10565
|
+
class CachedFileQueryCommand extends QueryCommand {
|
10566
|
+
text;
|
10567
|
+
constructor(text) {
|
10568
|
+
super();
|
10569
|
+
this.text = text;
|
10570
|
+
}
|
10571
|
+
/**
|
10572
|
+
* Serializes the query command data
|
10573
|
+
*/
|
10574
|
+
SerializeQueryCommandData() {
|
10575
|
+
let message = ConstInterface.MG_ATTR_VAL_QUERY_CACHED_FILE + '"';
|
10576
|
+
let helper = new CommandSerializationHelper();
|
10577
|
+
helper.SerializeAttribute(ConstInterface.MG_ATTR_FILE_PATH, this.text);
|
10578
|
+
message += helper.GetString();
|
10579
|
+
return message;
|
10580
|
+
}
|
10581
|
+
}
|
10582
|
+
|
10417
10583
|
/// <summary>
|
10418
10584
|
/// factory class for creating commands
|
10419
10585
|
/// </summary>
|
@@ -10810,6 +10976,9 @@ class CommandFactory {
|
|
10810
10976
|
iniputForceWriteCommand.Text = param;
|
10811
10977
|
return iniputForceWriteCommand;
|
10812
10978
|
}
|
10979
|
+
static CreateQueryCachedFileCommand(cachedFileName) {
|
10980
|
+
return new CachedFileQueryCommand(cachedFileName);
|
10981
|
+
}
|
10813
10982
|
}
|
10814
10983
|
|
10815
10984
|
var ParamParseResult;
|
@@ -11306,13 +11475,12 @@ class Environment {
|
|
11306
11475
|
// in which case the current error message will be matched with an error in the xpa server's log file (GeneralErrorLog=)).
|
11307
11476
|
Logger.Instance.WriteErrorToLog(NString.Format("Empty cached file URL: '{0}'", tagAndAttributes.trim()));
|
11308
11477
|
else {
|
11309
|
-
let Content = await CommandsProcessorManager.
|
11478
|
+
let Content = await CommandsProcessorManager.GetContentString(cachedFileUrl, true);
|
11310
11479
|
try {
|
11311
11480
|
switch (tagName) {
|
11312
11481
|
case ConstInterface.MG_TAG_KBDMAP_URL:
|
11313
11482
|
break;
|
11314
11483
|
case ConstInterface.MG_TAG_ENV_PARAM_URL:
|
11315
|
-
Content = Content instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(Content) : Content;
|
11316
11484
|
let innerXmlParser = new XmlParser(Content);
|
11317
11485
|
while (AccessHelper.envParamsTable.mirrorFromXML(innerXmlParser.getNextTag(), innerXmlParser)) {
|
11318
11486
|
}
|
@@ -27202,9 +27370,8 @@ class TableCacheManager {
|
|
27202
27370
|
// get the table
|
27203
27371
|
let current = this._tables.get_Item(tableUId);
|
27204
27372
|
try {
|
27205
|
-
let residentTableContentStr = await server.
|
27373
|
+
let residentTableContentStr = await server.GetContentAsString(tableUId, true);
|
27206
27374
|
try {
|
27207
|
-
residentTableContentStr = residentTableContentStr instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(residentTableContentStr) : residentTableContentStr;
|
27208
27375
|
RuntimeContextBase.Instance.Parser.loadTableCacheData(residentTableContentStr);
|
27209
27376
|
}
|
27210
27377
|
catch (innerException) {
|
@@ -32839,8 +33006,7 @@ class Task extends TaskBase {
|
|
32839
33006
|
// bring the data
|
32840
33007
|
if (taskCacheURL.startsWith("./"))
|
32841
33008
|
taskCacheURL = NString.Replace(taskCacheURL, './', ClientManager.GetAssetsURL() + '/cache/');
|
32842
|
-
taskContentOriginal = await Task.CommandsProcessor.
|
32843
|
-
taskContentOriginal = taskContentOriginal instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(taskContentOriginal) : taskContentOriginal;
|
33009
|
+
taskContentOriginal = await Task.CommandsProcessor.GetContentAsString(taskCacheURL, true);
|
32844
33010
|
}
|
32845
33011
|
// prefix the original data till the start of the current <taskURL>
|
32846
33012
|
let taskContentFinal = new StringBuilder(xmlData.substr(0, RuntimeContextBase.Instance.Parser.getCurrIndex() - (ConstInterface.MG_TAG_TASKURL.length + 1)), taskContentOriginal.length);
|
@@ -33358,6 +33524,9 @@ class MGData {
|
|
33358
33524
|
Logger.Instance.WriteDevToLog("processing base64 encoded image of all global params from the server");
|
33359
33525
|
this.fillGlobalParams(parser);
|
33360
33526
|
break;
|
33527
|
+
case ConstInterface.MG_TAG_CACHED_FILE:
|
33528
|
+
RemoteCommandsProcessor.GetInstance().fillCacheFilesMap(parser);
|
33529
|
+
break;
|
33361
33530
|
case ConstInterface.MG_TAG_ENV_PARAM_URL:
|
33362
33531
|
Logger.Instance.WriteDevToLog("goes to env params name ");
|
33363
33532
|
await Environment.Instance.fillFromUrl(foundTagName, parser);
|
@@ -39338,7 +39507,7 @@ class CommandsTable {
|
|
39338
39507
|
}
|
39339
39508
|
}
|
39340
39509
|
|
39341
|
-
let CurrentClientVersion = '4.1200.0-
|
39510
|
+
let CurrentClientVersion = '4.1200.0-ec.131.0';
|
39342
39511
|
|
39343
39512
|
// @dynamic
|
39344
39513
|
class ClientManager {
|
@@ -39692,13 +39861,8 @@ class ClientManager {
|
|
39692
39861
|
// isError cannot be true here, because it is returned by runtime engine and to read execution properties, we do not reach the engine.
|
39693
39862
|
let isError = new RefParam(false);
|
39694
39863
|
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
|
-
}
|
39864
|
+
const responseStr = Encoding.UTF8.GetString((new Uint8Array(response)), 0, response.byteLength);
|
39865
|
+
ServerConfig.Instance.Init(JSON.parse(responseStr));
|
39702
39866
|
let assetsURL = ServerConfig.Instance.getAssetsURL();
|
39703
39867
|
if (assetsURL !== null) {
|
39704
39868
|
ClientManager.assetsURL = assetsURL;
|
@@ -39735,6 +39899,9 @@ class ClientManager {
|
|
39735
39899
|
static UploadFileToServer(fileContent, serverFileName) {
|
39736
39900
|
return RemoteCommandsProcessor.GetInstance().UploadFileToServer(fileContent, serverFileName);
|
39737
39901
|
}
|
39902
|
+
static async DownloadFileFromServer(serverFileName) {
|
39903
|
+
return await RemoteCommandsProcessor.GetInstance().DownloadFileFromServer(serverFileName);
|
39904
|
+
}
|
39738
39905
|
/// <summary>
|
39739
39906
|
/// Get formatted value
|
39740
39907
|
/// </summary>
|
@@ -39885,6 +40052,9 @@ class MagicBridge {
|
|
39885
40052
|
static UploadFileToServer(fileContent, serverFileName) {
|
39886
40053
|
return ClientManager.UploadFileToServer(fileContent, serverFileName);
|
39887
40054
|
}
|
40055
|
+
static async DownloadFileFromServer(serverFileName) {
|
40056
|
+
return await ClientManager.DownloadFileFromServer(serverFileName);
|
40057
|
+
}
|
39888
40058
|
static GetFormattedValue(taskId, controlName, value, rowId) {
|
39889
40059
|
return ClientManager.GetFormattedValue(taskId, controlName, value, rowId);
|
39890
40060
|
}
|
@@ -39951,5 +40121,5 @@ class DataSourceIdKey {
|
|
39951
40121
|
* Generated bundle index. Do not edit.
|
39952
40122
|
*/
|
39953
40123
|
|
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 };
|
40124
|
+
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
40125
|
//# sourceMappingURL=magic-xpa-engine.mjs.map
|