@magic-xpa/engine 4.1200.0-dev4120.112 → 4.1200.0-dev4120.113
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 +206 -51
- 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 +1 -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
|
}
|
@@ -5934,9 +5940,12 @@ class HttpManager {
|
|
5934
5940
|
/// otherwise - null (indicating that the 'http Response' didn't contain an error).</returns>
|
5935
5941
|
static CheckAndGetErrorResponse(httpResponse) {
|
5936
5942
|
let errorResponse = null;
|
5937
|
-
|
5938
|
-
if (
|
5939
|
-
|
5943
|
+
const buffer = Encoding.UTF8.GetString(new Uint8Array(httpResponse), 0, httpResponse.byteLength);
|
5944
|
+
if (buffer.startsWith(ConstInterface.V24_RIA_ERROR_PREFIX)) {
|
5945
|
+
const errorResponseStr = buffer.substr(ConstInterface.V24_RIA_ERROR_PREFIX.length);
|
5946
|
+
const errorResponseBytes = Encoding.UTF8.GetBytes(errorResponseStr);
|
5947
|
+
errorResponse = errorResponseBytes.buffer;
|
5948
|
+
}
|
5940
5949
|
return errorResponse;
|
5941
5950
|
}
|
5942
5951
|
static LogAccessToServer(msg, requestContent) {
|
@@ -5944,7 +5953,6 @@ class HttpManager {
|
|
5944
5953
|
if (!NString.IsNullOrEmpty(msg)) {
|
5945
5954
|
msg = msg + "; accessing server ...";
|
5946
5955
|
}
|
5947
|
-
requestContent = requestContent instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(requestContent) : requestContent;
|
5948
5956
|
if (requestContent === null) {
|
5949
5957
|
if (!NString.IsNullOrEmpty(msg)) {
|
5950
5958
|
Logger.Instance.WriteServerToLog(msg);
|
@@ -5954,11 +5962,24 @@ class HttpManager {
|
|
5954
5962
|
if (!NString.IsNullOrEmpty(msg)) {
|
5955
5963
|
msg = msg + " ";
|
5956
5964
|
}
|
5957
|
-
msg = msg + "uploading " + requestContent
|
5965
|
+
msg = msg + "uploading " + HttpManager.GetRequestContentLength(requestContent) + " bytes";
|
5958
5966
|
Logger.Instance.WriteServerToLog(msg);
|
5959
5967
|
}
|
5960
5968
|
}
|
5961
5969
|
}
|
5970
|
+
/// <summary>
|
5971
|
+
/// <returns>the length of 'requestContent'.</returns>
|
5972
|
+
/// <summary>
|
5973
|
+
static GetRequestContentLength(requestContent) {
|
5974
|
+
let length = 0;
|
5975
|
+
if (requestContent instanceof ArrayBuffer) {
|
5976
|
+
length = requestContent.byteLength;
|
5977
|
+
}
|
5978
|
+
else {
|
5979
|
+
length = requestContent.length;
|
5980
|
+
}
|
5981
|
+
return length;
|
5982
|
+
}
|
5962
5983
|
}
|
5963
5984
|
|
5964
5985
|
class ServerConfig {
|
@@ -6614,6 +6635,12 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
6614
6635
|
SessionId;
|
6615
6636
|
DelayCommandExecution = false;
|
6616
6637
|
_requestInfo = new RequestInfo();
|
6638
|
+
// After the expression is evaluated, we obtain local file path. But to fetch this resource from server,
|
6639
|
+
// cache path is needed. If cache path isn't found in cachedFilesMap, then query server for cachedFile.
|
6640
|
+
// Later again if the expression is evaluated to the same path, no need to query server for cache path.
|
6641
|
+
// e.g. for server-file path = "C:\\Blue_hills.jpg"
|
6642
|
+
// cache path = "/MagicScripts/mgrqispi.dll?CTX=10430335172368&CACHE=agent_3572_C__Blue_hills.jpg|06/10/2009%2016:36:16"
|
6643
|
+
serverFilesToClientFiles = new Map(); // Map between server-file path and cachedFileUrl
|
6617
6644
|
static GetInstance() {
|
6618
6645
|
if (RemoteCommandsProcessor._instance === null) {
|
6619
6646
|
RemoteCommandsProcessor._instance = new RemoteCommandsProcessor();
|
@@ -7279,6 +7306,45 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7279
7306
|
}
|
7280
7307
|
return response;
|
7281
7308
|
}
|
7309
|
+
async DownloadFileFromServer(serverFileName) {
|
7310
|
+
let fileContent = new ArrayBuffer(0);
|
7311
|
+
let cmd = CommandFactory.CreateQueryCachedFileCommand(serverFileName);
|
7312
|
+
AccessHelper.mgDataTable.getCurrMGData().CmdsToServer.Add(cmd);
|
7313
|
+
this.serverFilesToClientFiles.delete(serverFileName);
|
7314
|
+
await this.Execute(CommandsProcessorBase_SendingInstruction.ONLY_COMMANDS);
|
7315
|
+
//Check what url value is getting in the below line.(file path or the url starts with ?)
|
7316
|
+
let serverCachedFilePath = this.serverFilesToClientFiles.has(serverFileName) ? this.serverFilesToClientFiles.get(serverFileName) : null;
|
7317
|
+
if (serverCachedFilePath) {
|
7318
|
+
// let url: string = serverCachedFilePath;
|
7319
|
+
fileContent = await this.GetContent(serverCachedFilePath, false);
|
7320
|
+
}
|
7321
|
+
return fileContent;
|
7322
|
+
}
|
7323
|
+
fillCacheFilesMap(parser) {
|
7324
|
+
const xmlData = parser.getXMLdata();
|
7325
|
+
let endContext = xmlData.indexOf(XMLConstants.TAG_TERM, parser.getCurrIndex());
|
7326
|
+
if (endContext !== -1 && endContext < xmlData.length) {
|
7327
|
+
// Find last position of its tag
|
7328
|
+
const tag = parser.getXMLsubstring(endContext);
|
7329
|
+
parser.add2CurrIndex(tag.indexOf(ConstInterface.MG_TAG_CACHED_FILE) + ConstInterface.MG_TAG_CACHED_FILE.length);
|
7330
|
+
const tokensVector = XmlParser.getTokens(parser.getXMLsubstring(endContext), XMLConstants.XML_ATTR_DELIM);
|
7331
|
+
// Verify token names
|
7332
|
+
console.assert(tokensVector[0] === ConstInterface.MG_ATTR_FILE_PATH, 'Invalid token for file path');
|
7333
|
+
console.assert(tokensVector[2] === ConstInterface.MG_ATTR_CACHE_URL, 'Invalid token for cache URL');
|
7334
|
+
// Get token values
|
7335
|
+
const fileName = tokensVector[1];
|
7336
|
+
const fileUrl = tokensVector[3];
|
7337
|
+
if (fileUrl.trim() !== '') {
|
7338
|
+
// Store file path and cache retrieval URL in dictionary
|
7339
|
+
this.serverFilesToClientFiles.set(fileName, fileUrl);
|
7340
|
+
}
|
7341
|
+
endContext = xmlData.indexOf(XMLConstants.TAG_OPEN, endContext);
|
7342
|
+
if (endContext === -1) {
|
7343
|
+
endContext = xmlData.length;
|
7344
|
+
}
|
7345
|
+
parser.setCurrIndex(endContext);
|
7346
|
+
}
|
7347
|
+
}
|
7282
7348
|
// <summary> If any items are stored on local storage clear it now as session cannot continued.
|
7283
7349
|
// Clearing only the local storage items which are stored by magic library.
|
7284
7350
|
clearLocalStorage() {
|
@@ -7296,30 +7362,28 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7296
7362
|
/// an xml/html error</summary>
|
7297
7363
|
/// <param name="response"></param>
|
7298
7364
|
HandleErrorResponse(response) {
|
7299
|
-
|
7300
|
-
response = this.ArrayBufferToString(response);
|
7365
|
+
let responseStr = this.ArrayBufferToString(response);
|
7301
7366
|
try {
|
7302
7367
|
// 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(
|
7368
|
+
Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + responseStr);
|
7369
|
+
responseStr = CommandsProcessorBase.UnScramble(responseStr);
|
7370
|
+
Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + StrUtil.getConsoleErorString(responseStr));
|
7306
7371
|
}
|
7307
7372
|
catch (ex) {
|
7308
7373
|
}
|
7309
|
-
if (
|
7310
|
-
let errorMessageXml = new ErrorMessageXml(
|
7374
|
+
if (responseStr.startsWith("<xmlerr")) {
|
7375
|
+
let errorMessageXml = new ErrorMessageXml(responseStr, this._lastRequestTime, AccessHelper.environment.getContextInactivityTimeout());
|
7311
7376
|
throw new ServerError(errorMessageXml.GetMessage(), errorMessageXml.GetCode());
|
7312
7377
|
}
|
7313
|
-
else if (
|
7314
|
-
throw new ServerError(
|
7378
|
+
else if (responseStr.toUpperCase().startsWith("<HTML")) {
|
7379
|
+
throw new ServerError(responseStr);
|
7315
7380
|
}
|
7316
7381
|
}
|
7317
7382
|
// <summary>
|
7318
7383
|
// Converts an ArrayBuffer to a UTF-8 encoded string.
|
7319
7384
|
// </summary>
|
7320
7385
|
ArrayBufferToString(arrayBuffer) {
|
7321
|
-
|
7322
|
-
return decoder.decode(arrayBuffer);
|
7386
|
+
return Encoding.UTF8.GetString(new Uint8Array(arrayBuffer), 0, arrayBuffer.byteLength);
|
7323
7387
|
}
|
7324
7388
|
/// <summary>send 'encodedBody' to 'url' and receive a response.
|
7325
7389
|
/// </summary>
|
@@ -7327,29 +7391,36 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7327
7391
|
/// <param name="encodedBody">In case of POST, content to be sent to server. For other methods, null.</param>
|
7328
7392
|
/// <returns>the response from the server</returns>
|
7329
7393
|
async ExecuteRequest(url, encodedBody) {
|
7330
|
-
|
7331
|
-
|
7394
|
+
return await this.GetContentAsString(url, false, encodedBody);
|
7395
|
+
}
|
7396
|
+
async GetContentAsString(requestedURL, useCache, requestContent, requestContentType) {
|
7397
|
+
let response = await this.GetContent(requestedURL, useCache, requestContent, requestContentType);
|
7398
|
+
return this.ArrayBufferToString(response);
|
7332
7399
|
}
|
7333
7400
|
async GetContent(requestedURL, useCache, requestContent, requestContentType) {
|
7334
7401
|
if (isUndefined(requestContent))
|
7335
7402
|
requestContent = null;
|
7336
7403
|
if (isUndefined(requestContentType))
|
7337
7404
|
requestContentType = null;
|
7338
|
-
let
|
7405
|
+
let response;
|
7339
7406
|
try {
|
7340
7407
|
// if relative, prefix with the 'protocol://server/' from which the rich-client was activated
|
7341
7408
|
if (requestedURL.startsWith("/"))
|
7342
7409
|
requestedURL = ServerConfig.Instance.getProtocol() + "://" + ServerConfig.Instance.getServer() + requestedURL;
|
7410
|
+
else if (requestedURL.startsWith("?")) {
|
7411
|
+
requestedURL = this.ServerUrl + requestedURL;
|
7412
|
+
requestedURL = this.validateURL(requestedURL, this._sessionCounter, this.SessionId);
|
7413
|
+
}
|
7343
7414
|
var spinnerTimer = timer(50, 50);
|
7344
7415
|
var spinnerTimerSubscription = spinnerTimer.subscribe(() => {
|
7345
7416
|
AccessHelper.eventsManager.CheckAndShowSpinner(true);
|
7346
7417
|
});
|
7347
7418
|
let isError = new RefParam(false);
|
7348
|
-
|
7419
|
+
response = await HttpManager.GetInstance().GetContent(requestedURL, requestContent, requestContentType, useCache, isError);
|
7349
7420
|
spinnerTimerSubscription.unsubscribe();
|
7350
7421
|
spinnerTimerSubscription = null;
|
7351
7422
|
if (isError.value) {
|
7352
|
-
this.HandleErrorResponse(
|
7423
|
+
this.HandleErrorResponse(response);
|
7353
7424
|
}
|
7354
7425
|
}
|
7355
7426
|
catch (ex) {
|
@@ -7367,7 +7438,75 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7367
7438
|
if (spinnerTimerSubscription != null)
|
7368
7439
|
spinnerTimerSubscription.unsubscribe();
|
7369
7440
|
}
|
7370
|
-
return
|
7441
|
+
return response;
|
7442
|
+
}
|
7443
|
+
validateURL(url, sessionCounter, sessionId) {
|
7444
|
+
// const utf8Encoding = 'utf-8'; // UTF-8 encoding is used in the context of web APIs, but not directly needed in JavaScript/TypeScript
|
7445
|
+
// Create URL object from string
|
7446
|
+
const u = new URL(url);
|
7447
|
+
// Assert protocol (http, https, or file)
|
7448
|
+
if (!(u.protocol === "http:" || u.protocol === "https:" || u.protocol === "file:")) {
|
7449
|
+
throw new Error("Invalid protocol. Expected http, https, or file.");
|
7450
|
+
}
|
7451
|
+
// Add protocol as is
|
7452
|
+
let validURL = u.protocol + "//";
|
7453
|
+
// Encode host
|
7454
|
+
validURL += encodeURIComponent(u.hostname);
|
7455
|
+
// If port is specified, append it
|
7456
|
+
const port = u.port;
|
7457
|
+
if (port) {
|
7458
|
+
validURL += `:${port}`;
|
7459
|
+
}
|
7460
|
+
// Get path (e.g., alias/dir1/dir2/file)
|
7461
|
+
let path = u.pathname;
|
7462
|
+
if (!path.startsWith("/")) {
|
7463
|
+
validURL += "/";
|
7464
|
+
}
|
7465
|
+
// Tokenize the path and encode each part
|
7466
|
+
const pathParts = path.split("/");
|
7467
|
+
// Recompose the URL (path is already encoded by `encodeURIComponent`)
|
7468
|
+
for (let i = 0; i < pathParts.length; i++) {
|
7469
|
+
validURL += encodeURIComponent(pathParts[i]) + "/";
|
7470
|
+
}
|
7471
|
+
// Remove last "/"
|
7472
|
+
if (validURL.endsWith("/")) {
|
7473
|
+
validURL = validURL.slice(0, validURL.length - 1);
|
7474
|
+
}
|
7475
|
+
// Replace "+" with "%20" (standard for spaces in URLs)
|
7476
|
+
validURL = validURL.replace(/\+/g, "%20");
|
7477
|
+
// Add the query string
|
7478
|
+
if (u.search) {
|
7479
|
+
let modifiedQuery = u.search;
|
7480
|
+
const CTX_ID_PLACEHOLDER = "CTX=&";
|
7481
|
+
const ctxIdIdx = u.search.indexOf(CTX_ID_PLACEHOLDER);
|
7482
|
+
if (ctxIdIdx > -1) {
|
7483
|
+
// Add context ID
|
7484
|
+
// const queryString = `${ClientManager.Instance.RuntimeCtx.ContextID}`;
|
7485
|
+
// Append session ID if provided
|
7486
|
+
let queryParams = `${ClientManager.Instance.GetRuntimeCtxID()}`;
|
7487
|
+
if (sessionId) {
|
7488
|
+
queryParams += `&${ConstInterface.RC_TOKEN_SESSION_ID}=${sessionId}`;
|
7489
|
+
}
|
7490
|
+
queryParams += `&${ConstInterface.RC_TOKEN_SESSION_COUNT}${sessionCounter}`;
|
7491
|
+
// Insert query parameters in the query string
|
7492
|
+
modifiedQuery = u.search.substring(0, ctxIdIdx + CTX_ID_PLACEHOLDER.length - 1) + queryParams + u.search.substring(ctxIdIdx + CTX_ID_PLACEHOLDER.length - 1);
|
7493
|
+
// modifiedQuery is updated with file name with base64 encoded.
|
7494
|
+
let indexOfCacheToken = modifiedQuery.indexOf(ConstInterface.RC_TOKEN_CACHED_FILE);
|
7495
|
+
if (indexOfCacheToken !== -1) {
|
7496
|
+
let url = modifiedQuery;
|
7497
|
+
const cacheRegex = /CACHE=([^&]+)/;
|
7498
|
+
const match = url.match(cacheRegex);
|
7499
|
+
if (match && match[1]) {
|
7500
|
+
const cacheFileName = match[1].split('|')[0];
|
7501
|
+
const base64CacheFileName = btoa(cacheFileName);
|
7502
|
+
modifiedQuery = url.replace(`CACHE=${match[1]}`, `CACHE=${base64CacheFileName}`);
|
7503
|
+
}
|
7504
|
+
}
|
7505
|
+
}
|
7506
|
+
validURL += modifiedQuery;
|
7507
|
+
validURL = validURL.replace(/\|/g, "%7C");
|
7508
|
+
}
|
7509
|
+
return validURL;
|
7371
7510
|
}
|
7372
7511
|
// <summary> Upload contents to a file on server </summary>
|
7373
7512
|
// <param name="serverFileName">filename to be saved on the server.</param>
|
@@ -7383,11 +7522,8 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
7383
7522
|
queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_TARGET_FILE}${encodedName}`;
|
7384
7523
|
const url = ServerConfig.Instance.getServerURL() + queryStr;
|
7385
7524
|
let response = await this.GetContent(url, false, fileContent, contentType);
|
7386
|
-
|
7387
|
-
|
7388
|
-
return uInt8Array[0];
|
7389
|
-
}
|
7390
|
-
return response;
|
7525
|
+
let uInt8Array = new Uint8Array(response);
|
7526
|
+
return uInt8Array[0];
|
7391
7527
|
}
|
7392
7528
|
ClientActivated() {
|
7393
7529
|
// log the values as client is active again
|
@@ -8032,8 +8168,7 @@ class CommandsProcessorManager {
|
|
8032
8168
|
/// <param name="requestedURL"></param>
|
8033
8169
|
/// <returns></returns>
|
8034
8170
|
static async GetContent(requestedURL, useCache) {
|
8035
|
-
|
8036
|
-
return ret;
|
8171
|
+
return await (CommandsProcessorManager.GetCommandsProcessor().GetContentAsString(requestedURL, useCache));
|
8037
8172
|
}
|
8038
8173
|
/// <summary>
|
8039
8174
|
/// Start session
|
@@ -8198,7 +8333,6 @@ class LanguageData {
|
|
8198
8333
|
msgsInCommentString = this._constMessagesContent;
|
8199
8334
|
}
|
8200
8335
|
if (msgsInCommentString != null) {
|
8201
|
-
msgsInCommentString = msgsInCommentString instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(msgsInCommentString) : msgsInCommentString;
|
8202
8336
|
// ignore the comment wrapper
|
8203
8337
|
let startData = msgsInCommentString.indexOf(START_TAG);
|
8204
8338
|
let endData = msgsInCommentString.indexOf(END_TAG) + END_TAG.length;
|
@@ -8289,7 +8423,6 @@ class LanguageData {
|
|
8289
8423
|
if (this._mlsFileUrl.startsWith("./"))
|
8290
8424
|
this._mlsFileUrl = NString.Replace(this._mlsFileUrl, './', ClientManager.GetAssetsURL() + '/cache/');
|
8291
8425
|
let buffer = await CommandsProcessorManager.GetContent(this._mlsFileUrl, true);
|
8292
|
-
buffer = buffer instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(buffer) : buffer;
|
8293
8426
|
if (buffer != null && buffer.length > 0) {
|
8294
8427
|
let contentLen = buffer.length;
|
8295
8428
|
this._mlsStrings = new Hashtable();
|
@@ -10414,6 +10547,24 @@ class ControlItemsRefreshCommand extends DataviewCommand {
|
|
10414
10547
|
}
|
10415
10548
|
}
|
10416
10549
|
|
10550
|
+
class CachedFileQueryCommand extends QueryCommand {
|
10551
|
+
text;
|
10552
|
+
constructor(text) {
|
10553
|
+
super();
|
10554
|
+
this.text = text;
|
10555
|
+
}
|
10556
|
+
/**
|
10557
|
+
* Serializes the query command data
|
10558
|
+
*/
|
10559
|
+
SerializeQueryCommandData() {
|
10560
|
+
let message = ConstInterface.MG_ATTR_VAL_QUERY_CACHED_FILE + '"';
|
10561
|
+
let helper = new CommandSerializationHelper();
|
10562
|
+
helper.SerializeAttribute(ConstInterface.MG_ATTR_FILE_PATH, this.text);
|
10563
|
+
message += helper.GetString();
|
10564
|
+
return message;
|
10565
|
+
}
|
10566
|
+
}
|
10567
|
+
|
10417
10568
|
/// <summary>
|
10418
10569
|
/// factory class for creating commands
|
10419
10570
|
/// </summary>
|
@@ -10810,6 +10961,9 @@ class CommandFactory {
|
|
10810
10961
|
iniputForceWriteCommand.Text = param;
|
10811
10962
|
return iniputForceWriteCommand;
|
10812
10963
|
}
|
10964
|
+
static CreateQueryCachedFileCommand(cachedFileName) {
|
10965
|
+
return new CachedFileQueryCommand(cachedFileName);
|
10966
|
+
}
|
10813
10967
|
}
|
10814
10968
|
|
10815
10969
|
var ParamParseResult;
|
@@ -11312,7 +11466,6 @@ class Environment {
|
|
11312
11466
|
case ConstInterface.MG_TAG_KBDMAP_URL:
|
11313
11467
|
break;
|
11314
11468
|
case ConstInterface.MG_TAG_ENV_PARAM_URL:
|
11315
|
-
Content = Content instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(Content) : Content;
|
11316
11469
|
let innerXmlParser = new XmlParser(Content);
|
11317
11470
|
while (AccessHelper.envParamsTable.mirrorFromXML(innerXmlParser.getNextTag(), innerXmlParser)) {
|
11318
11471
|
}
|
@@ -27202,9 +27355,8 @@ class TableCacheManager {
|
|
27202
27355
|
// get the table
|
27203
27356
|
let current = this._tables.get_Item(tableUId);
|
27204
27357
|
try {
|
27205
|
-
let residentTableContentStr = await server.
|
27358
|
+
let residentTableContentStr = await server.GetContentAsString(tableUId, true);
|
27206
27359
|
try {
|
27207
|
-
residentTableContentStr = residentTableContentStr instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(residentTableContentStr) : residentTableContentStr;
|
27208
27360
|
RuntimeContextBase.Instance.Parser.loadTableCacheData(residentTableContentStr);
|
27209
27361
|
}
|
27210
27362
|
catch (innerException) {
|
@@ -32839,8 +32991,7 @@ class Task extends TaskBase {
|
|
32839
32991
|
// bring the data
|
32840
32992
|
if (taskCacheURL.startsWith("./"))
|
32841
32993
|
taskCacheURL = NString.Replace(taskCacheURL, './', ClientManager.GetAssetsURL() + '/cache/');
|
32842
|
-
taskContentOriginal = await Task.CommandsProcessor.
|
32843
|
-
taskContentOriginal = taskContentOriginal instanceof ArrayBuffer ? new TextDecoder('utf-8').decode(taskContentOriginal) : taskContentOriginal;
|
32994
|
+
taskContentOriginal = await Task.CommandsProcessor.GetContentAsString(taskCacheURL, true);
|
32844
32995
|
}
|
32845
32996
|
// prefix the original data till the start of the current <taskURL>
|
32846
32997
|
let taskContentFinal = new StringBuilder(xmlData.substr(0, RuntimeContextBase.Instance.Parser.getCurrIndex() - (ConstInterface.MG_TAG_TASKURL.length + 1)), taskContentOriginal.length);
|
@@ -33358,6 +33509,9 @@ class MGData {
|
|
33358
33509
|
Logger.Instance.WriteDevToLog("processing base64 encoded image of all global params from the server");
|
33359
33510
|
this.fillGlobalParams(parser);
|
33360
33511
|
break;
|
33512
|
+
case ConstInterface.MG_TAG_CACHED_FILE:
|
33513
|
+
RemoteCommandsProcessor.GetInstance().fillCacheFilesMap(parser);
|
33514
|
+
break;
|
33361
33515
|
case ConstInterface.MG_TAG_ENV_PARAM_URL:
|
33362
33516
|
Logger.Instance.WriteDevToLog("goes to env params name ");
|
33363
33517
|
await Environment.Instance.fillFromUrl(foundTagName, parser);
|
@@ -39338,7 +39492,7 @@ class CommandsTable {
|
|
39338
39492
|
}
|
39339
39493
|
}
|
39340
39494
|
|
39341
|
-
let CurrentClientVersion = '4.1200.0-dev4120.
|
39495
|
+
let CurrentClientVersion = '4.1200.0-dev4120.113';
|
39342
39496
|
|
39343
39497
|
// @dynamic
|
39344
39498
|
class ClientManager {
|
@@ -39692,13 +39846,8 @@ class ClientManager {
|
|
39692
39846
|
// isError cannot be true here, because it is returned by runtime engine and to read execution properties, we do not reach the engine.
|
39693
39847
|
let isError = new RefParam(false);
|
39694
39848
|
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
|
-
}
|
39849
|
+
const responseStr = Encoding.UTF8.GetString((new Uint8Array(response)), 0, response.byteLength);
|
39850
|
+
ServerConfig.Instance.Init(JSON.parse(responseStr));
|
39702
39851
|
let assetsURL = ServerConfig.Instance.getAssetsURL();
|
39703
39852
|
if (assetsURL !== null) {
|
39704
39853
|
ClientManager.assetsURL = assetsURL;
|
@@ -39735,6 +39884,9 @@ class ClientManager {
|
|
39735
39884
|
static UploadFileToServer(fileContent, serverFileName) {
|
39736
39885
|
return RemoteCommandsProcessor.GetInstance().UploadFileToServer(fileContent, serverFileName);
|
39737
39886
|
}
|
39887
|
+
static async DownloadFileFromServer(serverFileName) {
|
39888
|
+
return await RemoteCommandsProcessor.GetInstance().DownloadFileFromServer(serverFileName);
|
39889
|
+
}
|
39738
39890
|
/// <summary>
|
39739
39891
|
/// Get formatted value
|
39740
39892
|
/// </summary>
|
@@ -39885,6 +40037,9 @@ class MagicBridge {
|
|
39885
40037
|
static UploadFileToServer(fileContent, serverFileName) {
|
39886
40038
|
return ClientManager.UploadFileToServer(fileContent, serverFileName);
|
39887
40039
|
}
|
40040
|
+
static async DownloadFileFromServer(serverFileName) {
|
40041
|
+
return await ClientManager.DownloadFileFromServer(serverFileName);
|
40042
|
+
}
|
39888
40043
|
static GetFormattedValue(taskId, controlName, value, rowId) {
|
39889
40044
|
return ClientManager.GetFormattedValue(taskId, controlName, value, rowId);
|
39890
40045
|
}
|
@@ -39951,5 +40106,5 @@ class DataSourceIdKey {
|
|
39951
40106
|
* Generated bundle index. Do not edit.
|
39952
40107
|
*/
|
39953
40108
|
|
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 };
|
40109
|
+
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
40110
|
//# sourceMappingURL=magic-xpa-engine.mjs.map
|