1define('OutSystems/ClientRuntime/RuntimeDebuggerAPI',["require", "exports"], function (require, exports) { 2 "use strict"; 3 Object.defineProperty(exports, "__esModule", { value: true }); 4 exports.BreakpointType = void 0; 5 var BreakpointType; 6 (function (BreakpointType) { 7 BreakpointType[BreakpointType["Normal"] = 0] = "Normal"; 8 BreakpointType[BreakpointType["AtFunctionReturn"] = 1] = "AtFunctionReturn"; 9 BreakpointType[BreakpointType["BetweenAssignments"] = 2] = "BetweenAssignments"; 10 })(BreakpointType || (exports.BreakpointType = BreakpointType = {})); 11}); 12// All licensing information regarding this source code can be found in the LICENSES.txt file. 13//# sourceMappingURL=Debugger.js.map?ts=1761906972138 14define('OutSystems/ClientRuntime/VersionDefinition',["require", "exports"], function (require, exports) { 15 "use strict"; 16 Object.defineProperty(exports, "__esModule", { value: true }); 17 exports.toObject = exports.registerPackage = exports.clientRuntimeKey = void 0; 18 var versions = new Map(); 19 exports.clientRuntimeKey = "Client Runtime Packages"; 20 var cacheResult; 21 function registerPackage(project, version) { 22 cacheResult = null; 23 versions.set(project, version); 24 } 25 exports.registerPackage = registerPackage; 26 function toObject() { 27 if (!cacheResult) { 28 var result_1 = { "Client Runtime Packages": "" }; 29 versions.forEach(function (version, project) { 30 if (version && project) { 31 result_1[exports.clientRuntimeKey] += "".concat(project, "= ").concat(version, ";"); 32 } 33 }); 34 cacheResult = result_1; 35 } 36 return cacheResult; 37 } 38 exports.toObject = toObject; 39}); 40//# sourceMappingURL=VersionDefinition.js.map; 41define('OutSystems/ClientRuntime/Debugger',["require", "exports", "tslib", "./DataTypes", "./Exceptions", "./Logger", "./Model", "./Navigation", "./RuntimeDebuggerAPI", "./VersionDefinition"], function (require, exports, tslib_1, DataTypes_1, Exceptions, Logger, Model_1, Navigation, RuntimeDebuggerAPI_1, VersionDefinition) { 42 "use strict"; 43 Object.defineProperty(exports, "__esModule", { value: true }); 44 exports.Version = exports.DebuggerDataConverter = exports.DebuggerBase = exports.ThreadState = exports.LocalState = exports.DebugCommand = exports.BreakpointId = exports.InitializationStatus = exports.CommandType = void 0; 45 var HEADER_KEYS = { 46 CallContextId: "ccid", 47 DebugStop: "dbg-stop", 48 DebugBreakpointId: "dbg-bkp", 49 }; 50 var CommandType; 51 (function (CommandType) { 52 CommandType[CommandType["StepOver"] = 0] = "StepOver"; 53 CommandType[CommandType["StepInto"] = 1] = "StepInto"; 54 CommandType[CommandType["StepOut"] = 2] = "StepOut"; 55 CommandType[CommandType["Continue"] = 3] = "Continue"; 56 CommandType[CommandType["ContinueToHere"] = 4] = "ContinueToHere"; 57 CommandType[CommandType["None"] = 5] = "None"; 58 })(CommandType || (exports.CommandType = CommandType = {})); 59 var InitializationStatus; 60 (function (InitializationStatus) { 61 InitializationStatus[InitializationStatus["Unprepared"] = 0] = "Unprepared"; 62 InitializationStatus[InitializationStatus["WaitingForClient"] = 1] = "WaitingForClient"; 63 InitializationStatus[InitializationStatus["Prepared"] = 2] = "Prepared"; 64 })(InitializationStatus || (exports.InitializationStatus = InitializationStatus = {})); 65 var BreakpointId = (function () { 66 function BreakpointId(moduleKey, objectKey, compoundKey, debuggerHash) { 67 if (moduleKey === void 0) { moduleKey = null; } 68 if (objectKey === void 0) { objectKey = null; } 69 if (compoundKey === void 0) { compoundKey = null; } 70 if (debuggerHash === void 0) { debuggerHash = null; } 71 this.moduleKey = moduleKey; 72 this.objectKey = objectKey; 73 this.compoundKey = compoundKey; 74 this.debuggerHash = debuggerHash; 75 } 76 BreakpointId.prototype.init = function (breakpointIdStr) { 77 if (!breakpointIdStr) { 78 return; 79 } 80 var parts = breakpointIdStr.split(BreakpointId.SeparatorChar); 81 this.moduleKey = parts[0]; 82 this.objectKey = parts[1]; 83 this.compoundKey = parts.length > 2 && parts[2] ? parts[2] : null; 84 this.debuggerHash = parts.length > 3 && parts[3] ? parts[3] : null; 85 }; 86 BreakpointId.parse = function (breakpointIdStr) { 87 if (!breakpointIdStr) { 88 return null; 89 } 90 try {
91 var breakpoint = new BreakpointId(); 92 breakpoint.init(breakpointIdStr); 93 return breakpoint; 94 } 95 catch (error) { 96 return null; 97 } 98 }; 99 BreakpointId.prototype.equals = function (b1) { 100 if (!b1) { 101 return false; 102 } 103 return b1.moduleKey === this.moduleKey && b1.objectKey === this.objectKey; 104 }; 105 BreakpointId.prototype.toString = function (fullKey) { 106 if (fullKey === void 0) { fullKey = false; } 107 if (!fullKey) { 108 return this.moduleKey + BreakpointId.SeparatorChar + (this.objectKey || ""); 109 } 110 else { 111 return (this.moduleKey + 112 BreakpointId.SeparatorChar + 113 (this.objectKey || "") + 114 BreakpointId.SeparatorChar + 115 (this.compoundKey || "") + 116 BreakpointId.SeparatorChar + 117 (this.debuggerHash || "")); 118 } 119 }; 120 BreakpointId.SeparatorChar = ":"; 121 return BreakpointId; 122 }()); 123 exports.BreakpointId = BreakpointId; 124 var DebugCommand = (function () { 125 function DebugCommand(_commandType, _stackLevel) { 126 if (_commandType === void 0) { _commandType = CommandType.None; } 127 if (_stackLevel === void 0) { _stackLevel = -1; } 128 this._commandType = _commandType; 129 this._stackLevel = _stackLevel; 130 } 131 DebugCommand.prototype.resetCommandState = function () { 132 this._commandType = CommandType.None; 133 this._stackLevel = -1; 134 }; 135 Object.defineProperty(DebugCommand.prototype, "commandType", { 136 get: function () { 137 return this._commandType; 138 }, 139 set: function (stepType) { 140 this._commandType = stepType; 141 }, 142 enumerable: false, 143 configurable: true 144 }); 145 Object.defineProperty(DebugCommand.prototype, "stackLevel", { 146 get: function () { 147 return this._stackLevel; 148 }, 149 set: function (stackLevel) { 150 this._stackLevel = stackLevel; 151 }, 152 enumerable: false, 153 configurable: true 154 }); 155 return DebugCommand; 156 }()); 157 exports.DebugCommand = DebugCommand; 158 var LocalState = (function () { 159 function LocalState(elementKey, moduleName, elementName, elementType, varBag) { 160 this.elementKey = elementKey; 161 this.moduleName = moduleName; 162 this.elementName = elementName; 163 this.elementType = elementType; 164 this.varBag = varBag; 165 this.currentBreakpoint = null; 166 this.previousBreakpoint = null; 167 this.breakpointType = null; 168 this.extraInfo = null; 169 this.functionLeft = ""; 170 } 171 LocalState.prototype.refreshLocalState = function (currentBreakpoint, breakpointType, extraInfo) { 172 this.previousBreakpoint = this.currentBreakpoint; 173 this.currentBreakpoint = currentBreakpoint; 174 this.breakpointType = breakpointType; 175 this.extraInfo = extraInfo; 176 }; 177 return LocalState; 178 }()); 179 exports.LocalState = LocalState; 180 var ThreadState = (function () { 181 function ThreadState() { 182 this.callStack = new Array(); 183 this._command = new DebugCommand(); 184 this._continueToHereBreakpoint = undefined; 185 this._stopImmediately = false; 186 } 187 ThreadState.prototype.pushCallOnStack = function (elementKey, moduleName, elementName, elementType, varBag) { 188 this.callStack.push(new LocalState(elementKey, moduleName, elementName, elementType, varBag)); 189 }; 190 ThreadState.prototype.popCallOnStack = function () { 191 var lastState = this.callStack.pop(); 192 if (this.callStack.length > 0) { 193 this.peekLastCallOnStack().functionLeft = lastState.elementName; 194 } 195 return lastState; 196 }; 197 ThreadState.prototype.peekLastCallOnStack = function () { 198 if (this.callStack.length <= 0) { 199 return; 200 } 201 return this.callStack[this.callStack.length - 1]; 202 }; 203 ThreadState.prototype.getCallOnStack = function (position) { 204 if (position < 0 || position >= this.callStack.length) {
205 logMessage("The received stack level is not valid. Received '" + 206 position + 207 "', current thread stack length '" + 208 this.callStack.length + 209 "'"); 210 return; 211 } 212 return this.callStack[position]; 213 }; 214 ThreadState.prototype.refreshLastCallOnStack = function (currentBreakpoint, breakpointType, extraInfo) { 215 this.peekLastCallOnStack().refreshLocalState(currentBreakpoint, breakpointType, extraInfo); 216 }; 217 Object.defineProperty(ThreadState.prototype, "command", { 218 get: function () { 219 return this._command; 220 }, 221 set: function (command) { 222 this._command = command; 223 }, 224 enumerable: false, 225 configurable: true 226 }); 227 Object.defineProperty(ThreadState.prototype, "stackLevel", { 228 get: function () { 229 return this.callStack.length; 230 }, 231 enumerable: false, 232 configurable: true 233 }); 234 Object.defineProperty(ThreadState.prototype, "stopImmediately", { 235 get: function () { 236 return this._stopImmediately; 237 }, 238 set: function (value) { 239 this._stopImmediately = value || false; 240 }, 241 enumerable: false, 242 configurable: true 243 }); 244 Object.defineProperty(ThreadState.prototype, "continueToBreakpoint", { 245 get: function () { 246 return this._continueToHereBreakpoint; 247 }, 248 set: function (value) { 249 this._continueToHereBreakpoint = value; 250 }, 251 enumerable: false, 252 configurable: true 253 }); 254 Object.defineProperty(ThreadState.prototype, "threadStartName", { 255 get: function () { 256 return this._threadStartName || ""; 257 }, 258 set: function (value) { 259 this._threadStartName = value; 260 }, 261 enumerable: false, 262 configurable: true 263 }); 264 ThreadState.prototype.getThreadStack = function () { 265 return this.callStack.map(function (localState) { 266 return { 267 currentBreakpoint: localState.currentBreakpoint !== null && localState.currentBreakpoint !== undefined 268 ? localState.currentBreakpoint.toString(true) 269 : null, 270 previousBreakpoint: localState.previousBreakpoint !== null && localState.previousBreakpoint !== undefined 271 ? localState.previousBreakpoint.toString(true) 272 : null, 273 breakpointType: localState.breakpointType !== null && localState.breakpointType !== undefined 274 ? localState.breakpointType 275 : RuntimeDebuggerAPI_1.BreakpointType.Normal, 276 extraInfo: localState.extraInfo,
277 elementKey: localState.elementKey !== null && localState.elementKey !== undefined 278 ? localState.elementKey.toString(true) 279 : null, 280 elementName: localState.elementName, 281 elementType: localState.elementType, 282 functionLeft: localState.functionLeft, 283 moduleName: localState.moduleName, 284 }; 285 }); 286 }; 287 return ThreadState; 288 }()); 289 exports.ThreadState = ThreadState; 290 function logMessage(message) { 291 Logger.log("Debugger", message); 292 } 293 var Indexer = /^([0-9]+)$/; 294 var UnsuportedIndexer = /\[[^\]]*[^0-9\]]+[^\]]*\]/; 295 var FunctionReturnVariablePath = "$return"; 296 var DebuggerBase = (function () { 297 function DebuggerBase() { 298 this.isInSession = false; 299 this.breakpoints = new Map(); 300 this.callContexts = new Map(); 301 this.initializationStatus = InitializationStatus.Unprepared; 302 this._pauseOnAllExceptions = false; 303 this.exceptionsMap = new Map(); 304 this.pausedOnAnException = false; 305 this.allowedModules = new Map(); 306 } 307 Object.defineProperty(DebuggerBase.prototype, "BreakpointType", { 308 get: function () { 309 return RuntimeDebuggerAPI_1.BreakpointType; 310 }, 311 enumerable: false, 312 configurable: true 313 }); 314 DebuggerBase.prototype.isPausedOnException = function () { 315 return this.pausedOnAnException; 316 }; 317 Object.defineProperty(DebuggerBase.prototype, "version", { 318 get: function () { 319 return 3; 320 }, 321 enumerable: false, 322 configurable: true 323 }); 324 DebuggerBase.prototype.startSession = function () { 325 if (this.isInSession) { 326 logMessage("Debugger is already in session"); 327 return; 328 } 329 if (this.pendingInitializationHandler) { 330 this.initializationStatus = InitializationStatus.Prepared; 331 this.pendingInitializationHandler(); 332 this.pendingInitializationHandler = null; 333 } 334 this.isInSession = true; 335 }; 336 DebuggerBase.prototype.endSession = function () { 337 if (!this.isInSession) { 338 logMessage("Can't end an unexisting session"); 339 return; 340 } 341 this.isInSession = false; 342 }; 343 DebuggerBase.prototype.addBreakpoint = function (breakpointId) { 344 if (BreakpointId.parse(breakpointId) === null) { 345 logMessage("Cannot convert '" + breakpointId + "' to a BreakpointId"); 346 return; 347 } 348 if (this.breakpoints.get(breakpointId)) { 349 logMessage("Breakpoint with id '" + breakpointId + "' already registered"); 350 return; 351 } 352 this.breakpoints.set(breakpointId, true); 353 }; 354 DebuggerBase.prototype.addBreakpoints = function (breakpointIds) { 355 var _this = this; 356 breakpointIds.forEach(function (bi) { return _this.addBreakpoint(bi); }); 357 }; 358 DebuggerBase.prototype.allowBreakpointsFromModule = function (key) { 359 if (this.allowedModules.get(key)) { 360 logMessage("Module with key '" + key + "' is already allowed"); 361 return; 362 } 363 this.allowedModules.set(key, true); 364 }; 365 DebuggerBase.prototype.removeBreakpoint = function (breakpointId) { 366 if (BreakpointId.parse(breakpointId) === null) { 367 logMessage("Cannot convert '" + breakpointId + "' to a BreakpointId"); 368 return; 369 } 370 if (!this.breakpoints.delete(breakpointId)) { 371 logMessage("Breakpoint with id '" + breakpointId + "' isn't registered"); 372 } 373 }; 374 DebuggerBase.prototype.clearBreakpoints = function () { 375 this.breakpoints.clear(); 376 }; 377 DebuggerBase.prototype.push = function (breakpointIdStr, moduleName, elementName, elementType, callContextId, varBag) { 378 if (!this.isInSession) { 379 return; 380 }
381 var breakpointId = BreakpointId.parse(breakpointIdStr); 382 if (!breakpointId) { 383 logMessage("Error when parsing breakpointId '" + breakpointIdStr + "'"); 384 return; 385 } 386 var threadState = this.callContexts.get(callContextId); 387 if (!threadState) { 388 threadState = new ThreadState(); 389 this.callContexts.set(callContextId, threadState); 390 } 391 threadState.pushCallOnStack(breakpointId, moduleName, elementName, elementType, varBag); 392 }; 393 DebuggerBase.prototype.pop = function (breakpointIdStr, callContextId) { 394 if (!this.isInSession) { 395 return; 396 } 397 var breakpointId = BreakpointId.parse(breakpointIdStr); 398 if (!breakpointId) { 399 logMessage("Error when parsing breakpointId '" + breakpointIdStr + "'"); 400 return; 401 } 402 var threadState = this.callContexts.get(callContextId); 403 if (!threadState) { 404 logMessage("There is no action to end to callContextId '" + callContextId.toString() + "'"); 405 return; 406 } 407 var lastVal = threadState.peekLastCallOnStack(); 408 if (!lastVal.elementKey.equals(breakpointId)) { 409 logMessage("Action to end didn't match to current running action. Running action key: '" + 410 lastVal.elementKey.toString() + 411 "', tried to end: '" + 412 breakpointId.toString() + 413 "'"); 414 return; 415 } 416 threadState.popCallOnStack(); 417 if (threadState.stackLevel <= 0) { 418 this.callContexts.delete(callContextId); 419 this.exceptionsMap.delete(callContextId); 420 } 421 }; 422 DebuggerBase.prototype.stepInto = function (callContextId) { 423 this.fillCommandByCallContextId(callContextId, CommandType.StepInto); 424 }; 425 DebuggerBase.prototype.stepOver = function (callContextId) { 426 this.fillCommandByCallContextId(callContextId, CommandType.StepOver); 427 }; 428 DebuggerBase.prototype.stepOut = function (callContextId) { 429 this.fillCommandByCallContextId(callContextId, CommandType.StepOut); 430 }; 431 DebuggerBase.prototype.continue = function (callContextId) { 432 this.fillCommandByCallContextId(callContextId, CommandType.Continue); 433 }; 434 DebuggerBase.prototype.continueToHere = function (breakpointIdStr, callContextId) { 435 var breakpointId = BreakpointId.parse(breakpointIdStr); 436 if (!breakpointId) { 437 logMessage("Error when parsing breakpointId '" + breakpointIdStr + "'"); 438 return; 439 } 440 this.fillCommandByCallContextId(callContextId, CommandType.ContinueToHere); 441 var threadState = this.callContexts.get(callContextId); 442 threadState.continueToBreakpoint = breakpointId; 443 }; 444 DebuggerBase.prototype.pauseOnAllExceptions = function (isEnabled) { 445 this._pauseOnAllExceptions = isEnabled; 446 }; 447 DebuggerBase.prototype.fillCommandByCallContextId = function (callContextId, commandType) { 448 if (!this.isInSession) { 449 logMessage("Cannot preform debug actions out of a session context"); 450 return; 451 } 452 var threadState = this.callContexts.get(callContextId); 453 if (!threadState) { 454 logMessage("No match for callContextId '" + callContextId + "'"); 455 return; 456 } 457 threadState.command.commandType = commandType; 458 threadState.command.stackLevel = threadState.stackLevel; 459 }; 460 DebuggerBase.prototype.handleFunctionCall = function (functionCaller, resultType, callContextId) { 461 var value = functionCaller(); 462 if (!this.isInSession) { 463 return value; 464 } 465 var threadState = this.callContexts.get(callContextId); 466 if (!threadState) { 467 logMessage("There is no callContext registered with Id '" + callContextId + "'"); 468 return value; 469 } 470 var localState = threadState.getCallOnStack(threadState.stackLevel - 1); 471 var breakpoint = localState.currentBreakpoint || localState.elementKe
471y; 472 this.handleBreakpoint(breakpoint.toString(true), callContextId, RuntimeDebuggerAPI_1.BreakpointType.AtFunctionReturn, DebuggerDataConverter.to(value, localState.varBag.callContext, null, null, resultType)); 473 return value; 474 }; 475 DebuggerBase.prototype.handleBreakpoint = function (breakpointIdStr, callContextId, breakpointType, extraInfo) { 476 if (breakpointType === void 0) { breakpointType = RuntimeDebuggerAPI_1.BreakpointType.Normal; } 477 if (!this.isInSession) { 478 return true; 479 } 480 var breakpointId = BreakpointId.parse(breakpointIdStr); 481 if (!breakpointId) { 482 logMessage("Error when parsing breakpointId '" + breakpointIdStr + "'"); 483 return true; 484 } 485 var threadState = this.callContexts.get(callContextId); 486 if (!threadState) { 487 logMessage("Trying to handle breakpoint with id '" + 488 breakpointIdStr + 489 "', but there is no callContext registered with Id '" + 490 callContextId + 491 "'"); 492 return true; 493 } 494 threadState.refreshLastCallOnStack(breakpointId, breakpointType, extraInfo); 495 if (!this.allowedModules.get(breakpointId.moduleKey)) { 496 Logger.trace("Debugger", "Skipping breakpoint '" + 497 breakpointIdStr + 498 "' because breakpoints from module with key '" + 499 breakpointId.moduleKey + 500 "' are to be ignored."); 501 return true; 502 } 503 if (threadState.stopImmediately || 504 (this.breakpoints.get(breakpointIdStr) && 505 threadState.command.commandType !== CommandType.ContinueToHere && 506 breakpointType === RuntimeDebuggerAPI_1.BreakpointType.Normal)) { 507 threadState.stopImmediately = false; 508 this.resetStateAndCallDebugger(threadState, callContextId); 509 return true; 510 } 511 switch (threadState.command.commandType) { 512 case CommandType.StepInto: 513 this.resetStateAndCallDebugger(threadState, callContextId); 514 break; 515 case CommandType.StepOut: 516 if (threadState.stackLevel < threadState.command.stackLevel) { 517 this.resetStateAndCallDebugger(threadState, callContextId); 518 } 519 break; 520 case CommandType.StepOver: 521 if (threadState.stackLevel <= threadState.command.stackLevel && 522 breakpointType === RuntimeDebuggerAPI_1.BreakpointType.Normal) { 523 this.resetStateAndCallDebugger(threadState, callContextId); 524 } 525 break; 526 case CommandType.ContinueToHere: 527 if (breakpointId.equals(threadState.continueToBreakpoint) && breakpointType === RuntimeDebuggerAPI_1.BreakpointType.Normal) { 528 threadState.continueToBreakpoint = undefined; 529 this.resetStateAndCallDebugger(threadState, callContextId); 530 } 531 break; 532 default: 533 break; 534 } 535 return true; 536 }; 537 DebuggerBase.prototype.resetStateAndCallDebugger = function (threadState, callContextId) { 538 threadState.command.resetCommandState(); 539 this.callDebugger(callContextId); 540 }; 541 DebuggerBase.prototype.handleException = function (error, callContextId) { 542 if (!this.isInSession) { 543 return; 544 } 545 if (Exceptions.isSystem(error)) { 546 return; 547 } 548 var threadState = this.callContexts.get(callContextId); 549 var errorMessage = Exceptions.getMessage(error); 550 if (!threadState) { 551 logMessage("Trying to handle Exception with message '" + 552 errorMessage + 553 "', but there is no callContext registered with Id '" + 554 callContextId + 555 "'"); 556 return; 557 } 558 var registeredError = this.exceptionsMap.get(callContextId); 559 if (error === registeredError) { 560 return; 561 } 562 this.exceptionsMap.set(callContextId, error); 563 if (this._pauseOnAllExceptions) { 564 this.pausedOnAnException = true; 565 try { 566 this.callDebugger(callContextId); 567 } 568 finally { 569 this.pausedOnAnException = false;
570 } 571 } 572 }; 573 DebuggerBase.prototype.getExceptionMessage = function (callContextId) { 574 var threadState = this.getThreadState(callContextId); 575 if (!threadState) { 576 return; 577 } 578 var exception = this.exceptionsMap.get(callContextId); 579 if (exception === undefined) { 580 logMessage("There is no Exception associated to callContext with Id '" + callContextId + "'"); 581 return; 582 } 583 return Exceptions.getMessage(exception); 584 }; 585 DebuggerBase.prototype.getThreadState = function (callContextId) { 586 if (!this.isInSession) { 587 logMessage("Cannot perform debug actions out of a session context"); 588 return; 589 } 590 var threadState = this.callContexts.get(callContextId); 591 if (!threadState) { 592 logMessage("There is no callContext registered with Id '" + callContextId + "'"); 593 return; 594 } 595 return threadState; 596 }; 597 DebuggerBase.prototype.getThreadStack = function (callContextId) { 598 var threadState = this.getThreadState(callContextId); 599 if (threadState) { 600 return threadState.getThreadStack(); 601 } 602 }; 603 DebuggerBase.prototype.parse = function (breakpointIdStr) { 604 return BreakpointId.parse(breakpointIdStr); 605 }; 606 DebuggerBase.prototype.initialize = function (waitForClient) { 607 var _this = this; 608 switch (this.initializationStatus) { 609 case InitializationStatus.WaitingForClient: 610 return Promise.reject("Debugger already waiting for client initialization"); 611 case InitializationStatus.Prepared: 612 return Promise.reject("Debugger already initialized"); 613 default: 614 break; 615 } 616 if (waitForClient === undefined) { 617 waitForClient = !!Navigation.getSearchParameterValue("_waitForClient"); 618 } 619 return new Promise(function (resolve, reject) { 620 if (waitForClient && !_this.isInSession) { 621 _this.initializationStatus = InitializationStatus.WaitingForClient; 622 _this.pendingInitializationHandler = resolve; 623 } 624 else { 625 _this.initializationStatus = InitializationStatus.Prepared; 626 resolve(); 627 } 628 }); 629 }; 630 DebuggerBase.prototype.registerMetaInfo = function (variablesMapping) { 631 if (!this.metaInfoMap) { 632 this.metaInfoMap = new Map(); 633 } 634 for (var variableKey in variablesMapping) { 635 if (variablesMapping.hasOwnProperty(variableKey) && !this.metaInfoMap.get(variableKey)) { 636 this.metaInfoMap.set(variableKey, variablesMapping[variableKey]); 637 } 638 } 639 }; 640 DebuggerBase.prototype.getRuntimeExpression = function (variableKey, actionKey) { 641 if (!this.metaInfoMap) { 642 logMessage("MetaInfo not registered yet."); 643 return; 644 } 645 var runtimeVariable = this.metaInfoMap.get(variableKey); 646 if (!runtimeVariable) { 647 logMessage("There is no mapping defined for variable with the key '" + 648 variableKey + 649 "', that was evaluated in the context of the action with the key '" + 650 actionKey + 651 "'."); 652 return; 653 } 654 return runtimeVariable; 655 }; 656 DebuggerBase.prototype.innerEvaluateVariable = function (callContextId, stackLevel, actionKey, variableKey) { 657 var threadState = this.getThreadState(callContextId); 658 if (!threadState) { 659 return; 660 } 661 var localState = threadState.getCallOnStack(stackLevel); 662 if (!localState) { 663 return; 664 } 665 var runtimeVariable = this.getRuntimeExpression(variableKey, actionKey); 666 if (!runtimeVariable) { 667 logMessage("Failed to get runtime variable expression. CallContextId '" + 668 callContextId + 669 "', stackLevel '" + 670 stackLevel + 671 "'"); 672 return; 673 } 674 var result = undefined; 675 try { 676 result = runtimeVariable.getter(localState.varBag, localState.varBag.idService); 677 } 678 catch (e) { 679 } 680 finally { 681 if (result === undefined) { 682 logMessage("Couldn't evaluate variable with key '" + 683 variableKey + 684 "', that was evaluated in the context of the action with the key '" + 685 actionKey + 686 "' at stack level '" + 687 stackLevel + 688 "' of callContextId '" + 689 callContextId + 690 "'."); 691 return; 692 } 693 } 694 return result; 695 }; 696 DebuggerBase.prototype.splitPath = function (path) { 697 if (UnsuportedIndexer.test(path)) { 698 return undefined; 699 } 700 return !!path 701 ? path 702 .split(/[.\[\]]/) 703 .filter(function (s) { return s !== ""; }) 704 .slice(1) 705 : undefined; 706 }; 707 DebuggerBase.prototype.evaluateVariable = function (callContextId, stackLevel, actionKey, variableKey, path, depth) { 708 if (variableKey === "" && path === FunctionReturnVariablePath) { 709 var threadState_1 = this.getThreadState(callContextId); 710 if (!threadState_1) { 711 return; 712 } 713 var localState_1 = threadState_1.getCallOnStack(stackLevel); 714 if (!localState_1) { 715 return; 716 } 717 return localState_1.extraInfo; 718 } 719 var result = this.innerEvaluateVariable(callContextId, stackLevel, actionKey, variableKey); 720 if (result === undefined) { 721 return; 722 } 723 if (UnsuportedIndexer.test(path)) { 724 return undefined; 725 } 726 var threadState = this.callContexts.get(callContextId); 727 var localState = threadState.getCallOnStack(stackLevel); 728 var runtimeVariable = this.getRuntimeExpression(variableKey, actionKey); 729 var pathArray = this.splitPath(path); 730 return DebuggerDataConverter.to(result, localState.varBag.callContext, pathArray, depth, runtimeVariable.dataType); 731 }; 732 DebuggerBase.prototype.getRequestHeaders = function (callContextId) { 733 if (!this.isInSession) { 734 return; 735 } 736 var threadState = this.callContexts.get(callContextId); 737 if (!threadState) { 738 logMessage("There is no callContext registered with Id '" + callContextId + "'"); 739 return; 740 } 741 var headers = {};
742 headers[HEADER_KEYS.CallContextId] = String(callContextId); 743 var cmd = threadState.command; 744 if (cmd && cmd.commandType === CommandType.StepInto) { 745 headers[HEADER_KEYS.DebugStop] = "true"; 746 } 747 else if (threadState.continueToBreakpoint && cmd.commandType === CommandType.ContinueToHere) { 748 headers[HEADER_KEYS.DebugBreakpointId] = String(threadState.continueToBreakpoint); 749 } 750 return headers; 751 }; 752 DebuggerBase.prototype.processResponseHeaders = function (callContextId, headers) { 753 if (!this.isInSession) { 754 return; 755 } 756 var threadState = this.getThreadState(callContextId); 757 if (headers && threadState) { 758 if ((headers[HEADER_KEYS.DebugStop] || "").toLowerCase() === "true") { 759 threadState.stopImmediately = true; 760 } 761 else if (headers[HEADER_KEYS.DebugBreakpointId]) { 762 threadState.command.commandType = CommandType.ContinueToHere; 763 threadState.continueToBreakpoint = BreakpointId.parse(headers[HEADER_KEYS.DebugBreakpointId]); 764 } 765 else if (threadState.command.commandType === CommandType.StepInto) { 766 threadState.command.commandType = CommandType.Continue; 767 } 768 } 769 }; 770 DebuggerBase.prototype.getThreadStartName = function (callContextId) { 771 return this.getThreadState(callContextId).threadStartName; 772 }; 773 DebuggerBase.prototype.setThreadStartName = function (callContextId, threadStartName) { 774 if (!this.isInSession) { 775 return; 776 } 777 if (!this.callContexts) { 778 logMessage("No call context dictionary initialized yet"); 779 return; 780 } 781 if (!this.callContexts.get(callContextId)) { 782 logMessage("No thread state for this context id"); 783 return; 784 } 785 this.callContexts.get(callContextId).threadStartName = threadStartName; 786 }; 787 return DebuggerBase; 788 }()); 789 exports.DebuggerBase = DebuggerBase; 790 var RuntimeDebugger = (function (_super) { 791 tslib_1.__extends(RuntimeDebugger, _super); 792 function RuntimeDebugger() { 793 return _super !== null && _super.apply(this, arguments) || this; 794 } 795 RuntimeDebugger.prototype.callDebugger = function (callContextId) { 796 debugger; 797 }; 798 return RuntimeDebugger; 799 }(DebuggerBase)); 800 var DebuggerDataConverter; 801 (function (DebuggerDataConverter) { 802 var DataFetchStatusProp = "DataFetchStatus"; 803 var IsDataFetchedProp = "IsDataFetched"; 804 var HasFetchErrorProp = "HasFetchError"; 805 function to(value, callContext, path, depth, dataType) { 806 if (depth === void 0) { depth = -1; } 807 var nextDepth = Math.max(-1, depth - 1); 808 if (value instanceof DataTypes_1.GenericRecord) { 809 var record = value; 810 var attributes = record.getAttributes(); 811 if (path && path.length > 0) { 812 var currentPath_1 = path[0]; 813 path = path.slice(1); 814 if (value instanceof Model_1.DataSourceRecord) { 815 var dataSource = value; 816 if (currentPath_1 === "HasFetchError") { 817 return to(dataSource.hasFetchErrorAttr, callContext, path, depth, DataTypes_1.DataTypes.Boolean); 818 } 819 else if (currentPath_1 === "IsDataFetched") { 820 return to(dataSource.isDataFetchedAttr, callContext, path, depth, DataTypes_1.DataTypes.Boolean); 821 } 822 } 823 attributes = attributes.filter(function (attr) { return attr.name === currentPath_1; }); 824 if (attributes.length === 0) { 825 logMessage("No attribute matching the given path '" + currentPath_1 + "'."); 826 return; 827 } 828 else { 829 var attr = attributes[0]; 830 return to(record[attr.attrName], callContext, path, depth, attr.dataType); 831 } 832 } 833 if (depth === 0) { 834 return buildValueTypeObject(null, DataTypes_1.DataTypes.Record); 835 } 836 var result = {}; 837 for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { 838 var attr = attributes_1[_i]; 839 result[attr.name] = to(record[attr.attrName], callContext, path, nextDepth, attr.dataType); 840 } 841 if (value instanceof Model_1.DataSourceRecord) { 842 var dataSource = value; 843 delete result[DataFetchStatusProp]; 844 result[IsDataFetchedProp] = to(dataSource.isDataFetchedAttr, callContext, path, depth, DataTypes_1.DataTypes.Boolean); 845 result[HasFetchErrorProp] = to(dataSource.hasFetchErrorAttr, callContext, path, depth, DataTypes_1.DataTypes.Boolean); 846 } 847 return buildValueTypeObject(result, DataTypes_1.DataTypes.Record); 848 } 849 else if (value instanceof DataTypes_1.List) { 850 var list = value; 851 var listItemType = undefined; 852 var getItemTypeFunc = list.constructor.getItemType; 853 if (getItemTypeFunc) { 854 listItemType = list.constructor.getItemType(); 855 }
856 var iterationContext = callContext.iterationContext; 857 var rowNumber = iterationContext.getCurrentRowNumber(list); 858 if (path && path.length > 0) { 859 var currentPath = path[0]; 860 path = path.slice(1); 861 if (currentPath === "CurrentRowNumber") { 862 return to(rowNumber, callContext, path, depth, DataTypes_1.DataTypes.Integer); 863 } 864 else if (currentPath === "Current") { 865 return to(list.isEmpty ? list.emptyListItem : list.getItem(rowNumber), callContext, path, depth, listItemType); 866 } 867 else if (currentPath === "Empty") { 868 return to(list.isEmpty, callContext, path, depth, DataTypes_1.DataTypes.Boolean); 869 } 870 else if (currentPath === "Length") { 871 return to(list.length, callContext, path, depth, DataTypes_1.DataTypes.Integer); 872 } 873 else { 874 var indexerResult = Indexer.exec(currentPath); 875 if (indexerResult) { 876 var resultInNumber = parseInt(indexerResult[1], 10); 877 if (resultInNumber >= 0 && resultInNumber < list.length) { 878 return to(list.getItem(resultInNumber), callContext, path, depth, listItemType); 879 } 880 logMessage("Index out of bounds '" + resultInNumber + "'."); 881 return; 882 } 883 else { 884 logMessage("No '" + currentPath + "' attribute on Type 'List'."); 885 return; 886 } 887 } 888 } 889 if (depth === 0) { 890 return buildValueTypeObject(null, DataTypes_1.DataTypes.RecordList); 891 } 892 var result = { 893 CurrentRowNumber: to(rowNumber, callContext, path, nextDepth, DataTypes_1.DataTypes.Integer), 894 Current: to(list.isEmpty ? list.emptyListItem : list.getItem(rowNumber), callContext, path, nextDepth, listItemType), 895 Empty: to(list.isEmpty, callContext, path, nextDepth, DataTypes_1.DataTypes.Boolean), 896 Length: to(list.length, callContext, path, nextDepth, DataTypes_1.DataTypes.Integer), 897 }; 898 for (var i = 0; i < list.length; i++) { 899 result["[" + i + "]"] = to(list.getItem(i), callContext, path, nextDepth, listItemType); 900 } 901 return buildValueTypeObject(result, DataTypes_1.DataTypes.RecordList); 902 } 903 else if (value instanceof Model_1.WidgetRecord) { 904 if (depth === 0) { 905 return buildValueTypeObject(null, DataTypes_1.DataTypes.Record); 906 } 907 var record = value; 908 if (path && path.length > 0) { 909 var currentPath = path[0]; 910 path = path.slice(1); 911 if (currentPath === "Id") { 912 return to(record.idAttr, callContext, path, depth, DataTypes_1.DataTypes.Text); 913 } 914 else if (record instanceof Model_1.ValidationWidgetRecord) { 915 if (currentPath === "Valid") { 916 return to(record.validAttr, callContext, path, depth, DataTypes_1.DataTypes.Boolean); 917 } 918 else if (currentPath === "ValidationMessage") { 919 return to(record.validationMessageAttr, callContext, path, depth, DataTypes_1.DataTypes.Text); 920 } 921 } 922 logMessage("No attribute matching the given path '" + currentPath + "'."); 923 return; 924 } 925 var result = { 926 Id: to(record.idAttr, callContext, path, nextDepth, DataTypes_1.DataTypes.Text), 927 }; 928 if (record instanceof Model_1.ValidationWidgetRecord) { 929 result.Valid = to(record.validAttr, callContext, path, nextDepth, DataTypes_1.DataTypes.Boolean); 930 result.ValidationMessage = to(record.validationMessageAttr, callContext, path, nextDepth, DataTypes_1.DataTypes.Text); 931 } 932 return buildValueTypeObject(result, DataTypes_1.DataTypes.Record); 933 } 934 else if (dataType !== undefined) { 935 if (path && path.length > 0) { 936 logMessage("Cannot perform a inner evaluation to a Basic Type. Trying to evaluate '" + 937 path[0] + 938 "' for a variable of type '" + 939 DataTypes_1.DataTypes[dataType] + 940 "'."); 941 return; 942 } 943 return basicTypeToDebuggerData(value, dataType); 944 } 945 else { 946 logMessage("Variable Type didn't match any case. " + typeof value); 947 return; 948 } 949 } 950 DebuggerDataConverter.to = to; 951 function basicTypeToDebuggerData(value, dataType) { 952 switch (dataType) { 953 case DataTypes_1.DataTypes.Integer: 954 case DataTypes_1.DataTypes.Text: 955 case DataTypes_1.DataTypes.PhoneNumber: 956 case DataTypes_1.DataTypes.Email: 957 case DataTypes_1.DataTypes.Boolean: 958 return buildValueTypeObject(value, dataType); 959 case DataTypes_1.DataTypes.LongInteger:
960 case DataTypes_1.DataTypes.Decimal: 961 case DataTypes_1.DataTypes.Currency: 962 return buildValueTypeObject(value.toString(), dataType); 963 case DataTypes_1.DataTypes.Date: 964 return buildValueTypeObject(value.toISODate(), dataType); 965 case DataTypes_1.DataTypes.DateTime: 966 return buildValueTypeObject(value.toString(), dataType); 967 case DataTypes_1.DataTypes.Time: 968 return buildValueTypeObject(value.toISOTime(), dataType); 969 case DataTypes_1.DataTypes.BinaryData: 970 return buildValueTypeObject(value.length, dataType); 971 case DataTypes_1.DataTypes.Object: 972 return buildValueTypeObject(null, dataType); 973 case DataTypes_1.DataTypes.Record: 974 logMessage("Record is not a basic type"); 975 return; 976 case DataTypes_1.DataTypes.RecordList: 977 logMessage("RecordList is not a basic type"); 978 return; 979 default: 980 logMessage("Unknown data type ".concat(dataType)); 981 return; 982 } 983 } 984 function buildValueTypeObject(value, dataType) { 985 return { 986 value: value, 987 type: DataTypes_1.DataTypes[dataType], 988 }; 989 } 990 })(DebuggerDataConverter || (exports.DebuggerDataConverter = DebuggerDataConverter = {})); 991 exports.Version = "3.63.0"; 992 VersionDefinition.registerPackage("client-runtime-core", exports.Version); 993 var globalObj = typeof window !== "undefined" ? window : global; 994 globalObj.OutSystemsDebugger = new RuntimeDebugger(); 995}); 996//# sourceMappingURL=Debugger.js.map;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.