{"id":14986745,"url":"https://github.com/kaizhu256/node-swgg","last_synced_at":"2025-04-11T22:52:57.631Z","repository":{"id":57375824,"uuid":"46631656","full_name":"kaizhu256/node-swgg","owner":"kaizhu256","description":"this zero-dependency package will run a virtual swagger-ui server with persistent-storage in the browser, that your webapp can use (in-place of a real backend), with a working web-demo","archived":false,"fork":false,"pushed_at":"2019-09-15T22:43:08.000Z","size":17792,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"beta","last_synced_at":"2025-04-10T14:12:21.845Z","etag":null,"topics":["openapi","swagger","swagger-ui"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaizhu256.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-21T20:06:15.000Z","updated_at":"2023-08-02T07:11:08.000Z","dependencies_parsed_at":"2022-09-02T16:29:15.177Z","dependency_job_id":null,"html_url":"https://github.com/kaizhu256/node-swgg","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaizhu256%2Fnode-swgg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaizhu256%2Fnode-swgg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaizhu256%2Fnode-swgg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaizhu256%2Fnode-swgg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaizhu256","download_url":"https://codeload.github.com/kaizhu256/node-swgg/tar.gz/refs/heads/beta","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487688,"owners_count":21112191,"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":["openapi","swagger","swagger-ui"],"created_at":"2024-09-24T14:13:27.678Z","updated_at":"2025-04-11T22:52:57.612Z","avatar_url":"https://github.com/kaizhu256.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swgg\nthis zero-dependency package will run a virtual swagger-ui server with persistent-storage in the browser, that your webapp can use (in-place of a real backend), with a working web-demo\n\n# live web demo\n- [https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app)\n\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp.png)](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app)\n\n\n\n[![travis-ci.org build-status](https://api.travis-ci.org/kaizhu256/node-swgg.svg)](https://travis-ci.org/kaizhu256/node-swgg) [![coverage](https://kaizhu256.github.io/node-swgg/build/coverage.badge.svg)](https://kaizhu256.github.io/node-swgg/build/coverage.html/index.html)\n\n[![NPM](https://nodei.co/npm/swgg.png?downloads=true)](https://www.npmjs.com/package/swgg)\n\n[![build commit status](https://kaizhu256.github.io/node-swgg/build/build.badge.svg)](https://travis-ci.org/kaizhu256/node-swgg)\n\n| git-branch : | [master](https://github.com/kaizhu256/node-swgg/tree/master) | [beta](https://github.com/kaizhu256/node-swgg/tree/beta) | [alpha](https://github.com/kaizhu256/node-swgg/tree/alpha)|\n|--:|:--|:--|:--|\n| test-server-github : | [![github.com test-server](https://kaizhu256.github.io/node-swgg/GitHub-Mark-32px.png)](https://kaizhu256.github.io/node-swgg/build..master..travis-ci.org/app) | [![github.com test-server](https://kaizhu256.github.io/node-swgg/GitHub-Mark-32px.png)](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app) | [![github.com test-server](https://kaizhu256.github.io/node-swgg/GitHub-Mark-32px.png)](https://kaizhu256.github.io/node-swgg/build..alpha..travis-ci.org/app)|\n| test-server-heroku : | [![heroku.com test-server](https://kaizhu256.github.io/node-swgg/heroku-logo.75x25.png)](https://h1-swgg-master.herokuapp.com) | [![heroku.com test-server](https://kaizhu256.github.io/node-swgg/heroku-logo.75x25.png)](https://h1-swgg-beta.herokuapp.com) | [![heroku.com test-server](https://kaizhu256.github.io/node-swgg/heroku-logo.75x25.png)](https://h1-swgg-alpha.herokuapp.com)|\n| test-report : | [![test-report](https://kaizhu256.github.io/node-swgg/build..master..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-swgg/build..master..travis-ci.org/test-report.html) | [![test-report](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/test-report.html) | [![test-report](https://kaizhu256.github.io/node-swgg/build..alpha..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-swgg/build..alpha..travis-ci.org/test-report.html)|\n| coverage : | [![coverage](https://kaizhu256.github.io/node-swgg/build..master..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-swgg/build..master..travis-ci.org/coverage.html/index.html) | [![coverage](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/coverage.html/index.html) | [![coverage](https://kaizhu256.github.io/node-swgg/build..alpha..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-swgg/build..alpha..travis-ci.org/coverage.html/index.html)|\n| build-artifacts : | [![build-artifacts](https://kaizhu256.github.io/node-swgg/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-swgg/tree/gh-pages/build..master..travis-ci.org) | [![build-artifacts](https://kaizhu256.github.io/node-swgg/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-swgg/tree/gh-pages/build..beta..travis-ci.org) | [![build-artifacts](https://kaizhu256.github.io/node-swgg/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-swgg/tree/gh-pages/build..alpha..travis-ci.org)|\n\n[![npmPackageListing](https://kaizhu256.github.io/node-swgg/build/screenshot.npmPackageListing.svg)](https://github.com/kaizhu256/node-swgg)\n\n![npmPackageDependencyTree](https://kaizhu256.github.io/node-swgg/build/screenshot.npmPackageDependencyTree.svg)\n\n\n\n# table of contents\n1. [cdn download](#cdn-download)\n1. [documentation](#documentation)\n1. [quickstart standalone app](#quickstart-standalone-app)\n1. [quickstart example.js](#quickstart-examplejs)\n1. [extra screenshots](#extra-screenshots)\n1. [package.json](#packagejson)\n1. [changelog of last 50 commits](#changelog-of-last-50-commits)\n1. [internal build script](#internal-build-script)\n1. [misc](#misc)\n\n\n\n# cdn download\n- [https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app/assets.swgg.html](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app/assets.swgg.html)\n- [https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app/assets.swgg.swagger.json](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app/assets.swgg.swagger.json)\n- [https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app/assets.utility2.rollup.js](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app/assets.utility2.rollup.js)\n\n\n\n# documentation\n#### api doc\n- [https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/apidoc.html](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/apidoc.html)\n\n[![apidoc](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/apidoc.html)\n\n#### cli help\n![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.npmPackageCliHelp.svg)\n\n#### todo\n- add input-type=date and input-type=time\n- update function swaggerJsonFromAjax to inline definitions\n- add swagger.json editor\n- allow parsing of default path-argument, e.g. /aa/{bb=1}/{cc=2}\n- add hmacSha256 support for wechat-pay\n- add property parameters.x-swgg-persist to persist to localStorage\n- revamp datatable with card-expansion ui\n- add authorization-header hook\n- add middlewareAcl\n- add api userPasswordChange\n- add cached version crudGetManyByQueryCached\n- none\n\n#### changelog 2019.9.14\n- npm publish 2019.9.14\n- add replace-string-operation to function templateRender\n- merge polyfills into assets.example.begin.js\n- create function eventEmitterCreate\n- merge class _http.IncomingMessage, _http.ServerResponse into function _http.request\n- jslint - remove unexpected_a hacks\n- jslint - migrate from let-declaration to var-declaration\n- inline lib.puppeteer.js into assets.app.js\n- remove electron dependency\n- revamp function local.ajaxProgressUpdate with window.domElementAjaxProgress1\n- jslint - remove ternary-operator/newline comment preceding bra\n- jslint - remove allow-method-chain-newline hack\n- jslint - upgrade to jslint edition 2019.8.3\n- rename coverage-hack to hack-istanbul, gotoNext to gotoNext, gotoState to gotoState, jslint-hack to hack-jslint\n- istanbul - switch parser from esprima to acorn v6.3.0\n- none\n\n#### this package requires\n- darwin or linux os\n\n#### this swagger-implementation is compliant with json-schema-validation (draft-04)\n- [https://json-schema.org/draft-04/json-schema-validation.html](https://json-schema.org/draft-04/json-schema-validation.html)\n\n#### this swagger-implementation is compliant with OpenAPI Specification (2.0)\n- [https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md](https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md)\n\n\n\n# quickstart standalone app\n#### to run this example, follow instruction in script below\n- [assets.app.js](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app/assets.app.js)\n```shell\n# example.sh\n\n# this shell script will download and run a web-demo of swgg as a standalone app\n\n# 1. download standalone app\ncurl -O https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/app/assets.app.js\n# 2. run standalone app\nPORT=8081 node ./assets.app.js\n# 3. open a browser to http://127.0.0.1:8081 and play with web-demo\n# 4. edit file assets.app.js to suit your needs\n```\n\n#### output from browser\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleSh.browser.%252F.png)](https://kaizhu256.github.io/node-swgg/build/app/assets.example.html)\n\n#### output from shell\n![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleSh.svg)\n\n\n\n# quickstart example.js\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleJs.browser.%252F.png)](https://kaizhu256.github.io/node-swgg/build/app/assets.example.html)\n\n#### to run this example, follow instruction in script below\n- [example.js](https://kaizhu256.github.io/node-swgg/build..beta..travis-ci.org/example.js)\n```javascript\n/*\nexample.js\n\nthis script will run a web-demo of swgg\n\ninstruction\n    1. save this script as example.js\n    2. run shell-command:\n        $ npm install swgg \u0026\u0026 \\\n            PORT=8081 node example.js\n    3. open a browser to http://127.0.0.1:8081 and play with web-demo\n    4. edit this script to suit your needs\n*/\n\n\n\n/* istanbul instrument in package swgg */\n/* istanbul ignore next */\n/* jslint utility2:true */\n(function (globalThis) {\n    \"use strict\";\n    let ArrayPrototypeFlat;\n    let TextXxcoder;\n    let consoleError;\n    let local;\n    // init globalThis\n    globalThis.globalThis = globalThis.globalThis || globalThis;\n    // init debug_inline\n    if (!globalThis[\"debug\\u0049nline\"]) {\n        consoleError = console.error;\n        globalThis[\"debug\\u0049nline\"] = function (...argList) {\n        /*\n         * this function will both print \u003cargList\u003e to stderr\n         * and return \u003cargList\u003e[0]\n         */\n            // debug argList\n            globalThis[\"debug\\u0049nlineArgList\"] = argList;\n            consoleError(\"\\n\\ndebug\\u0049nline\");\n            consoleError.apply(console, argList);\n            consoleError(\"\\n\");\n            // return arg0 for inspection\n            return argList[0];\n        };\n    }\n    // polyfill\n    ArrayPrototypeFlat = function (depth) {\n    /*\n     * this function will polyfill Array.prototype.flat\n     * https://github.com/jonathantneal/array-flat-polyfill\n     */\n        depth = (\n            globalThis.isNaN(depth)\n            ? 1\n            : Number(depth)\n        );\n        if (!depth) {\n            return Array.prototype.slice.call(this);\n        }\n        return Array.prototype.reduce.call(this, function (acc, cur) {\n            if (Array.isArray(cur)) {\n                // recurse\n                acc.push.apply(acc, ArrayPrototypeFlat.call(cur, depth - 1));\n            } else {\n                acc.push(cur);\n            }\n            return acc;\n        }, []);\n    };\n    Array.prototype.flat = Array.prototype.flat || ArrayPrototypeFlat;\n    Array.prototype.flatMap = Array.prototype.flatMap || function flatMap(\n        ...argList\n    ) {\n    /*\n     * this function will polyfill Array.prototype.flatMap\n     * https://github.com/jonathantneal/array-flat-polyfill\n     */\n        return this.map(...argList).flat();\n    };\n    (function () {\n        try {\n            globalThis.TextDecoder = (\n                globalThis.TextDecoder || require(\"util\").TextDecoder\n            );\n            globalThis.TextEncoder = (\n                globalThis.TextEncoder || require(\"util\").TextEncoder\n            );\n        } catch (ignore) {}\n    }());\n    TextXxcoder = function () {\n    /*\n     * this function will polyfill TextDecoder/TextEncoder\n     * https://gist.github.com/Yaffle/5458286\n     */\n        return;\n    };\n    TextXxcoder.prototype.decode = function (octets) {\n    /*\n     * this function will polyfill TextDecoder.prototype.decode\n     * https://gist.github.com/Yaffle/5458286\n     */\n        let bytesNeeded;\n        let codePoint;\n        let ii;\n        let kk;\n        let octet;\n        let string;\n        string = \"\";\n        ii = 0;\n        while (ii \u003c octets.length) {\n            octet = octets[ii];\n            bytesNeeded = 0;\n            codePoint = 0;\n            if (octet \u003c= 0x7F) {\n                bytesNeeded = 0;\n                codePoint = octet \u0026 0xFF;\n            } else if (octet \u003c= 0xDF) {\n                bytesNeeded = 1;\n                codePoint = octet \u0026 0x1F;\n            } else if (octet \u003c= 0xEF) {\n                bytesNeeded = 2;\n                codePoint = octet \u0026 0x0F;\n            } else if (octet \u003c= 0xF4) {\n                bytesNeeded = 3;\n                codePoint = octet \u0026 0x07;\n            }\n            if (octets.length - ii - bytesNeeded \u003e 0) {\n                kk = 0;\n                while (kk \u003c bytesNeeded) {\n                    octet = octets[ii + kk + 1];\n                    codePoint = (codePoint \u003c\u003c 6) | (octet \u0026 0x3F);\n                    kk += 1;\n                }\n            } else {\n                codePoint = 0xFFFD;\n                bytesNeeded = octets.length - ii;\n            }\n            string += String.fromCodePoint(codePoint);\n            ii += bytesNeeded + 1;\n        }\n        return string;\n    };\n    TextXxcoder.prototype.encode = function (string) {\n    /*\n     * this function will polyfill TextEncoder.prototype.encode\n     * https://gist.github.com/Yaffle/5458286\n     */\n        let bits;\n        let cc;\n        let codePoint;\n        let ii;\n        let length;\n        let octets;\n        octets = [];\n        length = string.length;\n        ii = 0;\n        while (ii \u003c length) {\n            codePoint = string.codePointAt(ii);\n            cc = 0;\n            bits = 0;\n            if (codePoint \u003c= 0x0000007F) {\n                cc = 0;\n                bits = 0x00;\n            } else if (codePoint \u003c= 0x000007FF) {\n                cc = 6;\n                bits = 0xC0;\n            } else if (codePoint \u003c= 0x0000FFFF) {\n                cc = 12;\n                bits = 0xE0;\n            } else if (codePoint \u003c= 0x001FFFFF) {\n                cc = 18;\n                bits = 0xF0;\n            }\n            octets.push(bits | (codePoint \u003e\u003e cc));\n            cc -= 6;\n            while (cc \u003e= 0) {\n                octets.push(0x80 | ((codePoint \u003e\u003e cc) \u0026 0x3F));\n                cc -= 6;\n            }\n            ii += (\n                codePoint \u003e= 0x10000\n                ? 2\n                : 1\n            );\n        }\n        return octets;\n    };\n    globalThis.TextDecoder = globalThis.TextDecoder || TextXxcoder;\n    globalThis.TextEncoder = globalThis.TextEncoder || TextXxcoder;\n    // init local\n    local = {};\n    local.local = local;\n    globalThis.globalLocal = local;\n    // init isBrowser\n    local.isBrowser = (\n        typeof globalThis.XMLHttpRequest === \"function\"\n        \u0026\u0026 globalThis.navigator\n        \u0026\u0026 typeof globalThis.navigator.userAgent === \"string\"\n    );\n    // init function\n    local.assertOrThrow = function (passed, message) {\n    /*\n     * this function will throw err.\u003cmessage\u003e if \u003cpassed\u003e is falsy\n     */\n        let err;\n        if (passed) {\n            return;\n        }\n        err = (\n            (\n                message\n                \u0026\u0026 typeof message.message === \"string\"\n                \u0026\u0026 typeof message.stack === \"string\"\n            )\n            // if message is errObj, then leave as is\n            ? message\n            : new Error(\n                typeof message === \"string\"\n                // if message is a string, then leave as is\n                ? message\n                // else JSON.stringify message\n                : JSON.stringify(message, null, 4)\n            )\n        );\n        throw err;\n    };\n    local.fsRmrfSync = function (dir) {\n    /*\n     * this function will sync \"rm -rf\" \u003cdir\u003e\n     */\n        let child_process;\n        try {\n            child_process = require(\"child_process\");\n        } catch (ignore) {\n            return;\n        }\n        child_process.spawnSync(\"rm\", [\n            \"-rf\", dir\n        ], {\n            stdio: [\n                \"ignore\", 1, 2\n            ]\n        });\n    };\n    local.fsWriteFileWithMkdirpSync = function (file, data) {\n    /*\n     * this function will sync write \u003cdata\u003e to \u003cfile\u003e with \"mkdir -p\"\n     */\n        let fs;\n        try {\n            fs = require(\"fs\");\n        } catch (ignore) {\n            return;\n        }\n        // try to write file\n        try {\n            fs.writeFileSync(file, data);\n        } catch (ignore) {\n            // mkdir -p\n            require(\"child_process\").spawnSync(\n                \"mkdir\",\n                [\n                    \"-p\", require(\"path\").dirname(file)\n                ],\n                {\n                    stdio: [\n                        \"ignore\", 1, 2\n                    ]\n                }\n            );\n            // rewrite file\n            fs.writeFileSync(file, data);\n        }\n    };\n    local.functionOrNop = function (fnc) {\n    /*\n     * this function will if \u003cfnc\u003e exists,\n     * return \u003cfnc\u003e,\n     * else return \u003cnop\u003e\n     */\n        return fnc || local.nop;\n    };\n    local.nop = function () {\n    /*\n     * this function will do nothing\n     */\n        return;\n    };\n    local.objectAssignDefault = function (target, source) {\n    /*\n     * this function will if items from \u003ctarget\u003e are\n     * null, undefined, or empty-string,\n     * then overwrite them with items from \u003csource\u003e\n     */\n        target = target || {};\n        Object.keys(source || {}).forEach(function (key) {\n            if (\n                target[key] === null\n                || target[key] === undefined\n                || target[key] === \"\"\n            ) {\n                target[key] = target[key] || source[key];\n            }\n        });\n        return target;\n    };\n    local.value = function (val) {\n    /*\n     * this function will return \u003cval\u003e\n     */\n        return val;\n    };\n    local.valueOrEmptyList = function (val) {\n    /*\n     * this function will return \u003cval\u003e or []\n     */\n        return val || [];\n    };\n    local.valueOrEmptyObject = function (val) {\n    /*\n     * this function will return \u003cval\u003e or {}\n     */\n        return val || {};\n    };\n    local.valueOrEmptyString = function (val) {\n    /*\n     * this function will return \u003cval\u003e or \"\"\n     */\n        return val || \"\";\n    };\n    // require builtin\n    if (!local.isBrowser) {\n        local.assert = require(\"assert\");\n        local.buffer = require(\"buffer\");\n        local.child_process = require(\"child_process\");\n        local.cluster = require(\"cluster\");\n        local.crypto = require(\"crypto\");\n        local.dgram = require(\"dgram\");\n        local.dns = require(\"dns\");\n        local.domain = require(\"domain\");\n        local.events = require(\"events\");\n        local.fs = require(\"fs\");\n        local.http = require(\"http\");\n        local.https = require(\"https\");\n        local.net = require(\"net\");\n        local.os = require(\"os\");\n        local.path = require(\"path\");\n        local.querystring = require(\"querystring\");\n        local.readline = require(\"readline\");\n        local.repl = require(\"repl\");\n        local.stream = require(\"stream\");\n        local.string_decoder = require(\"string_decoder\");\n        local.timers = require(\"timers\");\n        local.tls = require(\"tls\");\n        local.tty = require(\"tty\");\n        local.url = require(\"url\");\n        local.util = require(\"util\");\n        local.vm = require(\"vm\");\n        local.zlib = require(\"zlib\");\n    }\n}((typeof globalThis === \"object\" \u0026\u0026 globalThis) || (function () {\n    return Function(\"return this\")(); // jslint ignore:line\n}())));\n\n\n\n(function (local) {\n\"use strict\";\n\n\n\n// run shared js-env code - init-before\n(function () {\n// init local\nlocal = (\n    globalThis.utility2_rollup\n    || globalThis.utility2_swgg\n    || require(\"swgg\")\n);\n// init exports\nglobalThis.local = local;\n// init assets\nlocal.assetsDict[\"/assets.swgg.swagger.json\"] = (\n    local.assetsDict[\"/assets.swgg.swagger.petstore.json\"]\n);\n// load db\nlocal.db.dbLoad(function () {\n    console.error(\"db loaded from \" + local.storageDir);\n});\n}());\n\n\n\n// run shared js-env code - function\n(function () {\nlocal.middlewareCrudCustom = function (req, response, nextMiddleware) {\n/*\n * this function will run the middleware to run custom-crud-operations\n */\n    let crud;\n    let opt;\n    let result;\n    opt = {};\n    local.gotoNext(opt, function (err, data) {\n        switch (opt.gotoState) {\n        case 1:\n            crud = req.swgg.crud;\n            switch (crud.crudType[0]) {\n            // hack-istanbul - test err handling-behavior\n            case \"crudErrorPre\":\n                opt.gotoNext(local.errDefault);\n                return;\n            case \"getInventory\":\n                crud.dbTable.crudGetManyByQuery({\n                    query: {},\n                    projection: [\n                        \"status\"\n                    ]\n                }, opt.gotoNext);\n                break;\n            default:\n                opt.gotoState = Infinity;\n                opt.gotoNext();\n            }\n            break;\n        case 2:\n            switch (crud.crudType[0]) {\n            case \"getInventory\":\n                result = {};\n                data.forEach(function (element) {\n                    result[element.status] = result[element.status] || 0;\n                    result[element.status] += 1;\n                });\n                opt.gotoNext(null, result);\n                break;\n            }\n            break;\n        case 3:\n            local.swgg.serverRespondJsonapi(req, response, err, data);\n            break;\n        default:\n            nextMiddleware(err, data);\n        }\n    });\n    opt.gotoState = 0;\n    opt.gotoNext();\n};\n\nlocal.middlewareInitCustom = function (req, response, nextMiddleware) {\n/*\n * this function will run the middleware to custom-init \u003creq\u003e and \u003cres\u003e\n */\n    // enable cors\n    // https://en.wikipedia.org/wiki/Cross-origin_resource_sharing\n    response.setHeader(\n        \"Access-Control-Allow-Methods\",\n        \"DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT\"\n    );\n    response.setHeader(\"Access-Control-Allow-Origin\", \"*\");\n    // init content-type\n    response.setHeader(\"Content-Type\", \"application/json; charset=UTF-8\");\n    // ignore .map files\n    if (req.urlParsed.pathname.slice(-4) === \".map\") {\n        local.serverRespondDefault(req, response, 404);\n        return;\n    }\n    nextMiddleware();\n};\n}());\n\n\n\n// run shared js-env code - init-after\n(function () {\n// init assets\n/* jslint ignore:start */\nlocal.assetsDict['/assets.index.template.html'] = local.assetsDict['/assets.swgg.html']\n    .replace((/\\n\u003c\\/script\u003e\\n/), '\\\n\\n\\\n\u003c/script\u003e\\n\\\n\u003ch1\u003e\\n\\\n\u003c!-- utility2-comment\\n\\\n\u003ca\\n\\\n    {{#if env.npm_package_homepage}}\\n\\\n    href=\"{{env.npm_package_homepage}}\"\\n\\\n    {{/if env.npm_package_homepage}}\\n\\\n    target=\"_blank\"\\n\\\n\u003e\\n\\\nutility2-comment --\u003e\\n\\\n    {{env.npm_package_name}} ({{env.npm_package_version}})\\n\\\n\u003c!-- utility2-comment\\n\\\n\u003c/a\u003e\\n\\\nutility2-comment --\u003e\\n\\\n\u003c/h1\u003e\\n\\\n\u003ch3\u003e{{env.npm_package_description}}\u003c/h3\u003e\\n\\\n\u003c!-- utility2-comment\\n\\\n\u003ca class=\"button\" download href=\"assets.app.js\"\u003edownload standalone app\u003c/a\u003e\u003cbr\u003e\\n\\\n\u003cbutton class=\"button\" data-onevent=\"testRunBrowser\" id=\"buttonTestRun1\"\u003erun internal test\u003c/button\u003e\u003cbr\u003e\\n\\\n\u003cdiv class=\"uiAnimateSlide\" id=\"htmlTestReport1\" style=\"border-bottom: 0; border-top: 0; margin-bottom: 0; margin-top: 0; max-height: 0; padding-bottom: 0; padding-top: 0;\"\u003e\u003c/div\u003e\\n\\\nutility2-comment --\u003e\\n\\\n\\n\\\n\\n\\\n\\n\\\n\u003c!-- custom-html-start --\u003e\\n\\\n\u003cbutton class=\"button\" data-onevent=\"onEventDomDb\" data-onevent-db=\"dbReset\"\u003ereset database\u003c/button\u003e\u003cbr\u003e\\n\\\n\u003cbutton class=\"button\" data-onevent=\"onEventDomDb\" data-onevent-db=\"dbExport\"\u003eexport database -\u0026gt; file\u003c/button\u003e\u003cbr\u003e\\n\\\n\u003cbutton class=\"button\" data-onevent=\"onEventDomDb\" data-onevent-db=\"dbImport\"\u003eimport database \u0026lt;- file\u003c/button\u003e\u003cbr\u003e\\n\\\n\u003c/button\u003e\u003cbr\u003e\\n\\\n\u003cinput class=\"onchange zeroPixel\" type=\"file\" id=\"dbImportInput1\"\u003e\\n\\\n')\n            .replace('assets.swgg.swagger.json', 'assets.swgg.swagger.server.json')\n            .replace((/\\n\u003cscript src=[\\S\\s]*\\n\u003c\\/html\u003e\\n/), '\\\n\\n\\\n\u003c!-- custom-html-end --\u003e\\n\\\n\\n\\\n\\n\\\n\\n\\\n\u003c!-- utility2-comment\\n\\\n{{#if isRollup}}\\n\\\n\u003cscript src=\"assets.app.js\"\u003e\u003c/script\u003e\\n\\\n{{#unless isRollup}}\\n\\\n\u003cscript src=\"assets.utility2.rollup.js\"\u003e\u003c/script\u003e\\n\\\n\u003cscript\u003ewindow.utility2_onReadyBefore.counter += 1;\u003c/script\u003e\\n\\\n\u003cscript src=\"jsonp.utility2.stateInit?callback=window.utility2.stateInit\"\u003e\u003c/script\u003e\\n\\\nutility2-comment --\u003e\\n\\\n\u003cscript src=\"assets.swgg.js\"\u003e\u003c/script\u003e\\n\\\n\u003cscript src=\"assets.example.js\"\u003e\u003c/script\u003e\\n\\\n\u003cscript src=\"assets.test.js\"\u003e\u003c/script\u003e\\n\\\n\u003cscript\u003ewindow.utility2_onReadyBefore();\u003c/script\u003e\\n\\\n\u003c!-- utility2-comment\\n\\\n{{/if isRollup}}\\n\\\nutility2-comment --\u003e\\n\\\n\u003cscript\u003e\\n\\\n/* jslint utility2:true */\\n\\\n(function () {\\n\\\n\"use strict\";\\n\\\nlet htmlTestReport1;\\n\\\nlet local;\\n\\\nhtmlTestReport1 = document.querySelector(\"#htmlTestReport1\");\\n\\\nlocal = window.utility2;\\n\\\nif (!(htmlTestReport1 \u0026\u0026 local)) {\\n\\\n    return;\\n\\\n}\\n\\\nlocal.on(\"utility2.testRunProgressUpdate\", function (testReport) {\\n\\\n    htmlTestReport1.innerHTML = local.testReportMerge(testReport, {});\\n\\\n});\\n\\\nlocal.on(\"utility2.testRunStart\", function (testReport) {\\n\\\n    local.uiAnimateSlideDown(htmlTestReport1);\\n\\\n    htmlTestReport1.innerHTML = local.testReportMerge(testReport, {});\\n\\\n});\\n\\\n}());\\n\\\n\u003c/script\u003e\\n\\\n\u003c/body\u003e\\n\\\n\u003c/html\u003e\\n\\\n');\n/* jslint ignore:end */\n\n\n\n// init middleware\nlocal.middlewareList = [\n    local.middlewareInit,\n    local.middlewareForwardProxy,\n    local.middlewareAssetsCached,\n    local.swgg.middlewareRouter,\n    local.swgg.middlewareUserLogin,\n    local.middlewareInitCustom,\n    local.middlewareJsonpStateInit,\n    local.middlewareBodyRead,\n    local.swgg.middlewareBodyParse,\n    local.swgg.middlewareValidate,\n    local.middlewareCrudCustom,\n    local.swgg.middlewareCrudBuiltin,\n    local.swgg.middlewareCrudEnd\n];\nlocal.utility2.middlewareList = local.middlewareList;\n// run test-server\nlocal.testRunServer(local);\n/* validateLineSortedReset */\n// init petstore-api - frontend\nlocal.tmp = JSON.parse(local.assetsDict[\"/assets.swgg.swagger.petstore.json\"]);\ndelete local.tmp.basePath;\ndelete local.tmp.host;\ndelete local.tmp.schemes;\nlocal.swgg.apiUpdate(local.tmp);\n// init petstore-api - backend\nlocal.swgg.apiUpdate({\n    definitions: {\n        File: {\n            allOf: [\n                {\n                    $ref: \"#/definitions/BuiltinFile\"\n                }\n            ]\n        },\n        Pet: {\n            properties: {\n                _id: {\n                    readOnly: true,\n                    type: \"string\"\n                },\n                _timeCreated: {\n                    format: \"date-time\",\n                    readOnly: true,\n                    type: \"string\"\n                },\n                _timeUpdated: {\n                    format: \"date-time\",\n                    readOnly: true,\n                    type: \"string\"\n                },\n                id: {\n                    default: 1,\n                    minimum: 1\n                }\n            }\n        },\n        Order: {\n            properties: {\n                _id: {\n                    readOnly: true,\n                    type: \"string\"\n                },\n                _timeCreated: {\n                    format: \"date-time\",\n                    readOnly: true,\n                    type: \"string\"\n                },\n                _timeUpdated: {\n                    format: \"date-time\",\n                    readOnly: true,\n                    type: \"string\"\n                },\n                id: {\n                    default: 1,\n                    minimum: 1\n                }\n            }\n        },\n        User: {\n            allOf: [\n                {\n                    $ref: \"#/definitions/BuiltinUser\"\n                }\n            ],\n            properties: {\n                _id: {\n                    readOnly: true,\n                    type: \"string\"\n                },\n                _timeCreated: {\n                    format: \"date-time\",\n                    readOnly: true,\n                    type: \"string\"\n                },\n                _timeUpdated: {\n                    format: \"date-time\",\n                    readOnly: true,\n                    type: \"string\"\n                },\n                email: {\n                    default: \"a@a.com\",\n                    format: \"email\"\n                },\n                id: {\n                    default: 1,\n                    minimum: 1\n                }\n            }\n        }\n    },\n    tags: [\n        {\n            description: \"builtin-file model\",\n            name: \"file\"\n        }\n    ],\n    \"x-swgg-apiDict\": {\n        \"operationId.file.crudCountManyByQuery\": {\n            _schemaName: \"File\"\n        },\n        \"operationId.file.crudSetOneById.id.id\": {\n            _schemaName: \"File\"\n        },\n        \"operationId.file.crudGetManyByQuery\": {\n            _schemaName: \"File\"\n        },\n        \"operationId.file.crudRemoveOneById.id.id\": {\n            _schemaName: \"File\"\n        },\n        \"operationId.file.crudUpdateOneById.id.id\": {\n            _schemaName: \"File\"\n        },\n        \"operationId.file.fileGetOneById.id.id\": {\n            _schemaName: \"File\"\n        },\n        \"operationId.file.fileUploadManyByForm.1\": {\n            _schemaName: \"File\"\n        },\n        \"operationId.addPet\": {\n            _crudType: [\n                \"crudSetOneById\", \"petId\", \"id\"\n            ],\n            _schemaName: \"Pet\"\n        },\n        \"operationId.pet.crudGetManyByQuery\": {\n            _schemaName: \"Pet\"\n        },\n        \"operationId.deletePet\": {\n            _crudType: [\n                \"crudRemoveOneById\", \"petId\", \"id\"\n            ],\n            _schemaName: \"Pet\"\n        },\n        \"operationId.findPetsByStatus\": {\n            _crudType: [\n                \"crudGetManyByQuery\"\n            ],\n            _queryWhere: \"{\\\"status\\\":{\\\"$in\\\":{{status jsonStringify}}}}\",\n            _schemaName: \"Pet\"\n        },\n        \"operationId.findPetsByTags\": {\n            _crudType: [\n                \"crudGetManyByQuery\"\n            ],\n            _queryWhere: \"{\\\"tags.name\\\":{\\\"$in\\\":{{tags jsonStringify}}}}\",\n            _schemaName: \"Pet\"\n        },\n        \"operationId.getPetById\": {\n            _crudType: [\n                \"crudGetOneById\", \"petId\", \"id\"\n            ],\n            _schemaName: \"Pet\"\n        },\n        \"operationId.updatePet\": {\n            _crudType: [\n                \"crudUpdateOneById\", \"petId\", \"id\"\n            ],\n            _schemaName: \"Pet\"\n        },\n        \"operationId.updatePetWithForm\": {\n            _crudType: [\n                \"crudUpdateOneById\", \"petId\", \"id\"\n            ],\n            _schemaName: \"Pet\"\n        },\n        \"operationId.uploadFile\": {\n            _crudType: [\n                \"fileUploadManyByForm\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.store.crudGetManyByQuery\": {\n            _schemaName: \"Order\"\n        },\n        \"operationId.store.crudUpdateOneById.id.id\": {\n            _schemaName: \"Order\"\n        },\n        \"operationId.deleteOrder\": {\n            _crudType: [\n                \"crudRemoveOneById\", \"orderId\", \"id\"\n            ],\n            _schemaName: \"Order\"\n        },\n        \"operationId.getInventory\": {\n            _schemaName: \"Order\"\n        },\n        \"operationId.getOrderById\": {\n            _crudType: [\n                \"crudGetOneById\", \"orderId\", \"id\"\n            ],\n            _schemaName: \"Order\"\n        },\n        \"operationId.placeOrder\": {\n            _crudType: [\n                \"crudSetOneById\", \"orderId\", \"id\"\n            ],\n            _schemaName: \"Order\"\n        },\n        \"operationId.createUser\": {\n            _crudType: [\n                \"crudSetOneById\", \"username\", \"username\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.createUsersWithArrayInput\": {\n            _crudType: [\n                \"crudSetManyById\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.createUsersWithListInput\": {\n            _crudType: [\n                \"crudSetManyById\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.user.crudCountManyByQuery\": {\n            _schemaName: \"User\"\n        },\n        \"operationId.user.crudSetOneById.username.username\": {\n            _schemaName: \"User\"\n        },\n        \"operationId.user.crudRemoveOneById.username.username\": {\n            _schemaName: \"User\"\n        },\n        \"operationId.user.crudGetManyByQuery\": {\n            _schemaName: \"User\"\n        },\n        \"operationId.user.crudUpdateOneById.username.username\": {\n            _schemaName: \"User\"\n        },\n        \"operationId.deleteUser\": {\n            _crudType: [\n                \"crudRemoveOneById\", \"username\", \"username\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.getUserByName\": {\n            _crudType: [\n                \"crudGetOneById\", \"username\", \"username\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.loginUser\": {\n            _crudType: [\n                \"userLoginByPassword\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.logoutUser\": {\n            _crudType: [\n                \"userLogout\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.updateUser\": {\n            _crudType: [\n                \"crudUpdateOneById\", \"username\", \"username\"\n            ],\n            _schemaName: \"User\"\n        },\n        \"operationId.user.userLoginByPassword\": {\n            _schemaName: \"User\"\n        },\n        \"operationId.user.userLogout\": {\n            _schemaName: \"User\"\n        }\n    }\n});\n/* validateLineSortedReset */\n// init db\nglobalThis.utility2_dbSeedList = [{\n    dbRowList: [\n        {\n            id: \"testCase_swaggerUiLogoSmall\",\n            fileBlob: local.swgg.templateSwaggerUiLogoSmallBase64,\n            fileContentType: \"image/png\",\n            fileDescription: \"swagger-ui logo\",\n            fileFilename: \"swaggerUiLogoSmall.png\"\n        }\n    ],\n    idIndexCreateList: [\n        {\n            name: \"id\"\n        }\n    ],\n    name: \"File\"\n}, {\n    dbRowList: local.swgg.dbRowListRandomCreate({\n        dbRowList: [\n            {\n                id: 0,\n                name: \"birdie\",\n                photoUrls: [],\n                status: \"available\",\n                tags: [\n                    {\n                        name: \"bird\"\n                    }\n                ]\n            }, {\n                id: 1,\n                name: \"doggie\",\n                status: \"pending\",\n                photoUrls: [],\n                tags: [\n                    {\n                        name: \"dog\"\n                    }\n                ]\n            }, {\n                id: 2,\n                name: \"fishie\",\n                photoUrls: [],\n                status: \"sold\",\n                tags: [\n                    {\n                        name: \"fish\"\n                    }\n                ]\n            }\n        ],\n        // init 100 extra random pets\n        length: 100,\n        override: function (opt) {\n            return {\n                id: opt.ii + 100,\n                name: local.listGetElementRandom([\n                    \"birdie\", \"doggie\", \"fishie\"\n                ]) + \"-\" + (opt.ii + 100),\n                tags: [\n                    {\n                        name: local.listGetElementRandom([\n                            \"female\", \"male\"\n                        ])\n                    }\n                ]\n            };\n        },\n        schema: local.swgg.swaggerJson.definitions.Pet\n    }),\n    idIndexCreateList: [\n        {\n            isInteger: true,\n            name: \"id\"\n        }\n    ],\n    name: \"Pet\"\n}, {\n    dbRowList: local.swgg.dbRowListRandomCreate({\n        dbRowList: [\n            {\n                id: 0,\n                petId: 0,\n                status: \"available\"\n            }, {\n                id: 1,\n                petId: 1,\n                status: \"pending\"\n            }, {\n                id: 2,\n                petId: 2,\n                status: \"sold\"\n            }\n        ],\n        // init 100 extra random orders\n        length: 100,\n        override: function (opt) {\n            return {\n                id: opt.ii + 100,\n                petId: opt.ii + 100\n            };\n        },\n        schema: local.swgg.swaggerJson.definitions.Order\n    }),\n    idIndexCreateList: [\n        {\n            isInteger: true,\n            name: \"id\"\n        }\n    ],\n    name: \"Order\"\n}, {\n    dbRowList: local.swgg.dbRowListRandomCreate({\n        dbRowList: [\n            {\n                email: \"admin@admin.com\",\n                firstName: \"admin\",\n                id: 0,\n                lastName: \"\",\n                password: local.sjclHashScryptCreate(\"secret\"),\n                phone: \"1234-5678\",\n                username: \"admin\"\n            }, {\n                email: \"jane@doe.com\",\n                firstName: \"jane\",\n                id: 1,\n                lastName: \"doe\",\n                password: local.sjclHashScryptCreate(\"secret\"),\n                phone: \"1234-5678\",\n                username: \"jane.doe\"\n            }, {\n                email: \"john@doe.com\",\n                firstName: \"john\",\n                id: 2,\n                lastName: \"doe\",\n                password: local.sjclHashScryptCreate(\"secret\"),\n                phone: \"1234-5678\",\n                username: \"john.doe\"\n            }\n        ],\n        // init 100 extra random users\n        length: 100,\n        override: function (opt) {\n            return {\n                firstName: local.listGetElementRandom([\n                    \"alice\", \"bob\", \"jane\", \"john\"\n                ]) + \"-\" + (opt.ii + 100),\n                id: opt.ii + 100,\n                lastName: local.listGetElementRandom([\n                    \"doe\", \"smith\"\n                ]) + \"-\" + (opt.ii + 100),\n                password: local.sjclHashScryptCreate(\"secret\"),\n                tags: [\n                    {\n                        name: local.listGetElementRandom([\n                            \"female\", \"male\"\n                        ])\n                    }, {\n                        name: Math.random().toString(36).slice(2)\n                    }\n                ]\n            };\n        },\n        schema: local.swgg.swaggerJson.definitions.User\n    }),\n    idIndexCreateList: [\n        {\n            name: \"email\"\n        }, {\n            name: \"id\",\n            isInteger: true\n        }, {\n            name: \"username\"\n        }\n    ],\n    name: \"User\"\n}];\n// seed db\nlocal.db.dbSeed(globalThis.utility2_dbSeedList, local.onErrorThrow);\n// init serverLocal\nlocal.utility2.serverLocalUrlTest = function (url) {\n    url = local.urlParse(url).pathname;\n    return (\n        local.isBrowser\n        \u0026\u0026 !local.env.npm_config_mode_backend\n        \u0026\u0026 (\n            /^\\/test\\.|\\/api\\/v0\\//\n        ).test(url)\n    );\n};\n}());\n\n\n\n/* istanbul ignore next */\n// run browser js-env code - init-test\n(function () {\nif (!local.isBrowser) {\n    return;\n}\n// log stderr and stdout to #outputStdout1\n[\"error\", \"log\"].forEach(function (key) {\n    let elem;\n    let fnc;\n    elem = document.querySelector(\n        \"#outputStdout1\"\n    );\n    if (!elem) {\n        return;\n    }\n    fnc = console[key];\n    console[key] = function (...argList) {\n        fnc.apply(console, argList);\n        // append text to #outputStdout1\n        elem.textContent += argList.map(function (arg) {\n            return (\n                typeof arg === \"string\"\n                ? arg\n                : JSON.stringify(arg, null, 4)\n            );\n        }).join(\" \").replace((\n            /\\u001b\\[\\d*m/g\n        ), \"\") + \"\\n\";\n        // scroll textarea to bottom\n        elem.scrollTop = elem.scrollHeight;\n    };\n});\nlocal.objectAssignDefault(local, globalThis.domOnEventDelegateDict);\nglobalThis.domOnEventDelegateDict = local;\nlocal.onEventDomDb = local.db \u0026\u0026 local.db.onEventDomDb;\nlocal.testRunBrowser = function (evt) {\n/*\n * this function will run browser-tests\n */\n    switch (\n        !evt.ctrlKey\n        \u0026\u0026 !evt.metaKey\n        \u0026\u0026 (\n            evt.modeInit\n            || (evt.type + \".\" + (evt.target \u0026\u0026 evt.target.id))\n        )\n    ) {\n    // custom-case\n    case true:\n        // init ui\n        globalThis.utility2_onReadyBefore.counter += 1;\n        local.swgg.uiEventListenerDict.onEventUiReload(\n            null,\n            globalThis.utility2_onReadyBefore\n        );\n        return;\n    // run browser-tests\n    default:\n        if (\n            (evt.target \u0026\u0026 evt.target.id) !== \"buttonTestRun1\"\n            \u0026\u0026 !(evt.modeInit \u0026\u0026 (\n                /\\bmodeTest=1\\b/\n            ).test(location.search))\n        ) {\n            return;\n        }\n        // show browser-tests\n        if (document.querySelector(\n            \"#htmlTestReport1\"\n        ).style.maxHeight === \"0px\") {\n            globalThis.domOnEventDelegateDict.domOnEventResetOutput();\n            local.uiAnimateSlideDown(document.querySelector(\n                \"#htmlTestReport1\"\n            ));\n            document.querySelector(\n                \"#buttonTestRun1\"\n            ).textContent = \"hide internal test\";\n            local.modeTest = 1;\n            local.testRunDefault(local);\n            return;\n        }\n        // hide browser-tests\n        local.uiAnimateSlideUp(document.querySelector(\n            \"#htmlTestReport1\"\n        ));\n        document.querySelector(\n            \"#buttonTestRun1\"\n        ).textContent = \"run internal test\";\n    }\n};\n\nlocal.testRunBrowser({\n    modeInit: true\n});\n}());\n\n\n\n/* istanbul ignore next */\n// run node js-env code - init-test\n(function () {\nif (local.isBrowser) {\n    return;\n}\n// init exports\nmodule.exports = local;\n/* validateLineSortedReset */\n// init assets\nlocal.assetsDict = local.assetsDict || {};\n[\n    \"assets.index.template.html\",\n    \"assets.swgg.swagger.json\",\n    \"assets.swgg.swagger.server.json\"\n].forEach(function (file) {\n    file = \"/\" + file;\n    local.assetsDict[file] = local.assetsDict[file] || \"\";\n    if (local.fs.existsSync(local.__dirname + file)) {\n        local.assetsDict[file] = local.fs.readFileSync(\n            local.__dirname + file,\n            \"utf8\"\n        );\n    }\n});\n/* validateLineSortedReset */\n/* jslint ignore:start */\nlocal.assetsDict[\"/assets.swgg.js\"] =\n    local.assetsDict[\"/assets.swgg.js\"] ||\n    local.fs.readFileSync(local.__dirname + \"/lib.swgg.js\", \"utf8\"\n).replace((/^#!\\//), \"// \");\n/* jslint ignore:end */\n/* validateLineSortedReset */\nlocal.assetsDict[\"/\"] = local.assetsDict[\n    \"/assets.index.template.html\"\n].replace((\n    /\\{\\{env\\.(\\w+?)\\}\\}/g\n), function (match0, match1) {\n    switch (match1) {\n    case \"npm_package_description\":\n        return \"the greatest app in the world!\";\n    case \"npm_package_name\":\n        return \"swgg\";\n    case \"npm_package_nameLib\":\n        return \"swgg\";\n    case \"npm_package_version\":\n        return \"0.0.1\";\n    default:\n        return match0;\n    }\n});\nlocal.assetsDict[\"/assets.example.html\"] = local.assetsDict[\"/\"];\nlocal.assetsDict[\"/index.html\"] = local.assetsDict[\"/\"];\n// init cli\nif (module !== require.main || globalThis.utility2_rollup) {\n    return;\n}\n/* validateLineSortedReset */\nlocal.assetsDict[\"/assets.example.js\"] = (\n    local.assetsDict[\"/assets.example.js\"]\n    || local.fs.readFileSync(__filename, \"utf8\")\n);\nlocal.assetsDict[\"/favicon.ico\"] = local.assetsDict[\"/favicon.ico\"] || \"\";\n// if $npm_config_timeout_exit exists,\n// then exit this process after $npm_config_timeout_exit ms\nif (Number(process.env.npm_config_timeout_exit)) {\n    setTimeout(process.exit, Number(process.env.npm_config_timeout_exit));\n}\n// start server\nif (globalThis.utility2_serverHttp1) {\n    return;\n}\nprocess.env.PORT = process.env.PORT || \"8081\";\nconsole.error(\"http-server listening on port \" + process.env.PORT);\nlocal.http.createServer(function (req, res) {\n    req.urlParsed = local.url.parse(req.url);\n    if (local.assetsDict[req.urlParsed.pathname] !== undefined) {\n        res.end(local.assetsDict[req.urlParsed.pathname]);\n        return;\n    }\n    res.statusCode = 404;\n    res.end();\n}).listen(process.env.PORT);\n}());\n}());\n```\n\n#### output from browser\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleJs.browser.%252F.png)](https://kaizhu256.github.io/node-swgg/build/app/assets.example.html)\n\n#### output from shell\n![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleJs.svg)\n\n\n\n# extra screenshots\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp%252Fassets.swgg.html.png](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp%252Fassets.swgg.html.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp%252Fassets.swgg.html.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp%252Fassets.swgg.html.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp.png](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithub.browser.%252Fnode-swgg%252Fbuild%252Fapp.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithubTest.browser.%252Fnode-swgg%252Fbuild%252Fapp.png](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithubTest.browser.%252Fnode-swgg%252Fbuild%252Fapp.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithubTest.browser.%252Fnode-swgg%252Fbuild%252Fapp.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.deployGithubTest.browser.%252Fnode-swgg%252Fbuild%252Fapp.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.deployHeroku.browser.%252Fassets.swgg.html.png](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHeroku.browser.%252Fassets.swgg.html.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHeroku.browser.%252Fassets.swgg.html.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHeroku.browser.%252Fassets.swgg.html.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.deployHeroku.browser.%252F.png](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHeroku.browser.%252F.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHeroku.browser.%252F.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHeroku.browser.%252F.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.deployHerokuTest.browser.%252F.png](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHerokuTest.browser.%252F.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHerokuTest.browser.%252F.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.deployHerokuTest.browser.%252F.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.npmTest.browser.%252F.png](https://kaizhu256.github.io/node-swgg/build/screenshot.npmTest.browser.%252F.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.npmTest.browser.%252F.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.npmTest.browser.%252F.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleJs.browser.%252F.png](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleJs.browser.%252F.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleJs.browser.%252F.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleJs.browser.%252F.png)\n\n1. [https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleSh.browser.%252F.png](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleSh.browser.%252F.png)\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleSh.browser.%252F.png)](https://kaizhu256.github.io/node-swgg/build/screenshot.testExampleSh.browser.%252F.png)\n\n\n\n# package.json\n```json\n{\n    \"author\": \"kai zhu \u003ckaizhu256@gmail.com\u003e\",\n    \"description\": \"this zero-dependency package will run a virtual swagger-ui server with persistent-storage in the browser, that your webapp can use (in-place of a real backend), with a working web-demo\",\n    \"devDependencies\": {\n        \"utility2\": \"kaizhu256/node-utility2#alpha\"\n    },\n    \"engines\": {\n        \"node\": \"\u003e=10.0\"\n    },\n    \"githubRepoAlias\": \"swgg-io/node-swgg\",\n    \"homepage\": \"https://github.com/kaizhu256/node-swgg\",\n    \"keywords\": [\n        \"openapi\",\n        \"swagger-client\",\n        \"swagger-server\"\n    ],\n    \"license\": \"MIT\",\n    \"main\": \"lib.swgg.js\",\n    \"name\": \"swgg\",\n    \"nameAliasPublish\": \"petstore swagger-lite swaggerdoc\",\n    \"nameLib\": \"swgg\",\n    \"nameOriginal\": \"swgg\",\n    \"os\": [\n        \"darwin\",\n        \"linux\"\n    ],\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/kaizhu256/node-swgg.git\"\n    },\n    \"scripts\": {\n        \"build-ci\": \"./npm_scripts.sh\",\n        \"env\": \"env\",\n        \"eval\": \"./npm_scripts.sh\",\n        \"heroku-postbuild\": \"./npm_scripts.sh\",\n        \"postinstall\": \"./npm_scripts.sh\",\n        \"start\": \"./npm_scripts.sh\",\n        \"test\": \"./npm_scripts.sh\",\n        \"utility2\": \"./npm_scripts.sh\"\n    },\n    \"version\": \"2019.9.14\"\n}\n```\n\n\n\n# changelog of last 50 commits\n[![screenshot](https://kaizhu256.github.io/node-swgg/build/screenshot.gitLog.svg)](https://github.com/kaizhu256/node-swgg/commits)\n\n\n\n# internal build script\n- build_ci.sh\n```shell\n# build_ci.sh\n\n# this shell script will run the build for this package\n\nshBuildCiAfter () {(set -e\n    # shDeployCustom\n    shDeployGithub\n    shDeployHeroku\n    shReadmeTest example.sh\n)}\n\nshBuildCiBefore () {(set -e\n    shNpmTestPublished\n    shReadmeTest example.js\n)}\n\n# run shBuildCi\neval \"$(utility2 source)\"\nshBuildCi\n```\n\n\n\n# misc\n- this package was created with [utility2](https://github.com/kaizhu256/node-utility2)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaizhu256%2Fnode-swgg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaizhu256%2Fnode-swgg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaizhu256%2Fnode-swgg/lists"}