{"id":22059189,"url":"https://github.com/pegasystems/offline-diagnostic-tool","last_synced_at":"2025-10-11T14:31:18.768Z","repository":{"id":47474655,"uuid":"417529246","full_name":"pegasystems/offline-diagnostic-tool","owner":"pegasystems","description":"Debugging and validating offline-enabled apps with the JavaScript console [BETA]","archived":false,"fork":false,"pushed_at":"2023-07-19T04:57:37.000Z","size":253,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-30T17:33:40.380Z","etag":null,"topics":["debugging","diagnostic-tool","offline","offline-enabled","online-as-a-special-case-of-offline","pega","pegasystems"],"latest_commit_sha":null,"homepage":"https://wiki.pega.com/index.php/How_to_connect_to_offline_app_console_from_chrome_inspector","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pegasystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-15T14:28:31.000Z","updated_at":"2024-07-09T16:25:41.000Z","dependencies_parsed_at":"2024-11-30T17:28:10.250Z","dependency_job_id":"3b47d803-1e98-4fa8-8584-92d8550b5bba","html_url":"https://github.com/pegasystems/offline-diagnostic-tool","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasystems%2Foffline-diagnostic-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasystems%2Foffline-diagnostic-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasystems%2Foffline-diagnostic-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasystems%2Foffline-diagnostic-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pegasystems","download_url":"https://codeload.github.com/pegasystems/offline-diagnostic-tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236102624,"owners_count":19095206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugging","diagnostic-tool","offline","offline-enabled","online-as-a-special-case-of-offline","pega","pegasystems"],"created_at":"2024-11-30T17:27:28.604Z","updated_at":"2025-10-11T14:31:13.420Z","avatar_url":"https://github.com/pegasystems.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Pega Offline Diagnostic Tool** \n\nThis project is diagnostic tool that helps find, identify and investigate problems present in **Pega Offline** applications.\n\n\n\n# Usage\n\n`pega-offline-diagnostic-tool.js` needs to be pasted into JavaScipt console as is then available as `PegaOfflineDiagnosticTool` \n \nPreparation:\n1. Open [Chrome inspector](chrome://inspect/#devices). If you don't see WebViews related to you app:\n    * make sure that `adb` daemon/service is running (type `adb devices` in system console)\n    * make sure your offline app has `Enable debugging` option checked in **Mobile Channel**\n1. Click `inspect` under `pzPMCHiddenPortalTemplate` to open DevTools window.\n1. Copy the content of `pega-offline-diagnostic-tool.js` from latest release. (See [list of releases](https://github.com/pegasystems/offline-diagnostic-tool/releases))\n1. Paste the script cotent info JavaScript console in DevTools window.\n1. **Clear JS console** (otherwise console.log messages may not appear or appear in unexpected place)\n\nThe diagnostic tool is now ready to use.\n\n## Validating application.\n\nYou can run several validations that will scan your offline application for common known issues. \n\nRun the follwing command in JS console:\n\n`PegaOfflineDiagnosticTool.validateApp()`\n\n## Checking offline rules in offline application storage\n\nThe generic command to display rules in offline app is:  \n\n`PegaOfflineDiagnosticTool.storage.[rule type].[show function]()`\n\nThere are following rule types available:\n\n\n| `[rule type]` | Comment | \n| :--: | --- | \n| `all` | All rule types  | \n| `app_resources` | scripts, css files, images, fonts|\n| `app_resource_entry_points` | |\n| `assignments` | |\n| `case_types` | |\n| `data_transforms` | |\n| `datapages` | |\n| `flows` | |\n| `flow_actions` | |\n| `flow_action_rules` | |\n| `function` | |\n| `function_alias` | |\n| `harnesses` | |\n| `locales` | |\n| `portal` | |\n| `report_definitions` | |\n| `sections` | |\n| `system_settings` | |\n| `system_pages` | |\n| `validate_rules` | |\n| `when_rules` | |\n| `workitems` | |\n| `workitem_templates` | |\n\nThere are following show functions available:\n\n| `[show function]` | Comment | \n| :--: | --- | \n| `find` | Returns a Promise where response contains rules with no modification |\n| `show` | Shows the rules. Integer `softflag` is followed by enum name. | \n| `showAsTable` | Shows the rules rendered as a table in JS console. Integer `softflag` is followed by enum name. Long strings may be truncated | \n| `showAsExpandableObjects` | Shows a list of rules rendered as JS objects. It is possible to expand properies to see nested properties. Integer `softflag` is followed by enum name. Long strings containing JSON are parsed so that they can be be expanded too if necessary. | \n| `showAsPrettyJson` | Shows a list of rules rendered as human readable JSON string. Each property is displayed in a separate line and is prefixed with specific number of spaces to make nesting clearly visible. Integer `softflag` is followed by enum name. Long strings containing JSON are parsed and appended to parent object before formatting is applied. Number of spaces, used to make a single indent, can be passed as parameter. |\n| `exportEachAsJson` | Shows each rule as single JSON string, so that it can be used in mocks/tests. Number of spaces, used to make a single indent, can be passed as parameter.  |\n| `exportAsJson` | Shows the array of rules as single JSON string, so that it can be used in mocks/tests. Number of spaces, used to make a single indent, can be passed as parameter.  |\n\n## Checking SQL tables in offline application local database\n\nThe names of SQL tables in offline application can be displayed with the following command:\n\n`PegaOfflineDiagnosticTool.storage.sqlTables.showTableNames()`\n\n\nThe generic command to display content of any SQL table in offline app is:  \n\n`PegaOfflineDiagnosticTool.storage.sqlTables.[table name].[show function]()`\n\nThere are following show functions available:\n\n| `[show function]` | Comment | \n| :--: | --- | \n| `showAsTable` | Shows SQL table content rendered as a table in JS console. |\n| `showAsExpandableObjects` | Shows SQL table content rendered as a list of JS objects. It is possible to expand rows to see nested properties. Long strings containing JSON are parsed so that they can be be expanded too if necessary. | \n| `showAsPrettyJson` | Shows rows of SQL table content rendered as human readable JSON string. Each property is displayed in a separate line and is prefixed with specific number of spaces to make nesting clearly visible. Integer `softflag` is followed by enum name. Long strings containing JSON are parsed and appended to parent object before formatting is applied. Number of spaces, used to make a single indent, can be passed as parameter. |\n| `exportAsJson` | Shows rows of SQL table content as single JSON string, so that it can be used in mocks/tests. Number of spaces, used to make a single indent, can be passed as parameter.  |\n\n\n## Issues\n\n| Issue | Comment | \n| :-- | --- | \n| Nothing is displayed when I run a command like `PegaOfflineDiagnosticTool.storage.[rule type].[show function]()` | Try clearing JavaScript console logs (with a button in Chrome inspector) and run the command again. Sometimes, when there are too many logs, the JS console displays the logs somewhere in the middle of previous logs or and no more new logs | \n\n# Development\n\n## Get NodeJS\n\nDownload NodeJS from https://nodejs.org/en/download/ (e.g. node-v14.16.1).\nRun the installer and install NodeJS.\nRun ```node -v``` in console to verify if NodeJS was correctly installed and if you are using the version that you downloaded.\n\n## Install dependencies\n\n```npm install```\n\nWebpack is used to package several .js files into a single large file.\nWebpack-cli is required to call webpack from command line.\n\n## Rebuild script\n\n```npx webpack```\n\n## Linting\n\n```eslint```\n\n# Useful links\n\n* Hack for missing 'dns' package when using Promises\n\nhttps://stackoverflow.com/questions/51541561/module-not-found-cant-resolve-dns-in-pg-lib/51781959\n\n* JS Bundlers (webpack alternatives):\n\nhttps://dev.to/talentlessguy/2020-javascript-bundlers-review-3ce\n\n* Webpack devtool settings for dev and production\n\nhttps://webpack.js.org/configuration/devtool/\n\n# Potential issues in analysing Data Pages\n\nThe set of DataPage properties varies a lot, so we need to be careful.\nSome properties available in one DataPage may be not available in another DataPage, e.g.:\n\nContent (DataPage A):\n```\npxObjClass: \"Rule-Declare-Pages\"\npyClassName: \"Link-Attachment\"\npyDataSourceList: [{…}]\npyParameters: [{…}]\npyScope: \"thread\"\npyStructure: \"list\"\npyType: \"normal\"\n```\n\nContent (DataPage B):\n```\npxObjClass: \"Code-Pega-List\"\npxResultCount: \"19\"\npxResults: (19) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]\npyObjClass: \"Assign-Worklist\"\npzPageNameBase: \"D_pyUserWorkList\"\npzPageToDisplay: \"D_pyUserWorkList\"\n```\n\nSSIP (DataPage A):\n```\npxObjClass: \"Embed-SIIP\"\npxUpdateDateTime: \"20180713T134707.778 GMT\"\npyActualClass: \"D_PZOFFLINECASEATTACHMENTS\"\npyCategory: \"datapage\"\npyIsParamDP: \"true\"\npyKey: \"D_pzOfflineCaseAttachments\"\npzHash: \"1352259856908057690\"\npzInsKey: \"RULE-DECLARE-PAGES D_PZOFFLINECASEATTACHMENTS #20180713T134707.778 GMT\"\n```\n\nSSIP (DataPage B):\n```\npxObjClass: \"Embed-SIIP\"\npxUpdateDateTime: \"20180713T134707.606 GMT\"\npyActualClass: \"D_PYUSERWORKLIST\"\npyCategory: \"datapage\"\npyKey: \"D_pyUserWorkList\"\npzHash: \"6635871054021419605\"\npzInsKey: \"RULE-DECLARE-PAGES D_PYUSERWORKLIST #20180713T134707.606 GMT\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpegasystems%2Foffline-diagnostic-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpegasystems%2Foffline-diagnostic-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpegasystems%2Foffline-diagnostic-tool/lists"}