{"_id":"js-request-manager","_rev":"42-70f282a5deb14eb8b2d576b5cc46e8bb","name":"js-request-manager","dist-tags":{"latest":"1.2.2","beta":"2.0.0-alpha.9"},"versions":{"0.1.0":{"name":"js-request-manager","version":"0.1.0","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb@mail.ru"},"scripts":{},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"homepage":"https://oploshka.github.io/js-request-manager/","keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"gitHead":"d542f2dcc0567664473ba22b0ec4968a2afb8b84","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"_id":"js-request-manager@0.1.0","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-ZTBh+1IZH40Unydqt9asKe4yLyvwPln0c0hJzU1xqjXy9XLDUjZm0/rSx1xLNbiU9JFlUPqm/f8A7LZSpFX9Kw==","shasum":"d85bea4b6a95f48b7341d84c1497c0a3f57cc685","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-0.1.0.tgz","fileCount":27,"unpackedSize":40832,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4cKiCRA9TVsSAnZWagAAxH8P/33lazJSmsvXp8Wbw5uI\nP5unTC5wMSibe4FvOxscBn5B/yNQi2yKj2lV4ma3el3PEJW8zpRlhm53tbXy\n+ghDM0Fh4jjObXWwnIG7TwmjULtzLYYoGGxbEhhAhBBOHjj3VXN4RMNOKPfY\nmxRCRyBXIo3/NVvcagXY2jfPsCOPed2UcqgjZydb8+QGMybe6guBC8L83xsZ\nCJdHNsAWcZK2BgMjFIsJQKxbaRYj0zJXeDyOKm2unIlcV7fBztWG2IAiG+Ua\nsLkM83CGAyy/WFwdhfkZElXXgHZc+de6H3Zz6DLcjva5RegZ/Aib4+FVXKPf\nNf2PkG6b1bArpPSesRKz1VStLkjLOvsWvz8Dfhk9Le2de/Uv5MAX0h/ahWS/\nX7i7GAqyMFh9BQulka/jd7eIX5AFDux9aMyLfw7aZt/df9i2GsJZSIE1CUYc\nSTDcrKkuwLcaEpBkOQZa6wGFuDsX6YOH3K2fsUcLB6ihxDtcIUCgICdoEbuk\nGzaF3fsHnBCfpq5Y0vyMEiY6lHvwt2XzoOnRX9wMPrKHm5FAR2GqAsQL2Mz+\nr6L9UDwbhvS29dhaoqgC+D250C9XA7S2j0qoEg+1hsQQHIQ+Ujmyor5KAcAo\ntd18+5Jh1P5frUeeezsilUxdbdp8xxpYWv6GasPT0Fopo2pTvgf0lqJD4+Vf\n5n2t\r\n=TJZx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCWNGIt+xrP69GaSgccrAncxuULkeT7GcxFWpX4FJdPjQIhAKNyheX1b5I136dMtSfGyCir+b8E3ZXfhdO1H6vgQdVI"}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_0.1.0_1625408162327_0.8787643859121439"},"_hasShrinkwrap":false,"deprecated":"0.x is no longer supported"},"0.1.1":{"name":"js-request-manager","version":"0.1.1","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb@mail.ru"},"scripts":{},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"homepage":"https://oploshka.github.io/js-request-manager/","keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"gitHead":"ec05926e54f08a4ebf68b46b7e630c1d1f76d1bb","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"_id":"js-request-manager@0.1.1","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-z6CFfqi4vQ+mt9PsQDnft55TIQbFuSS+jWLFF1Cgm0MRHXsRNe/zyYx96joJjZRz+GKE3Xc4V7yczD7zFDZmqg==","shasum":"7a91e9a88529f523a7136eb669407c42a36c6456","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-0.1.1.tgz","fileCount":28,"unpackedSize":41204,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4c6hCRA9TVsSAnZWagAArLUP/RPMcY/vr14BPUBYryy3\n+0ygaQqZB+L3cjlrm4VOCXUOsVA5xkzzraV/znNLnqRr/YhTrooe4ZRnCHv0\n3CG9MEucPAdRMY2Sq13DpJ3Shl2DpLF7rOsJwfMHZ1qEWUocPOWy6fDw/9v4\nb+k/cC8UGySEFm5s55CJYrGyKlpJlugKo3Kx4YiL7wPxj0OVUPtaz7vdJlfy\nwC0VlUUy2K93g0DPFX/ETjvi81GgPHERAxlFGBfUUQy23mZnElIrN/U5rdsZ\nCoTQeLIBYNyEJMZsVN2buTPop9yEAllRDilb0vP/5J7UopJzsMxHYJ9JuOTZ\nF8dG9RYOZlsdeMlcqGGvSLb3ZkjHiX98ON1OvWjBA4ut78b93OBLe9c6U6xb\n+CC1zPmQJrXE43wZbFLS1zHmCulYxwy0WRDD6OQR+kIR3GzV+XrWp59nxhMY\n/7iixIEL8Q7OGSoa39mIQNefYciGIUjKyCP6PYUN+53nte6SKVncLBsPPr3r\n+21ly3QsCozfBn6Xn5zM268KuzQOOJm4E0gR5gtdsSDN95QD/7tIDcKloWhP\nNjzbS2TSQ3N3hKnvjpxuDvOJ7C7r6dRW3aFuDSkaO+IVedMS7Ct5GnPluXHN\n7TBztrJwhwON4gKhLJ+bafLG0GCgQTtVKGNoyhOf6kQUvzt67hNxqHqGrRlp\nvj3n\r\n=1PWA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUBZ2nki2UKHU6R3LUt6SytttgLpOpQRx3Y3qrSqO6tgIhAPlIQFMOvY1MgeAHSi5FGIm7eQ8SgSuLyjEr0xxDkz5t"}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_0.1.1_1625411232933_0.3220505931006028"},"_hasShrinkwrap":false,"deprecated":"0.x is no longer supported"},"0.1.2":{"name":"js-request-manager","version":"0.1.2","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb@mail.ru"},"scripts":{},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"homepage":"https://oploshka.github.io/js-request-manager/","keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"gitHead":"e5cac327c0fe8f6e645e61c4fdcdd8a15d05b66c","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"_id":"js-request-manager@0.1.2","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-v30YDTFURFzxQaBQMPNt0w4CnL81IRA04YPcVvy8A+yUHAhXoV7P9/SGhP+MT1bRPk8eoKGr8kixaLmXfQIXxA==","shasum":"452937487ab21d040506399c8f3ef0454343da2d","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-0.1.2.tgz","fileCount":28,"unpackedSize":41118,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4dD6CRA9TVsSAnZWagAALcoP/1ab3Cupk3sn/uRufEPq\niQ6RoFCRhHHSJ+LZYCQal75pZU9wQxqJX6wQHs88mJTzqVIn84vhXD46+txV\nopoMrKEG3cCLNePKZLouUKND8KkXHbDc+TG36ME74sOTxLl2z7PBzvgOHMVV\ndZfMb4vsmCForhiQ+NeNXNQ/Xjre8Wrw/H7HMXq+/2W5pOxuDvOTC3VrxXTL\nD68Hm0U17vJPlUp817Fza/Fs/A6EM5CDTZRYILttRfAFAxXj6XuxX5R1seu9\nEZ3XGvMl5k+IiSHS/oS8uso1J5+3RoQb9iagZ7t8hHNMP+i2+A1bHSeinXid\nDmtEL8Lmm2ixt29xPvShP8Eu49TAZn0xpVkbcWsbaEGBxOzNCxf5O+X+AUJe\njF0Aw7O9KOWoX6F+nxBJJRS7hj8f0yjP/UwtdfD6xP4X5f4PHIcMzqKIOIH1\nCmrLHtObTk7747NgEs1DCPwoVySwTLdlObq2WCDpsu87bDFIgg4oYaPnAb/F\n5MMmkIo5tkROX8Mnu6pjEFLSXeU4nKgKMk8caz8PSiezjiuwN4DEEobrE/GR\nWovQaTAt41CnuW5vq7j7R7YcCSj2stwz86QPBx1R0UqaF+Vv4IitpdApY1Gk\nQFCbnrxUnPaGFCJvmkiptMYwvr3MNKCUnQD4O6FxtcorxKRqsmP9iC0rZLL0\n0GN7\r\n=3KYH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIExEVGQ7p/kj/iWCsoxyZH/6dgelA5eYeeUr497kDcfeAiEA0P8187x7ra/cMkvMmkyGhK3AMpLLaXgV4mprpW12nnE="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_0.1.2_1625411834073_0.9602672376821291"},"_hasShrinkwrap":false,"deprecated":"0.x is no longer supported"},"0.1.3":{"name":"js-request-manager","version":"0.1.3","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb@mail.ru"},"scripts":{},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"homepage":"https://oploshka.github.io/js-request-manager/","keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"gitHead":"e5cac327c0fe8f6e645e61c4fdcdd8a15d05b66c","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"_id":"js-request-manager@0.1.3","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-sDOxtxDt71w9U4kQbWhyLcvfdo1gk+SduaXhQpSWznq8BiGqRaabiHdi+fzwCQNeOB/Kit6uGr0DIsz/mMyTyA==","shasum":"f14383a2eae3ce20cceb7927f53580c01a3e4af0","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-0.1.3.tgz","fileCount":28,"unpackedSize":41267,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4ddXCRA9TVsSAnZWagAA960QAKSB6K3wXsnlSg68b42v\n0bFsi25s4avl6Tg4kY/h0tq+1V1djIKt2ahqEoU828uxH7usReIn3UFUDXnk\n2FsYqUz9pjS1UllThbfXBgxlyjcqzZLb8OxWa5TOdHKEukKS/Mvw2Yecei1P\nH/KCPU2xJ/23s6eg51v+ge4XVuyzgYq6HDIsoglbYMlZxl3jG7U21ebTHfgv\nNMki6+cnlBWIWm78YAWmywWQ9snvnPTkGZGSTx09O1auYrlPHlyBexnmm7mq\nYn4GvMs7ta1TwDdSmY7ruwc+vS1TS34oGx1PBQ0TB1MhZkTipqeGDjB83Tmx\nxtwv3QIpRHRV1vfmp9V/Qn83uFwA5ApsH2HfGmphBYJ1zSvbZDalM1SGq7Ra\n6x8MebOT3tQ6LJ1Ihg71XvI/gWaFVsVog+302vXzEP828Liko/Ng1/tFxwvJ\nOFwXFNbnT052jjgBGb0mVOYnYlL8Jr5GTbHBg8VRAAIaAKeEzcRWP5MgMcj4\n4Wjin/Wk/lNe6+Y+5poNDOAIF/Y9K8X62XMG0Souf+rnS2XTpGvvYYZlbnNy\nQ2vkBYJ2jJCurMOfpgRlc/u/kzwBmBhXcMH/nP/uQcv9IBb19vqCUs1tGxLs\nU+ck6mYSApS7kZIEHFAYkGKRi7IiU0p1Rq7hN1d7Jf0IRp9bbxJgxtXOcNqX\n3D2v\r\n=hwSP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE6c+9uZ2oeRpt9feBq31R56l/kcZDVRBbIVdRphTUD8AiBtitozRibGoJqH/13Axn/I09wl2hm/E1RLJ1QX7ygoow=="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_0.1.3_1625413463109_0.810436219110318"},"_hasShrinkwrap":false,"deprecated":"0.x is no longer supported"},"0.2.0":{"name":"js-request-manager","version":"0.2.0","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb@mail.ru"},"scripts":{},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"gitHead":"536736f428c96c0ad074cbdf236df78bdd030aa0","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@0.2.0","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-uyxdS+cZU7ulqsVRXa0v1VFnc8LcVDkFe+oiD9CLueZWB5nK11LJgINZuGO1StcmVei7kpX0LmORQUxMxZdOyw==","shasum":"8c0e4a0759fac0bba75fa344b3cf62e5c71653e1","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-0.2.0.tgz","fileCount":30,"unpackedSize":54759,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4gPrCRA9TVsSAnZWagAAs5AP/3K9aN7o++H2H+6cTS39\nqDJOdnqAXKQYgLeogohrTIclmnEMXB+eR52wZ+PrYpnkXJrXy62qsVPC8sLB\n92CspM0KQ0utbxDKhMJOAN25kZXkwzk+72u5Cjy0KcP+9ecjxeW+d6uSy+J5\ntU8wu2LS0ArUnOFceD3C+mw0Mb1oZFSMD2AgoM5hJdo9N0Fz87Jtb9sU273E\nv9Q/+BwmusjNL4KEVtwMN582qZubamyl5VVyJWr+iqtlZZM+j3McWlqM9k5G\nuaHfyjaANBvPdvdAAX4yOifnuXa6x+v+lsCVgv8/RamwlPLWheGYZc6cSaaD\n3QPMsjBzB2cIDAlCX8OR+Z3UgN21N3sf9lt5NnvWYmQQNYbvHYzHglPWzoN1\nPr4h0JhKVBmnKg4onT4G4bjJFCiLNeMSXCiGCq4zsVP7hiZ5ARU9ncSvdzgT\n8BzL7/K9Nbba5keoYTQE2wcSzdI18Uii5ju0R05+RnKNIgW9kbt9I4xj32CY\nt2fsyFnlAazwKO+YA75BAOd1s+YctpFF6RFoupxZfBiOI4ZY4EKeSskbeMcg\nvJIL1ZBrpJ9t5wjXqfbTssjj6QoEIqDQ6RmqefZTEgIRwqTD87CyJzH9SYrX\nKws5DXMH+iU9YdS8YGCSETd5PaQAJ1+d1I9WwLHZY6NvsamWJY+CnrpwPBv2\n7xvg\r\n=moDY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDkFX+UDPsGA58AOGBIYeYYTYGIDKBIlnU3JahmDbN9tAiBpC4za/WuKRCHNOLIhsd8HidKYSpiW3Y4J4TrI1EB2Xg=="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_0.2.0_1625424874997_0.8682816217427392"},"_hasShrinkwrap":false,"deprecated":"0.x is no longer supported"},"0.2.1":{"name":"js-request-manager","version":"0.2.1","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb@mail.ru"},"scripts":{},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"gitHead":"be58390abdb0621ac7b41ec6571cfd3f6d1f62fe","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@0.2.1","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-sYOgFUVocYyGD9co+mv95pcRNU7uNLYmfhoZRpWZ3xOKq7L6L48m5WKeqMSo+nD2I7QTlL2zmvrcBcQwmXO70w==","shasum":"0f7aff969b92a4a66b65f142435fe5a033de220e","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-0.2.1.tgz","fileCount":30,"unpackedSize":54333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4hA5CRA9TVsSAnZWagAAGzsP/0LFjcuWDlWFRqNTd0CU\nXQXwVYRy3GZmsjCeQld+8jEWG+8p+NoUIv0IFnGL5VQ72VOXFL6nEoXR0U0U\nSJbCPoOtfOzJO4vAzm9d06CDrOXJD73l7fN+rJ1mJsXnWHVazmVkH0shJ4vh\nZTbg/x18TD0zYqjLXLzQciwnk8DMD3kJNfPHKn73aB48WpD/6siAbVt+5ymP\nlal8JQMPiUeZIzT/LA73c8ukB/c34IFRV3CR5piAm3FFYmJ9Nqwn5RbW/Eme\nhbidQ7JCgIUYtRNFZDauEX0i/HErsX6wKbU42uXSnbx2RlFKR/9LFSoQkIxw\nz0l9vKlfyXsHo1R1jsc8q003ou77ZAqb2SY2Nm/a6lyh0dTOBPsEjRAsaFOY\nKOrY6wK028K2jMgMZYIoUbnxy3XCFvu2VGtmDnklWmELbKXap4bF+LLbC3Wo\nnsQHvyFEIl0dUAxGyVIAgQBF2kqaqgQYC871R7FA3kh6hJwGknCTDBdT6GEd\n1IR/x+MBUYtGGb34ksqZLaR3znRj5fuMbVbdfq6VhLwuvtZMXRRTS5yQ+6lA\nER6F3cnF+55RD3u4fF6vyZfuZ1dzShfxB+l38nHUoub36MvC/4GSVx98kIRP\nDrgtHkfsk2eYMCK8uLLQd7zkWR2ShIGUeFBY1VBEsC8ehFEoIKMsMDmxvtDe\nwN8C\r\n=EQWC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGmpJFC8/g0b9ZjqovjclpAYEzxsD1/nWFfOB2cYxhc3AiB2KnNdwuHR5G6CF7mM5NMrPHADhf54X1AUSfUnsVX9Ow=="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_0.2.1_1625428025171_0.46017328240923927"},"_hasShrinkwrap":false,"deprecated":"0.x is no longer supported"},"0.2.2":{"name":"js-request-manager","version":"0.2.2","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb@mail.ru"},"scripts":{},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"gitHead":"6d08937f68b3d8fb6aa8ec8cff164a51a029154b","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@0.2.2","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-nf0iSqdoyKXqDCfNx7Xxap8+lXzhpRJXP+Fx8+yKWbAvqCE9G7kr1GSoCj6b0Uz4B+RbCa+VpALl8UFqHMGvcw==","shasum":"751a96532d3dcf0cdfe2b3ae95c93706944f5b5c","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-0.2.2.tgz","fileCount":31,"unpackedSize":54694,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4i4lCRA9TVsSAnZWagAAM4AQAIzoi7E4btIGTeR4JASb\ngZ/yGDLwQaAh+hGw6iVO+1tKh/QW0VkZEfz8ZGuS6OSUlAf91zLgMvEk8u9U\nBCnMJvX6umZo3OqKF6QqRfQsD90t4p0JstOdEB9Ud6zu+PJWCi+q6TdNoVns\nPUy8RnhvWwBHGTuujmXsmhxiQf2AkdbqgZGv5SPkBDPl9Y4Wtyve6LkRR2Mm\nZxgu0c0O81BUyUBLYVuWLjGxU9y6IOZn3PEEuC4VUJWMQTMjwd5aGcbHuJfK\ne/DS/oy/YNQIgKJenYSJlQzz6bWnE4sjEfyWrRwzAeMsMujtfyWm0sCUVlc2\nnNRRqJytl8gDzj+L/p3wXZ917NBC0EuAOtTCIgqQ2x7MfMoHQhGDUVvMwZ3j\nqqEbLiyCmHYT7nURKc1zLJPIBxLByKbzR8NTG4VHzNjGfdUuOfngZ3O8/nuj\niQfJiUSwt7hOFN1RhkmCLqyo+ar149CCb87JGhAGvKSx6MP5a9NUZ6uAXhX7\nJQdMe6A47HewanJwlhc4rKGHsxftzRpTu83jftj16trzPOivB1Psx38qwUhJ\nN/BhTZ+ptNOKC4M0wF32Z8nCsjApEn3MmgM55t7fPKCkmH7qMuFuirEQp/m0\nwGxChJeUPe2eoq4U/ndExLFAhcbtSllhf5byNSFtYf5I4zQMegzquwjJ2LRo\n71yZ\r\n=6RpY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID38H46sj/qSwMmD3XqPi+wkqWnbzioo4rDSSKURb/fyAiAuACGdf9gkJV6V1i1kt+vGqmxdcsR6E/uMuDI1iQdaig=="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_0.2.2_1625435684826_0.21539665704706734"},"_hasShrinkwrap":false,"deprecated":"0.x is no longer supported"},"0.2.3":{"name":"js-request-manager","version":"0.2.3","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb@mail.ru"},"scripts":{},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"gitHead":"6d08937f68b3d8fb6aa8ec8cff164a51a029154b","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@0.2.3","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-i3atIADC58Cj8BfR9IAzlCFieqnBp2ZFw1b0Ip7ib4qpyQh739mcr+kL4Sy1X2w8TVXnzrxp3InR/TxmFrPYAw==","shasum":"5baca5066758418503ae59b1a3bb6185c7465692","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-0.2.3.tgz","fileCount":31,"unpackedSize":55415,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4urPCRA9TVsSAnZWagAAqOgP/iKpT4wL6M5ynkbt7WD0\nc7o212UDN1TIBoX9K1kOb4KLRaD3El7hgZcTMtXcF/kQf8JkjFXvGdA9jwN4\nXGkL4IqLN+RJMofV4AAPFyPcNsPoN3nNLTm/xAp9XXY/qjpyz6TmjHRbl7wH\nsPBe0/nriXJACM8quRFn6drXr6KHNoYLYZvTY9H8HUMS+ae1Y+nUICe5VXpX\nksxNYPubeIbUWkXO6tIDqg52I1m6qqk8piXpndr1Dgo4Nf92W930zuCn6Wo1\nbPINj0aq+mUbbpCjyPAIv3gSARNXxCujtfOON3bYUuWCBySEzQtFnU6NUr0T\nEneccnTwdq7YRzKg51lv9lm8NdxxJ18rLFBGxbIhqnRpYgoTeyFhD9q2bfpJ\nIMPul5+2kjAQXc74RMQXvmgApk7xGavBrx4d6Moj6Af75kWg7zdccW5RIEEU\nG9t0zPviiUpHh5Ebo0USDWDW25SaKzxoxqZPltp5j94zIhepA5Cn2XVgzyLH\nop2yd68aYOMcSuZIHQiIX+l/xPBqSPRWAMFZaL8Nit1Z4YtoF5u0LckyUvkc\nRlSNOglZ1JSXq7M9ToWDP1gy3e20IZNFijUgjzcn4GbwVbVpSVunOSdPxqSg\nsD91IKsG3eRdQMke1mQFRD4Em433TTeAscI6zmE3mc5ieZ03GSbJfXIIasw6\nkPS3\r\n=kPpU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAOXYNYK/GU+mABGFMxtObkP+r2OAj17hDpwJ97gKkRTAiB7lmqseGwW0FcO/iBymvwqV58jvlcj1oSvkVWI0ehT6w=="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_0.2.3_1625483982697_0.08538353106520846"},"_hasShrinkwrap":false,"deprecated":"0.x is no longer supported"},"1.0.1":{"name":"js-request-manager","version":"1.0.1","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack --config webpack.config.prod-build.js","serve":"webpack serve","test":"mocha -r esm -r babel-polyfill -r @babel/register \"test/Api/*/*Test.js\""},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@babel/runtime":"^7.14.6","babel-loader":"^8.2.2","babel-plugin-webpack-aliases":"^1.1.3","babel-polyfill":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.3.4","esm":"^3.2.25","form-data":"^4.0.0","html-webpack-plugin":"^5.3.2","mocha":"^9.0.2","webpack":"^5.43.0","webpack-cli":"^4.7.2","webpack-dev-server":"^3.11.2"},"dependencies":{"axios":"^0.21.1","js-file-download":"^0.4.12"},"gitHead":"c71883606f507aa4ade9a85564fcaa4611e6433e","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@1.0.1","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-KryFWqSeLKH4u52YJeqiWSy9J3QufUi+ZncD2lI92Li2WzN64Fu+K5Vspr6nsBkOAr96foiSdrIk4a9xAB8Cig==","shasum":"271fb8696d06f6e5ee245c89ee32064c7ec0f301","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-1.0.1.tgz","fileCount":17,"unpackedSize":79651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg8HIkCRA9TVsSAnZWagAAGIUP/0Dfd7NabqxoBLvq8ZFj\nnD1x/t7KhD0IT+Gi87ZkpeHLheCktCXHK6DGUyZTBQoVVavuNg297wYGifpb\nOpsvsjE3YziBfSH5YSA7WMxTtDOLUFpv5Cny8WQ6a5nGRX5ebjU2m4Eh52No\nk6eyw9HPKt4FECVt8OU+4ThuRlnULbmrgx5aLW/IGT6yka9mzbaaAjYCyQls\norp8W9qHqy1/EE6aHahJQKQJXxEnryxVARTTlQwA7VQ9riZS1CZwBk/cyzxh\nsNvUVBgXpdgAiMyw6golGWvyWKAG3+agEwuYW1HNdjtdIiv5eOy1t+nRnF64\nuu8FAGNeYU/rbu01/HC1s39kk29BfunWFx91EEYDx0Q3aXuUbYdcf99GAVB+\nrszPNc27xPUPIFw61/wyuAqz/Yulp2zY1xfVeZVQoi79aldI1hyuavju9DzK\n+xhlGghkOBPoBpXkU21wocMefH0UkziB7rakaWPjm5Eovnx59pS7Kgw9fEde\nkRPssGfoQcV8u+GUpzCnSV8WuGK5QUB1pb7hn2DxSMDrfkAulrhzDRw3inNS\nCMiMZ8AriNOGAdQf5prnU8CuBGws5btAc8Z0T1Kp8N0Uo55cZEIa0+dQ4SQ2\nHHHkvFdZhZZ6C+/eEVJkPWU6n5uJbUURX3zHIrxpn2fBwiN1g5yWqU/QJK0P\nxpxx\r\n=/z+k\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCxytKMRmF1p9L/McxddvwzmqYkIVdYrB8alKkQAzOKRAIhAMG2vvTnqJ5RjiNeuFbCohXDzzro/HqiPlcgObC7Mdes"}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_1.0.1_1626370596861_0.37741970297195904"},"_hasShrinkwrap":false},"1.1.1":{"name":"js-request-manager","version":"1.1.1","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack --config webpack.config.prod-build.js","serve":"webpack serve","test":"mocha -r esm -r babel-polyfill -r @babel/register \"test/Api/*/*Test.js\""},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@babel/runtime":"^7.14.6","babel-loader":"^8.2.2","babel-plugin-webpack-aliases":"^1.1.3","babel-polyfill":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.3.4","esm":"^3.2.25","form-data":"^4.0.0","html-webpack-plugin":"^5.3.2","mocha":"^9.0.2","webpack":"^5.43.0","webpack-cli":"^4.7.2","webpack-dev-server":"^3.11.2","node-fetch":"^2.6.1","axios":"^0.21.1"},"dependencies":{"js-file-download":"^0.4.12"},"gitHead":"aa1b22be622044858954b4e087e2319a0537970f","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@1.1.1","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-VHtevkcF4l3IFLcOf+hVbq0oipeO6ZdwiE/hpCs//v/khCKUA2hNTEyQa9ryCOu9e3Fqi9QIke2ENZDoJtiwLw==","shasum":"94f151093b24a2b4ab24519584575f62c8825c0f","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-1.1.1.tgz","fileCount":17,"unpackedSize":80825,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg8usKCRA9TVsSAnZWagAADeoQAJWXZNafG41rmDAS3rR/\nBEJyKVZ9L/CisY81SGr/TG0+tk1TnRYnrpZ6ke0ZkG5aNvuYAIDsD9Q6iY0d\nTF/G1S3PMs87RGEUIK+EehxAKudSBtp/H/JyhuCdrpLaPhLA8+Wz2jJ8JdXz\ndg1XUItX3Ni3g+/zBtgSw/8OuU9dxTy/v3+6Zk3YrGxGr6yJfwh0XQSQNH0A\n64iVosjMlDvmOmSZLcZbSyFhYKftkxI7An6CfF/zaIWVnp+a1SkurqjFsYc9\nTauYgAMOg+rnp2sE7SEbWpUB7LGs4rNGs7sGj+fLlbGhjImUHnLC6CY0EBY1\nAWDmFsQbRmVfVH+eiK0oCffjUXFoqgZ56zvyy1NX0/QRnQb6TJuAGCa4hsIh\nzMsoBHVHBPYaMwvC9h9fqi0ET1F+BnkYMLa3CD0IRP/ejVYMTiHhYHjiY+Oq\nJB4QYotHY8xTWww231Zha0ql1T5/Y2QgPweXAkwpXvm/Hudvlob0IYW4Wx/s\nZJTM6O6XOqyfMJ9dwLfuZHGNosRxZcxcF4PuzNhckuK/2wjOvZIpZYUSwXBn\nsSOXqmqmesm2LBm5oISl3YZlb3+WrNcnbKWT1cdhVkqGoir6g25IEdOvfR9X\ni+gMtFNyHs6SCsmhoQaEL5movWx4NJRlGiT+KW7KmL6qYDEiN405jRu7D/QF\n06fj\r\n=Vt/u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB2oSw5BOamWcQi2z62HtJK9aIZtlad631QA0vRSFx9jAiEA8qHFk1oolmzOgmQt1HBdKBjYVQmy0hkXN0e0nlzoAjM="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_1.1.1_1626532618075_0.4597015937764224"},"_hasShrinkwrap":false},"1.1.2":{"name":"js-request-manager","version":"1.1.2","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack --config webpack.config.prod-build.js","serve":"webpack serve","test":"mocha -r esm -r babel-polyfill -r @babel/register \"test/Api/*/*Test.js\""},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@babel/runtime":"^7.14.6","babel-loader":"^8.2.2","babel-plugin-webpack-aliases":"^1.1.3","babel-polyfill":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.3.4","esm":"^3.2.25","form-data":"^4.0.0","html-webpack-plugin":"^5.3.2","mocha":"^9.0.2","webpack":"^5.43.0","webpack-cli":"^4.7.2","webpack-dev-server":"^3.11.2","node-fetch":"^2.6.1","axios":"^0.21.1"},"dependencies":{"js-file-download":"^0.4.12"},"gitHead":"73973f5f9de8d4abdd5b4d843315338d7ba04776","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@1.1.2","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-q6B0enVNUf4ZqU5NG8CDsImpDJQ+2dmtzCYrFa0YHUZMfNhtTlhuz8td6OvdTtNOA9KAgSCyJ8AcvFOQ6ZLESg==","shasum":"fd9ec25dad2c5593cc32f08fc3f701a0e631dae5","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-1.1.2.tgz","fileCount":16,"unpackedSize":80745,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg8xObCRA9TVsSAnZWagAAYgEP/2QPrCxdJ52wrarzo+4n\n7/3jUb9pq9j902rkOPVXS1fmDpq/3QRcji5Npgxf10RkrbrXuTx/ltOmLiGu\nm0ju7RfHKDYqdEZFJ2LRu43KHtcCm8e86SG5yaPGtwSFtwVRcGav4jiw3yBb\nsMOIuyhHQkEJKX0bZWsXPpUjEexcUsnxe5uOU+Kt4fKaFGerL0pntAul+8aq\nF+F3JCbryyOz46LPZ/6qtaRnJGwQSRC4amUj66vtkBEVNY7M56DWFx8Yjgjx\na6MryVLTtrTnPvII+UUVFHD2XB4JAew/CPm0K6u+HcI4Qgg5KLlklyhQGkOf\nZccOQbNDh00HKyXDIeB3qSqVSF2PHajjKFUG5zag+0DiRCt/v1QxIkxn8qlD\nA7sqRYl5TGkU+gegXdBbX0ZnMH3PYTZKIoyZEsVraJITcJM+FmKBkmwtVwJ/\nZmCFF+X43nGHx2Q4W3a4erJEdUUeOXWBsJE/cQbq9h3dGnWPAaU4utafZVhO\n3aMjMB7S+Gy3yOrRTNgCCP9pjTVApstJ/dIU7guur+VtX+0BIAr5DNDGIIb5\nl7BvQ3QFk94vqaGM+tmV8I0RkIkumk8/hmktBnuYjmX2brJ5LB+BamlpZKRC\nvQ6dBgoBmNHwnWFXtB1qg2qh/IAPm5LaNEPX1AVXa/I05w/jnfO4iIQzSdpB\nagSX\r\n=kB7h\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH1BtvSrUWUgdYTgfOe/xKtHoDrKROHiS/iIocjh5yGeAiBwLGHrW377iCaUU0anmxOxCfYAzp6+aM3fTAHAOIJ8MQ=="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_1.1.2_1626543002889_0.6793394483726667"},"_hasShrinkwrap":false},"1.2.0":{"name":"js-request-manager","version":"1.2.0","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack --config webpack.config.prod-build.js","serve":"webpack serve","test":"mocha -r esm -r babel-polyfill -r @babel/register \"test/Api/*/*Test.js\""},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@babel/runtime":"^7.14.6","babel-loader":"^8.2.2","babel-plugin-webpack-aliases":"^1.1.3","babel-polyfill":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.3.4","esm":"^3.2.25","form-data":"^4.0.0","html-webpack-plugin":"^5.3.2","mocha":"^9.0.2","webpack":"^5.43.0","webpack-cli":"^4.7.2","webpack-dev-server":"^3.11.2","node-fetch":"^2.6.1","axios":"^0.21.1","js-file-download":"^0.4.12"},"dependencies":{},"gitHead":"ece1c4a3a13d7a1126396546f024ccd4ff7d2ef1","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@1.2.0","_nodeVersion":"12.14.1","_npmVersion":"7.20.0","dist":{"integrity":"sha512-OjvytQnHvg2TqJBLdYULkIcY9gjAUsZVS8oCqJkqx31o+zhDpj+IHfKCHMVoVtTqgigXJ3+94rIN2vTNR8Q6hQ==","shasum":"9ad2f1eee7ba8a3b3686d9977b47b2f4fa88ddfc","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-1.2.0.tgz","fileCount":16,"unpackedSize":83270,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9YWbCRA9TVsSAnZWagAAoloP/jl5XaihlPf10ZREtBgr\nwHSBjWv1dSuY3s+x5gMOMpLN+h/Uour6V9AT3iHJMQ3h4JlavdhrRjYOM0/E\nfUZxMoebZl/v8mXtq/Va459q+20BQWQlKR7sgQM+35bwwDu2ViKdu3RcvlTr\n5nJByYTYNC6YjPa7soTs9uIBnzZy6nlBoeujCDsOxVyd7dJyG+lsKsIBPU9U\niu4cahXovfy2kpfi+oL82R2HZe7RjP6vmw01pCkgVACSmsAZiAnnOCJ5Mk8X\nuanWDqC3g1Mkcy12bIBVAu9nOSGRJrC7D+53aV7AcXuAbYrY0WcKLIlW2iOh\nAcxO94DxoDdvLcuqFDA9PWVpaiQh6r1WvJNu67Yql62YTwUDyzK4l6KDt8/N\neVZijIgOFW25gPUD3tegcpE1A/IqFb7YaSElI+Y1iY8sGfz6H3H/bXdSzamZ\njDoP4ViEC3G3WYRMJo7bdYxJDFen9mKq+nD3O6hx37ZFJMNbuf11LfEXMNYt\nQMprdYbx3mtVHpDpWnu3VcfRLhsEEc5Ow94Hl/azlrsq7i1KKoU5qpASXzGn\nGo79tfkLVudlcHXtlpC96t+M1yIHjhjjuPuA09M3i5vewUQKrInByyVmr5Mu\n6GqyaBDOU/ypAG1kspxfeQYAUz+UGaUjg0HfQsGHL2O4qNPWnCiVm0GVjwxb\nQLa0\r\n=eOGa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKzMnOnbjoo3XYWhES+h8KHoYz3ISRd9FViLjU9fFelwIgDLshKw/4FvOth2pjhpRT6U8e1yfdiWQlZ3kHvTgWfXs="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_1.2.0_1626703258823_0.9231765475136045"},"_hasShrinkwrap":false},"1.2.1":{"name":"js-request-manager","version":"1.2.1","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack --config webpack.config.prod-build.js","serve":"webpack serve","test":"mocha -r esm -r babel-polyfill -r @babel/register \"test/Api/*/*Test.js\""},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@babel/runtime":"^7.14.6","babel-loader":"^8.2.2","babel-plugin-webpack-aliases":"^1.1.3","babel-polyfill":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.3.4","esm":"^3.2.25","form-data":"^4.0.0","html-webpack-plugin":"^5.3.2","mocha":"^9.0.2","webpack":"^5.43.0","webpack-cli":"^4.7.2","webpack-dev-server":"^3.11.2","node-fetch":"^2.6.1","axios":"^0.21.1","js-file-download":"^0.4.12"},"dependencies":{},"gitHead":"334f610d54acb4c77f48102171c884b15e36b6eb","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@1.2.1","_nodeVersion":"12.14.1","_npmVersion":"7.20.0","dist":{"integrity":"sha512-DjXNHA4Ahl5IPeYBiX1oUJHMtUu/C+aTHrxMjvdpFHebcrjLNKEFl2DGrpusf1qN5YA9NDFwBfkcDVC1ixW3Dg==","shasum":"084ea67813bc84430c420558057ad08e03fe711f","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-1.2.1.tgz","fileCount":16,"unpackedSize":83722,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhCjsgCRA9TVsSAnZWagAAoksQAIdDr4DUGUQZ6qDmxsp1\nae/QDh3pexMwu5APlP2C4S91XjjOZsVJp+J7pyWNSXZNzAyoo6AqnDidf7sl\nSwJevtLTgU/4sBkkjpZJnmP8kcLZCBwpMditJWrmOd86Ii8SdLw5bAUe1zC0\nmvFMtCT2qvixZiqeJXwavHWR7ystW7VAHv9QQertk/h/Tlg3GdEtcLFiQbnE\ntvZbJDudGCruSojIldwrsWIGUlKjKCODD2egvQ0YuYlpJE5xp9kdxMZDyaD7\nWX7P1NK3HKWin2ccxQZUUg6fzQwKcTnh89TqNXUjpKW/31aPT/tKuRMkZNIf\nXvmPHz6OWn6M4fXeZmQkowjIq3CT7Te8g2n5jHP6hDG0c3nFEdqN9f7f+xA3\nxamwamioLSfVVdy6xSAw+TzzKk1hbklou2F/7QkapLiOIGyv5j1M9sBKzjtH\nANqHnf3oRZaof0rr6mPv4kjklg4zsAiY1SpJlizc2G5PysDejFY+XrCV/+CO\nlFxPGKefnBhsbP1KauCvBb2TaG/Fo30ioCwYZVKYf63taft3AkQcXfZ4sfOy\nero8NlozYoPdFSEqv0Q9A35h953IoJCuo/QwGH/1yKEMpNbk3DhjhVZDYp2J\nFr9KbW60QkpKS22hmR10eydAPs17iiElNMFef+0W7svDyhYPqpfOUa9VNbUb\nQ/nM\r\n=RSNO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEyRlWqNkOpCkiC9oJXjW+YQmEQMrxr9PDsE71KNj6kqAiEAw7ts9wT3SA/vmaErunYh6mrqXr+rLb4S5HViaKWKO2Q="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_1.2.1_1628060448203_0.8853517403966269"},"_hasShrinkwrap":false},"1.2.2":{"name":"js-request-manager","version":"1.2.2","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack --config webpack.config.prod-build.js","serve":"webpack serve","test":"mocha -r esm -r babel-polyfill -r @babel/register \"test/Api/*/*Test.js\""},"main":"./src/RequestManager.js","exports":{"./":"./src/"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"eslintConfig":{"root":true,"env":{"node":true},"extends":["plugin:vue/essential","eslint:recommended"],"rules":{"semi":[2,"always"],"no-unused-vars":"off","no-console":"off","no-debugger":"off"},"parserOptions":{"parser":"babel-eslint"}},"browserslist":["last 2 chrome versions"],"devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@babel/runtime":"^7.14.6","babel-loader":"^8.2.2","babel-plugin-webpack-aliases":"^1.1.3","babel-polyfill":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.3.4","esm":"^3.2.25","form-data":"^4.0.0","html-webpack-plugin":"^5.3.2","mocha":"^9.0.2","webpack":"^5.43.0","webpack-cli":"^4.7.2","webpack-dev-server":"^3.11.2","node-fetch":"^2.6.1","axios":"^0.21.1","js-file-download":"^0.4.12"},"dependencies":{},"gitHead":"334f610d54acb4c77f48102171c884b15e36b6eb","bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"homepage":"https://github.com/oploshka/js-request-manager#readme","_id":"js-request-manager@1.2.2","_nodeVersion":"12.14.1","_npmVersion":"7.20.0","dist":{"integrity":"sha512-xUpcDZvT0E+1SgXHTu5J4w6KDXEGbQQS6zw6xfRCBUCDm+b7s6CMDBwU/FThEz+bd9KTSIgHgvRO+HhmsK9HXg==","shasum":"4fe54dc82d89eb276f955715a483706ce11ad62d","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-1.2.2.tgz","fileCount":16,"unpackedSize":83474,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhCj1WCRA9TVsSAnZWagAAZnQP/1oLNr3AnYQg0fcZnQRz\nR2yWIMfrVcgxv34/rBtB32bjgfkYHnWgUBQ9Lkj5mESQo2/5pnoRo5Rcj73+\nTLULuXHB+E2GSe2CXnybQ4nSzdoNlZLZqrTw008ujV/Jvfwg/5SI+pptBw7a\nuG8nH86/qiXRqfYBIY4AQczMEV3c61Bsvl7SFy/CYjbBTq6fJitf2+8WBCdb\nZziJoKJuv8Ps8jjKxbs3JKa4QF5OYJ0N2LOz+abApLLm0HpRTFCdxZZT5ICO\nqQpq/zvZgE121kQ8b73GSpgA8Sx087E5xg8ugOn0vWRly9yEn5lPESkayANz\nmlWcjo7rRlfdSk3ktFwm0EWQngfgKmWFuu6MU8V2Ez9uG2LVQ+7RBhXKaQrI\nC8VZwl1ExmeMYUu04fJXNGpZxVF6NKURKbOSCoJjVCd83mbHhqFbmSpGapJx\nKFQ1y/HZ2J+5r29CPl1ZBKBZ98nWYYSVRpB8oqM7N0js9fZjnvBOqSnh85Hz\nIc6dR6ePJPPJyFIMRgfwostxSAeDEdux9Ue2eNvzQ6uyqnfWUzeVOBFPrsST\neyx92SN8huVkAGkrhbYWFveQpB6qmUXZ4VHaWecMAPEdTsA/6MUXt0PUTv61\nGcMCTkgSuwuRy7Ffah1caIXOSH0FKNinWpT3PC7vl2nlroIOadRNSc+k0AOe\nO3BI\r\n=QUuq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA+hThLX/c17UqP1gRN9LTUtO5/mo9GiVZ0WvDQIhhfiAiEA/+zn859bLZ3Bg5SPTjm2BH467Pdfkh2ezzf0I4rmE1w="}]},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_1.2.2_1628061014266_0.13689824007705664"},"_hasShrinkwrap":false},"2.0.0-alpha.2":{"name":"js-request-manager","version":"2.0.0-alpha.2","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack"},"devDependencies":{"@babel/core":"^7.17.7","@babel/plugin-proposal-class-properties":"^7.16.7","@babel/plugin-transform-runtime":"^7.17.0","@babel/preset-env":"^7.16.11","babel-loader":"^8.2.3","babel-plugin-webpack-aliases":"^1.1.3","eslint":"^8.11.0","eslint-plugin-oploshka":"^1.0.7","webpack":"^5.70.0","webpack-cli":"^4.9.2"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"readme":"# API request Manager.\r\n\r\nRequest Manager is a library for creating an sdk library for your server (API).\r\nThe API type doesn't matter, whether it's REST or RPC.\r\nAs a result, we get the opportunity to centrally process all requests.\r\nWe do not bother with converting data in the code, but only work with pure data.\r\nIt is better to see 1 time than to hear 100 times.\r\n\r\n[Documentation in Russian](readme.ru.md)\r\n\r\n# How it looks after setting up\r\n### async/await\r\n```js\r\ntry {\r\n  let responseData = await RequestManager.Auth.authorization({login: 'admin', password: 'pass'})\r\n  // ... user code for success response\r\n} catch (err) {\r\n  // ... user code for error response or server error\r\n  return;\r\n}\r\n```\r\n### Promise\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'}).then(\r\n  (result)  => { /* ... user code for success response */ },\r\n  (error)   => { /* ... user code for error response or server error */ }\r\n);\r\n```\r\n\r\n# Installation\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">NPM</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# npm install axios              # for use axios client\r\n# npm install node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# npm install js-file-download   # for file download (or use other)\r\n# # install\r\nnpm install js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Yarn</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# yarn add axios              # for use axios client\r\n# yarn add node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# yarn add js-file-download   # for file download (or use other)\r\n# # install\r\nyarn add js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">package.json</b></summary>\r\n\r\n```json5\r\n{\r\n  \"dependencies\": {\r\n    // \"axios\": \"^0.21.1\", or \"node-fetch\": \"^2.6.1\", or js fetch()\r\n    // js-file-download\": \"^0.4.12\", or other \r\n    \"js-request-manager\": \"^1.0.0\",\r\n    // ..\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n\r\n# Initialization (options):\r\n   - Copy [optimal example files](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmOptimalStructureCreate) to your project (recommended).\r\n   - Copy [minimal example file](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmSimpleCreate) to your project.\r\n   - or create a file manually.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Example of manual creation</b></summary>\r\n\r\n> ```js\r\n> import RequestManager from 'js-request-manager/src/RequestManager';\r\n> import RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n> // request sender\r\n> import axios from 'axios';\r\n> \r\n> const requestSchema = {\r\n>   Auth: {\r\n>     authorization: ({login, password}) => {\r\n>       return new RequestClass({\r\n>         name  : 'authorization',\r\n>         type  : 'POST',\r\n>         url   : 'api://authorize', // https://domain.test/api/authorize\r\n>         params: {\r\n>           get: {},\r\n>           post: {login, password},\r\n>         },\r\n>         responsePrepare: (data) => {\r\n>           return {token: data.jwt};\r\n>         },\r\n>         errorMessage: 'Not correct login or password',\r\n>       });\r\n>     },\r\n>   }\r\n> }\r\n> \r\n> const Config = {\r\n>   hostAlias: {\r\n>     api: 'https://domain.test/api',\r\n>   },\r\n>   Hook: {\r\n>     RequestPromise (requestPromise, settings) { console.log(requestPromise, settings); }\r\n>   },\r\n>   RequestClient: {\r\n>     async send(obj) { return await axios(obj); }\r\n>   }\r\n> }\r\n> \r\n> const RmSimpleCreate = RequestManager(requestSchema, Config);\r\n> \r\n> // optional (recommended use global request manager)\r\n> global.RequestManager = RmSimpleCreate\r\n> \r\n> export default RmSimpleCreate\r\n> \r\n> ```\r\n</details>\r\n\r\n\r\n# RequestManager accepts the following settings:\r\n```js\r\nconst RequestSchema = {/* ... request schema */ };\r\n\r\n// Config - all parameters are optional\r\nconst Config = {\r\n  hostAlias: {},\r\n  RequestPrepare: {\r\n    data(requestType, requestUrl, requestData) {\r\n      return requestData;\r\n    },\r\n    type(requestType, requestUrl, requestData) {\r\n      return requestType;\r\n    },\r\n    url(requestType, requestUrl, requestData) {\r\n      return requestUrl.getUrl();\r\n    },\r\n    requestClientDataPrepare(requestClientData, requestClass) {\r\n      return requestClientData;\r\n    },\r\n  },\r\n  ResponsePrepare: {\r\n    isError(riObject) {\r\n      return false;\r\n    },\r\n    getErrorInfo: async (riObject, requestClass, Config) => {\r\n      return {code: 'error', message: 'Undefined error', data: riObject}\r\n    },\r\n    getSuccessInfo: async (riObject, requestClass, Config) => {\r\n      return riObject.data\r\n    },\r\n  },\r\n  Hook: {\r\n    RequestPromise(requestPromise, settings) {\r\n      console.log(requestPromise, settings);\r\n    }\r\n  },\r\n  RequestClient: {\r\n    name: 'AXIOS', // or FETCH\r\n    async send(obj) {\r\n      return await axios(obj);\r\n    },\r\n    async fileDownload(data, ri, requestClass, Config) {\r\n      // add file download code\r\n      return {};\r\n    },\r\n    getRequestClientObject(requestObj, requestClass, Config) {\r\n      return requestObj;\r\n    },\r\n    isNetworkError(axiosResponse, requestClass, Config) {\r\n      return false;\r\n    }\r\n    getRiObject(axiosResponse, requestClass, Config) {\r\n      return {httpStatus: 200, contentType: '', data: {}, headers: {}};\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\n## RequestSchema setting information\r\n\r\nIt describes how we will group all our requests, what parameters they will accept and in what form they will be sent.\r\nWe can also change or replace the response data.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em\">RequestSchema</b></summary>\r\n\r\n```js\r\n// schema example\r\nconst RequestSchema = {\r\n  Auth: {\r\n    authorization: ({login, password})        => { return new RequestClass({/* ... */}); },\r\n    registration : ({email, login, password}) => { return new RequestClass({/* ... */}); },\r\n  },\r\n  News: {\r\n    getAll : ()           => { return new RequestClass({/* ... */}); },\r\n    getById: ({id})       => { return new RequestClass({/* ... */}); },\r\n    getOldNews: ()        => { return new RequestClass({/* ... */}); },\r\n    getNewNews: ()        => { return new RequestClass({/* ... */}); },\r\n    create:({name, desc}) => { return new RequestClass({/* ... */}); },\r\n    delete:({id})         => { return new RequestClass({/* ... */}); },\r\n  },\r\n  Tags: {\r\n    News: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n    User: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n  },\r\n  getTheme : ()           => { return new RequestClass({/* ... */}); },\r\n};\r\n```\r\nA single request is described by a function that accepts a single object and returns RequestClass\r\n\r\nAn example of how to call it\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'});\r\n\r\nRequestManager.News.getAll();\r\nRequestManager.News.getById({id});\r\n\r\nRequestManager.Tags.News.getAll();\r\nRequestManager.Tags.User.getAll({}).then(console.log, console.error);\r\n\r\nRequestManager.getTheme();\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">RequestSchema RequestClass</b></summary>\r\n\r\nThis is the class that we use to describe all our queries.\r\n```js\r\nimport RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n\r\nrequest = new RequestClass({\r\n  name : '',      // String - request name (need for debug or custom prepare)\r\n  type : '',      // String - request type [GET|POST|PUT|DELETE ... or other custom ]\r\n  url  : '',      // String - request url\r\n  params : {\r\n    get : {},     // Send GET params\r\n    post: {},     // Send POST params\r\n  },\r\n\r\n  responsePrepare: (response) => { // Function\r\n    return {token: response.jwt};  // change response\r\n  },\r\n\r\n  cache : false,        // Create request cache   \r\n  errorMessage: '',     // String or Function\r\n  // For load file\r\n  fileName: 'test.txt', // String or Function\r\n})\r\n```\r\n</details>\r\n\r\n\r\n## Config setting information\r\n\r\nHere we can change the standard behavior of the Request Manager, subscribe to events, set an alias for the url.\r\nNext, you can see detailed information on RequestSchema and Config\r\n\r\nConfig will be described in the form Config.[Type].[Sub type] = [Settings]\r\n\r\n------------------------------------------------------\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.hostAlias</b></summary>\r\n\r\nSetting an alias for the url.\r\nWe do this in order not to write full domain names in all requests.\r\nExample:\r\n```js\r\nconst hostAlias = {\r\n   auth   : 'https://auth.domain.test/api',\r\n   apiV1  : 'https://domain.test/api/v1',\r\n   apiV2  : 'https://v2.domain.test/api',\r\n};\r\n```\r\n\r\nIn the future, you can use abbreviations when describing queries\r\n```js\r\nRequestClass({ url: 'auth://authorize' /* ... */}); // url => https://auth.domain.test/api/authorize\r\nRequestClass({ url: 'apiV1://users'    /* ... */}); // url => https://domain.test/api/v1/users\r\nRequestClass({ url: 'apiV2://news'     /* ... */}); // url => https://v2.domain.test/api/news\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare</b></summary>\r\n\r\nIn this object, we can add/redefine/change/delete the data that will be in the request.\r\nRequestPrepare is an object. See the parameters (below) in Config.RequestPrepare.[Settings subtype].\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.data</b></summary>\r\n\r\n\r\nThis function allows you to change/supplement / replace the request data.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.data\r\nfunction RequestPrepare_data(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n     return { test: \"test\"} // replace requestData\r\n  }\r\n  \r\n  requestData.time = Date(); // add date in send request\r\n  \r\n  if(requestData.debugInfo) {\r\n    console.log(requestData.debugInfo) // view debug info\r\n    delete requestData.debugInfo;     // delete data (debugInfo) from the request\r\n  }\r\n   \r\n  if(requestData.arrayInfo) {\r\n    requestData.arrayInfo = JSON.stringify(requestData.arrayInfo) // replace/conver data\r\n  }\r\n  \r\n  return requestData;\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.type</b></summary>\r\n\r\nThis function allows you to change / replace the request type.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.type\r\nfunction RequestPrepare_type(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n    return 'POST' // replace requestType\r\n  }\r\n\r\n  const allowedRequestType = {\r\n    'GET': true,\r\n    'POST': true,\r\n  }\r\n  if(!allowedRequestType[requestType]) {\r\n    console.warn('Not correct request type', requestType)\r\n    return 'GET'; // replace\r\n  }\r\n  \r\n  return requestType; // return original request type\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.url</b></summary>\r\n\r\nThis function allows you to change/replace the request url.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.url\r\nfunction RequestPrepare_url(requestType, requestUrl, requestData) {\r\n  \r\n  if(requestType === 'POST-REPLACE') {\r\n    return 'https://test.domain.com/test-url' // replace url\r\n  }\r\n  \r\n   return requestUrl.getUrl(); // warning requestUrl - is RequestLinkClass\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.requestClientDataPrepare</b></summary>\r\n\r\nThis function allows you to change the object passed to axios or fetch.\r\nAdd headers, settings, etc.\r\n\r\n```js\r\nfunction RequestPrepare_requestClientDataPrepare(requestClientData, requestClass) {\r\n  let token = localStorage.getItem('user-token');\r\n  if (token) {\r\n    // add axios header\r\n    requestClientData.headers['Authorization'] = `Token ${token}`;\r\n  }\r\n  return requestClientData;\r\n},\r\n```\r\n\r\nps: this is a general callback\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare</b></summary>\r\n\r\nIn this block, we are working with the answer (we can change it).\r\nResponsePrepare is an object.\r\nSee the parameters (below) in Config.ResponsePrepare.[Settings subtype].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.isError</b></summary>\r\n\r\nHere we check whether the answer is an error\r\n```js\r\nfunction ResponsePrepare_isError(responseData){\r\n  if( !(200 <= riObject.httpStatus && riObject.httpStatus < 300) ) {\r\n    return true;\r\n  }\r\n  if(!riObject.data.success) {\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getErrorInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is true, then we are trying to get information about the error.\r\nWe give this information in the form of an object.\r\n```js\r\nasync function ResponsePrepare_getErrorInfo(riObject, requestClass, Config) => {\r\n  return {\r\n    code: 'error',\r\n    message: riObject.data.error || 'Unknown error',\r\n    data: riObject.data,\r\n  };\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getSuccessInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is false, then we get clean data from the response.\r\nLet's look at the example of the answer:\r\n\r\n```json5\r\n{ \"success\": true, \"result\": { \"a\": 1, \"b\": 2} } \r\n```\r\nIn this case, we want to get - {\"a\": 1, \"b\": 2}. To do this, use the following code:\r\n\r\n```js\r\nasync function ResponsePrepare_getSuccessInfo(riObject, requestClass, Config) => {\r\n  return riObject.data.result;\r\n};\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook</b></summary>\r\n\r\nHook - we can subscribe to Request Managera events.\r\nHook is an object.\r\nSee the parameters (below) in Config. Hook.[Subtype of settings].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook.RequestPromise</b></summary>\r\n\r\nThis event is called after the request is sent.\r\nIt is applicable for loading, maintaining statistics, logging, and displaying error messages\r\n```js\r\nfunction Hook_RequestPromise(requestPromise, settings){\r\n  requestPromise.then(\r\n    (result) => {},\r\n    (error) => {\r\n      alert(settings.errorMessage) // alert error\r\n    });\r\n};\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient</b></summary>\r\n\r\nThis function allows you to determine through which we will send the request.\r\nUsually axios or fetch is used (you can use others as well).\r\nIn the examples below, we will use axios.\r\n\r\nIn 99%, it is necessary to pass axios. This is done via Config.RequestClient.send.\r\nThe rest should work correctly!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\n\r\nOverriding the rest makes sense if you are using a different client for sending\r\nor axios has released a new version (not compatible with the old one).\r\n\r\nps: It is worth noting axios on the front and on the back - behaves a little differently\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.name</b></summary>\r\n\r\nHere we are talking about which preset Config.RequestClient to use (AXIOS | FETCH).\r\nBy default, the AXIOS preset will be used.\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.send</b></summary>\r\n\r\nHere we say that the sending will be via \"axios\".\r\n```js\r\nimport axios from 'axios';\r\n\r\nasync function RequestClient_send(obj) {\r\n  return await axios(obj);\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.fileDownload</b></summary>\r\n\r\nHere we say that we will upload files.\r\n```js\r\nimport fileDownload from 'js-file-download';\r\n\r\nasync fileDownload(data, ri, requestClass, Config) {\r\n  const download = async (data, ri, requestClass, Config) => {\r\n    let fileName = requestClass.getFileName();\r\n    fileDownload(ri.data, fileName, ri.contentType);\r\n  }\r\n  download(data, ri, requestClass, Config)\r\n  return {};\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRequestClientObject</b></summary>\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\nHere we convert the data from the RequestManagera request object to an axios object. We only convert it!\r\n```js\r\nfunction getRequestClientObject(requestObj, requestClass, Config) {\r\n  const axiosObj = {\r\n    method  : requestObj.type,\r\n    url     : requestObj.url,\r\n    headers : {}\r\n  };\r\n  // axiosObj.responseType = 'application/json';\r\n\r\n  if(requestClass.getFileName()){\r\n    axiosObj.responseType = 'blob';\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.get)){\r\n    axiosObj.params  = requestObj.data.get;\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.post)){\r\n    axiosObj.data    = requestObj.data.post;\r\n  }\r\n\r\n  if(requestObj.data.post instanceof FormData){\r\n    axiosObj.data    = requestObj.data.post;\r\n    axiosObj.headers['Content-Type'] = 'multipart/form-data';\r\n  }\r\n\r\n  return axiosObj;\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.isNetworkError</b></summary>\r\n\r\nIn js, network errors can't get much information.\r\nIf network errors occur, we handle them separately.\r\nIf this is a network error , we will return a message with the error text.\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction isNetworkError(axiosResponse, requestClass, Config) {\r\n  if(/* axiosResponse.isAxiosError && */ !axiosResponse.response) {\r\n    return axiosResponse.message ? axiosResponse.message : 'Unknown network error';\r\n  }\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRiObject</b></summary>\r\n\r\nWe pull the information from the response to riObject (internal type of Request Manager).\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction getRiObject(axiosResponse, requestClass, Config) {\r\n\r\n  const ri = {\r\n    httpStatus  : -1,\r\n    contentType : '',\r\n    data        : {},\r\n    headers     : {}\r\n  }\r\n  const clearContentType = (contentType) => {\r\n    return contentType ? contentType.split(';')[0] : '';\r\n  }\r\n\r\n  // get status\r\n  if(axiosResponse.status) {\r\n    ri.httpStatus = axiosResponse.status;\r\n  } else if(axiosResponse.request &&  axiosResponse.request.status) {\r\n    ri.httpStatus = axiosResponse.request.status;\r\n  }\r\n\r\n  // get headers\r\n  if(axiosResponse.headers) {\r\n    ri.headers = axiosResponse.headers;\r\n  }\r\n\r\n  // get contentType\r\n  if( ri.headers['content-type']) {\r\n    ri.contentType = clearContentType( axiosResponse.headers['content-type'] );\r\n  }\r\n\r\n  // get data\r\n  if(axiosResponse.data){\r\n    ri.data = axiosResponse.data;\r\n\r\n    if(ri.data instanceof Blob){\r\n      ri.contentType = clearContentType( ri.data.type );\r\n    }\r\n  }\r\n\r\n  return ri;\r\n},\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n\r\n# Advantages\r\n\r\n- Ability to integrate into any js project (webpack, Vue, React, Next, Nuxt, Angular and ...).\r\n- 1 sending point for all requests.\r\n- The ability to create an sdk and reuse it in different projects.\r\n- Ease of use (grouping by type, uniformity, response prepare).\r\n- Query caching (optional, disabled by default).\r\n- Working with fake data.\r\n- Use of global error handlers (user notify)\r\n- Logger, Statistics, Loading, ...\r\n\r\nA lot of this requires integration with your system.\r\nThe final functionality is up to you to determine.\r\n\r\n\r\n# Disadvantages\r\n\r\n- There is no way to make a universal solution (the variety of APIs knows no boundaries).\r\n  Perhaps someone will need additional functionality.\r\n  Such cases are reduced to a minimum, but they can still happen.\r\n- Complexity. Integration with the API requires experience. You need to understand what is happening and where.\r\n  This solution makes it easier, but I always want it easier...\r\n- The solution is designed for communication via json.\r\n  To work with other formats (xml, yaml,...)\r\n  , you may need to use additional librari\r\n","readmeFilename":"readme.md","gitHead":"4b1206719a21f49660a62117650f74b01226326a","_id":"js-request-manager@2.0.0-alpha.2","_nodeVersion":"14.18.1","_npmVersion":"8.5.3","dist":{"integrity":"sha512-JK7dqIg+QM45z109ysuaCzXa0CmkqP8eLJyrrEmKlVVreZIgW3si50ooE0m5ci462cucTYkfRYyskm5dNN99oQ==","shasum":"895cda12ca05481473a4861bcb564fb37e51f949","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-2.0.0-alpha.2.tgz","fileCount":84,"unpackedSize":689393,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWc/r4n3K+HdjBM7ikH7vcHcKQ+MCvfbjCCCmpxZdR6QIhAOFKO1+4Rl11BqUAMmIJbX1pKX0oHvms336SCANyJFV+"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiWMkTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmroFA//SjWXLECyah9gi7OTSWVAnQ8MbauBFzdRLLsqxwk5zKHsixll\r\n4aP8lp9wR9ZrZ2iG/tXc4OucPxg5cgNkmrnkBfhuxkpKvQBUPq66lwkj5LY1\r\nG9ThXvNDPytGarASta5vk60D/MaVp9VjYUKJwP5G7kIQaYXysoTDX6GkpTnd\r\nbjS0sc8aaOK8SkbP5fD6ffDb+x3nWqPQNxKM+hvjQUEviJsYVavO1xNJzQz8\r\nKYrlJB3+LRHwZ9rw01yS5CGokBKbbJHNETHwQwm9tEJjuVS2Q6WcnbnAkI2q\r\ntnXD7AZ2roGY4J1WF54zdYfjjYXlM56TEwwRzqw6zSkL9W/3+zY60+3FJf1F\r\nFJfn8FKQr6prYeDarLEUnp32GaBz/Z0JAs10fLTFoeqQd4Zz5e8kV4xjN7Qh\r\nKHmLfMcQjB29L/dUsaaY9VZnSe/jlqUJYJzAmg+8AB/RdDt0kD7eUgMDf8iS\r\ne83XeIowiWrRc9MsViQ+PkCOYmy2m+ZMMVX+IYoJc8IUt8VubvxSkeGvv8oL\r\nPP7x8+3Ekddh1D+5uix+MArln3jhYgCVeLHDpXZuXuD4UOZuEuFB6BNJCsME\r\n2ss46I1UbZhaMiSPGc7qeESO5NsVDI6FN2TwOboj7NCgWVvj6EGZzITKi824\r\n01Tiy3MhWoKzBwu/w0U2I7RDYSwljxOPics=\r\n=RnOC\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_2.0.0-alpha.2_1649985811447_0.0530881093680291"},"_hasShrinkwrap":false},"2.0.0-alpha.3":{"name":"js-request-manager","version":"2.0.0-alpha.3","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack"},"devDependencies":{"@babel/core":"^7.17.7","@babel/plugin-proposal-class-properties":"^7.16.7","@babel/plugin-transform-runtime":"^7.17.0","@babel/preset-env":"^7.16.11","babel-loader":"^8.2.3","babel-plugin-webpack-aliases":"^1.1.3","eslint":"^8.11.0","eslint-plugin-oploshka":"^1.0.7","webpack":"^5.70.0","webpack-cli":"^4.9.2"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"readme":"# API request Manager.\r\n\r\nRequest Manager is a library for creating an sdk library for your server (API).\r\nThe API type doesn't matter, whether it's REST or RPC.\r\nAs a result, we get the opportunity to centrally process all requests.\r\nWe do not bother with converting data in the code, but only work with pure data.\r\nIt is better to see 1 time than to hear 100 times.\r\n\r\n[Documentation in Russian](readme.ru.md)\r\n\r\n# How it looks after setting up\r\n### async/await\r\n```js\r\ntry {\r\n  let responseData = await RequestManager.Auth.authorization({login: 'admin', password: 'pass'})\r\n  // ... user code for success response\r\n} catch (err) {\r\n  // ... user code for error response or server error\r\n  return;\r\n}\r\n```\r\n### Promise\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'}).then(\r\n  (result)  => { /* ... user code for success response */ },\r\n  (error)   => { /* ... user code for error response or server error */ }\r\n);\r\n```\r\n\r\n# Installation\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">NPM</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# npm install axios              # for use axios client\r\n# npm install node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# npm install js-file-download   # for file download (or use other)\r\n# # install\r\nnpm install js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Yarn</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# yarn add axios              # for use axios client\r\n# yarn add node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# yarn add js-file-download   # for file download (or use other)\r\n# # install\r\nyarn add js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">package.json</b></summary>\r\n\r\n```json5\r\n{\r\n  \"dependencies\": {\r\n    // \"axios\": \"^0.21.1\", or \"node-fetch\": \"^2.6.1\", or js fetch()\r\n    // js-file-download\": \"^0.4.12\", or other \r\n    \"js-request-manager\": \"^1.0.0\",\r\n    // ..\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n\r\n# Initialization (options):\r\n   - Copy [optimal example files](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmOptimalStructureCreate) to your project (recommended).\r\n   - Copy [minimal example file](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmSimpleCreate) to your project.\r\n   - or create a file manually.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Example of manual creation</b></summary>\r\n\r\n> ```js\r\n> import RequestManager from 'js-request-manager/src/RequestManager';\r\n> import RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n> // request sender\r\n> import axios from 'axios';\r\n> \r\n> const requestSchema = {\r\n>   Auth: {\r\n>     authorization: ({login, password}) => {\r\n>       return new RequestClass({\r\n>         name  : 'authorization',\r\n>         type  : 'POST',\r\n>         url   : 'api://authorize', // https://domain.test/api/authorize\r\n>         params: {\r\n>           get: {},\r\n>           post: {login, password},\r\n>         },\r\n>         responsePrepare: (data) => {\r\n>           return {token: data.jwt};\r\n>         },\r\n>         errorMessage: 'Not correct login or password',\r\n>       });\r\n>     },\r\n>   }\r\n> }\r\n> \r\n> const Config = {\r\n>   hostAlias: {\r\n>     api: 'https://domain.test/api',\r\n>   },\r\n>   Hook: {\r\n>     RequestPromise (requestPromise, settings) { console.log(requestPromise, settings); }\r\n>   },\r\n>   RequestClient: {\r\n>     async send(obj) { return await axios(obj); }\r\n>   }\r\n> }\r\n> \r\n> const RmSimpleCreate = RequestManager(requestSchema, Config);\r\n> \r\n> // optional (recommended use global request manager)\r\n> global.RequestManager = RmSimpleCreate\r\n> \r\n> export default RmSimpleCreate\r\n> \r\n> ```\r\n</details>\r\n\r\n\r\n# RequestManager accepts the following settings:\r\n```js\r\nconst RequestSchema = {/* ... request schema */ };\r\n\r\n// Config - all parameters are optional\r\nconst Config = {\r\n  hostAlias: {},\r\n  RequestPrepare: {\r\n    data(requestType, requestUrl, requestData) {\r\n      return requestData;\r\n    },\r\n    type(requestType, requestUrl, requestData) {\r\n      return requestType;\r\n    },\r\n    url(requestType, requestUrl, requestData) {\r\n      return requestUrl.getUrl();\r\n    },\r\n    requestClientDataPrepare(requestClientData, requestClass) {\r\n      return requestClientData;\r\n    },\r\n  },\r\n  ResponsePrepare: {\r\n    isError(riObject) {\r\n      return false;\r\n    },\r\n    getErrorInfo: async (riObject, requestClass, Config) => {\r\n      return {code: 'error', message: 'Undefined error', data: riObject}\r\n    },\r\n    getSuccessInfo: async (riObject, requestClass, Config) => {\r\n      return riObject.data\r\n    },\r\n  },\r\n  Hook: {\r\n    RequestPromise(requestPromise, settings) {\r\n      console.log(requestPromise, settings);\r\n    }\r\n  },\r\n  RequestClient: {\r\n    name: 'AXIOS', // or FETCH\r\n    async send(obj) {\r\n      return await axios(obj);\r\n    },\r\n    async fileDownload(data, ri, requestClass, Config) {\r\n      // add file download code\r\n      return {};\r\n    },\r\n    getRequestClientObject(requestObj, requestClass, Config) {\r\n      return requestObj;\r\n    },\r\n    isNetworkError(axiosResponse, requestClass, Config) {\r\n      return false;\r\n    }\r\n    getRiObject(axiosResponse, requestClass, Config) {\r\n      return {httpStatus: 200, contentType: '', data: {}, headers: {}};\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\n## RequestSchema setting information\r\n\r\nIt describes how we will group all our requests, what parameters they will accept and in what form they will be sent.\r\nWe can also change or replace the response data.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em\">RequestSchema</b></summary>\r\n\r\n```js\r\n// schema example\r\nconst RequestSchema = {\r\n  Auth: {\r\n    authorization: ({login, password})        => { return new RequestClass({/* ... */}); },\r\n    registration : ({email, login, password}) => { return new RequestClass({/* ... */}); },\r\n  },\r\n  News: {\r\n    getAll : ()           => { return new RequestClass({/* ... */}); },\r\n    getById: ({id})       => { return new RequestClass({/* ... */}); },\r\n    getOldNews: ()        => { return new RequestClass({/* ... */}); },\r\n    getNewNews: ()        => { return new RequestClass({/* ... */}); },\r\n    create:({name, desc}) => { return new RequestClass({/* ... */}); },\r\n    delete:({id})         => { return new RequestClass({/* ... */}); },\r\n  },\r\n  Tags: {\r\n    News: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n    User: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n  },\r\n  getTheme : ()           => { return new RequestClass({/* ... */}); },\r\n};\r\n```\r\nA single request is described by a function that accepts a single object and returns RequestClass\r\n\r\nAn example of how to call it\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'});\r\n\r\nRequestManager.News.getAll();\r\nRequestManager.News.getById({id});\r\n\r\nRequestManager.Tags.News.getAll();\r\nRequestManager.Tags.User.getAll({}).then(console.log, console.error);\r\n\r\nRequestManager.getTheme();\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">RequestSchema RequestClass</b></summary>\r\n\r\nThis is the class that we use to describe all our queries.\r\n```js\r\nimport RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n\r\nrequest = new RequestClass({\r\n  name : '',      // String - request name (need for debug or custom prepare)\r\n  type : '',      // String - request type [GET|POST|PUT|DELETE ... or other custom ]\r\n  url  : '',      // String - request url\r\n  params : {\r\n    get : {},     // Send GET params\r\n    post: {},     // Send POST params\r\n  },\r\n\r\n  responsePrepare: (response) => { // Function\r\n    return {token: response.jwt};  // change response\r\n  },\r\n\r\n  cache : false,        // Create request cache   \r\n  errorMessage: '',     // String or Function\r\n  // For load file\r\n  fileName: 'test.txt', // String or Function\r\n})\r\n```\r\n</details>\r\n\r\n\r\n## Config setting information\r\n\r\nHere we can change the standard behavior of the Request Manager, subscribe to events, set an alias for the url.\r\nNext, you can see detailed information on RequestSchema and Config\r\n\r\nConfig will be described in the form Config.[Type].[Sub type] = [Settings]\r\n\r\n------------------------------------------------------\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.hostAlias</b></summary>\r\n\r\nSetting an alias for the url.\r\nWe do this in order not to write full domain names in all requests.\r\nExample:\r\n```js\r\nconst hostAlias = {\r\n   auth   : 'https://auth.domain.test/api',\r\n   apiV1  : 'https://domain.test/api/v1',\r\n   apiV2  : 'https://v2.domain.test/api',\r\n};\r\n```\r\n\r\nIn the future, you can use abbreviations when describing queries\r\n```js\r\nRequestClass({ url: 'auth://authorize' /* ... */}); // url => https://auth.domain.test/api/authorize\r\nRequestClass({ url: 'apiV1://users'    /* ... */}); // url => https://domain.test/api/v1/users\r\nRequestClass({ url: 'apiV2://news'     /* ... */}); // url => https://v2.domain.test/api/news\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare</b></summary>\r\n\r\nIn this object, we can add/redefine/change/delete the data that will be in the request.\r\nRequestPrepare is an object. See the parameters (below) in Config.RequestPrepare.[Settings subtype].\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.data</b></summary>\r\n\r\n\r\nThis function allows you to change/supplement / replace the request data.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.data\r\nfunction RequestPrepare_data(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n     return { test: \"test\"} // replace requestData\r\n  }\r\n  \r\n  requestData.time = Date(); // add date in send request\r\n  \r\n  if(requestData.debugInfo) {\r\n    console.log(requestData.debugInfo) // view debug info\r\n    delete requestData.debugInfo;     // delete data (debugInfo) from the request\r\n  }\r\n   \r\n  if(requestData.arrayInfo) {\r\n    requestData.arrayInfo = JSON.stringify(requestData.arrayInfo) // replace/conver data\r\n  }\r\n  \r\n  return requestData;\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.type</b></summary>\r\n\r\nThis function allows you to change / replace the request type.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.type\r\nfunction RequestPrepare_type(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n    return 'POST' // replace requestType\r\n  }\r\n\r\n  const allowedRequestType = {\r\n    'GET': true,\r\n    'POST': true,\r\n  }\r\n  if(!allowedRequestType[requestType]) {\r\n    console.warn('Not correct request type', requestType)\r\n    return 'GET'; // replace\r\n  }\r\n  \r\n  return requestType; // return original request type\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.url</b></summary>\r\n\r\nThis function allows you to change/replace the request url.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.url\r\nfunction RequestPrepare_url(requestType, requestUrl, requestData) {\r\n  \r\n  if(requestType === 'POST-REPLACE') {\r\n    return 'https://test.domain.com/test-url' // replace url\r\n  }\r\n  \r\n   return requestUrl.getUrl(); // warning requestUrl - is RequestLinkClass\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.requestClientDataPrepare</b></summary>\r\n\r\nThis function allows you to change the object passed to axios or fetch.\r\nAdd headers, settings, etc.\r\n\r\n```js\r\nfunction RequestPrepare_requestClientDataPrepare(requestClientData, requestClass) {\r\n  let token = localStorage.getItem('user-token');\r\n  if (token) {\r\n    // add axios header\r\n    requestClientData.headers['Authorization'] = `Token ${token}`;\r\n  }\r\n  return requestClientData;\r\n},\r\n```\r\n\r\nps: this is a general callback\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare</b></summary>\r\n\r\nIn this block, we are working with the answer (we can change it).\r\nResponsePrepare is an object.\r\nSee the parameters (below) in Config.ResponsePrepare.[Settings subtype].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.isError</b></summary>\r\n\r\nHere we check whether the answer is an error\r\n```js\r\nfunction ResponsePrepare_isError(responseData){\r\n  if( !(200 <= riObject.httpStatus && riObject.httpStatus < 300) ) {\r\n    return true;\r\n  }\r\n  if(!riObject.data.success) {\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getErrorInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is true, then we are trying to get information about the error.\r\nWe give this information in the form of an object.\r\n```js\r\nasync function ResponsePrepare_getErrorInfo(riObject, requestClass, Config) => {\r\n  return {\r\n    code: 'error',\r\n    message: riObject.data.error || 'Unknown error',\r\n    data: riObject.data,\r\n  };\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getSuccessInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is false, then we get clean data from the response.\r\nLet's look at the example of the answer:\r\n\r\n```json5\r\n{ \"success\": true, \"result\": { \"a\": 1, \"b\": 2} } \r\n```\r\nIn this case, we want to get - {\"a\": 1, \"b\": 2}. To do this, use the following code:\r\n\r\n```js\r\nasync function ResponsePrepare_getSuccessInfo(riObject, requestClass, Config) => {\r\n  return riObject.data.result;\r\n};\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook</b></summary>\r\n\r\nHook - we can subscribe to Request Managera events.\r\nHook is an object.\r\nSee the parameters (below) in Config. Hook.[Subtype of settings].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook.RequestPromise</b></summary>\r\n\r\nThis event is called after the request is sent.\r\nIt is applicable for loading, maintaining statistics, logging, and displaying error messages\r\n```js\r\nfunction Hook_RequestPromise(requestPromise, settings){\r\n  requestPromise.then(\r\n    (result) => {},\r\n    (error) => {\r\n      alert(settings.errorMessage) // alert error\r\n    });\r\n};\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient</b></summary>\r\n\r\nThis function allows you to determine through which we will send the request.\r\nUsually axios or fetch is used (you can use others as well).\r\nIn the examples below, we will use axios.\r\n\r\nIn 99%, it is necessary to pass axios. This is done via Config.RequestClient.send.\r\nThe rest should work correctly!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\n\r\nOverriding the rest makes sense if you are using a different client for sending\r\nor axios has released a new version (not compatible with the old one).\r\n\r\nps: It is worth noting axios on the front and on the back - behaves a little differently\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.name</b></summary>\r\n\r\nHere we are talking about which preset Config.RequestClient to use (AXIOS | FETCH).\r\nBy default, the AXIOS preset will be used.\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.send</b></summary>\r\n\r\nHere we say that the sending will be via \"axios\".\r\n```js\r\nimport axios from 'axios';\r\n\r\nasync function RequestClient_send(obj) {\r\n  return await axios(obj);\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.fileDownload</b></summary>\r\n\r\nHere we say that we will upload files.\r\n```js\r\nimport fileDownload from 'js-file-download';\r\n\r\nasync fileDownload(data, ri, requestClass, Config) {\r\n  const download = async (data, ri, requestClass, Config) => {\r\n    let fileName = requestClass.getFileName();\r\n    fileDownload(ri.data, fileName, ri.contentType);\r\n  }\r\n  download(data, ri, requestClass, Config)\r\n  return {};\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRequestClientObject</b></summary>\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\nHere we convert the data from the RequestManagera request object to an axios object. We only convert it!\r\n```js\r\nfunction getRequestClientObject(requestObj, requestClass, Config) {\r\n  const axiosObj = {\r\n    method  : requestObj.type,\r\n    url     : requestObj.url,\r\n    headers : {}\r\n  };\r\n  // axiosObj.responseType = 'application/json';\r\n\r\n  if(requestClass.getFileName()){\r\n    axiosObj.responseType = 'blob';\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.get)){\r\n    axiosObj.params  = requestObj.data.get;\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.post)){\r\n    axiosObj.data    = requestObj.data.post;\r\n  }\r\n\r\n  if(requestObj.data.post instanceof FormData){\r\n    axiosObj.data    = requestObj.data.post;\r\n    axiosObj.headers['Content-Type'] = 'multipart/form-data';\r\n  }\r\n\r\n  return axiosObj;\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.isNetworkError</b></summary>\r\n\r\nIn js, network errors can't get much information.\r\nIf network errors occur, we handle them separately.\r\nIf this is a network error , we will return a message with the error text.\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction isNetworkError(axiosResponse, requestClass, Config) {\r\n  if(/* axiosResponse.isAxiosError && */ !axiosResponse.response) {\r\n    return axiosResponse.message ? axiosResponse.message : 'Unknown network error';\r\n  }\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRiObject</b></summary>\r\n\r\nWe pull the information from the response to riObject (internal type of Request Manager).\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction getRiObject(axiosResponse, requestClass, Config) {\r\n\r\n  const ri = {\r\n    httpStatus  : -1,\r\n    contentType : '',\r\n    data        : {},\r\n    headers     : {}\r\n  }\r\n  const clearContentType = (contentType) => {\r\n    return contentType ? contentType.split(';')[0] : '';\r\n  }\r\n\r\n  // get status\r\n  if(axiosResponse.status) {\r\n    ri.httpStatus = axiosResponse.status;\r\n  } else if(axiosResponse.request &&  axiosResponse.request.status) {\r\n    ri.httpStatus = axiosResponse.request.status;\r\n  }\r\n\r\n  // get headers\r\n  if(axiosResponse.headers) {\r\n    ri.headers = axiosResponse.headers;\r\n  }\r\n\r\n  // get contentType\r\n  if( ri.headers['content-type']) {\r\n    ri.contentType = clearContentType( axiosResponse.headers['content-type'] );\r\n  }\r\n\r\n  // get data\r\n  if(axiosResponse.data){\r\n    ri.data = axiosResponse.data;\r\n\r\n    if(ri.data instanceof Blob){\r\n      ri.contentType = clearContentType( ri.data.type );\r\n    }\r\n  }\r\n\r\n  return ri;\r\n},\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n\r\n# Advantages\r\n\r\n- Ability to integrate into any js project (webpack, Vue, React, Next, Nuxt, Angular and ...).\r\n- 1 sending point for all requests.\r\n- The ability to create an sdk and reuse it in different projects.\r\n- Ease of use (grouping by type, uniformity, response prepare).\r\n- Query caching (optional, disabled by default).\r\n- Working with fake data.\r\n- Use of global error handlers (user notify)\r\n- Logger, Statistics, Loading, ...\r\n\r\nA lot of this requires integration with your system.\r\nThe final functionality is up to you to determine.\r\n\r\n\r\n# Disadvantages\r\n\r\n- There is no way to make a universal solution (the variety of APIs knows no boundaries).\r\n  Perhaps someone will need additional functionality.\r\n  Such cases are reduced to a minimum, but they can still happen.\r\n- Complexity. Integration with the API requires experience. You need to understand what is happening and where.\r\n  This solution makes it easier, but I always want it easier...\r\n- The solution is designed for communication via json.\r\n  To work with other formats (xml, yaml,...)\r\n  , you may need to use additional librari\r\n","readmeFilename":"readme.md","gitHead":"4b1206719a21f49660a62117650f74b01226326a","_id":"js-request-manager@2.0.0-alpha.3","_nodeVersion":"14.18.1","_npmVersion":"8.5.3","dist":{"integrity":"sha512-djLz+nzXlfve+61n/vnJe4Pt3ZhswZ8yPD/+XUEvonGBtCOj+kOOQb5L74t0jLKfTFkeTtXUnzV96sWcHYVAWA==","shasum":"9410a1641fde60e04aab32da43661cd14d557adb","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-2.0.0-alpha.3.tgz","fileCount":84,"unpackedSize":689395,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGZfNeOnVxnawC/eum0zJ2op78soy8pcsWMK9nSSRHcQAiEAp0gk2cowIEBfMnSPOUFdkeOD8RNQpiv9yvUJfuZ2zOU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiWNCyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqtCg//WX1qNnSEYHopUMDMj01FupqXvc956XGq56TNhHLLwGnXP1IM\r\nqQrQ18gJwe38HrjmBlyyNbutY5XVszQ01go/gCO3IhYTukD+l2K/D0H+71wI\r\nDVBSd0ZKCf0urGzZTSeqel/7VljrrqQy36Jp8ap+siHNEsomWB/f+GQ5zP7K\r\n0VMezwWUapew9Ljpc4ZKd2lbzFXz9Xp4sVflMyWvd/sZVD4pgJaOU0zgKTAD\r\nJulJ23RFAXtnF/K/+/mamLgNozz5NX6AAGXdkT0v8DlkKGW1AO43BO4nqZ2I\r\n38GTP38JrFriNjhEG+Y65aG41OP+zxrBH8kTA5ycOitlA0u58SG49t8WOnDU\r\nLNUzHLIIsZq1NlDLgHJQ2qMAnBFoWqQotiiAf+GQ1c3sDhfWN84QVNtV7kkf\r\n2VcFNs3tO8u+xMz/Zcfp1/8Ju5HdDtfgQnpwrpb0reZeIsOmW/BaSPF3sF1i\r\nm+Ynni5CIWRLmY0P4O+8Ho0XVI7FZLkhTsX4quHVAIoKJLIEsjFU4OcoIacg\r\np8Ab9wwQ2iViAXA4K/KEsDxCEVasNWmKwDAcJMyNPLNSg1z1xcQEru/VExRW\r\nHNHJmXP+gZJJPO1KE8ts2RkFMEelAa63miCNn8HcGIhL5aeOc89HE3EV2Wh6\r\nLQqfdzVlmQnmBtQL7zI+akOr7Xl7QKPBg1c=\r\n=D/P2\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_2.0.0-alpha.3_1649987761942_0.5332580302548529"},"_hasShrinkwrap":false},"2.0.0-alpha.4":{"name":"js-request-manager","version":"2.0.0-alpha.4","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack"},"devDependencies":{"@babel/core":"^7.17.7","@babel/plugin-proposal-class-properties":"^7.16.7","@babel/plugin-transform-runtime":"^7.17.0","@babel/preset-env":"^7.16.11","babel-loader":"^8.2.3","babel-plugin-webpack-aliases":"^1.1.3","eslint":"^8.11.0","eslint-plugin-oploshka":"^1.0.7","webpack":"^5.70.0","webpack-cli":"^4.9.2"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"readme":"# API request Manager.\r\n\r\nRequest Manager is a library for creating an sdk library for your server (API).\r\nThe API type doesn't matter, whether it's REST or RPC.\r\nAs a result, we get the opportunity to centrally process all requests.\r\nWe do not bother with converting data in the code, but only work with pure data.\r\nIt is better to see 1 time than to hear 100 times.\r\n\r\n[Documentation in Russian](readme.ru.md)\r\n\r\n# How it looks after setting up\r\n### async/await\r\n```js\r\ntry {\r\n  let responseData = await RequestManager.Auth.authorization({login: 'admin', password: 'pass'})\r\n  // ... user code for success response\r\n} catch (err) {\r\n  // ... user code for error response or server error\r\n  return;\r\n}\r\n```\r\n### Promise\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'}).then(\r\n  (result)  => { /* ... user code for success response */ },\r\n  (error)   => { /* ... user code for error response or server error */ }\r\n);\r\n```\r\n\r\n# Installation\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">NPM</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# npm install axios              # for use axios client\r\n# npm install node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# npm install js-file-download   # for file download (or use other)\r\n# # install\r\nnpm install js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Yarn</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# yarn add axios              # for use axios client\r\n# yarn add node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# yarn add js-file-download   # for file download (or use other)\r\n# # install\r\nyarn add js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">package.json</b></summary>\r\n\r\n```json5\r\n{\r\n  \"dependencies\": {\r\n    // \"axios\": \"^0.21.1\", or \"node-fetch\": \"^2.6.1\", or js fetch()\r\n    // js-file-download\": \"^0.4.12\", or other \r\n    \"js-request-manager\": \"^1.0.0\",\r\n    // ..\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n\r\n# Initialization (options):\r\n   - Copy [optimal example files](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmOptimalStructureCreate) to your project (recommended).\r\n   - Copy [minimal example file](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmSimpleCreate) to your project.\r\n   - or create a file manually.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Example of manual creation</b></summary>\r\n\r\n> ```js\r\n> import RequestManager from 'js-request-manager/src/RequestManager';\r\n> import RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n> // request sender\r\n> import axios from 'axios';\r\n> \r\n> const requestSchema = {\r\n>   Auth: {\r\n>     authorization: ({login, password}) => {\r\n>       return new RequestClass({\r\n>         name  : 'authorization',\r\n>         type  : 'POST',\r\n>         url   : 'api://authorize', // https://domain.test/api/authorize\r\n>         params: {\r\n>           get: {},\r\n>           post: {login, password},\r\n>         },\r\n>         responsePrepare: (data) => {\r\n>           return {token: data.jwt};\r\n>         },\r\n>         errorMessage: 'Not correct login or password',\r\n>       });\r\n>     },\r\n>   }\r\n> }\r\n> \r\n> const Config = {\r\n>   hostAlias: {\r\n>     api: 'https://domain.test/api',\r\n>   },\r\n>   Hook: {\r\n>     RequestPromise (requestPromise, settings) { console.log(requestPromise, settings); }\r\n>   },\r\n>   RequestClient: {\r\n>     async send(obj) { return await axios(obj); }\r\n>   }\r\n> }\r\n> \r\n> const RmSimpleCreate = RequestManager(requestSchema, Config);\r\n> \r\n> // optional (recommended use global request manager)\r\n> global.RequestManager = RmSimpleCreate\r\n> \r\n> export default RmSimpleCreate\r\n> \r\n> ```\r\n</details>\r\n\r\n\r\n# RequestManager accepts the following settings:\r\n```js\r\nconst RequestSchema = {/* ... request schema */ };\r\n\r\n// Config - all parameters are optional\r\nconst Config = {\r\n  hostAlias: {},\r\n  RequestPrepare: {\r\n    data(requestType, requestUrl, requestData) {\r\n      return requestData;\r\n    },\r\n    type(requestType, requestUrl, requestData) {\r\n      return requestType;\r\n    },\r\n    url(requestType, requestUrl, requestData) {\r\n      return requestUrl.getUrl();\r\n    },\r\n    requestClientDataPrepare(requestClientData, requestClass) {\r\n      return requestClientData;\r\n    },\r\n  },\r\n  ResponsePrepare: {\r\n    isError(riObject) {\r\n      return false;\r\n    },\r\n    getErrorInfo: async (riObject, requestClass, Config) => {\r\n      return {code: 'error', message: 'Undefined error', data: riObject}\r\n    },\r\n    getSuccessInfo: async (riObject, requestClass, Config) => {\r\n      return riObject.data\r\n    },\r\n  },\r\n  Hook: {\r\n    RequestPromise(requestPromise, settings) {\r\n      console.log(requestPromise, settings);\r\n    }\r\n  },\r\n  RequestClient: {\r\n    name: 'AXIOS', // or FETCH\r\n    async send(obj) {\r\n      return await axios(obj);\r\n    },\r\n    async fileDownload(data, ri, requestClass, Config) {\r\n      // add file download code\r\n      return {};\r\n    },\r\n    getRequestClientObject(requestObj, requestClass, Config) {\r\n      return requestObj;\r\n    },\r\n    isNetworkError(axiosResponse, requestClass, Config) {\r\n      return false;\r\n    }\r\n    getRiObject(axiosResponse, requestClass, Config) {\r\n      return {httpStatus: 200, contentType: '', data: {}, headers: {}};\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\n## RequestSchema setting information\r\n\r\nIt describes how we will group all our requests, what parameters they will accept and in what form they will be sent.\r\nWe can also change or replace the response data.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em\">RequestSchema</b></summary>\r\n\r\n```js\r\n// schema example\r\nconst RequestSchema = {\r\n  Auth: {\r\n    authorization: ({login, password})        => { return new RequestClass({/* ... */}); },\r\n    registration : ({email, login, password}) => { return new RequestClass({/* ... */}); },\r\n  },\r\n  News: {\r\n    getAll : ()           => { return new RequestClass({/* ... */}); },\r\n    getById: ({id})       => { return new RequestClass({/* ... */}); },\r\n    getOldNews: ()        => { return new RequestClass({/* ... */}); },\r\n    getNewNews: ()        => { return new RequestClass({/* ... */}); },\r\n    create:({name, desc}) => { return new RequestClass({/* ... */}); },\r\n    delete:({id})         => { return new RequestClass({/* ... */}); },\r\n  },\r\n  Tags: {\r\n    News: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n    User: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n  },\r\n  getTheme : ()           => { return new RequestClass({/* ... */}); },\r\n};\r\n```\r\nA single request is described by a function that accepts a single object and returns RequestClass\r\n\r\nAn example of how to call it\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'});\r\n\r\nRequestManager.News.getAll();\r\nRequestManager.News.getById({id});\r\n\r\nRequestManager.Tags.News.getAll();\r\nRequestManager.Tags.User.getAll({}).then(console.log, console.error);\r\n\r\nRequestManager.getTheme();\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">RequestSchema RequestClass</b></summary>\r\n\r\nThis is the class that we use to describe all our queries.\r\n```js\r\nimport RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n\r\nrequest = new RequestClass({\r\n  name : '',      // String - request name (need for debug or custom prepare)\r\n  type : '',      // String - request type [GET|POST|PUT|DELETE ... or other custom ]\r\n  url  : '',      // String - request url\r\n  params : {\r\n    get : {},     // Send GET params\r\n    post: {},     // Send POST params\r\n  },\r\n\r\n  responsePrepare: (response) => { // Function\r\n    return {token: response.jwt};  // change response\r\n  },\r\n\r\n  cache : false,        // Create request cache   \r\n  errorMessage: '',     // String or Function\r\n  // For load file\r\n  fileName: 'test.txt', // String or Function\r\n})\r\n```\r\n</details>\r\n\r\n\r\n## Config setting information\r\n\r\nHere we can change the standard behavior of the Request Manager, subscribe to events, set an alias for the url.\r\nNext, you can see detailed information on RequestSchema and Config\r\n\r\nConfig will be described in the form Config.[Type].[Sub type] = [Settings]\r\n\r\n------------------------------------------------------\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.hostAlias</b></summary>\r\n\r\nSetting an alias for the url.\r\nWe do this in order not to write full domain names in all requests.\r\nExample:\r\n```js\r\nconst hostAlias = {\r\n   auth   : 'https://auth.domain.test/api',\r\n   apiV1  : 'https://domain.test/api/v1',\r\n   apiV2  : 'https://v2.domain.test/api',\r\n};\r\n```\r\n\r\nIn the future, you can use abbreviations when describing queries\r\n```js\r\nRequestClass({ url: 'auth://authorize' /* ... */}); // url => https://auth.domain.test/api/authorize\r\nRequestClass({ url: 'apiV1://users'    /* ... */}); // url => https://domain.test/api/v1/users\r\nRequestClass({ url: 'apiV2://news'     /* ... */}); // url => https://v2.domain.test/api/news\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare</b></summary>\r\n\r\nIn this object, we can add/redefine/change/delete the data that will be in the request.\r\nRequestPrepare is an object. See the parameters (below) in Config.RequestPrepare.[Settings subtype].\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.data</b></summary>\r\n\r\n\r\nThis function allows you to change/supplement / replace the request data.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.data\r\nfunction RequestPrepare_data(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n     return { test: \"test\"} // replace requestData\r\n  }\r\n  \r\n  requestData.time = Date(); // add date in send request\r\n  \r\n  if(requestData.debugInfo) {\r\n    console.log(requestData.debugInfo) // view debug info\r\n    delete requestData.debugInfo;     // delete data (debugInfo) from the request\r\n  }\r\n   \r\n  if(requestData.arrayInfo) {\r\n    requestData.arrayInfo = JSON.stringify(requestData.arrayInfo) // replace/conver data\r\n  }\r\n  \r\n  return requestData;\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.type</b></summary>\r\n\r\nThis function allows you to change / replace the request type.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.type\r\nfunction RequestPrepare_type(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n    return 'POST' // replace requestType\r\n  }\r\n\r\n  const allowedRequestType = {\r\n    'GET': true,\r\n    'POST': true,\r\n  }\r\n  if(!allowedRequestType[requestType]) {\r\n    console.warn('Not correct request type', requestType)\r\n    return 'GET'; // replace\r\n  }\r\n  \r\n  return requestType; // return original request type\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.url</b></summary>\r\n\r\nThis function allows you to change/replace the request url.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.url\r\nfunction RequestPrepare_url(requestType, requestUrl, requestData) {\r\n  \r\n  if(requestType === 'POST-REPLACE') {\r\n    return 'https://test.domain.com/test-url' // replace url\r\n  }\r\n  \r\n   return requestUrl.getUrl(); // warning requestUrl - is RequestLinkClass\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.requestClientDataPrepare</b></summary>\r\n\r\nThis function allows you to change the object passed to axios or fetch.\r\nAdd headers, settings, etc.\r\n\r\n```js\r\nfunction RequestPrepare_requestClientDataPrepare(requestClientData, requestClass) {\r\n  let token = localStorage.getItem('user-token');\r\n  if (token) {\r\n    // add axios header\r\n    requestClientData.headers['Authorization'] = `Token ${token}`;\r\n  }\r\n  return requestClientData;\r\n},\r\n```\r\n\r\nps: this is a general callback\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare</b></summary>\r\n\r\nIn this block, we are working with the answer (we can change it).\r\nResponsePrepare is an object.\r\nSee the parameters (below) in Config.ResponsePrepare.[Settings subtype].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.isError</b></summary>\r\n\r\nHere we check whether the answer is an error\r\n```js\r\nfunction ResponsePrepare_isError(responseData){\r\n  if( !(200 <= riObject.httpStatus && riObject.httpStatus < 300) ) {\r\n    return true;\r\n  }\r\n  if(!riObject.data.success) {\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getErrorInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is true, then we are trying to get information about the error.\r\nWe give this information in the form of an object.\r\n```js\r\nasync function ResponsePrepare_getErrorInfo(riObject, requestClass, Config) => {\r\n  return {\r\n    code: 'error',\r\n    message: riObject.data.error || 'Unknown error',\r\n    data: riObject.data,\r\n  };\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getSuccessInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is false, then we get clean data from the response.\r\nLet's look at the example of the answer:\r\n\r\n```json5\r\n{ \"success\": true, \"result\": { \"a\": 1, \"b\": 2} } \r\n```\r\nIn this case, we want to get - {\"a\": 1, \"b\": 2}. To do this, use the following code:\r\n\r\n```js\r\nasync function ResponsePrepare_getSuccessInfo(riObject, requestClass, Config) => {\r\n  return riObject.data.result;\r\n};\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook</b></summary>\r\n\r\nHook - we can subscribe to Request Managera events.\r\nHook is an object.\r\nSee the parameters (below) in Config. Hook.[Subtype of settings].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook.RequestPromise</b></summary>\r\n\r\nThis event is called after the request is sent.\r\nIt is applicable for loading, maintaining statistics, logging, and displaying error messages\r\n```js\r\nfunction Hook_RequestPromise(requestPromise, settings){\r\n  requestPromise.then(\r\n    (result) => {},\r\n    (error) => {\r\n      alert(settings.errorMessage) // alert error\r\n    });\r\n};\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient</b></summary>\r\n\r\nThis function allows you to determine through which we will send the request.\r\nUsually axios or fetch is used (you can use others as well).\r\nIn the examples below, we will use axios.\r\n\r\nIn 99%, it is necessary to pass axios. This is done via Config.RequestClient.send.\r\nThe rest should work correctly!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\n\r\nOverriding the rest makes sense if you are using a different client for sending\r\nor axios has released a new version (not compatible with the old one).\r\n\r\nps: It is worth noting axios on the front and on the back - behaves a little differently\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.name</b></summary>\r\n\r\nHere we are talking about which preset Config.RequestClient to use (AXIOS | FETCH).\r\nBy default, the AXIOS preset will be used.\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.send</b></summary>\r\n\r\nHere we say that the sending will be via \"axios\".\r\n```js\r\nimport axios from 'axios';\r\n\r\nasync function RequestClient_send(obj) {\r\n  return await axios(obj);\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.fileDownload</b></summary>\r\n\r\nHere we say that we will upload files.\r\n```js\r\nimport fileDownload from 'js-file-download';\r\n\r\nasync fileDownload(data, ri, requestClass, Config) {\r\n  const download = async (data, ri, requestClass, Config) => {\r\n    let fileName = requestClass.getFileName();\r\n    fileDownload(ri.data, fileName, ri.contentType);\r\n  }\r\n  download(data, ri, requestClass, Config)\r\n  return {};\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRequestClientObject</b></summary>\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\nHere we convert the data from the RequestManagera request object to an axios object. We only convert it!\r\n```js\r\nfunction getRequestClientObject(requestObj, requestClass, Config) {\r\n  const axiosObj = {\r\n    method  : requestObj.type,\r\n    url     : requestObj.url,\r\n    headers : {}\r\n  };\r\n  // axiosObj.responseType = 'application/json';\r\n\r\n  if(requestClass.getFileName()){\r\n    axiosObj.responseType = 'blob';\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.get)){\r\n    axiosObj.params  = requestObj.data.get;\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.post)){\r\n    axiosObj.data    = requestObj.data.post;\r\n  }\r\n\r\n  if(requestObj.data.post instanceof FormData){\r\n    axiosObj.data    = requestObj.data.post;\r\n    axiosObj.headers['Content-Type'] = 'multipart/form-data';\r\n  }\r\n\r\n  return axiosObj;\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.isNetworkError</b></summary>\r\n\r\nIn js, network errors can't get much information.\r\nIf network errors occur, we handle them separately.\r\nIf this is a network error , we will return a message with the error text.\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction isNetworkError(axiosResponse, requestClass, Config) {\r\n  if(/* axiosResponse.isAxiosError && */ !axiosResponse.response) {\r\n    return axiosResponse.message ? axiosResponse.message : 'Unknown network error';\r\n  }\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRiObject</b></summary>\r\n\r\nWe pull the information from the response to riObject (internal type of Request Manager).\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction getRiObject(axiosResponse, requestClass, Config) {\r\n\r\n  const ri = {\r\n    httpStatus  : -1,\r\n    contentType : '',\r\n    data        : {},\r\n    headers     : {}\r\n  }\r\n  const clearContentType = (contentType) => {\r\n    return contentType ? contentType.split(';')[0] : '';\r\n  }\r\n\r\n  // get status\r\n  if(axiosResponse.status) {\r\n    ri.httpStatus = axiosResponse.status;\r\n  } else if(axiosResponse.request &&  axiosResponse.request.status) {\r\n    ri.httpStatus = axiosResponse.request.status;\r\n  }\r\n\r\n  // get headers\r\n  if(axiosResponse.headers) {\r\n    ri.headers = axiosResponse.headers;\r\n  }\r\n\r\n  // get contentType\r\n  if( ri.headers['content-type']) {\r\n    ri.contentType = clearContentType( axiosResponse.headers['content-type'] );\r\n  }\r\n\r\n  // get data\r\n  if(axiosResponse.data){\r\n    ri.data = axiosResponse.data;\r\n\r\n    if(ri.data instanceof Blob){\r\n      ri.contentType = clearContentType( ri.data.type );\r\n    }\r\n  }\r\n\r\n  return ri;\r\n},\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n\r\n# Advantages\r\n\r\n- Ability to integrate into any js project (webpack, Vue, React, Next, Nuxt, Angular and ...).\r\n- 1 sending point for all requests.\r\n- The ability to create an sdk and reuse it in different projects.\r\n- Ease of use (grouping by type, uniformity, response prepare).\r\n- Query caching (optional, disabled by default).\r\n- Working with fake data.\r\n- Use of global error handlers (user notify)\r\n- Logger, Statistics, Loading, ...\r\n\r\nA lot of this requires integration with your system.\r\nThe final functionality is up to you to determine.\r\n\r\n\r\n# Disadvantages\r\n\r\n- There is no way to make a universal solution (the variety of APIs knows no boundaries).\r\n  Perhaps someone will need additional functionality.\r\n  Such cases are reduced to a minimum, but they can still happen.\r\n- Complexity. Integration with the API requires experience. You need to understand what is happening and where.\r\n  This solution makes it easier, but I always want it easier...\r\n- The solution is designed for communication via json.\r\n  To work with other formats (xml, yaml,...)\r\n  , you may need to use additional librari\r\n","readmeFilename":"readme.md","gitHead":"4b1206719a21f49660a62117650f74b01226326a","_id":"js-request-manager@2.0.0-alpha.4","_nodeVersion":"14.18.1","_npmVersion":"8.5.3","dist":{"integrity":"sha512-xl1+xWVZA1QSe9PxDD72BPEOgtYbG01YMK1AbWOxkkvrefUvF8sFYD3NBeAa96vTNr0QmjM8I+LmljEaZ+wJXw==","shasum":"9ba1cad7bfd5c9c1ae25396b587fddca500a5306","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-2.0.0-alpha.4.tgz","fileCount":84,"unpackedSize":689400,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE2FrW1Snlb94WvJAb7jU2XUhs17T3GGWLCMh3lHqGEGAiAQCIh/vEsnlfkDKZmwgcZOKZ7YbDO5rftO0L2jQftbQA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiWNHSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpzIw//ZBFLSq6BddVblJYuuToMeIuqrlthBZBub909mbM6ij9cpL/p\r\nwipVGaOX8w+oLKtbXodidYhN8rmgK1V4nMA5kpU2h1P2IT6YzsTMJgbUkIut\r\n1fBQ5yKPwugyXg94nFw0AwOx/TpPPo9v65yHu4lQwN3IgqkR0/mlDcozzomS\r\n0JB91IwaBO0qakf6vkLBu5B1MTMMVrhGb9uEGaUGSU8ucYQvQEJwhDMRVH+X\r\nOSgkXBlFiXJka6SxlfMOYspQofbnmMq2e8OfSLqoozg6e0awMRCgqNVrDhpZ\r\niFc6yL7XEx8vgzBCZNsTEA5eh9hnpOYrWnVGBsfLW5JItS8y2BaGzu20gxQe\r\nUWPvRlULbIF6EeQIiAM0zHlMJh5It+E6hJy2TG2AWHB7dWx2eMWIHRz6imNo\r\nDPpxDqfYWRhDeQBz3WaU1+vd9dEtsL4ghy9Vz+QLyws9H6D7avMx0jV8OXLA\r\nT8G9alC9ozePwUs6/2IuF94nBDm8vnQYERq3VaWy1B0fGqX6cvSMaVyV0xC7\r\nQVSXW5QI8Y6ODyuZ4I+QjIpZosZIGRVLwqbxDPGub4/DbaCGomE2e2PumFTD\r\n9BCx61/38q6hhzngitb6YYJPcUmPtjpGUVb3s+ULFAAJbpaSIAZ4XZLusKM0\r\nash71VoZCXNc8sj6key52HupW5lX0o0Ejac=\r\n=yaK+\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_2.0.0-alpha.4_1649988050724_0.6044768428751761"},"_hasShrinkwrap":false},"2.0.0-alpha.5":{"name":"js-request-manager","version":"2.0.0-alpha.5","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack"},"devDependencies":{"@babel/core":"^7.17.7","@babel/plugin-proposal-class-properties":"^7.16.7","@babel/plugin-transform-runtime":"^7.17.0","@babel/preset-env":"^7.16.11","babel-loader":"^8.2.3","babel-plugin-webpack-aliases":"^1.1.3","eslint":"^8.11.0","eslint-plugin-oploshka":"^1.0.7","webpack":"^5.70.0","webpack-cli":"^4.9.2"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"readme":"# API request Manager.\r\n\r\nRequest Manager is a library for creating an sdk library for your server (API).\r\nThe API type doesn't matter, whether it's REST or RPC.\r\nAs a result, we get the opportunity to centrally process all requests.\r\nWe do not bother with converting data in the code, but only work with pure data.\r\nIt is better to see 1 time than to hear 100 times.\r\n\r\n[Documentation in Russian](readme.ru.md)\r\n\r\n# How it looks after setting up\r\n### async/await\r\n```js\r\ntry {\r\n  let responseData = await RequestManager.Auth.authorization({login: 'admin', password: 'pass'})\r\n  // ... user code for success response\r\n} catch (err) {\r\n  // ... user code for error response or server error\r\n  return;\r\n}\r\n```\r\n### Promise\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'}).then(\r\n  (result)  => { /* ... user code for success response */ },\r\n  (error)   => { /* ... user code for error response or server error */ }\r\n);\r\n```\r\n\r\n# Installation\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">NPM</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# npm install axios              # for use axios client\r\n# npm install node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# npm install js-file-download   # for file download (or use other)\r\n# # install\r\nnpm install js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Yarn</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# yarn add axios              # for use axios client\r\n# yarn add node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# yarn add js-file-download   # for file download (or use other)\r\n# # install\r\nyarn add js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">package.json</b></summary>\r\n\r\n```json5\r\n{\r\n  \"dependencies\": {\r\n    // \"axios\": \"^0.21.1\", or \"node-fetch\": \"^2.6.1\", or js fetch()\r\n    // js-file-download\": \"^0.4.12\", or other \r\n    \"js-request-manager\": \"^1.0.0\",\r\n    // ..\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n\r\n# Initialization (options):\r\n   - Copy [optimal example files](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmOptimalStructureCreate) to your project (recommended).\r\n   - Copy [minimal example file](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmSimpleCreate) to your project.\r\n   - or create a file manually.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Example of manual creation</b></summary>\r\n\r\n> ```js\r\n> import RequestManager from 'js-request-manager/src/RequestManager';\r\n> import RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n> // request sender\r\n> import axios from 'axios';\r\n> \r\n> const requestSchema = {\r\n>   Auth: {\r\n>     authorization: ({login, password}) => {\r\n>       return new RequestClass({\r\n>         name  : 'authorization',\r\n>         type  : 'POST',\r\n>         url   : 'api://authorize', // https://domain.test/api/authorize\r\n>         params: {\r\n>           get: {},\r\n>           post: {login, password},\r\n>         },\r\n>         responsePrepare: (data) => {\r\n>           return {token: data.jwt};\r\n>         },\r\n>         errorMessage: 'Not correct login or password',\r\n>       });\r\n>     },\r\n>   }\r\n> }\r\n> \r\n> const Config = {\r\n>   hostAlias: {\r\n>     api: 'https://domain.test/api',\r\n>   },\r\n>   Hook: {\r\n>     RequestPromise (requestPromise, settings) { console.log(requestPromise, settings); }\r\n>   },\r\n>   RequestClient: {\r\n>     async send(obj) { return await axios(obj); }\r\n>   }\r\n> }\r\n> \r\n> const RmSimpleCreate = RequestManager(requestSchema, Config);\r\n> \r\n> // optional (recommended use global request manager)\r\n> global.RequestManager = RmSimpleCreate\r\n> \r\n> export default RmSimpleCreate\r\n> \r\n> ```\r\n</details>\r\n\r\n\r\n# RequestManager accepts the following settings:\r\n```js\r\nconst RequestSchema = {/* ... request schema */ };\r\n\r\n// Config - all parameters are optional\r\nconst Config = {\r\n  hostAlias: {},\r\n  RequestPrepare: {\r\n    data(requestType, requestUrl, requestData) {\r\n      return requestData;\r\n    },\r\n    type(requestType, requestUrl, requestData) {\r\n      return requestType;\r\n    },\r\n    url(requestType, requestUrl, requestData) {\r\n      return requestUrl.getUrl();\r\n    },\r\n    requestClientDataPrepare(requestClientData, requestClass) {\r\n      return requestClientData;\r\n    },\r\n  },\r\n  ResponsePrepare: {\r\n    isError(riObject) {\r\n      return false;\r\n    },\r\n    getErrorInfo: async (riObject, requestClass, Config) => {\r\n      return {code: 'error', message: 'Undefined error', data: riObject}\r\n    },\r\n    getSuccessInfo: async (riObject, requestClass, Config) => {\r\n      return riObject.data\r\n    },\r\n  },\r\n  Hook: {\r\n    RequestPromise(requestPromise, settings) {\r\n      console.log(requestPromise, settings);\r\n    }\r\n  },\r\n  RequestClient: {\r\n    name: 'AXIOS', // or FETCH\r\n    async send(obj) {\r\n      return await axios(obj);\r\n    },\r\n    async fileDownload(data, ri, requestClass, Config) {\r\n      // add file download code\r\n      return {};\r\n    },\r\n    getRequestClientObject(requestObj, requestClass, Config) {\r\n      return requestObj;\r\n    },\r\n    isNetworkError(axiosResponse, requestClass, Config) {\r\n      return false;\r\n    }\r\n    getRiObject(axiosResponse, requestClass, Config) {\r\n      return {httpStatus: 200, contentType: '', data: {}, headers: {}};\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\n## RequestSchema setting information\r\n\r\nIt describes how we will group all our requests, what parameters they will accept and in what form they will be sent.\r\nWe can also change or replace the response data.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em\">RequestSchema</b></summary>\r\n\r\n```js\r\n// schema example\r\nconst RequestSchema = {\r\n  Auth: {\r\n    authorization: ({login, password})        => { return new RequestClass({/* ... */}); },\r\n    registration : ({email, login, password}) => { return new RequestClass({/* ... */}); },\r\n  },\r\n  News: {\r\n    getAll : ()           => { return new RequestClass({/* ... */}); },\r\n    getById: ({id})       => { return new RequestClass({/* ... */}); },\r\n    getOldNews: ()        => { return new RequestClass({/* ... */}); },\r\n    getNewNews: ()        => { return new RequestClass({/* ... */}); },\r\n    create:({name, desc}) => { return new RequestClass({/* ... */}); },\r\n    delete:({id})         => { return new RequestClass({/* ... */}); },\r\n  },\r\n  Tags: {\r\n    News: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n    User: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n  },\r\n  getTheme : ()           => { return new RequestClass({/* ... */}); },\r\n};\r\n```\r\nA single request is described by a function that accepts a single object and returns RequestClass\r\n\r\nAn example of how to call it\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'});\r\n\r\nRequestManager.News.getAll();\r\nRequestManager.News.getById({id});\r\n\r\nRequestManager.Tags.News.getAll();\r\nRequestManager.Tags.User.getAll({}).then(console.log, console.error);\r\n\r\nRequestManager.getTheme();\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">RequestSchema RequestClass</b></summary>\r\n\r\nThis is the class that we use to describe all our queries.\r\n```js\r\nimport RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n\r\nrequest = new RequestClass({\r\n  name : '',      // String - request name (need for debug or custom prepare)\r\n  type : '',      // String - request type [GET|POST|PUT|DELETE ... or other custom ]\r\n  url  : '',      // String - request url\r\n  params : {\r\n    get : {},     // Send GET params\r\n    post: {},     // Send POST params\r\n  },\r\n\r\n  responsePrepare: (response) => { // Function\r\n    return {token: response.jwt};  // change response\r\n  },\r\n\r\n  cache : false,        // Create request cache   \r\n  errorMessage: '',     // String or Function\r\n  // For load file\r\n  fileName: 'test.txt', // String or Function\r\n})\r\n```\r\n</details>\r\n\r\n\r\n## Config setting information\r\n\r\nHere we can change the standard behavior of the Request Manager, subscribe to events, set an alias for the url.\r\nNext, you can see detailed information on RequestSchema and Config\r\n\r\nConfig will be described in the form Config.[Type].[Sub type] = [Settings]\r\n\r\n------------------------------------------------------\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.hostAlias</b></summary>\r\n\r\nSetting an alias for the url.\r\nWe do this in order not to write full domain names in all requests.\r\nExample:\r\n```js\r\nconst hostAlias = {\r\n   auth   : 'https://auth.domain.test/api',\r\n   apiV1  : 'https://domain.test/api/v1',\r\n   apiV2  : 'https://v2.domain.test/api',\r\n};\r\n```\r\n\r\nIn the future, you can use abbreviations when describing queries\r\n```js\r\nRequestClass({ url: 'auth://authorize' /* ... */}); // url => https://auth.domain.test/api/authorize\r\nRequestClass({ url: 'apiV1://users'    /* ... */}); // url => https://domain.test/api/v1/users\r\nRequestClass({ url: 'apiV2://news'     /* ... */}); // url => https://v2.domain.test/api/news\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare</b></summary>\r\n\r\nIn this object, we can add/redefine/change/delete the data that will be in the request.\r\nRequestPrepare is an object. See the parameters (below) in Config.RequestPrepare.[Settings subtype].\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.data</b></summary>\r\n\r\n\r\nThis function allows you to change/supplement / replace the request data.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.data\r\nfunction RequestPrepare_data(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n     return { test: \"test\"} // replace requestData\r\n  }\r\n  \r\n  requestData.time = Date(); // add date in send request\r\n  \r\n  if(requestData.debugInfo) {\r\n    console.log(requestData.debugInfo) // view debug info\r\n    delete requestData.debugInfo;     // delete data (debugInfo) from the request\r\n  }\r\n   \r\n  if(requestData.arrayInfo) {\r\n    requestData.arrayInfo = JSON.stringify(requestData.arrayInfo) // replace/conver data\r\n  }\r\n  \r\n  return requestData;\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.type</b></summary>\r\n\r\nThis function allows you to change / replace the request type.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.type\r\nfunction RequestPrepare_type(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n    return 'POST' // replace requestType\r\n  }\r\n\r\n  const allowedRequestType = {\r\n    'GET': true,\r\n    'POST': true,\r\n  }\r\n  if(!allowedRequestType[requestType]) {\r\n    console.warn('Not correct request type', requestType)\r\n    return 'GET'; // replace\r\n  }\r\n  \r\n  return requestType; // return original request type\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.url</b></summary>\r\n\r\nThis function allows you to change/replace the request url.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.url\r\nfunction RequestPrepare_url(requestType, requestUrl, requestData) {\r\n  \r\n  if(requestType === 'POST-REPLACE') {\r\n    return 'https://test.domain.com/test-url' // replace url\r\n  }\r\n  \r\n   return requestUrl.getUrl(); // warning requestUrl - is RequestLinkClass\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.requestClientDataPrepare</b></summary>\r\n\r\nThis function allows you to change the object passed to axios or fetch.\r\nAdd headers, settings, etc.\r\n\r\n```js\r\nfunction RequestPrepare_requestClientDataPrepare(requestClientData, requestClass) {\r\n  let token = localStorage.getItem('user-token');\r\n  if (token) {\r\n    // add axios header\r\n    requestClientData.headers['Authorization'] = `Token ${token}`;\r\n  }\r\n  return requestClientData;\r\n},\r\n```\r\n\r\nps: this is a general callback\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare</b></summary>\r\n\r\nIn this block, we are working with the answer (we can change it).\r\nResponsePrepare is an object.\r\nSee the parameters (below) in Config.ResponsePrepare.[Settings subtype].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.isError</b></summary>\r\n\r\nHere we check whether the answer is an error\r\n```js\r\nfunction ResponsePrepare_isError(responseData){\r\n  if( !(200 <= riObject.httpStatus && riObject.httpStatus < 300) ) {\r\n    return true;\r\n  }\r\n  if(!riObject.data.success) {\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getErrorInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is true, then we are trying to get information about the error.\r\nWe give this information in the form of an object.\r\n```js\r\nasync function ResponsePrepare_getErrorInfo(riObject, requestClass, Config) => {\r\n  return {\r\n    code: 'error',\r\n    message: riObject.data.error || 'Unknown error',\r\n    data: riObject.data,\r\n  };\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getSuccessInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is false, then we get clean data from the response.\r\nLet's look at the example of the answer:\r\n\r\n```json5\r\n{ \"success\": true, \"result\": { \"a\": 1, \"b\": 2} } \r\n```\r\nIn this case, we want to get - {\"a\": 1, \"b\": 2}. To do this, use the following code:\r\n\r\n```js\r\nasync function ResponsePrepare_getSuccessInfo(riObject, requestClass, Config) => {\r\n  return riObject.data.result;\r\n};\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook</b></summary>\r\n\r\nHook - we can subscribe to Request Managera events.\r\nHook is an object.\r\nSee the parameters (below) in Config. Hook.[Subtype of settings].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook.RequestPromise</b></summary>\r\n\r\nThis event is called after the request is sent.\r\nIt is applicable for loading, maintaining statistics, logging, and displaying error messages\r\n```js\r\nfunction Hook_RequestPromise(requestPromise, settings){\r\n  requestPromise.then(\r\n    (result) => {},\r\n    (error) => {\r\n      alert(settings.errorMessage) // alert error\r\n    });\r\n};\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient</b></summary>\r\n\r\nThis function allows you to determine through which we will send the request.\r\nUsually axios or fetch is used (you can use others as well).\r\nIn the examples below, we will use axios.\r\n\r\nIn 99%, it is necessary to pass axios. This is done via Config.RequestClient.send.\r\nThe rest should work correctly!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\n\r\nOverriding the rest makes sense if you are using a different client for sending\r\nor axios has released a new version (not compatible with the old one).\r\n\r\nps: It is worth noting axios on the front and on the back - behaves a little differently\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.name</b></summary>\r\n\r\nHere we are talking about which preset Config.RequestClient to use (AXIOS | FETCH).\r\nBy default, the AXIOS preset will be used.\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.send</b></summary>\r\n\r\nHere we say that the sending will be via \"axios\".\r\n```js\r\nimport axios from 'axios';\r\n\r\nasync function RequestClient_send(obj) {\r\n  return await axios(obj);\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.fileDownload</b></summary>\r\n\r\nHere we say that we will upload files.\r\n```js\r\nimport fileDownload from 'js-file-download';\r\n\r\nasync fileDownload(data, ri, requestClass, Config) {\r\n  const download = async (data, ri, requestClass, Config) => {\r\n    let fileName = requestClass.getFileName();\r\n    fileDownload(ri.data, fileName, ri.contentType);\r\n  }\r\n  download(data, ri, requestClass, Config)\r\n  return {};\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRequestClientObject</b></summary>\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\nHere we convert the data from the RequestManagera request object to an axios object. We only convert it!\r\n```js\r\nfunction getRequestClientObject(requestObj, requestClass, Config) {\r\n  const axiosObj = {\r\n    method  : requestObj.type,\r\n    url     : requestObj.url,\r\n    headers : {}\r\n  };\r\n  // axiosObj.responseType = 'application/json';\r\n\r\n  if(requestClass.getFileName()){\r\n    axiosObj.responseType = 'blob';\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.get)){\r\n    axiosObj.params  = requestObj.data.get;\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.post)){\r\n    axiosObj.data    = requestObj.data.post;\r\n  }\r\n\r\n  if(requestObj.data.post instanceof FormData){\r\n    axiosObj.data    = requestObj.data.post;\r\n    axiosObj.headers['Content-Type'] = 'multipart/form-data';\r\n  }\r\n\r\n  return axiosObj;\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.isNetworkError</b></summary>\r\n\r\nIn js, network errors can't get much information.\r\nIf network errors occur, we handle them separately.\r\nIf this is a network error , we will return a message with the error text.\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction isNetworkError(axiosResponse, requestClass, Config) {\r\n  if(/* axiosResponse.isAxiosError && */ !axiosResponse.response) {\r\n    return axiosResponse.message ? axiosResponse.message : 'Unknown network error';\r\n  }\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRiObject</b></summary>\r\n\r\nWe pull the information from the response to riObject (internal type of Request Manager).\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction getRiObject(axiosResponse, requestClass, Config) {\r\n\r\n  const ri = {\r\n    httpStatus  : -1,\r\n    contentType : '',\r\n    data        : {},\r\n    headers     : {}\r\n  }\r\n  const clearContentType = (contentType) => {\r\n    return contentType ? contentType.split(';')[0] : '';\r\n  }\r\n\r\n  // get status\r\n  if(axiosResponse.status) {\r\n    ri.httpStatus = axiosResponse.status;\r\n  } else if(axiosResponse.request &&  axiosResponse.request.status) {\r\n    ri.httpStatus = axiosResponse.request.status;\r\n  }\r\n\r\n  // get headers\r\n  if(axiosResponse.headers) {\r\n    ri.headers = axiosResponse.headers;\r\n  }\r\n\r\n  // get contentType\r\n  if( ri.headers['content-type']) {\r\n    ri.contentType = clearContentType( axiosResponse.headers['content-type'] );\r\n  }\r\n\r\n  // get data\r\n  if(axiosResponse.data){\r\n    ri.data = axiosResponse.data;\r\n\r\n    if(ri.data instanceof Blob){\r\n      ri.contentType = clearContentType( ri.data.type );\r\n    }\r\n  }\r\n\r\n  return ri;\r\n},\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n\r\n# Advantages\r\n\r\n- Ability to integrate into any js project (webpack, Vue, React, Next, Nuxt, Angular and ...).\r\n- 1 sending point for all requests.\r\n- The ability to create an sdk and reuse it in different projects.\r\n- Ease of use (grouping by type, uniformity, response prepare).\r\n- Query caching (optional, disabled by default).\r\n- Working with fake data.\r\n- Use of global error handlers (user notify)\r\n- Logger, Statistics, Loading, ...\r\n\r\nA lot of this requires integration with your system.\r\nThe final functionality is up to you to determine.\r\n\r\n\r\n# Disadvantages\r\n\r\n- There is no way to make a universal solution (the variety of APIs knows no boundaries).\r\n  Perhaps someone will need additional functionality.\r\n  Such cases are reduced to a minimum, but they can still happen.\r\n- Complexity. Integration with the API requires experience. You need to understand what is happening and where.\r\n  This solution makes it easier, but I always want it easier...\r\n- The solution is designed for communication via json.\r\n  To work with other formats (xml, yaml,...)\r\n  , you may need to use additional librari\r\n","readmeFilename":"readme.md","gitHead":"4b1206719a21f49660a62117650f74b01226326a","_id":"js-request-manager@2.0.0-alpha.5","_nodeVersion":"14.18.1","_npmVersion":"8.5.3","dist":{"integrity":"sha512-UrELvkyYU246EznM6S5+jfLc4mpS7JNI8x3FL+nC32/TTuVidsGxtXhULvIIYaP79HMBy8sJxrfWBpgkqyO6Rw==","shasum":"3ef6be78f0980c4f61c5c1f5de3c92cb000fdecd","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-2.0.0-alpha.5.tgz","fileCount":84,"unpackedSize":689648,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDh4A7jblCZpmNv3+lFPxmfjUoMNKrsimqMLPIA6EmxkAiBrMTPXJMM0z+rtjH4p25OdCXpEf3PhWzImTuk1VtGxUw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiWNPlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqFcQ//VD6t+mCHURKDrfc1fWXga0JDMGkysAq52hH4y7p2TwyKC4YY\r\nzoCBRvLAkEe6UDoB+VzbdZbHSx3cpxUcwuxTD5cXIFK3yiYRxRphIoAydfGQ\r\nKqoy0NesDnIa/EUcsugZ08uQ3g8XuYpsRl30NkQdbCiOHN7rm3WdE2NXC5mf\r\nBHt2f+Xq+4/3cJMl7DKXlIVezmDm1HKCPGnuI/c/J93n8vG5cSfNz5K7AFcV\r\naMss1d7jtamUvM8LtG7p5suqZ8PCdisZOstIdq3sdyhrQKmrO1Bcfp9YDRB9\r\nxCqq2bERN/JtZjdsss7utoTgfzzdJ9UvfUYxXLOBatqOxbogTtzgUgwrAOyQ\r\nzkymtAytO2RWeCIQ28k8E47MoFwHqvNXoEzUMJfx+AT5/P8bDyg/HlhrJHa0\r\nPi9VJQLaBxGvfrEFoQjkjo6uLd73+rGZjbcqQxAo+wE+JHTim5Cm17CMPRad\r\ns27mnK1/E14t1faILvnkUQPHYcuZ7MFlpgjZZbVwPutUJPfi0XdLaZ31Fa6W\r\n11EOUajWd+4gyWik0+EVzcybClDfOTfSUJFwIxuYtCbc0+SIqWmOAKyparOb\r\nEQ84/RuAEFP08btmc/tMlxu6fgo4aBF6zkw1RGBJnPGQziJG9VzdZ1V/9Dvi\r\n3Dy6vjICc54f+ytlav6t13DRKwMNgZ6+kNM=\r\n=vDw4\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_2.0.0-alpha.5_1649988580978_0.44593656733611886"},"_hasShrinkwrap":false},"2.0.0-alpha.6":{"name":"js-request-manager","version":"2.0.0-alpha.6","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack"},"devDependencies":{"@babel/core":"^7.17.7","@babel/plugin-proposal-class-properties":"^7.16.7","@babel/plugin-transform-runtime":"^7.17.0","@babel/preset-env":"^7.16.11","babel-loader":"^8.2.3","babel-plugin-webpack-aliases":"^1.1.3","eslint":"^8.11.0","eslint-plugin-oploshka":"^1.0.7","webpack":"^5.70.0","webpack-cli":"^4.9.2"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"readme":"# API request Manager.\r\n\r\nRequest Manager is a library for creating an sdk library for your server (API).\r\nThe API type doesn't matter, whether it's REST or RPC.\r\nAs a result, we get the opportunity to centrally process all requests.\r\nWe do not bother with converting data in the code, but only work with pure data.\r\nIt is better to see 1 time than to hear 100 times.\r\n\r\n[Documentation in Russian](readme.ru.md)\r\n\r\n# How it looks after setting up\r\n### async/await\r\n```js\r\ntry {\r\n  let responseData = await RequestManager.Auth.authorization({login: 'admin', password: 'pass'})\r\n  // ... user code for success response\r\n} catch (err) {\r\n  // ... user code for error response or server error\r\n  return;\r\n}\r\n```\r\n### Promise\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'}).then(\r\n  (result)  => { /* ... user code for success response */ },\r\n  (error)   => { /* ... user code for error response or server error */ }\r\n);\r\n```\r\n\r\n# Installation\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">NPM</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# npm install axios              # for use axios client\r\n# npm install node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# npm install js-file-download   # for file download (or use other)\r\n# # install\r\nnpm install js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Yarn</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# yarn add axios              # for use axios client\r\n# yarn add node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# yarn add js-file-download   # for file download (or use other)\r\n# # install\r\nyarn add js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">package.json</b></summary>\r\n\r\n```json5\r\n{\r\n  \"dependencies\": {\r\n    // \"axios\": \"^0.21.1\", or \"node-fetch\": \"^2.6.1\", or js fetch()\r\n    // js-file-download\": \"^0.4.12\", or other \r\n    \"js-request-manager\": \"^1.0.0\",\r\n    // ..\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n\r\n# Initialization (options):\r\n   - Copy [optimal example files](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmOptimalStructureCreate) to your project (recommended).\r\n   - Copy [minimal example file](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmSimpleCreate) to your project.\r\n   - or create a file manually.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Example of manual creation</b></summary>\r\n\r\n> ```js\r\n> import RequestManager from 'js-request-manager/src/RequestManager';\r\n> import RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n> // request sender\r\n> import axios from 'axios';\r\n> \r\n> const requestSchema = {\r\n>   Auth: {\r\n>     authorization: ({login, password}) => {\r\n>       return new RequestClass({\r\n>         name  : 'authorization',\r\n>         type  : 'POST',\r\n>         url   : 'api://authorize', // https://domain.test/api/authorize\r\n>         params: {\r\n>           get: {},\r\n>           post: {login, password},\r\n>         },\r\n>         responsePrepare: (data) => {\r\n>           return {token: data.jwt};\r\n>         },\r\n>         errorMessage: 'Not correct login or password',\r\n>       });\r\n>     },\r\n>   }\r\n> }\r\n> \r\n> const Config = {\r\n>   hostAlias: {\r\n>     api: 'https://domain.test/api',\r\n>   },\r\n>   Hook: {\r\n>     RequestPromise (requestPromise, settings) { console.log(requestPromise, settings); }\r\n>   },\r\n>   RequestClient: {\r\n>     async send(obj) { return await axios(obj); }\r\n>   }\r\n> }\r\n> \r\n> const RmSimpleCreate = RequestManager(requestSchema, Config);\r\n> \r\n> // optional (recommended use global request manager)\r\n> global.RequestManager = RmSimpleCreate\r\n> \r\n> export default RmSimpleCreate\r\n> \r\n> ```\r\n</details>\r\n\r\n\r\n# RequestManager accepts the following settings:\r\n```js\r\nconst RequestSchema = {/* ... request schema */ };\r\n\r\n// Config - all parameters are optional\r\nconst Config = {\r\n  hostAlias: {},\r\n  RequestPrepare: {\r\n    data(requestType, requestUrl, requestData) {\r\n      return requestData;\r\n    },\r\n    type(requestType, requestUrl, requestData) {\r\n      return requestType;\r\n    },\r\n    url(requestType, requestUrl, requestData) {\r\n      return requestUrl.getUrl();\r\n    },\r\n    requestClientDataPrepare(requestClientData, requestClass) {\r\n      return requestClientData;\r\n    },\r\n  },\r\n  ResponsePrepare: {\r\n    isError(riObject) {\r\n      return false;\r\n    },\r\n    getErrorInfo: async (riObject, requestClass, Config) => {\r\n      return {code: 'error', message: 'Undefined error', data: riObject}\r\n    },\r\n    getSuccessInfo: async (riObject, requestClass, Config) => {\r\n      return riObject.data\r\n    },\r\n  },\r\n  Hook: {\r\n    RequestPromise(requestPromise, settings) {\r\n      console.log(requestPromise, settings);\r\n    }\r\n  },\r\n  RequestClient: {\r\n    name: 'AXIOS', // or FETCH\r\n    async send(obj) {\r\n      return await axios(obj);\r\n    },\r\n    async fileDownload(data, ri, requestClass, Config) {\r\n      // add file download code\r\n      return {};\r\n    },\r\n    getRequestClientObject(requestObj, requestClass, Config) {\r\n      return requestObj;\r\n    },\r\n    isNetworkError(axiosResponse, requestClass, Config) {\r\n      return false;\r\n    }\r\n    getRiObject(axiosResponse, requestClass, Config) {\r\n      return {httpStatus: 200, contentType: '', data: {}, headers: {}};\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\n## RequestSchema setting information\r\n\r\nIt describes how we will group all our requests, what parameters they will accept and in what form they will be sent.\r\nWe can also change or replace the response data.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em\">RequestSchema</b></summary>\r\n\r\n```js\r\n// schema example\r\nconst RequestSchema = {\r\n  Auth: {\r\n    authorization: ({login, password})        => { return new RequestClass({/* ... */}); },\r\n    registration : ({email, login, password}) => { return new RequestClass({/* ... */}); },\r\n  },\r\n  News: {\r\n    getAll : ()           => { return new RequestClass({/* ... */}); },\r\n    getById: ({id})       => { return new RequestClass({/* ... */}); },\r\n    getOldNews: ()        => { return new RequestClass({/* ... */}); },\r\n    getNewNews: ()        => { return new RequestClass({/* ... */}); },\r\n    create:({name, desc}) => { return new RequestClass({/* ... */}); },\r\n    delete:({id})         => { return new RequestClass({/* ... */}); },\r\n  },\r\n  Tags: {\r\n    News: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n    User: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n  },\r\n  getTheme : ()           => { return new RequestClass({/* ... */}); },\r\n};\r\n```\r\nA single request is described by a function that accepts a single object and returns RequestClass\r\n\r\nAn example of how to call it\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'});\r\n\r\nRequestManager.News.getAll();\r\nRequestManager.News.getById({id});\r\n\r\nRequestManager.Tags.News.getAll();\r\nRequestManager.Tags.User.getAll({}).then(console.log, console.error);\r\n\r\nRequestManager.getTheme();\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">RequestSchema RequestClass</b></summary>\r\n\r\nThis is the class that we use to describe all our queries.\r\n```js\r\nimport RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n\r\nrequest = new RequestClass({\r\n  name : '',      // String - request name (need for debug or custom prepare)\r\n  type : '',      // String - request type [GET|POST|PUT|DELETE ... or other custom ]\r\n  url  : '',      // String - request url\r\n  params : {\r\n    get : {},     // Send GET params\r\n    post: {},     // Send POST params\r\n  },\r\n\r\n  responsePrepare: (response) => { // Function\r\n    return {token: response.jwt};  // change response\r\n  },\r\n\r\n  cache : false,        // Create request cache   \r\n  errorMessage: '',     // String or Function\r\n  // For load file\r\n  fileName: 'test.txt', // String or Function\r\n})\r\n```\r\n</details>\r\n\r\n\r\n## Config setting information\r\n\r\nHere we can change the standard behavior of the Request Manager, subscribe to events, set an alias for the url.\r\nNext, you can see detailed information on RequestSchema and Config\r\n\r\nConfig will be described in the form Config.[Type].[Sub type] = [Settings]\r\n\r\n------------------------------------------------------\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.hostAlias</b></summary>\r\n\r\nSetting an alias for the url.\r\nWe do this in order not to write full domain names in all requests.\r\nExample:\r\n```js\r\nconst hostAlias = {\r\n   auth   : 'https://auth.domain.test/api',\r\n   apiV1  : 'https://domain.test/api/v1',\r\n   apiV2  : 'https://v2.domain.test/api',\r\n};\r\n```\r\n\r\nIn the future, you can use abbreviations when describing queries\r\n```js\r\nRequestClass({ url: 'auth://authorize' /* ... */}); // url => https://auth.domain.test/api/authorize\r\nRequestClass({ url: 'apiV1://users'    /* ... */}); // url => https://domain.test/api/v1/users\r\nRequestClass({ url: 'apiV2://news'     /* ... */}); // url => https://v2.domain.test/api/news\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare</b></summary>\r\n\r\nIn this object, we can add/redefine/change/delete the data that will be in the request.\r\nRequestPrepare is an object. See the parameters (below) in Config.RequestPrepare.[Settings subtype].\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.data</b></summary>\r\n\r\n\r\nThis function allows you to change/supplement / replace the request data.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.data\r\nfunction RequestPrepare_data(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n     return { test: \"test\"} // replace requestData\r\n  }\r\n  \r\n  requestData.time = Date(); // add date in send request\r\n  \r\n  if(requestData.debugInfo) {\r\n    console.log(requestData.debugInfo) // view debug info\r\n    delete requestData.debugInfo;     // delete data (debugInfo) from the request\r\n  }\r\n   \r\n  if(requestData.arrayInfo) {\r\n    requestData.arrayInfo = JSON.stringify(requestData.arrayInfo) // replace/conver data\r\n  }\r\n  \r\n  return requestData;\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.type</b></summary>\r\n\r\nThis function allows you to change / replace the request type.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.type\r\nfunction RequestPrepare_type(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n    return 'POST' // replace requestType\r\n  }\r\n\r\n  const allowedRequestType = {\r\n    'GET': true,\r\n    'POST': true,\r\n  }\r\n  if(!allowedRequestType[requestType]) {\r\n    console.warn('Not correct request type', requestType)\r\n    return 'GET'; // replace\r\n  }\r\n  \r\n  return requestType; // return original request type\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.url</b></summary>\r\n\r\nThis function allows you to change/replace the request url.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.url\r\nfunction RequestPrepare_url(requestType, requestUrl, requestData) {\r\n  \r\n  if(requestType === 'POST-REPLACE') {\r\n    return 'https://test.domain.com/test-url' // replace url\r\n  }\r\n  \r\n   return requestUrl.getUrl(); // warning requestUrl - is RequestLinkClass\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.requestClientDataPrepare</b></summary>\r\n\r\nThis function allows you to change the object passed to axios or fetch.\r\nAdd headers, settings, etc.\r\n\r\n```js\r\nfunction RequestPrepare_requestClientDataPrepare(requestClientData, requestClass) {\r\n  let token = localStorage.getItem('user-token');\r\n  if (token) {\r\n    // add axios header\r\n    requestClientData.headers['Authorization'] = `Token ${token}`;\r\n  }\r\n  return requestClientData;\r\n},\r\n```\r\n\r\nps: this is a general callback\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare</b></summary>\r\n\r\nIn this block, we are working with the answer (we can change it).\r\nResponsePrepare is an object.\r\nSee the parameters (below) in Config.ResponsePrepare.[Settings subtype].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.isError</b></summary>\r\n\r\nHere we check whether the answer is an error\r\n```js\r\nfunction ResponsePrepare_isError(responseData){\r\n  if( !(200 <= riObject.httpStatus && riObject.httpStatus < 300) ) {\r\n    return true;\r\n  }\r\n  if(!riObject.data.success) {\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getErrorInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is true, then we are trying to get information about the error.\r\nWe give this information in the form of an object.\r\n```js\r\nasync function ResponsePrepare_getErrorInfo(riObject, requestClass, Config) => {\r\n  return {\r\n    code: 'error',\r\n    message: riObject.data.error || 'Unknown error',\r\n    data: riObject.data,\r\n  };\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getSuccessInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is false, then we get clean data from the response.\r\nLet's look at the example of the answer:\r\n\r\n```json5\r\n{ \"success\": true, \"result\": { \"a\": 1, \"b\": 2} } \r\n```\r\nIn this case, we want to get - {\"a\": 1, \"b\": 2}. To do this, use the following code:\r\n\r\n```js\r\nasync function ResponsePrepare_getSuccessInfo(riObject, requestClass, Config) => {\r\n  return riObject.data.result;\r\n};\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook</b></summary>\r\n\r\nHook - we can subscribe to Request Managera events.\r\nHook is an object.\r\nSee the parameters (below) in Config. Hook.[Subtype of settings].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook.RequestPromise</b></summary>\r\n\r\nThis event is called after the request is sent.\r\nIt is applicable for loading, maintaining statistics, logging, and displaying error messages\r\n```js\r\nfunction Hook_RequestPromise(requestPromise, settings){\r\n  requestPromise.then(\r\n    (result) => {},\r\n    (error) => {\r\n      alert(settings.errorMessage) // alert error\r\n    });\r\n};\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient</b></summary>\r\n\r\nThis function allows you to determine through which we will send the request.\r\nUsually axios or fetch is used (you can use others as well).\r\nIn the examples below, we will use axios.\r\n\r\nIn 99%, it is necessary to pass axios. This is done via Config.RequestClient.send.\r\nThe rest should work correctly!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\n\r\nOverriding the rest makes sense if you are using a different client for sending\r\nor axios has released a new version (not compatible with the old one).\r\n\r\nps: It is worth noting axios on the front and on the back - behaves a little differently\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.name</b></summary>\r\n\r\nHere we are talking about which preset Config.RequestClient to use (AXIOS | FETCH).\r\nBy default, the AXIOS preset will be used.\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.send</b></summary>\r\n\r\nHere we say that the sending will be via \"axios\".\r\n```js\r\nimport axios from 'axios';\r\n\r\nasync function RequestClient_send(obj) {\r\n  return await axios(obj);\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.fileDownload</b></summary>\r\n\r\nHere we say that we will upload files.\r\n```js\r\nimport fileDownload from 'js-file-download';\r\n\r\nasync fileDownload(data, ri, requestClass, Config) {\r\n  const download = async (data, ri, requestClass, Config) => {\r\n    let fileName = requestClass.getFileName();\r\n    fileDownload(ri.data, fileName, ri.contentType);\r\n  }\r\n  download(data, ri, requestClass, Config)\r\n  return {};\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRequestClientObject</b></summary>\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\nHere we convert the data from the RequestManagera request object to an axios object. We only convert it!\r\n```js\r\nfunction getRequestClientObject(requestObj, requestClass, Config) {\r\n  const axiosObj = {\r\n    method  : requestObj.type,\r\n    url     : requestObj.url,\r\n    headers : {}\r\n  };\r\n  // axiosObj.responseType = 'application/json';\r\n\r\n  if(requestClass.getFileName()){\r\n    axiosObj.responseType = 'blob';\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.get)){\r\n    axiosObj.params  = requestObj.data.get;\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.post)){\r\n    axiosObj.data    = requestObj.data.post;\r\n  }\r\n\r\n  if(requestObj.data.post instanceof FormData){\r\n    axiosObj.data    = requestObj.data.post;\r\n    axiosObj.headers['Content-Type'] = 'multipart/form-data';\r\n  }\r\n\r\n  return axiosObj;\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.isNetworkError</b></summary>\r\n\r\nIn js, network errors can't get much information.\r\nIf network errors occur, we handle them separately.\r\nIf this is a network error , we will return a message with the error text.\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction isNetworkError(axiosResponse, requestClass, Config) {\r\n  if(/* axiosResponse.isAxiosError && */ !axiosResponse.response) {\r\n    return axiosResponse.message ? axiosResponse.message : 'Unknown network error';\r\n  }\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRiObject</b></summary>\r\n\r\nWe pull the information from the response to riObject (internal type of Request Manager).\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction getRiObject(axiosResponse, requestClass, Config) {\r\n\r\n  const ri = {\r\n    httpStatus  : -1,\r\n    contentType : '',\r\n    data        : {},\r\n    headers     : {}\r\n  }\r\n  const clearContentType = (contentType) => {\r\n    return contentType ? contentType.split(';')[0] : '';\r\n  }\r\n\r\n  // get status\r\n  if(axiosResponse.status) {\r\n    ri.httpStatus = axiosResponse.status;\r\n  } else if(axiosResponse.request &&  axiosResponse.request.status) {\r\n    ri.httpStatus = axiosResponse.request.status;\r\n  }\r\n\r\n  // get headers\r\n  if(axiosResponse.headers) {\r\n    ri.headers = axiosResponse.headers;\r\n  }\r\n\r\n  // get contentType\r\n  if( ri.headers['content-type']) {\r\n    ri.contentType = clearContentType( axiosResponse.headers['content-type'] );\r\n  }\r\n\r\n  // get data\r\n  if(axiosResponse.data){\r\n    ri.data = axiosResponse.data;\r\n\r\n    if(ri.data instanceof Blob){\r\n      ri.contentType = clearContentType( ri.data.type );\r\n    }\r\n  }\r\n\r\n  return ri;\r\n},\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n\r\n# Advantages\r\n\r\n- Ability to integrate into any js project (webpack, Vue, React, Next, Nuxt, Angular and ...).\r\n- 1 sending point for all requests.\r\n- The ability to create an sdk and reuse it in different projects.\r\n- Ease of use (grouping by type, uniformity, response prepare).\r\n- Query caching (optional, disabled by default).\r\n- Working with fake data.\r\n- Use of global error handlers (user notify)\r\n- Logger, Statistics, Loading, ...\r\n\r\nA lot of this requires integration with your system.\r\nThe final functionality is up to you to determine.\r\n\r\n\r\n# Disadvantages\r\n\r\n- There is no way to make a universal solution (the variety of APIs knows no boundaries).\r\n  Perhaps someone will need additional functionality.\r\n  Such cases are reduced to a minimum, but they can still happen.\r\n- Complexity. Integration with the API requires experience. You need to understand what is happening and where.\r\n  This solution makes it easier, but I always want it easier...\r\n- The solution is designed for communication via json.\r\n  To work with other formats (xml, yaml,...)\r\n  , you may need to use additional librari\r\n","readmeFilename":"readme.md","gitHead":"b02a575330d280b8880f9bedff8ee9f922540549","_id":"js-request-manager@2.0.0-alpha.6","_nodeVersion":"14.18.1","_npmVersion":"8.5.3","dist":{"integrity":"sha512-9ThA5KiUMZ0loe/l+zMU//rmPS9wMeZafeOe0XTkSgxtIjnSQffzHTaaNgN2e/+0SJEioF48DfuXfa833sJuXQ==","shasum":"1dde94dce2d557a86ccc944944f6437e7ddf2ef8","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-2.0.0-alpha.6.tgz","fileCount":84,"unpackedSize":689512,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnMGKV+HDz9lvenqre/+9fTX1DWbiLjXP/+sqNkVPK9wIhAPmfuEzHFasYB39mZ4DtXi24YPKy01Ripjih2lYjObVV"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiX0JlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQYg/+Nfoi9tg68AWTerraluOiWFmYcwldRttS5AdE55dKkRGf6xTO\r\neO27pmfzxShp96KcQGauqXCXPuxRUc9S7hIOU9GDNa8OWWSn++jwJlGJTcKY\r\nVi/XwtJlceEu8QxqNIEcQGVLd/MxS8mBdg8Du7hFVi+9WL99J5MoQnS7Xf+y\r\nolg14Bon1NNr9iDp6MJQn3nnXeyM8+2LHkqB9MEv7SWUQ8U3c9J2ii2mca6O\r\nkEbRS7kPHjX2aAzRPgNiFjdhKUTtSA2Ju6bpSUtAvTdXE+c04XL/JAwPaYtP\r\n8A9axjZjz9X6tk7JANtpP8SHQ7uMg87AcPoe9Jo/KDLdIgzpHSJdBTM+YJla\r\n++6IFQjNC7nuMbkITR0E+71aw739LLdYjsqGCRlmJE+xoL6D4mLg9S/UXnNs\r\nDO/zDWLCPNh16mOracAQhXdrl0QdWT79ACkcUc9G6ZFxBL74Q2/I3/1c5uz3\r\nXIoSuxWBKwheDkbjSuOg1d6NTo/GiTRPQqDFpd5AP+3T/gU1V7uuqjE7LmXk\r\nUywwb+omyN3gr71SLINSs00gA97HomOrYi3n9YiyET/Vrqn8G0IFJ/bm+Gka\r\n+mlU3P5FAafHC8zrQmnHI5oFxYcgAYr+7Fgoi7oXpu4MYOq9tpp1SDFQ1ILi\r\nBp7TYRjr47KURa2dsr7F6WgXi6+Je4cz5lw=\r\n=QKOJ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_2.0.0-alpha.6_1650410085121_0.2578944509729886"},"_hasShrinkwrap":false},"2.0.0-alpha.7":{"name":"js-request-manager","version":"2.0.0-alpha.7","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack"},"devDependencies":{"@babel/core":"^7.17.7","@babel/plugin-proposal-class-properties":"^7.16.7","@babel/plugin-transform-runtime":"^7.17.0","@babel/preset-env":"^7.16.11","babel-loader":"^8.2.3","babel-plugin-webpack-aliases":"^1.1.3","eslint":"^8.11.0","eslint-plugin-oploshka":"^1.0.7","webpack":"^5.70.0","webpack-cli":"^4.9.2"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"readme":"# API request Manager.\r\n\r\nRequest Manager is a library for creating an sdk library for your server (API).\r\nThe API type doesn't matter, whether it's REST or RPC.\r\nAs a result, we get the opportunity to centrally process all requests.\r\nWe do not bother with converting data in the code, but only work with pure data.\r\nIt is better to see 1 time than to hear 100 times.\r\n\r\n[Documentation in Russian](readme.ru.md)\r\n\r\n# How it looks after setting up\r\n### async/await\r\n```js\r\ntry {\r\n  let responseData = await RequestManager.Auth.authorization({login: 'admin', password: 'pass'})\r\n  // ... user code for success response\r\n} catch (err) {\r\n  // ... user code for error response or server error\r\n  return;\r\n}\r\n```\r\n### Promise\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'}).then(\r\n  (result)  => { /* ... user code for success response */ },\r\n  (error)   => { /* ... user code for error response or server error */ }\r\n);\r\n```\r\n\r\n# Installation\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">NPM</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# npm install axios              # for use axios client\r\n# npm install node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# npm install js-file-download   # for file download (or use other)\r\n# # install\r\nnpm install js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Yarn</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# yarn add axios              # for use axios client\r\n# yarn add node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# yarn add js-file-download   # for file download (or use other)\r\n# # install\r\nyarn add js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">package.json</b></summary>\r\n\r\n```json5\r\n{\r\n  \"dependencies\": {\r\n    // \"axios\": \"^0.21.1\", or \"node-fetch\": \"^2.6.1\", or js fetch()\r\n    // js-file-download\": \"^0.4.12\", or other \r\n    \"js-request-manager\": \"^1.0.0\",\r\n    // ..\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n\r\n# Initialization (options):\r\n   - Copy [optimal example files](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmOptimalStructureCreate) to your project (recommended).\r\n   - Copy [minimal example file](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmSimpleCreate) to your project.\r\n   - or create a file manually.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Example of manual creation</b></summary>\r\n\r\n> ```js\r\n> import RequestManager from 'js-request-manager/src/RequestManager';\r\n> import RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n> // request sender\r\n> import axios from 'axios';\r\n> \r\n> const requestSchema = {\r\n>   Auth: {\r\n>     authorization: ({login, password}) => {\r\n>       return new RequestClass({\r\n>         name  : 'authorization',\r\n>         type  : 'POST',\r\n>         url   : 'api://authorize', // https://domain.test/api/authorize\r\n>         params: {\r\n>           get: {},\r\n>           post: {login, password},\r\n>         },\r\n>         responsePrepare: (data) => {\r\n>           return {token: data.jwt};\r\n>         },\r\n>         errorMessage: 'Not correct login or password',\r\n>       });\r\n>     },\r\n>   }\r\n> }\r\n> \r\n> const Config = {\r\n>   hostAlias: {\r\n>     api: 'https://domain.test/api',\r\n>   },\r\n>   Hook: {\r\n>     RequestPromise (requestPromise, settings) { console.log(requestPromise, settings); }\r\n>   },\r\n>   RequestClient: {\r\n>     async send(obj) { return await axios(obj); }\r\n>   }\r\n> }\r\n> \r\n> const RmSimpleCreate = RequestManager(requestSchema, Config);\r\n> \r\n> // optional (recommended use global request manager)\r\n> global.RequestManager = RmSimpleCreate\r\n> \r\n> export default RmSimpleCreate\r\n> \r\n> ```\r\n</details>\r\n\r\n\r\n# RequestManager accepts the following settings:\r\n```js\r\nconst RequestSchema = {/* ... request schema */ };\r\n\r\n// Config - all parameters are optional\r\nconst Config = {\r\n  hostAlias: {},\r\n  RequestPrepare: {\r\n    data(requestType, requestUrl, requestData) {\r\n      return requestData;\r\n    },\r\n    type(requestType, requestUrl, requestData) {\r\n      return requestType;\r\n    },\r\n    url(requestType, requestUrl, requestData) {\r\n      return requestUrl.getUrl();\r\n    },\r\n    requestClientDataPrepare(requestClientData, requestClass) {\r\n      return requestClientData;\r\n    },\r\n  },\r\n  ResponsePrepare: {\r\n    isError(riObject) {\r\n      return false;\r\n    },\r\n    getErrorInfo: async (riObject, requestClass, Config) => {\r\n      return {code: 'error', message: 'Undefined error', data: riObject}\r\n    },\r\n    getSuccessInfo: async (riObject, requestClass, Config) => {\r\n      return riObject.data\r\n    },\r\n  },\r\n  Hook: {\r\n    RequestPromise(requestPromise, settings) {\r\n      console.log(requestPromise, settings);\r\n    }\r\n  },\r\n  RequestClient: {\r\n    name: 'AXIOS', // or FETCH\r\n    async send(obj) {\r\n      return await axios(obj);\r\n    },\r\n    async fileDownload(data, ri, requestClass, Config) {\r\n      // add file download code\r\n      return {};\r\n    },\r\n    getRequestClientObject(requestObj, requestClass, Config) {\r\n      return requestObj;\r\n    },\r\n    isNetworkError(axiosResponse, requestClass, Config) {\r\n      return false;\r\n    }\r\n    getRiObject(axiosResponse, requestClass, Config) {\r\n      return {httpStatus: 200, contentType: '', data: {}, headers: {}};\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\n## RequestSchema setting information\r\n\r\nIt describes how we will group all our requests, what parameters they will accept and in what form they will be sent.\r\nWe can also change or replace the response data.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em\">RequestSchema</b></summary>\r\n\r\n```js\r\n// schema example\r\nconst RequestSchema = {\r\n  Auth: {\r\n    authorization: ({login, password})        => { return new RequestClass({/* ... */}); },\r\n    registration : ({email, login, password}) => { return new RequestClass({/* ... */}); },\r\n  },\r\n  News: {\r\n    getAll : ()           => { return new RequestClass({/* ... */}); },\r\n    getById: ({id})       => { return new RequestClass({/* ... */}); },\r\n    getOldNews: ()        => { return new RequestClass({/* ... */}); },\r\n    getNewNews: ()        => { return new RequestClass({/* ... */}); },\r\n    create:({name, desc}) => { return new RequestClass({/* ... */}); },\r\n    delete:({id})         => { return new RequestClass({/* ... */}); },\r\n  },\r\n  Tags: {\r\n    News: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n    User: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n  },\r\n  getTheme : ()           => { return new RequestClass({/* ... */}); },\r\n};\r\n```\r\nA single request is described by a function that accepts a single object and returns RequestClass\r\n\r\nAn example of how to call it\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'});\r\n\r\nRequestManager.News.getAll();\r\nRequestManager.News.getById({id});\r\n\r\nRequestManager.Tags.News.getAll();\r\nRequestManager.Tags.User.getAll({}).then(console.log, console.error);\r\n\r\nRequestManager.getTheme();\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">RequestSchema RequestClass</b></summary>\r\n\r\nThis is the class that we use to describe all our queries.\r\n```js\r\nimport RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n\r\nrequest = new RequestClass({\r\n  name : '',      // String - request name (need for debug or custom prepare)\r\n  type : '',      // String - request type [GET|POST|PUT|DELETE ... or other custom ]\r\n  url  : '',      // String - request url\r\n  params : {\r\n    get : {},     // Send GET params\r\n    post: {},     // Send POST params\r\n  },\r\n\r\n  responsePrepare: (response) => { // Function\r\n    return {token: response.jwt};  // change response\r\n  },\r\n\r\n  cache : false,        // Create request cache   \r\n  errorMessage: '',     // String or Function\r\n  // For load file\r\n  fileName: 'test.txt', // String or Function\r\n})\r\n```\r\n</details>\r\n\r\n\r\n## Config setting information\r\n\r\nHere we can change the standard behavior of the Request Manager, subscribe to events, set an alias for the url.\r\nNext, you can see detailed information on RequestSchema and Config\r\n\r\nConfig will be described in the form Config.[Type].[Sub type] = [Settings]\r\n\r\n------------------------------------------------------\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.hostAlias</b></summary>\r\n\r\nSetting an alias for the url.\r\nWe do this in order not to write full domain names in all requests.\r\nExample:\r\n```js\r\nconst hostAlias = {\r\n   auth   : 'https://auth.domain.test/api',\r\n   apiV1  : 'https://domain.test/api/v1',\r\n   apiV2  : 'https://v2.domain.test/api',\r\n};\r\n```\r\n\r\nIn the future, you can use abbreviations when describing queries\r\n```js\r\nRequestClass({ url: 'auth://authorize' /* ... */}); // url => https://auth.domain.test/api/authorize\r\nRequestClass({ url: 'apiV1://users'    /* ... */}); // url => https://domain.test/api/v1/users\r\nRequestClass({ url: 'apiV2://news'     /* ... */}); // url => https://v2.domain.test/api/news\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare</b></summary>\r\n\r\nIn this object, we can add/redefine/change/delete the data that will be in the request.\r\nRequestPrepare is an object. See the parameters (below) in Config.RequestPrepare.[Settings subtype].\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.data</b></summary>\r\n\r\n\r\nThis function allows you to change/supplement / replace the request data.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.data\r\nfunction RequestPrepare_data(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n     return { test: \"test\"} // replace requestData\r\n  }\r\n  \r\n  requestData.time = Date(); // add date in send request\r\n  \r\n  if(requestData.debugInfo) {\r\n    console.log(requestData.debugInfo) // view debug info\r\n    delete requestData.debugInfo;     // delete data (debugInfo) from the request\r\n  }\r\n   \r\n  if(requestData.arrayInfo) {\r\n    requestData.arrayInfo = JSON.stringify(requestData.arrayInfo) // replace/conver data\r\n  }\r\n  \r\n  return requestData;\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.type</b></summary>\r\n\r\nThis function allows you to change / replace the request type.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.type\r\nfunction RequestPrepare_type(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n    return 'POST' // replace requestType\r\n  }\r\n\r\n  const allowedRequestType = {\r\n    'GET': true,\r\n    'POST': true,\r\n  }\r\n  if(!allowedRequestType[requestType]) {\r\n    console.warn('Not correct request type', requestType)\r\n    return 'GET'; // replace\r\n  }\r\n  \r\n  return requestType; // return original request type\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.url</b></summary>\r\n\r\nThis function allows you to change/replace the request url.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.url\r\nfunction RequestPrepare_url(requestType, requestUrl, requestData) {\r\n  \r\n  if(requestType === 'POST-REPLACE') {\r\n    return 'https://test.domain.com/test-url' // replace url\r\n  }\r\n  \r\n   return requestUrl.getUrl(); // warning requestUrl - is RequestLinkClass\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.requestClientDataPrepare</b></summary>\r\n\r\nThis function allows you to change the object passed to axios or fetch.\r\nAdd headers, settings, etc.\r\n\r\n```js\r\nfunction RequestPrepare_requestClientDataPrepare(requestClientData, requestClass) {\r\n  let token = localStorage.getItem('user-token');\r\n  if (token) {\r\n    // add axios header\r\n    requestClientData.headers['Authorization'] = `Token ${token}`;\r\n  }\r\n  return requestClientData;\r\n},\r\n```\r\n\r\nps: this is a general callback\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare</b></summary>\r\n\r\nIn this block, we are working with the answer (we can change it).\r\nResponsePrepare is an object.\r\nSee the parameters (below) in Config.ResponsePrepare.[Settings subtype].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.isError</b></summary>\r\n\r\nHere we check whether the answer is an error\r\n```js\r\nfunction ResponsePrepare_isError(responseData){\r\n  if( !(200 <= riObject.httpStatus && riObject.httpStatus < 300) ) {\r\n    return true;\r\n  }\r\n  if(!riObject.data.success) {\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getErrorInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is true, then we are trying to get information about the error.\r\nWe give this information in the form of an object.\r\n```js\r\nasync function ResponsePrepare_getErrorInfo(riObject, requestClass, Config) => {\r\n  return {\r\n    code: 'error',\r\n    message: riObject.data.error || 'Unknown error',\r\n    data: riObject.data,\r\n  };\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getSuccessInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is false, then we get clean data from the response.\r\nLet's look at the example of the answer:\r\n\r\n```json5\r\n{ \"success\": true, \"result\": { \"a\": 1, \"b\": 2} } \r\n```\r\nIn this case, we want to get - {\"a\": 1, \"b\": 2}. To do this, use the following code:\r\n\r\n```js\r\nasync function ResponsePrepare_getSuccessInfo(riObject, requestClass, Config) => {\r\n  return riObject.data.result;\r\n};\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook</b></summary>\r\n\r\nHook - we can subscribe to Request Managera events.\r\nHook is an object.\r\nSee the parameters (below) in Config. Hook.[Subtype of settings].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook.RequestPromise</b></summary>\r\n\r\nThis event is called after the request is sent.\r\nIt is applicable for loading, maintaining statistics, logging, and displaying error messages\r\n```js\r\nfunction Hook_RequestPromise(requestPromise, settings){\r\n  requestPromise.then(\r\n    (result) => {},\r\n    (error) => {\r\n      alert(settings.errorMessage) // alert error\r\n    });\r\n};\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient</b></summary>\r\n\r\nThis function allows you to determine through which we will send the request.\r\nUsually axios or fetch is used (you can use others as well).\r\nIn the examples below, we will use axios.\r\n\r\nIn 99%, it is necessary to pass axios. This is done via Config.RequestClient.send.\r\nThe rest should work correctly!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\n\r\nOverriding the rest makes sense if you are using a different client for sending\r\nor axios has released a new version (not compatible with the old one).\r\n\r\nps: It is worth noting axios on the front and on the back - behaves a little differently\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.name</b></summary>\r\n\r\nHere we are talking about which preset Config.RequestClient to use (AXIOS | FETCH).\r\nBy default, the AXIOS preset will be used.\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.send</b></summary>\r\n\r\nHere we say that the sending will be via \"axios\".\r\n```js\r\nimport axios from 'axios';\r\n\r\nasync function RequestClient_send(obj) {\r\n  return await axios(obj);\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.fileDownload</b></summary>\r\n\r\nHere we say that we will upload files.\r\n```js\r\nimport fileDownload from 'js-file-download';\r\n\r\nasync fileDownload(data, ri, requestClass, Config) {\r\n  const download = async (data, ri, requestClass, Config) => {\r\n    let fileName = requestClass.getFileName();\r\n    fileDownload(ri.data, fileName, ri.contentType);\r\n  }\r\n  download(data, ri, requestClass, Config)\r\n  return {};\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRequestClientObject</b></summary>\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\nHere we convert the data from the RequestManagera request object to an axios object. We only convert it!\r\n```js\r\nfunction getRequestClientObject(requestObj, requestClass, Config) {\r\n  const axiosObj = {\r\n    method  : requestObj.type,\r\n    url     : requestObj.url,\r\n    headers : {}\r\n  };\r\n  // axiosObj.responseType = 'application/json';\r\n\r\n  if(requestClass.getFileName()){\r\n    axiosObj.responseType = 'blob';\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.get)){\r\n    axiosObj.params  = requestObj.data.get;\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.post)){\r\n    axiosObj.data    = requestObj.data.post;\r\n  }\r\n\r\n  if(requestObj.data.post instanceof FormData){\r\n    axiosObj.data    = requestObj.data.post;\r\n    axiosObj.headers['Content-Type'] = 'multipart/form-data';\r\n  }\r\n\r\n  return axiosObj;\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.isNetworkError</b></summary>\r\n\r\nIn js, network errors can't get much information.\r\nIf network errors occur, we handle them separately.\r\nIf this is a network error , we will return a message with the error text.\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction isNetworkError(axiosResponse, requestClass, Config) {\r\n  if(/* axiosResponse.isAxiosError && */ !axiosResponse.response) {\r\n    return axiosResponse.message ? axiosResponse.message : 'Unknown network error';\r\n  }\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRiObject</b></summary>\r\n\r\nWe pull the information from the response to riObject (internal type of Request Manager).\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction getRiObject(axiosResponse, requestClass, Config) {\r\n\r\n  const ri = {\r\n    httpStatus  : -1,\r\n    contentType : '',\r\n    data        : {},\r\n    headers     : {}\r\n  }\r\n  const clearContentType = (contentType) => {\r\n    return contentType ? contentType.split(';')[0] : '';\r\n  }\r\n\r\n  // get status\r\n  if(axiosResponse.status) {\r\n    ri.httpStatus = axiosResponse.status;\r\n  } else if(axiosResponse.request &&  axiosResponse.request.status) {\r\n    ri.httpStatus = axiosResponse.request.status;\r\n  }\r\n\r\n  // get headers\r\n  if(axiosResponse.headers) {\r\n    ri.headers = axiosResponse.headers;\r\n  }\r\n\r\n  // get contentType\r\n  if( ri.headers['content-type']) {\r\n    ri.contentType = clearContentType( axiosResponse.headers['content-type'] );\r\n  }\r\n\r\n  // get data\r\n  if(axiosResponse.data){\r\n    ri.data = axiosResponse.data;\r\n\r\n    if(ri.data instanceof Blob){\r\n      ri.contentType = clearContentType( ri.data.type );\r\n    }\r\n  }\r\n\r\n  return ri;\r\n},\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n\r\n# Advantages\r\n\r\n- Ability to integrate into any js project (webpack, Vue, React, Next, Nuxt, Angular and ...).\r\n- 1 sending point for all requests.\r\n- The ability to create an sdk and reuse it in different projects.\r\n- Ease of use (grouping by type, uniformity, response prepare).\r\n- Query caching (optional, disabled by default).\r\n- Working with fake data.\r\n- Use of global error handlers (user notify)\r\n- Logger, Statistics, Loading, ...\r\n\r\nA lot of this requires integration with your system.\r\nThe final functionality is up to you to determine.\r\n\r\n\r\n# Disadvantages\r\n\r\n- There is no way to make a universal solution (the variety of APIs knows no boundaries).\r\n  Perhaps someone will need additional functionality.\r\n  Such cases are reduced to a minimum, but they can still happen.\r\n- Complexity. Integration with the API requires experience. You need to understand what is happening and where.\r\n  This solution makes it easier, but I always want it easier...\r\n- The solution is designed for communication via json.\r\n  To work with other formats (xml, yaml,...)\r\n  , you may need to use additional librari\r\n","readmeFilename":"readme.md","gitHead":"dabd627e933f51c2ac0dc731bc76491d403cb132","_id":"js-request-manager@2.0.0-alpha.7","_nodeVersion":"14.18.1","_npmVersion":"8.5.3","dist":{"integrity":"sha512-vgDApQ8vYuH4bPmeqDUtbOEcQrKQrtET4JDeVru4dV0ha5JR+uBW3EiyXKV5w0L4RJXxKdU+J30sgZ8VAw5K6Q==","shasum":"926b99c1d7a70d8dd90f33168931b523b1d80fa0","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-2.0.0-alpha.7.tgz","fileCount":85,"unpackedSize":692136,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGx2zLBQAu0teUa7pkKoHMzEp+XNTv/hYWffwXFZXrNHAiAZe9BypswZJOz2oRTROv5RLJ0mh/hha/PbrtiLyg4Z5A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJicwt+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoRpA/8D4l8M5Fncj8JGssSbouodeza4ml7MEgipLbsw8VRWpjaOaLI\r\nwUlnqqYBWJw6h9C6+vLayNEjqwsYNXPreNIMuaAjplfNlsWrROJfpVLaEAtf\r\n966djdpI66P/lm3xjFjNiDTLbjui2ryLBfI7DYO2K6245wZ+BVoSnjEqLXlt\r\nhC/GoiNBGTVrpJHvrAmlBMzy9iAi49LWpJu7ecMUO7RLJVitpZkN88hrZjPt\r\n11KNDak8RdUcEa6KHF74xYsrdWxwCr80OMLEUZzqxhmVpgzMO6QOb39ad4cm\r\nCWpiZxZ+DDEP/HeUP/PiRwjfa0xbN/fnJ7cFK6tDHv+P2SQNXtvm05ut/rTy\r\nSj5tr71MIosM2SrjQyFjWnVBQyswoxYNdGJPdCvXxzqXBD171rkJVI16OZiZ\r\nPDkRVnAbrVZ7pMwzWMYyMs1ITP0LpDVIa/Zk7667UjpytQnwqGJEpcvL/X9O\r\nd4J/LMPh+xHBWuxnVz2MZES6+VGsQa+Twwo6UWCtcE4U3NJNB4Ivd1iH2bCq\r\no89w0wsD3Oy9zeKRLfQukKGzwVro+ylFELxOYjAAXHW8+mfyIeC2t2sVuQgi\r\nIXpilJpaCRGEqPNRcnz9CkIagDro4e910kt85zb91EPs+iGA5Q+Jo0i9tyqP\r\ndmJOgyw8SCMXfzM0ADUTW/ICGcv6HG59Mx8=\r\n=FMmj\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_2.0.0-alpha.7_1651706749978_0.059311358596445984"},"_hasShrinkwrap":false},"2.0.0-alpha.8":{"name":"js-request-manager","version":"2.0.0-alpha.8","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack"},"devDependencies":{"@babel/core":"^7.17.7","@babel/plugin-proposal-class-properties":"^7.16.7","@babel/plugin-transform-runtime":"^7.17.0","@babel/preset-env":"^7.16.11","babel-loader":"^8.2.3","babel-plugin-webpack-aliases":"^1.1.3","eslint":"^8.11.0","eslint-plugin-oploshka":"^1.0.7","webpack":"^5.70.0","webpack-cli":"^4.9.2"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"readme":"# API request Manager.\r\n\r\nRequest Manager is a library for creating an sdk library for your server (API).\r\nThe API type doesn't matter, whether it's REST or RPC.\r\nAs a result, we get the opportunity to centrally process all requests.\r\nWe do not bother with converting data in the code, but only work with pure data.\r\nIt is better to see 1 time than to hear 100 times.\r\n\r\n[Documentation in Russian](readme.ru.md)\r\n\r\n# How it looks after setting up\r\n### async/await\r\n```js\r\ntry {\r\n  let responseData = await RequestManager.Auth.authorization({login: 'admin', password: 'pass'})\r\n  // ... user code for success response\r\n} catch (err) {\r\n  // ... user code for error response or server error\r\n  return;\r\n}\r\n```\r\n### Promise\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'}).then(\r\n  (result)  => { /* ... user code for success response */ },\r\n  (error)   => { /* ... user code for error response or server error */ }\r\n);\r\n```\r\n\r\n# Installation\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">NPM</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# npm install axios              # for use axios client\r\n# npm install node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# npm install js-file-download   # for file download (or use other)\r\n# # install\r\nnpm install js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Yarn</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# yarn add axios              # for use axios client\r\n# yarn add node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# yarn add js-file-download   # for file download (or use other)\r\n# # install\r\nyarn add js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">package.json</b></summary>\r\n\r\n```json5\r\n{\r\n  \"dependencies\": {\r\n    // \"axios\": \"^0.21.1\", or \"node-fetch\": \"^2.6.1\", or js fetch()\r\n    // js-file-download\": \"^0.4.12\", or other \r\n    \"js-request-manager\": \"^1.0.0\",\r\n    // ..\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n\r\n# Initialization (options):\r\n   - Copy [optimal example files](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmOptimalStructureCreate) to your project (recommended).\r\n   - Copy [minimal example file](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmSimpleCreate) to your project.\r\n   - or create a file manually.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Example of manual creation</b></summary>\r\n\r\n> ```js\r\n> import RequestManager from 'js-request-manager/src/RequestManager';\r\n> import RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n> // request sender\r\n> import axios from 'axios';\r\n> \r\n> const requestSchema = {\r\n>   Auth: {\r\n>     authorization: ({login, password}) => {\r\n>       return new RequestClass({\r\n>         name  : 'authorization',\r\n>         type  : 'POST',\r\n>         url   : 'api://authorize', // https://domain.test/api/authorize\r\n>         params: {\r\n>           get: {},\r\n>           post: {login, password},\r\n>         },\r\n>         responsePrepare: (data) => {\r\n>           return {token: data.jwt};\r\n>         },\r\n>         errorMessage: 'Not correct login or password',\r\n>       });\r\n>     },\r\n>   }\r\n> }\r\n> \r\n> const Config = {\r\n>   hostAlias: {\r\n>     api: 'https://domain.test/api',\r\n>   },\r\n>   Hook: {\r\n>     RequestPromise (requestPromise, settings) { console.log(requestPromise, settings); }\r\n>   },\r\n>   RequestClient: {\r\n>     async send(obj) { return await axios(obj); }\r\n>   }\r\n> }\r\n> \r\n> const RmSimpleCreate = RequestManager(requestSchema, Config);\r\n> \r\n> // optional (recommended use global request manager)\r\n> global.RequestManager = RmSimpleCreate\r\n> \r\n> export default RmSimpleCreate\r\n> \r\n> ```\r\n</details>\r\n\r\n\r\n# RequestManager accepts the following settings:\r\n```js\r\nconst RequestSchema = {/* ... request schema */ };\r\n\r\n// Config - all parameters are optional\r\nconst Config = {\r\n  hostAlias: {},\r\n  RequestPrepare: {\r\n    data(requestType, requestUrl, requestData) {\r\n      return requestData;\r\n    },\r\n    type(requestType, requestUrl, requestData) {\r\n      return requestType;\r\n    },\r\n    url(requestType, requestUrl, requestData) {\r\n      return requestUrl.getUrl();\r\n    },\r\n    requestClientDataPrepare(requestClientData, requestClass) {\r\n      return requestClientData;\r\n    },\r\n  },\r\n  ResponsePrepare: {\r\n    isError(riObject) {\r\n      return false;\r\n    },\r\n    getErrorInfo: async (riObject, requestClass, Config) => {\r\n      return {code: 'error', message: 'Undefined error', data: riObject}\r\n    },\r\n    getSuccessInfo: async (riObject, requestClass, Config) => {\r\n      return riObject.data\r\n    },\r\n  },\r\n  Hook: {\r\n    RequestPromise(requestPromise, settings) {\r\n      console.log(requestPromise, settings);\r\n    }\r\n  },\r\n  RequestClient: {\r\n    name: 'AXIOS', // or FETCH\r\n    async send(obj) {\r\n      return await axios(obj);\r\n    },\r\n    async fileDownload(data, ri, requestClass, Config) {\r\n      // add file download code\r\n      return {};\r\n    },\r\n    getRequestClientObject(requestObj, requestClass, Config) {\r\n      return requestObj;\r\n    },\r\n    isNetworkError(axiosResponse, requestClass, Config) {\r\n      return false;\r\n    }\r\n    getRiObject(axiosResponse, requestClass, Config) {\r\n      return {httpStatus: 200, contentType: '', data: {}, headers: {}};\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\n## RequestSchema setting information\r\n\r\nIt describes how we will group all our requests, what parameters they will accept and in what form they will be sent.\r\nWe can also change or replace the response data.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em\">RequestSchema</b></summary>\r\n\r\n```js\r\n// schema example\r\nconst RequestSchema = {\r\n  Auth: {\r\n    authorization: ({login, password})        => { return new RequestClass({/* ... */}); },\r\n    registration : ({email, login, password}) => { return new RequestClass({/* ... */}); },\r\n  },\r\n  News: {\r\n    getAll : ()           => { return new RequestClass({/* ... */}); },\r\n    getById: ({id})       => { return new RequestClass({/* ... */}); },\r\n    getOldNews: ()        => { return new RequestClass({/* ... */}); },\r\n    getNewNews: ()        => { return new RequestClass({/* ... */}); },\r\n    create:({name, desc}) => { return new RequestClass({/* ... */}); },\r\n    delete:({id})         => { return new RequestClass({/* ... */}); },\r\n  },\r\n  Tags: {\r\n    News: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n    User: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n  },\r\n  getTheme : ()           => { return new RequestClass({/* ... */}); },\r\n};\r\n```\r\nA single request is described by a function that accepts a single object and returns RequestClass\r\n\r\nAn example of how to call it\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'});\r\n\r\nRequestManager.News.getAll();\r\nRequestManager.News.getById({id});\r\n\r\nRequestManager.Tags.News.getAll();\r\nRequestManager.Tags.User.getAll({}).then(console.log, console.error);\r\n\r\nRequestManager.getTheme();\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">RequestSchema RequestClass</b></summary>\r\n\r\nThis is the class that we use to describe all our queries.\r\n```js\r\nimport RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n\r\nrequest = new RequestClass({\r\n  name : '',      // String - request name (need for debug or custom prepare)\r\n  type : '',      // String - request type [GET|POST|PUT|DELETE ... or other custom ]\r\n  url  : '',      // String - request url\r\n  params : {\r\n    get : {},     // Send GET params\r\n    post: {},     // Send POST params\r\n  },\r\n\r\n  responsePrepare: (response) => { // Function\r\n    return {token: response.jwt};  // change response\r\n  },\r\n\r\n  cache : false,        // Create request cache   \r\n  errorMessage: '',     // String or Function\r\n  // For load file\r\n  fileName: 'test.txt', // String or Function\r\n})\r\n```\r\n</details>\r\n\r\n\r\n## Config setting information\r\n\r\nHere we can change the standard behavior of the Request Manager, subscribe to events, set an alias for the url.\r\nNext, you can see detailed information on RequestSchema and Config\r\n\r\nConfig will be described in the form Config.[Type].[Sub type] = [Settings]\r\n\r\n------------------------------------------------------\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.hostAlias</b></summary>\r\n\r\nSetting an alias for the url.\r\nWe do this in order not to write full domain names in all requests.\r\nExample:\r\n```js\r\nconst hostAlias = {\r\n   auth   : 'https://auth.domain.test/api',\r\n   apiV1  : 'https://domain.test/api/v1',\r\n   apiV2  : 'https://v2.domain.test/api',\r\n};\r\n```\r\n\r\nIn the future, you can use abbreviations when describing queries\r\n```js\r\nRequestClass({ url: 'auth://authorize' /* ... */}); // url => https://auth.domain.test/api/authorize\r\nRequestClass({ url: 'apiV1://users'    /* ... */}); // url => https://domain.test/api/v1/users\r\nRequestClass({ url: 'apiV2://news'     /* ... */}); // url => https://v2.domain.test/api/news\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare</b></summary>\r\n\r\nIn this object, we can add/redefine/change/delete the data that will be in the request.\r\nRequestPrepare is an object. See the parameters (below) in Config.RequestPrepare.[Settings subtype].\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.data</b></summary>\r\n\r\n\r\nThis function allows you to change/supplement / replace the request data.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.data\r\nfunction RequestPrepare_data(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n     return { test: \"test\"} // replace requestData\r\n  }\r\n  \r\n  requestData.time = Date(); // add date in send request\r\n  \r\n  if(requestData.debugInfo) {\r\n    console.log(requestData.debugInfo) // view debug info\r\n    delete requestData.debugInfo;     // delete data (debugInfo) from the request\r\n  }\r\n   \r\n  if(requestData.arrayInfo) {\r\n    requestData.arrayInfo = JSON.stringify(requestData.arrayInfo) // replace/conver data\r\n  }\r\n  \r\n  return requestData;\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.type</b></summary>\r\n\r\nThis function allows you to change / replace the request type.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.type\r\nfunction RequestPrepare_type(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n    return 'POST' // replace requestType\r\n  }\r\n\r\n  const allowedRequestType = {\r\n    'GET': true,\r\n    'POST': true,\r\n  }\r\n  if(!allowedRequestType[requestType]) {\r\n    console.warn('Not correct request type', requestType)\r\n    return 'GET'; // replace\r\n  }\r\n  \r\n  return requestType; // return original request type\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.url</b></summary>\r\n\r\nThis function allows you to change/replace the request url.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.url\r\nfunction RequestPrepare_url(requestType, requestUrl, requestData) {\r\n  \r\n  if(requestType === 'POST-REPLACE') {\r\n    return 'https://test.domain.com/test-url' // replace url\r\n  }\r\n  \r\n   return requestUrl.getUrl(); // warning requestUrl - is RequestLinkClass\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.requestClientDataPrepare</b></summary>\r\n\r\nThis function allows you to change the object passed to axios or fetch.\r\nAdd headers, settings, etc.\r\n\r\n```js\r\nfunction RequestPrepare_requestClientDataPrepare(requestClientData, requestClass) {\r\n  let token = localStorage.getItem('user-token');\r\n  if (token) {\r\n    // add axios header\r\n    requestClientData.headers['Authorization'] = `Token ${token}`;\r\n  }\r\n  return requestClientData;\r\n},\r\n```\r\n\r\nps: this is a general callback\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare</b></summary>\r\n\r\nIn this block, we are working with the answer (we can change it).\r\nResponsePrepare is an object.\r\nSee the parameters (below) in Config.ResponsePrepare.[Settings subtype].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.isError</b></summary>\r\n\r\nHere we check whether the answer is an error\r\n```js\r\nfunction ResponsePrepare_isError(responseData){\r\n  if( !(200 <= riObject.httpStatus && riObject.httpStatus < 300) ) {\r\n    return true;\r\n  }\r\n  if(!riObject.data.success) {\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getErrorInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is true, then we are trying to get information about the error.\r\nWe give this information in the form of an object.\r\n```js\r\nasync function ResponsePrepare_getErrorInfo(riObject, requestClass, Config) => {\r\n  return {\r\n    code: 'error',\r\n    message: riObject.data.error || 'Unknown error',\r\n    data: riObject.data,\r\n  };\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getSuccessInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is false, then we get clean data from the response.\r\nLet's look at the example of the answer:\r\n\r\n```json5\r\n{ \"success\": true, \"result\": { \"a\": 1, \"b\": 2} } \r\n```\r\nIn this case, we want to get - {\"a\": 1, \"b\": 2}. To do this, use the following code:\r\n\r\n```js\r\nasync function ResponsePrepare_getSuccessInfo(riObject, requestClass, Config) => {\r\n  return riObject.data.result;\r\n};\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook</b></summary>\r\n\r\nHook - we can subscribe to Request Managera events.\r\nHook is an object.\r\nSee the parameters (below) in Config. Hook.[Subtype of settings].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook.RequestPromise</b></summary>\r\n\r\nThis event is called after the request is sent.\r\nIt is applicable for loading, maintaining statistics, logging, and displaying error messages\r\n```js\r\nfunction Hook_RequestPromise(requestPromise, settings){\r\n  requestPromise.then(\r\n    (result) => {},\r\n    (error) => {\r\n      alert(settings.errorMessage) // alert error\r\n    });\r\n};\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient</b></summary>\r\n\r\nThis function allows you to determine through which we will send the request.\r\nUsually axios or fetch is used (you can use others as well).\r\nIn the examples below, we will use axios.\r\n\r\nIn 99%, it is necessary to pass axios. This is done via Config.RequestClient.send.\r\nThe rest should work correctly!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\n\r\nOverriding the rest makes sense if you are using a different client for sending\r\nor axios has released a new version (not compatible with the old one).\r\n\r\nps: It is worth noting axios on the front and on the back - behaves a little differently\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.name</b></summary>\r\n\r\nHere we are talking about which preset Config.RequestClient to use (AXIOS | FETCH).\r\nBy default, the AXIOS preset will be used.\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.send</b></summary>\r\n\r\nHere we say that the sending will be via \"axios\".\r\n```js\r\nimport axios from 'axios';\r\n\r\nasync function RequestClient_send(obj) {\r\n  return await axios(obj);\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.fileDownload</b></summary>\r\n\r\nHere we say that we will upload files.\r\n```js\r\nimport fileDownload from 'js-file-download';\r\n\r\nasync fileDownload(data, ri, requestClass, Config) {\r\n  const download = async (data, ri, requestClass, Config) => {\r\n    let fileName = requestClass.getFileName();\r\n    fileDownload(ri.data, fileName, ri.contentType);\r\n  }\r\n  download(data, ri, requestClass, Config)\r\n  return {};\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRequestClientObject</b></summary>\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\nHere we convert the data from the RequestManagera request object to an axios object. We only convert it!\r\n```js\r\nfunction getRequestClientObject(requestObj, requestClass, Config) {\r\n  const axiosObj = {\r\n    method  : requestObj.type,\r\n    url     : requestObj.url,\r\n    headers : {}\r\n  };\r\n  // axiosObj.responseType = 'application/json';\r\n\r\n  if(requestClass.getFileName()){\r\n    axiosObj.responseType = 'blob';\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.get)){\r\n    axiosObj.params  = requestObj.data.get;\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.post)){\r\n    axiosObj.data    = requestObj.data.post;\r\n  }\r\n\r\n  if(requestObj.data.post instanceof FormData){\r\n    axiosObj.data    = requestObj.data.post;\r\n    axiosObj.headers['Content-Type'] = 'multipart/form-data';\r\n  }\r\n\r\n  return axiosObj;\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.isNetworkError</b></summary>\r\n\r\nIn js, network errors can't get much information.\r\nIf network errors occur, we handle them separately.\r\nIf this is a network error , we will return a message with the error text.\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction isNetworkError(axiosResponse, requestClass, Config) {\r\n  if(/* axiosResponse.isAxiosError && */ !axiosResponse.response) {\r\n    return axiosResponse.message ? axiosResponse.message : 'Unknown network error';\r\n  }\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRiObject</b></summary>\r\n\r\nWe pull the information from the response to riObject (internal type of Request Manager).\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction getRiObject(axiosResponse, requestClass, Config) {\r\n\r\n  const ri = {\r\n    httpStatus  : -1,\r\n    contentType : '',\r\n    data        : {},\r\n    headers     : {}\r\n  }\r\n  const clearContentType = (contentType) => {\r\n    return contentType ? contentType.split(';')[0] : '';\r\n  }\r\n\r\n  // get status\r\n  if(axiosResponse.status) {\r\n    ri.httpStatus = axiosResponse.status;\r\n  } else if(axiosResponse.request &&  axiosResponse.request.status) {\r\n    ri.httpStatus = axiosResponse.request.status;\r\n  }\r\n\r\n  // get headers\r\n  if(axiosResponse.headers) {\r\n    ri.headers = axiosResponse.headers;\r\n  }\r\n\r\n  // get contentType\r\n  if( ri.headers['content-type']) {\r\n    ri.contentType = clearContentType( axiosResponse.headers['content-type'] );\r\n  }\r\n\r\n  // get data\r\n  if(axiosResponse.data){\r\n    ri.data = axiosResponse.data;\r\n\r\n    if(ri.data instanceof Blob){\r\n      ri.contentType = clearContentType( ri.data.type );\r\n    }\r\n  }\r\n\r\n  return ri;\r\n},\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n\r\n# Advantages\r\n\r\n- Ability to integrate into any js project (webpack, Vue, React, Next, Nuxt, Angular and ...).\r\n- 1 sending point for all requests.\r\n- The ability to create an sdk and reuse it in different projects.\r\n- Ease of use (grouping by type, uniformity, response prepare).\r\n- Query caching (optional, disabled by default).\r\n- Working with fake data.\r\n- Use of global error handlers (user notify)\r\n- Logger, Statistics, Loading, ...\r\n\r\nA lot of this requires integration with your system.\r\nThe final functionality is up to you to determine.\r\n\r\n\r\n# Disadvantages\r\n\r\n- There is no way to make a universal solution (the variety of APIs knows no boundaries).\r\n  Perhaps someone will need additional functionality.\r\n  Such cases are reduced to a minimum, but they can still happen.\r\n- Complexity. Integration with the API requires experience. You need to understand what is happening and where.\r\n  This solution makes it easier, but I always want it easier...\r\n- The solution is designed for communication via json.\r\n  To work with other formats (xml, yaml,...)\r\n  , you may need to use additional librari\r\n","readmeFilename":"readme.md","gitHead":"dabd627e933f51c2ac0dc731bc76491d403cb132","_id":"js-request-manager@2.0.0-alpha.8","_nodeVersion":"14.18.1","_npmVersion":"8.5.3","dist":{"integrity":"sha512-oqfqcgdC8ePpQZNF7jtKWD/HNUicdx6dHOzFBkVd5dHnbyDUZOuthLt1fbmlZ33BuxUaDHRlTjqmUwfvKLna6w==","shasum":"9cf692234ddb82ca85055e038ded6000972604a4","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-2.0.0-alpha.8.tgz","fileCount":85,"unpackedSize":692121,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHpqr4Ir4fdD4GMi3S8LftX2tQcmtCXBbqkgdYkWzrUKAiEAhUW8hyOP1QyCtK74VYJwJkFUPpCZ4fGXc/rv+fAf+vA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJicwyEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTnA//YHsHwoGw5Ys0sFha6P6lHk25r75x38D51FfkIJZl+mcXzRP9\r\nqxlt25DAOyAZlHsEZwIB0TNa+UWT4UZB/EqMoitaRP6kJZysEDPgmyL6l+U7\r\n2LhtDVIwD7O385xUUnfpTtw6kckKu1SaBlyhCPcwx38NcRnQZJeN2KSBrS5y\r\ny+9BLsaS+++EfEHWvYUgkv5SNFwnVMyyt16rrlD9021vJ6NTmgddGhRjcBWX\r\n7BBKnMpNLo1NtGT994FvVwjy82NkWv0gwD4jdaadm6rV1qX3OxTTsWHOlQ1v\r\nN9mnUN9Kp7VRy/o4Avb/f8DECndIqR5Kr1yHGu0wLFXDiD6vLfTh+ZOK0eEI\r\nJkp3xOO7hHnarqF7psTIhaxxl9739nndro2CHiuVqcDsWw9Xz8FCQxoDoB0d\r\nfV42yDO7XMdTH7KcnQurHH2yRUGyTSXEbH98sMq8xqFg3KsoRhnWlGBXZLT+\r\nLhY91isoMnilag866Y7KQ98UsJRH4nQLmu0dwy+pcMQZrhpxzRfEtlZiXXgt\r\nMKypbxOYy0UmhDuZrl99rUgi3+sxgGSYee5+fWB/EzN/SGxuS5G+w2V8LPKm\r\nsFX3LbaGSGOLeQ2C7UnKaQps5mjU08FrJWWB0JylEe5s1Jh1zbosD/b5yUov\r\nz6t7m6XS/M7oWXCwP9nszLRALWqsYvGwhmM=\r\n=NKVf\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_2.0.0-alpha.8_1651707012710_0.9585934387317123"},"_hasShrinkwrap":false},"2.0.0-alpha.9":{"name":"js-request-manager","version":"2.0.0-alpha.9","description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"scripts":{"build":"webpack"},"devDependencies":{"@babel/core":"^7.17.7","@babel/plugin-proposal-class-properties":"^7.16.7","@babel/plugin-transform-runtime":"^7.17.0","@babel/preset-env":"^7.16.11","babel-loader":"^8.2.3","babel-plugin-webpack-aliases":"^1.1.3","eslint":"^8.11.0","eslint-plugin-oploshka":"^1.0.7","webpack":"^5.70.0","webpack-cli":"^4.9.2"},"keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"readme":"# API request Manager.\r\n\r\nRequest Manager is a library for creating an sdk library for your server (API).\r\nThe API type doesn't matter, whether it's REST or RPC.\r\nAs a result, we get the opportunity to centrally process all requests.\r\nWe do not bother with converting data in the code, but only work with pure data.\r\nIt is better to see 1 time than to hear 100 times.\r\n\r\n[Documentation in Russian](readme.ru.md)\r\n\r\n# How it looks after setting up\r\n### async/await\r\n```js\r\ntry {\r\n  let responseData = await RequestManager.Auth.authorization({login: 'admin', password: 'pass'})\r\n  // ... user code for success response\r\n} catch (err) {\r\n  // ... user code for error response or server error\r\n  return;\r\n}\r\n```\r\n### Promise\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'}).then(\r\n  (result)  => { /* ... user code for success response */ },\r\n  (error)   => { /* ... user code for error response or server error */ }\r\n);\r\n```\r\n\r\n# Installation\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">NPM</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# npm install axios              # for use axios client\r\n# npm install node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# npm install js-file-download   # for file download (or use other)\r\n# # install\r\nnpm install js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Yarn</b></summary>\r\n\r\n```shell\r\n# # install a request client, such as axios or fetch (or any other)\r\n# yarn add axios              # for use axios client\r\n# yarn add node-fetch         # for use fetch client in nodejs\r\n# # install file download (if necessary)\r\n# yarn add js-file-download   # for file download (or use other)\r\n# # install\r\nyarn add js-request-manager\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">package.json</b></summary>\r\n\r\n```json5\r\n{\r\n  \"dependencies\": {\r\n    // \"axios\": \"^0.21.1\", or \"node-fetch\": \"^2.6.1\", or js fetch()\r\n    // js-file-download\": \"^0.4.12\", or other \r\n    \"js-request-manager\": \"^1.0.0\",\r\n    // ..\r\n  }\r\n}\r\n```\r\n</details>\r\n\r\n\r\n# Initialization (options):\r\n   - Copy [optimal example files](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmOptimalStructureCreate) to your project (recommended).\r\n   - Copy [minimal example file](https://github.com/oploshka/js-request-manager/tree/develop/example/create/RmSimpleCreate) to your project.\r\n   - or create a file manually.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Example of manual creation</b></summary>\r\n\r\n> ```js\r\n> import RequestManager from 'js-request-manager/src/RequestManager';\r\n> import RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n> // request sender\r\n> import axios from 'axios';\r\n> \r\n> const requestSchema = {\r\n>   Auth: {\r\n>     authorization: ({login, password}) => {\r\n>       return new RequestClass({\r\n>         name  : 'authorization',\r\n>         type  : 'POST',\r\n>         url   : 'api://authorize', // https://domain.test/api/authorize\r\n>         params: {\r\n>           get: {},\r\n>           post: {login, password},\r\n>         },\r\n>         responsePrepare: (data) => {\r\n>           return {token: data.jwt};\r\n>         },\r\n>         errorMessage: 'Not correct login or password',\r\n>       });\r\n>     },\r\n>   }\r\n> }\r\n> \r\n> const Config = {\r\n>   hostAlias: {\r\n>     api: 'https://domain.test/api',\r\n>   },\r\n>   Hook: {\r\n>     RequestPromise (requestPromise, settings) { console.log(requestPromise, settings); }\r\n>   },\r\n>   RequestClient: {\r\n>     async send(obj) { return await axios(obj); }\r\n>   }\r\n> }\r\n> \r\n> const RmSimpleCreate = RequestManager(requestSchema, Config);\r\n> \r\n> // optional (recommended use global request manager)\r\n> global.RequestManager = RmSimpleCreate\r\n> \r\n> export default RmSimpleCreate\r\n> \r\n> ```\r\n</details>\r\n\r\n\r\n# RequestManager accepts the following settings:\r\n```js\r\nconst RequestSchema = {/* ... request schema */ };\r\n\r\n// Config - all parameters are optional\r\nconst Config = {\r\n  hostAlias: {},\r\n  RequestPrepare: {\r\n    data(requestType, requestUrl, requestData) {\r\n      return requestData;\r\n    },\r\n    type(requestType, requestUrl, requestData) {\r\n      return requestType;\r\n    },\r\n    url(requestType, requestUrl, requestData) {\r\n      return requestUrl.getUrl();\r\n    },\r\n    requestClientDataPrepare(requestClientData, requestClass) {\r\n      return requestClientData;\r\n    },\r\n  },\r\n  ResponsePrepare: {\r\n    isError(riObject) {\r\n      return false;\r\n    },\r\n    getErrorInfo: async (riObject, requestClass, Config) => {\r\n      return {code: 'error', message: 'Undefined error', data: riObject}\r\n    },\r\n    getSuccessInfo: async (riObject, requestClass, Config) => {\r\n      return riObject.data\r\n    },\r\n  },\r\n  Hook: {\r\n    RequestPromise(requestPromise, settings) {\r\n      console.log(requestPromise, settings);\r\n    }\r\n  },\r\n  RequestClient: {\r\n    name: 'AXIOS', // or FETCH\r\n    async send(obj) {\r\n      return await axios(obj);\r\n    },\r\n    async fileDownload(data, ri, requestClass, Config) {\r\n      // add file download code\r\n      return {};\r\n    },\r\n    getRequestClientObject(requestObj, requestClass, Config) {\r\n      return requestObj;\r\n    },\r\n    isNetworkError(axiosResponse, requestClass, Config) {\r\n      return false;\r\n    }\r\n    getRiObject(axiosResponse, requestClass, Config) {\r\n      return {httpStatus: 200, contentType: '', data: {}, headers: {}};\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\n## RequestSchema setting information\r\n\r\nIt describes how we will group all our requests, what parameters they will accept and in what form they will be sent.\r\nWe can also change or replace the response data.\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em\">RequestSchema</b></summary>\r\n\r\n```js\r\n// schema example\r\nconst RequestSchema = {\r\n  Auth: {\r\n    authorization: ({login, password})        => { return new RequestClass({/* ... */}); },\r\n    registration : ({email, login, password}) => { return new RequestClass({/* ... */}); },\r\n  },\r\n  News: {\r\n    getAll : ()           => { return new RequestClass({/* ... */}); },\r\n    getById: ({id})       => { return new RequestClass({/* ... */}); },\r\n    getOldNews: ()        => { return new RequestClass({/* ... */}); },\r\n    getNewNews: ()        => { return new RequestClass({/* ... */}); },\r\n    create:({name, desc}) => { return new RequestClass({/* ... */}); },\r\n    delete:({id})         => { return new RequestClass({/* ... */}); },\r\n  },\r\n  Tags: {\r\n    News: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n    User: {\r\n      getAll : ()         => { return new RequestClass({/* ... */}); },\r\n    },\r\n  },\r\n  getTheme : ()           => { return new RequestClass({/* ... */}); },\r\n};\r\n```\r\nA single request is described by a function that accepts a single object and returns RequestClass\r\n\r\nAn example of how to call it\r\n```js\r\nRequestManager.Auth.authorization({login: 'admin', password: 'pass'});\r\n\r\nRequestManager.News.getAll();\r\nRequestManager.News.getById({id});\r\n\r\nRequestManager.Tags.News.getAll();\r\nRequestManager.Tags.User.getAll({}).then(console.log, console.error);\r\n\r\nRequestManager.getTheme();\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">RequestSchema RequestClass</b></summary>\r\n\r\nThis is the class that we use to describe all our queries.\r\n```js\r\nimport RequestClass   from \"js-request-manager/src/Class/RequestClass\";\r\n\r\nrequest = new RequestClass({\r\n  name : '',      // String - request name (need for debug or custom prepare)\r\n  type : '',      // String - request type [GET|POST|PUT|DELETE ... or other custom ]\r\n  url  : '',      // String - request url\r\n  params : {\r\n    get : {},     // Send GET params\r\n    post: {},     // Send POST params\r\n  },\r\n\r\n  responsePrepare: (response) => { // Function\r\n    return {token: response.jwt};  // change response\r\n  },\r\n\r\n  cache : false,        // Create request cache   \r\n  errorMessage: '',     // String or Function\r\n  // For load file\r\n  fileName: 'test.txt', // String or Function\r\n})\r\n```\r\n</details>\r\n\r\n\r\n## Config setting information\r\n\r\nHere we can change the standard behavior of the Request Manager, subscribe to events, set an alias for the url.\r\nNext, you can see detailed information on RequestSchema and Config\r\n\r\nConfig will be described in the form Config.[Type].[Sub type] = [Settings]\r\n\r\n------------------------------------------------------\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.hostAlias</b></summary>\r\n\r\nSetting an alias for the url.\r\nWe do this in order not to write full domain names in all requests.\r\nExample:\r\n```js\r\nconst hostAlias = {\r\n   auth   : 'https://auth.domain.test/api',\r\n   apiV1  : 'https://domain.test/api/v1',\r\n   apiV2  : 'https://v2.domain.test/api',\r\n};\r\n```\r\n\r\nIn the future, you can use abbreviations when describing queries\r\n```js\r\nRequestClass({ url: 'auth://authorize' /* ... */}); // url => https://auth.domain.test/api/authorize\r\nRequestClass({ url: 'apiV1://users'    /* ... */}); // url => https://domain.test/api/v1/users\r\nRequestClass({ url: 'apiV2://news'     /* ... */}); // url => https://v2.domain.test/api/news\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare</b></summary>\r\n\r\nIn this object, we can add/redefine/change/delete the data that will be in the request.\r\nRequestPrepare is an object. See the parameters (below) in Config.RequestPrepare.[Settings subtype].\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.data</b></summary>\r\n\r\n\r\nThis function allows you to change/supplement / replace the request data.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.data\r\nfunction RequestPrepare_data(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n     return { test: \"test\"} // replace requestData\r\n  }\r\n  \r\n  requestData.time = Date(); // add date in send request\r\n  \r\n  if(requestData.debugInfo) {\r\n    console.log(requestData.debugInfo) // view debug info\r\n    delete requestData.debugInfo;     // delete data (debugInfo) from the request\r\n  }\r\n   \r\n  if(requestData.arrayInfo) {\r\n    requestData.arrayInfo = JSON.stringify(requestData.arrayInfo) // replace/conver data\r\n  }\r\n  \r\n  return requestData;\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.type</b></summary>\r\n\r\nThis function allows you to change / replace the request type.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.type\r\nfunction RequestPrepare_type(requestType, requestUrl, requestData) {\r\n  if(requestType === 'POST-REPLACE') { // add new types of queries if you understand what this is for.\r\n    return 'POST' // replace requestType\r\n  }\r\n\r\n  const allowedRequestType = {\r\n    'GET': true,\r\n    'POST': true,\r\n  }\r\n  if(!allowedRequestType[requestType]) {\r\n    console.warn('Not correct request type', requestType)\r\n    return 'GET'; // replace\r\n  }\r\n  \r\n  return requestType; // return original request type\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.url</b></summary>\r\n\r\nThis function allows you to change/replace the request url.\r\nThis works for all requests!!!\r\n```js\r\n// example Config.RequestPrepare.url\r\nfunction RequestPrepare_url(requestType, requestUrl, requestData) {\r\n  \r\n  if(requestType === 'POST-REPLACE') {\r\n    return 'https://test.domain.com/test-url' // replace url\r\n  }\r\n  \r\n   return requestUrl.getUrl(); // warning requestUrl - is RequestLinkClass\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestPrepare.requestClientDataPrepare</b></summary>\r\n\r\nThis function allows you to change the object passed to axios or fetch.\r\nAdd headers, settings, etc.\r\n\r\n```js\r\nfunction RequestPrepare_requestClientDataPrepare(requestClientData, requestClass) {\r\n  let token = localStorage.getItem('user-token');\r\n  if (token) {\r\n    // add axios header\r\n    requestClientData.headers['Authorization'] = `Token ${token}`;\r\n  }\r\n  return requestClientData;\r\n},\r\n```\r\n\r\nps: this is a general callback\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare</b></summary>\r\n\r\nIn this block, we are working with the answer (we can change it).\r\nResponsePrepare is an object.\r\nSee the parameters (below) in Config.ResponsePrepare.[Settings subtype].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.isError</b></summary>\r\n\r\nHere we check whether the answer is an error\r\n```js\r\nfunction ResponsePrepare_isError(responseData){\r\n  if( !(200 <= riObject.httpStatus && riObject.httpStatus < 300) ) {\r\n    return true;\r\n  }\r\n  if(!riObject.data.success) {\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getErrorInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is true, then we are trying to get information about the error.\r\nWe give this information in the form of an object.\r\n```js\r\nasync function ResponsePrepare_getErrorInfo(riObject, requestClass, Config) => {\r\n  return {\r\n    code: 'error',\r\n    message: riObject.data.error || 'Unknown error',\r\n    data: riObject.data,\r\n  };\r\n};\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.ResponsePrepare.getSuccessInfo</b></summary>\r\n\r\nIf ResponsePrepare_isError is false, then we get clean data from the response.\r\nLet's look at the example of the answer:\r\n\r\n```json5\r\n{ \"success\": true, \"result\": { \"a\": 1, \"b\": 2} } \r\n```\r\nIn this case, we want to get - {\"a\": 1, \"b\": 2}. To do this, use the following code:\r\n\r\n```js\r\nasync function ResponsePrepare_getSuccessInfo(riObject, requestClass, Config) => {\r\n  return riObject.data.result;\r\n};\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook</b></summary>\r\n\r\nHook - we can subscribe to Request Managera events.\r\nHook is an object.\r\nSee the parameters (below) in Config. Hook.[Subtype of settings].\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.Hook.RequestPromise</b></summary>\r\n\r\nThis event is called after the request is sent.\r\nIt is applicable for loading, maintaining statistics, logging, and displaying error messages\r\n```js\r\nfunction Hook_RequestPromise(requestPromise, settings){\r\n  requestPromise.then(\r\n    (result) => {},\r\n    (error) => {\r\n      alert(settings.errorMessage) // alert error\r\n    });\r\n};\r\n```\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n<details open>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient</b></summary>\r\n\r\nThis function allows you to determine through which we will send the request.\r\nUsually axios or fetch is used (you can use others as well).\r\nIn the examples below, we will use axios.\r\n\r\nIn 99%, it is necessary to pass axios. This is done via Config.RequestClient.send.\r\nThe rest should work correctly!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\n\r\nOverriding the rest makes sense if you are using a different client for sending\r\nor axios has released a new version (not compatible with the old one).\r\n\r\nps: It is worth noting axios on the front and on the back - behaves a little differently\r\n\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.name</b></summary>\r\n\r\nHere we are talking about which preset Config.RequestClient to use (AXIOS | FETCH).\r\nBy default, the AXIOS preset will be used.\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.send</b></summary>\r\n\r\nHere we say that the sending will be via \"axios\".\r\n```js\r\nimport axios from 'axios';\r\n\r\nasync function RequestClient_send(obj) {\r\n  return await axios(obj);\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.fileDownload</b></summary>\r\n\r\nHere we say that we will upload files.\r\n```js\r\nimport fileDownload from 'js-file-download';\r\n\r\nasync fileDownload(data, ri, requestClass, Config) {\r\n  const download = async (data, ri, requestClass, Config) => {\r\n    let fileName = requestClass.getFileName();\r\n    fileDownload(ri.data, fileName, ri.contentType);\r\n  }\r\n  download(data, ri, requestClass, Config)\r\n  return {};\r\n}\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRequestClientObject</b></summary>\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\nTo add custom tokens, headers (and so on) to axiosObj, use \" Config.RequestPrepare.requestClientDataPrepare\"\r\nHere we convert the data from the RequestManagera request object to an axios object. We only convert it!\r\n```js\r\nfunction getRequestClientObject(requestObj, requestClass, Config) {\r\n  const axiosObj = {\r\n    method  : requestObj.type,\r\n    url     : requestObj.url,\r\n    headers : {}\r\n  };\r\n  // axiosObj.responseType = 'application/json';\r\n\r\n  if(requestClass.getFileName()){\r\n    axiosObj.responseType = 'blob';\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.get)){\r\n    axiosObj.params  = requestObj.data.get;\r\n  }\r\n\r\n  if(!isEmpty(requestObj.data.post)){\r\n    axiosObj.data    = requestObj.data.post;\r\n  }\r\n\r\n  if(requestObj.data.post instanceof FormData){\r\n    axiosObj.data    = requestObj.data.post;\r\n    axiosObj.headers['Content-Type'] = 'multipart/form-data';\r\n  }\r\n\r\n  return axiosObj;\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.isNetworkError</b></summary>\r\n\r\nIn js, network errors can't get much information.\r\nIf network errors occur, we handle them separately.\r\nIf this is a network error , we will return a message with the error text.\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction isNetworkError(axiosResponse, requestClass, Config) {\r\n  if(/* axiosResponse.isAxiosError && */ !axiosResponse.response) {\r\n    return axiosResponse.message ? axiosResponse.message : 'Unknown network error';\r\n  }\r\n},\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary><b style=\"font-size: 1.3em;\">Config.RequestClient.getRiObject</b></summary>\r\n\r\nWe pull the information from the response to riObject (internal type of Request Manager).\r\n\r\nThis setting works correctly in most cases.\r\nThere is no need to redefine it without an urgent need!\r\n```js\r\nfunction getRiObject(axiosResponse, requestClass, Config) {\r\n\r\n  const ri = {\r\n    httpStatus  : -1,\r\n    contentType : '',\r\n    data        : {},\r\n    headers     : {}\r\n  }\r\n  const clearContentType = (contentType) => {\r\n    return contentType ? contentType.split(';')[0] : '';\r\n  }\r\n\r\n  // get status\r\n  if(axiosResponse.status) {\r\n    ri.httpStatus = axiosResponse.status;\r\n  } else if(axiosResponse.request &&  axiosResponse.request.status) {\r\n    ri.httpStatus = axiosResponse.request.status;\r\n  }\r\n\r\n  // get headers\r\n  if(axiosResponse.headers) {\r\n    ri.headers = axiosResponse.headers;\r\n  }\r\n\r\n  // get contentType\r\n  if( ri.headers['content-type']) {\r\n    ri.contentType = clearContentType( axiosResponse.headers['content-type'] );\r\n  }\r\n\r\n  // get data\r\n  if(axiosResponse.data){\r\n    ri.data = axiosResponse.data;\r\n\r\n    if(ri.data instanceof Blob){\r\n      ri.contentType = clearContentType( ri.data.type );\r\n    }\r\n  }\r\n\r\n  return ri;\r\n},\r\n```\r\n\r\n</details>\r\n\r\n------------------------------------------------------\r\n\r\n\r\n# Advantages\r\n\r\n- Ability to integrate into any js project (webpack, Vue, React, Next, Nuxt, Angular and ...).\r\n- 1 sending point for all requests.\r\n- The ability to create an sdk and reuse it in different projects.\r\n- Ease of use (grouping by type, uniformity, response prepare).\r\n- Query caching (optional, disabled by default).\r\n- Working with fake data.\r\n- Use of global error handlers (user notify)\r\n- Logger, Statistics, Loading, ...\r\n\r\nA lot of this requires integration with your system.\r\nThe final functionality is up to you to determine.\r\n\r\n\r\n# Disadvantages\r\n\r\n- There is no way to make a universal solution (the variety of APIs knows no boundaries).\r\n  Perhaps someone will need additional functionality.\r\n  Such cases are reduced to a minimum, but they can still happen.\r\n- Complexity. Integration with the API requires experience. You need to understand what is happening and where.\r\n  This solution makes it easier, but I always want it easier...\r\n- The solution is designed for communication via json.\r\n  To work with other formats (xml, yaml,...)\r\n  , you may need to use additional librari\r\n","readmeFilename":"readme.md","gitHead":"159365f3c435fa25cf1c947b08d9415d26ce354e","_id":"js-request-manager@2.0.0-alpha.9","_nodeVersion":"14.18.1","_npmVersion":"8.5.3","dist":{"integrity":"sha512-2vq0UtxovUOE54k615eiii2aYJ764GQYIFvplUa2ISBKDB3o+yvZZQomMtdROCrmwabKunA935uIrQ/TIrkBYA==","shasum":"92b6d0b2fe55e9f52fcbf37e5cba26f1f9dbe446","tarball":"https://registry.npmjs.org/js-request-manager/-/js-request-manager-2.0.0-alpha.9.tgz","fileCount":85,"unpackedSize":692135,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAFygcrUzC4fDj5P1+XdAC2Y/95cDqBfjjUpcMO4PN5sAiABWljJUku1ZeGQ56XYaKfnKUcS/ZbKiG6g7qgg7eJE3Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJic5IHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpobg//YO0CeMsYc3hLLPbDLceFA7ndVwm8YfTNlnVG2e80xNubu8pt\r\ne/0V7tPEbrqhvVeGjUAGxQiMAR4QVZGMy0Aqv4zrFjgy0xO4t07PuU+EjCXU\r\naASkj6z/uFqfIqzksY2EecbF9Sfmwaw60IYGNfS5GxFUY05uC1pwzrgHIHim\r\nLSSUyeADsdiyhv328r8DPNpbp6S7/UUC6kNAnBtzylq/sF879M7dZv4rJfgo\r\n+CXS37LXeNSx+j5CLO+QCZufMSsOmGxjRtyFhd7D3DiL/DhMy2onphVHzEk6\r\nca/qZr3I8X8BXtVxszt8bagXB3E2Ppywit/Dq8rMUEUuMowzMe9mLGoiYrFl\r\nW8NglZ+7Fok1ufpyClztET2j2C8/WBmqEZ48aSE3gknxZ1zsWOyyNqZgctWK\r\n3REZ597PkR18B1jl27VPJsd+/keJrkv3Rg3/yC1KdxbeIYiL+FimOpXvAiTZ\r\nYZnMLoYKYnCMRBX+Tas/wTb3VXEUAc0Qci8t9PXCUJnser+Wm25bOrnAj/Hv\r\n0IkO1nSAsdaOgswlbiSlbvQplP7Amm1hkm07/nWeboyn4vNBIlvgVrmbWXwP\r\n8fnFs4CqESnVvYCvV15rSyVtvoQEqobUj9CeexgrIgyUDDDdD5ta+YziIPP+\r\nXwSeRgizd+AZQAC1vtwbaXiM8ubrxVSzz0k=\r\n=Vp2M\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"oploshka","email":"ectb08@mail.ru"},"directories":{},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-request-manager_2.0.0-alpha.9_1651741191623_0.5671412731703611"},"_hasShrinkwrap":false}},"time":{"created":"2021-07-04T14:16:02.327Z","0.1.0":"2021-07-04T14:16:02.467Z","modified":"2022-05-06T19:23:53.897Z","0.1.1":"2021-07-04T15:07:13.095Z","0.1.2":"2021-07-04T15:17:14.223Z","0.1.3":"2021-07-04T15:44:23.247Z","0.2.0":"2021-07-04T18:54:35.145Z","0.2.1":"2021-07-04T19:47:05.320Z","0.2.2":"2021-07-04T21:54:44.970Z","0.2.3":"2021-07-05T11:19:42.894Z","0.3.0-beta.0":"2021-07-10T17:49:16.519Z","0.3.1-beta.0":"2021-07-12T22:00:07.782Z","1.0.0-beta.0":"2021-07-14T18:22:58.919Z","1.0.0-beta.1":"2021-07-14T19:43:21.862Z","1.0.0-beta.2":"2021-07-14T21:34:41.899Z","1.0.0-beta.3":"2021-07-14T21:51:43.026Z","1.0.0-beta.4":"2021-07-14T22:31:57.814Z","1.0.0-beta.5":"2021-07-15T17:08:29.057Z","1.0.0":"2021-07-15T17:15:21.139Z","1.0.1":"2021-07-15T17:36:36.987Z","1.1.1":"2021-07-17T14:36:58.263Z","1.1.2":"2021-07-17T17:30:03.043Z","1.2.0":"2021-07-19T14:00:59.148Z","1.2.1":"2021-08-04T07:00:48.541Z","1.2.2":"2021-08-04T07:10:14.411Z","2.0.0-alpha.2":"2022-04-15T01:23:31.601Z","2.0.0-alpha.3":"2022-04-15T01:56:02.448Z","2.0.0-alpha.4":"2022-04-15T02:00:50.940Z","2.0.0-alpha.5":"2022-04-15T02:09:41.182Z","2.0.0-alpha.6":"2022-04-19T23:14:45.300Z","2.0.0-alpha.7":"2022-05-04T23:25:50.255Z","2.0.0-alpha.8":"2022-05-04T23:30:12.886Z","2.0.0-alpha.9":"2022-05-05T08:59:51.860Z"},"maintainers":[{"name":"oploshka","email":"ectb08@mail.ru"}],"description":"JS Request Manager is a library for creating an sdk library for your server (API). The API type doesn't matter, whether it's REST or RPC","homepage":"https://github.com/oploshka/js-request-manager#readme","keywords":["js request manager","api request manager","rpc request manager","request manager","api manager","rpc manager","api request","rpc request","batch request","request","api","apis","rest","rpc","manager","batch"],"repository":{"type":"git","url":"git+ssh://git@github.com/oploshka/js-request-manager.git"},"author":{"name":"Andrey Tyurin","email":"ectb08@mail.ru"},"bugs":{"url":"https://github.com/oploshka/js-request-manager/issues"},"license":"MIT","readme":"","readmeFilename":""}